summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-14 18:16:22 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-14 18:21:58 +0100
commit5d29daa7df72d9a96e044d0706f3014811389629 (patch)
tree74ae34f6b4dcdd06d8539a56fd82cd57d23a54b2 /src
parenta0f90a4c79799780592c004c846a963aad5f28e6 (diff)
sna: Make sure the frontbuffer exists before doing pitch checks
An unusual path to be sure, to call sna_crtc_set_mode_major before we create a GPU bo for the scanout - but might be possible after a GPU hang, or it appears after trying to set a 0x0 mode. At any rate, make sure the GPU bo exists before dereferencing. Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1212344 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_display.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 2a5b4b4e..a6a46658 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1093,7 +1093,7 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc)
PictTransform crtc_to_fb;
struct pict_f_transform f_crtc_to_fb, f_fb_to_crtc;
unsigned long pitch_limit;
- struct kgem_bo *bo;
+ struct sna_pixmap *priv;
BoxRec b;
assert(sna->scrn->virtualX && sna->scrn->virtualY);
@@ -1118,18 +1118,21 @@ static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc)
return true;
}
- bo = __sna_pixmap_get_bo(sna->front);
+ priv = sna_pixmap_force_to_gpu(sna->front, MOVE_READ | MOVE_WRITE);
+ if (priv == NULL)
+ return true; /* maybe we can create a bo for the scanout? */
+
if (sna->kgem.gen == 071)
- pitch_limit = bo->tiling ? 16 * 1024 : 32 * 1024;
+ pitch_limit = priv->gpu_bo->tiling ? 16 * 1024 : 32 * 1024;
else if ((sna->kgem.gen >> 3) > 4)
pitch_limit = 32 * 1024;
else if ((sna->kgem.gen >> 3) == 4)
- pitch_limit = bo->tiling ? 16 * 1024 : 32 * 1024;
+ pitch_limit = priv->gpu_bo->tiling ? 16 * 1024 : 32 * 1024;
else if ((sna->kgem.gen >> 3) == 3)
- pitch_limit = bo->tiling ? 8 * 1024 : 16 * 1024;
+ pitch_limit = priv->gpu_bo->tiling ? 8 * 1024 : 16 * 1024;
else
pitch_limit = 8 * 1024;
- if (bo->pitch > pitch_limit)
+ if (priv->gpu_bo->pitch > pitch_limit)
return true;
transform = NULL;