diff --git a/dix/dispatch.c b/dix/dispatch.c index 0e5aced..786e7d4 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3914,8 +3914,12 @@ AddScreen( any of the strings pointed to by argv. They may be passed to multiple screens. */ + + if (!CreateScratchPixmapsForScreen(pScreen)) + FatalError("failed to create scratch pixmaps"); screenInfo.screens[i] = pScreen; screenInfo.numScreens++; + if (!(*pfnInit)(i, pScreen, argc, argv)) { dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN); diff --git a/dix/main.c b/dix/main.c index 5c46dc1..d4a0987 100644 --- a/dix/main.c +++ b/dix/main.c @@ -213,8 +213,6 @@ int main(int argc, char *argv[], char *envp[]) for (i = 0; i < screenInfo.numScreens; i++) { ScreenPtr pScreen = screenInfo.screens[i]; - if (!CreateScratchPixmapsForScreen(i)) - FatalError("failed to create scratch pixmaps"); if (pScreen->CreateScreenResources && !(*pScreen->CreateScreenResources)(pScreen)) FatalError("failed to create screen resources"); diff --git a/dix/pixmap.c b/dix/pixmap.c index cbb5e7f..c4519af 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -89,15 +89,15 @@ FreeScratchPixmapHeader(PixmapPtr pPixmap) Bool -CreateScratchPixmapsForScreen(int scrnum) +CreateScratchPixmapsForScreen(ScreenPtr scrnptr) { unsigned int pixmap_size; pixmap_size = sizeof(PixmapRec) + dixPrivatesSize(PRIVATE_PIXMAP); - screenInfo.screens[scrnum]->totalPixmapSize = BitmapBytePad(pixmap_size * 8); + scrnptr->totalPixmapSize = BitmapBytePad(pixmap_size * 8); /* let it be created on first use */ - screenInfo.screens[scrnum]->pScratchPixmap = NULL; + scrnptr->pScratchPixmap = NULL; return TRUE; } diff --git a/include/pixmap.h b/include/pixmap.h index 5cf42d1..24921f9 100644 --- a/include/pixmap.h +++ b/include/pixmap.h @@ -106,7 +106,7 @@ extern _X_EXPORT void FreeScratchPixmapHeader( PixmapPtr /*pPixmap*/); extern _X_EXPORT Bool CreateScratchPixmapsForScreen( - int /*scrnum*/); + ScreenPtr /*scrnptr*/); extern _X_EXPORT void FreeScratchPixmapsForScreen( int /*scrnum*/);