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>
This commit is contained in:
Veeresh Kadasani 2020-04-24 13:23:52 +09:00 committed by Daniel Stone
parent f35eccc6fa
commit c0f3cb87be
3 changed files with 16 additions and 6 deletions

View File

@ -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 |=

View File

@ -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;
}

View File

@ -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 "