diff options
author | Dave Airlie <airlied@redhat.com> | 2011-05-26 16:11:26 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-05-26 16:11:26 +1000 |
commit | f2d082e0ed45f34873472c1e5acaa692faf6b5f9 (patch) | |
tree | fe78131328d631dfd465e25ee741dcf3d90bebee | |
parent | 189d5a891f6a156d262f9ab8f86d1ffdaa832422 (diff) |
fixup pixmap size setup
-rw-r--r-- | dix/dispatch.c | 1 | ||||
-rw-r--r-- | dix/impedscrn.c | 8 | ||||
-rw-r--r-- | dix/main.c | 1 | ||||
-rw-r--r-- | dix/pixmap.c | 8 | ||||
-rw-r--r-- | include/imped.h | 2 | ||||
-rw-r--r-- | include/scrnintstr.h | 2 |
6 files changed, 18 insertions, 4 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c index c091e567c..e31476490 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3850,6 +3850,7 @@ AddScreen( } pScreen->myNum = i; pScreen->totalPixmapSize = 0; /* computed in CreateScratchPixmapForScreen */ + pScreen->totalProtoPixmapSize = 0; /* computed in CreateScratchPixmapForScreen */ pScreen->ClipNotify = 0; /* for R4 ddx compatibility */ pScreen->CreateScreenResources = 0; diff --git a/dix/impedscrn.c b/dix/impedscrn.c index 51322f2b3..cfc4749d4 100644 --- a/dix/impedscrn.c +++ b/dix/impedscrn.c @@ -10,6 +10,7 @@ #include "imped.h" #include "drvline.h" +#include "drv_pixmapstr.h" #include "micmap.h" DevPrivateKeyRec drvZeroLineScreenKeyRec; @@ -306,9 +307,16 @@ impedScreenInit(ScreenPtr pScreen) pScreen->CloseScreen = impedCloseScreen; drvSetZeroLineBias(pScreen, DEFAULTZEROLINEBIAS); + return TRUE; } +void +impedScreenSetPixmapSize(ScreenPtr pScreen) +{ + /* might be wrong */ + pScreen->totalPixmapSize = BitmapBytePad((sizeof(PixmapRec) + dixPrivatesSize(PRIVATE_PIXMAP)) * 8); +} DevPrivateKeyRec drvZeroLineScreenKeyRec; diff --git a/dix/main.c b/dix/main.c index 31e2d48c4..3b52d5a01 100644 --- a/dix/main.c +++ b/dix/main.c @@ -212,6 +212,7 @@ int main(int argc, char *argv[], char *envp[]) for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; + impedScreenSetPixmapSize(pScreen); if (!CreateScratchPixmapsForScreen(i)) FatalError("failed to create scratch pixmaps"); if (pScreen->CreateScreenResources && diff --git a/dix/pixmap.c b/dix/pixmap.c index 79d69378e..274b617bb 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -94,7 +94,7 @@ CreateScratchPixmapsForScreen(int scrnum) unsigned int pixmap_size; pixmap_size = sizeof(ProtoPixmapRec) + dixPrivatesSize(PRIVATE_PROTO_PIXMAP); - screenInfo.screens[scrnum]->totalPixmapSize = BitmapBytePad(pixmap_size * 8); + screenInfo.screens[scrnum]->totalProtoPixmapSize = BitmapBytePad(pixmap_size * 8); /* let it be created on first use */ screenInfo.screens[scrnum]->pScratchPixmap = NULL; @@ -115,12 +115,12 @@ AllocateProtoPixmap(ScreenPtr pScreen, int pixDataSize) { ProtoPixmapPtr pPixmap; - assert(pScreen->totalPixmapSize > 0); + assert(pScreen->totalProtoPixmapSize > 0); - if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize) + if (pScreen->totalProtoPixmapSize > ((size_t)-1) - pixDataSize) return NullProtoPixmap; - pPixmap = malloc(pScreen->totalPixmapSize + pixDataSize); + pPixmap = malloc(pScreen->totalProtoPixmapSize + pixDataSize); if (!pPixmap) return NullProtoPixmap; diff --git a/include/imped.h b/include/imped.h index 4fe915eb3..efbe9f8b5 100644 --- a/include/imped.h +++ b/include/imped.h @@ -47,4 +47,6 @@ impedCopyNtoN (DrawablePtr pSrcDrawable, void *closure); extern _X_EXPORT Bool impedCreateGC(GCPtr pGC); + +extern _X_EXPORT void impedScreenSetPixmapSize(ScreenPtr pScreen); #endif diff --git a/include/scrnintstr.h b/include/scrnintstr.h index a8cc7ce44..315d1205b 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -553,6 +553,8 @@ typedef struct _Screen { ProtoPixmapPtr pScratchPixmap; /* scratch pixmap "pool" */ + unsigned int totalProtoPixmapSize; + unsigned int totalPixmapSize; MarkWindowProcPtr MarkWindow; |