backend-drm: Add support for the BACKGROUND_COLOR CRTC property

Signed-off-by: Robert Mader <robert.mader@collabora.com>
This commit is contained in:
Robert Mader 2025-09-04 15:20:42 +02:00
parent e96d00b012
commit 77b1d4af96
4 changed files with 25 additions and 0 deletions

View file

@ -581,6 +581,9 @@ struct drm_crtc {
/* CRTC prop WDRM_CRTC_GAMMA_LUT_SIZE */
uint32_t lut_size;
/* CRTC prop WDRM_CRTC_BACKGROUND_COLOR */
uint64_t background_color;
};
struct drm_output {
@ -771,6 +774,9 @@ drm_output_get_handle_type_name(struct drm_plane_handle *h)
struct drm_crtc *
drm_crtc_find(struct drm_device *device, uint32_t crtc_id);
bool
drm_crtc_supports_background_color(struct drm_crtc *crtc);
struct drm_head *
drm_head_find_by_connector(struct drm_backend *backend, struct drm_device *device, uint32_t connector_id);

View file

@ -197,5 +197,6 @@ enum wdrm_crtc_property {
WDRM_CRTC_GAMMA_LUT,
WDRM_CRTC_GAMMA_LUT_SIZE,
WDRM_CRTC_VRR_ENABLED,
WDRM_CRTC_BACKGROUND_COLOR,
WDRM_CRTC__COUNT
};

View file

@ -2512,6 +2512,10 @@ drm_crtc_create(struct drm_device *device, uint32_t crtc_id, uint32_t pipe)
drm_property_get_value(&crtc->props_crtc[WDRM_CRTC_GAMMA_LUT_SIZE],
props, 0);
crtc->background_color =
drm_property_get_value(&crtc->props_crtc[WDRM_CRTC_BACKGROUND_COLOR],
props, 0);
/* Add it to the last position of the DRM-backend CRTC list */
wl_list_insert(device->crtc_list.prev, &crtc->link);

View file

@ -263,6 +263,7 @@ const struct drm_property_info crtc_props[] = {
[WDRM_CRTC_GAMMA_LUT] = { .name = "GAMMA_LUT", },
[WDRM_CRTC_GAMMA_LUT_SIZE] = { .name = "GAMMA_LUT_SIZE", },
[WDRM_CRTC_VRR_ENABLED] = { .name = "VRR_ENABLED", },
[WDRM_CRTC_BACKGROUND_COLOR] = { .name = "BACKGROUND_COLOR", },
};
@ -1039,6 +1040,15 @@ crtc_add_prop_zero_ok(drmModeAtomicReq *req, struct drm_crtc *crtc,
return crtc_add_prop(req, crtc, prop, val);
}
bool
drm_crtc_supports_background_color(struct drm_crtc *crtc)
{
if (crtc->props_crtc[WDRM_CRTC_BACKGROUND_COLOR].prop_id != 0)
return true;
return false;
}
static int
connector_add_prop(drmModeAtomicReq *req, struct drm_connector *connector,
enum wdrm_connector_property prop, uint64_t val)
@ -1338,6 +1348,10 @@ drm_output_apply_state_atomic(struct drm_output_state *state,
ret |= crtc_add_prop_zero_ok(req, crtc, WDRM_CRTC_VRR_ENABLED,
wdrm_vrr_enabled_from_output(output));
ret |= crtc_add_prop_zero_ok(req, crtc,
WDRM_CRTC_BACKGROUND_COLOR,
crtc->background_color);
/* No need for the DPMS property, since it is implicit in
* routing and CRTC activity. */
wl_list_for_each(head, &output->base.head_list, base.output_link) {