vo_drm: add support for RGB565

This image format is quite legacy, but uses half as much bandwidth as
the closest XRGB8888, at 16bpp instead of 32bpp, so it is useful to
support on the slowest/oldest display controllers.
This commit is contained in:
Link Mauve
2026-10-15 22:11:24 +02:00
committed by Kacper Michajłow
parent b6cab8fa0c
commit a2cd83c56d
5 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -646,12 +646,13 @@ Available video output drivers are:
lower resolution (the video when handled by the hwdec will be on the
drmprime-video plane and at full 4K resolution)
``--drm-format=<xrgb8888|xbgr8888|xrgb2101010|xbgr2101010|yuyv>``
``--drm-format=<xrgb8888|xbgr8888|xrgb2101010|xbgr2101010|rgb565|yuyv>``
Select the DRM format to use (default: xrgb8888). This allows you to
choose the bit depth and color type of the DRM mode.
xrgb8888 is your usual 24bpp packed RGB format with 8 bits of padding.
xrgb2101010 is a 30bpp packed RGB format with 2 bits of padding.
rgb565 is a 16bpp packed RGB format with reduced colour accuracy.
yuyv is a 32bpp packed YUV 4:2:2 format. No planar formats are currently
supported.
+1
View File
@@ -99,6 +99,7 @@ const struct m_sub_options drm_conf = {
{"xrgb2101010", DRM_OPTS_FORMAT_XRGB2101010},
{"xbgr8888", DRM_OPTS_FORMAT_XBGR8888},
{"xbgr2101010", DRM_OPTS_FORMAT_XBGR2101010},
{"rgb565", DRM_OPTS_FORMAT_RGB565},
{"yuyv", DRM_OPTS_FORMAT_YUYV})},
{"drm-draw-surface-size", OPT_SIZE_BOX(draw_surface_size)},
{"drm-vrr-enabled", OPT_CHOICE(vrr_enabled,
+1
View File
@@ -34,6 +34,7 @@ enum {
DRM_OPTS_FORMAT_XRGB2101010,
DRM_OPTS_FORMAT_XBGR8888,
DRM_OPTS_FORMAT_XBGR2101010,
DRM_OPTS_FORMAT_RGB565,
DRM_OPTS_FORMAT_YUYV,
};
+4
View File
@@ -594,6 +594,10 @@ static bool drm_egl_init(struct ra_ctx *ctx)
argb_format = GBM_FORMAT_ABGR8888;
xrgb_format = GBM_FORMAT_XBGR8888;
break;
case DRM_OPTS_FORMAT_RGB565:
argb_format = GBM_FORMAT_RGB565;
xrgb_format = GBM_FORMAT_RGB565;
break;
default:
if (drm->opts->drm_format != DRM_OPTS_FORMAT_XRGB8888) {
MP_VERBOSE(ctx->vo, "Requested format not supported by context, "
+4
View File
@@ -109,6 +109,10 @@ static struct framebuffer *setup_framebuffer(struct vo *vo)
p->drm_format = DRM_FORMAT_XBGR8888;
p->imgfmt = IMGFMT_RGB0;
break;
case DRM_OPTS_FORMAT_RGB565:
p->drm_format = DRM_FORMAT_RGB565;
p->imgfmt = IMGFMT_RGB565;
break;
case DRM_OPTS_FORMAT_YUYV:
p->drm_format = DRM_FORMAT_YUYV;
p->imgfmt = pixfmt2imgfmt(AV_PIX_FMT_YUYV422);