Skip to contentSkip to conversation

drm/i915: Use intel_plane_data_rate for min_cdclk calculation

PATCH Superseded Stanislav Lisovskiy 2 participants 2 messages Feb 21, 2020

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drm/i915: Use intel_plane_data_rate for min_cdclk calculation

There seems to be a bit of confusing redundancy in a way, how plane data rate/min cdclk are calculated.
In fact both min cdclk, pixel rate and plane data rate are all part of the same formula as per BSpec.

However currently we have intel_plane_data_rate, which is used to calculate plane data rate and which is also used in bandwidth calculations. However for calculating min_cdclk we have another piece of code, doing almost same calculation, but a bit differently and in a different place. However as both are actually part of same formula, probably would be wise to use plane data rate calculations as a basis anyway, thus avoiding code duplication and possible bugs related to this.

Another thing is that I've noticed that during min_cdclk calculations we account for plane scaling, while for plane data rate, we don't. crtc->pixel_rate seems to account only for pipe ratio, however it is clearly stated in BSpec that plane data rate also need to account plane ratio as well.

So what this commit does is:
- Adds a plane ratio calculation to intel_plane_data_rate
- Removes redundant calculations from skl_plane_min_cdclk which is used for gen9+ and now uses intel_plane_data_rate as a basis from there as well.

v2: - Don't use 64 division if not needed(Ville Syrjälä)
- Now use intel_plane_pixel_rate as a basis for calculations both at intel_plane_data_rate and skl_plane_min_cdclk(Ville Syrjälä)

v3: - Again fix the division macro
- Fix plane_pixel_rate to pixel_rate at intel_plane_pixel_rate callsites

---
 .../gpu/drm/i915/display/intel_atomic_plane.c | 22 +++++++++++++++++-
 .../gpu/drm/i915/display/intel_atomic_plane.h |  3 +++
 drivers/gpu/drm/i915/display/intel_sprite.c   | 23 +++++--------------
 3 files changed, 30 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic_plane.c +21 -1
index c86d7a35c816..5f56cdc628aa 100644
@@ -133,11 +133,31 @@ intel_plane_destroy_state(struct drm_plane *plane,
 	kfree(plane_state);
 }
 
+unsigned int intel_plane_pixel_rate(const struct intel_crtc_state *crtc_state,
+				    const struct intel_plane_state *plane_state)
+{
+	unsigned int src_w, src_h, dst_w, dst_h;
+
+	src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
+	src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
+	dst_w = drm_rect_width(&plane_state->uapi.dst);
+	dst_h = drm_rect_height(&plane_state->uapi.dst);
+
+	/* Downscaling limits the maximum pixel rate */
+	dst_w = min(src_w, dst_w);
+	dst_h = min(src_h, dst_h);
+
+	return DIV_ROUND_UP_ULL(mul_u32_u32(crtc_state->pixel_rate,
+				src_w * src_h),
+				dst_w * dst_h);
+}
+
 unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state,
 				   const struct intel_plane_state *plane_state)
 {
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
 	unsigned int cpp;
+	unsigned int pixel_rate = intel_plane_pixel_rate(crtc_state, plane_state);
 
 	if (!plane_state->uapi.visible)
 		return 0;
@@ -153,7 +173,7 @@ unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state,
 	if (fb->format->is_yuv && fb->format->num_planes > 1)
 		cpp *= 4;
 
-	return cpp * crtc_state->pixel_rate;
+	return pixel_rate * cpp;
 }
 
 int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
drivers/gpu/drm/i915/display/intel_atomic_plane.h +3 -0
index 2bcf15e34728..a6bbf42bae1f 100644
@@ -18,6 +18,9 @@ struct intel_plane_state;
 
 extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;
 
+unsigned int intel_plane_pixel_rate(const struct intel_crtc_state *crtc_state,
+				    const struct intel_plane_state *plane_state);
+
 unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state,
 				   const struct intel_plane_state *plane_state);
 void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
drivers/gpu/drm/i915/display/intel_sprite.c +6 -17
index 7abeefe8dce5..2c0afb802f18 100644
@@ -330,9 +330,9 @@ bool icl_is_hdr_plane(struct drm_i915_private *dev_priv, enum plane_id plane_id)
 }
 
 static void
-skl_plane_ratio(const struct intel_crtc_state *crtc_state,
-		const struct intel_plane_state *plane_state,
-		unsigned int *num, unsigned int *den)
+skl_plane_pixel_rate_divisors(const struct intel_crtc_state *crtc_state,
+			      const struct intel_plane_state *plane_state,
+			      unsigned int *num, unsigned int *den)
 {
 	struct drm_i915_private *dev_priv = to_i915(plane_state->uapi.plane->dev);
 	const struct drm_framebuffer *fb = plane_state->hw.fb;
@@ -355,27 +355,16 @@ static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
 			       const struct intel_plane_state *plane_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(plane_state->uapi.plane->dev);
-	unsigned int pixel_rate = crtc_state->pixel_rate;
-	unsigned int src_w, src_h, dst_w, dst_h;
 	unsigned int num, den;
+	int pixel_rate = intel_plane_pixel_rate(crtc_state, plane_state);
 
-	skl_plane_ratio(crtc_state, plane_state, &num, &den);
+	skl_plane_pixel_rate_divisors(crtc_state, plane_state, &num, &den);
 
 	/* two pixels per clock on glk+ */
 	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
 		den *= 2;
 
-	src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
-	src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
-	dst_w = drm_rect_width(&plane_state->uapi.dst);
-	dst_h = drm_rect_height(&plane_state->uapi.dst);
-
-	/* Downscaling limits the maximum pixel rate */
-	dst_w = min(src_w, dst_w);
-	dst_h = min(src_h, dst_h);
-
-	return DIV64_U64_ROUND_UP(mul_u32_u32(pixel_rate * num, src_w * src_h),
-				  mul_u32_u32(den, dst_w * dst_h));
+	return DIV_ROUND_UP(pixel_rate * num, den);
 }
 
 static unsigned int
Signature · 6 lines
2.24.1.485.gad05a3d8e5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Use intel_plane_data_rate for min_cdclk calculation (rev3)

== Series Details ==

== Series Details ==

Series: drm/i915: Use intel_plane_data_rate for min_cdclk calculation (rev3)
URL : https://patchwork.freedesktop.org/series/73718/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7983 -> Patchwork_16664
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_16664, please notify your bug team 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_16664/index.html

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

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

### IGT changes ###

#### Possible regressions ####

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-pnv-d510: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-pnv-d510/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-pnv-d510/igt@[email protected]
- fi-gdg-551: [PASS][3] -> [DMESG-WARN][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-gdg-551/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-gdg-551/igt@[email protected]
- fi-bwr-2160: [PASS][5] -> [DMESG-WARN][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-bwr-2160/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-bwr-2160/igt@[email protected]
- fi-blb-e6850: [PASS][7] -> [DMESG-WARN][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-blb-e6850/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-blb-e6850/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* {igt@kms_busy@basic@flip}:
- fi-icl-guc: [PASS][9] -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-icl-guc/igt@kms_busy@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-icl-guc/igt@kms_busy@[email protected]
- fi-hsw-4770: [PASS][11] -> [INCOMPLETE][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-hsw-4770/igt@kms_busy@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-hsw-4770/igt@kms_busy@[email protected]
- {fi-tgl-u}: [PASS][13] -> [INCOMPLETE][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-tgl-u/igt@kms_busy@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-tgl-u/igt@kms_busy@[email protected]
- fi-cfl-guc: [PASS][15] -> [INCOMPLETE][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-cfl-guc/igt@kms_busy@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-cfl-guc/igt@kms_busy@[email protected]
- fi-bsw-n3050: [PASS][17] -> [INCOMPLETE][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-bsw-n3050/igt@kms_busy@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-bsw-n3050/igt@kms_busy@[email protected]
- fi-skl-guc: [PASS][19] -> [INCOMPLETE][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-skl-guc/igt@kms_busy@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-skl-guc/igt@kms_busy@[email protected]
- fi-ilk-650: [PASS][21] -> [INCOMPLETE][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-ilk-650/igt@kms_busy@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-ilk-650/igt@kms_busy@[email protected]
- fi-ivb-3770: [PASS][23] -> [INCOMPLETE][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-ivb-3770/igt@kms_busy@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-ivb-3770/igt@kms_busy@[email protected]
- fi-icl-y: [PASS][25] -> [INCOMPLETE][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-icl-y/igt@kms_busy@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-icl-y/igt@kms_busy@[email protected]
- fi-hsw-4770r: [PASS][27] -> [INCOMPLETE][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-hsw-4770r/igt@kms_busy@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-hsw-4770r/igt@kms_busy@[email protected]
- fi-skl-6700k2: [PASS][29] -> [INCOMPLETE][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-skl-6700k2/igt@kms_busy@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-skl-6700k2/igt@kms_busy@[email protected]
- fi-icl-u2: [PASS][31] -> [INCOMPLETE][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-icl-u2/igt@kms_busy@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-icl-u2/igt@kms_busy@[email protected]
- fi-hsw-peppy: [PASS][33] -> [INCOMPLETE][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-hsw-peppy/igt@kms_busy@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-hsw-peppy/igt@kms_busy@[email protected]
- fi-cfl-8700k: [PASS][35] -> [INCOMPLETE][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-cfl-8700k/igt@kms_busy@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-cfl-8700k/igt@kms_busy@[email protected]
- fi-snb-2520m: [PASS][37] -> [INCOMPLETE][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-snb-2520m/igt@kms_busy@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-snb-2520m/igt@kms_busy@[email protected]
- fi-icl-dsi: [PASS][39] -> [INCOMPLETE][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-icl-dsi/igt@kms_busy@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-icl-dsi/igt@kms_busy@[email protected]
- fi-bsw-kefka: [PASS][41] -> [INCOMPLETE][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-bsw-kefka/igt@kms_busy@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-bsw-kefka/igt@kms_busy@[email protected]
- fi-bdw-5557u: [PASS][43] -> [INCOMPLETE][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-bdw-5557u/igt@kms_busy@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-bdw-5557u/igt@kms_busy@[email protected]
- fi-skl-6600u: [PASS][45] -> [INCOMPLETE][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-skl-6600u/igt@kms_busy@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-skl-6600u/igt@kms_busy@[email protected]
- fi-kbl-x1275: [PASS][47] -> [INCOMPLETE][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-kbl-x1275/igt@kms_busy@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-kbl-x1275/igt@kms_busy@[email protected]
- fi-cfl-8109u: [PASS][49] -> [INCOMPLETE][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-cfl-8109u/igt@kms_busy@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-cfl-8109u/igt@kms_busy@[email protected]
- fi-kbl-7500u: [PASS][51] -> [INCOMPLETE][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-kbl-7500u/igt@kms_busy@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-kbl-7500u/igt@kms_busy@[email protected]
- fi-skl-lmem: [PASS][53] -> [INCOMPLETE][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-skl-lmem/igt@kms_busy@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-skl-lmem/igt@kms_busy@[email protected]
- fi-kbl-r: [PASS][55] -> [INCOMPLETE][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-kbl-r/igt@kms_busy@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-kbl-r/igt@kms_busy@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@kms_addfb_basic@addfb25-yf-tiled:
- fi-tgl-y: [PASS][57] -> [DMESG-WARN][58] ([CI#94] / [i915#402])
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-tgl-y/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-tgl-y/igt@[email protected]

#### Possible fixes ####

* igt@gem_close_race@basic-threads:
- fi-byt-j1900: [INCOMPLETE][59] ([i915#45]) -> [PASS][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-byt-j1900/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-byt-j1900/igt@[email protected]

* igt@gem_exec_suspend@basic-s4-devices:
- fi-tgl-y: [FAIL][61] ([CI#94]) -> [PASS][62]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-tgl-y/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-tgl-y/igt@[email protected]

* igt@gem_mmap_gtt@basic:
- fi-tgl-y: [DMESG-WARN][63] ([CI#94] / [i915#402]) -> [PASS][64]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7983/fi-tgl-y/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/fi-tgl-y/igt@[email protected]

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

[CI#94]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/94
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[i915#283]: https://gitlab.freedesktop.org/drm/intel/issues/283
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#45]: https://gitlab.freedesktop.org/drm/intel/issues/45
[i915#58]: https://gitlab.freedesktop.org/drm/intel/issues/58
[i915#585]: https://gitlab.freedesktop.org/drm/intel/issues/585
[i915#82]: https://gitlab.freedesktop.org/drm/intel/issues/82
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (51 -> 44)
------------------------------

Missing (7): fi-ilk-m540 fi-ehl-1 fi-hsw-4200u fi-byt-squawks fi-ctg-p8600 fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_7983 -> Patchwork_16664

CI-20190529: 20190529
CI_DRM_7983: 85ccd7de7d75735a667c4133b0927481986a2a1c @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5458: 5f7e4ae6a91ed2c104593b8abd5b71a6cc96fc10 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16664: 999b67585942412202ea993b3249d342e4e45313 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

999b67585942 drm/i915: Use intel_plane_data_rate for min_cdclk calculation

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16664/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx