summarylogtreecommitdiffstats
path: root/0001-gl-renderer-Renaming-of-things-and-minor-improvement.patch
blob: ae7acd6ca073cf06f0ea293d8efb5de9d8d382eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
From 50b2478345ae978143364abde179080a36479e94 Mon Sep 17 00:00:00 2001
From: "Miguel A. Vico" <mvicomoya@nvidia.com>
Date: Mon, 21 Mar 2016 17:37:31 +0100
Subject: [PATCH 1/7] gl-renderer: Renaming of things and minor improvements
X-NVConfidentiality: public

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@nvidia.com>
Reviewed-by: Andy Ritger <aritger@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 538e56eb58ba..ded15f83c3e6 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 36d7ae0ae500..84435b7f2fbd 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 d1c020d886a1..d38376a9ee38 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 13a5d7304568..bc35db66f6fc 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 cb083448bfdb..0c55e0b9ebd2 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 71f6b46e49e1..af8dd267e700 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.4