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