From: Jani Nikula <jani.nikula@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915/panel: Split range scaling calculation for readiblity
Date: Wed, 14 Feb 2018 13:33:55 +0200 [thread overview]
Message-ID: <87efln6c0s.fsf@intel.com> (raw)
In-Reply-To: <20180214091747.12753-2-chris@chris-wilson.co.uk>
On Wed, 14 Feb 2018, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Split the 64b multiplication from the division so that it doesn't sprawl
> across a couple of lines and use mul_u32_u32() instead of open-coding
> the 64b conversion.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/intel_panel.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 41296935ef11..41d00b1603e3 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -419,8 +419,9 @@ static uint32_t scale(uint32_t source_val,
> source_val = clamp(source_val, source_min, source_max);
>
> /* avoid overflows */
> - target_val = DIV_ROUND_CLOSEST_ULL((uint64_t)(source_val - source_min) *
> - (target_max - target_min), source_max - source_min);
> + target_val = mul_u32_u32(source_val - source_min,
> + target_max - target_min);
> + target_val = DIV_ROUND_CLOSEST_ULL(target_val, source_max - source_min);
> target_val += target_min;
>
> return target_val;
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-02-14 11:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 9:17 [PATCH 1/2] drm/i915/panel: Add missing parameters to kerneldoc Chris Wilson
2018-02-14 9:17 ` [PATCH 2/2] drm/i915/panel: Split range scaling calculation for readiblity Chris Wilson
2018-02-14 11:33 ` Jani Nikula [this message]
2018-02-14 10:22 ` [PATCH 1/2] drm/i915/panel: Add missing parameters to kerneldoc Jani Nikula
2018-02-14 10:27 ` Chris Wilson
2018-02-14 11:31 ` Jani Nikula
2018-02-14 10:30 ` Chris Wilson
2018-02-14 11:24 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2018-02-14 16:33 ` ✗ Fi.CI.IGT: 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=87efln6c0s.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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