drm/i915: Use intel_plane_data_rate for min_cdclk calculation
Subsystems (3)
PATCH v2 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ä)
--- .../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 | 26 +++++++------------ 3 files changed, 33 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic_plane.c +21 -1
@@ -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 (mul_u32_u32 (crtc_state->pixel_rate, + src_w * src_h), +mul_u32_u32 (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 plane_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 mul_u32_u32 (plane_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
@@ -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 +9 -17
@@ -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_bpp_constraints (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,19 @@ 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 plane_pixel_rate =intel_plane_pixel_rate (crtc_state, plane_state); -skl_plane_ratio (crtc_state, plane_state, &num, &den); +skl_plane_bpp_constraints (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)); +/* +* Plane pixel rate is a pipe pixel rate * plane ratio * pipe ratio +*/ +return DIV64_U64_ROUND_UP (plane_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
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Use intel_plane_data_rate for min_cdclk calculation (rev2)
== Series Details ==
== Series Details ==
Series: drm/i915: Use intel_plane_data_rate for min_cdclk calculation (rev2)
URL : https://patchwork.freedesktop.org/series/73718/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7975 -> Patchwork_16647
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_16647 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_16647, 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_16647/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_16647:
### 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_7975/fi-pnv-d510/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/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_7975/fi-gdg-551/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-gdg-551/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][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-icl-guc/igt@kms_busy@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-icl-guc/igt@kms_busy@[email protected]
- fi-hsw-4770: [PASS][7] -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-hsw-4770/igt@kms_busy@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-hsw-4770/igt@kms_busy@[email protected]
- {fi-tgl-u}: [PASS][9] -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-tgl-u/igt@kms_busy@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-tgl-u/igt@kms_busy@[email protected]
- {fi-kbl-7560u}: NOTRUN -> [INCOMPLETE][11]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-kbl-7560u/igt@kms_busy@[email protected]
- fi-cfl-guc: [PASS][12] -> [INCOMPLETE][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-cfl-guc/igt@kms_busy@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-cfl-guc/igt@kms_busy@[email protected]
- fi-bsw-n3050: [PASS][14] -> [INCOMPLETE][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-bsw-n3050/igt@kms_busy@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-bsw-n3050/igt@kms_busy@[email protected]
- fi-skl-guc: [PASS][16] -> [INCOMPLETE][17]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-skl-guc/igt@kms_busy@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-skl-guc/igt@kms_busy@[email protected]
- fi-ilk-650: [PASS][18] -> [INCOMPLETE][19]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-ilk-650/igt@kms_busy@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-ilk-650/igt@kms_busy@[email protected]
- fi-icl-y: [PASS][20] -> [INCOMPLETE][21]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-icl-y/igt@kms_busy@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-icl-y/igt@kms_busy@[email protected]
- fi-hsw-4770r: [PASS][22] -> [INCOMPLETE][23]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-hsw-4770r/igt@kms_busy@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-hsw-4770r/igt@kms_busy@[email protected]
- fi-skl-6700k2: [PASS][24] -> [INCOMPLETE][25]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-skl-6700k2/igt@kms_busy@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-skl-6700k2/igt@kms_busy@[email protected]
- fi-icl-u2: [PASS][26] -> [INCOMPLETE][27]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-icl-u2/igt@kms_busy@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-icl-u2/igt@kms_busy@[email protected]
- fi-hsw-peppy: [PASS][28] -> [INCOMPLETE][29]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-hsw-peppy/igt@kms_busy@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-hsw-peppy/igt@kms_busy@[email protected]
- fi-cfl-8700k: [PASS][30] -> [INCOMPLETE][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-cfl-8700k/igt@kms_busy@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-cfl-8700k/igt@kms_busy@[email protected]
- {fi-tgl-dsi}: NOTRUN -> [INCOMPLETE][32]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-tgl-dsi/igt@kms_busy@[email protected]
- fi-snb-2520m: NOTRUN -> [INCOMPLETE][33]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-snb-2520m/igt@kms_busy@[email protected]
- fi-icl-dsi: [PASS][34] -> [INCOMPLETE][35]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-icl-dsi/igt@kms_busy@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-icl-dsi/igt@kms_busy@[email protected]
- fi-bsw-kefka: [PASS][36] -> [INCOMPLETE][37]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-bsw-kefka/igt@kms_busy@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-bsw-kefka/igt@kms_busy@[email protected]
- fi-bdw-5557u: [PASS][38] -> [INCOMPLETE][39]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-bdw-5557u/igt@kms_busy@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-bdw-5557u/igt@kms_busy@[email protected]
- fi-kbl-x1275: [PASS][40] -> [INCOMPLETE][41]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-kbl-x1275/igt@kms_busy@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-kbl-x1275/igt@kms_busy@[email protected]
- fi-cfl-8109u: [PASS][42] -> [INCOMPLETE][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-cfl-8109u/igt@kms_busy@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-cfl-8109u/igt@kms_busy@[email protected]
- fi-kbl-7500u: [PASS][44] -> [INCOMPLETE][45]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-kbl-7500u/igt@kms_busy@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-kbl-7500u/igt@kms_busy@[email protected]
- {fi-ehl-1}: [PASS][46] -> [INCOMPLETE][47]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-ehl-1/igt@kms_busy@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-ehl-1/igt@kms_busy@[email protected]
- fi-skl-lmem: [PASS][48] -> [INCOMPLETE][49]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-skl-lmem/igt@kms_busy@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-skl-lmem/igt@kms_busy@[email protected]
- fi-kbl-r: NOTRUN -> [INCOMPLETE][50]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-kbl-r/igt@kms_busy@[email protected]
Known issues
------------
Here are the changes found in Patchwork_16647 that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@gem_close_race@basic-threads:
- fi-hsw-4770r: [TIMEOUT][51] ([fdo#112271] / [i915#1084]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-hsw-4770r/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-hsw-4770r/igt@[email protected]
- fi-byt-n2820: [INCOMPLETE][53] ([i915#45]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7975/fi-byt-n2820/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/fi-byt-n2820/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
[fdo#112271]: https://bugs.freedesktop.org/show_bug.cgi?id=112271
[i915#1084]: https://gitlab.freedesktop.org/drm/intel/issues/1084
[i915#283]: https://gitlab.freedesktop.org/drm/intel/issues/283
[i915#45]: https://gitlab.freedesktop.org/drm/intel/issues/45
[i915#585]: https://gitlab.freedesktop.org/drm/intel/issues/585
Participating hosts (47 -> 42)
------------------------------
Additional (5): fi-tgl-dsi fi-glk-dsi fi-snb-2520m fi-kbl-7560u fi-kbl-r
Missing (10): fi-ilk-m540 fi-bdw-samus fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-ivb-3770 fi-blb-e6850 fi-byt-clapper fi-skl-6600u fi-snb-2600
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7975 -> Patchwork_16647
CI-20190529: 20190529
CI_DRM_7975: f66891f7bdc3c60bb6f06fd6bc0718a0bd975896 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5453: cae9a5881ed2c5be2c2518a255740b612a927f9a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16647: c72d584adc34fccaacf86b8c033093ade8f9d71a @ git://anongit.freedesktop.org/gfx-ci/linux
== Kernel 32bit build ==
Warning: Kernel 32bit buildtest failed:
https://intel-gfx-ci.01.org/Patchwork_16647/build_32bit.log
CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.h
Kernel: arch/x86/boot/bzImage is ready (#1)
MODPOST 121 modules
ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined! scripts/Makefile.modpost:93: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1281: recipe for target 'modules' failed
make: *** [modules] Error 2
== Linux commits ==
c72d584adc34 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_16647/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: warning for drm/i915: Use intel_plane_data_rate for min_cdclk calculation (rev2)
In reply to Stanislav Lisovskiy== Series Details ==
== Series Details ==
Series: drm/i915: Use intel_plane_data_rate for min_cdclk calculation (rev2)
URL : https://patchwork.freedesktop.org/series/73718/
State : warning
== Summary ==
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
CHK include/generated/compile.h
Kernel: arch/x86/boot/bzImage is ready (#1)
MODPOST 121 modules
ERROR: "__udivdi3" [drivers/gpu/drm/i915/i915.ko] undefined! scripts/Makefile.modpost:93: recipe for target '__modpost' failed make[1]: *** [__modpost] Error 1
Makefile:1281: recipe for target 'modules' failed
make: *** [modules] Error 2
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16647/build_32bit.log
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 50 lines · Stanislav Lisovskiy
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 calculatingmin_cdclkwe 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_cdclkcalculations we account for plane scaling, while for plane data rate, we don't.crtc->pixel_rateseems 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 tointel_plane_data_rate
- Removes redundant calculations fromskl_plane_min_cdclkwhich is used for gen9+ and now usesintel_plane_data_rateas a basis from there as well.v2: - Don't use 64 division if not needed(Ville Syrjälä)
- Now useintel_plane_pixel_rateas a basis for calculations both atintel_plane_data_rateandskl_plane_min_cdclk(Ville Syrjälä)Signed-off-by Stanislav Lisovskiy <[email protected]>--- .../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 | 26 +++++++------------ 3 files changed, 33 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/display/intel_atomic_plane.c +5
-0@@ -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; +
drivers/gpu/drm/i915/display/intel_atomic_plane.c intel_plane_destroy_state(struct drm_plane *plane, · line 150
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +10
-0+ 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(mul_u32_u32(crtc_state->pixel_rate,
Wrong macro for 64/32->32 division.
drivers/gpu/drm/i915/display/intel_atomic_plane.c intel_plane_destroy_state(struct drm_plane *plane, · line 152
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +2
-0+ src_w * src_h), + mul_u32_u32(dst_w, dst_h));
And the divisor shouldn't be a u64.
drivers/gpu/drm/i915/display/intel_atomic_plane.c intel_plane_destroy_state(struct drm_plane *plane, · line 160
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +3
-0+} +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 plane_pixel_rate =intel_plane_pixel_rate (crtc_state, plane_state);
Just 'pixel_rate' should do. We know the rest from the fact that this is a plane function. Also I'd put this first so the declaration block looks at least a bit less messy.
drivers/gpu/drm/i915/display/intel_atomic_plane.c unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state, · line 176
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +1
-1if (!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 mul_u32_u32 (plane_pixel_rate, cpp);
We're not returning a u64.
Quoted 22 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +0
-0} int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,drivers/gpu/drm/i915/display/intel_atomic_plane.h +3
-0@@ -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 +0
-0
drivers/gpu/drm/i915/display/intel_sprite.c bool icl_is_hdr_plane(struct drm_i915_private *dev_priv, enum plane_id plane_id) · line 335
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_sprite.c +3
-3@@ -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_bpp_constraints (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state, +unsigned int *num,unsigned int *den)
Bogus rename.
drivers/gpu/drm/i915/display/intel_sprite.c static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state, · line 359
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_sprite.c +1
-2{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,19 @@ 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 plane_pixel_rate =intel_plane_pixel_rate (crtc_state, plane_state);
same comments as for the other call site.
Quoted 12 lines
drivers/gpu/drm/i915/display/intel_sprite.c +1
-5-skl_plane_ratio (crtc_state, plane_state, &num, &den); +skl_plane_bpp_constraints (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);
drivers/gpu/drm/i915/display/intel_sprite.c static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state, · line 369
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +3
-7- -/* 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)); +/* +* Plane pixel rate is a pipe pixel rate * plane ratio * pipe ratio +*/
Should be obvious.
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_sprite.c +1
-0+return DIV64_U64_ROUND_UP (plane_pixel_rate * num, den); } static unsigned intSignature · 1 line
2.24.1.485.gad05a3d8e5
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 65 lines · Ville Syrjälä
Quoted 64 lines · Stanislav Lisovskiy
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 calculatingmin_cdclkwe 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_cdclkcalculations
we account for plane scaling, while for plane data rate, we don't.crtc->pixel_rateseems 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 tointel_plane_data_rate
- Removes redundant calculations fromskl_plane_min_cdclkwhich is used for gen9+ and now usesintel_plane_data_rateas a basis from there as well.v2: - Don't use 64 division if not needed(Ville Syrjälä)
- Now useintel_plane_pixel_rateas a basis for calculations
both
atintel_plane_data_rateand skl_plane_min_cdclk(Ville
Syrjälä)Signed-off-by Stanislav Lisovskiy <[email protected]>--- .../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 | 26 +++++++------ ------ 3 files changed, 33 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/display/intel_atomic_plane.c +9
-0@@ -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);
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c intel_plane_destroy_state(struct drm_plane *plane, · line 150
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +6
-0+ +/* Downscaling limits the maximum pixel rate */ + dst_w =min (src_w, dst_w); + dst_h =min (src_h, dst_h); + + return DIV_ROUND_UP(mul_u32_u32(crtc_state->pixel_rate,Wrong macro for 64/32->32 division.
Yes, in fact we should use 64 macro here still.
As I understand pixel rate is stored in kHz so for instance for pixel rate 172800 * 4K * 4K we already overflowing u32. Was just a bit confused with prev comment :)
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c intel_plane_destroy_state(struct drm_plane *plane, · line 152
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +2
-0+ src_w * src_h), + mul_u32_u32(dst_w, dst_h));And the divisor shouldn't be a u64.
Agree divisor is not, however divident is 64.
Quoted 63 lines
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +3
-0+} +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 plane_pixel_rate =Quoted 1 line
intel_plane_pixel_rate(crtc_state, plane_state);Just '
pixel_rate' should do. We know the rest from the fact that this is a plane function. Also I'd put this first so the declaration block looks at least a bit less messy.drivers/gpu/drm/i915/display/intel_atomic_plane.c unsigned int intel_plane_data_rate(const struct · line 177
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +1
-1if (!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 mul_u32_u32 (plane_pixel_rate, cpp);We're not returning a u64.
Quoted 33 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +0
-0}int intel_plane_calc_min_cdclk(struct
intel_atomic_state*state,drivers/gpu/drm/i915/display/intel_atomic_plane.h +3
-0@@ -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 structintel_plane_state*plane_state);
void intel_plane_copy_uapi_to_hw_state(structintel_plane_state*plane_state,drivers/gpu/drm/i915/display/intel_sprite.c +0
-0@@ -330,9 +330,9 @@ bool icl_is_hdr_plane(struct drm_i915_private *dev_priv, enum plane_id plane_id) }
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c bool icl_is_hdr_plane(struct drm_i915_private *dev_priv, enum plane_id plane_id) · line 335
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_sprite.c +3
-3static 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_bpp_constraints (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state, +unsigned int *num,unsigned int *den)Bogus rename.
Well, I guess you agree, that this function is not returning plane_ratio either :) Was just wondering if it has to be named somewhat differently.
Stan
Quoted 47 lines
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_sprite.c +0
-0{struct
drm_i915_private*dev_priv= to_i915(plane_state-Quoted 1 line
uapi.plane->dev);drivers/gpu/drm/i915/display/intel_sprite.c +0
-0const struct drm_framebuffer *fb = plane_state->hw.fb;@@ -355,27 +355,19 @@ static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state,drivers/gpu/drm/i915/display/intel_sprite.c static int skl_plane_min_cdclk(const struct · line 363
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +1
-2const 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 plane_pixel_rate =intel_plane_pixel_rate (crtc_state, plane_state);same comments as for the other call site.
Quoted 23 lines
drivers/gpu/drm/i915/display/intel_sprite.c +3
-12-skl_plane_ratio (crtc_state, plane_state, &num, &den); +skl_plane_bpp_constraints (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)); +/* +* Plane pixel rate is a pipe pixel rate * plane ratio * pipe ratio
drivers/gpu/drm/i915/display/intel_sprite.c static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state, · line 369
Quoted 1 line
drivers/gpu/drm/i915/display/intel_sprite.c +1
-0+*/ Should be obvious.
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_sprite.c +1
-0+return DIV64_U64_ROUND_UP (plane_pixel_rate * num, den); } static unsigned intSignature · 1 line
2.24.1.485.gad05a3d8e5
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 161 lines · Stanislav
Quoted 65 lines · Ville Syrjälä
Quoted 64 lines · Stanislav Lisovskiy
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 calculatingmin_cdclkwe 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_cdclkcalculations
we account for plane scaling, while for plane data rate, we don't.crtc->pixel_rateseems 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 tointel_plane_data_rate
- Removes redundant calculations fromskl_plane_min_cdclkwhich is used for gen9+ and now usesintel_plane_data_rateas a basis from there as well.v2: - Don't use 64 division if not needed(Ville Syrjälä)
- Now useintel_plane_pixel_rateas a basis for calculations
both
atintel_plane_data_rateand skl_plane_min_cdclk(Ville
Syrjälä)Signed-off-by Stanislav Lisovskiy <[email protected]>--- .../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 | 26 +++++++------ ------ 3 files changed, 33 insertions(+), 18 deletions(-)drivers/gpu/drm/i915/display/intel_atomic_plane.c +9
-0@@ -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);Quoted 8 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c intel_plane_destroy_state(struct drm_plane *plane, · line 150
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +6
-0+ +/* Downscaling limits the maximum pixel rate */ + dst_w =min (src_w, dst_w); + dst_h =min (src_h, dst_h); + + return DIV_ROUND_UP(mul_u32_u32(crtc_state->pixel_rate,Wrong macro for 64/32->32 division.
Yes, in fact we should use 64 macro here still.
As I understand pixel rate is stored in kHz so for instance for pixel rate 172800 * 4K * 4K we already overflowing u32. Was just a bit confused with prev comment :)Quoted 5 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c intel_plane_destroy_state(struct drm_plane *plane, · line 152
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +2
-0+ src_w * src_h), + mul_u32_u32(dst_w, dst_h));And the divisor shouldn't be a u64.
Agree divisor is not, however divident is 64.
Quoted 63 lines
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +3
-0+} +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 plane_pixel_rate =Quoted 1 line
intel_plane_pixel_rate(crtc_state, plane_state);Just '
pixel_rate' should do. We know the rest from the fact that this is a plane function. Also I'd put this first so the declaration block looks at least a bit less messy.drivers/gpu/drm/i915/display/intel_atomic_plane.c unsigned int intel_plane_data_rate(const struct · line 177
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +1
-1if (!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 mul_u32_u32 (plane_pixel_rate, cpp);We're not returning a u64.
Quoted 33 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +0
-0}int intel_plane_calc_min_cdclk(struct
intel_atomic_state*state,drivers/gpu/drm/i915/display/intel_atomic_plane.h +3
-0@@ -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 structintel_plane_state*plane_state);
void intel_plane_copy_uapi_to_hw_state(structintel_plane_state*plane_state,drivers/gpu/drm/i915/display/intel_sprite.c +0
-0@@ -330,9 +330,9 @@ bool icl_is_hdr_plane(struct drm_i915_private *dev_priv, enum plane_id plane_id) }Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c bool icl_is_hdr_plane(struct drm_i915_private *dev_priv, enum plane_id plane_id) · line 335
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_sprite.c +3
-3static 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_bpp_constraints (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state, +unsigned int *num,unsigned int *den)Bogus rename.
Quoted 3 lines
Well, I guess you agree, that this function is not returning
plane_ratioeither :) Was just wondering if it has to be named somewhat differently.
It returns the plane ratio excluding the downscaling component. So seems good enough to me. Or at least I can't immediately think of anything particularly better.
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx