[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7560cd10-0a7c-3fda-da83-9008833e3901@suse.de>
Date: Fri, 11 Feb 2022 12:54:26 +0100
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Javier Martinez Canillas <javierm@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-fbdev@...r.kernel.org,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Maxime Ripard <maxime@...no.tech>,
Daniel Vetter <daniel.vetter@...ll.ch>,
dri-devel@...ts.freedesktop.org, Sam Ravnborg <sam@...nborg.org>,
Noralf Trønnes <noralf@...nnes.org>,
Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...ux.ie>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>
Subject: Re: [PATCH v4 1/6] drm/format-helper: Add
drm_fb_xrgb8888_to_gray8_line()
Hi
Am 11.02.22 um 12:12 schrieb Andy Shevchenko:
> On Fri, Feb 11, 2022 at 11:40:13AM +0100, Javier Martinez Canillas wrote:
>> On 2/11/22 11:28, Andy Shevchenko wrote:
>>> On Fri, Feb 11, 2022 at 10:19:22AM +0100, Javier Martinez Canillas wrote:
>
> ...
>
>>>> +static void drm_fb_xrgb8888_to_gray8_line(u8 *dst, const u32 *src, unsigned int pixels)
>>>> +{
>>>> + unsigned int x;
>>>> +
>>>> + for (x = 0; x < pixels; x++) {
>>>> + u8 r = (*src & 0x00ff0000) >> 16;
>>>> + u8 g = (*src & 0x0000ff00) >> 8;
>>>> + u8 b = *src & 0x000000ff;
>>>> +
>>>> + /* ITU BT.601: Y = 0.299 R + 0.587 G + 0.114 B */
>>>> + *dst++ = (3 * r + 6 * g + b) / 10;
>>>> + src++;
>>>> + }
>>>
>>> Can be done as
>>>
>>> while (pixels--) {
>>> ...
>>> }
>>>
>>> or
>>>
>>> do {
>>> ...
>>> } while (--pixels);
>>>
>>
>> I don't see why a while loop would be an improvement here TBH.
>
> Less letters to parse when reading the code.
It's a simple refactoring of code that has worked well so far. Let's
leave it as-is for now.
Best regards
Thomas
>
>> In any case, I just pulled the line conversion logic as a separate
>> function with minimal code changes since doing that should be in a
>> separate patch.
>
>
>> Feel free to post a patch if you want to change that while loop.
>
> Perhaps some day :-)
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)
Powered by blists - more mailing lists