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