From de69b14deb4109dce884cf88d0a13ba294562822 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@gmail.com>
Date: Thu, 19 Jul 2012 06:53:59 +1000
Subject: [PATCH 4/4] compat: bump to new server API changes
---
src/compat/compat-qxl.h | 1 +
src/compat/compat-qxl_driver.c | 51 +++++++++++++++++++++---------------------
2 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/src/compat/compat-qxl.h b/src/compat/compat-qxl.h
index 2c61699..eed3a2f 100644
--- a/src/compat/compat-qxl.h
+++ b/src/compat/compat-qxl.h
@@ -41,6 +41,7 @@
#include "fb.h"
#include "vgaHW.h"
+#include "../compat-api.h"
#define hidden _X_HIDDEN
#define QXL_NAME "compat_qxl"
diff --git a/src/compat/compat-qxl_driver.c b/src/compat/compat-qxl_driver.c
index 758ee24..0047382 100644
--- a/src/compat/compat-qxl_driver.c
+++ b/src/compat/compat-qxl_driver.c
@@ -260,14 +260,14 @@ compat_qxl_restore_state(ScrnInfoPtr pScrn)
}
static Bool
-compat_qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
+compat_qxl_close_screen(CLOSE_SCREEN_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
compat_qxl_screen_t *compat_qxl = pScrn->driverPrivate;
if (pScrn->vtSema) {
compat_qxl_restore_state(pScrn);
- compat_qxl_unmap_memory(compat_qxl, scrnIndex);
+ compat_qxl_unmap_memory(compat_qxl, pScrn->scrnIndex);
}
pScrn->vtSema = FALSE;
@@ -276,14 +276,15 @@ compat_qxl_close_screen(int scrnIndex, ScreenPtr pScreen)
pScreen->CreateScreenResources = compat_qxl->create_screen_resources;
pScreen->CloseScreen = compat_qxl->close_screen;
- return pScreen->CloseScreen(scrnIndex, pScreen);
+ return pScreen->CloseScreen(CLOSE_SCREEN_ARGS);
}
static Bool
-compat_qxl_switch_mode(int scrnIndex, DisplayModePtr p, int flags)
+compat_qxl_switch_mode(SWITCH_MODE_ARGS_DECL)
{
- compat_qxl_screen_t *compat_qxl = xf86Screens[scrnIndex]->driverPrivate;
- int mode_index = (int)(unsigned long)p->Private;
+ SCRN_INFO_PTR(arg);
+ compat_qxl_screen_t *compat_qxl = pScrn->driverPrivate;
+ int mode_index = (int)(unsigned long)mode->Private;
struct compat_qxl_mode *m = compat_qxl->modes + mode_index;
ScreenPtr pScreen = compat_qxl->pScrn->pScreen;
@@ -291,8 +292,8 @@ compat_qxl_switch_mode(int scrnIndex, DisplayModePtr p, int flags)
return FALSE;
/* if (debug) */
- xf86DrvMsg (scrnIndex, X_INFO, "Setting mode %d (%d x %d) (%d x %d) %p\n",
- m->id, m->x_res, m->y_res, p->HDisplay, p->VDisplay, p);
+ xf86DrvMsg (pScrn->scrnIndex, X_INFO, "Setting mode %d (%d x %d) (%d x %d) %p\n",
+ m->id, m->x_res, m->y_res, mode->HDisplay, mode->VDisplay, mode);
outb(compat_qxl->io_base + QXL_IO_RESET, 0);
@@ -571,7 +572,7 @@ compat_qxl_sanity_check (compat_qxl_screen_t *compat_qxl)
if (compat_qxl->rom->mode == ~0)
{
ErrorF("QXL device jumped back to VGA mode - resetting mode\n");
- compat_qxl_switch_mode(compat_qxl->pScrn->scrnIndex, compat_qxl->pScrn->currentMode, 0);
+ compat_qxl_switch_mode(SWITCH_MODE_ARGS(compat_qxl->pScrn, compat_qxl->pScrn->currentMode));
}
}
@@ -638,7 +639,7 @@ compat_qxl_on_damage (DamagePtr pDamage, RegionPtr pRegion, pointer closure)
static Bool
compat_qxl_create_screen_resources(ScreenPtr pScreen)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
compat_qxl_screen_t *compat_qxl = pScrn->driverPrivate;
Bool ret;
PixmapPtr pPixmap;
@@ -691,7 +692,7 @@ compat_qxl_poly_fill_rect (DrawablePtr pDrawable,
int nrect,
xRectangle *prect)
{
- ScrnInfoPtr pScrn = xf86Screens[pDrawable->pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pDrawable->pScreen);
compat_qxl_screen_t *compat_qxl = pScrn->driverPrivate;
PixmapPtr pPixmap;
int xoff, yoff;
@@ -746,7 +747,7 @@ compat_qxl_copy_n_to_n (DrawablePtr pSrcDrawable,
void *closure)
{
ScreenPtr pScreen = pSrcDrawable->pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
compat_qxl_screen_t *compat_qxl = pScrn->driverPrivate;
int src_xoff, src_yoff;
int dst_xoff, dst_yoff;
@@ -859,7 +860,7 @@ static void
compat_qxl_fill_region_solid (DrawablePtr pDrawable, RegionPtr pRegion, Pixel pixel)
{
ScreenPtr pScreen = pDrawable->pScreen;
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
compat_qxl_screen_t *compat_qxl = pScrn->driverPrivate;
PixmapPtr pPixmap;
int xoff, yoff;
@@ -937,9 +938,9 @@ compat_qxl_create_gc (GCPtr pGC)
}
static Bool
-compat_qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+compat_qxl_screen_init(SCREEN_INIT_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
compat_qxl_screen_t *compat_qxl = pScrn->driverPrivate;
struct compat_qxl_rom *rom;
struct compat_qxl_ram_header *ram_header;
@@ -949,7 +950,7 @@ compat_qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
compat_qxl->pScrn = pScrn;
- if (!compat_qxl_map_memory(compat_qxl, scrnIndex))
+ if (!compat_qxl_map_memory(compat_qxl, pScrn->scrnIndex))
return FALSE;
rom = compat_qxl->rom;
@@ -1053,7 +1054,7 @@ compat_qxl_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
CHECK_POINT();
- compat_qxl_switch_mode(scrnIndex, pScrn->currentMode, 0);
+ compat_qxl_switch_mode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
CHECK_POINT();
@@ -1064,20 +1065,20 @@ out:
}
static Bool
-compat_qxl_enter_vt(int scrnIndex, int flags)
+compat_qxl_enter_vt(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
compat_qxl_save_state(pScrn);
- compat_qxl_switch_mode(scrnIndex, pScrn->currentMode, 0);
+ compat_qxl_switch_mode(SWITCH_MODE_ARGS(pScrn, pScrn->currentMode));
return TRUE;
}
static void
-compat_qxl_leave_vt(int scrnIndex, int flags)
+compat_qxl_leave_vt(VT_FUNC_ARGS_DECL)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SCRN_INFO_PTR(arg);
compat_qxl_restore_state(pScrn);
}
@@ -1212,9 +1213,9 @@ compat_qxl_find_native_mode(ScrnInfoPtr pScrn, DisplayModePtr p)
}
static ModeStatus
-compat_qxl_valid_mode(int scrn, DisplayModePtr p, Bool flag, int pass)
+compat_qxl_valid_mode(SCRN_ARG_TYPE arg, DisplayModePtr p, Bool flag, int pass)
{
- ScrnInfoPtr pScrn = xf86Screens[scrn];
+ SCRN_INFO_PTR(arg);
compat_qxl_screen_t *compat_qxl = pScrn->driverPrivate;
int bpp = pScrn->bitsPerPixel;
int mode_idx;
--
1.8.2.1