Loading services/surfaceflinger/ScreenCaptureOutput.cpp +16 −6 Original line number Diff line number Diff line Loading @@ -45,10 +45,9 @@ Rect getOrientedDisplaySpaceRect(ui::Rotation orientation, int reqWidth, int req std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutputArgs args) { std::shared_ptr<ScreenCaptureOutput> output = compositionengine::impl::createOutputTemplated< ScreenCaptureOutput, compositionengine::CompositionEngine, const RenderArea&, const compositionengine::Output::ColorProfile&, bool>(args.compositionEngine, args.renderArea, args.colorProfile, args.regionSampling); const compositionengine::Output::ColorProfile&, bool>(args.compositionEngine, args.renderArea, args.colorProfile, args.regionSampling, args.dimInGammaSpaceForEnhancedScreenshots); output->editState().isSecure = args.renderArea.isSecure(); output->setCompositionEnabled(true); output->setLayerFilter({args.layerStack}); Loading Loading @@ -81,8 +80,11 @@ std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutp ScreenCaptureOutput::ScreenCaptureOutput( const RenderArea& renderArea, const compositionengine::Output::ColorProfile& colorProfile, bool regionSampling) : mRenderArea(renderArea), mColorProfile(colorProfile), mRegionSampling(regionSampling) {} bool regionSampling, bool dimInGammaSpaceForEnhancedScreenshots) : mRenderArea(renderArea), mColorProfile(colorProfile), mRegionSampling(regionSampling), mDimInGammaSpaceForEnhancedScreenshots(dimInGammaSpaceForEnhancedScreenshots) {} void ScreenCaptureOutput::updateColorProfile(const compositionengine::CompositionRefreshArgs&) { auto& outputState = editState(); Loading @@ -95,6 +97,14 @@ renderengine::DisplaySettings ScreenCaptureOutput::generateClientCompositionDisp auto clientCompositionDisplay = compositionengine::impl::Output::generateClientCompositionDisplaySettings(); clientCompositionDisplay.clip = mRenderArea.getSourceCrop(); auto renderIntent = static_cast<ui::RenderIntent>(clientCompositionDisplay.renderIntent); if (mDimInGammaSpaceForEnhancedScreenshots && renderIntent != ui::RenderIntent::COLORIMETRIC && renderIntent != ui::RenderIntent::TONE_MAP_COLORIMETRIC) { clientCompositionDisplay.dimmingStage = aidl::android::hardware::graphics::composer3::DimmingStage::GAMMA_OETF; } return clientCompositionDisplay; } Loading services/surfaceflinger/ScreenCaptureOutput.h +3 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ struct ScreenCaptureOutputArgs { float targetBrightness; bool regionSampling; bool treat170mAsSrgb; bool dimInGammaSpaceForEnhancedScreenshots; }; // ScreenCaptureOutput is used to compose a set of layers into a preallocated buffer. Loading @@ -47,7 +48,7 @@ class ScreenCaptureOutput : public compositionengine::impl::Output { public: ScreenCaptureOutput(const RenderArea& renderArea, const compositionengine::Output::ColorProfile& colorProfile, bool regionSampling); bool regionSampling, bool dimInGammaSpaceForEnhancedScreenshots); void updateColorProfile(const compositionengine::CompositionRefreshArgs&) override; Loading @@ -63,6 +64,7 @@ private: const RenderArea& mRenderArea; const compositionengine::Output::ColorProfile& mColorProfile; const bool mRegionSampling; const bool mDimInGammaSpaceForEnhancedScreenshots; }; std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutputArgs); Loading services/surfaceflinger/SurfaceFlinger.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -451,6 +451,9 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI property_get("debug.sf.treat_170m_as_sRGB", value, "0"); mTreat170mAsSrgb = atoi(value); property_get("debug.sf.dim_in_gamma_in_enhanced_screenshots", value, 0); mDimInGammaSpaceForEnhancedScreenshots = atoi(value); mIgnoreHwcPhysicalDisplayOrientation = base::GetBoolProperty("debug.sf.ignore_hwc_physical_display_orientation"s, false); Loading Loading @@ -7480,7 +7483,9 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl( .displayBrightnessNits = displayBrightnessNits, .targetBrightness = targetBrightness, .regionSampling = regionSampling, .treat170mAsSrgb = mTreat170mAsSrgb}); .treat170mAsSrgb = mTreat170mAsSrgb, .dimInGammaSpaceForEnhancedScreenshots = mDimInGammaSpaceForEnhancedScreenshots}); const float colorSaturation = grayscale ? 0 : 1; compositionengine::CompositionRefreshArgs refreshArgs{ Loading services/surfaceflinger/SurfaceFlinger.h +5 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,11 @@ public: // on this behavior to increase contrast for some media sources. bool mTreat170mAsSrgb = false; // If true, then screenshots with an enhanced render intent will dim in gamma space. // The purpose is to ensure that screenshots appear correct during system animations for devices // that require that dimming must occur in gamma space. bool mDimInGammaSpaceForEnhancedScreenshots = false; // Allows to ignore physical orientation provided through hwc API in favour of // 'ro.surface_flinger.primary_display_orientation'. // TODO(b/246793311): Clean up a temporary property Loading Loading
services/surfaceflinger/ScreenCaptureOutput.cpp +16 −6 Original line number Diff line number Diff line Loading @@ -45,10 +45,9 @@ Rect getOrientedDisplaySpaceRect(ui::Rotation orientation, int reqWidth, int req std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutputArgs args) { std::shared_ptr<ScreenCaptureOutput> output = compositionengine::impl::createOutputTemplated< ScreenCaptureOutput, compositionengine::CompositionEngine, const RenderArea&, const compositionengine::Output::ColorProfile&, bool>(args.compositionEngine, args.renderArea, args.colorProfile, args.regionSampling); const compositionengine::Output::ColorProfile&, bool>(args.compositionEngine, args.renderArea, args.colorProfile, args.regionSampling, args.dimInGammaSpaceForEnhancedScreenshots); output->editState().isSecure = args.renderArea.isSecure(); output->setCompositionEnabled(true); output->setLayerFilter({args.layerStack}); Loading Loading @@ -81,8 +80,11 @@ std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutp ScreenCaptureOutput::ScreenCaptureOutput( const RenderArea& renderArea, const compositionengine::Output::ColorProfile& colorProfile, bool regionSampling) : mRenderArea(renderArea), mColorProfile(colorProfile), mRegionSampling(regionSampling) {} bool regionSampling, bool dimInGammaSpaceForEnhancedScreenshots) : mRenderArea(renderArea), mColorProfile(colorProfile), mRegionSampling(regionSampling), mDimInGammaSpaceForEnhancedScreenshots(dimInGammaSpaceForEnhancedScreenshots) {} void ScreenCaptureOutput::updateColorProfile(const compositionengine::CompositionRefreshArgs&) { auto& outputState = editState(); Loading @@ -95,6 +97,14 @@ renderengine::DisplaySettings ScreenCaptureOutput::generateClientCompositionDisp auto clientCompositionDisplay = compositionengine::impl::Output::generateClientCompositionDisplaySettings(); clientCompositionDisplay.clip = mRenderArea.getSourceCrop(); auto renderIntent = static_cast<ui::RenderIntent>(clientCompositionDisplay.renderIntent); if (mDimInGammaSpaceForEnhancedScreenshots && renderIntent != ui::RenderIntent::COLORIMETRIC && renderIntent != ui::RenderIntent::TONE_MAP_COLORIMETRIC) { clientCompositionDisplay.dimmingStage = aidl::android::hardware::graphics::composer3::DimmingStage::GAMMA_OETF; } return clientCompositionDisplay; } Loading
services/surfaceflinger/ScreenCaptureOutput.h +3 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ struct ScreenCaptureOutputArgs { float targetBrightness; bool regionSampling; bool treat170mAsSrgb; bool dimInGammaSpaceForEnhancedScreenshots; }; // ScreenCaptureOutput is used to compose a set of layers into a preallocated buffer. Loading @@ -47,7 +48,7 @@ class ScreenCaptureOutput : public compositionengine::impl::Output { public: ScreenCaptureOutput(const RenderArea& renderArea, const compositionengine::Output::ColorProfile& colorProfile, bool regionSampling); bool regionSampling, bool dimInGammaSpaceForEnhancedScreenshots); void updateColorProfile(const compositionengine::CompositionRefreshArgs&) override; Loading @@ -63,6 +64,7 @@ private: const RenderArea& mRenderArea; const compositionengine::Output::ColorProfile& mColorProfile; const bool mRegionSampling; const bool mDimInGammaSpaceForEnhancedScreenshots; }; std::shared_ptr<ScreenCaptureOutput> createScreenCaptureOutput(ScreenCaptureOutputArgs); Loading
services/surfaceflinger/SurfaceFlinger.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -451,6 +451,9 @@ SurfaceFlinger::SurfaceFlinger(Factory& factory) : SurfaceFlinger(factory, SkipI property_get("debug.sf.treat_170m_as_sRGB", value, "0"); mTreat170mAsSrgb = atoi(value); property_get("debug.sf.dim_in_gamma_in_enhanced_screenshots", value, 0); mDimInGammaSpaceForEnhancedScreenshots = atoi(value); mIgnoreHwcPhysicalDisplayOrientation = base::GetBoolProperty("debug.sf.ignore_hwc_physical_display_orientation"s, false); Loading Loading @@ -7480,7 +7483,9 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl( .displayBrightnessNits = displayBrightnessNits, .targetBrightness = targetBrightness, .regionSampling = regionSampling, .treat170mAsSrgb = mTreat170mAsSrgb}); .treat170mAsSrgb = mTreat170mAsSrgb, .dimInGammaSpaceForEnhancedScreenshots = mDimInGammaSpaceForEnhancedScreenshots}); const float colorSaturation = grayscale ? 0 : 1; compositionengine::CompositionRefreshArgs refreshArgs{ Loading
services/surfaceflinger/SurfaceFlinger.h +5 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,11 @@ public: // on this behavior to increase contrast for some media sources. bool mTreat170mAsSrgb = false; // If true, then screenshots with an enhanced render intent will dim in gamma space. // The purpose is to ensure that screenshots appear correct during system animations for devices // that require that dimming must occur in gamma space. bool mDimInGammaSpaceForEnhancedScreenshots = false; // Allows to ignore physical orientation provided through hwc API in favour of // 'ro.surface_flinger.primary_display_orientation'. // TODO(b/246793311): Clean up a temporary property Loading