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 1cc56cf3a02868878e19a72d06bcacae54a9679e
Author: Christopher Michael <devilho...@comcast.net>
AuthorDate: Wed Mar 8 09:41:15 2023 -0500

    ecore_drm2: Move to using a current & pending state
    
    Large patch that essentially moves all the code to use a current &
    pending 'state' so that we can apply changes on vblank
---
 src/lib/ecore_drm2/Ecore_Drm2.h            |   1 +
 src/lib/ecore_drm2/ecore_drm2_connectors.c |  21 ++--
 src/lib/ecore_drm2/ecore_drm2_crtcs.c      |  19 ++--
 src/lib/ecore_drm2/ecore_drm2_device.c     |   4 +-
 src/lib/ecore_drm2/ecore_drm2_displays.c   | 167 ++++++++++++++++++-----------
 src/lib/ecore_drm2/ecore_drm2_planes.c     |  25 ++---
 src/lib/ecore_drm2/ecore_drm2_private.h    |  44 ++++++--
 src/lib/ecore_drm2/meson.build             |   2 +-
 8 files changed, 175 insertions(+), 108 deletions(-)

diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 491f322e0f..347e77000b 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -76,6 +76,7 @@ EAPI void ecore_drm2_display_primary_set(Ecore_Drm2_Display *disp, Eina_Bool pri
 EAPI const Eina_List *ecore_drm2_displays_get(Ecore_Drm2_Device *dev);
 EAPI void ecore_drm2_display_info_get(Ecore_Drm2_Display *disp, int *x, int *y, int *w, int *h, unsigned int *refresh);
 EAPI int ecore_drm2_display_rotation_get(Ecore_Drm2_Display *disp);
+EAPI Eina_Bool ecore_drm2_display_rotation_set(Ecore_Drm2_Display *disp, uint64_t rotation);
 
 /* XXX: These are 'test' APIs */
 EAPI void ecore_drm2_display_mode_set(Ecore_Drm2_Display *disp, Ecore_Drm2_Display_Mode *mode, int x, int y);
diff --git a/src/lib/ecore_drm2/ecore_drm2_connectors.c b/src/lib/ecore_drm2/ecore_drm2_connectors.c
index d83242bdc7..2f46d37655 100644
--- a/src/lib/ecore_drm2/ecore_drm2_connectors.c
+++ b/src/lib/ecore_drm2/ecore_drm2_connectors.c
@@ -27,11 +27,11 @@ static void
 _ecore_drm2_connector_state_debug(Ecore_Drm2_Connector *conn)
 {
    DBG("Connector Atomic State Fill Complete");
-   DBG("\tConnector: %d", conn->state->obj_id);
-   DBG("\t\tCrtc Id: %lu", (long)conn->state->crtc.value);
-   DBG("\t\tDPMS: %lu", (long)conn->state->dpms.value);
-   DBG("\t\tAspect Ratio: %lu", (long)conn->state->aspect.value);
-   DBG("\t\tScaling Mode: %lu", (long)conn->state->scaling.value);
+   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);
+   DBG("\t\tAspect Ratio: %lu", (long)conn->state.current->aspect.value);
+   DBG("\t\tScaling Mode: %lu", (long)conn->state.current->scaling.value);
 }
 
 static void
@@ -42,14 +42,14 @@ _ecore_drm2_connector_state_fill(Ecore_Drm2_Connector *conn)
    unsigned int i = 0;
 
    /* try to allocate space for connector Atomic state */
-   conn->state = calloc(1, sizeof(Ecore_Drm2_Connector_State));
-   if (!conn->state)
+   conn->state.current = calloc(1, sizeof(Ecore_Drm2_Connector_State));
+   if (!conn->state.current)
      {
         ERR("Could not allocate space for Connector state");
         return;
      }
 
-   cstate = conn->state;
+   cstate = conn->state.current;
    cstate->obj_id = conn->id;
 
    /* get the properties of this connector from drm */
@@ -58,7 +58,7 @@ _ecore_drm2_connector_state_fill(Ecore_Drm2_Connector *conn)
                                     DRM_MODE_OBJECT_CONNECTOR);
    if (!oprops)
      {
-        free(conn->state);
+        free(conn->state.current);
         return;
      }
 
@@ -255,7 +255,8 @@ _ecore_drm2_connectors_destroy(Ecore_Drm2_Device *dev)
      {
         if (conn->thread) ecore_thread_cancel(conn->thread);
         if (conn->drmConn) sym_drmModeFreeConnector(conn->drmConn);
-        free(conn->state);
+        free(conn->state.pending);
+        free(conn->state.current);
         free(conn);
      }
 
