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