[Intel-gfx] [PATCH] drm/i915: handle FIFO oversubsription correctly
Vasily Khoruzhick
anarsoul at gmail.com
Sat Jul 18 23:27:46 CEST 2009
On Thursday 16 July 2009 23:01:01 Jesse Barnes wrote:
> If you're pushing a plane hard (i.e. you need most or all of the FIFO
> entries just to cover your frame refresh latency), the watermark level
> may end up being negative. So fix up the signed vs. unsigned math in
> the calculation function to handle this correctly, giving all available
> FIFO entries to such a configuration.
>
> Reported-by: Eric Anholt <eric at anholt.net>
> Tested-by: Eric Anholt <eric at anholt.net>
> Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
> ---
> drivers/gpu/drm/i915/intel_display.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c index 3fa0d63..890f710 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -1674,7 +1674,7 @@ static unsigned long intel_calculate_wm(unsigned long
> clock_in_khz, int pixel_size,
> unsigned long latency_ns)
> {
> - unsigned long entries_required, wm_size;
> + long entries_required, wm_size;
>
> entries_required = (clock_in_khz * pixel_size * latency_ns) / 1000000;
> entries_required /= wm->cacheline_size;
> @@ -1685,9 +1685,10 @@ static unsigned long intel_calculate_wm(unsigned
> long clock_in_khz,
>
> DRM_DEBUG("FIFO watermark level: %d\n", wm_size);
>
> - if (wm_size > wm->max_wm)
> + /* Don't promote wm_size to unsigned... */
> + if (wm_size > (long)wm->max_wm)
> wm_size = wm->max_wm;
> - if (wm_size == 0)
> + if (wm_size <= 0)
> wm_size = wm->default_wm;
> return wm_size;
> }
Cool, this patch fixes flickering on my external monitor in hi-res mode.
Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090719/90940ffe/attachment.sig>
More information about the Intel-gfx
mailing list