@@ -170,6 +170,23 @@ void gd_gl_area_switch(DisplayChangeListener *dcl,
}
}
+static int gd_cmp_gl_context_version(int major, int minor, QEMUGLParams *params)
+{
+ if (major > params->major_ver) {
+ return 1;
+ }
+ if (major < params->major_ver) {
+ return -1;
+ }
+ if (minor > params->minor_ver) {
+ return 1;
+ }
+ if (minor < params->minor_ver) {
+ return -1;
+ }
+ return 0;
+}
+
QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *dgc,
QEMUGLParams *params)
{
@@ -177,8 +194,8 @@ QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *dgc,
GdkWindow *window;
GdkGLContext *ctx;
GError *err = NULL;
+ int major, minor;
- gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
window = gtk_widget_get_window(vc->gfx.drawing_area);
ctx = gdk_window_create_gl_context(window, &err);
if (err) {
@@ -196,6 +213,18 @@ QEMUGLContext gd_gl_area_create_context(DisplayGLCtx *dgc,
g_clear_object(&ctx);
return NULL;
}
+
+ gdk_gl_context_make_current(ctx);
+ gdk_gl_context_get_version(ctx, &major, &minor);
+ gdk_gl_context_clear_current();
+ gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
+
+ if (gd_cmp_gl_context_version(major, minor, params) == -1) {
+ /* created ctx version < requested version */
+ g_clear_object(&ctx);
+ }
+
+ trace_gd_gl_area_create_context(ctx, params->major_ver, params->minor_ver);
return ctx;
}
@@ -26,6 +26,7 @@ gd_key_event(const char *tab, int gdk_keycode, int qkeycode, const char *action)
gd_grab(const char *tab, const char *device, const char *reason) "tab=%s, dev=%s, reason=%s"
gd_ungrab(const char *tab, const char *device) "tab=%s, dev=%s"
gd_keymap_windowing(const char *name) "backend=%s"
+gd_gl_area_create_context(void *ctx, int major, int minor) "ctx=%p, major=%d, minor=%d"
gd_gl_area_destroy_context(void *ctx, void *current_ctx) "ctx=%p, current_ctx=%p"
# vnc-auth-sasl.c