[PATCH xf86-video-amdgpu 11/13] glamor: Add radeon_pixmap parameter to radeon_glamor_create_textured_pixmap

Michel Dänzer michel at daenzer.net
Tue Jun 2 02:21:29 PDT 2015


From: Michel Dänzer <michel.daenzer at amd.com>

(cherry picked from radeon commit 051d46382656ffc3e6cac1aab3aee7efdf5b623a)

Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Signed-off-by: Darren Powell <darren.powell at amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_glamor.c   | 20 +++++++-------------
 src/amdgpu_glamor.h   |  5 ++++-
 src/drmmode_display.c |  3 ++-
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 36241ce..79b3d01 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -126,28 +126,22 @@ Bool amdgpu_glamor_pre_init(ScrnInfoPtr scrn)
 	return TRUE;
 }
 
-Bool amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap)
+Bool
+amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_pixmap *priv)
 {
 	ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
 	AMDGPUInfoPtr info = AMDGPUPTR(scrn);
-	struct amdgpu_pixmap *priv;
 	union gbm_bo_handle bo_handle;
 
 	if ((info->use_glamor) == 0)
 		return TRUE;
 
-	priv = amdgpu_get_pixmap_private(pixmap);
-	if (!priv->stride) {
+	if (!priv->stride)
 		priv->stride = pixmap->devKind;
-	}
 
 	bo_handle = gbm_bo_get_handle(priv->bo->bo.gbm);
-	if (glamor_egl_create_textured_pixmap(pixmap, bo_handle.u32,
-					      priv->stride)) {
-		return TRUE;
-	} else {
-		return FALSE;
-	}
+	return glamor_egl_create_textured_pixmap(pixmap, bo_handle.u32,
+						 priv->stride);
 }
 
 Bool amdgpu_glamor_pixmap_is_offscreen(PixmapPtr pixmap)
@@ -206,7 +200,7 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 		screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, priv->stride,
 					   NULL);
 
-		if (!amdgpu_glamor_create_textured_pixmap(pixmap))
+		if (!amdgpu_glamor_create_textured_pixmap(pixmap, priv))
 			goto fallback_glamor;
 	}
 
@@ -280,7 +274,7 @@ amdgpu_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *handle)
 	priv = amdgpu_get_pixmap_private(pixmap);
 	priv->stride = pixmap->devKind;
 
-	if (!amdgpu_glamor_create_textured_pixmap(pixmap)) {
+	if (!amdgpu_glamor_create_textured_pixmap(pixmap, priv)) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			   "Failed to get PRIME drawable for glamor pixmap.\n");
 		return FALSE;
diff --git a/src/amdgpu_glamor.h b/src/amdgpu_glamor.h
index 01b5ce1..f2414da 100644
--- a/src/amdgpu_glamor.h
+++ b/src/amdgpu_glamor.h
@@ -48,6 +48,8 @@
 #define GLAMOR_USE_PICTURE_SCREEN 0
 #endif
 
+struct amdgpu_pixmap;
+
 Bool amdgpu_glamor_pre_init(ScrnInfoPtr scrn);
 Bool amdgpu_glamor_init(ScreenPtr screen);
 Bool amdgpu_glamor_create_screen_resources(ScreenPtr screen);
@@ -55,7 +57,8 @@ void amdgpu_glamor_free_screen(int scrnIndex, int flags);
 
 void amdgpu_glamor_flush(ScrnInfoPtr pScrn);
 
-Bool amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap);
+Bool
+amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_pixmap *priv);
 void amdgpu_glamor_exchange_buffers(PixmapPtr src, PixmapPtr dst);
 
 Bool amdgpu_glamor_pixmap_is_offscreen(PixmapPtr pixmap);
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 01fe860..870ced6 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -108,7 +108,8 @@ static PixmapPtr drmmode_create_bo_pixmap(ScrnInfoPtr pScrn,
 
 	amdgpu_set_pixmap_bo(pixmap, bo);
 
-	if (!amdgpu_glamor_create_textured_pixmap(pixmap)) {
+	if (!amdgpu_glamor_create_textured_pixmap(pixmap,
+						  amdgpu_get_pixmap_private(pixmap))) {
 		pScreen->DestroyPixmap(pixmap);
 		return NULL;
 	}
-- 
2.1.4



More information about the xorg-driver-ati mailing list