This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch evas-norender-updates-stuck
in repository efl.
View the commit online.
commit d3d5a803be124f02f7b5d832076b561bc9efd3f8
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Dec 2 15:17:58 2026 -0600
evas/software_generic: let a render follow evas_norender_with_updates()
The update list of a pass is kept until the engine is flushed.
evas_norender_with_updates() asks for the updates without drawing, so
no flush follows, and for every swap mode but FULL and AUTO the list
stayed in place with nothing left to hand out. Every later call
returned no update: the canvas stopped seeing any damage and, as haveup
never became true, never flushed either, so it stayed stuck for good.
In tree, the canvases that get there are the buffer ones with a
switch_buffer callback, which the buffer engine runs as MODE_DOUBLE:
the ecore_evas extn socket and SDL. A buffer canvas without it is
FULL and was never affected.
Free the list when a pass finds that it was fully handed out and never
flushed. Normal rendering never takes this branch: a drawing pass that
handed out a rect always reaches the flush, directly in a sync render
and through the pipe wakeup in an async one, and a new render waits
for a running one. The flush frees the list and clears the flag, and
the GL engines, which read their damage from it in the flush, still see
it.
The rects that were reported were not drawn into any buffer, so the
rect history of the buffers cannot be trusted: ask for a full redraw
of the next frame. That costs one full frame, plus one or two more
through the history in the DOUBLE and TRIPLE modes.
The test renders, changes an object, calls evas_norender_with_updates(),
changes another one, renders again and compares the buffer with a
reference canvas. It fails without the fix: the second render reports
nothing.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
---
.../Evas_Engine_Software_Generic.h | 4 +
.../evas/engines/software_generic/evas_engine.c | 18 ++-
src/tests/evas/evas_test_render_engines.c | 127 +++++++++++++++++++++
3 files changed, 148 insertions(+), 1 deletion(-)
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 52918cce34..bab9d8dfa9 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
@@ -76,6 +76,9 @@ struct _Render_Output_Software_Generic
Render_Output_Merge_Mode merge_mode;
unsigned char end : 1;
+ /* set once every rect of re->rects was handed out, cleared by the flush
+ * that frees them */
+ unsigned char rects_drained : 1;
unsigned char lost_back : 1;
unsigned char tile_strict : 1;
};
@@ -134,6 +137,7 @@ evas_render_engine_software_generic_init(Render_Engine_Software_Generic *engine,
re->swap_mode = MODE_FULL;
re->merge_mode = MERGE_FULL;
re->end = 0;
+ re->rects_drained = 0;
re->lost_back = 0;
re->tile_strict = 0;
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 580e75e40a..a576c1722b 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -4155,6 +4155,17 @@ eng_output_redraws_next_update_get(void *engine EINA_UNUSED, void *data, int *x,
return NULL;
}
+ /* A pass that asked for the updates without drawing (evas_norender_with_updates())
+ * is never flushed. Its list must not hide the damage of the next pass, and
+ * what it reported was not drawn into any buffer. */
+ if (re->rects_drained)
+ {
+ evas_common_tilebuf_free_render_rects(re->rects);
+ re->rects = NULL;
+ re->rects_drained = 0;
+ re->lost_back = 1;
+ }
+
if (!re->rects)
{
int mode = MODE_COPY;
@@ -4210,7 +4221,11 @@ eng_output_redraws_next_update_get(void *engine EINA_UNUSED, void *data, int *x,
if (re->cur_rect && re->outbuf_damage_region_set)
re->outbuf_damage_region_set(re->ob, re->rects);
}
- if (!re->cur_rect) return NULL;
+ if (!re->cur_rect)
+ {
+ re->rects_drained = !!re->rects;
+ return NULL;
+ }
rect = (Tilebuf_Rect *)re->cur_rect;
if (re->rects)
{
@@ -4292,6 +4307,7 @@ eng_output_flush(void *engine EINA_UNUSED, void *data, Evas_Render_Mode render_m
{
evas_common_tilebuf_free_render_rects(re->rects);
re->rects = NULL;
+ re->rects_drained = 0;
}
}
diff --git a/src/tests/evas/evas_test_render_engines.c b/src/tests/evas/evas_test_render_engines.c
index 777326920a..26a76c828c 100644
--- a/src/tests/evas/evas_test_render_engines.c
+++ b/src/tests/evas/evas_test_render_engines.c
@@ -3,6 +3,7 @@
#endif
#include <stdio.h>
+#include <string.h>
#include <Evas.h>
#include <Evas_Engine_Buffer.h>
@@ -153,10 +154,136 @@ EFL_START_TEST(evas_render_callbacks)
}
EFL_END_TEST
+#define CANVAS_W 64
+#define CANVAS_H 64
+
+#define C_BG 0xff202020
+#define C_A 0xffff0000
+#define C_B 0xff00ff00
+
+typedef struct
+{
+ unsigned int pixels[2][CANVAS_W * CANVAS_H];
+ unsigned int *last_drawn;
+} Double_Buffer;
+
+static void *
+_switch_buffer(void *data, void *dest_buffer)
+{
+ Double_Buffer *db = data;
+
+ db->last_drawn = dest_buffer;
+ return (dest_buffer == db->pixels[0]) ? db->pixels[1] : db->pixels[0];
+}
+
+/* With a switch_buffer callback the buffer engine reports MODE_DOUBLE, so it
+ * keeps the rects of the previous frames and only a flush drops them. */
+static Evas *
+_canvas_new(unsigned int *dest, Double_Buffer *db)
+{
+ Evas_Engine_Info_Buffer *einfo;
+ Evas *e;
+ int method;
+
+ method = evas_render_method_lookup("buffer");
+ fail_if(method <= 0);
+
+ e = evas_new();
+ fail_if(!e);
+ evas_output_method_set(e, method);
+ evas_output_size_set(e, CANVAS_W, CANVAS_H);
+ evas_output_viewport_set(e, 0, 0, CANVAS_W, CANVAS_H);
+
+ einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(e);
+ fail_if(!einfo);
+ einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
+ einfo->info.dest_buffer = dest;
+ einfo->info.dest_buffer_row_bytes = CANVAS_W * sizeof(int);
+ einfo->info.use_color_key = 0;
+ einfo->info.alpha_threshold = 0;
+ einfo->info.func.new_update_region = NULL;
+ einfo->info.func.free_update_region = NULL;
+ einfo->info.func.switch_buffer = db ? _switch_buffer : NULL;
+ einfo->info.switch_data = db;
+ fail_if(!evas_engine_info_set(e, (Evas_Engine_Info *)einfo));
+ return e;
+}
+
+static Evas_Object *
+_rect_add(Evas *e, int x, int y, unsigned int color)
+{
+ Evas_Object *o = evas_object_rectangle_add(e);
+
+ evas_object_color_set(o, (color >> 16) & 0xff, (color >> 8) & 0xff,
+ color & 0xff, 0xff);
+ evas_object_move(o, x, y);
+ evas_object_resize(o, 16, 16);
+ evas_object_show(o);
+ return o;
+}
+
+static void
+_updates_free_count(Eina_List *updates, unsigned int *count)
+{
+ if (count) *count = eina_list_count(updates);
+ evas_render_updates_free(updates);
+}
+
+EFL_START_TEST(evas_norender_with_updates_keeps_damage)
+{
+ Double_Buffer *db = calloc(1, sizeof(Double_Buffer));
+ unsigned int *ref_pixels = calloc(CANVAS_W * CANVAS_H, sizeof(int));
+ Evas *e, *ref;
+ Evas_Object *bg, *a, *b, *ref_a, *ref_b;
+ unsigned int count;
+
+ fail_if(!db || !ref_pixels);
+ e = _canvas_new(db->pixels[0], db);
+ ref = _canvas_new(ref_pixels, NULL);
+
+ bg = _rect_add(e, 0, 0, C_BG);
+ evas_object_resize(bg, CANVAS_W, CANVAS_H);
+ bg = _rect_add(ref, 0, 0, C_BG);
+ evas_object_resize(bg, CANVAS_W, CANVAS_H);
+ a = _rect_add(e, 0, 0, C_BG);
+ ref_a = _rect_add(ref, 0, 0, C_BG);
+ b = _rect_add(e, 32, 32, C_BG);
+ ref_b = _rect_add(ref, 32, 32, C_BG);
+
+ _updates_free_count(evas_render_updates(e), &count);
+ fail_if(count == 0);
+
+ /* A changes and its update is only asked for, nothing is drawn. */
+ evas_object_color_set(a, 0xff, 0, 0, 0xff);
+ evas_norender_with_updates(e);
+
+ /* B changes afterwards: the next render has to see it. */
+ evas_object_color_set(b, 0, 0xff, 0, 0xff);
+ _updates_free_count(evas_render_updates(e), &count);
+ ck_assert_msg(count > 0, "the damage added after a norender was not reported");
+
+ evas_object_color_set(ref_a, 0xff, 0, 0, 0xff);
+ evas_object_color_set(ref_b, 0, 0xff, 0, 0xff);
+ _updates_free_count(evas_render_updates(ref), NULL);
+
+ fail_if(!db->last_drawn);
+ ck_assert_uint_eq(db->last_drawn[(32 * CANVAS_W) + 32], C_B);
+ ck_assert_uint_eq(db->last_drawn[(8 * CANVAS_W) + 8], C_A);
+ ck_assert_int_eq(memcmp(db->last_drawn, ref_pixels,
+ CANVAS_W * CANVAS_H * sizeof(int)), 0);
+
+ evas_free(e);
+ evas_free(ref);
+ free(db);
+ free(ref_pixels);
+}
+EFL_END_TEST
+
void evas_test_render_engines(TCase *tc)
{
tcase_add_test(tc, evas_render_engines);
tcase_add_test(tc, evas_render_lookup);
tcase_add_test(tc, evas_render_lookup_keeps_egl_platform);
tcase_add_test(tc, evas_render_callbacks);
+ tcase_add_test(tc, evas_norender_with_updates_keeps_damage);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.