gl-renderer: Fix SHM RGB888 and BGR888 endianness

The 24 bpp RGB and BGR SHM formats are meant to be stored little
endian, not big endian.

Fixes a regression in commit 815ccaff.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
Loïc Molinari 2025-04-01 12:00:14 +02:00
parent 9d841e39e8
commit 6bbc6c1256
3 changed files with 8 additions and 8 deletions

View file

@ -612,11 +612,11 @@ paint_format(void *image, const struct format *format, int width, int height)
color = GET_COLOR(i);
for (j = 0; j < width; j++) {
img8[(i * width + j) * 3 + 0] =
(color >> 16) & 0xff;
(color >> 0) & 0xff;
img8[(i * width + j) * 3 + 1] =
(color >> 8) & 0xff;
img8[(i * width + j) * 3 + 2] =
(color >> 0) & 0xff;
(color >> 16) & 0xff;
}
}
break;

View file

@ -363,7 +363,7 @@ static const struct pixel_format_info pixel_format_table[] = {
COLOR_MODEL(RGB),
BITS_RGBA_FIXED(8, 8, 8, 0),
.bpp = 24,
GL_FORMAT_INFO(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, RGB1),
GL_FORMAT_INFO(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, BGR1),
GL_FORMAT(GL_RGB),
GL_TYPE(GL_UNSIGNED_BYTE),
},
@ -372,7 +372,7 @@ static const struct pixel_format_info pixel_format_table[] = {
COLOR_MODEL(RGB),
BITS_RGBA_FIXED(8, 8, 8, 0),
.bpp = 24,
GL_FORMAT_INFO(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, BGR1),
GL_FORMAT_INFO(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, RGB1),
GL_FORMAT(GL_RGB),
GL_TYPE(GL_UNSIGNED_BYTE),
},

View file

@ -352,13 +352,13 @@ rgb888_create_buffer(struct client *client,
uint8_t b = src_row[x];
if (drm_format == DRM_FORMAT_RGB888) {
dst_row[x * 3 + 2] = b;
dst_row[x * 3 + 1] = g;
dst_row[x * 3 + 0] = r;
} else {
dst_row[x * 3 + 2] = r;
dst_row[x * 3 + 1] = g;
dst_row[x * 3 + 0] = b;
} else {
dst_row[x * 3 + 2] = b;
dst_row[x * 3 + 1] = g;
dst_row[x * 3 + 0] = r;
}
}
}