diff options
Diffstat (limited to 'drivers/gpu/drm/sti/sti_crtc.c')
-rw-r--r-- | drivers/gpu/drm/sti/sti_crtc.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c index 493c4a3006ad..3ae09dcd4fd8 100644 --- a/drivers/gpu/drm/sti/sti_crtc.c +++ b/drivers/gpu/drm/sti/sti_crtc.c | |||
@@ -226,7 +226,7 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc, | |||
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | static struct drm_crtc_helper_funcs sti_crtc_helper_funcs = { | 229 | static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = { |
230 | .enable = sti_crtc_enable, | 230 | .enable = sti_crtc_enable, |
231 | .disable = sti_crtc_disabling, | 231 | .disable = sti_crtc_disabling, |
232 | .mode_fixup = sti_crtc_mode_fixup, | 232 | .mode_fixup = sti_crtc_mode_fixup, |
@@ -254,15 +254,17 @@ static int sti_crtc_set_property(struct drm_crtc *crtc, | |||
254 | int sti_crtc_vblank_cb(struct notifier_block *nb, | 254 | int sti_crtc_vblank_cb(struct notifier_block *nb, |
255 | unsigned long event, void *data) | 255 | unsigned long event, void *data) |
256 | { | 256 | { |
257 | struct drm_device *drm_dev; | ||
258 | struct sti_compositor *compo = | 257 | struct sti_compositor *compo = |
259 | container_of(nb, struct sti_compositor, vtg_vblank_nb); | 258 | container_of(nb, struct sti_compositor, vtg_vblank_nb); |
260 | int *crtc = data; | 259 | struct drm_crtc *crtc = data; |
260 | struct sti_mixer *mixer; | ||
261 | unsigned long flags; | 261 | unsigned long flags; |
262 | struct sti_private *priv; | 262 | struct sti_private *priv; |
263 | unsigned int pipe; | ||
263 | 264 | ||
264 | drm_dev = compo->mixer[*crtc]->drm_crtc.dev; | 265 | priv = crtc->dev->dev_private; |
265 | priv = drm_dev->dev_private; | 266 | pipe = drm_crtc_index(crtc); |
267 | mixer = compo->mixer[pipe]; | ||
266 | 268 | ||
267 | if ((event != VTG_TOP_FIELD_EVENT) && | 269 | if ((event != VTG_TOP_FIELD_EVENT) && |
268 | (event != VTG_BOTTOM_FIELD_EVENT)) { | 270 | (event != VTG_BOTTOM_FIELD_EVENT)) { |
@@ -270,30 +272,30 @@ int sti_crtc_vblank_cb(struct notifier_block *nb, | |||
270 | return -EINVAL; | 272 | return -EINVAL; |
271 | } | 273 | } |
272 | 274 | ||
273 | drm_handle_vblank(drm_dev, *crtc); | 275 | drm_crtc_handle_vblank(crtc); |
274 | 276 | ||
275 | spin_lock_irqsave(&drm_dev->event_lock, flags); | 277 | spin_lock_irqsave(&crtc->dev->event_lock, flags); |
276 | if (compo->mixer[*crtc]->pending_event) { | 278 | if (mixer->pending_event) { |
277 | drm_send_vblank_event(drm_dev, -1, | 279 | drm_crtc_send_vblank_event(crtc, mixer->pending_event); |
278 | compo->mixer[*crtc]->pending_event); | 280 | drm_crtc_vblank_put(crtc); |
279 | drm_vblank_put(drm_dev, *crtc); | 281 | mixer->pending_event = NULL; |
280 | compo->mixer[*crtc]->pending_event = NULL; | ||
281 | } | 282 | } |
282 | spin_unlock_irqrestore(&drm_dev->event_lock, flags); | 283 | spin_unlock_irqrestore(&crtc->dev->event_lock, flags); |
283 | 284 | ||
284 | if (compo->mixer[*crtc]->status == STI_MIXER_DISABLING) { | 285 | if (mixer->status == STI_MIXER_DISABLING) { |
285 | struct drm_plane *p; | 286 | struct drm_plane *p; |
286 | 287 | ||
287 | /* Disable mixer only if all overlay planes (GDP and VDP) | 288 | /* Disable mixer only if all overlay planes (GDP and VDP) |
288 | * are disabled */ | 289 | * 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) { | ||
290 | struct sti_plane *plane = to_sti_plane(p); | 292 | struct sti_plane *plane = to_sti_plane(p); |
291 | 293 | ||
292 | if ((plane->desc & STI_PLANE_TYPE_MASK) <= STI_VDP) | 294 | if ((plane->desc & STI_PLANE_TYPE_MASK) <= STI_VDP) |
293 | if (plane->status != STI_PLANE_DISABLED) | 295 | if (plane->status != STI_PLANE_DISABLED) |
294 | return 0; | 296 | return 0; |
295 | } | 297 | } |
296 | sti_crtc_disable(&compo->mixer[*crtc]->drm_crtc); | 298 | sti_crtc_disable(crtc); |
297 | } | 299 | } |
298 | 300 | ||
299 | return 0; | 301 | return 0; |
@@ -304,25 +306,26 @@ int sti_crtc_enable_vblank(struct drm_device *dev, unsigned int pipe) | |||
304 | struct sti_private *dev_priv = dev->dev_private; | 306 | struct sti_private *dev_priv = dev->dev_private; |
305 | struct sti_compositor *compo = dev_priv->compo; | 307 | struct sti_compositor *compo = dev_priv->compo; |
306 | struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb; | 308 | struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb; |
309 | struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc; | ||
307 | 310 | ||
308 | DRM_DEBUG_DRIVER("\n"); | 311 | DRM_DEBUG_DRIVER("\n"); |
309 | 312 | ||
310 | if (sti_vtg_register_client(pipe == STI_MIXER_MAIN ? | 313 | if (sti_vtg_register_client(pipe == STI_MIXER_MAIN ? |
311 | compo->vtg_main : compo->vtg_aux, | 314 | compo->vtg_main : compo->vtg_aux, |
312 | vtg_vblank_nb, pipe)) { | 315 | vtg_vblank_nb, crtc)) { |
313 | DRM_ERROR("Cannot register VTG notifier\n"); | 316 | DRM_ERROR("Cannot register VTG notifier\n"); |
314 | return -EINVAL; | 317 | return -EINVAL; |
315 | } | 318 | } |
316 | 319 | ||
317 | return 0; | 320 | return 0; |
318 | } | 321 | } |
319 | EXPORT_SYMBOL(sti_crtc_enable_vblank); | ||
320 | 322 | ||
321 | void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe) | 323 | void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe) |
322 | { | 324 | { |
323 | struct sti_private *priv = drm_dev->dev_private; | 325 | struct sti_private *priv = drm_dev->dev_private; |
324 | struct sti_compositor *compo = priv->compo; | 326 | struct sti_compositor *compo = priv->compo; |
325 | struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb; | 327 | struct notifier_block *vtg_vblank_nb = &compo->vtg_vblank_nb; |
328 | struct drm_crtc *crtc = &compo->mixer[pipe]->drm_crtc; | ||
326 | 329 | ||
327 | DRM_DEBUG_DRIVER("\n"); | 330 | DRM_DEBUG_DRIVER("\n"); |
328 | 331 | ||
@@ -332,13 +335,12 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe) | |||
332 | 335 | ||
333 | /* free the resources of the pending requests */ | 336 | /* free the resources of the pending requests */ |
334 | if (compo->mixer[pipe]->pending_event) { | 337 | if (compo->mixer[pipe]->pending_event) { |
335 | drm_vblank_put(drm_dev, pipe); | 338 | drm_crtc_vblank_put(crtc); |
336 | compo->mixer[pipe]->pending_event = NULL; | 339 | compo->mixer[pipe]->pending_event = NULL; |
337 | } | 340 | } |
338 | } | 341 | } |
339 | EXPORT_SYMBOL(sti_crtc_disable_vblank); | ||
340 | 342 | ||
341 | static struct drm_crtc_funcs sti_crtc_funcs = { | 343 | static const struct drm_crtc_funcs sti_crtc_funcs = { |
342 | .set_config = drm_atomic_helper_set_config, | 344 | .set_config = drm_atomic_helper_set_config, |
343 | .page_flip = drm_atomic_helper_page_flip, | 345 | .page_flip = drm_atomic_helper_page_flip, |
344 | .destroy = sti_crtc_destroy, | 346 | .destroy = sti_crtc_destroy, |
@@ -357,7 +359,6 @@ bool sti_crtc_is_main(struct drm_crtc *crtc) | |||
357 | 359 | ||
358 | return false; | 360 | return false; |
359 | } | 361 | } |
360 | EXPORT_SYMBOL(sti_crtc_is_main); | ||
361 | 362 | ||
362 | int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer, | 363 | int sti_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer, |
363 | struct drm_plane *primary, struct drm_plane *cursor) | 364 | struct drm_plane *primary, struct drm_plane *cursor) |