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