* [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device
@ 2018-09-28 0:43 Deepak Rawat
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers Deepak Rawat
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Deepak Rawat @ 2018-09-28 0:43 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.
v2: Don't remove second virtio_gpu
Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
lib/drmtest.c | 8 ++++++++
lib/drmtest.h | 3 +++
2 files changed, 11 insertions(+)
diff --git a/lib/drmtest.c b/lib/drmtest.c
index fee9d33a..9d013a00 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;
@@ -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:
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] 12+ messages in thread
* [igt-dev] [PATCH i-g-t 2/7] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
2018-09-28 0:43 [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
@ 2018-09-28 0:43 ` Deepak Rawat
2018-09-28 11:23 ` Chris Wilson
2018-09-28 0:43 ` [Intel-gfx] [PATCH i-g-t 3/7] lib/igt_fb: Check for cairo surface success Deepak Rawat
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Deepak Rawat @ 2018-09-28 0:43 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.
v2: Use drmIoctl with error when ioctl() failed.
Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
lib/igt_fb.c | 5 ++++-
lib/igt_kms.c | 13 +++++++++++++
lib/igt_kms.h | 1 +
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 486b5d30..0248637c 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -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;
}
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 4563bfd9..6c6c6441 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -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.
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 3862efa2..5754ac66 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] 12+ messages in thread
* [Intel-gfx] [PATCH i-g-t 3/7] lib/igt_fb: Check for cairo surface success
2018-09-28 0:43 [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers Deepak Rawat
@ 2018-09-28 0:43 ` Deepak Rawat
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: Don't call gem_set_domain() for dumb buffer Deepak Rawat
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Deepak Rawat @ 2018-09-28 0:43 UTC (permalink / raw)
To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
Cc: 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.
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 0248637c..0485708b 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -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,
--
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] 12+ messages in thread
* [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: Don't call gem_set_domain() for dumb buffer
2018-09-28 0:43 [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers Deepak Rawat
2018-09-28 0:43 ` [Intel-gfx] [PATCH i-g-t 3/7] lib/igt_fb: Check for cairo surface success Deepak Rawat
@ 2018-09-28 0:43 ` Deepak Rawat
2018-09-28 11:19 ` Chris Wilson
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 5/7] lib: Don't call igt_require_fb_modifiers() when no modifier Deepak Rawat
` (3 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Deepak Rawat @ 2018-09-28 0:43 UTC (permalink / raw)
To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
Cc: Deepak Rawat
gem_set_domain() is gem specific and not needed for dumb buffers.
Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
lib/igt_fb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 0485708b..74a4b501 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -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,
--
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] 12+ messages in thread
* [igt-dev] [PATCH i-g-t 5/7] lib: Don't call igt_require_fb_modifiers() when no modifier
2018-09-28 0:43 [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
` (2 preceding siblings ...)
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: Don't call gem_set_domain() for dumb buffer Deepak Rawat
@ 2018-09-28 0:43 ` Deepak Rawat
2018-09-28 0:43 ` [Intel-gfx] [PATCH i-g-t 6/7] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property Deepak Rawat
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Deepak Rawat @ 2018-09-28 0:43 UTC (permalink / raw)
To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
Cc: Deepak Rawat
vmwgfx doesn't support fb modifier so skip igt_require_fb_modifiers()
when modifier are not passed.
Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
lib/ioctl_wrappers.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 0929c43f..3a11cb6e 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -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));
--
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] 12+ messages in thread
* [Intel-gfx] [PATCH i-g-t 6/7] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property
2018-09-28 0:43 [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
` (3 preceding siblings ...)
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 5/7] lib: Don't call igt_require_fb_modifiers() when no modifier Deepak Rawat
@ 2018-09-28 0:43 ` Deepak Rawat
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper Deepak Rawat
2018-09-28 0:56 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/7] lib/igt_vmwgfx: Add vmwgfx device Patchwork
6 siblings, 0 replies; 12+ messages in thread
From: Deepak Rawat @ 2018-09-28 0:43 UTC (permalink / raw)
To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
Cc: Deepak Rawat
Some simple test cases to use FB_DAMAGE_CLIPS plane property.
Signed-off-by: Deepak Rawat <drawat@vmware.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 6c6c6441..2de4b35c 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 5754ac66..bee0b7e4 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 ac02baf0..8c23af35 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),
@@ -835,6 +853,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);
@@ -951,6 +1203,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] 12+ messages in thread
* [igt-dev] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper
2018-09-28 0:43 [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
` (4 preceding siblings ...)
2018-09-28 0:43 ` [Intel-gfx] [PATCH i-g-t 6/7] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property Deepak Rawat
@ 2018-09-28 0:43 ` Deepak Rawat
2018-09-28 11:20 ` Chris Wilson
2018-10-01 9:31 ` [Intel-gfx] " Petri Latvala
2018-09-28 0:56 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/7] lib/igt_vmwgfx: Add vmwgfx device Patchwork
6 siblings, 2 replies; 12+ messages in thread
From: Deepak Rawat @ 2018-09-28 0:43 UTC (permalink / raw)
To: igt-dev, intel-gfx, linux-graphics-maintainer, thellstrom, syeh
Cc: Deepak Rawat
Call kernel selftest module test-drm_damage_helper from igt.
Signed-off-by: Deepak Rawat <drawat@vmware.com>
---
tests/Makefile.sources | 1 +
tests/drm_plane_damage.c | 10 ++++++++++
2 files changed, 11 insertions(+)
create mode 100644 tests/drm_plane_damage.c
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 269336ad..31ea8819 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -229,6 +229,7 @@ TESTS_progs = \
tools_test \
vgem_basic \
vgem_slow \
+ drm_plane_damage \
$(NULL)
TESTS_progs_X = \
diff --git a/tests/drm_plane_damage.c b/tests/drm_plane_damage.c
new file mode 100644
index 00000000..c2b793cc
--- /dev/null
+++ b/tests/drm_plane_damage.c
@@ -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);
+}
--
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] 12+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/7] lib/igt_vmwgfx: Add vmwgfx device
2018-09-28 0:43 [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
` (5 preceding siblings ...)
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper Deepak Rawat
@ 2018-09-28 0:56 ` Patchwork
6 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2018-09-28 0:56 UTC (permalink / raw)
To: Deepak Rawat; +Cc: igt-dev
== 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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: Don't call gem_set_domain() for dumb buffer
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: Don't call gem_set_domain() for dumb buffer Deepak Rawat
@ 2018-09-28 11:19 ` Chris Wilson
0 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2018-09-28 11:19 UTC (permalink / raw)
To: Deepak Rawat, igt-dev, intel-gfx, linux-graphics-maintainer, syeh,
thellstrom
Cc: Deepak Rawat
Quoting Deepak Rawat (2018-09-28 01:43:47)
> gem_set_domain() is gem specific and not needed for dumb buffers.
>
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
> lib/igt_fb.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 0485708b..74a4b501 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper Deepak Rawat
@ 2018-09-28 11:20 ` Chris Wilson
2018-10-01 9:31 ` [Intel-gfx] " Petri Latvala
1 sibling, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2018-09-28 11:20 UTC (permalink / raw)
To: Deepak Rawat, igt-dev, intel-gfx, linux-graphics-maintainer, syeh,
thellstrom
Cc: Deepak Rawat
Quoting Deepak Rawat (2018-09-28 01:43:50)
> Call kernel selftest module test-drm_damage_helper from igt.
>
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
> tests/Makefile.sources | 1 +
> tests/drm_plane_damage.c | 10 ++++++++++
> 2 files changed, 11 insertions(+)
> create mode 100644 tests/drm_plane_damage.c
>
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 269336ad..31ea8819 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -229,6 +229,7 @@ TESTS_progs = \
> tools_test \
> vgem_basic \
> vgem_slow \
> + drm_plane_damage \
Alphabetical, please.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/7] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers Deepak Rawat
@ 2018-09-28 11:23 ` Chris Wilson
0 siblings, 0 replies; 12+ messages in thread
From: Chris Wilson @ 2018-09-28 11:23 UTC (permalink / raw)
To: Deepak Rawat, igt-dev, intel-gfx, linux-graphics-maintainer, syeh,
thellstrom
Cc: Deepak Rawat
Quoting Deepak Rawat (2018-09-28 01:43:45)
> vmwgfx does not support GEM interface so calling gem_close on vmwgfx
> results in error.
>
> v2: Use drmIoctl with error when ioctl() failed.
>
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
> lib/igt_fb.c | 5 ++++-
> lib/igt_kms.c | 13 +++++++++++++
> lib/igt_kms.h | 1 +
> 3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 486b5d30..0248637c 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -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;
> }
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 4563bfd9..6c6c6441 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -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");
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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper Deepak Rawat
2018-09-28 11:20 ` Chris Wilson
@ 2018-10-01 9:31 ` Petri Latvala
1 sibling, 0 replies; 12+ messages in thread
From: Petri Latvala @ 2018-10-01 9:31 UTC (permalink / raw)
To: Deepak Rawat
Cc: thellstrom, syeh, intel-gfx, igt-dev, linux-graphics-maintainer
On Thu, Sep 27, 2018 at 05:43:50PM -0700, Deepak Rawat wrote:
> Call kernel selftest module test-drm_damage_helper from igt.
>
> Signed-off-by: Deepak Rawat <drawat@vmware.com>
> ---
> tests/Makefile.sources | 1 +
> tests/drm_plane_damage.c | 10 ++++++++++
> 2 files changed, 11 insertions(+)
> create mode 100644 tests/drm_plane_damage.c
>
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 269336ad..31ea8819 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -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.
>
> TESTS_progs_X = \
> diff --git a/tests/drm_plane_damage.c b/tests/drm_plane_damage.c
> new file mode 100644
> index 00000000..c2b793cc
> --- /dev/null
> +++ b/tests/drm_plane_damage.c
> @@ -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.
> --
> 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] 12+ messages in thread
end of thread, other threads:[~2018-10-01 9:31 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28 0:43 [igt-dev] [PATCH i-g-t 1/7] lib/igt_vmwgfx: Add vmwgfx device Deepak Rawat
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_fb: Call dumb_destroy ioctl in case of dumb buffers Deepak Rawat
2018-09-28 11:23 ` Chris Wilson
2018-09-28 0:43 ` [Intel-gfx] [PATCH i-g-t 3/7] lib/igt_fb: Check for cairo surface success Deepak Rawat
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 4/7] lib/igt_fb: Don't call gem_set_domain() for dumb buffer Deepak Rawat
2018-09-28 11:19 ` Chris Wilson
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 5/7] lib: Don't call igt_require_fb_modifiers() when no modifier Deepak Rawat
2018-09-28 0:43 ` [Intel-gfx] [PATCH i-g-t 6/7] tests/kms_atomic: Add a new test case for FB_DAMAGE_CLIPS plane property Deepak Rawat
2018-09-28 0:43 ` [igt-dev] [PATCH i-g-t 7/7] tests/plane_damage: Integrate kernel selftest test-drm_damage_helper Deepak Rawat
2018-09-28 11:20 ` Chris Wilson
2018-10-01 9:31 ` [Intel-gfx] " Petri Latvala
2018-09-28 0:56 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/7] lib/igt_vmwgfx: Add vmwgfx device Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox