@@ -25,6 +25,50 @@ struct sun4i_plane_desc {
25
25
uint32_t nformats ;
26
26
};
27
27
28
+ static void sun4i_backend_layer_reset (struct drm_plane * plane )
29
+ {
30
+ struct sun4i_layer_state * state ;
31
+
32
+ if (plane -> state ) {
33
+ state = state_to_sun4i_layer_state (plane -> state );
34
+
35
+ __drm_atomic_helper_plane_destroy_state (& state -> state );
36
+
37
+ kfree (state );
38
+ plane -> state = NULL ;
39
+ }
40
+
41
+ state = kzalloc (sizeof (* state ), GFP_KERNEL );
42
+ if (state ) {
43
+ plane -> state = & state -> state ;
44
+ plane -> state -> plane = plane ;
45
+ }
46
+ }
47
+
48
+ static struct drm_plane_state *
49
+ sun4i_backend_layer_duplicate_state (struct drm_plane * plane )
50
+ {
51
+ struct sun4i_layer_state * copy ;
52
+
53
+ copy = kzalloc (sizeof (* copy ), GFP_KERNEL );
54
+ if (!copy )
55
+ return NULL ;
56
+
57
+ __drm_atomic_helper_plane_duplicate_state (plane , & copy -> state );
58
+
59
+ return & copy -> state ;
60
+ }
61
+
62
+ static void sun4i_backend_layer_destroy_state (struct drm_plane * plane ,
63
+ struct drm_plane_state * state )
64
+ {
65
+ struct sun4i_layer_state * s_state = state_to_sun4i_layer_state (state );
66
+
67
+ __drm_atomic_helper_plane_destroy_state (state );
68
+
69
+ kfree (s_state );
70
+ }
71
+
28
72
static void sun4i_backend_layer_atomic_disable (struct drm_plane * plane ,
29
73
struct drm_plane_state * old_state )
30
74
{
@@ -52,11 +96,11 @@ static const struct drm_plane_helper_funcs sun4i_backend_layer_helper_funcs = {
52
96
};
53
97
54
98
static const struct drm_plane_funcs sun4i_backend_layer_funcs = {
55
- .atomic_destroy_state = drm_atomic_helper_plane_destroy_state ,
56
- .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state ,
99
+ .atomic_destroy_state = sun4i_backend_layer_destroy_state ,
100
+ .atomic_duplicate_state = sun4i_backend_layer_duplicate_state ,
57
101
.destroy = drm_plane_cleanup ,
58
102
.disable_plane = drm_atomic_helper_disable_plane ,
59
- .reset = drm_atomic_helper_plane_reset ,
103
+ .reset = sun4i_backend_layer_reset ,
60
104
.update_plane = drm_atomic_helper_update_plane ,
61
105
};
62
106
0 commit comments