From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Tvrtko Ursulin <tursulin@ursulin.net>, Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 8/9] drm/i915: Make intel_calculate_wm return unsigned int
Date: Mon, 10 Oct 2016 11:02:31 +0300 [thread overview]
Message-ID: <1476086551.3897.21.camel@linux.intel.com> (raw)
In-Reply-To: <1475847252-31580-9-git-send-email-tvrtko.ursulin@linux.intel.com>
On pe, 2016-10-07 at 14:34 +0100, Tvrtko Ursulin wrote:
> @@ -595,18 +595,17 @@ static unsigned long intel_calculate_wm(unsigned int clock_in_khz,
> * clocks go from a few thousand to several hundred thousand.
> * latency is usually a few thousand
> */
> - entries_required = ((clock_in_khz / 1000) * cpp * latency_ns) /
> - 1000;
> + entries_required = ((clock_in_khz / 1000) * cpp * latency_ns) / 1000;
Is the intermediary result always within int?
> entries_required = DIV_ROUND_UP(entries_required, wm->cacheline_size);
>
> - DRM_DEBUG_KMS("FIFO entries required for mode: %ld\n", entries_required);
> + DRM_DEBUG_KMS("FIFO entries required for mode: %d\n", entries_required);
>
> wm_size = fifo_size - (entries_required + wm->guard_size);
>
> - DRM_DEBUG_KMS("FIFO watermark level: %ld\n", wm_size);
> + DRM_DEBUG_KMS("FIFO watermark level: %d\n", wm_size);
>
> /* Don't promote wm_size to unsigned... */
> - if (wm_size > (long)wm->max_wm)
> + if (wm_size > (int)wm->max_wm)
> wm_size = wm->max_wm;
> if (wm_size <= 0)
> wm_size = wm->default_wm;
This could be
if (wm_size <= 0)
wm_size = wm->default_wm;
else if (wm_size > U16_MAX || (u16)wm_size > wm->max_wm)
wm_size = wm->max_wm;
or something?
Other than that, types look better that they used to.
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
The whole type landscape in watermark code seems bit sloppy to me.
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-10-10 8:02 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 13:34 [PATCH 0/9] .rodata diet 2 (non-disruptive version) Tvrtko Ursulin
2016-10-07 13:34 ` [PATCH 1/9] drm/i915: Shrink cxsr_latency_table Tvrtko Ursulin
2016-10-10 7:15 ` Joonas Lahtinen
2016-10-07 13:34 ` [PATCH 2/9] drm/i915: Shrink sdvo_cmd_names Tvrtko Ursulin
2016-10-10 7:16 ` Joonas Lahtinen
2016-10-07 13:34 ` [PATCH 3/9] drm/i915: Shrink per-platform watermark configuration Tvrtko Ursulin
2016-10-10 7:17 ` Joonas Lahtinen
2016-10-07 13:34 ` [PATCH 4/9] drm/i915: Shrink TV modes const data Tvrtko Ursulin
2016-10-10 6:49 ` Jani Nikula
2016-10-10 8:38 ` Tvrtko Ursulin
2016-10-10 7:22 ` Joonas Lahtinen
2016-10-07 13:34 ` [PATCH 5/9] drm/i915: Use unsigned int for latencies Tvrtko Ursulin
2016-10-10 7:24 ` Joonas Lahtinen
2016-10-10 8:34 ` Tvrtko Ursulin
2016-10-07 13:34 ` [PATCH 6/9] drm/i915: unsigned int is enough for crtc clock Tvrtko Ursulin
2016-10-10 7:25 ` Joonas Lahtinen
2016-10-07 13:34 ` [PATCH 7/9] drm/i915: Convert get_fifo_size return from int to unsigned int Tvrtko Ursulin
2016-10-10 7:46 ` Joonas Lahtinen
2016-10-07 13:34 ` [PATCH 8/9] drm/i915: Make intel_calculate_wm return " Tvrtko Ursulin
2016-10-10 8:02 ` Joonas Lahtinen [this message]
2016-10-10 8:33 ` Tvrtko Ursulin
2016-10-07 13:34 ` [PATCH 9/9] drm/i915: Tidy watermark computation local types Tvrtko Ursulin
2016-10-07 13:48 ` Ville Syrjälä
2016-10-07 14:51 ` Tvrtko Ursulin
2016-10-07 15:16 ` Ville Syrjälä
2016-10-10 8:06 ` Joonas Lahtinen
2016-10-10 8:19 ` ✗ Fi.CI.BAT: warning for .rodata diet 2 (non-disruptive version) Patchwork
2016-10-10 8:27 ` ✗ Fi.CI.BAT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1476086551.3897.21.camel@linux.intel.com \
--to=joonas.lahtinen@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=tursulin@ursulin.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox