diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/binder/Android.mk | 18 | ||||
-rw-r--r-- | libs/binder/IMemory.cpp | 29 | ||||
-rw-r--r-- | libs/binder/MemoryHeapBaseIon.cpp | 96 | ||||
-rw-r--r-- | libs/binder/MemoryHeapPmem.cpp | 248 | ||||
-rw-r--r-- | libs/gui/Android.mk | 2 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 75 | ||||
-rw-r--r-- | libs/ui/Android.mk | 19 | ||||
-rw-r--r-- | libs/ui/FramebufferNativeWindow.cpp | 25 | ||||
-rw-r--r-- | libs/ui/GraphicBufferAllocator.cpp | 10 | ||||
-rw-r--r-- | libs/ui/GraphicBufferMapper.cpp | 13 |
10 files changed, 532 insertions, 3 deletions
diff --git a/libs/binder/Android.mk b/libs/binder/Android.mk index d449298..c72e930 100644 --- a/libs/binder/Android.mk +++ b/libs/binder/Android.mk @@ -29,17 +29,33 @@ sources := \ ProcessState.cpp \ Static.cpp +ifeq ($(BOARD_NEEDS_MEMORYHEAPPMEM),true) +sources += \ + MemoryHeapPmem.cpp +endif + LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) + +ifeq ($(BOARD_USE_V4L2_ION), true) +LOCAL_CFLAGS += -DUSE_V4L2_ION +sources += \ + MemoryHeapBaseIon.cpp +LOCAL_C_INCLUDES := hardware/samsung/exynos4/hal/include +LOCAL_SHARED_LIBRARIES := libsecion +endif + LOCAL_LDLIBS += -lpthread LOCAL_MODULE := libbinder -LOCAL_SHARED_LIBRARIES := liblog libcutils libutils +LOCAL_SHARED_LIBRARIES += liblog libcutils libutils LOCAL_SRC_FILES := $(sources) + include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_LDLIBS += -lpthread LOCAL_MODULE := libbinder LOCAL_SRC_FILES := $(sources) + include $(BUILD_STATIC_LIBRARY) diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp index cd2451a..8fea1b2 100644 --- a/libs/binder/IMemory.cpp +++ b/libs/binder/IMemory.cpp @@ -32,6 +32,10 @@ #include <binder/Parcel.h> #include <utils/CallStack.h> +#ifdef USE_V4L2_ION +#include "ion.h" +#endif + #define VERBOSE 0 namespace android { @@ -301,6 +305,14 @@ void BpMemoryHeap::assertReallyMapped() const ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)", asBinder().get(), parcel_fd, size, err, strerror(-err)); +#ifdef USE_V4L2_ION + int ion_client = -1; + if (flags & USE_ION_FD) { + ion_client = ion_client_create(); + ALOGE_IF(ion_client < 0, "BpMemoryHeap : ion client creation error"); + } +#endif + int fd = dup( parcel_fd ); ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)", parcel_fd, size, err, strerror(errno)); @@ -313,7 +325,16 @@ void BpMemoryHeap::assertReallyMapped() const Mutex::Autolock _l(mLock); if (mHeapId == -1) { mRealHeap = true; - mBase = mmap(0, size, access, MAP_SHARED, fd, offset); + +#ifdef USE_V4L2_ION + if (flags & USE_ION_FD) { + if (ion_client < 0) + mBase = MAP_FAILED; + else + mBase = ion_map(fd, size, offset); + } else +#endif + mBase = mmap(0, size, access, MAP_SHARED, fd, offset); if (mBase == MAP_FAILED) { ALOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)", asBinder().get(), size, fd, strerror(errno)); @@ -325,6 +346,12 @@ void BpMemoryHeap::assertReallyMapped() const android_atomic_write(fd, &mHeapId); } } +#ifdef USE_V4L2_ION + if (ion_client < 0) + ion_client = -1; + else + ion_client_destroy(ion_client); +#endif } } diff --git a/libs/binder/MemoryHeapBaseIon.cpp b/libs/binder/MemoryHeapBaseIon.cpp new file mode 100644 index 0000000..fe7dbb8 --- /dev/null +++ b/libs/binder/MemoryHeapBaseIon.cpp @@ -0,0 +1,96 @@ +/* + * Copyright Samsung Electronics Co.,LTD. + * Copyright (C) 2011 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. + */ +/*! + * \file MemoryHeapBaseIon.cpp + * \brief source file for MemoryHeapBaseIon + * \author MinGu, Jeon(mingu85.jeon) + * \date 2011/11/20 + * + * <b>Revision History: </b> + * - 2011/11/20 : MinGu, Jeon(mingu85.jeon)) \n + * Initial version + */ + +#include <stdlib.h> +#include <stdint.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/types.h> +#include <cutils/log.h> +#include <binder/MemoryHeapBase.h> +#include <binder/IMemory.h> +#include <binder/MemoryHeapBaseIon.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/mman.h> +#include "ion.h" + +namespace android { + +MemoryHeapBaseIon::MemoryHeapBaseIon(size_t size, uint32_t flags, char const *name) +{ + mIonClient = ion_client_create(); + if (mIonClient < 0) { + mIonClient = -1; + ALOGE("MemoryHeapBaseIon : ION client creation failed"); + } + void* base = NULL; + int fd = ion_alloc(mIonClient, size, 0, ION_HEAP_EXYNOS_MASK); + + if (fd < 0) { + ALOGE("MemoryHeapBaseIon : ION memory allocation failed"); + } else { + flags |= USE_ION_FD; + base = ion_map(fd, size, 0); + if (base != MAP_FAILED) + init(fd, base, size, flags, NULL); + else + ALOGE("MemoryHeapBaseIon : mmap failed"); + } +} + +MemoryHeapBaseIon::MemoryHeapBaseIon(int fd, size_t size, uint32_t flags, uint32_t offset) +{ + ALOGE_IF(fd < 0, "MemoryHeapBaseIon : file discriptor error. fd is not for ION Memory"); + mIonClient = ion_client_create(); + if (mIonClient < 0) { + mIonClient = -1; + ALOGE("MemoryHeapBaseIon : ION client creation failed"); + } + void* base = NULL; + if (fd >= 0) { + int dup_fd = dup(fd); + flags |= USE_ION_FD; + base = ion_map(dup_fd, size, 0); + if (base != MAP_FAILED) + init(dup_fd, base, size, flags, NULL); + else + ALOGE("MemoryHeapBaseIon : mmap failed"); + } +} + +MemoryHeapBaseIon::~MemoryHeapBaseIon() +{ + if (mIonClient != -1) { + ion_unmap(getBase(), getSize()); + ion_free(getHeapID()); + ion_client_destroy(mIonClient); + mIonClient = -1; + } +} + +}; diff --git a/libs/binder/MemoryHeapPmem.cpp b/libs/binder/MemoryHeapPmem.cpp new file mode 100644 index 0000000..66bcf4d --- /dev/null +++ b/libs/binder/MemoryHeapPmem.cpp @@ -0,0 +1,248 @@ +/* + * 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_TAG "MemoryHeapPmem" + +#include <stdlib.h> +#include <stdint.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/ioctl.h> + +#include <cutils/log.h> + +#include <binder/MemoryHeapPmem.h> +#include <binder/MemoryHeapBase.h> + +#ifdef HAVE_ANDROID_OS +#include <linux/android_pmem.h> +#endif + +namespace android { + +// --------------------------------------------------------------------------- + +MemoryHeapPmem::MemoryPmem::MemoryPmem(const sp<MemoryHeapPmem>& heap) + : BnMemory(), mClientHeap(heap) +{ +} + +MemoryHeapPmem::MemoryPmem::~MemoryPmem() { + if (mClientHeap != NULL) { + mClientHeap->remove(this); + } +} + +// --------------------------------------------------------------------------- + +class SubRegionMemory : public MemoryHeapPmem::MemoryPmem { +public: + SubRegionMemory(const sp<MemoryHeapPmem>& heap, ssize_t offset, size_t size); + virtual ~SubRegionMemory(); + virtual sp<IMemoryHeap> getMemory(ssize_t* offset, size_t* size) const; +private: + friend class MemoryHeapPmem; + void revoke(); + size_t mSize; + ssize_t mOffset; +}; + +SubRegionMemory::SubRegionMemory(const sp<MemoryHeapPmem>& heap, + ssize_t offset, size_t size) + : MemoryHeapPmem::MemoryPmem(heap), mSize(size), mOffset(offset) +{ +#ifndef NDEBUG + void* const start_ptr = (void*)(intptr_t(getHeap()->base()) + offset); + memset(start_ptr, 0xda, size); +#endif + +#ifdef HAVE_ANDROID_OS + if (size > 0) { + const size_t pagesize = getpagesize(); + size = (size + pagesize-1) & ~(pagesize-1); + int our_fd = heap->heapID(); + struct pmem_region sub = { offset, size }; + int err = ioctl(our_fd, PMEM_MAP, &sub); + ALOGE_IF(err<0, "PMEM_MAP failed (%s), " + "mFD=%d, sub.offset=%lu, sub.size=%lu", + strerror(errno), our_fd, sub.offset, sub.len); +} +#endif +} + +sp<IMemoryHeap> SubRegionMemory::getMemory(ssize_t* offset, size_t* size) const +{ + if (offset) *offset = mOffset; + if (size) *size = mSize; + return getHeap(); +} + +SubRegionMemory::~SubRegionMemory() +{ + revoke(); +} + + +void SubRegionMemory::revoke() +{ + // NOTE: revoke() doesn't need to be protected by a lock because it + // can only be called from MemoryHeapPmem::revoke(), which means + // that we can't be in ~SubRegionMemory(), or in ~SubRegionMemory(), + // which means MemoryHeapPmem::revoke() wouldn't have been able to + // promote() it. + +#ifdef HAVE_ANDROID_OS + if (mSize != 0) { + const sp<MemoryHeapPmem>& heap(getHeap()); + int our_fd = heap->heapID(); + struct pmem_region sub; + sub.offset = mOffset; + sub.len = mSize; + int err = ioctl(our_fd, PMEM_UNMAP, &sub); + ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), " + "mFD=%d, sub.offset=%lu, sub.size=%lu", + strerror(errno), our_fd, sub.offset, sub.len); + mSize = 0; + } +#endif +} + +// --------------------------------------------------------------------------- + +MemoryHeapPmem::MemoryHeapPmem(const sp<MemoryHeapBase>& pmemHeap, + uint32_t flags) + : MemoryHeapBase() +{ + char const * const device = pmemHeap->getDevice(); +#ifdef HAVE_ANDROID_OS + if (device) { + int fd = open(device, O_RDWR | (flags & NO_CACHING ? O_SYNC : 0)); + ALOGE_IF(fd<0, "couldn't open %s (%s)", device, strerror(errno)); + if (fd >= 0) { + int err = ioctl(fd, PMEM_CONNECT, pmemHeap->heapID()); + if (err < 0) { + ALOGE("PMEM_CONNECT failed (%s), mFD=%d, sub-fd=%d", + strerror(errno), fd, pmemHeap->heapID()); + close(fd); + } else { + // everything went well... + mParentHeap = pmemHeap; + MemoryHeapBase::init(fd, + pmemHeap->getBase(), + pmemHeap->getSize(), + pmemHeap->getFlags() | flags, + device); + } + } + } +#else + mParentHeap = pmemHeap; + MemoryHeapBase::init( + dup(pmemHeap->heapID()), + pmemHeap->getBase(), + pmemHeap->getSize(), + pmemHeap->getFlags() | flags, + device); +#endif +} + +MemoryHeapPmem::~MemoryHeapPmem() +{ +} + +sp<IMemory> MemoryHeapPmem::mapMemory(size_t offset, size_t size) +{ + sp<MemoryPmem> memory = createMemory(offset, size); + if (memory != 0) { + Mutex::Autolock _l(mLock); + mAllocations.add(memory); + } + return memory; +} + +sp<MemoryHeapPmem::MemoryPmem> MemoryHeapPmem::createMemory( + size_t offset, size_t size) +{ + sp<SubRegionMemory> memory; + if (heapID() > 0) + memory = new SubRegionMemory(this, offset, size); + return memory; +} + +status_t MemoryHeapPmem::slap() +{ +#ifdef HAVE_ANDROID_OS + size_t size = getSize(); + const size_t pagesize = getpagesize(); + size = (size + pagesize-1) & ~(pagesize-1); + int our_fd = getHeapID(); + struct pmem_region sub = { 0, size }; + int err = ioctl(our_fd, PMEM_MAP, &sub); + ALOGE_IF(err<0, "PMEM_MAP failed (%s), " + "mFD=%d, sub.offset=%lu, sub.size=%lu", + strerror(errno), our_fd, sub.offset, sub.len); + return -errno; +#else + return NO_ERROR; +#endif +} + +status_t MemoryHeapPmem::unslap() +{ +#ifdef HAVE_ANDROID_OS + size_t size = getSize(); + const size_t pagesize = getpagesize(); + size = (size + pagesize-1) & ~(pagesize-1); + int our_fd = getHeapID(); + struct pmem_region sub = { 0, size }; + int err = ioctl(our_fd, PMEM_UNMAP, &sub); + ALOGE_IF(err<0, "PMEM_UNMAP failed (%s), " + "mFD=%d, sub.offset=%lu, sub.size=%lu", + strerror(errno), our_fd, sub.offset, sub.len); + return -errno; +#else + return NO_ERROR; +#endif +} + +void MemoryHeapPmem::revoke() +{ + SortedVector< wp<MemoryPmem> > allocations; + + { // scope for lock + Mutex::Autolock _l(mLock); + allocations = mAllocations; + } + + ssize_t count = allocations.size(); + for (ssize_t i=0 ; i<count ; i++) { + sp<MemoryPmem> memory(allocations[i].promote()); + if (memory != 0) + memory->revoke(); + } +} + +void MemoryHeapPmem::remove(const wp<MemoryPmem>& memory) +{ + Mutex::Autolock _l(mLock); + mAllocations.remove(memory); +} + +// --------------------------------------------------------------------------- +}; // namespace android diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk index d970a33..8706dbc 100644 --- a/libs/gui/Android.mk +++ b/libs/gui/Android.mk @@ -54,7 +54,7 @@ ifneq ($(filter generic%,$(TARGET_DEVICE)),) LOCAL_CFLAGS += -DUSE_FENCE_SYNC endif -ifeq ($(TARGET_BOARD_PLATFORM), msm8960) +ifeq ($(call is-vendor-board-platform,QCOM),true) LOCAL_CFLAGS += -DUSE_NATIVE_FENCE_SYNC endif diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 80dd6ee..e6b4b21 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -393,6 +393,15 @@ void Composer::setDisplayProjection(const sp<IBinder>& token, mForceSynchronous = true; // TODO: do we actually still need this? } +status_t Composer::setOrientation(int orientation) { + sp<ISurfaceComposer> sm(ComposerService::getComposerService()); + sp<IBinder> token(sm->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); + DisplayState& s(getDisplayStateLocked(token)); + s.orientation = orientation; + mForceSynchronous = true; // TODO: do we actually still need this? + return NO_ERROR; +} + // --------------------------------------------------------------------------- SurfaceComposerClient::SurfaceComposerClient() @@ -441,6 +450,30 @@ void SurfaceComposerClient::dispose() { mStatus = NO_INIT; } +/* Create ICS/MR0-compatible constructors */ +extern "C" sp<SurfaceControl> _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8Ejjij( + const String8& name, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags); +extern "C" sp<SurfaceControl> _ZN7android21SurfaceComposerClient13createSurfaceEijjij( + uint32_t display, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags) +{ + String8 name; + const size_t SIZE = 128; + char buffer[SIZE]; + snprintf(buffer, SIZE, "<pid_%d>", getpid()); + name.append(buffer); + + return _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8Ejjij(name, + w, h, format, flags); +} + sp<SurfaceControl> SurfaceComposerClient::createSurface( const String8& name, uint32_t w, @@ -547,6 +580,11 @@ status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx, return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy); } +status_t SurfaceComposerClient::setOrientation(int32_t dpy, int orientation, uint32_t flags) +{ + return Composer::getInstance().setOrientation(orientation); +} + // ---------------------------------------------------------------------------- void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token, @@ -583,12 +621,49 @@ void SurfaceComposerClient::unblankDisplay(const sp<IBinder>& token) { ComposerService::getComposerService()->unblank(token); } +// TODO: Remove me. Do not use. +// This is a compatibility shim for one product whose drivers are depending on +// this legacy function (when they shouldn't). +status_t SurfaceComposerClient::getDisplayInfo( + int32_t displayId, DisplayInfo* info) +{ + return getDisplayInfo(getBuiltInDisplay(displayId), info); +} + +#if defined(ICS_CAMERA_BLOB) || defined(MR0_CAMERA_BLOB) +ssize_t SurfaceComposerClient::getDisplayWidth(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.w; +} + +ssize_t SurfaceComposerClient::getDisplayHeight(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.h; +} + +ssize_t SurfaceComposerClient::getDisplayOrientation(int32_t displayId) { + DisplayInfo info; + getDisplayInfo(getBuiltInDisplay(displayId), &info); + return info.orientation; +} +#endif + // ---------------------------------------------------------------------------- ScreenshotClient::ScreenshotClient() : mWidth(0), mHeight(0), mFormat(PIXEL_FORMAT_NONE) { } +// TODO: Remove me. Do not use. +// This is a compatibility shim for one product whose drivers are depending on +// this legacy function (when they shouldn't). +status_t ScreenshotClient::update() { + sp<ISurfaceComposer> sm(ComposerService::getComposerService()); + return update(sm->getBuiltInDisplay(0)); +} + status_t ScreenshotClient::update(const sp<IBinder>& display) { sp<ISurfaceComposer> s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk index 0d2e44c..5d5e082 100644 --- a/libs/ui/Android.mk +++ b/libs/ui/Android.mk @@ -36,6 +36,25 @@ ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),) LOCAL_CFLAGS += -DFRAMEBUFFER_FORCE_FORMAT=$(BOARD_FRAMEBUFFER_FORCE_FORMAT) endif +ifeq ($(TARGET_SOC),exynos4210) + LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4210 +endif + +ifeq ($(TARGET_SOC),exynos4x12) + LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4x12 +endif + +ifeq ($(TARGET_SOC),exynos5250) + LOCAL_CFLAGS += -DSAMSUNG_EXYNOS5250 +endif + +ifeq ($(BOARD_USES_SAMSUNG_HDMI),true) +LOCAL_CFLAGS += -DSAMSUNG_HDMI_SUPPORT +LOCAL_SHARED_LIBRARIES += libhdmiclient +LOCAL_C_INCLUDES += hardware/samsung/$(TARGET_BOARD_PLATFORM)/libhdmi/libhdmiservice +LOCAL_C_INCLUDES += hardware/samsung/$(TARGET_BOARD_PLATFORM)/include +endif + LOCAL_MODULE:= libui include $(BUILD_SHARED_LIBRARY) diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index 31a69b2..7ff6618 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -76,6 +76,11 @@ FramebufferNativeWindow::FramebufferNativeWindow() : BASE(), fbDev(0), grDev(0), mUpdateOnDemand(false) { hw_module_t const* module; + +#ifdef SAMSUNG_HDMI_SUPPORT + mHdmiClient = android::SecHdmiClient::getInstance(); +#endif + if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) { int stride; int err; @@ -154,6 +159,7 @@ FramebufferNativeWindow::FramebufferNativeWindow() ANativeWindow::queueBuffer = queueBuffer; ANativeWindow::query = query; ANativeWindow::perform = perform; + ANativeWindow::cancelBuffer = NULL; ANativeWindow::dequeueBuffer_DEPRECATED = dequeueBuffer_DEPRECATED; ANativeWindow::lockBuffer_DEPRECATED = lockBuffer_DEPRECATED; @@ -287,6 +293,25 @@ int FramebufferNativeWindow::queueBuffer(ANativeWindow* window, self->front = static_cast<NativeBuffer*>(buffer); self->mNumFreeBuffers++; self->mCondition.broadcast(); +#ifdef SAMSUNG_HDMI_SUPPORT +#if defined(SAMSUNG_EXYNOS4210) || defined(SAMSUNG_EXYNOS4x12) + if (self->mHdmiClient != NULL) + self->mHdmiClient->blit2Hdmi(buffer->width, buffer->height, + HAL_PIXEL_FORMAT_BGRA_8888, + 0, 0, 0, + 0, 0, + android::SecHdmiClient::HDMI_MODE_UI, + 0); +#elif defined(SAMSUNG_EXYNOS5250) + if (self->mHdmiClient != NULL) + self->mHdmiClient->blit2Hdmi(buffer->width, buffer->height, + HAL_PIXEL_FORMAT_BGRA_8888, + 0, 0, 0, + 0, 0, + android::SecHdmiClient::HDMI_MODE_MIRROR, + 0); +#endif +#endif return res; } diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp index fb43410..2ea5696 100644 --- a/libs/ui/GraphicBufferAllocator.cpp +++ b/libs/ui/GraphicBufferAllocator.cpp @@ -199,6 +199,16 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma w = h = 1; // we have a h/w allocator and h/w buffer is requested + +#ifdef EXYNOS4_ENHANCEMENTS + if ((format == 0x101) || (format == 0x105) || (format == 0x107)) { + // 0x101 = HAL_PIXEL_FORMAT_YCbCr_420_P (Samsung-specific pixel format) + // 0x105 = HAL_PIXEL_FORMAT_YCbCr_420_SP (Samsung-specific pixel format) + // 0x107 = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED (Samsung-specific pixel format) + usage |= GRALLOC_USAGE_HW_FIMC1; // Exynos HWC wants FIMC-friendly memory allocation + } +#endif + status_t err; // If too many async frees are queued up then wait for some of them to diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp index 967da98..19c549d 100644 --- a/libs/ui/GraphicBufferMapper.cpp +++ b/libs/ui/GraphicBufferMapper.cpp @@ -95,5 +95,18 @@ status_t GraphicBufferMapper::unlock(buffer_handle_t handle) return err; } +#ifdef EXYNOS4_ENHANCEMENTS +status_t GraphicBufferMapper::getphys(buffer_handle_t handle, void** paddr) +{ + status_t err; + + err = mAllocMod->getphys(mAllocMod, handle, paddr); + + ALOGW_IF(err, "getphys(%p) fail %d(%s)", + handle, err, strerror(-err)); + return err; +} +#endif + // --------------------------------------------------------------------------- }; // namespace android |