dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org,
	Emil Velikov <emil.velikov@collabora.com>
Subject: [PATCH v3 02/16] drm/i915: Introduce some local intel_dp variables
Date: Tue, 28 Apr 2020 20:19:26 +0300	[thread overview]
Message-ID: <20200428171940.19552-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20200428171940.19552-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The drrs code dereferences mode->vrefresh via some really long chain
of structures/pointers. Couldn't get coccinelle to see through all
that so let's add some local variables to help it.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 6952b0295096..2a3004b1ffc0 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -8002,6 +8002,7 @@ static void intel_edp_drrs_downclock_work(struct work_struct *work)
 void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
 			       unsigned int frontbuffer_bits)
 {
+	struct intel_dp *intel_dp;
 	struct drm_crtc *crtc;
 	enum pipe pipe;
 
@@ -8011,12 +8012,14 @@ void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
 	cancel_delayed_work(&dev_priv->drrs.work);
 
 	mutex_lock(&dev_priv->drrs.mutex);
-	if (!dev_priv->drrs.dp) {
+
+	intel_dp = dev_priv->drrs.dp;
+	if (!intel_dp) {
 		mutex_unlock(&dev_priv->drrs.mutex);
 		return;
 	}
 
-	crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
+	crtc = dp_to_dig_port(intel_dp)->base.base.crtc;
 	pipe = to_intel_crtc(crtc)->pipe;
 
 	frontbuffer_bits &= INTEL_FRONTBUFFER_ALL_MASK(pipe);
@@ -8025,7 +8028,7 @@ void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
 	/* invalidate means busy screen hence upclock */
 	if (frontbuffer_bits && dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR)
 		intel_dp_set_drrs_state(dev_priv, to_intel_crtc(crtc)->config,
-			dev_priv->drrs.dp->attached_connector->panel.fixed_mode->vrefresh);
+					intel_dp->attached_connector->panel.fixed_mode->vrefresh);
 
 	mutex_unlock(&dev_priv->drrs.mutex);
 }
@@ -8045,6 +8048,7 @@ void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv,
 void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
 			  unsigned int frontbuffer_bits)
 {
+	struct intel_dp *intel_dp;
 	struct drm_crtc *crtc;
 	enum pipe pipe;
 
@@ -8054,12 +8058,14 @@ void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
 	cancel_delayed_work(&dev_priv->drrs.work);
 
 	mutex_lock(&dev_priv->drrs.mutex);
-	if (!dev_priv->drrs.dp) {
+
+	intel_dp = dev_priv->drrs.dp;
+	if (!intel_dp) {
 		mutex_unlock(&dev_priv->drrs.mutex);
 		return;
 	}
 
-	crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
+	crtc = dp_to_dig_port(intel_dp)->base.base.crtc;
 	pipe = to_intel_crtc(crtc)->pipe;
 
 	frontbuffer_bits &= INTEL_FRONTBUFFER_ALL_MASK(pipe);
@@ -8068,7 +8074,7 @@ void intel_edp_drrs_flush(struct drm_i915_private *dev_priv,
 	/* flush means busy screen hence upclock */
 	if (frontbuffer_bits && dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR)
 		intel_dp_set_drrs_state(dev_priv, to_intel_crtc(crtc)->config,
-				dev_priv->drrs.dp->attached_connector->panel.fixed_mode->vrefresh);
+					intel_dp->attached_connector->panel.fixed_mode->vrefresh);
 
 	/*
 	 * flush also means no more activity hence schedule downclock, if all
-- 
2.24.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-04-28 17:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 17:19 [PATCH v3 00/16] drm: Put drm_display_mode on diet Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 01/16] drm: Nuke mode->hsync Ville Syrjala
2020-04-28 17:19 ` Ville Syrjala [this message]
2020-04-28 17:19 ` [PATCH v3 03/16] drm: Nuke mode->vrefresh Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 04/16] drm/msm/dpu: Stop copying around mode->private_flags Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 05/16] drm: Shrink {width,height}_mm to u16 Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 06/16] drm: Shrink mode->type to u8 Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 07/16] drm: Make mode->flags u32 Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 08/16] drm: Shrink drm_display_mode timings Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 09/16] drm: Flatten drm_mode_vrefresh() Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 10/16] drm: pahole struct drm_display_mode Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 11/16] drm/mcde: Use mode->clock instead of reverse calculating it from the vrefresh Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 12/16] drm/i915: Stop using mode->private_flags Ville Syrjala
2020-04-29 10:39   ` [PATCH v4 " Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 13/16] drm/i915: Replace I915_MODE_FLAG_INHERITED with a boolean Ville Syrjala
2020-04-29 10:39   ` [PATCH v4 " Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 14/16] drm/gma500: Stop using mode->private_flags Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 15/16] drm: Nuke mode->private_flags Ville Syrjala
2020-04-28 17:19 ` [PATCH v3 16/16] drm: Replace mode->export_head with a boolean Ville Syrjala
2020-04-30 13:50   ` Emil Velikov
2020-09-01 10:58     ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428171940.19552-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox