aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-04-24 18:54:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-24 18:54:06 +0000
commit4eedfee63685a066868138c834ab0687ad49a29a (patch)
treea06893c6b7854e8f9bdfec7519a3a21ef9039d08
parent3761d0cb4b6112d88133863cd4bc31a1d0bc867c (diff)
parentcddc51654c861ca14d8a340641ede0b5143a03ea (diff)
downloaddevice_generic_goldfish-opengl-4eedfee63685a066868138c834ab0687ad49a29a.tar.gz
device_generic_goldfish-opengl-4eedfee63685a066868138c834ab0687ad49a29a.tar.bz2
device_generic_goldfish-opengl-4eedfee63685a066868138c834ab0687ad49a29a.zip
Merge "Retire cbmananger from EmuHWC2" into rvc-dev
-rw-r--r--system/hwc2/Android.mk2
-rw-r--r--system/hwc2/EmuHWC2.cpp28
-rw-r--r--system/hwc2/EmuHWC2.h2
3 files changed, 21 insertions, 11 deletions
diff --git a/system/hwc2/Android.mk b/system/hwc2/Android.mk
index ac742186..24a8a58a 100644
--- a/system/hwc2/Android.mk
+++ b/system/hwc2/Android.mk
@@ -53,7 +53,7 @@ include $(CLEAR_VARS)
LOCAL_VENDOR_MODULE := true
LOCAL_SHARED_LIBRARIES := $(emulator_hwcomposer_shared_libraries)
LOCAL_SHARED_LIBRARIES += libOpenglSystemCommon lib_renderControl_enc
-LOCAL_SHARED_LIBRARIES += libcbmanager
+LOCAL_SHARED_LIBRARIES += libui
LOCAL_SRC_FILES := $(emulator_hwcomposer2_src_files)
LOCAL_C_INCLUDES := $(emulator_hwcomposer_c_includes)
LOCAL_MODULE_RELATIVE_PATH := $(emulator_hwcomposer_relative_path)
diff --git a/system/hwc2/EmuHWC2.cpp b/system/hwc2/EmuHWC2.cpp
index 14bb545c..8df9f6d0 100644
--- a/system/hwc2/EmuHWC2.cpp
+++ b/system/hwc2/EmuHWC2.cpp
@@ -27,6 +27,8 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
+#include <ui/GraphicBuffer.h>
+#include <ui/GraphicBufferAllocator.h>
#include "../egl/goldfish_sync.h"
@@ -390,17 +392,27 @@ Error EmuHWC2::registerCallback(Callback descriptor,
}
const native_handle_t* EmuHWC2::allocateDisplayColorBuffer() {
- typedef CbManager::BufferUsage BufferUsage;
-
- return mCbManager.allocateBuffer(
- mDisplayWidth,
- mDisplayHeight,
- CbManager::PixelFormat::RGBA_8888,
- (BufferUsage::COMPOSER_OVERLAY | BufferUsage::GPU_RENDER_TARGET));
+ const uint32_t layerCount = 1;
+ const uint64_t graphicBufferId = 0; // not used
+
+ buffer_handle_t h;
+ uint32_t stride;
+
+ if (GraphicBufferAllocator::get().allocate(
+ mDisplayWidth, mDisplayHeight,
+ PIXEL_FORMAT_RGBA_8888,
+ layerCount,
+ (GraphicBuffer::USAGE_HW_COMPOSER | GraphicBuffer::USAGE_HW_RENDER),
+ &h, &stride,
+ graphicBufferId, "EmuHWC2") == OK) {
+ return static_cast<const native_handle_t*>(h);
+ } else {
+ return nullptr;
+ }
}
void EmuHWC2::freeDisplayColorBuffer(const native_handle_t* h) {
- mCbManager.freeBuffer(h);
+ GraphicBufferAllocator::get().free(h);
}
// Display functions
diff --git a/system/hwc2/EmuHWC2.h b/system/hwc2/EmuHWC2.h
index 1a8f275a..1ff3394f 100644
--- a/system/hwc2/EmuHWC2.h
+++ b/system/hwc2/EmuHWC2.h
@@ -38,7 +38,6 @@
#include <cutils/native_handle.h>
-#include "cbmanager.h"
#include "HostConnection.h"
namespace android {
@@ -470,7 +469,6 @@ private:
const native_handle_t* allocateDisplayColorBuffer();
void freeDisplayColorBuffer(const native_handle_t* h);
- CbManager mCbManager;
std::unordered_set<HWC2::Capability> mCapabilities;
// These are potentially accessed from multiple threads, and are protected