Skip to contentSkip to conversation

drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks

PATCH Superseded Marek Vasut 2 participants 3 messages Sep 26, 2016 – Sep 29, 2016

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: simple_kms_helper: Add prepare_fb and cleanup_fb hooks

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.

Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++++++++++++++++++++
 include/drm/drm_simple_kms_helper.h     | 18 ++++++++++++++++++
 2 files changed, 44 insertions(+)
drivers/gpu/drm/drm_simple_kms_helper.c +26 -0
index 7b6d26e..7bae08c 100644
@@ -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,
 };
include/drm/drm_simple_kms_helper.h +18 -0
index 5d112f7..1f55488 100644
@@ -69,6 +69,24 @@ struct drm_simple_display_pipe_funcs {
 	 */
 	void (*update)(struct drm_simple_display_pipe *pipe,
 		       struct drm_plane_state *plane_state);
+
+	/**
+	 * @prepare_fb:
+	 *
+	 * Optional, calls drm_plane_helper_funcs->prepare_fb , refer to
+	 * the documentation in drm_modeset_helper_vtables.h .
+	 */
+	int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
+			  struct drm_plane_state *plane_state);
+
+	/**
+	 * @cleanup_fb:
+	 *
+	 * Optional, calls drm_plane_helper_funcs->cleanup_fb , refer to
+	 * the documentation in drm_modeset_helper_vtables.h .
+	 */
+	void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
+			   struct drm_plane_state *plane_state);
 };
 
 /**
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 56 lines · 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.

Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++++++++++++++++++++
 include/drm/drm_simple_kms_helper.h     | 18 ++++++++++++++++++
 2 files changed, 44 insertions(+)
drivers/gpu/drm/drm_simple_kms_helper.c +26 -0
index 7b6d26e..7bae08c 100644
@@ -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,
 };
include/drm/drm_simple_kms_helper.h +0 -0
index 5d112f7..1f55488 100644

include/drm/drm_simple_kms_helper.h struct drm_simple_display_pipe_funcs { · line 76

Quoted 8 lines
include/drm/drm_simple_kms_helper.h +5 -0
@@ -69,6 +69,24 @@ struct drm_simple_display_pipe_funcs {
 	 */
 	void (*update)(struct drm_simple_display_pipe *pipe,
 		       struct drm_plane_state *plane_state);
+
+	/**
+	 * @prepare_fb:
+	 *
+	 * Optional, calls drm_plane_helper_funcs->prepare_fb , refer to

s/calls/called by/.

include/drm/drm_simple_kms_helper.h struct drm_simple_display_pipe_funcs { · line 77

Quoted 1 line
include/drm/drm_simple_kms_helper.h +1 -0
+	 * the documentation in drm_modeset_helper_vtables.h .

Please insert a direct link to the right structure using "struct &drm_plane_helper_funcs". Please run

$ make htmldocs

to make sure it's all pretty and the links work.

Code itself lgtm.
-Daniel

Quoted 18 lines
include/drm/drm_simple_kms_helper.h +12 -0
+	 */
+	int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
+			  struct drm_plane_state *plane_state);
+
+	/**
+	 * @cleanup_fb:
+	 *
+	 * Optional, calls drm_plane_helper_funcs->cleanup_fb , refer to
+	 * the documentation in drm_modeset_helper_vtables.h .
+	 */
+	void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
+			   struct drm_plane_state *plane_state);
 };
 
 /**
Signature · 1 line
2.9.3
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 59 lines · Daniel Vetter
Quoted 58 lines · 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.

Cc Noralf Trønnes <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/drm_simple_kms_helper.c | 26 ++++++++++++++++++++++++++
 include/drm/drm_simple_kms_helper.h     | 18 ++++++++++++++++++
 2 files changed, 44 insertions(+)
drivers/gpu/drm/drm_simple_kms_helper.c +26 -0
index 7b6d26e..7bae08c 100644
@@ -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,
 };
include/drm/drm_simple_kms_helper.h +0 -0
index 5d112f7..1f55488 100644
@@ -69,6 +69,24 @@ struct drm_simple_display_pipe_funcs {
 	 */
 	void (*update)(struct drm_simple_display_pipe *pipe,
Quoted 8 lines

include/drm/drm_simple_kms_helper.h struct drm_simple_display_pipe_funcs { · line 76

Quoted 6 lines
include/drm/drm_simple_kms_helper.h +5 -0
 		       struct drm_plane_state *plane_state);
+
+	/**
+	 * @prepare_fb:
+	 *
+	 * Optional, calls drm_plane_helper_funcs->prepare_fb , refer to

s/calls/called by/.

Fixed

Quoted 8 lines

include/drm/drm_simple_kms_helper.h struct drm_simple_display_pipe_funcs { · line 77

Quoted 1 line
include/drm/drm_simple_kms_helper.h +1 -0
+	 * the documentation in drm_modeset_helper_vtables.h .

Please insert a direct link to the right structure using "struct &drm_plane_helper_funcs". Please run

$ make htmldocs

to make sure it's all pretty and the links work.

Done and fixed, thanks.

Quoted 22 lines

Code itself lgtm.
-Daniel

Quoted 18 lines
include/drm/drm_simple_kms_helper.h +12 -0
+	 */
+	int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
+			  struct drm_plane_state *plane_state);
+
+	/**
+	 * @cleanup_fb:
+	 *
+	 * Optional, calls drm_plane_helper_funcs->cleanup_fb , refer to
+	 * the documentation in drm_modeset_helper_vtables.h .
+	 */
+	void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
+			   struct drm_plane_state *plane_state);
 };
 
 /**
Signature · 1 line
2.9.3
Signature · 6 lines
Best regards,
Marek Vasut
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel