Back in 2016, we discussed[1] rules for headers, and these were generally liked: 1. Have a carefully curated header that's included everywhere first. We got that already thanks to Peter: osdep.h. 2. Headers should normally include everything they need beyond osdep.h. If exceptions are needed for some reason, they must be documented in the header. If all that's needed from a header is typedefs, put those into qemu/typedefs.h instead of including the header. 3. Cyclic inclusion is forbidden. This patch gets include/ closer to obeying 2. It's actually extracted from my "[RFC] Baby steps towards saner headers" series[2], which demonstrates a possible path towards checking 2 automatically. It passes the RFC test there. [1] Message-ID: <87h9g8j57d.fsf@blackfin.pond.sub.org> https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.html [2] Message-Id: <20190711122827.18970-1-armbru@redhat.com> https://lists.nongnu.org/archive/html/qemu-devel/2019-07/msg02715.html Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20190812052359.30071-2-armbru@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
57 lines
1.7 KiB
C
57 lines
1.7 KiB
C
#ifndef EGL_HELPERS_H
|
|
#define EGL_HELPERS_H
|
|
|
|
#include <epoxy/gl.h>
|
|
#include <epoxy/egl.h>
|
|
#include <gbm.h>
|
|
#include "qapi/qapi-types-ui.h"
|
|
#include "ui/console.h"
|
|
#include "ui/shader.h"
|
|
|
|
extern EGLDisplay *qemu_egl_display;
|
|
extern EGLConfig qemu_egl_config;
|
|
extern DisplayGLMode qemu_egl_mode;
|
|
|
|
typedef struct egl_fb {
|
|
int width;
|
|
int height;
|
|
GLuint texture;
|
|
GLuint framebuffer;
|
|
bool delete_texture;
|
|
} egl_fb;
|
|
|
|
void egl_fb_destroy(egl_fb *fb);
|
|
void egl_fb_setup_default(egl_fb *fb, int width, int height);
|
|
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);
|
|
void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip);
|
|
void egl_fb_read(void *dst, egl_fb *src);
|
|
|
|
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,
|
|
int x, int y, double scale_x, double scale_y);
|
|
|
|
#ifdef CONFIG_OPENGL_DMABUF
|
|
|
|
extern int qemu_egl_rn_fd;
|
|
extern struct gbm_device *qemu_egl_rn_gbm_dev;
|
|
extern EGLContext qemu_egl_rn_ctx;
|
|
|
|
int egl_rendernode_init(const char *rendernode, DisplayGLMode mode);
|
|
int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc,
|
|
EGLuint64KHR *modifier);
|
|
|
|
void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
|
|
void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);
|
|
|
|
#endif
|
|
|
|
EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, EGLNativeWindowType win);
|
|
|
|
int qemu_egl_init_dpy_x11(EGLNativeDisplayType dpy, DisplayGLMode mode);
|
|
int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy, DisplayGLMode mode);
|
|
EGLContext qemu_egl_init_ctx(void);
|
|
|
|
#endif /* EGL_HELPERS_H */
|