[PATCH i-g-t] tests/kms_psr_sink_crc: Assert if we don't have a valid crtc.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
CC: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
CC: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx>
CC: Daniel Vetter <daniel@xxxxxxxx>

---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux