brcm2708: update linux 4.4 patches to latest version
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0340-drm-vc4-Fix-drm_vblank_put-get-imbalance-in-page-fli.patch
1 From bd3aef6d9474fbb9fe063a2f409f920263c28ff1 Mon Sep 17 00:00:00 2001
2 From: Mario Kleiner <mario.kleiner.de@gmail.com>
3 Date: Fri, 6 May 2016 19:26:06 +0200
4 Subject: [PATCH] drm/vc4: Fix drm_vblank_put/get imbalance in page flip path.
5
6 The async page flip path was missing drm_crtc_vblank_get/put
7 completely. The sync flip path was missing a vblank put, so async
8 flips only reported proper pageflip completion events by chance,
9 and vblank irq's never turned off after a first vsync'ed page flip
10 until system reboot.
11
12 Tested against Raspian kernel 4.4.8 tree on RPi 2B.
13
14 Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
15 Cc: Eric Anholt <eric@anholt.net>
16 Signed-off-by: Eric Anholt <eric@anholt.net>
17 ---
18 drivers/gpu/drm/vc4/vc4_crtc.c | 4 ++++
19 1 file changed, 4 insertions(+)
20
21 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
22 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
23 @@ -506,6 +506,7 @@ static void vc4_crtc_handle_page_flip(st
24 if (vc4_crtc->event) {
25 drm_crtc_send_vblank_event(crtc, vc4_crtc->event);
26 vc4_crtc->event = NULL;
27 + drm_crtc_vblank_put(crtc);
28 }
29 spin_unlock_irqrestore(&dev->event_lock, flags);
30 }
31 @@ -556,6 +557,7 @@ vc4_async_page_flip_complete(struct vc4_
32 spin_unlock_irqrestore(&dev->event_lock, flags);
33 }
34
35 + drm_crtc_vblank_put(crtc);
36 drm_framebuffer_unreference(flip_state->fb);
37 kfree(flip_state);
38
39 @@ -598,6 +600,8 @@ static int vc4_async_page_flip(struct dr
40 return ret;
41 }
42
43 + WARN_ON(drm_crtc_vblank_get(crtc) != 0);
44 +
45 /* Immediately update the plane's legacy fb pointer, so that later
46 * modeset prep sees the state that will be present when the semaphore
47 * is released.