Skip to contentSkip to conversation

drm/ssd130x: Change pixel format used to compute the buffer size

PATCH In review Javier Martinez Canillas 3 participants 4 messages Jul 13, 2023

Subsystems (3)
lore
Share & tools
lore

Javier Martinez Canillas

author maintainer
#0 lore raw

PATCH 1/1 drm/ssd130x: Change pixel format used to compute the buffer size

The commit e254b584dbc0 ("drm/ssd130x: Remove hardcoded bits-per-pixel in ssd130x_buf_alloc()") used a pixel format info instead of a hardcoded bpp to calculate the size of the buffer allocated to store the native pixels.

But that wrongly used the DRM_FORMAT_C1 fourcc pixel format, which is for color-indexed frame buffer formats. While the ssd103x controllers don't support different single-channel colors nor a Color Lookup Table (CLUT).

Both formats use eight pixels/byte, so in practice there is no functional changes in this patch. But still the correct pixel format should be used.

---

 drivers/gpu/drm/solomon/ssd130x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/solomon/ssd130x.c +1 -1
index b3dc1ca9dc10..afb08a8aa9fc 100644
@@ -153,7 +153,7 @@ static int ssd130x_buf_alloc(struct ssd130x_device *ssd130x)
 	const struct drm_format_info *fi;
 	unsigned int pitch;
 
-	fi = drm_format_info(DRM_FORMAT_C1);
+	fi = drm_format_info(DRM_FORMAT_R1);
 	if (!fi)
 		return -EINVAL;
 
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Javier Martinez Canillas

The commit e254b584dbc0 ("drm/ssd130x: Remove hardcoded bits-per-pixel in ssd130x_buf_alloc()") used a pixel format info instead of a hardcoded bpp to calculate the size of the buffer allocated to store the native pixels.

But that wrongly used the DRM_FORMAT_C1 fourcc pixel format, which is for color-indexed frame buffer formats. While the ssd103x controllers don't support different single-channel colors nor a Color Lookup Table (CLUT).

Quoted 5 lines

Both formats use eight pixels/byte, so in practice there is no functional changes in this patch. But still the correct pixel format should be used.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Javier Martinez Canillas

Am 13.07.23 um 10:58 schrieb Javier Martinez Canillas:

Quoted 7 lines

The commit e254b584dbc0 ("drm/ssd130x: Remove hardcoded bits-per-pixel in ssd130x_buf_alloc()") used a pixel format info instead of a hardcoded bpp to calculate the size of the buffer allocated to store the native pixels.

But that wrongly used the DRM_FORMAT_C1 fourcc pixel format, which is for color-indexed frame buffer formats. While the ssd103x controllers don't support different single-channel colors nor a Color Lookup Table (CLUT).

Makes sense to me.

Quoted 24 lines

Both formats use eight pixels/byte, so in practice there is no functional changes in this patch. But still the correct pixel format should be used.

---

  drivers/gpu/drm/solomon/ssd130x.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/solomon/ssd130x.c +1 -1
index b3dc1ca9dc10..afb08a8aa9fc 100644
@@ -153,7 +153,7 @@ static int ssd130x_buf_alloc(struct ssd130x_device *ssd130x)
  	const struct drm_format_info *fi;
  	unsigned int pitch;
 
-	fi = drm_format_info(DRM_FORMAT_C1);
+	fi = drm_format_info(DRM_FORMAT_R1);
  	if (!fi)
  		return -EINVAL;
 
Signature · 6 lines
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)
author maintainer
#3 lore raw
Quoted 5 lines · Thomas Zimmermann

Am 13.07.23 um 10:58 schrieb Javier Martinez Canillas:

Quoted 4 lines

The commit e254b584dbc0 ("drm/ssd130x: Remove hardcoded bits-per-pixel in ssd130x_buf_alloc()") used a pixel format info instead of a hardcoded bpp to calculate the size of the buffer allocated to store the native pixels.

Quoted 8 lines
Quoted 3 lines

But that wrongly used the DRM_FORMAT_C1 fourcc pixel format, which is for color-indexed frame buffer formats. While the ssd103x controllers don't support different single-channel colors nor a Color Lookup Table (CLUT).

Makes sense to me.

Thanks Geert and Thomas for your review. I've fixed some typos that had in my commit message and pushed this to drm-misc-next.

Signature · 5 lines
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat