1From 5a2f8922a7fd99a74e1079c8d3a299294a55e8a3 Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Thu, 30 Jun 2022 09:16:58 +0800
4Subject: [PATCH 73/93] backend-drm: Don't try to prepare non-cursor view in
5 renderer-only mode
6
7It would fail out in the later check anyway.
8
9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
10---
11 libweston/backend-drm/state-propose.c | 15 +++++++++++++++
12 1 file changed, 15 insertions(+)
13
14diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c
15index 69d49bc..b2f0f53 100644
16--- a/libweston/backend-drm/state-propose.c
17+++ b/libweston/backend-drm/state-propose.c
18@@ -438,6 +438,14 @@ dmabuf_feedback_maybe_update(struct drm_device *device, struct weston_view *ev,
19 	return true;
20 }
21
22+static struct weston_layer *
23+get_view_layer(struct weston_view *view)
24+{
25+	if (view->parent_view)
26+		return get_view_layer(view->parent_view);
27+	return view->layer_link.layer;
28+}
29+
30 static struct drm_plane_state *
31 drm_output_find_plane_for_view(struct drm_output_state *state,
32 			       struct weston_paint_node *pnode,
33@@ -453,6 +461,7 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
34 	struct drm_plane *plane;
35
36 	struct weston_view *ev = pnode->view;
37+	struct weston_layer *layer;
38 	struct weston_buffer *buffer;
39 	struct drm_fb *fb = NULL;
40
41@@ -468,6 +477,12 @@ drm_output_find_plane_for_view(struct drm_output_state *state,
42 		return NULL;
43 	}
44
45+	/* only allow cursor in renderer-only mode */
46+	layer = get_view_layer(ev);
47+	if (mode == DRM_OUTPUT_PROPOSE_STATE_RENDERER_ONLY &&
48+	    layer->position != WESTON_LAYER_POSITION_CURSOR)
49+		return NULL;
50+
51 	buffer = ev->surface->buffer_ref.buffer;
52 	if (buffer->type == WESTON_BUFFER_SOLID) {
53 		pnode->try_view_on_plane_failure_reasons |=
54--
552.20.1
56
57