From patchwork Fri Oct 1 15:11:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 12530907 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B9BBC433F5 for ; Fri, 1 Oct 2021 15:12:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 59FB5611C0 for ; Fri, 1 Oct 2021 15:12:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 59FB5611C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BFA6E6EE31; Fri, 1 Oct 2021 15:12:14 +0000 (UTC) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by gabe.freedesktop.org (Postfix) with ESMTPS id D85FF6EE32 for ; Fri, 1 Oct 2021 15:12:12 +0000 (UTC) Received: by mail-qt1-x82c.google.com with SMTP id c20so9244592qtb.2 for ; Fri, 01 Oct 2021 08:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qp5JEnD4/ZWm7pQOphVFWIinix3003Tez3ET1mys8Yg=; b=d+yNvZM0YxwqZtrXFK1X2RkSwDcFb5sAzQZvobQy8gtNmAfQSCCIvMHf64XkgdgF18 8crEUjEY7xQCXN3RjxL+TmSGfZyJeKVO2ZJSdiqn8Rj9zgjZBS3DD2ftoQ7bm1mQaCL3 HOOdFIF+FFyvojuJgxbWOxK3Ud8JkstuLAOispzR6fYLke1PHVQPOkoJnKN/fPLP3mfF D175zq1Yj0Ox/wvv4dJLb/8Z/KUsbNt1/OsE8LpLlxIvy6Vy12l5YwGPaPGlqN8TjX4c WvuX8LJtUPMGVbE0t/IduaW67q30Uki8VEdLaCpU1OHVHspPahhEu7z03ZaJ3ZXeDaRf UOYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qp5JEnD4/ZWm7pQOphVFWIinix3003Tez3ET1mys8Yg=; b=Dx1APA3kc7QQY/WZAoMyX389GTHz4p0rAyU5A4x/j0Xq5NzCNbKS8JU/1k14sn5+Jd CieDpAQIYMtPTVNNbxptGyaFQzFfVO/fK/N0UeDY5gHn/aiCCz7Jl8WQMFJUcU6WWhPE BjtGt7unKu1SIXiZck5loIMZRYCVcPq/liBxGPnd32kahU1AUKAUUmSppdCR9ci4uNaK fKtuvwzL+xeDz4RlNIWuiSXJUcUNkLW7Bq20vCx1vAw8ertJLugFheCy8Zd96k4z6tpS IQurXKHy6KUJRuqPYOIWAIdwcpL5j8eEw6/w4CfaL7A+51WdfSGCnNjQDUvC5fDMqD/j 9Kng== X-Gm-Message-State: AOAM5300eWwfvVw2QtKY0EsXtLv813sWBCaEt0mQZlV40q2C+iY3GZn6 WV/i7Q1+OpfwBg0c/dSI084g77BWwgvOIQ== X-Google-Smtp-Source: ABdhPJzsf3e6Q9s1XezeoJrbESUMQfVAkIXoRb1w0cM5tOvG7oxj9mXH8KwjZ+euffqBcqgOVnwYiw== X-Received: by 2002:ac8:3b5a:: with SMTP id r26mr13374548qtf.171.1633101131843; Fri, 01 Oct 2021 08:12:11 -0700 (PDT) Received: from localhost ([167.100.64.199]) by smtp.gmail.com with ESMTPSA id 19sm3336711qtt.20.2021.10.01.08.12.11 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Oct 2021 08:12:11 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: swboyd@chromium.org, jani.nikula@linux.intel.com, Sean Paul , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter Subject: [PATCH v3 05/14] drm/i915/hdcp: Consolidate HDCP setup/state cache Date: Fri, 1 Oct 2021 11:11:34 -0400 Message-Id: <20211001151145.55916-6-sean@poorly.run> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20211001151145.55916-1-sean@poorly.run> References: <20211001151145.55916-1-sean@poorly.run> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 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 Changes in v2: -None Changes in v3: -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 feebafead046..af166baf8c71 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -2167,6 +2167,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) @@ -2306,28 +2337,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 @@ -2355,6 +2372,7 @@ int intel_hdcp_enable(struct intel_connector *connector, true); } +out: mutex_unlock(&dig_port->hdcp_mutex); mutex_unlock(&hdcp->mutex); return ret;