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

git pushed a commit to branch devs/devilhorns/apos
in repository efl.

View the commit online.

commit 02067112b177d742e31a8a440eb5c282978a3b84
Author: Christopher Michael <[email protected]>
AuthorDate: Wed Jan 28 10:50:21 2026 -0600

    evas_drm: Remove fb swapper code
    
    As we need to handle having multiple framebuffers per-plane, we won't
    make use of a swapper mechanism here (but rather in ecore_drm2)
---
 src/modules/evas/engines/drm/evas_drm_swapper.c | 192 ------------------------
 src/modules/evas/engines/drm/evas_engine.h      |  34 -----
 src/modules/evas/engines/drm/evas_outbuf.c      |  68 ++-------
 src/modules/evas/engines/drm/meson.build        |   3 +-
 4 files changed, 17 insertions(+), 280 deletions(-)

diff --git a/src/modules/evas/engines/drm/evas_drm_swapper.c b/src/modules/evas/engines/drm/evas_drm_swapper.c
deleted file mode 100644
index 9c3f863a3b..0000000000
--- a/src/modules/evas/engines/drm/evas_drm_swapper.c
+++ /dev/null
@@ -1,192 +0,0 @@
-#include "evas_engine.h"
-
-Drm_Swapper *
-_drm_swapper_new(Ecore_Drm2_Device *dev, int w, int h, int depth, int bpp, unsigned int format)
-{
-   Drm_Swapper *swp;
-
-   swp = calloc(1, sizeof(Drm_Swapper));
-   if (!swp) return NULL;
-
-   swp->w = w;
-   swp->h = h;
-   swp->dev = dev;
-   swp->bpp = bpp;
-   swp->depth = depth;
-   swp->format = format;
-   swp->last_count = -1;
-
-   return swp;
-}
-
-void
-_drm_swapper_free(Drm_Swapper *swp)
-{
-   Drm_Buffer *buf;
-
-   if (swp->mapped) _drm_swapper_buffer_unmap(swp);
-   EINA_LIST_FREE(swp->cache, buf)
-     {
-        ecore_drm2_fb_destroy(buf->fb);
-        free(buf);
-     }
-
-   free(swp);
-}
-
-void *
-_drm_swapper_buffer_map(Drm_Swapper *swp, int *bpl, int *w, int *h)
-{
-   Drm_Buffer *buf;
-   Eina_List *l;
-
-   if (swp->mapped)
-     {
-        if (bpl)
-          {
-             if (swp->buf)
-               *bpl = ecore_drm2_fb_stride_get(swp->buf->fb);
-             else
-               *bpl = swp->w * 4;
-          }
-        if (w) *w = swp->w;
-        if (h) *h = swp->h;
-
-        return ecore_drm2_fb_map_get(swp->buf_fb);
-     }
-
-   if ((swp->buf) && (!swp->buf->reused))
-     {
-        EINA_LIST_FREE(swp->cache, buf)
-          {
-             ecore_drm2_fb_destroy(buf->fb);
-             free(buf);
-          }
-     }
-   else
-     {
-        EINA_LIST_FOREACH(swp->cache, l, buf)
-          {
-             if (buf == swp->buf)
-               {
-                  buf->reused = EINA_TRUE;
-                  swp->buf = buf;
-                  swp->buf_fb = buf->fb;
-                  swp->cache = eina_list_promote_list(swp->cache, l);
-                  break;
-               }
-          }
-     }
-
-   if (!swp->buf_fb)
-     {
-        buf = calloc(1, sizeof(Drm_Buffer));
-        if (!buf) return NULL;
-
-        buf->fb =
-          ecore_drm2_fb_create(swp->dev, swp->w, swp->h, swp->depth,
-                               swp->bpp, swp->format, NULL);
-        if (!buf->fb)
-          {
-             ERR("\tCould Not Create Fb");
-             free(buf);
-             return NULL;
-          }
-
-        buf->index = eina_list_count(swp->cache);
-
-        swp->buf = buf;
-        swp->buf_fb = buf->fb;
-        swp->cache = eina_list_prepend(swp->cache, buf);
-
-        /* trim buffer cache */
-        while (eina_list_count(swp->cache) > 4)
-          {
-             l = eina_list_last(swp->cache);
-             if (l)
-               {
-                  buf = l->data;
-                  swp->cache = eina_list_remove_list(swp->cache, l);
-                  ecore_drm2_fb_destroy(buf->fb);
-                  free(buf);
-               }
-          }
-     }
-
-   if (!ecore_drm2_fb_map(swp->buf_fb))
-     {
-        ERR("Failed to map swap buffer: %m");
-        return NULL;
-     }
-
-   if (bpl) *bpl = ecore_drm2_fb_stride_get(swp->buf_fb);
-   if (w) *w = swp->w;
-   if (h) *h = swp->h;
-
-   swp->mapped = EINA_TRUE;
-   if (swp->buf) swp->buf->mapped = EINA_TRUE;
-
-   return ecore_drm2_fb_map_get(swp->buf_fb);
-}
-
-void
-_drm_swapper_buffer_unmap(Drm_Swapper *swp)
-{
-   if (!swp->mapped) return;
-
-   ecore_drm2_fb_unmap(swp->buf_fb);
-   free(swp->buf);
-
-   swp->buf = NULL;
-   swp->buf_fb = NULL;
-   swp->mapped = EINA_FALSE;
-}
-
-void
-_drm_swapper_swap(Drm_Swapper *swp EINA_UNUSED, Eina_Rectangle *rects EINA_UNUSED, int num EINA_UNUSED)
-{
-   /* int i = 0; */
-
-   /* for (; i < num; i++) */
-   /*   { */
-   /*   } */
-
-   /* TODO */
-   /* create region */
-   /* swap buffers with region */
-   /* destroy region */
-}
-
-Render_Output_Swap_Mode
-_drm_swapper_mode_get(Drm_Swapper *swp)
-{
-   if (!swp->mapped) _drm_swapper_buffer_map(swp, NULL, NULL, NULL);
-
-   if (!swp->mapped) return MODE_FULL;
-   if (!swp->buf) return MODE_FULL;
-
-   if (swp->buf->index != swp->last_count)
-     {
-        swp->last_count = swp->buf->index;
-        return MODE_FULL;
-     }
-
-   if (swp->buf->index == 0)
-     return MODE_FULL;
-   else if (swp->buf->index == 1)
-     return MODE_COPY;
-   else if (swp->buf->index == 2)
-     return MODE_DOUBLE;
-   else if (swp->buf->index == 3)
-     return MODE_TRIPLE;
-   else if (swp->buf->index == 4)
-     return MODE_QUADRUPLE;
-
-   return MODE_FULL;
-}
-
-void
-_drm_swapper_dirty(Drm_Swapper *swp, Eina_Rectangle *rects, int num)
-{
-   ecore_drm2_fb_dirty(swp->buf_fb, rects, num);
-}
diff --git a/src/modules/evas/engines/drm/evas_engine.h b/src/modules/evas/engines/drm/evas_engine.h
index be184b81fc..613b62fa19 100644
--- a/src/modules/evas/engines/drm/evas_engine.h
+++ b/src/modules/evas/engines/drm/evas_engine.h
@@ -39,30 +39,6 @@ extern int _evas_engine_drm_log_dom;
 # endif
 # define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_drm_log_dom, __VA_ARGS__)
 
-typedef struct
-{
-   Ecore_Drm2_Fb *fb;
-   unsigned int index : 3;
-   Eina_Bool mapped : 1;
-   Eina_Bool reused : 1;
-} Drm_Buffer;
-
-typedef struct _Drm_Swapper
-{
-   int w, h, depth, bpp;
-   unsigned int format;
-
-   int last_count;
-
-   Drm_Buffer *buf;
-   Ecore_Drm2_Fb *buf_fb;
-   Ecore_Drm2_Device *dev;
-
-   Eina_List *cache;
-
-   Eina_Bool mapped : 1;
-} Drm_Swapper;
-
 struct _Outbuf
 {
    Evas_Engine_Info_Drm *info;
@@ -72,8 +48,6 @@ struct _Outbuf
    RGBA_Image *onebuf;
    Eina_Array onebuf_regions;
 
-   Drm_Swapper *swapper;
-
    Eina_List *update_regions;
 
    Eina_Bool alpha : 1;
@@ -90,12 +64,4 @@ void _outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, in
 void _outbuf_idle_flush(Outbuf *ob);
 void _outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage, Tilebuf_Rect *buffer_damage, Evas_Render_Mode render_mode);
 
-Drm_Swapper *_drm_swapper_new(Ecore_Drm2_Device *dev, int w, int h, int depth, int bpp, unsigned int format);
-void _drm_swapper_free(Drm_Swapper *swp);
-void *_drm_swapper_buffer_map(Drm_Swapper *swp, int *bpl, int *w, int *h);
-void _drm_swapper_buffer_unmap(Drm_Swapper *swp);
-void _drm_swapper_swap(Drm_Swapper *swp, Eina_Rectangle *rects, int num);
-Render_Output_Swap_Mode _drm_swapper_mode_get(Drm_Swapper *swp);
-void _drm_swapper_dirty(Drm_Swapper *swp, Eina_Rectangle *rects, int num);
-
 #endif
