stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/23] drm/i915/dp: Fix dsc bpp calculations.
@ 2019-09-12 13:00 Maarten Lankhorst
       [not found] ` <20190912143415.D8F552081B@mail.kernel.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Maarten Lankhorst @ 2019-09-12 13:00 UTC (permalink / raw)
  To: intel-gfx-trybot; +Cc: Maarten Lankhorst, stable, Manasi Navare

There was a integer wraparound when mode_clock became too high,
and we didn't correct for the FEC overhead factor when dividing,
also the calculations would break at HBR3.

As a result our calculated bpp was way too high, and the link width
bpp limitation never came into effect.

Print out the resulting bpp calcululations as a sanity check, just
in case we ever have to debug it later on again.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Fixes: d9218c8f6cf4 ("drm/i915/dp: Add helpers for Compressed BPP and Slice Count for DSC")
Cc: <stable@vger.kernel.org> # v5.0+
Cc: Manasi Navare <manasi.d.navare@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 20 +++++++++++---------
 drivers/gpu/drm/i915/display/intel_dp.h |  4 ++--
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index d09133a958e1..a7e392f8adeb 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4363,10 +4363,10 @@ intel_dp_get_sink_irq_esi(struct intel_dp *intel_dp, u8 *sink_irq_vector)
 		DP_DPRX_ESI_LEN;
 }
 
-u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count,
-				int mode_clock, int mode_hdisplay)
+u16 intel_dp_dsc_get_output_bpp(u32 link_clock, u32 lane_count,
+				u32 mode_clock, u32 mode_hdisplay)
 {
-	u16 bits_per_pixel, max_bpp_small_joiner_ram;
+	u32 bits_per_pixel, max_bpp_small_joiner_ram;
 	int i;
 
 	/*
@@ -4375,13 +4375,14 @@ u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count,
 	 * FECOverhead = 2.4%, for SST -> TimeSlotsPerMTP is 1,
 	 * for MST -> TimeSlotsPerMTP has to be calculated
 	 */
-	bits_per_pixel = (link_clock * lane_count * 8 *
-			  DP_DSC_FEC_OVERHEAD_FACTOR) /
-		mode_clock;
+	bits_per_pixel =
+		mul_u32_u32(link_clock, lane_count * 8 * DP_DSC_FEC_OVERHEAD_FACTOR) /
+		mul_u32_u32(1000ULL, mode_clock);
+	DRM_DEBUG_KMS("Max link bpp: %u\n", bits_per_pixel);
 
 	/* Small Joiner Check: output bpp <= joiner RAM (bits) / Horiz. width */
-	max_bpp_small_joiner_ram = DP_DSC_MAX_SMALL_JOINER_RAM_BUFFER /
-		mode_hdisplay;
+	max_bpp_small_joiner_ram = DP_DSC_MAX_SMALL_JOINER_RAM_BUFFER / mode_hdisplay;
+	DRM_DEBUG_KMS("Max small joiner bpp: %u\n", max_bpp_small_joiner_ram);
 
 	/*
 	 * Greatest allowed DSC BPP = MIN (output BPP from avaialble Link BW
@@ -4391,7 +4392,8 @@ u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count,
 
 	/* Error out if the max bpp is less than smallest allowed valid bpp */
 	if (bits_per_pixel < valid_dsc_bpp[0]) {
-		DRM_DEBUG_KMS("Unsupported BPP %d\n", bits_per_pixel);
+		DRM_DEBUG_KMS("Unsupported BPP %u, min %u\n",
+			      bits_per_pixel, valid_dsc_bpp[0]);
 		return 0;
 	}
 
diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h
index e01d1f89409d..586dc9336d63 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.h
+++ b/drivers/gpu/drm/i915/display/intel_dp.h
@@ -103,8 +103,8 @@ bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp);
 bool intel_dp_source_supports_hbr3(struct intel_dp *intel_dp);
 bool
 intel_dp_get_link_status(struct intel_dp *intel_dp, u8 *link_status);
-u16 intel_dp_dsc_get_output_bpp(int link_clock, u8 lane_count,
-				int mode_clock, int mode_hdisplay);
+u16 intel_dp_dsc_get_output_bpp(u32 link_clock, u32 lane_count,
+				u32 mode_clock, u32 mode_hdisplay);
 u8 intel_dp_dsc_get_slice_count(struct intel_dp *intel_dp, int mode_clock,
 				int mode_hdisplay);
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 01/23] drm/i915/dp: Fix dsc bpp calculations.
       [not found] ` <20190912143415.D8F552081B@mail.kernel.org>
@ 2019-09-12 16:01   ` Maarten Lankhorst
  2019-09-12 18:05     ` [Intel-gfx] " Ville Syrjälä
  0 siblings, 1 reply; 4+ messages in thread
From: Maarten Lankhorst @ 2019-09-12 16:01 UTC (permalink / raw)
  To: Sasha Levin, intel-gfx; +Cc: Manasi Navare, stable

Hey,

Op 12-09-2019 om 16:34 schreef Sasha Levin:
> Hi,
>
> [This is an automated email]
>
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: d9218c8f6cf4 drm/i915/dp: Add helpers for Compressed BPP and Slice Count for DSC.
>
> The bot has tested the following trees: v5.2.14.
>
> v5.2.14: Failed to apply! Possible dependencies:
>     Unable to calculate
>
>
> NOTE: The patch will not be queued to stable trees until it is upstream.
>
> How should we proceed with this patch?
>
> --
> Thanks,
> Sasha

Why is this bot asking for patches on the trybot mailing list?

~Maarten


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] [PATCH 01/23] drm/i915/dp: Fix dsc bpp calculations.
  2019-09-12 16:01   ` Maarten Lankhorst
@ 2019-09-12 18:05     ` Ville Syrjälä
  2019-09-12 20:58       ` Maarten Lankhorst
  0 siblings, 1 reply; 4+ messages in thread
From: Ville Syrjälä @ 2019-09-12 18:05 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: Sasha Levin, intel-gfx, stable

On Thu, Sep 12, 2019 at 06:01:57PM +0200, Maarten Lankhorst wrote:
> Hey,
> 
> Op 12-09-2019 om 16:34 schreef Sasha Levin:
> > Hi,
> >
> > [This is an automated email]
> >
> > This commit has been processed because it contains a "Fixes:" tag,
> > fixing commit: d9218c8f6cf4 drm/i915/dp: Add helpers for Compressed BPP and Slice Count for DSC.
> >
> > The bot has tested the following trees: v5.2.14.
> >
> > v5.2.14: Failed to apply! Possible dependencies:
> >     Unable to calculate
> >
> >
> > NOTE: The patch will not be queued to stable trees until it is upstream.
> >
> > How should we proceed with this patch?
> >
> > --
> > Thanks,
> > Sasha
> 
> Why is this bot asking for patches on the trybot mailing list?

Did you forget --suppress-cc=all ?

-- 
Ville Syrjälä
Intel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Intel-gfx] [PATCH 01/23] drm/i915/dp: Fix dsc bpp calculations.
  2019-09-12 18:05     ` [Intel-gfx] " Ville Syrjälä
@ 2019-09-12 20:58       ` Maarten Lankhorst
  0 siblings, 0 replies; 4+ messages in thread
From: Maarten Lankhorst @ 2019-09-12 20:58 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: Sasha Levin, intel-gfx, stable

Op 12-09-2019 om 20:05 schreef Ville Syrjälä:
> On Thu, Sep 12, 2019 at 06:01:57PM +0200, Maarten Lankhorst wrote:
>> Hey,
>>
>> Op 12-09-2019 om 16:34 schreef Sasha Levin:
>>> Hi,
>>>
>>> [This is an automated email]
>>>
>>> This commit has been processed because it contains a "Fixes:" tag,
>>> fixing commit: d9218c8f6cf4 drm/i915/dp: Add helpers for Compressed BPP and Slice Count for DSC.
>>>
>>> The bot has tested the following trees: v5.2.14.
>>>
>>> v5.2.14: Failed to apply! Possible dependencies:
>>>     Unable to calculate
>>>
>>>
>>> NOTE: The patch will not be queued to stable trees until it is upstream.
>>>
>>> How should we proceed with this patch?
>>>
>>> --
>>> Thanks,
>>> Sasha
>> Why is this bot asking for patches on the trybot mailing list?
> Did you forget --suppress-cc=all ?
>
Ah that's it, thanks! :)

~Maarten


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-12 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12 13:00 [PATCH 01/23] drm/i915/dp: Fix dsc bpp calculations Maarten Lankhorst
     [not found] ` <20190912143415.D8F552081B@mail.kernel.org>
2019-09-12 16:01   ` Maarten Lankhorst
2019-09-12 18:05     ` [Intel-gfx] " Ville Syrjälä
2019-09-12 20:58       ` Maarten Lankhorst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).