qapi: allow unions to contain further unions
[qemu/armbru.git] / include / ui / egl-helpers.h
blob53d953ddf499ce867b1f0e762da5edda21f48be8
1 #ifndef EGL_HELPERS_H
2 #define EGL_HELPERS_H
4 #include <epoxy/gl.h>
5 #include <epoxy/egl.h>
6 #ifdef CONFIG_GBM
7 #include <gbm.h>
8 #endif
9 #include "ui/console.h"
10 #include "ui/shader.h"
12 extern EGLDisplay *qemu_egl_display;
13 extern EGLConfig qemu_egl_config;
14 extern DisplayGLMode qemu_egl_mode;
16 typedef struct egl_fb {
17 int width;
18 int height;
19 GLuint texture;
20 GLuint framebuffer;
21 bool delete_texture;
22 QemuDmaBuf *dmabuf;
23 } egl_fb;
25 #define EGL_FB_INIT { 0, }
27 void egl_fb_destroy(egl_fb *fb);
28 void egl_fb_setup_default(egl_fb *fb, int width, int height);
29 void egl_fb_setup_for_tex(egl_fb *fb, int width, int height,
30 GLuint texture, bool delete);
31 void egl_fb_setup_new_tex(egl_fb *fb, int width, int height);
32 void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip);
33 void egl_fb_read(DisplaySurface *dst, egl_fb *src);
35 void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip);
36 void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip,
37 int x, int y, double scale_x, double scale_y);
39 #ifdef CONFIG_GBM
41 extern int qemu_egl_rn_fd;
42 extern struct gbm_device *qemu_egl_rn_gbm_dev;
43 extern EGLContext qemu_egl_rn_ctx;
45 int egl_rendernode_init(const char *rendernode, DisplayGLMode mode);
46 int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc,
47 EGLuint64KHR *modifier);
49 void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
50 void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);
51 void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf);
52 void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf);
54 #endif
56 EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win);
58 #if defined(CONFIG_X11) || defined(CONFIG_GBM)
60 int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode);
61 int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode);
63 #endif
65 EGLContext qemu_egl_init_ctx(void);
66 bool qemu_egl_has_dmabuf(void);
68 bool egl_init(const char *rendernode, DisplayGLMode mode, Error **errp);
70 #endif /* EGL_HELPERS_H */