diff --git a/src/lib/ecore_drm2/ecore_drm2_crtcs.c b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
index 1932f44381..71285fca3e 100644
--- a/src/lib/ecore_drm2/ecore_drm2_crtcs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
@@ -23,9 +23,9 @@ static void
 _ecore_drm2_crtc_state_debug(Ecore_Drm2_Crtc *crtc)
 {
    DBG("CRTC Atomic State Fill Complete");
-   DBG("\tCrtc: %d", crtc->state->obj_id);
-   DBG("\t\tMode: %d", crtc->state->mode.value);
-   DBG("\t\tActive: %lu", (long)crtc->state->active.value);
+   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);
 }
 
 static void
@@ -35,15 +35,15 @@ _ecore_drm2_crtc_state_fill(Ecore_Drm2_Crtc *crtc)
    drmModeObjectPropertiesPtr oprops;
    unsigned int i = 0;
 
-   /* try to allocate space for CRTC Atomic state */
-   crtc->state = calloc(1, sizeof(Ecore_Drm2_Crtc_State));
-   if (!crtc->state)
+   /* try to allocate space for current CRTC Atomic state */
+   crtc->state.current = calloc(1, sizeof(Ecore_Drm2_Crtc_State));
+   if (!crtc->state.current)
      {
         ERR("Could not allocate space for CRTC state");
         return;
      }
 
-   cstate = crtc->state;
+   cstate = crtc->state.current;
    cstate->obj_id = crtc->drmCrtc->crtc_id;
 
    /* get the properties of this crtc from drm */
@@ -52,7 +52,7 @@ _ecore_drm2_crtc_state_fill(Ecore_Drm2_Crtc *crtc)
                                     DRM_MODE_OBJECT_CRTC);
    if (!oprops)
      {
-        free(crtc->state);
+        free(crtc->state.current);
         return;
      }
 
@@ -236,7 +236,8 @@ _ecore_drm2_crtcs_destroy(Ecore_Drm2_Device *dev)
      {
         if (crtc->thread) ecore_thread_cancel(crtc->thread);
         if (crtc->drmCrtc) sym_drmModeFreeCrtc(crtc->drmCrtc);
-        free(crtc->state);
+        free(crtc->state.pending);
+        free(crtc->state.current);
         free(crtc);
      }
 
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c b/src/lib/ecore_drm2/ecore_drm2_device.c
index ae56d7ebdc..a7c95c57f3 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -287,10 +287,10 @@ ecore_drm2_device_open(const char *seat, unsigned int tty)
 
 disp_err:
    _ecore_drm2_connectors_destroy(dev);
-plane_err:
-   _ecore_drm2_crtcs_destroy(dev);
 conn_err:
    _ecore_drm2_planes_destroy(dev);
+plane_err:
+   _ecore_drm2_crtcs_destroy(dev);
 caps_err:
    elput_input_shutdown(dev->em);
 input_err:
diff --git a/src/lib/ecore_drm2/ecore_drm2_displays.c b/src/lib/ecore_drm2/ecore_drm2_displays.c
index 38566efd21..0a2cb287aa 100644
--- a/src/lib/ecore_drm2/ecore_drm2_displays.c
+++ b/src/lib/ecore_drm2/ecore_drm2_displays.c
@@ -122,7 +122,7 @@ _ecore_drm2_display_edid_get(Ecore_Drm2_Display *disp)
    Ecore_Drm2_Connector_State *cstate;
    int ret = 0;
 
-   cstate = disp->conn->state;
+   cstate = disp->conn->state.current;
 
    ret = _ecore_drm2_display_edid_parse(disp, cstate->edid.data, cstate->edid.len);
    if (!ret)
@@ -182,8 +182,8 @@ _ecore_drm2_display_state_debug(Ecore_Drm2_Display *disp)
      }
 
    /* DBG("\tCloned: %d", disp->cloned); */
-   DBG("\tPrimary: %d", disp->primary);
-   DBG("\tEnabled: %d", disp->enabled);
+   DBG("\tPrimary: %d", disp->state.current->primary);
+   DBG("\tEnabled: %d", disp->state.current->enabled);
    DBG("\tConnected: %d", disp->connected);
 }
 
