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 4bfbfd36b01846ca3c79fdf058533d578cfb2627
Author: Christopher Michael <[email protected]>
AuthorDate: Sun Aug 17 10:18:54 2025 -0500

    ecore_drm2: Start work on iterating plane IN_FORMATS property
---
 src/lib/ecore_drm2/ecore_drm2.c         |  2 ++
 src/lib/ecore_drm2/ecore_drm2_planes.c  | 48 +++++++++++++++++++++++++++++----
 src/lib/ecore_drm2/ecore_drm2_private.h |  3 ++-
 3 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/src/lib/ecore_drm2/ecore_drm2.c b/src/lib/ecore_drm2/ecore_drm2.c
index 7c47ff62e6..b435c63733 100644
--- a/src/lib/ecore_drm2/ecore_drm2.c
+++ b/src/lib/ecore_drm2/ecore_drm2.c
@@ -45,6 +45,7 @@ int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint3
 int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue);
 int (*sym_drmModeConnectorSetProperty)(int fd, uint32_t connector_id, uint32_t property_id, uint64_t value);
 int (*sym_drmModeSetPlane)(int fd, uint32_t plane_id, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, int32_t crtc_x, int32_t crtc_y, uint32_t crtc_w, uint32_t crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h);
+bool (*sym_drmModeFormatModifierBlobIterNext)(const drmModePropertyBlobRes *blob, drmModeFormatModifierIterator *iter);
 
 EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1;
 
@@ -119,6 +120,7 @@ _ecore_drm2_link(void)
 	SYM(_drm_lib, drmModeCrtcSetGamma);
 	SYM(_drm_lib, drmModeConnectorSetProperty);
         SYM(_drm_lib, drmModeSetPlane);
+        SYM(_drm_lib, drmModeFormatModifierBlobIterNext);
 
         if (fail)
           {
diff --git a/src/lib/ecore_drm2/ecore_drm2_planes.c b/src/lib/ecore_drm2/ecore_drm2_planes.c
index f887be2dd8..4bc67e3dd3 100644
--- a/src/lib/ecore_drm2/ecore_drm2_planes.c
+++ b/src/lib/ecore_drm2/ecore_drm2_planes.c
@@ -52,6 +52,7 @@ _ecore_drm2_plane_state_fill(Ecore_Drm2_Plane *plane)
    drmModeObjectPropertiesPtr oprops;
    drmModePlanePtr p;
    unsigned int i = 0;
+   Eina_Bool in_formats = EINA_FALSE;
 
    plane->state.current = calloc(1, sizeof(Ecore_Drm2_Plane_State));
    if (!plane->state.current)
@@ -65,11 +66,6 @@ _ecore_drm2_plane_state_fill(Ecore_Drm2_Plane *plane)
 
    pstate->obj_id = plane->id;
    pstate->mask = p->possible_crtcs;
-   pstate->num_formats = p->count_formats;
-
-   pstate->formats = calloc(p->count_formats, sizeof(uint32_t));
-   for (; i < p->count_formats; i++)
-     pstate->formats[i] = p->formats[i];
 
    /* try to fill get drm properties of this plane */
    oprops =
@@ -199,10 +195,52 @@ _ecore_drm2_plane_state_fill(Ecore_Drm2_Plane *plane)
           }
         else if (!strcmp(prop->name, "FB_DAMAGE_CLIPS"))
           pstate->fb_dmg_clips.id = prop->prop_id;
+        else if (!strcmp(prop->name, "IN_FORMATS"))
+          {
+             drmModePropertyBlobPtr bp;
+             drmModeFormatModifierIterator iter = {0};
+             uint32_t prev = DRM_FORMAT_INVALID;
+             int f = 0;
 
+             pstate->in_formats.id = oprops->prop_values[i];
+
+             bp = sym_drmModeGetPropertyBlob(plane->fd, pstate->in_formats.id);
+             if (!bp) goto cont;
+
+             pstate->num_formats = (bp->length / sizeof(uint32_t));
+             pstate->formats = calloc(pstate->num_formats, sizeof(uint32_t));
+
+             while (sym_drmModeFormatModifierBlobIterNext(bp, &iter))
+               {
+                  if (prev != iter.fmt)
+                    {
+                       pstate->formats[f] = iter.fmt;
+                       f++;
+                       prev = iter.fmt;
+                    }
+               }
+
+             /* TODO: add modifier */
+
+             in_formats = EINA_TRUE;
+
+             sym_drmModeFreePropertyBlob(bp);
+          }
+
+cont:
         sym_drmModeFreeProperty(prop);
      }
 
+   /* if this plane does not support IN_FORMATS property, than use the 
+    * old fallback to fill in formats */
+   if (!in_formats)
+     {
+        pstate->num_formats = p->count_formats;
+        pstate->formats = calloc(p->count_formats, sizeof(uint32_t));
+        for (; i < p->count_formats; i++)
+          pstate->formats[i] = p->formats[i];
+     }
+
    sym_drmModeFreeObjectProperties(oprops);
 
    /* duplicate current state into pending so we can handle changes */
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 7985b24179..0d7c1dd286 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -183,10 +183,10 @@ typedef struct _Ecore_Drm2_Plane_State
    Ecore_Drm2_Atomic_Property rotation;
    Ecore_Drm2_Atomic_Range zpos;
    Ecore_Drm2_Atomic_Blob fb_dmg_clips;
+   Ecore_Drm2_Atomic_Blob in_formats;
 
    /* TODO ?? */
    /* Ecore_Drm2_Atomic_Property IN_FENCE_FD; */
-   /* Ecore_Drm2_Atomic_Property IN_FORMATS; */
    /* Ecore_Drm2_Atomic_Property COLOR_ENCODING; */
    /* Ecore_Drm2_Atomic_Property COLOR_RANGE; */
 
@@ -440,5 +440,6 @@ extern int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips
 extern int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue);
 extern int (*sym_drmModeConnectorSetProperty)(int fd, uint32_t connector_id, uint32_t property_id, uint64_t value);
 extern int (*sym_drmModeSetPlane)(int fd, uint32_t plane_id, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, int32_t crtc_x, int32_t crtc_y, uint32_t crtc_w, uint32_t crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h);
+extern bool (*sym_drmModeFormatModifierBlobIterNext)(const drmModePropertyBlobRes *blob, drmModeFormatModifierIterator *iter);
 
 #endif

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

Reply via email to