devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=639ad420aa9b4f4f95a50c65676a011657277646

commit 639ad420aa9b4f4f95a50c65676a011657277646
Author: Chris Michael <[email protected]>
Date:   Wed Jan 18 09:46:39 2017 -0500

    ecore-drm2: Add API to determine if a device prefers shadow buffers
    
    Small patch to add a new API function that can be called to determine
    if a given drm device prefers the use of shadow buffers. This API
    will be used later to provide some optimizations on various platforms.
    
    NB: Requested by Derek
    
    @feature
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/lib/ecore_drm2/Ecore_Drm2.h        | 12 ++++++++++++
 src/lib/ecore_drm2/ecore_drm2_device.c | 20 ++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 2b87981..8926314 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -345,6 +345,18 @@ EAPI void ecore_drm2_device_calibrate(Ecore_Drm2_Device 
*device, int w, int h);
 EAPI Eina_Bool ecore_drm2_device_vt_set(Ecore_Drm2_Device *device, int vt);
 
 /**
+ * Get if a given device prefers the use of shadow buffers
+ *
+ * @param device
+ *
+ * @return EINA_TRUE if preferred, EINA_FALSE otherwise
+ *
+ * @ingroup Ecore_Drm2_Device_Group
+ * @since 1.19
+ */
+EAPI Eina_Bool ecore_drm2_device_prefer_shadow(Ecore_Drm2_Device *device);
+
+/**
  * @defgroup Ecore_Drm2_Output_Group Drm output functions
  *
  * Functions that deal with setup of outputs
diff --git a/src/lib/ecore_drm2/ecore_drm2_device.c 
b/src/lib/ecore_drm2/ecore_drm2_device.c
index 10294af..a6e6d22 100644
--- a/src/lib/ecore_drm2/ecore_drm2_device.c
+++ b/src/lib/ecore_drm2/ecore_drm2_device.c
@@ -8,6 +8,10 @@
 # define DRM_CAP_CURSOR_HEIGHT 0x9
 #endif
 
+#ifndef DRM_CAP_DUMB_PREFER_SHADOW
+# define DRM_CAP_DUMB_PREFER_SHADOW 0x4
+#endif
+
 #ifdef HAVE_ATOMIC_DRM
 # include <sys/utsname.h>
 #endif
@@ -816,3 +820,19 @@ ecore_drm2_device_vt_set(Ecore_Drm2_Device *device, int vt)
 
    return elput_manager_vt_set(device->em, vt);
 }
+
+EAPI Eina_Bool
+ecore_drm2_device_prefer_shadow(Ecore_Drm2_Device *device)
+{
+   uint64_t caps;
+   int ret;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE);
+   EINA_SAFETY_ON_TRUE_RETURN_VAL((device->fd < 0), EINA_FALSE);
+
+   ret = sym_drmGetCap(device->fd, DRM_CAP_DUMB_PREFER_SHADOW, &caps);
+   if ((ret == 0) && (caps == 1))
+     return EINA_TRUE;
+   else
+     return EINA_FALSE;
+}

-- 


Reply via email to