diff --git a/src/modules/evas/engines/buffer/evas_engine.c b/src/modules/evas/engines/buffer/evas_engine.c index 516e055f9b..1e47cb55db 100644 --- a/src/modules/evas/engines/buffer/evas_engine.c +++ b/src/modules/evas/engines/buffer/evas_engine.c @@ -107,6 +107,7 @@ _output_setup(int w, evas_buffer_outbuf_buf_swap_mode_get, evas_buffer_outbuf_buf_rot_get, evas_buffer_outbuf_reconfigure, + NULL, evas_buffer_outbuf_buf_new_region_for_update, evas_buffer_outbuf_buf_push_updated_region, evas_buffer_outbuf_buf_free_region_for_update, diff --git a/src/modules/evas/engines/drm/evas_engine.c b/src/modules/evas/engines/drm/evas_engine.c index 68f586ae33..41dd8aba6b 100644 --- a/src/modules/evas/engines/drm/evas_engine.c +++ b/src/modules/evas/engines/drm/evas_engine.c @@ -38,6 +38,7 @@ _output_setup(Evas_Engine_Info_Drm *info, int w, int h) evas_outbuf_buffer_state_get, evas_outbuf_get_rot, evas_outbuf_reconfigure, + NULL, evas_outbuf_update_region_new, evas_outbuf_update_region_push, evas_outbuf_update_region_free, @@ -144,7 +145,7 @@ eng_setup(Evas *evas, void *einfo) if (ob) return 0; /* if we have an existing outbuf, free it */ - evas_render_engine_software_generic_update(&re->generic, ob); + evas_render_engine_software_generic_update(&re->generic, ob, epd->output.w, epd->output.h); } /* update the info structure pointer */ diff --git a/src/modules/evas/engines/drm/evas_engine.h b/src/modules/evas/engines/drm/evas_engine.h index cf4e22206a..43d6febc88 100644 --- a/src/modules/evas/engines/drm/evas_engine.h +++ b/src/modules/evas/engines/drm/evas_engine.h @@ -123,10 +123,10 @@ void evas_outbuf_free(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_get_rot(Outbuf *ob); -RGBA_Image *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_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); +void evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode); Eina_Bool evas_drm_init(Evas_Engine_Info_Drm *info); Eina_Bool evas_drm_shutdown(Evas_Engine_Info_Drm *info); diff --git a/src/modules/evas/engines/drm/evas_outbuf.c b/src/modules/evas/engines/drm/evas_outbuf.c index 1e33315626..6a2a4be631 100644 --- a/src/modules/evas/engines/drm/evas_outbuf.c +++ b/src/modules/evas/engines/drm/evas_outbuf.c @@ -226,7 +226,7 @@ evas_outbuf_buffer_state_get(Outbuf *ob) return MODE_FULL; } -RGBA_Image * +void * evas_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) { RGBA_Image *img = NULL; @@ -411,19 +411,21 @@ evas_outbuf_update_region_free(Outbuf *ob EINA_UNUSED, /* evas_cache_image_drop(&update->cache_entry); */ } -void -evas_outbuf_flush(Outbuf *ob) +void +evas_outbuf_flush(Outbuf *ob, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode render_mode) { - Eina_Rectangle *rects; + Eina_Rectangle *r; RGBA_Image *img; unsigned int n = 0, i = 0; + if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; + /* get number of pending writes */ n = eina_list_count(ob->priv.pending_writes); if (n == 0) return; /* allocate rectangles */ - if (!(rects = alloca(n * sizeof(Eina_Rectangle)))) return; + if (!(r = alloca(n * sizeof(Eina_Rectangle)))) return; /* loop the pending writes */ EINA_LIST_FREE(ob->priv.pending_writes, img) @@ -438,35 +440,35 @@ evas_outbuf_flush(Outbuf *ob) /* based on rotation, set rectangle position */ if (ob->rotation == 0) { - rects[i].x = x; - rects[i].y = y; + r[i].x = x; + r[i].y = y; } else if (ob->rotation == 90) { - rects[i].x = y; - rects[i].y = (ob->w - x - w); + r[i].x = y; + r[i].y = (ob->w - x - w); } else if (ob->rotation == 180) { - rects[i].x = (ob->w - x - w); - rects[i].y = (ob->h - y - h); + r[i].x = (ob->w - x - w); + r[i].y = (ob->h - y - h); } else if (ob->rotation == 270) { - rects[i].x = (ob->h - y - h); - rects[i].y = x; + r[i].x = (ob->h - y - h); + r[i].y = x; } /* based on rotation, set rectangle size */ if ((ob->rotation == 0) || (ob->rotation == 180)) { - rects[i].w = w; - rects[i].h = h; + r[i].w = w; + r[i].h = h; } else if ((ob->rotation == 90) || (ob->rotation == 270)) { - rects[i].w = h; - rects[i].h = w; + r[i].w = h; + r[i].h = w; } eina_rectangle_free(rect); @@ -482,7 +484,7 @@ evas_outbuf_flush(Outbuf *ob) } /* force a buffer swap */ - _evas_outbuf_buffer_swap(ob, rects, n); + _evas_outbuf_buffer_swap(ob, r, n); } int diff --git a/src/modules/evas/engines/fb/evas_engine.c b/src/modules/evas/engines/fb/evas_engine.c index 215bee4582..3a02a69345 100644 --- a/src/modules/evas/engines/fb/evas_engine.c +++ b/src/modules/evas/engines/fb/evas_engine.c @@ -57,6 +57,7 @@ _output_setup(int w, int h, int rot, int vt, int dev, int refresh) if (!evas_render_engine_software_generic_init(&re->generic, ob, NULL, evas_fb_outbuf_fb_get_rot, evas_fb_outbuf_fb_reconfigure, + NULL, evas_fb_outbuf_fb_new_region_for_update, evas_fb_outbuf_fb_push_updated_region, evas_fb_outbuf_fb_free_region_for_update, diff --git a/src/modules/evas/engines/fb/evas_engine.h b/src/modules/evas/engines/fb/evas_engine.h index d4fcb3ef27..424d47cbbe 100644 --- a/src/modules/evas/engines/fb/evas_engine.h +++ b/src/modules/evas/engines/fb/evas_engine.h @@ -57,7 +57,7 @@ Outbuf *evas_fb_outbuf_fb_setup_fb (int w, int h, int rot, Ou void evas_fb_outbuf_fb_blit (Outbuf *buf, int src_x, int src_y, int w, int h, int dst_x, int dst_y); void evas_fb_outbuf_fb_update (Outbuf *buf, int x, int y, int w, int h); -RGBA_Image *evas_fb_outbuf_fb_new_region_for_update (Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); +void *evas_fb_outbuf_fb_new_region_for_update (Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); void evas_fb_outbuf_fb_free_region_for_update (Outbuf *buf, RGBA_Image *update); void evas_fb_outbuf_fb_push_updated_region (Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h); void evas_fb_outbuf_fb_reconfigure (Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth); diff --git a/src/modules/evas/engines/fb/evas_outbuf.c b/src/modules/evas/engines/fb/evas_outbuf.c index 5196507084..0c22cf5712 100644 --- a/src/modules/evas/engines/fb/evas_outbuf.c +++ b/src/modules/evas/engines/fb/evas_outbuf.c @@ -240,7 +240,7 @@ evas_fb_outbuf_fb_update(Outbuf *buf, int x, int y, int w, int h) } } -RGBA_Image * +void * evas_fb_outbuf_fb_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) { if (buf->priv.back_buf) diff --git a/src/modules/evas/engines/software_ddraw/evas_engine.h b/src/modules/evas/engines/software_ddraw/evas_engine.h index 084a50d4e7..9217cdcfa5 100644 --- a/src/modules/evas/engines/software_ddraw/evas_engine.h +++ b/src/modules/evas/engines/software_ddraw/evas_engine.h @@ -140,7 +140,7 @@ void evas_software_ddraw_outbuf_push_updated_region(Outbuf *buf, void evas_software_ddraw_outbuf_free_region_for_update(Outbuf *buf, RGBA_Image *update); -void evas_software_ddraw_outbuf_flush(Outbuf *buf); +void evas_software_ddraw_outbuf_flush(Outbuf *buf, Evas_Render_Mode render_mode); void evas_software_ddraw_outbuf_idle_flush(Outbuf *buf); diff --git a/src/modules/evas/engines/software_ddraw/evas_outbuf.c b/src/modules/evas/engines/software_ddraw/evas_outbuf.c index 0e121ac981..4d6a515c64 100644 --- a/src/modules/evas/engines/software_ddraw/evas_outbuf.c +++ b/src/modules/evas/engines/software_ddraw/evas_outbuf.c @@ -356,7 +356,7 @@ evas_software_ddraw_outbuf_free_region_for_update(Outbuf *buf EINA_UNUSED, } void -evas_software_ddraw_outbuf_flush(Outbuf *buf) +evas_software_ddraw_outbuf_flush(Outbuf *buf, Evas_Render_Mode render_mode) { Eina_List *l; RGBA_Image *im; @@ -367,6 +367,8 @@ evas_software_ddraw_outbuf_flush(Outbuf *buf) int ddraw_pitch; int ddraw_depth; + if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; + /* lock the back surface */ if (!(ddraw_data = evas_software_ddraw_lock(buf, &ddraw_width, diff --git a/src/modules/evas/engines/software_gdi/evas_engine.h b/src/modules/evas/engines/software_gdi/evas_engine.h index 86f27e6199..a69032c15f 100644 --- a/src/modules/evas/engines/software_gdi/evas_engine.h +++ b/src/modules/evas/engines/software_gdi/evas_engine.h @@ -184,7 +184,7 @@ void evas_software_gdi_outbuf_push_updated_region(Outbuf *buf, void evas_software_gdi_outbuf_free_region_for_update(Outbuf *buf, RGBA_Image *update); -void evas_software_gdi_outbuf_flush(Outbuf *buf); +void evas_software_gdi_outbuf_flush(Outbuf *buf, Evas_Render_Mode render_mode); void evas_software_gdi_outbuf_idle_flush(Outbuf *buf); diff --git a/src/modules/evas/engines/software_gdi/evas_outbuf.c b/src/modules/evas/engines/software_gdi/evas_outbuf.c index 28a64a37d8..705c56961f 100644 --- a/src/modules/evas/engines/software_gdi/evas_outbuf.c +++ b/src/modules/evas/engines/software_gdi/evas_outbuf.c @@ -563,12 +563,14 @@ evas_software_gdi_outbuf_free_region_for_update(Outbuf *buf EINA_UNUSED, } void -evas_software_gdi_outbuf_flush(Outbuf *buf) +evas_software_gdi_outbuf_flush(Outbuf *buf, Evas_Render_Mode render_mode) { Eina_List *l; RGBA_Image *im; Outbuf_Region *obr; + if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; + /* copy safely the images that need to be drawn onto the back surface */ EINA_LIST_FOREACH(buf->priv.pending_writes, l, im) { diff --git a/src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h b/src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h index 8ab8101b22..dc9b971d49 100644 --- a/src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h +++ b/src/modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h @@ -28,7 +28,8 @@ typedef enum { MODE_COPY, MODE_DOUBLE, MODE_TRIPLE, - MODE_QUADRUPLE + MODE_QUADRUPLE, + MODE_AUTO } Render_Engine_Swap_Mode; typedef enum { @@ -41,13 +42,14 @@ typedef struct _Outbuf Outbuf; typedef Render_Engine_Swap_Mode (*Outbuf_Swap_Mode_Get)(Outbuf *ob); typedef void (*Outbuf_Reconfigure)(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth); -typedef RGBA_Image *(*Outbuf_New_Region_For_Update)(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); +typedef Eina_Bool (*Outbuf_Region_First_Rect)(Outbuf *ob); +typedef void *(*Outbuf_New_Region_For_Update)(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); typedef void (*Outbuf_Push_Updated_Region)(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h); typedef void (*Outbuf_Idle_Flush)(Outbuf *ob); typedef void (*Outbuf_Free_Region_For_Update)(Outbuf *ob, RGBA_Image *update); typedef void (*Outbuf_Free)(Outbuf *ob); typedef int (*Outbuf_Get_Rot)(Outbuf *ob); -typedef void (*Outbuf_Flush)(Outbuf *ob); +typedef void (*Outbuf_Flush)(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode); struct _Render_Engine_Software_Generic { @@ -60,6 +62,7 @@ struct _Render_Engine_Software_Generic Outbuf_Swap_Mode_Get outbuf_swap_mode_get; Outbuf_Get_Rot outbuf_get_rot; Outbuf_Reconfigure outbuf_reconfigure; + Outbuf_Region_First_Rect outbuf_region_first_rect; Outbuf_New_Region_For_Update outbuf_new_region_for_update; Outbuf_Push_Updated_Region outbuf_push_updated_region; Outbuf_Idle_Flush outbuf_idle_flush; @@ -74,6 +77,7 @@ struct _Render_Engine_Software_Generic unsigned char end : 1; unsigned char lost_back : 1; + unsigned char tile_strict : 1; }; static inline Eina_Bool @@ -82,6 +86,7 @@ evas_render_engine_software_generic_init(Render_Engine_Software_Generic *re, Outbuf_Swap_Mode_Get outbuf_swap_mode_get, Outbuf_Get_Rot outbuf_get_rot, Outbuf_Reconfigure outbuf_reconfigure, + Outbuf_Region_First_Rect outbuf_region_first_rect, Outbuf_New_Region_For_Update outbuf_new_region_for_update, Outbuf_Push_Updated_Region outbuf_push_updated_region, Outbuf_Free_Region_For_Update outbuf_free_region_for_update, @@ -96,6 +101,7 @@ evas_render_engine_software_generic_init(Render_Engine_Software_Generic *re, re->outbuf_swap_mode_get = outbuf_swap_mode_get; re->outbuf_get_rot = outbuf_get_rot; re->outbuf_reconfigure = outbuf_reconfigure; + re->outbuf_region_first_rect = outbuf_region_first_rect; re->outbuf_new_region_for_update = outbuf_new_region_for_update; re->outbuf_push_updated_region = outbuf_push_updated_region; re->outbuf_idle_flush = outbuf_idle_flush; @@ -114,6 +120,7 @@ evas_render_engine_software_generic_init(Render_Engine_Software_Generic *re, re->merge_mode = MERGE_FULL; re->end = 0; re->lost_back = 0; + re->tile_strict = 0; re->tb = evas_common_tilebuf_new(w, h); if (!re->tb) return EINA_FALSE; @@ -139,14 +146,6 @@ evas_render_engine_software_generic_clean(Render_Engine_Software_Generic *re) memset(re, 0, sizeof (Render_Engine_Software_Generic)); } -static inline void -evas_render_engine_software_generic_update(Render_Engine_Software_Generic *re, - Outbuf *ob) -{ - if (re->ob) re->outbuf_free(re->ob); - re->ob = ob; -} - static inline void evas_render_engine_software_generic_merge_mode_set(Render_Engine_Software_Generic *re, Render_Engine_Merge_Mode merge_mode) @@ -154,4 +153,28 @@ evas_render_engine_software_generic_merge_mode_set(Render_Engine_Software_Generi re->merge_mode = merge_mode; } +static inline void +evas_render_engine_software_generic_tile_strict_set(Render_Engine_Software_Generic *re, + Eina_Bool tile_strict) +{ + re->tile_strict = !!tile_strict; + evas_common_tilebuf_tile_strict_set(re->tb, re->tile_strict); +} + +static inline Eina_Bool +evas_render_engine_software_generic_update(Render_Engine_Software_Generic *re, + Outbuf *ob, + int w, int h) +{ + if (re->ob) re->outbuf_free(re->ob); + re->ob = ob; + + evas_common_tilebuf_free(re->tb); + re->tb = evas_common_tilebuf_new(w, h); + if (!re->tb) return EINA_FALSE; + evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); + evas_render_engine_software_generic_tile_strict_set(re, re->tile_strict); + return EINA_TRUE; +} + #endif diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index 274d421e8d..7c57fcfdd0 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c @@ -2586,6 +2586,7 @@ eng_output_resize(void *data, int w, int h) re->tb = evas_common_tilebuf_new(w, h); if (re->tb) evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); + evas_common_tilebuf_tile_strict_set(re->tb, re->tile_strict); re->w = w; re->h = h; } @@ -2703,9 +2704,8 @@ static void * eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch) { Render_Engine_Software_Generic *re; - RGBA_Image *surface; + void *surface; Tilebuf_Rect *rect; - Eina_Bool first_rect = EINA_FALSE; #define CLEAR_PREV_RECTS(x) \ do { \ @@ -2728,9 +2728,13 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i re->rects = evas_common_tilebuf_get_render_rects(re->tb); if (re->rects) { + // do anything needed for the first rect and update lost backbuffer if needed + if (re->outbuf_region_first_rect) + re->lost_back |= re->outbuf_region_first_rect(re->ob); + if (re->outbuf_swap_mode_get) mode = re->outbuf_swap_mode_get(re->ob); re->swap_mode = mode; - if ((re->lost_back) || (re->swap_mode == MODE_FULL)) + if ((re->lost_back) || (re->swap_mode == MODE_FULL) || (re->swap_mode == MODE_AUTO)) { /* if we lost our backbuffer since the last frame redraw all */ re->lost_back = 0; @@ -2749,6 +2753,7 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i re->rects = NULL; switch (re->swap_mode) { + case MODE_AUTO: case MODE_FULL: case MODE_COPY: // no prev rects needed re->rects = _merge_rects(re->merge_mode, re->tb, re->rects_prev[0], NULL, NULL, NULL); @@ -2765,7 +2770,6 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i default: break; } - first_rect = EINA_TRUE; } evas_common_tilebuf_clear(re->tb); re->cur_rect = EINA_INLIST_GET(re->rects); @@ -2791,6 +2795,7 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i *ch = rect->h; re->cur_rect = re->cur_rect->next; break; + case MODE_AUTO: case MODE_FULL: re->cur_rect = NULL; if (x) *x = 0; @@ -2805,10 +2810,6 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i default: break; } - if (first_rect) - { - // do anything needed fir the first frame - } surface = re->outbuf_new_region_for_update(re->ob, *x, *y, *w, *h, cx, cy, cw, ch); @@ -2845,8 +2846,8 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode) if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; re = (Render_Engine_Software_Generic *)data; - if (re->outbuf_flush) re->outbuf_flush(re->ob); - if (re->rects) + if (re->outbuf_flush) re->outbuf_flush(re->ob, re->rects, render_mode); + if (re->rects && render_mode != EVAS_RENDER_MODE_ASYNC_INIT) { evas_common_tilebuf_free_render_rects(re->rects); re->rects = NULL; diff --git a/src/modules/evas/engines/software_x11/evas_engine.c b/src/modules/evas/engines/software_x11/evas_engine.c index 80036d8e9f..2d7e9bfb61 100644 --- a/src/modules/evas/engines/software_x11/evas_engine.c +++ b/src/modules/evas/engines/software_x11/evas_engine.c @@ -163,6 +163,7 @@ _output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw, if (!evas_render_engine_software_generic_init(&re->generic, ob, NULL, evas_software_xlib_outbuf_get_rot, evas_software_xlib_outbuf_reconfigure, + NULL, evas_software_xlib_outbuf_new_region_for_update, evas_software_xlib_outbuf_push_updated_region, evas_software_xlib_outbuf_free_region_for_update, @@ -207,6 +208,7 @@ _output_swapbuf_setup(int w, int h, int rot, Display *disp, Drawable draw, evas_software_xlib_swapbuf_buffer_state_get, evas_software_xlib_swapbuf_get_rot, evas_software_xlib_swapbuf_reconfigure, + NULL, evas_software_xlib_swapbuf_new_region_for_update, evas_software_xlib_swapbuf_push_updated_region, evas_software_xlib_swapbuf_free_region_for_update, @@ -262,6 +264,7 @@ _output_xcb_setup(int w, int h, int rot, xcb_connection_t *conn, if (!evas_render_engine_software_generic_init(re, ob, NULL, evas_software_xcb_outbuf_rotation_get, evas_software_xcb_outbuf_reconfigure, + NULL, evas_software_xcb_outbuf_new_region_for_update, evas_software_xcb_outbuf_push_updated_region, evas_software_xcb_outbuf_free_region_for_update, @@ -568,7 +571,7 @@ eng_setup(Evas *eo_e, void *in) if (ob) { - evas_render_engine_software_generic_update(&re->generic, ob); + evas_render_engine_software_generic_update(&re->generic, ob, e->output.w, e->output.h); } /* if ((re) && (re->ob)) re->ob->onebuf = ponebuf; */ diff --git a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c index ba544efcb4..048e7edd8e 100644 --- a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c +++ b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c @@ -259,7 +259,7 @@ evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_co return buf; } -RGBA_Image * +void * evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) { RGBA_Image *im = NULL; @@ -581,12 +581,14 @@ evas_software_xcb_outbuf_free_region_for_update(Outbuf *buf EINA_UNUSED, RGBA_Im } void -evas_software_xcb_outbuf_flush(Outbuf *buf) +evas_software_xcb_outbuf_flush(Outbuf *buf, Tilebuf_Rect *rects, Evas_Render_Mode render_mode) { Eina_List *l = NULL; RGBA_Image *im = NULL; Outbuf_Region *obr = NULL; + if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; + if ((buf->priv.onebuf) && (eina_array_count(&buf->priv.onebuf_regions))) { Eina_Array_Iterator it; diff --git a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.h b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.h index e9f300180b..39ac6dcd84 100644 --- a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.h +++ b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.h @@ -6,9 +6,9 @@ void evas_software_xcb_outbuf_init(void); void evas_software_xcb_outbuf_free(Outbuf *buf); Outbuf *evas_software_xcb_outbuf_setup(int w, int h, int rot, Outbuf_Depth depth, xcb_connection_t *conn, xcb_screen_t *screen, xcb_drawable_t draw, xcb_visualtype_t *vis, xcb_colormap_t cmap, int xdepth, Eina_Bool grayscale, int max_colors, xcb_drawable_t mask, Eina_Bool shape_dither, Eina_Bool alpha); -RGBA_Image *evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); +void *evas_software_xcb_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); void evas_software_xcb_outbuf_free_region_for_update(Outbuf *buf, RGBA_Image *update); -void evas_software_xcb_outbuf_flush(Outbuf *buf); +void evas_software_xcb_outbuf_flush(Outbuf *buf, Tilebuf_Rect *rects, Evas_Render_Mode render_mode); void evas_software_xcb_outbuf_idle_flush(Outbuf *buf); void evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h); void evas_software_xcb_outbuf_reconfigure(Outbuf *buf, int w, int h, int rot, Outbuf_Depth depth); diff --git a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c index a189accc27..8fd2f1079c 100644 --- a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c +++ b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c @@ -172,7 +172,7 @@ evas_software_xlib_outbuf_free(Outbuf *buf) free(obr); } evas_software_xlib_outbuf_idle_flush(buf); - evas_software_xlib_outbuf_flush(buf); + evas_software_xlib_outbuf_flush(buf, NULL, MODE_FULL); if (buf->priv.x11.xlib.gc) XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc); if (buf->priv.x11.xlib.gcm) @@ -361,7 +361,7 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth, return buf; } -RGBA_Image * +void * evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) { RGBA_Image *im; @@ -710,12 +710,14 @@ evas_software_xlib_outbuf_free_region_for_update(Outbuf *buf EINA_UNUSED, RGBA_I } void -evas_software_xlib_outbuf_flush(Outbuf *buf) +evas_software_xlib_outbuf_flush(Outbuf *buf, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode render_mode) { Eina_List *l; RGBA_Image *im; Outbuf_Region *obr; + if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; + if ((buf->priv.onebuf) && eina_array_count(&buf->priv.onebuf_regions)) { Eina_Rectangle *rect; diff --git a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.h b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.h index 8745a1abfd..16f0cf1b53 100644 --- a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.h +++ b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.h @@ -25,20 +25,20 @@ Outbuf *evas_software_xlib_outbuf_setup_x (int w, int destination_alpha); -RGBA_Image *evas_software_xlib_outbuf_new_region_for_update (Outbuf *buf, - int x, - int y, - int w, - int h, - int *cx, - int *cy, - int *cw, - int *ch); +void *evas_software_xlib_outbuf_new_region_for_update (Outbuf *buf, + int x, + int y, + int w, + int h, + int *cx, + int *cy, + int *cw, + int *ch); void evas_software_xlib_outbuf_free_region_for_update (Outbuf *buf, RGBA_Image *update); -void evas_software_xlib_outbuf_flush (Outbuf *buf); +void evas_software_xlib_outbuf_flush (Outbuf *buf, Tilebuf_Rect *rects, Evas_Render_Mode render_mode); void evas_software_xlib_outbuf_idle_flush (Outbuf *buf); diff --git a/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c b/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c index ddd128b9ca..59a83d81ec 100644 --- a/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c +++ b/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c @@ -34,7 +34,7 @@ evas_software_xlib_swapbuf_init(void) void evas_software_xlib_swapbuf_free(Outbuf *buf) { - evas_software_xlib_swapbuf_flush(buf); + evas_software_xlib_swapbuf_flush(buf, NULL, MODE_FULL); evas_software_xlib_swapbuf_idle_flush(buf); if (buf->priv.pal) evas_software_xlib_x_color_deallocate @@ -207,7 +207,7 @@ evas_software_xlib_swapbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth, return buf; } -RGBA_Image * +void * evas_software_xlib_swapbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) { RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h); @@ -315,25 +315,27 @@ evas_software_xlib_swapbuf_free_region_for_update(Outbuf *buf EINA_UNUSED, RGBA_ } void -evas_software_xlib_swapbuf_flush(Outbuf *buf) +evas_software_xlib_swapbuf_flush(Outbuf *buf, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode render_mode EINA_UNUSED) { + if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; + if (!buf->priv.pending_writes) { - Eina_Rectangle *rects, *rect; + Eina_Rectangle *result, *rect; Eina_Array_Iterator it; unsigned int n, i; RGBA_Image *im; n = eina_array_count_get(&buf->priv.onebuf_regions); if (n == 0) return; - rects = alloca(n * sizeof(Eina_Rectangle)); + result = alloca(n * sizeof(Eina_Rectangle)); EINA_ARRAY_ITER_NEXT(&buf->priv.onebuf_regions, i, rect, it) { - rects[i] = *rect; + result[i] = *rect; eina_rectangle_free(rect); } evas_xlib_swapper_buffer_unmap(buf->priv.swapper); - evas_xlib_swapper_swap(buf->priv.swapper, rects, n); + evas_xlib_swapper_swap(buf->priv.swapper, result, n); eina_array_clean(&buf->priv.onebuf_regions); im = buf->priv.onebuf; buf->priv.onebuf = NULL; @@ -350,12 +352,12 @@ evas_software_xlib_swapbuf_flush(Outbuf *buf) else { RGBA_Image *im; - Eina_Rectangle *rects; + Eina_Rectangle *result; unsigned int n, i = 0; n = eina_list_count(buf->priv.pending_writes); if (n == 0) return; - rects = alloca(n * sizeof(Eina_Rectangle)); + result = alloca(n * sizeof(Eina_Rectangle)); EINA_LIST_FREE(buf->priv.pending_writes, im) { Eina_Rectangle *rect = im->extended_info; @@ -364,33 +366,33 @@ evas_software_xlib_swapbuf_flush(Outbuf *buf) x = rect->x; y = rect->y; w = rect->w; h = rect->h; if (buf->rot == 0) { - rects[i].x = x; - rects[i].y = y; + result[i].x = x; + result[i].y = y; } else if (buf->rot == 90) { - rects[i].x = y; - rects[i].y = buf->w - x - w; + result[i].x = y; + result[i].y = buf->w - x - w; } else if (buf->rot == 180) { - rects[i].x = buf->w - x - w; - rects[i].y = buf->h - y - h; + result[i].x = buf->w - x - w; + result[i].y = buf->h - y - h; } else if (buf->rot == 270) { - rects[i].x = buf->h - y - h; - rects[i].y = x; + result[i].x = buf->h - y - h; + result[i].y = x; } if ((buf->rot == 0) || (buf->rot == 180)) { - rects[i].w = w; - rects[i].h = h; + result[i].w = w; + result[i].h = h; } else if ((buf->rot == 90) || (buf->rot == 270)) { - rects[i].w = h; - rects[i].h = w; + result[i].w = h; + result[i].h = w; } eina_rectangle_free(rect); #ifdef EVAS_CSERVE2 @@ -402,7 +404,7 @@ evas_software_xlib_swapbuf_flush(Outbuf *buf) i++; } evas_xlib_swapper_buffer_unmap(buf->priv.swapper); - evas_xlib_swapper_swap(buf->priv.swapper, rects, n); + evas_xlib_swapper_swap(buf->priv.swapper, result, n); // evas_xlib_swapper_swap(buf->priv.swapper, NULL, 0); } } diff --git a/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.h b/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.h index ac8011697a..031c29de1f 100644 --- a/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.h +++ b/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.h @@ -21,18 +21,18 @@ Outbuf *evas_software_xlib_swapbuf_setup_x(int w, Pixmap mask, int shape_dither, int destination_alpha); -RGBA_Image *evas_software_xlib_swapbuf_new_region_for_update(Outbuf *buf, - int x, - int y, - int w, - int h, - int *cx, - int *cy, - int *cw, - int *ch); +void *evas_software_xlib_swapbuf_new_region_for_update(Outbuf *buf, + int x, + int y, + int w, + int h, + int *cx, + int *cy, + int *cw, + int *ch); void evas_software_xlib_swapbuf_free_region_for_update(Outbuf *buf, RGBA_Image *update); -void evas_software_xlib_swapbuf_flush(Outbuf *buf); +void evas_software_xlib_swapbuf_flush(Outbuf *buf, Tilebuf_Rect *rects, Evas_Render_Mode render_mode); void evas_software_xlib_swapbuf_idle_flush(Outbuf *buf); void evas_software_xlib_swapbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c b/src/modules/evas/engines/wayland_shm/evas_engine.c index 959b93f5e5..c8a612e188 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.c +++ b/src/modules/evas/engines/wayland_shm/evas_engine.c @@ -54,6 +54,7 @@ _output_engine_setup(Evas_Engine_Info_Wayland_Shm *info, evas_swapbuf_state_get, evas_swapbuf_rotation_get, NULL, + NULL, evas_swapbuf_update_region_new, evas_swapbuf_update_region_push, evas_swapbuf_update_region_free, @@ -167,7 +168,7 @@ eng_setup(Evas *eo_evas, void *einfo) info->info.wl_surface); if (!ob) return 0; - evas_render_engine_software_generic_update(&re->generic, ob); + evas_render_engine_software_generic_update(&re->generic, ob, epd->output.w, epd->output.h); if ((re) && (re->generic.ob)) re->generic.ob->onebuf = ponebuf; } diff --git a/src/modules/evas/engines/wayland_shm/evas_swapbuf.c b/src/modules/evas/engines/wayland_shm/evas_swapbuf.c index 5b746d8876..835ec52f9f 100644 --- a/src/modules/evas/engines/wayland_shm/evas_swapbuf.c +++ b/src/modules/evas/engines/wayland_shm/evas_swapbuf.c @@ -79,7 +79,7 @@ evas_swapbuf_free(Outbuf *ob) if (!ob) return; /* flush the output buffer */ - evas_swapbuf_flush(ob); + evas_swapbuf_flush(ob, NULL, MODE_FULL); evas_swapbuf_idle_flush(ob); evas_swapper_free(ob->priv.swapper); eina_array_flush(&ob->priv.onebuf_regions); @@ -137,7 +137,7 @@ evas_swapbuf_reconfigure(Outbuf *ob, int x, int y, int w, int h, int rotation, O } } -RGBA_Image * +void * evas_swapbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch) { RGBA_Image *img; @@ -375,14 +375,16 @@ evas_swapbuf_update_region_free(Outbuf *ob EINA_UNUSED, RGBA_Image *update EINA_ } void -evas_swapbuf_flush(Outbuf *ob) +evas_swapbuf_flush(Outbuf *ob, Tilebuf_Rect *rects EINA_UNUSED, Evas_Render_Mode render_mode) { - Eina_Rectangle *rects; + Eina_Rectangle *result; RGBA_Image *img; unsigned int n = 0, i = 0; LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; + /* check for valid output buffer */ if (!ob) return; @@ -397,17 +399,17 @@ evas_swapbuf_flush(Outbuf *ob) if (n == 0) return; /* allocate rectangles */ - if (!(rects = alloca(n * sizeof(Eina_Rectangle)))) return; + if (!(result = alloca(n * sizeof(Eina_Rectangle)))) return; - /* loop the buffer regions and assign to rects */ + /* loop the buffer regions and assign to result */ EINA_ARRAY_ITER_NEXT(&ob->priv.onebuf_regions, i, rect, it) - rects[i] = *rect; + result[i] = *rect; /* unmap the buffer */ evas_swapper_buffer_unmap(ob->priv.swapper); /* force a buffer swap */ - evas_swapper_swap(ob->priv.swapper, rects, n); + evas_swapper_swap(ob->priv.swapper, result, n); /* clean array */ eina_array_clean(&ob->priv.onebuf_regions); @@ -431,7 +433,7 @@ evas_swapbuf_flush(Outbuf *ob) if (n == 0) return; /* allocate rectangles */ - if (!(rects = alloca(n * sizeof(Eina_Rectangle)))) return; + if (!(result = alloca(n * sizeof(Eina_Rectangle)))) return; /* loop the pending writes */ EINA_LIST_FREE(ob->priv.pending_writes, img) @@ -446,35 +448,35 @@ evas_swapbuf_flush(Outbuf *ob) /* based on rotation, set rectangle position */ if (ob->rotation == 0) { - rects[i].x = x; - rects[i].y = y; + result[i].x = x; + result[i].y = y; } else if (ob->rotation == 90) { - rects[i].x = y; - rects[i].y = (ob->w - x - w); + result[i].x = y; + result[i].y = (ob->w - x - w); } else if (ob->rotation == 180) { - rects[i].x = (ob->w - x - w); - rects[i].y = (ob->h - y - h); + result[i].x = (ob->w - x - w); + result[i].y = (ob->h - y - h); } else if (ob->rotation == 270) { - rects[i].x = (ob->h - y - h); - rects[i].y = x; + result[i].x = (ob->h - y - h); + result[i].y = x; } /* based on rotation, set rectangle size */ if ((ob->rotation == 0) || (ob->rotation == 180)) { - rects[i].w = w; - rects[i].h = h; + result[i].w = w; + result[i].h = h; } else if ((ob->rotation == 90) || (ob->rotation == 270)) { - rects[i].w = h; - rects[i].h = w; + result[i].w = h; + result[i].h = w; } eina_rectangle_free(rect); @@ -493,7 +495,7 @@ evas_swapbuf_flush(Outbuf *ob) evas_swapper_buffer_unmap(ob->priv.swapper); /* force a buffer swap */ - evas_swapper_swap(ob->priv.swapper, rects, n); + evas_swapper_swap(ob->priv.swapper, result, n); } } diff --git a/src/modules/evas/engines/wayland_shm/evas_swapbuf.h b/src/modules/evas/engines/wayland_shm/evas_swapbuf.h index fe5b51cd2c..8716a37c29 100644 --- a/src/modules/evas/engines/wayland_shm/evas_swapbuf.h +++ b/src/modules/evas/engines/wayland_shm/evas_swapbuf.h @@ -6,10 +6,10 @@ Outbuf *evas_swapbuf_setup(Evas_Engine_Info_Wayland_Shm *info, int w, int h, unsigned int rotation, Outbuf_Depth depth, Eina_Bool alpha, struct wl_shm *wl_shm, struct wl_surface *wl_surface); void evas_swapbuf_free(Outbuf *ob); void evas_swapbuf_reconfigure(Outbuf *ob, int x, int y, int w, int h, int rotation, Outbuf_Depth depth, Eina_Bool alpha); -RGBA_Image *evas_swapbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); +void *evas_swapbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch); void evas_swapbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h); void evas_swapbuf_update_region_free(Outbuf *ob, RGBA_Image *update); -void evas_swapbuf_flush(Outbuf *ob); +void evas_swapbuf_flush(Outbuf *ob, Tilebuf_Rect *rects, Evas_Render_Mode render_mode); void evas_swapbuf_idle_flush(Outbuf *ob EINA_UNUSED); Render_Engine_Swap_Mode evas_swapbuf_state_get(Outbuf *ob); int evas_swapbuf_rotation_get(Outbuf *ob);