diff --git a/src/modules/evas/engines/drm/evas_outbuf.c b/src/modules/evas/engines/drm/evas_outbuf.c
index 4992b73c26..d590863a8f 100644
--- a/src/modules/evas/engines/drm/evas_outbuf.c
+++ b/src/modules/evas/engines/drm/evas_outbuf.c
@@ -16,25 +16,6 @@ _outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
    ob->h = h;
    ob->info = info;
 
-   if ((ob->info->rotation == 0) || (ob->info->rotation == 180))
-     {
-        ob->swapper =
-          _drm_swapper_new(ob->info->dev, w, h, info->depth, info->bpp,
-                           info->format);
-     }
-   else if ((ob->info->rotation == 90) || (ob->info->rotation == 270))
-     {
-        ob->swapper =
-          _drm_swapper_new(ob->info->dev, h, w, info->depth, info->bpp,
-                           info->format);
-     }
-
-   if (!ob->swapper)
-     {
-        free(ob);
-        return NULL;
-     }
-
    eina_array_step_set(&ob->onebuf_regions, sizeof(Eina_Array), 8);
 
    return ob;
@@ -46,17 +27,15 @@ _outbuf_free(Outbuf *ob)
    _outbuf_flush(ob, NULL, NULL, EVAS_RENDER_MODE_UNDEF);
    _outbuf_idle_flush(ob);
 
-   _drm_swapper_free(ob->swapper);
-
    eina_array_flush(&ob->onebuf_regions);
 
    free(ob);
 }
 
 Render_Output_Swap_Mode
-_outbuf_swap_mode_get(Outbuf *ob)
+_outbuf_swap_mode_get(Outbuf *ob EINA_UNUSED)
 {
-   return _drm_swapper_mode_get(ob->swapper);
+   return MODE_AUTO;
 }
 
 int
@@ -120,25 +99,10 @@ _outbuf_reconfigure(Outbuf *ob, int w, int h, int rot, Outbuf_Depth depth)
    ob->info->rotation = rot;
 
    _outbuf_idle_flush(ob);
-
-   _drm_swapper_free(ob->swapper);
-
-   if ((ob->info->rotation == 0) || (ob->info->rotation == 180))
-     {
-        ob->swapper =
-          _drm_swapper_new(ob->info->dev, w, h, ob->info->depth, ob->info->bpp,
-                           ob->info->format);
-     }
-   else if ((ob->info->rotation == 90) || (ob->info->rotation == 270))
-     {
-        ob->swapper =
-          _drm_swapper_new(ob->info->dev, h, w, ob->info->depth, ob->info->bpp,
-                           ob->info->format);
-     }
 }
 
 void
