ecore-drm2: Don't fill device atomic state if atomic is disabled
authorChris Michael <cp.michael@samsung.com>
Tue, 30 May 2017 15:01:22 +0000 (11:01 -0400)
committerChris Michael <cp.michael@samsung.com>
Tue, 30 May 2017 15:01:22 +0000 (11:01 -0400)
If atomic support is disabled (via kernel or env var), then we do not
need to fill device atomic state as it will not be used anyway.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_drm2/ecore_drm2_device.c

index 73805c8..41d2128 100644 (file)
@@ -639,9 +639,12 @@ ecore_drm2_device_open(Ecore_Drm2_Device *device)
           }
      }
 
-   device->state = calloc(1, sizeof(Ecore_Drm2_Atomic_State));
-   if (device->state)
-     _drm2_atomic_state_fill(device->state, device->fd);
+   if (_ecore_drm2_use_atomic)
+     {
+        device->state = calloc(1, sizeof(Ecore_Drm2_Atomic_State));
+        if (device->state)
+          _drm2_atomic_state_fill(device->state, device->fd);
+     }
 
    device->active_hdlr =
      ecore_event_handler_add(ELPUT_EVENT_SESSION_ACTIVE,
@@ -674,7 +677,8 @@ ecore_drm2_device_free(Ecore_Drm2_Device *device)
 {
    EINA_SAFETY_ON_NULL_RETURN(device);
 
-   _drm2_atomic_state_free(device->state);
+   if (_ecore_drm2_use_atomic)
+     _drm2_atomic_state_free(device->state);
 
    ecore_event_handler_del(device->active_hdlr);
    ecore_event_handler_del(device->device_change_hdlr);