Skip to contentSkip to conversation

Add vmwgfx prime tests

PATCH Superseded Zack Rusin 3 participants 12 messages Jun 27, 2024 – Jun 28, 2024

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Zack Rusin

author
#0 lore raw

v2 cover Add vmwgfx prime tests

The following series makes some adjustments for testing prime/dma-buf on vmwgfx, adds a vmwgfx dedicated test for it and fixes some minor issues.

The last patch in the series adds very basic prime tests to dumb_buffer test to verify dumb_buffer<->prime functionality.

v2: Add a reference counting and dumb buffer tests plus fix issues spotted by Kamil

Maaz Mombasawala (1):
tests/vmwgfx: Removing incorrect assert in mob_repeated_unref

Zack Rusin (4):
lib/vmwgfx: Allow using any buffer handle as a surface backing tests/vmwgfx: Add a prime test
tests/vmwgfx: Fix and extend the reference counting test tests/dumb_buffer: Add subtests for mixing dumb buffers with prime

 lib/igt_vmwgfx.c                |  76 ++--
 lib/igt_vmwgfx.h                |  42 +--
 tests/dumb_buffer.c             |  96 +++++
 tests/vmwgfx/meson.build        |   7 +-
 tests/vmwgfx/vmw_mob_stress.c   |   5 +-
 tests/vmwgfx/vmw_prime.c        | 609 ++++++++++++++++++++++++++++++++
 tests/vmwgfx/vmw_ref_count.c    | 217 +++++++++---
 tests/vmwgfx/vmw_surface_copy.c |   8 +-
 tests/vmwgfx/vmw_tri.c          |  12 +-
 9 files changed, 945 insertions(+), 127 deletions(-)
 create mode 100644 tests/vmwgfx/vmw_prime.c
Signature · 1 line
2.40.1
author
#1 lore raw

PATCH v2 1/5 tests/vmwgfx: Removing incorrect assert in mob_repeated_unref

From: Maaz Mombasawala <[email protected]>

Remove an incorrect assert in test mob_repeated_unref that checked if return value from multiple unrefs of a mob was 0. This was a bug in the vmwgfx driver, since after the first unref it should return -EINVAL.
This bug was fixed with buffer rework in the vmwgfx driver and now the unref ioctl behaves the correct way.

---
 tests/vmwgfx/vmw_ref_count.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tests/vmwgfx/vmw_ref_count.c +2 -4
index da4b41f89..92d49dbd0 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR MIT
 /**********************************************************
- * Copyright 2021-2022 VMware, Inc.
+ * Copyright 2021-2023 VMware, Inc.
  *
  * Permission is hereby granted, free of charge, to any person
  * obtaining a copy of this software and associated documentation
@@ -256,13 +256,11 @@ igt_main
 
 		/* Shouldn't crash on multiple invocations */
 		for (i = 0; i < 3; i++) {
-			int ret;
 			struct drm_vmw_handle_close_arg arg = {
 				.handle = mob->handle
 			};
-			ret = drmCommandWrite(fd1, DRM_VMW_HANDLE_CLOSE, &arg,
+			drmCommandWrite(fd1, DRM_VMW_HANDLE_CLOSE, &arg,
 					      sizeof(arg));
-			igt_assert_eq(ret, 0);
 		}
 		free(mob);
 	}
Signature · 1 line
2.40.1
author
#2 lore raw

PATCH v2 2/5 lib/vmwgfx: Allow using any buffer handle as a surface backing

In reply to Zack Rusin

Allow using any buffer handle as a surface backing to allow testing prime/dma-buf imports. This will allow addition of vmwgfx specific drm prime tests.

The code always expected a mob structure created via the explicit alloc dmabuf ioctl which made using buffers created via dumb_buffer drm interface impossible.

---
 lib/igt_vmwgfx.c                | 33 ++++++++++++++++-----------------
 lib/igt_vmwgfx.h                | 12 ++++++++----
 tests/vmwgfx/vmw_mob_stress.c   |  5 ++++-
 tests/vmwgfx/vmw_ref_count.c    |  6 +++---
 tests/vmwgfx/vmw_surface_copy.c |  8 ++++----
 tests/vmwgfx/vmw_tri.c          | 12 ++++++++----
 6 files changed, 43 insertions(+), 33 deletions(-)
lib/igt_vmwgfx.c +16 -17
index 12b07b4a8..d2f699575 100644
@@ -427,7 +427,7 @@ struct vmw_surface *vmw_ioctl_buffer_create(int fd, SVGA3dSurfaceAllFlags flags,
 	SVGA3dSize surface_size = { .width = size, .height = 1, .depth = 1 };
 
 	return vmw_create_surface_simple(fd, flags, SVGA3D_BUFFER, surface_size,
-					 mob);
+					 mob->handle);
 }
 
 /**
@@ -454,7 +454,7 @@ struct vmw_surface *vmw_ioctl_create_surface_full(
 	uint32 multisample_count, SVGA3dMSPattern multisample_pattern,
 	SVGA3dMSQualityLevel quality_level, SVGA3dTextureFilter autogen_filter,
 	uint32 num_mip_levels, uint32 array_size, SVGA3dSize size,
-	struct vmw_mob *mob, enum drm_vmw_surface_flags surface_flags)
+	uint32 buffer_handle, enum drm_vmw_surface_flags surface_flags)
 {
 	struct vmw_surface *surface;
 	int32 ret;
@@ -470,10 +470,8 @@ struct vmw_surface *vmw_ioctl_create_surface_full(
 	arg.req.base.array_size = array_size;
 	arg.req.base.autogen_filter = autogen_filter;
 	arg.req.base.drm_surface_flags |= surface_flags;
-	if (mob) {
-		arg.req.base.buffer_handle = mob->handle;
-	} else {
-		arg.req.base.buffer_handle = SVGA3D_INVALID_ID;
+	arg.req.base.buffer_handle = buffer_handle;
+	if (buffer_handle != SVGA3D_INVALID_ID) {
 		arg.req.base.drm_surface_flags |=
 			drm_vmw_surface_flag_create_buffer;
 	}
@@ -499,7 +497,6 @@ struct vmw_surface *vmw_ioctl_create_surface_full(
 	}
 
 	surface->base = arg.rep;
-	surface->mob = mob;
 	return surface;
 
 out_err1:
@@ -511,7 +508,7 @@ struct vmw_surface *vmw_create_surface_simple(int fd,
 					      SVGA3dSurfaceAllFlags flags,
 					      SVGA3dSurfaceFormat format,
 					      SVGA3dSize size,
-					      struct vmw_mob *mob)
+					      uint32 buffer_handle)
 {
 	/*
 	 * TODO:
@@ -531,7 +528,7 @@ struct vmw_surface *vmw_create_surface_simple(int fd,
 					     multisample_count,
 					     multisample_pattern, quality_level,
 					     SVGA3D_TEX_FILTER_NONE, 1,
-					     array_size, size, mob, 0);
+					     array_size, size, buffer_handle, 0);
 }
 
 /**
@@ -921,14 +918,14 @@ void vmw_create_default_objects(struct vmw_svga_device *device,
 		device->drm_fd,
 		SVGA3D_SURFACE_HINT_TEXTURE | SVGA3D_SURFACE_HINT_RENDERTARGET |
 			SVGA3D_SURFACE_BIND_RENDER_TARGET,
-		SVGA3D_R8G8B8A8_UNORM, *rt_size, NULL);
+		SVGA3D_R8G8B8A8_UNORM, *rt_size, SVGA3D_INVALID_ID);
 
 	objects->depth_rt = vmw_create_surface_simple(
 		device->drm_fd,
 		SVGA3D_SURFACE_HINT_DEPTHSTENCIL |
 			SVGA3D_SURFACE_HINT_RENDERTARGET |
 			SVGA3D_SURFACE_BIND_DEPTH_STENCIL,
-		SVGA3D_R24G8_TYPELESS, *rt_size, NULL);
+		SVGA3D_R24G8_TYPELESS, *rt_size, SVGA3D_INVALID_ID);
 
 	rtv_desc.tex.arraySize = 1;
 	rtv_desc.tex.firstArraySlice = 0;
@@ -1225,7 +1222,8 @@ void vmw_cmd_surface_copy(struct vmw_execbuf *cmd_buf, SVGA3dSurfaceImageId src,
 }
 
 uint8 *vmw_triangle_draw(struct vmw_svga_device *device, int32 cid,
-			 struct vmw_default_objects *objects, bool do_sync)
+			 struct vmw_default_objects *objects,
+			 uint32_t draw_flags)
 {
 	struct vmw_execbuf *cmd_buf;
 	struct drm_vmw_fence_rep cmd_fence;
@@ -1234,7 +1232,7 @@ uint8 *vmw_triangle_draw(struct vmw_svga_device *device, int32 cid,
 	SVGA3dVertexBuffer vb_binding;
 	SVGA3dRGBAFloat clear_color;
 	void *vertex_data;
-	uint8 *rendered_img;
+	uint8 *rendered_img = NULL;
 	struct vmw_vertex vertices[3] = {
 		{ 0.0, 0.75, 0.5, 1.0, 0.0, 1.0, 0.0, 1.0 },
 		{ 0.75, -0.75, 0.5, 1.0, 1.0, 0.0, 0.0, 1.0 },
@@ -1281,19 +1279,20 @@ uint8 *vmw_triangle_draw(struct vmw_svga_device *device, int32 cid,
 
 	/* Draw */
 	vmw_cmd_draw(cmd_buf, 3, 0);
-	vmw_cmd_draw(cmd_buf, 3, 0);
 
 	/* Readback */
-	vmw_cmd_readback_gb_surface(cmd_buf, objects->color_rt->base.handle);
+	if (draw_flags & vmw_triangle_draw_flags_readback)
+		vmw_cmd_readback_gb_surface(cmd_buf, objects->color_rt->base.handle);
 
 	/* Submit commands */
 	vmw_execbuf_submit(cmd_buf, &cmd_fence);
-	if (do_sync)
+	if (draw_flags & vmw_triangle_draw_flags_sync)
 		vmw_ioctl_fence_finish(device->drm_fd, &cmd_fence);
 	vmw_execbuf_destroy(cmd_buf);
 
 	/* Read framebuffer into system mem and save */
-	rendered_img = vmw_readback_surface(device->drm_fd, objects->color_rt);
+	if (draw_flags & vmw_triangle_draw_flags_readback)
+		rendered_img = vmw_readback_surface(device->drm_fd, objects->color_rt);
 
 	vmw_ioctl_surface_unref(device->drm_fd, vertex_buffer);
 	vmw_ioctl_mob_close_handle(device->drm_fd, vertex_mob);
lib/igt_vmwgfx.h +8 -4
index c8ed43bac..961aac389 100644
@@ -115,7 +115,6 @@ struct vmw_mob {
 struct vmw_surface {
 	struct drm_vmw_gb_surface_create_rep base;
 	struct drm_vmw_gb_surface_create_ext_req params;
-	struct vmw_mob *mob;
 };
 
 struct vmw_vertex {
@@ -194,13 +193,13 @@ struct vmw_surface *vmw_ioctl_create_surface_full(
 	uint32 multisample_count, SVGA3dMSPattern multisample_pattern,
 	SVGA3dMSQualityLevel quality_level, SVGA3dTextureFilter autogen_filter,
 	uint32 num_mip_levels, uint32 array_size, SVGA3dSize size,
-	struct vmw_mob *mob, enum drm_vmw_surface_flags surface_flags);
+	uint32 buffer_handle, enum drm_vmw_surface_flags surface_flags);
 
 struct vmw_surface *vmw_create_surface_simple(int fd,
 					      SVGA3dSurfaceAllFlags flags,
 					      SVGA3dSurfaceFormat format,
 					      SVGA3dSize size,
-					      struct vmw_mob *mob);
+					      uint32 buffer_handle);
 
 struct vmw_execbuf *vmw_execbuf_create(int drm_fd, int32_t cid);
 void vmw_execbuf_set_cid(struct vmw_execbuf *execbuf, int32_t cid);
@@ -261,8 +260,13 @@ void vmw_cmd_surface_copy(struct vmw_execbuf *cmd_buf, SVGA3dSurfaceImageId src,
 			  SVGA3dSurfaceImageId dest, const SVGA3dCopyBox *boxes,
 			  uint32 num_boxes);
 
+enum vmw_triangle_draw_flags {
+	vmw_triangle_draw_flags_none = 0,
+	vmw_triangle_draw_flags_sync = 1 << 0,
+	vmw_triangle_draw_flags_readback = 1 << 1,
+};
 uint8 *vmw_triangle_draw(struct vmw_svga_device *device, int32 cid,
-			 struct vmw_default_objects *objects, bool do_sync);
+			 struct vmw_default_objects *objects, uint32_t draw_flags);
 
 void vmw_triangle_assert_values(uint8 *rendered_img,
 				struct vmw_surface *color_rt);
tests/vmwgfx/vmw_mob_stress.c +4 -1
index 4af23d6f7..2e6a9422c 100644
@@ -35,7 +35,10 @@ static void test_triangle_render(struct vmw_svga_device *device, int32 cid)
 
 	vmw_create_default_objects(device, cid, &objects,
 				   &vmw_default_rect_size);
-	rendered_tri = vmw_triangle_draw(device, cid, &objects, true);
+	rendered_tri =
+		vmw_triangle_draw(device, cid, &objects,
+				  vmw_triangle_draw_flags_sync |
+				  vmw_triangle_draw_flags_readback);
 	vmw_triangle_assert_values(rendered_tri, objects.color_rt);
 
 	free(rendered_tri);
tests/vmwgfx/vmw_ref_count.c +3 -3
index 92d49dbd0..c765f2e70 100644
@@ -72,7 +72,7 @@ create_and_write_shareable_surface(int32 fd, SVGA3dSize surface_size)
 	surface = vmw_ioctl_create_surface_full(
 		fd, SVGA3D_SURFACE_HINT_RENDERTARGET, SVGA3D_BUFFER, 0,
 		SVGA3D_MS_PATTERN_NONE, SVGA3D_MS_QUALITY_NONE,
-		SVGA3D_TEX_FILTER_NONE, 1, 1, surface_size, NULL,
+		SVGA3D_TEX_FILTER_NONE, 1, 1, surface_size, SVGA3D_INVALID_ID,
 		drm_vmw_surface_flag_shareable);
 
 	mob.handle = surface->base.buffer_handle;
@@ -125,7 +125,7 @@ igt_main
 		surface = vmw_ioctl_create_surface_full(
 			fd1, SVGA3D_SURFACE_HINT_RENDERTARGET, SVGA3D_BUFFER, 0,
 			SVGA3D_MS_PATTERN_NONE, SVGA3D_MS_QUALITY_NONE,
-			SVGA3D_TEX_FILTER_NONE, 1, 1, surface_size, mob,
+			SVGA3D_TEX_FILTER_NONE, 1, 1, surface_size, mob->handle,
 			drm_vmw_surface_flag_shareable);
 
 		write_to_mob(fd1, mob);
@@ -274,7 +274,7 @@ igt_main
 		surface = vmw_ioctl_create_surface_full(
 			fd1, SVGA3D_SURFACE_HINT_RENDERTARGET, SVGA3D_BUFFER, 0,
 			SVGA3D_MS_PATTERN_NONE, SVGA3D_MS_QUALITY_NONE,
-			SVGA3D_TEX_FILTER_NONE, 1, 1, surface_size, NULL,
+			SVGA3D_TEX_FILTER_NONE, 1, 1, surface_size, SVGA3D_INVALID_ID,
 			drm_vmw_surface_flag_shareable);
 
 		/* Shouldn't crash on multiple invocations */
tests/vmwgfx/vmw_surface_copy.c +4 -4
index 57e90334f..471de54aa 100644
@@ -120,9 +120,9 @@ static void test_invalid_copies(int fd, int32 cid)
 		vmw_is_format_supported(fd, SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8));
 
 	s1 = vmw_create_surface_simple(fd, 0, SVGA3D_A8R8G8B8, surface_size,
-				       NULL);
+				       SVGA3D_INVALID_ID);
 	s2 = vmw_create_surface_simple(fd, 0, SVGA3D_A8R8G8B8, surface_size,
-				       NULL);
+				       SVGA3D_INVALID_ID);
 	cmd_buf = vmw_execbuf_create(fd, cid);
 
 	box.x = 0;
