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 <marius.vlad@collabora.com>
This commit is contained in:
parent
1accffe053
commit
cdd6fa2717
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user