diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-09-25 16:22:06 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-09-25 16:22:06 +0100 |
commit | 4827c518fe3323eedb56e7af7aef33801236d11f (patch) | |
tree | d7e4dd6399096f1ca57f956bbffcdec0f565f11d | |
parent | f3d27eec52cac63378c0e466db971ae125c813a1 (diff) |
sna: Use shadow CRTC bo if we fail to obtain an framebuffer for the Pixmap
This should mask driver bugs whereby we ask the kernel to make a
framebuffer out of an improper bo.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_display.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 07f5dff5..e7908cb7 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -1846,6 +1846,7 @@ static struct kgem_bo *sna_crtc_attach(xf86CrtcPtr crtc) unsigned long tiled_limit; int tiling; +force_shadow: if (!sna_crtc_enable_shadow(sna, sna_crtc)) { DBG(("%s: failed to enable crtc shadow\n")); return NULL; @@ -1939,26 +1940,30 @@ out_shadow: bo = sna_pixmap_pin(sna_crtc->slave_pixmap, PIN_SCANOUT); if (bo == NULL) { DBG(("%s: failed to pin crtc scanout\n", __FUNCTION__)); - return NULL; + sna_crtc->fallback_shadow = true; + goto force_shadow; } if (!get_fb(sna, bo, sna_crtc->slave_pixmap->drawable.width, sna_crtc->slave_pixmap->drawable.height)) { DBG(("%s: failed to bind fb for crtc scanout\n", __FUNCTION__)); - return NULL; + sna_crtc->fallback_shadow = true; + goto force_shadow; } } else { DBG(("%s: attaching to framebuffer\n", __FUNCTION__)); bo = sna_pixmap_pin(sna->front, PIN_SCANOUT); if (bo == NULL) { DBG(("%s: failed to pin framebuffer\n", __FUNCTION__)); - return NULL; + sna_crtc->fallback_shadow = true; + goto force_shadow; } if (!get_fb(sna, bo, scrn->virtualX, scrn->virtualY)) { DBG(("%s: failed to bind fb for crtc scanout\n", __FUNCTION__)); - return NULL; + sna_crtc->fallback_shadow = true; + goto force_shadow; } } @@ -1995,7 +2000,8 @@ out_shadow: CREATE_SCANOUT); if (shadow == NULL) { DBG(("%s: failed to allocate TearFree shadow bo\n", __FUNCTION__)); - return NULL; + sna_crtc->fallback_shadow = true; + goto force_shadow; } if (!get_fb(sna, shadow, @@ -2003,7 +2009,8 @@ out_shadow: region.extents.y2)) { DBG(("%s: failed to bind fb for TearFeee shadow\n", __FUNCTION__)); kgem_bo_destroy(&sna->kgem, shadow); - return NULL; + sna_crtc->fallback_shadow = true; + goto force_shadow; } sna->mode.shadow = shadow; |