[PATCH weston v3 3/3] fbdev-backend: move output transform configuration

Benoit Gschwind gschwind at gnu-log.net
Wed Apr 27 21:56:44 UTC 2016


The output transform configuration is moved into weston and added to the
fbdev configuration structure.

Signed-off-by: Benoit Gschwind <gschwind at gnu-log.net>
---
 src/compositor-fbdev.c | 17 ++++-------------
 src/compositor-fbdev.h |  2 ++
 src/main.c             |  8 ++++++++
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 619f969..4029714 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -60,6 +60,7 @@ struct fbdev_backend {
 	struct udev_input input;
 	int use_pixman;
 	char *device;
+	uint32_t output_transform;
 	struct wl_listener session_listener;
 };
 
@@ -452,11 +453,8 @@ static int
 fbdev_output_create(struct fbdev_backend *backend)
 {
 	struct fbdev_output *output;
-	struct weston_config_section *section;
 	int fb_fd;
 	struct wl_event_loop *loop;
-	uint32_t config_transform;
-	char *s;
 
 	weston_log("Creating fbdev output.\n");
 
@@ -502,19 +500,10 @@ fbdev_output_create(struct fbdev_backend *backend)
 	output->base.model = output->fb_info.id;
 	output->base.name = strdup("fbdev");
 
-	section = weston_config_get_section(backend->compositor->config,
-					    "output", "name",
-					    output->base.name);
-	weston_config_section_get_string(section, "transform", &s, "normal");
-	if (weston_parse_transform(s, &config_transform) < 0)
-		weston_log("Invalid transform \"%s\" for output %s\n",
-			   s, output->base.name);
-	free(s);
-
 	weston_output_init(&output->base, backend->compositor,
 	                   0, 0, output->fb_info.width_mm,
 	                   output->fb_info.height_mm,
-	                   config_transform,
+	                   backend->output_transform,
 			   1);
 
 	if (backend->use_pixman) {
@@ -779,6 +768,7 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
 	backend->prev_state = WESTON_COMPOSITOR_ACTIVE;
 	backend->use_pixman = !param->use_gl;
 	backend->device = strdup(param->device);
+	backend->output_transform = param->output_transform;
 
 	weston_setup_vt_switch_bindings(compositor);
 
@@ -831,6 +821,7 @@ config_init_to_defaults(struct weston_fbdev_backend_config *config)
 	config->tty = 0; /* default to current tty */
 	config->device = "/dev/fb0"; /* default frame buffer */
 	config->use_gl = 0;
+	config->output_transform = WL_OUTPUT_TRANSFORM_NORMAL;
 }
 
 WL_EXPORT int
diff --git a/src/compositor-fbdev.h b/src/compositor-fbdev.h
index 48bd269..bd60bdc 100644
--- a/src/compositor-fbdev.h
+++ b/src/compositor-fbdev.h
@@ -40,6 +40,8 @@ struct weston_fbdev_backend_config {
 	int tty;
 	char *device;
 	int use_gl;
+
+	uint32_t output_transform;
 };
 
 #ifdef  __cplusplus
diff --git a/src/main.c b/src/main.c
index 6062e8b..4c9e035 100644
--- a/src/main.c
+++ b/src/main.c
@@ -773,6 +773,8 @@ load_fbdev_backend(struct weston_compositor *c, char const * backend,
 		      int *argc, char **argv, struct weston_config *wc)
 {
 	struct weston_fbdev_backend_config config = {{ 0, }};
+	struct weston_config_section *section;
+	char *s = NULL;
 	int ret = 0;
 
 	const struct weston_option fbdev_options[] = {
@@ -786,6 +788,12 @@ load_fbdev_backend(struct weston_compositor *c, char const * backend,
 	if (!config.device)
 		config.device = strdup("/dev/fb0");
 
+	section = weston_config_get_section(wc, "output", "name", "fbdev");
+	weston_config_section_get_string(section, "transform", &s, "normal");
+	if (weston_parse_transform(s, &config.output_transform) < 0)
+		weston_log("Invalid transform \"%s\" for output fbdev\n", s);
+	free(s);
+
 	config.base.struct_version = WESTON_FBDEV_BACKEND_CONFIG_VERSION;
 	config.base.struct_size = sizeof(struct weston_fbdev_backend_config);
 
-- 
2.7.3



More information about the wayland-devel mailing list