@@ -271,8 +271,8 @@ static void test_invalid_copies_3d(int fd, int32 cid)
 	igt_require(vmw_is_format_supported(fd, SVGA3D_DEVCAP_DXFMT_Z_D32));
 
 	s1 = vmw_create_surface_simple(fd, 0, SVGA3D_A8R8G8B8, surface_size,
-				       NULL);
-	s2 = vmw_create_surface_simple(fd, 0, SVGA3D_Z_D32, surface_size, NULL);
+				       SVGA3D_INVALID_ID);
+	s2 = vmw_create_surface_simple(fd, 0, SVGA3D_Z_D32, surface_size, SVGA3D_INVALID_ID);
 	cmd_buf = vmw_execbuf_create(fd, cid);
 
 	box.x = 0;
tests/vmwgfx/vmw_tri.c +8 -4
index f5a59229c..61c4d5df8 100644
@@ -36,7 +36,10 @@ static void draw_triangle(struct vmw_svga_device *device, int32 cid)
 
 	vmw_create_default_objects(device, cid, &objects,
 				   &vmw_default_rect_size);
-	rendered_img = vmw_triangle_draw(device, cid, &objects, true);
+	rendered_img =
+		vmw_triangle_draw(device, cid, &objects,
+				  vmw_triangle_draw_flags_sync |
+				  vmw_triangle_draw_flags_readback);
 
 	save_status = vmw_save_data_as_png(objects.color_rt, rendered_img,
 					   "vmw_tri.png");
@@ -65,7 +68,7 @@ static void replace_with_coherent_rt(struct vmw_svga_device *device,
 			SVGA3D_SURFACE_BIND_RENDER_TARGET,
 		SVGA3D_R8G8B8A8_UNORM, 0, SVGA3D_MS_PATTERN_NONE,
 		SVGA3D_MS_QUALITY_NONE, SVGA3D_TEX_FILTER_NONE, 1, 1, *rt_size,
-		NULL, drm_vmw_surface_flag_coherent);
+		SVGA3D_INVALID_ID, drm_vmw_surface_flag_coherent);
 
 	objects->depth_rt = vmw_ioctl_create_surface_full(
 		device->drm_fd,
@@ -74,7 +77,7 @@ static void replace_with_coherent_rt(struct vmw_svga_device *device,
 			SVGA3D_SURFACE_BIND_DEPTH_STENCIL,
 		SVGA3D_R24G8_TYPELESS, 0, SVGA3D_MS_PATTERN_NONE,
 		SVGA3D_MS_QUALITY_NONE, SVGA3D_TEX_FILTER_NONE, 1, 1, *rt_size,
-		NULL, drm_vmw_surface_flag_coherent);
+		SVGA3D_INVALID_ID, drm_vmw_surface_flag_coherent);
 
 	cmd_buf = vmw_execbuf_create(device->drm_fd, context_id);
 
@@ -160,7 +163,8 @@ static void draw_triangle_on_coherent_rt(struct vmw_svga_device *device,
 	default_ds_view_id = objects.ds_view_id;
 	replace_with_coherent_rt(device, cid, &objects, &vmw_default_rect_size);
 
-	rendered_img = vmw_triangle_draw(device, cid, &objects, false);
+	rendered_img = vmw_triangle_draw(device, cid, &objects,
+					 vmw_triangle_draw_flags_readback);
 
 	vmw_triangle_assert_values(rendered_img, objects.color_rt);
 
Signature · 1 line
2.40.1
author
#3 lore raw

PATCH v2 3/5 tests/vmwgfx: Add a prime test

In reply to Zack Rusin

Add a test that check for various dma-buf/prime related issues that might show up on vmwgfx.

---
 tests/vmwgfx/meson.build |   7 +-
 tests/vmwgfx/vmw_prime.c | 609 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 613 insertions(+), 3 deletions(-)
 create mode 100644 tests/vmwgfx/vmw_prime.c
tests/vmwgfx/meson.build +4 -3
index 073905f0a..28163d0f1 100644
@@ -1,10 +1,11 @@
 
 vmwgfx_progs = [
-	'vmw_tri',
 	'vmw_execution_buffer',
-	'vmw_surface_copy',
 	'vmw_mob_stress',
-	'vmw_ref_count'
+	'vmw_prime',
+	'vmw_ref_count',
+	'vmw_surface_copy',
+	'vmw_tri',
 ]
 vmwgfx_deps = test_deps
 
tests/vmwgfx/vmw_prime.c new file +609 -0

609 lines not on this page · raw message

Signature · 1 line
2.40.1
author
#4 lore raw

PATCH v2 4/5 tests/vmwgfx: Fix and extend the reference counting test

In reply to Zack Rusin

Fix a few issues related to buffer managment in the reference counting test. Extend it to include various prime related reference counting issues.

---
 lib/igt_vmwgfx.c             |  45 +++-----
 lib/igt_vmwgfx.h             |  30 +----
 tests/vmwgfx/vmw_ref_count.c | 207 +++++++++++++++++++++++++++++------
 3 files changed, 193 insertions(+), 89 deletions(-)
lib/igt_vmwgfx.c +15 -30
index d2f699575..b62d7a326 100644
@@ -1,28 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0 OR MIT
-/**********************************************************
- * Copyright 2021-2023 VMware, Inc.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
+/*
+ * Copyright (c) 2021-2024 Broadcom. All Rights Reserved. The term
+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
+ */
 
 #include "igt_vmwgfx.h"
 
@@ -154,6 +134,7 @@ bool vmw_save_data_as_png(struct vmw_surface *surface, void *data,
 	/* Can separate this into another function as it grows */
 	switch (surface->params.base.format) {
 	case SVGA3D_R8G8B8A8_UNORM:
+	case SVGA3D_B8G8R8X8_UNORM:
 		format = CAIRO_FORMAT_ARGB32;
 		break;
 	default:
@@ -345,11 +326,15 @@ void vmw_ioctl_mob_close_handle(int fd, struct vmw_mob *mob)
 	free(mob);
 }
 
-struct vmw_surface vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type)
+struct vmw_surface *vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type)
 {
 	int ret;
-	union drm_vmw_gb_surface_reference_ext_arg arg;
-	struct vmw_surface surface;
+	union drm_vmw_gb_surface_reference_ext_arg arg = {0};
+	struct vmw_surface *surface;
+
+	surface = calloc(1, sizeof(struct vmw_surface));
+	if (!surface)
+		return NULL;
 
 	arg.req.handle_type = handle_type;
 	arg.req.sid = sid;
@@ -359,8 +344,8 @@ struct vmw_surface vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type)
 	if (ret != 0)
 		fprintf(stderr, "%s Failed\n", __func__);
 
-	surface.base = arg.rep.crep;
-	surface.params = arg.rep.creq;
+	surface->base = arg.rep.crep;
+	surface->params = arg.rep.creq;
 	return surface;
 }
 
@@ -471,7 +456,7 @@ struct vmw_surface *vmw_ioctl_create_surface_full(
 	arg.req.base.autogen_filter = autogen_filter;
 	arg.req.base.drm_surface_flags |= surface_flags;
 	arg.req.base.buffer_handle = buffer_handle;
-	if (buffer_handle != SVGA3D_INVALID_ID) {
+	if (buffer_handle == SVGA3D_INVALID_ID) {
 		arg.req.base.drm_surface_flags |=
 			drm_vmw_surface_flag_create_buffer;
 	}
lib/igt_vmwgfx.h +5 -25
index 961aac389..e80e9848f 100644
@@ -1,28 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
-/**********************************************************
- * Copyright 2021-2023 VMware, Inc.
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
+/*
+ * Copyright (c) 2021-2024 Broadcom. All Rights Reserved. The term
+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
+ */
 
 #ifndef IGT_VMWGFX_H
 #define IGT_VMWGFX_H
@@ -186,7 +166,7 @@ struct vmw_surface *vmw_ioctl_buffer_create(int fd, SVGA3dSurfaceAllFlags flags,
 					    uint32_t size, struct vmw_mob *mob);
 void vmw_ioctl_surface_unref(int fd, struct vmw_surface *buffer);
 
-struct vmw_surface vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type);
+struct vmw_surface *vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type);
 
 struct vmw_surface *vmw_ioctl_create_surface_full(
 	int fd, SVGA3dSurfaceAllFlags flags, SVGA3dSurfaceFormat format,
tests/vmwgfx/vmw_ref_count.c +173 -34

254 lines not on this page · raw message

Signature · 1 line
2.40.1
#5 lore raw

Re: [PATCH i-g-t 4/5] tests/vmwgfx: Fix and extend the reference counting test

Hi Zack,

Quoted 3 lines · Zack Rusin

Fix a few issues related to buffer managment in the reference counting test. Extend it to include various prime related reference counting issues.

- ^^^^^^
imho better 'capabilities' or some other word.

Quoted 13 lines
---
 lib/igt_vmwgfx.c             |  45 +++-----
 lib/igt_vmwgfx.h             |  30 +----
 tests/vmwgfx/vmw_ref_count.c | 207 +++++++++++++++++++++++++++++------
 3 files changed, 193 insertions(+), 89 deletions(-)
lib/igt_vmwgfx.c +0 -0
index d2f699575..b62d7a326 100644

lib/igt_vmwgfx.c line 3

Quoted 3 lines
lib/igt_vmwgfx.c +0 -2
@@ -1,28 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0 OR MIT
-/**********************************************************
- * Copyright 2021-2023 VMware, Inc.

------------------------- ^^^^^^^^^^^^

Quoted 14 lines
lib/igt_vmwgfx.c +0 -14
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF

lib/igt_vmwgfx.c line 3

Quoted 10 lines
lib/igt_vmwgfx.c +2 -8
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
+/*
+ * Copyright (c) 2021-2024 Broadcom. All Rights Reserved. The term

----------------------------- ^^^^^^^^^

This is not the same. Btw why not:

* Copyright 2021-2023 VMware, Inc.
* Copyright 2024 Broadcom, Inc. and/or its subsidiaries.

But I am a little reluctant to see '... subsidiaries' as this adds some unknown numbers/names here?
+cc Petri

Quoted 57 lines
lib/igt_vmwgfx.c +13 -6
+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
+ */
 
 #include "igt_vmwgfx.h"
 
@@ -154,6 +134,7 @@ bool vmw_save_data_as_png(struct vmw_surface *surface, void *data,
 	/* Can separate this into another function as it grows */
 	switch (surface->params.base.format) {
 	case SVGA3D_R8G8B8A8_UNORM:
+	case SVGA3D_B8G8R8X8_UNORM:
 		format = CAIRO_FORMAT_ARGB32;
 		break;
 	default:
@@ -345,11 +326,15 @@ void vmw_ioctl_mob_close_handle(int fd, struct vmw_mob *mob)
 	free(mob);
 }
 
-struct vmw_surface vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type)
+struct vmw_surface *vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type)
 {
 	int ret;
-	union drm_vmw_gb_surface_reference_ext_arg arg;
-	struct vmw_surface surface;
+	union drm_vmw_gb_surface_reference_ext_arg arg = {0};
+	struct vmw_surface *surface;
+
+	surface = calloc(1, sizeof(struct vmw_surface));
+	if (!surface)
+		return NULL;
 
 	arg.req.handle_type = handle_type;
 	arg.req.sid = sid;
@@ -359,8 +344,8 @@ struct vmw_surface vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type)
 	if (ret != 0)
 		fprintf(stderr, "%s Failed\n", __func__);
 
-	surface.base = arg.rep.crep;
-	surface.params = arg.rep.creq;
+	surface->base = arg.rep.crep;
+	surface->params = arg.rep.creq;
 	return surface;
 }
 
@@ -471,7 +456,7 @@ struct vmw_surface *vmw_ioctl_create_surface_full(
 	arg.req.base.autogen_filter = autogen_filter;
 	arg.req.base.drm_surface_flags |= surface_flags;
 	arg.req.base.buffer_handle = buffer_handle;
-	if (buffer_handle != SVGA3D_INVALID_ID) {
+	if (buffer_handle == SVGA3D_INVALID_ID) {
 		arg.req.base.drm_surface_flags |=
 			drm_vmw_surface_flag_create_buffer;
 	}
lib/igt_vmwgfx.h +0 -0
index 961aac389..e80e9848f 100644

lib/igt_vmwgfx.h line 3

Quoted 3 lines
lib/igt_vmwgfx.h +0 -2
@@ -1,28 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
-/**********************************************************
- * Copyright 2021-2023 VMware, Inc.

------------------------- ^
Same here, you replaced VMware with Broadcom.

Quoted 43 lines
lib/igt_vmwgfx.h +5 -23
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
+/*
+ * Copyright (c) 2021-2024 Broadcom. All Rights Reserved. The term
+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
+ */
 
 #ifndef IGT_VMWGFX_H
 #define IGT_VMWGFX_H
@@ -186,7 +166,7 @@ struct vmw_surface *vmw_ioctl_buffer_create(int fd, SVGA3dSurfaceAllFlags flags,
 					    uint32_t size, struct vmw_mob *mob);
 void vmw_ioctl_surface_unref(int fd, struct vmw_surface *buffer);
 
-struct vmw_surface vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type);
+struct vmw_surface *vmw_ioctl_surface_ref(int fd, int32 sid, uint32 handle_type);
 
 struct vmw_surface *vmw_ioctl_create_surface_full(
 	int fd, SVGA3dSurfaceAllFlags flags, SVGA3dSurfaceFormat format,
tests/vmwgfx/vmw_ref_count.c +0 -0
index c765f2e70..8b4108471 100644

tests/vmwgfx/vmw_ref_count.c line 3

Quoted 3 lines
tests/vmwgfx/vmw_ref_count.c +0 -2
@@ -1,33 +1,14 @@
 // SPDX-License-Identifier: GPL-2.0 OR MIT
-/**********************************************************
- * Copyright 2021-2023 VMware, Inc.

------------------------- ^
Same here, you replaced VMware with Broadcom.

Regards,
Kamil

Quoted 259 lines
tests/vmwgfx/vmw_ref_count.c +173 -32
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
+/*
+ * Copyright (c) 2021-2024 Broadcom. All Rights Reserved. The term
+ * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
+ */
 
 #include "igt_vmwgfx.h"
 
 IGT_TEST_DESCRIPTION("Perform tests related to vmwgfx's ref_count codepaths.");
 
+#define NUM_SURFACES 10
 static uint32 data[10] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
 
 static void write_to_mob(int fd, struct vmw_mob *mob)
@@ -35,6 +16,7 @@ static void write_to_mob(int fd, struct vmw_mob *mob)
 	void *write_data;
 
 	write_data = vmw_ioctl_mob_map(fd, mob);
+	igt_assert(write_data);
 	memcpy(write_data, data, sizeof(data));
 	vmw_ioctl_mob_unmap(mob);
 }
@@ -73,7 +55,7 @@ create_and_write_shareable_surface(int32 fd, SVGA3dSize surface_size)
 		fd, SVGA3D_SURFACE_HINT_RENDERTARGET, SVGA3D_BUFFER, 0,
 		SVGA3D_MS_PATTERN_NONE, SVGA3D_MS_QUALITY_NONE,
 		SVGA3D_TEX_FILTER_NONE, 1, 1, surface_size, SVGA3D_INVALID_ID,
-		drm_vmw_surface_flag_shareable);
+		drm_vmw_surface_flag_shareable | drm_vmw_surface_flag_create_buffer);
 
 	mob.handle = surface->base.buffer_handle;
 	mob.map_handle = surface->base.buffer_map_handle;
@@ -86,17 +68,22 @@ create_and_write_shareable_surface(int32 fd, SVGA3dSize surface_size)
 
 static bool ref_surface_and_check_contents(int32 fd, uint32 surface_handle)
 {
-	struct vmw_surface surface;
+	struct vmw_surface *surface;
 	struct vmw_mob mob = { 0 };
+	bool data_valid;
 
 	surface = vmw_ioctl_surface_ref(fd, surface_handle,
 					DRM_VMW_HANDLE_LEGACY);
 
-	mob.handle = surface.base.handle;
-	mob.size = surface.base.buffer_size;
-	mob.map_handle = surface.base.buffer_map_handle;
+	mob.handle = surface->base.handle;
+	mob.size = surface->base.buffer_size;
+	mob.map_handle = surface->base.buffer_map_handle;
+
+	data_valid = verify_mob_data(fd, &mob);
+
+	vmw_ioctl_surface_unref(fd, surface);
 
-	return verify_mob_data(fd, &mob);
+	return data_valid;
 }
 
 igt_main
