Commit 97f6c917 authored by Bhawanpreet Lakha's avatar Bhawanpreet Lakha Committed by Alex Deucher

drm/amd/display: Add display only once.

[Why]
We call add display multiple times because DESIRED->ENABLED cannot
happen instantaneously. We can't compare the new_state/old_state to
avoid this because on unplug we set the state to DESIRED and on hotplug
the state will still be DESIRED.

[How]
Add a flag to dm_connector_state to keep track of when to enable or
disable HDCP
Signed-off-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: default avatarZhan Liu <zhan.liu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c28f91dc
...@@ -2401,6 +2401,7 @@ static void handle_hpd_irq(void *param) ...@@ -2401,6 +2401,7 @@ static void handle_hpd_irq(void *param)
enum dc_connection_type new_connection_type = dc_connection_none; enum dc_connection_type new_connection_type = dc_connection_none;
#ifdef CONFIG_DRM_AMD_DC_HDCP #ifdef CONFIG_DRM_AMD_DC_HDCP
struct amdgpu_device *adev = drm_to_adev(dev); struct amdgpu_device *adev = drm_to_adev(dev);
struct dm_connector_state *dm_con_state = to_dm_connector_state(connector->state);
#endif #endif
/* /*
...@@ -2410,8 +2411,10 @@ static void handle_hpd_irq(void *param) ...@@ -2410,8 +2411,10 @@ static void handle_hpd_irq(void *param)
mutex_lock(&aconnector->hpd_lock); mutex_lock(&aconnector->hpd_lock);
#ifdef CONFIG_DRM_AMD_DC_HDCP #ifdef CONFIG_DRM_AMD_DC_HDCP
if (adev->dm.hdcp_workqueue) if (adev->dm.hdcp_workqueue) {
hdcp_reset_display(adev->dm.hdcp_workqueue, aconnector->dc_link->link_index); hdcp_reset_display(adev->dm.hdcp_workqueue, aconnector->dc_link->link_index);
dm_con_state->update_hdcp = true;
}
#endif #endif
if (aconnector->fake_enable) if (aconnector->fake_enable)
aconnector->fake_enable = false; aconnector->fake_enable = false;
...@@ -7233,6 +7236,7 @@ static bool is_content_protection_different(struct drm_connector_state *state, ...@@ -7233,6 +7236,7 @@ static bool is_content_protection_different(struct drm_connector_state *state,
const struct drm_connector *connector, struct hdcp_workqueue *hdcp_w) const struct drm_connector *connector, struct hdcp_workqueue *hdcp_w)
{ {
struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
struct dm_connector_state *dm_con_state = to_dm_connector_state(connector->state);
if (old_state->hdcp_content_type != state->hdcp_content_type && if (old_state->hdcp_content_type != state->hdcp_content_type &&
state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
...@@ -7255,14 +7259,16 @@ static bool is_content_protection_different(struct drm_connector_state *state, ...@@ -7255,14 +7259,16 @@ static bool is_content_protection_different(struct drm_connector_state *state,
/* Check if something is connected/enabled, otherwise we start hdcp but nothing is connected/enabled /* Check if something is connected/enabled, otherwise we start hdcp but nothing is connected/enabled
* hot-plug, headless s3, dpms * hot-plug, headless s3, dpms
*/ */
if (state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED && connector->dpms == DRM_MODE_DPMS_ON && if (dm_con_state->update_hdcp && state->content_protection == DRM_MODE_CONTENT_PROTECTION_DESIRED &&
aconnector->dc_sink != NULL) connector->dpms == DRM_MODE_DPMS_ON && aconnector->dc_sink != NULL) {
dm_con_state->update_hdcp = false;
return true; return true;
}
if (old_state->content_protection == state->content_protection) if (old_state->content_protection == state->content_protection)
return false; return false;
if (state->content_protection == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) if (state->content_protection != DRM_MODE_CONTENT_PROTECTION_ENABLED)
return true; return true;
return false; return false;
...@@ -8189,6 +8195,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -8189,6 +8195,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
connector->state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED) { connector->state->content_protection == DRM_MODE_CONTENT_PROTECTION_ENABLED) {
hdcp_reset_display(adev->dm.hdcp_workqueue, aconnector->dc_link->link_index); hdcp_reset_display(adev->dm.hdcp_workqueue, aconnector->dc_link->link_index);
new_con_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED; new_con_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED;
dm_new_con_state->update_hdcp = true;
continue; continue;
} }
......
...@@ -483,6 +483,9 @@ struct dm_connector_state { ...@@ -483,6 +483,9 @@ struct dm_connector_state {
uint8_t underscan_hborder; uint8_t underscan_hborder;
bool underscan_enable; bool underscan_enable;
bool freesync_capable; bool freesync_capable;
#ifdef CONFIG_DRM_AMD_DC_HDCP
bool update_hdcp;
#endif
uint8_t abm_level; uint8_t abm_level;
int vcpi_slots; int vcpi_slots;
uint64_t pbn; uint64_t pbn;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment