1880c7e28Smrg/*
2880c7e28Smrg * Copyright 2012 Red Hat, Inc.
3880c7e28Smrg *
4880c7e28Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5880c7e28Smrg * copy of this software and associated documentation files (the "Software"),
6880c7e28Smrg * to deal in the Software without restriction, including without limitation
7880c7e28Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8880c7e28Smrg * and/or sell copies of the Software, and to permit persons to whom the
9880c7e28Smrg * Software is furnished to do so, subject to the following conditions:
10880c7e28Smrg *
11880c7e28Smrg * The above copyright notice and this permission notice (including the next
12880c7e28Smrg * paragraph) shall be included in all copies or substantial portions of the
13880c7e28Smrg * Software.
14880c7e28Smrg *
15880c7e28Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16880c7e28Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17880c7e28Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18880c7e28Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19880c7e28Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20880c7e28Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21880c7e28Smrg * DEALINGS IN THE SOFTWARE.
22880c7e28Smrg *
23880c7e28Smrg * Author: Dave Airlie <airlied@redhat.com>
24880c7e28Smrg */
25880c7e28Smrg
26880c7e28Smrg/* this file provides API compat between server post 1.13 and pre it,
27880c7e28Smrg   it should be reused inside as many drivers as possible */
28880c7e28Smrg#ifndef COMPAT_API_H
29880c7e28Smrg#define COMPAT_API_H
30880c7e28Smrg
31880c7e28Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
32880c7e28Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
33880c7e28Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
34880c7e28Smrg#endif
35880c7e28Smrg
36880c7e28Smrg#ifndef XF86_HAS_SCRN_CONV
37880c7e28Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
38880c7e28Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
39880c7e28Smrg#endif
40880c7e28Smrg
41880c7e28Smrg#ifndef XF86_SCRN_INTERFACE
42880c7e28Smrg
43880c7e28Smrg#define SCRN_ARG_TYPE int
44880c7e28Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScreenInfo = xf86Screens[(arg1)]
45880c7e28Smrg
46880c7e28Smrg#define SCREEN_ARG_TYPE int
47880c7e28Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
48880c7e28Smrg
49880c7e28Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
50880c7e28Smrg
51880c7e28Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
52880c7e28Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
53880c7e28Smrg
54880c7e28Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
55880c7e28Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
56880c7e28Smrg
57880c7e28Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
58880c7e28Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
59880c7e28Smrg
60880c7e28Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
61880c7e28Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
62880c7e28Smrg
63880c7e28Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
64880c7e28Smrg
65880c7e28Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
66880c7e28Smrg#define VT_FUNC_ARGS pScreenInfo->scrnIndex, 0
67880c7e28Smrg
68880c7e28Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
69880c7e28Smrg#else
70880c7e28Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
71880c7e28Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScreenInfo = (arg1)
72880c7e28Smrg
73880c7e28Smrg#define SCREEN_ARG_TYPE ScreenPtr
74880c7e28Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
75880c7e28Smrg
76880c7e28Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
77880c7e28Smrg
78880c7e28Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
79880c7e28Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
80880c7e28Smrg
81880c7e28Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
82880c7e28Smrg#define CLOSE_SCREEN_ARGS pScreen
83880c7e28Smrg
84880c7e28Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
85880c7e28Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
86880c7e28Smrg
87880c7e28Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
88880c7e28Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
89880c7e28Smrg
90880c7e28Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
91880c7e28Smrg
92880c7e28Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
93880c7e28Smrg#define VT_FUNC_ARGS pScreenInfo
94880c7e28Smrg
95880c7e28Smrg#define XF86_SCRN_ARG(x) (x)
96880c7e28Smrg
97880c7e28Smrg#endif
98880c7e28Smrg
99880c7e28Smrg#endif
100