diff options
author | Veeresh Kadasani <external.vkadasani@jp.adit-jv.com> | 2020-04-24 13:23:52 +0900 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2023-03-30 17:29:57 +0100 |
commit | c0f3cb87be776941546a71dc10d37312a0b2636f (patch) | |
tree | fbd3eb7c57c225654e0d8a2ad02e0ea9cf4b9933 | |
parent | f35eccc6faa6c9f862ff4b936f086955f34e4046 (diff) | |
download | weston-c0f3cb87be776941546a71dc10d37312a0b2636f.tar.gz |
backend-drm: Pass view alpha to plane state and commit
We map view alpha(0.0-1.0) to plane state's alpha
by using the max plane alpha value got from drm.
Signed-off-by: Hsuan-Yu Lin <hlin@jp.adit-jv.com>
Signed-off-by: Veeresh Kadasani <external.vkadasani@jp.adit-jv.com>
Signed-off-by: Vinh Nguyen Trong <Vinh.NguyenTrong@vn.bosch.com>
-rw-r--r-- | libweston/backend-drm/fb.c | 6 | ||||
-rw-r--r-- | libweston/backend-drm/state-helpers.c | 8 | ||||
-rw-r--r-- | libweston/backend-drm/state-propose.c | 8 |
3 files changed, 16 insertions, 6 deletions
diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c index 40d4bf0c..0c2c0f6e 100644 --- a/libweston/backend-drm/fb.c +++ b/libweston/backend-drm/fb.c @@ -695,12 +695,6 @@ drm_fb_get_from_paint_node(struct drm_output_state *state, struct drm_fb *fb; struct drm_plane *plane; - if (ev->alpha != 1.0f) { - pnode->try_view_on_plane_failure_reasons |= - FAILURE_REASONS_GLOBAL_ALPHA; - return NULL; - } - if (ev->surface->protection_mode == WESTON_SURFACE_PROTECTION_MODE_ENFORCED && ev->surface->desired_protection > output->base.current_protection) { pnode->try_view_on_plane_failure_reasons |= diff --git a/libweston/backend-drm/state-helpers.c b/libweston/backend-drm/state-helpers.c index 57a2621f..b8fe7d87 100644 --- a/libweston/backend-drm/state-helpers.c +++ b/libweston/backend-drm/state-helpers.c @@ -225,6 +225,8 @@ drm_plane_state_coords_for_paint_node(struct drm_plane_state *state, pixman_box32_t *box; struct weston_coord corners[2]; float sxf1, syf1, sxf2, syf2; + uint16_t min_alpha = state->plane->alpha_min; + uint16_t max_alpha = state->plane->alpha_max; if (!drm_paint_node_transform_supported(node, state->plane)) return false; @@ -305,6 +307,12 @@ drm_plane_state_coords_for_paint_node(struct drm_plane_state *state, /* apply zpos if available */ state->zpos = zpos; + /* The alpha of the view is normalized to alpha value range + * [min_alpha, max_alpha] that got from drm. The alpha value would + * never exceed max_alpha if ev->alpha <= 1.0. + */ + state->alpha = min_alpha + (uint16_t)round((max_alpha - min_alpha) * ev->alpha); + return true; } diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c index 7cd7714c..077de824 100644 --- a/libweston/backend-drm/state-propose.c +++ b/libweston/backend-drm/state-propose.c @@ -583,6 +583,14 @@ drm_output_find_plane_for_view(struct drm_output_state *state, continue; } + /* if view has alpha check if this plane supports plane alpha */ + if (ev->alpha != 1.0f && plane->alpha_max == plane->alpha_min) { + drm_debug(b, "\t\t\t\t[plane] not trying plane %d:" + "plane-alpha not supported\n", + plane->plane_id); + continue; + } + if (plane->zpos_min >= current_lowest_zpos) { drm_debug(b, "\t\t\t\t[plane] not trying plane %d: " "plane's minimum zpos (%"PRIu64") above " |