EmulatedFakeCamera2: Use HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED
Stop using CAMERA2_HAL_PIXEL_FORMAT_OPAQUE. Bug: 6243944 Change-Id: I96ea30228b126b4eed560a760269cb50bbbb62f7
This commit is contained in:
@@ -24,18 +24,6 @@
|
||||
#define BUFFER_HANDLE_MAGIC ((int)0xabfabfab)
|
||||
#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
|
||||
//
|
||||
|
||||
@@ -156,7 +156,7 @@ static int gralloc_alloc(alloc_device_t* dev,
|
||||
|
||||
// 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 @@ static int gralloc_alloc(alloc_device_t* dev,
|
||||
} 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);
|
||||
|
||||
@@ -259,7 +259,7 @@ int EmulatedFakeCamera2::allocateStream(
|
||||
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 @@ int EmulatedFakeCamera2::allocateStream(
|
||||
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 @@ int EmulatedFakeCamera2::allocateStream(
|
||||
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 EmulatedFakeCamera2::registerStreamBuffers(
|
||||
|
||||
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 @@ bool EmulatedFakeCamera2::ConfigureThread::threadLoop() {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user