lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z7xB9xD6748bF9vJ@smile.fi.intel.com>
Date: Mon, 24 Feb 2025 11:55:03 +0200
From: "andriy.shevchenko@...ux.intel.com" <andriy.shevchenko@...ux.intel.com>
To: Thomas Zimmermann <tzimmermann@...e.de>
Cc: Aditya Garg <gargaditya08@...e.com>,
	"pmladek@...e.com" <pmladek@...e.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	"linux@...musvillemoes.dk" <linux@...musvillemoes.dk>,
	"senozhatsky@...omium.org" <senozhatsky@...omium.org>,
	Jonathan Corbet <corbet@....net>,
	"maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>,
	"mripard@...nel.org" <mripard@...nel.org>,
	"airlied@...il.com" <airlied@...il.com>,
	"simona@...ll.ch" <simona@...ll.ch>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"apw@...onical.com" <apw@...onical.com>,
	"joe@...ches.com" <joe@...ches.com>,
	"dwaipayanray1@...il.com" <dwaipayanray1@...il.com>,
	"lukas.bulwahn@...il.com" <lukas.bulwahn@...il.com>,
	"sumit.semwal@...aro.org" <sumit.semwal@...aro.org>,
	"christian.koenig@....com" <christian.koenig@....com>,
	Kerem Karabay <kekrby@...il.com>, Aun-Ali Zaidi <admin@...eit.net>,
	Orlando Chamberlain <orlandoch.dev@...il.com>,
	Atharva Tiwari <evepolonium@...il.com>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
	"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
	"linaro-mm-sig@...ts.linaro.org" <linaro-mm-sig@...ts.linaro.org>,
	Hector Martin <marcan@...can.st>,
	"linux@...linux.org.uk" <linux@...linux.org.uk>,
	Asahi Linux Mailing List <asahi@...ts.linux.dev>,
	Sven Peter <sven@...npeter.dev>, Janne Grunau <j@...nau.net>
Subject: Re: [PATCH v3 1/3] drm/format-helper: Add conversion from XRGB8888
 to BGR888

On Mon, Feb 24, 2025 at 10:19:13AM +0100, Thomas Zimmermann wrote:
> Am 21.02.25 um 16:51 schrieb andriy.shevchenko@...ux.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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