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

Commit 1efef7b1 authored by John Reck's avatar John Reck
Browse files

Allow passing --renderer=skiavk to hwuiunit

Enables easier testing of skiavk with hwuiunit

Test: hwuiunit --renderer=skiavk
Change-Id: I02376e5fa1c4f0e8ca285caf82671f95eeac0677
parent bb9ee079
Loading
Loading
Loading
Loading
+5 −27
Original line number Diff line number Diff line
@@ -61,18 +61,10 @@ namespace uirenderer {
        ADD_FAILURE() << "ClipState not a rect";                                     \
    }

#define INNER_PIPELINE_TEST(test_case_name, test_name, pipeline, functionCall) \
    TEST(test_case_name, test_name##_##pipeline) {                             \
        RenderPipelineType oldType = Properties::getRenderPipelineType();      \
        Properties::overrideRenderPipelineType(RenderPipelineType::pipeline);  \
        functionCall;                                                          \
        Properties::overrideRenderPipelineType(oldType);                       \
    };

#define INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, pipeline) \
    INNER_PIPELINE_TEST(test_case_name, test_name, pipeline,                  \
                        TestUtils::runOnRenderThread(                         \
                                test_case_name##_##test_name##_RenderThreadTest::doTheThing))
#define INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name)                                \
    TEST(test_case_name, test_name) {                                                              \
        TestUtils::runOnRenderThread(test_case_name##_##test_name##_RenderThreadTest::doTheThing); \
    }

/**
 * Like gtest's TEST, but runs on the RenderThread, and 'renderThread' is passed, in top level scope
@@ -83,21 +75,7 @@ namespace uirenderer {
    public:                                                                                 \
        static void doTheThing(renderthread::RenderThread& renderThread);                   \
    };                                                                                      \
    INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, SkiaGL);                    \
    /* Temporarily disabling Vulkan until we can figure out a way to stub out the driver */ \
    /* INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, SkiaVulkan); */          \
    void test_case_name##_##test_name##_RenderThreadTest::doTheThing(                       \
            renderthread::RenderThread& renderThread)

/**
 * Like RENDERTHREAD_TEST, but only runs with the Skia RenderPipelineTypes
 */
#define RENDERTHREAD_SKIA_PIPELINE_TEST(test_case_name, test_name)                          \
    class test_case_name##_##test_name##_RenderThreadTest {                                 \
    public:                                                                                 \
        static void doTheThing(renderthread::RenderThread& renderThread);                   \
    };                                                                                      \
    INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, SkiaGL);                    \
    INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name);                            \
    /* Temporarily disabling Vulkan until we can figure out a way to stub out the driver */ \
    /* INNER_PIPELINE_RENDERTHREAD_TEST(test_case_name, test_name, SkiaVulkan); */          \
    void test_case_name##_##test_name##_RenderThreadTest::doTheThing(                       \
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ static size_t getCacheUsage(GrDirectContext* grContext) {
}

// TOOD(258700630): fix this test and re-enable
RENDERTHREAD_SKIA_PIPELINE_TEST(CacheManager, DISABLED_trimMemory) {
RENDERTHREAD_TEST(CacheManager, DISABLED_trimMemory) {
    int32_t width = DeviceInfo::get()->getWidth();
    int32_t height = DeviceInfo::get()->getHeight();
    GrDirectContext* grContext = renderThread.getGrContext();
+4 −4
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ RENDERTHREAD_TEST(RenderNodeDrawable, projectionReorder) {
    EXPECT_EQ(3, canvas.getIndex());
}

RENDERTHREAD_SKIA_PIPELINE_TEST(RenderNodeDrawable, emptyReceiver) {
RENDERTHREAD_TEST(RenderNodeDrawable, emptyReceiver) {
    class ProjectionTestCanvas : public SkCanvas {
    public:
        ProjectionTestCanvas(int width, int height) : SkCanvas(width, height) {}
@@ -419,7 +419,7 @@ RENDERTHREAD_SKIA_PIPELINE_TEST(RenderNodeDrawable, emptyReceiver) {
    EXPECT_EQ(2, canvas.getDrawCounter());
}

RENDERTHREAD_SKIA_PIPELINE_TEST(RenderNodeDrawable, projectionHwLayer) {
RENDERTHREAD_TEST(RenderNodeDrawable, projectionHwLayer) {
    /* R is backward projected on B and C is a layer.
                A
               / \
@@ -1052,7 +1052,7 @@ TEST(RenderNodeDrawable, renderNode) {
}

// Verify that layers are composed with linear filtering.
RENDERTHREAD_SKIA_PIPELINE_TEST(RenderNodeDrawable, layerComposeQuality) {
RENDERTHREAD_TEST(RenderNodeDrawable, layerComposeQuality) {
    static const int CANVAS_WIDTH = 1;
    static const int CANVAS_HEIGHT = 1;
    static const int LAYER_WIDTH = 1;
@@ -1170,7 +1170,7 @@ TEST(ReorderBarrierDrawable, testShadowMatrix) {
}

// Draw a vector drawable twice but with different bounds and verify correct bounds are used.
RENDERTHREAD_SKIA_PIPELINE_TEST(SkiaRecordingCanvas, drawVectorDrawable) {
RENDERTHREAD_TEST(SkiaRecordingCanvas, drawVectorDrawable) {
    static const int CANVAS_WIDTH = 100;
    static const int CANVAS_HEIGHT = 200;
    class VectorDrawableTestCanvas : public TestCanvasBase {
+2 −2
Original line number Diff line number Diff line
@@ -370,9 +370,9 @@ TEST(ShaderCacheTest, testCacheValidation) {
}

using namespace android::uirenderer;
RENDERTHREAD_SKIA_PIPELINE_TEST(ShaderCacheTest, testOnVkFrameFlushed) {
RENDERTHREAD_TEST(ShaderCacheTest, testOnVkFrameFlushed) {
    if (Properties::getRenderPipelineType() != RenderPipelineType::SkiaVulkan) {
        // RENDERTHREAD_SKIA_PIPELINE_TEST declares both SkiaVK and SkiaGL variants.
        // RENDERTHREAD_TEST declares both SkiaVK and SkiaGL variants.
        GTEST_SKIP() << "This test is only applicable to RenderPipelineType::SkiaVulkan";
    }
    if (!folderExist(getExternalStorageFolder())) {
+2 −2
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ public:
    }
};

RENDERTHREAD_SKIA_PIPELINE_TEST(SkiaDisplayList, prepareListAndChildren) {
RENDERTHREAD_TEST(SkiaDisplayList, prepareListAndChildren) {
    auto rootNode = TestUtils::createNode(0, 0, 200, 400, nullptr);
    ContextFactory contextFactory;
    std::unique_ptr<CanvasContext> canvasContext(
@@ -195,7 +195,7 @@ RENDERTHREAD_SKIA_PIPELINE_TEST(SkiaDisplayList, prepareListAndChildren) {
    canvasContext->destroy();
}

RENDERTHREAD_SKIA_PIPELINE_TEST(SkiaDisplayList, prepareListAndChildren_vdOffscreen) {
RENDERTHREAD_TEST(SkiaDisplayList, prepareListAndChildren_vdOffscreen) {
    auto rootNode = TestUtils::createNode(0, 0, 200, 400, nullptr);
    ContextFactory contextFactory;
    std::unique_ptr<CanvasContext> canvasContext(
Loading