tests: client-helper: Make client_capture_output() take a client_buffer_type

Using the newly introduced create_buffer(), to which the buffer type is
passed on in order to allow taking writeback screenshots with dmabufs.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
This commit is contained in:
Robert Mader 2025-09-26 11:11:48 +02:00
parent 23f396aa30
commit 203dbd3393
5 changed files with 16 additions and 9 deletions

View file

@ -767,7 +767,8 @@ TEST(output_icc_decorations)
client = create_client();
shot = client_capture_output(client, client->output,
WESTON_CAPTURE_V1_SOURCE_FULL_FRAMEBUFFER);
WESTON_CAPTURE_V1_SOURCE_FULL_FRAMEBUFFER,
CLIENT_BUFFER_TYPE_SHM);
img = image_convert_to_a8r8g8b8(shot->image);
match = verify_image(img, "output-icc-decorations",

View file

@ -115,7 +115,8 @@ TEST(drm_writeback_screenshot) {
/* take screenshot */
testlog("Taking a screenshot\n");
screenshot = client_capture_output(client, client->output,
WESTON_CAPTURE_V1_SOURCE_WRITEBACK);
WESTON_CAPTURE_V1_SOURCE_WRITEBACK,
CLIENT_BUFFER_TYPE_SHM);
test_assert_ptr_not_null(screenshot);
buffer_destroy(screenshot);
@ -133,7 +134,8 @@ TEST(drm_writeback_screenshot) {
* writeback state machine is working correctly */
testlog("Taking another screenshot\n");
second_screenshot = client_capture_output(client, client->output,
WESTON_CAPTURE_V1_SOURCE_WRITEBACK);
WESTON_CAPTURE_V1_SOURCE_WRITEBACK,
CLIENT_BUFFER_TYPE_SHM);
test_assert_ptr_not_null(screenshot);
/* load reference image */

View file

@ -89,7 +89,8 @@ TEST(output_decorations)
client = create_client();
shot = client_capture_output(client, client->output,
WESTON_CAPTURE_V1_SOURCE_FULL_FRAMEBUFFER);
WESTON_CAPTURE_V1_SOURCE_FULL_FRAMEBUFFER,
CLIENT_BUFFER_TYPE_SHM);
img = image_convert_to_a8r8g8b8(shot->image);
match = verify_image(img, "output-decorations", 0, NULL, 0);

View file

@ -1920,7 +1920,8 @@ static const struct weston_capture_source_v1_listener output_capturer_source_han
struct buffer *
client_capture_output(struct client *client,
struct output *output,
enum weston_capture_v1_source src)
enum weston_capture_v1_source src,
enum client_buffer_type buffer_type)
{
struct output_capturer capt = {};
struct buffer *buf;
@ -1943,8 +1944,8 @@ client_capture_output(struct client *client,
capt.formats_done &&
"capture source not available");
buf = create_shm_buffer(client,
capt.width, capt.height, capt.drm_format);
buf = create_buffer(client, capt.width, capt.height, capt.drm_format,
buffer_type);
weston_capture_source_v1_capture(capt.source, buf->proxy);
while (!capt.complete)
@ -1998,7 +1999,8 @@ capture_screenshot_of_output(struct client *client, const char *output_name)
}
shm = client_capture_output(client, output,
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER);
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER,
CLIENT_BUFFER_TYPE_SHM);
ih = image_header_from(shm->image);
if (ih.pixman_format == PIXMAN_a8r8g8b8)

View file

@ -311,7 +311,8 @@ capture_screenshot_of_output(struct client *client, const char *output_name);
struct buffer *
client_capture_output(struct client *client,
struct output *output,
enum weston_capture_v1_source src);
enum weston_capture_v1_source src,
enum client_buffer_type buffer_type);
pixman_image_t *
image_convert_to_a8r8g8b8(pixman_image_t *image);