[PATCH 5/6] dix: make Create/Free scratch pixmaps take a ScreenPtr

Dave Airlie airlied at gmail.com
Wed May 23 09:07:17 PDT 2012


From: Dave Airlie <airlied at redhat.com>

While technically an API/ABI change I doubt anyone uses it,
but it helps in splitting screens up.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 dix/main.c       |    4 ++--
 dix/pixmap.c     |   10 +++++-----
 include/pixmap.h |    4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/dix/main.c b/dix/main.c
index 7837e9a..83efa7d 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -209,7 +209,7 @@ main(int argc, char *argv[], char *envp[])
         for (i = 0; i < screenInfo.numScreens; i++) {
             ScreenPtr pScreen = screenInfo.screens[i];
 
-            if (!CreateScratchPixmapsForScreen(i))
+            if (!CreateScratchPixmapsForScreen(pScreen))
                 FatalError("failed to create scratch pixmaps");
             if (pScreen->CreateScreenResources &&
                 !(*pScreen->CreateScreenResources) (pScreen))
@@ -322,7 +322,7 @@ main(int argc, char *argv[], char *envp[])
         CloseDownEvents();
 
         for (i = screenInfo.numScreens - 1; i >= 0; i--) {
-            FreeScratchPixmapsForScreen(i);
+            FreeScratchPixmapsForScreen(screenInfo.screens[i]);
             FreeGCperDepth(i);
             FreeDefaultStipple(i);
             (*screenInfo.screens[i]->CloseScreen) (screenInfo.screens[i]);
diff --git a/dix/pixmap.c b/dix/pixmap.c
index 47b220b..545ff54 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -84,23 +84,23 @@ FreeScratchPixmapHeader(PixmapPtr pPixmap)
 }
 
 Bool
-CreateScratchPixmapsForScreen(int scrnum)
+CreateScratchPixmapsForScreen(ScreenPtr pScreen)
 {
     unsigned int pixmap_size;
 
     pixmap_size = sizeof(PixmapRec) + dixPrivatesSize(PRIVATE_PIXMAP);
-    screenInfo.screens[scrnum]->totalPixmapSize =
+    pScreen->totalPixmapSize =
         BitmapBytePad(pixmap_size * 8);
 
     /* let it be created on first use */
-    screenInfo.screens[scrnum]->pScratchPixmap = NULL;
+    pScreen->pScratchPixmap = NULL;
     return TRUE;
 }
 
 void
-FreeScratchPixmapsForScreen(int scrnum)
+FreeScratchPixmapsForScreen(ScreenPtr pScreen)
 {
-    FreeScratchPixmapHeader(screenInfo.screens[scrnum]->pScratchPixmap);
+    FreeScratchPixmapHeader(pScreen->pScratchPixmap);
 }
 
 /* callable by ddx */
diff --git a/include/pixmap.h b/include/pixmap.h
index 26d737c..9bb5bb7 100644
--- a/include/pixmap.h
+++ b/include/pixmap.h
@@ -100,9 +100,9 @@ extern _X_EXPORT PixmapPtr GetScratchPixmapHeader(ScreenPtr /*pScreen */ ,
 
 extern _X_EXPORT void FreeScratchPixmapHeader(PixmapPtr /*pPixmap */ );
 
-extern _X_EXPORT Bool CreateScratchPixmapsForScreen(int /*scrnum */ );
+extern _X_EXPORT Bool CreateScratchPixmapsForScreen(ScreenPtr /*pScreen */ );
 
-extern _X_EXPORT void FreeScratchPixmapsForScreen(int /*scrnum */ );
+extern _X_EXPORT void FreeScratchPixmapsForScreen(ScreenPtr /*pScreen */ );
 
 extern _X_EXPORT PixmapPtr AllocatePixmap(ScreenPtr /*pScreen */ ,
                                           int /*pixDataSize */ );
-- 
1.7.6



More information about the xorg-devel mailing list