dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] drm: Move vmap out of commit tail for SHMEM-based drivers
@ 2021-02-04 20:03 Thomas Zimmermann
  2021-02-04 20:03 ` [PATCH 1/6] drm/simple-kms: Add plane-state helpers Thomas Zimmermann
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Thomas Zimmermann @ 2021-02-04 20:03 UTC (permalink / raw)
  To: daniel, airlied, maarten.lankhorst, mripard, kraxel, hdegoede,
	sean, sam, noralf
  Cc: Thomas Zimmermann, dri-devel, virtualization

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.

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

Patch 2 provides 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 3 to 6 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.

Thomas Zimmermann (6):
  drm/simple-kms: Add plane-state helpers
  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_atomic_helper.c | 210 ++++++++++++++++++++++++
 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     |  75 +++++++++
 include/drm/drm_simple_kms_helper.h     |  28 ++++
 10 files changed, 415 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: f9173d6435c6a9bb0b0076ebf9122d876da208ae
prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d
prerequisite-patch-id: f8140f08b77c49beb6243d9a2a88ebcc7097e391
prerequisite-patch-id: 6bffaf03d01daeb29a0b0ffbc78b415e72907a17
prerequisite-patch-id: 6386ca949b8b677a7eada2672990dab2f84f734f
prerequisite-patch-id: 706e35d0b2185d2332f725e1c22d8ffed910ea7b
--
2.30.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH 0/6 RFC] drm: Move vmap out of commit tail for SHMEM drivers
@ 2021-02-03 13:10 Thomas Zimmermann
  2021-02-03 13:10 ` [PATCH 4/6] drm/cirrus: Move vmap out of commit tail Thomas Zimmermann
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Zimmermann @ 2021-02-03 13:10 UTC (permalink / raw)
  To: daniel, airlied, maarten.lankhorst, mripard, kraxel, hdegoede,
	sean, sam, noralf
  Cc: Thomas Zimmermann, dri-devel, virtualization

Several SHMEM-based drivers use the BO as shadow buffer for the real
framebuffer memory. Damage handling requires a vmap of the BO memory.
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. Wrapper sfor simple KMS are provides,
as all of the involved drivers are built upon simple-KMS helpers.

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

Patch 2 provides plane state for SHMEM-based shadow planes. It's a
DRM plane with BO mappings into kernel address space. The involved
helpers take care of the details.

Patches 3 to 6 convert each involved driver to the new shadow-plane
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.

Thomas Zimmermann (6):
  drm/simple-kms: Add plane-state helpers
  drm/shmem-helper: Add additional KMS helpers
  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

 drivers/gpu/drm/Kconfig                    |   7 +
 drivers/gpu/drm/Makefile                   |   1 +
 drivers/gpu/drm/drm_gem_shmem_kms_helper.c | 159 +++++++++++++++++++++
 drivers/gpu/drm/drm_simple_kms_helper.c    |  40 +++++-
 drivers/gpu/drm/mgag200/Kconfig            |   1 +
 drivers/gpu/drm/mgag200/mgag200_mode.c     |  25 ++--
 drivers/gpu/drm/tiny/Kconfig               |   6 +-
 drivers/gpu/drm/tiny/cirrus.c              |  45 +++---
 drivers/gpu/drm/tiny/gm12u320.c            |  30 ++--
 drivers/gpu/drm/udl/Kconfig                |   1 +
 drivers/gpu/drm/udl/udl_modeset.c          |  36 ++---
 include/drm/drm_gem_shmem_kms_helper.h     |  56 ++++++++
 include/drm/drm_simple_kms_helper.h        |  28 ++++
 13 files changed, 353 insertions(+), 82 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_gem_shmem_kms_helper.c
 create mode 100644 include/drm/drm_gem_shmem_kms_helper.h


base-commit: 1e37c3960fd3910f3f65cd6927a6ebab8e8efc26
--
2.30.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-02-15 18:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 20:03 [PATCH 0/6] drm: Move vmap out of commit tail for SHMEM-based drivers Thomas Zimmermann
2021-02-04 20:03 ` [PATCH 1/6] drm/simple-kms: Add plane-state helpers Thomas Zimmermann
2021-02-04 20:03 ` [PATCH 2/6] drm: Add additional atomic helpers for shadow-buffered planes Thomas Zimmermann
2021-02-04 20:03 ` [PATCH 3/6] drm/mgag200: Move vmap out of commit tail Thomas Zimmermann
2021-02-04 20:03 ` [PATCH 4/6] drm/cirrus: " Thomas Zimmermann
2021-02-04 20:03 ` [PATCH 5/6] drm/gm12u320: " Thomas Zimmermann
2021-02-04 20:03 ` [PATCH 6/6] drm/udl: " Thomas Zimmermann
2021-02-05  9:05 ` [PATCH 0/6] drm: Move vmap out of commit tail for SHMEM-based drivers Gerd Hoffmann
2021-02-05 10:08   ` Thomas Zimmermann
2021-02-07 18:33   ` Thomas Zimmermann
2021-02-08 10:53     ` Gerd Hoffmann
2021-02-08 11:25       ` Thomas Zimmermann
2021-02-15 18:39   ` Thomas Zimmermann
  -- strict thread matches above, loose matches on Subject: below --
2021-02-03 13:10 [PATCH 0/6 RFC] drm: Move vmap out of commit tail for SHMEM drivers Thomas Zimmermann
2021-02-03 13:10 ` [PATCH 4/6] drm/cirrus: Move vmap out of commit tail Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).