[PATCH 6/8] ephyr: Create 3.3 core profile context if possible (v2)

Eric Anholt eric at anholt.net
Tue Jan 19 09:33:45 PST 2016


Dave Airlie <airlied at gmail.com> writes:

> From: Keith Packard <keithp at 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.
>
> Signed-off-by: Keith Packard <keithp at keithp.com>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  hw/kdrive/ephyr/ephyr_glamor_glx.c | 19 +++++++++++++++++--
>  hw/kdrive/ephyr/ephyr_glamor_glx.h |  2 +-
>  hw/kdrive/ephyr/hostx.c            |  7 +++++--
>  3 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/hw/kdrive/ephyr/ephyr_glamor_glx.c b/hw/kdrive/ephyr/ephyr_glamor_glx.c
> index 30c5245..674e7f5 100644
> --- a/hw/kdrive/ephyr/ephyr_glamor_glx.c
> +++ b/hw/kdrive/ephyr/ephyr_glamor_glx.c
> @@ -277,7 +277,7 @@ ephyr_glamor_process_event(xcb_generic_event_t *xev)
>  }
>  
>  struct ephyr_glamor *
> -ephyr_glamor_glx_screen_init(xcb_window_t win)
> +ephyr_glamor_glx_screen_init(xcb_window_t win, Bool *profile_is_core)
>  {
>      static const float position[] = {
>          -1, -1,
> @@ -295,6 +295,7 @@ ephyr_glamor_glx_screen_init(xcb_window_t win)
>      struct ephyr_glamor *glamor;
>      GLXWindow glx_win;
>  
> +    *profile_is_core = FALSE;
>      glamor = calloc(1, sizeof(struct ephyr_glamor));
>      if (!glamor) {
>          FatalError("malloc");
> @@ -319,7 +320,21 @@ 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,
> +            3,
> +            GLX_CONTEXT_MINOR_VERSION_ARB,
> +            3,
> +            0,
> +        };
> +        ctx = glXCreateContextAttribsARB(dpy, fb_config, NULL, True,
> +                                         context_attribs);
> +        if (!ctx)
> +            ctx = glXCreateContext(dpy, visual_info, NULL, True);
> +        else
> +            *profile_is_core = TRUE;
>      }

Before using the new function, we need to check
epoxy_has_glx_extension("GLX_ARB_create_context")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20160119/3037a454/attachment.sig>


More information about the xorg-devel mailing list