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 d0e4883d50b930d2691a83de99b714c07f1eaec7
Author: Christopher Michael <devilho...@comcast.net>
AuthorDate: Tue Nov 8 07:33:22 2022 -0500

    ecore_drm2: Switch threading code to use an 'op code'
    
    This should make it easier in the future to add more thread
    operations. Also, this fixes up the issue that the eina_thread_queue
    was never freed
---
 src/lib/ecore_drm2/ecore_drm2_crtcs.c   | 38 +++++++++++++++++++++------------
 src/lib/ecore_drm2/ecore_drm2_private.h |  7 ++++++
 2 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/src/lib/ecore_drm2/ecore_drm2_crtcs.c b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
index 3569c97111..3472ddccf3 100644
--- a/src/lib/ecore_drm2/ecore_drm2_crtcs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
@@ -5,21 +5,17 @@ static Eina_Thread_Queue *thq = NULL;
 typedef struct
 {
    Eina_Thread_Queue_Msg head;
-   Eina_Bool fill : 1;
-   Eina_Bool commit : 1;
-   Eina_Bool debug : 1;
+   Ecore_Drm2_Thread_Op_Code code;
 } Thread_Msg;
 
 static void
-_ecore_drm2_crtc_state_thread_send(Eina_Bool fill, Eina_Bool commit, Eina_Bool debug)
+_ecore_drm2_crtc_state_thread_send(Ecore_Drm2_Thread_Op_Code code)
 {
    Thread_Msg *msg;
    void *ref;
 
    msg = eina_thread_queue_send(thq, sizeof(Thread_Msg), &ref);
-   msg->fill = fill;
-   msg->commit = commit;
-   msg->debug = debug;
+   msg->code = code;
    eina_thread_queue_send_done(thq, ref);
 }
 
@@ -118,7 +114,7 @@ cont:
    sym_drmModeFreeObjectProperties(oprops);
 
    /* send message to thread for debug printing crtc state */
-   _ecore_drm2_crtc_state_thread_send(EINA_FALSE, EINA_FALSE, EINA_TRUE);
+   _ecore_drm2_crtc_state_thread_send(ECORE_DRM2_THREAD_CODE_DEBUG);
 }
 
 static void
@@ -127,7 +123,7 @@ _ecore_drm2_crtc_state_commit(Ecore_Drm2_Crtc *crtc EINA_UNUSED)
    /* Ecore_Drm2_Crtc_State *cstate; */
 
    /* cstate = crtc->state; */
-   /* DBG("CRTC State Commit"); */
+   DBG("CRTC State Commit");
 }
 
 static void
@@ -146,9 +142,20 @@ _ecore_drm2_crtc_state_thread(void *data, Ecore_Thread *thread)
         msg = eina_thread_queue_wait(thq, &ref);
         if (msg)
           {
-             if (msg->fill) _ecore_drm2_crtc_state_fill(crtc);
-             if (msg->commit) _ecore_drm2_crtc_state_commit(crtc);
-             if (msg->debug) _ecore_drm2_crtc_state_debug(crtc);
+             switch (msg->code)
+               {
+                case ECORE_DRM2_THREAD_CODE_FILL:
+                  _ecore_drm2_crtc_state_fill(crtc);
+                  break;
+                case ECORE_DRM2_THREAD_CODE_COMMIT:
+                  _ecore_drm2_crtc_state_commit(crtc);
+                  break;
+                case ECORE_DRM2_THREAD_CODE_DEBUG:
+                  _ecore_drm2_crtc_state_debug(crtc);
+                  break;
+                default:
+                  break;
+               }
              eina_thread_queue_wait_done(thq, ref);
           }
      }
@@ -243,13 +250,16 @@ _ecore_drm2_crtcs_destroy(Ecore_Drm2_Device *dev)
         free(crtc->state);
         free(crtc);
      }
+
+   eina_thread_queue_free(thq);
+   thq = NULL;
 }
 
 void
-_ecore_drm2_crtc_mode_set(Ecore_Drm2_Crtc *crtc, Ecore_Drm2_Display_Mode *mode EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED)
+_ecore_drm2_crtc_mode_set(Ecore_Drm2_Crtc *crtc EINA_UNUSED, Ecore_Drm2_Display_Mode *mode EINA_UNUSED, int x EINA_UNUSED, int y EINA_UNUSED)
 {
    /* TODO: add code to actually set crtc mode */
 
    /* send message to thread queue that we have work to do */
-   _ecore_drm2_crtc_state_thread_send(EINA_FALSE, EINA_TRUE, EINA_FALSE);
+   _ecore_drm2_crtc_state_thread_send(ECORE_DRM2_THREAD_CODE_COMMIT);
 }
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 02b4c329bf..2788530d8c 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -61,6 +61,13 @@ extern int _ecore_drm2_log_dom;
 # endif
 # define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_drm2_log_dom, __VA_ARGS__)
 
+typedef enum _Ecore_Drm2_Thread_Op_Code
+{
+   ECORE_DRM2_THREAD_CODE_FILL,
+   ECORE_DRM2_THREAD_CODE_COMMIT,
+   ECORE_DRM2_THREAD_CODE_DEBUG
+} Ecore_Drm2_Thread_Op_Code;
+
 typedef enum _Ecore_Drm2_Backlight_Type
 {
    ECORE_DRM2_BACKLIGHT_RAW,

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

Reply via email to