[PATCH xf86-video-amdgpu 10/11] glamor: Remove the stride member of struct radeon_pixmap

Michel Dänzer michel at daenzer.net
Wed Jun 10 02:04:25 PDT 2015


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

Its value was always the same as that of the PixmapRec devKind member.

(Cherry picked from radeon commit ed401f5b4f07375db17ff05e294907ec95fc946d)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_dri2.c   |  5 +++--
 src/amdgpu_glamor.c | 13 +++++--------
 src/amdgpu_pixmap.c | 11 ++++++-----
 src/amdgpu_pixmap.h |  1 -
 4 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index bdb0d37..bde36de 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -109,15 +109,16 @@ static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
 	/* And redirect the pixmap to the new bo (for 3D). */
 	glamor_egl_exchange_buffers(old, pixmap);
 	amdgpu_set_pixmap_private(old, priv);
-	screen->DestroyPixmap(pixmap);
 	old->refcnt++;
 
 	screen->ModifyPixmapHeader(old,
 				   old->drawable.width,
 				   old->drawable.height,
-				   0, 0, priv->stride, NULL);
+				   0, 0, pixmap->devKind, NULL);
 	old->devPrivate.ptr = NULL;
 
+	screen->DestroyPixmap(pixmap);
+
 	return old;
 }
 
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 0c100d4..f74aa28 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -136,9 +136,6 @@ amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_pixmap *pri
 	if ((info->use_glamor) == 0)
 		return TRUE;
 
-	if (!priv->stride)
-		priv->stride = pixmap->devKind;
-
 	if (!amdgpu_bo_get_handle(priv->bo, &bo_handle))
 		return FALSE;
 
@@ -183,20 +180,21 @@ amdgpu_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 		return pixmap;
 
 	if (w && h) {
+		int stride;
+
 		priv = calloc(1, sizeof(struct amdgpu_pixmap));
 		if (priv == NULL)
 			goto fallback_pixmap;
 
 		priv->bo = amdgpu_alloc_pixmap_bo(scrn, w, h, depth, usage,
 						  pixmap->drawable.bitsPerPixel,
-						  &priv->stride);
+						  &stride);
 		if (!priv->bo)
 			goto fallback_priv;
 
 		amdgpu_set_pixmap_private(pixmap, priv);
 
-		screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, priv->stride,
-					   NULL);
+		screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
 
 		pixmap->devPrivate.ptr = NULL;
 
@@ -279,7 +277,6 @@ amdgpu_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *handle)
 		return FALSE;
 
 	priv = amdgpu_get_pixmap_private(pixmap);
-	priv->stride = pixmap->devKind;
 
 	if (!amdgpu_glamor_create_textured_pixmap(pixmap, priv)) {
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
@@ -290,7 +287,7 @@ amdgpu_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *handle)
 	screen->ModifyPixmapHeader(pixmap,
 				   pixmap->drawable.width,
 				   pixmap->drawable.height,
-				   0, 0, priv->stride, NULL);
+				   0, 0, 0, NULL);
 
 	return TRUE;
 }
diff --git a/src/amdgpu_pixmap.c b/src/amdgpu_pixmap.c
index 657ad33..0a1b0b1 100644
--- a/src/amdgpu_pixmap.c
+++ b/src/amdgpu_pixmap.c
@@ -53,6 +53,8 @@ amdgpu_pixmap_create(ScreenPtr screen, int w, int h, int depth,	unsigned usage)
 		return pixmap;
 
 	if (w && h) {
+		int stride;
+
 		priv = calloc(1, sizeof(struct amdgpu_pixmap));
 		if (priv == NULL)
 			goto fallback_pixmap;
@@ -62,8 +64,8 @@ amdgpu_pixmap_create(ScreenPtr screen, int w, int h, int depth,	unsigned usage)
 		if (!info->use_glamor)
 			usage |= AMDGPU_CREATE_PIXMAP_LINEAR;
 		priv->bo = amdgpu_alloc_pixmap_bo(scrn, w, h, depth, usage,
-						pixmap->drawable.bitsPerPixel,
-						&priv->stride);
+						  pixmap->drawable.bitsPerPixel,
+						  &stride);
 		if (!priv->bo)
 			goto fallback_priv;
 
@@ -74,9 +76,8 @@ amdgpu_pixmap_create(ScreenPtr screen, int w, int h, int depth,	unsigned usage)
 			goto fallback_bo;
 		}
 
-		screen->ModifyPixmapHeader(pixmap, w, h,
-				0, 0, priv->stride,
-				priv->bo->cpu_ptr);
+		screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride,
+					   priv->bo->cpu_ptr);
 	}
 
 	return pixmap;
diff --git a/src/amdgpu_pixmap.h b/src/amdgpu_pixmap.h
index b269853..a8f204f 100644
--- a/src/amdgpu_pixmap.h
+++ b/src/amdgpu_pixmap.h
@@ -33,7 +33,6 @@ struct amdgpu_pixmap {
 	uint_fast32_t gpu_write;
 
 	struct amdgpu_buffer *bo;
-	int stride;
 };
 
 #if HAS_DEVPRIVATEKEYREC
-- 
2.1.4



More information about the xorg-driver-ati mailing list