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

Commit a22b34c4 authored by Alin Jerpelea's avatar Alin Jerpelea Committed by Gerrit Code Review
Browse files

ST_ERICSSON: Adding multimedia extension

adapted from
commit 151ce20c17e1a097a2edf5b467650941a1cc6287
Author: Patrik Ryd <patrik.ryd@stericsson.com>
Date:   Thu Apr 5 20:18:30 2012 +0000

    Adding multimedia extension

    More specifically:

    - Add support for ST-Ericsson native pixel formats and conversion to
    and from these formats.
    - The Khronos headers are out of date and Mali extensions are missing from
    the extension headers. GLES2/gl2ext.h has been updated with the missing ARM
    extensions.
    - ST-Ericsson audio support for multimedia.
    - ST-Ericsson video support for multimedia.

Change-Id: I716bdd850bc0e3ef783f7814e98e39c53f70d7e4
parent dd580a0e
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -750,12 +750,26 @@ public:
    static const char SCENE_DETECT_ON[];
#endif
    static const char PIXEL_FORMAT_YUV422SP[];
#ifdef STE_HARDWARE
    static const char PIXEL_FORMAT_YUV420P[]; // YV12
#endif
    static const char PIXEL_FORMAT_YUV420SP[]; // NV21
#ifdef STE_HARDWARE
    static const char PIXEL_FORMAT_YUV420SPNV12[]; // NV12
#endif
#ifdef QCOM_HARDWARE
    static const char PIXEL_FORMAT_YUV420SP_ADRENO[]; // ADRENO
#endif
    static const char PIXEL_FORMAT_YUV422I[]; // YUY2
#ifndef STE_HARDWARE
    static const char PIXEL_FORMAT_YUV420P[]; // YV12
#else
    static const char PIXEL_FORMAT_YVU422SP[];
    static const char PIXEL_FORMAT_YVU422P[];
    static const char PIXEL_FORMAT_YVU420SP[];
    static const char PIXEL_FORMAT_YVU420P[];
    static const char PIXEL_FORMAT_YUV420MB[];
#endif
    static const char PIXEL_FORMAT_RGB565[];
    static const char PIXEL_FORMAT_RGBA8888[];
    static const char PIXEL_FORMAT_JPEG[];
@@ -819,6 +833,11 @@ public:
    // other modes.
    static const char FOCUS_MODE_CONTINUOUS_PICTURE[];

#ifdef STE_HARDWARE
    // keys for record stride and slice height
    static const char KEY_RECORD_STRIDE[];
    static const char KEY_RECORD_SLICE_HEIGHT[];
#endif
#ifdef QCOM_HARDWARE
    static const char FOCUS_MODE_CONTINUOUS_CAMERA[];

+57 −0
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@
#include <utils/Vector.h>
#include <utils/threads.h>

#ifdef STE_HARDWARE
#include <hardware/copybit.h>
#endif
#define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture"

namespace android {
@@ -47,6 +50,9 @@ public:
    };
    enum { NUM_BUFFER_SLOTS = 32 };
    enum { NO_CONNECTED_API = 0 };
#ifdef STE_HARDWARE
    enum { NUM_BLIT_BUFFER_SLOTS = 2 };
