backend-drm: default to XRGB2101010 for HDR
Trying to do HDR with XRGB8888 is a bit like using RGB565 on SDR: you get visible color quantization and banding in gradients (without dithering which Weston does not implement yet, and might not work too well for HDR anyway). Therefore, on any HDR mode, default output framebuffer format to 10 bpc instead of 8 bpc. Ideally we'd also optionally try 16F or 16 bpc formats, but automatic fallbacks for those are more complicated to arrange. You can still configure 16F or 16 bpc manually. This patch also moves the default format setting from drm_output_set_gbm_format() to drm_output_enable(), because setting the default now requires eotf_mode. Frontends may call set_gbm_format() first and set eotf_mode next. This does create an awkward situation for outputs that a frontend disables and re-enables. This patch here makes sure that the old output configuration remains, but changing eotf_mode may not change the default format. One needs to call set_gbm_format(NULL) to re-evaluate the default format. Resetting the format on drm_output_deinit() would lose the current setting. DRM_FORMAT_INVALID was introduced in libdrm 2.4.95 which we already hard-depend on. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
committed by
Pekka Paalanen
parent
33d553f833
commit
e6a9e3c4ee
@@ -1416,10 +1416,10 @@ drm_output_set_gbm_format(struct weston_output *base,
|
||||
const char *gbm_format)
|
||||
{
|
||||
struct drm_output *output = to_drm_output(base);
|
||||
struct drm_backend *b = to_drm_backend(base->compositor);
|
||||
|
||||
if (parse_gbm_format(gbm_format, b->gbm_format, &output->gbm_format) == -1)
|
||||
output->gbm_format = b->gbm_format;
|
||||
if (parse_gbm_format(gbm_format,
|
||||
DRM_FORMAT_INVALID, &output->gbm_format) == -1)
|
||||
output->gbm_format = DRM_FORMAT_INVALID;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1855,6 +1855,13 @@ drm_output_enable(struct weston_output *base)
|
||||
|
||||
assert(!output->virtual);
|
||||
|
||||
if (output->gbm_format == DRM_FORMAT_INVALID) {
|
||||
if (output->base.eotf_mode != WESTON_EOTF_MODE_SDR)
|
||||
output->gbm_format = DRM_FORMAT_XRGB2101010;
|
||||
else
|
||||
output->gbm_format = b->gbm_format;
|
||||
}
|
||||
|
||||
ret = drm_output_attach_crtc(output);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
@@ -2301,6 +2308,7 @@ drm_output_create(struct weston_compositor *compositor, const char *name)
|
||||
output->backend = b;
|
||||
output->crtc = NULL;
|
||||
|
||||
output->gbm_format = DRM_FORMAT_INVALID;
|
||||
#ifdef BUILD_DRM_GBM
|
||||
output->gbm_bo_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user