tests: Only wait for frame callback when necessary

Some tests don't need to wait for the frame callback when a surface is
moved. This commit renames the move_client() helper function to
move_client_frame_sync() so that tests which need synchronisation must
explicitely request it. This allows to get 4 more tests using
repaint only on capture and to speed up runtime.

Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
Loïc Molinari 2024-02-22 14:01:29 +01:00 committed by Pekka Paalanen
parent 5791bdf6ec
commit 31a9a4831f
9 changed files with 17 additions and 9 deletions

View File

@ -71,7 +71,6 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg)
setup.width = BLOCK_WIDTH * ALPHA_STEPS; setup.width = BLOCK_WIDTH * ALPHA_STEPS;
setup.height = 16; setup.height = 16;
setup.shell = SHELL_TEST_DESKTOP; setup.shell = SHELL_TEST_DESKTOP;
setup.refresh = HIGHEST_OUTPUT_REFRESH;
if (arg->color_management) { if (arg->color_management) {
#if !BUILD_COLOR_LCMS #if !BUILD_COLOR_LCMS

View File

@ -80,7 +80,6 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg)
setup.scale = arg->scale; setup.scale = arg->scale;
setup.transform = arg->transform; setup.transform = arg->transform;
setup.shell = SHELL_TEST_DESKTOP; setup.shell = SHELL_TEST_DESKTOP;
setup.refresh = HIGHEST_OUTPUT_REFRESH;
return weston_test_harness_execute_as_client(harness, &setup); return weston_test_harness_execute_as_client(harness, &setup);
} }

View File

@ -214,7 +214,7 @@ TEST(output_damage)
} }
client->surface->buffer = buf[0]; client->surface->buffer = buf[0];
move_client(client, 19, 19); move_client_frame_sync(client, 19, 19);
/* /*
* Each time we commit a buffer with a different color, the damage box * Each time we commit a buffer with a different color, the damage box

View File

@ -92,7 +92,6 @@ fixture_setup(struct weston_test_harness *harness, const struct setup_args *arg)
setup.scale = arg->scale; setup.scale = arg->scale;
setup.transform = arg->transform; setup.transform = arg->transform;
setup.shell = SHELL_TEST_DESKTOP; setup.shell = SHELL_TEST_DESKTOP;
setup.refresh = HIGHEST_OUTPUT_REFRESH;
return weston_test_harness_execute_as_client(harness, &setup); return weston_test_harness_execute_as_client(harness, &setup);
} }

View File

@ -142,7 +142,7 @@ TEST(pointer_cursor_retains_committed_buffer_after_reenter)
client->surface = main_surface; client->surface = main_surface;
client->surface->buffer = create_shm_buffer_a8r8g8b8(client, 100, 100); client->surface->buffer = create_shm_buffer_a8r8g8b8(client, 100, 100);
fill_image_with_color(client->surface->buffer->image, &red); fill_image_with_color(client->surface->buffer->image, &red);
move_client(client, 50, 50); move_client_frame_sync(client, 50, 50);
/* Move the pointer into the main surface. */ /* Move the pointer into the main surface. */
send_motion(client, &t1, 100, 100); send_motion(client, &t1, 100, 100);

View File

@ -363,7 +363,7 @@ TEST(test_pointer_surface_move)
check_pointer_move(client, 50, 50); check_pointer_move(client, 50, 50);
/* move client center to pointer */ /* move client center to pointer */
move_client(client, 0, 0); move_client_frame_sync(client, 0, 0);
assert(surface_contains(client->surface, 50, 50)); assert(surface_contains(client->surface, 50, 50));
check_pointer(client, 50, 50); check_pointer(client, 50, 50);

View File

@ -58,7 +58,6 @@ fixture_setup(struct weston_test_harness *harness,
compositor_setup_defaults(&setup); compositor_setup_defaults(&setup);
setup.renderer = arg->renderer; setup.renderer = arg->renderer;
setup.shell = SHELL_TEST_DESKTOP; setup.shell = SHELL_TEST_DESKTOP;
setup.refresh = HIGHEST_OUTPUT_REFRESH;
return weston_test_harness_execute_as_client(harness, &setup); return weston_test_harness_execute_as_client(harness, &setup);
} }

View File

@ -119,7 +119,7 @@ move_client_internal(struct client *client, int x, int y)
} }
void void
move_client(struct client *client, int x, int y) move_client_frame_sync(struct client *client, int x, int y)
{ {
struct surface *surface = client->surface; struct surface *surface = client->surface;
int done; int done;
@ -130,6 +130,15 @@ move_client(struct client *client, int x, int y)
frame_callback_wait(client, &done); frame_callback_wait(client, &done);
} }
void
move_client(struct client *client, int x, int y)
{
struct surface *surface = client->surface;
move_client_internal(client, x, y);
wl_surface_commit(surface->wl_surface);
}
void void
move_client_offscreenable(struct client *client, int x, int y) move_client_offscreenable(struct client *client, int x, int y)
{ {
@ -1108,7 +1117,7 @@ create_client_and_test_surface(int x, int y, int width, int height)
width, height); width, height);
pixman_image_unref(solid); pixman_image_unref(solid);
move_client(client, x, y); move_client_frame_sync(client, x, y);
return client; return client;
} }

View File

@ -230,6 +230,9 @@ surface_contains(struct surface *surface, int x, int y);
void void
move_client(struct client *client, int x, int y); move_client(struct client *client, int x, int y);
void
move_client_frame_sync(struct client *client, int x, int y);
void void
move_client_offscreenable(struct client *client, int x, int y); move_client_offscreenable(struct client *client, int x, int y);