From: Zack Rusin <zack@kde.org>
To: igt-dev@lists.freedesktop.org
Cc: banackm@vmware.com, krastevm@vmware.com, iforbes@vmware.com,
mombasawalam@vmware.com
Subject: [igt-dev] [PATCH i-g-t v4 6/8] tests/vmwgfx: Add mob stress test
Date: Wed, 12 Apr 2023 21:24:24 -0400 [thread overview]
Message-ID: <20230413012426.503658-7-zack@kde.org> (raw)
In-Reply-To: <20230413012426.503658-1-zack@kde.org>
From: Maaz Mombasawala <mombasawalam@vmware.com>
This test checks the limits of the number and capacity of mobs that
vmwgfx can support.
Signed-off-by: Zack Rusin <zackr@vmware.com>
Signed-off-by: Maaz Mombasawala <mombasawalam@vmware.com>
Reviewed-by: Martin Krastev <krastevm@vmware.com>
---
tests/vmwgfx/meson.build | 3 +-
tests/vmwgfx/vmw_mob_stress.c | 102 ++++++++++++++++++++++++++++++++++
2 files changed, 104 insertions(+), 1 deletion(-)
create mode 100644 tests/vmwgfx/vmw_mob_stress.c
diff --git a/tests/vmwgfx/meson.build b/tests/vmwgfx/meson.build
index cc0718b2..1cb662e3 100644
--- a/tests/vmwgfx/meson.build
+++ b/tests/vmwgfx/meson.build
@@ -2,7 +2,8 @@
vmwgfx_progs = [
'vmw_tri',
'vmw_execution_buffer',
- 'vmw_surface_copy'
+ 'vmw_surface_copy',
+ 'vmw_mob_stress'
]
vmwgfx_deps = test_deps
diff --git a/tests/vmwgfx/vmw_mob_stress.c b/tests/vmwgfx/vmw_mob_stress.c
new file mode 100644
index 00000000..4af23d6f
--- /dev/null
+++ b/tests/vmwgfx/vmw_mob_stress.c
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/**********************************************************
+ * Copyright 2021-2022 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.
+ *
+ **********************************************************/
+
+#include "igt_vmwgfx.h"
+
+IGT_TEST_DESCRIPTION("Test memory limits on mob's.");
+
+static void test_triangle_render(struct vmw_svga_device *device, int32 cid)
+{
+ uint8 *rendered_tri;
+ struct vmw_default_objects objects;
+
+ vmw_create_default_objects(device, cid, &objects,
+ &vmw_default_rect_size);
+ rendered_tri = vmw_triangle_draw(device, cid, &objects, true);
+ vmw_triangle_assert_values(rendered_tri, objects.color_rt);
+
+ free(rendered_tri);
+ vmw_destroy_default_objects(device, &objects);
+}
+
+igt_main
+{
+ struct vmw_svga_device device;
+ int32 cid;
+ uint64 max_mob_mem;
+ uint64 max_mob_size;
+
+ igt_fixture
+ {
+ vmw_svga_device_init(&device, vmw_svga_device_node_render);
+ igt_require(device.drm_fd != -1);
+
+ cid = vmw_ioctl_context_create(device.drm_fd);
+ igt_require(cid != SVGA3D_INVALID_ID);
+
+ max_mob_mem = vmw_ioctl_get_param(device.drm_fd,
+ DRM_VMW_PARAM_MAX_MOB_MEMORY);
+ max_mob_size = vmw_ioctl_get_param(device.drm_fd,
+ DRM_VMW_PARAM_MAX_MOB_SIZE);
+ }
+
+ igt_describe("Test whether max memory allocations cause problems.");
+ igt_subtest("max_mob_mem_stress")
+ {
+ uint32 mob_num;
+ struct vmw_mob **mob_objs;
+ int i;
+
+ mob_num = max_mob_mem / max_mob_size;
+ mob_objs = (struct vmw_mob **)calloc(mob_num,
+ sizeof(struct vmw_mob *));
+
+ /* Enough mobs to reach max_mob_mem */
+ for (i = 0; i < mob_num; i++) {
+ char *readback;
+
+ mob_objs[i] = vmw_ioctl_mob_create(device.drm_fd,
+ max_mob_size);
+ /* Writing mob to ensure it gets created */
+ readback =
+ vmw_ioctl_mob_map(device.drm_fd, mob_objs[i]);
+ memset(readback, 0, mob_objs[i]->size);
+ vmw_ioctl_mob_unmap(mob_objs[i]);
+ }
+
+ test_triangle_render(&device, cid);
+
+ for (i = 0; i < mob_num; i++)
+ vmw_ioctl_mob_close_handle(device.drm_fd, mob_objs[i]);
+ free(mob_objs);
+ }
+
+ igt_fixture
+ {
+ vmw_ioctl_context_destroy(device.drm_fd, cid);
+ vmw_svga_device_fini(&device);
+ }
+}
--
2.39.2
next prev parent reply other threads:[~2023-04-13 1:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 1:24 [igt-dev] [PATCH i-g-t v4 0/8] Add vmwgfx support Zack Rusin
2023-04-13 1:24 ` [igt-dev] [PATCH i-g-t v4 1/8] lib/svga: Add generated headers for the svga device Zack Rusin
2023-04-17 12:41 ` Kamil Konieczny
2023-04-13 1:24 ` [igt-dev] [PATCH i-g-t v4 2/8] lib: Add vmwgfx support Zack Rusin
2023-04-13 10:44 ` Kamil Konieczny
2023-04-13 1:24 ` [igt-dev] [PATCH i-g-t v4 3/8] tests/vmwgfx: Add triangle test Zack Rusin
2023-04-13 1:24 ` [igt-dev] [PATCH i-g-t v4 4/8] tests/vmwgfx: Add execution buffer test Zack Rusin
2023-04-13 1:24 ` [igt-dev] [PATCH i-g-t v4 5/8] tests/vmwgfx: Add surface copy test Zack Rusin
2023-04-13 1:24 ` Zack Rusin [this message]
2023-04-13 1:24 ` [igt-dev] [PATCH i-g-t v4 7/8] tests/vmwgfx: Add reference counting tests Zack Rusin
2023-04-13 1:24 ` [igt-dev] [PATCH i-g-t v4 8/8] lib: Fix igt_kms for drivers with 8 crtc's Zack Rusin
2023-04-17 12:39 ` Kamil Konieczny
2023-04-19 4:41 ` Karthik B S
2023-04-13 2:05 ` [igt-dev] ✗ Fi.CI.BAT: failure for Add vmwgfx support (rev4) Patchwork
2023-04-13 9:47 ` Kamil Konieczny
2023-04-13 11:31 ` Yedireswarapu, SaiX Nandan
2023-04-13 11:28 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-04-13 13:37 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230413012426.503658-7-zack@kde.org \
--to=zack@kde.org \
--cc=banackm@vmware.com \
--cc=iforbes@vmware.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=krastevm@vmware.com \
--cc=mombasawalam@vmware.com \
--cc=zackr@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox