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()
181 if (drm_atomic_crtc_needs_modeset(crtc->state)) in tidss_crtc_atomic_flush()
185 if (WARN_ON(dispc_vp_go_busy(tidss->dispc, tcrtc->hw_videoport))) in tidss_crtc_atomic_flush()
189 if (WARN_ON(!crtc->state->event)) in tidss_crtc_atomic_flush()
193 dispc_vp_setup(tidss->dispc, tcrtc->hw_videoport, crtc->state, false); in tidss_crtc_atomic_flush()
200 spin_lock_irqsave(&ddev->event_lock, flags); in tidss_crtc_atomic_flush()
201 dispc_vp_go(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_flush()
203 WARN_ON(tcrtc->event); in tidss_crtc_atomic_flush()
205 tcrtc->event = crtc->state->event; in tidss_crtc_atomic_flush()
206 crtc->state->event = NULL; in tidss_crtc_atomic_flush()
208 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_atomic_flush()
217 struct drm_device *ddev = crtc->dev; in tidss_crtc_atomic_enable()
219 const struct drm_display_mode *mode = &crtc->state->adjusted_mode; in tidss_crtc_atomic_enable()
223 dev_dbg(ddev->dev, "%s, event %p\n", __func__, crtc->state->event); in tidss_crtc_atomic_enable()
227 r = dispc_vp_set_clk_rate(tidss->dispc, tcrtc->hw_videoport, in tidss_crtc_atomic_enable()
228 mode->clock * 1000); in tidss_crtc_atomic_enable()
232 r = dispc_vp_enable_clk(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_enable()
236 dispc_vp_setup(tidss->dispc, tcrtc->hw_videoport, crtc->state, true); in tidss_crtc_atomic_enable()
242 dispc_vp_prepare(tidss->dispc, tcrtc->hw_videoport, crtc->state); in tidss_crtc_atomic_enable()
244 dispc_vp_enable(tidss->dispc, tcrtc->hw_videoport, crtc->state); in tidss_crtc_atomic_enable()
246 spin_lock_irqsave(&ddev->event_lock, flags); in tidss_crtc_atomic_enable()
248 if (crtc->state->event) { in tidss_crtc_atomic_enable()
249 drm_crtc_send_vblank_event(crtc, crtc->state->event); in tidss_crtc_atomic_enable()
250 crtc->state->event = NULL; in tidss_crtc_atomic_enable()
253 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_atomic_enable()
260 struct drm_device *ddev = crtc->dev; in tidss_crtc_atomic_disable()
264 dev_dbg(ddev->dev, "%s, event %p\n", __func__, crtc->state->event); in tidss_crtc_atomic_disable()
266 reinit_completion(&tcrtc->framedone_completion); in tidss_crtc_atomic_disable()
269 * If a layer is left enabled when the videoport is disabled, and the in tidss_crtc_atomic_disable()
270 * vid pipeline that was used for the layer is taken into use on in tidss_crtc_atomic_disable()
272 * the layers here as a work-around. in tidss_crtc_atomic_disable()
274 for (u32 layer = 0; layer < tidss->feat->num_planes; layer++) in tidss_crtc_atomic_disable() local
275 dispc_ovr_enable_layer(tidss->dispc, tcrtc->hw_videoport, layer, in tidss_crtc_atomic_disable()
278 dispc_vp_disable(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_disable()
280 if (!wait_for_completion_timeout(&tcrtc->framedone_completion, in tidss_crtc_atomic_disable()
282 dev_err(tidss->dev, "Timeout waiting for framedone on crtc %d", in tidss_crtc_atomic_disable()
283 tcrtc->hw_videoport); in tidss_crtc_atomic_disable()
285 dispc_vp_unprepare(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_disable()
287 spin_lock_irqsave(&ddev->event_lock, flags); in tidss_crtc_atomic_disable()
288 if (crtc->state->event) { in tidss_crtc_atomic_disable()
289 drm_crtc_send_vblank_event(crtc, crtc->state->event); in tidss_crtc_atomic_disable()
290 crtc->state->event = NULL; in tidss_crtc_atomic_disable()
292 spin_unlock_irqrestore(&ddev->event_lock, flags); in tidss_crtc_atomic_disable()
296 dispc_vp_disable_clk(tidss->dispc, tcrtc->hw_videoport); in tidss_crtc_atomic_disable()
306 struct drm_device *ddev = crtc->dev; in tidss_crtc_mode_valid()
309 return dispc_vp_mode_valid(tidss->dispc, tcrtc->hw_videoport, mode); in tidss_crtc_mode_valid()
325 struct drm_device *ddev = crtc->dev; in tidss_crtc_enable_vblank()
328 dev_dbg(ddev->dev, "%s\n", __func__); in tidss_crtc_enable_vblank()
339 struct drm_device *ddev = crtc->dev; in tidss_crtc_disable_vblank()
342 dev_dbg(ddev->dev, "%s\n", __func__); in tidss_crtc_disable_vblank()
353 if (crtc->state) in tidss_crtc_reset()
354 __drm_atomic_helper_crtc_destroy_state(crtc->state); in tidss_crtc_reset()
356 kfree(crtc->state); in tidss_crtc_reset()
360 crtc->state = NULL; in tidss_crtc_reset()
364 __drm_atomic_helper_crtc_reset(crtc, &tcrtc->base); in tidss_crtc_reset()
371 if (WARN_ON(!crtc->state)) in tidss_crtc_duplicate_state()
374 current_state = to_tidss_crtc_state(crtc->state); in tidss_crtc_duplicate_state()
380 __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); in tidss_crtc_duplicate_state()
382 state->plane_pos_changed = false; in tidss_crtc_duplicate_state()
384 state->bus_format = current_state->bus_format; in tidss_crtc_duplicate_state()
385 state->bus_flags = current_state->bus_flags; in tidss_crtc_duplicate_state()
387 return &state->base; in tidss_crtc_duplicate_state()
411 struct drm_plane *primary) in tidss_crtc_create() argument
416 bool has_ctm = tidss->feat->vp_feat.color.has_ctm; in tidss_crtc_create()
421 return ERR_PTR(-ENOMEM); in tidss_crtc_create()
423 tcrtc->hw_videoport = hw_videoport; in tidss_crtc_create()
424 init_completion(&tcrtc->framedone_completion); in tidss_crtc_create()
426 crtc = &tcrtc->crtc; in tidss_crtc_create()
428 ret = drm_crtc_init_with_planes(&tidss->ddev, crtc, primary, in tidss_crtc_create()
439 * from it no matter what HW supports. X-server assumes 256 in tidss_crtc_create()
442 if (tidss->feat->vp_feat.color.gamma_size) in tidss_crtc_create()