From: "andriy.shevchenko@linux.intel.com" <andriy.shevchenko@linux.intel.com>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Aditya Garg <gargaditya08@live.com>,
"pmladek@suse.com" <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
"linux@rasmusvillemoes.dk" <linux@rasmusvillemoes.dk>,
"senozhatsky@chromium.org" <senozhatsky@chromium.org>,
Jonathan Corbet <corbet@lwn.net>,
"maarten.lankhorst@linux.intel.com"
<maarten.lankhorst@linux.intel.com>,
"mripard@kernel.org" <mripard@kernel.org>,
"airlied@gmail.com" <airlied@gmail.com>,
"simona@ffwll.ch" <simona@ffwll.ch>,
Andrew Morton <akpm@linux-foundation.org>,
"apw@canonical.com" <apw@canonical.com>,
"joe@perches.com" <joe@perches.com>,
"dwaipayanray1@gmail.com" <dwaipayanray1@gmail.com>,
"lukas.bulwahn@gmail.com" <lukas.bulwahn@gmail.com>,
"sumit.semwal@linaro.org" <sumit.semwal@linaro.org>,
"christian.koenig@amd.com" <christian.koenig@amd.com>,
Kerem Karabay <kekrby@gmail.com>,
Aun-Ali Zaidi <admin@kodeit.net>,
Orlando Chamberlain <orlandoch.dev@gmail.com>,
Atharva Tiwari <evepolonium@gmail.com>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
Hector Martin <marcan@marcan.st>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
Asahi Linux Mailing List <asahi@lists.linux.dev>,
Sven Peter <sven@svenpeter.dev>, Janne Grunau <j@jannau.net>
Subject: Re: [PATCH v3 1/3] drm/format-helper: Add conversion from XRGB8888 to BGR888
Date: Mon, 24 Feb 2025 11:55:03 +0200 [thread overview]
Message-ID: <Z7xB9xD6748bF9vJ@smile.fi.intel.com> (raw)
In-Reply-To: <27efffe1-6562-4612-a748-893475ba02fa@suse.de>
On Mon, Feb 24, 2025 at 10:19:13AM +0100, Thomas Zimmermann wrote:
> Am 21.02.25 um 16:51 schrieb andriy.shevchenko@linux.intel.com:
> > On Fri, Feb 21, 2025 at 11:36:00AM +0000, Aditya Garg wrote:
...
> > > + for (x = 0; x < pixels; x++) {
> > > + pix = le32_to_cpu(sbuf32[x]);
> > > + /* write red-green-blue to output in little endianness */
> > > + *dbuf8++ = (pix & 0x00ff0000) >> 16;
> > > + *dbuf8++ = (pix & 0x0000ff00) >> 8;
> > > + *dbuf8++ = (pix & 0x000000ff) >> 0;
> > put_unaligned_be24()
>
> I'm all for sharing helper code, but maybe not here.
>
> - DRM pixel formats are always little endian.
> - CPU encoding is LE or BE.
> - Pixel-component order can be anything: RGB/BGR/etc.
>
> So the code has a comment to explain what happens here. Adding that call
> with the _be24 postfix into the mix would make it more confusing.
I'm not objecting the comment, the code has definite meaning and with the
proposed helper it makes clearer (in my opinion).
Comment can be adjusted to explain better this conversion.
Or, perhaps pix should be be32? That's probably where confusion starts.
pix = be32_to_cpu(sbuf32[x]);
/* write red-green-blue to output in little endianness */
put_unaligned_le24(...);
?
> > > + }
...
> > > + static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = {
> > > + 3,
> > > + };
> > One line?
> >
> > static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = { 3 };
>
> I'd be ok, if there's a string preference in the kernel to use thins style.
Just a common sense to avoid more LoCs when it's not needed / redundant.
> Most of DRM doesn't AFAIK.
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2025-02-24 9:55 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 11:36 [PATCH v3 1/3] drm/format-helper: Add conversion from XRGB8888 to BGR888 Aditya Garg
2025-02-21 11:37 ` [PATCH v3 2/3] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc Aditya Garg
2025-02-21 11:54 ` Rasmus Villemoes
2025-02-21 15:29 ` andriy.shevchenko
2025-02-21 19:37 ` Aditya Garg
2025-02-21 20:18 ` andriy.shevchenko
2025-02-21 20:22 ` andriy.shevchenko
2025-02-21 11:37 ` [PATCH v3 3/3] drm/tiny: add driver for Apple Touch Bars in x86 Macs Aditya Garg
2025-02-21 15:48 ` andriy.shevchenko
2025-02-21 19:13 ` Aditya Garg
2025-02-21 20:42 ` andriy.shevchenko
2025-02-22 9:07 ` Aditya Garg
2025-02-22 12:22 ` Aditya Garg
2025-02-23 14:58 ` Aditya Garg
2025-02-24 8:41 ` Thomas Zimmermann
2025-02-24 9:47 ` andriy.shevchenko
2025-02-24 11:20 ` Aditya Garg
2025-02-24 11:42 ` andriy.shevchenko
2025-02-24 11:57 ` Aditya Garg
2025-02-24 12:27 ` andriy.shevchenko
2025-02-24 9:09 ` Thomas Zimmermann
2025-02-24 9:14 ` Aditya Garg
2025-02-21 15:51 ` [PATCH v3 1/3] drm/format-helper: Add conversion from XRGB8888 to BGR888 andriy.shevchenko
2025-02-21 17:21 ` Aditya Garg
2025-02-21 20:25 ` andriy.shevchenko
2025-02-24 9:19 ` Thomas Zimmermann
2025-02-24 9:55 ` andriy.shevchenko [this message]
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=Z7xB9xD6748bF9vJ@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=admin@kodeit.net \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=asahi@lists.linux.dev \
--cc=christian.koenig@amd.com \
--cc=corbet@lwn.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=dwaipayanray1@gmail.com \
--cc=evepolonium@gmail.com \
--cc=gargaditya08@live.com \
--cc=j@jannau.net \
--cc=joe@perches.com \
--cc=kekrby@gmail.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@rasmusvillemoes.dk \
--cc=lukas.bulwahn@gmail.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marcan@marcan.st \
--cc=mripard@kernel.org \
--cc=orlandoch.dev@gmail.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=sven@svenpeter.dev \
--cc=tzimmermann@suse.de \
/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