Skip to contentSkip to conversation

Update vtotal based on closest possible panel timings

RFC New Mitul Golani 2 participants 3 messages Nov 23, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Update vtotal based on closest possible panel timings

For edp VRR supported panel, vtotal should be updated
based on closest available panel timings and adjusted_mode panel configuration, instead of rounding up to nearest possible integer. This is to facilitate user about the refreh rate they're going to get when it is slightly off from list of available modes.

Mitul Golani (1):
drm/i915/display: Update vtotal based on closest possible panel
timings

 drivers/gpu/drm/i915/display/intel_panel.c | 53 ++++++++++++++++++----
 drivers/gpu/drm/i915/display/intel_vrr.h   |  2 +
 2 files changed, 45 insertions(+), 10 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

RFC 1/1 drm/i915/display: Update vtotal based on closest possible panel timings

For edp VRR supported panel, vtotal should be updated
based on closest available panel timings and adjusted_mode panel configuration, instead of rounding up to nearest possible integer. This is to facilitate user about the refreh rate they're going to get when it is slightly off from list of available modes.

---
 drivers/gpu/drm/i915/display/intel_panel.c | 53 ++++++++++++++++++----
 drivers/gpu/drm/i915/display/intel_vrr.h   |  2 +
 2 files changed, 45 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/display/intel_panel.c +43 -10
index 0d8e5320a4f8..f53cea2d7b29 100644
@@ -197,26 +197,56 @@ enum drrs_type intel_panel_drrs_type(struct intel_connector *connector)
 	return connector->panel.vbt.drrs_type;
 }
 
