diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 260ee5fbc..07b00d803 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -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); diff --git a/libweston/backend-drm/drm-kms-enums.h b/libweston/backend-drm/drm-kms-enums.h index 955a3ae15..ad9a11148 100644 --- a/libweston/backend-drm/drm-kms-enums.h +++ b/libweston/backend-drm/drm-kms-enums.h @@ -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 }; diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index f13df83f7..0e753b4f7 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -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); diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c index 47db319f1..c8bf70afb 100644 --- a/libweston/backend-drm/kms.c +++ b/libweston/backend-drm/kms.c @@ -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) {