1From 77f9ebdfd31791471add2ec7228f4d47558d68cd Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Tue, 13 Jul 2021 10:56:56 +0800
4Subject: [PATCH 47/79] Support sw-cursor config
5
6Tested with:
7[core]
8sw-cursor=true
9
10Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
11---
12 compositor/main.c               | 2 ++
13 include/libweston/backend-drm.h | 2 ++
14 libweston/backend-drm/drm.c     | 2 ++
15 3 files changed, 6 insertions(+)
16
17diff --git a/compositor/main.c b/compositor/main.c
18index 2010c02..33dd4e5 100644
19--- a/compositor/main.c
20+++ b/compositor/main.c
21@@ -2685,6 +2685,8 @@ load_drm_backend(struct weston_compositor *c,
22 	                               &config.pageflip_timeout, 0);
23 	weston_config_section_get_bool(section, "pixman-shadow",
24 				       &config.use_pixman_shadow, true);
25+	weston_config_section_get_bool(section, "sw-cursor",
26+				       &config.use_sw_cursor, false);
27 	if (without_input)
28 		c->require_input = !without_input;
29
30diff --git a/include/libweston/backend-drm.h b/include/libweston/backend-drm.h
31index af2da4a..cfbf69a 100644
32--- a/include/libweston/backend-drm.h
33+++ b/include/libweston/backend-drm.h
34@@ -223,6 +223,8 @@ struct weston_drm_backend_config {
35
36 	/** Use shadow buffer if using Pixman-renderer. */
37 	bool use_pixman_shadow;
38+
39+	bool use_sw_cursor;
40 };
41
42 #ifdef  __cplusplus
43diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
44index 884dcba..4979bf5 100644
45--- a/libweston/backend-drm/drm.c
46+++ b/libweston/backend-drm/drm.c
47@@ -4284,6 +4284,8 @@ drm_backend_create(struct weston_compositor *compositor,
48 	/* 'compute' faked zpos values in case HW doesn't expose any */
49 	drm_backend_create_faked_zpos(b);
50
51+	b->cursors_are_broken |= config->use_sw_cursor;
52+
53 	/* A this point we have some idea of whether or not we have a working
54 	 * cursor plane. */
55 	if (!b->cursors_are_broken)
56--
572.20.1
58
59