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