@@ -293,7 +280,7 @@ igt_main
 	igt_subtest("surface_alloc_ref_unref")
 	{
 		struct vmw_surface *surface;
-		struct vmw_surface ref_surface;
+		struct vmw_surface *ref_surface;
 		struct vmw_mob readback_mob = { 0 };
 
 		surface = create_and_write_shareable_surface(fd1, surface_size);
@@ -303,11 +290,163 @@ igt_main
 
 		vmw_ioctl_surface_unref(fd1, surface);
 
-		readback_mob.handle = ref_surface.base.handle;
-		readback_mob.size = ref_surface.base.buffer_size;
-		readback_mob.map_handle = ref_surface.base.buffer_map_handle;
+		readback_mob.handle = ref_surface->base.handle;
+		readback_mob.size = ref_surface->base.buffer_size;
+		readback_mob.map_handle = ref_surface->base.buffer_map_handle;
 
 		igt_assert(verify_mob_data(fd1, &readback_mob));
+
+		vmw_ioctl_surface_unref(fd1, ref_surface);
+	}
+
+	igt_describe("Test refing a surface from the buffer handle.");
+	igt_subtest("surface_buffer_ref")
+	{
+		struct vmw_surface *surfaces[NUM_SURFACES] = {0};
+		struct vmw_surface *refs[NUM_SURFACES] = {0};
+		struct vmw_surface *buf_refs[NUM_SURFACES] = {0};
+		int i;
+		SVGA3dSize surf_size;
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			surf_size.width = 32 + i * 16;
+			surf_size.height = 32 + i * 16;
+			surf_size.depth = 1;
+
+			surfaces[i] = vmw_create_surface_simple(
+				fd1,
+				SVGA3D_SURFACE_HINT_TEXTURE |
+				SVGA3D_SURFACE_HINT_RENDERTARGET |
+				SVGA3D_SURFACE_BIND_RENDER_TARGET,
+				SVGA3D_R8G8B8A8_UNORM, surf_size, SVGA3D_INVALID_ID);
+			igt_assert(surfaces[i]);
+		}
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			int prime_fd = prime_handle_to_fd_for_mmap(
+				fd1, surfaces[i]->base.handle);
+
+			refs[i] = vmw_ioctl_surface_ref(fd1, prime_fd,
+							DRM_VMW_HANDLE_PRIME);
+			igt_assert_eq(surfaces[i]->base.handle,
+				      refs[i]->base.handle);
+			igt_assert_eq(surfaces[i]->base.backup_size,
+				      refs[i]->base.backup_size);
+			igt_assert_eq(surfaces[i]->base.buffer_size,
+				      refs[i]->base.buffer_size);
+			igt_assert_eq(surfaces[i]->base.buffer_map_handle,
+				      refs[i]->base.buffer_map_handle);
+			igt_assert_eq(surfaces[i]->params.base.format,
+				      refs[i]->params.base.format);
+		}
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			int prime_fd = prime_handle_to_fd_for_mmap(
+				fd1, surfaces[i]->base.buffer_handle);
+
+			buf_refs[i] = vmw_ioctl_surface_ref(
+				fd1, prime_fd, DRM_VMW_HANDLE_PRIME);
+			igt_assert_eq(surfaces[i]->base.handle,
+				      buf_refs[i]->base.handle);
+			igt_assert_eq(surfaces[i]->base.backup_size,
+				      buf_refs[i]->base.backup_size);
+			igt_assert_eq(surfaces[i]->base.buffer_size,
+				      buf_refs[i]->base.buffer_size);
+			igt_assert_eq(surfaces[i]->base.buffer_map_handle,
+				      buf_refs[i]->base.buffer_map_handle);
+			igt_assert_eq(surfaces[i]->params.base.format,
+				      buf_refs[i]->params.base.format);
+		}
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			vmw_ioctl_surface_unref(fd1, buf_refs[i]);
+			vmw_ioctl_surface_unref(fd1, refs[i]);
+			vmw_ioctl_surface_unref(fd1, surfaces[i]);
+		}
+	}
+
+	igt_describe("Test refcounts on prime surfaces.");
+	igt_subtest("surface_prime_refs")
+	{
+		struct vmw_surface *surfaces[NUM_SURFACES] = {0};
+		int prime_fds[NUM_SURFACES] = {0};
+		struct vmw_surface *refs[NUM_SURFACES] = {0};
+		int i;
+		SVGA3dSize surf_size;
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			surf_size.width = 32 + i * 16;
+			surf_size.height = 32 + i * 16;
+			surf_size.depth = 1;
+
+			surfaces[i] = vmw_create_surface_simple(
+				fd1,
+				SVGA3D_SURFACE_HINT_TEXTURE |
+				SVGA3D_SURFACE_HINT_RENDERTARGET |
+				SVGA3D_SURFACE_BIND_RENDER_TARGET,
+				SVGA3D_R8G8B8A8_UNORM, surf_size, SVGA3D_INVALID_ID);
+			igt_assert(surfaces[i]);
+		}
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			prime_fds[i] = prime_handle_to_fd(
+				fd1, surfaces[i]->base.handle);
+			igt_assert_neq(prime_fds[i], 0);
+			igt_assert_neq(prime_fds[i], -1);
+			vmw_ioctl_surface_unref(fd1, surfaces[i]);
+		}
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			refs[i] = vmw_ioctl_surface_ref(fd1, prime_fds[i],
+							DRM_VMW_HANDLE_PRIME);
+			close(prime_fds[i]);
+			igt_assert_neq(refs[i]->base.handle, 0);
+			igt_assert_neq(refs[i]->base.backup_size, 0);
+			igt_assert_neq(refs[i]->base.buffer_size, 0);
+
+		}
+	}
+
+	igt_describe("Test refcounts on prime surfaces with buffer handles.");
+	igt_subtest("surface_buffer_prime_refs")
+	{
+		struct vmw_surface *surfaces[NUM_SURFACES] = {0};
+		int prime_fds[NUM_SURFACES] = {0};
+		struct vmw_surface *refs[NUM_SURFACES] = {0};
+		int i;
+		SVGA3dSize surf_size;
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			surf_size.width = 32 + i * 16;
+			surf_size.height = 32 + i * 16;
+			surf_size.depth = 1;
+
+			surfaces[i] = vmw_create_surface_simple(
+				fd1,
+				SVGA3D_SURFACE_HINT_TEXTURE |
+				SVGA3D_SURFACE_HINT_RENDERTARGET |
+				SVGA3D_SURFACE_BIND_RENDER_TARGET,
+				SVGA3D_R8G8B8A8_UNORM, surf_size, SVGA3D_INVALID_ID);
+			igt_assert(surfaces[i]);
+		}
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			prime_fds[i] = prime_handle_to_fd(
+				fd1, surfaces[i]->base.buffer_handle);
+			igt_assert_neq(prime_fds[i], 0);
+			igt_assert_neq(prime_fds[i], -1);
+			vmw_ioctl_surface_unref(fd1, surfaces[i]);
+		}
+
+		for (i = 0; i < NUM_SURFACES; ++i) {
+			refs[i] = vmw_ioctl_surface_ref(fd1, prime_fds[i],
+							DRM_VMW_HANDLE_PRIME);
+			close(prime_fds[i]);
+			igt_assert_neq(refs[i]->base.handle, 0);
+			igt_assert_neq(refs[i]->base.backup_size, 0);
+			igt_assert_neq(refs[i]->base.buffer_size, 0);
+
+		}
 	}
 
 	igt_fixture
Signature · 1 line
2.40.1
author
#6 lore raw

Re: [PATCH i-g-t 4/5] tests/vmwgfx: Fix and extend the reference counting test

Quoted 53 lines · Kamil Konieczny

Hi Zack,

Quoted 3 lines · Zack Rusin

Fix a few issues related to buffer managment in the reference counting test. Extend it to include various prime related reference counting issues.

- ^^^^^^
imho better 'capabilities' or some other word.

Quoted 13 lines
---
 lib/igt_vmwgfx.c             |  45 +++-----
 lib/igt_vmwgfx.h             |  30 +----
 tests/vmwgfx/vmw_ref_count.c | 207 +++++++++++++++++++++++++++++------
 3 files changed, 193 insertions(+), 89 deletions(-)
lib/igt_vmwgfx.c +0 -0
index d2f699575..b62d7a326 100644

lib/igt_vmwgfx.c line 3

