11fb744b4Smrg/*
21fb744b4Smrg * Copyright 2012 Red Hat, Inc.
31fb744b4Smrg *
41fb744b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
51fb744b4Smrg * copy of this software and associated documentation files (the "Software"),
61fb744b4Smrg * to deal in the Software without restriction, including without limitation
71fb744b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
81fb744b4Smrg * and/or sell copies of the Software, and to permit persons to whom the
91fb744b4Smrg * Software is furnished to do so, subject to the following conditions:
101fb744b4Smrg *
111fb744b4Smrg * The above copyright notice and this permission notice (including the next
121fb744b4Smrg * paragraph) shall be included in all copies or substantial portions of the
131fb744b4Smrg * Software.
141fb744b4Smrg *
151fb744b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161fb744b4Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171fb744b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
181fb744b4Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
191fb744b4Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
201fb744b4Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
211fb744b4Smrg * DEALINGS IN THE SOFTWARE.
221fb744b4Smrg *
231fb744b4Smrg * Author: Dave Airlie <airlied@redhat.com>
241fb744b4Smrg */
251fb744b4Smrg
261fb744b4Smrg/* this file provides API compat between server post 1.13 and pre it,
271fb744b4Smrg   it should be reused inside as many drivers as possible */
281fb744b4Smrg#ifndef COMPAT_API_H
291fb744b4Smrg#define COMPAT_API_H
301fb744b4Smrg
311fb744b4Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
321fb744b4Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
331fb744b4Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
341fb744b4Smrg#endif
351fb744b4Smrg
361fb744b4Smrg#ifndef XF86_HAS_SCRN_CONV
371fb744b4Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
381fb744b4Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
391fb744b4Smrg#endif
401fb744b4Smrg
411fb744b4Smrg#ifndef XF86_SCRN_INTERFACE
421fb744b4Smrg
431fb744b4Smrg#define SCRN_ARG_TYPE int
441fb744b4Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
451fb744b4Smrg
461fb744b4Smrg#define SCREEN_ARG_TYPE int
471fb744b4Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
481fb744b4Smrg
491fb744b4Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
501fb744b4Smrg
511fb744b4Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
521fb744b4Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
531fb744b4Smrg
541fb744b4Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
551fb744b4Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
561fb744b4Smrg
571fb744b4Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
581fb744b4Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
591fb744b4Smrg
601fb744b4Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
611fb744b4Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
621fb744b4Smrg
631fb744b4Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
641fb744b4Smrg
651fb744b4Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
661fb744b4Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0
671fb744b4Smrg
681fb744b4Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
691fb744b4Smrg#else
701fb744b4Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
711fb744b4Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
721fb744b4Smrg
731fb744b4Smrg#define SCREEN_ARG_TYPE ScreenPtr
741fb744b4Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
751fb744b4Smrg
761fb744b4Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
771fb744b4Smrg
7814210e8eSmrg#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0)
7914210e8eSmrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout
8014210e8eSmrg#define BLOCKHANDLER_ARGS arg, pTimeout
8114210e8eSmrg#else
821fb744b4Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
831fb744b4Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
8414210e8eSmrg#endif
851fb744b4Smrg
861fb744b4Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
871fb744b4Smrg#define CLOSE_SCREEN_ARGS pScreen
881fb744b4Smrg
891fb744b4Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
901fb744b4Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
911fb744b4Smrg
921fb744b4Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
931fb744b4Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
941fb744b4Smrg
951fb744b4Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
961fb744b4Smrg
971fb744b4Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
981fb744b4Smrg#define VT_FUNC_ARGS pScrn
991fb744b4Smrg
1001fb744b4Smrg#define XF86_SCRN_ARG(x) (x)
1011fb744b4Smrg
1021fb744b4Smrg#endif
1031fb744b4Smrg
1041fb744b4Smrg#endif
105