17ced9e9fSGerd Hoffmann #ifndef EGL_HELPERS_H 27ced9e9fSGerd Hoffmann #define EGL_HELPERS_H 37ced9e9fSGerd Hoffmann 47ced9e9fSGerd Hoffmann #include <epoxy/gl.h> 57ced9e9fSGerd Hoffmann #include <epoxy/egl.h> 61e316598SGerd Hoffmann #include <gbm.h> 7ec150c7eSMarkus Armbruster #include "ui/console.h" 8ec150c7eSMarkus Armbruster #include "ui/shader.h" 97ced9e9fSGerd Hoffmann 107ced9e9fSGerd Hoffmann extern EGLDisplay *qemu_egl_display; 117ced9e9fSGerd Hoffmann extern EGLConfig qemu_egl_config; 1254d208ffSGerd Hoffmann extern DisplayGLMode qemu_egl_mode; 137ced9e9fSGerd Hoffmann 146fafc260SGerd Hoffmann typedef struct egl_fb { 156fafc260SGerd Hoffmann int width; 166fafc260SGerd Hoffmann int height; 176fafc260SGerd Hoffmann GLuint texture; 186fafc260SGerd Hoffmann GLuint framebuffer; 196fafc260SGerd Hoffmann bool delete_texture; 206fafc260SGerd Hoffmann } egl_fb; 216fafc260SGerd Hoffmann 226fafc260SGerd Hoffmann void egl_fb_destroy(egl_fb *fb); 236fafc260SGerd Hoffmann void egl_fb_setup_default(egl_fb *fb, int width, int height); 2474083f9cSGerd Hoffmann void egl_fb_setup_for_tex(egl_fb *fb, int width, int height, 2574083f9cSGerd Hoffmann GLuint texture, bool delete); 2674083f9cSGerd Hoffmann void egl_fb_setup_new_tex(egl_fb *fb, int width, int height); 276fafc260SGerd Hoffmann void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip); 28*d2329237SGerd Hoffmann void egl_fb_read(DisplaySurface *dst, egl_fb *src); 296fafc260SGerd Hoffmann 300eb50c27SGerd Hoffmann void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip); 310eb50c27SGerd Hoffmann void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip, 32051a0cdeSChen Zhang int x, int y, double scale_x, double scale_y); 330eb50c27SGerd Hoffmann 341e316598SGerd Hoffmann #ifdef CONFIG_OPENGL_DMABUF 351e316598SGerd Hoffmann 361e316598SGerd Hoffmann extern int qemu_egl_rn_fd; 371e316598SGerd Hoffmann extern struct gbm_device *qemu_egl_rn_gbm_dev; 381e316598SGerd Hoffmann extern EGLContext qemu_egl_rn_ctx; 391e316598SGerd Hoffmann 4054d208ffSGerd Hoffmann int egl_rendernode_init(const char *rendernode, DisplayGLMode mode); 415fc1fb62SGerd Hoffmann int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc, 425fc1fb62SGerd Hoffmann EGLuint64KHR *modifier); 431e316598SGerd Hoffmann 4486c0522cSGerd Hoffmann void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf); 4586c0522cSGerd Hoffmann void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf); 4686c0522cSGerd Hoffmann 471e316598SGerd Hoffmann #endif 481e316598SGerd Hoffmann 49fbd57c75SAlexander Kanavin EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win); 507ced9e9fSGerd Hoffmann 5154d208ffSGerd Hoffmann int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode); 5254d208ffSGerd Hoffmann int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode); 537ced9e9fSGerd Hoffmann EGLContext qemu_egl_init_ctx(void); 547ced9e9fSGerd Hoffmann 557ced9e9fSGerd Hoffmann #endif /* EGL_HELPERS_H */ 56