From e7527e06d6e28c251f48cb774796c807ea6c8ea6 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 25 Aug 2017 10:54:59 -0700 Subject: [PATCH] evas: decorrelate canvas size from output size. --- src/lib/evas/canvas/evas_main.c | 15 ++++++++++-- src/lib/evas/canvas/evas_out.c | 14 ++++++++--- src/lib/evas/canvas/evas_render.c | 47 +++++++++++++++++++++---------------- src/lib/evas/include/evas_private.h | 4 +++- 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index 9a8e199..cb01eff 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -461,7 +461,7 @@ next_zombie: EAPI Evas_Engine_Info * evas_engine_info_get(const Evas *obj) { - const Evas_Public_Data *e = efl_data_scope_get(obj, EVAS_CANVAS_CLASS); + Evas_Public_Data *e = efl_data_scope_get(obj, EVAS_CANVAS_CLASS); Efl_Canvas_Output *output; output = eina_list_data_get(e->outputs); @@ -470,6 +470,7 @@ evas_engine_info_get(const Evas *obj) output = efl_canvas_output_add((Evas*) obj); } if (!output) return NULL; + e->output.legacy = EINA_TRUE; return efl_canvas_output_engine_info_get(output); } @@ -483,6 +484,8 @@ evas_engine_info_set(Evas *obj, Evas_Engine_Info *info) output = eina_list_data_get(e->outputs); if (!output) return EINA_FALSE; if (!info) return EINA_FALSE; + efl_canvas_output_view_set(output, 0, 0, + e->output.w, e->output.h); return efl_canvas_output_engine_info_set(output, info); } @@ -1106,9 +1109,17 @@ evas_output_size_set(Evas *eo_e, int w, int h) evas_canvas_async_block(e); e->output.w = w; e->output.h = h; - e->output.changed = 1; e->output_validity++; e->changed = 1; + + if (e->output.legacy) + { + Efl_Canvas_Output *output; + + output = eina_list_data_get(e->outputs); + efl_canvas_output_view_set(output, 0, 0, w, h); + } + evas_render_invalidate(eo_e); } diff --git a/src/lib/evas/canvas/evas_out.c b/src/lib/evas/canvas/evas_out.c index 42f8ed4..c5687de 100644 --- a/src/lib/evas/canvas/evas_out.c +++ b/src/lib/evas/canvas/evas_out.c @@ -50,6 +50,7 @@ efl_canvas_output_add(Evas *canvas) if (!r) return NULL; efl_wref_add(canvas, &r->canvas); + r->changed = EINA_TRUE; e = _efl_canvas_output_async_block(r); // Track this output in Evas @@ -97,11 +98,18 @@ efl_canvas_output_view_set(Efl_Canvas_Output *output, e = _efl_canvas_output_async_block(output); if (!e) return ; + if (output->geometry.x != x) goto changed; + if (output->geometry.y != y) goto changed; + if (output->geometry.w != w) goto changed; + if (output->geometry.h != h) goto changed; + return; + + changed: output->geometry.x = x; output->geometry.y = y; output->geometry.w = w; output->geometry.h = h; - // XXX: tell engine about any output size etc. changes + output->changed = EINA_TRUE; // XXX: tell evas to add damage if viewport loc/size changed } @@ -131,7 +139,7 @@ efl_canvas_output_engine_info_set(Efl_Canvas_Output *output, if (e->engine.func->output_update) { e->engine.func->output_update(_evas_engine_context(e), output->output, info, - e->output.w, e->output.h); + output->geometry.w, output->geometry.h); } else { @@ -152,7 +160,7 @@ efl_canvas_output_engine_info_set(Efl_Canvas_Output *output, setup: output->output = e->engine.func->output_setup(_evas_engine_context(e), info, - e->output.w, e->output.h); + output->geometry.w, output->geometry.h); } return !!output->output; diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c index 2527243..a2d30da 100644 --- a/src/lib/evas/canvas/evas_render.c +++ b/src/lib/evas/canvas/evas_render.c @@ -3133,6 +3133,7 @@ evas_render_updates_internal(Evas *eo_e, Evas_Object *eo_obj; Evas_Object_Protected_Data *obj; Evas_Public_Data *evas, *e; + Efl_Canvas_Output *out; Eina_List *ll; Eina_Bool clean_them = EINA_FALSE; Eina_Bool rendering = EINA_FALSE; @@ -3250,11 +3251,6 @@ evas_render_updates_internal(Evas *eo_e, { ENFN->output_redraws_rect_add(ENC, 0, 0, e->output.w, e->output.h); } - if (e->output.changed) - { - ENFN->output_resize(ENC, ENDT, e->output.w, e->output.h); - ENFN->output_redraws_rect_add(ENC, 0, 0, e->output.w, e->output.h); - } if ((e->output.w != e->viewport.w) || (e->output.h != e->viewport.h)) { ERR("viewport size != output size!"); @@ -3323,13 +3319,25 @@ evas_render_updates_internal(Evas *eo_e, } eina_evlog("-render_phase5", eo_e, 0.0, NULL); + /* phase 6. Initialize output */ + out = eina_list_data_get(e->outputs); + if (out->changed) + { + ENFN->output_resize(ENC, out->output, + out->geometry.w, out->geometry.h); + ENFN->output_redraws_rect_add(ENC, + out->geometry.x, out->geometry.y, + out->geometry.w, out->geometry.h); + out->changed = EINA_FALSE; + } + /* Define the output for Evas_GL operation */ if (ENFN->gl_output_set) - ENFN->gl_output_set(ENC, ENDT); + ENFN->gl_output_set(ENC, out->output); - /* phase 6. check if video surface should be inlined or stay in their hardware plane */ - eina_evlog("+render_phase6", eo_e, 0.0, NULL); - alpha = ENFN->canvas_alpha_get(ENDT); + /* phase 7. check if video surface should be inlined or stay in their hardware plane */ + eina_evlog("+render_phase7", eo_e, 0.0, NULL); + alpha = ENFN->canvas_alpha_get(out->output); EINA_LIST_FOREACH(e->video_objects, ll, eo_obj) { @@ -3380,10 +3388,10 @@ evas_render_updates_internal(Evas *eo_e, _evas_object_image_plane_release(eo_obj2, obj2, output); } } - eina_evlog("-render_phase6", eo_e, 0.0, NULL); + eina_evlog("-render_phase7", eo_e, 0.0, NULL); - /* phase 7. go thru each update rect and render objects in it*/ - eina_evlog("+render_phase7", eo_e, 0.0, NULL); + /* phase 8. go thru each update rect and render objects in it*/ + eina_evlog("+render_phase8", eo_e, 0.0, NULL); if (do_draw) { Render_Updates *ru; @@ -3401,7 +3409,7 @@ evas_render_updates_internal(Evas *eo_e, // FIXME: handle multiple output while ((surface = ENFN->output_redraws_next_update_get - (ENC, ENDT, + (ENC, out->output, &ux, &uy, &uw, &uh, &cx, &cy, &cw, &ch))) { @@ -3453,7 +3461,7 @@ evas_render_updates_internal(Evas *eo_e, RD(0, " SNAPSHOT %s [sfc:%p ur:%d,%d %dx%d]\n", RDNAME(snap), pseudo_canvas, ur.x, ur.y, ur.w, ur.h); ctx = ENFN->context_new(ENC); - clean_them |= evas_render_updates_internal_loop(eo_e, e, ENDT, pseudo_canvas, ctx, + clean_them |= evas_render_updates_internal_loop(eo_e, e, out->output, pseudo_canvas, ctx, snap, ur.x, ur.y, ur.w, ur.h, cr.x, cr.y, cr.w, cr.h, @@ -3481,7 +3489,7 @@ evas_render_updates_internal(Evas *eo_e, } ctx = ENFN->context_new(ENC); - clean_them |= evas_render_updates_internal_loop(eo_e, e, ENDT, surface, + clean_them |= evas_render_updates_internal_loop(eo_e, e, out->output, surface, ctx, NULL, ux, uy, uw, uh, cx, cy, cw, ch, @@ -3495,7 +3503,7 @@ evas_render_updates_internal(Evas *eo_e, if (!do_async) { eina_evlog("+render_push", eo_e, 0.0, NULL); - ENFN->output_redraws_next_update_push(ENC, ENDT, surface, ux, uy, uw, uh, render_mode); + ENFN->output_redraws_next_update_push(ENC, out->output, surface, ux, uy, uw, uh, render_mode); eina_evlog("-render_push", eo_e, 0.0, NULL); } } @@ -3520,7 +3528,7 @@ evas_render_updates_internal(Evas *eo_e, _evas_object_image_video_overlay_do(eo_obj); } _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL); - ENFN->output_flush(ENC, ENDT, EVAS_RENDER_MODE_SYNC); + ENFN->output_flush(ENC, out->output, EVAS_RENDER_MODE_SYNC); _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL); eina_evlog("-render_output_flush", eo_e, 0.0, NULL); } @@ -3528,13 +3536,13 @@ evas_render_updates_internal(Evas *eo_e, rendering = haveup; eina_evlog("-render_surface", eo_e, 0.0, NULL); } - eina_evlog("-render_phase7", eo_e, 0.0, NULL); + eina_evlog("-render_phase8", eo_e, 0.0, NULL); eina_evlog("+render_clear", eo_e, 0.0, NULL); if (!do_async && rendering) { /* clear redraws */ - ENFN->output_redraws_clear(ENC, ENDT); + ENFN->output_redraws_clear(ENC, out->output); } eina_evlog("-render_clear", eo_e, 0.0, NULL); @@ -3614,7 +3622,6 @@ evas_render_updates_internal(Evas *eo_e, eina_evlog("+render_end", eo_e, 0.0, NULL); e->changed = EINA_FALSE; e->viewport.changed = EINA_FALSE; - e->output.changed = EINA_FALSE; e->framespace.changed = EINA_FALSE; e->invalidate = EINA_FALSE; diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 146238b..0a28680 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -871,7 +871,7 @@ struct _Evas_Public_Data struct { int w, h; DATA32 render_method; - unsigned char changed : 1; + Eina_Bool legacy : 1; } output; struct @@ -1341,6 +1341,8 @@ struct _Efl_Canvas_Output Eina_Rectangle geometry; int info_magic; + + Eina_Bool changed : 1; }; struct _Evas_Object_Func -- 2.7.4