[PATCH weston 2/2] compositor-drm: Restore use-current-mode functionality

Armin Krezović krezovic.armin at gmail.com
Sun Oct 9 21:48:17 UTC 2016


It got lost during the porting to the config API.

Signed-off-by: Armin Krezović <krezovic.armin at gmail.com>
---
 compositor/main.c          | 9 +++++++--
 libweston/compositor-drm.c | 3 ---
 libweston/compositor-drm.h | 1 -
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/compositor/main.c b/compositor/main.c
index 320305c..ffeadfb 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -78,6 +78,7 @@ struct wet_compositor {
 	struct weston_config *config;
 	struct wet_output_config *parsed_options;
 	struct wl_listener pending_output_listener;
+	bool drm_use_current_mode;
 };
 
 static FILE *weston_logfile = NULL;
@@ -1116,6 +1117,7 @@ drm_backend_output_configure(struct wl_listener *listener, void *data)
 {
 	struct weston_output *output = data;
 	struct weston_config *wc = wet_get_config(output->compositor);
+	struct wet_compositor *wet = to_wet_compositor(output->compositor);
 	struct weston_config_section *section;
 	const struct weston_drm_output_api *api = weston_drm_output_get_api(output->compositor);
 	enum weston_drm_backend_output_mode mode =
@@ -1138,7 +1140,7 @@ drm_backend_output_configure(struct wl_listener *listener, void *data)
 		weston_output_disable(output);
 		free(s);
 		return;
-	} else if (strcmp(s, "current") == 0) {
+	} else if (wet->drm_use_current_mode || strcmp(s, "current") == 0) {
 		mode = WESTON_DRM_BACKEND_OUTPUT_CURRENT;
 	} else if (strcmp(s, "preferred") != 0) {
 		modeline = s;
@@ -1176,13 +1178,16 @@ load_drm_backend(struct weston_compositor *c,
 {
 	struct weston_drm_backend_config config = {{ 0, }};
 	struct weston_config_section *section;
+	struct wet_compositor *wet = to_wet_compositor(c);
 	int ret = 0;
 
+	wet->drm_use_current_mode = false;
+
 	const struct weston_option options[] = {
 		{ WESTON_OPTION_INTEGER, "connector", 0, &config.connector },
 		{ WESTON_OPTION_STRING, "seat", 0, &config.seat_id },
 		{ WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
-		{ WESTON_OPTION_BOOLEAN, "current-mode", 0, &config.use_current_mode },
+		{ WESTON_OPTION_BOOLEAN, "current-mode", 0, &wet->drm_use_current_mode },
 		{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
 	};
 
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 795e9f0..84da32b 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -122,8 +122,6 @@ struct drm_backend {
 
 	int32_t cursor_width;
 	int32_t cursor_height;
-
-	bool use_current_mode;
 };
 
 struct drm_mode {
@@ -3177,7 +3175,6 @@ drm_backend_create(struct weston_compositor *compositor,
 	b->sprites_are_broken = 1;
 	b->compositor = compositor;
 	b->use_pixman = config->use_pixman;
-	b->use_current_mode = config->use_current_mode;
 
 	if (parse_gbm_format(config->gbm_format, GBM_FORMAT_XRGB8888, &b->gbm_format) < 0)
 		goto err_compositor;
diff --git a/libweston/compositor-drm.h b/libweston/compositor-drm.h
index 8f89a2b..2e2995a 100644
--- a/libweston/compositor-drm.h
+++ b/libweston/compositor-drm.h
@@ -138,7 +138,6 @@ struct weston_drm_backend_config {
 	 */
 	void (*configure_device)(struct weston_compositor *compositor,
 				 struct libinput_device *device);
-	bool use_current_mode;
 };
 
 #ifdef  __cplusplus
-- 
2.10.1



More information about the wayland-devel mailing list