2015-01-06 15:40:00 +01:00
|
|
|
#ifndef EGL_HELPERS_H
|
|
|
|
#define EGL_HELPERS_H
|
|
|
|
|
|
|
|
#include <epoxy/gl.h>
|
|
|
|
#include <epoxy/egl.h>
|
2021-02-23 07:03:07 +01:00
|
|
|
#ifdef CONFIG_GBM
|
2015-10-12 12:03:49 +02:00
|
|
|
#include <gbm.h>
|
2021-02-23 07:03:07 +01:00
|
|
|
#endif
|
2019-08-12 07:23:31 +02:00
|
|
|
#include "ui/console.h"
|
|
|
|
#include "ui/shader.h"
|
2015-01-06 15:40:00 +01:00
|
|
|
|
|
|
|
extern EGLDisplay *qemu_egl_display;
|
|
|
|
extern EGLConfig qemu_egl_config;
|
2018-06-18 13:21:41 +02:00
|
|
|
extern DisplayGLMode qemu_egl_mode;
|
2015-01-06 15:40:00 +01:00
|
|
|
|
2017-06-14 10:41:46 +02:00
|
|
|
typedef struct egl_fb {
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
GLuint texture;
|
|
|
|
GLuint framebuffer;
|
|
|
|
bool delete_texture;
|
2021-09-14 23:18:35 +02:00
|
|
|
QemuDmaBuf *dmabuf;
|
2017-06-14 10:41:46 +02:00
|
|
|
} egl_fb;
|
|
|
|
|
|
|
|
void egl_fb_destroy(egl_fb *fb);
|
|
|
|
void egl_fb_setup_default(egl_fb *fb, int width, int height);
|
2017-09-27 13:50:31 +02:00
|
|
|
void egl_fb_setup_for_tex(egl_fb *fb, int width, int height,
|
|
|
|
GLuint texture, bool delete);
|
|
|
|
void egl_fb_setup_new_tex(egl_fb *fb, int width, int height);
|
2017-06-14 10:41:46 +02:00
|
|
|
void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip);
|
2019-09-09 09:39:11 +02:00
|
|
|
void egl_fb_read(DisplaySurface *dst, egl_fb *src);
|
2017-06-14 10:41:46 +02:00
|
|
|
|
2017-10-10 15:54:52 +02:00
|
|
|
void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip);
|
|
|
|
void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip,
|
2019-01-25 08:47:23 +01:00
|
|
|
int x, int y, double scale_x, double scale_y);
|
2017-10-10 15:54:52 +02:00
|
|
|
|
2021-02-23 07:03:07 +01:00
|
|
|
#ifdef CONFIG_GBM
|
2015-10-12 12:03:49 +02:00
|
|
|
|
|
|
|
extern int qemu_egl_rn_fd;
|
|
|
|
extern struct gbm_device *qemu_egl_rn_gbm_dev;
|
|
|
|
extern EGLContext qemu_egl_rn_ctx;
|
|
|
|
|
2018-06-18 13:21:41 +02:00
|
|
|
int egl_rendernode_init(const char *rendernode, DisplayGLMode mode);
|
2019-05-29 09:21:43 +02:00
|
|
|
int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc,
|
|
|
|
EGLuint64KHR *modifier);
|
2015-10-12 12:03:49 +02:00
|
|
|
|
2017-10-10 15:54:51 +02:00
|
|
|
void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
|
|
|
|
void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);
|
2021-09-14 23:18:34 +02:00
|
|
|
void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf);
|
|
|
|
void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf);
|
2017-10-10 15:54:51 +02:00
|
|
|
|
2015-10-12 12:03:49 +02:00
|
|
|
#endif
|
|
|
|
|
2019-01-16 12:37:51 +01:00
|
|
|
EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win);
|
2015-01-06 15:40:00 +01:00
|
|
|
|
2021-02-23 07:03:07 +01:00
|
|
|
#if defined(CONFIG_X11) || defined(CONFIG_GBM)
|
|
|
|
|
2018-06-18 13:21:41 +02:00
|
|
|
int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode);
|
|
|
|
int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode);
|
2021-02-23 07:03:07 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-01-06 15:40:00 +01:00
|
|
|
EGLContext qemu_egl_init_ctx(void);
|
2021-02-04 11:52:26 +01:00
|
|
|
bool qemu_egl_has_dmabuf(void);
|
2015-01-06 15:40:00 +01:00
|
|
|
|
|
|
|
#endif /* EGL_HELPERS_H */
|