From: Zack Rusin <zack@kde.org>
To: igt-dev@lists.freedesktop.org
Cc: krastevm@vmware.com, banackm@vmware.com, mombasawalam@vmware.com,
petri.latvala@intel.com
Subject: [igt-dev] [PATCH i-g-t v2 6/8] igt/vmwgfx: Add mob stress test
Date: Wed, 15 Mar 2023 22:26:57 -0400 [thread overview]
Message-ID: <20230316022659.73202-7-zack@kde.org> (raw)
In-Reply-To: <20230316022659.73202-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>
---
tests/vmwgfx/meson.build | 3 +-
tests/vmwgfx/mob_stress.c | 99 +++++++++++++++++++++++++++++++++++++++
2 files changed, 101 insertions(+), 1 deletion(-)
create mode 100644 tests/vmwgfx/mob_stress.c
diff --git a/tests/vmwgfx/meson.build b/tests/vmwgfx/meson.build
index 7c688e92..c84dcc28 100644
--- a/tests/vmwgfx/meson.build
+++ b/tests/vmwgfx/meson.build
@@ -2,7 +2,8 @@
vmwgfx_progs = [
'tri',
'execution_buffer',
- 'surface_copy'
+ 'surface_copy',
+ 'mob_stress'
]
vmwgfx_deps = test_deps
diff --git a/tests/vmwgfx/mob_stress.c b/tests/vmwgfx/mob_stress.c
new file mode 100644
index 00000000..9c8fb110
--- /dev/null
+++ b/tests/vmwgfx/mob_stress.c
@@ -0,0 +1,99 @@
+// 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"
+
+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_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.38.1
next prev parent reply other threads:[~2023-03-16 2:27 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 2:26 [igt-dev] [PATCH i-g-t v2 0/8] Add vmwgfx support Zack Rusin
2023-03-16 2:26 ` [igt-dev] [PATCH i-g-t v2 1/8] igt/vmwgfx: Add generated headers for svga device Zack Rusin
[not found] ` <DM6PR05MB7099753BF0C4C180B50FE6F5AEBC9@DM6PR05MB7099.namprd05.prod.outlook.com>
2023-03-16 13:03 ` Martin Krastev (VMware)
2023-03-20 17:08 ` Kamil Konieczny
2023-03-17 16:52 ` Kamil Konieczny
2023-03-17 19:34 ` Zack Rusin
2023-04-03 12:57 ` Kamil Konieczny
2023-03-16 2:26 ` [igt-dev] [PATCH i-g-t v2 2/8] igt/vmwgfx: Add vmwgfx support Zack Rusin
[not found] ` <DM6PR05MB7099CE80747EDA8D25FA1B80AEBC9@DM6PR05MB7099.namprd05.prod.outlook.com>
2023-03-16 13:17 ` Martin Krastev (VMware)
2023-03-17 8:12 ` Petri Latvala
2023-03-16 2:26 ` [igt-dev] [PATCH i-g-t v2 3/8] igt/vmwgfx: Add triangle test Zack Rusin
[not found] ` <DM6PR05MB7099906944F388E2AF52683CAEBC9@DM6PR05MB7099.namprd05.prod.outlook.com>
2023-03-16 13:37 ` Martin Krastev (VMware)
2023-03-17 16:58 ` Kamil Konieczny
2023-03-16 2:26 ` [igt-dev] [PATCH i-g-t v2 4/8] igt/vmwgfx: Add execution buffer test Zack Rusin
[not found] ` <DM6PR05MB7099387153CDB475DEC7D7A4AEBC9@DM6PR05MB7099.namprd05.prod.outlook.com>
2023-03-16 13:55 ` Martin Krastev (VMware)
2023-03-16 2:26 ` [igt-dev] [PATCH i-g-t v2 5/8] igt/vmwgfx: Add surface copy test Zack Rusin
[not found] ` <DM6PR05MB7099EFBC41B5FCEE66C80C44AEBC9@DM6PR05MB7099.namprd05.prod.outlook.com>
2023-03-16 14:08 ` Martin Krastev (VMware)
2023-03-16 2:26 ` Zack Rusin [this message]
[not found] ` <DM6PR05MB70993CAD6D2EF2959A0522F8AEBC9@DM6PR05MB7099.namprd05.prod.outlook.com>
2023-03-16 14:13 ` [igt-dev] [PATCH i-g-t v2 6/8] igt/vmwgfx: Add mob stress test Martin Krastev (VMware)
2023-03-16 2:26 ` [igt-dev] [PATCH i-g-t v2 7/8] igt/vmwgfx: Add reference counting tests Zack Rusin
[not found] ` <DM6PR05MB70999D64A5D5DC1B22771866AEBC9@DM6PR05MB7099.namprd05.prod.outlook.com>
2023-03-16 14:22 ` Martin Krastev (VMware)
2023-03-16 2:26 ` [igt-dev] [PATCH i-g-t v2 8/8] lib/igt_kms: vmwgfx returns 8 crtc Zack Rusin
[not found] ` <DM6PR05MB70990327C01C62C72489C001AEBC9@DM6PR05MB7099.namprd05.prod.outlook.com>
2023-03-16 14:25 ` Martin Krastev (VMware)
2023-03-16 17:39 ` Maaz Mombasawala (VMware)
2023-03-16 3:07 ` [igt-dev] ✓ Fi.CI.BAT: success for Add vmwgfx support (rev2) Patchwork
2023-03-16 8:19 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20230316022659.73202-7-zack@kde.org \
--to=zack@kde.org \
--cc=banackm@vmware.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=krastevm@vmware.com \
--cc=mombasawalam@vmware.com \
--cc=petri.latvala@intel.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