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 7c3953647d0321c8724ebf14527a11c0c8c95b58
Author: Christopher Michael <devilho...@comcast.net>
AuthorDate: Fri Aug 8 14:35:31 2025 -0500

    ecore_drm2: Start work on setting up planes during display creation
    
    This patch starts to add support for setting up planes during display
    creation. Currently only supports primary & cursor planes. It also
    slightly modifies the function used to find primary planes so that the
    same function can also be used to find overylay, cursor, etc planes
---
 src/lib/ecore_drm2/ecore_drm2_displays.c | 102 +++++++++++++++++++++----------
 src/lib/ecore_drm2/ecore_drm2_planes.c   |  10 +--
 src/lib/ecore_drm2/ecore_drm2_private.h  |  10 ++-
 3 files changed, 83 insertions(+), 39 deletions(-)

diff --git a/src/lib/ecore_drm2/ecore_drm2_displays.c b/src/lib/ecore_drm2/ecore_drm2_displays.c
index 132c68fb69..9b2c05cb23 100644
--- a/src/lib/ecore_drm2/ecore_drm2_displays.c
+++ b/src/lib/ecore_drm2/ecore_drm2_displays.c
@@ -351,43 +351,48 @@ _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)
+   plane = disp->planes.primary;
+   if (!plane)
      {
-        if (plane->state.current)
-          disp->state.current->rotation = plane->state.current->rotation.value;
-        else
+        /* try to find primary plane for this display */
+        plane = _ecore_drm2_planes_find(disp->dev, disp->crtc->id,
+                                        DRM_PLANE_TYPE_PRIMARY);
+     }
+
+   if (!plane) return;
+
+   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)
           {
-             drmModeObjectPropertiesPtr oprops;
+             unsigned int i = 0;
 
-             /* 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)
+             for (; i < oprops->count_props; i++)
                {
-                  unsigned int i = 0;
+                  drmModePropertyPtr prop;
 
-                  for (; i < oprops->count_props; i++)
-                    {
-                       drmModePropertyPtr prop;
+                  prop = sym_drmModeGetProperty(plane->fd, oprops->props[i]);
+                  if (!prop) continue;
 
-                       prop = sym_drmModeGetProperty(plane->fd, oprops->props[i]);
-                       if (!prop) continue;
+                  if (!strcmp(prop->name, "rotation"))
+                    disp->state.current->rotation = oprops->prop_values[i];
 
-                       if (!strcmp(prop->name, "rotation"))
-                         disp->state.current->rotation = oprops->prop_values[i];
-
-                       sym_drmModeFreeProperty(prop);
-                    }
-                  sym_drmModeFreeObjectProperties(oprops);
+                  sym_drmModeFreeProperty(prop);
                }
+             sym_drmModeFreeObjectProperties(oprops);
           }
      }
 }
@@ -566,6 +571,31 @@ _ecore_drm2_possible_crtcs_find(Ecore_Drm2_Device *dev, uint32_t enc_crtc_id)
    return NULL;
 }
 
+static void
+_ecore_drm2_displays_planes_init(Ecore_Drm2_Display *disp)
+{
+   if (!disp->planes.primary)
+     {
+        disp->planes.primary =
+          _ecore_drm2_planes_find(disp->dev, disp->crtc->id,
+                                  DRM_PLANE_TYPE_PRIMARY);
+     }
+
+   if (!disp->planes.overlay)
+     {
+        /* TODO */
+     }
+
+   if (!disp->planes.cursor)
+     {
+        disp->planes.cursor =
+          _ecore_drm2_planes_find(disp->dev, disp->crtc->id,
+                                  DRM_PLANE_TYPE_CURSOR);
+     }
+
+   disp->dev->hw_cursor = (disp->planes.cursor != NULL);
+}
+
 Ecore_Drm2_Crtc *
 _ecore_drm2_displays_crtc_find(Ecore_Drm2_Display *disp, Ecore_Drm2_Connector *conn, uint32_t enc_crtc_id)
 {
@@ -664,7 +694,8 @@ _ecore_drm2_displays_create(Ecore_Drm2_Device *dev)
         /* disp->fd = dev->fd; */
         disp->conn = c;
 
-        /* TODO: init planes */
+        _ecore_drm2_displays_planes_init(disp);
+
         /* TODO: init gamma size */
         /* TODO: init backlight */
 
@@ -1082,9 +1113,14 @@ ecore_drm2_display_supported_rotations_get(Ecore_Drm2_Display *disp)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(disp, -1);
 
-   /* get the primary plane for this output */
-   plane = _ecore_drm2_planes_primary_find(disp->dev, disp->crtc->id);
-   if (!plane) return -1;
+   plane = disp->planes.primary;
+   if (!plane)
+     {
+        /* get the primary plane for this output */
+        plane = _ecore_drm2_planes_find(disp->dev, disp->crtc->id,
+                                        DRM_PLANE_TYPE_PRIMARY);
+        if (!plane) return -1;
+     }
 
    /* if plane state has not been filled yet, bail out */
    /* NB: We could modify this to get the plane rotations directly from drm */
diff --git a/src/lib/ecore_drm2/ecore_drm2_planes.c b/src/lib/ecore_drm2/ecore_drm2_planes.c
index 5a8065cc9b..7966cc80aa 100644
--- a/src/lib/ecore_drm2/ecore_drm2_planes.c
+++ b/src/lib/ecore_drm2/ecore_drm2_planes.c
@@ -338,7 +338,7 @@ _ecore_drm2_planes_destroy(Ecore_Drm2_Device *dev)
 }
 
 Ecore_Drm2_Plane *
-_ecore_drm2_planes_primary_find(Ecore_Drm2_Device *dev, unsigned int crtc_id)
+_ecore_drm2_planes_find(Ecore_Drm2_Device *dev, unsigned int crtc_id, uint64_t type)
 {
    drmModeObjectPropertiesPtr oprops;
    Ecore_Drm2_Plane *plane;
@@ -354,13 +354,13 @@ _ecore_drm2_planes_primary_find(Ecore_Drm2_Device *dev, unsigned int crtc_id)
         pstate = plane->state.current;
         if (pstate)
           {
-             if (pstate->type.value != DRM_PLANE_TYPE_PRIMARY) continue;
+             if (pstate->type.value != type) continue;
              if (pstate->cid.value != crtc_id) continue;
              return plane;
           }
         else
           {
-             uint64_t cid = 0, type = 0;
+             uint64_t cid = 0, ptype = 0;
 
              /* We need to manually query plane properties here as
               * plane->state.current may not be filled yet due to threading */
@@ -380,14 +380,14 @@ _ecore_drm2_planes_primary_find(Ecore_Drm2_Device *dev, unsigned int crtc_id)
                   if (!strcmp(prop->name, "CRTC_ID"))
                     cid = oprops->prop_values[i];
                   else if (!strcmp(prop->name, "type"))
-                    type = oprops->prop_values[i];
+                    ptype = oprops->prop_values[i];
 
                   sym_drmModeFreeProperty(prop);
                }
 
              sym_drmModeFreeObjectProperties(oprops);
 
-             if (type != DRM_PLANE_TYPE_PRIMARY) continue;
+             if (ptype != type) continue;
              if (cid != crtc_id) continue;
 
              return plane;
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 64a1cbb0c2..ef49426151 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -297,6 +297,13 @@ struct _Ecore_Drm2_Display
    Ecore_Drm2_Crtc *crtc;
    Ecore_Drm2_Connector *conn;
 
+   struct
+     {
+        Ecore_Drm2_Plane *primary;
+        Ecore_Drm2_Plane *overlay;
+        Ecore_Drm2_Plane *cursor;
+     } planes;
+
    Eina_List *modes;
 
    Ecore_Thread *thread;
@@ -368,6 +375,7 @@ struct _Ecore_Drm2_Device
    Eina_Bool atomic : 1;
    /* Eina_Bool gbm_mods : 1; */
    Eina_Bool aspect_ratio : 1;
+   Eina_Bool hw_cursor : 1;
 };
 
 /* internal function prototypes */
@@ -386,7 +394,7 @@ void _ecore_drm2_displays_destroy(Ecore_Drm2_Device *dev);
 
 Eina_Bool _ecore_drm2_planes_create(Ecore_Drm2_Device *dev);
 void _ecore_drm2_planes_destroy(Ecore_Drm2_Device *dev);
-Ecore_Drm2_Plane *_ecore_drm2_planes_primary_find(Ecore_Drm2_Device *dev, unsigned int crtc_id);
+Ecore_Drm2_Plane *_ecore_drm2_planes_find(Ecore_Drm2_Device *dev, unsigned int crtc_id, uint64_t type);
 
 /* external drm function prototypes (for dlopen) */
 extern int (*sym_drmIoctl)(int fd, unsigned long request, void *arg);

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

Reply via email to