From 2bb2e6a6e3017d462be0ae9308955f37c5ee03c6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 6 Jun 2012 15:20:24 +0100 Subject: [PATCH] xorg: port to new compat API. Signed-off-by: Dave Airlie --- src/gallium/state_trackers/xorg/compat-api.h | 99 +++++++++++++++++++ .../state_trackers/xorg/xorg_composite.c | 2 +- src/gallium/state_trackers/xorg/xorg_dri2.c | 8 +- src/gallium/state_trackers/xorg/xorg_driver.c | 75 +++++++------- src/gallium/state_trackers/xorg/xorg_exa.c | 30 +++--- .../state_trackers/xorg/xorg_tracker.h | 3 +- src/gallium/state_trackers/xorg/xorg_xv.c | 6 +- src/gallium/state_trackers/xorg/xorg_xvmc.c | 2 +- 8 files changed, 162 insertions(+), 63 deletions(-) create mode 100644 src/gallium/state_trackers/xorg/compat-api.h diff --git a/src/gallium/state_trackers/xorg/compat-api.h b/src/gallium/state_trackers/xorg/compat-api.h new file mode 100644 index 00000000000..6bc946fd6d9 --- /dev/null +++ b/src/gallium/state_trackers/xorg/compat-api.h @@ -0,0 +1,99 @@ +/* + * Copyright 2012 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Dave Airlie + */ + +/* this file provides API compat between server post 1.13 and pre it, + it should be reused inside as many drivers as possible */ +#ifndef COMPAT_API_H +#define COMPAT_API_H + +#ifndef GLYPH_HAS_GLYPH_PICTURE_ACCESSOR +#define GetGlyphPicture(g, s) GlyphPicture((g))[(s)->myNum] +#define SetGlyphPicture(g, s, p) GlyphPicture((g))[(s)->myNum] = p +#endif + +#ifndef XF86_HAS_SCRN_CONV +#define xf86ScreenToScrn(s) xf86Screens[(s)->myNum] +#define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex] +#endif + +#ifndef XF86_SCRN_INTERFACE + +#define SCRN_ARG_TYPE int +#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = xf86Screens[(arg1)] + +#define SCREEN_ARG_TYPE int +#define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)] + +#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv + +#define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask +#define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask + +#define CLOSE_SCREEN_ARGS_DECL int scrnIndex, ScreenPtr pScreen +#define CLOSE_SCREEN_ARGS scrnIndex, pScreen + +#define ADJUST_FRAME_ARGS_DECL int arg, int x, int y, int flags +#define ADJUST_FRAME_ARGS(arg, x, y) (arg)->scrnIndex, x, y, 0 + +#define SWITCH_MODE_ARGS_DECL int arg, DisplayModePtr mode, int flags +#define SWITCH_MODE_ARGS(arg, m) (arg)->scrnIndex, m, 0 + +#define FREE_SCREEN_ARGS_DECL int arg, int flags + +#define VT_FUNC_ARGS_DECL int arg, int flags +#define VT_FUNC_ARGS pScrn->scrnIndex, 0 + +#define XF86_SCRN_ARG(x) ((x)->scrnIndex) +#else +#define SCRN_ARG_TYPE ScrnInfoPtr +#define SCRN_INFO_PTR(arg1) ScrnInfoPtr pScrn = (arg1) + +#define SCREEN_ARG_TYPE ScreenPtr +#define SCREEN_PTR(arg1) ScreenPtr pScreen = (arg1) + +#define SCREEN_INIT_ARGS_DECL ScreenPtr pScreen, int argc, char **argv + +#define BLOCKHANDLER_ARGS_DECL ScreenPtr arg, pointer pTimeout, pointer pReadmask +#define BLOCKHANDLER_ARGS arg, pTimeout, pReadmask + +#define CLOSE_SCREEN_ARGS_DECL ScreenPtr pScreen +#define CLOSE_SCREEN_ARGS pScreen + +#define ADJUST_FRAME_ARGS_DECL ScrnInfoPtr arg, int x, int y +#define ADJUST_FRAME_ARGS(arg, x, y) arg, x, y + +#define SWITCH_MODE_ARGS_DECL ScrnInfoPtr arg, DisplayModePtr mode +#define SWITCH_MODE_ARGS(arg, m) arg, m + +#define FREE_SCREEN_ARGS_DECL ScrnInfoPtr arg + +#define VT_FUNC_ARGS_DECL ScrnInfoPtr arg +#define VT_FUNC_ARGS pScrn + +#define XF86_SCRN_ARG(x) (x) + +#endif + +#endif diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 61ba6bdddf7..4c05c2bebc1 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -175,7 +175,7 @@ boolean xorg_composite_accelerated(int op, PicturePtr pDstPicture) { ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct xorg_composite_blend blend; diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index e81f7b81ca1..04e6a211def 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -64,7 +64,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form { struct pipe_resource *tex = NULL; ScreenPtr pScreen = pDraw->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_pixmap_priv *exa_priv; BufferPrivatePtr private = buffer->driverPrivate; @@ -183,7 +183,7 @@ static void dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer) { ScreenPtr pScreen = pDraw->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); BufferPrivatePtr private = buffer->driverPrivate; struct exa_pixmap_priv *exa_priv = exaGetPixmapDriverPrivate(private->pPixmap); @@ -293,7 +293,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer) { ScreenPtr pScreen = pDraw->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); BufferPrivatePtr dst_priv = pDestBuffer->driverPrivate; BufferPrivatePtr src_priv = pSrcBuffer->driverPrivate; @@ -404,7 +404,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, Bool xorg_dri2_init(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); DRI2InfoRec dri2info; #if DRI2INFOREC_VERSION >= 2 diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index eb9d7f075ef..4b128221b75 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -67,14 +67,13 @@ */ static Bool drv_pre_init(ScrnInfoPtr pScrn, int flags); -static Bool drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, - char **argv); -static Bool drv_switch_mode(int scrnIndex, DisplayModePtr mode, int flags); -static void drv_adjust_frame(int scrnIndex, int x, int y, int flags); -static Bool drv_enter_vt(int scrnIndex, int flags); -static void drv_leave_vt(int scrnIndex, int flags); -static void drv_free_screen(int scrnIndex, int flags); -static ModeStatus drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose, +static Bool drv_screen_init(SCREEN_INIT_ARGS_DECL); +static Bool drv_switch_mode(SWITCH_MODE_ARGS_DECL); +static void drv_adjust_frame(ADJUST_FRAME_ARGS_DECL); +static Bool drv_enter_vt(VT_FUNC_ARGS_DECL); +static void drv_leave_vt(VT_FUNC_ARGS_DECL); +static void drv_free_screen(FREE_SCREEN_ARGS_DECL); +static ModeStatus drv_valid_mode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags); typedef enum @@ -149,7 +148,7 @@ xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device) */ static Bool drv_init_front_buffer_functions(ScrnInfoPtr pScrn); -static Bool drv_close_screen(int scrnIndex, ScreenPtr pScreen); +static Bool drv_close_screen(CLOSE_SCREEN_ARGS_DECL); /* @@ -543,7 +542,7 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) void xorg_flush(ScreenPtr pScreen) { - modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]); + modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen)); if (ms->ctx) { int j; @@ -605,14 +604,13 @@ void xorg_flush(ScreenPtr pScreen) #endif } -static void drv_block_handler(int i, pointer blockData, pointer pTimeout, - pointer pReadmask) +static void drv_block_handler(BLOCKHANDLER_ARGS_DECL) { - ScreenPtr pScreen = screenInfo.screens[i]; - modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]); + SCREEN_PTR(arg); + modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(pScreen)); pScreen->BlockHandler = ms->blockHandler; - pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler(BLOCKHANDLER_ARGS); pScreen->BlockHandler = drv_block_handler; xorg_flush(pScreen); @@ -621,7 +619,7 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, static Bool drv_create_screen_resources(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); PixmapPtr rootPixmap; Bool ret; @@ -636,7 +634,7 @@ drv_create_screen_resources(ScreenPtr pScreen) ms->noEvict = FALSE; - drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + drv_adjust_frame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); #ifdef DRM_MODE_FEATURE_DIRTYFB rootPixmap = pScreen->GetScreenPixmap(pScreen); @@ -741,9 +739,9 @@ static void drv_load_palette(ScrnInfoPtr pScrn, int numColors, static Bool -drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +drv_screen_init(SCREEN_INIT_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); VisualPtr visual; CustomizerPtr cust = ms->cust; @@ -889,13 +887,13 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); - return drv_enter_vt(scrnIndex, 1); + return drv_enter_vt(VT_FUNC_ARGS); } static void -drv_adjust_frame(int scrnIndex, int x, int y, int flags) +drv_adjust_frame(ADJUST_FRAME_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86OutputPtr output = config->output[config->compat_output]; xf86CrtcPtr crtc = output->crtc; @@ -909,15 +907,16 @@ drv_adjust_frame(int scrnIndex, int x, int y, int flags) } static void -drv_free_screen(int scrnIndex, int flags) +drv_free_screen(FREE_SCREEN_ARGS_DECL) { - drv_free_rec(xf86Screens[scrnIndex]); + SCRN_INFO_PTR(arg); + drv_free_rec(pScrn); } static void -drv_leave_vt(int scrnIndex, int flags) +drv_leave_vt(VT_FUNC_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); modesettingPtr ms = modesettingPTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); CustomizerPtr cust = ms->cust; @@ -960,9 +959,9 @@ drv_leave_vt(int scrnIndex, int flags) * This gets called when gaining control of the VT, and from ScreenInit(). */ static Bool -drv_enter_vt(int scrnIndex, int flags) +drv_enter_vt(VT_FUNC_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); modesettingPtr ms = modesettingPTR(pScrn); CustomizerPtr cust = ms->cust; @@ -972,7 +971,7 @@ drv_enter_vt(int scrnIndex, int flags) if (!ms->create_front_buffer(pScrn)) return FALSE; - if (!flags && !ms->bind_front_buffer(pScrn)) + if (!ms->bind_front_buffer(pScrn)) return FALSE; if (!xf86SetDesiredModes(pScrn)) @@ -985,17 +984,17 @@ drv_enter_vt(int scrnIndex, int flags) } static Bool -drv_switch_mode(int scrnIndex, DisplayModePtr mode, int flags) +drv_switch_mode(SWITCH_MODE_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SCRN_INFO_PTR(arg); return xf86SetSingleMode(pScrn, mode, RR_Rotate_0); } static Bool -drv_close_screen(int scrnIndex, ScreenPtr pScreen) +drv_close_screen(CLOSE_SCREEN_ARGS_DECL) { - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); CustomizerPtr cust = ms->cust; @@ -1031,17 +1030,17 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen) /* calls drop master make sure we don't talk to 3D HW after that */ if (pScrn->vtSema) { - drv_leave_vt(scrnIndex, 0); + drv_leave_vt(VT_FUNC_ARGS); } pScrn->vtSema = FALSE; pScreen->CloseScreen = ms->CloseScreen; - return (*pScreen->CloseScreen) (scrnIndex, pScreen); + return (*pScreen->CloseScreen) (CLOSE_SCREEN_ARGS); } static ModeStatus -drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +drv_valid_mode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags) { return MODE_OK; } @@ -1110,7 +1109,7 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) pScrn->frameX0 = 0; pScrn->frameY0 = 0; - drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + drv_adjust_frame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); pipe_resource_reference(&ms->root_texture, tex); pipe_resource_reference(&tex, NULL); @@ -1222,7 +1221,7 @@ drv_create_front_buffer_kms(ScrnInfoPtr pScrn) pScrn->frameX0 = 0; pScrn->frameY0 = 0; - drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + drv_adjust_frame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); ms->root_bo = bo; ms->fb_id = fb_id; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index fa84298855e..91669ce7ede 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -196,7 +196,7 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst, int dst_pitch) { ScreenPtr pScreen = pPix->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPix); @@ -228,7 +228,7 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src, int src_pitch) { ScreenPtr pScreen = pPix->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPix); @@ -259,7 +259,7 @@ static Bool ExaPrepareAccess(PixmapPtr pPix, int index) { ScreenPtr pScreen = pPix->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv; @@ -311,7 +311,7 @@ static void ExaFinishAccess(PixmapPtr pPix, int index) { ScreenPtr pScreen = pPix->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv; @@ -343,7 +343,7 @@ ExaFinishAccess(PixmapPtr pPix, int index) static Bool ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) { - ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); struct exa_context *exa = ms->exa; @@ -377,7 +377,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) static void ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1) { - ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); @@ -402,7 +402,7 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1) static void ExaDoneSolid(PixmapPtr pPixmap) { - ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); struct exa_context *exa = ms->exa; @@ -423,7 +423,7 @@ static Bool ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir, int alu, Pixel planeMask) { - ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPixmap->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap); @@ -469,7 +469,7 @@ static void ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, int width, int height) { - ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPixmap->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct pipe_box src_box; @@ -524,7 +524,7 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, static void ExaDoneCopy(PixmapPtr pPixmap) { - ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); struct exa_context *exa = ms->exa; @@ -590,7 +590,7 @@ ExaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { - ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPicture->pDrawable->pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; Bool accelerated = exa->accel && xorg_composite_accelerated(op, @@ -610,7 +610,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) { - ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv; @@ -686,7 +686,7 @@ static void ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height) { - ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDst); @@ -705,7 +705,7 @@ ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, static void ExaDoneComposite(PixmapPtr pPixmap) { - ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pPixmap->drawable.pScreen); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; @@ -814,7 +814,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, pointer pPixData) { ScreenPtr pScreen = pPixmap->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 84a3a2fa4e2..242323d2aa2 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -46,6 +46,7 @@ #include #endif +#include "compat-api.h" #include "pipe/p_screen.h" #include "util/u_inlines.h" #include "util/u_debug.h" @@ -116,7 +117,7 @@ typedef struct _modesettingRec /* Broken-out options. */ OptionInfoPtr Options; - void (*blockHandler)(int, pointer, pointer, pointer); + void (*blockHandler)(BLOCKHANDLER_ARGS_DECL); struct pipe_fence_handle *fence[XORG_NR_FENCES]; CreateScreenResourcesProcPtr createScreenResources; diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 67fd6dfb501..d19f44c26fd 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -592,7 +592,7 @@ put_image(ScrnInfoPtr pScrn, DrawablePtr pDraw) { struct xorg_xv_port_priv *pPriv = (struct xorg_xv_port_priv *) data; - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); PixmapPtr pPixmap; INT32 x1, x2, y1, y2; BoxRec dstBox; @@ -658,7 +658,7 @@ port_priv_create(struct xorg_renderer *r) static XF86VideoAdaptorPtr xorg_setup_textured_adapter(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); modesettingPtr ms = modesettingPTR(pScrn); XF86VideoAdaptorPtr adapt; XF86AttributePtr attrs; @@ -720,7 +720,7 @@ xorg_setup_textured_adapter(ScreenPtr pScreen) void xorg_xv_init(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); /*modesettingPtr ms = modesettingPTR(pScrn);*/ XF86VideoAdaptorPtr *adaptors, *new_adaptors = NULL; XF86VideoAdaptorPtr textured_adapter; diff --git a/src/gallium/state_trackers/xorg/xorg_xvmc.c b/src/gallium/state_trackers/xorg/xorg_xvmc.c index 0f3f3f00907..ea9a74150d8 100644 --- a/src/gallium/state_trackers/xorg/xorg_xvmc.c +++ b/src/gallium/state_trackers/xorg/xorg_xvmc.c @@ -100,7 +100,7 @@ static const XF86MCAdaptorRec adaptor_template = void xorg_xvmc_init(ScreenPtr pScreen, char *name) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); XF86MCAdaptorPtr adaptorXvMC = xf86XvMCCreateAdaptorRec(); if (!adaptorXvMC) return; -- 2.30.2