On Mon, Jan 18, 2016 at 11:02 PM, Dave Airlie <airl...@gmail.com> wrote: > From: Keith Packard <kei...@keithp.com> > > On desktop GL, Ask for a 3.3 core profile context if that's available, > otherwise create a generic context. > > v2: tell glamor the profile is a core one. > v2.1: add/use GL version defines > v3: let glamor work out core itself > > Signed-off-by: Keith Packard <kei...@keithp.com> > Signed-off-by: Dave Airlie <airl...@redhat.com> > --- > hw/kdrive/ephyr/ephyr_glamor_glx.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/hw/kdrive/ephyr/ephyr_glamor_glx.c > b/hw/kdrive/ephyr/ephyr_glamor_glx.c > index 30c5245..b9fe8d1 100644 > --- a/hw/kdrive/ephyr/ephyr_glamor_glx.c > +++ b/hw/kdrive/ephyr/ephyr_glamor_glx.c > @@ -41,6 +41,10 @@ > #include "os.h" > #include <X11/Xproto.h> > > +/* until we need geometry shaders GL3.1 should suffice. */ > +/* Xephyr has it's own copy of this for build reasons */ > +#define GLAMOR_GL_CORE_VER_MAJOR 3 > +#define GLAMOR_GL_CORE_VER_MINOR 1 > /** @{ > * > * global state for Xephyr with glamor. > @@ -319,7 +323,19 @@ ephyr_glamor_glx_screen_init(xcb_window_t win) > "GLX_EXT_create_context_es2_profile\n"); > } > } else { > - ctx = glXCreateContext(dpy, visual_info, NULL, True); > + static const int context_attribs[] = { > + GLX_CONTEXT_PROFILE_MASK_ARB, > + GLX_CONTEXT_CORE_PROFILE_BIT_ARB, > + GLX_CONTEXT_MAJOR_VERSION_ARB, > + GLAMOR_GL_CORE_VER_MAJOR, > + GLX_CONTEXT_MINOR_VERSION_ARB, > + GLAMOR_GL_CORE_VER_MINOR, > + 0, > + }; > + ctx = glXCreateContextAttribsARB(dpy, fb_config, NULL, True, > + context_attribs); > + if (!ctx) > + ctx = glXCreateContext(dpy, visual_info, NULL, True); > } > if (ctx == NULL) > FatalError("glXCreateContext failed\n"); > --
GL 3.2 adds profiles -- they're not available in GL 3.1. The GLX_ARB_create_context_profile spec says: If the requested OpenGL version is less than 3.2, GLX_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality of the context is determined solely by the requested version. If you simply ask for 3.1, you may get GL_ARB_compatibility... The spec says: If version 3.1 is requested, the context returned may implement any of the following versions: * Version 3.1. The GL_ARB_compatibility extension may or may not be implemented, as determined by the implementation. * The core profile of version 3.2 or greater. It's probably a safe bet that no driver we care about glamor running on will implement GL_ARB_compatibility, so maybe asking for 3.1 is the best thing to do. The lack of profiles in 3.1 is a real pain in the ass. _______________________________________________ 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