All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vandana Kannan <vandana.kannan@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: paulo.r.zanoni@intel.com, rodrigo.vivi@intel.com
Subject: [PATCH 10/10] kms_drrs: Test DRRS entry and exit
Date: Sat, 10 Jan 2015 02:26:05 +0530	[thread overview]
Message-ID: <1420836965-10068-11-git-send-email-vandana.kannan@intel.com> (raw)
In-Reply-To: <1420836965-10068-1-git-send-email-vandana.kannan@intel.com>

This test just display a frame on screen, waits for 1 second to enter DRRS
and displays another frame to exit DRRS.
TODO:- Notify the user about which refresh rate was used at different stages.

Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
---
 tests/Makefile.sources |   1 +
 tests/kms_drrs.c       | 225 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 226 insertions(+)
 mode change 100644 => 100755 tests/Makefile.sources
 create mode 100644 tests/kms_drrs.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
old mode 100644
new mode 100755
index 967dc8f..fbc0977
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -64,6 +64,7 @@ TESTS_progs_M = \
 	gem_write_read_ring_switch \
 	kms_addfb \
 	kms_cursor_crc \
+	kms_drrs \
 	kms_fbc_crc \
 	kms_flip \
 	kms_flip_event_leak \
diff --git a/tests/kms_drrs.c b/tests/kms_drrs.c
new file mode 100644
index 0000000..5a360f3
--- /dev/null
+++ b/tests/kms_drrs.c
@@ -0,0 +1,225 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "drmtest.h"
+#include "igt_debugfs.h"
+#include "igt_kms.h"
+#include "intel_chipset.h"
+#include "intel_batchbuffer.h"
+#include "ioctl_wrappers.h"
+
+IGT_TEST_DESCRIPTION(
+"Performs write operations and then waits for DRRS to be enabled and then "
+"disturbs the contents of the screen once again to disable DRRS.");
+
+typedef struct {
+	int drm_fd;
+	uint32_t devid;
+	uint32_t handle[2];
+	igt_display_t display;
+	igt_output_t *output;
+	enum pipe pipe;
+	igt_plane_t *primary;
+	struct igt_fb fb[2];
+	uint32_t fb_id[2];
+} data_t;
+
+static bool drrs_enabled(data_t *data)
+{
+	FILE *status;
+	char str[64] = {};
+
+	status = igt_debugfs_fopen("i915_drrs_status", "r");
+	igt_assert(status);
+
+	fread(str, sizeof(str) - 1, 1, status);
+	fclose(status);
+	return strstr(str, "DRRS enabled") != NULL;
+}
+
+static bool prepare_crtc(data_t *data)
+{
+	igt_display_t *display = &data->display;
+	igt_output_t *output = data->output;
+
+	/* select the pipe we want to use */
+	igt_output_set_pipe(output, data->pipe);
+	igt_display_commit(display);
+
+	if (!output->valid) {
+		igt_output_set_pipe(output, PIPE_ANY);
+		igt_display_commit(display);
+		return false;
+	}
+
+	return true;
+}
+
+static bool prepare_test(data_t *data)
+{
+	igt_display_t *display = &data->display;
+	igt_output_t *output = data->output;
+	drmModeModeInfo *mode;
+
+	data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
+	mode = igt_output_get_mode(data->output);
+
+	data->fb_id[0] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+			DRM_FORMAT_XRGB8888,
+			I915_TILING_X,
+			0.0, 0.0, 0.0, &data->fb[0]);
+	igt_assert(data->fb_id[0]);
+	data->fb_id[1] = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+			DRM_FORMAT_XRGB8888,
+			I915_TILING_X,
+			0.1, 0.1, 0.1,
+			&data->fb[1]);
+	igt_assert(data->fb_id[1]);
+
+	data->handle[0] = data->fb[0].gem_handle;
+	data->handle[1] = data->fb[1].gem_handle;
+
+	/* scanout = fb[1] */
+	igt_plane_set_fb(data->primary, &data->fb[1]);
+	igt_display_commit(display);
+	usleep(1000000);
+
+	if (!drrs_enabled(data)) {
+		igt_info("DRRS not enabled\n");
+
+		igt_plane_set_fb(data->primary, NULL);
+		igt_output_set_pipe(output, PIPE_ANY);
+		igt_display_commit(display);
+
+		igt_remove_fb(data->drm_fd, &data->fb[0]);
+		igt_remove_fb(data->drm_fd, &data->fb[1]);
+		return false;
+	}
+
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+
+	/* scanout = fb[0] */
+	igt_plane_set_fb(data->primary, &data->fb[0]);
+	igt_display_commit(display);
+	usleep(100000);
+
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+
+	return true;
+}
+
+static void finish_crtc(data_t *data)
+{
+	igt_plane_set_fb(data->primary, NULL);
+	igt_output_set_pipe(data->output, PIPE_ANY);
+	igt_display_commit(&data->display);
+
+	igt_remove_fb(data->drm_fd, &data->fb[0]);
+	igt_remove_fb(data->drm_fd, &data->fb[1]);
+}
+
+static void reset_display(data_t *data)
+{
+	igt_display_t *display = &data->display;
+
+	for_each_connected_output(display, data->output) {
+		if (data->output->valid) {
+			data->primary =  igt_output_get_plane(data->output,
+							IGT_PLANE_PRIMARY);
+			igt_plane_set_fb(data->primary, NULL);
+		}
+		igt_output_set_pipe(data->output, PIPE_ANY);
+	}
+}
+
+static void run_test(data_t *data)
+{
+	igt_display_t *display = &data->display;
+	int valid_tests = 0;
+
+	reset_display(data);
+
+	for_each_connected_output(display, data->output) {
+		for_each_pipe(display, data->pipe) {
+			if (!prepare_crtc(data))
+				continue;
+
+			igt_info("Beginning %s on pipe %s, connector %s\n",
+					igt_subtest_name(),
+					kmstest_pipe_name(data->pipe),
+					igt_output_name(data->output));
+
+			if (!prepare_test(data)) {
+				igt_info("%s on pipe %s, connector %s: SKIPPED\n",
+						igt_subtest_name(),
+						kmstest_pipe_name(data->pipe),
+						igt_output_name(data->output));
+				continue;
+			}
+
+			valid_tests++;
+
+			igt_info("%s on pipe %s, connector %s: PASSED\n",
+					igt_subtest_name(),
+					kmstest_pipe_name(data->pipe),
+					igt_output_name(data->output));
+
+			finish_crtc(data);
+		}
+	}
+
+	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+}
+
+igt_main
+{
+	data_t data = {};
+
+	igt_skip_on_simulation();
+
+	igt_fixture {
+		char buf[64];
+		FILE *status;
+
+		data.drm_fd = drm_open_any_master();
+
+		data.devid = intel_get_drm_devid(data.drm_fd);
+
+		status = igt_debugfs_fopen("i915_drrs_status", "r");
+		igt_require_f(status, "No i915_drrs_status found\n");
+		fread(buf, sizeof(buf), 1, status);
+		fclose(status);
+		buf[sizeof(buf) - 1] = '\0';
+		igt_require_f(!strstr(buf, "disabled"),
+				"DRRS not supported:check VBT/panel caps\n");
+
+		igt_display_init(&data.display, data.drm_fd);
+	}
+
+	run_test(&data);
+
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
+}
-- 
2.0.1

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

  parent reply	other threads:[~2015-01-09 20:37 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09 20:55 [PATCH v3 0/10] eDP DRRS based on frontbuffer tracking Vandana Kannan
2015-01-09 20:55 ` [PATCH 1/10] drm/i915: Modifying structures related to DRRS Vandana Kannan
2015-01-14  1:27   ` Rodrigo Vivi
2015-01-22  6:48     ` Daniel Vetter
2015-01-22 11:35       ` Ramalingam C
2015-01-09 20:55 ` [PATCH 2/10] drm/i915: Initialize DRRS delayed work Vandana Kannan
2015-01-11 12:52   ` Chris Wilson
2015-01-21 11:04     ` Ramalingam C
2015-01-22  9:44       ` [PATCH] " Ramalingam C
2015-01-23 23:24         ` Rodrigo Vivi
2015-01-09 20:55 ` [PATCH 3/10] drm/i915: Enable/disable DRRS Vandana Kannan
2015-01-15 22:46   ` Rodrigo Vivi
2015-01-21 11:15     ` Ramalingam C
2015-01-22  9:47       ` [PATCH] " Ramalingam C
2015-01-23 23:25         ` Rodrigo Vivi
2015-01-26  7:31         ` Daniel Vetter
2015-01-26 19:00           ` Rodrigo Vivi
2015-01-09 20:55 ` [PATCH 4/10] drm/i915: DRRS calls based on frontbuffer Vandana Kannan
2015-01-15 22:49   ` Rodrigo Vivi
2015-01-26  7:44     ` Daniel Vetter
2015-02-11 12:43   ` [PATCH 1/6] drm/i915: Add support for DRRS in intel_dp_set_m_n Ramalingam C
2015-02-11 12:58     ` Ramalingam C
2015-01-09 20:56 ` [PATCH 5/10] drm/i915/bdw: Add support for DRRS to switch RR Vandana Kannan
2015-01-15 23:00   ` Rodrigo Vivi
2015-01-21 11:19     ` Ramalingam C
2015-01-22  9:50       ` [PATCH] " Ramalingam C
2015-01-22 16:40         ` Ramalingam C
2015-01-24  0:00           ` Rodrigo Vivi
2015-02-11 12:48             ` Ramalingam C
2015-01-09 20:56 ` [PATCH 6/10] drm/i915: Support for RR switching on VLV Vandana Kannan
2015-01-15 23:06   ` Rodrigo Vivi
2015-01-09 20:56 ` [PATCH 7/10] drm/i915: Enable eDP DRRS for CHV Vandana Kannan
2015-01-15 23:11   ` Rodrigo Vivi
2015-01-21 12:13     ` Ramalingam C
2015-01-21 15:03       ` Rodrigo Vivi
2015-01-22 10:54         ` Ramalingam C
2015-01-24  0:05   ` Rodrigo Vivi
2015-01-09 20:56 ` [PATCH 8/10] Documentation/drm: DocBook integration for DRRS Vandana Kannan
2015-01-15 23:16   ` Rodrigo Vivi
2015-01-20  9:12     ` Daniel Vetter
2015-01-09 20:56 ` [PATCH 9/10] drm/i915: Add debugfs entry " Vandana Kannan
2015-01-11 12:40   ` Chris Wilson
2015-01-15 23:18     ` Rodrigo Vivi
2015-01-21 12:26       ` Ramalingam C
2015-01-22 16:45         ` [PATCH] " Ramalingam C
2015-01-23 16:03           ` Daniel Vetter
2015-01-23 17:47             ` Ramalingam C
2015-01-23 17:52               ` Ramalingam C
2015-01-24  0:13                 ` Rodrigo Vivi
2015-02-11 12:52                   ` Ramalingam C
2015-01-09 20:56 ` Vandana Kannan [this message]
2015-01-15 23:24   ` [PATCH 10/10] kms_drrs: Test DRRS entry and exit Rodrigo Vivi
2015-01-20  9:11     ` Daniel Vetter
2015-01-21 12:31       ` Ramalingam C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420836965-10068-11-git-send-email-vandana.kannan@intel.com \
    --to=vandana.kannan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.