[PATCH] glamor: Remove the stride member of struct radeon_pixmap

Michel Dänzer michel at daenzer.net
Thu Apr 16 02:48:19 PDT 2015


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

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

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/radeon.h        |  1 -
 src/radeon_dri2.c   |  5 +++--
 src/radeon_glamor.c | 16 ++++++----------
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/src/radeon.h b/src/radeon.h
index afb66b2..dbc1660 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -256,7 +256,6 @@ struct radeon_pixmap {
 	struct radeon_bo *bo;
 
 	uint32_t tiling_flags;
-	int stride;
 
 	/* GEM handle for glamor-only pixmaps shared via DRI3 */
 	Bool handle_valid;
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index edf643d..31a1ce7 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -111,16 +111,17 @@ static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
 	/* And redirect the pixmap to the new bo (for 3D). */
 	glamor_egl_exchange_buffers(old, pixmap);
 	radeon_set_pixmap_private(old, priv);
-	screen->DestroyPixmap(pixmap);
 	old->refcnt++;
 
 	screen->ModifyPixmapHeader(old,
 				   old->drawable.width,
 				   old->drawable.height,
 				   0, 0,
-				   priv->stride,
+				   pixmap->devKind,
 				   NULL);
 
+	screen->DestroyPixmap(pixmap);
+
 #endif /* USE_GLAMOR*/
 
 	return old;
diff --git a/src/radeon_glamor.c b/src/radeon_glamor.c
index eccb8f7..f00967f 100644
--- a/src/radeon_glamor.c
+++ b/src/radeon_glamor.c
@@ -159,11 +159,8 @@ radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_pixmap *pri
 	if ((info->use_glamor) == 0)
 		return TRUE;
 
-	if (!priv->stride)
-		priv->stride = pixmap->devKind;
-
 	return glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle,
-						 priv->stride);
+						 pixmap->devKind);
 }
 
 static PixmapPtr
@@ -200,13 +197,15 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 		return pixmap;
 
 	if (w && h) {
+		int stride;
+
 		priv = calloc(1, sizeof (struct radeon_pixmap));
 		if (priv == NULL)
 			goto fallback_pixmap;
 
 		priv->bo = radeon_alloc_pixmap_bo(scrn, w, h, depth, usage,
 						  pixmap->drawable.bitsPerPixel,
-						  &priv->stride,
+						  &stride,
 						  &priv->surface,
 						  &priv->tiling_flags);
 		if (!priv->bo)
@@ -214,7 +213,7 @@ radeon_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 
 		radeon_set_pixmap_private(pixmap, priv);
 
-		screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, priv->stride, NULL);
+		screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
 
 		if (!radeon_glamor_create_textured_pixmap(pixmap, priv))
 			goto fallback_glamor;
@@ -298,7 +297,6 @@ radeon_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *handle)
 		return FALSE;
 
 	priv = radeon_get_pixmap_private(pixmap);
-	priv->stride = pixmap->devKind;
 	priv->surface = surface;
 
 	if (!radeon_glamor_create_textured_pixmap(pixmap, priv)) {
@@ -310,9 +308,7 @@ radeon_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;
 }
-- 
2.1.4



More information about the xorg-driver-ati mailing list