Message ID | 20190418085805.5648-8-ramalingam.c@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | HDCP2.2 Phase II | expand |
On Thu, Apr 18, 2019 at 02:28:00PM +0530, Ramalingam C wrote: > Considering the significant size of hdcp related code in drm, all > hdcp related codes are moved into separate file called drm_hdcp.c. > > v2: > Rebased. > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > Suggested-by: Daniel Vetter <daniel@ffwll.ch> > --- > drivers/gpu/drm/drm_connector.c | 78 ------------------------------- > drivers/gpu/drm/drm_hdcp.c | 81 +++++++++++++++++++++++++++++++++ Need to make sure this is still included into Documenation/gpu/drm-kms-helpers.rst. But an earlier patch should take care of that, so Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > include/drm/drm_connector.h | 2 - > include/drm/drm_hdcp.h | 3 ++ > 4 files changed, 84 insertions(+), 80 deletions(-) > > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c > index 03907d13ef66..436cf8e764cc 100644 > --- a/drivers/gpu/drm/drm_connector.c > +++ b/drivers/gpu/drm/drm_connector.c > @@ -823,13 +823,6 @@ static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = { > DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, > drm_tv_subconnector_enum_list) > > -static struct drm_prop_enum_list drm_cp_enum_list[] = { > - { DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" }, > - { DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" }, > - { DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" }, > -}; > -DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list) > - > static const struct drm_prop_enum_list hdmi_colorspaces[] = { > /* For Default case, driver will set the colorspace */ > { DRM_MODE_COLORIMETRY_DEFAULT, "Default" }, > @@ -857,13 +850,6 @@ static const struct drm_prop_enum_list hdmi_colorspaces[] = { > { DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER, "DCI-P3_RGB_Theater" }, > }; > > -static struct drm_prop_enum_list drm_hdcp_content_type_enum_list[] = { > - { DRM_MODE_HDCP_CONTENT_TYPE0, "HDCP Type0" }, > - { DRM_MODE_HDCP_CONTENT_TYPE1, "HDCP Type1" }, > -}; > -DRM_ENUM_NAME_FN(drm_get_hdcp_content_type_name, > - drm_hdcp_content_type_enum_list) > - > /** > * DOC: standard connector properties > * > @@ -1539,70 +1525,6 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, > } > EXPORT_SYMBOL(drm_connector_attach_scaling_mode_property); > > -/** > - * drm_connector_attach_content_protection_property - attach content protection > - * property > - * > - * @connector: connector to attach CP property on. > - * @hdcp_content_type: is HDCP Content Type property needed for connector > - * > - * This is used to add support for content protection on select connectors. > - * Content Protection is intentionally vague to allow for different underlying > - * technologies, however it is most implemented by HDCP. > - * > - * When hdcp_content_type is true enum property called HDCP Content Type is > - * created (if it is not already) and attached to the connector. > - * > - * This property is used for sending the protected content's stream type > - * from userspace to kernel on selected connectors. Protected content provider > - * will decide their type of their content and declare the same to kernel. > - * > - * Content type will be used during the HDCP 2.2 authentication. > - * Content type will be set to &drm_connector_state.hdcp_content_type. > - * > - * The content protection will be set to &drm_connector_state.content_protection > - * > - * Returns: > - * Zero on success, negative errno on failure. > - */ > -int drm_connector_attach_content_protection_property( > - struct drm_connector *connector, bool hdcp_content_type) > -{ > - struct drm_device *dev = connector->dev; > - struct drm_property *prop = > - dev->mode_config.content_protection_property; > - > - if (!prop) > - prop = drm_property_create_enum(dev, 0, "Content Protection", > - drm_cp_enum_list, > - ARRAY_SIZE(drm_cp_enum_list)); > - if (!prop) > - return -ENOMEM; > - > - drm_object_attach_property(&connector->base, prop, > - DRM_MODE_CONTENT_PROTECTION_UNDESIRED); > - dev->mode_config.content_protection_property = prop; > - > - if (!hdcp_content_type) > - return 0; > - > - prop = dev->mode_config.hdcp_content_type_property; > - if (!prop) > - prop = drm_property_create_enum(dev, 0, "HDCP Content Type", > - drm_hdcp_content_type_enum_list, > - ARRAY_SIZE( > - drm_hdcp_content_type_enum_list)); > - if (!prop) > - return -ENOMEM; > - > - drm_object_attach_property(&connector->base, prop, > - DRM_MODE_HDCP_CONTENT_TYPE0); > - dev->mode_config.hdcp_content_type_property = prop; > - > - return 0; > -} > -EXPORT_SYMBOL(drm_connector_attach_content_protection_property); > - > /** > * drm_mode_create_aspect_ratio_property - create aspect ratio property > * @dev: DRM device > diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c > index 78b043c8195e..a0960507e4ff 100644 > --- a/drivers/gpu/drm/drm_hdcp.c > +++ b/drivers/gpu/drm/drm_hdcp.c > @@ -17,6 +17,9 @@ > #include <drm/drm_sysfs.h> > #include <drm/drm_print.h> > #include <drm/drm_device.h> > +#include <drm/drm_property.h> > +#include <drm/drm_mode_object.h> > +#include <drm/drm_connector.h> > > struct hdcp_srm { > u8 *srm_buf; > @@ -334,3 +337,81 @@ void drm_teardown_hdcp_srm(struct class *drm_class) > kfree(srm_data); > } > } > + > +static struct drm_prop_enum_list drm_cp_enum_list[] = { > + { DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" }, > + { DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" }, > + { DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" }, > +}; > +DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list) > + > +static struct drm_prop_enum_list drm_hdcp_content_type_enum_list[] = { > + { DRM_MODE_HDCP_CONTENT_TYPE0, "HDCP Type0" }, > + { DRM_MODE_HDCP_CONTENT_TYPE1, "HDCP Type1" }, > +}; > +DRM_ENUM_NAME_FN(drm_get_hdcp_content_type_name, > + drm_hdcp_content_type_enum_list) > + > +/** > + * drm_connector_attach_content_protection_property - attach content protection > + * property > + * > + * @connector: connector to attach CP property on. > + * @hdcp_content_type: is HDCP Content Type property needed for connector > + * > + * This is used to add support for content protection on select connectors. > + * Content Protection is intentionally vague to allow for different underlying > + * technologies, however it is most implemented by HDCP. > + * > + * When hdcp_content_type is true enum property called HDCP Content Type is > + * created (if it is not already) and attached to the connector. > + * > + * This property is used for sending the protected content's stream type > + * from userspace to kernel on selected connectors. Protected content provider > + * will decide their type of their content and declare the same to kernel. > + * > + * Content type will be used during the HDCP 2.2 authentication. > + * Content type will be set to &drm_connector_state.hdcp_content_type. > + * > + * The content protection will be set to &drm_connector_state.content_protection > + * > + * Returns: > + * Zero on success, negative errno on failure. > + */ > +int drm_connector_attach_content_protection_property( > + struct drm_connector *connector, bool hdcp_content_type) > +{ > + struct drm_device *dev = connector->dev; > + struct drm_property *prop = > + dev->mode_config.content_protection_property; > + > + if (!prop) > + prop = drm_property_create_enum(dev, 0, "Content Protection", > + drm_cp_enum_list, > + ARRAY_SIZE(drm_cp_enum_list)); > + if (!prop) > + return -ENOMEM; > + > + drm_object_attach_property(&connector->base, prop, > + DRM_MODE_CONTENT_PROTECTION_UNDESIRED); > + dev->mode_config.content_protection_property = prop; > + > + if (!hdcp_content_type) > + return 0; > + > + prop = dev->mode_config.hdcp_content_type_property; > + if (!prop) > + prop = drm_property_create_enum(dev, 0, "HDCP Content Type", > + drm_hdcp_content_type_enum_list, > + ARRAY_SIZE( > + drm_hdcp_content_type_enum_list)); > + if (!prop) > + return -ENOMEM; > + > + drm_object_attach_property(&connector->base, prop, > + DRM_MODE_HDCP_CONTENT_TYPE0); > + dev->mode_config.hdcp_content_type_property = prop; > + > + return 0; > +} > +EXPORT_SYMBOL(drm_connector_attach_content_protection_property); > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h > index 2d2c2d5e7681..9e2f1a9de2a0 100644 > --- a/include/drm/drm_connector.h > +++ b/include/drm/drm_connector.h > @@ -1346,8 +1346,6 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, > u32 scaling_mode_mask); > int drm_connector_attach_vrr_capable_property( > struct drm_connector *connector); > -int drm_connector_attach_content_protection_property( > - struct drm_connector *connector, bool hdcp_content_type); > int drm_mode_create_aspect_ratio_property(struct drm_device *dev); > int drm_mode_create_colorspace_property(struct drm_connector *connector); > int drm_mode_create_content_type_property(struct drm_device *dev); > diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h > index ff2bcfc1ecef..145c81ba1e09 100644 > --- a/include/drm/drm_hdcp.h > +++ b/include/drm/drm_hdcp.h > @@ -299,6 +299,9 @@ struct hdcp2_srm_header { > } __packed; > > struct drm_device; > +struct drm_connector; > > bool drm_hdcp_ksvs_revocated(struct drm_device *dev, u8 *ksvs, u32 ksv_count); > +int drm_connector_attach_content_protection_property( > + struct drm_connector *connector, bool hdcp_content_type); > #endif > -- > 2.19.1 >
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 03907d13ef66..436cf8e764cc 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -823,13 +823,6 @@ static const struct drm_prop_enum_list drm_tv_subconnector_enum_list[] = { DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, drm_tv_subconnector_enum_list) -static struct drm_prop_enum_list drm_cp_enum_list[] = { - { DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" }, - { DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" }, - { DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" }, -}; -DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list) - static const struct drm_prop_enum_list hdmi_colorspaces[] = { /* For Default case, driver will set the colorspace */ { DRM_MODE_COLORIMETRY_DEFAULT, "Default" }, @@ -857,13 +850,6 @@ static const struct drm_prop_enum_list hdmi_colorspaces[] = { { DRM_MODE_COLORIMETRY_DCI_P3_RGB_THEATER, "DCI-P3_RGB_Theater" }, }; -static struct drm_prop_enum_list drm_hdcp_content_type_enum_list[] = { - { DRM_MODE_HDCP_CONTENT_TYPE0, "HDCP Type0" }, - { DRM_MODE_HDCP_CONTENT_TYPE1, "HDCP Type1" }, -}; -DRM_ENUM_NAME_FN(drm_get_hdcp_content_type_name, - drm_hdcp_content_type_enum_list) - /** * DOC: standard connector properties * @@ -1539,70 +1525,6 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, } EXPORT_SYMBOL(drm_connector_attach_scaling_mode_property); -/** - * drm_connector_attach_content_protection_property - attach content protection - * property - * - * @connector: connector to attach CP property on. - * @hdcp_content_type: is HDCP Content Type property needed for connector - * - * This is used to add support for content protection on select connectors. - * Content Protection is intentionally vague to allow for different underlying - * technologies, however it is most implemented by HDCP. - * - * When hdcp_content_type is true enum property called HDCP Content Type is - * created (if it is not already) and attached to the connector. - * - * This property is used for sending the protected content's stream type - * from userspace to kernel on selected connectors. Protected content provider - * will decide their type of their content and declare the same to kernel. - * - * Content type will be used during the HDCP 2.2 authentication. - * Content type will be set to &drm_connector_state.hdcp_content_type. - * - * The content protection will be set to &drm_connector_state.content_protection - * - * Returns: - * Zero on success, negative errno on failure. - */ -int drm_connector_attach_content_protection_property( - struct drm_connector *connector, bool hdcp_content_type) -{ - struct drm_device *dev = connector->dev; - struct drm_property *prop = - dev->mode_config.content_protection_property; - - if (!prop) - prop = drm_property_create_enum(dev, 0, "Content Protection", - drm_cp_enum_list, - ARRAY_SIZE(drm_cp_enum_list)); - if (!prop) - return -ENOMEM; - - drm_object_attach_property(&connector->base, prop, - DRM_MODE_CONTENT_PROTECTION_UNDESIRED); - dev->mode_config.content_protection_property = prop; - - if (!hdcp_content_type) - return 0; - - prop = dev->mode_config.hdcp_content_type_property; - if (!prop) - prop = drm_property_create_enum(dev, 0, "HDCP Content Type", - drm_hdcp_content_type_enum_list, - ARRAY_SIZE( - drm_hdcp_content_type_enum_list)); - if (!prop) - return -ENOMEM; - - drm_object_attach_property(&connector->base, prop, - DRM_MODE_HDCP_CONTENT_TYPE0); - dev->mode_config.hdcp_content_type_property = prop; - - return 0; -} -EXPORT_SYMBOL(drm_connector_attach_content_protection_property); - /** * drm_mode_create_aspect_ratio_property - create aspect ratio property * @dev: DRM device diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c index 78b043c8195e..a0960507e4ff 100644 --- a/drivers/gpu/drm/drm_hdcp.c +++ b/drivers/gpu/drm/drm_hdcp.c @@ -17,6 +17,9 @@ #include <drm/drm_sysfs.h> #include <drm/drm_print.h> #include <drm/drm_device.h> +#include <drm/drm_property.h> +#include <drm/drm_mode_object.h> +#include <drm/drm_connector.h> struct hdcp_srm { u8 *srm_buf; @@ -334,3 +337,81 @@ void drm_teardown_hdcp_srm(struct class *drm_class) kfree(srm_data); } } + +static struct drm_prop_enum_list drm_cp_enum_list[] = { + { DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" }, + { DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" }, + { DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" }, +}; +DRM_ENUM_NAME_FN(drm_get_content_protection_name, drm_cp_enum_list) + +static struct drm_prop_enum_list drm_hdcp_content_type_enum_list[] = { + { DRM_MODE_HDCP_CONTENT_TYPE0, "HDCP Type0" }, + { DRM_MODE_HDCP_CONTENT_TYPE1, "HDCP Type1" }, +}; +DRM_ENUM_NAME_FN(drm_get_hdcp_content_type_name, + drm_hdcp_content_type_enum_list) + +/** + * drm_connector_attach_content_protection_property - attach content protection + * property + * + * @connector: connector to attach CP property on. + * @hdcp_content_type: is HDCP Content Type property needed for connector + * + * This is used to add support for content protection on select connectors. + * Content Protection is intentionally vague to allow for different underlying + * technologies, however it is most implemented by HDCP. + * + * When hdcp_content_type is true enum property called HDCP Content Type is + * created (if it is not already) and attached to the connector. + * + * This property is used for sending the protected content's stream type + * from userspace to kernel on selected connectors. Protected content provider + * will decide their type of their content and declare the same to kernel. + * + * Content type will be used during the HDCP 2.2 authentication. + * Content type will be set to &drm_connector_state.hdcp_content_type. + * + * The content protection will be set to &drm_connector_state.content_protection + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_connector_attach_content_protection_property( + struct drm_connector *connector, bool hdcp_content_type) +{ + struct drm_device *dev = connector->dev; + struct drm_property *prop = + dev->mode_config.content_protection_property; + + if (!prop) + prop = drm_property_create_enum(dev, 0, "Content Protection", + drm_cp_enum_list, + ARRAY_SIZE(drm_cp_enum_list)); + if (!prop) + return -ENOMEM; + + drm_object_attach_property(&connector->base, prop, + DRM_MODE_CONTENT_PROTECTION_UNDESIRED); + dev->mode_config.content_protection_property = prop; + + if (!hdcp_content_type) + return 0; + + prop = dev->mode_config.hdcp_content_type_property; + if (!prop) + prop = drm_property_create_enum(dev, 0, "HDCP Content Type", + drm_hdcp_content_type_enum_list, + ARRAY_SIZE( + drm_hdcp_content_type_enum_list)); + if (!prop) + return -ENOMEM; + + drm_object_attach_property(&connector->base, prop, + DRM_MODE_HDCP_CONTENT_TYPE0); + dev->mode_config.hdcp_content_type_property = prop; + + return 0; +} +EXPORT_SYMBOL(drm_connector_attach_content_protection_property); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 2d2c2d5e7681..9e2f1a9de2a0 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1346,8 +1346,6 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, u32 scaling_mode_mask); int drm_connector_attach_vrr_capable_property( struct drm_connector *connector); -int drm_connector_attach_content_protection_property( - struct drm_connector *connector, bool hdcp_content_type); int drm_mode_create_aspect_ratio_property(struct drm_device *dev); int drm_mode_create_colorspace_property(struct drm_connector *connector); int drm_mode_create_content_type_property(struct drm_device *dev); diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index ff2bcfc1ecef..145c81ba1e09 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h @@ -299,6 +299,9 @@ struct hdcp2_srm_header { } __packed; struct drm_device; +struct drm_connector; bool drm_hdcp_ksvs_revocated(struct drm_device *dev, u8 *ksvs, u32 ksv_count); +int drm_connector_attach_content_protection_property( + struct drm_connector *connector, bool hdcp_content_type); #endif
Considering the significant size of hdcp related code in drm, all hdcp related codes are moved into separate file called drm_hdcp.c. v2: Rebased. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> Suggested-by: Daniel Vetter <daniel@ffwll.ch> --- drivers/gpu/drm/drm_connector.c | 78 ------------------------------- drivers/gpu/drm/drm_hdcp.c | 81 +++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 2 - include/drm/drm_hdcp.h | 3 ++ 4 files changed, 84 insertions(+), 80 deletions(-)