camera: Make overrideFormat from reserved fields opt-in
Change-Id: Ic0025ae5a4d359074e25692e1913eb98f47bbcec
This commit is contained in:
parent
df1c0cd96e
commit
579f81f4ae
5 changed files with 18 additions and 3 deletions
|
@ -10,7 +10,10 @@ package {
|
|||
|
||||
cc_library_shared {
|
||||
name: "camera.device@3.2-impl",
|
||||
defaults: ["hidl_defaults"],
|
||||
defaults: [
|
||||
"hidl_defaults",
|
||||
"camera_override_format_from_reserved_defaults",
|
||||
],
|
||||
proprietary: true,
|
||||
srcs: [
|
||||
"CameraDevice.cpp",
|
||||
|
|
|
@ -927,11 +927,14 @@ bool CameraDeviceSession::preProcessConfigurationLocked(
|
|||
mCirculatingBuffers.emplace(stream.mId, CirculatingBuffers{});
|
||||
} else {
|
||||
// width/height must not change, but usage/rotation might need to change
|
||||
// format might change and get updated with overrideFormat
|
||||
// format might change and get updated with TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED
|
||||
if (mStreamMap[id].stream_type !=
|
||||
(int) requestedConfiguration.streams[i].streamType ||
|
||||
mStreamMap[id].width != requestedConfiguration.streams[i].width ||
|
||||
mStreamMap[id].height != requestedConfiguration.streams[i].height ||
|
||||
#ifndef TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED
|
||||
mStreamMap[id].format != (int) requestedConfiguration.streams[i].format ||
|
||||
#endif
|
||||
mStreamMap[id].data_space !=
|
||||
mapToLegacyDataspace( static_cast<android_dataspace_t> (
|
||||
requestedConfiguration.streams[i].dataSpace))) {
|
||||
|
|
|
@ -74,8 +74,10 @@ void convertFromHidl(const Stream &src, Camera3Stream* dst) {
|
|||
dst->data_space = (android_dataspace_t) src.dataSpace;
|
||||
dst->rotation = (int) src.rotation;
|
||||
dst->usage = (uint32_t) src.usage;
|
||||
#ifdef TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED
|
||||
dst->reserved[0] = NULL;
|
||||
dst->reserved[1] = NULL;
|
||||
#endif
|
||||
// Fields to be filled by HAL (max_buffers, priv) are initialized to 0
|
||||
dst->max_buffers = 0;
|
||||
dst->priv = 0;
|
||||
|
@ -99,6 +101,7 @@ void convertToHidl(const Camera3Stream* src, HalStream* dst) {
|
|||
__FUNCTION__, src->stream_type);
|
||||
}
|
||||
|
||||
#ifdef TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED
|
||||
HalStream* halStream = NULL;
|
||||
if (src->reserved[0] != NULL) {
|
||||
halStream = (HalStream*)(src->reserved[0]);
|
||||
|
@ -115,6 +118,7 @@ void convertToHidl(const Camera3Stream* src, HalStream* dst) {
|
|||
dst->consumerUsage = (BufferUsageFlags)halStream->consumerUsage;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void convertToHidl(const camera3_stream_configuration_t& src, HalStreamConfiguration* dst) {
|
||||
|
|
|
@ -10,7 +10,10 @@ package {
|
|||
|
||||
cc_library_shared {
|
||||
name: "camera.device@3.3-impl",
|
||||
defaults: ["hidl_defaults"],
|
||||
defaults: [
|
||||
"hidl_defaults",
|
||||
"camera_override_format_from_reserved_defaults",
|
||||
],
|
||||
proprietary: true,
|
||||
srcs: [
|
||||
"CameraDevice.cpp",
|
||||
|
|
|
@ -48,6 +48,7 @@ void convertToHidl(const Camera3Stream* src, HalStream* dst) {
|
|||
__FUNCTION__, src->stream_type);
|
||||
}
|
||||
|
||||
#ifdef TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED
|
||||
HalStream* halStream = NULL;
|
||||
if (src->reserved[0] != NULL) {
|
||||
halStream = (HalStream*)(src->reserved[0]);
|
||||
|
@ -63,6 +64,7 @@ void convertToHidl(const Camera3Stream* src, HalStream* dst) {
|
|||
dst->v3_2.consumerUsage = (BufferUsageFlags)halStream->v3_2.consumerUsage;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void convertToHidl(const camera3_stream_configuration_t& src, HalStreamConfiguration* dst) {
|
||||
|
|
Loading…
Reference in a new issue