Home | History | Annotate | Download | only in drm_gralloc

Lines Matching refs:handle

152  * Validate a buffer handle and return the associated bo.
157 struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle);
159 if (!handle)
162 /* the buffer handle is passed to a new process */
163 ALOGE("data_owner=%d gralloc_pid=%d data=%p\n", handle->data_owner, gralloc_drm_get_pid(), handle->data);
164 if (unlikely(handle->data_owner != gralloc_drm_pid)) {
171 ALOGE("handle: name=%d pfd=%d\n", handle->name,
172 handle->prime_fd);
174 if (handle->name || handle->prime_fd >= 0)
175 bo = drm->drv->alloc(drm->drv, handle);
176 else /* an invalid handle */
181 bo->handle = handle;
185 handle->data_owner = gralloc_drm_get_pid();
186 handle->data = bo;
189 return handle->data;
193 * Register a buffer handle.
195 int gralloc_drm_handle_register(buffer_handle_t handle, struct gralloc_drm_t *drm)
199 bo = validate_handle(handle, drm);
209 * Unregister a buffer handle. It is no-op for handles created locally.
211 int gralloc_drm_handle_unregister(buffer_handle_t handle)
215 bo = validate_handle(handle, NULL);
227 * Create a buffer handle.
232 struct gralloc_drm_handle_t *handle;
234 handle = new gralloc_drm_handle_t;
235 if (!handle)
238 handle->base.version = sizeof(handle->base);
239 handle->base.numInts = GRALLOC_DRM_HANDLE_NUM_INTS;
240 handle->base.numFds = GRALLOC_DRM_HANDLE_NUM_FDS;
242 handle->magic = GRALLOC_DRM_HANDLE_MAGIC;
243 handle->width = width;
244 handle->height = height;
245 handle->format = format;
246 handle->usage = usage;
247 handle->prime_fd = -1;
249 return handle;
259 struct gralloc_drm_handle_t *handle;
261 handle = create_bo_handle(width, height, format, usage);
262 if (!handle)
265 bo = drm->drv->alloc(drm->drv, handle);
267 delete handle;
273 bo->handle = handle;
277 handle->data_owner = gralloc_drm_get_pid();
278 handle->data = bo;
288 struct gralloc_drm_handle_t *handle = bo->handle;
297 handle->data_owner = 0;
298 handle->data = 0;
301 delete handle;
315 * Return the bo of a registered handle.
317 struct gralloc_drm_bo_t *gralloc_drm_bo_from_handle(buffer_handle_t handle)
319 return validate_handle(handle, NULL);
323 * Get the buffer handle and stride of a bo.
328 *stride = bo->handle->stride;
329 return &bo->handle->base;
333 * Query YUV component offsets for a buffer handle
338 struct gralloc_drm_handle_t *handle = gralloc_drm_handle(_handle);
339 struct gralloc_drm_bo_t *bo = handle->data;
342 /* if handle exists and driver implements resolve_format */
343 if (handle && drm->drv->resolve_format)
355 if ((bo->handle->usage & usage) != usage) {
358 if (!(bo->handle->usage & GRALLOC_USAGE_HW_FB)
359 && !(bo->handle->usage & GRALLOC_USAGE_HW_TEXTURE)) {
361 ,bo->handle->usage,usage);