From patchwork Fri Aug 14 06:57:10 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: 1344655 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 4BSZ5K0WHZz9sTM; Fri, 14 Aug 2020 16:57:55 +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 1k6Tex-0007Uw-7I; Fri, 14 Aug 2020 06:57:51 +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 1k6Tev-0007UT-7I for kernel-team@lists.ubuntu.com; Fri, 14 Aug 2020 06:57:49 +0000 Received: by mail-pg1-f195.google.com with SMTP id o13so4100202pgf.0 for ; Thu, 13 Aug 2020 23:57:48 -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=A9G+znhK6Fc6Gg9C2cFnVcfdyMh+t0a0VDDagJphVqY=; b=k4jo9ARhu2Z1R36OdaF1OEA9C1+KwhkKAqxoRRkeBtDz2/zmm11Bk71WVf9UJtMvFV GGchYsr/24elRm0Vla8C0sd3G4M9tvJ4PGzvzul4DHiMdu0C+F2XgyD6Y12jV2OuVB4h W3p3INj64WHvJqVz9erCJbKdB7f8WipdmOm+VRPT68vDs+ZYHt9UFsmGwLfUpLBJhBmN VWsYSs9bAtaMjq8w11V6xOBjsPKtEHjr6tW44XkbYBn6WyzzoU4BzylwsF5IAYt0bOt0 /i9ykAarSpMKQQKHh0Q+N2eui8VGjPTzqM6zCJq3S1JG0iACdSSiQW7V4VI6TiMhBSm0 oknw== X-Gm-Message-State: AOAM533NSEQRWOJuPflHcCNZYDbPEQ+GdWD5TDFcfvuk1JB9HNpJiQ/o OIEbI9OBDi+ziBaLUatqDhKBIqcy1m4h8Q== X-Google-Smtp-Source: ABdhPJwcdwD4pLEYz5YdleKkU3m+W600YE9Pvwm6r2jJH278OyfBz0w5ZW4ebwDFj2aA8HFrvI1kwg== X-Received: by 2002:a62:20e:: with SMTP id 14mr3655pfc.207.1597388266775; Thu, 13 Aug 2020 23:57:46 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id il13sm7498744pjb.0.2020.08.13.23.57.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Aug 2020 23:57:45 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 01/31][SRU][OEM-5.6] drm/i915: Move more cdclk state handling into the cdclk code Date: Fri, 14 Aug 2020 14:57:10 +0800 Message-Id: <20200814065740.276039-2-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 Move the initial setup of state->{cdclk,min_cdclk[],min_voltage_level[]} into intel_modeset_calc_cdclk(), and we'll move the counterparts into intel_cdclk_swap_state(). This encapsulates the cdclk state much better. Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20200120174728.21095-5-ville.syrjala@linux.intel.com Reviewed-by: José Roberto de Souza (cherry picked from commit 54f09d2342b0516ce73ec02657db8d28fcfa637e) Signed-off-by: You-Sheng Yang --- drivers/gpu/drm/i915/display/intel_cdclk.c | 26 +++++++++++++++----- drivers/gpu/drm/i915/display/intel_display.c | 11 --------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c index fd24f10060b6..b2c8a027b442 100644 --- a/drivers/gpu/drm/i915/display/intel_cdclk.c +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c @@ -1831,6 +1831,14 @@ void intel_cdclk_swap_state(struct intel_atomic_state *state) { struct drm_i915_private *dev_priv = to_i915(state->base.dev); + /* FIXME maybe swap() these too */ + memcpy(dev_priv->min_cdclk, state->min_cdclk, + sizeof(state->min_cdclk)); + memcpy(dev_priv->min_voltage_level, state->min_voltage_level, + sizeof(state->min_voltage_level)); + + dev_priv->cdclk.force_min_cdclk = state->cdclk.force_min_cdclk; + swap(state->cdclk.logical, dev_priv->cdclk.logical); swap(state->cdclk.actual, dev_priv->cdclk.actual); } @@ -2045,9 +2053,6 @@ static int intel_compute_min_cdclk(struct intel_atomic_state *state) int min_cdclk, i; enum pipe pipe; - memcpy(state->min_cdclk, dev_priv->min_cdclk, - sizeof(state->min_cdclk)); - for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { int ret; @@ -2094,9 +2099,6 @@ static int bxt_compute_min_voltage_level(struct intel_atomic_state *state) int i; enum pipe pipe; - memcpy(state->min_voltage_level, dev_priv->min_voltage_level, - sizeof(state->min_voltage_level)); - for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) { int ret; @@ -2351,6 +2353,18 @@ int intel_modeset_calc_cdclk(struct intel_atomic_state *state) enum pipe pipe; int ret; + memcpy(state->min_cdclk, dev_priv->min_cdclk, + sizeof(state->min_cdclk)); + memcpy(state->min_voltage_level, dev_priv->min_voltage_level, + sizeof(state->min_voltage_level)); + + /* keep the current setting */ + if (!state->cdclk.force_min_cdclk_changed) + state->cdclk.force_min_cdclk = dev_priv->cdclk.force_min_cdclk; + + state->cdclk.logical = dev_priv->cdclk.logical; + state->cdclk.actual = dev_priv->cdclk.actual; + ret = dev_priv->display.modeset_calc_cdclk(state); if (ret) return ret; diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index eb6942604801..11f93d11079f 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -14376,14 +14376,8 @@ static int intel_modeset_checks(struct intel_atomic_state *state) struct intel_crtc *crtc; int ret, i; - /* keep the current setting */ - if (!state->cdclk.force_min_cdclk_changed) - state->cdclk.force_min_cdclk = dev_priv->cdclk.force_min_cdclk; - state->modeset = true; state->active_pipes = dev_priv->active_pipes; - state->cdclk.logical = dev_priv->cdclk.logical; - state->cdclk.actual = dev_priv->cdclk.actual; for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { @@ -15717,12 +15711,7 @@ static int intel_atomic_commit(struct drm_device *dev, if (state->global_state_changed) { assert_global_state_locked(dev_priv); - memcpy(dev_priv->min_cdclk, state->min_cdclk, - sizeof(state->min_cdclk)); - memcpy(dev_priv->min_voltage_level, state->min_voltage_level, - sizeof(state->min_voltage_level)); dev_priv->active_pipes = state->active_pipes; - dev_priv->cdclk.force_min_cdclk = state->cdclk.force_min_cdclk; intel_cdclk_swap_state(state); }