Add logging functions

Remove dead commented out code
Do not call wl_surface_attach if the buffer is the same as the one
already attached.

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 83293
This commit is contained in:
Christopher Michael 2013-01-24 12:15:07 +00:00 committed by Christopher Michael
parent b8a9d67c88
commit cfbdc648d1
3 changed files with 73 additions and 9 deletions

View File

@ -63,6 +63,8 @@ _output_engine_setup(int w, int h, unsigned int rotation, unsigned int depth, Ei
{
Render_Engine *re = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* try to allocate a new render engine */
if (!(re = calloc(1, sizeof(Render_Engine))))
return NULL;
@ -110,6 +112,8 @@ _merge_rects(Tilebuf *tb, Tilebuf_Rect *r1, Tilebuf_Rect *r2, Tilebuf_Rect *r3)
{
Tilebuf_Rect *r, *rects;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (r1)
{
EINA_INLIST_FOREACH(EINA_INLIST_GET(r1), r)
@ -193,6 +197,8 @@ eng_setup(Evas *eo_evas, void *einfo)
Evas_Public_Data *epd;
Render_Engine *re = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* try to cast the engine info to our engine info */
if (!(info = (Evas_Engine_Info_Wayland_Shm *)einfo))
return 0;
@ -283,6 +289,8 @@ eng_output_free(void *data)
{
Render_Engine *re;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if ((re = data))
{
re->outbuf_free(re->ob);
@ -307,6 +315,8 @@ eng_output_resize(void *data, int w, int h)
{
Render_Engine *re;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(re = (Render_Engine *)data)) return;
re->outbuf_reconfigure(re->ob, w, h,
re->ob->rotation, re->ob->depth,
@ -360,6 +370,8 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
Tilebuf_Rect *rect;
Eina_Bool first_rect = EINA_FALSE;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
#define CLEAR_PREV_RECTS(x) \
do { \
if (re->prev_rects[x]) \
@ -473,6 +485,8 @@ eng_output_redraws_next_update_push(void *data, void *surface, int x, int y, int
{
Render_Engine *re;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return;
if (!(re = (Render_Engine *)data)) return;
@ -489,6 +503,8 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode)
{
Render_Engine *re;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return;
if (!(re = (Render_Engine *)data)) return;
@ -505,6 +521,8 @@ eng_output_idle_flush(void *data)
{
Render_Engine *re;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!(re = (Render_Engine *)data)) return;
re->outbuf_idle_flush(re->ob);
}

View File

@ -25,6 +25,8 @@ evas_swapbuf_setup(int w, int h, unsigned int rotation, Outbuf_Depth depth, Eina
{
Outbuf *ob = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* try to allocate a new Outbuf */
if (!(ob = calloc(1, sizeof(Outbuf))))
return NULL;
@ -70,6 +72,8 @@ evas_swapbuf_setup(int w, int h, unsigned int rotation, Outbuf_Depth depth, Eina
void
evas_swapbuf_free(Outbuf *ob)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid output buffer */
if (!ob) return;
@ -78,9 +82,6 @@ evas_swapbuf_free(Outbuf *ob)
evas_swapbuf_idle_flush(ob);
eina_array_flush(&ob->priv.onebuf_regions);
/* destroy the wayland shm pool */
/* _evas_swapbuf_pool_destroy(ob); */
/* free the allocated structure */
free(ob);
}
@ -88,6 +89,8 @@ evas_swapbuf_free(Outbuf *ob)
void
evas_swapbuf_reconfigure(Outbuf *ob, int w, int h, unsigned int rotation, Outbuf_Depth depth, Eina_Bool alpha)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid output buffer */
if (!ob) return;
@ -131,6 +134,8 @@ evas_swapbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx,
RGBA_Image *img;
Eina_Rectangle *rect;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, ob->w, ob->h);
if ((w <= 0) || (h <= 0)) return NULL;
@ -234,6 +239,8 @@ evas_swapbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, in
DATA8 *dst;
int depth = 32, bpp = 0, bpl = 0, wid = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid output buffer */
if (!ob) return;
@ -245,14 +252,14 @@ evas_swapbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, in
func =
evas_common_convert_func_get(0, w, h, depth,
RED_MASK, GREEN_MASK, BLUE_MASK,
PAL_MODE_NONE, ob->rotation);
PAL_MODE_RGB332, ob->rotation);
}
else if ((ob->rotation == 90) || (ob->rotation == 270))
{
func =
evas_common_convert_func_get(0, h, w, depth,
RED_MASK, GREEN_MASK, BLUE_MASK,
PAL_MODE_NONE, ob->rotation);
PAL_MODE_RGB332, ob->rotation);
}
/* make sure we have a valid convert function */
@ -323,6 +330,8 @@ evas_swapbuf_flush(Outbuf *ob)
RGBA_Image *img;
unsigned int n = 0, i = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid output buffer */
if (!ob) return;
@ -440,6 +449,8 @@ evas_swapbuf_flush(Outbuf *ob)
void
evas_swapbuf_idle_flush(Outbuf *ob)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid output buffer */
if (!ob) return;
@ -455,6 +466,8 @@ evas_swapbuf_state_get(Outbuf *ob)
{
int mode = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
if (!ob->priv.swapper) return MODE_FULL;
mode = evas_swapper_buffer_state_get(ob->priv.swapper);
return mode;

View File

@ -62,6 +62,8 @@ evas_swapper_setup(int w, int h, Outbuf_Depth depth, Eina_Bool alpha, struct wl_
int i = 0;
char *num_buffers;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* try to allocate a new swapper */
if (!(ws = calloc(1, sizeof(Wl_Swapper))))
return NULL;
@ -117,6 +119,8 @@ evas_swapper_swap(Wl_Swapper *ws, Eina_Rectangle *rects, unsigned int count)
{
int n = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid swapper */
if (!ws) return;
@ -131,6 +135,8 @@ evas_swapper_free(Wl_Swapper *ws)
{
int i = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid swapper */
if (!ws) return;
@ -148,6 +154,8 @@ evas_swapper_free(Wl_Swapper *ws)
void *
evas_swapper_buffer_map(Wl_Swapper *ws)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid swapper */
if (!ws) return NULL;
@ -161,6 +169,8 @@ evas_swapper_buffer_map(Wl_Swapper *ws)
void
evas_swapper_buffer_unmap(Wl_Swapper *ws)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid swapper */
if (!ws) return;
@ -172,6 +182,8 @@ evas_swapper_buffer_state_get(Wl_Swapper *ws)
{
int i = 0, n = 0, count = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
for (i = 0; i < ws->buff_num; i++)
{
n = (ws->buff_num + ws->buff_cur - (i)) % ws->buff_num;
@ -194,6 +206,8 @@ evas_swapper_buffer_idle_flush(Wl_Swapper *ws)
{
int i = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid swapper */
if (!ws) return;
@ -218,6 +232,8 @@ _evas_swapper_shm_pool_new(Wl_Swapper *ws)
size_t size;
int fd = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* make sure swapper has a shm */
if (!ws->shm) return EINA_FALSE;
@ -276,6 +292,8 @@ _evas_swapper_shm_pool_new(Wl_Swapper *ws)
static void
_evas_swapper_shm_pool_free(Wl_Swapper *ws)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid swapper */
if (!ws) return;
@ -295,6 +313,8 @@ _evas_swapper_buffer_new(Wl_Swapper *ws, Wl_Buffer *wb)
unsigned int format = WL_SHM_FORMAT_XRGB8888;
size_t size;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* make sure swapper has a shm */
if (!ws->shm) return EINA_FALSE;
@ -335,6 +355,8 @@ _evas_swapper_buffer_new(Wl_Swapper *ws, Wl_Buffer *wb)
static void
_evas_swapper_buffer_free(Wl_Buffer *wb)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid buffer */
if (!wb) return;
@ -351,6 +373,9 @@ static void
_evas_swapper_buffer_put(Wl_Swapper *ws, Wl_Buffer *wb, Eina_Rectangle *rects, unsigned int count)
{
Eina_Rectangle *rect;
static struct wl_buffer *sent;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* check for valid swapper */
if (!ws) return;
@ -365,10 +390,12 @@ _evas_swapper_buffer_put(Wl_Swapper *ws, Wl_Buffer *wb, Eina_Rectangle *rects, u
if ((!wb->data) || (!wb->buffer))
{
/* call function to mmap buffer data */
if (!_evas_swapper_buffer_new(ws, wb))
return;
/* if (!_evas_swapper_buffer_new(ws, wb)) */
return;
}
if ((!rects) || (count == 0)) return;
rect = eina_rectangle_new(0, 0, 0, 0);
if (rects)
{
@ -388,7 +415,11 @@ _evas_swapper_buffer_put(Wl_Swapper *ws, Wl_Buffer *wb, Eina_Rectangle *rects, u
}
/* surface attach */
wl_surface_attach(ws->surface, wb->buffer, 0, 0);
if (sent != wb->buffer)
{
wl_surface_attach(ws->surface, wb->buffer, 0, 0);
sent = wb->buffer;
}
/* surface damage */
/* printf("Damage Surface: %d %d %d %d\n", rect->x, rect->y, rect->w, rect->h); */
@ -399,7 +430,7 @@ _evas_swapper_buffer_put(Wl_Swapper *ws, Wl_Buffer *wb, Eina_Rectangle *rects, u
/* surface commit */
wl_surface_commit(ws->surface);
wb->valid = EINA_TRUE;
/* wb->valid = EINA_FALSE; */
}
static void
@ -407,6 +438,8 @@ _evas_swapper_buffer_release(void *data, struct wl_buffer *buffer EINA_UNUSED)
{
Wl_Buffer *wb = NULL;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
/* try to get out Wl_Buffer struct */
if (!(wb = data)) return;