diff options
Diffstat (limited to 'src/modules/evas/engines/gl_drm/evas_engine.h')
-rw-r--r-- | src/modules/evas/engines/gl_drm/evas_engine.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/src/modules/evas/engines/gl_drm/evas_engine.h b/src/modules/evas/engines/gl_drm/evas_engine.h new file mode 100644 index 0000000000..b00cf382cc --- /dev/null +++ b/src/modules/evas/engines/gl_drm/evas_engine.h @@ -0,0 +1,128 @@ +#ifndef EVAS_ENGINE_H +# define EVAS_ENGINE_H + +# include "evas_common_private.h" +# include "evas_macros.h" +# include "evas_private.h" +# include "Evas.h" +# include "Evas_Engine_GL_Drm.h" + +# define GL_GLEXT_PROTOTYPES +# include <EGL/egl.h> +# include <EGL/eglext.h> +# include <EGL/eglmesaext.h> +# include <GLES2/gl2.h> +# include <GLES2/gl2ext.h> +# include "../gl_generic/Evas_Engine_GL_Generic.h" + +extern int _evas_engine_gl_drm_log_dom; +extern int _extn_have_buffer_age; + +# ifdef ERR +# undef ERR +# endif +# define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_gl_drm_log_dom, __VA_ARGS__) + +# ifdef DBG +# undef DBG +# endif +# define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_gl_drm_log_dom, __VA_ARGS__) + +# ifdef INF +# undef INF +# endif +# define INF(...) EINA_LOG_DOM_INFO(_evas_engine_gl_drm_log_dom, __VA_ARGS__) + +# ifdef WRN +# undef WRN +# endif +# define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_gl_drm_log_dom, __VA_ARGS__) + +# ifdef CRI +# undef CRI +# endif +# define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_gl_drm_log_dom, __VA_ARGS__) + +extern Evas_GL_Common_Context_New glsym_evas_gl_common_context_new; +extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_flush; +extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_free; +extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_use; +extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_newframe; +extern Evas_GL_Common_Context_Call glsym_evas_gl_common_context_done; +extern Evas_GL_Common_Context_Resize_Call glsym_evas_gl_common_context_resize; +extern Evas_GL_Common_Buffer_Dump_Call glsym_evas_gl_common_buffer_dump; +extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_lock; +extern Evas_GL_Preload_Render_Call glsym_evas_gl_preload_render_unlock; + +struct _Context_3D +{ + EGLDisplay display; + EGLContext context; + EGLSurface surface; +}; + +struct _Outbuf +{ + Evas_Engine_Info_GL_Drm *info; + Evas_Engine_GL_Context *gl_context; + + int w, h; + unsigned int rotation, depth; + Render_Engine_Swap_Mode swap_mode; + + struct gbm_device *gbm; + struct gbm_surface *surface; + + struct + { + EGLContext context[1]; + EGLSurface surface[1]; + EGLConfig config; + EGLDisplay disp; + } egl; + + struct + { + int prev_age, frame_cnt; + int curr, last, num; + Ecore_Drm_Fb *buffer[4]; + struct gbm_bo *bo[4]; + Eina_List *pending_writes; + } priv; + + Eina_Bool destination_alpha : 1; + Eina_Bool vsync : 1; + Eina_Bool lost_back : 1; + Eina_Bool surf : 1; + Eina_Bool drew : 1; +}; + +Outbuf *evas_outbuf_new(Evas_Engine_Info_GL_Drm *info, int w, int h, Render_Engine_Swap_Mode swap_mode); +void evas_outbuf_free(Outbuf *ob); +void evas_outbuf_use(Outbuf *ob); +void evas_outbuf_resurf(Outbuf *ob); +void evas_outbuf_unsurf(Outbuf *ob); +void evas_outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth); +Render_Engine_Swap_Mode evas_outbuf_buffer_state_get(Outbuf *ob); +int evas_outbuf_rot_get(Outbuf *ob); +Eina_Bool evas_outbuf_update_region_first_rect(Outbuf *ob); +void *evas_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); +void evas_outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h); +void evas_outbuf_update_region_free(Outbuf *ob, RGBA_Image *update); +void evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode); +Evas_Engine_GL_Context* evas_outbuf_gl_context_get(Outbuf *ob); +void *evas_outbuf_egl_display_get(Outbuf *ob); +Context_3D *evas_outbuf_gl_context_new(Outbuf *ob); +void evas_outbuf_gl_context_use(Context_3D *ctx); + +static inline Eina_Bool +_re_wincheck(Outbuf *ob) +{ + if (ob->surf) return EINA_TRUE; + evas_outbuf_resurf(ob); + ob->lost_back = 1; + if (!ob->surf) ERR("GL engine can't re-create window surface!"); + return EINA_FALSE; +} + +#endif |