summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-09-07 13:07:52 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-09-07 13:09:17 +0100
commit0c39c363d7235d03f27337c731c0ffe3369bf713 (patch)
tree5147b5abccfff570ca61e410ba1c35fe9c8f3cb2
parentd7879a5939cabcd8b804e19fc422d2022ab7e3a4 (diff)
downloadxorg-driver-xf86-video-intel-0c39c363d7235d03f27337c731c0ffe3369bf713.tar.gz
sna: Protect sna_crtc_resize() against early invocation with no RootWindow
If the outputs are resized very early on, in CreateScreenResources, then we will not yet have created a RootWindow and so trying to change its pixmap is a futile effort. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_display.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index bde296d2..f69ca977 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2266,24 +2266,24 @@ sna_crtc_resize(ScrnInfoPtr scrn, int width, int height)
PixmapPtr old_front, new_front;
int i;
- DBG(("%s (%d, %d) -> (%d, %d)\n",
- __FUNCTION__,
+ DBG(("%s (%d, %d) -> (%d, %d)\n", __FUNCTION__,
scrn->virtualX, scrn->virtualY,
width, height));
if (scrn->virtualX == width && scrn->virtualY == height)
return TRUE;
+ assert(sna->front);
assert(scrn->pScreen->GetScreenPixmap(scrn->pScreen) == sna->front);
- assert(scrn->pScreen->GetWindowPixmap(scrn->pScreen->root) == sna->front);
+
DBG(("%s: creating new framebuffer %dx%d\n",
__FUNCTION__, width, height));
old_front = sna->front;
new_front = scrn->pScreen->CreatePixmap(scrn->pScreen,
- width, height,
- scrn->depth,
- SNA_CREATE_FB);
+ width, height,
+ scrn->depth,
+ SNA_CREATE_FB);
if (!new_front)
return FALSE;
@@ -2312,9 +2312,11 @@ sna_crtc_resize(ScrnInfoPtr scrn, int width, int height)
sna_crtc_disable(crtc);
}
- sna_redirect_screen_pixmap(scrn, old_front, sna->front);
- assert(scrn->pScreen->GetScreenPixmap(scrn->pScreen) == sna->front);
- assert(scrn->pScreen->GetWindowPixmap(scrn->pScreen->root) == sna->front);
+ if (scrn->pScreen->root) {
+ sna_redirect_screen_pixmap(scrn, old_front, sna->front);
+ assert(scrn->pScreen->GetScreenPixmap(scrn->pScreen) == sna->front);
+ assert(scrn->pScreen->GetWindowPixmap(scrn->pScreen->root) == sna->front);
+ }
scrn->pScreen->DestroyPixmap(old_front);