egl-helpers.h (1979B)
1#ifndef EGL_HELPERS_H 2#define EGL_HELPERS_H 3 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" 11 12extern EGLDisplay *qemu_egl_display; 13extern EGLConfig qemu_egl_config; 14extern DisplayGLMode qemu_egl_mode; 15 16typedef 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; 24 25void egl_fb_destroy(egl_fb *fb); 26void egl_fb_setup_default(egl_fb *fb, int width, int height); 27void egl_fb_setup_for_tex(egl_fb *fb, int width, int height, 28 GLuint texture, bool delete); 29void egl_fb_setup_new_tex(egl_fb *fb, int width, int height); 30void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip); 31void egl_fb_read(DisplaySurface *dst, egl_fb *src); 32 33void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip); 34void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip, 35 int x, int y, double scale_x, double scale_y); 36 37#ifdef CONFIG_GBM 38 39extern int qemu_egl_rn_fd; 40extern struct gbm_device *qemu_egl_rn_gbm_dev; 41extern EGLContext qemu_egl_rn_ctx; 42 43int egl_rendernode_init(const char *rendernode, DisplayGLMode mode); 44int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc, 45 EGLuint64KHR *modifier); 46 47void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf); 48void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf); 49void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf); 50void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf); 51 52#endif 53 54EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win); 55 56#if defined(CONFIG_X11) || defined(CONFIG_GBM) 57 58int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode); 59int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode); 60 61#endif 62 63EGLContext qemu_egl_init_ctx(void); 64bool qemu_egl_has_dmabuf(void); 65 66#endif /* EGL_HELPERS_H */