Lines Matching refs:handle
190 int lock(cb_handle_t& handle, in lock() argument
194 if (!handle.bufferSize) { RETURN_ERROR_CODE(-EINVAL); } in lock()
195 char* const bufferBits = static_cast<char*>(handle.getBufferPtr()); in lock()
198 if (handle.hostHandle) { in lock()
199 const int res = lock_impl(handle, in lock()
210 int unlock(cb_handle_t& handle) { in unlock() argument
211 if (!handle.bufferSize) { RETURN_ERROR_CODE(-EINVAL); } in unlock()
213 char* const bufferBits = static_cast<char*>(handle.getBufferPtr()); in unlock()
216 if (handle.hostHandle) { in unlock()
217 unlock_impl(handle, bufferBits); in unlock()
223 int lock_ycbcr(cb_handle_t& handle, in lock_ycbcr() argument
228 if (!handle.bufferSize) { RETURN_ERROR_CODE(-EINVAL); } in lock_ycbcr()
229 char* const bufferBits = static_cast<char*>(handle.getBufferPtr()); in lock_ycbcr()
238 switch (handle.format) { in lock_ycbcr()
240 yStride = handle.width; in lock_ycbcr()
242 vOffset = yStride * handle.height; in lock_ycbcr()
249 yStride = align(handle.width, 16); in lock_ycbcr()
251 vOffset = yStride * handle.height; in lock_ycbcr()
252 uOffset = vOffset + (cStride * handle.height / 2); in lock_ycbcr()
257 yStride = handle.width; in lock_ycbcr()
259 uOffset = handle.height * yStride; in lock_ycbcr()
260 vOffset = uOffset + cStride * handle.height / 2; in lock_ycbcr()
265 ALOGE("%s:%d unexpected format (%d)", __func__, __LINE__, handle.format); in lock_ycbcr()
269 if (handle.hostHandle) { in lock_ycbcr()
270 const int res = lock_impl(handle, in lock_ycbcr()
289 int lock_impl(cb_handle_t& handle, in lock_impl() argument
302 rcEnc, handle.hostHandle, 0, usageSwRead); in lock_impl()
310 if (gralloc_is_yuv_format(handle.format)) { in lock_impl()
314 switch (handle.format) { in lock_impl()
316 get_yv12_offsets(handle.width, handle.height, in lock_impl()
320 get_yuv420p_offsets(handle.width, handle.height, in lock_impl()
328 rcEnc->rcReadColorBufferYUV(rcEnc, handle.hostHandle, in lock_impl()
329 0, 0, handle.width, handle.height, in lock_impl()
333 std::vector<char> tmpBuf(handle.width * handle.height * 3); in lock_impl()
334 rcEnc->rcReadColorBuffer(rcEnc, handle.hostHandle, in lock_impl()
335 0, 0, handle.width, handle.height, in lock_impl()
336 handle.glFormat, handle.glType, in lock_impl()
339 switch (handle.format) { in lock_impl()
342 handle.width, handle.height, in lock_impl()
348 handle.width, handle.height, in lock_impl()
359 handle.hostHandle, in lock_impl()
360 0, 0, handle.width, handle.height, in lock_impl()
361 handle.glFormat, handle.glType, in lock_impl()
367 handle.lockedLeft = left; in lock_impl()
368 handle.lockedTop = top; in lock_impl()
369 handle.lockedWidth = width; in lock_impl()
370 handle.lockedHeight = height; in lock_impl()
372 handle.lockedLeft = 0; in lock_impl()
373 handle.lockedTop = 0; in lock_impl()
374 handle.lockedWidth = handle.width; in lock_impl()
375 handle.lockedHeight = handle.height; in lock_impl()
381 void unlock_impl(cb_handle_t& handle, char* const bufferBits) { in unlock_impl() argument
382 const int bpp = glUtilsPixelBitSize(handle.glFormat, handle.glType) >> 3; in unlock_impl()
383 const int left = handle.lockedLeft; in unlock_impl()
384 const int top = handle.lockedTop; in unlock_impl()
385 const int width = handle.lockedWidth; in unlock_impl()
386 const int height = handle.lockedHeight; in unlock_impl()
392 if (gralloc_is_yuv_format(handle.format)) { in unlock_impl()
394 switch (handle.format) { in unlock_impl()
411 handle.width, in unlock_impl()
422 m_bufferManager->getMmapedPhysAddr(handle.getMmapedOffset())); in unlock_impl()
423 rcEnc->rcUpdateColorBufferDMA(rcEnc, handle.hostHandle, in unlock_impl()
425 handle.glFormat, handle.glType, in unlock_impl()
429 handle.lockedLeft = 0; in unlock_impl()
430 handle.lockedTop = 0; in unlock_impl()
431 handle.lockedWidth = 0; in unlock_impl()
432 handle.lockedHeight = 0; in unlock_impl()
843 std::unique_ptr<cb_handle_30_t> handle = in alloc_buffer() local
853 *pHandle = handle.release(); in alloc_buffer()
858 std::unique_ptr<cb_handle_30_t> handle(cb_handle_30_t::from_unconst(h)); in free_buffer() local
859 if (!handle) { in free_buffer()
863 if (handle->bufferPtrPid != getpid()) { RETURN_ERROR_CODE(-EACCES); } in free_buffer()
864 if (handle->bufferFd != handle->bufferFdAsInt) { RETURN_ERROR_CODE(-EACCES); } in free_buffer()
866 if (qemu_pipe_valid(handle->hostHandleRefCountFd)) { in free_buffer()
867 qemu_pipe_close(handle->hostHandleRefCountFd); in free_buffer()
872 if (handle->mmapedSize > 0) { in free_buffer()
873 GoldfishAddressSpaceBlock::memoryUnmap(handle->getBufferPtr(), handle->mmapedSize); in free_buffer()
875 GoldfishAddressSpaceHostMemoryAllocator::closeHandle(handle->bufferFd); in free_buffer()
882 cb_handle_30_t *handle = cb_handle_30_t::from_unconst(h); in register_buffer() local
883 if (!handle) { RETURN_ERROR_CODE(-EINVAL); } in register_buffer()
885 if (handle->mmapedSize > 0) { in register_buffer()
888 handle->getBufferPtr(), in register_buffer()
889 handle->mmapedSize, in register_buffer()
890 handle->bufferFd, in register_buffer()
891 handle->getMmapedOffset(), in register_buffer()
897 handle->setBufferPtr(ptr); in register_buffer()
899 if (handle->hostHandle) { in register_buffer()
902 rcEnc->rcOpenColorBuffer2(rcEnc, handle->hostHandle); in register_buffer()
905 handle->bufferFdAsInt = handle->bufferFd; in register_buffer()
906 handle->bufferPtrPid = getpid(); in register_buffer()
914 cb_handle_30_t *handle = cb_handle_30_t::from_unconst(h); in unregister_buffer() local
915 if (!handle) { RETURN_ERROR_CODE(-EINVAL); } in unregister_buffer()
917 if (handle->bufferPtrPid != getpid()) { RETURN_ERROR_CODE(-EACCES); } in unregister_buffer()
918 if (handle->bufferFd != handle->bufferFdAsInt) { RETURN_ERROR_CODE(-EACCES); } in unregister_buffer()
920 if (handle->hostHandle) { in unregister_buffer()
923 rcEnc->rcCloseColorBuffer(rcEnc, handle->hostHandle); in unregister_buffer()
925 if (handle->mmapedSize > 0) { in unregister_buffer()
926 GoldfishAddressSpaceBlock::memoryUnmap(handle->getBufferPtr(), handle->mmapedSize); in unregister_buffer()
929 handle->bufferFdAsInt = -1; in unregister_buffer()
930 handle->bufferPtrPid = -1; in unregister_buffer()
991 cb_handle_t* handle = cb_handle_t::from_unconst(bh); in gralloc_lock() local
992 if (!handle) { in gralloc_lock()
996 return module->impl()->lock(*handle, usage, l, t, w, h, vaddr); in gralloc_lock()
1005 cb_handle_t* handle = cb_handle_t::from_unconst(bh); in gralloc_unlock() local
1006 if (!handle) { in gralloc_unlock()
1010 return module->impl()->unlock(*handle); in gralloc_unlock()
1022 cb_handle_t* handle = cb_handle_t::from_unconst(bh); in gralloc_lock_ycbcr() local
1023 if (!handle) { in gralloc_lock_ycbcr()
1027 return module->impl()->lock_ycbcr(*handle, usage, l, t, w, h, ycbcr); in gralloc_lock_ycbcr()