1b4d38c65Smrg/*
2b4d38c65Smrg * Copyright 2012 Red Hat, Inc.
3b4d38c65Smrg *
4b4d38c65Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5b4d38c65Smrg * copy of this software and associated documentation files (the "Software"),
6b4d38c65Smrg * to deal in the Software without restriction, including without limitation
7b4d38c65Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b4d38c65Smrg * and/or sell copies of the Software, and to permit persons to whom the
9b4d38c65Smrg * Software is furnished to do so, subject to the following conditions:
10b4d38c65Smrg *
11b4d38c65Smrg * The above copyright notice and this permission notice (including the next
12b4d38c65Smrg * paragraph) shall be included in all copies or substantial portions of the
13b4d38c65Smrg * Software.
14b4d38c65Smrg *
15b4d38c65Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16b4d38c65Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17b4d38c65Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18b4d38c65Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19b4d38c65Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20b4d38c65Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21b4d38c65Smrg * DEALINGS IN THE SOFTWARE.
22b4d38c65Smrg *
23b4d38c65Smrg * Author: Dave Airlie <airlied@redhat.com>
24b4d38c65Smrg */
25b4d38c65Smrg
26b4d38c65Smrg/* this file provides API compat between server post 1.13 and pre it,
27b4d38c65Smrg   it should be reused inside as many drivers as possible */
28b4d38c65Smrg#ifndef COMPAT_API_H
29b4d38c65Smrg#define COMPAT_API_H
30b4d38c65Smrg
31b4d38c65Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
32b4d38c65Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
33b4d38c65Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
34b4d38c65Smrg#endif
35b4d38c65Smrg
36b4d38c65Smrg#ifndef XF86_HAS_SCRN_CONV
37b4d38c65Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
38b4d38c65Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
39b4d38c65Smrg#endif
40b4d38c65Smrg
41b4d38c65Smrg#ifndef XF86_SCRN_INTERFACE
42b4d38c65Smrg
43b4d38c65Smrg#define SCRN_ARG_TYPE int
44b4d38c65Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
45b4d38c65Smrg
46b4d38c65Smrg#define SCREEN_ARG_TYPE int
47b4d38c65Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
48b4d38c65Smrg
49b4d38c65Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
50b4d38c65Smrg
51b4d38c65Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
52b4d38c65Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
53b4d38c65Smrg
54b4d38c65Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
55b4d38c65Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
56b4d38c65Smrg
57b4d38c65Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
58b4d38c65Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
59b4d38c65Smrg
60b4d38c65Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
61b4d38c65Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
62b4d38c65Smrg
63b4d38c65Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
64b4d38c65Smrg
65b4d38c65Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
66b4d38c65Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0
67b4d38c65Smrg
68b4d38c65Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
69b4d38c65Smrg#else
70b4d38c65Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
71b4d38c65Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
72b4d38c65Smrg
73b4d38c65Smrg#define SCREEN_ARG_TYPE ScreenPtr
74b4d38c65Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
75b4d38c65Smrg
76b4d38c65Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
77b4d38c65Smrg
78b4d38c65Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
79b4d38c65Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
80b4d38c65Smrg
81b4d38c65Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
82b4d38c65Smrg#define CLOSE_SCREEN_ARGS pScreen
83b4d38c65Smrg
84b4d38c65Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
85b4d38c65Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
86b4d38c65Smrg
87b4d38c65Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
88b4d38c65Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
89b4d38c65Smrg
90b4d38c65Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
91b4d38c65Smrg
92b4d38c65Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
93b4d38c65Smrg#define VT_FUNC_ARGS pScrn
94b4d38c65Smrg
95b4d38c65Smrg#define XF86_SCRN_ARG(x) (x)
96b4d38c65Smrg
97b4d38c65Smrg#endif
98b4d38c65Smrg
99b4d38c65Smrg#endif
100