drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8466:13: warning: stack frame size of 2112 bytes in function 'amdgpu_dm_atomic_commit_tail'

From: kernel test robot
Date: Wed May 05 2021 - 08:27:37 EST


Hi Nikola,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d665ea6ea86c785760ee4bad4543dab3267ad074
commit: a85ba00538cd4bb0655aaf57fe3ebf8cc21f4fea drm/amdgpu/display: re-enable freesync video patches
date: 6 weeks ago
config: powerpc-randconfig-r016-20210505 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a85ba00538cd4bb0655aaf57fe3ebf8cc21f4fea
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a85ba00538cd4bb0655aaf57fe3ebf8cc21f4fea
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8466:13: warning: stack frame size of 2112 bytes in function 'amdgpu_dm_atomic_commit_tail' [-Wframe-larger-than=]
static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
^
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8054:13: warning: stack frame size of 2352 bytes in function 'amdgpu_dm_commit_planes' [-Wframe-larger-than=]
static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
^
2 warnings generated.


vim +/amdgpu_dm_atomic_commit_tail +8466 drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c

e7b07ceef2a650 Harry Wentland 2017-08-10 8457
b8592b48450b99 Leo Li 2018-09-14 8458 /**
b8592b48450b99 Leo Li 2018-09-14 8459 * amdgpu_dm_atomic_commit_tail() - AMDgpu DM's commit tail implementation.
b8592b48450b99 Leo Li 2018-09-14 8460 * @state: The atomic state to commit
b8592b48450b99 Leo Li 2018-09-14 8461 *
b8592b48450b99 Leo Li 2018-09-14 8462 * This will tell DC to commit the constructed DC state from atomic_check,
b8592b48450b99 Leo Li 2018-09-14 8463 * programming the hardware. Any failures here implies a hardware failure, since
b8592b48450b99 Leo Li 2018-09-14 8464 * atomic check should have filtered anything non-kosher.
b8592b48450b99 Leo Li 2018-09-14 8465 */
7578ecda14d521 Alex Deucher 2017-10-10 @8466 static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
e7b07ceef2a650 Harry Wentland 2017-08-10 8467 {
e7b07ceef2a650 Harry Wentland 2017-08-10 8468 struct drm_device *dev = state->dev;
1348969ab68cb8 Luben Tuikov 2020-08-24 8469 struct amdgpu_device *adev = drm_to_adev(dev);
e7b07ceef2a650 Harry Wentland 2017-08-10 8470 struct amdgpu_display_manager *dm = &adev->dm;
e7b07ceef2a650 Harry Wentland 2017-08-10 8471 struct dm_atomic_state *dm_state;
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8472 struct dc_state *dc_state = NULL, *dc_state_temp = NULL;
e7b07ceef2a650 Harry Wentland 2017-08-10 8473 uint32_t i, j;
5cc6dcbd45a60b Leo (Sunpeng Li 2017-10-12 8474) struct drm_crtc *crtc;
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8475) struct drm_crtc_state *old_crtc_state, *new_crtc_state;
e7b07ceef2a650 Harry Wentland 2017-08-10 8476 unsigned long flags;
e7b07ceef2a650 Harry Wentland 2017-08-10 8477 bool wait_for_vblank = true;
e7b07ceef2a650 Harry Wentland 2017-08-10 8478 struct drm_connector *connector;
c2cea7063b85fc Leo (Sunpeng Li 2017-10-12 8479) struct drm_connector_state *old_con_state, *new_con_state;
54d76575246798 Leo (Sunpeng Li 2017-10-12 8480) struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
fe2a19652918a5 Lyude Paul 2018-06-21 8481 int crtc_disable_count = 0;
6ee90e88b97674 hersen wu 2020-07-08 8482 bool mode_set_reset_required = false;
e7b07ceef2a650 Harry Wentland 2017-08-10 8483
e8a982355f9669 Rodrigo Siqueira 2020-09-04 8484 trace_amdgpu_dm_atomic_commit_tail_begin(state);
e8a982355f9669 Rodrigo Siqueira 2020-09-04 8485
e7b07ceef2a650 Harry Wentland 2017-08-10 8486 drm_atomic_helper_update_legacy_modeset_state(dev, state);
e7b07ceef2a650 Harry Wentland 2017-08-10 8487
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8488 dm_state = dm_atomic_get_new_state(state);
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8489 if (dm_state && dm_state->context) {
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8490 dc_state = dm_state->context;
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8491 } else {
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8492 /* No state changes, retain current state. */
813d20dccf93f8 Aidan Wood 2019-02-22 8493 dc_state_temp = dc_create_state(dm->dc);
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8494 ASSERT(dc_state_temp);
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8495 dc_state = dc_state_temp;
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8496 dc_resource_state_copy_construct_current(dm->dc, dc_state);
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8497 }
e7b07ceef2a650 Harry Wentland 2017-08-10 8498
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8499 for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state,
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8500 new_crtc_state, i) {
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8501 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8502
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8503 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8504
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8505 if (old_crtc_state->active &&
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8506 (!new_crtc_state->active ||
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8507 drm_atomic_crtc_needs_modeset(new_crtc_state))) {
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8508 manage_dm_interrupts(adev, acrtc, false);
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8509 dc_stream_release(dm_old_crtc_state->stream);
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8510 }
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8511 }
6d90a208cfff94 Aurabindo Pillai 2020-09-11 8512
8976f73b676eb9 Rodrigo Siqueira 2020-11-17 8513 drm_atomic_helper_calc_timestamping_constants(state);
8976f73b676eb9 Rodrigo Siqueira 2020-11-17 8514
e7b07ceef2a650 Harry Wentland 2017-08-10 8515 /* update changed items */
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8516) for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
e7b07ceef2a650 Harry Wentland 2017-08-10 8517 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
b830ebc910f641 Harry Wentland 2017-07-26 8518
54d76575246798 Leo (Sunpeng Li 2017-10-12 8519) dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
54d76575246798 Leo (Sunpeng Li 2017-10-12 8520) dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
e7b07ceef2a650 Harry Wentland 2017-08-10 8521
f1ad2f5efd29dc Harry Wentland 2017-09-12 8522 DRM_DEBUG_DRIVER(
e7b07ceef2a650 Harry Wentland 2017-08-10 8523 "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, "
e7b07ceef2a650 Harry Wentland 2017-08-10 8524 "planes_changed:%d, mode_changed:%d,active_changed:%d,"
e7b07ceef2a650 Harry Wentland 2017-08-10 8525 "connectors_changed:%d\n",
e7b07ceef2a650 Harry Wentland 2017-08-10 8526 acrtc->crtc_id,
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8527) new_crtc_state->enable,
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8528) new_crtc_state->active,
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8529) new_crtc_state->planes_changed,
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8530) new_crtc_state->mode_changed,
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8531) new_crtc_state->active_changed,
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8532) new_crtc_state->connectors_changed);
e7b07ceef2a650 Harry Wentland 2017-08-10 8533
5c68c65295de0b Victor Lu 2020-10-23 8534 /* Disable cursor if disabling crtc */
5c68c65295de0b Victor Lu 2020-10-23 8535 if (old_crtc_state->active && !new_crtc_state->active) {
5c68c65295de0b Victor Lu 2020-10-23 8536 struct dc_cursor_position position;
5c68c65295de0b Victor Lu 2020-10-23 8537
5c68c65295de0b Victor Lu 2020-10-23 8538 memset(&position, 0, sizeof(position));
5c68c65295de0b Victor Lu 2020-10-23 8539 mutex_lock(&dm->dc_lock);
5c68c65295de0b Victor Lu 2020-10-23 8540 dc_stream_set_cursor_position(dm_old_crtc_state->stream, &position);
5c68c65295de0b Victor Lu 2020-10-23 8541 mutex_unlock(&dm->dc_lock);
5c68c65295de0b Victor Lu 2020-10-23 8542 }
5c68c65295de0b Victor Lu 2020-10-23 8543
27b3f4fc91e1df Leo (Sunpeng Li 2017-11-10 8544) /* Copy all transient state flags into dc state */
27b3f4fc91e1df Leo (Sunpeng Li 2017-11-10 8545) if (dm_new_crtc_state->stream) {
27b3f4fc91e1df Leo (Sunpeng Li 2017-11-10 8546) amdgpu_dm_crtc_copy_transient_flags(&dm_new_crtc_state->base,
27b3f4fc91e1df Leo (Sunpeng Li 2017-11-10 8547) dm_new_crtc_state->stream);
27b3f4fc91e1df Leo (Sunpeng Li 2017-11-10 8548) }
27b3f4fc91e1df Leo (Sunpeng Li 2017-11-10 8549)
e7b07ceef2a650 Harry Wentland 2017-08-10 8550 /* handles headless hotplug case, updating new_state and
e7b07ceef2a650 Harry Wentland 2017-08-10 8551 * aconnector as needed
e7b07ceef2a650 Harry Wentland 2017-08-10 8552 */
e7b07ceef2a650 Harry Wentland 2017-08-10 8553
54d76575246798 Leo (Sunpeng Li 2017-10-12 8554) if (modeset_required(new_crtc_state, dm_new_crtc_state->stream, dm_old_crtc_state->stream)) {
e7b07ceef2a650 Harry Wentland 2017-08-10 8555
f1ad2f5efd29dc Harry Wentland 2017-09-12 8556 DRM_DEBUG_DRIVER("Atomic commit: SET crtc id %d: [%p]\n", acrtc->crtc_id, acrtc);
e7b07ceef2a650 Harry Wentland 2017-08-10 8557
54d76575246798 Leo (Sunpeng Li 2017-10-12 8558) if (!dm_new_crtc_state->stream) {
e7b07ceef2a650 Harry Wentland 2017-08-10 8559 /*
e7b07ceef2a650 Harry Wentland 2017-08-10 8560 * this could happen because of issues with
e7b07ceef2a650 Harry Wentland 2017-08-10 8561 * userspace notifications delivery.
e7b07ceef2a650 Harry Wentland 2017-08-10 8562 * In this case userspace tries to set mode on
1f6010a96273c3 David Francis 2018-08-15 8563 * display which is disconnected in fact.
1f6010a96273c3 David Francis 2018-08-15 8564 * dc_sink is NULL in this case on aconnector.
e7b07ceef2a650 Harry Wentland 2017-08-10 8565 * We expect reset mode will come soon.
e7b07ceef2a650 Harry Wentland 2017-08-10 8566 *
e7b07ceef2a650 Harry Wentland 2017-08-10 8567 * This can also happen when unplug is done
e7b07ceef2a650 Harry Wentland 2017-08-10 8568 * during resume sequence ended
e7b07ceef2a650 Harry Wentland 2017-08-10 8569 *
e7b07ceef2a650 Harry Wentland 2017-08-10 8570 * In this case, we want to pretend we still
e7b07ceef2a650 Harry Wentland 2017-08-10 8571 * have a sink to keep the pipe running so that
e7b07ceef2a650 Harry Wentland 2017-08-10 8572 * hw state is consistent with the sw state
e7b07ceef2a650 Harry Wentland 2017-08-10 8573 */
f1ad2f5efd29dc Harry Wentland 2017-09-12 8574 DRM_DEBUG_DRIVER("%s: Failed to create new stream for crtc %d\n",
e7b07ceef2a650 Harry Wentland 2017-08-10 8575 __func__, acrtc->base.base.id);
e7b07ceef2a650 Harry Wentland 2017-08-10 8576 continue;
e7b07ceef2a650 Harry Wentland 2017-08-10 8577 }
e7b07ceef2a650 Harry Wentland 2017-08-10 8578
54d76575246798 Leo (Sunpeng Li 2017-10-12 8579) if (dm_old_crtc_state->stream)
54d76575246798 Leo (Sunpeng Li 2017-10-12 8580) remove_stream(adev, acrtc, dm_old_crtc_state->stream);
e7b07ceef2a650 Harry Wentland 2017-08-10 8581
97028037a38ae4 Lyude Paul 2018-06-04 8582 pm_runtime_get_noresume(dev->dev);
97028037a38ae4 Lyude Paul 2018-06-04 8583
e7b07ceef2a650 Harry Wentland 2017-08-10 8584 acrtc->enabled = true;
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8585) acrtc->hw_mode = new_crtc_state->mode;
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8586) crtc->hwmode = new_crtc_state->mode;
6ee90e88b97674 hersen wu 2020-07-08 8587 mode_set_reset_required = true;
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8588) } else if (modereset_required(new_crtc_state)) {
f1ad2f5efd29dc Harry Wentland 2017-09-12 8589 DRM_DEBUG_DRIVER("Atomic commit: RESET. crtc id %d:[%p]\n", acrtc->crtc_id, acrtc);
e7b07ceef2a650 Harry Wentland 2017-08-10 8590 /* i.e. reset mode */
6ee90e88b97674 hersen wu 2020-07-08 8591 if (dm_old_crtc_state->stream)
54d76575246798 Leo (Sunpeng Li 2017-10-12 8592) remove_stream(adev, acrtc, dm_old_crtc_state->stream);
a85ba00538cd4b Nikola Cornij 2021-03-15 8593
6ee90e88b97674 hersen wu 2020-07-08 8594 mode_set_reset_required = true;
8c322309e48e9f Roman Li 2019-09-20 8595 }
e7b07ceef2a650 Harry Wentland 2017-08-10 8596 } /* for_each_crtc_in_state() */
e7b07ceef2a650 Harry Wentland 2017-08-10 8597
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8598 if (dc_state) {
6ee90e88b97674 hersen wu 2020-07-08 8599 /* if there mode set or reset, disable eDP PSR */
6ee90e88b97674 hersen wu 2020-07-08 8600 if (mode_set_reset_required)
6ee90e88b97674 hersen wu 2020-07-08 8601 amdgpu_dm_psr_disable_all(dm);
6ee90e88b97674 hersen wu 2020-07-08 8602
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8603 dm_enable_per_frame_crtc_master_sync(dc_state);
674e78acae0dfb Nicholas Kazlauskas 2018-12-05 8604 mutex_lock(&dm->dc_lock);
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8605 WARN_ON(!dc_commit_state(dm->dc, dc_state));
674e78acae0dfb Nicholas Kazlauskas 2018-12-05 8606 mutex_unlock(&dm->dc_lock);
fa2123dbccdc88 Mikita Lipski 2017-10-17 8607 }
e7b07ceef2a650 Harry Wentland 2017-08-10 8608
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8609) for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
e7b07ceef2a650 Harry Wentland 2017-08-10 8610 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
b830ebc910f641 Harry Wentland 2017-07-26 8611
54d76575246798 Leo (Sunpeng Li 2017-10-12 8612) dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
e7b07ceef2a650 Harry Wentland 2017-08-10 8613
54d76575246798 Leo (Sunpeng Li 2017-10-12 8614) if (dm_new_crtc_state->stream != NULL) {
e7b07ceef2a650 Harry Wentland 2017-08-10 8615 const struct dc_stream_status *status =
54d76575246798 Leo (Sunpeng Li 2017-10-12 8616) dc_stream_get_status(dm_new_crtc_state->stream);
e7b07ceef2a650 Harry Wentland 2017-08-10 8617
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8618 if (!status)
09f609c34fc8b9 Leo Li 2018-11-27 8619 status = dc_stream_get_status_from_state(dc_state,
eb3dc8978596a0 Nicholas Kazlauskas 2018-11-22 8620 dm_new_crtc_state->stream);
e7b07ceef2a650 Harry Wentland 2017-08-10 8621 if (!status)
54d76575246798 Leo (Sunpeng Li 2017-10-12 8622) DC_ERR("got no status for stream %p on acrtc%p\n", dm_new_crtc_state->stream, acrtc);
e7b07ceef2a650 Harry Wentland 2017-08-10 8623 else
e7b07ceef2a650 Harry Wentland 2017-08-10 8624 acrtc->otg_inst = status->primary_otg_inst;
e7b07ceef2a650 Harry Wentland 2017-08-10 8625 }
e7b07ceef2a650 Harry Wentland 2017-08-10 8626 }
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8627 #ifdef CONFIG_DRM_AMD_DC_HDCP
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8628 for_each_oldnew_connector_in_state(state, connector, old_con_state, new_con_state, i) {
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8629 struct dm_connector_state *dm_new_con_state = to_dm_connector_state(new_con_state);
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8630 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8631 struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8632
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8633 new_crtc_state = NULL;
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8634
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8635 if (acrtc)
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8636 new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base);
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8637
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8638 dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8639
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8640 if (dm_new_crtc_state && dm_new_crtc_state->stream == NULL &&
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8641 connector->state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8642 hdcp_reset_display(adev->dm.hdcp_workqueue, aconnector->dc_link->link_index);
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8643 new_con_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
97f6c91787d9fc Bhawanpreet Lakha 2019-09-26 8644 dm_new_con_state->update_hdcp = true;
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8645 continue;
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8646 }
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8647
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8648 if (is_content_protection_different(new_con_state, old_con_state, connector, adev->dm.hdcp_workqueue))
b1abe5586ffcb1 Bhawanpreet Lakha 2019-08-28 8649 hdcp_update_display(
b1abe5586ffcb1 Bhawanpreet Lakha 2019-08-28 8650 adev->dm.hdcp_workqueue, aconnector->dc_link->link_index, aconnector,
23eb41917fc9f2 Bhawanpreet Lakha 2019-08-29 8651 new_con_state->hdcp_content_type,
0e86d3d4fc5233 Yang Li 2021-02-18 8652 new_con_state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED);
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8653 }
0c8620d63d41fb Bhawanpreet Lakha 2019-09-16 8654 #endif
e7b07ceef2a650 Harry Wentland 2017-08-10 8655
02d6a6fcdf68c4 David Francis 2018-12-18 8656 /* Handle connector state changes */
c2cea7063b85fc Leo (Sunpeng Li 2017-10-12 8657) for_each_oldnew_connector_in_state(state, connector, old_con_state, new_con_state, i) {
54d76575246798 Leo (Sunpeng Li 2017-10-12 8658) struct dm_connector_state *dm_new_con_state = to_dm_connector_state(new_con_state);
54d76575246798 Leo (Sunpeng Li 2017-10-12 8659) struct dm_connector_state *dm_old_con_state = to_dm_connector_state(old_con_state);
54d76575246798 Leo (Sunpeng Li 2017-10-12 8660) struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
263a4febd1cce6 Anson Jacob 2021-02-18 8661 struct dc_surface_update dummy_updates[MAX_SURFACES];
19afd79951e630 Nathan Chancellor 2019-02-01 8662 struct dc_stream_update stream_update;
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8663 struct dc_info_packet hdr_packet;
e7b07ceef2a650 Harry Wentland 2017-08-10 8664 struct dc_stream_status *status = NULL;
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8665 bool abm_changed, hdr_changed, scaling_changed;
e7b07ceef2a650 Harry Wentland 2017-08-10 8666
263a4febd1cce6 Anson Jacob 2021-02-18 8667 memset(&dummy_updates, 0, sizeof(dummy_updates));
19afd79951e630 Nathan Chancellor 2019-02-01 8668 memset(&stream_update, 0, sizeof(stream_update));
19afd79951e630 Nathan Chancellor 2019-02-01 8669
44d09c6a577c8e Harry Wentland 2018-03-15 8670 if (acrtc) {
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8671) new_crtc_state = drm_atomic_get_new_crtc_state(state, &acrtc->base);
44d09c6a577c8e Harry Wentland 2018-03-15 8672 old_crtc_state = drm_atomic_get_old_crtc_state(state, &acrtc->base);
44d09c6a577c8e Harry Wentland 2018-03-15 8673 }
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8674)
e7b07ceef2a650 Harry Wentland 2017-08-10 8675 /* Skip any modesets/resets */
0bc9706db3a35b Leo (Sunpeng Li 2017-10-12 8676) if (!acrtc || drm_atomic_crtc_needs_modeset(new_crtc_state))
e7b07ceef2a650 Harry Wentland 2017-08-10 8677 continue;
e7b07ceef2a650 Harry Wentland 2017-08-10 8678
54d76575246798 Leo (Sunpeng Li 2017-10-12 8679) dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
c1ee92f94ce3b9 David Francis 2018-11-26 8680 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
c1ee92f94ce3b9 David Francis 2018-11-26 8681
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8682 scaling_changed = is_scaling_state_different(dm_new_con_state,
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8683 dm_old_con_state);
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8684
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8685 abm_changed = dm_new_crtc_state->abm_level !=
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8686 dm_old_crtc_state->abm_level;
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8687
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8688 hdr_changed =
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8689 is_hdr_metadata_different(old_con_state, new_con_state);
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8690
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8691 if (!scaling_changed && !abm_changed && !hdr_changed)
c1ee92f94ce3b9 David Francis 2018-11-26 8692 continue;
e7b07ceef2a650 Harry Wentland 2017-08-10 8693
b6e881c947417e Dmytro Laktyushkin 2019-09-13 8694 stream_update.stream = dm_new_crtc_state->stream;
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8695 if (scaling_changed) {
54d76575246798 Leo (Sunpeng Li 2017-10-12 8696) update_stream_scaling_settings(&dm_new_con_state->base.crtc->mode,
b6e881c947417e Dmytro Laktyushkin 2019-09-13 8697 dm_new_con_state, dm_new_crtc_state->stream);
e7b07ceef2a650 Harry Wentland 2017-08-10 8698
02d6a6fcdf68c4 David Francis 2018-12-18 8699 stream_update.src = dm_new_crtc_state->stream->src;
02d6a6fcdf68c4 David Francis 2018-12-18 8700 stream_update.dst = dm_new_crtc_state->stream->dst;
02d6a6fcdf68c4 David Francis 2018-12-18 8701 }
02d6a6fcdf68c4 David Francis 2018-12-18 8702
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8703 if (abm_changed) {
02d6a6fcdf68c4 David Francis 2018-12-18 8704 dm_new_crtc_state->stream->abm_level = dm_new_crtc_state->abm_level;
02d6a6fcdf68c4 David Francis 2018-12-18 8705
02d6a6fcdf68c4 David Francis 2018-12-18 8706 stream_update.abm_level = &dm_new_crtc_state->abm_level;
02d6a6fcdf68c4 David Francis 2018-12-18 8707 }
70e8ffc55b98f3 Harry Wentland 2017-11-10 8708
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8709 if (hdr_changed) {
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8710 fill_hdr_info_packet(new_con_state, &hdr_packet);
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8711 stream_update.hdr_static_metadata = &hdr_packet;
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8712 }
b232d4ed92eafb Nicholas Kazlauskas 2019-05-28 8713
54d76575246798 Leo (Sunpeng Li 2017-10-12 8714) status = dc_stream_get_status(dm_new_crtc_state->stream);
e7b07ceef2a650 Harry Wentland 2017-08-10 8715 WARN_ON(!status);
3be5262e353b8a Harry Wentland 2017-07-27 8716 WARN_ON(!status->plane_count);
e7b07ceef2a650 Harry Wentland 2017-08-10 8717
02d6a6fcdf68c4 David Francis 2018-12-18 8718 /*
02d6a6fcdf68c4 David Francis 2018-12-18 8719 * TODO: DC refuses to perform stream updates without a dc_surface_update.
02d6a6fcdf68c4 David Francis 2018-12-18 8720 * Here we create an empty update on each plane.
02d6a6fcdf68c4 David Francis 2018-12-18 8721 * To fix this, DC should permit updating only stream properties.
02d6a6fcdf68c4 David Francis 2018-12-18 8722 */
02d6a6fcdf68c4 David Francis 2018-12-18 8723 for (j = 0; j < status->plane_count; j++)
263a4febd1cce6 Anson Jacob 2021-02-18 8724 dummy_updates[j].surface = status->plane_states[0];
98e6436d3af5fe Anthony Koo 2018-08-21 8725
02d6a6fcdf68c4 David Francis 2018-12-18 8726
02d6a6fcdf68c4 David Francis 2018-12-18 8727 mutex_lock(&dm->dc_lock);
02d6a6fcdf68c4 David Francis 2018-12-18 8728 dc_commit_updates_for_stream(dm->dc,
263a4febd1cce6 Anson Jacob 2021-02-18 8729 dummy_updates,
3be5262e353b8a Harry Wentland 2017-07-27 8730 status->plane_count,
02d6a6fcdf68c4 David Francis 2018-12-18 8731 dm_new_crtc_state->stream,
263a4febd1cce6 Anson Jacob 2021-02-18 8732 &stream_update,
263a4febd1cce6 Anson Jacob 2021-02-18 8733 dc_state);
02d6a6fcdf68c4 David Francis 2018-12-18 8734 mutex_unlock(&dm->dc_lock);
e7b07ceef2a650 Harry Wentland 2017-08-10 8735 }
e7b07ceef2a650 Harry Wentland 2017-08-10 8736
b5e83f6fe1f003 Nicholas Kazlauskas 2019-04-08 8737 /* Count number of newly disabled CRTCs for dropping PM refs later. */
e1fc2dca1295c4 Leo (Sunpeng Li 2017-10-18 8738) for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,
e1fc2dca1295c4 Leo (Sunpeng Li 2017-10-18 8739) new_crtc_state, i) {
fe2a19652918a5 Lyude Paul 2018-06-21 8740 if (old_crtc_state->active && !new_crtc_state->active)
fe2a19652918a5 Lyude Paul 2018-06-21 8741 crtc_disable_count++;
fe2a19652918a5 Lyude Paul 2018-06-21 8742
54d76575246798 Leo (Sunpeng Li 2017-10-12 8743) dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
e1fc2dca1295c4 Leo (Sunpeng Li 2017-10-18 8744) dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
66b0c973d7f74e Mario Kleiner 2019-03-29 8745
585d450c76d1d5 Aurabindo Pillai 2020-08-12 8746 /* For freesync config update on crtc state and params for irq */
585d450c76d1d5 Aurabindo Pillai 2020-08-12 8747 update_stream_irq_parameters(dm, dm_new_crtc_state);
057be086603feb Nicholas Kazlauskas 2019-04-15 8748
66b0c973d7f74e Mario Kleiner 2019-03-29 8749 /* Handle vrr on->off / off->on transitions */
66b0c973d7f74e Mario Kleiner 2019-03-29 8750 amdgpu_dm_handle_vrr_transition(dm_old_crtc_state,
66b0c973d7f74e Mario Kleiner 2019-03-29 8751 dm_new_crtc_state);
e7b07ceef2a650 Harry Wentland 2017-08-10 8752 }
e7b07ceef2a650 Harry Wentland 2017-08-10 8753
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8754 /**
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8755 * Enable interrupts for CRTCs that are newly enabled or went through
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8756 * a modeset. It was intentionally deferred until after the front end
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8757 * state was modified to wait until the OTG was on and so the IRQ
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8758 * handlers didn't access stale or invalid state.
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8759 */
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8760 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8761 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
8e7b6fee9b03d6 Wayne Lin 2021-02-09 8762 #ifdef CONFIG_DEBUG_FS
86bc221918925a Wayne Lin 2021-03-02 8763 bool configure_crc = false;
8e7b6fee9b03d6 Wayne Lin 2021-02-09 8764 enum amdgpu_dm_pipe_crc_source cur_crc_src;
8e7b6fee9b03d6 Wayne Lin 2021-02-09 8765 #endif
585d450c76d1d5 Aurabindo Pillai 2020-08-12 8766 dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
585d450c76d1d5 Aurabindo Pillai 2020-08-12 8767
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8768 if (new_crtc_state->active &&
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8769 (!old_crtc_state->active ||
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8770 drm_atomic_crtc_needs_modeset(new_crtc_state))) {
585d450c76d1d5 Aurabindo Pillai 2020-08-12 8771 dc_stream_retain(dm_new_crtc_state->stream);
585d450c76d1d5 Aurabindo Pillai 2020-08-12 8772 acrtc->dm_irq_params.stream = dm_new_crtc_state->stream;
8fe684e97c86e3 Nicholas Kazlauskas 2020-07-13 8773 manage_dm_interrupts(adev, acrtc, true);
e2881d6d0a2653 Rodrigo Siqueira 2021-01-07 8774

:::::: The code at line 8466 was first introduced by commit
:::::: 7578ecda14d521f39e74166103270c62b15af96d drm/amd/display: make a bunch of stuff in amdgpu_dm.c static

:::::: TO: Alex Deucher <alexander.deucher@xxxxxxx>
:::::: CC: Dave Airlie <airlied@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip