104007ebaSmrg/*
204007ebaSmrg * Copyright 2012 Red Hat, Inc.
304007ebaSmrg * Copyright 2012 Canonical Ltd.
404007ebaSmrg *
504007ebaSmrg * Permission is hereby granted, free of charge, to any person obtaining a
604007ebaSmrg * copy of this software and associated documentation files (the "Software"),
704007ebaSmrg * to deal in the Software without restriction, including without limitation
804007ebaSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
904007ebaSmrg * and/or sell copies of the Software, and to permit persons to whom the
1004007ebaSmrg * Software is furnished to do so, subject to the following conditions:
1104007ebaSmrg *
1204007ebaSmrg * The above copyright notice and this permission notice (including the next
1304007ebaSmrg * paragraph) shall be included in all copies or substantial portions of the
1404007ebaSmrg * Software.
1504007ebaSmrg *
1604007ebaSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1704007ebaSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1804007ebaSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1904007ebaSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2004007ebaSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2104007ebaSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2204007ebaSmrg * DEALINGS IN THE SOFTWARE.
2304007ebaSmrg *
2404007ebaSmrg * Authors:
2504007ebaSmrg *   Dave Airlie <airlied@redhat.com>
2604007ebaSmrg *   Maarten Lankhorst <maarten.lankhorst@canonical.com>
2704007ebaSmrg */
2804007ebaSmrg
2904007ebaSmrg/* this file provides API compat between server post 1.13 and pre it,
3004007ebaSmrg   it should be reused inside as many drivers as possible */
3104007ebaSmrg#ifndef COMPAT_API_H
3204007ebaSmrg#define COMPAT_API_H
3304007ebaSmrg
3404007ebaSmrg#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR
3504007ebaSmrg#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum]
3604007ebaSmrg#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p
3704007ebaSmrg#endif
3804007ebaSmrg
3904007ebaSmrg#ifndef XF86_HAS_SCRN_CONV
4004007ebaSmrg#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum]
4104007ebaSmrg#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex]
4204007ebaSmrg#endif
4304007ebaSmrg
4404007ebaSmrg#ifndef XF86_SCRN_INTERFACE
4504007ebaSmrg
4604007ebaSmrg#define DDC_CALL(pScrni) (pScrni->scrnIndex)
4704007ebaSmrg
4804007ebaSmrg#define SCRN_ARG_TYPE int
4904007ebaSmrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrni = xf86Screens[(arg1)]
5004007ebaSmrg
5104007ebaSmrg#define SCREEN_ARG_TYPE int
5204007ebaSmrg#define SCREEN_PTR(arg1) ScreenPtr pScrn = screenInfo.screens[(arg1)]
5304007ebaSmrg
5404007ebaSmrg#define SCREEN_INIT_ARGS_DECL int index, ScreenPtr pScrn, int argc, char **argv
5504007ebaSmrg
5604007ebaSmrg#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
5704007ebaSmrg#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask
5804007ebaSmrg
5904007ebaSmrg#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScrn
6004007ebaSmrg#define CLOSE_SCREEN_ARGS scrnIndex, pScrn
6104007ebaSmrg
6204007ebaSmrg#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags
6304007ebaSmrg#define ADJUST_FRAME_ARGS(x, y) pScrni->scrnIndex, (x), (y), 0
6404007ebaSmrg
6504007ebaSmrg#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr pMode, int flags
6604007ebaSmrg
6704007ebaSmrg#define FREE_SCREEN_ARGS_DECL int arg, int flags
6804007ebaSmrg#define FREE_SCREEN_ARGS(x) (x)->scrnIndex, 0
6904007ebaSmrg
7004007ebaSmrg#define VT_FUNC_ARGS_DECL int arg, int flags
7104007ebaSmrg#define VT_FUNC_ARGS(flags) pScrni->scrnIndex, (flags)
7204007ebaSmrg
7304007ebaSmrg#define XF86_ENABLEDISABLEFB_ARG(pScrni, x) ((pScrni)->scrnIndex), (x)
7404007ebaSmrg
7504007ebaSmrg#define POINTER_MOVED_ARGS_DECL int arg, int x, int y
7604007ebaSmrg#define POINTER_MOVED_ARGS(x, y) pScrni->scrnIndex, (x), (y)
7704007ebaSmrg
7804007ebaSmrg#define VALID_MODE_ARGS_DECL int arg, DisplayModePtr pMode, Bool Verbose, int flags
7904007ebaSmrg
8004007ebaSmrg#else                           /*XF86_SCRN_INTERFACE) */
8104007ebaSmrg
8204007ebaSmrg#define DDC_CALL(pScrni) (pScrni)
8304007ebaSmrg
8404007ebaSmrg#define SCRN_ARG_TYPE ScrnInfoPtr
8504007ebaSmrg#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrni = (arg1)
8604007ebaSmrg
8704007ebaSmrg#define SCREEN_ARG_TYPE ScreenPtr
8804007ebaSmrg#define SCREEN_PTR(arg1) ScreenPtr pScrn = (arg1)
8904007ebaSmrg
9004007ebaSmrg#define SCREEN_INIT_ARGS_DECL ScreenPtr pScrn, int argc, char **argv
9104007ebaSmrg
9219b15abdSmrg#if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(23, 0)
9319b15abdSmrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout
9419b15abdSmrg#define BLOCKHANDLER_ARGS arg, pTimeout
9519b15abdSmrg#else
9604007ebaSmrg#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask
9704007ebaSmrg#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask
9819b15abdSmrg#endif
9904007ebaSmrg
10004007ebaSmrg#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScrn
10104007ebaSmrg#define CLOSE_SCREEN_ARGS pScrn
10204007ebaSmrg
10304007ebaSmrg#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y
10404007ebaSmrg#define ADJUST_FRAME_ARGS(x, y) pScrni, (x), (y)
10504007ebaSmrg
10604007ebaSmrg#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr pMode
10704007ebaSmrg
10804007ebaSmrg#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg
10904007ebaSmrg#define FREE_SCREEN_ARGS(x) (x)
11004007ebaSmrg
11104007ebaSmrg#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg
11204007ebaSmrg#define VT_FUNC_ARGS(flags) pScrni
11304007ebaSmrg
11404007ebaSmrg#define XF86_ENABLEDISABLEFB_ARG(pScrni, x) (pScrni), (x)
11504007ebaSmrg
11604007ebaSmrg#define POINTER_MOVED_ARGS_DECL ScrnInfoPtr arg, int x, int y
11704007ebaSmrg#define POINTER_MOVED_ARGS(x, y) pScrni, (x), (y)
11804007ebaSmrg
11904007ebaSmrg#define VALID_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr pMode, Bool Verbose, int flags
12004007ebaSmrg
12104007ebaSmrg#endif
12204007ebaSmrg
12304007ebaSmrg#endif
124