1898d24fdSmacallan/*
2898d24fdSmacallan * Copyright 2012 Red Hat, Inc.
3898d24fdSmacallan *
4898d24fdSmacallan * Permission is hereby granted, free of charge, to any person obtaining a
5898d24fdSmacallan * copy of this software and associated documentation files (the "Software"),
6898d24fdSmacallan * to deal in the Software without restriction, including without limitation
7898d24fdSmacallan * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8898d24fdSmacallan * and/or sell copies of the Software, and to permit persons to whom the
9898d24fdSmacallan * Software is furnished to do so, subject to the following conditions:
10898d24fdSmacallan *
11898d24fdSmacallan * The above copyright notice and this permission notice (including the next
12898d24fdSmacallan * paragraph) shall be included in all copies or substantial portions of the
13898d24fdSmacallan * Software.
14898d24fdSmacallan *
15898d24fdSmacallan * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16898d24fdSmacallan * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17898d24fdSmacallan * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18898d24fdSmacallan * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19898d24fdSmacallan * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20898d24fdSmacallan * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21898d24fdSmacallan * DEALINGS IN THE SOFTWARE.
22898d24fdSmacallan *
23898d24fdSmacallan * Author: Dave Airlie <airlied@redhat.com>
24898d24fdSmacallan */
25898d24fdSmacallan
26898d24fdSmacallan/* this file provides API compat between server post 1.13 and pre it,
27898d24fdSmacallan   it should be reused inside as many drivers as possible */
28898d24fdSmacallan#ifndef COMPAT_API_H
29898d24fdSmacallan#define COMPAT_API_H
30898d24fdSmacallan
31898d24fdSmacallan#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
32898d24fdSmacallan#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
33898d24fdSmacallan#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
34898d24fdSmacallan#endif
35898d24fdSmacallan
36898d24fdSmacallan#ifndef XF86_HAS_SCRN_CONV
37898d24fdSmacallan#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
38898d24fdSmacallan#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
39898d24fdSmacallan#endif
40898d24fdSmacallan
41898d24fdSmacallan#ifndef XF86_SCRN_INTERFACE
42898d24fdSmacallan
43898d24fdSmacallan#define SCRN_ARG_TYPE int
44898d24fdSmacallan#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
45898d24fdSmacallan
46898d24fdSmacallan#define SCREEN_ARG_TYPE int
47898d24fdSmacallan#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
48898d24fdSmacallan
49898d24fdSmacallan#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
50898d24fdSmacallan
51898d24fdSmacallan#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
52898d24fdSmacallan#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
53898d24fdSmacallan
54898d24fdSmacallan#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
55898d24fdSmacallan#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
56898d24fdSmacallan
57898d24fdSmacallan#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
58898d24fdSmacallan#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
59898d24fdSmacallan
60898d24fdSmacallan#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
61898d24fdSmacallan#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
62898d24fdSmacallan
63898d24fdSmacallan#define FREE_SCREEN_ARGS_DECL int arg, int flags
64898d24fdSmacallan
65898d24fdSmacallan#define VT_FUNC_ARGS_DECL int arg, int flags
66898d24fdSmacallan#define VT_FUNC_ARGS pScrn->scrnIndex, 0
67898d24fdSmacallan
68898d24fdSmacallan#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
69898d24fdSmacallan#else
70898d24fdSmacallan#define SCRN_ARG_TYPE ScrnInfoPtr
71898d24fdSmacallan#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
72898d24fdSmacallan
73898d24fdSmacallan#define SCREEN_ARG_TYPE ScreenPtr
74898d24fdSmacallan#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
75898d24fdSmacallan
76898d24fdSmacallan#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
77898d24fdSmacallan
78898d24fdSmacallan#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
79898d24fdSmacallan#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
80898d24fdSmacallan
81898d24fdSmacallan#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
82898d24fdSmacallan#define CLOSE_SCREEN_ARGS pScreen
83898d24fdSmacallan
84898d24fdSmacallan#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
85898d24fdSmacallan#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
86898d24fdSmacallan
87898d24fdSmacallan#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
88898d24fdSmacallan#define SWITCH_MODE_ARGS(arg, m) arg, m
89898d24fdSmacallan
90898d24fdSmacallan#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
91898d24fdSmacallan
92898d24fdSmacallan#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
93898d24fdSmacallan#define VT_FUNC_ARGS pScrn
94898d24fdSmacallan
95898d24fdSmacallan#define XF86_SCRN_ARG(x) (x)
96898d24fdSmacallan
97898d24fdSmacallan#endif
98898d24fdSmacallan
99898d24fdSmacallan#endif
100