]> git.proxmox.com Git - mirror_qemu.git/blame - include/ui/egl-helpers.h
Merge tag 'pull-maintainer-may24-160524-2' of https://gitlab.com/stsquad/qemu into...
[mirror_qemu.git] / include / ui / egl-helpers.h
CommitLineData
7ced9e9f
GH
1#ifndef EGL_HELPERS_H
2#define EGL_HELPERS_H
3
4#include <epoxy/gl.h>
5#include <epoxy/egl.h>
bc6a3565 6#ifdef CONFIG_GBM
1e316598 7#include <gbm.h>
bc6a3565 8#endif
ec150c7e
MA
9#include "ui/console.h"
10#include "ui/shader.h"
7ced9e9f
GH
11
12extern EGLDisplay *qemu_egl_display;
13extern EGLConfig qemu_egl_config;
54d208ff 14extern DisplayGLMode qemu_egl_mode;
06c63a34 15extern bool qemu_egl_angle_d3d;
7ced9e9f 16
6fafc260
GH
17typedef struct egl_fb {
18 int width;
19 int height;
20 GLuint texture;
21 GLuint framebuffer;
22 bool delete_texture;
65b847d2 23 QemuDmaBuf *dmabuf;
6fafc260
GH
24} egl_fb;
25
8bb6af67
MAL
26#define EGL_FB_INIT { 0, }
27
6fafc260
GH
28void egl_fb_destroy(egl_fb *fb);
29void egl_fb_setup_default(egl_fb *fb, int width, int height);
74083f9c
GH
30void egl_fb_setup_for_tex(egl_fb *fb, int width, int height,
31 GLuint texture, bool delete);
32void egl_fb_setup_new_tex(egl_fb *fb, int width, int height);
6fafc260 33void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip);
d2329237 34void egl_fb_read(DisplaySurface *dst, egl_fb *src);
da9eb580 35void egl_fb_read_rect(DisplaySurface *dst, egl_fb *src, int x, int y, int w, int h);
6fafc260 36
0eb50c27
GH
37void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip);
38void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip,
051a0cde 39 int x, int y, double scale_x, double scale_y);
0eb50c27 40
39324b49
MAL
41extern EGLContext qemu_egl_rn_ctx;
42
bc6a3565 43#ifdef CONFIG_GBM
1e316598
GH
44
45extern int qemu_egl_rn_fd;
46extern struct gbm_device *qemu_egl_rn_gbm_dev;
1e316598 47
54d208ff 48int egl_rendernode_init(const char *rendernode, DisplayGLMode mode);
5fc1fb62
GH
49int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc,
50 EGLuint64KHR *modifier);
1e316598 51
86c0522c
GH
52void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
53void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);
121abaf3
VK
54void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf);
55void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf);
86c0522c 56
1e316598
GH
57#endif
58
fbd57c75 59EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win);
7ced9e9f 60
bc6a3565
AO
61#if defined(CONFIG_X11) || defined(CONFIG_GBM)
62
54d208ff
GH
63int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode);
64int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode);
bc6a3565
AO
65
66#endif
67
39324b49
MAL
68#ifdef WIN32
69int qemu_egl_init_dpy_win32(EGLNativeDisplayType dpy, DisplayGLMode mode);
70#endif
71
7ced9e9f 72EGLContext qemu_egl_init_ctx(void);
0df5c72b 73bool qemu_egl_has_dmabuf(void);
7ced9e9f 74
0e1be59e
MAL
75bool egl_init(const char *rendernode, DisplayGLMode mode, Error **errp);
76
044ca4bf
MAL
77const char *qemu_egl_get_error_string(void);
78
7ced9e9f 79#endif /* EGL_HELPERS_H */