This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efl.

View the commit online.

commit b1759d9a5a38848fb39d6ceb896c40008f1b3fa9
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Dec 2 15:20:08 2026 -0600

    evas/software_generic: do not let a declined update eat the next frame
    
    When an engine declines to draw a region (new_region_for_update()
    returns NULL), the pass sets re->end to make the following call return
    NULL and finish the pass. The render loop stops at the NULL it just
    got, so nothing makes that following call: the flag stays set and the
    first call of the next render returns NULL at once. That frame draws
    nothing even though it has damage.
    
    Engines that decline: wayland_shm when ecore_wl2_surface_data_get()
    fails or the rect clips to nothing, software_x11 and drm when an
    allocation fails (drm also on an empty rect). fb has no such path.
    
    Only set the flag when a surface was returned, as that is the only
    case where the loop calls again.
    
    Left alone on purpose: in the per-rect swap modes, a NULL for one rect
    still ends the loop and drops the remaining rects of that frame.
    
    The test drives the engine's output_redraws_next_update_get() with a
    fake outbuf that declines one region, for the FULL, COPY and DOUBLE swap
    modes. It fails without the fix. No engine the suite can run declines
    on demand, hence the fake outbuf.
    
    Co-Authored-By: Claude Fable 5.2 <[email protected]>
---
 .../evas/engines/software_generic/evas_engine.c    |  3 +-
 src/tests/evas/evas_test_render_engines.c          | 85 ++++++++++++++++++++++
 2 files changed, 87 insertions(+), 1 deletion(-)

diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index a576c1722b..11d081400f 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -4270,7 +4270,8 @@ eng_output_redraws_next_update_get(void *engine EINA_UNUSED, void *data, int *x,
           {
              evas_common_tilebuf_free_render_rects(re->rects);
              re->rects = NULL;
-             re->end = 1;
+             /* only a surface is followed by a call that ends the pass */
+             re->end = !!surface;
           }
         return surface;
      }
diff --git a/src/tests/evas/evas_test_render_engines.c b/src/tests/evas/evas_test_render_engines.c
index 26a76c828c..6a375d9368 100644
--- a/src/tests/evas/evas_test_render_engines.c
+++ b/src/tests/evas/evas_test_render_engines.c
@@ -8,6 +8,10 @@
 #include <Evas.h>
 #include <Evas_Engine_Buffer.h>
 
+#include "../../lib/evas/include/evas_common_private.h"
+#include "../../lib/evas/include/evas_private.h"
+#include "../../modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h"
+
 #include "evas_suite.h"
 #include "evas_tests_helpers.h"
 
@@ -101,6 +105,86 @@ EFL_START_TEST(evas_render_lookup_keeps_egl_platform)
 }
 EFL_END_TEST
 
+#define OUTPUT_W 64
+#define OUTPUT_H 64
+
+static Render_Output_Swap_Mode _swap_mode;
+static Eina_Bool _decline_next_region;
+static char _surface;
+
+static Render_Output_Swap_Mode
+_outbuf_swap_mode_get(Outbuf *ob EINA_UNUSED)
+{
+   return _swap_mode;
+}
+
+static void *
+_outbuf_new_region_for_update(Outbuf *ob EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED,
+                              int w EINA_UNUSED, int h EINA_UNUSED,
+                              int *cx EINA_UNUSED, int *cy EINA_UNUSED,
+                              int *cw EINA_UNUSED, int *ch EINA_UNUSED)
+{
+   if (_decline_next_region)
+     {
+        _decline_next_region = EINA_FALSE;
+        return NULL;
+     }
+   return &_surface;
+}
+
+static Eina_Bool
+_next_update_get(const Evas_Func *eng, Render_Output_Software_Generic *re)
+{
+   int x, y, w, h, cx, cy, cw, ch;
+
+   return !!eng->output_redraws_next_update_get(NULL, re, &x, &y, &w, &h,
+                                                &cx, &cy, &cw, &ch);
+}
+
+EFL_START_TEST(evas_render_output_skipped_update_does_not_eat_next)
+{
+   Render_Output_Swap_Mode modes[] = { MODE_FULL, MODE_COPY, MODE_DOUBLE };
+   Render_Engine_Software_Generic engine = { 0 };
+   Evas_Public_Data *evas;
+   Evas *e;
+   unsigned int i;
+
+   e = evas_new();
+   fail_if(!e);
+   evas_output_method_set(e, evas_render_method_lookup("buffer"));
+   evas = efl_data_scope_get(e, EVAS_CANVAS_CLASS);
+
+   for (i = 0; i < EINA_C_ARRAY_LENGTH(modes); i++)
+     {
+        Render_Output_Software_Generic re = { 0 };
+
+        _swap_mode = modes[i];
+        fail_if(!evas_render_engine_software_generic_init(&engine, &re, NULL,
+                                                          _outbuf_swap_mode_get, NULL, NULL,
+                                                          NULL, NULL,
+                                                          _outbuf_new_region_for_update,
+                                                          NULL, NULL, NULL, NULL, NULL,
+                                                          NULL,
+                                                          OUTPUT_W, OUTPUT_H));
+
+        /* The engine declines to draw this frame. */
+        evas_common_tilebuf_add_redraw(re.tb, 0, 0, 16, 16);
+        _decline_next_region = EINA_TRUE;
+        fail_if(_next_update_get(evas->engine.func, &re));
+
+        /* The damage of the next frame must not be swallowed. */
+        evas_common_tilebuf_add_redraw(re.tb, 0, 0, 16, 16);
+        ck_assert_msg(_next_update_get(evas->engine.func, &re),
+                      "swap mode %d: the frame after a declined one drew nothing",
+                      modes[i]);
+
+        evas_render_engine_software_generic_clean(&engine, &re);
+     }
+
+   evas_free(e);
+}
+EFL_END_TEST
+
 static unsigned int counter;
 
 static void
@@ -282,6 +366,7 @@ EFL_END_TEST
 void evas_test_render_engines(TCase *tc)
 {
    tcase_add_test(tc, evas_render_engines);
+   tcase_add_test(tc, evas_render_output_skipped_update_does_not_eat_next);
    tcase_add_test(tc, evas_render_lookup);
    tcase_add_test(tc, evas_render_lookup_keeps_egl_platform);
    tcase_add_test(tc, evas_render_callbacks);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to