backend-drm: Do not create a head for invalid blacklight values

This most likely is a driver fail, as we shouldn't be getting a zero
value for max_brightness. Later on, this will be used to compute a
normalized brightness which would trip a with a division by zero.
Rather than fixing that up, just don't enable backlight support and
reportat that to the user that we have an invalid max_brightness value
and not backlight support.

Fixes: #878

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2024-07-03 11:21:13 +03:00 committed by Daniel Stone
parent 08c7015a32
commit a7dad91d8f

View file

@ -2715,6 +2715,13 @@ drm_head_create(struct drm_device *device, drmModeConnector *conn,
goto err_update;
head->backlight = backlight_init(drm_device, conn->connector_type);
if (head->backlight && head->backlight->max_brightness == 0) {
weston_log("Failed to retreive a valid value for max_brightness"
" from connector %d. Backlight disabled\n",
head->connector.connector_id);
backlight_destroy(head->backlight);
head->backlight = NULL;
}
if (conn->connector_type == DRM_MODE_CONNECTOR_LVDS ||
conn->connector_type == DRM_MODE_CONNECTOR_eDP)