drm/nv50-/kms: reject attempts at flipping to incompatible framebuffer
authorBen Skeggs <bskeggs@redhat.com>
Mon, 22 Dec 2014 09:50:23 +0000 (19:50 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 22 Jan 2015 02:15:01 +0000 (12:15 +1000)
Looks like a userspace bug can trigger this somehow during a mode
switch, causing: EVO complaint -> semaphores get out of sync ->
entire display stalled.

We likely want to be even stricter than this (or at least deal
better if EVO rejects our request), but I'll save that for the
drm_plane/atomic conversion and just fix the bug that I already
know can be triggered.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nv50_display.c

index 85cc667cfb0f0311143ad4cfff03b8e6fa6987e3..fcbbf3884781d79338970fdd52150fa083372688 100644 (file)
@@ -550,6 +550,10 @@ nv50_display_flip_next(struct drm_crtc *crtc, struct drm_framebuffer *fb,
        u32 *push;
        int ret;
 
+       if (crtc->primary->fb->width != fb->width ||
+           crtc->primary->fb->height != fb->height)
+               return -EINVAL;
+
        swap_interval <<= 4;
        if (swap_interval == 0)
                swap_interval |= 0x100;