Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp460727rwr; Wed, 19 Apr 2023 08:44:32 -0700 (PDT) X-Google-Smtp-Source: AKy350b3Olw2rKbXYCrUjjL5dQExBkkN/rjVhekJyOKKEUL9wNZrV+ZB5ayXsXG6tXoXXEyciMgj X-Received: by 2002:a17:902:cec9:b0:1a6:b5b2:6a25 with SMTP id d9-20020a170902cec900b001a6b5b26a25mr7224026plg.2.1681919072282; Wed, 19 Apr 2023 08:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681919072; cv=none; d=google.com; s=arc-20160816; b=vBxUuTIt8lND+7vuTPCTKDuiCSDj8vhbM9CoU9VarNg9ohqTeYBhefVGzTM51x5AKQ PCPKZBFHqV3IaOQBK5858GPYHSxdLRiDxVYO94i1TDY5kGOCPImnih51vMA+2wjQejBm WDagvsdq5GvyAYOWinQfuMiLoSiQyucKayiP9OgLjAJQGCYmd2W3gr2j2KxWFN4PBuEv zGZjojxUhXRqirUtocHpxCpiACEwH84D2S901mF70ktl7FTlcqDlWp+O4SGy96hZXy/i Yz6EbeJJeJNoeszTmOfRkuBGVxc79N4tOZ8ekXT6/8S4gq/SqtdNpiDGSTp+xKmugFbl Ywlw== 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=3rbNDIEnicTo7tDhLykbW0onsLUTFtSKKNeiVomT8Zk=; b=n4MWa+/tdS/sTtJZ8nTGU/v1Pux2Bs3hVhIg93VZdRwjxpI6Fv4fUzO8v9x0fOS8Dv uoybRwBBluhC7YusSXldfySzLHK9gVCu6StJnPnkp9kLJto1nPGm2DzIoobQYldM0I0A WebJ+x9203kN3ud5+4yMRY2HnnjG1IacHGRsnGY6dSR6b3NOoQoFTS+9XGDB5GsHI+Nq zrR0nPhkCII6ZRBrfZIkcRgL7BZM7sFW84rXWJccpW8DsjGs8F3MfaUUKb/YRFp6udsx 1RYCshUUbQ6XfMMnkpuQbmxED5a6A6lBZmv4YA/q1G7jl9g4ulzsRkj+azVLdyuWWXDj AwbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lqGKv9rs; 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 g1-20020a170902fe0100b001a6e71cfbaasi6193191plj.423.2023.04.19.08.44.18; Wed, 19 Apr 2023 08:44:32 -0700 (PDT) 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=lqGKv9rs; 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 S233537AbjDSPnp (ORCPT + 99 others); Wed, 19 Apr 2023 11:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233529AbjDSPnm (ORCPT ); Wed, 19 Apr 2023 11:43:42 -0400 Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69E8D93E2 for ; Wed, 19 Apr 2023 08:43:37 -0700 (PDT) Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-54fa9da5e5bso5727317b3.1 for ; Wed, 19 Apr 2023 08:43:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1681919016; x=1684511016; 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=3rbNDIEnicTo7tDhLykbW0onsLUTFtSKKNeiVomT8Zk=; b=lqGKv9rsoLivhOEKsIR4drSBrR1Q/DiHB/0eB7TBOu9TRoEDuZbNMaORCUV7ZTpDSZ xl3wGw0eOxO6v4QsGJb/wDfqSz4t0pTgp5pV510SxIPxNYoBYn9OWqD4YFzDeWJRu+nW dU0q824Yc6qNEN+PdK7ddn7C/oMH0vaHOr1UY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681919016; x=1684511016; 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=3rbNDIEnicTo7tDhLykbW0onsLUTFtSKKNeiVomT8Zk=; b=dgMGoWKv4ltrlPXmyNZC3brt5x2TQ3LsD6HJJ2PZxcpkYIiEaEVnbl/zv+2dYR1Gal cXxNutgWsLenu+MMMFBDHMAaYnyt6saFEliQokv+Aew+UFK4r4e0pRcl5NgtBYQolyqN of3X0kIfMj1Q+YRe3CWqRwFdSKeVlxJ5PYLgwO9PTWMH9xsvclGJhvCgHQrC0iGco0Rc B9SJaF63/xUxI+tOFrtJDARfMwp+5QLIk1MMNyON7iZ4j5Xumukwzj0mV3okA9roSZVu Q4fzcFbWbxS7h9c3T2YZ9XiBKn8AHcw2h6mQwrZga1F0CJqd5SkkHH4KRDynFVOewHal DPzw== X-Gm-Message-State: AAQBX9fXpkQqGJLlCmE9v8SFZUD/czz6nhRD756qSKrWHZOsvCjyDfP8 5Fltp/ASpI35SGIUaKSgwmyaI+MHPZWCBtGQOW8= X-Received: by 2002:a0d:f104:0:b0:54f:bb34:1a5 with SMTP id a4-20020a0df104000000b0054fbb3401a5mr3291360ywf.48.1681919016509; Wed, 19 Apr 2023 08:43:36 -0700 (PDT) Received: from localhost ([2620:0:1035:15:55c6:7cf1:a68:79b0]) by smtp.gmail.com with UTF8SMTPSA id f69-20020a25cf48000000b00b7767ca7473sm4457616ybg.16.2023.04.19.08.43.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Apr 2023 08:43:36 -0700 (PDT) From: Mark Yacoub X-Google-Original-From: Mark Yacoub To: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter Cc: seanpaul@chromium.org, suraj.kandpal@intel.com, dianders@chromium.org, dmitry.baryshkov@linaro.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jani Nikula , linux-kernel@vger.kernel.org Subject: [PATCH v10 05/10] drm/i915/hdcp: Consolidate HDCP setup/state cache Date: Wed, 19 Apr 2023 11:43:15 -0400 Message-ID: <20230419154321.1993419-6-markyacoub@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230419154321.1993419-1-markyacoub@google.com> References: <20230419154321.1993419-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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 --- Changes in v2: -None Changes in v3: -None Changes in v4: -None Changes in v5: -None Changes in v6: -None Changes in v7: - 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 396d2cef000aa..0a20bc41be55d 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.40.0.634.g4ca3ef3211-goog