【发布时间】:2016-03-12 06:40:17
【问题描述】:
我正在尝试使用使用 USING_IO_INPUT 标志创建的分配来从相机获取图像。我是这样设置的
Type.Builder yuvType = new Type.Builder(mRS, Element.YUV(mRS));
yuvType.setYuvFormat(imageReaderFormat);
yuvType.setX(mCameraWidth).setY(mCameraHeight);
mAllocation = Allocation.createTyped(mRS, yuvType.create(), Allocation
.MipmapControl.MIPMAP_NONE,
Allocation.USAGE_IO_INPUT | Allocation.USAGE_SCRIPT);
mAllocation.setOnBufferAvailableListener(mOnBufferAllocationAvailable);
我正在将分配表面添加到预览会话中,并获取对我非常简单的函数的回调
public void onBufferAvailable(Allocation allocation) {
allocation.ioReceive();
//mPixels is properly initialised
allocation.copyTo(mPixels);
}
此设置适用于 Nexus 5X,但在运行 5.1.1 的 Nexus 4 上失败。当我在回调中调用allocation.ioReceive() 时,我从驱动程序中打印出一些警告,并且从分配复制到字节数组会导致垃圾被复制。
W/Adreno-RS: <rsdVendorAllocationUnMapQCOM:394>: NOT Found allocation map for alloc 0xa1761000
W/Adreno-GSL: <gsl_ldd_control:427>: ioctl fd 25 code 0xc01c0915 (IOCTL_KGSL_MAP_USER_MEM) failed: errno 22 Invalid argument
W/Adreno-RS: <rsdVendorAllocationMapQCOM:288>: gsl_memory_map_fd failed -5 hostptr: 0xa0112000 sz: 0 offset: 0 flags: 0x10c0b00 alloc: 0xa1761000
我在后台线程中运行相机,尽管onBufferAvailable 在“RSMessageThread”中被调用。
此问题与我设置分配和相机预览的方式有关,还是驱动程序中的错误?
【问题讨论】:
标签: android renderscript android-camera2