Skip to content

Commit d1275f7

Browse files
ngphibangaescolar
authored andcommitted
drivers: video: sw_generator: Support XRGB32 pixel format
Add support for XRGB32 pixel format as this is useful to test camera and display drivers on i.MX RT11xx Signed-off-by: Phi Bang Nguyen <[email protected]>
1 parent c720ee1 commit d1275f7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/video/video_sw_generator.c

+15
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ static int video_sw_generator_stream_stop(const struct device *dev)
7272
/* Black, Blue, Red, Purple, Green, Aqua, Yellow, White */
7373
uint16_t rgb565_colorbar_value[] = {0x0000, 0x001F, 0xF800, 0xF81F, 0x07E0, 0x07FF, 0xFFE0, 0xFFFF};
7474

75+
uint32_t xrgb32_colorbar_value[] = {0xFF000000, 0xFF0000FF, 0xFFFF0000, 0xFFFF00FF,
76+
0xFF00FF00, 0xFF00FFFF, 0xFFFFFF00, 0xFFFFFFFF};
77+
7578
static void __fill_buffer_colorbar(struct video_sw_generator_data *data, struct video_buffer *vbuf)
7679
{
7780
int bw = data->fmt.width / 8;
@@ -84,6 +87,10 @@ static void __fill_buffer_colorbar(struct video_sw_generator_data *data, struct
8487
uint16_t *pixel = (uint16_t *)&vbuf->buffer[i];
8588
*pixel = rgb565_colorbar_value[color_idx];
8689
i += 2;
90+
} else if (data->fmt.pixelformat == VIDEO_PIX_FMT_XRGB32) {
91+
uint32_t *pixel = (uint32_t *)&vbuf->buffer[i];
92+
*pixel = xrgb32_colorbar_value[color_idx];
93+
i += 4;
8794
}
8895
}
8996
}
@@ -184,6 +191,14 @@ static const struct video_format_cap fmts[] = {{
184191
.height_max = 1080,
185192
.width_step = 1,
186193
.height_step = 1,
194+
}, {
195+
.pixelformat = VIDEO_PIX_FMT_XRGB32,
196+
.width_min = 64,
197+
.width_max = 1920,
198+
.height_min = 64,
199+
.height_max = 1080,
200+
.width_step = 1,
201+
.height_step = 1,
187202
},
188203
{0}};
189204

0 commit comments

Comments
 (0)