Add Render_Engine structure

Start on code to setup the output buffer.
Add code to init evas_common functions
Add override for engine setup.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-04-30 07:09:16 +01:00
parent b607e66f68
commit a67894a5a7
1 changed files with 121 additions and 0 deletions

View File

@ -3,12 +3,65 @@
#include "Evas_Engine_Drm.h"
#include "evas_engine.h"
/* local structures */
typedef struct _Render_Engine Render_Engine;
struct _Render_Engine
{
Evas_Engine_Info_Drm *info;
Tilebuf *tb;
Tilebuf_Rect *rects;
Tilebuf_Rect *prev_rects[3];
Outbuf *ob;
Eina_Inlist *cur_rect;
Eina_Bool end : 1;
};
/* local function prototypes */
static void *_output_setup(int w, int h, unsigned int rotation, unsigned int depth, Eina_Bool alpha, int swap);
/* function tables - filled in later (func and parent func) */
static Evas_Func func, pfunc;
/* external variables */
int _evas_engine_drm_log_dom;
/* local functions */
static void *
_output_setup(int w, int h, unsigned int rotation, unsigned int depth, Eina_Bool alpha, int swap)
{
Render_Engine *re;
/* try to allocate space for our render engine structure */
if (!(re = calloc(1, sizeof(Render_Engine))))
return NULL;
/* try to create a new tilebuffer */
if (!(re->tb = evas_common_tilebuf_new(w, h)))
{
free(re);
return NULL;
}
/* set tilesize */
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
if (swap)
{
/* free any existing outbuf */
if (re->ob) evas_outbuf_free(re->ob);
/* try to create new outbuf */
}
/* return the allocated render_engine structure */
return re;
}
/* engine api functions */
static void *
eng_info(Evas *evas EINA_UNUSED)
@ -36,6 +89,73 @@ eng_info_free(Evas *evas EINA_UNUSED, void *einfo)
free(info);
}
static int
eng_setup(Evas *evas, void *einfo)
{
Evas_Engine_Info_Drm *info;
Evas_Public_Data *epd;
Render_Engine *re;
/* try to cast to our engine info structure */
if (!(info = (Evas_Engine_Info_Drm *)einfo)) return 0;
/* try to get the evas public data */
if (!(epd = eo_data_get(evas, EVAS_CLASS))) return 0;
/* check for valid engine output */
if (!(re = epd->engine.data.output))
{
static int swap = -1;
/* NB: If we have no valid output then assume we have not been
* initialized yet and call any needed common init routines */
evas_common_cpu_init();
evas_common_blend_init();
evas_common_image_init();
evas_common_convert_init();
evas_common_scale_init();
evas_common_rectangle_init();
evas_common_polygon_init();
evas_common_line_init();
evas_common_font_init();
evas_common_draw_init();
evas_common_tilebuf_init();
/* check if swapping is disabled */
if (swap == -1)
{
if (getenv("EVAS_DRM_NO_SWAP")) swap = 0;
else swap = 1;
}
/* try to create a new render_engine */
if (!(re = _output_setup(epd->output.w, epd->output.h,
info->info.rotation, info->info.depth,
info->info.destination_alpha, swap)))
return 0;
re->info = info;
}
else
{
}
/* reassign engine output */
epd->engine.data.output = re;
if (!epd->engine.data.output) return 0;
/* check for valid engine context */
if (!epd->engine.data.context)
{
/* create a context if needed */
epd->engine.data.context =
epd->engine.func->context_new(epd->engine.data.output);
}
return 1;
}
/* module api functions */
static int
module_open(Evas_Module *em)
@ -63,6 +183,7 @@ module_open(Evas_Module *em)
/* override the methods we provide */
EVAS_API_OVERRIDE(info, &func, eng_);
EVAS_API_OVERRIDE(info_free, &func, eng_);
EVAS_API_OVERRIDE(setup, &func, eng_);
/* advertise our engine functions */
em->functions = (void *)(&func);