Revert "Camera: Map between bufferqueue gralloc0 usage, and HIDL gralloc1 usages"
This reverts commit 1a2f15daf13552e86324025cf6d31d887cd8fa02.
Test: fix b/36876770
Bug: b/36876770
Change-Id: Ie7b8c9ee444e3e8667154b396e3e6a556b54739a
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index 980ba39..e7a671d 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -44,8 +44,6 @@
#include <utils/Timers.h>
#include <cutils/properties.h>
-#include <grallocusage/GrallocUsageConversion.h>
-
#include <android/hardware/camera2/ICameraDeviceUser.h>
#include "utils/CameraTraces.h"
@@ -497,6 +495,11 @@
return dataSpace;
}
+ConsumerUsageFlags Camera3Device::mapToConsumerUsage(
+ uint32_t usage) {
+ return usage;
+}
+
StreamRotation Camera3Device::mapToStreamRotation(camera3_stream_rotation_t rotation) {
switch (rotation) {
case CAMERA3_STREAM_ROTATION_0:
@@ -546,6 +549,16 @@
return static_cast<uint32_t>(pixelFormat);
}
+uint32_t Camera3Device::mapConsumerToFrameworkUsage(
+ ConsumerUsageFlags usage) {
+ return usage;
+}
+
+uint32_t Camera3Device::mapProducerToFrameworkUsage(
+ ProducerUsageFlags usage) {
+ return usage;
+}
+
ssize_t Camera3Device::getJpegBufferSize(uint32_t width, uint32_t height) const {
// Get max jpeg size (area-wise).
Size maxJpegResolution = getMaxJpegResolution();
@@ -3143,9 +3156,7 @@
dst.width = src->width;
dst.height = src->height;
dst.format = mapToPixelFormat(src->format);
- uint64_t consumerUsage, producerUsage;
- ::android_convertGralloc0To1Usage(src->usage, &producerUsage, &consumerUsage);
- dst.usage = consumerUsage;
+ dst.usage = mapToConsumerUsage(src->usage);
dst.dataSpace = mapToHidlDataspace(src->data_space);
dst.rotation = mapToStreamRotation((camera3_stream_rotation_t) src->rotation);
@@ -3227,6 +3238,7 @@
__FUNCTION__, streamId);
return INVALID_OPERATION;
}
+ dst->usage = mapConsumerToFrameworkUsage(src.consumerUsage);
} else {
// OUTPUT
if (src.consumerUsage != 0) {
@@ -3234,8 +3246,8 @@
__FUNCTION__, streamId);
return INVALID_OPERATION;
}
+ dst->usage = mapProducerToFrameworkUsage(src.producerUsage);
}
- dst->usage = ::android_convertGralloc1To0Usage(src.producerUsage, src.consumerUsage);
dst->max_buffers = src.maxBuffers;
}
}
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index d4b92cf..692a97d 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -597,6 +597,7 @@
static hardware::graphics::common::V1_0::PixelFormat mapToPixelFormat(int frameworkFormat);
static hardware::camera::device::V3_2::DataspaceFlags mapToHidlDataspace(
android_dataspace dataSpace);
+ static hardware::camera::device::V3_2::ConsumerUsageFlags mapToConsumerUsage(uint32_t usage);
static hardware::camera::device::V3_2::StreamRotation mapToStreamRotation(
camera3_stream_rotation_t rotation);
// Returns a negative error code if the passed-in operation mode is not valid.
@@ -604,6 +605,10 @@
/*out*/ hardware::camera::device::V3_2::StreamConfigurationMode *mode);
static camera3_buffer_status_t mapHidlBufferStatus(hardware::camera::device::V3_2::BufferStatus status);
static int mapToFrameworkFormat(hardware::graphics::common::V1_0::PixelFormat pixelFormat);
+ static uint32_t mapConsumerToFrameworkUsage(
+ hardware::camera::device::V3_2::ConsumerUsageFlags usage);
+ static uint32_t mapProducerToFrameworkUsage(
+ hardware::camera::device::V3_2::ProducerUsageFlags usage);
struct RequestTrigger {
// Metadata tag number, e.g. android.control.aePrecaptureTrigger
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
index c60a68c..e46d55e 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp
@@ -634,7 +634,7 @@
NATIVE_WINDOW_CONSUMER_USAGE_BITS, &u);
// If an opaque output stream's endpoint is ImageReader, add
- // GRALLOC_USAGE_HW_CAMERA_READ to the usage so HAL knows it will be used
+ // GRALLOC_USAGE_HW_CAMERA_ZSL to the usage so HAL knows it will be used
// for the ZSL use case.
// Assume it's for ImageReader if the consumer usage doesn't have any of these bits set:
// 1. GRALLOC_USAGE_HW_TEXTURE
@@ -644,7 +644,7 @@
if (camera3_stream::format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED &&
(u & (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER |
GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_HW_VIDEO_ENCODER)) == 0) {
- u |= GRALLOC_USAGE_HW_CAMERA_READ;
+ u |= GRALLOC_USAGE_HW_CAMERA_ZSL;
}
*usage = u;