Exemple #1
0
struct wld_buffer *
wayland_buffer_get(struct wl_resource *resource)
{
	if (wl_resource_instance_of(resource, &wl_buffer_interface, &buffer_implementation))
		return wl_resource_get_user_data(resource);

	return NULL;
}
struct wl_gdl_buffer *
wl_gdl_buffer_get(struct wl_resource *resource)
{
	if (wl_resource_instance_of(resource, &wl_buffer_interface,
				    &gdl_buffer_interface))
		return wl_resource_get_user_data(resource);
	else
		return NULL;
}
Exemple #3
0
struct wl_drm_buffer *
wayland_drm_buffer_get(struct wl_resource *resource)
{
	if (resource == NULL)
		return NULL;

	if (wl_resource_instance_of(resource, &wl_buffer_interface,
				    &drm_buffer_interface))
		return wl_resource_get_user_data(resource);
	else
		return NULL;
}
Exemple #4
0
WL_EXPORT struct wl_shm_buffer *
wl_shm_buffer_get(struct wl_resource *resource)
{
	if (resource == NULL)
		return NULL;

	if (wl_resource_instance_of(resource, &wl_buffer_interface,
				    &shm_buffer_interface))
		return wl_resource_get_user_data(resource);
	else
		return NULL;
}
Exemple #5
0
static struct wl_drm_buffer *
wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource)
{
	trace(TRACE_DRM, "");
	if (resource == NULL)
		return NULL;

	if (wl_resource_instance_of(resource,
		&wl_buffer_interface, &drm->buffer_interface))
		return wl_resource_get_user_data(resource);
	else
		return NULL;
}
Exemple #6
0
/** Get the linux_dmabuf_buffer from a wl_buffer resource
 *
 * If the given wl_buffer resource was created through the linux_dmabuf
 * protocol interface, returns the linux_dmabuf_buffer object. This can
 * be used as a type check for a wl_buffer.
 *
 * \param resource A wl_buffer resource.
 * \return The linux_dmabuf_buffer if it exists, or NULL otherwise.
 */
WL_EXPORT struct linux_dmabuf_buffer *
linux_dmabuf_buffer_get(struct wl_resource *resource)
{
	struct linux_dmabuf_buffer *buffer;

	if (!resource)
		return NULL;

	if (!wl_resource_instance_of(resource, &wl_buffer_interface,
				     &linux_dmabuf_buffer_implementation))
		return NULL;

	buffer = wl_resource_get_user_data(resource);
	assert(buffer);
	assert(!buffer->params_resource);
	assert(buffer->buffer_resource == resource);

	return buffer;
}