Quoted 3 lines
lib/igt_vmwgfx.c +0 -2
@@ -1,28 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0 OR MIT
-/**********************************************************
- * Copyright 2021-2023 VMware, Inc.

------------------------- ^^^^^^^^^^^^

Quoted 14 lines
lib/igt_vmwgfx.c +0 -14
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy,
- * modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF

lib/igt_vmwgfx.c line 3

Quoted 10 lines
lib/igt_vmwgfx.c +2 -8
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- **********************************************************/
+/*
+ * Copyright (c) 2021-2024 Broadcom. All Rights Reserved. The term

----------------------------- ^^^^^^^^^

Quoted 8 lines

This is not the same. Btw why not:

* Copyright 2021-2023 VMware, Inc.
* Copyright 2024 Broadcom, Inc. and/or its subsidiaries.

But I am a little reluctant to see '... subsidiaries' as this adds some unknown numbers/names here?
+cc Petri

Unfortunately, this is just the way it is. Broadcom has acquired VMware and its IP. Unless Intel's legal team's official position is that Broadcom's legal team got it wrong, then that's the copyright header we have to use.

Quoted 6 lines

lib/igt_vmwgfx.c line 3

Quoted 4 lines
lib/igt_vmwgfx.c +0 -2
@@ -1,28 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
-/**********************************************************
- * Copyright 2021-2023 VMware, Inc.

------------------------- ^
Same here, you replaced VMware with Broadcom.

Yea, that's correct.

z

author
#7 lore raw

PATCH v2 5/5 tests/dumb_buffer: Add subtests for mixing dumb buffers with prime

In reply to Zack Rusin

New versions of KWin are extensively using dumb buffers with prime. Add some basic tests to verify that mixing the dumb buffer interface with prime ends up with a well formed buffer.

---
 tests/dumb_buffer.c | 96 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
tests/dumb_buffer.c +96 -0
index 8e243459c..0651f5d83 100644
@@ -69,6 +69,20 @@
  * SUBTEST: map-uaf
  *
  * SUBTEST: map-valid
+ *
+ * SUBTEST: dmabuf-read
+ * Description: Make a dumb buffer, map it using the dumb buffer interface,
+ *              export it via prime, mmap the prime buffer and check
+ *              that its contents matches what we wrote to the dumb
+ *              buffer.
+ * Functionality: dumb_buffers, prime, dmabuf, mmap
+ *
+ * SUBTEST: dmabuf-write
+ * Description: Make a dumb buffer, map and write to it using the prime
+ *              interface, than map it using the dumb buffer interface
+ *              and check whether its contents matches what we wrote using
+ * 		the prime interface.
+ * Functionality: dumb_buffers, prime, dmabuf, mmap
  */
 
 IGT_TEST_DESCRIPTION("This is a test for the generic dumb buffer interface.");
@@ -388,6 +402,82 @@ static void always_clear(int fd, int timeout)
 	igt_info("Checked %'lu page allocations\n", checked);
 }
 
+static const uint32_t pattern[] = {
+	0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff,
+	0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000,
+	0x00ffff00, 0xff0000ff, 0x00ff00ff, 0xff00ff00,
+	0xff0000ff, 0x00ff00ff, 0x00ffff00, 0xff00ff00
+};
+
+static void dmabuf_read(int fd)
+{
+	struct drm_mode_create_dumb create = {
+		.width = 64,
+		.height = 64,
+		.bpp = 32,
+	};
+	int dma_buf_fd;
+	uint32_t *ptr;
+
+	dumb_create(fd, &create);
+	ptr = dumb_map(fd, create.handle, create.size, PROT_WRITE);
+	igt_assert(ptr != MAP_FAILED);
+	igt_assert(ptr != NULL);
+	igt_assert(create.size > sizeof(pattern));
+	memcpy(ptr, pattern, sizeof(pattern));
+	munmap(ptr, create.size);
+
+	dma_buf_fd = prime_handle_to_fd_for_mmap(fd, create.handle);
+
+	/* Skip if DRM_RDWR is not supported */
+	igt_skip_on(errno == EINVAL);
+
+	ptr = mmap(NULL, create.size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf_fd, 0);
+	igt_assert(ptr != MAP_FAILED);
+
+	/* Check pattern correctness */
+	igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
+
+	munmap(ptr, create.size);
+	close(dma_buf_fd);
+
+	dumb_destroy(fd, create.handle);
+}
+
+static void dmabuf_write(int fd)
+{
+	struct drm_mode_create_dumb create = {
+		.width = 64,
+		.height = 64,
+		.bpp = 32,
+	};
+	int dma_buf_fd;
+	uint32_t *ptr;
+
+	dumb_create(fd, &create);
+
+	dma_buf_fd = prime_handle_to_fd_for_mmap(fd, create.handle);
+	/* Skip if DRM_RDWR is not supported */
+	igt_skip_on(errno == EINVAL);
+
+	ptr = mmap(NULL, create.size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf_fd, 0);
+	igt_assert(ptr != MAP_FAILED);
+	memcpy(ptr, pattern, sizeof(pattern));
+	munmap(ptr, create.size);
+
+
+	ptr = dumb_map(fd, create.handle, create.size, PROT_READ);
+	igt_assert(ptr != MAP_FAILED);
+	igt_assert(ptr != NULL);
+	igt_assert(create.size > sizeof(pattern));
+	igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
+	munmap(ptr, create.size);
+
+	close(dma_buf_fd);
+
+	dumb_destroy(fd, create.handle);
+}
+
 igt_main
 {
 	int fd = -1;
@@ -414,6 +504,12 @@ igt_main
 	igt_subtest("create-clear")
 		always_clear(fd, 30);
 
+	igt_subtest("dmabuf-read")
+		dmabuf_read(fd);
+
+	igt_subtest("dmabuf-write")
+		dmabuf_write(fd);
+
 	igt_fixture {
 		drm_close_driver(fd);
 	}
Signature · 1 line
2.40.1
#8 lore raw

Re: [PATCH i-g-t 5/5] tests/dumb_buffer: Add subtests for mixing dumb buffers with prime

Hi Zack,

Quoted 9 lines · Zack Rusin

New versions of KWin are extensively using dumb buffers with prime. Add some basic tests to verify that mixing the dumb buffer interface with prime ends up with a well formed buffer.

---
 tests/dumb_buffer.c | 96 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)

This seems unrelated to your series, please send it in separate one. Few more nits below.

Quoted 5 lines
tests/dumb_buffer.c +0 -0
index 8e243459c..0651f5d83 100644

tests/dumb_buffer.c line 78

Quoted 10 lines
tests/dumb_buffer.c +7 -0
@@ -69,6 +69,20 @@
  * SUBTEST: map-uaf
  *
  * SUBTEST: map-valid
+ *
+ * SUBTEST: dmabuf-read
+ * Description: Make a dumb buffer, map it using the dumb buffer interface,
+ *              export it via prime, mmap the prime buffer and check
+ *              that its contents matches what we wrote to the dumb
+ *              buffer.
+ * Functionality: dumb_buffers, prime, dmabuf, mmap

----- ^
Do you need it here?

tests/dumb_buffer.c line 85

Quoted 7 lines
tests/dumb_buffer.c +7 -0
+ *
+ * SUBTEST: dmabuf-write
+ * Description: Make a dumb buffer, map and write to it using the prime
+ *              interface, than map it using the dumb buffer interface
+ *              and check whether its contents matches what we wrote using
+ * 		the prime interface.
+ * Functionality: dumb_buffers, prime, dmabuf, mmap

----- ^
Same here.

Regards,
Kamil

Quoted 102 lines
tests/dumb_buffer.c +82 -0
  */
 
 IGT_TEST_DESCRIPTION("This is a test for the generic dumb buffer interface.");
@@ -388,6 +402,82 @@ static void always_clear(int fd, int timeout)
 	igt_info("Checked %'lu page allocations\n", checked);
 }
 
