Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8b67386 authored by Rohit Sekhar's avatar Rohit Sekhar Committed by Rohit Sekhar
Browse files

camera: Make overrideFormat from reserved fields opt-in

Change-Id: Ic0025ae5a4d359074e25692e1913eb98f47bbcec
parent 5ddb936d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -9,7 +9,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",
+4 −1
Original line number Diff line number Diff line
@@ -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))) {
+4 −0
Original line number Diff line number Diff line
@@ -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) {
+4 −1
Original line number Diff line number Diff line
@@ -9,7 +9,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",
+2 −0
Original line number Diff line number Diff line
@@ -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) {