diff mbox

[i-g-t,3/9] lib/kms: Add igt_display_commit2()

Message ID 1404171870-10206-4-git-send-email-matthew.d.roper@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Matt Roper June 30, 2014, 11:44 p.m. UTC
Add a new commit interface, igt_display_commit2(), that allows tests to
specify which programming API should be used to perform hardware
updates.  COMMIT_LEGACY is the only option for now, but universal
and atomic interfaces will be added as additional options in the future.

igt_display_commit() remains unchanged for existing tests that wish to
place the hardware in a specific state, but that don't care which API is
used to achieve that state.  The legacy API will be used by default for
now, but in the future we may decide to make the default API
configurable via an environment variable.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 lib/igt_kms.c | 32 +++++++++++++++++++++++++++++++-
 lib/igt_kms.h |  7 +++++++
 2 files changed, 38 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 3f561e9..064b741 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -946,7 +946,21 @@  static int igt_output_commit(igt_output_t *output)
 	return 0;
 }
 
-int igt_display_commit(igt_display_t *display)
+/**
+ * igt_display_commit2:
+ * @display: DRM device handle
+ * @s: Commit style
+ *
+ * Commits framebuffer and positioning changes to all planes of each display
+ * pipe, using a specific API to perform the programming.  This function should
+ * be used to exercise a specific driver programming API; igt_display_commit
+ * should be used instead if the API used is unimportant to the test being run.
+ *
+ * Returns: 0 upon success.  This function will never return upon failure
+ * since igt_fail() at lower levels will longjmp out of it.
+ */
+int igt_display_commit2(igt_display_t *display,
+		       enum igt_commit_style s)
 {
 	int i;
 
@@ -971,6 +985,22 @@  int igt_display_commit(igt_display_t *display)
 	return 0;
 }
 
+/**
+ * igt_display_commit:
+ * @display: DRM device handle
+ * @s: Commit style
+ *
+ * Commits framebuffer and positioning changes to all planes of each display
+ * pipe.
+ *
+ * Returns: 0 upon success.  This function will never return upon failure
+ * since igt_fail() at lower levels will longjmp out of it.
+ */
+int igt_display_commit(igt_display_t *display)
+{
+	return igt_display_commit2(display, COMMIT_LEGACY);
+}
+
 const char *igt_output_name(igt_output_t *output)
 {
 	return output->name;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index a9a4236..62dc73c 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -65,6 +65,12 @@  enum port {
 };
 #define port_name(p) ((p) + 'A')
 
+enum igt_commit_style {
+	COMMIT_LEGACY = 0,
+	COMMIT_UNIVERSAL,
+	/* We'll add atomic here eventually. */
+};
+
 #include "igt_fb.h"
 
 struct kmstest_connector_config {
@@ -150,6 +156,7 @@  void igt_set_vt_graphics_mode(void);
 
 void igt_display_init(igt_display_t *display, int drm_fd);
 void igt_display_fini(igt_display_t *display);
+int  igt_display_commit2(igt_display_t *display, enum igt_commit_style s);
 int  igt_display_commit(igt_display_t *display);
 int  igt_display_get_n_pipes(igt_display_t *display);