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 {
@@ -221,11 +228,17 @@ void omap_plane_install_properties(struct drm_plane *plane,
221
228
static void omap_plane_reset (struct drm_plane * plane )
222
229
{
223
230
struct omap_plane * omap_plane = to_omap_plane (plane );
231
+ struct omap_plane_state * omap_state ;
224
232
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 )
227
238
return ;
228
239
240
+ __drm_atomic_helper_plane_reset (plane , & omap_state -> base );
241
+
229
242
/*
230
243
* Set the zpos default depending on whether we are a primary or overlay
231
244
* plane.
@@ -236,6 +249,23 @@ static void omap_plane_reset(struct drm_plane *plane)
236
249
plane -> state -> color_range = DRM_COLOR_YCBCR_FULL_RANGE ;
237
250
}
238
251
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
+
239
269
static int omap_plane_atomic_set_property (struct drm_plane * plane ,
240
270
struct drm_plane_state * state ,
241
271
struct drm_property * property ,
@@ -271,7 +301,7 @@ static const struct drm_plane_funcs omap_plane_funcs = {
271
301
.disable_plane = drm_atomic_helper_disable_plane ,
272
302
.reset = omap_plane_reset ,
273
303
.destroy = omap_plane_destroy ,
274
- .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state ,
304
+ .atomic_duplicate_state = omap_plane_atomic_duplicate_state ,
275
305
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state ,
276
306
.atomic_set_property = omap_plane_atomic_set_property ,
277
307
.atomic_get_property = omap_plane_atomic_get_property ,
0 commit comments