All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/5] vmwgfx as a new driver for igt-gpu-tools
@ 2018-09-06  0:03 ` Deepak Rawat
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

Hi,

With this patch series adding vmwgfx as new driver for igt-gpu-tools and some
changes to make kms_atomic test case work for vmwgfx. For now the main
motivation for this was page-flip with damage test case to test the new plane
property FB_DAMAGE_CLIPS. However, will be adding more vmwgfx specific tests in
future.

Thanks,
Deepak

Deepak Rawat (5):
  lib/igt_vmwgfx: Add vmwgfx device
  lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
  tests/kms: Don't check crtc state for vmwgfx legacy set_crtc
  lib/igt_fb: Check for stride before creating cairo surface
  tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane
    property

 lib/drmtest.c      |   9 +-
 lib/drmtest.h      |   3 +
 lib/igt_fb.c       |   8 +-
 lib/igt_kms.c      |  16 +++
 lib/igt_kms.h      |   2 +
 tests/kms_atomic.c | 267 ++++++++++++++++++++++++++++++++++++++++++++-
 6 files changed, 302 insertions(+), 3 deletions(-)

-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [igt-dev] [PATCH i-g-t 0/5] vmwgfx as a new driver for igt-gpu-tools
@ 2018-09-06  0:03 ` Deepak Rawat
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

Hi,

With this patch series adding vmwgfx as new driver for igt-gpu-tools and some
changes to make kms_atomic test case work for vmwgfx. For now the main
motivation for this was page-flip with damage test case to test the new plane
property FB_DAMAGE_CLIPS. However, will be adding more vmwgfx specific tests in
future.

Thanks,
Deepak

Deepak Rawat (5):
  lib/igt_vmwgfx: Add vmwgfx device
  lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
  tests/kms: Don't check crtc state for vmwgfx legacy set_crtc
  lib/igt_fb: Check for stride before creating cairo surface
  tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane
    property

 lib/drmtest.c      |   9 +-
 lib/drmtest.h      |   3 +
 lib/igt_fb.c       |   8 +-
 lib/igt_kms.c      |  16 +++
 lib/igt_kms.h      |   2 +
 tests/kms_atomic.c | 267 ++++++++++++++++++++++++++++++++++++++++++++-
 6 files changed, 302 insertions(+), 3 deletions(-)

-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH i-g-t 1/5] lib/igt_vmwgfx: Add vmwgfx device
  2018-09-06  0:03 ` [igt-dev] " Deepak Rawat
@ 2018-09-06  0:03   ` Deepak Rawat
  -1 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

Add DRIVER_VMWGFX to represent vmwgfx device for running igt tests.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
 lib/drmtest.c | 9 ++++++++-
 lib/drmtest.h | 3 +++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index bfa2e0f0..563d5b8b 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -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;
@@ -205,7 +210,7 @@ static const struct module {
 	{ DRIVER_VC4, "vc4" },
 	{ DRIVER_VGEM, "vgem" },
 	{ DRIVER_VIRTIO, "virtio-gpu" },
-	{ DRIVER_VIRTIO, "virtio_gpu" },
+	{ DRIVER_VMWGFX, "vmwgfx" },
 	{}
 };
 
@@ -335,6 +340,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:
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 949865ee..0213fb51 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -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
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [igt-dev] [PATCH i-g-t 1/5] lib/igt_vmwgfx: Add vmwgfx device
@ 2018-09-06  0:03   ` Deepak Rawat
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

Add DRIVER_VMWGFX to represent vmwgfx device for running igt tests.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
 lib/drmtest.c | 9 ++++++++-
 lib/drmtest.h | 3 +++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index bfa2e0f0..563d5b8b 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -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;
@@ -205,7 +210,7 @@ static const struct module {
 	{ DRIVER_VC4, "vc4" },
 	{ DRIVER_VGEM, "vgem" },
 	{ DRIVER_VIRTIO, "virtio-gpu" },
-	{ DRIVER_VIRTIO, "virtio_gpu" },
+	{ DRIVER_VMWGFX, "vmwgfx" },
 	{}
 };
 
@@ -335,6 +340,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:
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 949865ee..0213fb51 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -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
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
  2018-09-06  0:03 ` [igt-dev] " Deepak Rawat
@ 2018-09-06  0:03   ` Deepak Rawat
  -1 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

vmwgfx does not support GEM interface so calling gem_close on vmwgfx
results in error. Call dumb destroy IOCTL in case have dumb buffer.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
 lib/igt_fb.c  |  5 ++++-
 lib/igt_kms.c | 15 +++++++++++++++
 lib/igt_kms.h |  1 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d967..ba995a1a 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1920,7 +1920,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;
 }
 
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 62d84684..9e9414cf 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -639,6 +639,21 @@ 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 = {};
+
+	igt_assert_neq(handle, 0);
+
+	arg.handle = handle;
+	do_ioctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);
+}
+
 /*
  * Returns: the previous mode, or KD_GRAPHICS if no /dev/tty0 was
  * found and nothing was done.
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 3a12f278..bd0c0f09 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -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);
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [igt-dev] [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
@ 2018-09-06  0:03   ` Deepak Rawat
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

vmwgfx does not support GEM interface so calling gem_close on vmwgfx
results in error. Call dumb destroy IOCTL in case have dumb buffer.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
 lib/igt_fb.c  |  5 ++++-
 lib/igt_kms.c | 15 +++++++++++++++
 lib/igt_kms.h |  1 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ae71d967..ba995a1a 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1920,7 +1920,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;
 }
 
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 62d84684..9e9414cf 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -639,6 +639,21 @@ 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 = {};
+
+	igt_assert_neq(handle, 0);
+
+	arg.handle = handle;
+	do_ioctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);
+}
+
 /*
  * Returns: the previous mode, or KD_GRAPHICS if no /dev/tty0 was
  * found and nothing was done.
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 3a12f278..bd0c0f09 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -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);
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH i-g-t 3/5] tests/kms: Don't check crtc state for vmwgfx legacy set_crtc
  2018-09-06  0:03 ` [igt-dev] " Deepak Rawat
@ 2018-09-06  0:03   ` Deepak Rawat
  -1 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

For a Xorg bug vmwgfx has a kernel workaround which reset the value of
mode::type. This will cause crtc state not to match what is expected.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
 tests/kms_atomic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index ac02baf0..72714e12 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -237,7 +237,12 @@ static void crtc_commit(igt_pipe_t *pipe, igt_plane_t *plane,
 {
 	igt_display_commit2(pipe->display, s);
 
-	crtc_check_current_state(pipe, pipe->values, plane->values, relax);
+	/*
+	 * For a vmwgfx xorg driver bug kernel module reset the value of
+	 * mode::type so crtc state check fails for legacy commit
+	 */
+	if (!is_vmwgfx_device(pipe->display->drm_fd) || !(s == COMMIT_LEGACY))
+		crtc_check_current_state(pipe, pipe->values, plane->values, relax);
 	plane_check_current_state(plane, plane->values, relax);
 }
 
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Intel-gfx] [PATCH i-g-t 3/5] tests/kms: Don't check crtc state for vmwgfx legacy set_crtc
@ 2018-09-06  0:03   ` Deepak Rawat
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

For a Xorg bug vmwgfx has a kernel workaround which reset the value of
mode::type. This will cause crtc state not to match what is expected.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
 tests/kms_atomic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index ac02baf0..72714e12 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -237,7 +237,12 @@ static void crtc_commit(igt_pipe_t *pipe, igt_plane_t *plane,
 {
 	igt_display_commit2(pipe->display, s);
 
-	crtc_check_current_state(pipe, pipe->values, plane->values, relax);
+	/*
+	 * For a vmwgfx xorg driver bug kernel module reset the value of
+	 * mode::type so crtc state check fails for legacy commit
+	 */
+	if (!is_vmwgfx_device(pipe->display->drm_fd) || !(s == COMMIT_LEGACY))
+		crtc_check_current_state(pipe, pipe->values, plane->values, relax);
 	plane_check_current_state(plane, plane->values, relax);
 }
 
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface
  2018-09-06  0:03 ` [igt-dev] " Deepak Rawat
@ 2018-09-06  0:03   ` Deepak Rawat
  -1 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

Cairo surface creation will fail if stride of provided buffer is not
same as expected by cairo. This fails for vmwgfx odd length framebuffer
as in vmwgfx stride is always width * bpp.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
 lib/igt_fb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ba995a1a..2724e323 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1349,6 +1349,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 		ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
 				    PROT_READ | PROT_WRITE);
 
+	igt_require(fb->stride == cairo_format_stride_for_width(
+		drm_format_to_cairo(fb->drm_format), fb->width));
+
 	fb->cairo_surface =
 		cairo_image_surface_create_for_data(ptr,
 						    drm_format_to_cairo(fb->drm_format),
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [igt-dev] [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface
@ 2018-09-06  0:03   ` Deepak Rawat
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Deepak Rawat

Cairo surface creation will fail if stride of provided buffer is not
same as expected by cairo. This fails for vmwgfx odd length framebuffer
as in vmwgfx stride is always width * bpp.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
 lib/igt_fb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ba995a1a..2724e323 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1349,6 +1349,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
 		ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
 				    PROT_READ | PROT_WRITE);
 
+	igt_require(fb->stride == cairo_format_stride_for_width(
+		drm_format_to_cairo(fb->drm_format), fb->width));
+
 	fb->cairo_surface =
 		cairo_image_surface_create_for_data(ptr,
 						    drm_format_to_cairo(fb->drm_format),
-- 
2.17.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH i-g-t 5/5] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property
  2018-09-06  0:03 ` [igt-dev] " Deepak Rawat
@ 2018-09-06  0:03   ` Deepak Rawat
  -1 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: Daniel Vetter, dri-devel, Noralf Trønnes, Deepak Rawat,
	Lukasz Spintzyk

Some simple test cases to use FB_DAMAGE_CLIPS plane property.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Lukasz Spintzyk <lukasz.spintzyk@displaylink.com>
Cc: Rob Clark <robdclark@gmail.com>	
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Dave Airlie <airlied@gmail.com>
---
 lib/igt_kms.c      |   1 +
 lib/igt_kms.h      |   1 +
 tests/kms_atomic.c | 260 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 262 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 9e9414cf..46cd50e1 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -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] = {
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index bd0c0f09..893b7cf5 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -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
 };
 
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 72714e12..4abc0ad5 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -56,6 +56,24 @@
 
 IGT_TEST_DESCRIPTION("Test atomic modesetting API");
 
