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()
302 if (old_connector_state->crtc != new_connector_state->crtc) { in update_connector_routing()
303 if (old_connector_state->crtc) { in update_connector_routing()
304 crtc_state = drm_atomic_get_new_crtc_state(state, old_connector_state->crtc); in update_connector_routing()
308 if (new_connector_state->crtc) { in update_connector_routing()
309 crtc_state = drm_atomic_get_new_crtc_state(state, new_connector_state->crtc); in update_connector_routing()
314 if (!new_connector_state->crtc) { in update_connector_routing()
324 new_connector_state->crtc); in update_connector_routing()
367 if (!drm_encoder_crtc_ok(new_encoder, new_connector_state->crtc)) { in update_connector_routing()
372 new_connector_state->crtc->base.id, in update_connector_routing()
373 new_connector_state->crtc->name); in update_connector_routing()
386 new_connector_state->crtc->base.id, in update_connector_routing()
387 new_connector_state->crtc->name); in update_connector_routing()
404 new_connector_state->crtc->base.id, in update_connector_routing()
405 new_connector_state->crtc->name); in update_connector_routing()
413 struct drm_crtc *crtc; in mode_fixup() local
420 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in mode_fixup()
433 WARN_ON(!!new_conn_state->best_encoder != !!new_conn_state->crtc); in mode_fixup()
435 if (!new_conn_state->crtc || !new_conn_state->best_encoder) in mode_fixup()
439 drm_atomic_get_new_crtc_state(state, new_conn_state->crtc); in mode_fixup()
478 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in mode_fixup()
488 funcs = crtc->helper_private; in mode_fixup()
492 ret = funcs->mode_fixup(crtc, &new_crtc_state->mode, in mode_fixup()
495 drm_dbg_atomic(crtc->dev, "[CRTC:%d:%s] fixup failed\n", in mode_fixup()
496 crtc->base.id, crtc->name); in mode_fixup()
506 struct drm_crtc *crtc, in mode_valid_path() argument
528 ret = drm_crtc_mode_valid(crtc, mode); in mode_valid_path()
531 crtc->base.id, crtc->name); in mode_valid_path()
547 struct drm_crtc *crtc = conn_state->crtc; in mode_valid() local
552 if (!crtc || !encoder) in mode_valid()
555 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in mode_valid()
563 mode_status = mode_valid_path(connector, encoder, crtc, mode); in mode_valid()
618 struct drm_crtc *crtc; in drm_atomic_helper_check_modeset() local
625 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_check_modeset()
629 WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); in drm_atomic_helper_check_modeset()
633 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
639 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
655 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
661 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
691 if (old_connector_state->crtc) { in drm_atomic_helper_check_modeset()
693 old_connector_state->crtc); in drm_atomic_helper_check_modeset()
721 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_check_modeset()
727 crtc->base.id, crtc->name, in drm_atomic_helper_check_modeset()
731 ret = drm_atomic_add_affected_connectors(state, crtc); in drm_atomic_helper_check_modeset()
735 ret = drm_atomic_add_affected_planes(state, crtc); in drm_atomic_helper_check_modeset()
862 WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc); in drm_atomic_helper_check_plane_state()
873 if (WARN_ON(!plane_state->crtc)) { in drm_atomic_helper_check_plane_state()
947 struct drm_device *dev = crtc_state->crtc->dev; in drm_atomic_helper_check_crtc_state()
966 if (plane_state->fb && plane_state->crtc) { in drm_atomic_helper_check_crtc_state()
1001 struct drm_crtc *crtc; in drm_atomic_helper_check_planes() local
1030 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_helper_check_planes()
1033 funcs = crtc->helper_private; in drm_atomic_helper_check_planes()
1038 ret = funcs->atomic_check(crtc, state); in drm_atomic_helper_check_planes()
1040 drm_dbg_atomic(crtc->dev, in drm_atomic_helper_check_planes()
1042 crtc->base.id, crtc->name); in drm_atomic_helper_check_planes()
1122 old_state->crtc != new_state->crtc) in crtc_needs_disable()
1141 struct drm_crtc *crtc; in disable_outputs() local
1154 if (!old_conn_state->crtc) in disable_outputs()
1157 old_crtc_state = drm_atomic_get_old_crtc_state(old_state, old_conn_state->crtc); in disable_outputs()
1159 if (new_conn_state->crtc) in disable_outputs()
1162 new_conn_state->crtc); in disable_outputs()
1167 !drm_atomic_crtc_needs_modeset(old_conn_state->crtc->state)) in disable_outputs()
1194 else if (new_conn_state->crtc && funcs->prepare) in disable_outputs()
1205 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in disable_outputs()
1216 funcs = crtc->helper_private; in disable_outputs()
1219 crtc->base.id, crtc->name); in disable_outputs()
1224 funcs->prepare(crtc); in disable_outputs()
1226 funcs->atomic_disable(crtc, old_state); in disable_outputs()
1228 funcs->disable(crtc); in disable_outputs()
1230 funcs->dpms(crtc, DRM_MODE_DPMS_OFF); in disable_outputs()
1235 ret = drm_crtc_vblank_get(crtc); in disable_outputs()
1238 drm_crtc_vblank_put(crtc); in disable_outputs()
1265 struct drm_crtc *crtc; in drm_atomic_helper_update_legacy_modeset_state() local
1272 WARN_ON(!connector->encoder->crtc); in drm_atomic_helper_update_legacy_modeset_state()
1274 connector->encoder->crtc = NULL; in drm_atomic_helper_update_legacy_modeset_state()
1278 crtc = new_conn_state->crtc; in drm_atomic_helper_update_legacy_modeset_state()
1279 if ((!crtc && old_conn_state->crtc) || in drm_atomic_helper_update_legacy_modeset_state()
1280 (crtc && drm_atomic_crtc_needs_modeset(crtc->state))) { in drm_atomic_helper_update_legacy_modeset_state()
1283 if (crtc && crtc->state->active) in drm_atomic_helper_update_legacy_modeset_state()
1292 if (!new_conn_state->crtc) in drm_atomic_helper_update_legacy_modeset_state()
1299 connector->encoder->crtc = new_conn_state->crtc; in drm_atomic_helper_update_legacy_modeset_state()
1303 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { in drm_atomic_helper_update_legacy_modeset_state()
1304 struct drm_plane *primary = crtc->primary; in drm_atomic_helper_update_legacy_modeset_state()
1307 crtc->mode = new_crtc_state->mode; in drm_atomic_helper_update_legacy_modeset_state()
1308 crtc->enabled = new_crtc_state->enable; in drm_atomic_helper_update_legacy_modeset_state()
1313 if (new_plane_state && new_plane_state->crtc == crtc) { in drm_atomic_helper_update_legacy_modeset_state()
1314 crtc->x = new_plane_state->src_x >> 16; in drm_atomic_helper_update_legacy_modeset_state()
1315 crtc->y = new_plane_state->src_y >> 16; in drm_atomic_helper_update_legacy_modeset_state()
1331 struct drm_crtc *crtc; in drm_atomic_helper_calc_timestamping_constants() local
1334 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_helper_calc_timestamping_constants()
1336 drm_calc_timestamping_constants(crtc, in drm_atomic_helper_calc_timestamping_constants()
1345 struct drm_crtc *crtc; in crtc_set_mode() local
1351 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { in crtc_set_mode()
1357 funcs = crtc->helper_private; in crtc_set_mode()
1361 crtc->base.id, crtc->name); in crtc_set_mode()
1363 funcs->mode_set_nofb(crtc); in crtc_set_mode()
1378 new_crtc_state = new_conn_state->crtc->state; in crtc_set_mode()
1468 struct drm_crtc *crtc; in drm_atomic_helper_commit_modeset_enables() local
1475 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_modeset_enables()
1485 funcs = crtc->helper_private; in drm_atomic_helper_commit_modeset_enables()
1489 crtc->base.id, crtc->name); in drm_atomic_helper_commit_modeset_enables()
1491 funcs->atomic_enable(crtc, old_state); in drm_atomic_helper_commit_modeset_enables()
1493 funcs->commit(crtc); in drm_atomic_helper_commit_modeset_enables()
1505 if (!new_conn_state->crtc->state->active || in drm_atomic_helper_commit_modeset_enables()
1506 !drm_atomic_crtc_needs_modeset(new_conn_state->crtc->state)) in drm_atomic_helper_commit_modeset_enables()
1609 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_vblanks() local
1621 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_wait_for_vblanks()
1625 ret = drm_crtc_vblank_get(crtc); in drm_atomic_helper_wait_for_vblanks()
1629 crtc_mask |= drm_crtc_mask(crtc); in drm_atomic_helper_wait_for_vblanks()
1630 old_state->crtcs[i].last_vblank_count = drm_crtc_vblank_count(crtc); in drm_atomic_helper_wait_for_vblanks()
1633 for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { in drm_atomic_helper_wait_for_vblanks()
1634 if (!(crtc_mask & drm_crtc_mask(crtc))) in drm_atomic_helper_wait_for_vblanks()
1639 drm_crtc_vblank_count(crtc), in drm_atomic_helper_wait_for_vblanks()
1643 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_vblanks()
1645 drm_crtc_vblank_put(crtc); in drm_atomic_helper_wait_for_vblanks()
1668 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_flip_done() local
1675 crtc = old_state->crtcs[i].ptr; in drm_atomic_helper_wait_for_flip_done()
1677 if (!crtc || !commit) in drm_atomic_helper_wait_for_flip_done()
1683 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_flip_done()
1760 struct drm_crtc *crtc; in commit_tail() local
1788 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) in commit_tail()
1832 struct drm_crtc *crtc; in drm_atomic_helper_async_check() local
1840 for_each_new_crtc_in_state(state, crtc, crtc_state, i) { in drm_atomic_helper_async_check()
1855 if (!new_plane_state->crtc || in drm_atomic_helper_async_check()
1856 old_plane_state->crtc != new_plane_state->crtc) { in drm_atomic_helper_async_check()
2096 static int stall_checks(struct drm_crtc *crtc, bool nonblock) in stall_checks() argument
2103 spin_lock(&crtc->commit_lock); in stall_checks()
2105 list_for_each_entry(commit, &crtc->commit_list, commit_entry) { in stall_checks()
2113 spin_unlock(&crtc->commit_lock); in stall_checks()
2114 drm_dbg_atomic(crtc->dev, in stall_checks()
2116 crtc->base.id, crtc->name); in stall_checks()
2127 spin_unlock(&crtc->commit_lock); in stall_checks()
2138 drm_err(crtc->dev, "[CRTC:%d:%s] cleanup_done timed out\n", in stall_checks()
2139 crtc->base.id, crtc->name); in stall_checks()
2155 static void init_commit(struct drm_crtc_commit *commit, struct drm_crtc *crtc) in init_commit() argument
2162 commit->crtc = crtc; in init_commit()
2166 crtc_or_fake_commit(struct drm_atomic_state *state, struct drm_crtc *crtc) in crtc_or_fake_commit() argument
2168 if (crtc) { in crtc_or_fake_commit()
2171 new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in crtc_or_fake_commit()
2236 struct drm_crtc *crtc; in drm_atomic_helper_setup_commit() local
2248 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_setup_commit()
2253 init_commit(commit, crtc); in drm_atomic_helper_setup_commit()
2257 ret = stall_checks(crtc, nonblock); in drm_atomic_helper_setup_commit()
2311 commit = crtc_or_fake_commit(state, new_conn_state->crtc ?: old_conn_state->crtc); in drm_atomic_helper_setup_commit()
2333 commit = crtc_or_fake_commit(state, new_plane_state->crtc ?: old_plane_state->crtc); in drm_atomic_helper_setup_commit()
2361 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_dependencies() local
2370 for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { in drm_atomic_helper_wait_for_dependencies()
2373 drm_err(crtc->dev, in drm_atomic_helper_wait_for_dependencies()
2375 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_dependencies()
2417 struct drm_crtc *crtc; in drm_atomic_helper_fake_vblank() local
2420 for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { in drm_atomic_helper_fake_vblank()
2428 drm_crtc_send_vblank_event(crtc, in drm_atomic_helper_fake_vblank()
2454 struct drm_crtc *crtc; in drm_atomic_helper_commit_hw_done() local
2459 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_hw_done()
2499 struct drm_crtc *crtc; in drm_atomic_helper_commit_cleanup_done() local
2504 for_each_old_crtc_in_state(old_state, crtc, old_crtc_state, i) { in drm_atomic_helper_commit_cleanup_done()
2512 spin_lock(&crtc->commit_lock); in drm_atomic_helper_commit_cleanup_done()
2514 spin_unlock(&crtc->commit_lock); in drm_atomic_helper_commit_cleanup_done()
2597 return state->crtc && state->crtc->state->active; in plane_crtc_active()
2645 struct drm_crtc *crtc; in drm_atomic_helper_commit_planes() local
2653 for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_planes()
2656 funcs = crtc->helper_private; in drm_atomic_helper_commit_planes()
2664 funcs->atomic_begin(crtc, old_state); in drm_atomic_helper_commit_planes()
2699 crtc_state = old_plane_state->crtc->state; in drm_atomic_helper_commit_planes()
2706 } else if (new_plane_state->crtc || disabling) { in drm_atomic_helper_commit_planes()
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_flush(crtc, old_state); in drm_atomic_helper_commit_planes()
2748 struct drm_crtc *crtc = old_crtc_state->crtc; in drm_atomic_helper_commit_planes_on_crtc() local
2751 drm_atomic_get_new_crtc_state(old_state, crtc); in drm_atomic_helper_commit_planes_on_crtc()
2758 crtc_funcs = crtc->helper_private; in drm_atomic_helper_commit_planes_on_crtc()
2760 crtc_funcs->atomic_begin(crtc, old_state); in drm_atomic_helper_commit_planes_on_crtc()
2762 drm_for_each_plane_mask(plane, crtc->dev, plane_mask) { in drm_atomic_helper_commit_planes_on_crtc()
2774 WARN_ON(new_plane_state->crtc && in drm_atomic_helper_commit_planes_on_crtc()
2775 new_plane_state->crtc != crtc); in drm_atomic_helper_commit_planes_on_crtc()
2780 else if (new_plane_state->crtc || in drm_atomic_helper_commit_planes_on_crtc()
2786 crtc_funcs->atomic_flush(crtc, old_state); in drm_atomic_helper_commit_planes_on_crtc()
2810 struct drm_crtc *crtc = old_crtc_state->crtc; in drm_atomic_helper_disable_planes_on_crtc() local
2812 crtc->helper_private; in drm_atomic_helper_disable_planes_on_crtc()
2816 crtc_funcs->atomic_begin(crtc, NULL); in drm_atomic_helper_disable_planes_on_crtc()
2831 crtc_funcs->atomic_flush(crtc, NULL); in drm_atomic_helper_disable_planes_on_crtc()
2916 struct drm_crtc *crtc; in drm_atomic_helper_swap_state() local
2934 for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { in drm_atomic_helper_swap_state()
2978 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_swap_state()
2979 WARN_ON(crtc->state != old_crtc_state); in drm_atomic_helper_swap_state()
2985 crtc->state = new_crtc_state; in drm_atomic_helper_swap_state()
2988 spin_lock(&crtc->commit_lock); in drm_atomic_helper_swap_state()
2990 &crtc->commit_list); in drm_atomic_helper_swap_state()
2991 spin_unlock(&crtc->commit_lock); in drm_atomic_helper_swap_state()
3042 struct drm_crtc *crtc, in drm_atomic_helper_update_plane() argument
3065 ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); in drm_atomic_helper_update_plane()
3078 if (plane == crtc->cursor) in drm_atomic_helper_update_plane()
3116 if (plane_state->crtc && plane_state->crtc->cursor == plane) in drm_atomic_helper_disable_plane()
3150 struct drm_crtc *crtc = set->crtc; in drm_atomic_helper_set_config() local
3153 state = drm_atomic_state_alloc(crtc->dev); in drm_atomic_helper_set_config()
3206 struct drm_crtc *crtc; in drm_atomic_helper_disable_all() local
3215 drm_for_each_crtc(crtc, dev) { in drm_atomic_helper_disable_all()
3216 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_helper_disable_all()
3228 ret = drm_atomic_add_affected_planes(state, crtc); in drm_atomic_helper_disable_all()
3232 ret = drm_atomic_add_affected_connectors(state, crtc); in drm_atomic_helper_disable_all()
3318 struct drm_crtc *crtc; in drm_atomic_helper_duplicate_state() local
3328 drm_for_each_crtc(crtc, dev) { in drm_atomic_helper_duplicate_state()
3331 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_helper_duplicate_state()
3453 struct drm_crtc *crtc; in drm_atomic_helper_commit_duplicated_state() local
3461 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) in drm_atomic_helper_commit_duplicated_state()
3462 state->crtcs[i].old_state = crtc->state; in drm_atomic_helper_commit_duplicated_state()
3511 struct drm_crtc *crtc, in page_flip_common() argument
3516 struct drm_plane *plane = crtc->primary; in page_flip_common()
3521 crtc_state = drm_atomic_get_crtc_state(state, crtc); in page_flip_common()
3532 ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); in page_flip_common()
3540 drm_dbg_atomic(crtc->dev, in page_flip_common()
3542 crtc->base.id, crtc->name); in page_flip_common()
3566 int drm_atomic_helper_page_flip(struct drm_crtc *crtc, in drm_atomic_helper_page_flip() argument
3572 struct drm_plane *plane = crtc->primary; in drm_atomic_helper_page_flip()
3582 ret = page_flip_common(state, crtc, fb, event, flags); in drm_atomic_helper_page_flip()
3609 int drm_atomic_helper_page_flip_target(struct drm_crtc *crtc, in drm_atomic_helper_page_flip_target() argument
3616 struct drm_plane *plane = crtc->primary; in drm_atomic_helper_page_flip_target()
3627 ret = page_flip_common(state, crtc, fb, event, flags); in drm_atomic_helper_page_flip_target()
3631 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in drm_atomic_helper_page_flip_target()