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

Commit caea6858 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4574286 from 4c5bfc69 to pi-release

Change-Id: I5aaa64742a7b75ec61d3ed110cfb0a77919a5b56
parents cb315c97 4c5bfc69
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ cc_library_shared {
    srcs: [
        "CameraDevice.cpp",
        "CameraDeviceSession.cpp",
        "convert.cpp",
        "convert.cpp"
    ],
    shared_libs: [
        "libhidlbase",
@@ -89,6 +89,8 @@ cc_library_shared {
        "libfmq",
        "libsync",
        "libyuv",
        "libjpeg",
        "libexif",
    ],
    static_libs: [
        "android.hardware.camera.common@1.0-helper",
+635 −9

File changed.

Preview size limit exceeded, changes collapsed.

+29 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include <unordered_set>
#include "CameraMetadata.h"
#include "HandleImporter.h"
#include "Exif.h"
#include "utils/KeyedVector.h"
#include "utils/Mutex.h"
#include "utils/Thread.h"
@@ -58,10 +59,13 @@ using ::android::hardware::camera::device::V3_2::StreamConfigurationMode;
using ::android::hardware::camera::device::V3_2::StreamRotation;
using ::android::hardware::camera::device::V3_2::StreamType;
using ::android::hardware::camera::device::V3_2::DataspaceFlags;
using ::android::hardware::camera::device::V3_2::CameraBlob;
using ::android::hardware::camera::device::V3_2::CameraBlobId;
using ::android::hardware::camera::device::V3_4::HalStreamConfiguration;
using ::android::hardware::camera::device::V3_4::ICameraDeviceSession;
using ::android::hardware::camera::common::V1_0::Status;
using ::android::hardware::camera::common::V1_0::helper::HandleImporter;
using ::android::hardware::camera::common::V1_0::helper::ExifUtils;
using ::android::hardware::graphics::common::V1_0::BufferUsage;
using ::android::hardware::graphics::common::V1_0::Dataspace;
using ::android::hardware::graphics::common::V1_0::PixelFormat;
@@ -272,13 +276,19 @@ protected:
            hidl_vec<CaptureResult> &results, bool tryWriteFmq);
    static void freeReleaseFences(hidl_vec<CaptureResult>&);

    Size getMaxJpegResolution() const;
    Size getMaxThumbResolution() const;

    ssize_t getJpegBufferSize(uint32_t width, uint32_t height) const;

    class OutputThread : public android::Thread {
    public:
        OutputThread(wp<ExternalCameraDeviceSession> parent, CroppingType);
        ~OutputThread();

        Status allocateIntermediateBuffers(
                const Size& v4lSize, const hidl_vec<Stream>& streams);
                const Size& v4lSize, const Size& thumbSize,
                const hidl_vec<Stream>& streams);
        Status submitRequest(const HalRequest&);
        void flush();
        virtual bool threadLoop() override;
@@ -296,12 +306,24 @@ protected:

        void waitForNextRequest(HalRequest* out);
        int cropAndScaleLocked(
                sp<AllocatedFrame>& in, const HalStreamBuffer& halBuf,
                sp<AllocatedFrame>& in, const Size& outSize,
                YCbCrLayout* out);

        int cropAndScaleThumbLocked(
                sp<AllocatedFrame>& in, const Size& outSize,
                YCbCrLayout* out);

        int formatConvertLocked(const YCbCrLayout& in, const YCbCrLayout& out,
                Size sz, uint32_t format);

        static int encodeJpegYU12(const Size &inSz,
                const YCbCrLayout& inLayout, int jpegQuality,
                const void *app1Buffer, size_t app1Size,
                void *out, size_t maxOutSize,
                size_t &actualCodeSize);

        int createJpegLocked(HalStreamBuffer &halBuf, HalRequest &req);

        mutable std::mutex mLock;
        std::condition_variable mRequestCond;
        wp<ExternalCameraDeviceSession> mParent;
@@ -312,9 +334,11 @@ protected:
        // (Scale)-> mScaledYu12Frames
        // (Format convert) -> output gralloc frames
        sp<AllocatedFrame> mYu12Frame;
        sp<AllocatedFrame> mYu12ThumbFrame;
        std::unordered_map<Size, sp<AllocatedFrame>, SizeHasher> mIntermediateBuffers;
        std::unordered_map<Size, sp<AllocatedFrame>, SizeHasher> mScaledYu12Frames;
        YCbCrLayout mYu12FrameLayout;
        YCbCrLayout mYu12ThumbFrameLayout;
    };

    // Protect (most of) HIDL interface methods from synchronized-entering
@@ -373,6 +397,9 @@ protected:
    Mutex mProcessCaptureResultLock;

    std::unordered_map<RequestTemplate, CameraMetadata> mDefaultRequests;

    const Size mMaxThumbResolution;
    const Size mMaxJpegResolution;
    /* End of members not changed after initialize() */

private:
+16 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ import @3.2::CaptureResult;
 * by the framework by its buffer resolution and format, and additionally by the
 * HAL with the gralloc usage flags and the maximum in-flight buffer count.
 *
 * This version extends the @3.2 Stream with the physicalCameraId field.
 * This version extends the @3.2 Stream with the physicalCameraId and bufferSize field.
 */
struct Stream {
    /**
@@ -60,6 +60,21 @@ struct Stream {
     * instance names returned by getCameraIdList().
     */
    string physicalCameraId;

    /**
     * The size of a buffer from this Stream, in bytes.
     *
     * For non PixelFormat::BLOB formats, this entry must be 0 and HAL should use
     * android.hardware.graphics.mapper lockYCbCr API to get buffer layout.
     *
     * For BLOB format with dataSpace Dataspace::DEPTH, this must be zero and and HAL must
     * determine the buffer size based on ANDROID_DEPTH_MAX_DEPTH_SAMPLES.
     *
     * For BLOB format with dataSpace Dataspace::JFIF, this must be non-zero and represent the
     * maximal size HAL can lock using android.hardware.graphics.mapper lock API.
     *
     */
    uint32_t bufferSize;
};

/**
+54 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import @1.0::Status;
import @1.1::DrmMetricGroup;
import @1.1::HdcpLevel;
import @1.1::KeyRequestType;
import @1.0::SecureStopId;
import @1.1::SecureStopRelease;
import @1.1::SecurityLevel;

/**
@@ -176,4 +178,56 @@ interface IDrmPlugin extends @1.0::IDrmPlugin {
     *         plugin.
     */
    getMetrics() generates (Status status, vec<DrmMetricGroup> metric_groups);

    /**
     * Get the IDs of all secure stops on the device
     *
     * @return status the status of the call. The status must be OK or
     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
     * IDs cannot be returned.
     * @return secureStopIds a list of the IDs
     */
    getSecureStopIds() generates
        (Status status, vec<SecureStopId> secureStopIds);

    /**
     * Release secure stops given a release message from the key server
     *
     * @param ssRelease the secure stop release message identifying one or more
     * secure stops to release. ssRelease is opaque, it is passed directly from
     * a DRM license server through the app and media framework to the vendor
     * HAL module. The format and content of ssRelease must be defined by the
     * DRM scheme being implemented according to this HAL. The DRM scheme
     * can be identified by its UUID which can be queried using
     * IDrmFactory::isCryptoSchemeSupported.
     *
     * @return status the status of the call. The status must be OK or one of
     * the following errors: BAD_VALUE if ssRelease is invalid or
     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
     * cannot be released.
     */
    releaseSecureStops(SecureStopRelease ssRelease) generates (Status status);

    /**
     * Remove a secure stop given its secure stop ID, without requiring
     * a secure stop release response message from the key server.
     *
     * @param secureStopId the ID of the secure stop to release.
     *
     * @return status the status of the call. The status must be OK or one of
     * the following errors: BAD_VALUE if the secureStopId is invalid or
     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure stop
     * cannot be released.
     */
    removeSecureStop(SecureStopId secureStopId) generates (Status status);

    /**
     * Remove all secure stops on the device without requiring a secure
     * stop release response message from the key server.
     *
     * @return status the status of the call. The status must be OK or
     * ERROR_DRM_INVALID_STATE if the HAL is in a state where the secure
     * stops cannot be removed.
     */
    removeAllSecureStops() generates (Status status);
};
Loading