Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d67d63d authored by Melody Hsu's avatar Melody Hsu Committed by Android (Google) Code Review
Browse files

Merge "Update MultiDisplay_test for duplicate layerstacks" into main

parents c0f7b2f7 91574af1
Loading
Loading
Loading
Loading
+3 −28
Original line number Diff line number Diff line
@@ -125,39 +125,14 @@ TEST_F(MultiDisplayTest, RenderLayerInVirtualDisplay) {
}

TEST_F(MultiDisplayTest, RenderLayerInMirroredVirtualDisplay) {
    // Create a display and set its layer stack to the main display's layer stack so
    // the contents of the main display are mirrored on to the virtual display.

    // Assumption here is that the new mirrored display has the same layer stack rect as the
    // primary display that it is mirroring.
    createDisplay(mMainDisplayState.layerStackSpaceRect, ui::DEFAULT_LAYER_STACK);
    createColorLayer(ui::DEFAULT_LAYER_STACK);

    sp<SurfaceControl> mirrorSc =
            SurfaceComposerClient::getDefault()->mirrorDisplay(mMainDisplayId);

    asTransaction([&](Transaction& t) { t.setPosition(mColorLayer, 10, 10); });

    // Verify color layer renders correctly on main display and it is mirrored on the
    // virtual display.
    std::unique_ptr<ScreenCapture> sc;
    ScreenCapture::captureScreen(&sc, mMainDisplay);
    sc->expectColor(Rect(10, 10, 40, 50), mExpectedColor);
    sc->expectColor(Rect(0, 0, 9, 9), {0, 0, 0, 255});

    ScreenCapture::captureScreen(&sc, mVirtualDisplay);
    sc->expectColor(Rect(10, 10, 40, 50), mExpectedColor);
    sc->expectColor(Rect(0, 0, 9, 9), {0, 0, 0, 255});
}

TEST_F(MultiDisplayTest, RenderLayerWithPromisedFenceInMirroredVirtualDisplay) {
    // Create a display and use a unique layerstack ID for mirrorDisplay() so
    // the contents of the main display are mirrored on to the virtual display.

    // A unique layerstack ID must be used because sharing the same layerFE
    // with more than one display is unsupported. A unique layerstack ensures
    // that a different layerFE is used between displays.
    constexpr ui::LayerStack layerStack{77687666}; // ASCII for MDLB (MultiDisplayLayerBounds)
    // that a different layerFE is used between displays. Each layerFE has a
    // promised fence that is each fulfilled.
    constexpr ui::LayerStack layerStack{776884}; // ASCII for MDT (MultiDisplayTest)
    createDisplay(mMainDisplayState.layerStackSpaceRect, layerStack);
    createColorLayer(ui::DEFAULT_LAYER_STACK);