EmulatedFakeCamera2: Use HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED
Stop using CAMERA2_HAL_PIXEL_FORMAT_OPAQUE.
Bug: 6243944
Change-Id: I96ea30228b126b4eed560a760269cb50bbbb62f7
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h b/tools/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h
index a3fb8dd..a207401 100644
--- a/tools/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h
+++ b/tools/emulator/opengl/system/OpenglSystemCommon/gralloc_cb.h
@@ -25,18 +25,6 @@
#define CB_HANDLE_NUM_INTS(nfds) (int)((sizeof(cb_handle_t) - (nfds)*sizeof(int)) / sizeof(int))
//
-// Emulator-specific gralloc formats
-//
-enum {
- // Request that gralloc select the proper format given the usage
- // flags. Pass this as the format to gralloc_alloc, and then the concrete
- // format can be found in cb_handle_t.format. It is invalid for
- // cb_handle_t.format to be AUTO; it must be a concrete format in either the
- // standard HAL_PIXEL_FORMAT enum or other values in this enum.
- GRALLOC_EMULATOR_PIXEL_FORMAT_AUTO = 0x100
-};
-
-//
// Our buffer handle structure
//
struct cb_handle_t : public native_handle {
diff --git a/tools/emulator/opengl/system/gralloc/gralloc.cpp b/tools/emulator/opengl/system/gralloc/gralloc.cpp
index 0e43711..96e0594 100644
--- a/tools/emulator/opengl/system/gralloc/gralloc.cpp
+++ b/tools/emulator/opengl/system/gralloc/gralloc.cpp
@@ -156,7 +156,7 @@
// Pick the right concrete pixel format given the endpoints as encoded in
// the usage bits. Every end-point pair needs explicit listing here.
- if (format == GRALLOC_EMULATOR_PIXEL_FORMAT_AUTO) {
+ if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
// Camera as producer
if (usage & GRALLOC_USAGE_HW_CAMERA_WRITE) {
if (usage & GRALLOC_USAGE_HW_TEXTURE) {
@@ -165,10 +165,13 @@
} 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) {
+ // Camera-to-ZSL-queue is RGB_888
+ format = HAL_PIXEL_FORMAT_RGB_888;
}
}
- if (format == GRALLOC_EMULATOR_PIXEL_FORMAT_AUTO) {
+ if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
ALOGE("gralloc_alloc: Requested auto format selection, "
"but no known format for this usage: %d x %d, usage %x",
w, h, usage);
diff --git a/tools/emulator/system/camera/EmulatedFakeCamera2.cpp b/tools/emulator/system/camera/EmulatedFakeCamera2.cpp
index 5a5db25..08475b1 100644
--- a/tools/emulator/system/camera/EmulatedFakeCamera2.cpp
+++ b/tools/emulator/system/camera/EmulatedFakeCamera2.cpp
@@ -259,7 +259,7 @@
uint32_t *max_buffers) {
Mutex::Autolock l(mMutex);
- if (format != CAMERA2_HAL_PIXEL_FORMAT_OPAQUE) {
+ if (format != HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
unsigned int numFormats = sizeof(kAvailableFormats) / sizeof(uint32_t);
unsigned int formatIdx = 0;
unsigned int sizeOffsetIdx = 0;
@@ -270,10 +270,6 @@
ALOGE("%s: Format 0x%x is not supported", __FUNCTION__, format);
return BAD_VALUE;
}
- } else {
- // Translate to emulator's magic format.
- // Note: It is assumed that this is a processed format (not raw or JPEG).
- format = GRALLOC_EMULATOR_PIXEL_FORMAT_AUTO;
}
const uint32_t *availableSizes;
@@ -290,7 +286,7 @@
sizeof(kAvailableJpegSizesBack)/sizeof(uint32_t) :
sizeof(kAvailableJpegSizesFront)/sizeof(uint32_t);
break;
- case GRALLOC_EMULATOR_PIXEL_FORMAT_AUTO:
+ case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_YV12:
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
@@ -384,9 +380,9 @@
int finalFormat = streamBuffer->format;
- if (finalFormat == GRALLOC_EMULATOR_PIXEL_FORMAT_AUTO) {
+ if (finalFormat == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
ALOGE("%s: Stream %d: Bad final pixel format "
- "GRALLOC_EMULATOR_PIXEL_FORMAT_AUTO; "
+ "HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED; "
"concrete pixel format required!", __FUNCTION__, stream_id);
return BAD_VALUE;
}
@@ -669,7 +665,7 @@
for (size_t i = 0; i < streams.count; i++) {
int streamId = streams.data.u8[i];
const Stream &s = mParent->getStreamInfo(streamId);
- if (s.format == GRALLOC_EMULATOR_PIXEL_FORMAT_AUTO) {
+ if (s.format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
ALOGE("%s: Stream %d does not have a concrete pixel format, but "
"is included in a request!", __FUNCTION__, streamId);
mParent->signalError();