• Home
  • Raw
  • Download

Lines Matching refs:hnd

71 	private_handle_t *hnd = (private_handle_t *)handle;  in gralloc_register_buffer()  local
95 hnd->pid = getpid(); in gralloc_register_buffer()
97 if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) in gralloc_register_buffer()
101 else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP) in gralloc_register_buffer()
104 hnd->ump_mem_handle = (int)ump_handle_create_from_secure_id(hnd->ump_id); in gralloc_register_buffer()
106 if (UMP_INVALID_MEMORY_HANDLE != (ump_handle)hnd->ump_mem_handle) in gralloc_register_buffer()
108 hnd->base = ump_mapped_pointer_get((ump_handle)hnd->ump_mem_handle); in gralloc_register_buffer()
110 if (0 != hnd->base) in gralloc_register_buffer()
112 hnd->writeOwner = 0; in gralloc_register_buffer()
113 hnd->lockState &= ~(private_handle_t::LOCK_STATE_UNREGISTERED); in gralloc_register_buffer()
119 AERR("Failed to map UMP handle 0x%x", hnd->ump_mem_handle); in gralloc_register_buffer()
122 ump_reference_release((ump_handle)hnd->ump_mem_handle); in gralloc_register_buffer()
126 AERR("Failed to create UMP handle 0x%x", hnd->ump_mem_handle); in gralloc_register_buffer()
130 AERR("Gralloc does not support UMP. Unable to register UMP memory for handle 0x%p", hnd); in gralloc_register_buffer()
133 else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) in gralloc_register_buffer()
138 size_t size = hnd->size; in gralloc_register_buffer()
148 AERR("Could not get gralloc module for handle: 0x%p", hnd); in gralloc_register_buffer()
164 AERR("Could not open ion device for handle: 0x%p", hnd); in gralloc_register_buffer()
170 …mappedAddress = (unsigned char *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, hnd->share_f… in gralloc_register_buffer()
174 AERR("mmap( share_fd:%d ) failed with %s", hnd->share_fd, strerror(errno)); in gralloc_register_buffer()
179 hnd->base = mappedAddress + hnd->offset; in gralloc_register_buffer()
180 hnd->lockState &= ~(private_handle_t::LOCK_STATE_UNREGISTERED); in gralloc_register_buffer()
187 AERR("registering non-UMP buffer not supported. flags = %d", hnd->flags); in gralloc_register_buffer()
195 static void unmap_buffer(private_handle_t *hnd) in unmap_buffer() argument
197 if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP) in unmap_buffer()
200 ump_mapped_pointer_release((ump_handle)hnd->ump_mem_handle); in unmap_buffer()
201 ump_reference_release((ump_handle)hnd->ump_mem_handle); in unmap_buffer()
202 hnd->ump_mem_handle = (int)UMP_INVALID_MEMORY_HANDLE; in unmap_buffer()
204 AERR("Can't unregister UMP buffer for handle 0x%p. Not supported", hnd); in unmap_buffer()
207 else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) in unmap_buffer()
210 void *base = (void *)hnd->base; in unmap_buffer()
211 size_t size = hnd->size; in unmap_buffer()
219 AERR("Can't unregister DMA_BUF buffer for hnd %p. Not supported", hnd); in unmap_buffer()
225 AERR("Unregistering unknown buffer is not supported. Flags = %d", hnd->flags); in unmap_buffer()
228 hnd->base = 0; in unmap_buffer()
229 hnd->lockState = 0; in unmap_buffer()
230 hnd->writeOwner = 0; in unmap_buffer()
243 private_handle_t *hnd = (private_handle_t *)handle; in gralloc_unregister_buffer() local
245 …AERR_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK, "[unregister] handle %p still loc… in gralloc_unregister_buffer()
247 if (hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER) in gralloc_unregister_buffer()
251 else if (hnd->pid == getpid()) // never unmap buffers that were not registered in this process in gralloc_unregister_buffer()
255 hnd->lockState &= ~(private_handle_t::LOCK_STATE_MAPPED); in gralloc_unregister_buffer()
258 if (!(hnd->lockState & private_handle_t::LOCK_STATE_WRITE)) in gralloc_unregister_buffer()
260 unmap_buffer(hnd); in gralloc_unregister_buffer()
263 hnd->lockState |= private_handle_t::LOCK_STATE_UNREGISTERED; in gralloc_unregister_buffer()
269 …buffer 0x%p from process %d that was not created in current process: %d", hnd, hnd->pid, getpid()); in gralloc_unregister_buffer()
283 private_handle_t *hnd = (private_handle_t *)handle; in gralloc_lock() local
287 if (hnd->lockState & private_handle_t::LOCK_STATE_UNREGISTERED) in gralloc_lock()
289 AERR("Locking on an unregistered buffer 0x%p, returning error", hnd); in gralloc_lock()
294 …if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP || hnd->flags & private_handle_t::PRIV_FLAG… in gralloc_lock()
296 hnd->writeOwner = usage & GRALLOC_USAGE_SW_WRITE_MASK; in gralloc_lock()
299 hnd->lockState |= private_handle_t::LOCK_STATE_WRITE; in gralloc_lock()
305 *vaddr = (void *)hnd->base; in gralloc_lock()
326 private_handle_t *hnd = (private_handle_t *)handle; in gralloc_unlock() local
331 if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP && hnd->writeOwner) in gralloc_unlock()
334 …ump_cpu_msync_now((ump_handle)hnd->ump_mem_handle, UMP_MSYNC_CLEAN_AND_INVALIDATE, (void *)hnd->ba… in gralloc_unlock()
336 AERR("Buffer 0x%p is UMP type but it is not supported", hnd); in gralloc_unlock()
339 else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION && hnd->writeOwner) in gralloc_unlock()
360 hnd->lockState &= ~(private_handle_t::LOCK_STATE_WRITE); in gralloc_unlock()
363 if (hnd->lockState & private_handle_t::LOCK_STATE_UNREGISTERED) in gralloc_unlock()
365 unmap_buffer(hnd); in gralloc_unlock()