diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-01-13 16:29:11 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-01-13 16:30:51 +0000 |
commit | b7feeca0730bf55c23e5bc5af4cae9b8a73bba0e (patch) | |
tree | 371a013d76f8d7610a784c0904c7a44e3ccd90d4 | |
parent | 3cfde9f04362a858ddfe7990109147e32eed516c (diff) |
sna: Wrap direct access to ScrnInfoPtr->pScreen
Admittedly ScrnInfoPtr->pScreen has nearly always existed, but for
completeness wrap it up in a compat macro.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/compat-api.h | 6 | ||||
-rw-r--r-- | src/sna/sna.h | 5 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 6 | ||||
-rw-r--r-- | src/sna/sna_display.c | 15 | ||||
-rw-r--r-- | src/sna/sna_display_fake.c | 2 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 8 | ||||
-rw-r--r-- | src/sna/sna_glyphs.c | 2 | ||||
-rw-r--r-- | src/sna/sna_video_overlay.c | 2 |
8 files changed, 29 insertions, 17 deletions
diff --git a/src/compat-api.h b/src/compat-api.h index 9367d646..c9c76eb4 100644 --- a/src/compat-api.h +++ b/src/compat-api.h @@ -39,7 +39,13 @@ #ifndef XF86_HAS_SCRN_CONV #define xf86ScreenToScrn(s) xf86Screens[(s)->myNum] +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,1,0,0,0) #define xf86ScrnToScreen(s) screenInfo.screens[(s)->scrnIndex] +#else +#define xf86ScrnToScreen(s) ((s)->pScreen) +#endif +#else +#define xf86ScrnToScreen(s) ((s)->pScreen) #endif #ifndef XF86_SCRN_INTERFACE diff --git a/src/sna/sna.h b/src/sna/sna.h index 7a1bf34f..0c66d17e 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -462,6 +462,11 @@ to_sna_from_screen(ScreenPtr screen) return to_sna(xf86ScreenToScrn(screen)); } +pure static inline ScreenPtr to_screen_from_sna(struct sna *sna) +{ + return xf86ScrnToScreen(sna->scrn); +} + pure static inline struct sna * to_sna_from_pixmap(PixmapPtr pixmap) { diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 3adb9a77..fb18d580 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -1420,7 +1420,7 @@ static void __sna_free_pixmap(struct sna *sna, sna_accel_watch_flush(sna, -1); if (priv->header) { - assert(pixmap->drawable.pScreen == sna->scrn->pScreen); + assert(pixmap->drawable.pScreen == to_screen_from_sna(sna)); assert(!priv->shm); pixmap->devPrivate.ptr = sna->freed_pixmap; sna->freed_pixmap = pixmap; @@ -17247,7 +17247,7 @@ static void sna_accel_disarm_timer(struct sna *sna, int id) static bool has_offload_slaves(struct sna *sna) { #if HAS_PIXMAP_SHARING - ScreenPtr screen = sna->scrn->pScreen; + ScreenPtr screen = to_screen_from_sna(sna); PixmapDirtyUpdatePtr dirty; xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) { @@ -17395,7 +17395,7 @@ static bool sna_accel_do_expire(struct sna *sna) static void sna_accel_post_damage(struct sna *sna) { #if HAS_PIXMAP_SHARING - ScreenPtr screen = sna->scrn->pScreen; + ScreenPtr screen = to_screen_from_sna(sna); PixmapDirtyUpdatePtr dirty; bool flush = false; diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 8e469840..db337fba 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -1378,7 +1378,7 @@ bool sna_pixmap_discard_shadow_damage(struct sna_pixmap *priv, static bool sna_mode_enable_shadow(struct sna *sna) { - ScreenPtr screen = sna->scrn->pScreen; + ScreenPtr screen = to_screen_from_sna(sna); DBG(("%s\n", __FUNCTION__)); assert(sna->mode.shadow == NULL); @@ -1465,7 +1465,8 @@ static bool sna_crtc_enable_shadow(struct sna *sna, struct sna_crtc *crtc) __FUNCTION__, crtc->id, crtc->pipe, crtc->slave_pixmap->drawable.serialNumber)); crtc->slave_damage = DamageCreate(sna_crtc_slave_damage, NULL, DamageReportRawRegion, TRUE, - sna->scrn->pScreen, crtc); + to_screen_from_sna(sna), + crtc); if (crtc->slave_damage == NULL) { if (!--sna->mode.shadow_active) sna_mode_disable_shadow(sna); @@ -1746,7 +1747,7 @@ void sna_copy_fbcon(struct sna *sna) kgem_bo_destroy(&sna->kgem, bo); #if ABI_VIDEODRV_VERSION >= SET_ABI_VERSION(10, 0) - sna->scrn->pScreen->canDoBGNoneRoot = ok; + to_screen_from_sna(sna)->canDoBGNoneRoot = ok; #endif } @@ -2221,7 +2222,7 @@ static void sna_crtc_randr(xf86CrtcPtr crtc) static void sna_crtc_damage(xf86CrtcPtr crtc) { - ScreenPtr screen = crtc->scrn->pScreen; + ScreenPtr screen = xf86ScrnToScreen(crtc->scrn); struct sna *sna = to_sna(crtc->scrn); RegionRec region, *damage; @@ -4347,7 +4348,7 @@ sna_mode_resize(ScrnInfoPtr scrn, int width, int height) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); struct sna *sna = to_sna(scrn); - ScreenPtr screen = scrn->pScreen; + ScreenPtr screen = xf86ScrnToScreen(scrn); PixmapPtr new_front; int i; @@ -6698,7 +6699,7 @@ sna_crtc_redisplay__fallback(xf86CrtcPtr crtc, RegionPtr region, struct kgem_bo { int16_t sx, sy; struct sna *sna = to_sna(crtc->scrn); - ScreenPtr screen = sna->scrn->pScreen; + ScreenPtr screen = xf86ScrnToScreen(crtc->scrn); DrawablePtr draw = crtc_source(crtc, &sx, &sy); PictFormatPtr format; PictTransform T; @@ -6796,7 +6797,7 @@ sna_crtc_redisplay__composite(xf86CrtcPtr crtc, RegionPtr region, struct kgem_bo { int16_t sx, sy; struct sna *sna = to_sna(crtc->scrn); - ScreenPtr screen = crtc->scrn->pScreen; + ScreenPtr screen = xf86ScrnToScreen(crtc->scrn); DrawablePtr draw = crtc_source(crtc, &sx, &sy); struct sna_composite_op tmp; PictFormatPtr format; diff --git a/src/sna/sna_display_fake.c b/src/sna/sna_display_fake.c index 4d74c38d..8830204a 100644 --- a/src/sna/sna_display_fake.c +++ b/src/sna/sna_display_fake.c @@ -192,7 +192,7 @@ static const xf86OutputFuncsRec sna_output_funcs = { static Bool sna_mode_resize(ScrnInfoPtr scrn, int width, int height) { - ScreenPtr screen = scrn->pScreen; + ScreenPtr screen = xf86ScrnToScreen(scrn); PixmapPtr new_front; DBG(("%s (%d, %d) -> (%d, %d)\n", __FUNCTION__, diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 59abc031..6c122d02 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -185,8 +185,8 @@ sna_set_fallback_mode(ScrnInfoPtr scrn) xf86DisableUnusedFunctions(scrn); #ifdef RANDR_12_INTERFACE - if (get_root_window(scrn->pScreen)) - xf86RandR12TellChanged(scrn->pScreen); + if (get_root_window(xf86ScrnToScreen(scrn))) + xf86RandR12TellChanged(xf86ScrnToScreen(scrn)); #endif } @@ -222,7 +222,7 @@ static Bool sna_create_screen_resources(ScreenPtr screen) screen->width, screen->height, screen->rootDepth)); assert(sna->scrn == xf86ScreenToScrn(screen)); - assert(sna->scrn->pScreen == screen); + assert(to_screen_from_sna(sna) == screen); /* free the data used during miInitScreen */ free(screen->devPrivate); @@ -1137,7 +1137,7 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL) DBG(("%s\n", __FUNCTION__)); assert(sna->scrn == scrn); - assert(scrn->pScreen == NULL); /* set afterwards */ + assert(to_screen_from_sna(sna) == NULL); /* set afterwards */ assert(sna->freed_pixmap == NULL); diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c index a5dfb06b..6d57e8fd 100644 --- a/src/sna/sna_glyphs.c +++ b/src/sna/sna_glyphs.c @@ -185,7 +185,7 @@ void sna_glyphs_close(struct sna *sna) */ bool sna_glyphs_create(struct sna *sna) { - ScreenPtr screen = sna->scrn->pScreen; + ScreenPtr screen = to_screen_from_sna(sna); pixman_color_t white = { 0xffff, 0xffff, 0xffff, 0xffff }; unsigned int formats[] = { PIXMAN_a8, diff --git a/src/sna/sna_video_overlay.c b/src/sna/sna_video_overlay.c index aee6d479..d7821134 100644 --- a/src/sna/sna_video_overlay.c +++ b/src/sna/sna_video_overlay.c @@ -130,7 +130,7 @@ static int sna_video_overlay_stop(ddStopVideo_ARGS) DBG(("%s()\n", __FUNCTION__)); - REGION_EMPTY(scrn->pScreen, &video->clip); + REGION_EMPTY(to_screen_from_sna(sna), &video->clip); request.flags = 0; (void)drmIoctl(sna->kgem.fd, |