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>
This commit is contained in:
parent
a0f90a4c79
commit
5d29daa7df
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue