Skip to content

drm: Move vmap out of commit tail for SHMEM-based drivers

Thomas Zimmermann dri-devel virtualization 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest7 patches 0 repliesNew
  2. v27 patches 0 repliesSuperseded
  3. v16 patches 6 repliesSuperseded

Changes in v3 from the cover letter

* documentation fixes

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7drm/simple-kms: Add plane-state helpersdrivers/gpu/drm/drm_simple_kms_helper.c include/drm/drm_simple_kms_helper.h+64 -30 replies
2/7drm/gem: Export drm_gem_vmap() and drm_gem_vunmap()drivers/gpu/drm/drm_gem.c+2 -00 replies
3/7drm: Add additional atomic helpers for shadow-buffered planesDocumentation/gpu/drm-kms-helpers.rst drivers/gpu/drm/Makefile drivers/gpu/drm/drm_gem_atomic_helper.c +1 more+295 -10 replies
4/7drm/mgag200: Move vmap out of commit taildrivers/gpu/drm/mgag200/mgag200_mode.c+8 -150 replies
5/7drm/cirrus: Move vmap out of commit taildrivers/gpu/drm/tiny/cirrus.c+17 -260 replies
6/7drm/gm12u320: Move vmap out of commit taildrivers/gpu/drm/tiny/gm12u320.c+13 -150 replies
7/7drm/udl: Move vmap out of commit taildrivers/gpu/drm/udl/udl_modeset.c+13 -210 replies

Reviews trailers per patch

All 7 patches have a Reviewed-by or Acked-by.

PatchGerd Hoffmann
1/7T-b A-b
2/7T-b A-b
3/7T-b A-b
4/7T-b A-b
5/7T-b A-b
6/7T-b A-b
7/7T-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/7] drm: Move vmap out of commit tail for SHMEM-based drivers

Several SHMEM-based drivers use the BO as shadow buffer for the real framebuffer memory. Damage handling requires a vmap of the BO memory. But vmap/vunmap can acquire the dma-buf reservation lock, which is not allowed in commit tails.

This patchset introduces a set of helpers that implement vmap/vunmap in the plane's prepare_fb and cleanup_fb; and provide the mapping's address to commit-tail functions. Wrappers for simple KMS are provides, as all of the involved drivers are built upon simple-KMS helpers.

All patches have been acked already. v3 only fixes a few typos in the documentation.

Patch 1 adds the support for private plane state to the simple-KMS helper library.

Patches 2 and 3 provide plane state for shadow-buffered planes. It's a DRM plane with BO mappings into kernel address space. The involved helpers take care of the details. The code is independent from GEM SHMEM and can be used with other shadow-buffered planes. I put all this in a new file. In a later patch, drm_gem_fb_prepare_fb() et al could be moved there as well.

Patches 4 to 7 convert each involved driver to the new helpers. The vmap operations are being removed from commit-tail functions. An additional benefit is that vmap errors are now detected before the commit starts. The original commit-tail functions could not handle failed vmap operations.

I smoke-tested the code by running fbdev, Xorg and weston with the converted mgag200 driver.

v3:
* documentation fixes
v2:
* export drm_gem_vmap()/_vunmap() (kernel test robot)
* make duplicate_state interface compatible with struct drm_plane_funcs

Thomas Zimmermann (7):
drm/simple-kms: Add plane-state helpers
drm/gem: Export drm_gem_vmap() and drm_gem_vunmap()
drm: Add additional atomic helpers for shadow-buffered planes drm/mgag200: Move vmap out of commit tail drm/cirrus: Move vmap out of commit tail drm/gm12u320: Move vmap out of commit tail
drm/udl: Move vmap out of commit tail

 Documentation/gpu/drm-kms-helpers.rst   |  12 ++
 drivers/gpu/drm/Makefile                |   3 +-
 drivers/gpu/drm/drm_gem.c               |   2 +
 drivers/gpu/drm/drm_gem_atomic_helper.c | 208 ++++++++++++++++++++++++
 drivers/gpu/drm/drm_simple_kms_helper.c |  40 ++++-
 drivers/gpu/drm/mgag200/mgag200_mode.c  |  23 +--
 drivers/gpu/drm/tiny/cirrus.c           |  43 ++---
 drivers/gpu/drm/tiny/gm12u320.c         |  28 ++--
 drivers/gpu/drm/udl/udl_modeset.c       |  34 ++--
 include/drm/drm_gem_atomic_helper.h     |  73 +++++++++
 include/drm/drm_simple_kms_helper.h     |  27 +++
 11 files changed, 412 insertions(+), 81 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_gem_atomic_helper.c
 create mode 100644 include/drm/drm_gem_atomic_helper.h

base-commit: efb1b1293b064512f7c47537e35ad14a05a05c84
prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d --
2.30.0

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization