From 403aa55f42fc103ab6cc4a32ba98d7c2f0b0402b Mon Sep 17 00:00:00 2001
From: Sebastian Krzyszkowiak <dos@dosowisko.net>
Date: Sat, 21 Oct 2023 04:20:58 +0200
Subject: [PATCH] Revert "drop frame"

This reverts commit aede9126c065be1928c4f2393f84b45cae2c7365.
---
 .../micropython/usermodule/mp_sys_display.c      | 12 ------------
 components/st3m/st3m_gfx.c                       | 16 ++--------------
 components/st3m/st3m_gfx.h                       |  3 ---
 3 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/components/micropython/usermodule/mp_sys_display.c b/components/micropython/usermodule/mp_sys_display.c
index e06da6daa8..6f42574328 100644
--- a/components/micropython/usermodule/mp_sys_display.c
+++ b/components/micropython/usermodule/mp_sys_display.c
@@ -105,17 +105,6 @@ STATIC mp_obj_t mp_update(mp_obj_t ctx_in) {
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_update_obj, mp_update);
 
-STATIC mp_obj_t mp_drop(mp_obj_t ctx_in) {
-    mp_ctx_obj_t *self = MP_OBJ_TO_PTR(ctx_in);
-    if (self->base.type != &mp_ctx_type) {
-        mp_raise_ValueError("not a ctx");
-        return mp_const_none;
-    }
-    st3m_gfx_drop_frame(self->ctx);
-    return mp_const_none;
-}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_drop_obj, mp_drop);
-
 STATIC mp_obj_t mp_pipe_full(void) {
     if (st3m_gfx_pipe_full()) {
         return mp_const_true;
@@ -144,7 +133,6 @@ STATIC const mp_rom_map_elem_t mp_module_sys_display_globals_table[] = {
     { MP_ROM_QSTR(MP_QSTR_pipe_available), MP_ROM_PTR(&mp_pipe_available_obj) },
     { MP_ROM_QSTR(MP_QSTR_pipe_flush), MP_ROM_PTR(&mp_pipe_flush_obj) },
     { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&mp_update_obj) },
-    { MP_ROM_QSTR(MP_QSTR_drop), MP_ROM_PTR(&mp_drop_obj) },
     { MP_ROM_QSTR(MP_QSTR_fb), MP_ROM_PTR(&mp_fb_obj) },
     { MP_ROM_QSTR(MP_QSTR_ctx), MP_ROM_PTR(&mp_ctx_obj) },
     { MP_ROM_QSTR(MP_QSTR_fps), MP_ROM_PTR(&mp_fps_obj) },
diff --git a/components/st3m/st3m_gfx.c b/components/st3m/st3m_gfx.c
index 7002fe5ce9..2b7c5e9a25 100644
--- a/components/st3m/st3m_gfx.c
+++ b/components/st3m/st3m_gfx.c
@@ -1026,33 +1026,21 @@ static void st3m_gfx_pipe_put(void) {
 }
 
 static Ctx *st3m_gfx_ctx_int(st3m_gfx_mode mode);
-
-static int end_frame(Ctx *ctx) {
+void st3m_gfx_end_frame(Ctx *ctx) {
     ctx_restore(ctx);
 #if CONFIG_FLOW3R_CTX_FLAVOUR_FULL
     if (ctx == st3m_gfx_ctx_int(st3m_gfx_osd)) {
         xSemaphoreGive(st3m_osd_lock);
-        return 1;
+        return;
     }
 #endif
     st3m_gfx_mode set_mode = _st3m_gfx_mode ? _st3m_gfx_mode : default_mode;
     if ((set_mode & st3m_gfx_smart_redraw) && (set_mode & st3m_gfx_direct_ctx))
         ctx_end_frame(ctx);
-    return 0;
-}
 
-void st3m_gfx_end_frame(Ctx *ctx) {
-    if (end_frame(ctx)) return;
     st3m_gfx_pipe_put();
 }
 
-void st3m_gfx_drop_frame(Ctx *ctx) {
-    if (end_frame(ctx)) return;
-    st3m_gfx_drawlist *drawlist = &drawlists[last_descno];
-    ctx_drawlist_clear(drawlist->user_ctx);
-    xQueueSend(user_ctx_freeq, &last_descno, portMAX_DELAY);
-}
-
 uint8_t st3m_gfx_pipe_available(void) {
     st3m_gfx_mode set_mode = _st3m_gfx_mode ? _st3m_gfx_mode : default_mode;
     if ((set_mode & st3m_gfx_EXPERIMENTAL_think_per_draw) &&
diff --git a/components/st3m/st3m_gfx.h b/components/st3m/st3m_gfx.h
index 7c31dd742a..faf4883a07 100644
--- a/components/st3m/st3m_gfx.h
+++ b/components/st3m/st3m_gfx.h
@@ -101,9 +101,6 @@ float st3m_gfx_fps(void);
 // with ctx_end_frame()
 void st3m_gfx_end_frame(Ctx *ctx);
 
-// drop the current frame without submitting it for displaying
-void st3m_gfx_drop_frame(Ctx *ctx);
-
 // Initialize the gfx subsystem of st3m, includng the rasterization and
 // crtx/blitter pipeline.
 void st3m_gfx_init(void);
-- 
GitLab