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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From c4f773a1aa2d372d152138952cf7058ce93f8952 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 344/381] drm/vc4: Fix drm_vblank_put/get imbalance in page
  5. flip path.
  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. Tested against Raspian kernel 4.4.8 tree on RPi 2B.
  12. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
  13. Cc: Eric Anholt <eric@anholt.net>
  14. Signed-off-by: Eric Anholt <eric@anholt.net>
  15. ---
  16. drivers/gpu/drm/vc4/vc4_crtc.c | 4 ++++
  17. 1 file changed, 4 insertions(+)
  18. --- a/drivers/gpu/drm/vc4/vc4_crtc.c
  19. +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
  20. @@ -506,6 +506,7 @@ static void vc4_crtc_handle_page_flip(st
  21. if (vc4_crtc->event) {
  22. drm_crtc_send_vblank_event(crtc, vc4_crtc->event);
  23. vc4_crtc->event = NULL;
  24. + drm_crtc_vblank_put(crtc);
  25. }
  26. spin_unlock_irqrestore(&dev->event_lock, flags);
  27. }
  28. @@ -556,6 +557,7 @@ vc4_async_page_flip_complete(struct vc4_
  29. spin_unlock_irqrestore(&dev->event_lock, flags);
  30. }
  31. + drm_crtc_vblank_put(crtc);
  32. drm_framebuffer_unreference(flip_state->fb);
  33. kfree(flip_state);
  34. @@ -598,6 +600,8 @@ static int vc4_async_page_flip(struct dr
  35. return ret;
  36. }
  37. + WARN_ON(drm_crtc_vblank_get(crtc) != 0);
  38. +
  39. /* Immediately update the plane's legacy fb pointer, so that later
  40. * modeset prep sees the state that will be present when the semaphore
  41. * is released.