Commit 1f25d005 authored by Noralf Trønnes's avatar Noralf Trønnes

drm/gud: Add GUD_PIXEL_FORMAT_RGB332

Add support for the RGB332 pixel format.
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210929191201.34456-6-noralf@tronnes.org
parent 4cabfedc
...@@ -526,6 +526,8 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id) ...@@ -526,6 +526,8 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id)
case DRM_FORMAT_R8: case DRM_FORMAT_R8:
fallthrough; fallthrough;
case GUD_DRM_FORMAT_XRGB1111: case GUD_DRM_FORMAT_XRGB1111:
fallthrough;
case DRM_FORMAT_RGB332:
if (!xrgb8888_emulation_format) if (!xrgb8888_emulation_format)
xrgb8888_emulation_format = info; xrgb8888_emulation_format = info;
break; break;
......
...@@ -84,6 +84,8 @@ static inline u8 gud_from_fourcc(u32 fourcc) ...@@ -84,6 +84,8 @@ static inline u8 gud_from_fourcc(u32 fourcc)
return GUD_PIXEL_FORMAT_R8; return GUD_PIXEL_FORMAT_R8;
case GUD_DRM_FORMAT_XRGB1111: case GUD_DRM_FORMAT_XRGB1111:
return GUD_PIXEL_FORMAT_XRGB1111; return GUD_PIXEL_FORMAT_XRGB1111;
case DRM_FORMAT_RGB332:
return GUD_PIXEL_FORMAT_RGB332;
case DRM_FORMAT_RGB565: case DRM_FORMAT_RGB565:
return GUD_PIXEL_FORMAT_RGB565; return GUD_PIXEL_FORMAT_RGB565;
case DRM_FORMAT_XRGB8888: case DRM_FORMAT_XRGB8888:
...@@ -104,6 +106,8 @@ static inline u32 gud_to_fourcc(u8 format) ...@@ -104,6 +106,8 @@ static inline u32 gud_to_fourcc(u8 format)
return DRM_FORMAT_R8; return DRM_FORMAT_R8;
case GUD_PIXEL_FORMAT_XRGB1111: case GUD_PIXEL_FORMAT_XRGB1111:
return GUD_DRM_FORMAT_XRGB1111; return GUD_DRM_FORMAT_XRGB1111;
case GUD_PIXEL_FORMAT_RGB332:
return DRM_FORMAT_RGB332;
case GUD_PIXEL_FORMAT_RGB565: case GUD_PIXEL_FORMAT_RGB565:
return DRM_FORMAT_RGB565; return DRM_FORMAT_RGB565;
case GUD_PIXEL_FORMAT_XRGB8888: case GUD_PIXEL_FORMAT_XRGB8888:
......
...@@ -191,6 +191,8 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb, ...@@ -191,6 +191,8 @@ static int gud_prep_flush(struct gud_device *gdrm, struct drm_framebuffer *fb,
} }
} else if (format->format == DRM_FORMAT_R8) { } else if (format->format == DRM_FORMAT_R8) {
drm_fb_xrgb8888_to_gray8(buf, vaddr, fb, rect); drm_fb_xrgb8888_to_gray8(buf, vaddr, fb, rect);
} else if (format->format == DRM_FORMAT_RGB332) {
drm_fb_xrgb8888_to_rgb332(buf, vaddr, fb, rect);
} else if (format->format == DRM_FORMAT_RGB565) { } else if (format->format == DRM_FORMAT_RGB565) {
drm_fb_xrgb8888_to_rgb565(buf, vaddr, fb, rect, gud_is_big_endian()); drm_fb_xrgb8888_to_rgb565(buf, vaddr, fb, rect, gud_is_big_endian());
} else { } else {
......
...@@ -249,6 +249,7 @@ struct gud_state_req { ...@@ -249,6 +249,7 @@ struct gud_state_req {
#define GUD_PIXEL_FORMAT_R1 0x01 /* 1-bit monochrome */ #define GUD_PIXEL_FORMAT_R1 0x01 /* 1-bit monochrome */
#define GUD_PIXEL_FORMAT_R8 0x08 /* 8-bit greyscale */ #define GUD_PIXEL_FORMAT_R8 0x08 /* 8-bit greyscale */
#define GUD_PIXEL_FORMAT_XRGB1111 0x20 #define GUD_PIXEL_FORMAT_XRGB1111 0x20
#define GUD_PIXEL_FORMAT_RGB332 0x30
#define GUD_PIXEL_FORMAT_RGB565 0x40 #define GUD_PIXEL_FORMAT_RGB565 0x40
#define GUD_PIXEL_FORMAT_XRGB8888 0x80 #define GUD_PIXEL_FORMAT_XRGB8888 0x80
#define GUD_PIXEL_FORMAT_ARGB8888 0x81 #define GUD_PIXEL_FORMAT_ARGB8888 0x81
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment