[PATCH weston v5 08/11] drm: Code and comments reformatting for consistency with other backend configs

Bryce Harrington bryce at osg.samsung.com
Wed Apr 13 10:25:12 UTC 2016


Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
 src/compositor-drm.c | 10 ++++++----
 src/compositor-drm.h | 43 ++++++++++++++++++++++++++++---------------
 src/main.c           |  6 ++++--
 3 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index aee42ea..38296e2 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -46,13 +46,13 @@
 #include <gbm.h>
 #include <libudev.h>
 
-#include "shared/helpers.h"
-#include "shared/timespec-util.h"
-#include "libbacklight.h"
 #include "compositor.h"
 #include "compositor-drm.h"
+#include "shared/helpers.h"
+#include "shared/timespec-util.h"
 #include "gl-renderer.h"
 #include "pixman-renderer.h"
+#include "libbacklight.h"
 #include "libinput-seat.h"
 #include "launcher-util.h"
 #include "vaapi-recorder.h"
@@ -3201,7 +3201,8 @@ err_compositor:
 }
 
 WL_EXPORT int
-backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
+backend_init(struct weston_compositor *compositor,
+	     int *argc, char *argv[],
 	     struct weston_config *wc,
 	     struct weston_backend_config *config_base)
 {
@@ -3221,5 +3222,6 @@ backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
 	b = drm_backend_create(compositor, config);
 	if (b == NULL)
 		return -1;
+
 	return 0;
 }
diff --git a/src/compositor-drm.h b/src/compositor-drm.h
index 423378a..3b54ca5 100644
--- a/src/compositor-drm.h
+++ b/src/compositor-drm.h
@@ -25,8 +25,8 @@
  * SOFTWARE.
  */
 
-#ifndef WESTON_COMPOSITOR_DRM_H
-#define WESTON_COMPOSITOR_DRM_H
+#ifndef _WESTON_COMPOSITOR_DRM_H
+#define _WESTON_COMPOSITOR_DRM_H
 
 #ifdef  __cplusplus
 extern "C" {
@@ -73,30 +73,43 @@ struct weston_drm_backend_output_config {
 struct weston_drm_backend_config {
 	struct weston_backend_config base;
 
-	/** The connector id of the output to be initialized. A value of 0 will
-	 * enable all available outputs. */
+	/** The connector id of the output to be initialized.
+	 *
+	 * A value of 0 will enable all available outputs.
+	 */
 	int connector;
+
 	/** The tty to be used. Set to 0 to use the current tty. */
 	int tty;
-	/** If true the pixman renderer will be used instead of the OpenGL ES
-	 * renderer. */
+
+	/** Whether to use the pixman renderer instead of the OpenGL ES renderer. */
 	bool use_pixman;
-	/** The seat to be used for input and output. If NULL the default "seat0"
-	 * will be used.
-	 * The backend will take ownership of the seat_id pointer and will free
-	 * it on backend destruction. */
+
+	/** The seat to be used for input and output.
+	 *
+	 * If NULL the default "seat0" will be used.  The backend will
+	 * take ownership of the seat_id pointer and will free it on
+	 * backend destruction.
+	 */
 	char *seat_id;
-	/** The pixel format of the framebuffer to be used. Valid values are:
+
+	/** The pixel format of the framebuffer to be used.
+	 *
+	 * Valid values are:
 	 * - NULL - The default format ("xrgb8888") will be used;
 	 * - "xrgb8888";
 	 * - "rgb565"
 	 * - "xrgb2101010"
 	 * The backend will take ownership of the format pointer and will free
-	 * it on backend destruction. */
+	 * it on backend destruction.
+	 */
 	char *gbm_format;
 
-	/** Callback used to configure the outputs. This function will be called
-	 * by the backend when a new DRM output needs to be configured. */
+	/** Callback used to configure the outputs.
+	 *
+	 * This function will be called by the backend when a new DRM
+	 * output needs to be configured.
+	 */
 	enum weston_drm_backend_output_mode
 		(*configure_output)(struct weston_compositor *compositor,
 				    struct weston_drm_backend_config *backend_config,
@@ -108,4 +121,4 @@ struct weston_drm_backend_config {
 }
 #endif
 
-#endif
+#endif /* _WESTON_COMPOSITOR_DRM_H */
diff --git a/src/main.c b/src/main.c
index 334464b..f652701 100644
--- a/src/main.c
+++ b/src/main.c
@@ -675,6 +675,7 @@ load_backend_new(struct weston_compositor *compositor, const char *backend,
 }
 
 
+// TODO: Why is there a wrapper around the drm config base object?
 struct drm_config {
 	struct weston_drm_backend_config base;
 	bool use_current_mode;
@@ -731,7 +732,7 @@ load_drm_backend(struct weston_compositor *c, const char *backend,
 	struct weston_config_section *section;
 	int ret = 0;
 
-	config = zalloc(sizeof *config);
+	config = zalloc(sizeof (struct drm_config));
 	if (!config)
 		return -1;
 
@@ -755,7 +756,8 @@ load_drm_backend(struct weston_compositor *c, const char *backend,
 	config->base.base.struct_size = sizeof(struct weston_drm_backend_config);
 	config->base.configure_output = drm_configure_output;
 
-	if (load_backend_new(c, backend, &config->base.base) < 0) {
+	if (load_backend_new(c, backend,
+			     (struct weston_backend_config *)(&config->base)) < 0) {
 		ret = -1;
 		free(config->base.gbm_format);
 		free(config->base.seat_id);
-- 
1.9.1



More information about the wayland-devel mailing list