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