From patchwork Wed Jan 18 19:30:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Yacoub X-Patchwork-Id: 644209 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB2BAC38147 for ; Wed, 18 Jan 2023 19:31:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230033AbjARTbI (ORCPT ); Wed, 18 Jan 2023 14:31:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjARTaw (ORCPT ); Wed, 18 Jan 2023 14:30:52 -0500 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A75E25421D for ; Wed, 18 Jan 2023 11:30:41 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id j9so7914860qtv.4 for ; Wed, 18 Jan 2023 11:30:41 -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=I1/a+ysQjYWSLi+7tvGa8uhZWWX+I3DCv+Ho6KGSchQ=; b=PIQlIOGduxyrwhLVu1XvTThHFJgMpf7lLtpiHVnbyiWhUwVk4Xv4TADgsCPFiiNR2w ZmPCWIci/ZkrNa31bPmPQwB9hioQqoirPt4j4qJp8YO0bHyiBMI6WYAnS0jcTShaESGq bRMLOugEVzPaWg4nG5t1R1FKmJ7GAG7j7YYl8= 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=I1/a+ysQjYWSLi+7tvGa8uhZWWX+I3DCv+Ho6KGSchQ=; b=QO57UVZIlYS8zz8LVxBDXZUt+O9108oBfe6T3LxpYBy7OhyfGNMOnyu/swmoCRBiXl vlJrE0FMl+ep0D2o0UdbDfAPoXCDmGUizFchJ1d0Y7lcPSnXAL41jpLGz5ni/Sns0LmD 7J/XebBUw9ZgJCTJtWTpBZxbERBWAw7DevTlL5ovVI69B80EPi25/rN+QY/P0pfUtgbw BXTNlsF6iVk+JKZMDzKDzIIBcaXnfsl2YBolJFQGLhpDS99HcXTQeV9quE87ozlvfRQR ttH0Y6f7rrcsyhqkfuSn6DcLE5P8PuWCO1pSwE8QuOE/Q7vgLFcUq+WMgiWVdNhcb0wf PMew== X-Gm-Message-State: AFqh2kp6iFHqXa7TpFpnWtq0d5FRPcffAB4Ez+wcA3uFqJvzFmFazOV5 To0FGYMmu4jyaQYxKxjXKMID9A== X-Google-Smtp-Source: AMrXdXubuwUavpiFBuAnouMLvfVbBO5rVhIlniXLSoJDGRXJivyAAxSPS+AeZy15FIMrlSBRXHu5Tg== X-Received: by 2002:a05:622a:1b11:b0:3af:7bf6:d1f5 with SMTP id bb17-20020a05622a1b1100b003af7bf6d1f5mr11779180qtb.63.1674070241279; Wed, 18 Jan 2023 11:30:41 -0800 (PST) Received: from localhost (29.46.245.35.bc.googleusercontent.com. [35.245.46.29]) by smtp.gmail.com with UTF8SMTPSA id h18-20020a05620a401200b00702d1c6e7bbsm7725753qko.130.2023.01.18.11.30.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Jan 2023 11:30:40 -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 Cc: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@somainline.org, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, tvrtko.ursulin@linux.intel.com, markyacoub@chromium.org, tzimmermann@suse.de, ville.syrjala@linux.intel.com, stanislav.lisovskiy@intel.com, matthew.d.roper@intel.com, imre.deak@intel.com, lucas.demarchi@intel.com, manasi.d.navare@intel.com, swati2.sharma@intel.com, bhanuprakash.modem@intel.com, javierm@redhat.com, jose.souza@intel.com, lyude@redhat.com, hbh25y@gmail.com, arun.r.murthy@intel.com, ashutosh.dixit@intel.com, ankit.k.nautiyal@intel.com, maxime@cerno.tech, swboyd@chromium.org, christophe.jaillet@wanadoo.fr, quic_sbillaka@quicinc.com, johan+linaro@kernel.org, dianders@chromium.org, marex@denx.de, quic_jesszhan@quicinc.com, bjorn.andersson@linaro.org, abhinavk@codeaurora.org, seanpaul@chromium.org, Jani Nikula Subject: [PATCH v6 05/10] drm/i915/hdcp: Consolidate HDCP setup/state cache Date: Wed, 18 Jan 2023 19:30:10 +0000 Message-Id: <20230118193015.911074-6-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 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Sean Paul Stick all of the setup for HDCP into a dedicated function. No functional change, but this will facilitate moving HDCP logic into helpers. Acked-by: Jani Nikula Reviewed-by: Rodrigo Vivi Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-6-sean@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-6-sean@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-6-sean@poorly.run #v3 Link: https://patchwork.freedesktop.org/patch/msgid/20211105030434.2828845-6-sean@poorly.run #v4 Link: https://patchwork.freedesktop.org/patch/msgid/20220411204741.1074308-6-sean@poorly.run #v5 Changes in v2: -None Changes in v3: -None Changes in v4: -None Changes in v5: -None Changes in v6: -None --- drivers/gpu/drm/i915/display/intel_hdcp.c | 52 +++++++++++++++-------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 396d2cef000a..0a20bc41be55 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -2190,6 +2190,37 @@ static enum mei_fw_tc intel_get_mei_fw_tc(enum transcoder cpu_transcoder) } } +static int +_intel_hdcp_setup(struct intel_connector *connector, + const struct intel_crtc_state *pipe_config, u8 content_type) +{ + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + struct intel_digital_port *dig_port = intel_attached_dig_port(connector); + struct intel_hdcp *hdcp = &connector->hdcp; + int ret = 0; + + if (!connector->encoder) { + drm_err(&dev_priv->drm, "[%s:%d] encoder is not initialized\n", + connector->base.name, connector->base.base.id); + return -ENODEV; + } + + hdcp->content_type = content_type; + + if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_DP_MST)) { + hdcp->cpu_transcoder = pipe_config->mst_master_transcoder; + hdcp->stream_transcoder = pipe_config->cpu_transcoder; + } else { + hdcp->cpu_transcoder = pipe_config->cpu_transcoder; + hdcp->stream_transcoder = INVALID_TRANSCODER; + } + + if (DISPLAY_VER(dev_priv) >= 12) + dig_port->hdcp_port_data.fw_tc = intel_get_mei_fw_tc(hdcp->cpu_transcoder); + + return ret; +} + static int initialize_hdcp_port_data(struct intel_connector *connector, struct intel_digital_port *dig_port, const struct intel_hdcp_shim *shim) @@ -2329,28 +2360,14 @@ int intel_hdcp_enable(struct intel_connector *connector, if (!hdcp->shim) return -ENOENT; - if (!connector->encoder) { - drm_err(&dev_priv->drm, "[%s:%d] encoder is not initialized\n", - connector->base.name, connector->base.base.id); - return -ENODEV; - } - mutex_lock(&hdcp->mutex); mutex_lock(&dig_port->hdcp_mutex); drm_WARN_ON(&dev_priv->drm, hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED); - hdcp->content_type = content_type; - - if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_DP_MST)) { - hdcp->cpu_transcoder = pipe_config->mst_master_transcoder; - hdcp->stream_transcoder = pipe_config->cpu_transcoder; - } else { - hdcp->cpu_transcoder = pipe_config->cpu_transcoder; - hdcp->stream_transcoder = INVALID_TRANSCODER; - } - if (DISPLAY_VER(dev_priv) >= 12) - dig_port->hdcp_port_data.fw_tc = intel_get_mei_fw_tc(hdcp->cpu_transcoder); + ret = _intel_hdcp_setup(connector, pipe_config, content_type); + if (ret) + goto out; /* * Considering that HDCP2.2 is more secure than HDCP1.4, If the setup @@ -2378,6 +2395,7 @@ int intel_hdcp_enable(struct intel_connector *connector, true); } +out: mutex_unlock(&dig_port->hdcp_mutex); mutex_unlock(&hdcp->mutex); return ret;