backend-drm: Hard-code zpos values if HW doesn't exposes them

This is based on the assumption that overlays are in between cursor and
primary plane and it is required to be able to assign views to planes,
even if the driver doesn't not expose such property.

As we hard-code them as immutable the commit part would not need any
further modifications.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Suggested-by: Daniel Stone <daniel.stone@collabora.com>
dev
Marius Vlad 5 years ago committed by Daniel Stone
parent 3dea57a9d5
commit e83e750183
  1. 58
      libweston/backend-drm/drm.c

@ -68,6 +68,61 @@
static const char default_seat[] = "seat0";
static void
drm_backend_create_faked_zpos(struct drm_backend *b)
{
struct drm_plane *plane;
uint64_t zpos = 0ULL;
uint64_t zpos_min_primary;
uint64_t zpos_min_overlay;
uint64_t zpos_min_cursor;
zpos_min_primary = zpos;
wl_list_for_each(plane, &b->plane_list, link) {
/* if the property is there, bail out sooner */
if (plane->props[WDRM_PLANE_ZPOS].prop_id != 0)
return;
if (plane->type != WDRM_PLANE_TYPE_PRIMARY)
continue;
zpos++;
}
zpos_min_overlay = zpos;
wl_list_for_each(plane, &b->plane_list, link) {
if (plane->type != WDRM_PLANE_TYPE_OVERLAY)
continue;
zpos++;
}
zpos_min_cursor = zpos;
wl_list_for_each(plane, &b->plane_list, link) {
if (plane->type != WDRM_PLANE_TYPE_CURSOR)
continue;
zpos++;
}
drm_debug(b, "[drm-backend] zpos property not found. "
"Using invented immutable zpos values:\n");
/* assume that invented zpos values are immutable */
wl_list_for_each(plane, &b->plane_list, link) {
if (plane->type == WDRM_PLANE_TYPE_PRIMARY) {
plane->zpos_min = zpos_min_primary;
plane->zpos_max = zpos_min_primary;
} else if (plane->type == WDRM_PLANE_TYPE_OVERLAY) {
plane->zpos_min = zpos_min_overlay;
plane->zpos_max = zpos_min_overlay;
} else if (plane->type == WDRM_PLANE_TYPE_CURSOR) {
plane->zpos_min = zpos_min_cursor;
plane->zpos_max = zpos_min_cursor;
}
drm_debug(b, "\t[plane] %s plane %d, zpos_min %"PRIu64", "
"zpos_max %"PRIu64"\n",
drm_output_get_plane_type_name(plane),
plane->plane_id, plane->zpos_min, plane->zpos_max);
}
}
static void
wl_array_remove_uint32(struct wl_array *array, uint32_t elm)
{
@ -2856,6 +2911,9 @@ drm_backend_create(struct weston_compositor *compositor,
goto err_udev_input;
}
/* 'compute' faked zpos values in case HW doesn't expose any */
drm_backend_create_faked_zpos(b);
/* A this point we have some idea of whether or not we have a working
* cursor plane. */
if (!b->cursors_are_broken)

Loading…
Cancel
Save