dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3] drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks
@ 2016-10-02 17:01 Marek Vasut
  2016-10-05 13:18 ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2016-10-02 17:01 UTC (permalink / raw)
  To: dri-devel; +Cc: Marek Vasut

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
V3: Re-add the clause about finding more details in drm_plane_helper_funcs
---
 drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++++++++++++++++++++
 include/drm/drm_simple_kms_helper.h     | 20 ++++++++++++++++++++
 2 files changed, 46 insertions(+)

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..01a8436 100644
--- a/include/drm/drm_simple_kms_helper.h
+++ b/include/drm/drm_simple_kms_helper.h
@@ -69,6 +69,26 @@ 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 .
+	 * Please read the documentation for the ->prepare_fb hook in
+	 * struct &drm_plane_helper_funcs for more details.
+	 */
+	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 .
+	 * Please read the documentation for the ->cleanup_fb hook in
+	 * struct &drm_plane_helper_funcs for more details.
+	 */
+	void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
+			   struct drm_plane_state *plane_state);
 };
 
 /**
-- 
2.9.3

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

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

* Re: [PATCH V3] drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks
  2016-10-02 17:01 [PATCH V3] drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks Marek Vasut
@ 2016-10-05 13:18 ` Daniel Vetter
  2016-10-05 14:07   ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2016-10-05 13:18 UTC (permalink / raw)
  To: Marek Vasut; +Cc: dri-devel

On Sun, Oct 02, 2016 at 07:01:24PM +0200, Marek Vasut wrote:
> 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
> V3: Re-add the clause about finding more details in drm_plane_helper_funcs

Real pretty now I think ;-) Applied to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++++++++++++++++++++
>  include/drm/drm_simple_kms_helper.h     | 20 ++++++++++++++++++++
>  2 files changed, 46 insertions(+)
> 
> 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..01a8436 100644
> --- a/include/drm/drm_simple_kms_helper.h
> +++ b/include/drm/drm_simple_kms_helper.h
> @@ -69,6 +69,26 @@ 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 .
> +	 * Please read the documentation for the ->prepare_fb hook in
> +	 * struct &drm_plane_helper_funcs for more details.
> +	 */
> +	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 .
> +	 * Please read the documentation for the ->cleanup_fb hook in
> +	 * struct &drm_plane_helper_funcs for more details.
> +	 */
> +	void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
> +			   struct drm_plane_state *plane_state);
>  };
>  
>  /**
> -- 
> 2.9.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH V3] drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks
  2016-10-05 13:18 ` Daniel Vetter
@ 2016-10-05 14:07   ` Marek Vasut
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Vasut @ 2016-10-05 14:07 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: dri-devel

On 10/05/2016 03:18 PM, Daniel Vetter wrote:
> On Sun, Oct 02, 2016 at 07:01:24PM +0200, Marek Vasut wrote:
>> 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
>> V3: Re-add the clause about finding more details in drm_plane_helper_funcs
> 
> Real pretty now I think ;-) Applied to drm-misc, thanks.

Appreciate your patience with my borderline clueless hacking, thanks.

> -Daniel
> 
>> ---
>>  drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++++++++++++++++++++
>>  include/drm/drm_simple_kms_helper.h     | 20 ++++++++++++++++++++
>>  2 files changed, 46 insertions(+)
>>
>> 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..01a8436 100644
>> --- a/include/drm/drm_simple_kms_helper.h
>> +++ b/include/drm/drm_simple_kms_helper.h
>> @@ -69,6 +69,26 @@ 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 .
>> +	 * Please read the documentation for the ->prepare_fb hook in
>> +	 * struct &drm_plane_helper_funcs for more details.
>> +	 */
>> +	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 .
>> +	 * Please read the documentation for the ->cleanup_fb hook in
>> +	 * struct &drm_plane_helper_funcs for more details.
>> +	 */
>> +	void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
>> +			   struct drm_plane_state *plane_state);
>>  };
>>  
>>  /**
>> -- 
>> 2.9.3
>>
> 


-- 
Best regards,
Marek Vasut
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2016-10-05 14:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-02 17:01 [PATCH V3] drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks Marek Vasut
2016-10-05 13:18 ` Daniel Vetter
2016-10-05 14:07   ` Marek Vasut

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).