Skip to content

Commit 3c265d9

Browse files
bparrottomba
authored andcommitted
drm/omap: omap_plane: subclass drm_plane_state
In preparation to add omap plane state specific extensions we need to subclass drm_plane_state and add the relevant helpers. The addition of specific extension will be done separately. Signed-off-by: Benoit Parrot <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c8fa1e7 commit 3c265d9

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

drivers/gpu/drm/omapdrm/omap_plane.c

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
* plane funcs
1717
*/
1818

19+
#define to_omap_plane_state(x) container_of(x, struct omap_plane_state, base)
20+
21+
struct omap_plane_state {
22+
/* Must be first. */
23+
struct drm_plane_state base;
24+
};
25+
1926
#define to_omap_plane(x) container_of(x, struct omap_plane, base)
2027

2128
struct omap_plane {
@@ -221,11 +228,17 @@ void omap_plane_install_properties(struct drm_plane *plane,
221228
static void omap_plane_reset(struct drm_plane *plane)
222229
{
223230
struct omap_plane *omap_plane = to_omap_plane(plane);
231+
struct omap_plane_state *omap_state;
224232

225-
drm_atomic_helper_plane_reset(plane);
226-
if (!plane->state)
233+
if (plane->state)
234+
drm_atomic_helper_plane_destroy_state(plane, plane->state);
235+
236+
omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL);
237+
if (!omap_state)
227238
return;
228239

240+
__drm_atomic_helper_plane_reset(plane, &omap_state->base);
241+
229242
/*
230243
* Set the zpos default depending on whether we are a primary or overlay
231244
* plane.
@@ -236,6 +249,23 @@ static void omap_plane_reset(struct drm_plane *plane)
236249
plane->state->color_range = DRM_COLOR_YCBCR_FULL_RANGE;
237250
}
238251

252+
static struct drm_plane_state *
253+
omap_plane_atomic_duplicate_state(struct drm_plane *plane)
254+
{
255+
struct omap_plane_state *state;
256+
257+
if (WARN_ON(!plane->state))
258+
return NULL;
259+
260+
state = kmalloc(sizeof(*state), GFP_KERNEL);
261+
if (!state)
262+
return NULL;
263+
264+
__drm_atomic_helper_plane_duplicate_state(plane, &state->base);
265+
266+
return &state->base;
267+
}
268+
239269
static int omap_plane_atomic_set_property(struct drm_plane *plane,
240270
struct drm_plane_state *state,
241271
struct drm_property *property,
@@ -271,7 +301,7 @@ static const struct drm_plane_funcs omap_plane_funcs = {
271301
.disable_plane = drm_atomic_helper_disable_plane,
272302
.reset = omap_plane_reset,
273303
.destroy = omap_plane_destroy,
274-
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
304+
.atomic_duplicate_state = omap_plane_atomic_duplicate_state,
275305
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
276306
.atomic_set_property = omap_plane_atomic_set_property,
277307
.atomic_get_property = omap_plane_atomic_get_property,

0 commit comments

Comments
 (0)