ecore_drm2: Assign planes in ecore_drm2_plane_assign
authorDerek Foreman <derekf@osg.samsung.com>
Thu, 27 Apr 2017 20:44:22 +0000 (15:44 -0500)
committerDerek Foreman <derekf@osg.samsung.com>
Fri, 5 May 2017 17:53:21 +0000 (12:53 -0500)
Don't just test, allocate the resource, and then prevent further
assignments from trying to use it as well.

src/lib/ecore_drm2/ecore_drm2_plane.c
src/lib/ecore_drm2/ecore_drm2_private.h

index 044fd57..e029439 100644 (file)
@@ -50,6 +50,9 @@ ecore_drm2_plane_assign(Ecore_Drm2_Output *output, Ecore_Drm2_Fb *fb)
    /* use algo based on format, size, etc to find a plane this FB can go in */
    EINA_LIST_FOREACH(output->plane_states, l, pstate)
      {
+        if (pstate->in_use)
+          continue;
+
         /* test if this plane supports the given format */
         if (!_plane_format_supported(pstate, fb->format))
           continue;
@@ -90,6 +93,7 @@ out:
    plane = calloc(1, sizeof(Ecore_Drm2_Plane));
    if (!plane) return NULL;
 
+   pstate->in_use = EINA_TRUE;
    pstate->cid.value = output->crtc_id;
    pstate->fid.value = fb->id;
 
index cdd19d5..8d3b0a9 100644 (file)
@@ -651,6 +651,8 @@ typedef struct _Ecore_Drm2_Plane_State
 
    uint32_t num_formats;
    uint32_t *formats;
+
+   Eina_Bool in_use;
 } Ecore_Drm2_Plane_State;
 
 struct _Ecore_Drm2_Atomic_State