mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2025-01-18 10:27:00 +01:00
Add support for reading immutable plane zpos
If zpos is present, instead of guessing the zpos from the plane type, just use it. If two planes have the same zpos, we consider their relative position as undefined. We don't handle the case where some planes have zpos set but some others don't. References: https://github.com/emersion/libhwc/issues/4
This commit is contained in:
parent
42db49c6fe
commit
dac885222b
1 changed files with 10 additions and 8 deletions
18
display.c
18
display.c
|
@ -41,7 +41,8 @@ static struct hwc_plane *plane_create(struct hwc_display *display, uint32_t id)
|
|||
uint32_t i;
|
||||
drmModePropertyRes *drm_prop;
|
||||
struct hwc_plane_property *prop;
|
||||
int type = -1;
|
||||
uint64_t value;
|
||||
bool has_zpos = false;
|
||||
|
||||
plane = calloc(1, sizeof(*plane));
|
||||
if (plane == NULL) {
|
||||
|
@ -80,17 +81,18 @@ static struct hwc_plane *plane_create(struct hwc_display *display, uint32_t id)
|
|||
drmModeFreeProperty(drm_prop);
|
||||
plane->props_len++;
|
||||
|
||||
if (strcmp(prop->name, "type") == 0) {
|
||||
type = drm_props->prop_values[i];
|
||||
value = drm_props->prop_values[i];
|
||||
if (strcmp(prop->name, "type") == 0 && !has_zpos) {
|
||||
plane->zpos = guess_plane_zpos_from_type(display,
|
||||
plane->id,
|
||||
type);
|
||||
} else if (strcmp(prop->name, "zpos") == 0) {
|
||||
plane->zpos = zpos;
|
||||
has_zpos = true;
|
||||
}
|
||||
}
|
||||
drmModeFreeObjectProperties(drm_props);
|
||||
|
||||
if (type >= 0) {
|
||||
plane->zpos = guess_plane_zpos_from_type(display, plane->id,
|
||||
type);
|
||||
}
|
||||
|
||||
hwc_list_insert(display->planes.prev, &plane->link);
|
||||
|
||||
return plane;
|
||||
|
|
Loading…
Reference in a new issue