Skip to contentSkip to conversation

lib/igt_vmwgfx: Add vmwgfx device

PATCH In review Deepak Rawat 4 participants 12 messages Sep 28, 2018 – Oct 1, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 lib/igt_vmwgfx: Add vmwgfx device

Add DRIVER_VMWGFX to represent vmwgfx device for running igt tests.

v2: Don't remove second virtio_gpu

---
 lib/drmtest.c | 8 ++++++++
 lib/drmtest.h | 3 +++
 2 files changed, 11 insertions(+)
lib/drmtest.c +8 -0
index fee9d33a..9d013a00 100644
@@ -105,6 +105,11 @@ bool is_i915_device(int fd)
 	return __is_device(fd, "i915");
 }
 
+bool is_vmwgfx_device(int fd)
+{
+	return __is_device(fd, "vmwg");
+}
+
 static bool has_known_intel_chipset(int fd)
 {
 	struct drm_i915_getparam gp;
@@ -206,6 +211,7 @@ static const struct module {
 	{ DRIVER_VGEM, "vgem" },
 	{ DRIVER_VIRTIO, "virtio-gpu" },
 	{ DRIVER_VIRTIO, "virtio_gpu" },
+	{ DRIVER_VMWGFX, "vmwgfx" },
 	{}
 };
 
@@ -348,6 +354,8 @@ static const char *chipset_to_str(int chipset)
 		return "virtio";
 	case DRIVER_AMDGPU:
 		return "amdgpu";
+	case DRIVER_VMWGFX:
+		return "vmwgfx";
 	case DRIVER_ANY:
 		return "any";
 	default:
lib/drmtest.h +3 -0
index 949865ee..0213fb51 100644
@@ -43,6 +43,7 @@
 #define DRIVER_VGEM	(1 << 2)
 #define DRIVER_VIRTIO	(1 << 3)
 #define DRIVER_AMDGPU	(1 << 4)
+#define DRIVER_VMWGFX	(1 << 5)
 /*
  * Exclude DRVER_VGEM from DRIVER_ANY since if you run on a system
  * with vgem as well as a supported driver, you can end up with a
@@ -80,6 +81,8 @@ void igt_require_intel(int fd);
 
 bool is_i915_device(int fd);
 
+bool is_vmwgfx_device(int fd);
+
 /**
  * do_or_die:
  * @x: command
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

PATCH 2/7 lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers

vmwgfx does not support GEM interface so calling gem_close on vmwgfx results in error.

v2: Use drmIoctl with error when ioctl() failed.

---
 lib/igt_fb.c  |  5 ++++-
 lib/igt_kms.c | 13 +++++++++++++
 lib/igt_kms.h |  1 +
 3 files changed, 18 insertions(+), 1 deletion(-)
lib/igt_fb.c +4 -1
index 486b5d30..0248637c 100644
@@ -1933,7 +1933,10 @@ void igt_remove_fb(int fd, struct igt_fb *fb)
 
 	cairo_surface_destroy(fb->cairo_surface);
 	do_or_die(drmModeRmFB(fd, fb->fb_id));
-	gem_close(fd, fb->gem_handle);
+	if (fb->is_dumb)
+		kmstest_dumb_destroy(fd, fb->gem_handle);
+	else
+		gem_close(fd, fb->gem_handle);
 	fb->fb_id = 0;
 }
 
lib/igt_kms.c +13 -0
index 4563bfd9..6c6c6441 100644
@@ -639,6 +639,19 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
 	return ptr;
 }
 
+/**
+ * kmstest_dumb_destroy:
+ * @fd: Opened drm file descriptor
+ * @handle: Offset in the file referred to by fd
+ */
+void kmstest_dumb_destroy(int fd, uint32_t handle)
+{
+	struct drm_mode_destroy_dumb arg = { handle };
+
+	if (drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg))
+		igt_warn("Destroying dumb buffer failed.\n");
+}
+
 /*
  * Returns: the previous mode, or KD_GRAPHICS if no /dev/tty0 was
  * found and nothing was done.
lib/igt_kms.h +1 -0
index 3862efa2..5754ac66 100644
@@ -222,6 +222,7 @@ uint32_t kmstest_dumb_create(int fd, int width, int height, int bpp,
 
 void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
 			      unsigned prot);
+void kmstest_dumb_destroy(int fd, uint32_t handle);
 void kmstest_wait_for_pageflip(int fd);
 unsigned int kmstest_get_vblank(int fd, int pipe, unsigned int flags);
 void igt_assert_plane_visible(int fd, enum pipe pipe, bool visibility);
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw

Re: [igt-dev] [PATCH i-g-t 2/7] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers

Quoting Deepak Rawat (2018-09-28 01:43:45)

Quoted 37 lines

vmwgfx does not support GEM interface so calling gem_close on vmwgfx results in error.

v2: Use drmIoctl with error when ioctl() failed.

---
 lib/igt_fb.c  |  5 ++++-
 lib/igt_kms.c | 13 +++++++++++++
 lib/igt_kms.h |  1 +
 3 files changed, 18 insertions(+), 1 deletion(-)
lib/igt_fb.c +4 -1
index 486b5d30..0248637c 100644
@@ -1933,7 +1933,10 @@ void igt_remove_fb(int fd, struct igt_fb *fb)
 
        cairo_surface_destroy(fb->cairo_surface);
        do_or_die(drmModeRmFB(fd, fb->fb_id));
-       gem_close(fd, fb->gem_handle);
+       if (fb->is_dumb)
+               kmstest_dumb_destroy(fd, fb->gem_handle);
+       else
+               gem_close(fd, fb->gem_handle);
        fb->fb_id = 0;
 }
 
lib/igt_kms.c +1 -0
index 4563bfd9..6c6c6441 100644
@@ -639,6 +639,19 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
        return ptr;
 }
 
+/**

lib/igt_kms.c void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size, · line 652

Quoted 10 lines
lib/igt_kms.c +10 -0
+ * kmstest_dumb_destroy:
+ * @fd: Opened drm file descriptor
+ * @handle: Offset in the file referred to by fd
+ */
+void kmstest_dumb_destroy(int fd, uint32_t handle)
+{
+       struct drm_mode_destroy_dumb arg = { handle };
+
+       if (drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg))
+               igt_warn("Destroying dumb buffer failed.\n");

The sop is to

int __kmstest_dumb_destroy() (why would this be kmstest if it is just a kms ioctl wrapper???)

{
	int err = 0;

	if (drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &handle))
		err = -errno;
	
	errno = 0;
	return err;
}

void kmstest_dumb_destroy(int fd, u32 handle)

{
	igt_assert_eq(__kmstest_dumb_destroy(fd, handle), 0);
}

-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

PATCH 3/7 lib/igt_fb: Check for cairo surface success

In reply to Deepak Rawat

For vmwgfx cairo surface creation fails due to stride mismatch, add a igt_require_f() for surface.

v2: Check for surface creation failure.

---
 lib/igt_fb.c | 3 +++
 1 file changed, 3 insertions(+)
lib/igt_fb.c +3 -0
index 0248637c..0485708b 100644
@@ -1370,6 +1370,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 		cairo_image_surface_create_for_data(ptr,
 						    drm_format_to_cairo(fb->drm_format),
 						    fb->width, fb->height, fb->stride);
+	igt_require_f(cairo_surface_status(fb->cairo_surface) == CAIRO_STATUS_SUCCESS,
+		      "Unable to create a cairo surface: %s\n",
+		      cairo_status_to_string(cairo_surface_status(fb->cairo_surface)));
 	fb->domain = I915_GEM_DOMAIN_GTT;
 
 	cairo_surface_set_user_data(fb->cairo_surface,
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 4/7 lib/igt_fb: Don't call gem_set_domain() for dumb buffer

In reply to Deepak Rawat

gem_set_domain() is gem specific and not needed for dumb buffers.

---
 lib/igt_fb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/igt_fb.c +4 -4
index 0485708b..74a4b501 100644
@@ -1356,15 +1356,15 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 {
 	void *ptr;
 
-	gem_set_domain(fd, fb->gem_handle,
-		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
-
 	if (fb->is_dumb)
 		ptr = kmstest_dumb_map_buffer(fd, fb->gem_handle, fb->size,
 					      PROT_READ | PROT_WRITE);
-	else
+	else {
+		gem_set_domain(fd, fb->gem_handle,
+			       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
 		ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
 				    PROT_READ | PROT_WRITE);
+	}
 
 	fb->cairo_surface =
 		cairo_image_surface_create_for_data(ptr,
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#5 lore raw

Re: [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: Don't call gem_set_domain() for dumb buffer

Quoting Deepak Rawat (2018-09-28 01:43:47)

Quoted 12 lines

gem_set_domain() is gem specific and not needed for dumb buffers.

---
 lib/igt_fb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/igt_fb.c +0 -0
index 0485708b..74a4b501 100644

lib/igt_fb.c static void create_cairo_surface__gtt(int fd, struct igt_fb *fb) · line 1359

Quoted 7 lines
lib/igt_fb.c +0 -3
@@ -1356,15 +1356,15 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 {
        void *ptr;
 
-       gem_set_domain(fd, fb->gem_handle,
-                      I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
-
        if (fb->is_dumb)

Kernel CODING_STYLE: if one branch need braces, apply them to all. -Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#6 lore raw

PATCH 5/7 lib: Don't call igt_require_fb_modifiers() when no modifier

In reply to Deepak Rawat

vmwgfx doesn't support fb modifier so skip igt_require_fb_modifiers() when modifier are not passed.

---
 lib/ioctl_wrappers.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
lib/ioctl_wrappers.c +4 -1
index 0929c43f..3a11cb6e 100644
@@ -1678,7 +1678,10 @@ int __kms_addfb(int fd, uint32_t handle,
 	struct drm_mode_fb_cmd2 f;
 	int ret, i;
 
-	igt_require_fb_modifiers(fd);
+	if (modifier)
+		igt_require_fb_modifiers(fd);
+	else
+		flags &= ~DRM_MODE_FB_MODIFIERS;
 
 	memset(&f, 0, sizeof(f));
 
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#7 lore raw

PATCH 6/7 tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property

In reply to Deepak Rawat

Some simple test cases to use FB_DAMAGE_CLIPS plane property.

---
 lib/igt_kms.c      |   1 +
 lib/igt_kms.h      |   1 +
 tests/kms_atomic.c | 260 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 262 insertions(+)
lib/igt_kms.c +1 -0
index 6c6c6441..2de4b35c 100644
@@ -175,6 +175,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	[IGT_PLANE_IN_FORMATS] = "IN_FORMATS",
 	[IGT_PLANE_COLOR_ENCODING] = "COLOR_ENCODING",
 	[IGT_PLANE_COLOR_RANGE] = "COLOR_RANGE",
+	[IGT_PLANE_FB_DAMAGE_CLIPS] = "FB_DAMAGE_CLIPS",
 };
 
 const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
lib/igt_kms.h +1 -0
index 5754ac66..bee0b7e4 100644
@@ -267,6 +267,7 @@ enum igt_atomic_plane_properties {
        IGT_PLANE_IN_FORMATS,
        IGT_PLANE_COLOR_ENCODING,
        IGT_PLANE_COLOR_RANGE,
+       IGT_PLANE_FB_DAMAGE_CLIPS,
        IGT_NUM_PLANE_PROPS
 };
 
tests/kms_atomic.c +260 -0

278 lines not on this page · raw message

Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH 7/7 tests/plane_damage: Integrate kernel selftest test-drm_damage_helper

In reply to Deepak Rawat

Call kernel selftest module test-drm_damage_helper from igt.

---
 tests/Makefile.sources   |  1 +
 tests/drm_plane_damage.c | 10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 tests/drm_plane_damage.c
tests/Makefile.sources +1 -0
index 269336ad..31ea8819 100644
@@ -229,6 +229,7 @@ TESTS_progs = \
 	tools_test \
 	vgem_basic \
 	vgem_slow \
+	drm_plane_damage \
 	$(NULL)
 
 TESTS_progs_X = \
tests/drm_plane_damage.c new file +10 -0
new file mode 100644
index 00000000..c2b793cc
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include "igt.h"
+#include "igt_kmod.h"
+
+IGT_TEST_DESCRIPTION("Basic sanity check of DRM's plane damage helper iterator.");
+
+igt_main
+{
+	igt_kselftests("test-drm_damage_helper", NULL, NULL, NULL);
+}
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#9 lore raw

Re: [igt-dev] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper

Quoting Deepak Rawat (2018-09-28 01:43:50)

Quoted 14 lines

Call kernel selftest module test-drm_damage_helper from igt.

---
 tests/Makefile.sources   |  1 +
 tests/drm_plane_damage.c | 10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 tests/drm_plane_damage.c
tests/Makefile.sources +0 -0
index 269336ad..31ea8819 100644

tests/Makefile.sources TESTS_progs = \ · line 232

Quoted 4 lines
tests/Makefile.sources +1 -0
@@ -229,6 +229,7 @@ TESTS_progs = \
        tools_test \
        vgem_basic \
        vgem_slow \
+       drm_plane_damage \

Alphabetical, please.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#10 lore raw

Re: [Intel-gfx] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper

In reply to Deepak Rawat
Quoted 14 lines · Deepak Rawat

Call kernel selftest module test-drm_damage_helper from igt.

---
 tests/Makefile.sources   |  1 +
 tests/drm_plane_damage.c | 10 ++++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 tests/drm_plane_damage.c
tests/Makefile.sources +0 -0
index 269336ad..31ea8819 100644

tests/Makefile.sources TESTS_progs = \ · line 233

Quoted 5 lines
tests/Makefile.sources +1 -0
@@ -229,6 +229,7 @@ TESTS_progs = \
 	tools_test \
 	vgem_basic \
 	vgem_slow \
+	drm_plane_damage \
 	$(NULL)

Alphabetical, as Chris said. And the corresponding change to meson.build too.

Quoted 8 lines
tests/Makefile.sources +0 -0
 TESTS_progs_X = \
tests/drm_plane_damage.c new file +0 -0
new file mode 100644
index 00000000..c2b793cc

tests/drm_plane_damage.c line 10

Quoted 10 lines
tests/drm_plane_damage.c new file +10 -0
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include "igt.h"
+#include "igt_kmod.h"
+
+IGT_TEST_DESCRIPTION("Basic sanity check of DRM's plane damage helper iterator.");
+
+igt_main
+{
+	igt_kselftests("test-drm_damage_helper", NULL, NULL, NULL);
+}

This test also needs whitelisting in tests/igt_command_line.sh similar to drv_selftest and drm_mm.

Quoted 3 lines
Signature · 1 line
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/7] lib/igt_vmwgfx: Add vmwgfx device

In reply to Deepak Rawat
== Series Details ==

== Series Details ==

Series: series starting with [i-g-t,1/7] lib/igt_vmwgfx: Add vmwgfx device
URL : https://patchwork.freedesktop.org/series/50298/
State : failure

== Summary ==

Applying: lib/igt_vmwgfx: Add vmwgfx device
Applying: lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
Applying: lib/igt_fb: Check for cairo surface success
Patch failed at 0003 lib/igt_fb: Check for cairo surface success Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev