[Intel-gfx] [PATCH 2/6] drm: Set mode->vrefresh before mode validation

Ville Syrjala ville.syrjala at linux.intel.com
Thu Jun 28 19:42:57 UTC 2018


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

Update mode->vrefresh before mode validation. This allows the
validation code to consult mode->vrefresh safely.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 527743394150..34409abfd061 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -490,6 +490,16 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 
 	drm_mode_connector_list_update(connector);
 
+	list_for_each_entry(mode, &connector->modes, head) {
+		/*
+		 * Clear out any potentially stale cached vrefresh
+		 * value, as otherwise drm_mode_vrefresh() would
+		 * just return it back to us.
+		 */
+		mode->vrefresh = 0;
+		mode->vrefresh = drm_mode_vrefresh(mode);
+	}
+
 	if (connector->interlace_allowed)
 		mode_flags |= DRM_MODE_FLAG_INTERLACE;
 	if (connector->doublescan_allowed)
@@ -525,9 +535,6 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 	if (list_empty(&connector->modes))
 		return 0;
 
-	list_for_each_entry(mode, &connector->modes, head)
-		mode->vrefresh = drm_mode_vrefresh(mode);
-
 	drm_mode_sort(&connector->modes);
 
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
-- 
2.16.4



More information about the Intel-gfx mailing list