[PATCH weston v6 10/12] drm: Pass gbm_format as enum rather than string in output config

Bryce Harrington bryce at osg.samsung.com
Sat Apr 16 03:28:35 UTC 2016


Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
 src/compositor-drm.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index d129adc..a896785 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -93,13 +93,13 @@ enum weston_drm_backend_output_mode {
 struct weston_drm_backend_output_config {
 	struct weston_backend_output_config base;
 
-	/** The pixel format to be used by the output. Valid values are:
-	 * - NULL - The format set at backend creation time will be used
-	 * - "xrgb8888"
-	 * - "rgb565"
-	 * - "xrgb2101010"
+	/** The pixel format to be used by the output. Supported values are:
+	 * - 0: The format set at backend creation time will be used
+	 * - GBM_FORMAT_XRGB8888
+	 * - GBM_FORMAT_RGB565
+	 * - GBM_FORMAT_XRGB2101010
 	 */
-	char *gbm_format;
+	uint32_t gbm_format;
 
 	/** The seat to be used by the output. Set to NULL to use the
 	 * default seat. */
@@ -2336,8 +2336,12 @@ drm_configure_output(struct weston_compositor *c,
 			   s, name);
 	free(s);
 
-	weston_config_section_get_string(section,
-					 "gbm-format", &config->gbm_format, NULL);
+	weston_config_section_get_string(section, "gbm-format", &s, NULL);
+        if (parse_gbm_format(s, GBM_FORMAT_XRGB8888, &config->gbm_format) < 0)
+		weston_log("Invalid gbm-format \"%s\" for output %s\n",
+			   s, name);
+	free(s);
+
 	weston_config_section_get_string(section, "seat", &config->seat, "");
 	return mode;
 }
@@ -2391,8 +2395,7 @@ create_output_for_connector(struct drm_backend *b,
 
 	mode = drm_configure_output(b->compositor, b->use_current_mode,
 				    output->base.name, &config);
-	if (parse_gbm_format(config.gbm_format, b->gbm_format, &output->gbm_format) == -1)
-		output->gbm_format = b->gbm_format;
+	output->gbm_format = config.gbm_format;
 
 	setup_output_seat_constraint(b, &output->base,
 				     config.seat ? config.seat : "");
-- 
1.9.1



More information about the wayland-devel mailing list