[Intel-gfx] [PATCH i-g-t 2/5] kms: Add igt_drm_plane_try_commit()

Matt Roper matthew.d.roper at intel.com
Thu May 29 17:09:14 CEST 2014


For some of our tests, we want to make sure that bogus plane programming
attempts fail with the expected error code.  Add
igt_drm_plane_try_commit() that will just return the error code on
failure rather than failing the current subtest.  This lets us test the
return value against the expected error code.

Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
 lib/igt_kms.c | 21 ++++++++++++++++++---
 lib/igt_kms.h |  1 +
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 97e329b..ce6ea87 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -810,7 +810,11 @@ static int igt_cursor_commit(igt_plane_t *plane, igt_output_t *output)
 	return 0;
 }
 
-static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output)
+/*
+ * Attempt to commit a plane; if the DRM call to program the plane fails,
+ * just return an error code (but don't fail the current subtest).
+ */
+int igt_drm_plane_try_commit(igt_plane_t *plane, igt_output_t *output)
 {
 	igt_display_t *display = output->display;
 	igt_pipe_t *pipe;
@@ -842,7 +846,8 @@ static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output)
 				      IGT_FIXED(0,0), /* src_w */
 				      IGT_FIXED(0,0) /* src_h */);
 
-		igt_assert(ret == 0);
+		if (ret)
+			return ret;
 
 		plane->fb_changed = false;
 	} else if (plane->fb_changed || plane->position_changed) {
@@ -866,7 +871,8 @@ static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output)
 				      IGT_FIXED(plane->fb->width,0), /* src_w */
 				      IGT_FIXED(plane->fb->height,0) /* src_h */);
 
-		igt_assert(ret == 0);
+		if (ret)
+			return ret;
 
 		plane->fb_changed = false;
 		plane->position_changed = false;
@@ -876,6 +882,15 @@ static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output)
 	return 0;
 }
 
+static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output)
+{
+	int ret = igt_drm_plane_try_commit(plane, output);
+
+	igt_assert(ret == 0);
+
+	return 0;
+}
+
 static int igt_plane_commit(igt_plane_t *plane, igt_output_t *output)
 {
 	struct igt_display *display = plane->pipe->display;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 4955fc8..2f72a1c 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -157,6 +157,7 @@ void igt_display_use_universal_commits(igt_display_t *display,
 				       bool use_universal);
 int  igt_display_commit(igt_display_t *display);
 int  igt_display_get_n_pipes(igt_display_t *display);
+int  igt_drm_plane_try_commit(igt_plane_t *plane, igt_output_t *output);
 
 const char *igt_output_name(igt_output_t *output);
 drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
-- 
1.8.5.1




More information about the Intel-gfx mailing list