[PATCH 3/4] shm: Replace open-coded version of GetScratchPixmapHeader

Chris Wilson chris at chris-wilson.co.uk
Sun Jun 5 22:36:08 PDT 2011


fbShmCreatePixmap() was just another variant of wrapping an arbitrary
data pointer within a pixmap, ala GetScratchPixmapHeader().

By using the common version, the fbShmCreatePixmap() is also updated to
pass the information that the pixmap contents are not part of the ddx
address space.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 Xext/shm.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/Xext/shm.c b/Xext/shm.c
index b08af82..c6a3aee 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1018,18 +1018,10 @@ static PixmapPtr
 fbShmCreatePixmap (ScreenPtr pScreen,
 		   int width, int height, int depth, char *addr)
 {
-    PixmapPtr pPixmap;
-
-    pPixmap = (*pScreen->CreatePixmap)(pScreen, 0, 0, pScreen->rootDepth, 0);
-    if (!pPixmap)
-	return NullPixmap;
-
-    if (!(*pScreen->ModifyPixmapHeader)(pPixmap, width, height, depth,
-	    BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
-	(*pScreen->DestroyPixmap)(pPixmap);
-	return NullPixmap;
-    }
-    return pPixmap;
+    return GetScratchPixmapHeader(pScreen, width, height, depth,
+				  BitsPerPixel(depth),
+				  PixmapBytePad(width, depth),
+				  addr);
 }
 
 static int
-- 
1.7.5.3



More information about the xorg-devel mailing list