[PATCH 6/8] ephyr: Create 3.3 core profile context if possible (v2)
Dave Airlie
airlied at gmail.com
Mon Jan 18 16:56:54 PST 2016
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;
}
if (ctx == NULL)
FatalError("glXCreateContext failed\n");
diff --git a/hw/kdrive/ephyr/ephyr_glamor_glx.h b/hw/kdrive/ephyr/ephyr_glamor_glx.h
index 0c238cf..c479b73 100644
--- a/hw/kdrive/ephyr/ephyr_glamor_glx.h
+++ b/hw/kdrive/ephyr/ephyr_glamor_glx.h
@@ -44,7 +44,7 @@ xcb_visualtype_t *
ephyr_glamor_get_visual(void);
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);
void
ephyr_glamor_glx_screen_fini(struct ephyr_glamor *glamor);
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 49516bb..e7fa089 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -1426,12 +1426,15 @@ ephyr_glamor_init(ScreenPtr screen)
KdScreenPriv(screen);
KdScreenInfo *kd_screen = pScreenPriv->screen;
EphyrScrPriv *scrpriv = kd_screen->driver;
+ Bool profile_is_core;
+ int flags;
+ scrpriv->glamor = ephyr_glamor_glx_screen_init(scrpriv->win, &profile_is_core);
- scrpriv->glamor = ephyr_glamor_glx_screen_init(scrpriv->win);
+ flags = profile_is_core ? GLAMOR_USE_CORE_PROFILE : 0;
ephyr_glamor_set_window_size(scrpriv->glamor,
scrpriv->win_width, scrpriv->win_height);
- if (!glamor_init(screen, 0)) {
+ if (!glamor_init(screen, flags)) {
FatalError("Failed to initialize glamor\n");
return FALSE;
}
--
2.4.3
More information about the xorg-devel
mailing list