168105dcbSveego/*
268105dcbSveego * Copyright 2012 Red Hat, Inc.
368105dcbSveego *
468105dcbSveego * Permission is hereby granted, free of charge, to any person obtaining a
568105dcbSveego * copy of this software and associated documentation files (the "Software"),
668105dcbSveego * to deal in the Software without restriction, including without limitation
768105dcbSveego * the rights to use, copy, modify, merge, publish, distribute, sublicense,
868105dcbSveego * and/or sell copies of the Software, and to permit persons to whom the
968105dcbSveego * Software is furnished to do so, subject to the following conditions:
1068105dcbSveego *
1168105dcbSveego * The above copyright notice and this permission notice (including the next
1268105dcbSveego * paragraph) shall be included in all copies or substantial portions of the
1368105dcbSveego * Software.
1468105dcbSveego *
1568105dcbSveego * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1668105dcbSveego * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1768105dcbSveego * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1868105dcbSveego * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1968105dcbSveego * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2068105dcbSveego * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2168105dcbSveego * DEALINGS IN THE SOFTWARE.
2268105dcbSveego *
2368105dcbSveego * Author: Dave Airlie <airlied@redhat.com>
2468105dcbSveego */
2568105dcbSveego
2668105dcbSveego/* this file provides API compat between server post 1.13 and pre it,
2768105dcbSveego   it should be reused inside as many drivers as possible */
2868105dcbSveego#ifndef COMPAT_API_H
2968105dcbSveego#define COMPAT_API_H
3068105dcbSveego
3168105dcbSveego#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
3268105dcbSveego#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
3368105dcbSveego#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
3468105dcbSveego#endif
3568105dcbSveego
3668105dcbSveego#ifndef XF86_HAS_SCRN_CONV
3768105dcbSveego#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
3868105dcbSveego#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
3968105dcbSveego#endif
4068105dcbSveego
41861b9feeSmrg#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(22,0)
42861b9feeSmrg#define HAVE_NOTIFY_FD  1
43861b9feeSmrg#endif
44861b9feeSmrg
4568105dcbSveego#ifndef XF86_SCRN_INTERFACE
4668105dcbSveego
4768105dcbSveego#define SCRN_ARG_TYPE int
4868105dcbSveego#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
4968105dcbSveego
5068105dcbSveego#define SCREEN_ARG_TYPE int
5168105dcbSveego#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
5268105dcbSveego
5368105dcbSveego#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
5468105dcbSveego
5568105dcbSveego#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
5668105dcbSveego#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
5768105dcbSveego
5868105dcbSveego#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
5968105dcbSveego#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
6068105dcbSveego
6168105dcbSveego#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
6268105dcbSveego
6368105dcbSveego#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
6468105dcbSveego
6568105dcbSveego#define FREE_SCREEN_ARGS_DECL int arg, int flags
6668105dcbSveego
6768105dcbSveego#define VT_FUNC_ARGS_DECL int arg, int flags
6868105dcbSveego#define VT_FUNC_ARGS(flags) pScrn->scrnIndex, (flags)
6968105dcbSveego
7068105dcbSveego#define XF86_ENABLEDISABLEFB_ARG(x) ((x)->scrnIndex)
7168105dcbSveego#else
7268105dcbSveego#define SCRN_ARG_TYPE ScrnInfoPtr
7368105dcbSveego#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
7468105dcbSveego
7568105dcbSveego#define SCREEN_ARG_TYPE ScreenPtr
7668105dcbSveego#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
7768105dcbSveego
7868105dcbSveego#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
7968105dcbSveego
80fe196524Smrg#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0)
81fe196524Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout
82fe196524Smrg#define BLOCKHANDLER_ARGS arg, pTimeout
83fe196524Smrg#else
8468105dcbSveego#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
8568105dcbSveego#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
86fe196524Smrg#endif
8768105dcbSveego
8868105dcbSveego#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
8968105dcbSveego#define CLOSE_SCREEN_ARGS pScreen
9068105dcbSveego
9168105dcbSveego#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
9268105dcbSveego#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
9368105dcbSveego
9468105dcbSveego#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
9568105dcbSveego
9668105dcbSveego#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
9768105dcbSveego#define VT_FUNC_ARGS(flags) pScrn
9868105dcbSveego
9968105dcbSveego#define XF86_ENABLEDISABLEFB_ARG(x) (x)
10068105dcbSveego
10168105dcbSveego#endif
10268105dcbSveego
10368105dcbSveego#endif
104