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