Loading libs/gui/tests/EndToEndNativeInputTest.cpp +30 −2 Original line number Diff line number Diff line Loading @@ -546,7 +546,10 @@ TEST_F(InputSurfacesTest, input_respects_scaled_surface_insets) { } TEST_F(InputSurfacesTest, input_respects_scaled_surface_insets_overflow) { std::unique_ptr<InputSurface> bgSurface = makeSurface(100, 100); std::unique_ptr<InputSurface> fgSurface = makeSurface(100, 100); bgSurface->showAt(100, 100); // In case we pass the very big inset without any checking. fgSurface->mInputInfo.surfaceInset = INT32_MAX; fgSurface->showAt(100, 100); Loading @@ -554,8 +557,8 @@ TEST_F(InputSurfacesTest, input_respects_scaled_surface_insets_overflow) { fgSurface->doTransaction([&](auto &t, auto &sc) { t.setMatrix(sc, 2.0, 0, 0, 2.0); }); // expect no crash for overflow, and inset size to be clamped to surface size injectTap(202, 202); fgSurface->expectTap(1, 1); injectTap(112, 124); bgSurface->expectTap(12, 24); } // Ensure we ignore transparent region when getting screen bounds when positioning input frame. Loading Loading @@ -987,6 +990,31 @@ TEST_F(InputSurfacesTest, drop_input_policy) { EXPECT_EQ(surface->consumeEvent(100), nullptr); } TEST_F(InputSurfacesTest, layer_with_empty_crop_cannot_be_focused) { std::unique_ptr<InputSurface> bufferSurface = InputSurface::makeBufferInputSurface(mComposerClient, 100, 100); bufferSurface->showAt(50, 50, Rect::EMPTY_RECT); bufferSurface->requestFocus(); EXPECT_EQ(bufferSurface->consumeEvent(100), nullptr); bufferSurface->showAt(50, 50, Rect::INVALID_RECT); bufferSurface->requestFocus(); EXPECT_EQ(bufferSurface->consumeEvent(100), nullptr); } TEST_F(InputSurfacesTest, layer_with_valid_crop_can_be_focused) { std::unique_ptr<InputSurface> bufferSurface = InputSurface::makeBufferInputSurface(mComposerClient, 100, 100); bufferSurface->showAt(50, 50, Rect{0, 0, 100, 100}); bufferSurface->requestFocus(); bufferSurface->assertFocusChange(true); } /** * If a cropped layer's touchable region is replaced with a null crop, it should receive input in * its own crop. Loading libs/ui/Fence.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -132,9 +132,13 @@ nsecs_t Fence::getSignalTime() const { ALOGE("sync_file_info returned NULL for fd %d", mFenceFd.get()); return SIGNAL_TIME_INVALID; } if (finfo->status != 1) { const auto status = finfo->status; ALOGE_IF(status < 0, "%s: sync_file_info contains an error: <%d> for fd: <%d>", __func__, status, mFenceFd.get()); sync_file_info_free(finfo); return SIGNAL_TIME_PENDING; return status < 0 ? SIGNAL_TIME_INVALID : SIGNAL_TIME_PENDING; } uint64_t timestamp = 0; Loading libs/ui/Gralloc4.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -98,9 +98,6 @@ static inline IMapper::Rect sGralloc4Rect(const Rect& rect) { static bool hasIAllocatorAidl() { // Avoid re-querying repeatedly for this information; static bool sHasIAllocatorAidl = []() -> bool { // TODO: Enable after landing sepolicy changes if constexpr ((true)) return false; if (__builtin_available(android 31, *)) { return AServiceManager_isDeclared(kAidlAllocatorServiceName.c_str()); } Loading services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayerCompositionState.h +4 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,10 @@ struct OutputLayerCompositionState { // The dataspace for this layer ui::Dataspace dataspace{ui::Dataspace::UNKNOWN}; // A hint to the HWC that this region is transparent and may be skipped in // order to save power. Region outputSpaceBlockingRegionHint; // Overrides the buffer, acquire fence, and display frame stored in LayerFECompositionState struct { std::shared_ptr<renderengine::ExternalTexture> buffer = nullptr; Loading services/surfaceflinger/CompositionEngine/src/Output.cpp +17 −5 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ #include "TracedOrdinal.h" using aidl::android::hardware::graphics::composer3::Composition; namespace android::compositionengine { Output::~Output() = default; Loading Loading @@ -529,11 +531,18 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, /* * transparentRegion: area of a surface that is hinted to be completely * transparent. This is only used to tell when the layer has no visible non- * transparent regions and can be removed from the layer list. It does not * affect the visibleRegion of this layer or any layers beneath it. The hint * may not be correct if apps don't respect the SurfaceView restrictions * (which, sadly, some don't). * transparent. * This is used to tell when the layer has no visible non-transparent * regions and can be removed from the layer list. It does not affect the * visibleRegion of this layer or any layers beneath it. The hint may not * be correct if apps don't respect the SurfaceView restrictions (which, * sadly, some don't). * * In addition, it is used on DISPLAY_DECORATION layers to specify the * blockingRegion, allowing the DPU to skip it to save power. Once we have * hardware that supports a blockingRegion on frames with AFBC, it may be * useful to use this for other layers, too, so long as we can prevent * regressions on b/7179570. */ Region transparentRegion; Loading Loading @@ -674,6 +683,9 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, outputLayerState.outputSpaceVisibleRegion = outputState.transform.transform( visibleNonShadowRegion.intersect(outputState.layerStackSpace.getContent())); outputLayerState.shadowRegion = shadowRegion; outputLayerState.outputSpaceBlockingRegionHint = layerFEState->compositionType == Composition::DISPLAY_DECORATION ? transparentRegion : Region(); } void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&) { Loading Loading
libs/gui/tests/EndToEndNativeInputTest.cpp +30 −2 Original line number Diff line number Diff line Loading @@ -546,7 +546,10 @@ TEST_F(InputSurfacesTest, input_respects_scaled_surface_insets) { } TEST_F(InputSurfacesTest, input_respects_scaled_surface_insets_overflow) { std::unique_ptr<InputSurface> bgSurface = makeSurface(100, 100); std::unique_ptr<InputSurface> fgSurface = makeSurface(100, 100); bgSurface->showAt(100, 100); // In case we pass the very big inset without any checking. fgSurface->mInputInfo.surfaceInset = INT32_MAX; fgSurface->showAt(100, 100); Loading @@ -554,8 +557,8 @@ TEST_F(InputSurfacesTest, input_respects_scaled_surface_insets_overflow) { fgSurface->doTransaction([&](auto &t, auto &sc) { t.setMatrix(sc, 2.0, 0, 0, 2.0); }); // expect no crash for overflow, and inset size to be clamped to surface size injectTap(202, 202); fgSurface->expectTap(1, 1); injectTap(112, 124); bgSurface->expectTap(12, 24); } // Ensure we ignore transparent region when getting screen bounds when positioning input frame. Loading Loading @@ -987,6 +990,31 @@ TEST_F(InputSurfacesTest, drop_input_policy) { EXPECT_EQ(surface->consumeEvent(100), nullptr); } TEST_F(InputSurfacesTest, layer_with_empty_crop_cannot_be_focused) { std::unique_ptr<InputSurface> bufferSurface = InputSurface::makeBufferInputSurface(mComposerClient, 100, 100); bufferSurface->showAt(50, 50, Rect::EMPTY_RECT); bufferSurface->requestFocus(); EXPECT_EQ(bufferSurface->consumeEvent(100), nullptr); bufferSurface->showAt(50, 50, Rect::INVALID_RECT); bufferSurface->requestFocus(); EXPECT_EQ(bufferSurface->consumeEvent(100), nullptr); } TEST_F(InputSurfacesTest, layer_with_valid_crop_can_be_focused) { std::unique_ptr<InputSurface> bufferSurface = InputSurface::makeBufferInputSurface(mComposerClient, 100, 100); bufferSurface->showAt(50, 50, Rect{0, 0, 100, 100}); bufferSurface->requestFocus(); bufferSurface->assertFocusChange(true); } /** * If a cropped layer's touchable region is replaced with a null crop, it should receive input in * its own crop. Loading
libs/ui/Fence.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -132,9 +132,13 @@ nsecs_t Fence::getSignalTime() const { ALOGE("sync_file_info returned NULL for fd %d", mFenceFd.get()); return SIGNAL_TIME_INVALID; } if (finfo->status != 1) { const auto status = finfo->status; ALOGE_IF(status < 0, "%s: sync_file_info contains an error: <%d> for fd: <%d>", __func__, status, mFenceFd.get()); sync_file_info_free(finfo); return SIGNAL_TIME_PENDING; return status < 0 ? SIGNAL_TIME_INVALID : SIGNAL_TIME_PENDING; } uint64_t timestamp = 0; Loading
libs/ui/Gralloc4.cpp +0 −3 Original line number Diff line number Diff line Loading @@ -98,9 +98,6 @@ static inline IMapper::Rect sGralloc4Rect(const Rect& rect) { static bool hasIAllocatorAidl() { // Avoid re-querying repeatedly for this information; static bool sHasIAllocatorAidl = []() -> bool { // TODO: Enable after landing sepolicy changes if constexpr ((true)) return false; if (__builtin_available(android 31, *)) { return AServiceManager_isDeclared(kAidlAllocatorServiceName.c_str()); } Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayerCompositionState.h +4 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,10 @@ struct OutputLayerCompositionState { // The dataspace for this layer ui::Dataspace dataspace{ui::Dataspace::UNKNOWN}; // A hint to the HWC that this region is transparent and may be skipped in // order to save power. Region outputSpaceBlockingRegionHint; // Overrides the buffer, acquire fence, and display frame stored in LayerFECompositionState struct { std::shared_ptr<renderengine::ExternalTexture> buffer = nullptr; Loading
services/surfaceflinger/CompositionEngine/src/Output.cpp +17 −5 Original line number Diff line number Diff line Loading @@ -50,6 +50,8 @@ #include "TracedOrdinal.h" using aidl::android::hardware::graphics::composer3::Composition; namespace android::compositionengine { Output::~Output() = default; Loading Loading @@ -529,11 +531,18 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, /* * transparentRegion: area of a surface that is hinted to be completely * transparent. This is only used to tell when the layer has no visible non- * transparent regions and can be removed from the layer list. It does not * affect the visibleRegion of this layer or any layers beneath it. The hint * may not be correct if apps don't respect the SurfaceView restrictions * (which, sadly, some don't). * transparent. * This is used to tell when the layer has no visible non-transparent * regions and can be removed from the layer list. It does not affect the * visibleRegion of this layer or any layers beneath it. The hint may not * be correct if apps don't respect the SurfaceView restrictions (which, * sadly, some don't). * * In addition, it is used on DISPLAY_DECORATION layers to specify the * blockingRegion, allowing the DPU to skip it to save power. Once we have * hardware that supports a blockingRegion on frames with AFBC, it may be * useful to use this for other layers, too, so long as we can prevent * regressions on b/7179570. */ Region transparentRegion; Loading Loading @@ -674,6 +683,9 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, outputLayerState.outputSpaceVisibleRegion = outputState.transform.transform( visibleNonShadowRegion.intersect(outputState.layerStackSpace.getContent())); outputLayerState.shadowRegion = shadowRegion; outputLayerState.outputSpaceBlockingRegionHint = layerFEState->compositionType == Composition::DISPLAY_DECORATION ? transparentRegion : Region(); } void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&) { Loading