-_outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage)
+_outbuf_damage_region_set(Outbuf *ob EINA_UNUSED, Tilebuf_Rect *damage)
 {
    Tilebuf_Rect *tr;
    Eina_Rectangle *rects;
@@ -156,7 +120,7 @@ _outbuf_damage_region_set(Outbuf *ob, Tilebuf_Rect *damage)
         i++;
      }
 
-   _drm_swapper_dirty(ob->swapper, rects, count);
+   /* TODO: mark fb dirty */
 }
 
 void *
@@ -172,20 +136,23 @@ _outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *
      {
         Eina_Rectangle *rect;
         RGBA_Image *img;
-        void *data;
+        void *data = ""
         int bpl = 0;
 
         img = ob->onebuf;
         if (!img)
           {
-             int ww = 0, hh = 0, bpp;
+             /* int fw = 0, fh = 0, bpp; */
+             int fh = 0, bpp;
 
              /* bpp = ob->info->depth / 8; */
              bpp = ob->info->bpp;
-             data = "" &bpl, &ww, &hh);
+
+             /* TODO: map fb data */
+
              img = (RGBA_Image *)
                evas_cache_image_data(evas_common_image_cache_get(),
-                                     bpl / bpp, hh, data, ob->alpha,
+                                     bpl / bpp, fh, data, ob->alpha,
                                      EVAS_COLORSPACE_ARGB8888);
              ob->_onebuf_ = img;
              if (!img) return NULL;
@@ -246,12 +213,11 @@ _outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w,
    int bpp, bpl = 0, ww = 0, hh = 0;
    int rx = 0, ry = 0, wid;
    DATA32 *src;
-   DATA8 *dst;
+   DATA8 *dst = NULL;
 
    if (!ob->update_regions) return;
 
-   /* bpp = ob->info->depth / 8; */
-   bpp = ob->info->bpp;
+   bpp = ob->info->depth / 8;
    if (bpp <= 0) return;
 
    if ((ob->info->rotation == 0) || (ob->info->rotation == 180))
@@ -306,7 +272,7 @@ _outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w,
    src = ""
    if (!src) return;
 
-   dst = _drm_swapper_buffer_map(ob->swapper, &bpl, &ww, &hh);
+   /* TODO: get dst data */
    if (!dst) return;
 
    if ((ob->info->rotation == 0) || (ob->info->rotation == 180))
@@ -380,8 +346,7 @@ _outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_Rect
              eina_rectangle_free(rect);
           }
 
-        _drm_swapper_buffer_unmap(ob->swapper);
-        _drm_swapper_swap(ob->swapper, rects, update_count);
+        /* TODO: unmap current buffer, issue swap to new buffer */
 
         eina_array_clean(&ob->onebuf_regions);
 
@@ -450,7 +415,6 @@ _outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_Rect
              i++;
           }
 
-        _drm_swapper_buffer_unmap(ob->swapper);
-        _drm_swapper_swap(ob->swapper, rects, update_count);
+        /* TODO: unmap current buffer, issue swap to new buffer */
      }
 }
diff --git a/src/modules/evas/engines/drm/meson.build b/src/modules/evas/engines/drm/meson.build
index 1edf7b266e..14f92abc13 100644
--- a/src/modules/evas/engines/drm/meson.build
+++ b/src/modules/evas/engines/drm/meson.build
@@ -2,8 +2,7 @@ engine_src = files([
   'Evas_Engine_Drm.h',
   'evas_engine.c',
   'evas_engine.h',
-  'evas_outbuf.c',
-  'evas_drm_swapper.c'
+  'evas_outbuf.c'
 ])
 
 evas_include_directories += include_directories('.')

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

Reply via email to