Lines Matching refs:crtc

86 	if (old_plane_state->crtc) {  in drm_atomic_helper_plane_changed()
88 old_plane_state->crtc); in drm_atomic_helper_plane_changed()
96 if (plane_state->crtc) { in drm_atomic_helper_plane_changed()
97 crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); in drm_atomic_helper_plane_changed()
125 if (!new_conn_state->crtc) in handle_conflicting_encoders()
179 connector->state->crtc->base.id, in handle_conflicting_encoders()
180 connector->state->crtc->name, in handle_conflicting_encoders()
195 new_conn_state->crtc->base.id, new_conn_state->crtc->name, in handle_conflicting_encoders()
198 crtc_state = drm_atomic_get_new_crtc_state(state, new_conn_state->crtc); in handle_conflicting_encoders()
225 struct drm_crtc *crtc; in set_best_encoder() local
229 crtc = conn_state->connector->state->crtc; in set_best_encoder()
237 WARN_ON(!crtc && encoder != conn_state->best_encoder); in set_best_encoder()
238 if (crtc) { in set_best_encoder()
239 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in set_best_encoder()
247 crtc = conn_state->crtc; in set_best_encoder()
248 WARN_ON(!crtc); in set_best_encoder()
249 if (crtc) { in set_best_encoder()
250 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in set_best_encoder()
275 encoder_crtc = old_connector_state->crtc; in steal_encoder()
305 if (old_connector_state->crtc != new_connector_state->crtc) { in update_connector_routing()
306 if (old_connector_state->crtc) { in update_connector_routing()
307 crtc_state = drm_atomic_get_new_crtc_state(state, old_connector_state->crtc); in update_connector_routing()
311 if (new_connector_state->crtc) { in update_connector_routing()
312 crtc_state = drm_atomic_get_new_crtc_state(state, new_connector_state->crtc); in update_connector_routing()
317 if (!new_connector_state->crtc) { in update_connector_routing()
327 new_connector_state->crtc); in update_connector_routing()
374 if (!drm_encoder_crtc_ok(new_encoder, new_connector_state->crtc)) { in update_connector_routing()
379 new_connector_state->crtc->base.id, in update_connector_routing()
380 new_connector_state->crtc->name); in update_connector_routing()
393 new_connector_state->crtc->base.id, in update_connector_routing()
394 new_connector_state->crtc->name); in update_connector_routing()
411 new_connector_state->crtc->base.id, in update_connector_routing()
412 new_connector_state->crtc->name); in update_connector_routing()
420 struct drm_crtc *crtc; in mode_fixup() local
427 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in mode_fixup()
440 WARN_ON(!!new_conn_state->best_encoder != !!new_conn_state->crtc); in mode_fixup()
442 if (!new_conn_state->crtc || !new_conn_state->best_encoder) in mode_fixup()
446 drm_atomic_get_new_crtc_state(state, new_conn_state->crtc); in mode_fixup()
485 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in mode_fixup()
495 funcs = crtc->helper_private; in mode_fixup()
499 ret = funcs->mode_fixup(crtc, &new_crtc_state->mode, in mode_fixup()
502 drm_dbg_atomic(crtc->dev, "[CRTC:%d:%s] fixup failed\n", in mode_fixup()
503 crtc->base.id, crtc->name); in mode_fixup()
513 struct drm_crtc *crtc, in mode_valid_path() argument
535 ret = drm_crtc_mode_valid(crtc, mode); in mode_valid_path()
538 crtc->base.id, crtc->name); in mode_valid_path()
554 struct drm_crtc *crtc = conn_state->crtc; in mode_valid() local
559 if (!crtc || !encoder) in mode_valid()
562 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in mode_valid()
570 mode_status = mode_valid_path(connector, encoder, crtc, mode); in mode_valid()
579 struct drm_crtc *crtc) in drm_atomic_check_valid_clones() argument
583 crtc); in drm_atomic_check_valid_clones()
585 drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask) { in drm_atomic_check_valid_clones()
594 crtc->base.id, crtc_state->encoder_mask); in drm_atomic_check_valid_clones()
649 struct drm_crtc *crtc; in drm_atomic_helper_check_modeset() local
659 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_check_modeset()
663 WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); in drm_atomic_helper_check_modeset()
667 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
673 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
689 crtc->base.id, crtc->name); in drm_atomic_helper_check_modeset()
695 crtc->base.id, crtc->name, in drm_atomic_helper_check_modeset()
727 if (old_connector_state->crtc) { in drm_atomic_helper_check_modeset()
729 old_connector_state->crtc); in drm_atomic_helper_check_modeset()
757 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_check_modeset()
763 crtc->base.id, crtc->name, in drm_atomic_helper_check_modeset()
767 ret = drm_atomic_add_affected_connectors(state, crtc); in drm_atomic_helper_check_modeset()
771 ret = drm_atomic_add_affected_planes(state, crtc); in drm_atomic_helper_check_modeset()
775 ret = drm_atomic_check_valid_clones(state, crtc); in drm_atomic_helper_check_modeset()
904 WARN_ON(plane_state->crtc && plane_state->crtc != crtc_state->crtc); in drm_atomic_helper_check_plane_state()
915 if (WARN_ON(!plane_state->crtc)) { in drm_atomic_helper_check_plane_state()
983 struct drm_crtc *crtc = crtc_state->crtc; in drm_atomic_helper_check_crtc_primary_plane() local
984 struct drm_device *dev = crtc->dev; in drm_atomic_helper_check_crtc_primary_plane()
993 drm_dbg_atomic(dev, "[CRTC:%d:%s] primary plane missing\n", crtc->base.id, crtc->name); in drm_atomic_helper_check_crtc_primary_plane()
1019 struct drm_crtc *crtc; in drm_atomic_helper_check_planes() local
1048 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_helper_check_planes()
1051 funcs = crtc->helper_private; in drm_atomic_helper_check_planes()
1056 ret = funcs->atomic_check(crtc, state); in drm_atomic_helper_check_planes()
1058 drm_dbg_atomic(crtc->dev, in drm_atomic_helper_check_planes()
1060 crtc->base.id, crtc->name); in drm_atomic_helper_check_planes()
1149 old_state->crtc != new_state->crtc) in crtc_needs_disable()
1180 if (!old_conn_state->crtc) in encoder_bridge_disable()
1183 old_crtc_state = drm_atomic_get_old_crtc_state(state, old_conn_state->crtc); in encoder_bridge_disable()
1185 if (new_conn_state->crtc) in encoder_bridge_disable()
1188 new_conn_state->crtc); in encoder_bridge_disable()
1193 !drm_atomic_crtc_needs_modeset(old_conn_state->crtc->state)) in encoder_bridge_disable()
1220 else if (new_conn_state->crtc && funcs->prepare) in encoder_bridge_disable()
1233 struct drm_crtc *crtc; in crtc_disable() local
1237 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in crtc_disable()
1248 funcs = crtc->helper_private; in crtc_disable()
1251 crtc->base.id, crtc->name); in crtc_disable()
1256 funcs->prepare(crtc); in crtc_disable()
1258 funcs->atomic_disable(crtc, state); in crtc_disable()
1260 funcs->disable(crtc); in crtc_disable()
1262 funcs->dpms(crtc, DRM_MODE_DPMS_OFF); in crtc_disable()
1267 ret = drm_crtc_vblank_get(crtc); in crtc_disable()
1279 drm_crtc_vblank_put(crtc); in crtc_disable()
1299 if (!old_conn_state->crtc) in encoder_bridge_post_disable()
1302 old_crtc_state = drm_atomic_get_old_crtc_state(state, old_conn_state->crtc); in encoder_bridge_post_disable()
1304 if (new_conn_state->crtc) in encoder_bridge_post_disable()
1306 new_conn_state->crtc); in encoder_bridge_post_disable()
1311 !drm_atomic_crtc_needs_modeset(old_conn_state->crtc->state)) in encoder_bridge_post_disable()
1368 struct drm_crtc *crtc; in drm_atomic_helper_update_legacy_modeset_state() local
1375 WARN_ON(!connector->encoder->crtc); in drm_atomic_helper_update_legacy_modeset_state()
1377 connector->encoder->crtc = NULL; in drm_atomic_helper_update_legacy_modeset_state()
1381 crtc = new_conn_state->crtc; in drm_atomic_helper_update_legacy_modeset_state()
1382 if ((!crtc && old_conn_state->crtc) || in drm_atomic_helper_update_legacy_modeset_state()
1383 (crtc && drm_atomic_crtc_needs_modeset(crtc->state))) { in drm_atomic_helper_update_legacy_modeset_state()
1386 if (crtc && crtc->state->active) in drm_atomic_helper_update_legacy_modeset_state()
1395 if (!new_conn_state->crtc) in drm_atomic_helper_update_legacy_modeset_state()
1402 connector->encoder->crtc = new_conn_state->crtc; in drm_atomic_helper_update_legacy_modeset_state()
1406 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_helper_update_legacy_modeset_state()
1407 struct drm_plane *primary = crtc->primary; in drm_atomic_helper_update_legacy_modeset_state()
1410 crtc->mode = new_crtc_state->mode; in drm_atomic_helper_update_legacy_modeset_state()
1411 crtc->enabled = new_crtc_state->enable; in drm_atomic_helper_update_legacy_modeset_state()
1416 if (new_plane_state && new_plane_state->crtc == crtc) { in drm_atomic_helper_update_legacy_modeset_state()
1417 crtc->x = new_plane_state->src_x >> 16; in drm_atomic_helper_update_legacy_modeset_state()
1418 crtc->y = new_plane_state->src_y >> 16; in drm_atomic_helper_update_legacy_modeset_state()
1434 struct drm_crtc *crtc; in drm_atomic_helper_calc_timestamping_constants() local
1437 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_helper_calc_timestamping_constants()
1439 drm_calc_timestamping_constants(crtc, in drm_atomic_helper_calc_timestamping_constants()
1448 struct drm_crtc *crtc; in crtc_set_mode() local
1454 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in crtc_set_mode()
1460 funcs = crtc->helper_private; in crtc_set_mode()
1464 crtc->base.id, crtc->name); in crtc_set_mode()
1466 funcs->mode_set_nofb(crtc); in crtc_set_mode()
1481 new_crtc_state = new_conn_state->crtc->state; in crtc_set_mode()
1568 if (!new_conn_state->crtc->state->active || in encoder_bridge_pre_enable()
1569 !drm_atomic_crtc_needs_modeset(new_conn_state->crtc->state)) in encoder_bridge_pre_enable()
1589 struct drm_crtc *crtc; in crtc_enable() local
1594 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in crtc_enable()
1604 funcs = crtc->helper_private; in crtc_enable()
1608 crtc->base.id, crtc->name); in crtc_enable()
1610 funcs->atomic_enable(crtc, state); in crtc_enable()
1612 funcs->commit(crtc); in crtc_enable()
1632 if (!new_conn_state->crtc->state->active || in encoder_bridge_enable()
1633 !drm_atomic_crtc_needs_modeset(new_conn_state->crtc->state)) in encoder_bridge_enable()
1695 struct drm_crtc *crtc; in set_fence_deadline() local
1702 for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { in set_fence_deadline()
1711 if (drm_crtc_next_vblank_start(crtc, &v)) in set_fence_deadline()
1802 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_vblanks() local
1814 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_wait_for_vblanks()
1818 ret = drm_crtc_vblank_get(crtc); in drm_atomic_helper_wait_for_vblanks()
1822 crtc_mask |= drm_crtc_mask(crtc); in drm_atomic_helper_wait_for_vblanks()
1823 state->crtcs[i].last_vblank_count = drm_crtc_vblank_count(crtc); in drm_atomic_helper_wait_for_vblanks()
1826 for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { in drm_atomic_helper_wait_for_vblanks()
1827 if (!(crtc_mask & drm_crtc_mask(crtc))) in drm_atomic_helper_wait_for_vblanks()
1832 drm_crtc_vblank_count(crtc), in drm_atomic_helper_wait_for_vblanks()
1836 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_vblanks()
1838 drm_crtc_vblank_put(crtc); in drm_atomic_helper_wait_for_vblanks()
1861 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_flip_done() local
1868 crtc = state->crtcs[i].ptr; in drm_atomic_helper_wait_for_flip_done()
1870 if (!crtc || !commit) in drm_atomic_helper_wait_for_flip_done()
1876 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_flip_done()
1953 struct drm_crtc *crtc; in commit_tail() local
1981 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) in commit_tail()
2025 struct drm_crtc *crtc; in drm_atomic_helper_async_check() local
2033 for_each_new_crtc_in_state(state, crtc, crtc_state, i) { in drm_atomic_helper_async_check()
2048 if (!new_plane_state->crtc || in drm_atomic_helper_async_check()
2049 old_plane_state->crtc != new_plane_state->crtc) { in drm_atomic_helper_async_check()
2289 static int stall_checks(struct drm_crtc *crtc, bool nonblock) in stall_checks() argument
2296 spin_lock(&crtc->commit_lock); in stall_checks()
2298 list_for_each_entry(commit, &crtc->commit_list, commit_entry) { in stall_checks()
2306 spin_unlock(&crtc->commit_lock); in stall_checks()
2307 drm_dbg_atomic(crtc->dev, in stall_checks()
2309 crtc->base.id, crtc->name); in stall_checks()
2320 spin_unlock(&crtc->commit_lock); in stall_checks()
2331 drm_err(crtc->dev, "[CRTC:%d:%s] cleanup_done timed out\n", in stall_checks()
2332 crtc->base.id, crtc->name); in stall_checks()
2348 static void init_commit(struct drm_crtc_commit *commit, struct drm_crtc *crtc) in init_commit() argument
2355 commit->crtc = crtc; in init_commit()
2359 crtc_or_fake_commit(struct drm_atomic_state *state, struct drm_crtc *crtc) in crtc_or_fake_commit() argument
2361 if (crtc) { in crtc_or_fake_commit()
2364 new_crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in crtc_or_fake_commit()
2428 struct drm_crtc *crtc; in drm_atomic_helper_setup_commit() local
2440 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_setup_commit()
2445 init_commit(commit, crtc); in drm_atomic_helper_setup_commit()
2449 ret = stall_checks(crtc, nonblock); in drm_atomic_helper_setup_commit()
2503 commit = crtc_or_fake_commit(state, new_conn_state->crtc ?: old_conn_state->crtc); in drm_atomic_helper_setup_commit()
2525 commit = crtc_or_fake_commit(state, new_plane_state->crtc ?: old_plane_state->crtc); in drm_atomic_helper_setup_commit()
2553 struct drm_crtc *crtc; in drm_atomic_helper_wait_for_dependencies() local
2562 for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { in drm_atomic_helper_wait_for_dependencies()
2565 drm_err(crtc->dev, in drm_atomic_helper_wait_for_dependencies()
2567 crtc->base.id, crtc->name); in drm_atomic_helper_wait_for_dependencies()
2609 struct drm_crtc *crtc; in drm_atomic_helper_fake_vblank() local
2612 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { in drm_atomic_helper_fake_vblank()
2620 drm_crtc_send_vblank_event(crtc, in drm_atomic_helper_fake_vblank()
2646 struct drm_crtc *crtc; in drm_atomic_helper_commit_hw_done() local
2651 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_hw_done()
2691 struct drm_crtc *crtc; in drm_atomic_helper_commit_cleanup_done() local
2696 for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { in drm_atomic_helper_commit_cleanup_done()
2704 spin_lock(&crtc->commit_lock); in drm_atomic_helper_commit_cleanup_done()
2706 spin_unlock(&crtc->commit_lock); in drm_atomic_helper_commit_cleanup_done()
2843 return state->crtc && state->crtc->state->active; in plane_crtc_active()
2891 struct drm_crtc *crtc; in drm_atomic_helper_commit_planes() local
2899 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_planes()
2902 funcs = crtc->helper_private; in drm_atomic_helper_commit_planes()
2910 funcs->atomic_begin(crtc, state); in drm_atomic_helper_commit_planes()
2945 crtc_state = old_plane_state->crtc->state; in drm_atomic_helper_commit_planes()
2952 } else if (new_plane_state->crtc || disabling) { in drm_atomic_helper_commit_planes()
2962 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_commit_planes()
2965 funcs = crtc->helper_private; in drm_atomic_helper_commit_planes()
2973 funcs->atomic_flush(crtc, state); in drm_atomic_helper_commit_planes()
3010 struct drm_crtc *crtc = old_crtc_state->crtc; in drm_atomic_helper_commit_planes_on_crtc() local
3013 drm_atomic_get_new_crtc_state(old_state, crtc); in drm_atomic_helper_commit_planes_on_crtc()
3020 crtc_funcs = crtc->helper_private; in drm_atomic_helper_commit_planes_on_crtc()
3022 crtc_funcs->atomic_begin(crtc, old_state); in drm_atomic_helper_commit_planes_on_crtc()
3024 drm_for_each_plane_mask(plane, crtc->dev, plane_mask) { in drm_atomic_helper_commit_planes_on_crtc()
3037 WARN_ON(new_plane_state->crtc && in drm_atomic_helper_commit_planes_on_crtc()
3038 new_plane_state->crtc != crtc); in drm_atomic_helper_commit_planes_on_crtc()
3044 } else if (new_plane_state->crtc || disabling) { in drm_atomic_helper_commit_planes_on_crtc()
3055 crtc_funcs->atomic_flush(crtc, old_state); in drm_atomic_helper_commit_planes_on_crtc()
3079 struct drm_crtc *crtc = old_crtc_state->crtc; in drm_atomic_helper_disable_planes_on_crtc() local
3081 crtc->helper_private; in drm_atomic_helper_disable_planes_on_crtc()
3085 crtc_funcs->atomic_begin(crtc, NULL); in drm_atomic_helper_disable_planes_on_crtc()
3100 crtc_funcs->atomic_flush(crtc, NULL); in drm_atomic_helper_disable_planes_on_crtc()
3174 struct drm_crtc *crtc; in drm_atomic_helper_swap_state() local
3192 for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) { in drm_atomic_helper_swap_state()
3236 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { in drm_atomic_helper_swap_state()
3237 WARN_ON(crtc->state != old_crtc_state); in drm_atomic_helper_swap_state()
3243 crtc->state = new_crtc_state; in drm_atomic_helper_swap_state()
3246 spin_lock(&crtc->commit_lock); in drm_atomic_helper_swap_state()
3248 &crtc->commit_list); in drm_atomic_helper_swap_state()
3249 spin_unlock(&crtc->commit_lock); in drm_atomic_helper_swap_state()
3302 struct drm_crtc *crtc, in drm_atomic_helper_update_plane() argument
3325 ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); in drm_atomic_helper_update_plane()
3338 if (plane == crtc->cursor) in drm_atomic_helper_update_plane()
3376 if (plane_state->crtc && plane_state->crtc->cursor == plane) in drm_atomic_helper_disable_plane()
3410 struct drm_crtc *crtc = set->crtc; in drm_atomic_helper_set_config() local
3413 state = drm_atomic_state_alloc(crtc->dev); in drm_atomic_helper_set_config()
3466 struct drm_crtc *crtc; in drm_atomic_helper_disable_all() local
3475 drm_for_each_crtc(crtc, dev) { in drm_atomic_helper_disable_all()
3476 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_helper_disable_all()
3488 ret = drm_atomic_add_affected_planes(state, crtc); in drm_atomic_helper_disable_all()
3492 ret = drm_atomic_add_affected_connectors(state, crtc); in drm_atomic_helper_disable_all()
3537 int drm_atomic_helper_reset_crtc(struct drm_crtc *crtc, in drm_atomic_helper_reset_crtc() argument
3544 state = drm_atomic_state_alloc(crtc->dev); in drm_atomic_helper_reset_crtc()
3550 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_helper_reset_crtc()
3629 struct drm_crtc *crtc; in drm_atomic_helper_duplicate_state() local
3639 drm_for_each_crtc(crtc, dev) { in drm_atomic_helper_duplicate_state()
3642 crtc_state = drm_atomic_get_crtc_state(state, crtc); in drm_atomic_helper_duplicate_state()
3764 struct drm_crtc *crtc; in drm_atomic_helper_commit_duplicated_state() local
3772 for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) in drm_atomic_helper_commit_duplicated_state()
3773 state->crtcs[i].old_state = crtc->state; in drm_atomic_helper_commit_duplicated_state()
3822 struct drm_crtc *crtc, in page_flip_common() argument
3827 struct drm_plane *plane = crtc->primary; in page_flip_common()
3832 crtc_state = drm_atomic_get_crtc_state(state, crtc); in page_flip_common()
3843 ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); in page_flip_common()
3851 drm_dbg_atomic(crtc->dev, in page_flip_common()
3853 crtc->base.id, crtc->name); in page_flip_common()
3877 int drm_atomic_helper_page_flip(struct drm_crtc *crtc, in drm_atomic_helper_page_flip() argument
3883 struct drm_plane *plane = crtc->primary; in drm_atomic_helper_page_flip()
3893 ret = page_flip_common(state, crtc, fb, event, flags); in drm_atomic_helper_page_flip()
3920 int drm_atomic_helper_page_flip_target(struct drm_crtc *crtc, in drm_atomic_helper_page_flip_target() argument
3927 struct drm_plane *plane = crtc->primary; in drm_atomic_helper_page_flip_target()
3938 ret = page_flip_common(state, crtc, fb, event, flags); in drm_atomic_helper_page_flip_target()
3942 crtc_state = drm_atomic_get_new_crtc_state(state, crtc); in drm_atomic_helper_page_flip_target()