diff mbox

[V2] drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks

Message ID 20160929215858.6525-1-marex@denx.de (mailing list archive)
State New, archived
Headers show

Commit Message

Marek Vasut Sept. 29, 2016, 9:58 p.m. UTC
Add .prepare_fb and .cleanup_fb plane hooks into the drm_simple_kms.
These can be used by drivers to call ie. the drm_fb_cma_setup_fence()
helper.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
---
V2: Fix the documentation style to play well with make htmldocs
---
 drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++++++++++++++++++++
 include/drm/drm_simple_kms_helper.h     | 16 ++++++++++++++++
 2 files changed, 42 insertions(+)

Comments

Daniel Vetter Sept. 30, 2016, 9:58 a.m. UTC | #1
On Thu, Sep 29, 2016 at 11:58 PM, Marek Vasut <marex@denx.de> wrote:
> +       /**
> +        * @prepare_fb:
> +        *
> +        * Optional, called by struct &drm_plane_helper_funcs ->prepare_fb .
> +        */


You've lost the hint that people should look there for what this hook
should do. Same with cleanup_fb. I think that was useful, can you pls
reinsert it? Just something like "Please read the documentation for
the ->prepare_fb hook in &drm_plane_helper_funcs for more details."

Thanks, Daniel
Marek Vasut Oct. 2, 2016, 4:49 p.m. UTC | #2
On 09/30/2016 11:58 AM, Daniel Vetter wrote:
> On Thu, Sep 29, 2016 at 11:58 PM, Marek Vasut <marex@denx.de> wrote:
>> +       /**
>> +        * @prepare_fb:
>> +        *
>> +        * Optional, called by struct &drm_plane_helper_funcs ->prepare_fb .
>> +        */
> 
> 
> You've lost the hint that people should look there for what this hook
> should do. Same with cleanup_fb. I think that was useful, can you pls
> reinsert it? Just something like "Please read the documentation for
> the ->prepare_fb hook in &drm_plane_helper_funcs for more details."

OK, added.
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 7b6d26e..7bae08c 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -125,7 +125,33 @@  static void drm_simple_kms_plane_atomic_update(struct drm_plane *plane,
 	pipe->funcs->update(pipe, pstate);
 }
 
+static int drm_simple_kms_plane_prepare_fb(struct drm_plane *plane,
+					   struct drm_plane_state *state)
+{
+	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;
+
+	return pipe->funcs->prepare_fb(pipe, state);
+}
+
+static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane,
+					    struct drm_plane_state *state)
+{
+	struct drm_simple_display_pipe *pipe;
+
+	pipe = container_of(plane, struct drm_simple_display_pipe, plane);
+	if (!pipe->funcs || !pipe->funcs->cleanup_fb)
+		return;
+
+	pipe->funcs->cleanup_fb(pipe, state);
+}
+
 static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = {
+	.prepare_fb = drm_simple_kms_plane_prepare_fb,
+	.cleanup_fb = drm_simple_kms_plane_cleanup_fb,
 	.atomic_check = drm_simple_kms_plane_atomic_check,
 	.atomic_update = drm_simple_kms_plane_atomic_update,
 };
diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h
index 5d112f7..140362a 100644
--- a/include/drm/drm_simple_kms_helper.h
+++ b/include/drm/drm_simple_kms_helper.h
@@ -69,6 +69,22 @@  struct drm_simple_display_pipe_funcs {
 	 */
 	void (*update)(struct drm_simple_display_pipe *pipe,
 		       struct drm_plane_state *plane_state);
+
+	/**
+	 * @prepare_fb:
+	 *
+	 * Optional, called by struct &drm_plane_helper_funcs ->prepare_fb .
+	 */
+	int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
+			  struct drm_plane_state *plane_state);
+
+	/**
+	 * @cleanup_fb:
+	 *
+	 * Optional, called by struct &drm_plane_helper_funcs ->cleanup_fb .
+	 */
+	void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
+			   struct drm_plane_state *plane_state);
 };
 
 /**