All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, airlied@gmail.com, javierm@redhat.com,
	jose.exposito89@gmail.com, mairacanal@riseup.net,
	mripard@kernel.org, maarten.lankhorst@linux.intel.com
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH v2 13/13] drm/format-helper: Remove unnecessary conversion helpers
Date: Tue, 20 Dec 2022 17:11:45 +0100	[thread overview]
Message-ID: <20221220161145.27568-14-tzimmermann@suse.de> (raw)
In-Reply-To: <20221220161145.27568-1-tzimmermann@suse.de>

Drivers only emulate XRGB8888 framebuffers. Remove all conversion
helpers that do not use XRGB8888 as their source format. Also remove
some special cases for alpha formats in the blit helper.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
---
 drivers/gpu/drm/drm_format_helper.c | 75 -----------------------------
 1 file changed, 75 deletions(-)

diff --git a/drivers/gpu/drm/drm_format_helper.c b/drivers/gpu/drm/drm_format_helper.c
index 07791aa5385d..820fcfd9d95d 100644
--- a/drivers/gpu/drm/drm_format_helper.c
+++ b/drivers/gpu/drm/drm_format_helper.c
@@ -649,65 +649,6 @@ void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_
 }
 EXPORT_SYMBOL(drm_fb_xrgb8888_to_argb8888);
 
-static void drm_fb_rgb565_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
-{
-	__le32 *dbuf32 = dbuf;
-	const __le16 *sbuf16 = sbuf;
-	unsigned int x;
-
-	for (x = 0; x < pixels; x++) {
-		u16 val16 = le16_to_cpu(sbuf16[x]);
-		u32 val32 = ((val16 & 0xf800) << 8) |
-			    ((val16 & 0x07e0) << 5) |
-			    ((val16 & 0x001f) << 3);
-		val32 = 0xff000000 | val32 |
-			((val32 >> 3) & 0x00070007) |
-			((val32 >> 2) & 0x00000300);
-		dbuf32[x] = cpu_to_le32(val32);
-	}
-}
-
-static void drm_fb_rgb565_to_xrgb8888(struct iosys_map *dst, const unsigned int *dst_pitch,
-				      const struct iosys_map *src,
-				      const struct drm_framebuffer *fb,
-				      const struct drm_rect *clip)
-{
-	static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = {
-		4,
-	};
-
-	drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false,
-		    drm_fb_rgb565_to_xrgb8888_line);
-}
-
-static void drm_fb_rgb888_to_xrgb8888_line(void *dbuf, const void *sbuf, unsigned int pixels)
-{
-	__le32 *dbuf32 = dbuf;
-	const u8 *sbuf8 = sbuf;
-	unsigned int x;
-
-	for (x = 0; x < pixels; x++) {
-		u8 r = *sbuf8++;
-		u8 g = *sbuf8++;
-		u8 b = *sbuf8++;
-		u32 pix = 0xff000000 | (r << 16) | (g << 8) | b;
-		dbuf32[x] = cpu_to_le32(pix);
-	}
-}
-
-static void drm_fb_rgb888_to_xrgb8888(struct iosys_map *dst, const unsigned int *dst_pitch,
-				      const struct iosys_map *src,
-				      const struct drm_framebuffer *fb,
-				      const struct drm_rect *clip)
-{
-	static const u8 dst_pixsize[DRM_FORMAT_MAX_PLANES] = {
-		4,
-	};
-
-	drm_fb_xfrm(dst, dst_pitch, dst_pixsize, src, fb, clip, false,
-		    drm_fb_rgb888_to_xrgb8888_line);
-}
-
 static void drm_fb_xrgb8888_to_xrgb2101010_line(void *dbuf, const void *sbuf, unsigned int pixels)
 {
 	__le32 *dbuf32 = dbuf;
@@ -899,12 +840,6 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d
 {
 	uint32_t fb_format = fb->format->format;
 
-	/* treat alpha channel like filler bits */
-	if (fb_format == DRM_FORMAT_ARGB8888)
-		fb_format = DRM_FORMAT_XRGB8888;
-	if (fb_format == DRM_FORMAT_ARGB2101010)
-		fb_format = DRM_FORMAT_XRGB2101010;
-
 	if (fb_format == dst_format) {
 		drm_fb_memcpy(dst, dst_pitch, src, fb, clip);
 		return 0;
@@ -943,16 +878,6 @@ int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t d
 			drm_fb_swab(dst, dst_pitch, src, fb, clip, false);
 			return 0;
 		}
-	} else if (fb_format == DRM_FORMAT_RGB888) {
-		if (dst_format == DRM_FORMAT_XRGB8888) {
-			drm_fb_rgb888_to_xrgb8888(dst, dst_pitch, src, fb, clip);
-			return 0;
-		}
-	} else if (fb_format == DRM_FORMAT_RGB565) {
-		if (dst_format == DRM_FORMAT_XRGB8888) {
-			drm_fb_rgb565_to_xrgb8888(dst, dst_pitch, src, fb, clip);
-			return 0;
-		}
 	}
 
 	drm_warn_once(fb->dev, "No conversion helper from %p4cc to %p4cc found.\n",
-- 
2.39.0


      parent reply	other threads:[~2022-12-20 16:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-20 16:11 [PATCH v2 00/13] drm: Fix color-format selection in fbdev emulation Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 01/13] firmware/sysfb: Fix EFI/VESA format selection Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 02/13] drm/format-helper: Comment on RGB888 byte order Thomas Zimmermann
2022-12-21 19:30   ` Maíra Canal
2022-12-23 12:37   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 03/13] drm/format-helper: Fix test-input format conversion Thomas Zimmermann
2022-12-21 19:40   ` Maíra Canal
2022-12-23 12:38   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 04/13] drm/format-helper: Store RGB565 in little-endian order Thomas Zimmermann
2022-12-21 19:55   ` Maíra Canal
2022-12-23 12:39   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 05/13] drm/format-helper: Type fixes in format-helper tests Thomas Zimmermann
2022-12-21 19:58   ` Maíra Canal
2022-12-23 12:40   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 06/13] drm/format-helper: Flip src/dst-format branches in blit helper Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 07/13] drm/format-helper: Add conversion from XRGB8888 to ARGB8888 Thomas Zimmermann
2022-12-21 12:37   ` kernel test robot
2022-12-21 12:37     ` kernel test robot
2022-12-21 20:07   ` Maíra Canal
2023-01-02 10:00     ` Thomas Zimmermann
2022-12-23 12:44   ` José Expósito
2023-01-02 10:01     ` Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 08/13] drm/format-helper: Add conversion from XRGB8888 to ARGB2101010 Thomas Zimmermann
2022-12-23 12:45   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 09/13] drm/format-helper: Add conversion from XRGB8888 to 15-bit RGB555 formats Thomas Zimmermann
2022-12-21 13:58   ` kernel test robot
2022-12-21 13:58     ` kernel test robot
2022-12-23 12:48   ` José Expósito
2022-12-20 16:11 ` [PATCH v2 10/13] drm/fh-helper: Split fbdev single-probe helper Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 11/13] drm/fb-helper: Fix single-probe color-format selection Thomas Zimmermann
2022-12-20 16:11 ` [PATCH v2 12/13] drm/format-helper: Simplify drm_fb_build_fourcc_list() Thomas Zimmermann
2022-12-20 16:11 ` Thomas Zimmermann [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=20221220161145.27568-14-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=jose.exposito89@gmail.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mairacanal@riseup.net \
    --cc=mripard@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.