1 #include "qemu/osdep.h" 2 #include "qemu-common.h" 3 #include "ui/egl-context.h" 4 5 QEMUGLContext qemu_egl_create_context(DisplayChangeListener *dcl, 6 QEMUGLParams *params) 7 { 8 EGLContext ctx; 9 EGLint ctx_att[] = { 10 EGL_CONTEXT_OPENGL_PROFILE_MASK, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT, 11 EGL_CONTEXT_CLIENT_VERSION, params->major_ver, 12 EGL_CONTEXT_MINOR_VERSION_KHR, params->minor_ver, 13 EGL_NONE 14 }; 15 16 ctx = eglCreateContext(qemu_egl_display, qemu_egl_config, 17 eglGetCurrentContext(), ctx_att); 18 return ctx; 19 } 20 21 void qemu_egl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx) 22 { 23 eglDestroyContext(qemu_egl_display, ctx); 24 } 25 26 int qemu_egl_make_context_current(DisplayChangeListener *dcl, 27 QEMUGLContext ctx) 28 { 29 return eglMakeCurrent(qemu_egl_display, 30 EGL_NO_SURFACE, EGL_NO_SURFACE, ctx); 31 } 32 33 QEMUGLContext qemu_egl_get_current_context(DisplayChangeListener *dcl) 34 { 35 return eglGetCurrentContext(); 36 } 37