Lines Matching refs:crtc
84 if (old_plane_state->crtc) { in drm_atomic_helper_plane_changed()
86 old_plane_state->crtc); in drm_atomic_helper_plane_changed()
94 if (plane_state->crtc) { in drm_atomic_helper_plane_changed()
95 crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in drm_atomic_helper_plane_changed()
123 if (!new_conn_state->crtc) in handle_conflicting_encoders()
177 connector->state->crtc->base.id, in handle_conflicting_encoders()
178 connector->state->crtc->name, in handle_conflicting_encoders()
193 new_conn_state->crtc->base.id, new_conn_state->crtc->name, in handle_conflicting_encoders()
196 crtc_state = drm_atomic_get_new_crtc_state(state, new_conn_state->crtc); in handle_conflicting_encoders()
223 struct drm_crtc *crtc; in set_best_encoder() local
227 crtc = conn_state->connector->state->crtc; in set_best_encoder()
235 WARN_ON(!crtc && encoder != conn_state->best_encoder); in set_best_encoder()
236 if (crtc) { in set_best_encoder()
237 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in set_best_encoder()
245 crtc = conn_state->crtc; in set_best_encoder()
246 WARN_ON(!crtc); in set_best_encoder()
247 if (crtc) { in set_best_encoder()
248 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in set_best_encoder()
273 encoder_crtc = old_connector_state->crtc; in steal_encoder()
303 if (old_connector_state->crtc != new_connector_state->crtc) { in update_connector_routing()
304 if (old_connector_state->crtc) { in update_connector_routing()
305 crtc_state = drm_atomic_get_new_crtc_state(state, old_connector_state->crtc); in update_connector_routing()
309 if (new_connector_state->crtc) { in update_connector_routing()
310 crtc_state = drm_atomic_get_new_crtc_state(state, new_connector_state->crtc); in update_connector_routing()
315 if (!new_connector_state->crtc) { in update_connector_routing()
325 new_connector_state->crtc); in update_connector_routing()
372 if (!drm_encoder_crtc_ok(new_encoder, new_connector_state->crtc)) { in update_connector_routing()
377 new_connector_state->crtc->base.id, in update_connector_routing()
378 new_connector_state->crtc->name); in update_connector_routing()
391 new_connector_state->crtc->base.id, in update_connector_routing()
392 new_connector_state->crtc->name); in update_connector_routing()
409 new_connector_state->crtc->base.id, in update_connector_routing()
410 new_connector_state->crtc->name); in update_connector_routing()
418 struct drm_crtc *crtc; in mode_fixup() local
425 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in mode_fixup()
438 WARN_ON(!!new_conn_state->best_encoder != !!new_conn_state->crtc); in mode_fixup()
440 if (!new_conn_state->crtc || !new_conn_state->best_encoder) in mode_fixup()
444 drm_atomic_get_new_crtc_state(state, new_conn_state->crtc); in mode_fixup()
483 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in mode_fixup()
493 funcs = crtc->helper_private; in mode_fixup()
497 ret = funcs->mode_fixup(crtc, &new_crtc_state->mode, in mode_fixup()
500 drm_dbg_atomic(crtc->dev, "[CRTC:%d:%s] fixup failed\n", in mode_fixup()
501 crtc->base.id, crtc->name); in mode_fixup()
511 struct drm_crtc *crtc, in mode_valid_path() argument
533 ret = drm_crtc_mode_valid(crtc, mode); in mode_valid_path()
536 crtc->base.id, crtc->name); in mode_valid_path()
552 struct drm_crtc *crtc = conn_state->crtc; in mode_valid() local
557 if (!crtc || !encoder) in mode_valid()
560 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in mode_valid()
568 mode_status = mode_valid_path(connector, encoder, crtc, mode); in mode_valid()
623 struct drm_crtc *crtc; in drm_atomic_helper_check_modeset() local
633 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_check_modeset()
637 WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); in drm_atomic_helper_check_modeset()
641 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
647 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
663 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
669 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
700 if (old_connector_state->crtc) { in drm_atomic_helper_check_modeset()
702 old_connector_state->crtc); in drm_atomic_helper_check_modeset()
730 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_check_modeset()
736 crtc->base.id, crtc->name, in drm_atomic_helper_check_modeset()
740 ret = drm_atomic_add_affected_connectors(state, crtc); in drm_atomic_helper_check_modeset()
744 ret = drm_atomic_add_affected_planes(state, crtc); in drm_atomic_helper_check_modeset()
871 WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc); in drm_atomic_helper_check_plane_state()
882 if (WARN_ON(!plane_state->crtc)) { in drm_atomic_helper_check_plane_state()
950 struct drm_crtc *crtc = crtc_state->crtc; in drm_atomic_helper_check_crtc_primary_plane() local
951 struct drm_device *dev = crtc->dev; in drm_atomic_helper_check_crtc_primary_plane()
960 drm_dbg_atomic(dev, "[CRTC:%d:%s] primary plane missing\n", crtc->base.id, crtc->name); in drm_atomic_helper_check_crtc_primary_plane()
986 struct drm_crtc *crtc; in drm_atomic_helper_check_planes() local
1015 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_helper_check_planes()
1018 funcs = crtc->helper_private; in drm_atomic_helper_check_planes()
1023 ret = funcs->atomic_check(crtc, state); in drm_atomic_helper_check_planes()
1025 drm_dbg_atomic(crtc->dev, in drm_atomic_helper_check_planes()
1027 crtc->base.id, crtc->name); in drm_atomic_helper_check_planes()
1107 old_state->crtc != new_state->crtc) in crtc_needs_disable()
1126 struct drm_crtc *crtc; in disable_outputs() local
1139 if (!old_conn_state->crtc) in disable_outputs()
1142 old_crtc_state = drm_atomic_get_old_crtc_state(old_state, old_conn_state->crtc); in disable_outputs()
1144 if (new_conn_state->crtc) in disable_outputs()
1147 new_conn_state->crtc); in disable_outputs()
1152 !drm_atomic_crtc_needs_modeset(old_conn_state->crtc->state)) in disable_outputs()
1179 else if (new_conn_state->crtc && funcs->prepare) in disable_outputs()
1190 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in disable_outputs()
1201 funcs = crtc->helper_private; in disable_outputs()
1204 crtc->base.id, crtc->name); in disable_outputs()
1209 funcs->prepare(crtc); in disable_outputs()
1211 funcs->atomic_disable(crtc, old_state); in disable_outputs()
1213 funcs->disable(crtc); in disable_outputs()
1215 funcs->dpms(crtc, DRM_MODE_DPMS_OFF); in disable_outputs()
1220 ret = drm_crtc_vblank_get(crtc); in disable_outputs()
1232 drm_crtc_vblank_put(crtc); in disable_outputs()
1259 struct drm_crtc *crtc; in drm_atomic_helper_update_legacy_modeset_state() local
1266 WARN_ON(!connector->encoder->crtc); in drm_atomic_helper_update_legacy_modeset_state()
1268 connector->encoder->crtc = NULL; in drm_atomic_helper_update_legacy_modeset_state()
1272 crtc = new_conn_state->crtc; in drm_atomic_helper_update_legacy_modeset_state()
1273 if ((!crtc && old_conn_state->crtc) || in drm_atomic_helper_update_legacy_modeset_state()
1274 (crtc && drm_atomic_crtc_needs_modeset(crtc->state))) { in drm_atomic_helper_update_legacy_modeset_state()
1277 if (crtc && crtc->state->active) in drm_atomic_helper_update_legacy_modeset_state()
1286 if (!new_conn_state->crtc) in drm_atomic_helper_update_legacy_modeset_state()
1293 connector->encoder->crtc = new_conn_state->crtc; in drm_atomic_helper_update_legacy_modeset_state()
1297 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { in drm_atomic_helper_update_legacy_modeset_state()
1298 struct drm_plane *primary = crtc->primary; in drm_atomic_helper_update_legacy_modeset_state()
1301 crtc->mode = new_crtc_state->mode; in drm_atomic_helper_update_legacy_modeset_state()
1302 crtc->enabled = new_crtc_state->enable; in drm_atomic_helper_update_legacy_modeset_state()
1307 if (new_plane_state && new_plane_state->crtc == crtc) { in drm_atomic_helper_update_legacy_modeset_state()
1308 crtc->x = new_plane_state->src_x >> 16; in drm_atomic_helper_update_legacy_modeset_state()
1309 crtc->y = new_plane_state->src_y >> 16; in drm_atomic_helper_update_legacy_modeset_state()
1325 struct drm_crtc *crtc; in drm_atomic_helper_calc_timestamping_constants() local
1328 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_helper_calc_timestamping_constants()
1330 drm_calc_timestamping_constants(crtc, in drm_atomic_helper_calc_timestamping_constants()
1339 struct drm_crtc *crtc; in crtc_set_mode() local
1345 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { in crtc_set_mode()
1351 funcs = crtc->helper_private; in crtc_set_mode()
1355 crtc->base.id, crtc->name); in crtc_set_mode()
1357 funcs->mode_set_nofb(crtc); in crtc_set_mode()
1372 new_crtc_state = new_conn_state->crtc->state; in crtc_set_mode()
1462 struct drm_crtc *crtc; in drm_atomic_helper_commit_modeset_enables() local
1469 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_modeset_enables()
1479 funcs = crtc->helper_private; in drm_atomic_helper_commit_modeset_enables()
1483 crtc->base.id, crtc->name); in drm_atomic_helper_commit_modeset_enables()
1485 funcs->atomic_enable(crtc, old_state); in drm_atomic_helper_commit_modeset_enables()
1487 funcs->commit(crtc); in drm_atomic_helper_commit_modeset_enables()
1499 if (!new_conn_state->crtc->state->active || in drm_atomic_helper_commit_modeset_enables()
1500 !drm_atomic_crtc_needs_modeset(new_conn_state->crtc->state)) in drm_atomic_helper_commit_modeset_enables()
1539 struct drm_crtc *crtc; in set_fence_deadline() local
1546 for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { in set_fence_deadline()
1555 if (drm_crtc_next_vblank_start(crtc, &v)) in set_fence_deadline()
1646 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_vblanks() local
1658 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_wait_for_vblanks()
1662 ret = drm_crtc_vblank_get(crtc); in drm_atomic_helper_wait_for_vblanks()
1666 crtc_mask |= drm_crtc_mask(crtc); in drm_atomic_helper_wait_for_vblanks()
1667 old_state->crtcs[i].last_vblank_count = drm_crtc_vblank_count(crtc); in drm_atomic_helper_wait_for_vblanks()
1670 for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { in drm_atomic_helper_wait_for_vblanks()
1671 if (!(crtc_mask & drm_crtc_mask(crtc))) in drm_atomic_helper_wait_for_vblanks()
1676 drm_crtc_vblank_count(crtc), in drm_atomic_helper_wait_for_vblanks()
1680 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_vblanks()
1682 drm_crtc_vblank_put(crtc); in drm_atomic_helper_wait_for_vblanks()
1705 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_flip_done() local
1712 crtc = old_state->crtcs[i].ptr; in drm_atomic_helper_wait_for_flip_done()
1714 if (!crtc || !commit) in drm_atomic_helper_wait_for_flip_done()
1720 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_flip_done()
1797 struct drm_crtc *crtc; in commit_tail() local
1825 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) in commit_tail()
1869 struct drm_crtc *crtc; in drm_atomic_helper_async_check() local
1877 for_each_new_crtc_in_state(state, crtc, crtc_state, i) { in drm_atomic_helper_async_check()
1892 if (!new_plane_state->crtc || in drm_atomic_helper_async_check()
1893 old_plane_state->crtc != new_plane_state->crtc) { in drm_atomic_helper_async_check()
2133 static int stall_checks(struct drm_crtc *crtc, bool nonblock) in stall_checks() argument
2140 spin_lock(&crtc->commit_lock); in stall_checks()
2142 list_for_each_entry(commit, &crtc->commit_list, commit_entry) { in stall_checks()
2150 spin_unlock(&crtc->commit_lock); in stall_checks()
2151 drm_dbg_atomic(crtc->dev, in stall_checks()
2153 crtc->base.id, crtc->name); in stall_checks()
2164 spin_unlock(&crtc->commit_lock); in stall_checks()
2175 drm_err(crtc->dev, "[CRTC:%d:%s] cleanup_done timed out\n", in stall_checks()
2176 crtc->base.id, crtc->name); in stall_checks()
2192 static void init_commit(struct drm_crtc_commit *commit, struct drm_crtc *crtc) in init_commit() argument
2199 commit->crtc = crtc; in init_commit()
2203 crtc_or_fake_commit(struct drm_atomic_state *state, struct drm_crtc *crtc) in crtc_or_fake_commit() argument
2205 if (crtc) { in crtc_or_fake_commit()
2208 new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in crtc_or_fake_commit()
2273 struct drm_crtc *crtc; in drm_atomic_helper_setup_commit() local
2285 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_setup_commit()
2290 init_commit(commit, crtc); in drm_atomic_helper_setup_commit()
2294 ret = stall_checks(crtc, nonblock); in drm_atomic_helper_setup_commit()
2348 commit = crtc_or_fake_commit(state, new_conn_state->crtc ?: old_conn_state->crtc); in drm_atomic_helper_setup_commit()
2370 commit = crtc_or_fake_commit(state, new_plane_state->crtc ?: old_plane_state->crtc); in drm_atomic_helper_setup_commit()
2398 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_dependencies() local
2407 for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { in drm_atomic_helper_wait_for_dependencies()
2410 drm_err(crtc->dev, in drm_atomic_helper_wait_for_dependencies()
2412 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_dependencies()
2454 struct drm_crtc *crtc; in drm_atomic_helper_fake_vblank() local
2457 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { in drm_atomic_helper_fake_vblank()
2465 drm_crtc_send_vblank_event(crtc, in drm_atomic_helper_fake_vblank()
2491 struct drm_crtc *crtc; in drm_atomic_helper_commit_hw_done() local
2496 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_hw_done()
2536 struct drm_crtc *crtc; in drm_atomic_helper_commit_cleanup_done() local
2541 for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { in drm_atomic_helper_commit_cleanup_done()
2549 spin_lock(&crtc->commit_lock); in drm_atomic_helper_commit_cleanup_done()
2551 spin_unlock(&crtc->commit_lock); in drm_atomic_helper_commit_cleanup_done()
2655 return state->crtc && state->crtc->state->active; in plane_crtc_active()
2703 struct drm_crtc *crtc; in drm_atomic_helper_commit_planes() local
2711 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_planes()
2714 funcs = crtc->helper_private; in drm_atomic_helper_commit_planes()
2722 funcs->atomic_begin(crtc, old_state); in drm_atomic_helper_commit_planes()
2757 crtc_state = old_plane_state->crtc->state; in drm_atomic_helper_commit_planes()
2764 } else if (new_plane_state->crtc || disabling) { in drm_atomic_helper_commit_planes()
2774 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_planes()
2777 funcs = crtc->helper_private; in drm_atomic_helper_commit_planes()
2785 funcs->atomic_flush(crtc, old_state); in drm_atomic_helper_commit_planes()
2811 struct drm_crtc *crtc = old_crtc_state->crtc; in drm_atomic_helper_commit_planes_on_crtc() local
2814 drm_atomic_get_new_crtc_state(old_state, crtc); in drm_atomic_helper_commit_planes_on_crtc()
2821 crtc_funcs = crtc->helper_private; in drm_atomic_helper_commit_planes_on_crtc()
2823 crtc_funcs->atomic_begin(crtc, old_state); in drm_atomic_helper_commit_planes_on_crtc()
2825 drm_for_each_plane_mask(plane, crtc->dev, plane_mask) { in drm_atomic_helper_commit_planes_on_crtc()
2838 WARN_ON(new_plane_state->crtc && in drm_atomic_helper_commit_planes_on_crtc()
2839 new_plane_state->crtc != crtc); in drm_atomic_helper_commit_planes_on_crtc()
2845 } else if (new_plane_state->crtc || disabling) { in drm_atomic_helper_commit_planes_on_crtc()
2856 crtc_funcs->atomic_flush(crtc, old_state); in drm_atomic_helper_commit_planes_on_crtc()
2880 struct drm_crtc *crtc = old_crtc_state->crtc; in drm_atomic_helper_disable_planes_on_crtc() local
2882 crtc->helper_private; in drm_atomic_helper_disable_planes_on_crtc()
2886 crtc_funcs->atomic_begin(crtc, NULL); in drm_atomic_helper_disable_planes_on_crtc()
2901 crtc_funcs->atomic_flush(crtc, NULL); in drm_atomic_helper_disable_planes_on_crtc()
2993 struct drm_crtc *crtc; in drm_atomic_helper_swap_state() local
3011 for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { in drm_atomic_helper_swap_state()
3055 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_swap_state()
3056 WARN_ON(crtc->state != old_crtc_state); in drm_atomic_helper_swap_state()
3062 crtc->state = new_crtc_state; in drm_atomic_helper_swap_state()
3065 spin_lock(&crtc->commit_lock); in drm_atomic_helper_swap_state()
3067 &crtc->commit_list); in drm_atomic_helper_swap_state()
3068 spin_unlock(&crtc->commit_lock); in drm_atomic_helper_swap_state()
3119 struct drm_crtc *crtc, in drm_atomic_helper_update_plane() argument
3142 ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); in drm_atomic_helper_update_plane()
3155 if (plane == crtc->cursor) in drm_atomic_helper_update_plane()
3193 if (plane_state->crtc && plane_state->crtc->cursor == plane) in drm_atomic_helper_disable_plane()
3227 struct drm_crtc *crtc = set->crtc; in drm_atomic_helper_set_config() local
3230 state = drm_atomic_state_alloc(crtc->dev); in drm_atomic_helper_set_config()
3283 struct drm_crtc *crtc; in drm_atomic_helper_disable_all() local
3292 drm_for_each_crtc(crtc, dev) { in drm_atomic_helper_disable_all()
3293 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_helper_disable_all()
3305 ret = drm_atomic_add_affected_planes(state, crtc); in drm_atomic_helper_disable_all()
3309 ret = drm_atomic_add_affected_connectors(state, crtc); in drm_atomic_helper_disable_all()
3395 struct drm_crtc *crtc; in drm_atomic_helper_duplicate_state() local
3405 drm_for_each_crtc(crtc, dev) { in drm_atomic_helper_duplicate_state()
3408 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_helper_duplicate_state()
3530 struct drm_crtc *crtc; in drm_atomic_helper_commit_duplicated_state() local
3538 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) in drm_atomic_helper_commit_duplicated_state()
3539 state->crtcs[i].old_state = crtc->state; in drm_atomic_helper_commit_duplicated_state()
3588 struct drm_crtc *crtc, in page_flip_common() argument
3593 struct drm_plane *plane = crtc->primary; in page_flip_common()
3598 crtc_state = drm_atomic_get_crtc_state(state, crtc); in page_flip_common()
3609 ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); in page_flip_common()
3617 drm_dbg_atomic(crtc->dev, in page_flip_common()
3619 crtc->base.id, crtc->name); in page_flip_common()
3643 int drm_atomic_helper_page_flip(struct drm_crtc *crtc, in drm_atomic_helper_page_flip() argument
3649 struct drm_plane *plane = crtc->primary; in drm_atomic_helper_page_flip()
3659 ret = page_flip_common(state, crtc, fb, event, flags); in drm_atomic_helper_page_flip()
3686 int drm_atomic_helper_page_flip_target(struct drm_crtc *crtc, in drm_atomic_helper_page_flip_target() argument
3693 struct drm_plane *plane = crtc->primary; in drm_atomic_helper_page_flip_target()
3704 ret = page_flip_common(state, crtc, fb, event, flags); in drm_atomic_helper_page_flip_target()
3708 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in drm_atomic_helper_page_flip_target()