From patchwork Wed Aug 2 15:53:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 9876941 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4AA33603B4 for ; Wed, 2 Aug 2017 15:53:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C2EF287D6 for ; Wed, 2 Aug 2017 15:53:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AD0F287FD; Wed, 2 Aug 2017 15:53:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C9B1B287E8 for ; Wed, 2 Aug 2017 15:53:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE3A76F1C3; Wed, 2 Aug 2017 15:53:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0408F6F1C3; Wed, 2 Aug 2017 15:53:46 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Aug 2017 08:53:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,312,1498546800"; d="scan'208";a="132591213" Received: from mint-dev.iind.intel.com ([10.223.25.164]) by orsmga005.jf.intel.com with ESMTP; 02 Aug 2017 08:53:44 -0700 From: Ramalingam C To: daniel.vetter@intel.com, seanpaul@chromium.org Subject: [RFC v4] drm/hdcp: drm enum property for CP State Date: Wed, 2 Aug 2017 21:23:05 +0530 Message-Id: <1501689185-24949-1-git-send-email-ramalingam.c@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1d07740e-418b-09a4-e018-6014c245e337@intel.com> References: <1d07740e-418b-09a4-e018-6014c245e337@intel.com> Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Default connector property called "Content Protection" is added to represent the content protection state of a connector and to configure the same. Userspace can request for enable or disable of content protection on a connector. Set "DESIRED" for Enable and "UNDESIRED" for disable. Content protection states defined: DRM_MODE_CONTENT_PROTECTION_UNSUPPORTED - Unsupported DRM_MODE_CONTENT_PROTECTION_UNDESIRED - Undesired DRM_MODE_CONTENT_PROTECTION_DESIRED - Desired DRM_MODE_CONTENT_PROTECTION_ENABLED - Enabled v2: Redesigned the property to match with CP needs of CrOS [Sean]. v3: Renamed the state names. Header is removed [Sean]. v4: Aligned with existing userspace(CrOS's usage) [Sean]. Signed-off-by: Ramalingam C --- drivers/gpu/drm/drm_connector.c | 24 ++++++++++++++++++++++++ include/drm/drm_mode_config.h | 5 +++++ include/uapi/drm/drm_mode.h | 7 +++++++ 3 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 8072e6e4c62c..f4ce0af63ad3 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -617,6 +617,14 @@ static const struct drm_prop_enum_list drm_link_status_enum_list[] = { }; DRM_ENUM_NAME_FN(drm_get_link_status_name, drm_link_status_enum_list) +static const struct drm_prop_enum_list drm_cp_enum_list[] = { + { DRM_MODE_CONTENT_PROTECTION_UNSUPPORTED, "Unsupported" }, + { DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" }, + { DRM_MODE_CONTENT_PROTECTION_DESIRED, "Desired" }, + { DRM_MODE_CONTENT_PROTECTION_ENABLED, "Enabled" }, +}; +DRM_ENUM_NAME_FN(drm_get_cp_status_name, drm_cp_enum_list) + /** * drm_display_info_set_bus_formats - set the supported bus formats * @info: display info to store bus formats in @@ -741,6 +749,15 @@ DRM_ENUM_NAME_FN(drm_get_tv_subconnector_name, * value of link-status is "GOOD". If something fails during or after modeset, * the kernel driver may set this to "BAD" and issue a hotplug uevent. Drivers * should update this value using drm_mode_connector_set_link_status_property(). + * Content Protection: + * Connector Content Protection property to indicate the content protection + * status of a connector. Default value is "UNDESIRED". Kernel will set + * to "UNSUPPORTED" if there is no common HDCP ver supported between Src + * and Sink. User space could set this to "DESIRED" to enabled the content + * protection on the connector. If content protection setup process is + * success, kernel will set this property to "ENABLED". To Disable the + * content protection on the connector userspace could set this property to + * "UNDESIRED". * * Connectors also have one standardized atomic property: * @@ -789,6 +806,13 @@ int drm_connector_create_standard_properties(struct drm_device *dev) return -ENOMEM; dev->mode_config.link_status_property = prop; + prop = drm_property_create_enum(dev, 0, "Content Protection", + drm_cp_enum_list, + ARRAY_SIZE(drm_cp_enum_list)); + if (!prop) + return -ENOMEM; + dev->mode_config.cp_property = prop; + return 0; } diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 42981711189b..72e2b4e6d51d 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -538,6 +538,11 @@ struct drm_mode_config { */ struct drm_property *link_status_property; /** + * @cp_property: Default connector property for content protection + * status of a connector + */ + struct drm_property *cp_property; + /** * @plane_type_property: Default plane property to differentiate * CURSOR, PRIMARY and OVERLAY legacy uses of planes. */ diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 403339f98a92..61685a64cd6a 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -173,6 +173,13 @@ extern "C" { DRM_MODE_REFLECT_X | \ DRM_MODE_REFLECT_Y) +/* Content Protection options */ +enum cp_state { + DRM_MODE_CONTENT_PROTECTION_UNSUPPORTED = -1, + DRM_MODE_CONTENT_PROTECTION_UNDESIRED, + DRM_MODE_CONTENT_PROTECTION_DESIRED, + DRM_MODE_CONTENT_PROTECTION_ENABLED, +}; struct drm_mode_modeinfo { __u32 clock;