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