#endif

    struct FrameAvailableListener : public virtual RefBase {
        // onFrameAvailable() is called from queueBuffer() each time an
@@ -136,12 +142,26 @@ public:
    // connected to the specified client API.
    virtual status_t disconnect(int api);

#ifndef STE_HARDWARE
    // updateTexImage sets the image contents of the target texture to that of
    // the most recently queued buffer.
    //
    // This call may only be made while the OpenGL ES context to which the
    // target texture belongs is bound to the calling thread.
    status_t updateTexImage(bool isComposition = false);
#else
    status_t updateTexImage();

    // A surface that uses a non-native format requires conversion of
    // its buffers. This conversion can be deferred until the layer
    // based on this surface is drawn.
    status_t updateTexImage(bool deferConversion);

    // convert() performs the deferred texture conversion as scheduled
    // by updateTexImage(bool deferConversion).
    // The method returns immediately if no conversion is necessary.
    status_t convert();
#endif

    // setBufferCountServer set the buffer count. If the client has requested
    // a buffer count using setBufferCount, the server-buffer count will
@@ -267,6 +287,13 @@ private:
    EGLImageKHR createImage(EGLDisplay dpy,
            const sp<GraphicBuffer>& graphicBuffer);

#ifdef STE_HARDWARE
    // returns TRUE if buffer needs color format conversion
    bool conversionIsNeeded(const sp<GraphicBuffer>& graphicBuffer);

    // converts buffer to a suitable color format
    status_t convert(sp<GraphicBuffer> &srcBuf, sp<GraphicBuffer> &dstBuf);
#endif
    status_t setBufferCountServerLocked(int bufferCount);

    // computeCurrentTransformMatrix computes the transform matrix for the
@@ -516,6 +543,36 @@ private:
    // with the surface Texture.
    uint64_t mFrameCounter;

#ifdef STE_HARDWARE
    // mBlitEngine is the handle to the copybit device which will be used in
    // case color transform is needed before the EGL image is created.
    copybit_device_t* mBlitEngine;

    // mBlitSlots contains several buffers which will
    // be rendered alternately in case color transform is needed (instead
    // of rendering the buffers in mSlots).
    BufferSlot mBlitSlots[NUM_BLIT_BUFFER_SLOTS];

    // mNextBlitSlot is the index of the blitter buffer (in mBlitSlots) which
    // will be used in the next color transform.
    int mNextBlitSlot;

    // mConversionSrcSlot designates the slot where source buffer
    // for the last deferred updateTexImage is located.
    int mConversionSrcSlot;

    // mConversionBltSlot designates the slot where destination buffer
    // for the last deferred updateTexImage is located.
    int mConversionBltSlot;

    // mNeedsConversion indicates that a format conversion is necessary
    // before the layer based on this surface is drawn.
    // This flag is set whenever updateTexImage() with deferred conversion
    // is called. It is cleared once the layer is drawn,
    // or when updateTexImage() w/o deferred conversion is called.
    bool mNeedsConversion;
#endif

#ifdef QCOM_HARDWARE
    // s3dFormat is the S3D format specified by the client.
    int mS3DFormat;
+4 −0
Original line number Diff line number Diff line
@@ -74,6 +74,10 @@ private:
    status_t convertQCOMYUV420SemiPlanar(
            const BitmapParams &src, const BitmapParams &dst);

#ifdef STE_HARDWARE
    status_t convertSTEYUV420PackedSemiPlanarMB(
            const BitmapParams &src, const BitmapParams &dst);
#endif
    status_t convertYUV420SemiPlanar(
            const BitmapParams &src, const BitmapParams &dst);

+6 −0
Original line number Diff line number Diff line
@@ -27,8 +27,14 @@ extern const char *MEDIA_MIMETYPE_VIDEO_VPX;
extern const char *MEDIA_MIMETYPE_VIDEO_AVC;
extern const char *MEDIA_MIMETYPE_VIDEO_MPEG4;
extern const char *MEDIA_MIMETYPE_VIDEO_H263;
#ifdef STE_HARDWARE
extern const char *MEDIA_MIMETYPE_VIDEO_H263_SW;
#endif
extern const char *MEDIA_MIMETYPE_VIDEO_MPEG2;
extern const char *MEDIA_MIMETYPE_VIDEO_RAW;
#ifdef STE_HARDWARE
extern const char *MEDIA_MIMETYPE_VIDEO_VC1;
#endif

extern const char *MEDIA_MIMETYPE_AUDIO_AMR_NB;
extern const char *MEDIA_MIMETYPE_AUDIO_AMR_WB;
+3 −0
Original line number Diff line number Diff line
@@ -156,6 +156,9 @@ private:
        kAvoidMemcopyInputRecordingFrames     = 2048,
        kRequiresLargerEncoderOutputBuffer    = 4096,
        kOutputBuffersAreUnreadable           = 8192,
#ifdef STE_HARDWARE
        kRequiresStoreMetaDataBeforeIdle      = 16384,
#endif
#ifdef QCOM_HARDWARE
        kStoreMetaDataInInputVideoBuffers     = 16384,
        kRequiresGlobalFlush                  = 0x20000000, // 2^29
Loading