Revert "Revert "Gralloc: Support HW_CAMERA_READ/HW_CAMERA_ZSL usage.""
Missing project ready to go.
This reverts commit 9642da51023d5dadaa3b544f100e84dfdbcabea3
Change-Id: I08a43e9cdcb06bd6b74fd08809bbaf801c2eb44f
diff --git a/tools/emulator/opengl/system/gralloc/gralloc.cpp b/tools/emulator/opengl/system/gralloc/gralloc.cpp
index 96e0594..ac20d49 100644
--- a/tools/emulator/opengl/system/gralloc/gralloc.cpp
+++ b/tools/emulator/opengl/system/gralloc/gralloc.cpp
@@ -165,7 +165,8 @@
} else if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) {
// Camera-to-encoder is NV21
format = HAL_PIXEL_FORMAT_YCrCb_420_SP;
- } else if (usage & GRALLOC_USAGE_HW_CAMERA_ZSL) {
+ } else if ((usage & GRALLOC_USAGE_HW_CAMERA_MASK) ==
+ GRALLOC_USAGE_HW_CAMERA_ZSL) {
// Camera-to-ZSL-queue is RGB_888
format = HAL_PIXEL_FORMAT_RGB_888;
}
@@ -614,11 +615,14 @@
bool hw_write = (usage & GRALLOC_USAGE_HW_RENDER);
bool hw_vid_enc_read = (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER);
bool hw_cam_write = (usage & GRALLOC_USAGE_HW_CAMERA_WRITE);
+ bool hw_cam_read = (usage & GRALLOC_USAGE_HW_CAMERA_READ);
bool sw_read_allowed = (0 != (cb->usage & GRALLOC_USAGE_SW_READ_MASK));
bool sw_write_allowed = (0 != (cb->usage & GRALLOC_USAGE_SW_WRITE_MASK));
if ( (hw_read || hw_write) ||
- (!sw_read && !sw_write && !hw_cam_write && !hw_vid_enc_read) ||
+ (!sw_read && !sw_write &&
+ !hw_cam_write && !hw_cam_read &&
+ !hw_vid_enc_read) ||
(sw_read && !sw_read_allowed) ||
(sw_write && !sw_write_allowed) ) {
ALOGE("gralloc_lock usage mismatch usage=0x%x cb->usage=0x%x\n", usage,
@@ -632,7 +636,9 @@
//
// make sure ashmem area is mapped if needed
//
- if (cb->canBePosted() || sw_read || sw_write || hw_cam_write || hw_vid_enc_read) {
+ if (cb->canBePosted() || sw_read || sw_write ||
+ hw_cam_write || hw_cam_read ||
+ hw_vid_enc_read) {
if (cb->ashmemBasePid != getpid() || !cb->ashmemBase) {
return -EACCES;
}
@@ -669,7 +675,7 @@
//
// is virtual address required ?
//
- if (sw_read || sw_write || hw_cam_write || hw_vid_enc_read) {
+ if (sw_read || sw_write || hw_cam_write || hw_cam_read || hw_vid_enc_read) {
*vaddr = cpu_addr;
}