+static int
+mode_vrefresh_k(const struct drm_display_mode *mode)
+{
+	unsigned int num, den;
+
+	if (mode->htotal == 0 || mode->vtotal == 0)
+		return 0;
+
+	num = mode->clock;
+	den = mode->htotal * mode->vtotal;
+
+	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+		num *= 2;
+	if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
+		den *= 2;
+	if (mode->vscan > 1)
+		den *= mode->vscan;
+
+	return mul_u64_u64_div_u64(num,
+							   1000 * FIXED_POINT_PRECISION,
+							   den);
+}
+
 int intel_panel_compute_config(struct intel_connector *connector,
 			       struct drm_display_mode *adjusted_mode)
 {
 	const struct drm_display_mode *fixed_mode =
 		intel_panel_fixed_mode(connector, adjusted_mode);
-	int vrefresh, fixed_mode_vrefresh;
+	int vrefresh_int, vrefresh_fraction;
+	int fixed_mode_vrefresh_int;
+	int vrefresh_k = mode_vrefresh_k(adjusted_mode);
+	int fixed_mode_vrefresh_k = mode_vrefresh_k(fixed_mode);
 	bool is_vrr;
 
 	if (!fixed_mode)
 		return 0;
 
-	vrefresh = drm_mode_vrefresh(adjusted_mode);
-	fixed_mode_vrefresh = drm_mode_vrefresh(fixed_mode);
+	vrefresh_int = vrefresh_k / FIXED_POINT_PRECISION;
+	vrefresh_fraction = do_div(vrefresh_k, FIXED_POINT_PRECISION);
+	fixed_mode_vrefresh_int = fixed_mode_vrefresh_k / FIXED_POINT_PRECISION;
 
 	/*
 	 * Assume that we shouldn't muck about with the
 	 * timings if they don't land in the VRR range.
 	 */
-	is_vrr = intel_vrr_is_in_range(connector, vrefresh) &&
-		intel_vrr_is_in_range(connector, fixed_mode_vrefresh);
+	is_vrr =
+		intel_vrr_is_in_range(connector,
+				      drm_mode_vrefresh(adjusted_mode)) &&
+		intel_vrr_is_in_range(connector,
+				      drm_mode_vrefresh(fixed_mode));
 
 	if (!is_vrr) {
 		/*
@@ -225,11 +255,12 @@ int intel_panel_compute_config(struct intel_connector *connector,
 		 * for Xorg since it likes to automagically cook up modes with slightly
 		 * off refresh rates.
 		 */
-		if (abs(vrefresh - fixed_mode_vrefresh) > 1) {
+		if (abs(vrefresh_int - fixed_mode_vrefresh_int) > 1) {
 			drm_dbg_kms(connector->base.dev,
 				    "[CONNECTOR:%d:%s] Requested mode vrefresh (%d Hz) does not match fixed mode vrefresh (%d Hz)\n",
 				    connector->base.base.id, connector->base.name,
-				    vrefresh, fixed_mode_vrefresh);
+				    DIV_ROUND_UP(vrefresh_k, 1000),
+					DIV_ROUND_UP(fixed_mode_vrefresh_k, 1000));
 
 			return -EINVAL;
 		}
@@ -237,10 +268,12 @@ int intel_panel_compute_config(struct intel_connector *connector,
 
 	drm_mode_copy(adjusted_mode, fixed_mode);
 
-	if (is_vrr && fixed_mode_vrefresh != vrefresh)
+	if (is_vrr && fixed_mode_vrefresh_k != vrefresh_k)
 		adjusted_mode->vtotal =
-			DIV_ROUND_CLOSEST(adjusted_mode->clock * 1000,
-					  adjusted_mode->htotal * vrefresh);
+			mul_u64_u32_div(adjusted_mode->clock * 1000,
+					FIXED_POINT_PRECISION,
+					adjusted_mode->htotal *
+					(vrefresh_int * FIXED_POINT_PRECISION + vrefresh_fraction));
 
 	drm_mode_set_crtcinfo(adjusted_mode, 0);
 
drivers/gpu/drm/i915/display/intel_vrr.h +2 -0
index 89937858200d..4bfabaac9ac8 100644
@@ -13,6 +13,8 @@ struct intel_atomic_state;
 struct intel_connector;
 struct intel_crtc_state;
 
+#define FIXED_POINT_PRECISION	100
+
 bool intel_vrr_is_capable(struct intel_connector *connector);
 bool intel_vrr_is_in_range(struct intel_connector *connector, int vrefresh);
 void intel_vrr_check_modeset(struct intel_atomic_state *state);
Signature · 1 line
2.25.1
#2 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for Update vtotal based on closest possible panel timings

In reply to Mitul Golani
== Series Details ==

== Series Details ==

Series: Update vtotal based on closest possible panel timings
URL : https://patchwork.freedesktop.org/series/126839/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_13918 -> Patchwork_126839v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_126839v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_126839v1, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/index.html

Participating hosts (37 -> 37)
------------------------------

Additional (2): bat-dg2-8 fi-pnv-d510
Missing (2): bat-kbl-2 fi-snb-2520m

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_126839v1:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live@reset:
- fi-apl-guc: [PASS][1] -> [DMESG-WARN][2] +36 other tests dmesg-warn
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13918/fi-apl-guc/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/fi-apl-guc/igt@i915_selftest@[email protected]

Known issues
------------

Here are the changes found in Patchwork_126839v1 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_lmem_swapping@basic:
- fi-pnv-d510: NOTRUN -> [SKIP][3] ([fdo#109271]) +25 other tests skip
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/fi-pnv-d510/igt@[email protected]

* igt@gem_mmap@basic:
- bat-dg2-8: NOTRUN -> [SKIP][4] ([i915#4083])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@gem_mmap_gtt@basic:
- bat-dg2-8: NOTRUN -> [SKIP][5] ([i915#4077]) +2 other tests skip
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@gem_tiled_pread_basic:
- bat-dg2-8: NOTRUN -> [SKIP][6] ([i915#4079]) +1 other test skip
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@gem_tiled_pread_basic.html

* igt@i915_module_load@reload:
- fi-apl-guc: [PASS][7] -> [DMESG-WARN][8] ([i915#180] / [i915#1982] / [i915#8585])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13918/fi-apl-guc/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/fi-apl-guc/igt@[email protected]

* igt@i915_pm_rpm@module-reload:
- fi-apl-guc: [PASS][9] -> [DMESG-WARN][10] ([i915#180] / [i915#8585]) +1 other test dmesg-warn
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13918/fi-apl-guc/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/fi-apl-guc/igt@[email protected]

* igt@i915_pm_rps@basic-api:
- bat-dg1-7: NOTRUN -> [SKIP][11] ([i915#6621])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]
- bat-dg2-8: NOTRUN -> [SKIP][12] ([i915#6621])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- bat-dg2-8: NOTRUN -> [SKIP][13] ([i915#6645])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@kms_addfb_basic@addfb25-y-tiled-small-legacy:
- bat-dg2-8: NOTRUN -> [SKIP][14] ([i915#5190])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@kms_addfb_basic@basic-y-tiled-legacy:
- bat-dg2-8: NOTRUN -> [SKIP][15] ([i915#4215] / [i915#5190])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@kms_addfb_basic@framebuffer-vs-set-tiling:
- bat-dg2-8: NOTRUN -> [SKIP][16] ([i915#4212]) +6 other tests skip
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@kms_addfb_basic@tile-pitch-mismatch:
- bat-dg2-8: NOTRUN -> [SKIP][17] ([i915#4212] / [i915#5608])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- bat-dg2-8: NOTRUN -> [SKIP][18] ([i915#4103] / [i915#4213] / [i915#5608]) +1 other test skip
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- bat-dg2-8: NOTRUN -> [SKIP][19] ([fdo#109285])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]
- bat-dg1-7: NOTRUN -> [SKIP][20] ([fdo#109285])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]

* igt@kms_force_connector_basic@prune-stale-modes:
- bat-dg2-8: NOTRUN -> [SKIP][21] ([i915#5274])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- bat-dg1-7: NOTRUN -> [SKIP][22] ([i915#4078] / [i915#4342])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]

* igt@kms_hdmi_inject@inject-audio:
- bat-dg1-7: NOTRUN -> [SKIP][23] ([i915#433])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-xr24:
- bat-dg1-7: NOTRUN -> [SKIP][24] ([i915#1845]) +1 other test skip
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]

* igt@kms_pipe_crc_basic@nonblocking-crc:
- bat-dg1-7: NOTRUN -> [SKIP][25] ([i915#1845] / [i915#4078]) +5 other tests skip
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-frame-sequence@pipe-d-edp-1:
- bat-rplp-1: [PASS][26] -> [ABORT][27] ([i915#8668])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13918/bat-rplp-1/igt@kms_pipe_crc_basic@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-rplp-1/igt@kms_pipe_crc_basic@[email protected]

* igt@kms_setmode@basic-clone-single-crtc:
- bat-dg2-8: NOTRUN -> [SKIP][28] ([i915#3555] / [i915#4098])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]
- bat-dg1-7: NOTRUN -> [SKIP][29] ([i915#3555])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]

* igt@prime_vgem@basic-fence-flip:
- bat-dg1-7: NOTRUN -> [SKIP][30] ([i915#1845] / [i915#3708])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]
- bat-dg2-8: NOTRUN -> [SKIP][31] ([i915#3708])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@prime_vgem@basic-fence-mmap:
- bat-dg1-7: NOTRUN -> [SKIP][32] ([i915#3708] / [i915#4077]) +1 other test skip
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]
- bat-dg2-8: NOTRUN -> [SKIP][33] ([i915#3708] / [i915#4077]) +1 other test skip
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

* igt@prime_vgem@basic-fence-read:
- bat-dg1-7: NOTRUN -> [SKIP][34] ([i915#3708]) +2 other tests skip
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]

* igt@prime_vgem@basic-write:
- bat-dg2-8: NOTRUN -> [SKIP][35] ([i915#3291] / [i915#3708]) +2 other tests skip
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg2-8/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_suspend@basic-s0@smem:
- bat-jsl-3: [INCOMPLETE][36] ([i915#9275]) -> [PASS][37]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13918/bat-jsl-3/igt@gem_exec_suspend@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-jsl-3/igt@gem_exec_suspend@[email protected]

* igt@i915_suspend@basic-s3-without-i915:
- bat-jsl-3: [FAIL][38] ([fdo#103375]) -> [PASS][39]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13918/bat-jsl-3/igt@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-jsl-3/igt@[email protected]

* igt@kms_force_connector_basic@force-connector-state:
- bat-dg1-7: [ABORT][40] -> [PASS][41]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13918/bat-dg1-7/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-dg1-7/igt@[email protected]

* igt@kms_pipe_crc_basic@hang-read-crc@pipe-c-dp-5:
- bat-adlp-11: [DMESG-WARN][42] ([i915#4309]) -> [PASS][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13918/bat-adlp-11/igt@kms_pipe_crc_basic@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/bat-adlp-11/igt@kms_pipe_crc_basic@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4309]: https://gitlab.freedesktop.org/drm/intel/issues/4309
[i915#433]: https://gitlab.freedesktop.org/drm/intel/issues/433
[i915#4342]: https://gitlab.freedesktop.org/drm/intel/issues/4342
[i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5608]: https://gitlab.freedesktop.org/drm/intel/issues/5608
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6645]: https://gitlab.freedesktop.org/drm/intel/issues/6645
[i915#8585]: https://gitlab.freedesktop.org/drm/intel/issues/8585
[i915#8668]: https://gitlab.freedesktop.org/drm/intel/issues/8668
[i915#9275]: https://gitlab.freedesktop.org/drm/intel/issues/9275
[i915#9673]: https://gitlab.freedesktop.org/drm/intel/issues/9673

Build changes
-------------

* Linux: CI_DRM_13918 -> Patchwork_126839v1

CI-20190529: 20190529
CI_DRM_13918: 30646f42536dc0986ef8b5339d37a958d0358dab @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7600: b889fd01780dc79f6fcc8545346c81f5c79f5efb @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_126839v1: 30646f42536dc0986ef8b5339d37a958d0358dab @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

56fd8d106fee drm/i915/display: Update vtotal based on closest possible panel timings

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_126839v1/index.html