@@ -241,7 +241,7 @@ _ecore_drm2_display_backlight_get(Ecore_Drm2_Display *disp)
         disp->backlight.path = eina_stringshare_add(dev);
         disp->backlight.max =
           _ecore_drm2_display_backlight_value_get(disp, "max_brightness");
-        disp->backlight.value =
+        disp->state.current->backlight =
           _ecore_drm2_display_backlight_value_get(disp, "brightness");
      }
 
@@ -327,13 +327,13 @@ _ecore_drm2_display_modes_get(Ecore_Drm2_Display *disp)
         disp->modes = eina_list_append(disp->modes, current);
      }
 
-   if (current) disp->current_mode = current;
-   else if (pref) disp->current_mode = pref;
-   else if (best) disp->current_mode = best;
+   if (current) disp->state.current->mode = current;
+   else if (pref) disp->state.current->mode = pref;
+   else if (best) disp->state.current->mode = best;
 
-   if (!disp->current_mode) goto err;
+   if (!disp->state.current->mode) goto err;
 
-   disp->current_mode->flags |= DRM_MODE_TYPE_DEFAULT;
+   disp->state.current->mode->flags |= DRM_MODE_TYPE_DEFAULT;
 
    return;
 
@@ -342,11 +342,68 @@ err:
      free(dmode);
 }
 
+static void
+_ecore_drm2_display_rotation_get(Ecore_Drm2_Display *disp)
+{
+   Ecore_Drm2_Plane *plane;
+
+   /* try to find primary plane for this display */
+   plane = _ecore_drm2_planes_primary_find(disp->dev, disp->crtc->id);
+   if (plane)
+     {
+        if (plane->state.current)
+          disp->state.current->rotation = plane->state.current->rotation.value;
+        else
+          {
+             drmModeObjectPropertiesPtr oprops;
+
+             /* NB: Sadly we cannot rely on plane->state.current being already 
+              * filled by the time we reach this (due to threading), 
+              * so we will query the plane properties we want directly */
+
+             /* query plane for rotations */
+             oprops =
+               sym_drmModeObjectGetProperties(plane->fd,
+                                              plane->drmPlane->plane_id,
+                                              DRM_MODE_OBJECT_PLANE);
+             if (oprops)
+               {
+                  unsigned int i = 0;
+
+                  for (; i < oprops->count_props; i++)
+                    {
+                       drmModePropertyPtr prop;
+
+                       prop = sym_drmModeGetProperty(plane->fd, oprops->props[i]);
+                       if (!prop) continue;
+
+                       if (!strcmp(prop->name, "rotation"))
+                         disp->state.current->rotation = oprops->prop_values[i];
+
+                       sym_drmModeFreeProperty(prop);
+                    }
+                  sym_drmModeFreeObjectProperties(oprops);
+               }
+          }
+     }
+}
+
 static void
 _ecore_drm2_display_state_fill(Ecore_Drm2_Display *disp)
 {
+   Ecore_Drm2_Display_State *dstate;
    char *name = NULL;
 
+   /* try to allocate space for current Display state */
+   disp->state.current = calloc(1, sizeof(Ecore_Drm2_Display_State));
+   if (!disp->state.current)
+     {
+        ERR("Could not allocate space for Display state");
+        return;
+     }
+
+   dstate = disp->state.current;
+
    /* get display name */
    name = _ecore_drm2_display_name_get(disp->conn);
    disp->name = eina_stringshare_add(name);
@@ -387,6 +444,9 @@ _ecore_drm2_display_state_fill(Ecore_Drm2_Display *disp)
         break;
      }
 
+   /* get current rotation value */
+   _ecore_drm2_display_rotation_get(disp);
+
    /* get backlight values */
    _ecore_drm2_display_backlight_get(disp);
 
@@ -394,7 +454,7 @@ _ecore_drm2_display_state_fill(Ecore_Drm2_Display *disp)
    _ecore_drm2_display_modes_get(disp);
 
    /* get gamma from crtc */
-   disp->gamma = disp->crtc->drmCrtc->gamma_size;
+   dstate->gamma = disp->crtc->drmCrtc->gamma_size;
 
    /* get connected state */
    disp->connected = (disp->conn->drmConn->connection == DRM_MODE_CONNECTED);
@@ -454,7 +514,6 @@ _ecore_drm2_displays_create(Ecore_Drm2_Device *dev)
    /* go through list of connectors and create displays */
    EINA_LIST_FOREACH(dev->conns, l, c)
      {
-        Ecore_Drm2_Plane *plane;
         drmModeEncoder *encoder;
         drmModeCrtc *dcrtc;
 
@@ -475,6 +534,8 @@ _ecore_drm2_displays_create(Ecore_Drm2_Device *dev)
              goto cont;
           }
 
