From: Marius Vlad Date: Thu, 29 Aug 2019 17:42:00 +0000 (+0300) Subject: backend-drm: Add zpos DRM-property X-Git-Tag: upstream/9.0.0~301 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cdd6fa2717f07afe5f719a388ebff116b9936684;p=platform%2Fupstream%2Fweston.git backend-drm: Add zpos DRM-property Functional no change, as nobody makes use of it. Only apply the zpos value if the zpos property is mutable (that is, zpos_max and zpos_min are not the same). Signed-off-by: Marius Vlad --- diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 29b68e38..2bd5b347 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -72,6 +72,10 @@ #define GBM_BO_USE_LINEAR (1 << 4) #endif +#ifndef DRM_PLANE_ZPOS_INVALID_PLANE +#define DRM_PLANE_ZPOS_INVALID_PLANE 0xffffffffffffffffULL +#endif + /** * A small wrapper to print information into the 'drm-backend' debug scope. * @@ -169,6 +173,7 @@ enum wdrm_plane_property { WDRM_PLANE_IN_FORMATS, WDRM_PLANE_IN_FENCE_FD, WDRM_PLANE_FB_DAMAGE_CLIPS, + WDRM_PLANE_ZPOS, WDRM_PLANE__COUNT }; @@ -385,6 +390,8 @@ struct drm_plane_state { int32_t dest_x, dest_y; uint32_t dest_w, dest_h; + uint64_t zpos; + bool complete; /* We don't own the fd, so we shouldn't close it */ @@ -426,6 +433,9 @@ struct drm_plane { /* The last state submitted to the kernel for this plane. */ struct drm_plane_state *state_cur; + uint64_t zpos_min; + uint64_t zpos_max; + struct wl_list link; struct { diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index 878d71ec..dd579e3c 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -680,6 +680,7 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane, { struct drm_plane *plane; drmModeObjectProperties *props; + uint64_t *zpos_range_values; uint32_t num_formats = (kplane) ? kplane->count_formats : 1; plane = zalloc(sizeof(*plane) + @@ -711,6 +712,18 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane, props, WDRM_PLANE_TYPE__COUNT); + zpos_range_values = + drm_property_get_range_values(&plane->props[WDRM_PLANE_ZPOS], + props); + + if (zpos_range_values) { + plane->zpos_min = zpos_range_values[0]; + plane->zpos_max = zpos_range_values[1]; + } else { + plane->zpos_min = DRM_PLANE_ZPOS_INVALID_PLANE; + plane->zpos_max = DRM_PLANE_ZPOS_INVALID_PLANE; + } + if (drm_plane_populate_formats(plane, kplane, props) < 0) { drmModeFreeObjectProperties(props); goto err; @@ -724,6 +737,8 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane, plane->count_formats = 1; plane->formats[0].format = format; plane->type = type; + plane->zpos_max = DRM_PLANE_ZPOS_INVALID_PLANE; + plane->zpos_min = DRM_PLANE_ZPOS_INVALID_PLANE; } if (plane->type == WDRM_PLANE_TYPE__COUNT) diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c index 4cb242d3..5468afb3 100644 --- a/libweston/backend-drm/kms.c +++ b/libweston/backend-drm/kms.c @@ -77,6 +77,7 @@ const struct drm_property_info plane_props[] = { [WDRM_PLANE_IN_FORMATS] = { .name = "IN_FORMATS" }, [WDRM_PLANE_IN_FENCE_FD] = { .name = "IN_FENCE_FD" }, [WDRM_PLANE_FB_DAMAGE_CLIPS] = { .name = "FB_DAMAGE_CLIPS" }, + [WDRM_PLANE_ZPOS] = { .name = "zpos" }, }; struct drm_property_enum_info dpms_state_enums[] = { @@ -1050,6 +1051,13 @@ drm_output_apply_state_atomic(struct drm_output_state *state, plane_state->in_fence_fd); } + /* do note, that 'invented' zpos values are set as immutable */ + if (plane_state->zpos != DRM_PLANE_ZPOS_INVALID_PLANE && + plane_state->plane->zpos_min != plane_state->plane->zpos_max) + ret |= plane_add_prop(req, plane, + WDRM_PLANE_ZPOS, + plane_state->zpos); + if (ret != 0) { weston_log("couldn't set plane state\n"); return ret; diff --git a/libweston/backend-drm/state-helpers.c b/libweston/backend-drm/state-helpers.c index 3956960c..79b800e7 100644 --- a/libweston/backend-drm/state-helpers.c +++ b/libweston/backend-drm/state-helpers.c @@ -48,6 +48,7 @@ drm_plane_state_alloc(struct drm_output_state *state_output, state->output_state = state_output; state->plane = plane; state->in_fence_fd = -1; + state->zpos = DRM_PLANE_ZPOS_INVALID_PLANE; pixman_region32_init(&state->damage); /* Here we only add the plane state to the desired link, and not @@ -80,6 +81,7 @@ drm_plane_state_free(struct drm_plane_state *state, bool force) wl_list_init(&state->link); state->output_state = NULL; state->in_fence_fd = -1; + state->zpos = DRM_PLANE_ZPOS_INVALID_PLANE; pixman_region32_fini(&state->damage); if (force || state != state->plane->state_cur) {