Peter Maydell | e16f4c8 | 2016-01-29 17:49:51 +0000 | [diff] [blame] | 1 | #include "qemu/osdep.h" |
Gerd Hoffmann | 6c18744 | 2015-04-29 10:08:04 +0200 | [diff] [blame] | 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_CLIENT_VERSION, params->major_ver, |
| 11 | EGL_CONTEXT_MINOR_VERSION_KHR, params->minor_ver, |
| 12 | EGL_NONE |
| 13 | }; |
| 14 | |
| 15 | ctx = eglCreateContext(qemu_egl_display, qemu_egl_config, |
| 16 | eglGetCurrentContext(), ctx_att); |
| 17 | return ctx; |
| 18 | } |
| 19 | |
| 20 | void qemu_egl_destroy_context(DisplayChangeListener *dcl, QEMUGLContext ctx) |
| 21 | { |
| 22 | eglDestroyContext(qemu_egl_display, ctx); |
| 23 | } |
| 24 | |
| 25 | int qemu_egl_make_context_current(DisplayChangeListener *dcl, |
| 26 | QEMUGLContext ctx) |
| 27 | { |
| 28 | return eglMakeCurrent(qemu_egl_display, |
| 29 | EGL_NO_SURFACE, EGL_NO_SURFACE, ctx); |
| 30 | } |
| 31 | |
| 32 | QEMUGLContext qemu_egl_get_current_context(DisplayChangeListener *dcl) |
| 33 | { |
| 34 | return eglGetCurrentContext(); |
| 35 | } |