+        disp->dev = dev;
+
         /* try to find crtc matching dcrtc->crtc_id and assign to display */
         EINA_LIST_FOREACH(dev->crtcs, ll, crtc)
           {
@@ -485,46 +546,6 @@ _ecore_drm2_displays_create(Ecore_Drm2_Device *dev)
                }
           }
 
-        /* try to find primary plane for this display */
-        plane = _ecore_drm2_planes_primary_find(dev, disp->crtc->id);
-        if (plane)
-          {
-             if (plane->state)
-               disp->rotation = plane->state->rotation.value;
-             else
-               {
-                  drmModeObjectPropertiesPtr oprops;
-
-                  /* NB: Sadly we cannot rely on plane->state being already filled
-                   * by the time we reach this (due to threading), so we will query
-                   * the plane properties we want directly */
-
-                  /* query plane for rotations */
-                  oprops =
-                    sym_drmModeObjectGetProperties(plane->fd,
-                                                   plane->drmPlane->plane_id,
-                                                   DRM_MODE_OBJECT_PLANE);
-                  if (oprops)
-                    {
-                       unsigned int i = 0;
-
-                       for (; i < oprops->count_props; i++)
-                         {
-                            drmModePropertyPtr prop;
-
-                            prop = sym_drmModeGetProperty(plane->fd, oprops->props[i]);
-                            if (!prop) continue;
-
-                            if (!strcmp(prop->name, "rotation"))
-                              disp->rotation = oprops->prop_values[i];
-
-                            sym_drmModeFreeProperty(prop);
-                         }
-                       sym_drmModeFreeObjectProperties(oprops);
-                    }
-               }
-          }
-
         sym_drmModeFreeCrtc(dcrtc);
 
         disp->fd = dev->fd;
@@ -557,6 +578,8 @@ _ecore_drm2_displays_destroy(Ecore_Drm2_Device *dev)
         eina_stringshare_del(disp->model);
         eina_stringshare_del(disp->make);
         eina_stringshare_del(disp->name);
+        free(disp->state.pending);
+        free(disp->state.current);
         free(disp);
      }
 
@@ -589,6 +612,8 @@ ecore_drm2_display_mode_set(Ecore_Drm2_Display *disp, Ecore_Drm2_Display_Mode *m
    EINA_SAFETY_ON_NULL_RETURN(disp);
    EINA_SAFETY_ON_NULL_RETURN(mode);
    EINA_SAFETY_ON_NULL_RETURN(disp->crtc);
+
+   /* TODO, FIXME */
 }
 
 EAPI Eina_Bool
@@ -637,14 +662,14 @@ ecore_drm2_display_dpms_get(Ecore_Drm2_Display *disp)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(disp, -1);
    EINA_SAFETY_ON_NULL_RETURN_VAL(disp->conn, -1);
-   return disp->conn->state->dpms.value;
+   return disp->conn->state.current->dpms.value;
 }
 
 EAPI Eina_Bool
 ecore_drm2_display_enabled_get(Ecore_Drm2_Display *disp)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(disp, EINA_FALSE);
-   return disp->enabled;
+   return disp->state.current->enabled;
 }
 
 EAPI unsigned int
@@ -664,9 +689,9 @@ ecore_drm2_display_edid_get(Ecore_Drm2_Display *disp)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(disp, NULL);
    EINA_SAFETY_ON_NULL_RETURN_VAL(disp->conn, NULL);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(disp->conn->state, NULL);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(disp->conn->state.current, NULL);
 
-   blob = disp->conn->state->edid.data;
+   blob = disp->conn->state.current->edid.data;
    if (!blob)
      {
         memset(fblob, 0, sizeof(fblob));
@@ -718,14 +743,15 @@ EAPI Eina_Bool
 ecore_drm2_display_primary_get(Ecore_Drm2_Display *disp)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(disp, EINA_FALSE);
-   return disp->primary;
+   return disp->state.current->primary;
 }
 
 EAPI void
 ecore_drm2_display_primary_set(Ecore_Drm2_Display *disp, Eina_Bool primary)
 {
    EINA_SAFETY_ON_NULL_RETURN(disp);
-   disp->primary = primary;
+   if (disp->state.current->primary == primary) return;
+   /* TODO, FIXME */
 }
 
 EAPI const Eina_List *
