Thread (27 messages) 27 messages, 4 authors, 2025-02-24

Re: [PATCH v3 1/3] drm/format-helper: Add conversion from XRGB8888 to BGR888

From: Thomas Zimmermann <tzimmermann@suse.de>
Date: 2025-02-24 09:19:22
Also in: asahi, dri-devel, linux-doc, lkml

Hi

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:
quoted
From: Kerem Karabay <redacted>

Add XRGB8888 emulation helper for devices that only support BGR888.
...
quoted
+	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.

quoted
+	}
...
quoted
+	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. Most of DRM doesn't AFAIK.

Best regards
Thomas
-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help