summarylogtreecommitdiffstats
path: root/0010-compositor-drm-Cleanup-scanout-plane-state-upon-head.patch
blob: 7d4d3d064182bec3784a4e0355625a673eb25d8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From 0868ca341affb984bfcd86cf578bb9734367dae7 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Fri, 21 Jun 2019 13:51:11 -0700
Subject: [PATCH 10/10] compositor-drm: Cleanup scanout plane state upon head
 detach
X-NVConfidentiality: public

When using EGLStreams and a head is detached, the scanout plane buffers
will be destroyed upon output destruction as the stream is torn down.
That needs to be reflected in the drm structures that keep track of all
this.

This change ensures the scanout plane state is freed appropriately upon
output destruction when using EGLStreams as well as GBM.

Signed-off-by: Miguel A Vico Moya <mvicomoya@nvidia.com>
---
 libweston/compositor-drm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 100b3050..17f2e103 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -5232,8 +5232,9 @@ drm_output_fini_egl(struct drm_output *output)
 	/* Destroying the GBM surface will destroy all our GBM buffers,
 	 * regardless of refcount. Ensure we destroy them here. */
 	if (!b->shutting_down &&
-	    output->scanout_plane->state_cur->fb &&
-	    output->scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE) {
+	    ((output->scanout_plane->state_cur->fb &&
+	      output->scanout_plane->state_cur->fb->type == BUFFER_GBM_SURFACE) ||
+	     b->use_egldevice)) {
 		drm_plane_state_free(output->scanout_plane->state_cur, true);
 		output->scanout_plane->state_cur =
 			drm_plane_state_alloc(NULL, output->scanout_plane);
-- 
2.21.0