@@ -745,32 +771,43 @@ ecore_drm2_display_info_get(Ecore_Drm2_Display *disp, int *x, int *y, int *w, in
    if (refresh) *refresh = 0;
 
    EINA_SAFETY_ON_NULL_RETURN(disp);
-   EINA_SAFETY_ON_TRUE_RETURN(!disp->current_mode);
+   EINA_SAFETY_ON_TRUE_RETURN(!disp->state.current->mode);
 
    if (x) *x = disp->x;
    if (y) *y = disp->y;
 
-   switch (disp->rotation)
+   switch (disp->state.current->rotation)
      {
       case ECORE_DRM2_ROTATION_90:
       case ECORE_DRM2_ROTATION_270:
-        if (w) *w = disp->current_mode->height;
-        if (h) *h = disp->current_mode->width;
+        if (w) *w = disp->state.current->mode->height;
+        if (h) *h = disp->state.current->mode->width;
         break;
       case ECORE_DRM2_ROTATION_NORMAL:
       case ECORE_DRM2_ROTATION_180:
       default:
-        if (w) *w = disp->current_mode->width;
-        if (h) *h = disp->current_mode->height;
+        if (w) *w = disp->state.current->mode->width;
+        if (h) *h = disp->state.current->mode->height;
         break;
      }
 
-   if (refresh) *refresh = disp->current_mode->refresh;
+   if (refresh) *refresh = disp->state.current->mode->refresh;
 }
 
 EAPI int
 ecore_drm2_display_rotation_get(Ecore_Drm2_Display *disp)
 {
    EINA_SAFETY_ON_NULL_RETURN_VAL(disp, -1);
-   return disp->rotation;
+   return disp->state.current->rotation;
+}
+
+EAPI Eina_Bool
+ecore_drm2_display_rotation_set(Ecore_Drm2_Display *disp, uint64_t rotation)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(disp, EINA_FALSE);
+
+   if (disp->state.current->rotation == rotation) return EINA_TRUE;
+
+   /* TODO, FIXME */
+   return EINA_FALSE;
 }
diff --git a/src/lib/ecore_drm2/ecore_drm2_planes.c b/src/lib/ecore_drm2/ecore_drm2_planes.c
index cf26f0b4e4..20989f0414 100644
--- a/src/lib/ecore_drm2/ecore_drm2_planes.c
+++ b/src/lib/ecore_drm2/ecore_drm2_planes.c
@@ -23,10 +23,10 @@ static void
 _ecore_drm2_plane_state_debug(Ecore_Drm2_Plane *plane)
 {
    DBG("Plane Atomic State Fill Complete");
-   DBG("\tPlane: %d", plane->state->obj_id);
-   DBG("\t\tCrtc: %lu", (long)plane->state->cid.value);
-   DBG("\t\tFB: %lu", (long)plane->state->fid.value);
-   switch (plane->state->type.value)
+   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);
+   switch (plane->state.current->type.value)
      {
       case DRM_PLANE_TYPE_OVERLAY:
         DBG("\t\tType: Overlay Plane");
@@ -40,9 +40,9 @@ _ecore_drm2_plane_state_debug(Ecore_Drm2_Plane *plane)
       default:
         break;
      }
-   DBG("\t\tZPos: %lu", (long)plane->state->zpos.value);
-   DBG("\t\t\tMin: %lu", (long)plane->state->zpos.min);
-   DBG("\t\t\tMax: %lu", (long)plane->state->zpos.max);
+   DBG("\t\tZPos: %lu", (long)plane->state.current->zpos.value);
+   DBG("\t\t\tMin: %lu", (long)plane->state.current->zpos.min);
+   DBG("\t\t\tMax: %lu", (long)plane->state.current->zpos.max);
 }
 
 static void
@@ -53,15 +53,15 @@ _ecore_drm2_plane_state_fill(Ecore_Drm2_Plane *plane)
    drmModePlanePtr p;
    unsigned int i = 0;
 
-   plane->state = calloc(1, sizeof(Ecore_Drm2_Plane_State));
-   if (!plane->state)
+   plane->state.current = calloc(1, sizeof(Ecore_Drm2_Plane_State));
+   if (!plane->state.current)
      {
         ERR("Could not allocate space for plane state");
         return;
      }
 
    p = plane->drmPlane;
-   pstate = plane->state;
+   pstate = plane->state.current;
 
    pstate->obj_id = plane->id;
    pstate->mask = p->possible_crtcs;
