tests: Add support for Vulkan renderer

Add support for Vulkan renderer in most places where there was
support for GL renderer.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
This commit is contained in:
Erico Nunes 2025-03-27 17:30:43 +01:00 committed by Daniel Stone
parent 8f56d03d4b
commit ec52e0cdda
11 changed files with 80 additions and 12 deletions

View file

@ -60,6 +60,11 @@ static const struct setup_args my_setup_args[] = {
.color_management = true, .color_management = true,
.meta.name = "GL sRGB EOTF" .meta.name = "GL sRGB EOTF"
}, },
{
.renderer = WESTON_RENDERER_VULKAN,
.color_management = false,
.meta.name = "Vulkan"
},
}; };
static enum test_result_code static enum test_result_code

View file

@ -48,6 +48,13 @@
.transform = WL_OUTPUT_TRANSFORM_ ## t, \ .transform = WL_OUTPUT_TRANSFORM_ ## t, \
.transform_name = #t, \ .transform_name = #t, \
.meta.name = "GL " #s " " #t, \ .meta.name = "GL " #s " " #t, \
}, \
{ \
.renderer = WESTON_RENDERER_VULKAN, \
.scale = s, \
.transform = WL_OUTPUT_TRANSFORM_ ## t, \
.transform_name = #t, \
.meta.name = "Vulkan " #s " " #t, \
} }
struct setup_args { struct setup_args {

View file

@ -107,6 +107,16 @@ static const uint32_t gl_dmabuf_format_must_pass[] = {
DRM_FORMAT_P016, DRM_FORMAT_P016,
}; };
static const uint32_t vulkan_shm_format_must_pass[] = {
DRM_FORMAT_ARGB8888,
DRM_FORMAT_XRGB8888
};
static const uint32_t vulkan_dmabuf_format_must_pass[] = {
DRM_FORMAT_ARGB8888,
DRM_FORMAT_XRGB8888
};
static const struct setup_args my_setup_args[] = { static const struct setup_args my_setup_args[] = {
{ {
.meta.name = "GL", .meta.name = "GL",
@ -124,6 +134,15 @@ static const struct setup_args my_setup_args[] = {
.dmabuf_format_num = ARRAY_LENGTH(gl_dmabuf_format_must_pass), .dmabuf_format_num = ARRAY_LENGTH(gl_dmabuf_format_must_pass),
.gl_force_import_yuv_fallback = true, .gl_force_import_yuv_fallback = true,
}, },
{
.renderer = WESTON_RENDERER_VULKAN,
.logging_scopes = "log",
.meta.name = "Vulkan",
.shm_format_must_pass = vulkan_shm_format_must_pass,
.shm_format_num = ARRAY_LENGTH(vulkan_shm_format_must_pass),
.dmabuf_format_must_pass = vulkan_dmabuf_format_must_pass,
.dmabuf_format_num = ARRAY_LENGTH(vulkan_dmabuf_format_must_pass),
},
}; };
static enum test_result_code static enum test_result_code

View file

@ -49,6 +49,11 @@ static const struct setup_args my_setup_args[] = {
.renderer = WESTON_RENDERER_GL, .renderer = WESTON_RENDERER_GL,
.expected_drm_format = DRM_FORMAT_ARGB8888, .expected_drm_format = DRM_FORMAT_ARGB8888,
}, },
{
.meta.name = "Vulkan",
.renderer = WESTON_RENDERER_VULKAN,
.expected_drm_format = DRM_FORMAT_ARGB8888,
},
}; };
static enum test_result_code static enum test_result_code

View file

@ -51,12 +51,12 @@
.meta.name = "GL no-shadow " #s " " #t, \ .meta.name = "GL no-shadow " #s " " #t, \
}, \ }, \
{ \ { \
.renderer = WESTON_RENDERER_GL, \ .renderer = WESTON_RENDERER_VULKAN, \
.scale = s, \ .scale = s, \
.transform = WL_OUTPUT_TRANSFORM_ ## t, \ .transform = WL_OUTPUT_TRANSFORM_ ## t, \
.transform_name = #t, \ .transform_name = #t, \
.gl_shadow_fb = true, \ .gl_shadow_fb = false, \
.meta.name = "GL shadow " #s " " #t, \ .meta.name = "Vulkan " #s " " #t, \
} }
struct setup_args { struct setup_args {
@ -112,9 +112,9 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg)
* Then the test checks that only the damage area gets the new color * Then the test checks that only the damage area gets the new color
* on screen. * on screen.
* *
* The following quirk forces GL-renderer to update the whole texture * The following quirk forces GL-renderer and Vulkan-renderer to update
* even for partial damage. Otherwise, GL-renderer would only copy the * the whole texture even for partial damage. Otherwise, they would
* damaged area from the wl_shm buffer into a GL texture. * only copy the damaged area from the wl_shm buffer into a texture.
* *
* Those output_damage tests where the surface is scaled up by the * Those output_damage tests where the surface is scaled up by the
* compositor will use bilinear texture sampling due to the policy * compositor will use bilinear texture sampling due to the policy
@ -122,12 +122,13 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg)
* *
* Pixman renderer never makes copies of wl_shm buffers, so bilinear * Pixman renderer never makes copies of wl_shm buffers, so bilinear
* sampling there will always produce the expected result. However, * sampling there will always produce the expected result. However,
* with GL-renderer if the texture is not updated beyond the strict * with GL-renderer and Vulkan-renderer if the texture is not updated
* damage region, bilinear sampling will result in a blend of the old * beyond the strict damage region, bilinear sampling will result in a
* and new colors at the edges of the damage rectangles. This blend * blend of the old and new colors at the edges of the damage
* would be detrimental to testing the damage regions and would cause * rectangles. This blend would be detrimental to testing the damage
* test failures due to reference image mismatch. What we actually * regions and would cause test failures due to reference image
* want to see is the crisp outline of the damage rectangles. * mismatch. What we actually want to see is the crisp outline of the
* damage rectangles.
*/ */
setup.test_quirks.force_full_upload = true; setup.test_quirks.force_full_upload = true;

