1213fdd94Smrg/*
2213fdd94Smrg * Copyright 2012 Red Hat, Inc.
3213fdd94Smrg *
4213fdd94Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5213fdd94Smrg * copy of this software and associated documentation files (the "Software"),
6213fdd94Smrg * to deal in the Software without restriction, including without limitation
7213fdd94Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8213fdd94Smrg * and/or sell copies of the Software, and to permit persons to whom the
9213fdd94Smrg * Software is furnished to do so, subject to the following conditions:
10213fdd94Smrg *
11213fdd94Smrg * The above copyright notice and this permission notice (including the next
12213fdd94Smrg * paragraph) shall be included in all copies or substantial portions of the
13213fdd94Smrg * Software.
14213fdd94Smrg *
15213fdd94Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16213fdd94Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17213fdd94Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18213fdd94Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19213fdd94Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20213fdd94Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21213fdd94Smrg * DEALINGS IN THE SOFTWARE.
22213fdd94Smrg *
23213fdd94Smrg * Author: Dave Airlie <airlied@redhat.com>
24213fdd94Smrg */
25213fdd94Smrg
26213fdd94Smrg/* this file provides API compat between server post 1.13 and pre it,
27213fdd94Smrg   it should be reused inside as many drivers as possible */
28213fdd94Smrg#ifndef COMPAT_API_H
29213fdd94Smrg#define COMPAT_API_H
30213fdd94Smrg
31213fdd94Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
32213fdd94Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
33213fdd94Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
34213fdd94Smrg#endif
35213fdd94Smrg
36213fdd94Smrg#ifndef XF86_HAS_SCRN_CONV
37213fdd94Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
38213fdd94Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
39213fdd94Smrg#endif
40213fdd94Smrg
41213fdd94Smrg#ifndef XF86_SCRN_INTERFACE
42213fdd94Smrg
43213fdd94Smrg#define SCRN_ARG_TYPE int
44213fdd94Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
45213fdd94Smrg
46213fdd94Smrg#define SCREEN_ARG_TYPE int
47213fdd94Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
48213fdd94Smrg
49213fdd94Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
50213fdd94Smrg
51213fdd94Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
52213fdd94Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
53213fdd94Smrg
54213fdd94Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
55213fdd94Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
56213fdd94Smrg
57213fdd94Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
58213fdd94Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
59213fdd94Smrg
60213fdd94Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
61213fdd94Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
62213fdd94Smrg
63213fdd94Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
64213fdd94Smrg
65213fdd94Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
66213fdd94Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0
67213fdd94Smrg
68213fdd94Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
69213fdd94Smrg#else
70213fdd94Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
71213fdd94Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
72213fdd94Smrg
73213fdd94Smrg#define SCREEN_ARG_TYPE ScreenPtr
74213fdd94Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
75213fdd94Smrg
76213fdd94Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
77213fdd94Smrg
7897ee6427Smrg#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0)
7997ee6427Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout
8097ee6427Smrg#define BLOCKHANDLER_ARGS arg, pTimeout
8197ee6427Smrg#else
82213fdd94Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
83213fdd94Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
8497ee6427Smrg#endif
85213fdd94Smrg
86213fdd94Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
87213fdd94Smrg#define CLOSE_SCREEN_ARGS pScreen
88213fdd94Smrg
89213fdd94Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
90213fdd94Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
91213fdd94Smrg
92213fdd94Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
93213fdd94Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
94213fdd94Smrg
95213fdd94Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
96213fdd94Smrg
97213fdd94Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
98213fdd94Smrg#define VT_FUNC_ARGS pScrn
99213fdd94Smrg
100213fdd94Smrg#define XF86_SCRN_ARG(x) (x)
101213fdd94Smrg
102213fdd94Smrg#endif
103213fdd94Smrg
104213fdd94Smrg#endif
105