aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Kiryanov <rkir@google.com>2020-04-28 20:37:57 -0700
committerRoman Kiryanov <rkir@google.com>2020-04-30 14:36:08 -0700
commit94f3ba886ff62a809a4d353f4c5f1a1a552778d1 (patch)
tree3d2cabce75b89967ea4bf8cb723c93e41899c0e3
parente171b80e76249f2397f5bf6c088323e87210a4ae (diff)
downloaddevice_generic_goldfish-opengl-94f3ba886ff62a809a4d353f4c5f1a1a552778d1.tar.gz
device_generic_goldfish-opengl-94f3ba886ff62a809a4d353f4c5f1a1a552778d1.tar.bz2
device_generic_goldfish-opengl-94f3ba886ff62a809a4d353f4c5f1a1a552778d1.zip
Retire CbManager
It was replaced by libui. Bug: 154346346 Test: presubmit Merged-In: Ife562e4c2466f275567ed6dfc134ebb4f8f67aef Signed-off-by: Roman Kiryanov <rkir@google.com> Change-Id: I15ad28b124100b98f8e799c3f796c5b841e932c1
-rw-r--r--Android.mk2
-rw-r--r--CMakeLists.txt2
-rw-r--r--system/cbmanager/Android.mk53
-rw-r--r--system/cbmanager/debug.h51
-rw-r--r--system/cbmanager/hidl.cpp387
-rw-r--r--system/cbmanager/host.cpp46
-rw-r--r--system/include/cbmanager.h143
7 files changed, 1 insertions, 683 deletions
diff --git a/Android.mk b/Android.mk
index 7afa40af..41466cb9 100644
--- a/Android.mk
+++ b/Android.mk
@@ -154,8 +154,6 @@ ifneq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
include $(GOLDFISH_OPENGL_PATH)/system/hals/Android.mk
endif
-include $(GOLDFISH_OPENGL_PATH)/system/cbmanager/Android.mk
-
include $(GOLDFISH_OPENGL_PATH)/system/egl/Android.mk
ifeq (true,$(BUILD_EMULATOR_VULKAN)) # Vulkan libs
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c58ad14..4909c42e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@
# instead run make from .../device/generic/goldfish-opengl
# which will re-generate this file.
set(GOLDFISH_DEVICE_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
-android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/./Android.mk" "c8e5536771d09cd120c3e396beac994a1e2d2880f37b4e3bd1844be4cfc31555")
+android_validate_sha256("${GOLDFISH_DEVICE_ROOT}/./Android.mk" "fa06707a3536204e7a71728c5aca307ff81e7badfefeac790d2fcba19ff59746")
add_subdirectory(shared/OpenglCodecCommon)
add_subdirectory(system/GLESv1_enc)
add_subdirectory(system/GLESv2_enc)
diff --git a/system/cbmanager/Android.mk b/system/cbmanager/Android.mk
deleted file mode 100644
index 753f00aa..00000000
--- a/system/cbmanager/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Copyright 2015 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)
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS += \
- -DLOG_TAG=\"cbmanager\" \
- -Werror \
-
-ifeq (true,$(GOLDFISH_OPENGL_BUILD_FOR_HOST))
-LOCAL_CFLAGS += \
- -DHOST_BUILD \
-
-LOCAL_SRC_FILES := host.cpp
-else
-LOCAL_SHARED_LIBRARIES += \
- liblog \
- libcutils \
- libutils \
- libhidlbase \
- android.hardware.graphics.mapper@2.0 \
- android.hardware.graphics.mapper@3.0 \
- android.hardware.graphics.allocator@2.0 \
- android.hardware.graphics.allocator@3.0 \
-
-LOCAL_CFLAGS += \
- -DPLATFORM_SDK_VERSION=$(PLATFORM_SDK_VERSION) \
-
-LOCAL_SRC_FILES := hidl.cpp
-
-endif
-
-LOCAL_C_INCLUDES += \
- device/generic/goldfish-opengl/system/include \
- device/generic/goldfish-opengl/shared/OpenglCodecCommon \
-
-LOCAL_MODULE := libcbmanager
-LOCAL_VENDOR_MODULE := true
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/system/cbmanager/debug.h b/system/cbmanager/debug.h
deleted file mode 100644
index 23899bd7..00000000
--- a/system/cbmanager/debug.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2020 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.
- */
-
-#ifndef ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_DEBUG_H
-#define ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_DEBUG_H
-
-#include <log/log.h>
-
-#define CRASH(MSG) \
- do { \
- ALOGE("%s:%d crashed with '%s'", __func__, __LINE__, MSG); \
- ::abort(); \
- } while (false)
-
-#define CRASH_IF(COND, MSG) \
- do { \
- if ((COND)) { \
- ALOGE("%s:%d crashed on '%s' with '%s'", __func__, __LINE__, #COND, MSG); \
- ::abort(); \
- } \
- } while (false)
-
-#define RETURN_ERROR_CODE(X) \
- do { \
- ALOGE("%s:%d failed with '%s' (%d)", \
- __func__, __LINE__, strerror(-(X)), -(X)); \
- return (X); \
- } while (false)
-
-#define RETURN_ERROR(X) \
- do { \
- ALOGE("%s:%d failed with '%s'", __func__, __LINE__, #X); \
- return (X); \
- } while (false)
-
-#define RETURN(X) return (X)
-
-#endif // ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_DEBUG_H
diff --git a/system/cbmanager/hidl.cpp b/system/cbmanager/hidl.cpp
deleted file mode 100644
index 46b6b1bf..00000000
--- a/system/cbmanager/hidl.cpp
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-
-#include <cutils/native_handle.h>
-#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
-#include <android/hardware/graphics/allocator/3.0/IAllocator.h>
-#include <android/hardware/graphics/mapper/2.0/IMapper.h>
-#include <android/hardware/graphics/mapper/3.0/IMapper.h>
-#include <log/log.h>
-
-#include "cbmanager.h"
-#include "debug.h"
-
-namespace android {
-namespace {
-using hardware::hidl_handle;
-using hardware::hidl_vec;
-
-namespace IMapper2ns = hardware::graphics::mapper::V2_0;
-namespace IMapper3ns = hardware::graphics::mapper::V3_0;
-namespace IAllocator2ns = hardware::graphics::allocator::V2_0;
-namespace IAllocator3ns = hardware::graphics::allocator::V3_0;
-
-class CbManagerHidlV3Impl : public CbManager::CbManagerImpl {
-public:
- typedef CbManager::BufferUsage BufferUsage;
- typedef CbManager::PixelFormat PixelFormat;
- typedef CbManager::YCbCrLayout YCbCrLayout;
- typedef hardware::hidl_bitfield<BufferUsage> BufferUsageBits;
-
- CbManagerHidlV3Impl(sp<IMapper3ns::IMapper> mapper,
- sp<IAllocator3ns::IAllocator> allocator)
- : mMapper(mapper), mAllocator(allocator) {}
-
- native_handle_t* allocateBuffer(int width, int height,
- PixelFormat format, BufferUsageBits usage) {
- using IMapper3ns::Error;
- using IMapper3ns::BufferDescriptor;
-
- IMapper3ns::IMapper::BufferDescriptorInfo descriptor_info;
- descriptor_info.width = width;
- descriptor_info.height = height;
- descriptor_info.layerCount = 1;
- descriptor_info.format =
- static_cast<hardware::graphics::common::V1_2::PixelFormat>(format);
- descriptor_info.usage = usage;
- Error hidl_err = Error::NONE;
-
- BufferDescriptor descriptor;
- mMapper->createDescriptor(descriptor_info,
- [&](const Error &_error,
- const BufferDescriptor &_descriptor) {
- hidl_err = _error;
- descriptor = _descriptor;
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- hidl_handle raw_handle = nullptr;
- mAllocator->allocate(descriptor, 1,
- [&](const Error &_error,
- uint32_t _stride,
- const hidl_vec<hidl_handle> &_buffers) {
- hidl_err = _error;
- (void)_stride;
- raw_handle = _buffers[0];
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- native_handle_t *buf = nullptr;
- mMapper->importBuffer(raw_handle, [&](const Error &_error,
- void *_buf) {
- hidl_err = _error;
- buf = static_cast<native_handle_t*>(_buf);
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- RETURN(buf);
- }
-
- void freeBuffer(const native_handle_t* _h) {
- using IMapper2ns::Error;
-
- native_handle_t* h = const_cast<native_handle_t*>(_h);
-
- mMapper->freeBuffer(h);
- native_handle_close(h);
- native_handle_delete(h);
- }
-
- int lockBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) {
- using IMapper3ns::Error;
-
- Error hidl_err = Error::NONE;
- mMapper->lock(
- &handle,
- usage,
- { left, top, width, height }, // rect
- hidl_handle(), // fence
- [&hidl_err, vaddr](const Error &_error,
- void* _ptr,
- int32_t /*bytesPerPixel*/,
- int32_t /*bytesPerStride*/) {
- hidl_err = _error;
- if (_error == Error::NONE) {
- *vaddr = _ptr;
- }
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
- int lockYCbCrBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) {
- using IMapper3ns::Error;
- typedef IMapper3ns::YCbCrLayout YCbCrLayout3;
-
- Error hidl_err = Error::NONE;
- mMapper->lockYCbCr(
- &handle,
- usage,
- { left, top, width, height }, // rect
- hidl_handle(), // fence
- [&hidl_err, ycbcr](const Error &_error,
- const YCbCrLayout3 &_ycbcr) {
- hidl_err = _error;
- if (_error == Error::NONE) {
- ycbcr->y = _ycbcr.y;
- ycbcr->cb = _ycbcr.cb;
- ycbcr->cr = _ycbcr.cr;
- ycbcr->yStride = _ycbcr.yStride;
- ycbcr->cStride = _ycbcr.cStride;
- ycbcr->chromaStep = _ycbcr.chromaStep;
- }
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
- int unlockBuffer(native_handle_t& handle) {
- using IMapper3ns::Error;
-
- Error hidl_err = Error::NONE;
- int fence = -1;
- mMapper->unlock(
- &handle,
- [&hidl_err, &fence](const Error &_error,
- const hidl_handle &_fence) {
- hidl_err = _error;
- (void)_fence;
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
-private:
- const sp<IMapper3ns::IMapper> mMapper;
- const sp<IAllocator3ns::IAllocator> mAllocator;
-};
-
-class CbManagerHidlV2Impl : public CbManager::CbManagerImpl {
-public:
- typedef CbManager::BufferUsage BufferUsage;
- typedef CbManager::PixelFormat PixelFormat;
- typedef CbManager::YCbCrLayout YCbCrLayout;
- typedef hardware::hidl_bitfield<BufferUsage> BufferUsageBits;
-
- CbManagerHidlV2Impl(sp<IMapper2ns::IMapper> mapper,
- sp<IAllocator2ns::IAllocator> allocator)
- : mMapper(mapper), mAllocator(allocator) {}
-
- native_handle_t* allocateBuffer(int width, int height,
- PixelFormat format, BufferUsageBits usage) {
- using IMapper2ns::Error;
- using IMapper2ns::BufferDescriptor;
-
- IMapper2ns::IMapper::BufferDescriptorInfo descriptor_info;
- descriptor_info.width = width;
- descriptor_info.height = height;
- descriptor_info.layerCount = 1;
- descriptor_info.format = format;
- descriptor_info.usage = usage;
- Error hidl_err = Error::NONE;
-
- BufferDescriptor descriptor;
- mMapper->createDescriptor(descriptor_info,
- [&](const Error &_error,
- const BufferDescriptor &_descriptor) {
- hidl_err = _error;
- descriptor = _descriptor;
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- hidl_handle raw_handle = nullptr;
- mAllocator->allocate(descriptor, 1,
- [&](const Error &_error,
- uint32_t _stride,
- const hidl_vec<hidl_handle> &_buffers) {
- hidl_err = _error;
- (void)_stride;
- raw_handle = _buffers[0];
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- native_handle_t *buf = nullptr;
- mMapper->importBuffer(raw_handle, [&](const Error &_error,
- void *_buf) {
- hidl_err = _error;
- buf = static_cast<native_handle_t*>(_buf);
- });
- if (hidl_err != Error::NONE) {
- RETURN_ERROR(nullptr);
- }
-
- RETURN(buf);
- }
-
- void freeBuffer(const native_handle_t* _h) {
- using IMapper2ns::Error;
-
- native_handle_t* h = const_cast<native_handle_t*>(_h);
-
- mMapper->freeBuffer(h);
- native_handle_close(h);
- native_handle_delete(h);
- }
-
- int lockBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) {
- using IMapper2ns::Error;
-
- Error hidl_err = Error::NONE;
- mMapper->lock(
- &handle,
- usage,
- { left, top, width, height }, // rect
- hidl_handle(), // fence
- [&hidl_err, vaddr](const Error &_error,
- void* _ptr) {
- hidl_err = _error;
- if (_error == Error::NONE) {
- *vaddr = _ptr;
- }
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
- int lockYCbCrBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) {
- using IMapper2ns::Error;
-
- Error hidl_err = Error::NONE;
- mMapper->lockYCbCr(
- &handle,
- usage,
- { left, top, width, height }, // rect
- hidl_handle(), // fence
- [&hidl_err, ycbcr](const Error &_error,
- const YCbCrLayout &_ycbcr) {
- hidl_err = _error;
- if (_error == Error::NONE) {
- *ycbcr = _ycbcr;
- }
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
- int unlockBuffer(native_handle_t& handle) {
- using IMapper2ns::Error;
-
- Error hidl_err = Error::NONE;
- int fence = -1;
- mMapper->unlock(
- &handle,
- [&hidl_err, &fence](const Error &_error,
- const hidl_handle &_fence) {
- hidl_err = _error;
- (void)_fence;
- });
-
- if (hidl_err == Error::NONE) {
- RETURN(0);
- } else {
- RETURN_ERROR(-1);
- }
- }
-
-private:
- const sp<IMapper2ns::IMapper> mMapper;
- const sp<IAllocator2ns::IAllocator> mAllocator;
-};
-
-std::unique_ptr<CbManager::CbManagerImpl> buildHidlImpl() {
- {
- sp<IMapper3ns::IMapper> mapper =
- IMapper3ns::IMapper::getService();
- if (!mapper) {
- ALOGW("%s:%d: no IMapper@3.0 implementation found", __func__, __LINE__);
- }
-
- sp<IAllocator3ns::IAllocator> allocator =
- IAllocator3ns::IAllocator::getService();
- if (!allocator) {
- ALOGW("%s:%d: no IAllocator@3.0 implementation found", __func__, __LINE__);
- }
-
- if (mapper && allocator) {
- return std::make_unique<CbManagerHidlV3Impl>(mapper, allocator);
- }
- }
- {
- sp<IMapper2ns::IMapper> mapper =
- IMapper2ns::IMapper::getService();
- if (!mapper) {
- ALOGW("%s:%d: no IMapper@2.0 implementation found", __func__, __LINE__);
- }
-
- sp<IAllocator2ns::IAllocator> allocator =
- IAllocator2ns::IAllocator::getService();
- if (!allocator) {
- ALOGW("%s:%d: no IAllocator@2.0 implementation found", __func__, __LINE__);
- }
-
- return std::make_unique<CbManagerHidlV2Impl>(mapper, allocator);
- }
-
- return nullptr;
-}
-
-} // namespace
-
-CbManager::CbManager() : mImpl(buildHidlImpl()) {}
-
-} // namespace android
diff --git a/system/cbmanager/host.cpp b/system/cbmanager/host.cpp
deleted file mode 100644
index c1a46af0..00000000
--- a/system/cbmanager/host.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-
-#include <hardware/gralloc.h>
-#include "cbmanager.h"
-
-namespace android {
-namespace {
-
-class CbManagerHostImpl : public CbManager::CbManagerImpl {
-public:
- CbManagerHostImpl() {}
-
- ~CbManagerHostImpl() {}
-
- const cb_handle_t* allocateBuffer(int width, int height, int format) {
- return nullptr;
- }
-
- void freeBuffer(const cb_handle_t* h) {
- }
-
-private:
-};
-
-std::unique_ptr<CbManager::CbManagerImpl> buildHostImpl() {
- return std::make_unique<CbManagerHostImpl>();
-}
-} // namespace
-
-CbManager::CbManager() : mImpl(buildHostImpl()) {}
-
-} // namespace android
diff --git a/system/include/cbmanager.h b/system/include/cbmanager.h
deleted file mode 100644
index 4bddedbe..00000000
--- a/system/include/cbmanager.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2019 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.
- */
-
-#ifndef ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_CBMANAGER_H
-#define ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_CBMANAGER_H
-
-#include <cutils/native_handle.h>
-#include <log/log.h>
-
-#include <memory>
-#include <android/hardware/graphics/common/1.0/types.h>
-#include <android/hardware/graphics/mapper/2.0/IMapper.h>
-
-#include "gralloc_cb.h"
-
-namespace android {
-
-class CbManager {
-public:
- typedef hardware::graphics::common::V1_0::BufferUsage BufferUsage;
- typedef hardware::graphics::common::V1_0::PixelFormat PixelFormat;
- typedef hardware::graphics::mapper::V2_0::YCbCrLayout YCbCrLayout;
- typedef hardware::hidl_bitfield<BufferUsage> BufferUsageBits;
-
- CbManager();
-
- class CbManagerImpl {
- public:
- virtual ~CbManagerImpl() {}
- virtual native_handle_t* allocateBuffer(int width,
- int height,
- PixelFormat format,
- BufferUsageBits usage) = 0;
- virtual void freeBuffer(const native_handle_t* h) = 0;
-
- virtual int lockBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) = 0;
-
- virtual int lockYCbCrBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) = 0;
-
- virtual int unlockBuffer(native_handle_t& handle) = 0;
- };
-
- native_handle_t* allocateBuffer(
- int width, int height, PixelFormat format, BufferUsageBits usage) {
- return mImpl->allocateBuffer(width, height, format, usage);
- }
-
- void freeBuffer(const native_handle_t* h) {
- mImpl->freeBuffer(h);
- }
-
- int lockBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) {
- return mImpl->lockBuffer(handle, usage, left, top, width, height, vaddr);
- }
-
- int lockBuffer(buffer_handle_t h,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- void** vaddr) {
- native_handle_t* cb = const_cast<native_handle_t*>(h);
- if (cb) {
- return lockBuffer(*cb, usage, left, top, width, height, vaddr);
- } else {
- return -1;
- }
- }
-
-
- int lockYCbCrBuffer(native_handle_t& handle,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) {
- return mImpl->lockYCbCrBuffer(handle, usage, left, top, width, height, ycbcr);
- }
-
- int lockYCbCrBuffer(buffer_handle_t h,
- BufferUsageBits usage,
- int left, int top, int width, int height,
- YCbCrLayout* ycbcr) {
- native_handle_t* cb = const_cast<native_handle_t*>(h);
- if (cb) {
- return lockYCbCrBuffer(*cb, usage, left, top, width, height, ycbcr);
- } else {
- return -1;
- }
- }
-
- int unlockBuffer(native_handle_t& handle) {
- return mImpl->unlockBuffer(handle);
- }
-
- int unlockBuffer(buffer_handle_t h) {
- native_handle_t* cb = const_cast<native_handle_t*>(h);
- if (cb) {
- return unlockBuffer(*cb);
- } else {
- return -1;
- }
- }
-
- // Specific to goldfish, for obtaining offsets
- // into host coherent memory
- // (requires address space devce)
- static uint64_t getOffset(const buffer_handle_t h) {
- const cb_handle_t* cb = cb_handle_t::from(h);
- if (!cb->isValid()) {
- ALOGE("%s: FATAL: using incompatible native_handle_t for "
- "host coherent mapping offset",
- __func__);
- abort();
- }
- return cb ? cb->getMmapedOffset() : -1;
- }
-
-private:
- std::unique_ptr<CbManagerImpl> mImpl;
-};
-
-} // namespace android
-
-#endif // ANDROID_GOLDFISH_OPENGL_SYSTEM_CBMANAGER_CBMANAGER_H