fill in some more egl sw engine theory.

SVN revision: 77078
This commit is contained in:
Carsten Haitzler 2012-09-26 10:03:49 +00:00
parent 53518723b8
commit 5ed4f6900b
3 changed files with 113 additions and 33 deletions

View File

@ -41,6 +41,12 @@ struct _Render_Engine
void (*outbuf_flush)(Outbuf *ob);
void (*outbuf_idle_flush)(Outbuf *ob);
Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
struct {
void *disp;
void *config;
void *surface;
} egl;
};
/* 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)
{
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;
// _egl_x_disp_get()
// then
// _egl_x_disp_init()
// then
// _egl_x_disp_choose_config()
// then
// _egl_x_win_surf_new()
//
// and on cleaup
//
// _egl_x_win_surf_free()
//
// to access pixels
//
// _egl_x_map_surf()
//
// to give back pixels
//
// _egl_x_unmap_surf()
re->egl.disp = _egl_x_disp_get(disp);
if (!re->egl.disp)
{
free(re);
return NULL;
}
re->egl.config = _egl_x_disp_choose_config(re->egl.disp);
if (!re->egl.config)
{
_egl_x_disp_terminate(re->egl.disp);
free(re);
return NULL;
}
re->egl.surface = _egl_x_win_surf_new(re->egl.disp, draw, re->egl.config);
if (!re->egl.surface)
{
_egl_x_disp_terminate(re->egl.disp);
free(re);
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;
}
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 *
_output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw,
Visual *vis, Colormap cmap, int depth, int debug,
@ -361,15 +407,25 @@ eng_setup(Evas *e, void *in)
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
if (info->info.backend == EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
{
re = _output_xlib_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);
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,
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);
re->outbuf_free = evas_software_xlib_outbuf_free;
re->outbuf_reconfigure = evas_software_xlib_outbuf_reconfigure;
@ -493,6 +549,7 @@ eng_output_free(void *data)
re->outbuf_free(re->ob);
evas_common_tilebuf_free(re->tb);
if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
_output_egl_shutdown(re);
free(re);
}

View File

@ -31,8 +31,6 @@
#define EGL_FALSE 0
#define EGL_TRUE 1
#define EGL_NATIVE_BIT 0x0010
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
#define EGL_MATCH_FORMAT_KHR 0x3043
@ -133,6 +131,15 @@ _egl_x_disp_get(void *d)
#endif
}
void
_egl_x_disp_terminate(void *ed)
{
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
if (!_egl_find()) return;
egl.Terminate(ed);
#endif
}
int
_egl_x_disp_init(void *ed)
{
@ -156,8 +163,6 @@ _egl_x_disp_choose_config(void *ed)
if (!_egl_find()) return NULL;
config_attrs[n++] = EGL_SURFACE_TYPE;
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++] = 8;
config_attrs[n++] = EGL_GREEN_SIZE;
@ -264,3 +269,13 @@ _egl_x_surf_swap(void *ed, void *surf, int vsync)
egl.SwapBuffers(ed, surf);
#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;
}

View File

@ -4,6 +4,7 @@
#include "evas_engine.h"
void *_egl_x_disp_get(void *d);
void _egl_x_disp_terminate(void *ed);
int _egl_x_disp_init(void *ed);
void *_egl_x_disp_choose_config(void *ed);
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_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