mirror of
https://github.com/torvalds/linux.git
synced 2026-04-24 17:42:27 -04:00
Merge drm/drm-next into drm-misc-next
Kickstart 6.14 cycle. Signed-off-by: Maxime Ripard <mripard@kernel.org>
This commit is contained in:
@@ -1308,6 +1308,29 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev)
|
||||
DRM_INFO("DMUB hardware initialized: version=0x%08X\n",
|
||||
adev->dm.dmcub_fw_version);
|
||||
|
||||
/* Keeping sanity checks off if
|
||||
* DCN31 >= 4.0.59.0
|
||||
* DCN314 >= 8.0.16.0
|
||||
* Otherwise, turn on sanity checks
|
||||
*/
|
||||
switch (amdgpu_ip_version(adev, DCE_HWIP, 0)) {
|
||||
case IP_VERSION(3, 1, 2):
|
||||
case IP_VERSION(3, 1, 3):
|
||||
if (adev->dm.dmcub_fw_version &&
|
||||
adev->dm.dmcub_fw_version >= DMUB_FW_VERSION(4, 0, 0) &&
|
||||
adev->dm.dmcub_fw_version < DMUB_FW_VERSION(4, 0, 59))
|
||||
adev->dm.dc->debug.sanity_checks = true;
|
||||
break;
|
||||
case IP_VERSION(3, 1, 4):
|
||||
if (adev->dm.dmcub_fw_version &&
|
||||
adev->dm.dmcub_fw_version >= DMUB_FW_VERSION(4, 0, 0) &&
|
||||
adev->dm.dmcub_fw_version < DMUB_FW_VERSION(8, 0, 16))
|
||||
adev->dm.dc->debug.sanity_checks = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3171,8 +3194,7 @@ static int dm_resume(struct amdgpu_ip_block *ip_block)
|
||||
struct dm_atomic_state *dm_state = to_dm_atomic_state(dm->atomic_obj.state);
|
||||
enum dc_connection_type new_connection_type = dc_connection_none;
|
||||
struct dc_state *dc_state;
|
||||
int i, r, j, ret;
|
||||
bool need_hotplug = false;
|
||||
int i, r, j;
|
||||
struct dc_commit_streams_params commit_params = {};
|
||||
|
||||
if (dm->dc->caps.ips_support) {
|
||||
@@ -3361,23 +3383,16 @@ static int dm_resume(struct amdgpu_ip_block *ip_block)
|
||||
aconnector->mst_root)
|
||||
continue;
|
||||
|
||||
ret = drm_dp_mst_topology_mgr_resume(&aconnector->mst_mgr, true);
|
||||
|
||||
if (ret < 0) {
|
||||
dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx,
|
||||
aconnector->dc_link);
|
||||
need_hotplug = true;
|
||||
}
|
||||
drm_dp_mst_topology_queue_probe(&aconnector->mst_mgr);
|
||||
}
|
||||
drm_connector_list_iter_end(&iter);
|
||||
|
||||
if (need_hotplug)
|
||||
drm_kms_helper_hotplug_event(ddev);
|
||||
|
||||
amdgpu_dm_irq_resume_late(adev);
|
||||
|
||||
amdgpu_dm_smu_write_watermarks_table(adev);
|
||||
|
||||
drm_kms_helper_hotplug_event(ddev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4654,7 +4669,12 @@ static void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
|
||||
if (!rc)
|
||||
DRM_DEBUG("DM: Failed to update backlight via AUX on eDP[%d]\n", bl_idx);
|
||||
} else {
|
||||
rc = dc_link_set_backlight_level(link, brightness, 0);
|
||||
struct set_backlight_level_params backlight_level_params = { 0 };
|
||||
|
||||
backlight_level_params.backlight_pwm_u16_16 = brightness;
|
||||
backlight_level_params.transition_time_in_ms = 0;
|
||||
|
||||
rc = dc_link_set_backlight_level(link, &backlight_level_params);
|
||||
if (!rc)
|
||||
DRM_DEBUG("DM: Failed to update backlight on eDP[%d]\n", bl_idx);
|
||||
}
|
||||
@@ -6799,7 +6819,7 @@ create_stream_for_sink(struct drm_connector *connector,
|
||||
if (stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22)
|
||||
tf = TRANSFER_FUNC_GAMMA_22;
|
||||
mod_build_vsc_infopacket(stream, &stream->vsc_infopacket, stream->output_color_space, tf);
|
||||
aconnector->psr_skip_count = AMDGPU_DM_PSR_ENTRY_DELAY;
|
||||
aconnector->sr_skip_count = AMDGPU_DM_PSR_ENTRY_DELAY;
|
||||
|
||||
}
|
||||
finish:
|
||||
@@ -7332,10 +7352,15 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
|
||||
const struct drm_connector_state *drm_state = dm_state ? &dm_state->base : NULL;
|
||||
int requested_bpc = drm_state ? drm_state->max_requested_bpc : 8;
|
||||
enum dc_status dc_result = DC_OK;
|
||||
uint8_t bpc_limit = 6;
|
||||
|
||||
if (!dm_state)
|
||||
return NULL;
|
||||
|
||||
if (aconnector->dc_link->connector_signal == SIGNAL_TYPE_HDMI_TYPE_A ||
|
||||
aconnector->dc_link->dpcd_caps.dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER)
|
||||
bpc_limit = 8;
|
||||
|
||||
do {
|
||||
stream = create_stream_for_sink(connector, drm_mode,
|
||||
dm_state, old_stream,
|
||||
@@ -7356,11 +7381,12 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
|
||||
dc_result = dm_validate_stream_and_context(adev->dm.dc, stream);
|
||||
|
||||
if (dc_result != DC_OK) {
|
||||
DRM_DEBUG_KMS("Mode %dx%d (clk %d) failed DC validation with error %d (%s)\n",
|
||||
DRM_DEBUG_KMS("Mode %dx%d (clk %d) pixel_encoding:%s color_depth:%s failed validation -- %s\n",
|
||||
drm_mode->hdisplay,
|
||||
drm_mode->vdisplay,
|
||||
drm_mode->clock,
|
||||
dc_result,
|
||||
dc_pixel_encoding_to_str(stream->timing.pixel_encoding),
|
||||
dc_color_depth_to_str(stream->timing.display_color_depth),
|
||||
dc_status_to_str(dc_result));
|
||||
|
||||
dc_stream_release(stream);
|
||||
@@ -7368,10 +7394,13 @@ create_validate_stream_for_sink(struct amdgpu_dm_connector *aconnector,
|
||||
requested_bpc -= 2; /* lower bpc to retry validation */
|
||||
}
|
||||
|
||||
} while (stream == NULL && requested_bpc >= 6);
|
||||
} while (stream == NULL && requested_bpc >= bpc_limit);
|
||||
|
||||
if (dc_result == DC_FAIL_ENC_VALIDATE && !aconnector->force_yuv420_output) {
|
||||
DRM_DEBUG_KMS("Retry forcing YCbCr420 encoding\n");
|
||||
if ((dc_result == DC_FAIL_ENC_VALIDATE ||
|
||||
dc_result == DC_EXCEED_DONGLE_CAP) &&
|
||||
!aconnector->force_yuv420_output) {
|
||||
DRM_DEBUG_KMS("%s:%d Retry forcing yuv420 encoding\n",
|
||||
__func__, __LINE__);
|
||||
|
||||
aconnector->force_yuv420_output = true;
|
||||
stream = create_validate_stream_for_sink(aconnector, drm_mode,
|
||||
@@ -8894,6 +8923,56 @@ static void amdgpu_dm_update_cursor(struct drm_plane *plane,
|
||||
}
|
||||
}
|
||||
|
||||
static void amdgpu_dm_enable_self_refresh(struct amdgpu_crtc *acrtc_attach,
|
||||
const struct dm_crtc_state *acrtc_state,
|
||||
const u64 current_ts)
|
||||
{
|
||||
struct psr_settings *psr = &acrtc_state->stream->link->psr_settings;
|
||||
struct replay_settings *pr = &acrtc_state->stream->link->replay_settings;
|
||||
struct amdgpu_dm_connector *aconn =
|
||||
(struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context;
|
||||
|
||||
if (acrtc_state->update_type > UPDATE_TYPE_FAST) {
|
||||
if (pr->config.replay_supported && !pr->replay_feature_enabled)
|
||||
amdgpu_dm_link_setup_replay(acrtc_state->stream->link, aconn);
|
||||
else if (psr->psr_version != DC_PSR_VERSION_UNSUPPORTED &&
|
||||
!psr->psr_feature_enabled)
|
||||
if (!aconn->disallow_edp_enter_psr)
|
||||
amdgpu_dm_link_setup_psr(acrtc_state->stream);
|
||||
}
|
||||
|
||||
/* Decrement skip count when SR is enabled and we're doing fast updates. */
|
||||
if (acrtc_state->update_type == UPDATE_TYPE_FAST &&
|
||||
(psr->psr_feature_enabled || pr->config.replay_supported)) {
|
||||
if (aconn->sr_skip_count > 0)
|
||||
aconn->sr_skip_count--;
|
||||
|
||||
/* Allow SR when skip count is 0. */
|
||||
acrtc_attach->dm_irq_params.allow_sr_entry = !aconn->sr_skip_count;
|
||||
|
||||
/*
|
||||
* If sink supports PSR SU/Panel Replay, there is no need to rely on
|
||||
* a vblank event disable request to enable PSR/RP. PSR SU/RP
|
||||
* can be enabled immediately once OS demonstrates an
|
||||
* adequate number of fast atomic commits to notify KMD
|
||||
* of update events. See `vblank_control_worker()`.
|
||||
*/
|
||||
if (acrtc_attach->dm_irq_params.allow_sr_entry &&
|
||||
#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY
|
||||
!amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) &&
|
||||
#endif
|
||||
(current_ts - psr->psr_dirty_rects_change_timestamp_ns) > 500000000) {
|
||||
if (pr->replay_feature_enabled && !pr->replay_allow_active)
|
||||
amdgpu_dm_replay_enable(acrtc_state->stream, true);
|
||||
if (psr->psr_version >= DC_PSR_VERSION_SU_1 &&
|
||||
!psr->psr_allow_active && !aconn->disallow_edp_enter_psr)
|
||||
amdgpu_dm_psr_enable(acrtc_state->stream);
|
||||
}
|
||||
} else {
|
||||
acrtc_attach->dm_irq_params.allow_sr_entry = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
|
||||
struct drm_device *dev,
|
||||
struct amdgpu_display_manager *dm,
|
||||
@@ -9047,7 +9126,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
|
||||
* during the PSR-SU was disabled.
|
||||
*/
|
||||
if (acrtc_state->stream->link->psr_settings.psr_version >= DC_PSR_VERSION_SU_1 &&
|
||||
acrtc_attach->dm_irq_params.allow_psr_entry &&
|
||||
acrtc_attach->dm_irq_params.allow_sr_entry &&
|
||||
#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY
|
||||
!amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) &&
|
||||
#endif
|
||||
@@ -9222,9 +9301,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
|
||||
bundle->stream_update.abm_level = &acrtc_state->abm_level;
|
||||
|
||||
mutex_lock(&dm->dc_lock);
|
||||
if ((acrtc_state->update_type > UPDATE_TYPE_FAST) &&
|
||||
acrtc_state->stream->link->psr_settings.psr_allow_active)
|
||||
amdgpu_dm_psr_disable(acrtc_state->stream);
|
||||
if (acrtc_state->update_type > UPDATE_TYPE_FAST) {
|
||||
if (acrtc_state->stream->link->replay_settings.replay_allow_active)
|
||||
amdgpu_dm_replay_disable(acrtc_state->stream);
|
||||
if (acrtc_state->stream->link->psr_settings.psr_allow_active)
|
||||
amdgpu_dm_psr_disable(acrtc_state->stream);
|
||||
}
|
||||
mutex_unlock(&dm->dc_lock);
|
||||
|
||||
/*
|
||||
@@ -9265,57 +9347,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
|
||||
dm_update_pflip_irq_state(drm_to_adev(dev),
|
||||
acrtc_attach);
|
||||
|
||||
if (acrtc_state->update_type > UPDATE_TYPE_FAST) {
|
||||
if (acrtc_state->stream->link->replay_settings.config.replay_supported &&
|
||||
!acrtc_state->stream->link->replay_settings.replay_feature_enabled) {
|
||||
struct amdgpu_dm_connector *aconn =
|
||||
(struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context;
|
||||
amdgpu_dm_link_setup_replay(acrtc_state->stream->link, aconn);
|
||||
} else if (acrtc_state->stream->link->psr_settings.psr_version != DC_PSR_VERSION_UNSUPPORTED &&
|
||||
!acrtc_state->stream->link->psr_settings.psr_feature_enabled) {
|
||||
|
||||
struct amdgpu_dm_connector *aconn = (struct amdgpu_dm_connector *)
|
||||
acrtc_state->stream->dm_stream_context;
|
||||
|
||||
if (!aconn->disallow_edp_enter_psr)
|
||||
amdgpu_dm_link_setup_psr(acrtc_state->stream);
|
||||
}
|
||||
}
|
||||
|
||||
/* Decrement skip count when PSR is enabled and we're doing fast updates. */
|
||||
if (acrtc_state->update_type == UPDATE_TYPE_FAST &&
|
||||
acrtc_state->stream->link->psr_settings.psr_feature_enabled) {
|
||||
struct amdgpu_dm_connector *aconn =
|
||||
(struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context;
|
||||
|
||||
if (aconn->psr_skip_count > 0)
|
||||
aconn->psr_skip_count--;
|
||||
|
||||
/* Allow PSR when skip count is 0. */
|
||||
acrtc_attach->dm_irq_params.allow_psr_entry = !aconn->psr_skip_count;
|
||||
|
||||
/*
|
||||
* If sink supports PSR SU, there is no need to rely on
|
||||
* a vblank event disable request to enable PSR. PSR SU
|
||||
* can be enabled immediately once OS demonstrates an
|
||||
* adequate number of fast atomic commits to notify KMD
|
||||
* of update events. See `vblank_control_worker()`.
|
||||
*/
|
||||
if (acrtc_state->stream->link->psr_settings.psr_version >= DC_PSR_VERSION_SU_1 &&
|
||||
acrtc_attach->dm_irq_params.allow_psr_entry &&
|
||||
#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY
|
||||
!amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) &&
|
||||
#endif
|
||||
!acrtc_state->stream->link->psr_settings.psr_allow_active &&
|
||||
!aconn->disallow_edp_enter_psr &&
|
||||
(timestamp_ns -
|
||||
acrtc_state->stream->link->psr_settings.psr_dirty_rects_change_timestamp_ns) >
|
||||
500000000)
|
||||
amdgpu_dm_psr_enable(acrtc_state->stream);
|
||||
} else {
|
||||
acrtc_attach->dm_irq_params.allow_psr_entry = false;
|
||||
}
|
||||
|
||||
amdgpu_dm_enable_self_refresh(acrtc_attach, acrtc_state, timestamp_ns);
|
||||
mutex_unlock(&dm->dc_lock);
|
||||
}
|
||||
|
||||
@@ -9448,6 +9480,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
|
||||
bool mode_set_reset_required = false;
|
||||
u32 i;
|
||||
struct dc_commit_streams_params params = {dc_state->streams, dc_state->stream_count};
|
||||
bool set_backlight_level = false;
|
||||
|
||||
/* Disable writeback */
|
||||
for_each_old_connector_in_state(state, connector, old_con_state, i) {
|
||||
@@ -9567,6 +9600,7 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
|
||||
acrtc->hw_mode = new_crtc_state->mode;
|
||||
crtc->hwmode = new_crtc_state->mode;
|
||||
mode_set_reset_required = true;
|
||||
set_backlight_level = true;
|
||||
} else if (modereset_required(new_crtc_state)) {
|
||||
drm_dbg_atomic(dev,
|
||||
"Atomic commit: RESET. crtc id %d:[%p]\n",
|
||||
@@ -9618,6 +9652,19 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
|
||||
acrtc->otg_inst = status->primary_otg_inst;
|
||||
}
|
||||
}
|
||||
|
||||
/* During boot up and resume the DC layer will reset the panel brightness
|
||||
* to fix a flicker issue.
|
||||
* It will cause the dm->actual_brightness is not the current panel brightness
|
||||
* level. (the dm->brightness is the correct panel level)
|
||||
* So we set the backlight level with dm->brightness value after set mode
|
||||
*/
|
||||
if (set_backlight_level) {
|
||||
for (i = 0; i < dm->num_of_edps; i++) {
|
||||
if (dm->backlight_dev[i])
|
||||
amdgpu_dm_backlight_set_level(dm, i, dm->brightness[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void dm_set_writeback(struct amdgpu_display_manager *dm,
|
||||
@@ -12086,7 +12133,7 @@ static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector,
|
||||
break;
|
||||
}
|
||||
|
||||
while (j < EDID_LENGTH) {
|
||||
while (j < EDID_LENGTH - sizeof(struct amd_vsdb_block)) {
|
||||
struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)&edid_ext[j];
|
||||
unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user