+/* signed32 drm_mode_rect declared here for use with drm damage for page-flip */
+struct damage_rect {
+	int x1;
+	int y1;
+	int x2;
+	int y2;
+};
+
+static inline int damage_rect_width(struct damage_rect *r)
+{
+	return r->x2 - r->x1;
+}
+
+static inline int damage_rect_height(struct damage_rect *r)
+{
+	return r->y2 - r->y1;
+}
+
 enum kms_atomic_check_relax {
 	ATOMIC_RELAX_NONE = 0,
 	CRTC_RELAX_MODE = (1 << 0),
@@ -840,6 +858,240 @@ static void atomic_invalid_params(igt_pipe_t *pipe,
 	do_ioctl_err(display->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc, EFAULT);
 }
 
+static void atomic_plane_damage(igt_pipe_t *pipe, igt_plane_t *plane, struct igt_fb *fb)
+{
+	struct damage_rect *damage;
+	struct igt_fb fb_1;
+	struct igt_fb fb_2;
+	cairo_t *cr_1;
+	cairo_t *cr_2;
+
+	damage = malloc(sizeof(*damage) * 2);
+	igt_assert(damage);
+
+	/* Color fb with white rect at center */
+	igt_create_color_fb(pipe->display->drm_fd, fb->width, fb->height,
+			    fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2,
+			    &fb_1);
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, fb->width/4, fb->height/4, fb->width/2,
+			fb->height/2, 1.0, 1.0, 1.0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+
+	/*
+	 * Flip the primary plane to new color fb using atomic API and check the
+	 * state.
+	 */
+	igt_plane_set_fb(plane, &fb_1);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Change the color of top left clip from center and issue plane update
+	 * with damage and verify the state.
+	 */
+	damage[0].x1 = 0;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width/2;
+	damage[0].y2 = fb->height/2;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 1.0, 0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage));
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Change the color of top left and bottom right clip from center and
+	 * issue plane update with damage and verify the state.
+	 */
+	damage[0].x1 = 0;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width/2;
+	damage[0].y2 = fb->height/2;
+
+	damage[1].x1 = fb->width/2;
+	damage[1].y1 = fb->height/2;
+	damage[1].x2 = fb->width;
+	damage[1].y2 = fb->height;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 1.0, 0, 1.0);
+	igt_paint_color(cr_1, damage[1].x1, damage[1].y1,
+			damage_rect_width(&damage[1]),
+			damage_rect_height(&damage[1]), 0, 0, 1.0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage) * 2);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue a plane update with damage on a seperate fb with damage to
+	 * upper right clip from center.
+	 */
+	igt_create_color_fb(pipe->display->drm_fd, fb->width, fb->height,
+			    fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2,
+			    &fb_2);
+
+	damage[0].x1 = fb->width/2;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width;
+	damage[0].y2 = fb->height/2;
+
+	cr_2 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_2);
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	cairo_set_source_surface(cr_2, fb_1.cairo_surface, 0, 0);
+	cairo_paint(cr_2);
+	igt_paint_color(cr_2, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 0, 1.0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_2, cr_2);
+	igt_plane_set_fb(plane, &fb_2);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage));
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue plane update with damage with a clip outside of plane src.
+	 * NOTE: This will result in no update on plane as damage is outside, so
+	 * will see no change on the screen.
+	 */
+	/* Reszie fb_1 to be bigger than plane */
+	igt_remove_fb(pipe->display->drm_fd, &fb_1);
+	igt_create_color_fb(pipe->display->drm_fd, fb->width * 2, fb->height,
+			    fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2,
+			    &fb_1);
+
+	damage[0].x1 = fb->width;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width + fb->width/2;
+	damage[0].y2 = fb->height/2;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	cr_2 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_2);
+	cairo_set_source_surface(cr_1, fb_2.cairo_surface, 0, 0);
+	cairo_paint(cr_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 0, 1.0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_2, cr_2);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_set_size(plane, fb->width, fb->height);
+	igt_fb_set_position(&fb_1, plane, 0, 0);
+	igt_fb_set_size(&fb_1, plane, fb->width, fb->height);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage));
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue a plane update with damage with a clip that overlap with plane
+	 * src (Top right from center extending outside src in below case).
+	 * NOTE: Here drm core should take care of intersecting the clip to
+	 * plane src.
+	 */
+	damage[0].x1 = fb->width/2;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width/2 + fb->width;
+	damage[0].y2 = fb->height/2;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 1.0, 1.0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_set_size(plane, fb->width, fb->height);
+	igt_fb_set_position(&fb_1, plane, 0, 0);
+	igt_fb_set_size(&fb_1, plane, fb->width, fb->height);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage));
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue a plane update with damage with two clips one inside plane src
+	 * and one outside
+	 * NOTE: This will result in plane update with clip inside plane src.
+	 */
+	damage[0].x1 = 0;
+	damage[0].y1 = fb->height/2;
+	damage[0].x2 = fb->width/2;
+	damage[0].y2 = fb->height;
+
+	damage[1].x1 = fb->width + fb->width/2;
+	damage[1].y1 = fb->height/2;
+	damage[1].x2 = fb->width * 2;
+	damage[1].y2 = fb->height;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 0, 1.0, 1.0);
+	igt_paint_color(cr_1, damage[1].x1, damage[1].y1,
+			damage_rect_width(&damage[1]),
+			damage_rect_height(&damage[1]), 0, 1.0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_set_size(plane, fb->width, fb->height);
+	igt_fb_set_position(&fb_1, plane, 0, 0);
+	igt_fb_set_size(&fb_1, plane, fb->width, fb->height);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage) * 2);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue a plane update with overlapping damage clips. White rect in
+	 * center overlap partially with top left red rect.
+	 * NOTE: Drm core does not error for overlapping damage clips so if any
+	 * driver does not support overlapping should have their own
+	 * validations.
+	 */
+	damage[0].x1 = 0;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width/2;
+	damage[0].y2 = fb->height/2;
+
+	damage[1].x1 = fb->width/4;
+	damage[1].y1 = fb->height/4;
+	damage[1].x2 = fb->width/4 + fb->width/2;
+	damage[1].y2 = fb->height/4 + fb->height/2;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 1.0, 0, 0);
+	igt_paint_color(cr_1, damage[1].x1, damage[1].y1,
+			damage_rect_width(&damage[1]),
+			damage_rect_height(&damage[1]), 1.0, 1.0, 1.0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_set_size(plane, fb->width, fb->height);
+	igt_fb_set_position(&fb_1, plane, 0, 0);
+	igt_fb_set_size(&fb_1, plane, fb->width, fb->height);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage) * 2);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/* Restore the primary plane */
+	igt_plane_set_fb(plane, fb);
+	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/* Remove the fb created for this test */
+	igt_remove_fb(pipe->display->drm_fd, &fb_1);
+	igt_remove_fb(pipe->display->drm_fd, &fb_2);
+
+	free(damage);
+}
+
 static void atomic_setup(igt_display_t *display, enum pipe pipe, igt_output_t *output, igt_plane_t *primary, struct igt_fb *fb)
 {
 	igt_output_set_pipe(output, pipe);
@@ -956,6 +1208,14 @@ igt_main
 		atomic_invalid_params(pipe_obj, primary, output, &fb);
 	}
 
