Skip to content

Commit d456512

Browse files
committed
drm/i915: Attach content type property
Attaches the content type property for HDCP2.2 capable connectors. Implements the update of content type from property and apply the restriction on HDCP version selection. Need ACK for content type property from userspace consumer. v2: s/cp_content_type/content_protection_type [daniel] disable at hdcp_atomic_check to avoid check at atomic_set_property [Maarten] v3: s/content_protection_type/hdcp_content_type [Pekka] v4: hdcp disable incase of type change is moved into commit [daniel]. v5: Simplified the Type change procedure. [Daniel] v6: Type change with UNDESIRED state is ignored. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/320959/?series=57232&rev=14
1 parent 7672dbb commit d456512

3 files changed

Lines changed: 62 additions & 22 deletions

File tree

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

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3511,7 +3511,8 @@ static void intel_enable_ddi(struct intel_encoder *encoder,
35113511
/* Enable hdcp if it's desired */
35123512
if (conn_state->content_protection ==
35133513
DRM_MODE_CONTENT_PROTECTION_DESIRED)
3514-
intel_hdcp_enable(to_intel_connector(conn_state->connector));
3514+
intel_hdcp_enable(to_intel_connector(conn_state->connector),
3515+
(u8)conn_state->hdcp_content_type);
35153516
}
35163517

35173518
static void intel_disable_ddi_dp(struct intel_encoder *encoder,
@@ -3580,15 +3581,41 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
35803581
const struct intel_crtc_state *crtc_state,
35813582
const struct drm_connector_state *conn_state)
35823583
{
3584+
struct intel_connector *connector =
3585+
to_intel_connector(conn_state->connector);
3586+
struct intel_hdcp *hdcp = &connector->hdcp;
3587+
bool content_protection_type_changed =
3588+
(conn_state->hdcp_content_type != hdcp->content_type &&
3589+
conn_state->content_protection !=
3590+
DRM_MODE_CONTENT_PROTECTION_UNDESIRED);
3591+
35833592
if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
35843593
intel_ddi_update_pipe_dp(encoder, crtc_state, conn_state);
35853594

3595+
/*
3596+
* During the HDCP encryption session if Type change is requested,
3597+
* disable the HDCP and reenable it with new TYPE value.
3598+
*/
35863599
if (conn_state->content_protection ==
3587-
DRM_MODE_CONTENT_PROTECTION_DESIRED)
3588-
intel_hdcp_enable(to_intel_connector(conn_state->connector));
3589-
else if (conn_state->content_protection ==
3590-
DRM_MODE_CONTENT_PROTECTION_UNDESIRED)
3591-
intel_hdcp_disable(to_intel_connector(conn_state->connector));
3600+
DRM_MODE_CONTENT_PROTECTION_UNDESIRED ||
3601+
content_protection_type_changed)
3602+
intel_hdcp_disable(connector);
3603+
3604+
/*
3605+
* Mark the hdcp state as DESIRED after the hdcp disable of type
3606+
* change procedure.
3607+
*/
3608+
if (content_protection_type_changed) {
3609+
mutex_lock(&hdcp->mutex);
3610+
hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
3611+
schedule_work(&hdcp->prop_work);
3612+
mutex_unlock(&hdcp->mutex);
3613+
}
3614+
3615+
if (conn_state->content_protection ==
3616+
DRM_MODE_CONTENT_PROTECTION_DESIRED ||
3617+
content_protection_type_changed)
3618+
intel_hdcp_enable(connector, (u8)conn_state->hdcp_content_type);
35923619
}
35933620

35943621
static void intel_ddi_set_fia_lane_count(struct intel_encoder *encoder,

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

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,14 +1748,15 @@ static const struct component_ops i915_hdcp_component_ops = {
17481748
.unbind = i915_hdcp_component_unbind,
17491749
};
17501750

1751-
static inline int initialize_hdcp_port_data(struct intel_connector *connector)
1751+
static inline int initialize_hdcp_port_data(struct intel_connector *connector,
1752+
const struct intel_hdcp_shim *shim)
17521753
{
17531754
struct intel_hdcp *hdcp = &connector->hdcp;
17541755
struct hdcp_port_data *data = &hdcp->port_data;
17551756

17561757
data->port = connector->encoder->port;
17571758
data->port_type = (u8)HDCP_PORT_TYPE_INTEGRATED;
1758-
data->protocol = (u8)hdcp->shim->protocol;
1759+
data->protocol = (u8)shim->protocol;
17591760

17601761
data->k = 1;
17611762
if (!data->streams)
@@ -1805,12 +1806,13 @@ void intel_hdcp_component_init(struct drm_i915_private *dev_priv)
18051806
}
18061807
}
18071808

1808-
static void intel_hdcp2_init(struct intel_connector *connector)
1809+
static void intel_hdcp2_init(struct intel_connector *connector,
1810+
const struct intel_hdcp_shim *shim)
18091811
{
18101812
struct intel_hdcp *hdcp = &connector->hdcp;
18111813
int ret;
18121814

1813-
ret = initialize_hdcp_port_data(connector);
1815+
ret = initialize_hdcp_port_data(connector, shim);
18141816
if (ret) {
18151817
DRM_DEBUG_KMS("Mei hdcp data init failed\n");
18161818
return;
@@ -1829,25 +1831,28 @@ int intel_hdcp_init(struct intel_connector *connector,
18291831
if (!shim)
18301832
return -EINVAL;
18311833

1834+
if (is_hdcp2_supported(dev_priv))
1835+
intel_hdcp2_init(connector, shim);
1836+
18321837
ret =
18331838
drm_connector_attach_content_protection_property(&connector->base,
1834-
false);
1835-
if (ret)
1839+
hdcp->hdcp2_supported);
1840+
if (ret) {
1841+
hdcp->hdcp2_supported = false;
1842+
kfree(hdcp->port_data.streams);
18361843
return ret;
1844+
}
18371845

18381846
hdcp->shim = shim;
18391847
mutex_init(&hdcp->mutex);
18401848
INIT_DELAYED_WORK(&hdcp->check_work, intel_hdcp_check_work);
18411849
INIT_WORK(&hdcp->prop_work, intel_hdcp_prop_work);
1842-
1843-
if (is_hdcp2_supported(dev_priv))
1844-
intel_hdcp2_init(connector);
18451850
init_waitqueue_head(&hdcp->cp_irq_queue);
18461851

18471852
return 0;
18481853
}
18491854

1850-
int intel_hdcp_enable(struct intel_connector *connector)
1855+
int intel_hdcp_enable(struct intel_connector *connector, u8 content_type)
18511856
{
18521857
struct intel_hdcp *hdcp = &connector->hdcp;
18531858
unsigned long check_link_interval = DRM_HDCP_CHECK_PERIOD_MS;
@@ -1858,6 +1863,7 @@ int intel_hdcp_enable(struct intel_connector *connector)
18581863

18591864
mutex_lock(&hdcp->mutex);
18601865
WARN_ON(hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED);
1866+
hdcp->content_type = content_type;
18611867

18621868
/*
18631869
* Considering that HDCP2.2 is more secure than HDCP1.4, If the setup
@@ -1869,8 +1875,12 @@ int intel_hdcp_enable(struct intel_connector *connector)
18691875
check_link_interval = DRM_HDCP2_CHECK_PERIOD_MS;
18701876
}
18711877

1872-
/* When HDCP2.2 fails, HDCP1.4 will be attempted */
1873-
if (ret && intel_hdcp_capable(connector)) {
1878+
/*
1879+
* When HDCP2.2 fails and Content Type is not Type1, HDCP1.4 will
1880+
* be attempted.
1881+
*/
1882+
if (ret && intel_hdcp_capable(connector) &&
1883+
hdcp->content_type != DRM_MODE_HDCP_CONTENT_TYPE1) {
18741884
ret = _intel_hdcp_enable(connector);
18751885
}
18761886

@@ -1952,12 +1962,15 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
19521962

19531963
/*
19541964
* Nothing to do if the state didn't change, or HDCP was activated since
1955-
* the last commit
1965+
* the last commit. And also no change in hdcp content type.
19561966
*/
19571967
if (old_cp == new_cp ||
19581968
(old_cp == DRM_MODE_CONTENT_PROTECTION_DESIRED &&
1959-
new_cp == DRM_MODE_CONTENT_PROTECTION_ENABLED))
1960-
return;
1969+
new_cp == DRM_MODE_CONTENT_PROTECTION_ENABLED)) {
1970+
if (old_state->hdcp_content_type ==
1971+
new_state->hdcp_content_type)
1972+
return;
1973+
}
19611974

19621975
crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
19631976
new_state->crtc);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
2121
struct drm_connector_state *new_state);
2222
int intel_hdcp_init(struct intel_connector *connector,
2323
const struct intel_hdcp_shim *hdcp_shim);
24-
int intel_hdcp_enable(struct intel_connector *connector);
24+
int intel_hdcp_enable(struct intel_connector *connector, u8 content_type);
2525
int intel_hdcp_disable(struct intel_connector *connector);
2626
bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
2727
bool intel_hdcp_capable(struct intel_connector *connector);

0 commit comments

Comments
 (0)