[PATCH 0/5] drm: Add new plane helpers to begin/end FB access
Thomas Zimmermann
tzimmermann at suse.de
Mon Oct 17 11:15:05 UTC 2022
This patchset adds the callbacks begin_fb_access and end_fb_access
to struct drm_plane_helper_funcs. They provide hooks to acquire and
release resources that are only held during the commit. It adds
related simple-KMS helpers and converts a number of drivers.
A number of drivers call drm_gem_fb_begin_cpu_access() in the plane's
atomic_update. While the call can fail, it's too late to handle the
error correctly within the atomic update. A correct place would be in
prepare_fb, where the atomic commit can still be aborted upon errors.
But the corresponding drm_gem_fb_end_cpu_access() needs to be called
at the end of the commit, so that the BO resource is available again
for other drivers. Hence, calling drm_Gem_fb_end_cpu_access() cannot
be located in the plane's cleanup_pl, which is only called after the
next page flip. (With an unbounded waiting time in between.)
Therefore introduce the begin_fb_access and end_fb_access callbacks in
struct drm_plane_helper_funcs. The atomic helpers call begin_fb_access
when preparing the planes for the commit and end_fb_access when
cleaning up afterwards. The argument to end_fb_access is the new plane
state, so that acquired resources are not held after the end of the
commit.
With this in place, move drm_gem_fb_{begin,end}_cpu_access() behind
the new callbacks for shadow-plane helpers and 2 other drivers. For
the shadow-plane helpers, also move the automatic vmap/vunmap behind
the new callbacks. The shadow-plane mapping is only required during
the atomic commit.
Tested with combinations of radeon, udl and simpledrm under X11, Weston
and Wayland-Gnome.
Thomas Zimmermann (5):
drm/atomic-helper: Add {begin,end}_fb_access to plane helpers
drm/gem: Implement shadow-plane {begin,end}_fb_access with vmap
drm/gem: Handle drm_gem_{begin,end}_cpu_access() in shadow-plane
helpers
drm/repaper: Implement {begin,end}_fb_access helpers
drm/st7586: Implement {begin,end}_fb_access helpers
drivers/gpu/drm/drm_atomic_helper.c | 34 ++++++++++-
drivers/gpu/drm/drm_gem_atomic_helper.c | 78 +++++++++++++-----------
drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++
drivers/gpu/drm/solomon/ssd130x.c | 10 +--
drivers/gpu/drm/tiny/gm12u320.c | 10 +--
drivers/gpu/drm/tiny/ofdrm.c | 8 +--
drivers/gpu/drm/tiny/repaper.c | 30 +++++++--
drivers/gpu/drm/tiny/simpledrm.c | 10 +--
drivers/gpu/drm/tiny/st7586.c | 44 ++++++++-----
drivers/gpu/drm/udl/udl_modeset.c | 11 +---
include/drm/drm_gem_atomic_helper.h | 20 +++---
include/drm/drm_modeset_helper_vtables.h | 27 ++++++++
include/drm/drm_simple_kms_helper.h | 20 ++++++
13 files changed, 217 insertions(+), 111 deletions(-)
base-commit: 8c797a984264f04708d2099e83c85978a0fede89
prerequisite-patch-id: c2b2f08f0eccc9f5df0c0da49fa1d36267deb11d
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
prerequisite-patch-id: 3f204510fcbf9530d6540bd8e6128cce598988b6
--
2.38.0
More information about the dri-devel
mailing list