intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Marius Vlad <marius.c.vlad@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: [PATCH i-g-t] tests/kms_psr_sink_crc: Assert if we don't have a valid crtc.
Date: Tue, 20 Sep 2016 11:22:56 +0300	[thread overview]
Message-ID: <1474359776-30667-1-git-send-email-marius.c.vlad@intel.com> (raw)

In the fixture block for the test we receive a segfault with the
following trace:

0  setup_output (data=<optimized out>) at kms_psr_sink_crc.c:115
1  display_init (data=0x7ffd46833cf0) at kms_psr_sink_crc.c:126
2  main (argc=1, argv=<optimized out>) at kms_psr_sink_crc.c:528

And in setup_output(), output.config is:

$2 = {crtc = 0x0, connector = 0x6ad460, encoder = 0x0, default_mode =
{clock = 361310, hdisplay = 3200, hsync_start = 3248,
hsync_end = 3280, htotal = 3316, hskew = 0, vdisplay = 1800,
vsync_start = 1802, vsync_end = 1807, vtotal = 1816,
vscan = 0, vrefresh = 60, flags = 10, type = 72,
name = "3200x1800", '\000' <repeats 22 times>},
connector_scaling_mode = 0, connector_scaling_mode_changed =
false, pipe_changed = true, atomic_props_connector =
{44, 0}, pipe = -1, valid_crtc_idx_mask = 7}

Also, include some warnings in _kmstest_connector_config()
in case we fail to retrieve the connector or the crtc.

Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
CC: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
CC: Rodrigo Vivi <rodrigo.vivi@intel.com>
CC: Daniel Vetter <daniel@ffwll.ch>

---
 lib/igt_kms.c            | 10 +++++++++-
 tests/kms_psr_sink_crc.c |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 960ecbd..32cd5cf 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -862,8 +862,10 @@ static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
 	else
 		connector = drmModeGetConnectorCurrent(drm_fd, connector_id);
 
-	if (!connector)
+	if (!connector) {
+		igt_warn("drmModeGetConnector(Current) failed\n");
 		goto err2;
+	}
 
 	if (connector->connector_id != connector_id) {
 		igt_warn("connector id doesn't match (%d != %d)\n",
@@ -896,6 +898,12 @@ static bool _kmstest_connector_config(int drm_fd, uint32_t connector_id,
 	config->encoder = _kmstest_connector_config_find_encoder(drm_fd, connector, config->pipe);
 	config->crtc = drmModeGetCrtc(drm_fd, resources->crtcs[config->pipe]);
 
+	if (!config->crtc) {
+		igt_warn("drmModeGetCrtc for pipe %s failed\n",
+				kmstest_pipe_name(config->pipe));
+		goto err2;
+	}
+
 	if (connector->connection != DRM_MODE_CONNECTED)
 		goto err2;
 
diff --git a/tests/kms_psr_sink_crc.c b/tests/kms_psr_sink_crc.c
index 8aafedb..0890d5b 100644
--- a/tests/kms_psr_sink_crc.c
+++ b/tests/kms_psr_sink_crc.c
@@ -112,6 +112,7 @@ static void setup_output(data_t *data)
 			continue;
 
 		igt_output_set_pipe(output, pipe);
+		igt_assert(output->config.crtc != NULL);
 		data->crtc_id = output->config.crtc->crtc_id;
 		data->output = output;
 		data->mode = igt_output_get_mode(output);
-- 
2.5.0

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

                 reply	other threads:[~2016-09-20  8:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1474359776-30667-1-git-send-email-marius.c.vlad@intel.com \
    --to=marius.c.vlad@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).