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 abc0a1c15f5ee086acac679d9113bdf21b638a9c
Author: Christopher Michael <[email protected]>
AuthorDate: Wed Aug 20 13:09:54 2025 -0500

    ecore_drm2: Rework threading for atomic state of crtcs, connectors,
    planes, and displays
    
    This patchset reworks the threading of ecore_drm2 so that it no longer
    stalls, actually fills in atomic states, and makes debug printing work
---
 src/lib/ecore_drm2/ecore_drm2_connectors.c | 43 +++++++++++---------
 src/lib/ecore_drm2/ecore_drm2_crtcs.c      | 51 +++++++++++++----------
 src/lib/ecore_drm2/ecore_drm2_device.c     |  2 +
 src/lib/ecore_drm2/ecore_drm2_displays.c   | 36 ++++++++++-------
 src/lib/ecore_drm2/ecore_drm2_planes.c     | 65 +++++++++++++++++++-----------
 src/lib/ecore_drm2/ecore_drm2_private.h    |  7 ----
 6 files changed, 120 insertions(+), 84 deletions(-)

diff --git a/src/lib/ecore_drm2/ecore_drm2_connectors.c b/src/lib/ecore_drm2/ecore_drm2_connectors.c
index afd96f36d9..83d871c5cc 100644
--- a/src/lib/ecore_drm2/ecore_drm2_connectors.c
+++ b/src/lib/ecore_drm2/ecore_drm2_connectors.c
@@ -5,28 +5,31 @@
 #endif
 
 static Eina_Thread_Queue *thq = NULL;
+static Ecore_Thread *conn_thread = NULL;
 
 typedef struct
 {
    Eina_Thread_Queue_Msg head;
    Ecore_Drm2_Thread_Op_Code code;
+   Ecore_Drm2_Connector *conn;
 } Thread_Msg;
 
 static void
-_ecore_drm2_connector_state_thread_send(Ecore_Drm2_Thread_Op_Code code)
+_ecore_drm2_connector_state_thread_send(Ecore_Drm2_Connector *conn, Ecore_Drm2_Thread_Op_Code code)
 {
    Thread_Msg *msg;
    void *ref;
 
    msg = eina_thread_queue_send(thq, sizeof(Thread_Msg), &ref);
    msg->code = code;
+   msg->conn = conn;
    eina_thread_queue_send_done(thq, ref);
 }
 
 static void
 _ecore_drm2_connector_state_debug(Ecore_Drm2_Connector *conn)
 {
-   DBG("Connector Atomic State Fill Complete");
+   DBG("Connector Atomic State Fill Complete: %d", conn->id);
    DBG("\tConnector: %d", conn->state.current->obj_id);
    DBG("\t\tCrtc Id: %lu", (long)conn->state.current->crtc.value);
    DBG("\t\tDPMS: %lu", (long)conn->state.current->dpms.value);
@@ -171,18 +174,15 @@ cont:
      memcpy(conn->state.pending, conn->state.current, sizeof(Ecore_Drm2_Connector_State));
 
    /* send message to thread for debug printing connector state */
-   _ecore_drm2_connector_state_thread_send(ECORE_DRM2_THREAD_CODE_DEBUG);
+   _ecore_drm2_connector_state_thread_send(conn, ECORE_DRM2_THREAD_CODE_DEBUG);
 }
 
 static void
-_ecore_drm2_connector_state_thread(void *data, Ecore_Thread *thread)
+_ecore_drm2_connector_state_thread(void *data EINA_UNUSED, Ecore_Thread *thread)
 {
-   Ecore_Drm2_Connector *conn;
    Thread_Msg *msg;
    void *ref;
 
-   conn = data;
-
    eina_thread_name_set(eina_thread_self(), "Ecore-drm2-connector");
 
    while (!ecore_thread_check(thread))
@@ -193,10 +193,10 @@ _ecore_drm2_connector_state_thread(void *data, Ecore_Thread *thread)
              switch (msg->code)
                {
                 case ECORE_DRM2_THREAD_CODE_FILL:
-                  _ecore_drm2_connector_state_fill(conn);
+                  _ecore_drm2_connector_state_fill(msg->conn);
                   break;
                 case ECORE_DRM2_THREAD_CODE_DEBUG:
-                  _ecore_drm2_connector_state_debug(conn);
+                  _ecore_drm2_connector_state_debug(msg->conn);
                   break;
                 default:
                   break;
@@ -230,9 +230,6 @@ _ecore_drm2_connector_create(Ecore_Drm2_Device *dev, drmModeConnector *conn, uin
    if (conn->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
      c->writeback = EINA_TRUE;
 
-   /* append this connector to list */
-   dev->conns = eina_list_append(dev->conns, c);
-
    return c;
 }
 
@@ -252,6 +249,12 @@ _ecore_drm2_connectors_create(Ecore_Drm2_Device *dev)
 
    thq = eina_thread_queue_new();
 
+   /* NB: Use an explicit thread to fill crtc atomic state */
+   conn_thread =
+     ecore_thread_feedback_run(_ecore_drm2_connector_state_thread,
+                               _ecore_drm2_connector_state_thread_notify,
+                               NULL, NULL, NULL, EINA_TRUE);
+
    for (; i < res->count_connectors; i++)
      {
         uint32_t conn_id;
@@ -266,12 +269,11 @@ _ecore_drm2_connectors_create(Ecore_Drm2_Device *dev)
         c = _ecore_drm2_connector_create(dev, conn, conn_id);
         if (!c) goto err;
 
-        /* NB: Use an explicit thread to fill crtc atomic state */
-        c->thread =
-          ecore_thread_feedback_run(_ecore_drm2_connector_state_thread,
-                                    _ecore_drm2_connector_state_thread_notify,
-                                    NULL, NULL, c, EINA_TRUE);
+        /* append this connector to list */
+        dev->conns = eina_list_append(dev->conns, c);
 
+        /* send message to thread for filling connector state */
+        _ecore_drm2_connector_state_thread_send(c, ECORE_DRM2_THREAD_CODE_FILL);
      }
 
    sym_drmModeFreeResources(res);
@@ -293,13 +295,18 @@ _ecore_drm2_connectors_destroy(Ecore_Drm2_Device *dev)
 
    EINA_LIST_FREE(dev->conns, conn)
      {
-        if (conn->thread) ecore_thread_cancel(conn->thread);
         if (conn->drmConn) sym_drmModeFreeConnector(conn->drmConn);
         free(conn->state.pending);
         free(conn->state.current);
         free(conn);
      }
 
+   if (conn_thread)
+     {
+        ecore_thread_cancel(conn_thread);
+        conn_thread = NULL;
+     }
+
    if (thq)
      {
         eina_thread_queue_free(thq);
diff --git a/src/lib/ecore_drm2/ecore_drm2_crtcs.c b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
index 784cc14f6e..dbd2d8eacb 100644
--- a/src/lib/ecore_drm2/ecore_drm2_crtcs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
@@ -1,28 +1,31 @@
 #include "ecore_drm2_private.h"
 
 static Eina_Thread_Queue *thq = NULL;
+static Ecore_Thread *crtc_thread = NULL;
 
 typedef struct
 {
    Eina_Thread_Queue_Msg head;
    Ecore_Drm2_Thread_Op_Code code;
+   Ecore_Drm2_Crtc *crtc;
 } Thread_Msg;
 
 static void
-_ecore_drm2_crtc_state_thread_send(Ecore_Drm2_Thread_Op_Code code)
+_ecore_drm2_crtc_state_thread_send(Ecore_Drm2_Crtc *crtc, Ecore_Drm2_Thread_Op_Code code)
 {
    Thread_Msg *msg;
    void *ref;
 
    msg = eina_thread_queue_send(thq, sizeof(Thread_Msg), &ref);
    msg->code = code;
+   msg->crtc = crtc;
    eina_thread_queue_send_done(thq, ref);
 }
 
 static void
 _ecore_drm2_crtc_state_debug(Ecore_Drm2_Crtc *crtc)
 {
-   DBG("CRTC Atomic State Fill Complete");
+   DBG("CRTC Atomic State Fill Complete: %d", crtc->id);
    DBG("\tCrtc: %d", crtc->state.current->obj_id);
    DBG("\t\tMode: %d", crtc->state.current->mode.value);
    DBG("\t\tActive: %lu", (long)crtc->state.current->active.value);
@@ -53,6 +56,7 @@ _ecore_drm2_crtc_state_fill(Ecore_Drm2_Crtc *crtc)
    if (!oprops)
      {
         free(crtc->state.current);
+        ERR("Could not get Crtc Object Properties");
         return;
      }
 
@@ -121,18 +125,15 @@ cont:
      memcpy(crtc->state.pending, crtc->state.current, sizeof(Ecore_Drm2_Crtc_State));
 
    /* send message to thread for debug printing crtc state */
-   _ecore_drm2_crtc_state_thread_send(ECORE_DRM2_THREAD_CODE_DEBUG);
+   _ecore_drm2_crtc_state_thread_send(crtc, ECORE_DRM2_THREAD_CODE_DEBUG);
 }
 
 static void
-_ecore_drm2_crtc_state_thread(void *data, Ecore_Thread *thread)
+_ecore_drm2_crtc_state_thread(void *data EINA_UNUSED, Ecore_Thread *thread)
 {
-   Ecore_Drm2_Crtc *crtc;
    Thread_Msg *msg;
    void *ref;
 
-   crtc = data;
-
    eina_thread_name_set(eina_thread_self(), "Ecore-drm2-crtc");
 
    while (!ecore_thread_check(thread))
@@ -143,10 +144,10 @@ _ecore_drm2_crtc_state_thread(void *data, Ecore_Thread *thread)
              switch (msg->code)
                {
                 case ECORE_DRM2_THREAD_CODE_FILL:
-                  _ecore_drm2_crtc_state_fill(crtc);
+                  _ecore_drm2_crtc_state_fill(msg->crtc);
                   break;
                 case ECORE_DRM2_THREAD_CODE_DEBUG:
-                  _ecore_drm2_crtc_state_debug(crtc);
+                  _ecore_drm2_crtc_state_debug(msg->crtc);
                   break;
                 default:
                   break;
@@ -159,10 +160,6 @@ _ecore_drm2_crtc_state_thread(void *data, Ecore_Thread *thread)
 static void
 _ecore_drm2_crtc_state_thread_notify(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED, void *msg)
 {
-   /* Ecore_Drm2_Crtc *crtc; */
-
-   /* crtc = data; */
-
    free(msg);
 }
 
@@ -184,9 +181,6 @@ _ecore_drm2_crtc_create(Ecore_Drm2_Device *dev, drmModeCrtcPtr dcrtc, uint32_t p
    crtc->pipe = pipe;
    crtc->drmCrtc = dcrtc;
 
-   /* add this crtc to the list */
-   dev->crtcs = eina_list_append(dev->crtcs, crtc);
-
    return crtc;
 }
 
@@ -204,23 +198,31 @@ _ecore_drm2_crtcs_create(Ecore_Drm2_Device *dev)
 
    thq = eina_thread_queue_new();
 
+   /* NB: Use an explicit thread to fill crtc atomic state */
+   crtc_thread =
+     ecore_thread_feedback_run(_ecore_drm2_crtc_state_thread,
+                               _ecore_drm2_crtc_state_thread_notify,
+                               NULL, NULL, NULL, EINA_TRUE);
+
    for (; i < res->count_crtcs; i++)
      {
         /* try to get this crtc from drm */
         c = sym_drmModeGetCrtc(dev->fd, res->crtcs[i]);
+        if (!c) continue;
 
         /* try to create a crtc */
         crtc = _ecore_drm2_crtc_create(dev, c, i);
         if (!crtc) goto err;
 
-        /* NB: Use an explicit thread to fill crtc atomic state */
-        crtc->thread =
-          ecore_thread_feedback_run(_ecore_drm2_crtc_state_thread,
-                                    _ecore_drm2_crtc_state_thread_notify,
-                                    NULL, NULL, crtc, EINA_TRUE);
+        /* add this crtc to the list */
+        dev->crtcs = eina_list_append(dev->crtcs, crtc);
+
+        /* send message to thread for filling crtc state */
+        _ecore_drm2_crtc_state_thread_send(crtc, ECORE_DRM2_THREAD_CODE_FILL);
      }
 
    sym_drmModeFreeResources(res);
+
    return EINA_TRUE;
 
 err:
@@ -239,13 +241,18 @@ _ecore_drm2_crtcs_destroy(Ecore_Drm2_Device *dev)
 
    EINA_LIST_FREE(dev->crtcs, crtc)
      {
-        if (crtc->thread) ecore_thread_cancel(crtc->thread);
         if (crtc->drmCrtc) sym_drmModeFreeCrtc(crtc->drmCrtc);
         free(crtc->state.pending);
         free(crtc->state.current);
         free(crtc);
      }
 
+   if (crtc_thread)
+     {
+        ecore_thread_cancel(crtc_thread);
+        crtc_thread = NULL;
+     }
+
    if (thq)
      {
         eina_thread_queue_free(thq);
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index c32b6825c9..c40d081654 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -280,6 +280,8 @@ ecore_drm2_device_open(const char *seat, unsigned int tty)
         goto caps_err;
      }
 
+   /* overlay planes */
+
    /* try to create planes */
    if (!_ecore_drm2_planes_create(dev))
      {
diff --git a/src/lib/ecore_drm2/ecore_drm2_displays.c b/src/lib/ecore_drm2/ecore_drm2_displays.c
index 36b16d6206..69b41e1ff8 100644
--- a/src/lib/ecore_drm2/ecore_drm2_displays.c
+++ b/src/lib/ecore_drm2/ecore_drm2_displays.c
@@ -13,11 +13,13 @@
 #define EDID_OFFSET_SERIAL 0x0c
 
 static Eina_Thread_Queue *thq = NULL;
+static Ecore_Thread *disp_thread = NULL;
 
 typedef struct
 {
    Eina_Thread_Queue_Msg head;
    Ecore_Drm2_Thread_Op_Code code;
+   Ecore_Drm2_Display *disp;
 } Thread_Msg;
 
 static const char *conn_types[] =
@@ -29,13 +31,14 @@ static const char *conn_types[] =
 };
 
 static void
-_ecore_drm2_display_state_thread_send(Ecore_Drm2_Thread_Op_Code code)
+_ecore_drm2_display_state_thread_send(Ecore_Drm2_Display *disp, Ecore_Drm2_Thread_Op_Code code)
 {
    Thread_Msg *msg;
    void *ref;
 
    msg = eina_thread_queue_send(thq, sizeof(Thread_Msg), &ref);
    msg->code = code;
+   msg->disp = disp;
    eina_thread_queue_send_done(thq, ref);
 }
 
@@ -471,32 +474,29 @@ _ecore_drm2_display_state_fill(Ecore_Drm2_Display *disp)
      memcpy(disp->state.pending, disp->state.current, sizeof(Ecore_Drm2_Display_State));
 
    /* send message to thread for debug printing display state */
-   _ecore_drm2_display_state_thread_send(ECORE_DRM2_THREAD_CODE_DEBUG);
+   _ecore_drm2_display_state_thread_send(disp, ECORE_DRM2_THREAD_CODE_DEBUG);
 }
 
 static void
-_ecore_drm2_display_state_thread(void *data, Ecore_Thread *thread EINA_UNUSED)
+_ecore_drm2_display_state_thread(void *data EINA_UNUSED, Ecore_Thread *thread EINA_UNUSED)
 {
-   Ecore_Drm2_Display *disp;
    Thread_Msg *msg;
    void *ref;
 
-   disp = data;
-
    eina_thread_name_set(eina_thread_self(), "Ecore-drm2-display");
 
    while (!ecore_thread_check(thread))
      {
-        msg = eina_thread_queue_wait(thq, &ref);
+        msg = eina_thread_queue_poll(thq, &ref);
         if (msg)
           {
              switch (msg->code)
                {
                 case ECORE_DRM2_THREAD_CODE_FILL:
-                  _ecore_drm2_display_state_fill(disp);
+                  _ecore_drm2_display_state_fill(msg->disp);
                   break;
                 case ECORE_DRM2_THREAD_CODE_DEBUG:
-                  _ecore_drm2_display_state_debug(disp);
+                  _ecore_drm2_display_state_debug(msg->disp);
                   break;
                 default:
                   break;
@@ -659,6 +659,11 @@ _ecore_drm2_displays_create(Ecore_Drm2_Device *dev)
 
    thq = eina_thread_queue_new();
 
+   disp_thread =
+     ecore_thread_feedback_run(_ecore_drm2_display_state_thread,
+                               _ecore_drm2_display_state_thread_notify,
+                               NULL, NULL, NULL, EINA_TRUE);
+
    /* go through list of connectors and create displays */
    EINA_LIST_FOREACH(dev->conns, l, c)
      {
@@ -697,10 +702,8 @@ _ecore_drm2_displays_create(Ecore_Drm2_Device *dev)
         /* append this display to the list */
         dev->displays = eina_list_append(dev->displays, disp);
 
-        disp->thread =
-          ecore_thread_feedback_run(_ecore_drm2_display_state_thread,
-                                    _ecore_drm2_display_state_thread_notify,
-                                    NULL, NULL, disp, EINA_TRUE);
+        /* send message to thread for filling display state */
+        _ecore_drm2_display_state_thread_send(disp, ECORE_DRM2_THREAD_CODE_FILL);
 
 cont:
         sym_drmModeFreeEncoder(encoder);
@@ -716,7 +719,6 @@ _ecore_drm2_displays_destroy(Ecore_Drm2_Device *dev)
 
    EINA_LIST_FREE(dev->displays, disp)
      {
-        if (disp->thread) ecore_thread_cancel(disp->thread);
         eina_stringshare_del(disp->backlight.path);
         eina_stringshare_del(disp->relative.to);
         eina_stringshare_del(disp->serial);
@@ -728,6 +730,12 @@ _ecore_drm2_displays_destroy(Ecore_Drm2_Device *dev)
         free(disp);
      }
 
+   if (disp_thread)
+     {
+        ecore_thread_cancel(disp_thread);
+        disp_thread = NULL;
+     }
+
    if (thq)
      {
         eina_thread_queue_free(thq);
diff --git a/src/lib/ecore_drm2/ecore_drm2_planes.c b/src/lib/ecore_drm2/ecore_drm2_planes.c
index fffc3f2127..648d4963de 100644
--- a/src/lib/ecore_drm2/ecore_drm2_planes.c
+++ b/src/lib/ecore_drm2/ecore_drm2_planes.c
@@ -1,28 +1,31 @@
 #include "ecore_drm2_private.h"
 
 static Eina_Thread_Queue *thq = NULL;
+static Ecore_Thread *plane_thread = NULL;
 
 typedef struct
 {
    Eina_Thread_Queue_Msg head;
    Ecore_Drm2_Thread_Op_Code code;
+   Ecore_Drm2_Plane *plane;
 } Thread_Msg;
 
 static void
-_ecore_drm2_plane_state_thread_send(Ecore_Drm2_Thread_Op_Code code)
+_ecore_drm2_plane_state_thread_send(Ecore_Drm2_Plane *plane, Ecore_Drm2_Thread_Op_Code code)
 {
    Thread_Msg *msg;
    void *ref;
 
    msg = eina_thread_queue_send(thq, sizeof(Thread_Msg), &ref);
    msg->code = code;
+   msg->plane = plane;
    eina_thread_queue_send_done(thq, ref);
 }
 
 static void
 _ecore_drm2_plane_state_debug(Ecore_Drm2_Plane *plane)
 {
-   DBG("Plane Atomic State Fill Complete");
+   DBG("Plane Atomic State Fill Complete: %d", plane->id);
    DBG("\tPlane: %d", plane->state.current->obj_id);
    DBG("\t\tCrtc: %lu", (long)plane->state.current->cid.value);
    DBG("\t\tFB: %lu", (long)plane->state.current->fid.value);
@@ -78,6 +81,7 @@ _ecore_drm2_plane_state_formats_del(Ecore_Drm2_Plane_State *pstate)
 {
    Ecore_Drm2_Format *fmt;
 
+   if (!pstate) return;
    EINA_LIST_FREE(pstate->formats, fmt)
      free(fmt);
 }
@@ -281,18 +285,15 @@ cont:
      memcpy(plane->state.pending, plane->state.current, sizeof(Ecore_Drm2_Plane_State));
 
    /* send message to thread for debug printing plane state */
-   _ecore_drm2_plane_state_thread_send(ECORE_DRM2_THREAD_CODE_DEBUG);
+   _ecore_drm2_plane_state_thread_send(plane, ECORE_DRM2_THREAD_CODE_DEBUG);
 }
 
 static void
-_ecore_drm2_plane_state_thread(void *data, Ecore_Thread *thread EINA_UNUSED)
+_ecore_drm2_plane_state_thread(void *data EINA_UNUSED, Ecore_Thread *thread)
 {
-   Ecore_Drm2_Plane *plane;
    Thread_Msg *msg;
    void *ref;
 
-   plane = data;
-
    eina_thread_name_set(eina_thread_self(), "Ecore-drm2-plane");
 
    while (!ecore_thread_check(thread))
@@ -303,10 +304,10 @@ _ecore_drm2_plane_state_thread(void *data, Ecore_Thread *thread EINA_UNUSED)
              switch (msg->code)
                {
                 case ECORE_DRM2_THREAD_CODE_FILL:
-                  _ecore_drm2_plane_state_fill(plane);
+                  _ecore_drm2_plane_state_fill(msg->plane);
                   break;
                 case ECORE_DRM2_THREAD_CODE_DEBUG:
-                  _ecore_drm2_plane_state_debug(plane);
+                  _ecore_drm2_plane_state_debug(msg->plane);
                   break;
                 default:
                   break;
@@ -339,16 +340,15 @@ _ecore_drm2_plane_create(Ecore_Drm2_Device *dev, drmModePlanePtr p, uint32_t ind
    plane->id = index;
    plane->drmPlane = p;
 
-   /* append this plane to the list */
-   dev->planes = eina_list_append(dev->planes, plane);
-
    return plane;
 }
 
 static Eina_Bool
 _ecore_drm2_planes_available(Ecore_Drm2_Plane *plane, Ecore_Drm2_Display *disp)
 {
-   if (!plane->state.current) return EINA_FALSE;
+   if (!plane->state.current)
+     return !!(plane->drmPlane->possible_crtcs & (1 << disp->crtc->pipe));
+//     return EINA_FALSE;
 
    if (!plane->state.current->complete) return EINA_FALSE;
 
@@ -371,6 +371,12 @@ _ecore_drm2_planes_create(Ecore_Drm2_Device *dev)
 
    thq = eina_thread_queue_new();
 
+   /* NB: Use an explicit thread to fill plane atomic state */
+   plane_thread =
+     ecore_thread_feedback_run(_ecore_drm2_plane_state_thread,
+                               _ecore_drm2_plane_state_thread_notify,
+                               NULL, NULL, NULL, EINA_TRUE);
+
    for (; i < pres->count_planes; i++)
      {
         /* try to get this plane from drm */
@@ -381,14 +387,15 @@ _ecore_drm2_planes_create(Ecore_Drm2_Device *dev)
         plane = _ecore_drm2_plane_create(dev, p, pres->planes[i]);
         if (!plane) goto err;
 
-        /* NB: Use an explicit thread to fill plane atomic state */
-        plane->thread =
-          ecore_thread_feedback_run(_ecore_drm2_plane_state_thread,
-                                    _ecore_drm2_plane_state_thread_notify,
-                                    NULL, NULL, plane, EINA_TRUE);
+        /* append this plane to the list */
+        dev->planes = eina_list_append(dev->planes, plane);
+
+        /* send message to thread for filling plane state */
+        _ecore_drm2_plane_state_thread_send(plane, ECORE_DRM2_THREAD_CODE_FILL);
      }
 
    sym_drmModeFreePlaneResources(pres);
+
    return EINA_TRUE;
 
 err:
@@ -407,13 +414,15 @@ _ecore_drm2_planes_destroy(Ecore_Drm2_Device *dev)
 
    EINA_LIST_FREE(dev->planes, plane)
      {
-        if (plane->state.current->type.value == DRM_PLANE_TYPE_OVERLAY)
+        if (plane->state.current)
           {
-             sym_drmModeSetPlane(dev->fd, plane->id, 0, 0, 0, 0, 0, 0, 0,
-                                 0, 0, 0, 0);
+             if (plane->state.current->type.value == DRM_PLANE_TYPE_OVERLAY)
+               {
+                  sym_drmModeSetPlane(dev->fd, plane->id, 0, 0, 0, 0, 0, 0, 0,
+                                      0, 0, 0, 0);
+               }
           }
 
-        if (plane->thread) ecore_thread_cancel(plane->thread);
         if (plane->drmPlane) sym_drmModeFreePlane(plane->drmPlane);
 
         _ecore_drm2_plane_state_formats_del(plane->state.pending);
@@ -425,6 +434,12 @@ _ecore_drm2_planes_destroy(Ecore_Drm2_Device *dev)
         free(plane);
      }
 
+   if (plane_thread)
+     {
+        ecore_thread_cancel(plane_thread);
+        plane_thread = NULL;
+     }
+
    if (thq)
      {
         eina_thread_queue_free(thq);
@@ -448,7 +463,11 @@ _ecore_drm2_planes_find(Ecore_Drm2_Display *disp, uint64_t type)
      {
         Eina_Bool found = EINA_FALSE;
 
-        if (plane->state.current->type.value != type) continue;
+        if (plane->state.current)
+          {
+             if (plane->state.current->type.value != type) continue;
+          }
+
         if (!_ecore_drm2_planes_available(plane, disp)) continue;
 
         EINA_LIST_FOREACH(dev->displays, ll, dsp)
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 672604afa7..06e8cd2b5f 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -254,8 +254,6 @@ struct _Ecore_Drm2_Plane
         Ecore_Drm2_Plane_State *current;
         Ecore_Drm2_Plane_State *pending;
      } state;
-
-   Ecore_Thread *thread;
 };
 
 struct _Ecore_Drm2_Display_Mode
@@ -319,8 +317,6 @@ struct _Ecore_Drm2_Display
 
    Eina_List *modes;
 
-   Ecore_Thread *thread;
-
    void *user_data;
 
    Eina_Bool connected : 1;
@@ -341,8 +337,6 @@ struct _Ecore_Drm2_Connector
         Ecore_Drm2_Connector_State *pending;
      } state;
 
-   Ecore_Thread *thread;
-
    Eina_Bool writeback : 1;
 };
 
@@ -362,7 +356,6 @@ struct _Ecore_Drm2_Crtc
         Ecore_Drm2_Crtc_State *pending;
      } state;
 
-   Ecore_Thread *thread;
    Eina_Bool in_use : 1;
 };
 

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

Reply via email to