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