diff options
Diffstat (limited to 'libqdutils')
-rw-r--r-- | libqdutils/Android.mk | 4 | ||||
-rw-r--r-- | libqdutils/clear_regions.h | 92 | ||||
-rw-r--r-- | libqdutils/egl_handles.cpp | 91 | ||||
-rw-r--r-- | libqdutils/egl_handles.h | 63 |
4 files changed, 2 insertions, 248 deletions
diff --git a/libqdutils/Android.mk b/libqdutils/Android.mk index 8ecfaf8ab..61daeacf9 100644 --- a/libqdutils/Android.mk +++ b/libqdutils/Android.mk @@ -4,10 +4,10 @@ include $(CLEAR_VARS) LOCAL_MODULE := libqdutils LOCAL_MODULE_TAGS := optional -LOCAL_SHARED_LIBRARIES := $(common_libs) libdl +LOCAL_SHARED_LIBRARIES := $(common_libs) LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) LOCAL_CFLAGS := $(common_flags) LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) LOCAL_SRC_FILES := profiler.cpp mdp_version.cpp \ - idle_invalidator.cpp egl_handles.cpp + idle_invalidator.cpp include $(BUILD_SHARED_LIBRARY) diff --git a/libqdutils/clear_regions.h b/libqdutils/clear_regions.h deleted file mode 100644 index 2d1f3df74..000000000 --- a/libqdutils/clear_regions.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of Code Aurora Forum, Inc. nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef QCOM_CLEARREGIONS_H -#define QCOM_CLEARREGIONS_H - -#include <gralloc_priv.h> -#include <cutils/memory.h> -#include <comptype.h> -#include "egl_handles.h" - -namespace qdutils { -/* - * Clear Region implementation for C2D/MDP versions. - * - * @param: region to be cleared - * @param: EGL Display - * @param: EGL Surface - * - * @return 0 on success - */ -static int qcomuiClearRegion(Region region, EGLDisplay dpy){ - - int ret = 0; - int compositionType = QCCompositionType::getInstance().getCompositionType(); - if (compositionType == COMPOSITION_TYPE_GPU){ - //SF can use the GPU to draw the wormhole. - return -1; - } - - android_native_buffer_t *renderBuffer = - qdutils::eglHandles::getInstance().getAndroidNativeRenderBuffer(dpy); - if (!renderBuffer) { - ALOGE("%s: eglGetRenderBufferANDROID returned NULL buffer", - __FUNCTION__); - return -1; - } - private_handle_t *fbHandle = (private_handle_t *)renderBuffer->handle; - if(!fbHandle) { - ALOGE("%s: Framebuffer handle is NULL", __FUNCTION__); - return -1; - } - - int bytesPerPixel = 4; - if (HAL_PIXEL_FORMAT_RGB_565 == fbHandle->format) { - bytesPerPixel = 2; - } - - Region::const_iterator it = region.begin(); - Region::const_iterator const end = region.end(); - const int32_t stride = renderBuffer->stride*bytesPerPixel; - while (it != end) { - const Rect& r = *it++; - uint8_t* dst = (uint8_t*) fbHandle->base + - (r.left + r.top*renderBuffer->stride)*bytesPerPixel; - int w = r.width()*bytesPerPixel; - int h = r.height(); - do { - if(4 == bytesPerPixel) - android_memset32((uint32_t*)dst, 0, w); - else - android_memset16((uint16_t*)dst, 0, w); - dst += stride; - } while(--h); - } - return 0; -} -}; //namespace qdutils -#endif /* end of include guard: QCOM_CLEARREGIONS_H*/ diff --git a/libqdutils/egl_handles.cpp b/libqdutils/egl_handles.cpp deleted file mode 100644 index d8a15dea2..000000000 --- a/libqdutils/egl_handles.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * Copyright (C) 2012, Code Aurora Forum. All rights reserved. - * - * Not a Contribution, Apache license notifications and license are retained - * for attribution purposes only. - * - * 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. - */ - - -#include <cutils/log.h> -#include <fcntl.h> -#include "egl_handles.h" -#include <dlfcn.h> - -ANDROID_SINGLETON_STATIC_INSTANCE(qdutils::eglHandles); -namespace qdutils { - -eglHandles::eglHandles(){ - LINK_eglGetRenderBufferANDROID = NULL ; - LINK_eglGetCurrentSurface = NULL; - egl_lib = NULL; - openEglLibAndGethandle(); - updateEglHandles(egl_lib); -} - -eglHandles::~eglHandles(){ - closeEglLib(); - -} - -void eglHandles::updateEglHandles(void* egl_lib){ - - if(egl_lib != NULL) { - *(void **)&LINK_eglGetRenderBufferANDROID = - ::dlsym(egl_lib, "eglGetRenderBufferANDROID"); - *(void **)&LINK_eglGetCurrentSurface = - ::dlsym(egl_lib, "eglGetCurrentSurface"); - if(LINK_eglGetRenderBufferANDROID == NULL || - LINK_eglGetCurrentSurface == NULL) - ALOGE(" %s::Unable to find symbols",__FUNCTION__) ; - }else { - LINK_eglGetRenderBufferANDROID = NULL; - LINK_eglGetCurrentSurface = NULL; - } -} - -void eglHandles::openEglLibAndGethandle(){ - - egl_lib = ::dlopen("libEGL_adreno200.so", RTLD_GLOBAL | RTLD_LAZY); - if (!egl_lib) { - ALOGE(" %s::Unable to open libEGL_adreno200",__FUNCTION__) ; - } -} - -android_native_buffer_t * - eglHandles::getAndroidNativeRenderBuffer(EGLDisplay dpy){ - - if(LINK_eglGetRenderBufferANDROID == NULL || - LINK_eglGetCurrentSurface == NULL){ - ALOGE("%s:: Unable to load or find the symbols ",__FUNCTION__); - return NULL; - } - EGLSurface eglSurface = LINK_eglGetCurrentSurface(EGL_DRAW); - android_native_buffer_t *renderBuffer = - (android_native_buffer_t*)LINK_eglGetRenderBufferANDROID(dpy, eglSurface); - return renderBuffer; -} - -void eglHandles ::closeEglLib(){ - if(egl_lib) - ::dlclose(egl_lib); - egl_lib = NULL; - updateEglHandles(NULL); -} - -}; - - - diff --git a/libqdutils/egl_handles.h b/libqdutils/egl_handles.h deleted file mode 100644 index c5fb24437..000000000 --- a/libqdutils/egl_handles.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * Copyright (C) 2012, Code Aurora Forum. All rights reserved. - * - * Not a Contribution, Apache license notifications and license are retained - * for attribution purposes only. - * - * 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 EGL_HANDLES_H -#define EGL_HANDLES_H - -#include <stdint.h> -#include <utils/Singleton.h> -#include <EGL/egl.h> -#include <gralloc_priv.h> -#include <EGL/eglext.h> - -typedef EGLClientBuffer (*functype_eglGetRenderBufferANDROID) ( - EGLDisplay dpy, - EGLSurface draw); -typedef EGLSurface (*functype_eglGetCurrentSurface)(EGLint readdraw); - -using namespace android; -namespace qdutils { -class eglHandles : public Singleton <eglHandles> -{ - - functype_eglGetRenderBufferANDROID LINK_eglGetRenderBufferANDROID; - functype_eglGetCurrentSurface LINK_eglGetCurrentSurface; - void* egl_lib; - - void updateEglHandles(void* egl_lib); - void openEglLibAndGethandle(); - void closeEglLib(); - -public : - eglHandles(); - ~eglHandles(); - functype_eglGetRenderBufferANDROID getEGLRenderBufferANDROID(){ - return LINK_eglGetRenderBufferANDROID; - } - functype_eglGetCurrentSurface getEGLCurrentSurface(){ - return LINK_eglGetCurrentSurface; - } - android_native_buffer_t *getAndroidNativeRenderBuffer(EGLDisplay dpy); -}; -}; -#endif // end of EGL_HANDLES_H - - |