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

Commit 1c960844 authored by x0118064's avatar x0118064 Committed by Ricardo Cerqueira
Browse files

CameraService: Add compatibility for OMAP ICS blobs



Workaround the conflict created by usage of the 0x800 enum
in JB (focus move) vs its OMAP usage in ICS (burst jpeg)

Originally:
CameraService: Adds support for burst compressed images

Signed-off-by: default avatarEmilian Peev <epeev@mm-sol.com>

Moved the changes under OMAP_ENHANCEMENT

Signed-off-by: default avatarSolaiyappan Saravanan <saravanan.s@ti.com>
Change-Id: I1f17675b2854793de83c2b7cdecafc039c46f355

CameraService: Adds support for burst compressed images

Depends on:
  - http://review.omapzoom.org/#/c/24537/
  - http://review.omapzoom.org/#/c/24538/



Change-Id: I1f17675b2854793de83c2b7cdecafc039c46f355
Signed-off-by: default avatarSolaiyappan Saravanan <saravanan.s@ti.com>
Signed-off-by: default avatarEmilian Peev <epeev@mm-sol.com>
Signed-off-by: default avatarDaniel Levin <dendy@ti.com>

Add CAMERA_MSG_RAW_BURST handling to CameraService

Change-Id: Id958836e726e9908f60311d5bfc6d26eb8298cea
Signed-off-by: default avatarVladimir Petrov <vppetrov@mm-sol.com>

CameraService: Disable capture message types before stopping preview

If we try to stopPreview in the middle of capture, these
callbacks might occur. In this case, stopPreview will already be
holding mLock while the message handler will try to grab mLock.
Deadlock occurs if the stopPreview and message callback dependencies
are in the same thread.

Issue reproduced with Image Capture/Home Key scenario.

Port from GB: Issue is still reproducible (although extremely
              rarely) in ICS.

Signed-off-by: default avatarEmilian Peev <epeev@mm-sol.com>
Signed-off-by: default avatarJean Johnson <jean-johnson@ti.com>
Signed-off-by: default avatarDaniel Levin <dendy@ti.com>
Change-Id: I222d00f8bd69c11302a35610095efe0ddc49f876
parent a9e1193a
Loading
Loading
Loading
Loading
+46 −1
Original line number Original line Diff line number Diff line
@@ -89,7 +89,11 @@ status_t CameraClient::initialize(camera_module_t *module) {


    // Enable zoom, error, focus, and metadata messages by default
    // Enable zoom, error, focus, and metadata messages by default
    enableMsgType(CAMERA_MSG_ERROR | CAMERA_MSG_ZOOM | CAMERA_MSG_FOCUS |
    enableMsgType(CAMERA_MSG_ERROR | CAMERA_MSG_ZOOM | CAMERA_MSG_FOCUS |
                  CAMERA_MSG_PREVIEW_METADATA | CAMERA_MSG_FOCUS_MOVE);
                  CAMERA_MSG_PREVIEW_METADATA 
#ifndef OMAP_ICS_CAMERA
                  | CAMERA_MSG_FOCUS_MOVE
#endif
                 );


    LOG1("CameraClient::initialize X (pid %d, id %d)", callingPid, mCameraId);
    LOG1("CameraClient::initialize X (pid %d, id %d)", callingPid, mCameraId);
    return OK;
    return OK;
@@ -400,6 +404,11 @@ status_t CameraClient::startPreviewMode() {
        native_window_set_buffers_transform(mPreviewWindow.get(),
        native_window_set_buffers_transform(mPreviewWindow.get(),
                mOrientation);
                mOrientation);
    }
    }

#if defined(OMAP_ICS_CAMERA) || defined(OMAP_ENHANCEMENT_BURST_CAPTURE)
    disableMsgType(CAMERA_MSG_COMPRESSED_BURST_IMAGE);
#endif

    mHardware->setPreviewWindow(mPreviewWindow);
    mHardware->setPreviewWindow(mPreviewWindow);
    result = mHardware->startPreview();
    result = mHardware->startPreview();


@@ -439,6 +448,16 @@ void CameraClient::stopPreview() {
    Mutex::Autolock lock(mLock);
    Mutex::Autolock lock(mLock);
    if (checkPidAndHardware() != NO_ERROR) return;
    if (checkPidAndHardware() != NO_ERROR) return;


#ifdef OMAP_ENHANCEMENT
    // According to framework documentation, preview needs
    // to be started for image capture. This will make sure
    // that image capture related messages get disabled if
    // not done already in their respective handlers.
    // If these messages come when in the midddle of
    // stopping preview we will deadlock the system in
    // lockIfMessageWanted().
    disableMsgType(CAMERA_MSG_POSTVIEW_FRAME);
#endif


    disableMsgType(CAMERA_MSG_PREVIEW_FRAME);
    disableMsgType(CAMERA_MSG_PREVIEW_FRAME);
    mHardware->stopPreview();
    mHardware->stopPreview();
@@ -534,8 +553,15 @@ status_t CameraClient::takePicture(int msgType) {
                           CAMERA_MSG_POSTVIEW_FRAME |
                           CAMERA_MSG_POSTVIEW_FRAME |
                           CAMERA_MSG_RAW_IMAGE |
                           CAMERA_MSG_RAW_IMAGE |
                           CAMERA_MSG_RAW_IMAGE_NOTIFY |
                           CAMERA_MSG_RAW_IMAGE_NOTIFY |
#if defined(OMAP_ICS_CAMERA) || defined(OMAP_ENHANCEMENT_BURST_CAPTURE)
                           CAMERA_MSG_RAW_BURST |
#endif
                           CAMERA_MSG_COMPRESSED_IMAGE);
                           CAMERA_MSG_COMPRESSED_IMAGE);


#if defined(OMAP_ICS_CAMERA) || defined(OMAP_ENHANCEMENT_BURST_CAPTURE)
    picMsgType |= CAMERA_MSG_COMPRESSED_BURST_IMAGE;
#endif

    enableMsgType(picMsgType);
    enableMsgType(picMsgType);


    return mHardware->takePicture();
    return mHardware->takePicture();
@@ -747,6 +773,11 @@ void CameraClient::dataCallback(int32_t msgType,
        case CAMERA_MSG_COMPRESSED_IMAGE:
        case CAMERA_MSG_COMPRESSED_IMAGE:
            client->handleCompressedPicture(dataPtr);
            client->handleCompressedPicture(dataPtr);
            break;
            break;
#if defined(OMAP_ICS_CAMERA) || defined(OMAP_ENHANCEMENT_BURST_CAPTURE)
        case CAMERA_MSG_COMPRESSED_BURST_IMAGE:
            client->handleCompressedBurstPicture(dataPtr);
            break;
#endif
        default:
        default:
            client->handleGenericData(msgType, dataPtr, metadata);
            client->handleGenericData(msgType, dataPtr, metadata);
            break;
            break;
@@ -876,6 +907,20 @@ void CameraClient::handleCompressedPicture(const sp<IMemory>& mem) {
    }
    }
}
}


#if defined(OMAP_ICS_CAMERA) || defined(OMAP_ENHANCEMENT_BURST_CAPTURE)
// burst picture callback - compressed picture ready
void CameraClient::handleCompressedBurstPicture(const sp<IMemory>& mem) {
    // Don't disable this message type yet. In this mode takePicture() will
    // get called only once. When burst finishes this message will get automatically
    // disabled in the respective call for restarting the preview.

    sp<ICameraClient> c = mCameraClient;
    mLock.unlock();
    if (c != 0) {
        c->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, mem, NULL);
    }
}
#endif


void CameraClient::handleGenericNotify(int32_t msgType,
void CameraClient::handleGenericNotify(int32_t msgType,
    int32_t ext1, int32_t ext2) {
    int32_t ext1, int32_t ext2) {
+3 −0
Original line number Original line Diff line number Diff line
@@ -105,6 +105,9 @@ private:
    void                    handlePostview(const sp<IMemory>& mem);
    void                    handlePostview(const sp<IMemory>& mem);
    void                    handleRawPicture(const sp<IMemory>& mem);
    void                    handleRawPicture(const sp<IMemory>& mem);
    void                    handleCompressedPicture(const sp<IMemory>& mem);
    void                    handleCompressedPicture(const sp<IMemory>& mem);
#if defined(OMAP_ICS_CAMERA) || defined(OMAP_ENHANCEMENT_BURST_CAPTURE)
    void                    handleCompressedBurstPicture(const sp<IMemory>& mem);
#endif
    void                    handleGenericNotify(int32_t msgType, int32_t ext1, int32_t ext2);
    void                    handleGenericNotify(int32_t msgType, int32_t ext1, int32_t ext2);
    void                    handleGenericData(int32_t msgType, const sp<IMemory>& dataPtr,
    void                    handleGenericData(int32_t msgType, const sp<IMemory>& dataPtr,
            camera_frame_metadata_t *metadata);
            camera_frame_metadata_t *metadata);