10bb88ba4Smrg/*
20bb88ba4Smrg * Copyright 2012 Red Hat, Inc.
30bb88ba4Smrg *
40bb88ba4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
50bb88ba4Smrg * copy of this software and associated documentation files (the "Software"),
60bb88ba4Smrg * to deal in the Software without restriction, including without limitation
70bb88ba4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
80bb88ba4Smrg * and/or sell copies of the Software, and to permit persons to whom the
90bb88ba4Smrg * Software is furnished to do so, subject to the following conditions:
100bb88ba4Smrg *
110bb88ba4Smrg * The above copyright notice and this permission notice (including the next
120bb88ba4Smrg * paragraph) shall be included in all copies or substantial portions of the
130bb88ba4Smrg * Software.
140bb88ba4Smrg *
150bb88ba4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
160bb88ba4Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
170bb88ba4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
180bb88ba4Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
190bb88ba4Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
200bb88ba4Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
210bb88ba4Smrg * DEALINGS IN THE SOFTWARE.
220bb88ba4Smrg *
230bb88ba4Smrg * Author: Dave Airlie <airlied@redhat.com>
240bb88ba4Smrg */
250bb88ba4Smrg
260bb88ba4Smrg/* this file provides API compat between server post 1.13 and pre it,
270bb88ba4Smrg   it should be reused inside as many drivers as possible */
280bb88ba4Smrg#ifndef COMPAT_API_H
290bb88ba4Smrg#define COMPAT_API_H
300bb88ba4Smrg
310bb88ba4Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
320bb88ba4Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
330bb88ba4Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
340bb88ba4Smrg#endif
350bb88ba4Smrg
360bb88ba4Smrg#ifndef XF86_HAS_SCRN_CONV
370bb88ba4Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
380bb88ba4Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
390bb88ba4Smrg#endif
400bb88ba4Smrg
410bb88ba4Smrg#ifndef XF86_SCRN_INTERFACE
420bb88ba4Smrg
430bb88ba4Smrg#define SCRN_ARG_TYPE int
440bb88ba4Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
450bb88ba4Smrg
460bb88ba4Smrg#define SCREEN_ARG_TYPE int
470bb88ba4Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
480bb88ba4Smrg
490bb88ba4Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
500bb88ba4Smrg
510bb88ba4Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
520bb88ba4Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
530bb88ba4Smrg
540bb88ba4Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
550bb88ba4Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
560bb88ba4Smrg
570bb88ba4Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
580bb88ba4Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
590bb88ba4Smrg
600bb88ba4Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
610bb88ba4Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
620bb88ba4Smrg
630bb88ba4Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
640bb88ba4Smrg
650bb88ba4Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
660bb88ba4Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0
670bb88ba4Smrg
680bb88ba4Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
690bb88ba4Smrg#else
700bb88ba4Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
710bb88ba4Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
720bb88ba4Smrg
730bb88ba4Smrg#define SCREEN_ARG_TYPE ScreenPtr
740bb88ba4Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
750bb88ba4Smrg
760bb88ba4Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
770bb88ba4Smrg
78ee82cb62Smrg#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0)
79ee82cb62Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout
80ee82cb62Smrg#define BLOCKHANDLER_ARGS arg, pTimeout
81ee82cb62Smrg#else
820bb88ba4Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
830bb88ba4Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
84ee82cb62Smrg#endif
850bb88ba4Smrg
860bb88ba4Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
870bb88ba4Smrg#define CLOSE_SCREEN_ARGS pScreen
880bb88ba4Smrg
890bb88ba4Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
900bb88ba4Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
910bb88ba4Smrg
920bb88ba4Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
930bb88ba4Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
940bb88ba4Smrg
950bb88ba4Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
960bb88ba4Smrg
970bb88ba4Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
980bb88ba4Smrg#define VT_FUNC_ARGS pScrn
990bb88ba4Smrg
1000bb88ba4Smrg#define XF86_SCRN_ARG(x) (x)
1010bb88ba4Smrg
1020bb88ba4Smrg#endif
1030bb88ba4Smrg
1040bb88ba4Smrg#endif
105