0340-drm-vc4-Fix-drm_vblank_put-get-imbalance-in-page-fli.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From 973a3b6f56336673afbf63a108aa9f1419eb38d8 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. The async page flip path was missing drm_crtc_vblank_get/put
  6. completely. The sync flip path was missing a vblank put, so async
  7. flips only reported proper pageflip completion events by chance,
  8. and vblank irq's never turned off after a first vsync'ed page flip
  9. until system reboot.
  10. Tested against Raspian kernel 4.4.8 tree on RPi 2B.
  11. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
  12. Cc: Eric Anholt <eric@anholt.net>
  13. Signed-off-by: Eric Anholt <eric@anholt.net>
  14. ---
  15. drivers/gpu/drm/vc4/vc4_crtc.c | 4 ++++
  16. 1 file changed, 4 insertions(+)
  17. --- a/drivers/gpu/drm/vc4/vc4_crtc.c
  18. +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
  19. @@ -506,6 +506,7 @@ static void vc4_crtc_handle_page_flip(st
  20. if (vc4_crtc->event) {
  21. drm_crtc_send_vblank_event(crtc, vc4_crtc->event);
  22. vc4_crtc->event = NULL;
  23. + drm_crtc_vblank_put(crtc);
  24. }
  25. spin_unlock_irqrestore(&dev->event_lock, flags);
  26. }
  27. @@ -556,6 +557,7 @@ vc4_async_page_flip_complete(struct vc4_
  28. spin_unlock_irqrestore(&dev->event_lock, flags);
  29. }
  30. + drm_crtc_vblank_put(crtc);
  31. drm_framebuffer_unreference(flip_state->fb);
  32. kfree(flip_state);
  33. @@ -598,6 +600,8 @@ static int vc4_async_page_flip(struct dr
  34. return ret;
  35. }
  36. + WARN_ON(drm_crtc_vblank_get(crtc) != 0);
  37. +
  38. /* Immediately update the plane's legacy fb pointer, so that later
  39. * modeset prep sees the state that will be present when the semaphore
  40. * is released.