@@ -320,7 +320,8 @@ _ecore_drm2_planes_destroy(Ecore_Drm2_Device *dev)
      {
         if (plane->thread) ecore_thread_cancel(plane->thread);
         if (plane->drmPlane) sym_drmModeFreePlane(plane->drmPlane);
-        free(plane->state);
+        free(plane->state.pending);
+        free(plane->state.current);
         free(plane);
      }
 
@@ -345,7 +346,7 @@ _ecore_drm2_planes_primary_find(Ecore_Drm2_Device *dev, unsigned int crtc_id)
      {
         Ecore_Drm2_Plane_State *pstate;
 
-        pstate = plane->state;
+        pstate = plane->state.current;
         if (pstate)
           {
              if (pstate->type.value != DRM_PLANE_TYPE_PRIMARY) continue;
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index f5eaac376f..ea1e5d6d5b 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -165,6 +165,18 @@ typedef struct _Ecore_Drm2_Plane_State
    Eina_Bool in_use : 1;
 } Ecore_Drm2_Plane_State;
 
+typedef struct _Ecore_Drm2_Display_State
+{
+   uint16_t gamma;
+   uint64_t rotation;
+   double backlight;
+
+   Ecore_Drm2_Display_Mode *mode;
+
+   Eina_Bool primary : 1;
+   Eina_Bool enabled : 1;
+} Ecore_Drm2_Display_State;
+
 /* opaque API structures */
 struct _Ecore_Drm2_Plane
 {
@@ -173,7 +185,11 @@ struct _Ecore_Drm2_Plane
 
    drmModePlanePtr drmPlane;
 
-   Ecore_Drm2_Plane_State *state;
+   struct
+     {
+        Ecore_Drm2_Plane_State *current;
+        Ecore_Drm2_Plane_State *pending;
+     } state;
 
    Ecore_Thread *thread;
 };
@@ -194,10 +210,8 @@ struct _Ecore_Drm2_Display
    Eina_Stringshare *name, *make, *model, *serial;
 
    uint32_t subpixel;
-   uint16_t gamma;
 
    uint32_t supported_rotations;
-   uint64_t rotation;
 
    struct
      {
@@ -210,20 +224,24 @@ struct _Ecore_Drm2_Display
    struct
      {
         const char *path;
-        double value, max;
+        double max;
         Ecore_Drm2_Backlight_Type type;
      } backlight;
 
+   struct
+     {
+        Ecore_Drm2_Display_State *current;
+        Ecore_Drm2_Display_State *pending;
+     } state;
+
+   Ecore_Drm2_Device *dev;
    Ecore_Drm2_Crtc *crtc;
    Ecore_Drm2_Connector *conn;
 
    Eina_List *modes;
-   Ecore_Drm2_Display_Mode *current_mode;
 
    Ecore_Thread *thread;
 
-   Eina_Bool primary : 1;
-   Eina_Bool enabled : 1;
    Eina_Bool connected : 1;
 };
 
@@ -235,7 +253,11 @@ struct _Ecore_Drm2_Connector
 
    drmModeConnector *drmConn;
 
-   Ecore_Drm2_Connector_State *state;
+   struct
+     {
+        Ecore_Drm2_Connector_State *current;
+        Ecore_Drm2_Connector_State *pending;
+     } state;
 
    Ecore_Thread *thread;
 
@@ -252,7 +274,11 @@ struct _Ecore_Drm2_Crtc
 
    /* TODO: store FBs */
 
-   Ecore_Drm2_Crtc_State *state;
+   struct
+     {
+        Ecore_Drm2_Crtc_State *current;
+        Ecore_Drm2_Crtc_State *pending;
+     } state;
 
    Ecore_Thread *thread;
 };
diff --git a/src/lib/ecore_drm2/meson.build b/src/lib/ecore_drm2/meson.build
index eb775fac60..71b0bce3c9 100644
--- a/src/lib/ecore_drm2/meson.build
+++ b/src/lib/ecore_drm2/meson.build
@@ -7,9 +7,9 @@ ecore_drm2_header_src = [
 ]
 
 ecore_drm2_src = files([
-  'ecore_drm2_planes.c',
   'ecore_drm2_displays.c',
   'ecore_drm2_connectors.c',
+  'ecore_drm2_planes.c',
   'ecore_drm2_crtcs.c',
   'ecore_drm2_device.c',
   'ecore_drm2.c',

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

Reply via email to