From patchwork Fri Aug 14 06:57:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1344667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BSZ6201ntz9sPB; Fri, 14 Aug 2020 16:58:33 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1k6TfX-0007v8-T7; Fri, 14 Aug 2020 06:58:27 +0000 Received: from mail-pg1-f195.google.com ([209.85.215.195]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k6TfP-0007mD-CT for kernel-team@lists.ubuntu.com; Fri, 14 Aug 2020 06:58:19 +0000 Received: by mail-pg1-f195.google.com with SMTP id j21so4077395pgi.9 for ; Thu, 13 Aug 2020 23:58:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HGTv+Up8o9uYKF1weTcesElSoIeSlgTcSXgH6l8i2tc=; b=QqCNH0I0XQ09Vol/FSud6I0x8DF6RSBhNMYeld9EG0+iRYzUqJuGVvVzg81M96thcI vzJjueMysLIVSndC6ayFWERwUooabvdvwg8W9DAUGQ+RIjyp8K94gfYgBu+ml/naxYf7 nQCdRB1PWi2Sr0gntFiM0Z013/i36NT8EJSFtm8KpsQ/z7TgoL8fideNkCd482KoeFn3 rDltXid8+x3D2CzyfYnlLlZLu63qL27BrDOdUzezxnfiymaXTNPny89ogwstDZbZBw6j BUobeLPBhDIBLAxV1uDhJ2z2ERp8DAlwFn1Xvl1ZF+EISPYkOjFgH5jryX7I9N7So7cs PMUA== X-Gm-Message-State: AOAM530q9X/hENMFgvRoBn83aepEFW7rJPFYVw4eeKheA5lnjqmowb3G ZKW/c2VEhu//tX40Da1Rmbr7uUDepUUZow== X-Google-Smtp-Source: ABdhPJxeu/PmenvR/DOnmKWHPw8JbvVzehcg8EjUFkEjZGysTbOfjya1K/KCBqkXLrBCNdUrUPyRtg== X-Received: by 2002:a62:a10f:: with SMTP id b15mr845816pff.253.1597388295686; Thu, 13 Aug 2020 23:58:15 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id t25sm8449778pfl.198.2020.08.13.23.58.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Aug 2020 23:58:14 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 12/31][SRU][OEM-5.6] drm/i915: Introduce intel_calc_active_pipes() Date: Fri, 14 Aug 2020 14:57:21 +0800 Message-Id: <20200814065740.276039-13-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200814065740.276039-1-vicamo.yang@canonical.com> References: <20200814065740.276039-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.195; envelope-from=vicamo@gmail.com; helo=mail-pg1-f195.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Ville Syrjälä BugLink: https://bugs.launchpad.net/bugs/1891451 Extract a small helper to compute the active pipes bitmask based on the old bitmask + the crtcs in the atomic state. I want to decouple the cdclk state entirely from the current global state so I want to track the active pipes also inside the (to be introduced) full cdclk state. Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20200120174728.21095-17-ville.syrjala@linux.intel.com Reviewed-by: Imre Deak (cherry picked from commit aac978718bb480fee1b4a577727c0c06e7ae65db) Signed-off-by: You-Sheng Yang --- drivers/gpu/drm/i915/display/intel_display.c | 34 ++++++++++++-------- drivers/gpu/drm/i915/display/intel_display.h | 3 ++ 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 8ca2d3f7c99b..ebafe88572ba 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -14375,26 +14375,32 @@ static int hsw_mode_set_planes_workaround(struct intel_atomic_state *state) return 0; } +u8 intel_calc_active_pipes(struct intel_atomic_state *state, + u8 active_pipes) +{ + const struct intel_crtc_state *crtc_state; + struct intel_crtc *crtc; + int i; + + for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { + if (crtc_state->hw.active) + active_pipes |= BIT(crtc->pipe); + else + active_pipes &= ~BIT(crtc->pipe); + } + + return active_pipes; +} + static int intel_modeset_checks(struct intel_atomic_state *state) { struct drm_i915_private *dev_priv = to_i915(state->base.dev); - struct intel_crtc_state *old_crtc_state, *new_crtc_state; - struct intel_crtc *crtc; - int ret, i; + int ret; state->modeset = true; - state->active_pipes = dev_priv->active_pipes; + state->active_pipes = intel_calc_active_pipes(state, dev_priv->active_pipes); - for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, - new_crtc_state, i) { - if (new_crtc_state->hw.active) - state->active_pipes |= BIT(crtc->pipe); - else - state->active_pipes &= ~BIT(crtc->pipe); - - if (old_crtc_state->hw.active != new_crtc_state->hw.active) - state->active_pipe_changes |= BIT(crtc->pipe); - } + state->active_pipe_changes = state->active_pipes ^ dev_priv->active_pipes; if (state->active_pipe_changes) { ret = _intel_atomic_lock_global_state(state); diff --git a/drivers/gpu/drm/i915/display/intel_display.h b/drivers/gpu/drm/i915/display/intel_display.h index dd1215106d4a..1bd7b4cc3227 100644 --- a/drivers/gpu/drm/i915/display/intel_display.h +++ b/drivers/gpu/drm/i915/display/intel_display.h @@ -44,6 +44,7 @@ struct drm_modeset_acquire_ctx; struct drm_plane; struct drm_plane_state; struct i915_ggtt_view; +struct intel_atomic_state; struct intel_crtc; struct intel_crtc_state; struct intel_digital_port; @@ -469,6 +470,8 @@ enum phy_fia { ((connector) = to_intel_connector((__state)->base.connectors[__i].ptr), \ (new_connector_state) = to_intel_digital_connector_state((__state)->base.connectors[__i].new_state), 1)) +u8 intel_calc_active_pipes(struct intel_atomic_state *state, + u8 active_pipes); void intel_link_compute_m_n(u16 bpp, int nlanes, int pixel_clock, int link_clock, struct intel_link_m_n *m_n,