From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: "David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"DRI Development" <dri-devel@lists.freedesktop.org>,
"Noralf Trønnes" <noralf@tronnes.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Daniel Vetter" <daniel.vetter@intel.com>,
"Sam Ravnborg" <sam@ravnborg.org>
Subject: [PATCH] drm/simple-helper: drm_gem_simple_display_pipe_prepare_fb as default
Date: Wed, 23 Jun 2021 18:24:56 +0200 [thread overview]
Message-ID: <20210623162456.3373469-1-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <20210622165511.3169559-13-daniel.vetter@ffwll.ch>
It's tedious to review this all the time, and my audit showed that
arcpgu actually forgot to set this.
Make this the default and stop worrying.
Again I sprinkled WARN_ON_ONCE on top to make sure we don't have
strange combinations of hooks: cleanup_fb without prepare_fb doesn't
make sense, and since simpler drivers are all new they better be GEM
based drivers.
v2: Warn and bail when it's _not_ a GEM driver (Noralf)
v3: It's neither ... nor, not not (Sam)
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
drivers/gpu/drm/drm_simple_kms_helper.c | 12 ++++++++++--
include/drm/drm_simple_kms_helper.h | 7 +++++--
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 0b095a313c44..735f4f34bcc4 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -9,6 +9,8 @@
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
+#include <drm/drm_drv.h>
+#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_plane_helper.h>
#include <drm/drm_probe_helper.h>
@@ -225,8 +227,14 @@ static int drm_simple_kms_plane_prepare_fb(struct drm_plane *plane,
struct drm_simple_display_pipe *pipe;
pipe = container_of(plane, struct drm_simple_display_pipe, plane);
- if (!pipe->funcs || !pipe->funcs->prepare_fb)
- return 0;
+ if (!pipe->funcs || !pipe->funcs->prepare_fb) {
+ if (WARN_ON_ONCE(!drm_core_check_feature(plane->dev, DRIVER_GEM)))
+ return 0;
+
+ WARN_ON_ONCE(pipe->funcs && pipe->funcs->cleanup_fb);
+
+ return drm_gem_simple_display_pipe_prepare_fb(pipe, state);
+ }
return pipe->funcs->prepare_fb(pipe, state);
}
diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h
index ef9944e9c5fc..cf07132d4ee8 100644
--- a/include/drm/drm_simple_kms_helper.h
+++ b/include/drm/drm_simple_kms_helper.h
@@ -116,8 +116,11 @@ struct drm_simple_display_pipe_funcs {
* the documentation for the &drm_plane_helper_funcs.prepare_fb hook for
* more details.
*
- * Drivers which always have their buffers pinned should use
- * drm_gem_simple_display_pipe_prepare_fb() for this hook.
+ * For GEM drivers who neither have a @prepare_fb nor @cleanup_fb hook
+ * set drm_gem_simple_display_pipe_prepare_fb() is called automatically
+ * to implement this. Other drivers which need additional plane
+ * processing can call drm_gem_simple_display_pipe_prepare_fb() from
+ * their @prepare_fb hook.
*/
int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state);
--
2.32.0.rc2
next prev parent reply other threads:[~2021-06-23 16:25 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-22 16:54 [PATCH 00/15] implicit fencing/dma-resv rules for shared buffers Daniel Vetter
2021-06-22 16:54 ` [PATCH 01/15] dma-resv: Fix kerneldoc Daniel Vetter
2021-06-22 18:19 ` Alex Deucher
2021-06-22 18:49 ` Sam Ravnborg
2021-06-22 19:19 ` Daniel Vetter
2021-06-23 8:31 ` Christian König
2021-06-23 15:15 ` Daniel Vetter
2021-06-22 16:54 ` [PATCH 02/15] dma-buf: Switch to inline kerneldoc Daniel Vetter
2021-06-22 18:24 ` Alex Deucher
2021-06-22 19:01 ` Sam Ravnborg
2021-06-22 19:21 ` Daniel Vetter
2021-06-23 8:32 ` Christian König
2021-06-23 16:17 ` [PATCH] " Daniel Vetter
2021-06-23 17:33 ` Sam Ravnborg
2021-06-22 16:54 ` [PATCH 03/15] dma-buf: Document dma-buf implicit fencing/resv fencing rules Daniel Vetter
2021-06-23 8:41 ` Christian König
2021-06-23 16:19 ` [PATCH] " Daniel Vetter
2021-06-24 6:59 ` Dave Airlie
2021-06-24 11:08 ` [Mesa-dev] " Daniel Stone
2021-06-24 11:23 ` Daniel Vetter
2021-06-24 12:48 ` Daniel Vetter
2021-06-24 12:52 ` Daniel Vetter
2021-06-22 16:55 ` [PATCH 04/15] drm/panfrost: Shrink sched_lock Daniel Vetter
2021-06-23 16:52 ` Boris Brezillon
2021-06-22 16:55 ` [PATCH 05/15] drm/panfrost: Use xarray and helpers for depedency tracking Daniel Vetter
2021-06-23 16:51 ` Boris Brezillon
2021-06-22 16:55 ` [PATCH 06/15] drm/panfrost: Fix implicit sync Daniel Vetter
2021-06-23 16:47 ` Boris Brezillon
2021-06-23 19:17 ` Daniel Vetter
2021-06-22 16:55 ` [PATCH 07/15] drm/atomic-helper: make drm_gem_plane_helper_prepare_fb the default Daniel Vetter
2021-06-22 19:10 ` Sam Ravnborg
2021-06-22 20:20 ` Daniel Vetter
2021-06-23 15:39 ` Sam Ravnborg
2021-06-23 16:22 ` [PATCH] " Daniel Vetter
2021-06-22 16:55 ` [PATCH 08/15] drm/<driver>: drm_gem_plane_helper_prepare_fb is now " Daniel Vetter
2021-06-24 8:32 ` Philipp Zabel
2021-06-22 16:55 ` [PATCH 09/15] drm/armada: Remove prepare/cleanup_fb hooks Daniel Vetter
2021-06-24 12:46 ` Maxime Ripard
2021-06-22 16:55 ` [PATCH 10/15] drm/vram-helpers: Create DRM_GEM_VRAM_PLANE_HELPER_FUNCS Daniel Vetter
2021-06-24 7:38 ` Thomas Zimmermann
2021-06-24 7:46 ` Thomas Zimmermann
2021-06-24 13:39 ` Daniel Vetter
2021-06-22 16:55 ` [PATCH 11/15] drm/omap: Follow implicit fencing in prepare_fb Daniel Vetter
2021-06-22 16:55 ` [PATCH 12/15] drm/simple-helper: drm_gem_simple_display_pipe_prepare_fb as default Daniel Vetter
2021-06-22 19:15 ` Sam Ravnborg
2021-06-23 16:24 ` Daniel Vetter [this message]
2021-06-23 17:34 ` [PATCH] " Sam Ravnborg
2021-06-22 16:55 ` [PATCH 13/15] drm/tiny: drm_gem_simple_display_pipe_prepare_fb is the default Daniel Vetter
2021-06-22 16:55 ` [PATCH 14/15] drm/gem: Tiny kernel clarification for drm_gem_fence_array_add Daniel Vetter
2021-06-23 8:42 ` Christian König
2021-06-24 12:41 ` Daniel Vetter
2021-06-24 12:48 ` Christian König
2021-06-24 13:32 ` Daniel Vetter
2021-06-24 13:35 ` Christian König
2021-06-24 13:41 ` Daniel Vetter
2021-06-24 13:45 ` Christian König
2021-06-22 16:55 ` [PATCH 15/15] RFC: drm/amdgpu: Implement a proper implicit fencing uapi Daniel Vetter
2021-06-23 9:45 ` Bas Nieuwenhuizen
2021-06-23 12:18 ` Daniel Vetter
2021-06-23 12:59 ` Christian König
2021-06-23 13:38 ` Bas Nieuwenhuizen
2021-06-23 13:44 ` Christian König
2021-06-23 13:49 ` Daniel Vetter
2021-06-23 14:02 ` Christian König
2021-06-23 14:50 ` Daniel Vetter
2021-06-23 14:58 ` Bas Nieuwenhuizen
2021-06-23 15:03 ` Daniel Vetter
2021-06-23 15:07 ` Christian König
2021-06-23 15:12 ` Daniel Vetter
2021-06-23 15:15 ` Christian König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210623162456.3373469-1-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--cc=airlied@linux.ie \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=noralf@tronnes.org \
--cc=sam@ravnborg.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).