get rid of overlay HAL

Change-Id: I495a6b46ef2745406578108558b6b29400fd522f
diff --git a/libopencorehw/Android.mk b/libopencorehw/Android.mk
deleted file mode 100644
index e11c6ad..0000000
--- a/libopencorehw/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-ifneq ($(BUILD_WITHOUT_PV),true)
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# Set up the OpenCore variables.
-include external/opencore/Config.mk
-LOCAL_C_INCLUDES := \
-    $(PV_INCLUDES) \
-    hardware/ti/omap3/liboverlay
-
-LOCAL_SRC_FILES := \
-	android_surface_output_omap34xx.cpp buffer_alloc_omap34xx.cpp
-
-LOCAL_CFLAGS := -Wno-non-virtual-dtor -DENABLE_SHAREDFD_PLAYBACK -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DUSE_CML2_CONFIG -DPV_ARM_GCC_V5 -DHAS_OSCL_LIB_SUPPORT
-
-LOCAL_SHARED_LIBRARIES := \
-    libutils \
-    libcutils \
-    libui \
-    libhardware\
-    libandroid_runtime \
-    libmedia \
-    libopencore_common \
-    libicuuc \
-    libopencore_player
-
-LOCAL_MODULE := libopencorehw
-
-LOCAL_LDLIBS += 
-
-include $(BUILD_SHARED_LIBRARY)
-
-endif
diff --git a/libopencorehw/android_surface_output_omap34xx.cpp b/libopencorehw/android_surface_output_omap34xx.cpp
deleted file mode 100644
index 6c84751..0000000
--- a/libopencorehw/android_surface_output_omap34xx.cpp
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * OMAP3430 support
- *
- * Author: Srini Gosangi <srini.gosangi@windriver.com>
- * Author: Michael Barabanov <michael.barabanov@windriver.com>
-
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- */
-
-/* ------------------------------------------------------------------
- * Copyright (C) 2008 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-
-
-//#define LOG_NDEBUG 0
-#ifdef LOG_NDEBUG
-#warning LOG_NDEBUG ##LOG_NDEBUG##
-#endif
-
-#define LOG_TAG "VideoMio34xx"
-#include <utils/Log.h>
-
-#include <cutils/properties.h>
-#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false ))
-static int mDebugFps = 0;
-
-#include "android_surface_output_omap34xx.h"
-#include "pv_mime_string_utils.h"
-#include "pvmf_video.h"
-#include <media/PVPlayer.h>
-
-extern "C" {
-#include "v4l2_utils.h"
-}
-
-#define CACHEABLE_BUFFERS 0x1
-
-using namespace android;
-
-static void convertYuv420ToYuv422(int width, int height, void* src, void* dst);
-
-OSCL_EXPORT_REF AndroidSurfaceOutputOmap34xx::AndroidSurfaceOutputOmap34xx() :
-    AndroidSurfaceOutput()
-{
-    mUseOverlay = true;
-    mOverlay = NULL;
-    mIsFirstFrame = true;
-    mbufferAlloc.buffer_address = NULL;
-    mConvert = false;
-}
-
-OSCL_EXPORT_REF AndroidSurfaceOutputOmap34xx::~AndroidSurfaceOutputOmap34xx()
-{
-    mUseOverlay = false;
-}
-
-OSCL_EXPORT_REF bool AndroidSurfaceOutputOmap34xx::initCheck()
-{
-    LOGV("Calling Vendor(34xx) Specific initCheck");
-    
-    // reset flags in case display format changes in the middle of a stream
-    resetVideoParameterFlags();
-    bufEnc = 0;
-
-    // copy parameters in case we need to adjust them
-    int displayWidth = iVideoDisplayWidth;
-    int displayHeight = iVideoDisplayHeight;
-    int frameWidth = iVideoWidth;
-    int frameHeight = iVideoHeight;
-    int frameSize;
-    int videoFormat = OVERLAY_FORMAT_CbYCrY_422_I;
-    mapping_data_t *data;
-    LOGV("Use Overlays");
-
-    if (mUseOverlay) {
-        if(mOverlay == NULL){
-            LOGV("using Vendor Specific(34xx) codec");
-            sp<OverlayRef> ref = NULL;
-            // FIXME:
-            // Surfaceflinger may hold onto the previous overlay reference for some
-            // time after we try to destroy it. retry a few times. In the future, we
-            // should make the destroy call block, or possibly specify that we can
-            // wait in the createOverlay call if the previous overlay is in the
-            // process of being destroyed.
-            for (int retry = 0; retry < 50; ++retry) {
-                ref = mSurface->createOverlay(displayWidth, displayHeight, videoFormat, 0);
-                if (ref != NULL) break;
-                LOGD("Overlay create failed - retrying");
-                usleep(100000);
-            }
-            if ( ref.get() == NULL )
-            {
-                LOGE("Overlay Creation Failed!");
-                return mInitialized;
-            }
-            mOverlay = new Overlay(ref);
-            mOverlay->setParameter(CACHEABLE_BUFFERS, 0);
-        }
-        else
-        {
-            mOverlay->resizeInput(displayWidth, displayHeight);
-        }
-
-        mbufferAlloc.maxBuffers = 6;  // Hardcoded to work with OMX decoder component
-        mbufferAlloc.bufferSize = iBufferSize;
-        if (mbufferAlloc.buffer_address) {
-            delete [] mbufferAlloc.buffer_address;
-        }
-        mbufferAlloc.buffer_address = new uint8*[mbufferAlloc.maxBuffers];
-        if (mbufferAlloc.buffer_address == NULL) {
-            LOGE("unable to allocate mem for overlay addresses");
-            return mInitialized;
-        }
-        LOGV("number of buffers = %d\n", mbufferAlloc.maxBuffers);
-        for (int i = 0; i < mbufferAlloc.maxBuffers; i++) {
-            data = (mapping_data_t *)mOverlay->getBufferAddress((void*)i);
-            mbufferAlloc.buffer_address[i] = (uint8*)data->ptr;
-            strcpy((char *)mbufferAlloc.buffer_address[i], "hello");
-            if (strcmp((char *)mbufferAlloc.buffer_address[i], "hello")) {
-                LOGI("problem with buffer\n");
-                return mInitialized;
-            }else{
-                LOGV("buffer = %d allocated addr=%#lx\n", i, (unsigned long) mbufferAlloc.buffer_address[i]);
-            }
-        }        
-    }
-    mInitialized = true;
-    LOGV("sendEvent(MEDIA_SET_VIDEO_SIZE, %d, %d)", iVideoDisplayWidth, iVideoDisplayHeight);
-    mPvPlayer->sendEvent(MEDIA_SET_VIDEO_SIZE, iVideoDisplayWidth, iVideoDisplayHeight);
-
-    // is conversion necessary?
-    if (iVideoSubFormat == PVMF_MIME_YUV420_PLANAR) {
-        LOGV("Use YUV420_PLANAR -> YUV422_INTERLEAVED_UYVY converter");
-        mConvert = true;
-    }
-
-    char value[PROPERTY_VALUE_MAX];
-    property_get("debug.video.showfps", value, "0");
-    mDebugFps = atoi(value);
-    LOGV_IF(mDebugFps, "showfps enabled");
-
-    return mInitialized;
-}
-
-static void debugShowFPS()
-{
-    static int mFrameCount = 0;
-    static int mLastFrameCount = 0;
-    static nsecs_t mLastFpsTime = 0;
-    static float mFps = 0;
-    mFrameCount++;
-    if (!(mFrameCount & 0x1F)) {
-        nsecs_t now = systemTime();
-        nsecs_t diff = now - mLastFpsTime;
-        mFps = ((mFrameCount - mLastFrameCount) * float(s2ns(1))) / diff;
-        mLastFpsTime = now;
-        mLastFrameCount = mFrameCount;
-        LOGV("%d Frames, %f FPS", mFrameCount, mFps);
-    }
-    // XXX: mFPS has the value we want
-}
-
-PVMFStatus AndroidSurfaceOutputOmap34xx::writeFrameBuf(uint8* aData, uint32 aDataLen, const PvmiMediaXferHeader& data_header_info)
-{
-    LOGV(" calling Vendor Specific(34xx) writeFrameBuf call");
-    if (mSurface == 0) return PVMFFailure;
-
-    if (UNLIKELY(mDebugFps)) {
-        debugShowFPS();
-    }
-
-    if (mUseOverlay) {
-        int ret;
-
-        // Convert from YUV420 to YUV422 for software codec
-        if (mConvert) {
-            convertYuv420ToYuv422(iVideoWidth, iVideoHeight, aData, mbufferAlloc.buffer_address[bufEnc]);
-        } else {
-            int i;
-            for (i = 0; i < mbufferAlloc.maxBuffers; i++) {
-                if (mbufferAlloc.buffer_address[i] == aData) {
-                    break;
-                }
-
-            }
-            if (i == mbufferAlloc.maxBuffers) {
-                LOGE("aData does not match any v4l buffer address\n");
-                return PVMFSuccess;
-            }
-            LOGV("queueBuffer %d\n", i);
-            bufEnc = i;
-        }
-
-        /* This is to reset the buffer queue when stream_off is called as
-         * all the buffers are flushed when stream_off is called.
-         */
-        ret = mOverlay->queueBuffer((void*)bufEnc);
-        if (ret == ALL_BUFFERS_FLUSHED) {
-            mIsFirstFrame = true;
-            mOverlay->queueBuffer((void*)bufEnc);
-        }
-
-        overlay_buffer_t overlay_buffer;
-
-        /* This is to prevent dequeueBuffer to be called before the first
-         * queueBuffer call is done. If that happens, there will be a delay
-         * as the dequeueBuffer call will be blocked.
-         */
-        if (!mIsFirstFrame)
-        {
-            ret = mOverlay->dequeueBuffer(&overlay_buffer);
-            if (ret != NO_ERROR) {
-                if (ret == ALL_BUFFERS_FLUSHED)
-                    mIsFirstFrame = true;
-                return false;
-            }
-        }
-        else
-        {
-            mIsFirstFrame = false;
-        }
-
-        // advance the overlay index if using color conversion
-        if (mConvert) {
-            if (++bufEnc == mbufferAlloc.maxBuffers) {
-                bufEnc = 0;
-            }
-        }
-    }
-    return PVMFSuccess;
-}
-
-
-#define USE_BUFFER_ALLOC 1
-
-/* based on test code in pvmi/media_io/pvmiofileoutput/src/pvmi_media_io_fileoutput.cpp */
-void AndroidSurfaceOutputOmap34xx::setParametersSync(PvmiMIOSession aSession,
-        PvmiKvp* aParameters,
-        int num_elements,
-        PvmiKvp * & aRet_kvp)
-{
-    OSCL_UNUSED_ARG(aSession);
-    aRet_kvp = NULL;
-
-#ifndef USE_BUFFER_ALLOC
-    AndroidSurfaceOutput::setParametersSync(aSession, aParameters, num_elements, aRet_kvp);
-    return;
-#endif
-
-    for (int32 i = 0;i < num_elements;i++)
-    {
-        if (pv_mime_strcmp(aParameters[i].key, MOUT_VIDEO_FORMAT_KEY) == 0)
-        {
-            iVideoFormatString=aParameters[i].value.pChar_value;
-            iVideoFormat=iVideoFormatString.get_str();
-            LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Video Format Key, Value %s",iVideoFormatString.get_str());
-        }
-        else if (pv_mime_strcmp(aParameters[i].key, PVMF_FORMAT_SPECIFIC_INFO_KEY_YUV) == 0)
-        {
-            uint8* data = (uint8*)aParameters->value.key_specific_value;
-            PVMFYuvFormatSpecificInfo0* yuvInfo = (PVMFYuvFormatSpecificInfo0*)data;
-
-            iVideoWidth = (int32)yuvInfo->width;
-            iVideoParameterFlags |= VIDEO_WIDTH_VALID;
-            LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Video Width, Value %d", iVideoWidth);
-
-            iVideoHeight = (int32)yuvInfo->height;
-            iVideoParameterFlags |= VIDEO_HEIGHT_VALID;
-            LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Video Height, Value %d", iVideoHeight);
-
-            iVideoDisplayHeight = (int32)yuvInfo->display_height;
-            iVideoParameterFlags |= DISPLAY_HEIGHT_VALID;
-            LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Video Display Height, Value %d", iVideoDisplayHeight);
-
-
-            iVideoDisplayWidth = (int32)yuvInfo->display_width;
-            iVideoParameterFlags |= DISPLAY_WIDTH_VALID;
-            LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Video Display Width, Value %d", iVideoDisplayWidth);
-
-            iNumberOfBuffers = (int32)yuvInfo->num_buffers;
-            LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Number of Buffer, Value %d", iNumberOfBuffers);
-
-            iBufferSize = (int32)yuvInfo->buffer_size;
-            LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Buffer Size, Value %d", iBufferSize);
-
-            LOGV("Ln %d video_format %s", __LINE__, yuvInfo->video_format.getMIMEStrPtr() );
-            iVideoSubFormat = yuvInfo->video_format.getMIMEStrPtr();
-            iVideoParameterFlags |= VIDEO_SUBFORMAT_VALID;
-        }
-        else
-        {
-            //if we get here the key is unrecognized.
-            LOGV("AndroidSurfaceOutputOmap34xx::setParametersSync() Error, unrecognized key %s ", aParameters[i].key);
-
-            //set the return value to indicate the unrecognized key
-            //and return.
-            aRet_kvp = &aParameters[i];
-            return;
-        }
-    }
-    /* Copy Code from base class. Ideally we'd just call base class's setParametersSync, but we can't as it will not get to initCheck if it encounters an unrecognized parameter such as the one we're handling here */
-    uint32 mycache = iVideoParameterFlags ;
-    if( checkVideoParameterFlags() ) {
-        initCheck();
-    }
-    iVideoParameterFlags = mycache;
-    if(!iIsMIOConfigured && checkVideoParameterFlags() )
-    {
-        iIsMIOConfigured = true;
-        if(iObserver)
-        {
-            iObserver->ReportInfoEvent(PVMFMIOConfigurationComplete);
-        }
-    }
-}
-
-/* based on test code in pvmi/media_io/pvmiofileoutput/src/pvmi_media_io_fileoutput.cpp */
-PVMFStatus AndroidSurfaceOutputOmap34xx::getParametersSync(PvmiMIOSession aSession, PvmiKeyType aIdentifier,
-        PvmiKvp*& aParameters, int& num_parameter_elements,
-        PvmiCapabilityContext aContext)
-{
-#ifdef USE_BUFFER_ALLOC
-    OSCL_UNUSED_ARG(aSession);
-    OSCL_UNUSED_ARG(aContext);
-    aParameters=NULL;
-
-    if (strcmp(aIdentifier, PVMF_BUFFER_ALLOCATOR_KEY) == 0)
-    {
-        if( iVideoSubFormat != PVMF_MIME_YUV422_INTERLEAVED_UYVY ) {
-            LOGV("Ln %d iVideoSubFormat %s. do NOT allocate decoder buffer from overlay", __LINE__, iVideoSubFormat.getMIMEStrPtr() );
-            OSCL_LEAVE(OsclErrNotSupported);
-            return PVMFErrNotSupported;
-        }
-
-        int32 err;
-        aParameters = (PvmiKvp*)oscl_malloc(sizeof(PvmiKvp));
-        if (!aParameters)
-        {
-            return PVMFErrNoMemory;
-        }
-        aParameters[0].value.key_specific_value = (PVInterface*)&mbufferAlloc;
-        return PVMFSuccess;
-    }
-
-#endif
-    return AndroidSurfaceOutput::getParametersSync(aSession, aIdentifier, aParameters, num_parameter_elements, aContext);
-}
-
-// post the last video frame to refresh screen after pause
-void AndroidSurfaceOutputOmap34xx::postLastFrame()
-{
-    //do nothing here, this is only for override the Android_Surface_output::PostLastFrame()
-    LOGV("AndroidSurfaceOutputOmap34xx::postLastFrame()");
-    //mSurface->postBuffer(mOffset);
-}
-
-void AndroidSurfaceOutputOmap34xx::closeFrameBuf()
-{
-    LOGV("Vendor(34xx) Speicif CloseFrameBuf");
-    if (UNLIKELY(mDebugFps)) {
-        debugShowFPS();
-    }
-    if (mOverlay != NULL){
-        mOverlay->destroy();
-        mOverlay = NULL;
-    }
-    if (mbufferAlloc.buffer_address) {
-        delete [] mbufferAlloc.buffer_address;
-        mbufferAlloc.buffer_address = NULL;
-    }
-    if (!mInitialized) return;
-    mInitialized = false;
-}
-
-// return a byte offset from any pointer
-static inline void* byteOffset(void* p, size_t offset) { return (void*)((uint8_t*)p + offset); }
-
-static void convertYuv420ToYuv422(int width, int height, void* src, void* dst)
-{
-
-    // calculate total number of pixels, and offsets to U and V planes
-    int pixelCount = height * width;
-    int srcLineLength = width / 4;
-    int destLineLength = width / 2;
-    uint32_t* ySrc = (uint32_t*) src;
-    uint16_t* uSrc = (uint16_t*) byteOffset(src, pixelCount);
-    uint16_t* vSrc = (uint16_t*) byteOffset(uSrc, pixelCount >> 2);
-    uint32_t *p = (uint32_t*) dst;
-
-    // convert lines
-    for (int i = 0; i < height; i += 2) {
-
-        // upsample by repeating the UV values on adjacent lines
-        // to save memory accesses, we handle 2 adjacent lines at a time
-        // convert 4 pixels in 2 adjacent lines at a time
-        for (int j = 0; j < srcLineLength; j++) {
-
-            // fetch 4 Y values for each line
-            uint32_t y0 = ySrc[0];
-            uint32_t y1 = ySrc[srcLineLength];
-            ySrc++;
-
-            // fetch 2 U/V values
-            uint32_t u = *uSrc++;
-            uint32_t v = *vSrc++;
-
-            // assemble first U/V pair, leave holes for Y's
-            uint32_t uv = (u | (v << 16)) & 0x00ff00ff;
-
-            // OR y values and write to memory
-            p[0] = ((y0 & 0xff) << 8) | ((y0 & 0xff00) << 16) | uv;
-            p[destLineLength] = ((y1 & 0xff) << 8) | ((y1 & 0xff00) << 16) | uv;
-            p++;
-
-            // assemble second U/V pair, leave holes for Y's
-            uv = ((u >> 8) | (v << 8)) & 0x00ff00ff;
-
-            // OR y values and write to memory
-            p[0] = ((y0 >> 8) & 0xff00) | (y0 & 0xff000000) | uv;
-            p[destLineLength] = ((y1 >> 8) & 0xff00) | (y1 & 0xff000000) | uv;
-            p++;
-        }
-
-        // skip the next y line, we already converted it
-        ySrc += srcLineLength;
-        p += destLineLength;
-    }
-}
-
-
-// factory function for playerdriver linkage
-extern "C" AndroidSurfaceOutputOmap34xx* createVideoMio()
-{
-    LOGV("Creating Vendor(34xx) Specific MIO component");
-    return new AndroidSurfaceOutputOmap34xx();
-}
diff --git a/libopencorehw/android_surface_output_omap34xx.h b/libopencorehw/android_surface_output_omap34xx.h
deleted file mode 100644
index 68e14b1..0000000
--- a/libopencorehw/android_surface_output_omap34xx.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * OMAP3430 support
- *
- * Author: Srini Gosangi <srini.gosangi@windriver.com>
- * Author: Michael Barabanov <michael.barabanov@windriver.com>
-
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- */
-
-/* ------------------------------------------------------------------
- * Copyright (C) 2008 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-
-#ifndef ANDROID_SURFACE_OUTPUT_OMAP34XXH_INCLUDED
-#define ANDROID_SURFACE_OUTPUT_OMAP34XXH_INCLUDED
-
-#include "android_surface_output.h"
-#include "buffer_alloc_omap34xx.h"
-
-// support for shared contiguous physical memory
-#include <ui/Overlay.h>
-
-
-class AndroidSurfaceOutputOmap34xx : public AndroidSurfaceOutput
-{
-    public:
-        AndroidSurfaceOutputOmap34xx();
-
-        // frame buffer interface
-        virtual bool initCheck();
-        virtual void setParametersSync(PvmiMIOSession aSession, PvmiKvp* aParameters, int num_elements, PvmiKvp * & aRet_kvp);
-        virtual PVMFStatus getParametersSync(PvmiMIOSession aSession, PvmiKeyType aIdentifier,
-                PvmiKvp*& aParameters, int& num_parameter_elements, PvmiCapabilityContext aContext);
-        virtual PVMFStatus writeFrameBuf(uint8* aData, uint32 aDataLen, const PvmiMediaXferHeader& data_header_info);
-
-        virtual void closeFrameBuf();
-        virtual void postLastFrame();
-
-        OSCL_IMPORT_REF ~AndroidSurfaceOutputOmap34xx();
-    private:
-        bool                    mUseOverlay;
-        sp<Overlay>             mOverlay;
-        int                     bufEnc;
-
-        int32                   iNumberOfBuffers;
-        int32                   iBufferSize;
-        bool                    mIsFirstFrame;
-        bool                    mConvert;
-    public:
-        BufferAllocOmap34xx     mbufferAlloc;
-};
-
-#endif // ANDROID_SURFACE_OUTPUT_OMAP34XX_H_INCLUDED
diff --git a/libopencorehw/buffer_alloc_omap34xx.cpp b/libopencorehw/buffer_alloc_omap34xx.cpp
deleted file mode 100644
index c830191..0000000
--- a/libopencorehw/buffer_alloc_omap34xx.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * OMAP3430 support
- *
- * Author: Michael Barabanov <michael.barabanov@windriver.com>
- * Author: Srini Gosangi <srini.gosangi@windriver.com>
-
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- */
-
-/* ------------------------------------------------------------------
- * Copyright (C) 2008 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-
-#define LOG_NDEBUG 0
-#define LOG_TAG "BufferAllocOmap34xx"
-#include <utils/Log.h>
-
-#include "buffer_alloc_omap34xx.h"
-#include "oscl_mem.h" // needed for oscl_malloc / oscl_free
-
-/* based on test code in pvmi/media_io/pvmiofileoutput/src/pvmi_media_io_fileoutput.cpp */
-
-BufferAllocOmap34xx::BufferAllocOmap34xx(): refCount(0), bufferSize(0), maxBuffers(4), numAllocated(0)
-{
-}
-
-BufferAllocOmap34xx::~BufferAllocOmap34xx()
-{
-
-}
-
-OSCL_EXPORT_REF void BufferAllocOmap34xx::addRef()
-{
-    ++refCount;
-}
-
-OSCL_EXPORT_REF void BufferAllocOmap34xx::removeRef()
-{
-    --refCount;
-    if (refCount <= 0)
-    {
-    	LOGV("BufferAllocOmap34xx::removeRef()");
-       // this->~BufferAllocOmap34xx();
-    }
-}
-
-
-OSCL_EXPORT_REF OsclAny* BufferAllocOmap34xx::allocate()
-{
-    if (numAllocated < maxBuffers)
-    {
-        OsclAny* ptr = buffer_address[numAllocated];
-        if (ptr) ++numAllocated;
-        return ptr;
-    }
-    return NULL;
-}
-
-OSCL_EXPORT_REF void BufferAllocOmap34xx::deallocate(OsclAny* ptr)
-{
-    if (ptr)
-    {
-        --numAllocated;
-    }
-}
-
-OSCL_EXPORT_REF uint32 BufferAllocOmap34xx::getBufferSize()
-{
-    return bufferSize;
-}
-
-OSCL_EXPORT_REF uint32 BufferAllocOmap34xx::getNumBuffers()
-{
-    return maxBuffers;
-}
-
-
-OSCL_EXPORT_REF bool BufferAllocOmap34xx::queryInterface(const PVUuid& uuid, PVInterface*& aInterface)
-{
-    aInterface = NULL; // initialize aInterface to NULL in case uuid is not supported
-
-    if (PVMFFixedSizeBufferAllocUUID == uuid)
-    {
-        // Send back ptr to the allocator interface object
-        PVMFFixedSizeBufferAlloc* myInterface	= OSCL_STATIC_CAST(PVMFFixedSizeBufferAlloc*, this);
-        refCount++; // increment interface refcount before returning ptr
-        aInterface = OSCL_STATIC_CAST(PVInterface*, myInterface);
-        return true;
-    }
-    return false;
-}
diff --git a/libopencorehw/buffer_alloc_omap34xx.h b/libopencorehw/buffer_alloc_omap34xx.h
deleted file mode 100644
index dbe72cd..0000000
--- a/libopencorehw/buffer_alloc_omap34xx.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * OMAP3430 support
- *
- * Author: Michael Barabanov <michael.barabanov@windriver.com>
- * Author: Srini Gosangi <srini.gosangi@windriver.com>
-
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- */
-
-/* ------------------------------------------------------------------
- * Copyright (C) 2008 PacketVideo
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- * express or implied.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- * -------------------------------------------------------------------
- */
-
-
-#ifndef BUFFER_ALLOC_OMAP34XXH_INCLUDED
-#define BUFFER_ALLOC_OMAP34XXH_INCLUDED
-
-#include "pv_interface.h"
-
-#ifndef PVMF_FIXEDSIZE_BUFFER_ALLOC_H_INCLUDED
-#include "pvmf_fixedsize_buffer_alloc.h"
-#endif
-
-/* based on test code in pvmi/media_io/pvmiofileoutput/include/pvmi_media_io_fileoutput.h */
-
-class BufferAllocOmap34xx: public PVInterface, public PVMFFixedSizeBufferAlloc
-{
-    public:
-
-        BufferAllocOmap34xx();
-
-        virtual ~BufferAllocOmap34xx();
-
-        OSCL_IMPORT_REF void addRef();
-
-        OSCL_IMPORT_REF void removeRef();
-
-        OSCL_IMPORT_REF bool queryInterface(const PVUuid& uuid, PVInterface*& aInterface) ;
-
-        OSCL_IMPORT_REF OsclAny* allocate();
-
-        OSCL_IMPORT_REF void deallocate(OsclAny* ptr) ;
-
-        OSCL_IMPORT_REF uint32 getBufferSize() ;
-
-        OSCL_IMPORT_REF uint32 getNumBuffers() ;
-
-    public:
-        int32 refCount;
-        int32 bufferSize;
-        int32 maxBuffers;
-        int32 numAllocated;
-        uint8** buffer_address;
-};
-
-#endif
diff --git a/liboverlay/Android.mk b/liboverlay/Android.mk
deleted file mode 100644
index 52f3c10..0000000
--- a/liboverlay/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-# HAL module implemenation stored in
-# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.product.board>.so
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
-LOCAL_SHARED_LIBRARIES := liblog libcutils
-LOCAL_SRC_FILES := v4l2_utils.c overlay.cpp
-LOCAL_MODULE := overlay.omap3
-include $(BUILD_SHARED_LIBRARY)
diff --git a/liboverlay/overlay.cpp b/liboverlay/overlay.cpp
deleted file mode 100644
index d441f51..0000000
--- a/liboverlay/overlay.cpp
+++ /dev/null
@@ -1,1145 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "TIOverlay"
-
-#include <hardware/hardware.h>
-#include <hardware/overlay.h>
-
-extern "C" {
-#include "v4l2_utils.h"
-}
-
-#include <pthread.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <linux/videodev.h>
-
-#include <cutils/log.h>
-#include <cutils/ashmem.h>
-#include <cutils/atomic.h>
-
-/*****************************************************************************/
-
-#define LOG_FUNCTION_NAME LOGV(" %s %s",  __FILE__, __FUNCTION__)
-
-#define NUM_OVERLAY_BUFFERS_REQUESTED  (8)
-#define SHARED_DATA_MARKER             (0x68759746) // OVRLYSHM on phone keypad
-
-/* These values should come from Surface Flinger */
-#define LCD_WIDTH 480
-#define LCD_HEIGHT 854
-
-#define CACHEABLE_BUFFERS 0x1
-
-#define ALL_BUFFERS_FLUSHED -66 //shared with Camera/Video Playback HAL
-
-typedef struct
-{
-  uint32_t posX;
-  uint32_t posY;
-  uint32_t posW;
-  uint32_t posH;
-  uint32_t rotation;
-} overlay_ctrl_t;
-
-typedef struct
-{
-  uint32_t cropX;
-  uint32_t cropY;
-  uint32_t cropW;
-  uint32_t cropH;
-} overlay_data_t;
-
-typedef struct
-{
-  uint32_t marker;
-  uint32_t size;
-
-  volatile int32_t refCnt;
-
-  uint32_t controlReady; // Only updated by the control side
-  uint32_t dataReady;    // Only updated by the data side
-
-  pthread_mutex_t lock;
-  pthread_mutexattr_t attr;
-
-  uint32_t streamEn;
-  uint32_t streamingReset;
-
-  uint32_t dispW;
-  uint32_t dispH;
-
-} overlay_shared_t;
-
-// Only one instance is created per platform
-struct overlay_control_context_t {
-    struct overlay_control_device_t device;
-    /* our private state goes below here */
-    struct overlay_t* overlay_video1;
-    struct overlay_t* overlay_video2;
-};
-
-// A separate instance is created per overlay data side user
-struct overlay_data_context_t {
-    struct overlay_data_device_t device;
-    /* our private state goes below here */
-    int ctl_fd;
-    int shared_fd;
-    int shared_size;
-    int width;
-    int height;
-    int format;
-    int num_buffers;
-    size_t *buffers_len;
-    void **buffers;
-
-    overlay_data_t    data;
-    overlay_shared_t  *shared;
-    mapping_data_t    *mapping_data;
-    // Need to count Qd buffers to be sure we don't block DQ'ing when exiting
-    int qd_buf_count;
-    int cacheable_buffers;
-};
-
-static int  create_shared_data(overlay_shared_t **shared);
-static void destroy_shared_data(int shared_fd, overlay_shared_t *shared, bool closefd);
-static int  open_shared_data(overlay_data_context_t *ctx);
-static void close_shared_data(overlay_data_context_t *ctx);
-enum { LOCK_REQUIRED = 1, NO_LOCK_NEEDED = 0 };
-static int  enable_streaming( overlay_shared_t *shared, int ovly_fd, int lock_required );
-
-static int overlay_device_open(const struct hw_module_t* module,
-                               const char* name, struct hw_device_t** device);
-
-static struct hw_module_methods_t overlay_module_methods = {
-    open: overlay_device_open
-};
-
-struct overlay_module_t HAL_MODULE_INFO_SYM = {
-    common: {
-        tag: HARDWARE_MODULE_TAG,
-        version_major: 1,
-        version_minor: 0,
-        id: OVERLAY_HARDWARE_MODULE_ID,
-        name: "Sample Overlay module",
-        author: "The Android Open Source Project",
-        methods: &overlay_module_methods,
-    }
-};
-
-/*****************************************************************************/
-
-/*
- * This is the overlay_t object, it is returned to the user and represents
- * an overlay. here we use a subclass, where we can store our own state.
- * This handles will be passed across processes and possibly given to other
- * HAL modules (for instance video decode modules).
- */
-struct handle_t : public native_handle {
-    /* add the data fields we need here, for instance: */
-    int ctl_fd;
-    int shared_fd;
-    int width;
-    int height;
-    int format;
-    int num_buffers;
-    int shared_size;
-};
-
-static int handle_format(const overlay_handle_t overlay) {
-    return static_cast<const struct handle_t *>(overlay)->format;
-}
-
-static int handle_ctl_fd(const overlay_handle_t overlay) {
-    return static_cast<const struct handle_t *>(overlay)->ctl_fd;
-}
-
-static int handle_shared_fd(const overlay_handle_t overlay) {
-    return static_cast<const struct handle_t *>(overlay)->shared_fd;
-}
-
-static int handle_num_buffers(const overlay_handle_t overlay) {
-    return static_cast<const struct handle_t *>(overlay)->num_buffers;
-}
-
-static int handle_width(const overlay_handle_t overlay) {
-    return static_cast<const struct handle_t *>(overlay)->width;
-}
-
-static int handle_height(const overlay_handle_t overlay) {
-    return static_cast<const struct handle_t *>(overlay)->height;
-}
-
-static int handle_shared_size(const overlay_handle_t overlay) {
-    return static_cast<const struct handle_t *>(overlay)->shared_size;
-}
-
-// A separate instance of this class is created per overlay
-class overlay_object : public overlay_t
-{
-    handle_t mHandle;
-
-    overlay_ctrl_t    mCtl;
-    overlay_ctrl_t    mCtlStage;
-    overlay_shared_t *mShared;
-
-    static overlay_handle_t getHandleRef(struct overlay_t* overlay) {
-        /* returns a reference to the handle, caller doesn't take ownership */
-        return &(static_cast<overlay_object *>(overlay)->mHandle);
-    }
-
-public:
-    overlay_object(int ctl_fd, int shared_fd, int shared_size, int w, int h,
-                   int format, int num_buffers) {
-        this->overlay_t::getHandleRef = getHandleRef;
-        mHandle.version     = sizeof(native_handle);
-        mHandle.numFds      = 2;
-        mHandle.numInts     = 5; // extra ints we have in our handle
-        mHandle.ctl_fd      = ctl_fd;
-        mHandle.shared_fd   = shared_fd;
-        mHandle.width       = w;
-        mHandle.height      = h;
-        mHandle.format      = format;
-        mHandle.num_buffers = num_buffers;
-        mHandle.shared_size = shared_size;
-        this->w = w;
-        this->h = h;
-        this->format = format;
-
-        memset( &mCtl, 0, sizeof( mCtl ) );
-        memset( &mCtlStage, 0, sizeof( mCtlStage ) );
-    }
-
-    int               ctl_fd()    { return mHandle.ctl_fd; }
-    int               shared_fd() { return mHandle.shared_fd; }
-    overlay_ctrl_t*   data()      { return &mCtl; }
-    overlay_ctrl_t*   staging()   { return &mCtlStage; }
-    overlay_shared_t* getShared() { return mShared; }
-    void              setShared( overlay_shared_t *p ) { mShared = p; }
-};
-
-// ****************************************************************************
-// Local Functions
-// ****************************************************************************
-
-static int create_shared_data(overlay_shared_t **shared)
-{
-    int fd;
-    // assuming sizeof(overlay_shared_t) < a single page
-    int size = getpagesize();
-    overlay_shared_t *p;
-
-    if ((fd = ashmem_create_region("overlay_data", size)) < 0) {
-        LOGE("Failed to Create Overlay Shared Data!\n");
-        return fd;
-    }
-
-    p = (overlay_shared_t*)mmap(NULL, size, PROT_READ | PROT_WRITE,
-                                MAP_SHARED, fd, 0);
-    if (p == MAP_FAILED) {
-        LOGE("Failed to Map Overlay Shared Data!\n");
-        close(fd);
-        return -1;
-    }
-
-    memset(p, 0, size);
-    p->marker = SHARED_DATA_MARKER;
-    p->size   = size;
-    p->refCnt = 1;
-    int ret = 0;
-    if ((ret = pthread_mutexattr_init(&p->attr)) != 0) {
-        LOGE("Failed to initialize overlay mutex attr");
-    }
-    if (ret == 0 && (ret = pthread_mutexattr_setpshared(&p->attr, PTHREAD_PROCESS_SHARED)) != 0) {
-       LOGE("Failed to set the overlay mutex attr to be shared across-processes");
-    }
-    if (ret == 0 && (ret = pthread_mutex_init(&p->lock, &p->attr)) != 0) {
-        LOGE("Failed to initialize overlay mutex\n");
-    }
-    if (ret != 0) {
-        munmap(p, size);
-        close(fd);
-        return -1;
-    }
-    *shared = p;
-    return fd;
-}
-
-static void destroy_shared_data( int shared_fd, overlay_shared_t *shared, bool closefd )
-{
-    if (shared == NULL)
-        return;
-
-    // Last side deallocated releases the mutex, otherwise the remaining
-    // side will deadlock trying to use an already released mutex
-    if (android_atomic_dec(&shared->refCnt) == 1) {
-        if (pthread_mutex_destroy(&shared->lock)) {
-            LOGE("Failed to uninitialize overlay mutex!\n");
-        }
-
-        if (pthread_mutexattr_destroy(&shared->attr)) {
-            LOGE("Failed to uninitialize the overlay mutex attr!\n");
-        }
-        shared->marker = 0;
-    }
-
-    if (munmap(shared, shared->size)) {
-        LOGE("Failed to Unmap Overlay Shared Data!\n");
-    }
-
-    if (closefd && close(shared_fd)) {
-        LOGE("Failed to Close Overlay Shared Data!\n");
-    }
-}
-
-static int open_shared_data( overlay_data_context_t *ctx )
-{
-    int rc   = -1;
-    int mode = PROT_READ | PROT_WRITE;
-    int fd   = ctx->shared_fd;
-    int size = ctx->shared_size;
-
-    if (ctx->shared != NULL) {
-        // Already open, return success
-        LOGI("Overlay Shared Data Already Open\n");
-        return 0;
-    }
-    ctx->shared = (overlay_shared_t*)mmap(0, size, mode, MAP_SHARED, fd, 0);
-
-    if (ctx->shared == MAP_FAILED) {
-        LOGE("Failed to Map Overlay Shared Data!\n");
-    } else if ( ctx->shared->marker != SHARED_DATA_MARKER ) {
-        LOGE("Invalid Overlay Shared Marker!\n");
-        munmap( ctx->shared, size);
-    } else if ( (int)ctx->shared->size != size ) {
-        LOGE("Invalid Overlay Shared Size!\n");
-        munmap(ctx->shared, size);
-    } else {
-        android_atomic_inc(&ctx->shared->refCnt);
-        rc = 0;
-    }
-
-    return rc;
-}
-
-static void close_shared_data(overlay_data_context_t *ctx)
-{
-    destroy_shared_data(ctx->shared_fd, ctx->shared, false);
-    ctx->shared = NULL;
-}
-
-static int enable_streaming_locked(overlay_shared_t *shared, int ovly_fd)
-{
-    int rc = 0;
-
-    if (!shared->controlReady || !shared->dataReady) {
-        LOGI("Postponing Stream Enable/%d/%d\n", shared->controlReady,
-             shared->dataReady);
-    } else {
-        shared->streamEn = 1;
-        rc = v4l2_overlay_stream_on(ovly_fd);
-        if (rc) {
-            LOGE("Stream Enable Failed!/%d\n", rc);
-            shared->streamEn = 0;
-        }
-    }
-
-    return rc;
-}
-
-static int enable_streaming(overlay_shared_t *shared, int ovly_fd)
-{
-    int ret;
-
-    pthread_mutex_lock(&shared->lock);
-    ret = enable_streaming_locked(shared, ovly_fd);
-    pthread_mutex_unlock(&shared->lock);
-    return ret;
-}
-
-static int disable_streaming_locked(overlay_shared_t *shared, int ovly_fd)
-{
-    int ret = 0;
-
-    if (shared->streamEn) {
-        ret = v4l2_overlay_stream_off( ovly_fd );
-        if (ret) {
-            LOGE("Stream Off Failed!/%d\n", ret);
-        } else {
-            shared->streamingReset = 1;
-            shared->streamEn = 0;
-        }
-    }
-
-    return ret;
-}
-
-// ****************************************************************************
-// Control module
-// ****************************************************************************
-
-static int overlay_get(struct overlay_control_device_t *dev, int name)
-{
-    int result = -1;
-
-    switch (name) {
-        case OVERLAY_MINIFICATION_LIMIT:   result = 0;  break; // 0 = no limit
-        case OVERLAY_MAGNIFICATION_LIMIT:  result = 0;  break; // 0 = no limit
-        case OVERLAY_SCALING_FRAC_BITS:    result = 0;  break; // 0 = infinite
-        case OVERLAY_ROTATION_STEP_DEG:    result = 90; break; // 90 rotation steps (for instance)
-        case OVERLAY_HORIZONTAL_ALIGNMENT: result = 1;  break; // 1-pixel alignment
-        case OVERLAY_VERTICAL_ALIGNMENT:   result = 1;  break; // 1-pixel alignment
-        case OVERLAY_WIDTH_ALIGNMENT:      result = 1;  break; // 1-pixel alignment
-        case OVERLAY_HEIGHT_ALIGNMENT:     break;
-    }
-
-    return result;
-}
-
-static overlay_t* overlay_createOverlay(struct overlay_control_device_t *dev,
-                                        uint32_t w, uint32_t h, int32_t  format)
-{
-    LOGD("overlay_createOverlay:IN w=%d h=%d format=%d\n", w, h, format);
-    LOG_FUNCTION_NAME;
-
-    overlay_object            *overlay;
-    overlay_control_context_t *ctx = (overlay_control_context_t *)dev;
-    overlay_shared_t          *shared;
-
-    int ret;
-    uint32_t num = NUM_OVERLAY_BUFFERS_REQUESTED;
-    int fd;
-    int shared_fd;
-
-    if (format == OVERLAY_FORMAT_DEFAULT)
-    {
-        format = OVERLAY_FORMAT_YCbYCr_422_I;
-    }
-
-    if (ctx->overlay_video1) {
-        LOGE("Error - overlays already in use\n");
-        return NULL;
-    }
-
-    shared_fd = create_shared_data(&shared);
-    if (shared_fd < 0) {
-        LOGE("Failed to create shared data");
-        return NULL;
-    }
-
-    fd = v4l2_overlay_open(V4L2_OVERLAY_PLANE_VIDEO1);
-    if (fd < 0) {
-        LOGE("Failed to open overlay device\n");
-        goto error;
-    }
-
-    if (v4l2_overlay_init(fd, w, h, format)) {
-        LOGE("Failed initializing overlays\n");
-        goto error1;
-    }
-
-    if (v4l2_overlay_set_crop(fd, 0, 0, w, h)) {
-        LOGE("Failed defaulting crop window\n");
-        goto error1;
-    }
-
-    if (v4l2_overlay_set_rotation(fd, 0, 0)) {
-        LOGE("Failed defaulting rotation\n");
-        goto error1;
-    }
-
-    if (v4l2_overlay_req_buf(fd, &num, 0)) {
-        LOGE("Failed requesting buffers\n");
-        goto error1;
-    }
-
-   overlay = new overlay_object(fd, shared_fd, shared->size, w, h, format, num);
-   if (overlay == NULL) {
-        LOGE("Failed to create overlay object\n");
-        goto error1;
-   }
-   ctx->overlay_video1 = overlay;
-
-   overlay->setShared(shared);
-
-   shared->controlReady = 0;
-   shared->streamEn = 0;
-   shared->streamingReset = 0;
-   shared->dispW = LCD_WIDTH; // Need to determine this properly
-   shared->dispH = LCD_HEIGHT; // Need to determine this properly
-
-    LOGI("Opened video1/fd=%d/obj=%08lx/shm=%d/size=%d", fd,
-        (unsigned long)overlay, shared_fd, shared->size);
-
-
-    LOGD("overlay_createOverlay: OUT");
-    return overlay;
-
-error1:
-    close(fd);
-error:
-    destroy_shared_data(shared_fd, shared, true);
-    return NULL;
-}
-
-static void overlay_destroyOverlay(struct overlay_control_device_t *dev,
-                                   overlay_t* overlay)
-{
-    LOGD("overlay_destroyOverlay:IN dev (%p) and overlay (%p)", dev, overlay);
-    LOG_FUNCTION_NAME;
-
-    overlay_control_context_t *ctx = (overlay_control_context_t *)dev;
-    overlay_object *obj = static_cast<overlay_object *>(overlay);
-
-    int rc;
-    int fd = obj->ctl_fd();
-    overlay_shared_t *shared = obj->getShared();
-
-    if (shared == NULL) {
-        LOGE("Overlay was already destroyed - nothing needs to be done\n");
-        return;
-    }
-
-    pthread_mutex_lock(&shared->lock);
-
-    disable_streaming_locked(shared, fd);
-
-    pthread_mutex_unlock(&shared->lock);
-
-    destroy_shared_data(obj->shared_fd(), shared, true);
-    obj->setShared(NULL);
-
-    LOGI("Destroying overlay/fd=%d/obj=%08lx", fd, (unsigned long)overlay);
-
-    if (close(fd)) {
-        LOGE( "Error closing overly fd/%d\n", errno);
-    }
-
-    if (overlay) {
-        if (ctx->overlay_video1 == overlay)
-            ctx->overlay_video1 = NULL;
-        delete overlay;
-        overlay = NULL;
-    }
-    LOGD("overlay_destroyOverlay:OUT");
-}
-
-static int overlay_setPosition(struct overlay_control_device_t *dev,
-                               overlay_t* overlay, int x, int y, uint32_t w,
-                               uint32_t h)
-{
-    LOG_FUNCTION_NAME;
-
-    overlay_object *obj = static_cast<overlay_object *>(overlay);
-
-    overlay_ctrl_t   *stage  = obj->staging();
-    overlay_shared_t *shared = obj->getShared();
-
-    int rc = 0;
-
-    // FIXME:  This is a hack to deal with seemingly unintentional negative
-    // offset that pop up now and again.  I believe the negative offsets are
-    // due to a surface flinger bug that has not yet been found or fixed.
-    //
-    // This logic here is to return an error if the rectangle is not fully
-    // within the display, unless we have not received a valid position yet,
-    // in which case we will do our best to adjust the rectangle to be within
-    // the display.
-
-    // Require a minimum size
-    if (w < 16 || h < 16) {
-        // Return an error
-        rc = -1;
-    } else if (!shared->controlReady) {
-        if ( x < 0 ) x = 0;
-        if ( y < 0 ) y = 0;
-        if ( w > shared->dispW ) w = shared->dispW;
-        if ( h > shared->dispH ) h = shared->dispH;
-        if ( (x + w) > shared->dispW ) w = shared->dispW - x;
-        if ( (y + h) > shared->dispH ) h = shared->dispH - y;
-    } else if (x < 0 || y < 0 || (x + w) > shared->dispW ||
-               (y + h) > shared->dispH) {
-        // Return an error
-        rc = -1;
-    }
-
-    if (rc == 0) {
-        stage->posX = x;
-        stage->posY = y;
-        stage->posW = w;
-        stage->posH = h;
-    }
-
-    return rc;
-}
-
-static int overlay_getPosition(struct overlay_control_device_t *dev,
-                               overlay_t* overlay, int* x, int* y, uint32_t* w,
-                               uint32_t* h)
-{
-    LOG_FUNCTION_NAME;
-
-    int fd = static_cast<overlay_object *>(overlay)->ctl_fd();
-
-    if (v4l2_overlay_get_position(fd, x, y, (int32_t*)w, (int32_t*)h)) {
-        return -EINVAL;
-    }
-    return 0;
-}
-
-static int overlay_setParameter(struct overlay_control_device_t *dev,
-                                overlay_t* overlay, int param, int value)
-{
-    LOG_FUNCTION_NAME;
-
-    overlay_ctrl_t *stage = static_cast<overlay_object *>(overlay)->staging();
-    int rc = 0;
-
-    switch (param) {
-    case OVERLAY_DITHER:
-        break;
-
-    case OVERLAY_TRANSFORM:
-        switch ( value )
-        {
-        case 0:
-            stage->rotation = 0;
-            break;
-        case OVERLAY_TRANSFORM_ROT_90:
-            stage->rotation = 90;
-            break;
-        case OVERLAY_TRANSFORM_ROT_180:
-            stage->rotation = 180;
-            break;
-        case OVERLAY_TRANSFORM_ROT_270:
-            stage->rotation = 270;
-            break;
-        default:
-            rc = -EINVAL;
-            break;
-        }
-        break;
-    }
-
-    return rc;
-}
-
-static int overlay_stage(struct overlay_control_device_t *dev,
-                          overlay_t* overlay) {
-    return 0;
-}
-
-static int overlay_commit(struct overlay_control_device_t *dev,
-                          overlay_t* overlay) {
-    LOG_FUNCTION_NAME;
-
-    overlay_object *obj = static_cast<overlay_object *>(overlay);
-
-    overlay_ctrl_t   *data   = obj->data();
-    overlay_ctrl_t   *stage  = obj->staging();
-    overlay_shared_t *shared = obj->getShared();
-
-    int ret = 0;
-    int fd = obj->ctl_fd();
-
-    if (shared == NULL) {
-        LOGI("Shared Data Not Init'd!\n");
-        return -1;
-    }
-
-    pthread_mutex_lock(&shared->lock);
-
-    if (!shared->controlReady) {
-        shared->controlReady = 1;
-    }
-
-    if (data->posX == stage->posX && data->posY == stage->posY &&
-        data->posW == stage->posW && data->posH == stage->posH &&
-        data->rotation == stage->rotation) {
-        LOGI("Nothing to do!\n");
-        goto end;
-    }
-
-    LOGI("Position/X%d/Y%d/W%d/H%d\n", data->posX, data->posY, data->posW,
-         data->posH);
-    LOGI("Adjusted Position/X%d/Y%d/W%d/H%d\n", stage->posX, stage->posY,
-         stage->posW, data->posH);
-    LOGI("Rotation/%d\n", stage->rotation );
-
-    if ((ret = disable_streaming_locked(shared, fd)))
-        goto end;
-
-    if (stage->rotation != data->rotation) {
-        ret = v4l2_overlay_set_rotation(fd, stage->rotation, 0);
-        if (ret) {
-            LOGE("Set Rotation Failed!/%d\n", ret);
-            goto end;
-        }
-        data->rotation = stage->rotation;
-    }
-
-    if (!(stage->posX == data->posX && stage->posY == data->posY &&
-        stage->posW == data->posW && stage->posH == data->posH)) {
-        ret = v4l2_overlay_set_position(fd, stage->posX, stage->posY,
-                                        stage->posW, stage->posH);
-        if (ret) {
-            LOGE("Set Position Failed!/%d\n", ret);
-            goto end;
-        }
-        data->posX = stage->posX;
-        data->posY = stage->posY;
-        data->posW = stage->posW;
-        data->posH = stage->posH;
-    }
-
-    ret = enable_streaming_locked(shared, fd);
-
-end:
-    pthread_mutex_unlock(&shared->lock);
-
-    return ret;
-}
-
-static int overlay_control_close(struct hw_device_t *dev)
-{
-    LOG_FUNCTION_NAME;
-
-    struct overlay_control_context_t* ctx = (struct overlay_control_context_t*)dev;
-    overlay_object *overlay_v1;
-    //overlay_object *overlay_v2;
-
-    if (ctx) {
-        overlay_v1 = static_cast<overlay_object *>(ctx->overlay_video1);
-        //overlay_v2 = static_cast<overlay_object *>(ctx->overlay_video2);
-
-        overlay_destroyOverlay((struct overlay_control_device_t *)ctx,
-                               overlay_v1);
-        //overlay_destroyOverlay((struct overlay_control_device_t *)ctx, overlay_v2);
-
-        free(ctx);
-    }
-    return 0;
-}
-
-// ****************************************************************************
-// Data module
-// ****************************************************************************
-
-int overlay_initialize(struct overlay_data_device_t *dev,
-                       overlay_handle_t handle)
-{
-    LOG_FUNCTION_NAME;
-
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-    struct stat stat;
-
-    int i;
-    int rc = -1;
-
-    ctx->num_buffers  = handle_num_buffers(handle);
-    ctx->width        = handle_width(handle);
-    ctx->height       = handle_height(handle);
-    ctx->format       = handle_format(handle);
-    ctx->ctl_fd       = handle_ctl_fd(handle);
-    ctx->shared_fd    = handle_shared_fd(handle);
-    ctx->shared_size  = handle_shared_size(handle);
-    ctx->shared       = NULL;
-    ctx->qd_buf_count = 0;
-    ctx->cacheable_buffers = 0;
-
-    if (fstat(ctx->ctl_fd, &stat)) {
-        LOGE("Error = %s from %s\n", strerror(errno), "overlay initialize");
-        return -1;
-    }
-
-    if (open_shared_data(ctx)) {
-        return -1;
-    }
-
-    ctx->shared->dataReady = 0;
-
-    ctx->mapping_data = new mapping_data_t;
-    ctx->buffers     = new void* [ctx->num_buffers];
-    ctx->buffers_len = new size_t[ctx->num_buffers];
-    if (!ctx->buffers || !ctx->buffers_len || !ctx->mapping_data) {
-            LOGE("Failed alloc'ing buffer arrays\n");
-            close_shared_data(ctx);
-    } else {
-        for (i = 0; i < ctx->num_buffers; i++) {
-            rc = v4l2_overlay_map_buf(ctx->ctl_fd, i, &ctx->buffers[i],
-                                       &ctx->buffers_len[i]);
-            if (rc) {
-                LOGE("Failed mapping buffers\n");
-                close_shared_data( ctx );
-                break;
-            }
-        }
-    }
-
-    return ( rc );
-}
-
-static int overlay_resizeInput(struct overlay_data_device_t *dev, uint32_t w,
-                               uint32_t h)
-{
-    int rc = -1;
-
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-
-    if ((ctx->width == (int)w) && (ctx->width == (int)h)) {
-        LOGV("same as current width and height. so do nothing");
-        return 0;
-    }
-
-    if (!ctx->shared) {
-        LOGI("Shared Data Not Init'd!\n");
-        return -1;
-    }
-
-    if (ctx->shared->dataReady) {
-        LOGV("Either setCrop() or queueBuffer() was called prior to this!"
-             "Therefore failing this call.\n");
-        return -1;
-    }
-
-    pthread_mutex_lock(&ctx->shared->lock);
-
-    if ((rc = disable_streaming_locked(ctx->shared, ctx->ctl_fd)))
-        goto end;
-
-    for (int i = 0; i < ctx->num_buffers; i++) {
-        v4l2_overlay_unmap_buf(ctx->buffers[i], ctx->buffers_len[i]);      
-    }
-
-    rc = v4l2_overlay_init(ctx->ctl_fd, w, h, ctx->format);
-    if (rc) {
-        LOGE("Error initializing overlay");
-        goto end;
-    }
-    rc = v4l2_overlay_set_crop(ctx->ctl_fd, 0, 0, w, h);
-    if (rc) {
-        LOGE("Error setting crop window\n");
-        goto end;
-    }
-    rc = v4l2_overlay_req_buf(ctx->ctl_fd, (uint32_t *)(&ctx->num_buffers),
-                              ctx->cacheable_buffers);
-    if (rc) {
-        LOGE("Error creating buffers");
-        goto end;
-    }
-
-    for (int i = 0; i < ctx->num_buffers; i++)
-        v4l2_overlay_map_buf(ctx->ctl_fd, i, &ctx->buffers[i],
-                             &ctx->buffers_len[i]);
-
-    rc = enable_streaming_locked(ctx->shared, ctx->ctl_fd);
-
-end:
-    pthread_mutex_unlock(&ctx->shared->lock);
-
-    return rc;
-}
-
-
-static int overlay_data_setParameter(struct overlay_data_device_t *dev,
-                                     int param, int value)
-{
-    int ret = 0;
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-
-    if (ctx->shared == NULL)
-    {
-        LOGI("Shared Data Not Init'd!\n");
-        return -1;
-    }
-
-    if (ctx->shared->dataReady) {
-        LOGI("Too late. Cant set it now!\n");
-        return -1;
-    }
-
-    if (param == CACHEABLE_BUFFERS)
-        ctx->cacheable_buffers = value;
-
-    //ret = v4l2_overlay_set_attributes(ctx->ctl_fd, param, value);
-    return ( ret );
-}
-
-
-static int overlay_setCrop(struct overlay_data_device_t *dev, uint32_t x,
-                           uint32_t y, uint32_t w, uint32_t h) {
-    LOG_FUNCTION_NAME;
-
-    int rc = 0;
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-
-    if (ctx->shared == NULL) {
-        LOGI("Shared Data Not Init'd!\n");
-        return -1;
-    }
-
-    pthread_mutex_lock(&ctx->shared->lock);
-
-    ctx->shared->dataReady = 1;
-
-    if (ctx->data.cropX == x && ctx->data.cropY == y && ctx->data.cropW == w
-        && ctx->data.cropH == h) {
-        LOGI("Nothing to do!\n");
-        goto end;
-    }
-
-    ctx->data.cropX = x;
-    ctx->data.cropY = y;
-    ctx->data.cropW = w;
-    ctx->data.cropH = h;
-
-    LOGI("Crop Win/X%d/Y%d/W%d/H%d\n", x, y, w, h );
-
-    if ((rc = disable_streaming_locked(ctx->shared, ctx->ctl_fd)))
-        goto end;
-
-    rc = v4l2_overlay_set_crop(ctx->ctl_fd, x, y, w, h);
-    if (rc) {
-        LOGE("Set Crop Window Failed!/%d\n", rc);
-    }
-
-    rc = enable_streaming_locked(ctx->shared, ctx->ctl_fd);
-
-end:
-    pthread_mutex_unlock(&ctx->shared->lock);
-    return rc;
-}
-
-static int overlay_getCrop(struct overlay_data_device_t *dev , uint32_t* x,
-                           uint32_t* y, uint32_t* w, uint32_t* h) {
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-
-    return v4l2_overlay_get_crop(ctx->ctl_fd, x, y, w, h);
-}
-
-int overlay_dequeueBuffer(struct overlay_data_device_t *dev,
-                          overlay_buffer_t *buffer) {
-    /* blocks until a buffer is available and return an opaque structure
-     * representing this buffer.
-     */
-
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-
-    int rc;
-    int i = -1;
-
-    pthread_mutex_lock(&ctx->shared->lock);
-    if ( ctx->shared->streamingReset )
-    {
-        ctx->shared->streamingReset = 0;
-        pthread_mutex_unlock(&ctx->shared->lock);
-        return ALL_BUFFERS_FLUSHED;
-    }
-    pthread_mutex_unlock(&ctx->shared->lock);
-
-    // If we are not streaming dequeue will fail, skip to prevent error printouts
-    if (ctx->shared->streamEn) {
-        if ((rc = v4l2_overlay_dq_buf( ctx->ctl_fd, &i )) != 0) {
-            LOGE("Failed to DQ/%d\n", rc);
-        }
-        else if (i < 0 || i > ctx->num_buffers) {
-            rc = -EINVAL;
-        } else {
-            *((int *)buffer) = i;
-            ctx->qd_buf_count --;
-        }
-    } else {
-        rc = -1;
-    }
-
-    return rc;
-}
-
-int overlay_queueBuffer(struct overlay_data_device_t *dev,
-                        overlay_buffer_t buffer) {
-
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-
-    pthread_mutex_lock(&ctx->shared->lock);
-    if ( ctx->shared->streamingReset )
-    {
-        ctx->shared->streamingReset = 0;
-        pthread_mutex_unlock(&ctx->shared->lock);
-        return ALL_BUFFERS_FLUSHED;
-    }
-    pthread_mutex_unlock(&ctx->shared->lock);
-
-    // Catch the case where the data side had no need to set the crop window
-    if (!ctx->shared->dataReady) {
-        ctx->shared->dataReady = 1;
-        enable_streaming(ctx->shared, ctx->ctl_fd);
-    }
-
-    int rc = v4l2_overlay_q_buf( ctx->ctl_fd, (int)buffer );
-    if (rc == 0 && ctx->qd_buf_count < ctx->num_buffers) {
-        ctx->qd_buf_count ++;
-    }
-
-    return rc;
-}
-
-void *overlay_getBufferAddress(struct overlay_data_device_t *dev,
-                               overlay_buffer_t buffer)
-{
-    LOG_FUNCTION_NAME;
-
-    /* this may fail (NULL) if this feature is not supported. In that case,
-     * presumably, there is some other HAL module that can fill the buffer,
-     * using a DSP for instance
-     */
-    int ret;
-    struct v4l2_buffer buf;
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-
-    ret = v4l2_overlay_query_buffer(ctx->ctl_fd, (int)buffer, &buf);
-
-    if (ret)
-        return NULL;
-
-    // Initialize ctx->mapping_data
-    memset(ctx->mapping_data, 0, sizeof(mapping_data_t));
-
-    ctx->mapping_data->fd = ctx->ctl_fd;
-    ctx->mapping_data->length = buf.length;
-    ctx->mapping_data->offset = buf.m.offset;
-    ctx->mapping_data->ptr = NULL;
-
-    if ((int)buffer >= 0 && (int)buffer < ctx->num_buffers) {
-        ctx->mapping_data->ptr = ctx->buffers[(int)buffer];
-        LOGI("Buffer/%d/addr=%08lx/len=%d", (int)buffer, (unsigned long)ctx->mapping_data->ptr,
-             ctx->buffers_len[(int)buffer]);
-    }
-
-    return (void *)ctx->mapping_data;
-}
-
-int overlay_getBufferCount(struct overlay_data_device_t *dev)
-{
-    LOG_FUNCTION_NAME;
-
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-
-    return (ctx->num_buffers);
-}
-
-static int overlay_data_close(struct hw_device_t *dev) {
-
-    LOG_FUNCTION_NAME;
-
-    struct overlay_data_context_t* ctx = (struct overlay_data_context_t*)dev;
-    int rc;
-
-    if (ctx) {
-        overlay_data_device_t *overlay_dev = &ctx->device;
-        int buf;
-        int i;
-
-        pthread_mutex_lock(&ctx->shared->lock);
-
-        for (i = 0; i < ctx->num_buffers; i++) {
-            LOGV("Unmap Buffer/%d/%08lx/%d", i, (unsigned long)ctx->buffers[i], ctx->buffers_len[i] );
-            rc = v4l2_overlay_unmap_buf(ctx->buffers[i], ctx->buffers_len[i]);
-            if (rc != 0) {
-                LOGE("Error unmapping the buffer/%d/%d", i, rc);
-            }
-        }
-
-        delete(ctx->mapping_data);
-        delete(ctx->buffers);
-        delete(ctx->buffers_len);
-
-        pthread_mutex_unlock(&ctx->shared->lock);
-
-        ctx->shared->dataReady = 0;
-        close_shared_data( ctx );
-
-        free(ctx);
-    }
-
-    return 0;
-}
-
-/*****************************************************************************/
-
-static int overlay_device_open(const struct hw_module_t* module,
-                               const char* name, struct hw_device_t** device)
-{
-    LOG_FUNCTION_NAME;
-    int status = -EINVAL;
-
-    if (!strcmp(name, OVERLAY_HARDWARE_CONTROL)) {
-        struct overlay_control_context_t *dev;
-        dev = (overlay_control_context_t*)malloc(sizeof(*dev));
-
-        /* initialize our state here */
-        memset(dev, 0, sizeof(*dev));
-
-        /* initialize the procs */
-        dev->device.common.tag = HARDWARE_DEVICE_TAG;
-        dev->device.common.version = 0;
-        dev->device.common.module = const_cast<hw_module_t*>(module);
-        dev->device.common.close = overlay_control_close;
-
-        dev->device.get = overlay_get;
-        dev->device.createOverlay = overlay_createOverlay;
-        dev->device.destroyOverlay = overlay_destroyOverlay;
-        dev->device.setPosition = overlay_setPosition;
-        dev->device.getPosition = overlay_getPosition;
-        dev->device.setParameter = overlay_setParameter;
-        dev->device.stage = overlay_stage;
-        dev->device.commit = overlay_commit;
-
-        *device = &dev->device.common;
-        status = 0;
-    } else if (!strcmp(name, OVERLAY_HARDWARE_DATA)) {
-        struct overlay_data_context_t *dev;
-        dev = (overlay_data_context_t*)malloc(sizeof(*dev));
-
-        /* initialize our state here */
-        memset(dev, 0, sizeof(*dev));
-
-        /* initialize the procs */
-        dev->device.common.tag = HARDWARE_DEVICE_TAG;
-        dev->device.common.version = 0;
-        dev->device.common.module = const_cast<hw_module_t*>(module);
-        dev->device.common.close = overlay_data_close;
-
-        dev->device.initialize = overlay_initialize;
-        dev->device.resizeInput = overlay_resizeInput;
-        dev->device.setCrop = overlay_setCrop;
-        dev->device.getCrop = overlay_getCrop;
-        dev->device.setParameter = overlay_data_setParameter;
-        dev->device.dequeueBuffer = overlay_dequeueBuffer;
-        dev->device.queueBuffer = overlay_queueBuffer;
-        dev->device.getBufferAddress = overlay_getBufferAddress;
-        dev->device.getBufferCount = overlay_getBufferCount;
-
-        *device = &dev->device.common;
-        status = 0;
-    }
-    return status;
-}
diff --git a/liboverlay/v4l2_utils.c b/liboverlay/v4l2_utils.c
deleted file mode 100644
index 78aa3ff..0000000
--- a/liboverlay/v4l2_utils.c
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define OVERLAY_DEBUG 1
-#define LOG_TAG "Overlay"
-
-#include <fcntl.h>
-#include <errno.h>
-#include <cutils/log.h>
-#include <hardware/overlay.h>
-#include <linux/videodev.h>
-#include <sys/ioctl.h>
-#include <sys/mman.h>
-#include "v4l2_utils.h"
-
-#define LOG_FUNCTION_NAME    LOGV("%s: %s",  __FILE__, __FUNCTION__);
-
-#ifndef LOGE
-#define LOGE(fmt,args...) \
-        do { printf(fmt, ##args); } \
-        while (0)
-#endif
-
-#ifndef LOGI
-#define LOGI(fmt,args...) \
-        do { LOGE(fmt, ##args); } \
-        while (0)
-#endif
-#define V4L2_CID_PRIV_OFFSET			0x00530000
-#define V4L2_CID_PRIV_ROTATION		(V4L2_CID_PRIVATE_BASE \
-						+ V4L2_CID_PRIV_OFFSET + 0)
-#define V4L2_CID_PRIV_COLORKEY		(V4L2_CID_PRIVATE_BASE \
-						+ V4L2_CID_PRIV_OFFSET + 1)
-#define V4L2_CID_PRIV_COLORKEY_EN	(V4L2_CID_PRIVATE_BASE \
-						+ V4L2_CID_PRIV_OFFSET + 2)
-
-
-
-int v4l2_overlay_get(int name) {
-    int result = -1;
-    switch (name) {
-        case OVERLAY_MINIFICATION_LIMIT:
-            result = 4; // 0 = no limit
-            break;
-        case OVERLAY_MAGNIFICATION_LIMIT:
-            result = 2; // 0 = no limit
-            break;
-        case OVERLAY_SCALING_FRAC_BITS:
-            result = 0; // 0 = infinite
-            break;
-        case OVERLAY_ROTATION_STEP_DEG:
-            result = 90; // 90 rotation steps (for instance)
-            break;
-        case OVERLAY_HORIZONTAL_ALIGNMENT:
-            result = 1; // 1-pixel alignment
-            break;
-        case OVERLAY_VERTICAL_ALIGNMENT:
-            result = 1; // 1-pixel alignment
-            break;
-        case OVERLAY_WIDTH_ALIGNMENT:
-            result = 1; // 1-pixel alignment
-            break;
-        case OVERLAY_HEIGHT_ALIGNMENT:
-            result = 1; // 1-pixel alignment
-            break;
-    }
-    return result;
-}
-
-int v4l2_overlay_open(int id)
-{
-    LOG_FUNCTION_NAME
-
-    if (id == V4L2_OVERLAY_PLANE_VIDEO1)
-        return open("/dev/video1", O_RDWR);
-    else if (id == V4L2_OVERLAY_PLANE_VIDEO2)
-        return open("/dev/video2", O_RDWR);
-    return -EINVAL;
-}
-
-void dump_pixfmt(struct v4l2_pix_format *pix)
-{
-    LOGI("w: %d\n", pix->width);
-    LOGI("h: %d\n", pix->height);
-    LOGI("color: %x\n", pix->colorspace);
-    switch (pix->pixelformat) {
-        case V4L2_PIX_FMT_YUYV:
-            LOGI ("YUYV\n");
-            break;
-        case V4L2_PIX_FMT_UYVY:
-            LOGI ("UYVY\n");
-            break;
-        case V4L2_PIX_FMT_RGB565:
-            LOGI ("RGB565\n");
-            break;
-        case V4L2_PIX_FMT_RGB565X:
-            LOGI ("RGB565X\n");
-            break;
-        default:
-            LOGI("not supported\n");
-    }
-}
-
-void dump_crop(struct v4l2_crop *crop)
-{
-    LOGI("crop l: %d ", crop->c.left);
-    LOGI("crop t: %d ", crop->c.top);
-    LOGI("crop w: %d ", crop->c.width);
-    LOGI("crop h: %d\n", crop->c.height);
-}
-
-void dump_window(struct v4l2_window *win)
-{
-    LOGI("window l: %d ", win->w.left);
-    LOGI("window t: %d ", win->w.top);
-    LOGI("window w: %d ", win->w.width);
-    LOGI("window h: %d\n", win->w.height);
-}
-void v4l2_overlay_dump_state(int fd)
-{
-    struct v4l2_format format;
-    struct v4l2_crop crop;
-    int ret;
-
-    LOGI("dumping driver state:");
-    format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    ret = ioctl(fd, VIDIOC_G_FMT, &format);
-    if (ret < 0)
-        return;
-    LOGI("output pixfmt:\n");
-    dump_pixfmt(&format.fmt.pix);
-
-    format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-    ret = ioctl(fd, VIDIOC_G_FMT, &format);
-    if (ret < 0)
-        return;
-    LOGI("v4l2_overlay window:\n");
-    dump_window(&format.fmt.win);
-
-    crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    ret = ioctl(fd, VIDIOC_G_CROP, &crop);
-    if (ret < 0)
-        return;
-    LOGI("output crop:\n");
-    dump_crop(&crop);
-/*
-    crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    ret = ioctl(fd, VIDIOC_G_CROP, &crop);
-    if (ret < 0)
-        return;
-    LOGI("ovelay crop:\n");
-    dump_crop(&crop);
-*/
-}
-
-static void error(int fd, const char *msg)
-{
-  LOGE("Error = %s from %s", strerror(errno), msg);
-#ifdef OVERLAY_DEBUG
-  v4l2_overlay_dump_state(fd);
-#endif
-}
-
-static int v4l2_overlay_ioctl(int fd, int req, void *arg, const char* msg)
-{
-    int ret;
-    ret = ioctl(fd, req, arg);
-    if (ret < 0) {
-        error(fd, msg);
-        return -1;
-    }
-    return 0;
-}
-
-int configure_pixfmt(struct v4l2_pix_format *pix, int32_t fmt,
-                     uint32_t w, uint32_t h)
-{
-    LOG_FUNCTION_NAME
-
-    int fd;
-
-    switch (fmt) {
-        case OVERLAY_FORMAT_RGB_565:
-            pix->pixelformat = V4L2_PIX_FMT_RGB565;
-            break;
-        case OVERLAY_FORMAT_YCbYCr_422_I:
-            pix->pixelformat = V4L2_PIX_FMT_YUYV;
-            break;
-        case OVERLAY_FORMAT_CbYCrY_422_I:
-            pix->pixelformat = V4L2_PIX_FMT_UYVY;
-            break;
-        default:
-            return -1;
-    }
-    pix->width = w;
-    pix->height = h;
-    return 0;
-}
-
-static void configure_window(struct v4l2_window *win, int32_t w,
-                             int32_t h, int32_t x, int32_t y)
-{
-    LOG_FUNCTION_NAME
-
-    win->w.left = x;
-    win->w.top = y;
-    win->w.width = w;
-    win->w.height = h;
-}
-
-void get_window(struct v4l2_format *format, int32_t *x,
-                int32_t *y, int32_t *w, int32_t *h)
-{
-    LOG_FUNCTION_NAME
-
-    *x = format->fmt.win.w.left;
-    *y = format->fmt.win.w.top;
-    *w = format->fmt.win.w.width;
-    *h = format->fmt.win.w.height;
-}
-
-int v4l2_overlay_init(int fd, uint32_t w, uint32_t h, uint32_t fmt)
-{
-    LOG_FUNCTION_NAME
-
-    struct v4l2_format format;
-    int ret;
-
-    /* configure the v4l2_overlay framebuffer */
-    /*
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FBUF, &fbuf, "get fbuf");
-    if (ret)
-        return ret;
-    if (fbuf.fmt.pixelformat != dst_format) {
-        fbuf.fmt.pixelformat = dst_format;
-        ret = v4l2_overlay_ioctl(fd, VIDIOC_S_FBUF, &fbuf, "set fbuf");
-        if (ret)
-            return ret;
-    }
-    */
-
-    format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FMT, &format, "get format");
-    if (ret)
-        return ret;
-    LOGI("v4l2_overlay_init:: w=%d h=%d\n", format.fmt.pix.width, format.fmt.pix.height);
-
-    format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    configure_pixfmt(&format.fmt.pix, fmt, w, h);
-    LOGI("v4l2_overlay_init:: w=%d h=%d\n", format.fmt.pix.width, format.fmt.pix.height);
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_S_FMT, &format, "set output format");
-
-    format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FMT, &format, "get output format");
-    LOGI("v4l2_overlay_init:: w=%d h=%d\n", format.fmt.pix.width, format.fmt.pix.height);
-    return ret;
-}
-
-int v4l2_overlay_get_input_size_and_format(int fd, uint32_t *w, uint32_t *h, uint32_t *fmt)
-{
-    LOG_FUNCTION_NAME
-
-    struct v4l2_format format;
-    int ret;
-
-    format.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FMT, &format, "get format");
-    *w = format.fmt.pix.width;
-    *h = format.fmt.pix.height;
-    //if (format.fmt.pix.pixelformat == V4L2_PIX_FMT_UYVY)
-    if (format.fmt.pix.pixelformat == V4L2_PIX_FMT_YUYV)
-        *fmt = OVERLAY_FORMAT_CbYCrY_422_I;
-    else return -EINVAL;
-    return ret;
-}
-
-int v4l2_overlay_set_position(int fd, int32_t x, int32_t y, int32_t w, int32_t h)
-{
-    LOG_FUNCTION_NAME
-
-    struct v4l2_format format;
-    int ret;
-
-     /* configure the src format pix */
-    /* configure the dst v4l2_overlay window */
-    format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FMT, &format,
-                             "get v4l2_overlay format");
-    if (ret)
-       return ret;
-    LOGI("v4l2_overlay_set_position:: w=%d h=%d", format.fmt.win.w.width, format.fmt.win.w.height);
-   
-    configure_window(&format.fmt.win, w, h, x, y);
-
-    format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_S_FMT, &format,
-                             "set v4l2_overlay format");
-    LOGI("v4l2_overlay_set_position:: w=%d h=%d", format.fmt.win.w.width, format.fmt.win.w.height);
-    
-    if (ret)
-       return ret;
-    v4l2_overlay_dump_state(fd);
-
-    return 0;
-}
-
-int v4l2_overlay_get_position(int fd, int32_t *x, int32_t *y, int32_t *w, int32_t *h)
-{
-    struct v4l2_format format;
-    int ret;
-
-    format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FMT, &format, "get v4l2_overlay format");
-    if (ret)
-       return ret;
-    get_window(&format, x, y, w, h);
-    return 0;
-}
-
-int v4l2_overlay_set_crop(int fd, uint32_t x, uint32_t y, uint32_t w, uint32_t h)
-{
-    LOG_FUNCTION_NAME
-
-    struct v4l2_crop crop;
-    int ret;
-
-    crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_CROP, &crop, "get crop");
-    crop.c.left = x;
-    crop.c.top = y;
-    crop.c.width = w;
-    crop.c.height = h;
-    crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-
-    return v4l2_overlay_ioctl(fd, VIDIOC_S_CROP, &crop, "set crop");
-}
-
-int v4l2_overlay_get_crop(int fd, uint32_t *x, uint32_t *y, uint32_t *w, uint32_t *h)
-{
-    LOG_FUNCTION_NAME
-
-    struct v4l2_crop crop;
-    int ret;
-
-    crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_CROP, &crop, "get crop");
-    *x = crop.c.left;
-    *y = crop.c.top;
-    *w = crop.c.width;
-    *h = crop.c.height;
-    return ret;
-}
-
-int v4l2_overlay_set_rotation(int fd, int degree, int step)
-{
-    LOG_FUNCTION_NAME
-
-    int ret;
-    struct v4l2_control ctrl;
-
-    ctrl.id = V4L2_CID_ROTATE;
-    ctrl.value = degree;
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_S_CTRL, &ctrl, "set rotation");
-
-    return ret;
-}
-
-int v4l2_overlay_set_colorkey(int fd, int enable, int colorkey)
-{
-    LOG_FUNCTION_NAME
-
-    int ret;
-    struct v4l2_framebuffer fbuf;
-    struct v4l2_format fmt;
-
-    memset(&fbuf, 0, sizeof(fbuf));
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FBUF, &fbuf, "get transparency enables");
-
-    if (ret)
-        return ret;
-
-    if (enable)
-        fbuf.flags |= V4L2_FBUF_FLAG_CHROMAKEY;
-    else
-        fbuf.flags &= ~V4L2_FBUF_FLAG_CHROMAKEY;
-
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_S_FBUF, &fbuf, "enable colorkey");
-
-    if (ret)
-        return ret;
-
-    if (enable)
-
-    {
-        memset(&fmt, 0, sizeof(fmt));
-        fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-        ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FMT, &fmt, "get colorkey");
-
-        if (ret)
-            return ret;
-
-        fmt.fmt.win.chromakey = colorkey & 0xFFFFFF;
-
-        ret = v4l2_overlay_ioctl(fd, VIDIOC_S_FMT, &fmt, "set colorkey");
-    }
-
-    return ret;
-}
-
-int v4l2_overlay_set_global_alpha(int fd, int enable, int alpha)
-{
-    LOG_FUNCTION_NAME
-
-    int ret;
-    struct v4l2_framebuffer fbuf;
-    struct v4l2_format fmt;
-
-    memset(&fbuf, 0, sizeof(fbuf));
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FBUF, &fbuf, "get transparency enables");
-
-    if (ret)
-        return ret;
-
-    if (enable)
-        fbuf.flags |= V4L2_FBUF_FLAG_GLOBAL_ALPHA;
-    else
-        fbuf.flags &= ~V4L2_FBUF_FLAG_GLOBAL_ALPHA;
-
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_S_FBUF, &fbuf, "enable global alpha");
-
-    if (ret)
-        return ret;
-
-    if (enable)
-    {
-        memset(&fmt, 0, sizeof(fmt));
-        fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
-        ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FMT, &fmt, "get global alpha");
-
-        if (ret)
-            return ret;
-
-        fmt.fmt.win.global_alpha = alpha & 0xFF;
-
-        ret = v4l2_overlay_ioctl(fd, VIDIOC_S_FMT, &fmt, "set global alpha");
-    }
-
-    return ret;
-}
-
-int v4l2_overlay_set_local_alpha(int fd, int enable)
-{
-    int ret;
-    struct v4l2_framebuffer fbuf;
-
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_G_FBUF, &fbuf,
-                             "get transparency enables");
-
-    if (ret)
-        return ret;
-
-    if (enable)
-        fbuf.flags |= V4L2_FBUF_FLAG_LOCAL_ALPHA;
-    else
-        fbuf.flags &= ~V4L2_FBUF_FLAG_LOCAL_ALPHA;
-
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_S_FBUF, &fbuf, "enable global alpha");
-
-    return ret;
-}
-
-int v4l2_overlay_req_buf(int fd, uint32_t *num_bufs, int cacheable_buffers)
-{
-    LOG_FUNCTION_NAME
-
-    struct v4l2_requestbuffers reqbuf;
-    int ret, i;
-    reqbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    reqbuf.memory = V4L2_MEMORY_MMAP;
-    reqbuf.count = *num_bufs;
-    //reqbuf.reserved[0] = cacheable_buffers;
-    ret = ioctl(fd, VIDIOC_REQBUFS, &reqbuf);
-    if (ret < 0) {
-        error(fd, "reqbuf ioctl");
-        return ret;
-    }
-    LOGI("%d buffers allocated %d requested\n", reqbuf.count, 4);
-    if (reqbuf.count > *num_bufs) {
-        error(fd, "Not enough buffer structs passed to get_buffers");
-        return -ENOMEM;
-    }
-    *num_bufs = reqbuf.count;
-    LOGI("buffer cookie is %d\n", reqbuf.type);
-    return 0;
-}
-
-static int is_mmaped(struct v4l2_buffer *buf)
-{
-    return buf->flags == V4L2_BUF_FLAG_MAPPED;
-}
-
-static int is_queued(struct v4l2_buffer *buf)
-{
-    /* is either on the input or output queue in the kernel */
-    return (buf->flags & V4L2_BUF_FLAG_QUEUED) ||
-           (buf->flags & V4L2_BUF_FLAG_DONE);
-}
-
-static int is_dequeued(struct v4l2_buffer *buf)
-{
-    /* is on neither input or output queue in kernel */
-    return (!(buf->flags & V4L2_BUF_FLAG_QUEUED) &&
-            !(buf->flags & V4L2_BUF_FLAG_DONE));
-}
-
-int v4l2_overlay_query_buffer(int fd, int index, struct v4l2_buffer *buf)
-{
-    LOG_FUNCTION_NAME
-
-    memset(buf, 0, sizeof(struct v4l2_buffer));
-
-    buf->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    buf->memory = V4L2_MEMORY_MMAP;
-    buf->index = index;
-    LOGI("query buffer, mem=%u type=%u index=%u\n", buf->memory, buf->type,
-         buf->index);
-    return v4l2_overlay_ioctl(fd, VIDIOC_QUERYBUF, buf, "querybuf ioctl");
-}
-
-int v4l2_overlay_map_buf(int fd, int index, void **start, size_t *len)
-{
-    LOG_FUNCTION_NAME
-
-    struct v4l2_buffer buf;
-    int ret;
-
-    ret = v4l2_overlay_query_buffer(fd, index, &buf);
-    if (ret)
-        return ret;
-
-    if (is_mmaped(&buf)) {
-        LOGE("Trying to mmap buffers that are already mapped!\n");
-        return -EINVAL;
-    }
-
-    *len = buf.length;
-    *start = mmap(NULL, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED,
-                  fd, buf.m.offset);
-    if (*start == MAP_FAILED) {
-        LOGE("map failed, length=%u offset=%u\n", buf.length, buf.m.offset);
-        return -EINVAL;
-    }
-    return 0;
-}
-
-int v4l2_overlay_unmap_buf(void *start, size_t len)
-{
-    LOG_FUNCTION_NAME
-
-  return munmap(start, len);
-}
-
-
-int v4l2_overlay_get_caps(int fd, struct v4l2_capability *caps)
-{
-    return v4l2_overlay_ioctl(fd, VIDIOC_QUERYCAP, caps, "query cap");
-}
-
-int v4l2_overlay_stream_on(int fd)
-{
-    LOG_FUNCTION_NAME
-
-    int ret;
-    uint32_t type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-
-    ret = v4l2_overlay_set_local_alpha(fd, 1);
-    if (ret)
-        return ret;
-
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_STREAMON, &type, "stream on");
-
-    return ret;
-}
-
-int v4l2_overlay_stream_off(int fd)
-{
-    LOG_FUNCTION_NAME
-
-    int ret;
-    uint32_t type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-
-    ret = v4l2_overlay_set_local_alpha(fd, 0);
-    if (ret)
-        return ret;
-
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_STREAMOFF, &type, "stream off");
-
-    return ret;
-}
-
-int v4l2_overlay_q_buf(int fd, int index)
-{
-    struct v4l2_buffer buf;
-    int ret;
-
-    /*
-    ret = v4l2_overlay_query_buffer(fd, buffer_cookie, index, &buf);
-    if (ret)
-        return ret;
-    if (is_queued(buf)) {
-        LOGE("Trying to queue buffer to kernel that is already queued!\n");
-        return -EINVAL
-    }
-    */
-    buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    buf.index = index;
-    buf.memory = V4L2_MEMORY_MMAP;
-    buf.field = V4L2_FIELD_NONE;
-    buf.timestamp.tv_sec = 0;
-    buf.timestamp.tv_usec = 0;
-    buf.flags = 0;
-
-    return v4l2_overlay_ioctl(fd, VIDIOC_QBUF, &buf, "qbuf");
-}
-
-int v4l2_overlay_dq_buf(int fd, int *index)
-{
-    struct v4l2_buffer buf;
-    int ret;
-
-    /*
-    ret = v4l2_overlay_query_buffer(fd, buffer_cookie, index, &buf);
-    if (ret)
-        return ret;
-
-    if (is_dequeued(buf)) {
-        LOGE("Trying to dequeue buffer that is not in kernel!\n");
-        return -EINVAL
-    }
-    */
-    buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-    buf.memory = V4L2_MEMORY_MMAP;
-
-    ret = v4l2_overlay_ioctl(fd, VIDIOC_DQBUF, &buf, "dqbuf");
-    if (ret)
-      return ret;
-    *index = buf.index;
-    return 0;
-}
diff --git a/liboverlay/v4l2_utils.h b/liboverlay/v4l2_utils.h
deleted file mode 100644
index c599b66..0000000
--- a/liboverlay/v4l2_utils.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2009 Google Inc. All Rights Reserved.
-// Author: rschultz@google.com (Rebecca Schultz Zavin)
-
-#ifndef ANDROID_ZOOM_REPO_HARDWARE_TI_OMAP3_LIBOVERLAY_V4L2_UTILS_H_
-#define ANDROID_ZOOM_REPO_HARDWARE_TI_OMAP3_LIBOVERLAY_V4L2_UTILS_H_
-
-int v4l2_overlay_open(int id);
-int v4l2_overlay_get_caps(int fd, struct v4l2_capability *caps);
-int v4l2_overlay_req_buf(int fd, uint32_t *num_bufs, int cacheable_buffers);
-int v4l2_overlay_query_buffer(int fd, int index, struct v4l2_buffer *buf);
-int v4l2_overlay_map_buf(int fd, int index, void **start, size_t *len);
-int v4l2_overlay_unmap_buf(void *start, size_t len);
-int v4l2_overlay_stream_on(int fd);
-int v4l2_overlay_stream_off(int fd);
-int v4l2_overlay_q_buf(int fd, int index);
-int v4l2_overlay_dq_buf(int fd, int *index);
-int v4l2_overlay_init(int fd, uint32_t w, uint32_t h, uint32_t fmt);
-int v4l2_overlay_get_input_size(int fd, uint32_t *w, uint32_t *h, uint32_t *fmt);
-int v4l2_overlay_set_position(int fd, int32_t x, int32_t y, int32_t w,
-                              int32_t h);
-int v4l2_overlay_get_position(int fd, int32_t *x, int32_t *y, int32_t *w,
-                              int32_t *h);
-int v4l2_overlay_set_crop(int fd, uint32_t x, uint32_t y, uint32_t w,
-                              uint32_t h);
-int v4l2_overlay_get_crop(int fd, uint32_t *x, uint32_t *y, uint32_t *w,
-                              uint32_t *h);
-int v4l2_overlay_set_rotation(int fd, int degree, int step);
-int v4l2_overlay_set_colorkey(int fd, int enable, int colorkey);
-int v4l2_overlay_set_global_alpha(int fd, int enable, int alpha);
-int v4l2_overlay_set_local_alpha(int fd, int enable);
-
-enum {
-  V4L2_OVERLAY_PLANE_GRAPHICS,
-  V4L2_OVERLAY_PLANE_VIDEO1,
-  V4L2_OVERLAY_PLANE_VIDEO2,
-};
-
-typedef struct
-{
-  int fd;
-  size_t length;
-  uint32_t offset;
-  void *ptr;
-} mapping_data_t;
-
-#define ALL_BUFFERS_FLUSHED -66
-
-#endif  // ANDROID_ZOOM_REPO_HARDWARE_TI_OMAP3_LIBOVERLAY_V4L2_UTILS_H_