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