+	igt_subtest("atomic_plane_damage") {
+		igt_require(igt_plane_has_prop(primary, IGT_PLANE_FB_DAMAGE_CLIPS));
+
+		atomic_setup(&display, pipe, output, primary, &fb);
+
+		atomic_plane_damage(pipe_obj, primary, &fb);
+	}
+
 	igt_fixture {
 		atomic_clear(&display, pipe, primary, output);
 		igt_remove_fb(display.drm_fd, &fb);
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH i-g-t 5/5] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property
@ 2018-09-06  0:03   ` Deepak Rawat
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak Rawat @ 2018-09-06  0:03 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
  Cc: petri.latvala, Daniel Vetter, dri-devel, arkadiusz.hiler,
	Deepak Rawat, Lukasz Spintzyk

Some simple test cases to use FB_DAMAGE_CLIPS plane property.

Signed-off-by: Deepak Rawat <drawat@vmware.com>
Cc: dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Lukasz Spintzyk <lukasz.spintzyk@displaylink.com>
Cc: Rob Clark <robdclark@gmail.com>	
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Dave Airlie <airlied@gmail.com>
---
 lib/igt_kms.c      |   1 +
 lib/igt_kms.h      |   1 +
 tests/kms_atomic.c | 260 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 262 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 9e9414cf..46cd50e1 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -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] = {
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index bd0c0f09..893b7cf5 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -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
 };
 
diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 72714e12..4abc0ad5 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -56,6 +56,24 @@
 
 IGT_TEST_DESCRIPTION("Test atomic modesetting API");
 
+/* signed32 drm_mode_rect declared here for use with drm damage for page-flip */
+struct damage_rect {
+	int x1;
+	int y1;
+	int x2;
+	int y2;
+};
+
+static inline int damage_rect_width(struct damage_rect *r)
+{
+	return r->x2 - r->x1;
+}
+
+static inline int damage_rect_height(struct damage_rect *r)
+{
+	return r->y2 - r->y1;
+}
+
 enum kms_atomic_check_relax {
 	ATOMIC_RELAX_NONE = 0,
 	CRTC_RELAX_MODE = (1 << 0),
@@ -840,6 +858,240 @@ static void atomic_invalid_params(igt_pipe_t *pipe,
 	do_ioctl_err(display->drm_fd, DRM_IOCTL_MODE_ATOMIC, &ioc, EFAULT);
 }
 
+static void atomic_plane_damage(igt_pipe_t *pipe, igt_plane_t *plane, struct igt_fb *fb)
+{
+	struct damage_rect *damage;
+	struct igt_fb fb_1;
+	struct igt_fb fb_2;
+	cairo_t *cr_1;
+	cairo_t *cr_2;
+
+	damage = malloc(sizeof(*damage) * 2);
+	igt_assert(damage);
+
+	/* Color fb with white rect at center */
+	igt_create_color_fb(pipe->display->drm_fd, fb->width, fb->height,
+			    fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2,
+			    &fb_1);
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, fb->width/4, fb->height/4, fb->width/2,
+			fb->height/2, 1.0, 1.0, 1.0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+
+	/*
+	 * Flip the primary plane to new color fb using atomic API and check the
+	 * state.
+	 */
+	igt_plane_set_fb(plane, &fb_1);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Change the color of top left clip from center and issue plane update
+	 * with damage and verify the state.
+	 */
+	damage[0].x1 = 0;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width/2;
+	damage[0].y2 = fb->height/2;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 1.0, 0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage));
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Change the color of top left and bottom right clip from center and
+	 * issue plane update with damage and verify the state.
+	 */
+	damage[0].x1 = 0;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width/2;
+	damage[0].y2 = fb->height/2;
+
+	damage[1].x1 = fb->width/2;
+	damage[1].y1 = fb->height/2;
+	damage[1].x2 = fb->width;
+	damage[1].y2 = fb->height;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 1.0, 0, 1.0);
+	igt_paint_color(cr_1, damage[1].x1, damage[1].y1,
+			damage_rect_width(&damage[1]),
+			damage_rect_height(&damage[1]), 0, 0, 1.0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage) * 2);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue a plane update with damage on a seperate fb with damage to
+	 * upper right clip from center.
+	 */
+	igt_create_color_fb(pipe->display->drm_fd, fb->width, fb->height,
+			    fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2,
+			    &fb_2);
+
+	damage[0].x1 = fb->width/2;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width;
+	damage[0].y2 = fb->height/2;
+
+	cr_2 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_2);
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	cairo_set_source_surface(cr_2, fb_1.cairo_surface, 0, 0);
+	cairo_paint(cr_2);
+	igt_paint_color(cr_2, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 0, 1.0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_2, cr_2);
+	igt_plane_set_fb(plane, &fb_2);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage));
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue plane update with damage with a clip outside of plane src.
+	 * NOTE: This will result in no update on plane as damage is outside, so
+	 * will see no change on the screen.
+	 */
+	/* Reszie fb_1 to be bigger than plane */
+	igt_remove_fb(pipe->display->drm_fd, &fb_1);
+	igt_create_color_fb(pipe->display->drm_fd, fb->width * 2, fb->height,
+			    fb->drm_format, I915_TILING_NONE, 0.2, 0.2, 0.2,
+			    &fb_1);
+
+	damage[0].x1 = fb->width;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width + fb->width/2;
+	damage[0].y2 = fb->height/2;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	cr_2 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_2);
+	cairo_set_source_surface(cr_1, fb_2.cairo_surface, 0, 0);
+	cairo_paint(cr_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 0, 1.0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_2, cr_2);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_set_size(plane, fb->width, fb->height);
+	igt_fb_set_position(&fb_1, plane, 0, 0);
+	igt_fb_set_size(&fb_1, plane, fb->width, fb->height);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage));
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue a plane update with damage with a clip that overlap with plane
+	 * src (Top right from center extending outside src in below case).
+	 * NOTE: Here drm core should take care of intersecting the clip to
+	 * plane src.
+	 */
+	damage[0].x1 = fb->width/2;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width/2 + fb->width;
+	damage[0].y2 = fb->height/2;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 1.0, 1.0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_set_size(plane, fb->width, fb->height);
+	igt_fb_set_position(&fb_1, plane, 0, 0);
+	igt_fb_set_size(&fb_1, plane, fb->width, fb->height);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage));
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue a plane update with damage with two clips one inside plane src
+	 * and one outside
+	 * NOTE: This will result in plane update with clip inside plane src.
+	 */
+	damage[0].x1 = 0;
+	damage[0].y1 = fb->height/2;
+	damage[0].x2 = fb->width/2;
+	damage[0].y2 = fb->height;
+
+	damage[1].x1 = fb->width + fb->width/2;
+	damage[1].y1 = fb->height/2;
+	damage[1].x2 = fb->width * 2;
+	damage[1].y2 = fb->height;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 0, 1.0, 1.0);
+	igt_paint_color(cr_1, damage[1].x1, damage[1].y1,
+			damage_rect_width(&damage[1]),
+			damage_rect_height(&damage[1]), 0, 1.0, 0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_set_size(plane, fb->width, fb->height);
+	igt_fb_set_position(&fb_1, plane, 0, 0);
+	igt_fb_set_size(&fb_1, plane, fb->width, fb->height);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage) * 2);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/*
+	 * Issue a plane update with overlapping damage clips. White rect in
+	 * center overlap partially with top left red rect.
+	 * NOTE: Drm core does not error for overlapping damage clips so if any
+	 * driver does not support overlapping should have their own
+	 * validations.
+	 */
+	damage[0].x1 = 0;
+	damage[0].y1 = 0;
+	damage[0].x2 = fb->width/2;
+	damage[0].y2 = fb->height/2;
+
+	damage[1].x1 = fb->width/4;
+	damage[1].y1 = fb->height/4;
+	damage[1].x2 = fb->width/4 + fb->width/2;
+	damage[1].y2 = fb->height/4 + fb->height/2;
+
+	cr_1 = igt_get_cairo_ctx(pipe->display->drm_fd, &fb_1);
+	igt_paint_color(cr_1, damage[0].x1, damage[0].y1,
+			damage_rect_width(&damage[0]),
+			damage_rect_height(&damage[0]), 1.0, 0, 0);
+	igt_paint_color(cr_1, damage[1].x1, damage[1].y1,
+			damage_rect_width(&damage[1]),
+			damage_rect_height(&damage[1]), 1.0, 1.0, 1.0);
+	igt_put_cairo_ctx(pipe->display->drm_fd, &fb_1, cr_1);
+	igt_plane_set_fb(plane, &fb_1);
+	igt_plane_set_size(plane, fb->width, fb->height);
+	igt_fb_set_position(&fb_1, plane, 0, 0);
+	igt_fb_set_size(&fb_1, plane, fb->width, fb->height);
+	igt_plane_replace_prop_blob(plane, IGT_PLANE_FB_DAMAGE_CLIPS, damage,
+				    sizeof(*damage) * 2);
+	crtc_commit(pipe, plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/* Restore the primary plane */
+	igt_plane_set_fb(plane, fb);
+	plane_commit(plane, COMMIT_ATOMIC, ATOMIC_RELAX_NONE);
+
+	/* Remove the fb created for this test */
+	igt_remove_fb(pipe->display->drm_fd, &fb_1);
+	igt_remove_fb(pipe->display->drm_fd, &fb_2);
+
+	free(damage);
+}
+
 static void atomic_setup(igt_display_t *display, enum pipe pipe, igt_output_t *output, igt_plane_t *primary, struct igt_fb *fb)
 {
 	igt_output_set_pipe(output, pipe);
@@ -956,6 +1208,14 @@ igt_main
 		atomic_invalid_params(pipe_obj, primary, output, &fb);
 	}
 
+	igt_subtest("atomic_plane_damage") {
+		igt_require(igt_plane_has_prop(primary, IGT_PLANE_FB_DAMAGE_CLIPS));
+
+		atomic_setup(&display, pipe, output, primary, &fb);
+
+		atomic_plane_damage(pipe_obj, primary, &fb);
+	}
+
 	igt_fixture {
 		atomic_clear(&display, pipe, primary, output);
 		igt_remove_fb(display.drm_fd, &fb);
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH i-g-t 1/5] lib/igt_vmwgfx: Add vmwgfx device
  2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
@ 2018-09-06  8:42     ` Petri Latvala
  -1 siblings, 0 replies; 25+ messages in thread
From: Petri Latvala @ 2018-09-06  8:42 UTC (permalink / raw)
  To: Deepak Rawat
  Cc: thellstrom, syeh, intel-gfx, igt-dev, linux-graphics-maintainer

On Wed, Sep 05, 2018 at 05:03:46PM -0700, Deepak Rawat wrote:
> Add DRIVER_VMWGFX to represent vmwgfx device for running igt tests.
> 
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
>  lib/drmtest.c | 9 ++++++++-
>  lib/drmtest.h | 3 +++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index bfa2e0f0..563d5b8b 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -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;
> @@ -205,7 +210,7 @@ static const struct module {
>  	{ DRIVER_VC4, "vc4" },
>  	{ DRIVER_VGEM, "vgem" },
>  	{ DRIVER_VIRTIO, "virtio-gpu" },
> -	{ DRIVER_VIRTIO, "virtio_gpu" },
> +	{ DRIVER_VMWGFX, "vmwgfx" },
>  	{}


Don't remove the second virtio-gpu line, there's a reason for it.

.... we should probably add a comment there.


-- 
Petri Latvala
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/5] lib/igt_vmwgfx: Add vmwgfx device
@ 2018-09-06  8:42     ` Petri Latvala
  0 siblings, 0 replies; 25+ messages in thread
From: Petri Latvala @ 2018-09-06  8:42 UTC (permalink / raw)
  To: Deepak Rawat
  Cc: thellstrom, syeh, intel-gfx, igt-dev, linux-graphics-maintainer

On Wed, Sep 05, 2018 at 05:03:46PM -0700, Deepak Rawat wrote:
> Add DRIVER_VMWGFX to represent vmwgfx device for running igt tests.
> 
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
>  lib/drmtest.c | 9 ++++++++-
>  lib/drmtest.h | 3 +++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index bfa2e0f0..563d5b8b 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -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;
> @@ -205,7 +210,7 @@ static const struct module {
>  	{ DRIVER_VC4, "vc4" },
>  	{ DRIVER_VGEM, "vgem" },
>  	{ DRIVER_VIRTIO, "virtio-gpu" },
> -	{ DRIVER_VIRTIO, "virtio_gpu" },
> +	{ DRIVER_VMWGFX, "vmwgfx" },
>  	{}


Don't remove the second virtio-gpu line, there's a reason for it.

.... we should probably add a comment there.


-- 
Petri Latvala
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
  2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
@ 2018-09-06  8:49     ` Chris Wilson
  -1 siblings, 0 replies; 25+ messages in thread
From: Chris Wilson @ 2018-09-06  8:49 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, syeh, thellstrom
  Cc: Deepak Rawat

Quoting Deepak Rawat (2018-09-06 01:03:47)
> vmwgfx does not support GEM interface so calling gem_close on vmwgfx
> results in error. Call dumb destroy IOCTL in case have dumb buffer.
> 
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
>  lib/igt_fb.c  |  5 ++++-
>  lib/igt_kms.c | 15 +++++++++++++++
>  lib/igt_kms.h |  1 +
>  3 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ae71d967..ba995a1a 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1920,7 +1920,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;
>  }
>  
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 62d84684..9e9414cf 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -639,6 +639,21 @@ 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 = {};
> +
> +       igt_assert_neq(handle, 0);

Don't bother doing the kernel's job for it. Abusing the ioctl iface is
the name of the game.

> +       arg.handle = handle;
> +       do_ioctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);

struct drm_mode_destroy_dumb arg = { handle };

Try never to use do_ioctl() if you ever want to debug an error.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
@ 2018-09-06  8:49     ` Chris Wilson
  0 siblings, 0 replies; 25+ messages in thread
From: Chris Wilson @ 2018-09-06  8:49 UTC (permalink / raw)
  To: Deepak Rawat, igt-dev, intel-gfx, linux-graphics-maintainer,
	syeh, thellstrom
  Cc: Deepak Rawat

Quoting Deepak Rawat (2018-09-06 01:03:47)
> vmwgfx does not support GEM interface so calling gem_close on vmwgfx
> results in error. Call dumb destroy IOCTL in case have dumb buffer.
> 
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
>  lib/igt_fb.c  |  5 ++++-
>  lib/igt_kms.c | 15 +++++++++++++++
>  lib/igt_kms.h |  1 +
>  3 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ae71d967..ba995a1a 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1920,7 +1920,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;
>  }
>  
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 62d84684..9e9414cf 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -639,6 +639,21 @@ 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 = {};
> +
> +       igt_assert_neq(handle, 0);

Don't bother doing the kernel's job for it. Abusing the ioctl iface is
the name of the game.

> +       arg.handle = handle;
> +       do_ioctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &arg);

struct drm_mode_destroy_dumb arg = { handle };

Try never to use do_ioctl() if you ever want to debug an error.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/5] tests/kms: Don't check crtc state for vmwgfx legacy set_crtc
  2018-09-06  0:03   ` [Intel-gfx] " Deepak Rawat
@ 2018-09-06  8:54     ` Chris Wilson
  -1 siblings, 0 replies; 25+ messages in thread
From: Chris Wilson @ 2018-09-06  8:54 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, syeh, thellstrom
  Cc: Deepak Rawat

Quoting Deepak Rawat (2018-09-06 01:03:48)
> For a Xorg bug vmwgfx has a kernel workaround which reset the value of
> mode::type. This will cause crtc state not to match what is expected.

Seems suspect, I think we need a stronger reason to accept iface
irregularities.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 3/5] tests/kms: Don't check crtc state for vmwgfx legacy set_crtc
@ 2018-09-06  8:54     ` Chris Wilson
  0 siblings, 0 replies; 25+ messages in thread
From: Chris Wilson @ 2018-09-06  8:54 UTC (permalink / raw)
  To: Deepak Rawat, igt-dev, intel-gfx, linux-graphics-maintainer,
	syeh, thellstrom
  Cc: Deepak Rawat

Quoting Deepak Rawat (2018-09-06 01:03:48)
> For a Xorg bug vmwgfx has a kernel workaround which reset the value of
> mode::type. This will cause crtc state not to match what is expected.

Seems suspect, I think we need a stronger reason to accept iface
irregularities.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface
  2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
@ 2018-09-06  8:58     ` Chris Wilson
  -1 siblings, 0 replies; 25+ messages in thread
From: Chris Wilson @ 2018-09-06  8:58 UTC (permalink / raw)
  To: igt-dev, intel-gfx, linux-graphics-maintainer, syeh, thellstrom
  Cc: Deepak Rawat

Quoting Deepak Rawat (2018-09-06 01:03:49)
> Cairo surface creation will fail if stride of provided buffer is not
> same as expected by cairo. This fails for vmwgfx odd length framebuffer
> as in vmwgfx stride is always width * bpp.
> 
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
>  lib/igt_fb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ba995a1a..2724e323 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1349,6 +1349,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
>                 ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
>                                     PROT_READ | PROT_WRITE);
>  
> +       igt_require(fb->stride == cairo_format_stride_for_width(
> +               drm_format_to_cairo(fb->drm_format), fb->width));
> +
>         fb->cairo_surface =
>                 cairo_image_surface_create_for_data(ptr,
>                                                     drm_format_to_cairo(fb->drm_format),

Is there not a 
igt_require_f/igt_assert_f(cairo_surface_status(fb->cairo_surface) == CAIRO_STATUS_SUCCESS,
"Unable to create a cairo surface: %s", cairo_status_to_string(cairo_surface_status(fb->cairo_surface)));
here?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface
@ 2018-09-06  8:58     ` Chris Wilson
  0 siblings, 0 replies; 25+ messages in thread
From: Chris Wilson @ 2018-09-06  8:58 UTC (permalink / raw)
  To: Deepak Rawat, igt-dev, intel-gfx, linux-graphics-maintainer,
	syeh, thellstrom
  Cc: Deepak Rawat

Quoting Deepak Rawat (2018-09-06 01:03:49)
> Cairo surface creation will fail if stride of provided buffer is not
> same as expected by cairo. This fails for vmwgfx odd length framebuffer
> as in vmwgfx stride is always width * bpp.
> 
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
>  lib/igt_fb.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index ba995a1a..2724e323 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -1349,6 +1349,9 @@ static void create_cairo_surface__gtt(int fd, struct igt_fb *fb)
>                 ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
>                                     PROT_READ | PROT_WRITE);
>  
> +       igt_require(fb->stride == cairo_format_stride_for_width(
> +               drm_format_to_cairo(fb->drm_format), fb->width));
> +
>         fb->cairo_surface =
>                 cairo_image_surface_create_for_data(ptr,
>                                                     drm_format_to_cairo(fb->drm_format),

Is there not a 
igt_require_f/igt_assert_f(cairo_surface_status(fb->cairo_surface) == CAIRO_STATUS_SUCCESS,
"Unable to create a cairo surface: %s", cairo_status_to_string(cairo_surface_status(fb->cairo_surface)));
here?
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for vmwgfx as a new driver for igt-gpu-tools
  2018-09-06  0:03 ` [igt-dev] " Deepak Rawat
                   ` (5 preceding siblings ...)
  (?)
@ 2018-09-06 10:10 ` Patchwork
  -1 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2018-09-06 10:10 UTC (permalink / raw)
  To: Deepak Rawat; +Cc: igt-dev

== Series Details ==

Series: vmwgfx as a new driver for igt-gpu-tools
URL   : https://patchwork.freedesktop.org/series/49239/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4775 -> IGTPW_1801 =

== Summary - WARNING ==

  Minor unknown changes coming with IGTPW_1801 need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1801, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/49239/revisions/1/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in IGTPW_1801:

  === IGT changes ===

    ==== Warnings ====

    igt@kms_busy@basic-flip-a:
      fi-byt-n2820:       PASS -> SKIP +1
      fi-bdw-gvtdvm:      PASS -> SKIP +2
      fi-ivb-3520m:       PASS -> SKIP +2

    igt@kms_busy@basic-flip-b:
      fi-skl-gvtdvm:      PASS -> SKIP +2
      fi-ilk-650:         PASS -> SKIP
      fi-kbl-7500u:       PASS -> SKIP

    igt@kms_cursor_legacy@basic-flip-before-cursor-atomic:
      fi-snb-2520m:       PASS -> SKIP +27

    igt@kms_flip@basic-flip-vs-wf_vblank:
      fi-hsw-peppy:       PASS -> SKIP +36

    igt@kms_pipe_crc_basic@nonblocking-crc-pipe-b:
      fi-bsw-kefka:       PASS -> SKIP +30

    igt@kms_pipe_crc_basic@read-crc-pipe-b:
      fi-byt-clapper:     PASS -> SKIP +29

    igt@kms_psr@sprite_plane_onoff:
      fi-skl-6700hq:      PASS -> SKIP
      fi-kbl-7560u:       PASS -> SKIP
      fi-skl-6600u:       PASS -> SKIP

    igt@pm_rpm@module-reload:
      fi-hsw-4770r:       PASS -> SKIP

    
== Known issues ==

  Here are the changes found in IGTPW_1801 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_module_reload@basic-reload:
      fi-glk-j4005:       PASS -> DMESG-WARN (fdo#106725, fdo#106248)

    igt@drv_module_reload@basic-reload-inject:
      fi-hsw-4770r:       PASS -> DMESG-WARN (fdo#107425)

    igt@kms_psr@primary_page_flip:
      fi-bdw-samus:       PASS -> FAIL (fdo#107336)

    
    ==== Possible fixes ====

    igt@kms_frontbuffer_tracking@basic:
      fi-byt-clapper:     FAIL (fdo#103167) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#107362, fdo#103191) -> SKIP

    igt@kms_psr@cursor_plane_move:
      fi-cnl-psr:         FAIL (fdo#107717) -> PASS

    igt@kms_psr@primary_page_flip:
      fi-cnl-psr:         FAIL (fdo#107336) -> PASS

    igt@kms_psr@sprite_plane_onoff:
      fi-icl-u:           FAIL (fdo#107383) -> SKIP

    igt@pm_rpm@module-reload:
      fi-hsw-peppy:       DMESG-WARN (fdo#107603) -> SKIP

    
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#106248 https://bugs.freedesktop.org/show_bug.cgi?id=106248
  fdo#106725 https://bugs.freedesktop.org/show_bug.cgi?id=106725
  fdo#107336 https://bugs.freedesktop.org/show_bug.cgi?id=107336
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107383 https://bugs.freedesktop.org/show_bug.cgi?id=107383
  fdo#107425 https://bugs.freedesktop.org/show_bug.cgi?id=107425
  fdo#107603 https://bugs.freedesktop.org/show_bug.cgi?id=107603
  fdo#107717 https://bugs.freedesktop.org/show_bug.cgi?id=107717


== Participating hosts (54 -> 48) ==

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-j1900 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 


== Build changes ==

    * IGT: IGT_4630 -> IGTPW_1801

  CI_DRM_4775: 1a2bb6c061217718b972b3f4a74b96b61cf19d0c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1801: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1801/
  IGT_4630: 86686c6e2f7c6f0944bced11550e06d20bc6957f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@kms_atomic@atomic_plane_damage

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1801/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH i-g-t 1/5] lib/igt_vmwgfx: Add vmwgfx device
  2018-09-06  8:42     ` [igt-dev] " Petri Latvala
@ 2018-09-06 10:54       ` Jani Nikula
  -1 siblings, 0 replies; 25+ messages in thread
From: Jani Nikula @ 2018-09-06 10:54 UTC (permalink / raw)
  To: Petri Latvala, Deepak Rawat
  Cc: igt-dev, thellstrom, linux-graphics-maintainer, intel-gfx, syeh

On Thu, 06 Sep 2018, Petri Latvala <petri.latvala@intel.com> wrote:
> On Wed, Sep 05, 2018 at 05:03:46PM -0700, Deepak Rawat wrote:
>> Add DRIVER_VMWGFX to represent vmwgfx device for running igt tests.
>> 
>> Signed-off-by: Deepak Rawat <drawat@vmware.com>
>> ---
>>  lib/drmtest.c | 9 ++++++++-
>>  lib/drmtest.h | 3 +++
>>  2 files changed, 11 insertions(+), 1 deletion(-)
>> 
>> diff --git a/lib/drmtest.c b/lib/drmtest.c
>> index bfa2e0f0..563d5b8b 100644
>> --- a/lib/drmtest.c
>> +++ b/lib/drmtest.c
>> @@ -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;
>> @@ -205,7 +210,7 @@ static const struct module {
>>  	{ DRIVER_VC4, "vc4" },
>>  	{ DRIVER_VGEM, "vgem" },
>>  	{ DRIVER_VIRTIO, "virtio-gpu" },
>> -	{ DRIVER_VIRTIO, "virtio_gpu" },
>> +	{ DRIVER_VMWGFX, "vmwgfx" },
>>  	{}
>
>
> Don't remove the second virtio-gpu line, there's a reason for it.
>
> .... we should probably add a comment there.

Don't keep us in suspense!

Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 1/5] lib/igt_vmwgfx: Add vmwgfx device
@ 2018-09-06 10:54       ` Jani Nikula
  0 siblings, 0 replies; 25+ messages in thread
From: Jani Nikula @ 2018-09-06 10:54 UTC (permalink / raw)
  To: Petri Latvala, Deepak Rawat
  Cc: igt-dev, thellstrom, linux-graphics-maintainer, intel-gfx, syeh

On Thu, 06 Sep 2018, Petri Latvala <petri.latvala@intel.com> wrote:
> On Wed, Sep 05, 2018 at 05:03:46PM -0700, Deepak Rawat wrote:
>> Add DRIVER_VMWGFX to represent vmwgfx device for running igt tests.
>> 
>> Signed-off-by: Deepak Rawat <drawat@vmware.com>
>> ---
>>  lib/drmtest.c | 9 ++++++++-
>>  lib/drmtest.h | 3 +++
>>  2 files changed, 11 insertions(+), 1 deletion(-)
>> 
>> diff --git a/lib/drmtest.c b/lib/drmtest.c
>> index bfa2e0f0..563d5b8b 100644
>> --- a/lib/drmtest.c
>> +++ b/lib/drmtest.c
>> @@ -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;
>> @@ -205,7 +210,7 @@ static const struct module {
>>  	{ DRIVER_VC4, "vc4" },
>>  	{ DRIVER_VGEM, "vgem" },
>>  	{ DRIVER_VIRTIO, "virtio-gpu" },
>> -	{ DRIVER_VIRTIO, "virtio_gpu" },
>> +	{ DRIVER_VMWGFX, "vmwgfx" },
>>  	{}
>
>
> Don't remove the second virtio-gpu line, there's a reason for it.
>
> .... we should probably add a comment there.

Don't keep us in suspense!

Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface
  2018-09-06  8:58     ` [igt-dev] [Intel-gfx] " Chris Wilson
@ 2018-09-06 22:24       ` Deepak Singh Rawat
  -1 siblings, 0 replies; 25+ messages in thread
From: Deepak Singh Rawat @ 2018-09-06 22:24 UTC (permalink / raw)
  To: Chris Wilson, igt-dev, intel-gfx, linux-graphics-maintainer,
	Sinclair Yeh, Thomas Hellstrom

> Quoting Deepak Rawat (2018-09-06 01:03:49)
> > Cairo surface creation will fail if stride of provided buffer is not
> > same as expected by cairo. This fails for vmwgfx odd length framebuffer
> > as in vmwgfx stride is always width * bpp.
> >
> > Signed-off-by: Deepak Rawat <drawat@vmware.com>
> > ---
> >  lib/igt_fb.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> > index ba995a1a..2724e323 100644
> > --- a/lib/igt_fb.c
> > +++ b/lib/igt_fb.c
> > @@ -1349,6 +1349,9 @@ static void create_cairo_surface__gtt(int fd,
> struct igt_fb *fb)
> >                 ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
> >                                     PROT_READ | PROT_WRITE);
> >
> > +       igt_require(fb->stride == cairo_format_stride_for_width(
> > +               drm_format_to_cairo(fb->drm_format), fb->width));
> > +
> >         fb->cairo_surface =
> >                 cairo_image_surface_create_for_data(ptr,
> >                                                     drm_format_to_cairo(fb->drm_format),
> 
> Is there not a
> igt_require_f/igt_assert_f(cairo_surface_status(fb->cairo_surface) ==
> CAIRO_STATUS_SUCCESS,
> "Unable to create a cairo surface: %s",
> cairo_status_to_string(cairo_surface_status(fb->cairo_surface)));
> here?
> -Chris

Thanks Chris for the review.

No there wasn't a check like that but I guess I can add that instead of
checking for stride. 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface
@ 2018-09-06 22:24       ` Deepak Singh Rawat
  0 siblings, 0 replies; 25+ messages in thread
From: Deepak Singh Rawat @ 2018-09-06 22:24 UTC (permalink / raw)
  To: Chris Wilson, igt-dev, intel-gfx, linux-graphics-maintainer,
	Sinclair Yeh, Thomas Hellstrom

> Quoting Deepak Rawat (2018-09-06 01:03:49)
> > Cairo surface creation will fail if stride of provided buffer is not
> > same as expected by cairo. This fails for vmwgfx odd length framebuffer
> > as in vmwgfx stride is always width * bpp.
> >
> > Signed-off-by: Deepak Rawat <drawat@vmware.com>
> > ---
> >  lib/igt_fb.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> > index ba995a1a..2724e323 100644
> > --- a/lib/igt_fb.c
> > +++ b/lib/igt_fb.c
> > @@ -1349,6 +1349,9 @@ static void create_cairo_surface__gtt(int fd,
> struct igt_fb *fb)
> >                 ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
> >                                     PROT_READ | PROT_WRITE);
> >
> > +       igt_require(fb->stride == cairo_format_stride_for_width(
> > +               drm_format_to_cairo(fb->drm_format), fb->width));
> > +
> >         fb->cairo_surface =
> >                 cairo_image_surface_create_for_data(ptr,
> >                                                     drm_format_to_cairo(fb->drm_format),
> 
> Is there not a
> igt_require_f/igt_assert_f(cairo_surface_status(fb->cairo_surface) ==
> CAIRO_STATUS_SUCCESS,
> "Unable to create a cairo surface: %s",
> cairo_status_to_string(cairo_surface_status(fb->cairo_surface)));
> here?
> -Chris

Thanks Chris for the review.

No there wasn't a check like that but I guess I can add that instead of
checking for stride. 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2018-09-06 22:24 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06  0:03 [PATCH i-g-t 0/5] vmwgfx as a new driver for igt-gpu-tools Deepak Rawat
2018-09-06  0:03 ` [igt-dev] " Deepak Rawat
2018-09-06  0:03 ` [PATCH i-g-t 1/5] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
2018-09-06  8:42   ` Petri Latvala
2018-09-06  8:42     ` [igt-dev] " Petri Latvala
2018-09-06 10:54     ` Jani Nikula
2018-09-06 10:54       ` [igt-dev] [Intel-gfx] " Jani Nikula
2018-09-06  0:03 ` [PATCH i-g-t 2/5] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers Deepak Rawat
2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
2018-09-06  8:49   ` Chris Wilson
2018-09-06  8:49     ` Chris Wilson
2018-09-06  0:03 ` [PATCH i-g-t 3/5] tests/kms: Don't check crtc state for vmwgfx legacy set_crtc Deepak Rawat
2018-09-06  0:03   ` [Intel-gfx] " Deepak Rawat
2018-09-06  8:54   ` [igt-dev] " Chris Wilson
2018-09-06  8:54     ` [Intel-gfx] " Chris Wilson
2018-09-06  0:03 ` [PATCH i-g-t 4/5] lib/igt_fb: Check for stride before creating cairo surface Deepak Rawat
2018-09-06  0:03   ` [igt-dev] " Deepak Rawat
2018-09-06  8:58   ` Chris Wilson
2018-09-06  8:58     ` [igt-dev] [Intel-gfx] " Chris Wilson
2018-09-06 22:24     ` Deepak Singh Rawat
2018-09-06 22:24       ` [igt-dev] [Intel-gfx] " Deepak Singh Rawat
2018-09-06  0:03 ` [PATCH i-g-t 5/5] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property Deepak Rawat
2018-09-06  0:03   ` Deepak Rawat
2018-09-06 10:10 ` [igt-dev] ✓ Fi.CI.BAT: success for vmwgfx as a new driver for igt-gpu-tools Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.