drm/vkms: rework crc worker

Submitted by Daniel Vetter on June 6, 2019, 10:27 p.m.


Reviewer None
Submitted June 6, 2019, 10:27 p.m.
Last Updated June 6, 2019, 10:28 p.m.
Revision 1

Cover Letter(s)

Revision 1
      Hi all,

This here is the first part of a rework for the vkms crc worker. I think
this should fix all the locking/races/use-after-free issues I spotted in
the code. There's more work we can do in the future as a follow-up:

- directly access vkms_plane_state->base in the crc worker, with this
  approach in this series here that should be safe now. Follow-up patches
  could switch and remove all the separate crc_data infrastructure.

- I think some kerneldoc for vkms structures would be nice. Documentation
  the various functions is probably overkill.

- Implementing a more generic blending engine, as prep for adding more
  pixel formats, more planes, and more features in general.

Tested with kms_pipe_crc, kms_flip and kms_cursor_crc. Seems to not make
things worse, but I didn't do a full run.

Cheers, Daniel

Daniel Vetter (10):
  drm/vkms: Fix crc worker races
  drm/vkms: Use spin_lock_irq in process context
  drm/vkms: Rename vkms_output.state_lock to crc_lock
  drm/vkms: Move format arrays to vkms_plane.c
  drm/vkms: Add our own commit_tail
  drm/vkms: flush crc workers earlier in commit flow
  drm/vkms: Dont flush crc worker when we change crc status
  drm/vkms: No _irqsave within spin_lock_irq needed
  drm/vkms: totally reworked crc data tracking
  drm/vkms: No need for ->pages_lock in crc work anymore

 drivers/gpu/drm/vkms/vkms_crc.c   | 74 +++++++++-------------------
 drivers/gpu/drm/vkms/vkms_crtc.c  | 80 ++++++++++++++++++++++++++-----
 drivers/gpu/drm/vkms/vkms_drv.c   | 35 ++++++++++++++
 drivers/gpu/drm/vkms/vkms_drv.h   | 24 +++++-----
 drivers/gpu/drm/vkms/vkms_plane.c |  8 ++++
 5 files changed, 146 insertions(+), 75 deletions(-)