[PATCH 1/7] gl-renderer: Renaming of things and minor improvements

Miguel A. Vico mvicomoya at nvidia.com
Mon Mar 21 16:37:31 UTC 2016


In preparation for follow-on changes to support frame presentation
through EGLDevice+EGLOutput, this change includes the following:
  -Rename gl_renderer_output_create to gl_renderer_output_window_create
  -Add <platform_attribs> argument to gl_renderer_create
  -Rename <attribs> argument for gl_renderer_create() and
   gl_renderer_output_window_create() to <config_attribs>
  -Accept non-NULL empty <visual_id> arrays (n_ids == 0) both in
   gl_renderer_create() and gl_renderer_output_window_create()

Signed-off-by: Miguel A Vico Moya <mvicomoya at nvidia.com>
Reviewed-by: Andy Ritger <aritger at nvidia.com>
---
 src/compositor-drm.c     |  3 ++-
 src/compositor-fbdev.c   |  3 ++-
 src/compositor-wayland.c |  3 ++-
 src/compositor-x11.c     |  4 ++--
 src/gl-renderer.c        | 18 +++++++++---------
 src/gl-renderer.h        |  7 ++++---
 6 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 621414c..b87acd5 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1588,6 +1588,7 @@ drm_backend_create_gl_renderer(struct drm_backend *b)
 	if (gl_renderer->create(b->compositor,
 				EGL_PLATFORM_GBM_KHR,
 				(void *)b->gbm,
+				NULL,
 				gl_renderer->opaque_attribs,
 				format,
 				n_formats) < 0) {
@@ -1852,7 +1853,7 @@ drm_output_init_egl(struct drm_output *output, struct drm_backend *b)
 
 	if (format[1])
 		n_formats = 2;
-	if (gl_renderer->output_create(&output->base,
+	if (gl_renderer->output_window_create(&output->base,
 				       (EGLNativeWindowType)output->surface,
 				       output->surface,
 				       gl_renderer->opaque_attribs,
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 19c5e3b..04ba026 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -526,7 +526,7 @@ fbdev_output_create(struct fbdev_backend *backend,
 			goto out_hw_surface;
 	} else {
 		setenv("HYBRIS_EGLPLATFORM", "wayland", 1);
-		if (gl_renderer->output_create(&output->base,
+		if (gl_renderer->output_window_create(&output->base,
 					       (EGLNativeWindowType)NULL, NULL,
 					       gl_renderer->opaque_attribs,
 					       NULL, 0) < 0) {
@@ -799,6 +799,7 @@ fbdev_backend_create(struct weston_compositor *compositor, int *argc, char *argv
 
 		if (gl_renderer->create(compositor, NO_EGL_PLATFORM,
 					EGL_DEFAULT_DISPLAY,
+					NULL,
 					gl_renderer->opaque_attribs,
 					NULL, 0) < 0) {
 			weston_log("gl_renderer_create failed.\n");
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 8a1878c..3845875 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -657,7 +657,7 @@ wayland_output_init_gl_renderer(struct wayland_output *output)
 		return -1;
 	}
 
-	if (gl_renderer->output_create(&output->base,
+	if (gl_renderer->output_window_create(&output->base,
 				       output->gl.egl_window,
 				       output->gl.egl_window,
 				       gl_renderer->alpha_attribs,
@@ -2250,6 +2250,7 @@ wayland_backend_create(struct weston_compositor *compositor, int use_pixman,
 		if (gl_renderer->create(compositor,
 					EGL_PLATFORM_WAYLAND_KHR,
 					b->parent.wl_display,
+					NULL,
 					gl_renderer->alpha_attribs,
 					NULL,
 					0) < 0) {
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index cca6ab7..bede1b7 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -932,7 +932,7 @@ x11_backend_create_output(struct x11_backend *b, int x, int y,
 		 * but eglCreateWindowSurface takes a Window. */
 		Window xid = (Window) output->window;
 
-		ret = gl_renderer->output_create(&output->base,
+		ret = gl_renderer->output_window_create(&output->base,
 						 (EGLNativeWindowType) output->window,
 						 &xid,
 						 gl_renderer->opaque_attribs,
@@ -1562,7 +1562,7 @@ init_gl_renderer(struct x11_backend *b)
 		return -1;
 
 	ret = gl_renderer->create(b->compositor, EGL_PLATFORM_X11_KHR, (void *) b->dpy,
-				  gl_renderer->opaque_attribs, NULL, 0);
+				 NULL, gl_renderer->opaque_attribs, NULL, 0);
 
 	return ret;
 }
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index cb08344..0c55e0b 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -2493,7 +2493,7 @@ egl_choose_config(struct gl_renderer *gr, const EGLint *attribs,
 		goto out;
 	}
 
-	if (!visual_id)
+	if (!visual_id || n_ids == 0)
 		config_index = 0;
 
 	for (i = 0; config_index == -1 && i < n_ids; i++)
@@ -2547,10 +2547,10 @@ static int
 gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface);
 
 static int
-gl_renderer_output_create(struct weston_output *output,
+gl_renderer_output_window_create(struct weston_output *output,
 			  EGLNativeWindowType window_for_legacy,
 			  void *window_for_platform,
-			  const EGLint *attribs,
+			  const EGLint *config_attribs,
 			  const EGLint *visual_id,
 			  int n_ids)
 {
@@ -2560,7 +2560,7 @@ gl_renderer_output_create(struct weston_output *output,
 	EGLConfig egl_config;
 	int i;
 
-	if (egl_choose_config(gr, attribs, visual_id,
+	if (egl_choose_config(gr, config_attribs, visual_id,
 			      n_ids, &egl_config) == -1) {
 		weston_log("failed to choose EGL config for output\n");
 		return -1;
@@ -2846,8 +2846,8 @@ platform_to_extension(EGLenum platform)
 
 static int
 gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
-	void *native_window, const EGLint *attribs,
-	const EGLint *visual_id, int n_ids)
+	void *native_window, const EGLint* platform_attribs,
+	const EGLint *config_attribs, const EGLint *visual_id, int n_ids)
 {
 	struct gl_renderer *gr;
 	EGLint major, minor;
@@ -2889,7 +2889,7 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
 		if (get_platform_display && platform) {
 			gr->egl_display = get_platform_display(platform,
 							       native_window,
-							       NULL);
+							       platform_attribs);
 		}
 	}
 
@@ -2910,7 +2910,7 @@ gl_renderer_create(struct weston_compositor *ec, EGLenum platform,
 		goto fail_with_error;
 	}
 
-	if (egl_choose_config(gr, attribs, visual_id,
+	if (egl_choose_config(gr, config_attribs, visual_id,
 			      n_ids, &gr->egl_config) < 0) {
 		weston_log("failed to choose EGL config\n");
 		goto fail_terminate;
@@ -3121,7 +3121,7 @@ WL_EXPORT struct gl_renderer_interface gl_renderer_interface = {
 
 	.create = gl_renderer_create,
 	.display = gl_renderer_display,
-	.output_create = gl_renderer_output_create,
+	.output_window_create = gl_renderer_output_window_create,
 	.output_destroy = gl_renderer_output_destroy,
 	.output_surface = gl_renderer_output_surface,
 	.output_set_border = gl_renderer_output_set_border,
diff --git a/src/gl-renderer.h b/src/gl-renderer.h
index 71f6b46..af8dd26 100644
--- a/src/gl-renderer.h
+++ b/src/gl-renderer.h
@@ -78,16 +78,17 @@ struct gl_renderer_interface {
 	int (*create)(struct weston_compositor *ec,
 		      EGLenum platform,
 		      void *native_window,
-		      const EGLint *attribs,
+		      const EGLint *platform_attribs,
+		      const EGLint *config_attribs,
 		      const EGLint *visual_id,
 		      const int n_ids);
 
 	EGLDisplay (*display)(struct weston_compositor *ec);
 
-	int (*output_create)(struct weston_output *output,
+	int (*output_window_create)(struct weston_output *output,
 			     EGLNativeWindowType window_for_legacy,
 			     void *window_for_platform,
-			     const EGLint *attribs,
+			     const EGLint *config_attribs,
 			     const EGLint *visual_id,
 			     const int n_ids);
 
-- 
2.7.1



More information about the wayland-devel mailing list