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: Aaron Plattner <aplattner at nvidia.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 f902fa607fce..82fbdeaaaa54 100644
a
|
b
|
typedef struct dummyRec |
50 | 50 | int cursorFG, cursorBG; |
51 | 51 | |
52 | 52 | dummy_colors colors[256]; |
53 | | pointer* FBBase; |
54 | 53 | Bool (*CreateWindow)() ; /* wrapped CreateWindow */ |
55 | 54 | Bool prop; |
56 | 55 | } DUMMYRec, *DUMMYPtr; |
diff --git a/src/dummy_cursor.c b/src/dummy_cursor.c
index 07a89bf20cb4..d7c67c6962ff 100644
a
|
b
|
dummySetCursorPosition(ScrnInfoPtr pScrn, int x, int y) |
39 | 39 | { |
40 | 40 | DUMMYPtr dPtr = DUMMYPTR(pScrn); |
41 | 41 | |
42 | | /* unsigned char *_dest = ((unsigned char *)dPtr->FBBase + */ |
43 | | /* pScrn->videoRam * 1024 - 1024); */ |
44 | 42 | dPtr->cursorX = x; |
45 | 43 | dPtr->cursorY = y; |
46 | 44 | } |
diff --git a/src/dummy_driver.c b/src/dummy_driver.c
index 194b39fca817..8262f39f2563 100644
a
|
b
|
DUMMYScreenInit(SCREEN_INIT_ARGS_DECL) |
505 | 505 | DUMMYPtr dPtr; |
506 | 506 | int ret; |
507 | 507 | VisualPtr visual; |
508 | | |
| 508 | void *pixels; |
| 509 | |
509 | 510 | /* |
510 | 511 | * we need to get the ScrnInfoRec for this screen, so let's allocate |
511 | 512 | * one first thing |
… |
… |
DUMMYScreenInit(SCREEN_INIT_ARGS_DECL) |
515 | 516 | DUMMYScrn = pScrn; |
516 | 517 | |
517 | 518 | |
518 | | if (!(dPtr->FBBase = malloc(pScrn->videoRam * 1024))) |
| 519 | if (!(pixels = malloc(pScrn->videoRam * 1024))) |
519 | 520 | return FALSE; |
520 | 521 | |
521 | 522 | DUMMYAdjustFrame(ADJUST_FRAME_ARGS(pScrn, pScrn->frameX0, pScrn->frameY0)); |
… |
… |
DUMMYScreenInit(SCREEN_INIT_ARGS_DECL) |
538 | 539 | * Call the framebuffer layer's ScreenInit function, and fill in other |
539 | 540 | * pScreen fields. |
540 | 541 | */ |
541 | | ret = fbScreenInit(pScreen, dPtr->FBBase, |
| 542 | ret = fbScreenInit(pScreen, pixels, |
542 | 543 | pScrn->virtualX, pScrn->virtualY, |
543 | 544 | pScrn->xDpi, pScrn->yDpi, |
544 | 545 | pScrn->displayWidth, pScrn->bitsPerPixel); |
… |
… |
DUMMYCloseScreen(CLOSE_SCREEN_ARGS_DECL) |
649 | 650 | ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); |
650 | 651 | DUMMYPtr dPtr = DUMMYPTR(pScrn); |
651 | 652 | |
652 | | if(pScrn->vtSema){ |
653 | | free(dPtr->FBBase); |
654 | | } |
| 653 | free(pScreen->GetScreenPixmap(pScreen)->devPrivate.ptr); |
655 | 654 | |
656 | 655 | if (dPtr->CursorInfo) |
657 | 656 | xf86DestroyCursorInfoRec(dPtr->CursorInfo); |