compat-api.h revision 74c14cd6
174c14cd6Smrg/*
274c14cd6Smrg * Copyright 2012 Red Hat, Inc.
374c14cd6Smrg *
474c14cd6Smrg * Permission is hereby granted, free of charge, to any person obtaining a
574c14cd6Smrg * copy of this software and associated documentation files (the "Software"),
674c14cd6Smrg * to deal in the Software without restriction, including without limitation
774c14cd6Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
874c14cd6Smrg * and/or sell copies of the Software, and to permit persons to whom the
974c14cd6Smrg * Software is furnished to do so, subject to the following conditions:
1074c14cd6Smrg *
1174c14cd6Smrg * The above copyright notice and this permission notice (including the next
1274c14cd6Smrg * paragraph) shall be included in all copies or substantial portions of the
1374c14cd6Smrg * Software.
1474c14cd6Smrg *
1574c14cd6Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1674c14cd6Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1774c14cd6Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1874c14cd6Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1974c14cd6Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2074c14cd6Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2174c14cd6Smrg * DEALINGS IN THE SOFTWARE.
2274c14cd6Smrg *
2374c14cd6Smrg * Author: Dave Airlie <airlied@redhat.com>
2474c14cd6Smrg */
2574c14cd6Smrg
2674c14cd6Smrg/* this file provides API compat between server post 1.13 and pre it,
2774c14cd6Smrg   it should be reused inside as many drivers as possible */
2874c14cd6Smrg#ifndef COMPAT_API_H
2974c14cd6Smrg#define COMPAT_API_H
3074c14cd6Smrg
3174c14cd6Smrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
3274c14cd6Smrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
3374c14cd6Smrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
3474c14cd6Smrg#endif
3574c14cd6Smrg
3674c14cd6Smrg#ifndef XF86_HAS_SCRN_CONV
3774c14cd6Smrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
3874c14cd6Smrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
3974c14cd6Smrg#endif
4074c14cd6Smrg
4174c14cd6Smrg#ifndef XF86_SCRN_INTERFACE
4274c14cd6Smrg
4374c14cd6Smrg#define SCRN_ARG_TYPE int
4474c14cd6Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)]
4574c14cd6Smrg
4674c14cd6Smrg#define SCREEN_ARG_TYPE int
4774c14cd6Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
4874c14cd6Smrg
4974c14cd6Smrg#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
5074c14cd6Smrg
5174c14cd6Smrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
5274c14cd6Smrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
5374c14cd6Smrg
5474c14cd6Smrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen
5574c14cd6Smrg#define CLOSE_SCREEN_ARGS scrnIndex, pScreen
5674c14cd6Smrg
5774c14cd6Smrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
5874c14cd6Smrg#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0
5974c14cd6Smrg
6074c14cd6Smrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags
6174c14cd6Smrg#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0
6274c14cd6Smrg
6374c14cd6Smrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
6474c14cd6Smrg
6574c14cd6Smrg#define VT_FUNC_ARGS_DECL int arg, int flags
6674c14cd6Smrg#define VT_FUNC_ARGS pScrn->scrnIndex, 0
6774c14cd6Smrg
6874c14cd6Smrg#define XF86_SCRN_ARG(x) ((x)->scrnIndex)
6974c14cd6Smrg#else
7074c14cd6Smrg#define SCRN_ARG_TYPE ScrnInfoPtr
7174c14cd6Smrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1)
7274c14cd6Smrg
7374c14cd6Smrg#define SCREEN_ARG_TYPE ScreenPtr
7474c14cd6Smrg#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1)
7574c14cd6Smrg
7674c14cd6Smrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv
7774c14cd6Smrg
7874c14cd6Smrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
7974c14cd6Smrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
8074c14cd6Smrg
8174c14cd6Smrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen
8274c14cd6Smrg#define CLOSE_SCREEN_ARGS pScreen
8374c14cd6Smrg
8474c14cd6Smrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
8574c14cd6Smrg#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y
8674c14cd6Smrg
8774c14cd6Smrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode
8874c14cd6Smrg#define SWITCH_MODE_ARGS(arg, m) arg, m
8974c14cd6Smrg
9074c14cd6Smrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
9174c14cd6Smrg
9274c14cd6Smrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
9374c14cd6Smrg#define VT_FUNC_ARGS pScrn
9474c14cd6Smrg
9574c14cd6Smrg#define XF86_SCRN_ARG(x) (x)
9674c14cd6Smrg
9774c14cd6Smrg#endif
9874c14cd6Smrg
9974c14cd6Smrg#endif
100