13e51e026Smrg/*
23e51e026Smrg * Copyright 2012 Red Hat, Inc.
33e51e026Smrg *
43e51e026Smrg * Permission is hereby granted, free of charge, to any person obtaining a
53e51e026Smrg * copy of this software and associated documentation files (the "Software"),
63e51e026Smrg * to deal in the Software without restriction, including without limitation
73e51e026Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
83e51e026Smrg * and/or sell copies of the Software, and to permit persons to whom the
93e51e026Smrg * Software is furnished to do so, subject to the following conditions:
103e51e026Smrg *
113e51e026Smrg * The above copyright notice and this permission notice (including the next
123e51e026Smrg * paragraph) shall be included in all copies or substantial portions of the
133e51e026Smrg * Software.
143e51e026Smrg *
153e51e026Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
163e51e026Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
173e51e026Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
183e51e026Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
193e51e026Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
203e51e026Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
213e51e026Smrg * DEALINGS IN THE SOFTWARE.
223e51e026Smrg *
233e51e026Smrg * Author: Dave Airlie <airlied@redhat.com>
243e51e026Smrg */
253e51e026Smrg
263e51e026Smrg/* this file provides API compat between server post 1.13 and pre it,
273e51e026Smrg   it should be reused inside as many drivers as possible */
283e51e026Smrg#ifndef COMPAT_API_H
293e51e026Smrg#define COMPAT_API_H
303e51e026Smrg
313e51e026Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
323e51e026Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
333e51e026Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
343e51e026Smrg#endif
353e51e026Smrg
363e51e026Smrg#ifndef XF86_HAS_SCRN_CONV
373e51e026Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
383e51e026Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
393e51e026Smrg#endif
403e51e026Smrg
413e51e026Smrg#ifndef XF86_SCRN_INTERFACE
423e51e026Smrg
433e51e026Smrg#define SCRN_ARG_TYPE int
443e51e026Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
453e51e026Smrg
463e51e026Smrg#define SCREEN_ARG_TYPE int
473e51e026Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
483e51e026Smrg
493e51e026Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
503e51e026Smrg
513e51e026Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
523e51e026Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
533e51e026Smrg
543e51e026Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
553e51e026Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
563e51e026Smrg
573e51e026Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
583e51e026Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
593e51e026Smrg
603e51e026Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
613e51e026Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
623e51e026Smrg
633e51e026Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
643e51e026Smrg
653e51e026Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
663e51e026Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0
673e51e026Smrg
683e51e026Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
693e51e026Smrg#else
703e51e026Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
713e51e026Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
723e51e026Smrg
733e51e026Smrg#define SCREEN_ARG_TYPE ScreenPtr
743e51e026Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
753e51e026Smrg
763e51e026Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
773e51e026Smrg
783e51e026Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
793e51e026Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
803e51e026Smrg
813e51e026Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
823e51e026Smrg#define CLOSE_SCREEN_ARGS pScreen
833e51e026Smrg
843e51e026Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
853e51e026Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
863e51e026Smrg
873e51e026Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
883e51e026Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
893e51e026Smrg
903e51e026Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
913e51e026Smrg
923e51e026Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
933e51e026Smrg#define VT_FUNC_ARGS pScrn
943e51e026Smrg
953e51e026Smrg#define XF86_SCRN_ARG(x) (x)
963e51e026Smrg
973e51e026Smrg#endif
983e51e026Smrg
993e51e026Smrg#endif
100