Loading services/surfaceflinger/Android.mk +8 −5 Original line number Diff line number Diff line Loading @@ -49,14 +49,11 @@ LOCAL_C_INCLUDES := \ LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\" LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES ifeq ($(TARGET_IN_VR_MODE),true) LOCAL_CFLAGS += -DIN_VR_MODE endif ifeq ($(TARGET_USES_HWC2),true) LOCAL_CFLAGS += -DUSE_HWC2 LOCAL_SRC_FILES += \ SurfaceFlinger.cpp \ VrStateCallbacks.cpp \ DisplayHardware/HWComposer.cpp ifeq ($(TARGET_USES_HWC2ON1ADAPTER), true) LOCAL_CFLAGS += -DBYPASS_IHWC Loading Loading @@ -134,7 +131,13 @@ endif LOCAL_CFLAGS += -fvisibility=hidden -Werror=format LOCAL_STATIC_LIBRARIES := libhwcomposer-command-buffer libtrace_proto libvkjson LOCAL_STATIC_LIBRARIES := \ libhwcomposer-command-buffer \ libtrace_proto \ libvkjson \ libvr_manager \ libvrflinger LOCAL_SHARED_LIBRARIES := \ android.dvr.composer@1.0 \ android.hardware.graphics.allocator@2.0 \ Loading services/surfaceflinger/DisplayHardware/ComposerHal.cpp +5 −8 Original line number Diff line number Diff line Loading @@ -124,13 +124,11 @@ void Composer::CommandWriter::setLayerInfo(uint32_t type, uint32_t appId) endCommand(); } Composer::Composer() : mWriter(kWriterInitialSize) Composer::Composer(bool useVrComposer) : mWriter(kWriterInitialSize), mIsUsingVrComposer(useVrComposer) { #if defined(IN_VR_MODE) mIsInVrMode = true; #endif if (mIsInVrMode) { if (mIsUsingVrComposer) { mComposer = IComposer::getService("vr_hwcomposer"); } else { mComposer = IComposer::getService("hwcomposer"); Loading Loading @@ -622,8 +620,7 @@ Error Composer::setLayerZOrder(Display display, Layer layer, uint32_t z) Error Composer::setLayerInfo(Display display, Layer layer, uint32_t type, uint32_t appId) { if (mIsInVrMode) { if (mIsUsingVrComposer) { mWriter.selectDisplay(display); mWriter.selectLayer(layer); mWriter.setLayerInfo(type, appId); Loading services/surfaceflinger/DisplayHardware/ComposerHal.h +5 −3 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <android/hardware/graphics/composer/2.1/IComposer.h> #include <utils/StrongPointer.h> #include <IComposerCommandBuffer.h> #include <MessageQueue.h> namespace android { Loading Loading @@ -128,7 +127,7 @@ private: // Composer is a wrapper to IComposer, a proxy to server-side composer. class Composer { public: Composer(); Composer(bool useVrComposer); std::vector<IComposer::Capability> getCapabilities(); std::string dumpDebugInfo(); Loading @@ -136,6 +135,7 @@ public: void registerCallback(const sp<IComposerCallback>& callback); uint32_t getMaxVirtualDisplayCount(); bool isUsingVrComposer() const { return mIsUsingVrComposer; } Error createVirtualDisplay(uint32_t width, uint32_t height, PixelFormat* format, Display* outDisplay); Error destroyVirtualDisplay(Display display); Loading Loading @@ -248,7 +248,9 @@ private: CommandWriter mWriter; CommandReader mReader; bool mIsInVrMode = false; // When true, the we attach to the vr_hwcomposer service instead of the // hwcomposer. This allows us to redirect surfaces to 3d surfaces in vr. const bool mIsUsingVrComposer; }; } // namespace Hwc2 Loading services/surfaceflinger/DisplayHardware/HWC2.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -135,8 +135,8 @@ Device::Device(hwc2_device_t* device) mSetLayerVisibleRegion(nullptr), mSetLayerZOrder(nullptr), #else Device::Device() : mComposer(std::make_unique<Hwc2::Composer>()), Device::Device(bool useVrComposer) : mComposer(std::make_unique<Hwc2::Composer>(useVrComposer)), #endif // BYPASS_IHWC mCapabilities(), mDisplays(), Loading services/surfaceflinger/DisplayHardware/HWC2.h +10 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,10 @@ public: #ifdef BYPASS_IHWC explicit Device(hwc2_device_t* device); #else Device(); // useVrComposer is passed to the composer HAL. When true, the composer HAL // will use the vr composer service, otherwise it uses the real hardware // composer. Device(bool useVrComposer); #endif ~Device(); Loading Loading @@ -106,6 +109,12 @@ public: bool hasCapability(HWC2::Capability capability) const; #ifdef BYPASS_IHWC android::Hwc2::Composer* getComposer() { return nullptr; } #else android::Hwc2::Composer* getComposer() { return mComposer.get(); } #endif private: // Initialization methods Loading Loading
services/surfaceflinger/Android.mk +8 −5 Original line number Diff line number Diff line Loading @@ -49,14 +49,11 @@ LOCAL_C_INCLUDES := \ LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\" LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES ifeq ($(TARGET_IN_VR_MODE),true) LOCAL_CFLAGS += -DIN_VR_MODE endif ifeq ($(TARGET_USES_HWC2),true) LOCAL_CFLAGS += -DUSE_HWC2 LOCAL_SRC_FILES += \ SurfaceFlinger.cpp \ VrStateCallbacks.cpp \ DisplayHardware/HWComposer.cpp ifeq ($(TARGET_USES_HWC2ON1ADAPTER), true) LOCAL_CFLAGS += -DBYPASS_IHWC Loading Loading @@ -134,7 +131,13 @@ endif LOCAL_CFLAGS += -fvisibility=hidden -Werror=format LOCAL_STATIC_LIBRARIES := libhwcomposer-command-buffer libtrace_proto libvkjson LOCAL_STATIC_LIBRARIES := \ libhwcomposer-command-buffer \ libtrace_proto \ libvkjson \ libvr_manager \ libvrflinger LOCAL_SHARED_LIBRARIES := \ android.dvr.composer@1.0 \ android.hardware.graphics.allocator@2.0 \ Loading
services/surfaceflinger/DisplayHardware/ComposerHal.cpp +5 −8 Original line number Diff line number Diff line Loading @@ -124,13 +124,11 @@ void Composer::CommandWriter::setLayerInfo(uint32_t type, uint32_t appId) endCommand(); } Composer::Composer() : mWriter(kWriterInitialSize) Composer::Composer(bool useVrComposer) : mWriter(kWriterInitialSize), mIsUsingVrComposer(useVrComposer) { #if defined(IN_VR_MODE) mIsInVrMode = true; #endif if (mIsInVrMode) { if (mIsUsingVrComposer) { mComposer = IComposer::getService("vr_hwcomposer"); } else { mComposer = IComposer::getService("hwcomposer"); Loading Loading @@ -622,8 +620,7 @@ Error Composer::setLayerZOrder(Display display, Layer layer, uint32_t z) Error Composer::setLayerInfo(Display display, Layer layer, uint32_t type, uint32_t appId) { if (mIsInVrMode) { if (mIsUsingVrComposer) { mWriter.selectDisplay(display); mWriter.selectLayer(layer); mWriter.setLayerInfo(type, appId); Loading
services/surfaceflinger/DisplayHardware/ComposerHal.h +5 −3 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include <android/hardware/graphics/composer/2.1/IComposer.h> #include <utils/StrongPointer.h> #include <IComposerCommandBuffer.h> #include <MessageQueue.h> namespace android { Loading Loading @@ -128,7 +127,7 @@ private: // Composer is a wrapper to IComposer, a proxy to server-side composer. class Composer { public: Composer(); Composer(bool useVrComposer); std::vector<IComposer::Capability> getCapabilities(); std::string dumpDebugInfo(); Loading @@ -136,6 +135,7 @@ public: void registerCallback(const sp<IComposerCallback>& callback); uint32_t getMaxVirtualDisplayCount(); bool isUsingVrComposer() const { return mIsUsingVrComposer; } Error createVirtualDisplay(uint32_t width, uint32_t height, PixelFormat* format, Display* outDisplay); Error destroyVirtualDisplay(Display display); Loading Loading @@ -248,7 +248,9 @@ private: CommandWriter mWriter; CommandReader mReader; bool mIsInVrMode = false; // When true, the we attach to the vr_hwcomposer service instead of the // hwcomposer. This allows us to redirect surfaces to 3d surfaces in vr. const bool mIsUsingVrComposer; }; } // namespace Hwc2 Loading
services/surfaceflinger/DisplayHardware/HWC2.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -135,8 +135,8 @@ Device::Device(hwc2_device_t* device) mSetLayerVisibleRegion(nullptr), mSetLayerZOrder(nullptr), #else Device::Device() : mComposer(std::make_unique<Hwc2::Composer>()), Device::Device(bool useVrComposer) : mComposer(std::make_unique<Hwc2::Composer>(useVrComposer)), #endif // BYPASS_IHWC mCapabilities(), mDisplays(), Loading
services/surfaceflinger/DisplayHardware/HWC2.h +10 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,10 @@ public: #ifdef BYPASS_IHWC explicit Device(hwc2_device_t* device); #else Device(); // useVrComposer is passed to the composer HAL. When true, the composer HAL // will use the vr composer service, otherwise it uses the real hardware // composer. Device(bool useVrComposer); #endif ~Device(); Loading Loading @@ -106,6 +109,12 @@ public: bool hasCapability(HWC2::Capability capability) const; #ifdef BYPASS_IHWC android::Hwc2::Composer* getComposer() { return nullptr; } #else android::Hwc2::Composer* getComposer() { return mComposer.get(); } #endif private: // Initialization methods Loading