From e2cd67abb4aa8b5c942b46dd66dac091b9fad7ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 16 Mar 2020 17:43:54 +0100 Subject: [PATCH 1/2] Bail from amdgpu_pixmap_get_handle with ShadowFB There's no pixmap private in that case. The callers handle this gracefully. Reviewed-by: Alex Deucher --- src/amdgpu_bo_helper.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/amdgpu_bo_helper.c b/src/amdgpu_bo_helper.c index 6f7d6df..3f62214 100644 --- a/src/amdgpu_bo_helper.c +++ b/src/amdgpu_bo_helper.c @@ -185,13 +185,15 @@ uint64_t amdgpu_pixmap_get_tiling_info(PixmapPtr pixmap) Bool amdgpu_pixmap_get_handle(PixmapPtr pixmap, uint32_t *handle) { -#ifdef USE_GLAMOR ScreenPtr screen = pixmap->drawable.pScreen; ScrnInfoPtr scrn = xf86ScreenToScrn(screen); AMDGPUInfoPtr info = AMDGPUPTR(scrn); -#endif - struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap); + struct amdgpu_pixmap *priv; + + if (info->shadow_fb) + return FALSE; + priv = amdgpu_get_pixmap_private(pixmap); if (!priv) { priv = calloc(1, sizeof(*priv)); amdgpu_set_pixmap_private(pixmap, priv); -- GitLab From cb27a5b1120266e4baaa3eb784ff041977ded43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 29 Nov 2019 16:37:32 +0100 Subject: [PATCH 2/2] Handle NULL fb_ptr in pixmap_get_fb This can happen when HW acceleration is disabled. Fixes https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/issues/188 (ported from radeon commit 4d84cf438e7f1bebf0053035ef0292e9fed257d1) Reviewed-by: Alex Deucher --- src/amdgpu_pixmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h index 94ec210..663d414 100644 --- a/src/amdgpu_pixmap.h +++ b/src/amdgpu_pixmap.h @@ -162,7 +162,7 @@ amdgpu_pixmap_get_fb(PixmapPtr pix) handle); } - return *fb_ptr; + return fb_ptr ? *fb_ptr : NULL; } enum { -- GitLab