Loading graphics/composer/2.1/default/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ cc_library_shared { "liblog", "libsync", "libutils", "libhwc2on1adapter" ], } Loading graphics/composer/2.1/default/Hwc.cpp +31 −6 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ #include "ComposerClient.h" #include "Hwc.h" #include "hardware/hwcomposer.h" #include "hwc2on1adapter/HWC2On1Adapter.h" namespace android { namespace hardware { Loading @@ -30,13 +32,36 @@ namespace composer { namespace V2_1 { namespace implementation { HwcHal::HwcHal(const hw_module_t* module) : mDevice(nullptr), mDispatch() { int status = hwc2_open(module, &mDevice); if (status) { LOG_ALWAYS_FATAL("failed to open hwcomposer2 device: %s", strerror(-status)); : mDevice(nullptr), mDispatch(), mAdapter() { // Determine what kind of module is available (HWC2 vs HWC1.X). hw_device_t* device = nullptr; int error = module->methods->open(module, HWC_HARDWARE_COMPOSER, &device); if (error != 0) { ALOGE("Failed to open HWC device (%s), aborting", strerror(-error)); abort(); } uint32_t majorVersion = (device->version >> 24) & 0xF; // If we don't have a HWC2, we need to wrap whatever we have in an adapter. if (majorVersion != 2) { uint32_t minorVersion = device->version & HARDWARE_API_VERSION_2_MAJ_MIN_MASK; minorVersion = (minorVersion >> 16) & 0xF; ALOGI("Found HWC implementation v%d.%d", majorVersion, minorVersion); if (minorVersion < 1) { ALOGE("Cannot adapt to HWC version %d.%d. Minimum supported is 1.1", majorVersion, minorVersion); abort(); } mAdapter = std::make_unique<HWC2On1Adapter>( reinterpret_cast<hwc_composer_device_1*>(device)); // Place the adapter in front of the device module. mDevice = mAdapter.get(); } else { mDevice = reinterpret_cast<hwc2_device_t*>(device); } initCapabilities(); Loading graphics/composer/2.1/default/Hwc.h +13 −1 Original line number Diff line number Diff line Loading @@ -18,14 +18,22 @@ #define ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_H #include <mutex> #include <memory> #include <unordered_set> #include <vector> #include <android/hardware/graphics/composer/2.1/IComposer.h> #define HWC2_INCLUDE_STRINGIFICATION #define HWC2_USE_CPP11 #include <hardware/hwcomposer2.h> #undef HWC2_INCLUDE_STRINGIFICATION #undef HWC2_USE_CPP11 #include "ComposerBase.h" namespace android { class HWC2On1Adapter; } namespace android { namespace hardware { namespace graphics { Loading Loading @@ -204,6 +212,10 @@ private: std::mutex mClientMutex; wp<ComposerClient> mClient; // If the HWC implementation version is < 2.0, use an adapter to interface // between HWC 2.0 <-> HWC 1.X. std::unique_ptr<HWC2On1Adapter> mAdapter; }; extern "C" IComposer* HIDL_FETCH_IComposer(const char* name); Loading Loading
graphics/composer/2.1/default/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ cc_library_shared { "liblog", "libsync", "libutils", "libhwc2on1adapter" ], } Loading
graphics/composer/2.1/default/Hwc.cpp +31 −6 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ #include "ComposerClient.h" #include "Hwc.h" #include "hardware/hwcomposer.h" #include "hwc2on1adapter/HWC2On1Adapter.h" namespace android { namespace hardware { Loading @@ -30,13 +32,36 @@ namespace composer { namespace V2_1 { namespace implementation { HwcHal::HwcHal(const hw_module_t* module) : mDevice(nullptr), mDispatch() { int status = hwc2_open(module, &mDevice); if (status) { LOG_ALWAYS_FATAL("failed to open hwcomposer2 device: %s", strerror(-status)); : mDevice(nullptr), mDispatch(), mAdapter() { // Determine what kind of module is available (HWC2 vs HWC1.X). hw_device_t* device = nullptr; int error = module->methods->open(module, HWC_HARDWARE_COMPOSER, &device); if (error != 0) { ALOGE("Failed to open HWC device (%s), aborting", strerror(-error)); abort(); } uint32_t majorVersion = (device->version >> 24) & 0xF; // If we don't have a HWC2, we need to wrap whatever we have in an adapter. if (majorVersion != 2) { uint32_t minorVersion = device->version & HARDWARE_API_VERSION_2_MAJ_MIN_MASK; minorVersion = (minorVersion >> 16) & 0xF; ALOGI("Found HWC implementation v%d.%d", majorVersion, minorVersion); if (minorVersion < 1) { ALOGE("Cannot adapt to HWC version %d.%d. Minimum supported is 1.1", majorVersion, minorVersion); abort(); } mAdapter = std::make_unique<HWC2On1Adapter>( reinterpret_cast<hwc_composer_device_1*>(device)); // Place the adapter in front of the device module. mDevice = mAdapter.get(); } else { mDevice = reinterpret_cast<hwc2_device_t*>(device); } initCapabilities(); Loading
graphics/composer/2.1/default/Hwc.h +13 −1 Original line number Diff line number Diff line Loading @@ -18,14 +18,22 @@ #define ANDROID_HARDWARE_GRAPHICS_COMPOSER_V2_1_HWC_H #include <mutex> #include <memory> #include <unordered_set> #include <vector> #include <android/hardware/graphics/composer/2.1/IComposer.h> #define HWC2_INCLUDE_STRINGIFICATION #define HWC2_USE_CPP11 #include <hardware/hwcomposer2.h> #undef HWC2_INCLUDE_STRINGIFICATION #undef HWC2_USE_CPP11 #include "ComposerBase.h" namespace android { class HWC2On1Adapter; } namespace android { namespace hardware { namespace graphics { Loading Loading @@ -204,6 +212,10 @@ private: std::mutex mClientMutex; wp<ComposerClient> mClient; // If the HWC implementation version is < 2.0, use an adapter to interface // between HWC 2.0 <-> HWC 1.X. std::unique_ptr<HWC2On1Adapter> mAdapter; }; extern "C" IComposer* HIDL_FETCH_IComposer(const char* name); Loading