Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp6961896rwb; Wed, 18 Jan 2023 11:33:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXt1VRIDcG1nQuQWReZNOj7fhKmaOfO+AtK/bVuu9Yez5+wLrP+wjvuaKv3A+QHKz+zLjV94 X-Received: by 2002:a05:6a21:2d88:b0:ad:79bb:a417 with SMTP id ty8-20020a056a212d8800b000ad79bba417mr9215081pzb.9.1674070384331; Wed, 18 Jan 2023 11:33:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674070384; cv=none; d=google.com; s=arc-20160816; b=oEkg6Gv5H5D1GYsX7MXnMgtqg6hWtEkQ18HF2Gpo0J+/hQNEM4GfjxC8LmWB6oni6Q OiJ4B/L6tuUFCxqrlwf16F3KQvQ33lxDWb8I8ok675ahjqui6hbzmOewsTg5Sg5YeJyc ngudUUo0qzYBEcqX/c+9DVh6KZ4smCv++fPRTHLtCEkaLgaeSE7t1M9wCnuhFXF28ypi xoc0D3uKO5jrSSqKBrxVn4a6/VBMrKLGxM+gGV3KVSKKhC1NKPX8f/qPUInismbTGdOV odmRHIalq4ltFRxIvTAbKimUGe48pfddTWhTcc4YQqU+c9AEBZnyZVWfVCbv5D5HvLNj KQig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=I1/a+ysQjYWSLi+7tvGa8uhZWWX+I3DCv+Ho6KGSchQ=; b=Nx/RhNU2yr5ysC+ZzSQArCtk7Dbt/WKBP+Ri9gWoF1LwnRlNe9Rentd7OZKpaMIj8o y9S8y+XWFJShvcyetzCaTuKMcqWdBLN946IdbRN6kE9WXzVJ2mEnI1GHHxlLXV116wxV iuHe0qBIS7IRh7+R2aHQ6XULhVD9+6/WZoakAaafRx5uBXq1/EI4V4b9KFT3YQ3qVp/u QqF2gy8wHIWg05K6wwgZ62YZNxlxjiJDTRVwgv6nLNSSlJFTeE2SlSa8xmDhdMrbjNHD 2vdtIMMchXWVEG/3Q9SFWYuimasXgVfzY7Is0kjcC5cektyieL2xDQwBIQS64Xfqsb4/ mWHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PIQlIOGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a63df12000000b0043ca0a1f7dasi37339280pgg.674.2023.01.18.11.32.58; Wed, 18 Jan 2023 11:33:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PIQlIOGd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230273AbjARTbO (ORCPT + 45 others); Wed, 18 Jan 2023 14:31:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230242AbjARTaw (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 3B5F75AA4D for ; Wed, 18 Jan 2023 11:30:42 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id x7so20566655qtv.13 for ; Wed, 18 Jan 2023 11:30:42 -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=zhxhKaC3n6QQ3N6LaQEYczl6RLvpJaYlgRv2sjdt6QACaUfjVi+9kxU6hEqmDd71Xf wElqidXrC2+3RKuXed8+VUk0HddIF6+WLnAfXh2cDRyRPy8Aud3U7YIhEDYYyqvpdBub swDq+6hjOOCQXmC7mrpBYfObF+W4z89rh1+e3aKv+cviSt7V9iKDs7Pz9/s6SEOlpnJZ EbTWEySsAAJYbRfg+FvgWGkpmJ3GGuRaUj/HEexSLJcgcVtRZMHge2APBadJJcN94lk3 R5Ywnr1/hBAe4A+4o6yG7XZ7FPZuORpG9OS30v7cM4IkvN0anAz4S0hT2tJ6P1OrORTL ZIFw== X-Gm-Message-State: AFqh2kpTV/2HgIYZ34Cd7jkhXGUfh1Rx6caC4YJnO0qb9GCyLO4H481T JfwkSfQH6grXVSvuwItqOLcokw== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; -- 2.39.0.246.g2a6d74b583-goog