forked from enlightenment/efl
fill in some more egl sw engine theory.
SVN revision: 77078
This commit is contained in:
parent
53518723b8
commit
5ed4f6900b
|
@ -41,6 +41,12 @@ struct _Render_Engine
|
||||||
void (*outbuf_flush)(Outbuf *ob);
|
void (*outbuf_flush)(Outbuf *ob);
|
||||||
void (*outbuf_idle_flush)(Outbuf *ob);
|
void (*outbuf_idle_flush)(Outbuf *ob);
|
||||||
Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
|
Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
|
||||||
|
|
||||||
|
struct {
|
||||||
|
void *disp;
|
||||||
|
void *config;
|
||||||
|
void *surface;
|
||||||
|
} egl;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* prototypes we will use here */
|
/* prototypes we will use here */
|
||||||
|
@ -73,30 +79,70 @@ _output_egl_setup(int w, int h, int rot, Display *disp, Drawable draw,
|
||||||
int shape_dither, int destination_alpha)
|
int shape_dither, int destination_alpha)
|
||||||
{
|
{
|
||||||
Render_Engine *re;
|
Render_Engine *re;
|
||||||
|
void *ptr;
|
||||||
|
int stride = 0;
|
||||||
|
|
||||||
|
if (depth != 32) return NULL;
|
||||||
|
if (mask) return NULL;
|
||||||
if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL;
|
if (!(re = calloc(1, sizeof(Render_Engine)))) return NULL;
|
||||||
// _egl_x_disp_get()
|
re->egl.disp = _egl_x_disp_get(disp);
|
||||||
// then
|
if (!re->egl.disp)
|
||||||
// _egl_x_disp_init()
|
{
|
||||||
// then
|
free(re);
|
||||||
// _egl_x_disp_choose_config()
|
return NULL;
|
||||||
// then
|
}
|
||||||
// _egl_x_win_surf_new()
|
re->egl.config = _egl_x_disp_choose_config(re->egl.disp);
|
||||||
//
|
if (!re->egl.config)
|
||||||
// and on cleaup
|
{
|
||||||
//
|
_egl_x_disp_terminate(re->egl.disp);
|
||||||
// _egl_x_win_surf_free()
|
free(re);
|
||||||
//
|
return NULL;
|
||||||
// to access pixels
|
}
|
||||||
//
|
re->egl.surface = _egl_x_win_surf_new(re->egl.disp, draw, re->egl.config);
|
||||||
// _egl_x_map_surf()
|
if (!re->egl.surface)
|
||||||
//
|
{
|
||||||
// to give back pixels
|
_egl_x_disp_terminate(re->egl.disp);
|
||||||
//
|
free(re);
|
||||||
// _egl_x_unmap_surf()
|
return NULL;
|
||||||
|
}
|
||||||
|
ptr = _egl_x_surf_map(re->egl.disp, re->egl.surface, &stride);
|
||||||
|
if (!ptr)
|
||||||
|
{
|
||||||
|
_egl_x_win_surf_free(re->egl.disp, re->egl.surface);
|
||||||
|
_egl_x_disp_terminate(re->egl.disp);
|
||||||
|
free(re);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
_egl_x_surf_unmap(re->egl.disp, re->egl.surface);
|
||||||
|
|
||||||
|
re->ob =
|
||||||
|
evas_software_egl_outbuf_setup_x(w, h, rot, OUTBUF_DEPTH_INHERIT, disp,
|
||||||
|
draw, vis, cmap, depth, grayscale,
|
||||||
|
max_colors, mask, shape_dither,
|
||||||
|
destination_alpha);
|
||||||
|
|
||||||
|
re->tb = evas_common_tilebuf_new(w, h);
|
||||||
|
if (!re->tb)
|
||||||
|
{
|
||||||
|
evas_software_xlib_outbuf_free(re->ob);
|
||||||
|
free(re);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* in preliminary tests 16x16 gave highest framerates */
|
||||||
|
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
|
||||||
|
|
||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_output_egl_shutdown(Render_Engine *re)
|
||||||
|
{
|
||||||
|
if (!re->egl.disp) return;
|
||||||
|
_egl_x_win_surf_free(re->egl.disp, re->egl.surface);
|
||||||
|
_egl_x_disp_terminate(re->egl.disp);
|
||||||
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
_output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw,
|
_output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw,
|
||||||
Visual *vis, Colormap cmap, int depth, int debug,
|
Visual *vis, Colormap cmap, int depth, int debug,
|
||||||
|
@ -361,6 +407,16 @@ eng_setup(Evas *e, void *in)
|
||||||
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||||
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
|
||||||
{
|
{
|
||||||
|
re = _output_egl_setup(e->output.w, e->output.h,
|
||||||
|
info->info.rotation, info->info.connection,
|
||||||
|
info->info.drawable, info->info.visual,
|
||||||
|
info->info.colormap,
|
||||||
|
info->info.depth, info->info.debug,
|
||||||
|
info->info.alloc_grayscale,
|
||||||
|
info->info.alloc_colors_max,
|
||||||
|
info->info.mask, info->info.shape_dither,
|
||||||
|
info->info.destination_alpha);
|
||||||
|
if (!re)
|
||||||
re = _output_xlib_setup(e->output.w, e->output.h,
|
re = _output_xlib_setup(e->output.w, e->output.h,
|
||||||
info->info.rotation, info->info.connection,
|
info->info.rotation, info->info.connection,
|
||||||
info->info.drawable, info->info.visual,
|
info->info.drawable, info->info.visual,
|
||||||
|
@ -493,6 +549,7 @@ eng_output_free(void *data)
|
||||||
re->outbuf_free(re->ob);
|
re->outbuf_free(re->ob);
|
||||||
evas_common_tilebuf_free(re->tb);
|
evas_common_tilebuf_free(re->tb);
|
||||||
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
|
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
|
||||||
|
_output_egl_shutdown(re);
|
||||||
free(re);
|
free(re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
#define EGL_FALSE 0
|
#define EGL_FALSE 0
|
||||||
#define EGL_TRUE 1
|
#define EGL_TRUE 1
|
||||||
|
|
||||||
#define EGL_NATIVE_BIT 0x0010
|
|
||||||
|
|
||||||
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
|
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
|
||||||
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
|
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
|
||||||
#define EGL_MATCH_FORMAT_KHR 0x3043
|
#define EGL_MATCH_FORMAT_KHR 0x3043
|
||||||
|
@ -133,6 +131,15 @@ _egl_x_disp_get(void *d)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_egl_x_disp_terminate(void *ed)
|
||||||
|
{
|
||||||
|
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
|
||||||
|
if (!_egl_find()) return;
|
||||||
|
egl.Terminate(ed);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_egl_x_disp_init(void *ed)
|
_egl_x_disp_init(void *ed)
|
||||||
{
|
{
|
||||||
|
@ -156,8 +163,6 @@ _egl_x_disp_choose_config(void *ed)
|
||||||
if (!_egl_find()) return NULL;
|
if (!_egl_find()) return NULL;
|
||||||
config_attrs[n++] = EGL_SURFACE_TYPE;
|
config_attrs[n++] = EGL_SURFACE_TYPE;
|
||||||
config_attrs[n++] = EGL_WINDOW_BIT;
|
config_attrs[n++] = EGL_WINDOW_BIT;
|
||||||
config_attrs[n++] = EGL_RENDERABLE_TYPE;
|
|
||||||
config_attrs[n++] = EGL_NATIVE_BIT;
|
|
||||||
config_attrs[n++] = EGL_RED_SIZE;
|
config_attrs[n++] = EGL_RED_SIZE;
|
||||||
config_attrs[n++] = 8;
|
config_attrs[n++] = 8;
|
||||||
config_attrs[n++] = EGL_GREEN_SIZE;
|
config_attrs[n++] = EGL_GREEN_SIZE;
|
||||||
|
@ -264,3 +269,13 @@ _egl_x_surf_swap(void *ed, void *surf, int vsync)
|
||||||
egl.SwapBuffers(ed, surf);
|
egl.SwapBuffers(ed, surf);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Outbuf *
|
||||||
|
evas_software_egl_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
|
||||||
|
Display *disp, Drawable draw, Visual *vis,
|
||||||
|
Colormap cmap, int x_depth,
|
||||||
|
int grayscale, int max_colors, Pixmap mask,
|
||||||
|
int shape_dither, int destination_alpha)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "evas_engine.h"
|
#include "evas_engine.h"
|
||||||
|
|
||||||
void *_egl_x_disp_get(void *d);
|
void *_egl_x_disp_get(void *d);
|
||||||
|
void _egl_x_disp_terminate(void *ed);
|
||||||
int _egl_x_disp_init(void *ed);
|
int _egl_x_disp_init(void *ed);
|
||||||
void *_egl_x_disp_choose_config(void *ed);
|
void *_egl_x_disp_choose_config(void *ed);
|
||||||
void *_egl_x_win_surf_new(void *ed, Window win, void *config);
|
void *_egl_x_win_surf_new(void *ed, Window win, void *config);
|
||||||
|
@ -12,4 +13,11 @@ void *_egl_x_surf_map(void *ed, void *surf, int *stride);
|
||||||
void _egl_x_surf_unmap(void *ed, void *surf);
|
void _egl_x_surf_unmap(void *ed, void *surf);
|
||||||
void _egl_x_surf_swap(void *ed, void *surf, int vsync);
|
void _egl_x_surf_swap(void *ed, void *surf, int vsync);
|
||||||
|
|
||||||
|
Outbuf *
|
||||||
|
evas_software_egl_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
|
||||||
|
Display *disp, Drawable draw, Visual *vis,
|
||||||
|
Colormap cmap, int x_depth,
|
||||||
|
int grayscale, int max_colors, Pixmap mask,
|
||||||
|
int shape_dither, int destination_alpha);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue