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.
This commit is contained in:
Derek Foreman 2017-06-30 14:54:12 -05:00
parent b8165098dc
commit 81420d76e0
2 changed files with 25 additions and 8 deletions

View File

@ -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;
}

View File

@ -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;