public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/2] tests/testdisplay: Allow testing aspect ratios
Date: Thu, 20 Jun 2019 18:58:30 +0300	[thread overview]
Message-ID: <20190620155830.20500-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20190620155830.20500-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a new knob "-A" to enable the aspect ratio client cap
and thus test modes with potentially different aspect ratios.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tests/testdisplay.c | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 32590547e9f8..2fdc0236984b 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -80,7 +80,7 @@ struct termios saved_tio;
 drmModeRes *resources;
 int drm_fd, modes;
 int test_all_modes = 0, test_preferred_mode = 0, force_mode = 0, test_plane,
-    test_stereo_modes;
+    test_stereo_modes, test_aspect_ratio;
 uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
 int sleep_between_modes = 0;
 int do_dpms = 0; /* This aliases to DPMS_ON */
@@ -248,6 +248,24 @@ static void paint_image(cairo_t *cr, const char *file)
 	igt_paint_image(cr, file, img_x, img_y, img_h, img_w);
 }
 
+static const char *picture_aspect_ratio_str(uint32_t flags)
+{
+	switch (flags & DRM_MODE_FLAG_PIC_AR_MASK) {
+	case DRM_MODE_FLAG_PIC_AR_NONE:
+		return "";
+	case DRM_MODE_FLAG_PIC_AR_4_3:
+		return "(4:3) ";
+	case DRM_MODE_FLAG_PIC_AR_16_9:
+		return "(16:9) ";
+	case DRM_MODE_FLAG_PIC_AR_64_27:
+		return "(64:27) ";
+	case DRM_MODE_FLAG_PIC_AR_256_135:
+		return "(256:135) ";
+	default:
+		return "(invalid) ";
+	}
+}
+
 static void paint_output_info(struct connector *c, struct igt_fb *fb)
 {
 	cairo_t *cr = igt_get_cairo_ctx(drm_fd, fb);
@@ -288,8 +306,10 @@ static void paint_output_info(struct connector *c, struct igt_fb *fb)
 			cairo_move_to(cr, x, top_y);
 		}
 		str_width = igt_cairo_printf_line(cr, align_right, 10,
-			"%s @ %dHz", c->connector->modes[i].name,
-			 c->connector->modes[i].vrefresh);
+						  "%s%s @ %dHz",
+						  picture_aspect_ratio_str(c->connector->modes[i].flags),
+						  c->connector->modes[i].name,
+						  c->connector->modes[i].vrefresh);
 		if (str_width > max_width)
 			max_width = str_width;
 	}
@@ -573,7 +593,7 @@ static void set_termio_mode(void)
 	tcsetattr(tio_fd, TCSANOW, &tio);
 }
 
-static char optstr[] = "3iaf:s:d:p:mrto:j:y";
+static char optstr[] = "3Aiaf:s:d:p:mrto:j:y";
 static struct option long_opts[] = {
 	{"yb", 0, 0, OPT_YB},
 	{"yf", 0, 0, OPT_YF},
@@ -588,6 +608,7 @@ static const char *help_str =
 	"  -p\t<planew,h>,<crtcx,y>,<crtcw,h> test overlay plane\n"
 	"  -m\ttest the preferred mode\n"
 	"  -3\ttest all 3D modes\n"
+	"  -A\ttest all aspect ratios\n"
 	"  -t\tuse an X-tiled framebuffer\n"
 	"  -y, --yb\n"
 	"  \tuse a Y-tiled framebuffer\n"
@@ -609,6 +630,9 @@ static int opt_handler(int opt, int opt_index, void *data)
 	case '3':
 		test_stereo_modes = 1;
 		break;
+	case 'A':
+		test_aspect_ratio = 1;
+		break;
 	case 'i':
 		opt_dump_info = true;
 		break;
@@ -697,6 +721,12 @@ igt_simple_main_args(optstr, long_opts, help_str, opt_handler, NULL)
 		goto out_close;
 	}
 
+	if (test_aspect_ratio &&
+	    drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ASPECT_RATIO, 1) < 0) {
+		igt_warn("DRM_CLIENT_CAP_ASPECT_RATIO failed\n");
+		goto out_close;
+	}
+
 	if (opt_dump_info) {
 		dump_info();
 		goto out_close;
-- 
2.21.0

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

  reply	other threads:[~2019-06-20 15:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20 15:58 [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms: Dump mode picture aspect ratio Ville Syrjala
2019-06-20 15:58 ` Ville Syrjala [this message]
2019-06-24  7:39   ` [igt-dev] [PATCH i-g-t 2/2] tests/testdisplay: Allow testing aspect ratios Ser, Simon
2019-06-20 17:21 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/2] lib/igt_kms: Dump mode picture aspect ratio Patchwork
2019-06-24  7:34 ` [igt-dev] [PATCH i-g-t 1/2] " Ser, Simon

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=20190620155830.20500-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox