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

Commit 5ec377b4 authored by Emilian Peev's avatar Emilian Peev
Browse files

Camera: Add fall back properties for FMQ size override

All system properties in the vendor partition must
start with either "vendor" or "ro.vendor".
Older devices should not be affected but newer
implementations may not be able to override the
FMQ size if needed.
Keep this functionality and provide fall back
properties using "ro.vendor.camera".

Bug: 77865891
Test: Manual using application and modified device configuration.
Change-Id: I23d0ba7a10eaafe98a708277c26579e8a0fec614
parent 248f72a9
Loading
Loading
Loading
Loading
+25 −6
Original line number Diff line number Diff line
@@ -99,12 +99,21 @@ bool CameraDeviceSession::initialize() {
        return true;
    }

    int32_t reqFMQSize = property_get_int32("ro.camera.req.fmq.size", /*default*/-1);
    // "ro.camera" properties are no longer supported on vendor side.
    //  Support a fall back for the fmq size override that uses "ro.vendor.camera"
    //  properties.
    int32_t reqFMQSize = property_get_int32("ro.vendor.camera.req.fmq.size", /*default*/-1);
    if (reqFMQSize < 0) {
        reqFMQSize = property_get_int32("ro.camera.req.fmq.size", /*default*/-1);
        if (reqFMQSize < 0) {
            reqFMQSize = CAMERA_REQUEST_METADATA_QUEUE_SIZE;
        } else {
            ALOGV("%s: request FMQ size overridden to %d", __FUNCTION__, reqFMQSize);
        }
    } else {
        ALOGV("%s: request FMQ size overridden to %d via fallback property", __FUNCTION__,
                reqFMQSize);
    }

    mRequestMetadataQueue = std::make_unique<RequestMetadataQueue>(
            static_cast<size_t>(reqFMQSize),
@@ -114,12 +123,22 @@ bool CameraDeviceSession::initialize() {
        return true;
    }

    int32_t resFMQSize = property_get_int32("ro.camera.res.fmq.size", /*default*/-1);
    // "ro.camera" properties are no longer supported on vendor side.
    //  Support a fall back for the fmq size override that uses "ro.vendor.camera"
    //  properties.
    int32_t resFMQSize = property_get_int32("ro.vendor.camera.res.fmq.size", /*default*/-1);
    if (resFMQSize < 0) {
        resFMQSize = property_get_int32("ro.camera.res.fmq.size", /*default*/-1);
        if (resFMQSize < 0) {
            resFMQSize = CAMERA_RESULT_METADATA_QUEUE_SIZE;
        } else {
            ALOGV("%s: result FMQ size overridden to %d", __FUNCTION__, resFMQSize);
        }
    } else {
        ALOGV("%s: result FMQ size overridden to %d via fallback property", __FUNCTION__,
                resFMQSize);
    }

    mResultMetadataQueue = std::make_shared<RequestMetadataQueue>(
            static_cast<size_t>(resFMQSize),
            false /* non blocking */);