163847c39Smrg/*
263847c39Smrg * Copyright 2012 Red Hat, Inc.
363847c39Smrg *
463847c39Smrg * Permission is hereby granted, free of charge, to any person obtaining a
563847c39Smrg * copy of this software and associated documentation files (the "Software"),
663847c39Smrg * to deal in the Software without restriction, including without limitation
763847c39Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
863847c39Smrg * and/or sell copies of the Software, and to permit persons to whom the
963847c39Smrg * Software is furnished to do so, subject to the following conditions:
1063847c39Smrg *
1163847c39Smrg * The above copyright notice and this permission notice (including the next
1263847c39Smrg * paragraph) shall be included in all copies or substantial portions of the
1363847c39Smrg * Software.
1463847c39Smrg *
1563847c39Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1663847c39Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1763847c39Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1863847c39Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1963847c39Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2063847c39Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2163847c39Smrg * DEALINGS IN THE SOFTWARE.
2263847c39Smrg *
2363847c39Smrg * Author: Dave Airlie <airlied@redhat.com>
2463847c39Smrg */
2563847c39Smrg
2663847c39Smrg/* this file provides API compat between server post 1.13 and pre it,
2763847c39Smrg   it should be reused inside as many drivers as possible */
2863847c39Smrg#ifndef COMPAT_API_H
2963847c39Smrg#define COMPAT_API_H
3063847c39Smrg
3163847c39Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
3263847c39Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
3363847c39Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
3463847c39Smrg#endif
3563847c39Smrg
3663847c39Smrg#ifndef XF86_HAS_SCRN_CONV
3763847c39Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
3863847c39Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
3963847c39Smrg#endif
4063847c39Smrg
4163847c39Smrg#ifndef XF86_SCRN_INTERFACE
4263847c39Smrg
4363847c39Smrg#define SCRN_ARG_TYPE int
4463847c39Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
4563847c39Smrg
4663847c39Smrg#define SCREEN_ARG_TYPE int
4763847c39Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
4863847c39Smrg
4963847c39Smrg#define SCREEN_INIT_ARGS_DECL int scrnIndex, ScreenPtr pScreen, int argc, char **argv
5063847c39Smrg
5163847c39Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
5263847c39Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
5363847c39Smrg
5463847c39Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
5563847c39Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
5663847c39Smrg
5763847c39Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
5863847c39Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
5963847c39Smrg
6063847c39Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
6163847c39Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
6263847c39Smrg
6363847c39Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
6463847c39Smrg
6563847c39Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
6663847c39Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0
6763847c39Smrg
6863847c39Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
6963847c39Smrg#else
7063847c39Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
7163847c39Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
7263847c39Smrg
7363847c39Smrg#define SCREEN_ARG_TYPE ScreenPtr
7463847c39Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
7563847c39Smrg
7663847c39Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
7763847c39Smrg
7863847c39Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
7963847c39Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
8063847c39Smrg
8163847c39Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
8263847c39Smrg#define CLOSE_SCREEN_ARGS pScreen
8363847c39Smrg
8463847c39Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
8563847c39Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
8663847c39Smrg
8763847c39Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
8863847c39Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
8963847c39Smrg
9063847c39Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
9163847c39Smrg
9263847c39Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
9363847c39Smrg#define VT_FUNC_ARGS pScrn
9463847c39Smrg
9563847c39Smrg#define XF86_SCRN_ARG(x) (x)
9663847c39Smrg
9763847c39Smrg#endif
9863847c39Smrg
9963847c39Smrg#endif
100