From patchwork Wed Jan 18 19:30:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Yacoub X-Patchwork-Id: 13106988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E259BC38159 for ; Wed, 18 Jan 2023 19:30:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4EF4C10E818; Wed, 18 Jan 2023 19:30:41 +0000 (UTC) Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by gabe.freedesktop.org (Postfix) with ESMTPS id 31CB210E816 for ; Wed, 18 Jan 2023 19:30:36 +0000 (UTC) Received: by mail-qt1-x834.google.com with SMTP id z9so8029051qtv.5 for ; Wed, 18 Jan 2023 11:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qy72HLragdKKsAlVqQe+Eds7xMX1u8GGBw8aEtaI0ZE=; b=ChMcOZkWnhvIoGCvrWgE0kc5X3lFXKoI/3Ml+sCZSQnO1ueslzwK2y9S7t0O+eaqiI Wu+33+yqnC7OfKacIwaQEfL7Lhnm53eiMMm/416nfvJbTJJOUUQCI/YgXCLcnTK4rQh4 Zpd6L48MGkDY4nVsZmfu35kHH571dA5dGNfo8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qy72HLragdKKsAlVqQe+Eds7xMX1u8GGBw8aEtaI0ZE=; b=eiV9JHZXB/yDE+iymvUAGApJMIuMDzBi1SAIKb7mHtUSQ9h8RjcOTk5ycXskuwKNMe VX9b/eQS8ExbsYCmfBVuVJmJmi7MaFnjiBmA/Ky0OQloC0G4g4MW3mPatBy2tE4mw9iL 13SjVJv7S6pSDyI2taTZZFx1gfoeGaqB1fybFhvs5mE2VPO1PU8O4rBO3w60UHWDkUDx DnAvxwUpbcKOM998/bLmD+X8tWNH3Z7swQEqKQgSlFJ33L5xer7/pZoJ2in5FQ68KhKn kw3xa4UpcM+GrYU8ewvG0yqJwVSQ5jZQLn4K/q5mgyY4iHCo40aWcpega8MFeRDSXoYd Ea5A== X-Gm-Message-State: AFqh2kqke1IykA++ycHwcwI4m/sbiMfTt5a75zEOT2Uklsd/w6LTRzuq pzs0oSXZ+E4vlNY674Nusfd8uw== X-Google-Smtp-Source: AMrXdXu2vrUMP92aOea8CLzCaUWzDsB7wiMKTVTrm03BYSbZZ4QWqxxZxshSk3BE/duePBa1M/wXjQ== X-Received: by 2002:ac8:6650:0:b0:3b3:9d7f:1489 with SMTP id j16-20020ac86650000000b003b39d7f1489mr11541209qtp.56.1674070235256; Wed, 18 Jan 2023 11:30:35 -0800 (PST) Received: from localhost (29.46.245.35.bc.googleusercontent.com. [35.245.46.29]) by smtp.gmail.com with UTF8SMTPSA id bl3-20020a05620a1a8300b006fa9d101775sm17366qkb.33.2023.01.18.11.30.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Jan 2023 11:30:34 -0800 (PST) From: Mark Yacoub X-Google-Original-From: Mark Yacoub To: quic_khsieh@quicinc.com, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org Date: Wed, 18 Jan 2023 19:30:08 +0000 Message-Id: <20230118193015.911074-4-markyacoub@google.com> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog In-Reply-To: <20230118193015.911074-1-markyacoub@google.com> References: <20230118193015.911074-1-markyacoub@google.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v6 03/10] drm/hdcp: Update property value on content type and user changes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: quic_sbillaka@quicinc.com, konrad.dybcio@somainline.org, bjorn.andersson@linaro.org, krzysztof.kozlowski+dt@linaro.org, airlied@gmail.com, hbh25y@gmail.com, marex@denx.de, abhinavk@codeaurora.org, javierm@redhat.com, agross@kernel.org, quic_jesszhan@quicinc.com, daniel@ffwll.ch, Jani Nikula , lucas.demarchi@intel.com, quic_abhinavk@quicinc.com, swboyd@chromium.org, robh+dt@kernel.org, christophe.jaillet@wanadoo.fr, maxime@cerno.tech, rodrigo.vivi@intel.com, johan+linaro@kernel.org, markyacoub@chromium.org, andersson@kernel.org, dianders@chromium.org, tzimmermann@suse.de, dmitry.baryshkov@linaro.org, seanpaul@chromium.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Sean Paul This patch updates the connector's property value in 2 cases which were previously missed: 1- Content type changes. The value should revert back to DESIRED from ENABLED in case the driver must re-authenticate the link due to the new content type. 2- Userspace sets value to DESIRED while ENABLED. In this case, the value should be reset immediately to ENABLED since the link is actively being encrypted. To accommodate these changes, I've split up the conditionals to make things a bit more clear (as much as one can with this mess of state). Acked-by: Jani Nikula Reviewed-by: Rodrigo Vivi Reviewed-by: Abhinav Kumar Signed-off-by: Sean Paul Signed-off-by: Mark Yacoub Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-4-sean@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-4-sean@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-4-sean@poorly.run #v3 Link: https://patchwork.freedesktop.org/patch/msgid/20211105030434.2828845-4-sean@poorly.run #v4 Link: https://patchwork.freedesktop.org/patch/msgid/20220411204741.1074308-4-sean@poorly.run Changes in v2: -None Changes in v3: -Fixed indentation issue identified by 0-day Changes in v4: -None Changes in v5: -None Changes in v6: -Rebased: modifications in drm_hdcp_helper.c instead of drm_hdcp.c --- drivers/gpu/drm/display/drm_hdcp_helper.c | 29 +++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdcp_helper.c b/drivers/gpu/drm/display/drm_hdcp_helper.c index a3896b0904b5..ce92f1cac251 100644 --- a/drivers/gpu/drm/display/drm_hdcp_helper.c +++ b/drivers/gpu/drm/display/drm_hdcp_helper.c @@ -485,21 +485,30 @@ bool drm_hdcp_atomic_check(struct drm_connector *connector, return true; /* - * Nothing to do if content type is unchanged and one of: - * - state didn't change - * - HDCP was activated since the last commit - * - attempting to set to desired while already enabled + * Content type changes require an HDCP disable/enable cycle. */ - if (old_hdcp == new_hdcp || - (old_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED && + if (new_conn_state->hdcp_content_type != + old_conn_state->hdcp_content_type) { + new_conn_state->content_protection = + DRM_MODE_CONTENT_PROTECTION_DESIRED; + return true; + } + + /* + * Ignore meaningless state changes: + * - HDCP was activated since the last commit + * - Attempting to set to desired while already enabled + */ + if ((old_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED && new_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED) || (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED && new_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED)) { - if (old_conn_state->hdcp_content_type == - new_conn_state->hdcp_content_type) - return false; + new_conn_state->content_protection = + DRM_MODE_CONTENT_PROTECTION_ENABLED; + return false; } - return true; + /* Finally, if state changes, we need action */ + return old_hdcp != new_hdcp; } EXPORT_SYMBOL(drm_hdcp_atomic_check);