Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <bparrot@ti.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211117141928.771082-6-narmstrong@baylibre.com

authored by

Benoit Parrot and committed by
Tomi Valkeinen
3c265d92 c8fa1e73

+33 -3
+33 -3
drivers/gpu/drm/omapdrm/omap_plane.c
··· 16 16 * plane funcs 17 17 */ 18 18 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 + 19 26 #define to_omap_plane(x) container_of(x, struct omap_plane, base) 20 27 21 28 struct omap_plane { ··· 228 221 static void omap_plane_reset(struct drm_plane *plane) 229 222 { 230 223 struct omap_plane *omap_plane = to_omap_plane(plane); 224 + struct omap_plane_state *omap_state; 231 225 232 - drm_atomic_helper_plane_reset(plane); 233 - if (!plane->state) 226 + if (plane->state) 227 + drm_atomic_helper_plane_destroy_state(plane, plane->state); 228 + 229 + omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL); 230 + if (!omap_state) 234 231 return; 232 + 233 + __drm_atomic_helper_plane_reset(plane, &omap_state->base); 235 234 236 235 /* 237 236 * Set the zpos default depending on whether we are a primary or overlay ··· 247 234 ? 0 : omap_plane->id; 248 235 plane->state->color_encoding = DRM_COLOR_YCBCR_BT601; 249 236 plane->state->color_range = DRM_COLOR_YCBCR_FULL_RANGE; 237 + } 238 + 239 + static struct drm_plane_state * 240 + omap_plane_atomic_duplicate_state(struct drm_plane *plane) 241 + { 242 + struct omap_plane_state *state; 243 + 244 + if (WARN_ON(!plane->state)) 245 + return NULL; 246 + 247 + state = kmalloc(sizeof(*state), GFP_KERNEL); 248 + if (!state) 249 + return NULL; 250 + 251 + __drm_atomic_helper_plane_duplicate_state(plane, &state->base); 252 + 253 + return &state->base; 250 254 } 251 255 252 256 static int omap_plane_atomic_set_property(struct drm_plane *plane, ··· 301 271 .disable_plane = drm_atomic_helper_disable_plane, 302 272 .reset = omap_plane_reset, 303 273 .destroy = omap_plane_destroy, 304 - .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 274 + .atomic_duplicate_state = omap_plane_atomic_duplicate_state, 305 275 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, 306 276 .atomic_set_property = omap_plane_atomic_set_property, 307 277 .atomic_get_property = omap_plane_atomic_get_property,