2121struct omap_plane {
2222 struct drm_plane base ;
2323 enum omap_plane_id id ;
24- const char * name ;
24+
25+ struct omap_hw_overlay * overlay ;
2526};
2627
2728static int omap_plane_prepare_fb (struct drm_plane * plane ,
@@ -49,10 +50,11 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
4950 struct omap_plane * omap_plane = to_omap_plane (plane );
5051 struct drm_plane_state * new_state = drm_atomic_get_new_plane_state (state ,
5152 plane );
53+ enum omap_plane_id ovl_id = omap_plane -> overlay -> id ;
5254 struct omap_overlay_info info ;
5355 int ret ;
5456
55- DBG ("%s, crtc=%p fb=%p" , omap_plane -> name , new_state -> crtc ,
57+ DBG ("%s, crtc=%p fb=%p" , plane -> name , new_state -> crtc ,
5658 new_state -> fb );
5759
5860 memset (& info , 0 , sizeof (info ));
@@ -77,17 +79,17 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
7779 & info .paddr , & info .p_uv_addr );
7880
7981 /* and finally, update omapdss: */
80- ret = dispc_ovl_setup (priv -> dispc , omap_plane -> id , & info ,
82+ ret = dispc_ovl_setup (priv -> dispc , ovl_id , & info ,
8183 omap_crtc_timings (new_state -> crtc ), false,
8284 omap_crtc_channel (new_state -> crtc ));
8385 if (ret ) {
8486 dev_err (plane -> dev -> dev , "Failed to setup plane %s\n" ,
85- omap_plane -> name );
86- dispc_ovl_enable (priv -> dispc , omap_plane -> id , false);
87+ plane -> name );
88+ dispc_ovl_enable (priv -> dispc , ovl_id , false);
8789 return ;
8890 }
8991
90- dispc_ovl_enable (priv -> dispc , omap_plane -> id , true);
92+ dispc_ovl_enable (priv -> dispc , ovl_id , true);
9193}
9294
9395static void omap_plane_atomic_disable (struct drm_plane * plane ,
@@ -97,11 +99,12 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
9799 plane );
98100 struct omap_drm_private * priv = plane -> dev -> dev_private ;
99101 struct omap_plane * omap_plane = to_omap_plane (plane );
102+ enum omap_plane_id ovl_id = omap_plane -> overlay -> id ;
100103
101104 new_state -> rotation = DRM_MODE_ROTATE_0 ;
102105 new_state -> zpos = plane -> type == DRM_PLANE_TYPE_PRIMARY ? 0 : omap_plane -> id ;
103106
104- dispc_ovl_enable (priv -> dispc , omap_plane -> id , false);
107+ dispc_ovl_enable (priv -> dispc , ovl_id , false);
105108}
106109
107110#define FRAC_16_16 (mult , div ) (((mult) << 16) / (div))
@@ -184,7 +187,7 @@ static void omap_plane_destroy(struct drm_plane *plane)
184187{
185188 struct omap_plane * omap_plane = to_omap_plane (plane );
186189
187- DBG ("%s" , omap_plane -> name );
190+ DBG ("%s" , plane -> name );
188191
189192 drm_plane_cleanup (plane );
190193
@@ -290,20 +293,6 @@ static bool omap_plane_supports_yuv(struct drm_plane *plane)
290293 return false;
291294}
292295
293- static const char * plane_id_to_name [] = {
294- [OMAP_DSS_GFX ] = "gfx" ,
295- [OMAP_DSS_VIDEO1 ] = "vid1" ,
296- [OMAP_DSS_VIDEO2 ] = "vid2" ,
297- [OMAP_DSS_VIDEO3 ] = "vid3" ,
298- };
299-
300- static const enum omap_plane_id plane_idx_to_id [] = {
301- OMAP_DSS_GFX ,
302- OMAP_DSS_VIDEO1 ,
303- OMAP_DSS_VIDEO2 ,
304- OMAP_DSS_VIDEO3 ,
305- };
306-
307296/* initialize plane */
308297struct drm_plane * omap_plane_init (struct drm_device * dev ,
309298 int idx , enum drm_plane_type type ,
@@ -313,27 +302,26 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
313302 unsigned int num_planes = dispc_get_num_ovls (priv -> dispc );
314303 struct drm_plane * plane ;
315304 struct omap_plane * omap_plane ;
316- enum omap_plane_id id ;
317305 int ret ;
318306 u32 nformats ;
319307 const u32 * formats ;
320308
321- if (WARN_ON (idx >= ARRAY_SIZE ( plane_idx_to_id ) ))
309+ if (WARN_ON (idx >= num_planes ))
322310 return ERR_PTR (- EINVAL );
323311
324- id = plane_idx_to_id [idx ];
325-
326- DBG ("%s: type=%d" , plane_id_to_name [id ], type );
327-
328312 omap_plane = kzalloc (sizeof (* omap_plane ), GFP_KERNEL );
329313 if (!omap_plane )
330314 return ERR_PTR (- ENOMEM );
331315
332- formats = dispc_ovl_get_color_modes (priv -> dispc , id );
316+ omap_plane -> id = idx ;
317+ omap_plane -> overlay = priv -> overlays [idx ];
318+
319+ DBG ("%d: type=%d" , omap_plane -> id , type );
320+ DBG (" crtc_mask: 0x%04x" , possible_crtcs );
321+
322+ formats = dispc_ovl_get_color_modes (priv -> dispc , omap_plane -> overlay -> id );
333323 for (nformats = 0 ; formats [nformats ]; ++ nformats )
334324 ;
335- omap_plane -> id = id ;
336- omap_plane -> name = plane_id_to_name [id ];
337325
338326 plane = & omap_plane -> base ;
339327
@@ -363,8 +351,8 @@ struct drm_plane *omap_plane_init(struct drm_device *dev,
363351 return plane ;
364352
365353error :
366- dev_err (dev -> dev , "%s(): could not create plane: %s \n" ,
367- __func__ , plane_id_to_name [ id ] );
354+ dev_err (dev -> dev , "%s(): could not create plane: %d \n" ,
355+ __func__ , omap_plane -> id );
368356
369357 kfree (omap_plane );
370358 return NULL ;
0 commit comments