+static const uint32_t pattern[] = {
+	0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff,
+	0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000,
+	0x00ffff00, 0xff0000ff, 0x00ff00ff, 0xff00ff00,
+	0xff0000ff, 0x00ff00ff, 0x00ffff00, 0xff00ff00
+};
+
+static void dmabuf_read(int fd)
+{
+	struct drm_mode_create_dumb create = {
+		.width = 64,
+		.height = 64,
+		.bpp = 32,
+	};
+	int dma_buf_fd;
+	uint32_t *ptr;
+
+	dumb_create(fd, &create);
+	ptr = dumb_map(fd, create.handle, create.size, PROT_WRITE);
+	igt_assert(ptr != MAP_FAILED);
+	igt_assert(ptr != NULL);
+	igt_assert(create.size > sizeof(pattern));
+	memcpy(ptr, pattern, sizeof(pattern));
+	munmap(ptr, create.size);
+
+	dma_buf_fd = prime_handle_to_fd_for_mmap(fd, create.handle);
+
+	/* Skip if DRM_RDWR is not supported */
+	igt_skip_on(errno == EINVAL);
+
+	ptr = mmap(NULL, create.size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf_fd, 0);
+	igt_assert(ptr != MAP_FAILED);
+
+	/* Check pattern correctness */
+	igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
+
+	munmap(ptr, create.size);
+	close(dma_buf_fd);
+
+	dumb_destroy(fd, create.handle);
+}
+
+static void dmabuf_write(int fd)
+{
+	struct drm_mode_create_dumb create = {
+		.width = 64,
+		.height = 64,
+		.bpp = 32,
+	};
+	int dma_buf_fd;
+	uint32_t *ptr;
+
+	dumb_create(fd, &create);
+
+	dma_buf_fd = prime_handle_to_fd_for_mmap(fd, create.handle);
+	/* Skip if DRM_RDWR is not supported */
+	igt_skip_on(errno == EINVAL);
+
+	ptr = mmap(NULL, create.size, PROT_READ | PROT_WRITE, MAP_SHARED, dma_buf_fd, 0);
+	igt_assert(ptr != MAP_FAILED);
+	memcpy(ptr, pattern, sizeof(pattern));
+	munmap(ptr, create.size);
+
+
+	ptr = dumb_map(fd, create.handle, create.size, PROT_READ);
+	igt_assert(ptr != MAP_FAILED);
+	igt_assert(ptr != NULL);
+	igt_assert(create.size > sizeof(pattern));
+	igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
+	munmap(ptr, create.size);
+
+	close(dma_buf_fd);
+
+	dumb_destroy(fd, create.handle);
+}
+
 igt_main
 {
 	int fd = -1;
@@ -414,6 +504,12 @@ igt_main
 	igt_subtest("create-clear")
 		always_clear(fd, 30);
 
+	igt_subtest("dmabuf-read")
+		dmabuf_read(fd);
+
+	igt_subtest("dmabuf-write")
+		dmabuf_write(fd);
+
 	igt_fixture {
 		drm_close_driver(fd);
 	}
Signature · 1 line
2.40.1
author
#9 lore raw

Re: [PATCH i-g-t 5/5] tests/dumb_buffer: Add subtests for mixing dumb buffers with prime

Quoted 7 lines · Kamil Konieczny

Hi Zack,

Quoted 4 lines · Zack Rusin

New versions of KWin are extensively using dumb buffers with prime. Add some basic tests to verify that mixing the dumb buffer interface with prime ends up with a well formed buffer.

Quoted 8 lines
Quoted 5 lines
---
 tests/dumb_buffer.c | 96 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)

This seems unrelated to your series, please send it in separate one. Few more nits below.

Sounds good. It's generally just improvements to prime/dmabuf testing framework in igt, but I'm happy to send that as a separate patch.

Quoted 9 lines
Quoted 9 lines
tests/dumb_buffer.c +1 -0
index 8e243459c..0651f5d83 100644
@@ -69,6 +69,20 @@
  * SUBTEST: map-uaf
  *
  * SUBTEST: map-valid
+ *
Quoted 8 lines

tests/dumb_buffer.c line 78

Quoted 6 lines
tests/dumb_buffer.c +6 -0
+ * SUBTEST: dmabuf-read
+ * Description: Make a dumb buffer, map it using the dumb buffer interface,
+ *              export it via prime, mmap the prime buffer and check
+ *              that its contents matches what we wrote to the dumb
+ *              buffer.
+ * Functionality: dumb_buffers, prime, dmabuf, mmap

----- ^
Do you need it here?

We don't. I just looked at other files e.g. kms_flip.c and kms_prime.c which seem to list "Functionality" for the added tests so I was trying to follow what I assumed best practice was. I'm happy to remove any part of the docs for it.

z

#10 lore raw

✗ Fi.CI.BUILD: failure for Add vmwgfx prime tests (rev2)

In reply to Zack Rusin
== Series Details ==

== Series Details ==

Series: Add vmwgfx prime tests (rev2)
URL : https://patchwork.freedesktop.org/series/133402/
State : failure

== Summary ==

IGT patchset build failed on latest successful build
676b8e660cadae8ffb29a45b12ad5b53ef228b6a lib/rendercopy_gen9: Use AUX_NONE for platforms with unified compression

Tail of build.log:
[701/1679] Compiling C object 'tests/v3d/cad21b8@@v3d_submit_csd@exe/v3d_submit_csd.c.o'. [702/1679] Compiling C object 'benchmarks/cb1d2fd@@gem_exec_tracer@sha/gem_exec_tracer.c.o'. [703/1679] Compiling C object 'benchmarks/cb1d2fd@@gem_exec_trace@exe/gem_exec_trace.c.o'. [704/1679] Compiling C object 'tests/59830eb@@xe_pat@exe/intel_xe_pat.c.o'.
[705/1679] Compiling C object 'benchmarks/cb1d2fd@@intel_upload_blit_large_gtt@exe/intel_upload_blit_large_gtt.c.o'. [706/1679] Compiling C object 'tools/f9d35d4@@intel_forcewaked@exe/intel_forcewaked.c.o'. [707/1679] Compiling C object 'tools/f9d35d4@@cnl_compute_wrpll@exe/cnl_compute_wrpll.c.o'. [708/1679] Compiling C object 'tools/f9d35d4@@intel_dump_decode@exe/intel_dump_decode.c.o'. [709/1679] Compiling C object 'tools/f9d35d4@@intel_lid@exe/intel_lid.c.o'.
[710/1679] Compiling C object 'benchmarks/cb1d2fd@@intel_upload_blit_small@exe/intel_upload_blit_small.c.o'. [711/1679] Compiling C object 'tools/f9d35d4@@intel_framebuffer_dump@exe/intel_framebuffer_dump.c.o'. [712/1679] Compiling C object 'tests/vmwgfx/776e741@@vmw_surface_copy@exe/vmw_surface_copy.c.o'. [713/1679] Compiling C object 'tools/f9d35d4@@intel_gpu_time@exe/intel_gpu_time.c.o'.
[714/1679] Compiling C object 'benchmarks/cb1d2fd@@kms_fb_stress@exe/kms_fb_stress.c.o'. [715/1679] Compiling C object 'tools/f9d35d4@@intel_firmware_decode@exe/intel_firmware_decode.c.o'. [716/1679] Compiling C object 'tests/59830eb@@i915_query@exe/intel_i915_query.c.o'.
[717/1679] Compiling C object 'benchmarks/cb1d2fd@@vgem_mmap@exe/vgem_mmap.c.o'.
[718/1679] Compiling C object 'tools/f9d35d4@@intel_gtt@exe/intel_gtt.c.o'.
[719/1679] Compiling C object 'tools/f9d35d4@@intel_gpu_frequency@exe/intel_gpu_frequency.c.o'. [720/1679] Compiling C object 'benchmarks/cb1d2fd@@gem_userptr_benchmark@exe/gem_userptr_benchmark.c.o'. [721/1679] Compiling C object 'tests/vmwgfx/776e741@@vmw_ref_count@exe/vmw_ref_count.c.o'. [722/1679] Compiling C object 'tools/f9d35d4@@skl_compute_wrpll@exe/skl_compute_wrpll.c.o'. [723/1679] Compiling C object 'tools/f9d35d4@@intel_panel_fitter@exe/intel_panel_fitter.c.o'. [724/1679] Compiling C object 'tests/59830eb@@kms_pm_rpm@exe/intel_kms_pm_rpm.c.o'.
[725/1679] Compiling C object 'tools/f9d35d4@@intel_perf_counters@exe/intel_perf_counters.c.o'. [726/1679] Compiling C object 'tests/59830eb@@xe_exec_threads@exe/intel_xe_exec_threads.c.o'. [727/1679] Compiling C object 'tests/59830eb@@kms_chamelium_frames@exe/chamelium_kms_chamelium_frames.c.o'. [728/1679] Compiling C object 'benchmarks/cb1d2fd@@gem_syslatency@exe/gem_syslatency.c.o'. [729/1679] Compiling C object 'tools/f9d35d4@@intel_opregion_decode@exe/intel_opregion_decode.c.o'. [730/1679] Compiling C object 'benchmarks/cb1d2fd@@gem_latency@exe/gem_latency.c.o'.
[731/1679] Compiling C object 'tests/59830eb@@kms_psr2_sf@exe/intel_kms_psr2_sf.c.o'.
[732/1679] Compiling C object 'tests/59830eb@@gem_exec_balancer@exe/intel_gem_exec_balancer.c.o'. [733/1679] Compiling C object 'tools/f9d35d4@@intel_guc_logger@exe/intel_guc_logger.c.o'. [734/1679] Compiling C object 'tests/59830eb@@gem_stress@exe/intel_gem_stress.c.o'.
[735/1679] Compiling C object 'tools/f9d35d4@@intel_error_decode@exe/intel_error_decode.c.o'. [736/1679] Compiling C object 'tools/f9d35d4@@intel_infoframes@exe/intel_infoframes.c.o'. [737/1679] Generating i915-perf-equations with a custom command.
[738/1679] Compiling C object 'tests/59830eb@@xe_vm@exe/intel_xe_vm.c.o'.
[739/1679] Compiling C object 'tools/f9d35d4@@intel_display_poller@exe/intel_display_poller.c.o'. [740/1679] Compiling C object 'tests/59830eb@@gem_userptr_blits@exe/intel_gem_userptr_blits.c.o'. [741/1679] Compiling C object 'tests/59830eb@@gem_exec_fence@exe/intel_gem_exec_fence.c.o'. [742/1679] Compiling C object 'tests/59830eb@@gem_concurrent_all@exe/intel_gem_concurrent_all.c.o'. [743/1679] Compiling C object 'tests/59830eb@@kms_frontbuffer_tracking@exe/intel_kms_frontbuffer_tracking.c.o'. [744/1679] Compiling C object 'tools/f9d35d4@@intel_audio_dump@exe/intel_audio_dump.c.o'. [745/1679] Compiling C object 'tests/59830eb@@perf_pmu@exe/intel_perf_pmu.c.o'.
[746/1679] Compiling C object 'benchmarks/cb1d2fd@@gem_wsim@exe/gem_wsim.c.o'.
[747/1679] Compiling C object 'tests/59830eb@@perf@exe/intel_perf.c.o'.
[748/1679] Compiling C object 'tests/59830eb@@gem_exec_schedule@exe/intel_gem_exec_schedule.c.o'. [749/1679] Linking target lib/libigt.so.0.
ninja: build stopped: subcommand failed.

