Lines Matching refs:crtc
95 struct drm_crtc *crtc = &mtk_crtc->base; in mtk_drm_crtc_finish_page_flip() local
99 spin_lock_irqsave(&crtc->dev->event_lock, flags); in mtk_drm_crtc_finish_page_flip()
100 drm_crtc_send_vblank_event(crtc, mtk_crtc->event); in mtk_drm_crtc_finish_page_flip()
101 drm_crtc_vblank_put(crtc); in mtk_drm_crtc_finish_page_flip()
103 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); in mtk_drm_crtc_finish_page_flip()
159 static void mtk_drm_crtc_destroy(struct drm_crtc *crtc) in mtk_drm_crtc_destroy() argument
161 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_destroy()
181 drm_crtc_cleanup(crtc); in mtk_drm_crtc_destroy()
184 static void mtk_drm_crtc_reset(struct drm_crtc *crtc) in mtk_drm_crtc_reset() argument
188 if (crtc->state) in mtk_drm_crtc_reset()
189 __drm_atomic_helper_crtc_destroy_state(crtc->state); in mtk_drm_crtc_reset()
191 kfree(to_mtk_crtc_state(crtc->state)); in mtk_drm_crtc_reset()
192 crtc->state = NULL; in mtk_drm_crtc_reset()
196 __drm_atomic_helper_crtc_reset(crtc, &state->base); in mtk_drm_crtc_reset()
199 static struct drm_crtc_state *mtk_drm_crtc_duplicate_state(struct drm_crtc *crtc) in mtk_drm_crtc_duplicate_state() argument
207 __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); in mtk_drm_crtc_duplicate_state()
209 WARN_ON(state->base.crtc != crtc); in mtk_drm_crtc_duplicate_state()
210 state->base.crtc = crtc; in mtk_drm_crtc_duplicate_state()
216 static void mtk_drm_crtc_destroy_state(struct drm_crtc *crtc, in mtk_drm_crtc_destroy_state() argument
223 static bool mtk_drm_crtc_mode_fixup(struct drm_crtc *crtc, in mtk_drm_crtc_mode_fixup() argument
231 static void mtk_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) in mtk_drm_crtc_mode_set_nofb() argument
233 struct mtk_crtc_state *state = to_mtk_crtc_state(crtc->state); in mtk_drm_crtc_mode_set_nofb()
235 state->pending_width = crtc->mode.hdisplay; in mtk_drm_crtc_mode_set_nofb()
236 state->pending_height = crtc->mode.vdisplay; in mtk_drm_crtc_mode_set_nofb()
237 state->pending_vrefresh = drm_mode_vrefresh(&crtc->mode); in mtk_drm_crtc_mode_set_nofb()
271 struct mtk_ddp_comp *mtk_drm_ddp_comp_for_plane(struct drm_crtc *crtc, in mtk_drm_ddp_comp_for_plane() argument
275 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_ddp_comp_for_plane()
351 struct drm_crtc *crtc = &mtk_crtc->base; in mtk_crtc_ddp_hw_init() local
359 if (WARN_ON(!crtc->state)) in mtk_crtc_ddp_hw_init()
362 width = crtc->state->adjusted_mode.hdisplay; in mtk_crtc_ddp_hw_init()
363 height = crtc->state->adjusted_mode.vdisplay; in mtk_crtc_ddp_hw_init()
364 vrefresh = drm_mode_vrefresh(&crtc->state->adjusted_mode); in mtk_crtc_ddp_hw_init()
366 drm_for_each_encoder(encoder, crtc->dev) { in mtk_crtc_ddp_hw_init()
367 if (encoder->crtc != crtc) in mtk_crtc_ddp_hw_init()
370 drm_connector_list_iter_begin(crtc->dev, &conn_iter); in mtk_crtc_ddp_hw_init()
381 ret = pm_runtime_resume_and_get(crtc->dev->dev); in mtk_crtc_ddp_hw_init()
434 comp = mtk_drm_ddp_comp_for_plane(crtc, plane, &local_layer); in mtk_crtc_ddp_hw_init()
445 pm_runtime_put(crtc->dev->dev); in mtk_crtc_ddp_hw_init()
452 struct drm_crtc *crtc = &mtk_crtc->base; in mtk_crtc_ddp_hw_fini() local
484 if (crtc->state->event && !crtc->state->active) { in mtk_crtc_ddp_hw_fini()
485 spin_lock_irqsave(&crtc->dev->event_lock, flags); in mtk_crtc_ddp_hw_fini()
486 drm_crtc_send_vblank_event(crtc, crtc->state->event); in mtk_crtc_ddp_hw_fini()
487 crtc->state->event = NULL; in mtk_crtc_ddp_hw_fini()
488 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); in mtk_crtc_ddp_hw_fini()
492 static void mtk_crtc_ddp_config(struct drm_crtc *crtc, in mtk_crtc_ddp_config() argument
495 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_crtc_ddp_config()
526 comp = mtk_drm_ddp_comp_for_plane(crtc, plane, in mtk_crtc_ddp_config()
551 comp = mtk_drm_ddp_comp_for_plane(crtc, plane, in mtk_crtc_ddp_config()
573 struct drm_crtc *crtc = &mtk_crtc->base; in mtk_drm_crtc_update_config() local
574 struct mtk_drm_private *priv = crtc->dev->dev_private; in mtk_drm_crtc_update_config()
610 mtk_crtc_ddp_config(crtc, NULL); in mtk_drm_crtc_update_config()
619 mtk_crtc_ddp_config(crtc, cmdq_handle); in mtk_drm_crtc_update_config()
647 struct drm_crtc *crtc = data; in mtk_crtc_ddp_irq() local
648 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_crtc_ddp_irq()
649 struct mtk_drm_private *priv = crtc->dev->dev_private; in mtk_crtc_ddp_irq()
653 mtk_crtc_ddp_config(crtc, NULL); in mtk_crtc_ddp_irq()
659 mtk_crtc_ddp_config(crtc, NULL); in mtk_crtc_ddp_irq()
664 static int mtk_drm_crtc_enable_vblank(struct drm_crtc *crtc) in mtk_drm_crtc_enable_vblank() argument
666 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_enable_vblank()
674 static void mtk_drm_crtc_disable_vblank(struct drm_crtc *crtc) in mtk_drm_crtc_disable_vblank() argument
676 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_disable_vblank()
682 int mtk_drm_crtc_plane_check(struct drm_crtc *crtc, struct drm_plane *plane, in mtk_drm_crtc_plane_check() argument
688 comp = mtk_drm_ddp_comp_for_plane(crtc, plane, &local_layer); in mtk_drm_crtc_plane_check()
694 void mtk_drm_crtc_async_update(struct drm_crtc *crtc, struct drm_plane *plane, in mtk_drm_crtc_async_update() argument
697 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_async_update()
705 static void mtk_drm_crtc_atomic_enable(struct drm_crtc *crtc, in mtk_drm_crtc_atomic_enable() argument
708 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_atomic_enable()
712 DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id); in mtk_drm_crtc_atomic_enable()
726 drm_crtc_vblank_on(crtc); in mtk_drm_crtc_atomic_enable()
730 static void mtk_drm_crtc_atomic_disable(struct drm_crtc *crtc, in mtk_drm_crtc_atomic_disable() argument
733 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_atomic_disable()
737 DRM_DEBUG_DRIVER("%s %d\n", __func__, crtc->base.id); in mtk_drm_crtc_atomic_disable()
761 drm_crtc_wait_one_vblank(crtc); in mtk_drm_crtc_atomic_disable()
763 drm_crtc_vblank_off(crtc); in mtk_drm_crtc_atomic_disable()
772 static void mtk_drm_crtc_atomic_begin(struct drm_crtc *crtc, in mtk_drm_crtc_atomic_begin() argument
776 crtc); in mtk_drm_crtc_atomic_begin()
778 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_atomic_begin()
785 mtk_crtc_state->base.event->pipe = drm_crtc_index(crtc); in mtk_drm_crtc_atomic_begin()
786 WARN_ON(drm_crtc_vblank_get(crtc) != 0); in mtk_drm_crtc_atomic_begin()
788 spin_lock_irqsave(&crtc->dev->event_lock, flags); in mtk_drm_crtc_atomic_begin()
790 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); in mtk_drm_crtc_atomic_begin()
796 static void mtk_drm_crtc_atomic_flush(struct drm_crtc *crtc, in mtk_drm_crtc_atomic_flush() argument
799 struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_atomic_flush()
802 if (crtc->state->color_mgmt_changed) in mtk_drm_crtc_atomic_flush()
804 mtk_ddp_gamma_set(mtk_crtc->ddp_comp[i], crtc->state); in mtk_drm_crtc_atomic_flush()
805 mtk_ddp_ctm_set(mtk_crtc->ddp_comp[i], crtc->state); in mtk_drm_crtc_atomic_flush()
915 struct device *mtk_drm_crtc_dma_dev_get(struct drm_crtc *crtc) in mtk_drm_crtc_dma_dev_get() argument
919 if (!crtc) in mtk_drm_crtc_dma_dev_get()
922 mtk_crtc = to_mtk_crtc(crtc); in mtk_drm_crtc_dma_dev_get()