[PATCH xf86-video-ati] glamor: Use glamor_egl_create_textured_pixmap_from_gbm_bo when possible
Michel Dänzer
michel at daenzer.net
Fri Jul 27 09:33:09 UTC 2018
From: Michel Dänzer <michel.daenzer at amd.com>
Inspired by the modesetting driver.
Fixes screen pixmap corruption with Xorg < 1.20, and as a bonus,
simplifies the code slightly.
Bugzilla: https://bugs.freedesktop.org/107385
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/radeon_glamor.c | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index b649bd18d..368e433ef 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -50,9 +50,9 @@ radeon_glamor_exchange_buffers(PixmapPtr src,
Bool
radeon_glamor_create_screen_resources(ScreenPtr screen)
{
+ PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
RADEONInfoPtr info = RADEONPTR(scrn);
- uint32_t handle;
if (!info->use_glamor)
return TRUE;
@@ -62,16 +62,11 @@ radeon_glamor_create_screen_resources(ScreenPtr screen)
return FALSE;
#endif
- if (info->front_buffer->flags & RADEON_BO_FLAGS_GBM)
- handle = gbm_bo_get_handle(info->front_buffer->bo.gbm).u32;
- else
- handle = info->front_buffer->bo.radeon->handle;
-
- if (!glamor_egl_create_textured_screen(screen, handle,
- scrn->displayWidth *
- info->pixel_bytes))
+ if (!radeon_glamor_create_textured_pixmap(screen_pixmap, info->front_buffer))
return FALSE;
+ glamor_set_screen_pixmap(screen_pixmap, NULL);
+
return TRUE;
}
@@ -180,17 +175,18 @@ radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_buffer *bo)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
RADEONInfoPtr info = RADEONPTR(scrn);
- uint32_t handle;
if (!info->use_glamor)
return TRUE;
- if (bo->flags & RADEON_BO_FLAGS_GBM)
- handle = gbm_bo_get_handle(bo->bo.gbm).u32;
- else
- handle = bo->bo.radeon->handle;
-
- return glamor_egl_create_textured_pixmap(pixmap, handle, pixmap->devKind);
+ if (bo->flags & RADEON_BO_FLAGS_GBM) {
+ return glamor_egl_create_textured_pixmap_from_gbm_bo(pixmap,
+ bo->bo.gbm);
+ } else {
+ return glamor_egl_create_textured_pixmap(pixmap,
+ bo->bo.radeon->handle,
+ pixmap->devKind);
+ }
}
static Bool radeon_glamor_destroy_pixmap(PixmapPtr pixmap)
--
2.18.0
More information about the amd-gfx
mailing list