[PATCH 7/8] glamor: add core profile support to EGL glamor. (v2)

2016-01-18 Thread Dave Airlie
From: Dave Airlie 

This breaks ABI unfortunately as we have to pass the core profile
info from the egl part of glamor to the glamor part of glamor.

v1.1: use version defines.
v2: let glamor work it out itself

Signed-off-by: Dave Airlie 
---
 glamor/glamor_egl.c | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index ea0443d..4bcd3ce 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -738,6 +738,15 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 #endif
 EGL_NONE
 };
+static const EGLint config_attribs_core[] = {
+EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
+EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
+EGL_CONTEXT_MAJOR_VERSION_KHR,
+GLAMOR_GL_CORE_VER_MAJOR,
+EGL_CONTEXT_MINOR_VERSION_KHR,
+GLAMOR_GL_CORE_VER_MINOR,
+EGL_NONE
+};
 
 glamor_identify(0);
 glamor_egl = calloc(sizeof(*glamor_egl), 1);
@@ -798,12 +807,21 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 KHR_surfaceless_opengl);
 #endif
 
+#ifndef GLAMOR_GLES2
 glamor_egl->context = eglCreateContext(glamor_egl->display,
NULL, EGL_NO_CONTEXT,
-   config_attribs);
-if (glamor_egl->context == EGL_NO_CONTEXT) {
-xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL context\n");
-goto error;
+   config_attribs_core);
+#else
+glamor_egl->context = NULL;
+#endif
+if (!glamor_egl->context) {
+glamor_egl->context = eglCreateContext(glamor_egl->display,
+   NULL, EGL_NO_CONTEXT,
+   config_attribs);
+if (glamor_egl->context == EGL_NO_CONTEXT) {
+xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL 
context\n");
+goto error;
+}
 }
 
 if (!eglMakeCurrent(glamor_egl->display,
-- 
2.4.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 7/8] glamor: add core profile support to EGL glamor. (v2)

2016-01-19 Thread Michel Dänzer
On 19.01.2016 16:02, Dave Airlie wrote:
> From: Dave Airlie 
> 
> This breaks ABI unfortunately as we have to pass the core profile
> info from the egl part of glamor to the glamor part of glamor.

Drop this paragraph.


> @@ -798,12 +807,21 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
>  KHR_surfaceless_opengl);
>  #endif
>  
> +#ifndef GLAMOR_GLES2
>  glamor_egl->context = eglCreateContext(glamor_egl->display,
> NULL, EGL_NO_CONTEXT,
> -   config_attribs);
> -if (glamor_egl->context == EGL_NO_CONTEXT) {
> -xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to create EGL 
> context\n");

Might be nice to keep something like

if (glamor_egl->context == EGL_NO_CONTEXT) {
   xf86DrvMsgVerb(scrn->scrnIndex, X_WARNING, 4,
  "Failed to create EGL OpenGL core profile context\n");
}


> -goto error;
> +   config_attribs_core);
> +#else
> +glamor_egl->context = NULL;

s/NULL/EGL_NO_CONTEXT/ ?


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel