@@ -254,46 +254,48 @@ static int sti_crtc_set_property(struct drm_crtc *crtc,
254254int sti_crtc_vblank_cb (struct notifier_block * nb ,
255255 unsigned long event , void * data )
256256{
257- struct drm_device * drm_dev ;
258257 struct sti_compositor * compo =
259258 container_of (nb , struct sti_compositor , vtg_vblank_nb );
260- int * crtc = data ;
259+ struct drm_crtc * crtc = data ;
260+ struct sti_mixer * mixer ;
261261 unsigned long flags ;
262262 struct sti_private * priv ;
263+ unsigned int pipe ;
263264
264- drm_dev = compo -> mixer [* crtc ]-> drm_crtc .dev ;
265- priv = drm_dev -> dev_private ;
265+ priv = crtc -> dev -> dev_private ;
266+ pipe = drm_crtc_index (crtc );
267+ mixer = compo -> mixer [pipe ];
266268
267269 if ((event != VTG_TOP_FIELD_EVENT ) &&
268270 (event != VTG_BOTTOM_FIELD_EVENT )) {
269271 DRM_ERROR ("unknown event: %lu\n" , event );
270272 return - EINVAL ;
271273 }
272274
273- drm_handle_vblank ( drm_dev , * crtc );
275+ drm_crtc_handle_vblank ( crtc );
274276
275- spin_lock_irqsave (& drm_dev -> event_lock , flags );
276- if (compo -> mixer [* crtc ]-> pending_event ) {
277- drm_send_vblank_event (drm_dev , * crtc ,
278- compo -> mixer [* crtc ]-> pending_event );
279- drm_vblank_put (drm_dev , * crtc );
280- compo -> mixer [* crtc ]-> pending_event = NULL ;
277+ spin_lock_irqsave (& crtc -> dev -> event_lock , flags );
278+ if (mixer -> pending_event ) {
279+ drm_crtc_send_vblank_event (crtc , mixer -> pending_event );
280+ drm_crtc_vblank_put (crtc );
281+ mixer -> pending_event = NULL ;
281282 }
282- spin_unlock_irqrestore (& drm_dev -> event_lock , flags );
283+ spin_unlock_irqrestore (& crtc -> dev -> event_lock , flags );
283284
284- if (compo -> mixer [ * crtc ] -> status == STI_MIXER_DISABLING ) {
285+ if (mixer -> status == STI_MIXER_DISABLING ) {
285286 struct drm_plane * p ;
286287
287288 /* Disable mixer only if all overlay planes (GDP and VDP)
288289 * are disabled */
289- list_for_each_entry (p , & drm_dev -> mode_config .plane_list , head ) {
290+ list_for_each_entry (p , & crtc -> dev -> mode_config .plane_list ,
291+ head ) {
290292 struct sti_plane * plane = to_sti_plane (p );
291293
292294 if ((plane -> desc & STI_PLANE_TYPE_MASK ) <= STI_VDP )
293295 if (plane -> status != STI_PLANE_DISABLED )
294296 return 0 ;
295297 }
296- sti_crtc_disable (& compo -> mixer [ * crtc ] -> drm_crtc );
298+ sti_crtc_disable (crtc );
297299 }
298300
299301 return 0 ;
@@ -304,12 +306,13 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe)
304306 struct sti_private * dev_priv = dev -> dev_private ;
305307 struct sti_compositor * compo = dev_priv -> compo ;
306308 struct notifier_block * vtg_vblank_nb = & compo -> vtg_vblank_nb ;
309+ struct drm_crtc * crtc = & compo -> mixer [pipe ]-> drm_crtc ;
307310
308311 DRM_DEBUG_DRIVER ("\n" );
309312
310313 if (sti_vtg_register_client (pipe == STI_MIXER_MAIN ?
311314 compo -> vtg_main : compo -> vtg_aux ,
312- vtg_vblank_nb , pipe )) {
315+ vtg_vblank_nb , crtc )) {
313316 DRM_ERROR ("Cannot register VTG notifier\n" );
314317 return - EINVAL ;
315318 }
@@ -323,6 +326,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
323326 struct sti_private * priv = drm_dev -> dev_private ;
324327 struct sti_compositor * compo = priv -> compo ;
325328 struct notifier_block * vtg_vblank_nb = & compo -> vtg_vblank_nb ;
329+ struct drm_crtc * crtc = & compo -> mixer [pipe ]-> drm_crtc ;
326330
327331 DRM_DEBUG_DRIVER ("\n" );
328332
@@ -332,7 +336,7 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
332336
333337 /* free the resources of the pending requests */
334338 if (compo -> mixer [pipe ]-> pending_event ) {
335- drm_vblank_put ( drm_dev , pipe );
339+ drm_crtc_vblank_put ( crtc );
336340 compo -> mixer [pipe ]-> pending_event = NULL ;
337341 }
338342}
0 commit comments