diff options
author | Marek Vasut <marex@denx.de> | 2016-10-02 13:01:24 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-10-05 09:18:02 -0400 |
commit | 7d83a155f0c4bf86bd6dfced1768c0a34add8f1b (patch) | |
tree | cfc77ccbf274f59a2924516b3362d083a4efcbd9 | |
parent | 587680c1c52d73bc7d5dbba2dcfadacb7a3f6b0e (diff) |
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.
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>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161002170124.6099-1-marex@denx.de
-rw-r--r-- | drivers/gpu/drm/drm_simple_kms_helper.c | 26 | ||||
-rw-r--r-- | include/drm/drm_simple_kms_helper.h | 20 |
2 files changed, 46 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 7b6d26e64977..7bae08c2bf0a 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, | |||
125 | pipe->funcs->update(pipe, pstate); | 125 | pipe->funcs->update(pipe, pstate); |
126 | } | 126 | } |
127 | 127 | ||
128 | static int drm_simple_kms_plane_prepare_fb(struct drm_plane *plane, | ||
129 | struct drm_plane_state *state) | ||
130 | { | ||
131 | struct drm_simple_display_pipe *pipe; | ||
132 | |||
133 | pipe = container_of(plane, struct drm_simple_display_pipe, plane); | ||
134 | if (!pipe->funcs || !pipe->funcs->prepare_fb) | ||
135 | return 0; | ||
136 | |||
137 | return pipe->funcs->prepare_fb(pipe, state); | ||
138 | } | ||
139 | |||
140 | static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane, | ||
141 | struct drm_plane_state *state) | ||
142 | { | ||
143 | struct drm_simple_display_pipe *pipe; | ||
144 | |||
145 | pipe = container_of(plane, struct drm_simple_display_pipe, plane); | ||
146 | if (!pipe->funcs || !pipe->funcs->cleanup_fb) | ||
147 | return; | ||
148 | |||
149 | pipe->funcs->cleanup_fb(pipe, state); | ||
150 | } | ||
151 | |||
128 | static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = { | 152 | static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = { |
153 | .prepare_fb = drm_simple_kms_plane_prepare_fb, | ||
154 | .cleanup_fb = drm_simple_kms_plane_cleanup_fb, | ||
129 | .atomic_check = drm_simple_kms_plane_atomic_check, | 155 | .atomic_check = drm_simple_kms_plane_atomic_check, |
130 | .atomic_update = drm_simple_kms_plane_atomic_update, | 156 | .atomic_update = drm_simple_kms_plane_atomic_update, |
131 | }; | 157 | }; |
diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h index 5d112f75e04c..01a8436ccb0a 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 { | |||
69 | */ | 69 | */ |
70 | void (*update)(struct drm_simple_display_pipe *pipe, | 70 | void (*update)(struct drm_simple_display_pipe *pipe, |
71 | struct drm_plane_state *plane_state); | 71 | struct drm_plane_state *plane_state); |
72 | |||
73 | /** | ||
74 | * @prepare_fb: | ||
75 | * | ||
76 | * Optional, called by struct &drm_plane_helper_funcs ->prepare_fb . | ||
77 | * Please read the documentation for the ->prepare_fb hook in | ||
78 | * struct &drm_plane_helper_funcs for more details. | ||
79 | */ | ||
80 | int (*prepare_fb)(struct drm_simple_display_pipe *pipe, | ||
81 | struct drm_plane_state *plane_state); | ||
82 | |||
83 | /** | ||
84 | * @cleanup_fb: | ||
85 | * | ||
86 | * Optional, called by struct &drm_plane_helper_funcs ->cleanup_fb . | ||
87 | * Please read the documentation for the ->cleanup_fb hook in | ||
88 | * struct &drm_plane_helper_funcs for more details. | ||
89 | */ | ||
90 | void (*cleanup_fb)(struct drm_simple_display_pipe *pipe, | ||
91 | struct drm_plane_state *plane_state); | ||
72 | }; | 92 | }; |
73 | 93 | ||
74 | /** | 94 | /** |