derekf pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=81420d76e060802088b9f0a69b44a90d146f52e2

commit 81420d76e060802088b9f0a69b44a90d146f52e2
Author: Derek Foreman <[email protected]>
Date:   Fri Jun 30 14:54:12 2017 -0500

    software_generic: Improve dmabuf validity tests
    
    Now that upper layers set load errors this can be less gruesome.
    
    Also, add some checks that were in E here where they belong.
---
 .../evas/engines/software_generic/evas_engine.c    |  8 +------
 .../engines/software_generic/evas_native_dmabuf.c  | 25 +++++++++++++++++++++-
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/modules/evas/engines/software_generic/evas_engine.c 
b/src/modules/evas/engines/software_generic/evas_engine.c
index 85e9f401c3..7697592a30 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -1139,13 +1139,7 @@ eng_image_native_set(void *data EINA_UNUSED, void 
*image, void *native)
         /* This is a probe for wl_dmabuf viability */
         if (ns && ns->type == EVAS_NATIVE_SURFACE_WL_DMABUF &&
             !ns->data.wl_dmabuf.resource)
-          {
-             struct dmabuf_attributes *attr;
-
-             attr = ns->data.wl_dmabuf.attr;
-             if (attr->version != EVAS_DMABUF_ATTRIBUTE_VERSION)
-               ns->data.wl_dmabuf.attr = NULL;
-          }
+          return _evas_native_dmabuf_surface_image_set(image, native);
 
         return NULL;
      }
diff --git a/src/modules/evas/engines/software_generic/evas_native_dmabuf.c 
b/src/modules/evas/engines/software_generic/evas_native_dmabuf.c
index bd88850ab4..6033c1c95b 100644
--- a/src/modules/evas/engines/software_generic/evas_native_dmabuf.c
+++ b/src/modules/evas/engines/software_generic/evas_native_dmabuf.c
@@ -80,7 +80,30 @@ _evas_native_dmabuf_surface_image_set(void *image, void 
*native)
    Evas_Native_Surface *ns = native;
    RGBA_Image *im = image;
 
-   if (!im) return NULL;
+   if (!im)
+     {
+        if (ns && ns->type == EVAS_NATIVE_SURFACE_WL_DMABUF &&
+            !ns->data.wl_dmabuf.resource)
+          {
+             struct dmabuf_attributes *attr;
+
+             attr = ns->data.wl_dmabuf.attr;
+             if (attr->version != EVAS_DMABUF_ATTRIBUTE_VERSION)
+               return NULL;
+             if (attr->n_planes != 1)
+               return NULL;
+             if (attr->format != DRM_FORMAT_ARGB8888 &&
+                 attr->format != DRM_FORMAT_XRGB8888)
+               return NULL;
+
+             return evas_cache_image_data(evas_common_image_cache_get(),
+                                          attr->width, attr->height,
+                                          NULL, 1,
+                                          EVAS_COLORSPACE_ARGB8888);
+          }
+       return NULL;
+     }
+
    if (ns)
      {
         struct dmabuf_attributes *a;

-- 


Reply via email to