summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/evas/engines/gl_drm/evas_outbuf.c64
1 files changed, 57 insertions, 7 deletions
diff --git a/src/modules/evas/engines/gl_drm/evas_outbuf.c b/src/modules/evas/engines/gl_drm/evas_outbuf.c
index 4cc62e6c6c..9e251d1be1 100644
--- a/src/modules/evas/engines/gl_drm/evas_outbuf.c
+++ b/src/modules/evas/engines/gl_drm/evas_outbuf.c
@@ -152,8 +152,9 @@ _evas_outbuf_egl_setup(Outbuf *ob)
152{ 152{
153 int ctx_attr[3]; 153 int ctx_attr[3];
154 int cfg_attr[40]; 154 int cfg_attr[40];
155 int maj = 0, min = 0, n = 0; 155 int maj = 0, min = 0, n = 0, i = 0;
156 EGLint ncfg; 156 EGLint ncfg;
157 EGLConfig *cfgs;
157 const GLubyte *vendor, *renderer, *version, *glslversion; 158 const GLubyte *vendor, *renderer, *version, *glslversion;
158 Eina_Bool blacklist = EINA_FALSE; 159 Eina_Bool blacklist = EINA_FALSE;
159 160
@@ -162,12 +163,16 @@ _evas_outbuf_egl_setup(Outbuf *ob)
162 ctx_attr[1] = 2; 163 ctx_attr[1] = 2;
163 ctx_attr[2] = EGL_NONE; 164 ctx_attr[2] = EGL_NONE;
164 165
165 /* cfg_attr[n++] = EGL_BUFFER_SIZE; */ 166 cfg_attr[n++] = EGL_BUFFER_SIZE;
166 /* cfg_attr[n++] = 32; */ 167 cfg_attr[n++] = 32;
167 cfg_attr[n++] = EGL_SURFACE_TYPE; 168 cfg_attr[n++] = EGL_DEPTH_SIZE;
168 cfg_attr[n++] = EGL_WINDOW_BIT; 169 cfg_attr[n++] = EGL_DONT_CARE;
170 cfg_attr[n++] = EGL_STENCIL_SIZE;
171 cfg_attr[n++] = EGL_DONT_CARE;
169 cfg_attr[n++] = EGL_RENDERABLE_TYPE; 172 cfg_attr[n++] = EGL_RENDERABLE_TYPE;
170 cfg_attr[n++] = EGL_OPENGL_ES2_BIT; 173 cfg_attr[n++] = EGL_OPENGL_ES2_BIT;
174 cfg_attr[n++] = EGL_SURFACE_TYPE;
175 cfg_attr[n++] = EGL_WINDOW_BIT;
171#if 0 176#if 0
172 cfg_attr[n++] = EGL_RED_SIZE; 177 cfg_attr[n++] = EGL_RED_SIZE;
173 cfg_attr[n++] = 1; 178 cfg_attr[n++] = 1;
@@ -182,7 +187,12 @@ _evas_outbuf_egl_setup(Outbuf *ob)
182 else cfg_attr[n++] = 0; 187 else cfg_attr[n++] = 0;
183 cfg_attr[n++] = EGL_NONE; 188 cfg_attr[n++] = EGL_NONE;
184 189
190#ifdef EGL_MESA_platform_gbm
191 ob->egl.disp =
192 eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_MESA, ob->info->info.gbm, NULL);
193#else
185 ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)ob->info->info.gbm); 194 ob->egl.disp = eglGetDisplay((EGLNativeDisplayType)ob->info->info.gbm);
195#endif
186 if (ob->egl.disp == EGL_NO_DISPLAY) 196 if (ob->egl.disp == EGL_NO_DISPLAY)
187 { 197 {
188 ERR("eglGetDisplay() fail. code=%#x", eglGetError()); 198 ERR("eglGetDisplay() fail. code=%#x", eglGetError());
@@ -202,16 +212,56 @@ _evas_outbuf_egl_setup(Outbuf *ob)
202 return EINA_FALSE; 212 return EINA_FALSE;
203 } 213 }
204 214
205 if (!eglChooseConfig(ob->egl.disp, cfg_attr, &ob->egl.config, 215 if (!eglGetConfigs(ob->egl.disp, NULL, 0, &ncfg) || (ncfg == 0))
206 1, &ncfg) || (ncfg != 1)) 216 {
217 ERR("eglGetConfigs() fail. code=%#x", eglGetError());
218 return EINA_FALSE;
219 }
220
221 cfgs = malloc(ncfg * sizeof(EGLConfig));
222 if (!cfgs)
223 {
224 ERR("Failed to malloc space for egl configs");
225 return EINA_FALSE;
226 }
227
228 if (!eglChooseConfig(ob->egl.disp, cfg_attr, cfgs,
229 ncfg, &ncfg) || (ncfg == 0))
207 { 230 {
208 ERR("eglChooseConfig() fail. code=%#x", eglGetError()); 231 ERR("eglChooseConfig() fail. code=%#x", eglGetError());
209 return EINA_FALSE; 232 return EINA_FALSE;
210 } 233 }
211 234
235 for (; i < ncfg; ++i)
236 {
237 EGLint format;
238
239 if (!eglGetConfigAttrib(ob->egl.disp, cfgs[i], EGL_NATIVE_VISUAL_ID,
240 &format))
241 {
242 ERR("eglGetConfigAttrib() fail. code=%#x", eglGetError());
243 return EINA_FALSE;
244 }
245
246 DBG("Config Format: %d", format);
247 DBG("OB Format: %d", ob->info->info.format);
248
249 if (format == ob->info->info.format)
250 {
251 ob->egl.config = cfgs[i];
252 break;
253 }
254 }
255
256#ifdef EGL_MESA_platform_gbm
257 ob->egl.surface[0] =
258 eglCreatePlatformWindowSurfaceEXT(ob->egl.disp, ob->egl.config,
259 ob->surface, NULL);
260#else
212 ob->egl.surface[0] = 261 ob->egl.surface[0] =
213 eglCreateWindowSurface(ob->egl.disp, ob->egl.config, 262 eglCreateWindowSurface(ob->egl.disp, ob->egl.config,
214 (EGLNativeWindowType)ob->surface, NULL); 263 (EGLNativeWindowType)ob->surface, NULL);
264#endif
215 if (ob->egl.surface[0] == EGL_NO_SURFACE) 265 if (ob->egl.surface[0] == EGL_NO_SURFACE)
216 { 266 {
217 ERR("eglCreateWindowSurface() fail for %p. code=%#x", 267 ERR("eglCreateWindowSurface() fail for %p. code=%#x",