View file

@ -39,6 +39,10 @@ static const struct setup_args my_setup_args[] = {
.meta.name = "GL", .meta.name = "GL",
.renderer = WESTON_RENDERER_GL, .renderer = WESTON_RENDERER_GL,
}, },
{
.renderer = WESTON_RENDERER_VULKAN,
.meta.name = "Vulkan",
},
}; };
static enum test_result_code static enum test_result_code

View file

@ -48,6 +48,13 @@
.transform = WL_OUTPUT_TRANSFORM_ ## t, \ .transform = WL_OUTPUT_TRANSFORM_ ## t, \
.transform_name = #t, \ .transform_name = #t, \
.meta.name = "GL " #s " " #t, \ .meta.name = "GL " #s " " #t, \
}, \
{ \
.renderer = WESTON_RENDERER_VULKAN, \
.scale = s, \
.transform = WL_OUTPUT_TRANSFORM_ ## t, \
.transform_name = #t, \
.meta.name = "Vulkan " #s " " #t, \
} }
struct setup_args { struct setup_args {

View file

@ -48,6 +48,10 @@ static const struct setup_args my_setup_args[] = {
.renderer = WESTON_RENDERER_GL, .renderer = WESTON_RENDERER_GL,
.meta.name = "GL" .meta.name = "GL"
}, },
{
.renderer = WESTON_RENDERER_VULKAN,
.meta.name = "Vulkan"
},
}; };
static enum test_result_code static enum test_result_code

View file

@ -48,6 +48,10 @@ static const struct setup_args my_setup_args[] = {
.renderer = WESTON_RENDERER_GL, .renderer = WESTON_RENDERER_GL,
.meta.name = "GL" .meta.name = "GL"
}, },
{
.renderer = WESTON_RENDERER_VULKAN,
.meta.name = "Vulkan"
},
}; };
static enum test_result_code static enum test_result_code

View file

@ -48,6 +48,10 @@ static const struct setup_args my_setup_args[] = {
.renderer = WESTON_RENDERER_GL, .renderer = WESTON_RENDERER_GL,
.meta.name = "GL" .meta.name = "GL"
}, },
{
.renderer = WESTON_RENDERER_VULKAN,
.meta.name = "Vulkan"
},
}; };
static enum test_result_code static enum test_result_code

View file

@ -227,6 +227,7 @@ renderer_to_str(enum weston_renderer_type t)
[WESTON_RENDERER_NOOP] = "noop", [WESTON_RENDERER_NOOP] = "noop",
[WESTON_RENDERER_PIXMAN] = "pixman", [WESTON_RENDERER_PIXMAN] = "pixman",
[WESTON_RENDERER_GL] = "gl", [WESTON_RENDERER_GL] = "gl",
[WESTON_RENDERER_VULKAN] = "vulkan",
}; };
test_assert_true(t >= 0 && t <= ARRAY_LENGTH(names)); test_assert_true(t >= 0 && t <= ARRAY_LENGTH(names));
return names[t]; return names[t];
@ -414,6 +415,13 @@ execute_compositor(const struct compositor_setup *setup,
} }
#endif #endif
#ifndef ENABLE_VULKAN
if (setup->renderer == WESTON_RENDERER_VULKAN) {
fprintf(stderr, "Vulkan renderer required but not built, skipping.\n");
ret = RESULT_SKIP;
}
#endif
test_data.test_quirks = setup->test_quirks; test_data.test_quirks = setup->test_quirks;
test_data.test_private_data = data; test_data.test_private_data = data;
prog_args_save(&args); prog_args_save(&args);