コード例 #1
0
/*
 * Validate a buffer handle and return the associated bo.
 */
static struct gralloc_drm_bo_t *validate_handle(buffer_handle_t _handle,
		struct gralloc_drm_t *drm)
{
	struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle);

	if (!handle)
		return NULL;

	/* the buffer handle is passed to a new process */
	if (unlikely(handle->data_owner != gralloc_drm_pid)) {
		struct gralloc_drm_bo_t *bo;

		/* check only */
		if (!drm)
			return NULL;

		/* create the struct gralloc_drm_bo_t locally */
		if (handle->name)
			bo = drm->drv->alloc(drm->drv, handle);
		else /* an invalid handle */
			bo = NULL;
		if (bo) {
			bo->drm = drm;
			bo->imported = 1;
			bo->handle = handle;
		}

		handle->data_owner = gralloc_drm_get_pid();
		handle->data = (int) bo;
	}

	return (struct gralloc_drm_bo_t *) handle->data;
}
コード例 #2
0
static int
get_native_buffer_name(struct ANativeWindowBuffer *buf)
{
   struct gralloc_drm_handle_t *handle;

   /* check that the buffer is allocated by drm_gralloc and cast */
   handle = gralloc_drm_handle(buf->handle);

   return (handle) ? handle->name : 0;
}
コード例 #3
0
static int
get_handle_name(buffer_handle_t handle)
{
   struct gralloc_drm_handle_t *dh;

   /* check that the buffer is allocated by drm_gralloc and cast */
   dh = gralloc_drm_handle(handle);

   return (dh) ? dh->name : 0;
}
コード例 #4
0
/*
 * So that Mesa/EGL can get to the GEM name.
 */
int
gralloc_drm_gem_name(buffer_handle_t _handle)
{
	struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle);

	if (handle)
		return handle->name;
	else
		return 0;
}