#11 lore raw

✗ GitLab.Pipeline: warning for Add vmwgfx prime tests (rev2)

In reply to Zack Rusin
== Series Details ==

== Series Details ==

Series: Add vmwgfx prime tests (rev2)
URL : https://patchwork.freedesktop.org/series/133402/
State : warning

== Summary ==

Pipeline status: FAILED.

see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/1212583 for the overview.

build:tests-debian-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482518):
../tests/vmwgfx/vmw_prime.c: In function ‘draw_triangle_3d’:
../tests/vmwgfx/vmw_prime.c:327:26: error: ‘pattern’ undeclared (first use in this function)

     igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                            ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    do { if (!(expr)) \
               ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: note: each undeclared identifier is reported only once for each function it appears in
     igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                            ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    do { if (!(expr)) \
               ^~~~

ninja: build stopped: subcommand failed. section_end:1719578469:step_script section_start:1719578469:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578470:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-debian-meson-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482521):
../tests/vmwgfx/vmw_prime.c: In function ‘draw_triangle_3d’:
../tests/vmwgfx/vmw_prime.c:327:26: error: ‘pattern’ undeclared (first use in this function)

     igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                            ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    do { if (!(expr)) \
               ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: note: each undeclared identifier is reported only once for each function it appears in
     igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                            ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    do { if (!(expr)) \
               ^~~~

ninja: build stopped: subcommand failed. section_end:1719578465:step_script section_start:1719578465:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578466:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-debian-meson-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482520):
../tests/vmwgfx/vmw_prime.c: In function ‘draw_triangle_3d’:
../tests/vmwgfx/vmw_prime.c:327:26: error: ‘pattern’ undeclared (first use in this function)

     igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                            ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    do { if (!(expr)) \
               ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: note: each undeclared identifier is reported only once for each function it appears in
     igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                            ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    do { if (!(expr)) \
               ^~~~

ninja: build stopped: subcommand failed. section_end:1719578486:step_script section_start:1719578486:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578487:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-debian-meson-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482522):
../tests/vmwgfx/vmw_prime.c: In function ‘draw_triangle_3d’:
../tests/vmwgfx/vmw_prime.c:327:26: error: ‘pattern’ undeclared (first use in this function)

     igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                            ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    do { if (!(expr)) \
               ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: note: each undeclared identifier is reported only once for each function it appears in
     igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                            ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    do { if (!(expr)) \
               ^~~~

ninja: build stopped: subcommand failed. section_end:1719578491:step_script section_start:1719578491:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578492:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482513):
../tests/vmwgfx/vmw_prime.c: In function ‘draw_triangle_3d’:
../tests/vmwgfx/vmw_prime.c:327:26: error: ‘pattern’ undeclared (first use in this function)

    327 |   igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
        |                          ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    676 |  do { if (!(expr)) \
        |             ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: note: each undeclared identifier is reported only once for each function it appears in
    327 |   igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
        |                          ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    676 |  do { if (!(expr)) \
        |             ^~~~

ninja: build stopped: subcommand failed. section_end:1719578498:step_script section_start:1719578498:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578498:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482517):
../lib/igt_core.h:676:13: note: expanded from macro 'igt_assert'

          do { if (!(expr)) \
                     ^
  ../tests/vmwgfx/vmw_prime.c:327:41: error: reference to overloaded function could not be resolved; did you mean to call it?
                  igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                                                        ^~~~~~~~~
  ../lib/igt_core.h:676:13: note: expanded from macro 'igt_assert'
          do { if (!(expr)) \
                     ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: error: use of undeclared identifier 'pattern'
                  igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
                                         ^

3 errors generated.
ninja: build stopped: subcommand failed. section_end:1719578493:step_script section_start:1719578493:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578493:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora-no-libdrm-nouveau has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482516):
../tests/vmwgfx/vmw_prime.c: In function ‘draw_triangle_3d’:
../tests/vmwgfx/vmw_prime.c:327:26: error: ‘pattern’ undeclared (first use in this function)

    327 |   igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
        |                          ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    676 |  do { if (!(expr)) \
        |             ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: note: each undeclared identifier is reported only once for each function it appears in
    327 |   igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
        |                          ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    676 |  do { if (!(expr)) \
        |             ^~~~

ninja: build stopped: subcommand failed. section_end:1719578468:step_script section_start:1719578468:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578469:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora-no-libunwind has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482514):
../tests/vmwgfx/vmw_prime.c: In function ‘draw_triangle_3d’:
../tests/vmwgfx/vmw_prime.c:327:26: error: ‘pattern’ undeclared (first use in this function)

    327 |   igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
        |                          ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    676 |  do { if (!(expr)) \
        |             ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: note: each undeclared identifier is reported only once for each function it appears in
    327 |   igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
        |                          ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    676 |  do { if (!(expr)) \
        |             ^~~~

ninja: build stopped: subcommand failed. section_end:1719578466:step_script section_start:1719578466:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578467:cleanup_file_variables
ERROR: Job failed: exit code 1

build:tests-fedora-oldest-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/60482515):
../tests/vmwgfx/vmw_prime.c: In function ‘draw_triangle_3d’:
../tests/vmwgfx/vmw_prime.c:327:26: error: ‘pattern’ undeclared (first use in this function)

    327 |   igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
        |                          ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    676 |  do { if (!(expr)) \
        |             ^~~~
  ../tests/vmwgfx/vmw_prime.c:327:26: note: each undeclared identifier is reported only once for each function it appears in
    327 |   igt_assert(memcmp(ptr, pattern, sizeof(pattern)) == 0);
        |                          ^~~~~~~
  ../lib/igt_core.h:676:13: note: in definition of macro ‘igt_assert’
    676 |  do { if (!(expr)) \
        |             ^~~~

ninja: build stopped: subcommand failed. section_end:1719578493:step_script section_start:1719578493:cleanup_file_variables Cleaning up project directory and file based variables section_end:1719578494:cleanup_file_variables
ERROR: Job failed: exit code 1

== Logs ==

For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/1212583