[PATCH xf86-video-dummy 4/4] Get rid of dPtr->FBBase

Bob Terek xorg at esoterek.com
Tue Dec 6 22:41:53 UTC 2016


The pointer to the screen's pixels is stored in the screen pixmap's
devPrivate.ptr field.  Just use that instead of storing it
redundantly.

In addition, don't leak the screen if the server was VT switched.

Signed-off-by: Bob Terek <xorg at esoterek.com>
---
 src/dummy.h        |  1 -
 src/dummy_cursor.c |  2 --
 src/dummy_driver.c | 11 +++++------
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/dummy.h b/src/dummy.h
index f902fa6..82fbdea 100644
--- a/src/dummy.h
+++ b/src/dummy.h
@@ -50,7 +50,6 @@ typedef struct dummyRec
     int cursorFG, cursorBG;
 
     dummy_colors colors[256];
-    pointer* FBBase;
     Bool        (*CreateWindow)() ;     /* wrapped CreateWindow */
     Bool prop;
 } DUMMYRec, *DUMMYPtr;
diff --git a/src/dummy_cursor.c b/src/dummy_cursor.c
index 07a89bf..d7c67c6 100644
--- a/src/dummy_cursor.c
+++ b/src/dummy_cursor.c
@@ -39,8 +39,6 @@ dummySetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
 {
     DUMMYPtr dPtr = DUMMYPTR(pScrn);
 
-/*     unsigned char *_dest = ((unsigned char *)dPtr->FBBase + */
-/* 			    pScrn->videoRam * 1024 - 1024); */
     dPtr->cursorX = x;
     dPtr->cursorY = y;
 }
diff --git a/src/dummy_driver.c b/src/dummy_driver.c
index 6653883..03fa1d7 100644
--- a/src/dummy_driver.c
+++ b/src/dummy_driver.c
@@ -501,7 +501,8 @@ DUMMYScreenInit(SCREEN_INIT_ARGS_DECL)
     DUMMYPtr dPtr;
     int ret;
     VisualPtr visual;
-    
+    void *pixels;
+
     /*
      * we need to get the ScrnInfoRec for this screen, so let's allocate
      * one first thing
@@ -511,7 +512,7 @@ DUMMYScreenInit(SCREEN_INIT_ARGS_DECL)
     DUMMYScrn = pScrn;
 
 
-    if (!(dPtr->FBBase = malloc(pScrn->videoRam * 1024)))
+    if (!(pixels = malloc(pScrn->videoRam * 1024)))
 	return FALSE;
 
     /*
@@ -532,7 +533,7 @@ DUMMYScreenInit(SCREEN_INIT_ARGS_DECL)
      * Call the framebuffer layer's ScreenInit function, and fill in other
      * pScreen fields.
      */
-    ret = fbScreenInit(pScreen, dPtr->FBBase,
+    ret = fbScreenInit(pScreen, pixels,
 			    pScrn->virtualX, pScrn->virtualY,
 			    pScrn->xDpi, pScrn->yDpi,
 			    pScrn->displayWidth, pScrn->bitsPerPixel);
@@ -644,9 +645,7 @@ DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL)
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     DUMMYPtr dPtr = DUMMYPTR(pScrn);
 
-    if(pScrn->vtSema){
-	free(dPtr->FBBase);
-    }
+    free(pScreen->GetScreenPixmap(pScreen)->devPrivate.ptr);
 
     if (dPtr->CursorInfo)
 	xf86DestroyCursorInfoRec(dPtr->CursorInfo);
-- 
1.9.1



More information about the xorg-devel mailing list