summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2023-02-04 19:59:33 +0200
committerMarius Vlad <marius.vlad@collabora.com>2023-05-16 10:49:17 +0300
commitdf70b81ed7d8d80043b016b406ce79b1f1995af0 (patch)
treede08054813772fcdc2b9157e7c2b203e02aecaed
parent70479268340f50cebe3f1dec45d51c1ec5b140e7 (diff)
downloadweston-df70b81ed7d8d80043b016b406ce79b1f1995af0.tar.gz
backend-drm: Do not overwrite plane's index when creating virtual plane
Starting with commit 4cde507be6a116 "backend-drm: fix plane sorting" the plane list will have a descending order of the planes rather than ascending. This reversed order had the side-effect of exposing the fact that we don't set-up a plane index when creating the drm_plane using the DRM virtual API. Without settting a plane index for that drm_plane we effectively overwrite the plane index which has the 0 (zero) entry. This wasn't an issue before commit 4cde507be6a116 "backend-drm: fix plane sorting" as it seems we never picked up that plane index as being a suitable one due to the fact that those were assigned to primary planes, but after that commit, the cursor plane will be one getting the 0 (zero) plane index. Finally, this would trip over because we attempt to place a (cursor) view on a primary plane (where it would've normally be a cursor plane) and we end up with no framebuffer ref. This is fixed trivially by assigning a plane index, different than the ones already created by create_spirtes(). Signed-off-by: Marius Vlad <marius.vlad@collabora.com> (cherry picked from commit 27ce9dadd8865b266f72f848b784d61aeaf8b228)
-rw-r--r--libweston/backend-drm/drm-virtual.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libweston/backend-drm/drm-virtual.c b/libweston/backend-drm/drm-virtual.c
index cf8de76a..931cb822 100644
--- a/libweston/backend-drm/drm-virtual.c
+++ b/libweston/backend-drm/drm-virtual.c
@@ -81,6 +81,20 @@ drm_virtual_crtc_destroy(struct drm_crtc *crtc)
free(crtc);
}
+static uint32_t
+get_drm_plane_index_maximum(struct drm_device *device)
+{
+ uint32_t max = 0;
+ struct drm_plane *p;
+
+ wl_list_for_each(p, &device->plane_list, link) {
+ if (p->plane_idx > max)
+ max = p->plane_idx;
+ }
+
+ return max;
+}
+
/**
* Create a drm_plane for virtual output
*
@@ -125,6 +139,7 @@ drm_virtual_plane_create(struct drm_device *device, struct drm_output *output)
goto err;
weston_plane_init(&plane->base, b->compositor, 0, 0);
+ plane->plane_idx = get_drm_plane_index_maximum(device) + 1;
wl_list_insert(&device->plane_list, &plane->link);
return plane;