14b9470b1Smrg/* 24b9470b1Smrg * Copyright 2012 Red Hat, Inc. 34b9470b1Smrg * 44b9470b1Smrg * Permission is hereby granted, free of charge, to any person obtaining a 54b9470b1Smrg * copy of this software and associated documentation files (the "Software"), 64b9470b1Smrg * to deal in the Software without restriction, including without limitation 74b9470b1Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 84b9470b1Smrg * and/or sell copies of the Software, and to permit persons to whom the 94b9470b1Smrg * Software is furnished to do so, subject to the following conditions: 104b9470b1Smrg * 114b9470b1Smrg * The above copyright notice and this permission notice (including the next 124b9470b1Smrg * paragraph) shall be included in all copies or substantial portions of the 134b9470b1Smrg * Software. 144b9470b1Smrg * 154b9470b1Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 164b9470b1Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 174b9470b1Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 184b9470b1Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 194b9470b1Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 204b9470b1Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 214b9470b1Smrg * DEALINGS IN THE SOFTWARE. 224b9470b1Smrg * 234b9470b1Smrg * Author: Dave Airlie <airlied@redhat.com> 244b9470b1Smrg */ 254b9470b1Smrg 264b9470b1Smrg/* this file provides API compat between server post 1.13 and pre it, 274b9470b1Smrg it should be reused inside as many drivers as possible */ 284b9470b1Smrg#ifndef COMPAT_API_H 294b9470b1Smrg#define COMPAT_API_H 304b9470b1Smrg 314b9470b1Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR 324b9470b1Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum] 334b9470b1Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p 344b9470b1Smrg#endif 354b9470b1Smrg 364b9470b1Smrg#ifndef XF86_HAS_SCRN_CONV 374b9470b1Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum] 384b9470b1Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex] 394b9470b1Smrg#endif 404b9470b1Smrg 414b9470b1Smrg#ifndef XF86_SCRN_INTERFACE 424b9470b1Smrg 434b9470b1Smrg#define SCRN_ARG_TYPE int 444b9470b1Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)] 454b9470b1Smrg 464b9470b1Smrg#define SCREEN_ARG_TYPE int 474b9470b1Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)] 484b9470b1Smrg 494b9470b1Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv 504b9470b1Smrg 514b9470b1Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask 524b9470b1Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask 534b9470b1Smrg 544b9470b1Smrg#define WAKEUPHANDLER_ARGS_DECL int arg, pointer wakeupData, unsigned long result, pointer read_mask 554b9470b1Smrg#define WAKEUPHANDLER_ARGS arg, wakeupData, result, read_mask 564b9470b1Smrg 574b9470b1Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen 584b9470b1Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen 594b9470b1Smrg 604b9470b1Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags 614b9470b1Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0 624b9470b1Smrg 634b9470b1Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags 644b9470b1Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0 654b9470b1Smrg 664b9470b1Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags 674b9470b1Smrg 684b9470b1Smrg#define VT_FUNC_ARGS_DECL int arg, int flags 694b9470b1Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0 704b9470b1Smrg 714b9470b1Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex) 724b9470b1Smrg#else 734b9470b1Smrg#define SCRN_ARG_TYPE ScrnInfoPtr 744b9470b1Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1) 754b9470b1Smrg 764b9470b1Smrg#define SCREEN_ARG_TYPE ScreenPtr 774b9470b1Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1) 784b9470b1Smrg 794b9470b1Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv 804b9470b1Smrg 81fe196524Smrg#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0) 82fe196524Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask 83fe196524Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask 84fe196524Smrg 85fe196524Smrg#define WAKEUPHANDLER_ARGS_DECL ScreenPtr arg, int result 86fe196524Smrg#define WAKEUPHANDLER_ARGS arg, result 87fe196524Smrg#else 884b9470b1Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask 894b9470b1Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask 904b9470b1Smrg 914b9470b1Smrg#define WAKEUPHANDLER_ARGS_DECL ScreenPtr arg, unsigned long result, pointer read_mask 924b9470b1Smrg#define WAKEUPHANDLER_ARGS arg, result, read_mask 93fe196524Smrg#endif 944b9470b1Smrg 954b9470b1Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen 964b9470b1Smrg#define CLOSE_SCREEN_ARGS pScreen 974b9470b1Smrg 984b9470b1Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y 994b9470b1Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y 1004b9470b1Smrg 1014b9470b1Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode 1024b9470b1Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m 1034b9470b1Smrg 1044b9470b1Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg 1054b9470b1Smrg 1064b9470b1Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg 1074b9470b1Smrg#define VT_FUNC_ARGS pScrn 1084b9470b1Smrg 1094b9470b1Smrg#define XF86_SCRN_ARG(x) (x) 1104b9470b1Smrg 1114b9470b1Smrg#endif 1124b9470b1Smrg 1134b9470b1Smrg#endif 114