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 14f9d2dd1ee89e346428248fcaded2e6452cfb83
Author: Christopher Michael <[email protected]>
AuthorDate: Sat Sep 6 08:16:56 2025 -0500

    ecore_drm2: Fix setting display crtc position
---
 src/lib/ecore_drm2/ecore_drm2_crtcs.c    | 39 ++++++++++++++++++++------------
 src/lib/ecore_drm2/ecore_drm2_displays.c |  4 +---
 src/lib/ecore_drm2/ecore_drm2_private.h  |  5 ++--
 3 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/src/lib/ecore_drm2/ecore_drm2_crtcs.c b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
index c32b715251..98445a81ab 100644
--- a/src/lib/ecore_drm2/ecore_drm2_crtcs.c
+++ b/src/lib/ecore_drm2/ecore_drm2_crtcs.c
@@ -311,26 +311,22 @@ err:
 }
 
 Eina_Bool
-_ecore_drm2_crtcs_position_set(Ecore_Drm2_Crtc *crtc, uint32_t conn_id, int x, int y)
+_ecore_drm2_crtcs_position_set(Ecore_Drm2_Crtc *crtc, int x, int y)
 {
-   drmModeCrtcPtr cptr;
-   int ret;
+   Ecore_Drm2_Crtc_State *cstate, *pstate;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(crtc, EINA_FALSE);
 
-   cptr = sym_drmModeGetCrtc(crtc->fd, crtc->id);
-   if (!cptr) return EINA_FALSE;
+   cstate = crtc->state.current;
+   pstate = crtc->state.pending;
 
-   ret = sym_drmModeSetCrtc(crtc->fd, crtc->id, cptr->buffer_id, x, y,
-                            &conn_id, 1, &cptr->mode);
-   if (ret)
+   if ((cstate->x != x) || (cstate->y != y))
      {
-        ERR("Failed to set Crtc Position: %m");
-        sym_drmModeFreeCrtc(cptr);
-        return EINA_FALSE;
+        pstate->x = x;
+        pstate->y = y;
+        pstate->changes |= ECORE_DRM2_CRTC_STATE_POSITION;
      }
 
-   sym_drmModeFreeCrtc(cptr);
    return EINA_TRUE;
 }
 
@@ -357,6 +353,12 @@ _ecore_drm2_crtcs_changes_apply(Ecore_Drm2_Crtc *crtc)
           pstate->changes &= ~ECORE_DRM2_CRTC_STATE_ACTIVE;
      }
 
+   if (pstate->changes & ECORE_DRM2_CRTC_STATE_POSITION)
+     {
+        /* No-op change */
+        pstate->changes &= ~ECORE_DRM2_CRTC_STATE_POSITION;
+     }
+
    /* copy pending state to current on success */
    memcpy(cstate, pstate, sizeof(Ecore_Drm2_Crtc_State));
 
@@ -370,6 +372,7 @@ EAPI void
 ecore_drm2_crtc_geometry_get(Ecore_Drm2_Crtc *crtc, int *x, int *y, int *w, int *h)
 {
    drmModeCrtcPtr cptr;
+   Ecore_Drm2_Crtc_State *cstate;
 
    if (x) *x = 0;
    if (y) *y = 0;
@@ -379,10 +382,16 @@ ecore_drm2_crtc_geometry_get(Ecore_Drm2_Crtc *crtc, int *x, int *y, int *w, int
    EINA_SAFETY_ON_NULL_RETURN(crtc);
 
    cptr = sym_drmModeGetCrtc(crtc->fd, crtc->id);
-   if (!cptr) return;
+   if (!cptr)
+     {
+        ERR("Could Not Get Crtc: %d %m", crtc->id);
+        return;
+     }
 
-   if (x) *x = cptr->x;
-   if (y) *y = cptr->y;
+   cstate = crtc->state.current;
+
+   if (x) *x = cstate->x;
+   if (y) *y = cstate->y;
    if (w) *w = cptr->width;
    if (h) *h = cptr->height;
 
diff --git a/src/lib/ecore_drm2/ecore_drm2_displays.c b/src/lib/ecore_drm2/ecore_drm2_displays.c
index a35036c033..36bd278404 100644
--- a/src/lib/ecore_drm2/ecore_drm2_displays.c
+++ b/src/lib/ecore_drm2/ecore_drm2_displays.c
@@ -1513,14 +1513,12 @@ ecore_drm2_display_changes_apply(Ecore_Drm2_Display *disp)
    if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_PRIMARY)
      {
 	/* No-op change */
-        cstate->primary = pstate->primary;
 	pstate->changes &= ~ECORE_DRM2_DISPLAY_STATE_PRIMARY;
      }
 
    if (pstate->changes & ECORE_DRM2_DISPLAY_STATE_POSITION)
      {
-        if (_ecore_drm2_crtcs_position_set(disp->crtc, disp->conn->id,
-                                           pstate->x, pstate->y))
+        if (_ecore_drm2_crtcs_position_set(disp->crtc, pstate->x, pstate->y))
           pstate->changes &= ~ECORE_DRM2_DISPLAY_STATE_POSITION;
      }
 
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 242b363dd2..b46517775b 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -88,6 +88,7 @@ typedef enum _Ecore_Drm2_Crtc_State_Changes
 {
    ECORE_DRM2_CRTC_STATE_ACTIVE = (1 << 0),
    ECORE_DRM2_CRTC_STATE_MODE = (1 << 1),
+   ECORE_DRM2_CRTC_STATE_POSITION = (1 << 2),
 } Ecore_Drm2_Crtc_State_Changes;
 
 typedef enum _Ecore_Drm2_Plane_State_Changes
@@ -163,7 +164,7 @@ typedef struct _Ecore_Drm2_Connector_State
 typedef struct _Ecore_Drm2_Crtc_State
 {
    uint32_t obj_id, changes;
-   /* int index; */
+   int x, y;
    Ecore_Drm2_Atomic_Property active;
    Ecore_Drm2_Atomic_Blob mode;
 
@@ -397,7 +398,7 @@ Eina_Bool _ecore_drm2_crtcs_create(Ecore_Drm2_Device *dev);
 void _ecore_drm2_crtcs_destroy(Ecore_Drm2_Device *dev);
 Eina_Bool _ecore_drm2_crtcs_mode_set(Ecore_Drm2_Crtc *crtc);
 Eina_Bool _ecore_drm2_crtcs_changes_apply(Ecore_Drm2_Crtc *crtc);
-Eina_Bool _ecore_drm2_crtcs_position_set(Ecore_Drm2_Crtc *crtc, uint32_t conn_id, int x, int y);
+Eina_Bool _ecore_drm2_crtcs_position_set(Ecore_Drm2_Crtc *crtc, int x, int y);
 
 Eina_Bool _ecore_drm2_connectors_create(Ecore_Drm2_Device *dev);
 void _ecore_drm2_connectors_destroy(Ecore_Drm2_Device *dev);

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

Reply via email to