Lines Matching +full:layer +full:- +full:primary

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/
23 struct drm_device *ddev = tcrtc->crtc.dev; in tidss_crtc_finish_page_flip()
29 spin_lock_irqsave(&ddev->event_lock, flags); in tidss_crtc_finish_page_flip()
37 busy = dispc_vp_go_busy(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_finish_page_flip()
39 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_finish_page_flip()
43 event = tcrtc->event; in tidss_crtc_finish_page_flip()
44 tcrtc->event = NULL; in tidss_crtc_finish_page_flip()
47 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_finish_page_flip()
51 drm_crtc_send_vblank_event(&tcrtc->crtc, event); in tidss_crtc_finish_page_flip()
53 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_finish_page_flip()
55 drm_crtc_vblank_put(&tcrtc->crtc); in tidss_crtc_finish_page_flip()
71 complete(&tcrtc->framedone_completion); in tidss_crtc_framedone_irq()
78 dev_err_ratelimited(crtc->dev->dev, "CRTC%u SYNC LOST: (irq %llx)\n", in tidss_crtc_error_irq()
79 tcrtc->hw_videoport, irqstatus); in tidss_crtc_error_irq()
89 struct drm_device *ddev = crtc->dev; in tidss_crtc_atomic_check()
91 struct dispc_device *dispc = tidss->dispc; in tidss_crtc_atomic_check()
93 u32 hw_videoport = tcrtc->hw_videoport; in tidss_crtc_atomic_check()
97 dev_dbg(ddev->dev, "%s\n", __func__); in tidss_crtc_atomic_check()
99 if (!crtc_state->enable) in tidss_crtc_atomic_check()
102 mode = &crtc_state->adjusted_mode; in tidss_crtc_atomic_check()
106 dev_dbg(ddev->dev, "%s: bad mode: %ux%u pclk %u kHz\n", in tidss_crtc_atomic_check()
107 __func__, mode->hdisplay, mode->vdisplay, mode->clock); in tidss_crtc_atomic_check()
108 return -EINVAL; in tidss_crtc_atomic_check()
124 struct drm_atomic_state *ostate = old_state->state; in tidss_crtc_position_planes()
126 struct drm_crtc_state *cstate = crtc->state; in tidss_crtc_position_planes()
127 int layer; in tidss_crtc_position_planes() local
129 if (!newmodeset && !cstate->zpos_changed && in tidss_crtc_position_planes()
130 !to_tidss_crtc_state(cstate)->plane_pos_changed) in tidss_crtc_position_planes()
133 for (layer = 0; layer < tidss->feat->num_planes; layer++) { in tidss_crtc_position_planes()
140 if (pstate->crtc != crtc || !pstate->visible) in tidss_crtc_position_planes()
143 if (pstate->normalized_zpos == layer) { in tidss_crtc_position_planes()
152 dispc_ovr_set_plane(tidss->dispc, tplane->hw_plane_id, in tidss_crtc_position_planes()
153 tcrtc->hw_videoport, in tidss_crtc_position_planes()
154 pstate->crtc_x, pstate->crtc_y, in tidss_crtc_position_planes()
155 layer); in tidss_crtc_position_planes()
157 dispc_ovr_enable_layer(tidss->dispc, tcrtc->hw_videoport, layer, in tidss_crtc_position_planes()
168 struct drm_device *ddev = crtc->dev; in tidss_crtc_atomic_flush()
172 dev_dbg(ddev->dev, "%s: %s is %sactive, %s modeset, event %p\n", in tidss_crtc_atomic_flush()
173 __func__, crtc->name, crtc->state->active ? "" : "not ", in tidss_crtc_atomic_flush()
174 drm_atomic_crtc_needs_modeset(crtc->state) ? "needs" : "doesn't need", in tidss_crtc_atomic_flush()
175 crtc->state->event); in tidss_crtc_atomic_flush()
178 if (!crtc->state->active) in tidss_crtc_atomic_flush()
185 if (drm_atomic_crtc_needs_modeset(crtc->state)) in tidss_crtc_atomic_flush()
189 if (WARN_ON(dispc_vp_go_busy(tidss->dispc, tcrtc->hw_videoport))) in tidss_crtc_atomic_flush()
193 if (WARN_ON(!crtc->state->event)) in tidss_crtc_atomic_flush()
197 dispc_vp_setup(tidss->dispc, tcrtc->hw_videoport, crtc->state, false); in tidss_crtc_atomic_flush()
204 spin_lock_irqsave(&ddev->event_lock, flags); in tidss_crtc_atomic_flush()
205 dispc_vp_go(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_flush()
207 WARN_ON(tcrtc->event); in tidss_crtc_atomic_flush()
209 tcrtc->event = crtc->state->event; in tidss_crtc_atomic_flush()
210 crtc->state->event = NULL; in tidss_crtc_atomic_flush()
212 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_atomic_flush()
221 struct drm_device *ddev = crtc->dev; in tidss_crtc_atomic_enable()
223 const struct drm_display_mode *mode = &crtc->state->adjusted_mode; in tidss_crtc_atomic_enable()
227 dev_dbg(ddev->dev, "%s, event %p\n", __func__, crtc->state->event); in tidss_crtc_atomic_enable()
231 r = dispc_vp_set_clk_rate(tidss->dispc, tcrtc->hw_videoport, in tidss_crtc_atomic_enable()
232 mode->clock * 1000); in tidss_crtc_atomic_enable()
236 r = dispc_vp_enable_clk(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_enable()
240 dispc_vp_setup(tidss->dispc, tcrtc->hw_videoport, crtc->state, true); in tidss_crtc_atomic_enable()
246 dispc_vp_prepare(tidss->dispc, tcrtc->hw_videoport, crtc->state); in tidss_crtc_atomic_enable()
248 dispc_vp_enable(tidss->dispc, tcrtc->hw_videoport, crtc->state); in tidss_crtc_atomic_enable()
250 spin_lock_irqsave(&ddev->event_lock, flags); in tidss_crtc_atomic_enable()
252 if (crtc->state->event) { in tidss_crtc_atomic_enable()
253 drm_crtc_send_vblank_event(crtc, crtc->state->event); in tidss_crtc_atomic_enable()
254 crtc->state->event = NULL; in tidss_crtc_atomic_enable()
257 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_atomic_enable()
264 struct drm_device *ddev = crtc->dev; in tidss_crtc_atomic_disable()
268 dev_dbg(ddev->dev, "%s, event %p\n", __func__, crtc->state->event); in tidss_crtc_atomic_disable()
270 reinit_completion(&tcrtc->framedone_completion); in tidss_crtc_atomic_disable()
273 * If a layer is left enabled when the videoport is disabled, and the in tidss_crtc_atomic_disable()
274 * vid pipeline that was used for the layer is taken into use on in tidss_crtc_atomic_disable()
276 * the layers here as a work-around. in tidss_crtc_atomic_disable()
278 for (u32 layer = 0; layer < tidss->feat->num_planes; layer++) in tidss_crtc_atomic_disable() local
279 dispc_ovr_enable_layer(tidss->dispc, tcrtc->hw_videoport, layer, in tidss_crtc_atomic_disable()
282 dispc_vp_disable(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_disable()
284 if (!wait_for_completion_timeout(&tcrtc->framedone_completion, in tidss_crtc_atomic_disable()
286 dev_err(tidss->dev, "Timeout waiting for framedone on crtc %d", in tidss_crtc_atomic_disable()
287 tcrtc->hw_videoport); in tidss_crtc_atomic_disable()
289 dispc_vp_unprepare(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_disable()
291 spin_lock_irqsave(&ddev->event_lock, flags); in tidss_crtc_atomic_disable()
292 if (crtc->state->event) { in tidss_crtc_atomic_disable()
293 drm_crtc_send_vblank_event(crtc, crtc->state->event); in tidss_crtc_atomic_disable()
294 crtc->state->event = NULL; in tidss_crtc_atomic_disable()
296 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_atomic_disable()
300 dispc_vp_disable_clk(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_disable()
310 struct drm_device *ddev = crtc->dev; in tidss_crtc_mode_valid()
313 return dispc_vp_mode_valid(tidss->dispc, tcrtc->hw_videoport, mode); in tidss_crtc_mode_valid()
329 struct drm_device *ddev = crtc->dev; in tidss_crtc_enable_vblank()
332 dev_dbg(ddev->dev, "%s\n", __func__); in tidss_crtc_enable_vblank()
343 struct drm_device *ddev = crtc->dev; in tidss_crtc_disable_vblank()
346 dev_dbg(ddev->dev, "%s\n", __func__); in tidss_crtc_disable_vblank()
357 if (crtc->state) in tidss_crtc_reset()
358 __drm_atomic_helper_crtc_destroy_state(crtc->state); in tidss_crtc_reset()
360 kfree(crtc->state); in tidss_crtc_reset()
364 crtc->state = NULL; in tidss_crtc_reset()
368 __drm_atomic_helper_crtc_reset(crtc, &tcrtc->base); in tidss_crtc_reset()
375 if (WARN_ON(!crtc->state)) in tidss_crtc_duplicate_state()
378 current_state = to_tidss_crtc_state(crtc->state); in tidss_crtc_duplicate_state()
384 __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); in tidss_crtc_duplicate_state()
386 state->plane_pos_changed = false; in tidss_crtc_duplicate_state()
388 state->bus_format = current_state->bus_format; in tidss_crtc_duplicate_state()
389 state->bus_flags = current_state->bus_flags; in tidss_crtc_duplicate_state()
391 return &state->base; in tidss_crtc_duplicate_state()
415 struct drm_plane *primary) in tidss_crtc_create() argument
420 bool has_ctm = tidss->feat->vp_feat.color.has_ctm; in tidss_crtc_create()
425 return ERR_PTR(-ENOMEM); in tidss_crtc_create()
427 tcrtc->hw_videoport = hw_videoport; in tidss_crtc_create()
428 init_completion(&tcrtc->framedone_completion); in tidss_crtc_create()
430 crtc = &tcrtc->crtc; in tidss_crtc_create()
432 ret = drm_crtc_init_with_planes(&tidss->ddev, crtc, primary, in tidss_crtc_create()
443 * from it no matter what HW supports. X-server assumes 256 in tidss_crtc_create()
446 if (tidss->feat->vp_feat.color.gamma_size) in tidss_crtc_create()