Loading libs/hwui/DeviceInfo.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -66,12 +66,16 @@ void DeviceInfo::initialize(int maxTextureSize) { sDeviceInfo = new DeviceInfo(); sDeviceInfo->mDisplayInfo = DeviceInfo::queryDisplayInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; sDeviceInfo->queryCompositionPreference(&sDeviceInfo->mTargetDataSpace, &sDeviceInfo->mTargetPixelFormat); }); } void DeviceInfo::load() { mDisplayInfo = queryDisplayInfo(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); sDeviceInfo->queryCompositionPreference(&sDeviceInfo->mTargetDataSpace, &sDeviceInfo->mTargetPixelFormat); } DisplayInfo DeviceInfo::queryDisplayInfo() { Loading @@ -86,5 +90,17 @@ DisplayInfo DeviceInfo::queryDisplayInfo() { return displayInfo; } void DeviceInfo::queryCompositionPreference(ui::Dataspace* dataSpace, ui::PixelFormat* pixelFormat) { if (Properties::isolatedProcess) { *dataSpace = ui::Dataspace::V0_SRGB; *pixelFormat = ui::PixelFormat::RGBA_8888; } status_t status = SurfaceComposerClient::getCompositionPreference(dataSpace, pixelFormat); LOG_ALWAYS_FATAL_IF(status, "Failed to get composition preference, error %d", status); } } /* namespace uirenderer */ } /* namespace android */ libs/hwui/DeviceInfo.h +9 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #define DEVICEINFO_H #include <ui/DisplayInfo.h> #include <ui/GraphicTypes.h> #include "Extensions.h" #include "utils/Macros.h" Loading @@ -39,6 +40,8 @@ public: static void initialize(int maxTextureSize); int maxTextureSize() const { return mMaxTextureSize; } ui::Dataspace getTargetDataSpace() const { return mTargetDataSpace; } ui::PixelFormat getTargetPixelFormat() const { return mTargetPixelFormat; } const DisplayInfo& displayInfo() const { return mDisplayInfo; } const Extensions& extensions() const { return mExtensions; } Loading @@ -50,6 +53,9 @@ public: static DisplayInfo queryDisplayInfo(); private: static void queryCompositionPreference(ui::Dataspace* dataSpace, ui::PixelFormat* pixelFormat); DeviceInfo() {} ~DeviceInfo() {} Loading @@ -58,6 +64,9 @@ private: int mMaxTextureSize; DisplayInfo mDisplayInfo; Extensions mExtensions; // TODO(lpy) Replace below with android_ prefix types. ui::Dataspace mTargetDataSpace; ui::PixelFormat mTargetPixelFormat; }; } /* namespace uirenderer */ Loading libs/hwui/LayerUpdateQueue.h +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <utils/StrongPointer.h> #include "Rect.h" #include "RenderNode.h" #include "utils/Macros.h" #include <unordered_map> Loading libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp +18 −10 Original line number Diff line number Diff line Loading @@ -62,21 +62,23 @@ Frame SkiaOpenGLPipeline::getFrame() { bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty, const LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue, const Rect& contentDrawBounds, bool opaque, bool wideColorGamut, const LightInfo& lightInfo, bool opaque, const LightInfo& lightInfo, const std::vector<sp<RenderNode>>& renderNodes, FrameInfoVisualizer* profiler) { mEglManager.damageFrame(frame, dirty); SkColorType colorType; SkColorType colorType = getSurfaceColorType(); // setup surface for fbo0 GrGLFramebufferInfo fboInfo; fboInfo.fFBOID = 0; if (wideColorGamut) { if (colorType == kRGBA_F16_SkColorType) { fboInfo.fFormat = GL_RGBA16F; colorType = kRGBA_F16_SkColorType; } else { } else if (colorType == kN32_SkColorType) { // Note: The default preference of pixel format is RGBA_8888, when other // pixel format is available, we should branch out and do more check. fboInfo.fFormat = GL_RGBA8; colorType = kN32_SkColorType; } else { LOG_ALWAYS_FATAL("Unsupported color type."); } GrBackendRenderTarget backendRT(frame.width(), frame.height(), 0, STENCIL_BUFFER_SIZE, fboInfo); Loading @@ -89,8 +91,7 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, con nullptr, &props)); SkiaPipeline::updateLighting(lightGeometry, lightInfo); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, wideColorGamut, contentDrawBounds, surface); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, contentDrawBounds, surface); layerUpdateQueue->clear(); // Draw visual debugging features Loading Loading @@ -147,8 +148,7 @@ bool SkiaOpenGLPipeline::setSurface(Surface* surface, SwapBehavior swapBehavior, if (surface) { mRenderThread.requireGlContext(); const bool wideColorGamut = colorMode == ColorMode::WideColorGamut; mEglSurface = mEglManager.createSurface(surface, wideColorGamut); mEglSurface = mEglManager.createSurface(surface, colorMode); } if (mEglSurface != EGL_NO_SURFACE) { Loading @@ -168,6 +168,14 @@ bool SkiaOpenGLPipeline::isContextReady() { return CC_LIKELY(mEglManager.hasEglContext()); } SkColorType SkiaOpenGLPipeline::getSurfaceColorType() const { return mEglManager.getSurfaceColorType(); } sk_sp<SkColorSpace> SkiaOpenGLPipeline::getSurfaceColorSpace() { return mEglManager.getSurfaceColorSpace(); } void SkiaOpenGLPipeline::invokeFunctor(const RenderThread& thread, Functor* functor) { DrawGlInfo::Mode mode = DrawGlInfo::kModeProcessNoContext; if (thread.eglManager().hasEglContext()) { Loading libs/hwui/pipeline/skia/SkiaOpenGLPipeline.h +3 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,7 @@ public: renderthread::Frame getFrame() override; bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty, const LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue, const Rect& contentDrawBounds, bool opaque, bool wideColorGamut, const LightInfo& lightInfo, const Rect& contentDrawBounds, bool opaque, const LightInfo& lightInfo, const std::vector<sp<RenderNode> >& renderNodes, FrameInfoVisualizer* profiler) override; bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, Loading @@ -46,6 +45,8 @@ public: void onStop() override; bool isSurfaceReady() override; bool isContextReady() override; SkColorType getSurfaceColorType() const override; sk_sp<SkColorSpace> getSurfaceColorSpace() override; static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor); Loading Loading
libs/hwui/DeviceInfo.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -66,12 +66,16 @@ void DeviceInfo::initialize(int maxTextureSize) { sDeviceInfo = new DeviceInfo(); sDeviceInfo->mDisplayInfo = DeviceInfo::queryDisplayInfo(); sDeviceInfo->mMaxTextureSize = maxTextureSize; sDeviceInfo->queryCompositionPreference(&sDeviceInfo->mTargetDataSpace, &sDeviceInfo->mTargetPixelFormat); }); } void DeviceInfo::load() { mDisplayInfo = queryDisplayInfo(); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); sDeviceInfo->queryCompositionPreference(&sDeviceInfo->mTargetDataSpace, &sDeviceInfo->mTargetPixelFormat); } DisplayInfo DeviceInfo::queryDisplayInfo() { Loading @@ -86,5 +90,17 @@ DisplayInfo DeviceInfo::queryDisplayInfo() { return displayInfo; } void DeviceInfo::queryCompositionPreference(ui::Dataspace* dataSpace, ui::PixelFormat* pixelFormat) { if (Properties::isolatedProcess) { *dataSpace = ui::Dataspace::V0_SRGB; *pixelFormat = ui::PixelFormat::RGBA_8888; } status_t status = SurfaceComposerClient::getCompositionPreference(dataSpace, pixelFormat); LOG_ALWAYS_FATAL_IF(status, "Failed to get composition preference, error %d", status); } } /* namespace uirenderer */ } /* namespace android */
libs/hwui/DeviceInfo.h +9 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #define DEVICEINFO_H #include <ui/DisplayInfo.h> #include <ui/GraphicTypes.h> #include "Extensions.h" #include "utils/Macros.h" Loading @@ -39,6 +40,8 @@ public: static void initialize(int maxTextureSize); int maxTextureSize() const { return mMaxTextureSize; } ui::Dataspace getTargetDataSpace() const { return mTargetDataSpace; } ui::PixelFormat getTargetPixelFormat() const { return mTargetPixelFormat; } const DisplayInfo& displayInfo() const { return mDisplayInfo; } const Extensions& extensions() const { return mExtensions; } Loading @@ -50,6 +53,9 @@ public: static DisplayInfo queryDisplayInfo(); private: static void queryCompositionPreference(ui::Dataspace* dataSpace, ui::PixelFormat* pixelFormat); DeviceInfo() {} ~DeviceInfo() {} Loading @@ -58,6 +64,9 @@ private: int mMaxTextureSize; DisplayInfo mDisplayInfo; Extensions mExtensions; // TODO(lpy) Replace below with android_ prefix types. ui::Dataspace mTargetDataSpace; ui::PixelFormat mTargetPixelFormat; }; } /* namespace uirenderer */ Loading
libs/hwui/LayerUpdateQueue.h +1 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <utils/StrongPointer.h> #include "Rect.h" #include "RenderNode.h" #include "utils/Macros.h" #include <unordered_map> Loading
libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp +18 −10 Original line number Diff line number Diff line Loading @@ -62,21 +62,23 @@ Frame SkiaOpenGLPipeline::getFrame() { bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty, const LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue, const Rect& contentDrawBounds, bool opaque, bool wideColorGamut, const LightInfo& lightInfo, bool opaque, const LightInfo& lightInfo, const std::vector<sp<RenderNode>>& renderNodes, FrameInfoVisualizer* profiler) { mEglManager.damageFrame(frame, dirty); SkColorType colorType; SkColorType colorType = getSurfaceColorType(); // setup surface for fbo0 GrGLFramebufferInfo fboInfo; fboInfo.fFBOID = 0; if (wideColorGamut) { if (colorType == kRGBA_F16_SkColorType) { fboInfo.fFormat = GL_RGBA16F; colorType = kRGBA_F16_SkColorType; } else { } else if (colorType == kN32_SkColorType) { // Note: The default preference of pixel format is RGBA_8888, when other // pixel format is available, we should branch out and do more check. fboInfo.fFormat = GL_RGBA8; colorType = kN32_SkColorType; } else { LOG_ALWAYS_FATAL("Unsupported color type."); } GrBackendRenderTarget backendRT(frame.width(), frame.height(), 0, STENCIL_BUFFER_SIZE, fboInfo); Loading @@ -89,8 +91,7 @@ bool SkiaOpenGLPipeline::draw(const Frame& frame, const SkRect& screenDirty, con nullptr, &props)); SkiaPipeline::updateLighting(lightGeometry, lightInfo); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, wideColorGamut, contentDrawBounds, surface); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, contentDrawBounds, surface); layerUpdateQueue->clear(); // Draw visual debugging features Loading Loading @@ -147,8 +148,7 @@ bool SkiaOpenGLPipeline::setSurface(Surface* surface, SwapBehavior swapBehavior, if (surface) { mRenderThread.requireGlContext(); const bool wideColorGamut = colorMode == ColorMode::WideColorGamut; mEglSurface = mEglManager.createSurface(surface, wideColorGamut); mEglSurface = mEglManager.createSurface(surface, colorMode); } if (mEglSurface != EGL_NO_SURFACE) { Loading @@ -168,6 +168,14 @@ bool SkiaOpenGLPipeline::isContextReady() { return CC_LIKELY(mEglManager.hasEglContext()); } SkColorType SkiaOpenGLPipeline::getSurfaceColorType() const { return mEglManager.getSurfaceColorType(); } sk_sp<SkColorSpace> SkiaOpenGLPipeline::getSurfaceColorSpace() { return mEglManager.getSurfaceColorSpace(); } void SkiaOpenGLPipeline::invokeFunctor(const RenderThread& thread, Functor* functor) { DrawGlInfo::Mode mode = DrawGlInfo::kModeProcessNoContext; if (thread.eglManager().hasEglContext()) { Loading
libs/hwui/pipeline/skia/SkiaOpenGLPipeline.h +3 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,7 @@ public: renderthread::Frame getFrame() override; bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty, const LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue, const Rect& contentDrawBounds, bool opaque, bool wideColorGamut, const LightInfo& lightInfo, const Rect& contentDrawBounds, bool opaque, const LightInfo& lightInfo, const std::vector<sp<RenderNode> >& renderNodes, FrameInfoVisualizer* profiler) override; bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, Loading @@ -46,6 +45,8 @@ public: void onStop() override; bool isSurfaceReady() override; bool isContextReady() override; SkColorType getSurfaceColorType() const override; sk_sp<SkColorSpace> getSurfaceColorSpace() override; static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor); Loading