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