@@ -148,40 +148,39 @@ static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
148148 struct rcar_du_vsp_plane_state * state =
149149 to_rcar_vsp_plane_state (plane -> plane .state );
150150 struct drm_framebuffer * fb = plane -> plane .state -> fb ;
151- struct v4l2_rect src ;
152- struct v4l2_rect dst ;
153- dma_addr_t paddr [2 ] = { 0 , };
154- u32 pixelformat = 0 ;
151+ struct vsp1_du_atomic_config cfg = {
152+ .pixelformat = 0 ,
153+ .pitch = fb -> pitches [0 ],
154+ .alpha = state -> alpha ,
155+ .zpos = state -> zpos ,
156+ };
155157 unsigned int i ;
156158
157- src .left = state -> state .src_x >> 16 ;
158- src .top = state -> state .src_y >> 16 ;
159- src .width = state -> state .src_w >> 16 ;
160- src .height = state -> state .src_h >> 16 ;
159+ cfg . src .left = state -> state .src_x >> 16 ;
160+ cfg . src .top = state -> state .src_y >> 16 ;
161+ cfg . src .width = state -> state .src_w >> 16 ;
162+ cfg . src .height = state -> state .src_h >> 16 ;
161163
162- dst .left = state -> state .crtc_x ;
163- dst .top = state -> state .crtc_y ;
164- dst .width = state -> state .crtc_w ;
165- dst .height = state -> state .crtc_h ;
164+ cfg . dst .left = state -> state .crtc_x ;
165+ cfg . dst .top = state -> state .crtc_y ;
166+ cfg . dst .width = state -> state .crtc_w ;
167+ cfg . dst .height = state -> state .crtc_h ;
166168
167169 for (i = 0 ; i < state -> format -> planes ; ++ i ) {
168170 struct drm_gem_cma_object * gem ;
169171
170172 gem = drm_fb_cma_get_gem_obj (fb , i );
171- paddr [i ] = gem -> paddr + fb -> offsets [i ];
173+ cfg . mem [i ] = gem -> paddr + fb -> offsets [i ];
172174 }
173175
174176 for (i = 0 ; i < ARRAY_SIZE (formats_kms ); ++ i ) {
175177 if (formats_kms [i ] == state -> format -> fourcc ) {
176- pixelformat = formats_v4l2 [i ];
178+ cfg . pixelformat = formats_v4l2 [i ];
177179 break ;
178180 }
179181 }
180182
181- WARN_ON (!pixelformat );
182-
183- vsp1_du_atomic_update (plane -> vsp -> vsp , plane -> index , pixelformat ,
184- fb -> pitches [0 ], paddr , & src , & dst );
183+ vsp1_du_atomic_update (plane -> vsp -> vsp , plane -> index , & cfg );
185184}
186185
187186static int rcar_du_vsp_plane_atomic_check (struct drm_plane * plane ,
@@ -220,8 +219,7 @@ static void rcar_du_vsp_plane_atomic_update(struct drm_plane *plane,
220219 if (plane -> state -> crtc )
221220 rcar_du_vsp_plane_setup (rplane );
222221 else
223- vsp1_du_atomic_update (rplane -> vsp -> vsp , rplane -> index , 0 , 0 , 0 ,
224- NULL , NULL );
222+ vsp1_du_atomic_update (rplane -> vsp -> vsp , rplane -> index , NULL );
225223}
226224
227225static const struct drm_plane_helper_funcs rcar_du_vsp_plane_helper_funcs = {
@@ -269,6 +267,7 @@ static void rcar_du_vsp_plane_reset(struct drm_plane *plane)
269267 return ;
270268
271269 state -> alpha = 255 ;
270+ state -> zpos = plane -> type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1 ;
272271
273272 plane -> state = & state -> state ;
274273 plane -> state -> plane = plane ;
@@ -283,6 +282,8 @@ static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane,
283282
284283 if (property == rcdu -> props .alpha )
285284 rstate -> alpha = val ;
285+ else if (property == rcdu -> props .zpos )
286+ rstate -> zpos = val ;
286287 else
287288 return - EINVAL ;
288289
@@ -299,6 +300,8 @@ static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane,
299300
300301 if (property == rcdu -> props .alpha )
301302 * val = rstate -> alpha ;
303+ else if (property == rcdu -> props .zpos )
304+ * val = rstate -> zpos ;
302305 else
303306 return - EINVAL ;
304307
@@ -378,6 +381,8 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp)
378381
379382 drm_object_attach_property (& plane -> plane .base ,
380383 rcdu -> props .alpha , 255 );
384+ drm_object_attach_property (& plane -> plane .base ,
385+ rcdu -> props .zpos , 1 );
381386 }
382387
383388 return 0 ;
0 commit comments