backend-drm: allow more formats with pixman-renderer

Clean up the code a little by dropping the now unnecessary switch case
in drm_output_init_pixman(). As a side effect, this enables all formats
that have a pixman_format entry in the pixel format table:

  - rgb565
  - xrgb8888
  - argb8888
  - xbgr8888
  - abgr8888
  - rgbx8888
  - rgba8888
  - bgrx8888
  - bgra8888
  - xrgb2101010
  - argb2101010
  - xbgr2101010
  - abgr2101010

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
Philipp Zabel 2023-01-27 17:15:43 +01:00 committed by Pekka Paalanen
parent 4c3febfb52
commit 397e66a4dd
2 changed files with 11 additions and 11 deletions

View File

@ -1179,7 +1179,6 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b)
struct drm_device *device = output->device;
int w = output->base.current_mode->width;
int h = output->base.current_mode->height;
uint32_t format = output->format->format;
unsigned int i;
const struct pixman_renderer_output_options options = {
.use_shadow = b->use_pixman_shadow,
@ -1187,12 +1186,11 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b)
.format = output->format
};
switch (format) {
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_RGB565:
break;
default:
weston_log("Unsupported pixman format 0x%x\n", format);
assert(options.format);
if (!options.format->pixman_format) {
weston_log("Unsupported pixel format %s\n",
options.format->drm_format_name);
return -1;
}
@ -1201,7 +1199,8 @@ drm_output_init_pixman(struct drm_output *output, struct drm_backend *b)
/* FIXME error checking */
for (i = 0; i < ARRAY_LENGTH(output->dumb); i++) {
output->dumb[i] = drm_fb_create_dumb(device, w, h, format);
output->dumb[i] = drm_fb_create_dumb(device, w, h,
options.format->format);
if (!output->dumb[i])
goto err;

View File

@ -54,8 +54,9 @@ the kernel DRM subsystem in
.B drm_fourcc.h
header without the DRM_FORMAT_ prefix.
The actually supported pixel formats depend on the DRM driver and hardware,
and the renderer used. Using Pixman-renderer, DRM-backend supports only
.BR xrgb8888 " and " rgb565 .
and the renderer used. Using Pixman-renderer, DRM-backend supports
.BR xrgb8888 ", " xrgb2101010 ", " rgb565
and some of their permutations.
The formats supported with GL-renderer depend on the EGL and OpenGL ES 2 or 3
implementations. The names are case-insensitive. This setting applies only to
.RB "outputs in SDR mode, see " eotf-mode " in " weston.ini (5).