dmabuf: set modifier to invalid for not supporting clients

modifier_hi and modifier_lo are set to 0 by clients,
which are not supporting modifiers. Modifier attributes
of buffers of these clients set to 0 too in linux-dmabuf.c

import_simple_dmabuf function in gl-renderer.c compares
modifier attribute of the buffer with DRM_FORMAT_MOD_INVALID.
DRM_FORMAT_MOD_INVALID is equal to ((1ULL<<56) - 1).
Therefore, modifer 0 is accepted as valid. Then, the function
checks support for eglQueryDmaBufModifiersEXT.
If it is not supported import_simple_dmabuf function is returning
NULL.

This patch sets the modifier attribute to DRM_FORMAT_MOD_INVALID
for clients which are not supporting modifiers. Without this patch
linux-dmabuf protocol is not working for not supporting clients.

Fixes: b138d7afb3 ("gl-renderer: Ignore INVALID modifier")
Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Tested-by: Tomohito Esaki <etom@igel.co.jp>
dev
Emre Ucan 7 years ago committed by Daniel Stone
parent e79694ceec
commit 99ef816fd1
  1. 2
      libweston/gl-renderer.c
  2. 5
      libweston/linux-dmabuf.c

@ -2164,7 +2164,7 @@ gl_renderer_import_dmabuf(struct weston_compositor *ec,
for (i = 0; i < dmabuf->attributes.n_planes; i++) {
/* return if EGL doesn't support import modifiers */
if (dmabuf->attributes.modifier[i] != 0)
if (dmabuf->attributes.modifier[i] != DRM_FORMAT_MOD_INVALID)
if (!gr->has_dmabuf_import_modifiers)
return false;

@ -111,8 +111,13 @@ params_add(struct wl_client *client,
buffer->attributes.fd[plane_idx] = name_fd;
buffer->attributes.offset[plane_idx] = offset;
buffer->attributes.stride[plane_idx] = stride;
if (wl_resource_get_version(params_resource) < ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION)
buffer->attributes.modifier[plane_idx] = DRM_FORMAT_MOD_INVALID;
else
buffer->attributes.modifier[plane_idx] = ((uint64_t)modifier_hi << 32) |
modifier_lo;
buffer->attributes.n_planes++;
}

Loading…
Cancel
Save