Skip to content

Commit 3ce8209

Browse files
vsyrjalajlahtine-intel
authored andcommitted
drm/i915/hdcp: Nuke intel_hdcp_transcoder_config()
intel_hdcp_transcoder_config() is clobbering some globally visible state in .compute_config(). That is a big no no as .compute_config() is supposed to have no visible side effects when either the commit fails or it's just a TEST_ONLY commit. Inline this stuff into intel_hdcp_enable() so that the state only gets modified when we actually commit the state to the hardware. Cc: Ramalingam C <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Uma Shankar <[email protected]> Fixes: 39e2df0 ("drm/i915/hdcp: update current transcoder into intel_hdcp") Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Ramalingam C <[email protected]> (cherry picked from commit 67e1d5e) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent 0eb8e74 commit 3ce8209

File tree

5 files changed

+14
-28
lines changed

5 files changed

+14
-28
lines changed

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3986,6 +3986,7 @@ static void intel_enable_ddi(struct intel_encoder *encoder,
39863986
if (conn_state->content_protection ==
39873987
DRM_MODE_CONTENT_PROTECTION_DESIRED)
39883988
intel_hdcp_enable(to_intel_connector(conn_state->connector),
3989+
crtc_state->cpu_transcoder,
39893990
(u8)conn_state->hdcp_content_type);
39903991
}
39913992

@@ -4089,7 +4090,9 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
40894090
if (conn_state->content_protection ==
40904091
DRM_MODE_CONTENT_PROTECTION_DESIRED ||
40914092
content_protection_type_changed)
4092-
intel_hdcp_enable(connector, (u8)conn_state->hdcp_content_type);
4093+
intel_hdcp_enable(connector,
4094+
crtc_state->cpu_transcoder,
4095+
(u8)conn_state->hdcp_content_type);
40934096
}
40944097

40954098
static void

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,9 +2414,6 @@ intel_dp_compute_config(struct intel_encoder *encoder,
24142414

24152415
intel_psr_compute_config(intel_dp, pipe_config);
24162416

2417-
intel_hdcp_transcoder_config(intel_connector,
2418-
pipe_config->cpu_transcoder);
2419-
24202417
return 0;
24212418
}
24222419

drivers/gpu/drm/i915/display/intel_hdcp.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,23 +1821,6 @@ enum mei_fw_tc intel_get_mei_fw_tc(enum transcoder cpu_transcoder)
18211821
}
18221822
}
18231823

1824-
void intel_hdcp_transcoder_config(struct intel_connector *connector,
1825-
enum transcoder cpu_transcoder)
1826-
{
1827-
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
1828-
struct intel_hdcp *hdcp = &connector->hdcp;
1829-
1830-
if (!hdcp->shim)
1831-
return;
1832-
1833-
if (INTEL_GEN(dev_priv) >= 12) {
1834-
mutex_lock(&hdcp->mutex);
1835-
hdcp->cpu_transcoder = cpu_transcoder;
1836-
hdcp->port_data.fw_tc = intel_get_mei_fw_tc(cpu_transcoder);
1837-
mutex_unlock(&hdcp->mutex);
1838-
}
1839-
}
1840-
18411824
static inline int initialize_hdcp_port_data(struct intel_connector *connector,
18421825
const struct intel_hdcp_shim *shim)
18431826
{
@@ -1959,8 +1942,10 @@ int intel_hdcp_init(struct intel_connector *connector,
19591942
return 0;
19601943
}
19611944

1962-
int intel_hdcp_enable(struct intel_connector *connector, u8 content_type)
1945+
int intel_hdcp_enable(struct intel_connector *connector,
1946+
enum transcoder cpu_transcoder, u8 content_type)
19631947
{
1948+
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
19641949
struct intel_hdcp *hdcp = &connector->hdcp;
19651950
unsigned long check_link_interval = DRM_HDCP_CHECK_PERIOD_MS;
19661951
int ret = -EINVAL;
@@ -1972,6 +1957,11 @@ int intel_hdcp_enable(struct intel_connector *connector, u8 content_type)
19721957
WARN_ON(hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED);
19731958
hdcp->content_type = content_type;
19741959

1960+
if (INTEL_GEN(dev_priv) >= 12) {
1961+
hdcp->cpu_transcoder = cpu_transcoder;
1962+
hdcp->port_data.fw_tc = intel_get_mei_fw_tc(cpu_transcoder);
1963+
}
1964+
19751965
/*
19761966
* Considering that HDCP2.2 is more secure than HDCP1.4, If the setup
19771967
* is capable of HDCP2.2, it is preferred to use HDCP2.2.

drivers/gpu/drm/i915/display/intel_hdcp.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ enum transcoder;
2121
void intel_hdcp_atomic_check(struct drm_connector *connector,
2222
struct drm_connector_state *old_state,
2323
struct drm_connector_state *new_state);
24-
void intel_hdcp_transcoder_config(struct intel_connector *connector,
25-
enum transcoder cpu_transcoder);
2624
int intel_hdcp_init(struct intel_connector *connector,
2725
const struct intel_hdcp_shim *hdcp_shim);
28-
int intel_hdcp_enable(struct intel_connector *connector, u8 content_type);
26+
int intel_hdcp_enable(struct intel_connector *connector,
27+
enum transcoder cpu_transcoder, u8 content_type);
2928
int intel_hdcp_disable(struct intel_connector *connector);
3029
bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
3130
bool intel_hdcp_capable(struct intel_connector *connector);

drivers/gpu/drm/i915/display/intel_hdmi.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,9 +2489,6 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
24892489
return -EINVAL;
24902490
}
24912491

2492-
intel_hdcp_transcoder_config(intel_hdmi->attached_connector,
2493-
pipe_config->cpu_transcoder);
2494-
24952492
return 0;
24962493
}
24972494

0 commit comments

Comments
 (0)