feature_en: enumerate plane zpos for virtual planes as well
authorSubhajit Paul <subhajit_paul@ti.com>
Thu, 4 Jul 2019 10:49:04 +0000 (16:19 +0530)
committerSubhajit Paul <subhajit_paul@ti.com>
Thu, 4 Jul 2019 11:09:42 +0000 (16:39 +0530)
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
drm_util.c

index f47e96205c5d1963d2b1a26fb8172336e9d7e133..34f3c0ca638ba1a45f3529efd54afb3b174fea00 100644 (file)
@@ -80,6 +80,39 @@ err1:
        return -1;
 }
 
+static int get_zorder(int fd, uint32_t plane_id)
+{
+       int i, r;
+       drmModeObjectPropertiesPtr props = NULL;
+
+       props = drmModeObjectGetProperties(fd, plane_id, DRM_MODE_OBJECT_PLANE);
+       if(!props) {
+               printf("drmModeObjectGetProperties for plane %u failed\n", plane_id);
+               return -1;
+       }
+
+       for(i = 0; i < props->count_props; i++) {
+               drmModePropertyPtr prop = drmModeGetProperty(fd, props->props[i]);
+               if(!prop) {
+                       printf("getting prop = %u for plane %u failed\n", props->props[i], plane_id);
+                       drmModeFreeObjectProperties(props);
+                       return -1;
+               }
+               if(strcmp("zpos", prop->name) == 0) {
+                       r = props->prop_values[i];
+                       drmModeFreeProperty(prop);
+                       drmModeFreeObjectProperties(props);
+                       return r;
+               }
+               drmModeFreeProperty(prop);
+
+       }
+       printf("could not find property zpos for plane = %u\n", plane_id);
+       drmModeFreeObjectProperties(props);
+
+       return -1;
+}
+
 static int add_property(int fd, drmModeAtomicReqPtr req, uint32_t id, uint32_t type, char *prop_name, uint64_t value)
 {
        int i, r;
@@ -347,7 +380,7 @@ static int drm_get_new_plane(int zorder)
                if(occupied) 
                        continue;
 
-               if(true /*zorder check here!!! but broken right now*/ )
+               if(get_zorder(drm.fd, plane->plane_id) == zorder)
                        break;
        }