Skip to contentSkip to conversation

lib/igt_kms: Add igt_display_reset function.

PATCH In review Maarten Lankhorst 3 participants 15 messages Nov 16, 2017 – Nov 21, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 lib/igt_kms: Add igt_display_reset function.

A lot of code duplicates this, but it should be handled in the core. Add it and use it after igt_display_init(), the tests have to be converted one by one.

---
 lib/igt_kms.c | 162 +++++++++++++++++++++++++++++++++++++---------------------
 lib/igt_kms.h |   1 +
 2 files changed, 104 insertions(+), 59 deletions(-)
lib/igt_kms.c +103 -59
index 1d26b8ddbf43..239f4f17d22e 100644
@@ -1549,29 +1549,14 @@ static void igt_output_refresh(igt_output_t *output)
 			       -1);
 	}
 
-	if (output->config.connector) {
+	if (output->config.connector)
 		igt_atomic_fill_connector_props(display, output,
 			IGT_NUM_CONNECTOR_PROPS, igt_connector_prop_names);
 
-		if (output->props[IGT_CONNECTOR_BROADCAST_RGB])
-			igt_output_set_prop_value(output,
-						  IGT_CONNECTOR_BROADCAST_RGB,
-						  BROADCAST_RGB_FULL);
-	}
-
 	LOG(display, "%s: Selecting pipe %s\n", output->name,
 	    kmstest_pipe_name(output->pending_pipe));
 }
 
-static bool
-get_plane_property(int drm_fd, uint32_t plane_id, const char *name,
-		   uint32_t *prop_id /* out */, uint64_t *value /* out */,
-		   drmModePropertyPtr *prop /* out */)
-{
-	return kmstest_get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE,
-				    name, prop_id, value, prop);
-}
-
 static int
 igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
 {
@@ -1582,15 +1567,6 @@ igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
 				 DRM_MODE_OBJECT_PLANE, prop_id, value);
 }
 
-static bool
-get_crtc_property(int drm_fd, uint32_t crtc_id, const char *name,
-		   uint32_t *prop_id /* out */, uint64_t *value /* out */,
-		   drmModePropertyPtr *prop /* out */)
-{
-	return kmstest_get_property(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC,
-				    name, prop_id, value, prop);
-}
-
 /*
  * Walk a plane's property list to determine its type.  If we don't
  * find a type property, then the kernel doesn't support universal
@@ -1601,14 +1577,110 @@ static int get_drm_plane_type(int drm_fd, uint32_t plane_id)
 	uint64_t value;
 	bool has_prop;
 
-	has_prop = get_plane_property(drm_fd, plane_id, "type",
-				      NULL /* prop_id */, &value, NULL);
+	has_prop = kmstest_get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE,
+					"type", NULL, &value, NULL);
 	if (has_prop)
 		return (int)value;
 
 	return DRM_PLANE_TYPE_OVERLAY;
 }
 
+static void igt_plane_reset(igt_plane_t *plane)
+{
+	/* Reset src coordinates. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_W, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H, 0);
+
+	/* Reset crtc coordinates. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_X, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_Y, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_W, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, 0);
+
+	/* Reset binding to fb and crtc. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, 0);
+
+	/* Use default rotation */
+	if (igt_plane_has_prop(plane, IGT_PLANE_ROTATION))
+		igt_plane_set_prop_value(plane, IGT_PLANE_ROTATION,
+					 IGT_ROTATION_0);
+
+	igt_plane_clear_prop_changed(plane, IGT_PLANE_IN_FENCE_FD);
+	plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
+}
+
+static void igt_pipe_reset(igt_pipe_t *pipe)
+{
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_MODE_ID, 0);
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_ACTIVE, 0);
+	igt_pipe_obj_clear_prop_changed(pipe, IGT_CRTC_OUT_FENCE_PTR);
+
+	pipe->out_fence_fd = -1;
+}
+
+static void igt_output_reset(igt_output_t *output)
+{
+	output->pending_pipe = PIPE_NONE;
+	output->use_override_mode = false;
+	memset(&output->override_mode, 0, sizeof(output->override_mode));
+
+	igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, 0);
+
+	if (igt_output_has_prop(output, IGT_CONNECTOR_BROADCAST_RGB))
+		igt_output_set_prop_value(output, IGT_CONNECTOR_BROADCAST_RGB,
+					  BROADCAST_RGB_FULL);
+}
+
+/**
+ * igt_display_reset:
+ * @display: a pointer to an #igt_display_t structure
+ *
+ * Reset basic pipes, connectors and planes on @display back to default values.
+ * In particular, the following properties will be reset:
+ *
+ * For outputs:
+ * - %IGT_CONNECTOR_CRTC_ID
+ * - %IGT_CONNECTOR_BROADCAST_RGB (if applicable)
+ * - igt_output_override_mode() to default.
+ *
+ * For pipes:
+ * - %IGT_CRTC_MODE_ID (leaked)
+ * - %IGT_CRTC_ACTIVE
+ * - %IGT_CRTC_OUT_FENCE_PTR
+ *
+ * For planes:
+ * - %IGT_PLANE_SRC_*
+ * - %IGT_PLANE_CRTC_*
+ * - %IGT_PLANE_FB_ID
+ * - %IGT_PLANE_CRTC_ID
+ * - %IGT_PLANE_ROTATION
+ * - %IGT_PLANE_IN_FENCE_FD
+ */
+void igt_display_reset(igt_display_t *display)
+{
+	enum pipe pipe;
+	int i;
+
+	for_each_pipe(display, pipe) {
+		igt_pipe_t *pipe_obj = &display->pipes[pipe];
+		igt_plane_t *plane;
+
+		for_each_plane_on_pipe(display, pipe, plane)
+			igt_plane_reset(plane);
+
+		igt_pipe_reset(pipe_obj);
+	}
+
+	for (i = 0; i < display->n_outputs; i++) {
+		igt_output_t *output = &display->outputs[i];
+
+		igt_output_reset(output);
+	}
+}
+
 /**
  * igt_display_init:
  * @display: a pointer to an #igt_display_t structure
@@ -1648,7 +1720,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 	plane_resources = drmModeGetPlaneResources(display->drm_fd);
 	igt_assert(plane_resources);
 
-	for (i = 0; i < display->n_pipes; i++) {
+	for_each_pipe(display, i) {
 		igt_pipe_t *pipe = &display->pipes[i];
 		igt_plane_t *plane;
 		int p = 1;
@@ -1661,19 +1733,9 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		pipe->plane_cursor = -1;
 		pipe->plane_primary = -1;
 		pipe->planes = NULL;
-		pipe->out_fence_fd = -1;
 
 		igt_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
 
-		/* Force modeset disable on first commit */
-		igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
-		igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_ACTIVE);
-
-		get_crtc_property(display->drm_fd, pipe->crtc_id,
-				    "background_color", NULL,
-				    &pipe->values[IGT_CRTC_BACKGROUND],
-				    NULL);
-
 		/* count number of valid planes */
 		for (j = 0; j < plane_resources->count_planes; j++) {
 			drmModePlane *drm_plane;
@@ -1730,24 +1792,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 			plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
 
 			igt_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
-
-			get_plane_property(display->drm_fd, drm_plane->plane_id,
-					   "rotation",
-					   &plane->props[IGT_PLANE_ROTATION],
-					   &plane->values[IGT_PLANE_ROTATION],
-					   NULL);
-
-			/* Clear any residual framebuffer info on first commit. */
-			igt_plane_set_prop_changed(plane, IGT_PLANE_FB_ID);
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_ID);
-
-			/*
-			 * CRTC_X/Y are not changed in igt_plane_set_fb, so
-			 * force them to be sanitized in case they contain
-			 * garbage.
-			 */
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_X);
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_Y);
 		}
 
 		/*
@@ -1782,18 +1826,18 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		 * a pipe is set with igt_output_set_pipe().
 		 */
 		output->force_reprobe = true;
-		output->pending_pipe = PIPE_NONE;
 		output->id = resources->connectors[i];
 		output->display = display;
 
 		igt_output_refresh(output);
-
-		igt_output_set_prop_changed(output, IGT_CONNECTOR_CRTC_ID);
 	}
 
 	drmModeFreePlaneResources(plane_resources);
 	drmModeFreeResources(resources);
 
+	/* Set reasonable default values for every object in the display. */
+	igt_display_reset(display);
+
 	LOG_UNINDENT(display);
 }
 
lib/igt_kms.h +1 -0
index acc82913e0b7..e1883bf1b8a3 100644
@@ -353,6 +353,7 @@ struct igt_display {
 
 void igt_display_init(igt_display_t *display, int drm_fd);
 void igt_display_fini(igt_display_t *display);
+void igt_display_reset(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_try_commit_atomic(igt_display_t *display, uint32_t flags, void *user_data);
Signature · 6 lines
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 2/4 lib/igt_kms: Make igt_output_from_connector probe all outputs

igt_output_from_connector should be used for disconnected outputs too, this is useful for chamelium testing, where disconnected outputs may reappear.

---
 lib/igt_kms.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
lib/igt_kms.c +6 -2
index 239f4f17d22e..fe0ef2bd6f38 100644
@@ -1884,9 +1884,13 @@ igt_output_t *igt_output_from_connector(igt_display_t *display,
 					drmModeConnector *connector)
 {
 	igt_output_t *output, *found = NULL;
+	int i;
+
+	for (i = 0; i < display->n_outputs; i++) {
+		output = &display->outputs[i];
 
-	for_each_connected_output(display, output) {
-		if (output->config.connector->connector_id ==
+		if (output->config.connector &&
+		    output->config.connector->connector_id ==
 		    connector->connector_id) {
 			found = output;
 			break;
Signature · 6 lines
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/4
#2 lore raw

Re: [PATCH i-g-t 2/4] lib/igt_kms: Make igt_output_from_connector probe all outputs

Quoted 29 lines · Maarten Lankhorst

igt_output_from_connector should be used for disconnected outputs too, this is useful for chamelium testing, where disconnected outputs may reappear.

---
 lib/igt_kms.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
lib/igt_kms.c +6 -2
index 239f4f17d22e..fe0ef2bd6f38 100644
@@ -1884,9 +1884,13 @@ igt_output_t *igt_output_from_connector(igt_display_t
 *display,
 					drmModeConnector *connector)
 {
 	igt_output_t *output, *found = NULL;
+	int i;
+
+	for (i = 0; i < display->n_outputs; i++) {
+		output = &display->outputs[i];
 
-	for_each_connected_output(display, output) {
-		if (output->config.connector->connector_id ==
+		if (output->config.connector &&
+		    output->config.connector->connector_id ==
 		    connector->connector_id) {
 			found = output;
Quoted 1 line

break;

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH 3/4 tests/chamelium: Only initialize igt_display once

In reply to Maarten Lankhorst

Instead of first calling kmstest_unset_all_crtcs, and calling igt_display_init for each test, use igt_display_reset to reset igt_display between tests, and use atomic commit to disable all unused crtcs in enable_output().

---
 tests/chamelium.c | 45 ++++++++++++---------------------------------
 1 file changed, 12 insertions(+), 33 deletions(-)
tests/chamelium.c +12 -33
index d4a185e76873..8855a8300049 100644
@@ -33,6 +33,7 @@
 typedef struct {
 	struct chamelium *chamelium;
 	struct chamelium_port **ports;
+	igt_display_t display;
 	int port_count;
 
 	int drm_fd;
@@ -409,9 +410,9 @@ test_suspend_resume_edid_change(data_t *data, struct chamelium_port *port,
 
 static igt_output_t *
 prepare_output(data_t *data,
-	       igt_display_t *display,
 	       struct chamelium_port *port)
 {
+	igt_display_t *display = &data->display;
 	igt_output_t *output;
 	drmModeRes *res;
 	drmModeConnector *connector =
@@ -420,7 +421,6 @@ prepare_output(data_t *data,
 	bool found = false;
 
 	igt_assert(res = drmModeGetResources(data->drm_fd));
-	kmstest_unset_all_crtcs(data->drm_fd, res);
 
 	/* The chamelium's default EDID has a lot of resolutions, way more then
 	 * we need to test
@@ -430,11 +430,9 @@ prepare_output(data_t *data,
 	chamelium_plug(data->chamelium, port);
 	wait_for_connector(data, port, DRM_MODE_CONNECTED);
 
-	igt_display_init(display, data->drm_fd);
-	output = igt_output_from_connector(display, connector);
+	igt_display_reset(display);
 
-	igt_assert(kmstest_probe_connector_config(
-		data->drm_fd, connector->connector_id, ~0, &output->config));
+	output = igt_output_from_connector(display, connector);
 
 	for_each_pipe(display, pipe) {
 		if (!igt_pipe_connector_valid(pipe, output))
@@ -477,7 +475,7 @@ enable_output(data_t *data,
 	igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_GAMMA_LUT, NULL, 0);
 	igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_CTM, NULL, 0);
 
-	igt_display_commit(display);
+	igt_display_commit2(display, COMMIT_ATOMIC);
 
 	if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
 		usleep(250000);
@@ -485,25 +483,10 @@ enable_output(data_t *data,
 	drmModeFreeConnector(connector);
 }
 
-static void
-disable_output(data_t *data,
-	       struct chamelium_port *port,
-	       igt_output_t *output)
-{
-	igt_display_t *display = output->display;
-	igt_plane_t *primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-	igt_assert(primary);
-
-	/* Disable the display */
-	igt_plane_set_fb(primary, NULL);
-	igt_display_commit(display);
-}
-
 static void
 test_display_crc(data_t *data, struct chamelium_port *port, int count,
 		 bool fast)
 {
-	igt_display_t display;
 	igt_output_t *output;
 	igt_plane_t *primary;
 	igt_crc_t *crc;
@@ -517,7 +500,7 @@ test_display_crc(data_t *data, struct chamelium_port *port, int count,
 
 	reset_state(data, port);
 
-	output = prepare_output(data, &display, port);
+	output = prepare_output(data, port);
 	connector = chamelium_port_get_connector(data->chamelium, port, false);
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
@@ -561,18 +544,15 @@ test_display_crc(data_t *data, struct chamelium_port *port, int count,
 		free(expected_crc);
 		free(crc);
 
-		disable_output(data, port, output);
 		igt_remove_fb(data->drm_fd, &fb);
 	}
 
 	drmModeFreeConnector(connector);
-	igt_display_fini(&display);
 }
 
 static void
 test_display_frame_dump(data_t *data, struct chamelium_port *port)
 {
-	igt_display_t display;
 	igt_output_t *output;
 	igt_plane_t *primary;
 	struct igt_fb fb;
@@ -583,7 +563,7 @@ test_display_frame_dump(data_t *data, struct chamelium_port *port)
 
 	reset_state(data, port);
 
-	output = prepare_output(data, &display, port);
+	output = prepare_output(data, port);
 	connector = chamelium_port_get_connector(data->chamelium, port, false);
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
@@ -608,18 +588,15 @@ test_display_frame_dump(data_t *data, struct chamelium_port *port)
 			chamelium_destroy_frame_dump(frame);
 		}
 
-		disable_output(data, port, output);
 		igt_remove_fb(data->drm_fd, &fb);
 	}
 
 	drmModeFreeConnector(connector);
-	igt_display_fini(&display);
 }
 
 static void
 test_analog_frame_dump(data_t *data, struct chamelium_port *port)
 {
-	igt_display_t display;
 	igt_output_t *output;
 	igt_plane_t *primary;
 	struct igt_fb fb;
@@ -631,7 +608,7 @@ test_analog_frame_dump(data_t *data, struct chamelium_port *port)
 
 	reset_state(data, port);
 
-	output = prepare_output(data, &display, port);
+	output = prepare_output(data, port);
 	connector = chamelium_port_get_connector(data->chamelium, port, false);
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 	igt_assert(primary);
@@ -666,12 +643,10 @@ test_analog_frame_dump(data_t *data, struct chamelium_port *port)
 
 		chamelium_destroy_frame_dump(frame);
 
-		disable_output(data, port, output);
 		igt_remove_fb(data->drm_fd, &fb);
 	}
 
 	drmModeFreeConnector(connector);
-	igt_display_fini(&display);
 }
 
 static void
@@ -773,6 +748,9 @@ igt_main
 
 		/* So fbcon doesn't try to reprobe things itself */
 		kmstest_set_vt_graphics_mode();
+
+		igt_display_init(&data.display, data.drm_fd);
+		igt_require(data.display.is_atomic);
 	}
 
 	igt_subtest_group {
@@ -952,6 +930,7 @@ igt_main
 	}
 
 	igt_fixture {
+		igt_display_fini(&data.display);
 		close(data.drm_fd);
 	}
 }
Signature · 6 lines
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/4
#4 lore raw

Re: [PATCH i-g-t 3/4] tests/chamelium: Only initialize igt_display once

Quoted 197 lines · Maarten Lankhorst

Instead of first calling kmstest_unset_all_crtcs, and calling igt_display_init for each test, use igt_display_reset to reset igt_display between tests, and use atomic commit to disable all unused crtcs in enable_output().

---
 tests/chamelium.c | 45 ++++++++++++---------------------------------
 1 file changed, 12 insertions(+), 33 deletions(-)
tests/chamelium.c +2 -1
index d4a185e76873..8855a8300049 100644
@@ -33,6 +33,7 @@
 typedef struct {
 	struct chamelium *chamelium;
 	struct chamelium_port **ports;
+	igt_display_t display;
 	int port_count;
 
 	int drm_fd;
@@ -409,9 +410,9 @@ test_suspend_resume_edid_change(data_t *data, struct
 chamelium_port *port,
 
 static igt_output_t *
 prepare_output(data_t *data,
-	       igt_display_t *display,
 	       struct chamelium_port *port)
 {
+	igt_display_t *display = &data->display;
 	igt_output_t *output;
 	drmModeRes *res;
tests/chamelium.c +0 -1
 	drmModeConnector *connector =
@@ -420,7 +421,6 @@ prepare_output(data_t *data,
 	bool found = false;
 
 	igt_assert(res = drmModeGetResources(data->drm_fd));
-	kmstest_unset_all_crtcs(data->drm_fd, res);
 
 	/* The chamelium's default EDID has a lot of resolutions, way more

then

tests/chamelium.c +2 -4
 	 * we need to test
@@ -430,11 +430,9 @@ prepare_output(data_t *data,
 	chamelium_plug(data->chamelium, port);
 	wait_for_connector(data, port, DRM_MODE_CONNECTED);
 
-	igt_display_init(display, data->drm_fd);
-	output = igt_output_from_connector(display, connector);
+	igt_display_reset(display);
 
-	igt_assert(kmstest_probe_connector_config(
-		data->drm_fd, connector->connector_id, ~0, &output-
 >config));
+	output = igt_output_from_connector(display, connector);
 
 	for_each_pipe(display, pipe) {
tests/chamelium.c +1 -1
 		if (!igt_pipe_connector_valid(pipe, output))
@@ -477,7 +475,7 @@ enable_output(data_t *data,
 	igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_GAMMA_LUT,
 NULL, 0);
 	igt_pipe_obj_replace_prop_blob(primary->pipe, IGT_CRTC_CTM, NULL,
 0);
 
-	igt_display_commit(display);
+	igt_display_commit2(display, COMMIT_ATOMIC);
 
tests/chamelium.c +0 -15
 	if (chamelium_port_get_type(port) == DRM_MODE_CONNECTOR_VGA)
 		usleep(250000);
@@ -485,25 +483,10 @@ enable_output(data_t *data,
 	drmModeFreeConnector(connector);
 }
 
-static void
-disable_output(data_t *data,
-	       struct chamelium_port *port,
-	       igt_output_t *output)
-{
-	igt_display_t *display = output->display;
-	igt_plane_t *primary = igt_output_get_plane_type(output,
 DRM_PLANE_TYPE_PRIMARY);
-	igt_assert(primary);
-
-	/* Disable the display */
-	igt_plane_set_fb(primary, NULL);
-	igt_display_commit(display);
-}
-
 static void
 test_display_crc(data_t *data, struct chamelium_port *port, int count,
 		 bool fast)
 {
-	igt_display_t display;
 	igt_output_t *output;
 	igt_plane_t *primary;
tests/chamelium.c +1 -1
 	igt_crc_t *crc;
@@ -517,7 +500,7 @@ test_display_crc(data_t *data, struct chamelium_port
 *port, int count,
 
 	reset_state(data, port);
 
-	output = prepare_output(data, &display, port);
+	output = prepare_output(data, port);
 	connector = chamelium_port_get_connector(data->chamelium, port,
 false);

primary = igt_output_get_plane_type(output,
DRM_PLANE_TYPE_PRIMARY);

tests/chamelium.c +0 -3
 	igt_assert(primary);
@@ -561,18 +544,15 @@ test_display_crc(data_t *data, struct chamelium_port
 *port, int count,
 		free(expected_crc);
 		free(crc);
 
-		disable_output(data, port, output);
 		igt_remove_fb(data->drm_fd, &fb);
 	}
 
 	drmModeFreeConnector(connector);
-	igt_display_fini(&display);
 }
 
 static void
 test_display_frame_dump(data_t *data, struct chamelium_port *port)
 {
-	igt_display_t display;
 	igt_output_t *output;
 	igt_plane_t *primary;
tests/chamelium.c +1 -1
 	struct igt_fb fb;
@@ -583,7 +563,7 @@ test_display_frame_dump(data_t *data, struct
 chamelium_port *port)
 
 	reset_state(data, port);
 
-	output = prepare_output(data, &display, port);
+	output = prepare_output(data, port);
 	connector = chamelium_port_get_connector(data->chamelium, port,
 false);

primary = igt_output_get_plane_type(output,
DRM_PLANE_TYPE_PRIMARY);

tests/chamelium.c +0 -3
 	igt_assert(primary);
@@ -608,18 +588,15 @@ test_display_frame_dump(data_t *data, struct
 chamelium_port *port)
 			chamelium_destroy_frame_dump(frame);
 		}
 
-		disable_output(data, port, output);
 		igt_remove_fb(data->drm_fd, &fb);
 	}
 
 	drmModeFreeConnector(connector);
-	igt_display_fini(&display);
 }
 
 static void
 test_analog_frame_dump(data_t *data, struct chamelium_port *port)
 {
-	igt_display_t display;
 	igt_output_t *output;
 	igt_plane_t *primary;
tests/chamelium.c +1 -1
 	struct igt_fb fb;
@@ -631,7 +608,7 @@ test_analog_frame_dump(data_t *data, struct
 chamelium_port *port)
 
 	reset_state(data, port);
 
-	output = prepare_output(data, &display, port);
+	output = prepare_output(data, port);
 	connector = chamelium_port_get_connector(data->chamelium, port,
 false);

primary = igt_output_get_plane_type(output,
DRM_PLANE_TYPE_PRIMARY);

tests/chamelium.c +0 -2
 	igt_assert(primary);
@@ -666,12 +643,10 @@ test_analog_frame_dump(data_t *data, struct
 chamelium_port *port)
 
 		chamelium_destroy_frame_dump(frame);
 
-		disable_output(data, port, output);
 		igt_remove_fb(data->drm_fd, &fb);
 	}
 
 	drmModeFreeConnector(connector);
-	igt_display_fini(&display);
 }
 

static void

tests/chamelium.c +3 -0
@@ -773,6 +748,9 @@ igt_main
 
 		/* So fbcon doesn't try to reprobe things itself */
 		kmstest_set_vt_graphics_mode();
+
+		igt_display_init(&data.display, data.drm_fd);
+		igt_require(data.display.is_atomic);
 	}
 
 	igt_subtest_group {

tests/chamelium.c igt_main · line 936

Quoted 7 lines
tests/chamelium.c +1 -0
@@ -952,6 +930,7 @@ igt_main
 	}
 
 	igt_fixture {
+		igt_display_fini(&data.display);
 		close(data.drm_fd);
 	}
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

PATCH 4/4 tests: Rename chamelium to kms_chamelium.

In reply to Maarten Lankhorst
---
 tests/Makefile.am                      |  6 +++---
 tests/intel-ci/fast-feedback.testlist  | 18 +++++++++---------
 tests/{chamelium.c => kms_chamelium.c} |  0
 tests/meson.build                      |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)
 rename tests/{chamelium.c => kms_chamelium.c} (100%)
tests/Makefile.am +3 -3
index 89a970153992..db360523dad6 100644
@@ -16,7 +16,7 @@ endif
 
 if HAVE_CHAMELIUM
 TESTS_progs += \
-	chamelium \
+	kms_chamelium \
 	$(NULL)
 endif
 
@@ -153,8 +153,8 @@ vc4_wait_bo_LDADD = $(LDADD) $(DRM_VC4_LIBS)
 vc4_wait_seqno_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS)
 vc4_wait_seqno_LDADD = $(LDADD) $(DRM_VC4_LIBS)
 
-chamelium_CFLAGS = $(AM_CFLAGS) $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS)
-chamelium_LDADD = $(LDADD) $(XMLRPC_LIBS) $(LIBUDEV_LIBS)
+kms_chamelium_CFLAGS = $(AM_CFLAGS) $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS)
+kms_chamelium_LDADD = $(LDADD) $(XMLRPC_LIBS) $(LIBUDEV_LIBS)
 
 audio_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS)
 audio_LDADD = $(LDADD) $(ALSA_LIBS)
tests/intel-ci/fast-feedback.testlist +9 -9
index bf8c1e663801..f74da743ce88 100644
@@ -1,14 +1,5 @@
 # Keep alphabetically sorted by default
 
-igt@chamelium@dp-hpd-fast
-igt@chamelium@dp-edid-read
-igt@chamelium@dp-crc-fast
-igt@chamelium@hdmi-hpd-fast
-igt@chamelium@hdmi-edid-read
-igt@chamelium@hdmi-crc-fast
-igt@chamelium@vga-hpd-fast
-igt@chamelium@vga-edid-read
-igt@chamelium@common-hpd-after-suspend
 igt@core_auth@basic-auth
 igt@core_prop_blob@basic
 igt@debugfs_test@read_all_entries
@@ -208,6 +199,15 @@ igt@kms_addfb_basic@unused-pitches
 igt@kms_busy@basic-flip-a
 igt@kms_busy@basic-flip-b
 igt@kms_busy@basic-flip-c
+igt@kms_chamelium@dp-hpd-fast
+igt@kms_chamelium@dp-edid-read
+igt@kms_chamelium@dp-crc-fast
+igt@kms_chamelium@hdmi-hpd-fast
+igt@kms_chamelium@hdmi-edid-read
+igt@kms_chamelium@hdmi-crc-fast
+igt@kms_chamelium@vga-hpd-fast
+igt@kms_chamelium@vga-edid-read
+igt@kms_chamelium@common-hpd-after-suspend
 igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic
 igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy
 igt@kms_cursor_legacy@basic-flip-after-cursor-atomic
tests/kms_chamelium.c renamed from tests/chamelium.c +0 -0
similarity index 100%
rename from tests/chamelium.c
rename to tests/kms_chamelium.c
tests/meson.build +1 -1
index c3d5372f78ac..20ff79dcb15f 100644
@@ -251,7 +251,7 @@ endif
 
 if chamelium.found()
 	test_progs += [
-		'chamelium',
+		'kms_chamelium',
 	]
 	test_deps += chamelium
 endif
Signature · 6 lines
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 4/4
#6 lore raw

Re: [PATCH i-g-t 4/4] tests: Rename chamelium to kms_chamelium.

Quoted 78 lines · Maarten Lankhorst
---
 tests/Makefile.am                      |  6 +++---
 tests/intel-ci/fast-feedback.testlist  | 18 +++++++++---------
 tests/{chamelium.c => kms_chamelium.c} |  0
 tests/meson.build                      |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)
 rename tests/{chamelium.c => kms_chamelium.c} (100%)
tests/Makefile.am +3 -3
index 89a970153992..db360523dad6 100644
@@ -16,7 +16,7 @@ endif
 
 if HAVE_CHAMELIUM
 TESTS_progs += \
-	chamelium \
+	kms_chamelium \
 	$(NULL)
 endif
 
@@ -153,8 +153,8 @@ vc4_wait_bo_LDADD = $(LDADD) $(DRM_VC4_LIBS)
 vc4_wait_seqno_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS)
 vc4_wait_seqno_LDADD = $(LDADD) $(DRM_VC4_LIBS)
 
-chamelium_CFLAGS = $(AM_CFLAGS) $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS)
-chamelium_LDADD = $(LDADD) $(XMLRPC_LIBS) $(LIBUDEV_LIBS)
+kms_chamelium_CFLAGS = $(AM_CFLAGS) $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS)
+kms_chamelium_LDADD = $(LDADD) $(XMLRPC_LIBS) $(LIBUDEV_LIBS)
 
 audio_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS)
 audio_LDADD = $(LDADD) $(ALSA_LIBS)
tests/intel-ci/fast- renamed from tests/intel-ci/fast-feedback.testlist +0 -0

feedback.testlist
index bf8c1e663801..f74da743ce88 100644

tests/intel-ci/fast-feedback.testlist +9 -9
@@ -1,14 +1,5 @@
 # Keep alphabetically sorted by default
 
-igt@chamelium@dp-hpd-fast
-igt@chamelium@dp-edid-read
-igt@chamelium@dp-crc-fast
-igt@chamelium@hdmi-hpd-fast
-igt@chamelium@hdmi-edid-read
-igt@chamelium@hdmi-crc-fast
-igt@chamelium@vga-hpd-fast
-igt@chamelium@vga-edid-read
-igt@chamelium@common-hpd-after-suspend
 igt@core_auth@basic-auth
 igt@core_prop_blob@basic
 igt@debugfs_test@read_all_entries
@@ -208,6 +199,15 @@ igt@kms_addfb_basic@unused-pitches
 igt@kms_busy@basic-flip-a
 igt@kms_busy@basic-flip-b
 igt@kms_busy@basic-flip-c
+igt@kms_chamelium@dp-hpd-fast
+igt@kms_chamelium@dp-edid-read
+igt@kms_chamelium@dp-crc-fast
+igt@kms_chamelium@hdmi-hpd-fast
+igt@kms_chamelium@hdmi-edid-read
+igt@kms_chamelium@hdmi-crc-fast
+igt@kms_chamelium@vga-hpd-fast
+igt@kms_chamelium@vga-edid-read
+igt@kms_chamelium@common-hpd-after-suspend
 igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic
 igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy
 igt@kms_cursor_legacy@basic-flip-after-cursor-atomic
tests/kms_chamelium.c renamed from tests/chamelium.c +0 -0
similarity index 100%
rename from tests/chamelium.c
rename to tests/kms_chamelium.c
tests/meson.build +0 -0
index c3d5372f78ac..20ff79dcb15f 100644

tests/meson.build endif · line 257

Quoted 8 lines
tests/meson.build +1 -1
@@ -251,7 +251,7 @@ endif
 
 if chamelium.found()
 	test_progs += [
-		'chamelium',
+		'kms_chamelium',
 	]
 	test_deps += chamelium
 endif

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw

Re: [PATCH i-g-t 4/4] tests: Rename chamelium to kms_chamelium.

Op 18-11-17 om 01:42 schreef Lyude Paul:

Quoted 82 lines
Quoted 79 lines · Maarten Lankhorst
---
 tests/Makefile.am                      |  6 +++---
 tests/intel-ci/fast-feedback.testlist  | 18 +++++++++---------
 tests/{chamelium.c => kms_chamelium.c} |  0
 tests/meson.build                      |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)
 rename tests/{chamelium.c => kms_chamelium.c} (100%)
tests/Makefile.am +3 -3
index 89a970153992..db360523dad6 100644
@@ -16,7 +16,7 @@ endif
 
 if HAVE_CHAMELIUM
 TESTS_progs += \
-	chamelium \
+	kms_chamelium \
 	$(NULL)
 endif
 
@@ -153,8 +153,8 @@ vc4_wait_bo_LDADD = $(LDADD) $(DRM_VC4_LIBS)
 vc4_wait_seqno_CFLAGS = $(AM_CFLAGS) $(DRM_VC4_CFLAGS)
 vc4_wait_seqno_LDADD = $(LDADD) $(DRM_VC4_LIBS)
 
-chamelium_CFLAGS = $(AM_CFLAGS) $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS)
-chamelium_LDADD = $(LDADD) $(XMLRPC_LIBS) $(LIBUDEV_LIBS)
+kms_chamelium_CFLAGS = $(AM_CFLAGS) $(XMLRPC_CFLAGS) $(LIBUDEV_CFLAGS)
+kms_chamelium_LDADD = $(LDADD) $(XMLRPC_LIBS) $(LIBUDEV_LIBS)
 
 audio_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS)
 audio_LDADD = $(LDADD) $(ALSA_LIBS)
tests/intel-ci/fast- renamed from tests/intel-ci/fast-feedback.testlist +0 -0

feedback.testlist
index bf8c1e663801..f74da743ce88 100644

tests/intel-ci/fast-feedback.testlist +9 -9
@@ -1,14 +1,5 @@
 # Keep alphabetically sorted by default
 
-igt@chamelium@dp-hpd-fast
-igt@chamelium@dp-edid-read
-igt@chamelium@dp-crc-fast
-igt@chamelium@hdmi-hpd-fast
-igt@chamelium@hdmi-edid-read
-igt@chamelium@hdmi-crc-fast
-igt@chamelium@vga-hpd-fast
-igt@chamelium@vga-edid-read
-igt@chamelium@common-hpd-after-suspend
 igt@core_auth@basic-auth
 igt@core_prop_blob@basic
 igt@debugfs_test@read_all_entries
@@ -208,6 +199,15 @@ igt@kms_addfb_basic@unused-pitches
 igt@kms_busy@basic-flip-a
 igt@kms_busy@basic-flip-b
 igt@kms_busy@basic-flip-c
+igt@kms_chamelium@dp-hpd-fast
+igt@kms_chamelium@dp-edid-read
+igt@kms_chamelium@dp-crc-fast
+igt@kms_chamelium@hdmi-hpd-fast
+igt@kms_chamelium@hdmi-edid-read
+igt@kms_chamelium@hdmi-crc-fast
+igt@kms_chamelium@vga-hpd-fast
+igt@kms_chamelium@vga-edid-read
+igt@kms_chamelium@common-hpd-after-suspend
 igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic
 igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy
 igt@kms_cursor_legacy@basic-flip-after-cursor-atomic
tests/kms_chamelium.c renamed from tests/chamelium.c +0 -0
similarity index 100%
rename from tests/chamelium.c
rename to tests/kms_chamelium.c
tests/meson.build +0 -0
index c3d5372f78ac..20ff79dcb15f 100644
@@ -251,7 +251,7 @@ endif
 
Quoted 7 lines

tests/meson.build endif · line 257

Quoted 7 lines
tests/meson.build +1 -1
 if chamelium.found()
 	test_progs += [
-		'chamelium',
+		'kms_chamelium',
 	]
 	test_deps += chamelium
 endif

Pushed, thanks for review. :)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

✗ Fi.CI.BAT: failure for series starting with [1/4] lib/igt_kms: Add igt_display_reset function.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: series starting with [1/4] lib/igt_kms: Add igt_display_reset function.
URL : https://patchwork.freedesktop.org/series/33934/
State : failure

== Summary ==

IGT patchset tested on top of latest successful build 88d6550795fad3974d77e4db2f563c5e2e8872e1 Revert "tests/kms_flip: Make flip-vs-panning-vs-hang change DSPSURF"

with latest DRM-Tip kernel build CI_DRM_3353
1fc4fe8ac97e drm-tip: 2017y-11m-16d-12h-57m-10s UTC integration manifest

Testlist changes:
+igt@kms_chamelium@common-hpd-after-hibernate +igt@kms_chamelium@common-hpd-after-suspend +igt@kms_chamelium@dp-crc-fast +igt@kms_chamelium@dp-crc-multiple +igt@kms_chamelium@dp-crc-single +igt@kms_chamelium@dp-edid-change-during-hibernate +igt@kms_chamelium@dp-edid-change-during-suspend +igt@kms_chamelium@dp-edid-read +igt@kms_chamelium@dp-frame-dump +igt@kms_chamelium@dp-hpd +igt@kms_chamelium@dp-hpd-after-hibernate +igt@kms_chamelium@dp-hpd-after-suspend +igt@kms_chamelium@dp-hpd-fast +igt@kms_chamelium@dp-hpd-storm +igt@kms_chamelium@dp-hpd-storm-disable +igt@kms_chamelium@hdmi-crc-fast +igt@kms_chamelium@hdmi-crc-multiple +igt@kms_chamelium@hdmi-crc-single +igt@kms_chamelium@hdmi-edid-change-during-hibernate +igt@kms_chamelium@hdmi-edid-change-during-suspend +igt@kms_chamelium@hdmi-edid-read +igt@kms_chamelium@hdmi-frame-dump +igt@kms_chamelium@hdmi-hpd +igt@kms_chamelium@hdmi-hpd-after-hibernate +igt@kms_chamelium@hdmi-hpd-after-suspend +igt@kms_chamelium@hdmi-hpd-fast +igt@kms_chamelium@hdmi-hpd-storm +igt@kms_chamelium@hdmi-hpd-storm-disable +igt@kms_chamelium@vga-edid-read +igt@kms_chamelium@vga-frame-dump +igt@kms_chamelium@vga-hpd +igt@kms_chamelium@vga-hpd-after-hibernate +igt@kms_chamelium@vga-hpd-after-suspend +igt@kms_chamelium@vga-hpd-fast +igt@kms_chamelium@vga-hpd-without-ddc -igt@chamelium@common-hpd-after-hibernate -igt@chamelium@common-hpd-after-suspend -igt@chamelium@dp-crc-fast -igt@chamelium@dp-crc-multiple -igt@chamelium@dp-crc-single -igt@chamelium@dp-edid-change-during-hibernate -igt@chamelium@dp-edid-change-during-suspend -igt@chamelium@dp-edid-read -igt@chamelium@dp-frame-dump -igt@chamelium@dp-hpd -igt@chamelium@dp-hpd-after-hibernate -igt@chamelium@dp-hpd-after-suspend -igt@chamelium@dp-hpd-fast -igt@chamelium@dp-hpd-storm -igt@chamelium@dp-hpd-storm-disable -igt@chamelium@hdmi-crc-fast -igt@chamelium@hdmi-crc-multiple -igt@chamelium@hdmi-crc-single -igt@chamelium@hdmi-edid-change-during-hibernate -igt@chamelium@hdmi-edid-change-during-suspend -igt@chamelium@hdmi-edid-read -igt@chamelium@hdmi-frame-dump -igt@chamelium@hdmi-hpd -igt@chamelium@hdmi-hpd-after-hibernate -igt@chamelium@hdmi-hpd-after-suspend -igt@chamelium@hdmi-hpd-fast -igt@chamelium@hdmi-hpd-storm -igt@chamelium@hdmi-hpd-storm-disable -igt@chamelium@vga-edid-read -igt@chamelium@vga-frame-dump -igt@chamelium@vga-hpd -igt@chamelium@vga-hpd-after-hibernate -igt@chamelium@vga-hpd-after-suspend -igt@chamelium@vga-hpd-fast -igt@chamelium@vga-hpd-without-ddc

Test debugfs_test:

        Subgroup read_all_entries:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
Test kms_busy:
        Subgroup basic-flip-a:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-ilk-650)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup basic-flip-b:
                pass       -> FAIL       (fi-bwr-2160) fdo#103182
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-ilk-650)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi) fdo#102403
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup basic-flip-c:
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-bsw-n3050)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k) fdo#103097 +2
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205) fdo#102035 +5
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-legacy:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
        Subgroup basic-flip-after-cursor-legacy:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
        Subgroup basic-flip-after-cursor-varying-size:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
        Subgroup basic-flip-before-cursor-legacy:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
        Subgroup basic-flip-before-cursor-varying-size:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
Test kms_force_connector_basic:
        Subgroup force-connector-state:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-a:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-ilk-650)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup hang-read-crc-pipe-b:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-ilk-650)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k) fdo#103191 +4
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup hang-read-crc-pipe-c:
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-bsw-n3050)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u) fdo#103163 +1
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup nonblocking-crc-pipe-a:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-ilk-650)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup nonblocking-crc-pipe-a-frame-sequence:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-ilk-650)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k) fdo#103546 +1
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u) fdo#103165 +1
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup nonblocking-crc-pipe-b:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-ilk-650)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900)
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)
                pass       -> FAIL       (fi-ilk-650)
                pass       -> FAIL       (fi-snb-2520m)
                pass       -> FAIL       (fi-snb-2600)
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-byt-j1900) fdo#102657
                pass       -> FAIL       (fi-byt-n2820)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup nonblocking-crc-pipe-c:
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-bsw-n3050)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup nonblocking-crc-pipe-c-frame-sequence:
                pass       -> FAIL       (fi-ivb-3520m)
                pass       -> FAIL       (fi-ivb-3770)
                pass       -> FAIL       (fi-hsw-4770)
                pass       -> FAIL       (fi-hsw-4770r)
                pass       -> FAIL       (fi-bdw-5557u)
                pass       -> FAIL       (fi-bsw-n3050)
                pass       -> FAIL       (fi-skl-6260u)
                pass       -> FAIL       (fi-skl-6600u)
                pass       -> FAIL       (fi-skl-6700hq)
                pass       -> FAIL       (fi-skl-6700k)
                pass       -> FAIL       (fi-skl-6770hq)
                pass       -> FAIL       (fi-skl-gvtdvm)
                pass       -> FAIL       (fi-bxt-dsi)
                pass       -> FAIL       (fi-bxt-j4205)
                pass       -> FAIL       (fi-kbl-7500u)
                pass       -> FAIL       (fi-kbl-7560u)
                pass       -> FAIL       (fi-kbl-7567u)
                pass       -> FAIL       (fi-kbl-r)
                pass       -> FAIL       (fi-glk-1)
        Subgroup read-crc-pipe-a:
                pass       -> FAIL       (fi-bwr-2160)
                pass       -> FAIL       (fi-elk-e7500)

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_509/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

PATCH 1/1 lib/igt_kms: Add igt_display_reset function, v2.

In reply to Maarten Lankhorst

A lot of code duplicates this, but it should be handled in the core. Add it and use it after igt_display_init(), the tests have to be converted one by one.

Changes since v1:
- Merely reset rotation to HW value.

---
 lib/igt_kms.c | 164 +++++++++++++++++++++++++++++++++++++---------------------
 lib/igt_kms.h |   1 +
 2 files changed, 106 insertions(+), 59 deletions(-)
lib/igt_kms.c +105 -59
index 1d26b8ddbf43..d51aba50e3d1 100644
@@ -1549,29 +1549,14 @@ static void igt_output_refresh(igt_output_t *output)
 			       -1);
 	}
 
-	if (output->config.connector) {
+	if (output->config.connector)
 		igt_atomic_fill_connector_props(display, output,
 			IGT_NUM_CONNECTOR_PROPS, igt_connector_prop_names);
 
-		if (output->props[IGT_CONNECTOR_BROADCAST_RGB])
-			igt_output_set_prop_value(output,
-						  IGT_CONNECTOR_BROADCAST_RGB,
-						  BROADCAST_RGB_FULL);
-	}
-
 	LOG(display, "%s: Selecting pipe %s\n", output->name,
 	    kmstest_pipe_name(output->pending_pipe));
 }
 
-static bool
-get_plane_property(int drm_fd, uint32_t plane_id, const char *name,
-		   uint32_t *prop_id /* out */, uint64_t *value /* out */,
-		   drmModePropertyPtr *prop /* out */)
-{
-	return kmstest_get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE,
-				    name, prop_id, value, prop);
-}
-
 static int
 igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
 {
@@ -1582,15 +1567,6 @@ igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
 				 DRM_MODE_OBJECT_PLANE, prop_id, value);
 }
 
-static bool
-get_crtc_property(int drm_fd, uint32_t crtc_id, const char *name,
-		   uint32_t *prop_id /* out */, uint64_t *value /* out */,
-		   drmModePropertyPtr *prop /* out */)
-{
-	return kmstest_get_property(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC,
-				    name, prop_id, value, prop);
-}
-
 /*
  * Walk a plane's property list to determine its type.  If we don't
  * find a type property, then the kernel doesn't support universal
@@ -1601,14 +1577,112 @@ static int get_drm_plane_type(int drm_fd, uint32_t plane_id)
 	uint64_t value;
 	bool has_prop;
 
-	has_prop = get_plane_property(drm_fd, plane_id, "type",
-				      NULL /* prop_id */, &value, NULL);
+	has_prop = kmstest_get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE,
+					"type", NULL, &value, NULL);
 	if (has_prop)
 		return (int)value;
 
 	return DRM_PLANE_TYPE_OVERLAY;
 }
 
+static void igt_plane_reset(igt_plane_t *plane)
+{
+	/* Reset src coordinates. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_W, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H, 0);
+
+	/* Reset crtc coordinates. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_X, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_Y, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_W, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, 0);
+
+	/* Reset binding to fb and crtc. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, 0);
+
+	/* Use default rotation */
+	if (igt_plane_has_prop(plane, IGT_PLANE_ROTATION)) {
+		plane->values[IGT_PLANE_ROTATION] =
+			igt_plane_get_prop_value(plane, IGT_PLANE_ROTATION);
+		igt_plane_clear_prop_changed(plane, IGT_PLANE_ROTATION);
+	}
+
+	igt_plane_clear_prop_changed(plane, IGT_PLANE_IN_FENCE_FD);
+	plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
+}
+
+static void igt_pipe_reset(igt_pipe_t *pipe)
+{
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_MODE_ID, 0);
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_ACTIVE, 0);
+	igt_pipe_obj_clear_prop_changed(pipe, IGT_CRTC_OUT_FENCE_PTR);
+
+	pipe->out_fence_fd = -1;
+}
+
+static void igt_output_reset(igt_output_t *output)
+{
+	output->pending_pipe = PIPE_NONE;
+	output->use_override_mode = false;
+	memset(&output->override_mode, 0, sizeof(output->override_mode));
+
+	igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, 0);
+
+	if (igt_output_has_prop(output, IGT_CONNECTOR_BROADCAST_RGB))
+		igt_output_set_prop_value(output, IGT_CONNECTOR_BROADCAST_RGB,
+					  BROADCAST_RGB_FULL);
+}
+
+/**
+ * igt_display_reset:
+ * @display: a pointer to an #igt_display_t structure
+ *
+ * Reset basic pipes, connectors and planes on @display back to default values.
+ * In particular, the following properties will be reset:
+ *
+ * For outputs:
+ * - %IGT_CONNECTOR_CRTC_ID
+ * - %IGT_CONNECTOR_BROADCAST_RGB (if applicable)
+ * - igt_output_override_mode() to default.
+ *
+ * For pipes:
+ * - %IGT_CRTC_MODE_ID (leaked)
+ * - %IGT_CRTC_ACTIVE
+ * - %IGT_CRTC_OUT_FENCE_PTR
+ *
+ * For planes:
+ * - %IGT_PLANE_SRC_*
+ * - %IGT_PLANE_CRTC_*
+ * - %IGT_PLANE_FB_ID
+ * - %IGT_PLANE_CRTC_ID
+ * - %IGT_PLANE_ROTATION
+ * - %IGT_PLANE_IN_FENCE_FD
+ */
+void igt_display_reset(igt_display_t *display)
+{
+	enum pipe pipe;
+	int i;
+
+	for_each_pipe(display, pipe) {
+		igt_pipe_t *pipe_obj = &display->pipes[pipe];
+		igt_plane_t *plane;
+
+		for_each_plane_on_pipe(display, pipe, plane)
+			igt_plane_reset(plane);
+
+		igt_pipe_reset(pipe_obj);
+	}
+
+	for (i = 0; i < display->n_outputs; i++) {
+		igt_output_t *output = &display->outputs[i];
+
+		igt_output_reset(output);
+	}
+}
+
 /**
  * igt_display_init:
  * @display: a pointer to an #igt_display_t structure
@@ -1648,7 +1722,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 	plane_resources = drmModeGetPlaneResources(display->drm_fd);
 	igt_assert(plane_resources);
 
-	for (i = 0; i < display->n_pipes; i++) {
+	for_each_pipe(display, i) {
 		igt_pipe_t *pipe = &display->pipes[i];
 		igt_plane_t *plane;
 		int p = 1;
@@ -1661,19 +1735,9 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		pipe->plane_cursor = -1;
 		pipe->plane_primary = -1;
 		pipe->planes = NULL;
-		pipe->out_fence_fd = -1;
 
 		igt_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
 
-		/* Force modeset disable on first commit */
-		igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
-		igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_ACTIVE);
-
-		get_crtc_property(display->drm_fd, pipe->crtc_id,
-				    "background_color", NULL,
-				    &pipe->values[IGT_CRTC_BACKGROUND],
-				    NULL);
-
 		/* count number of valid planes */
 		for (j = 0; j < plane_resources->count_planes; j++) {
 			drmModePlane *drm_plane;
@@ -1730,24 +1794,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 			plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
 
 			igt_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
-
-			get_plane_property(display->drm_fd, drm_plane->plane_id,
-					   "rotation",
-					   &plane->props[IGT_PLANE_ROTATION],
-					   &plane->values[IGT_PLANE_ROTATION],
-					   NULL);
-
-			/* Clear any residual framebuffer info on first commit. */
-			igt_plane_set_prop_changed(plane, IGT_PLANE_FB_ID);
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_ID);
-
-			/*
-			 * CRTC_X/Y are not changed in igt_plane_set_fb, so
-			 * force them to be sanitized in case they contain
-			 * garbage.
-			 */
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_X);
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_Y);
 		}
 
 		/*
@@ -1782,18 +1828,18 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		 * a pipe is set with igt_output_set_pipe().
 		 */
 		output->force_reprobe = true;
-		output->pending_pipe = PIPE_NONE;
 		output->id = resources->connectors[i];
 		output->display = display;
 
 		igt_output_refresh(output);
-
-		igt_output_set_prop_changed(output, IGT_CONNECTOR_CRTC_ID);
 	}
 
 	drmModeFreePlaneResources(plane_resources);
 	drmModeFreeResources(resources);
 
+	/* Set reasonable default values for every object in the display. */
+	igt_display_reset(display);
+
 	LOG_UNINDENT(display);
 }
 
lib/igt_kms.h +1 -0
index acc82913e0b7..e1883bf1b8a3 100644
@@ -353,6 +353,7 @@ struct igt_display {
 
 void igt_display_init(igt_display_t *display, int drm_fd);
 void igt_display_fini(igt_display_t *display);
+void igt_display_reset(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_try_commit_atomic(igt_display_t *display, uint32_t flags, void *user_data);
Signature · 6 lines
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 1/1 lib/igt_kms: Add igt_display_reset function, v3.

A lot of code duplicates this, but it should be handled in the core. Add it and use it after igt_display_init(), the tests have to be converted one by one.

Changes since v1:
- Merely reset rotation to HW value.
Changes since v2:
- Compile.

---
 lib/igt_kms.c | 164 +++++++++++++++++++++++++++++++++++++---------------------
 lib/igt_kms.h |   1 +
 2 files changed, 106 insertions(+), 59 deletions(-)
lib/igt_kms.c +105 -59
index 1d26b8ddbf43..becd77ce19aa 100644
@@ -1549,29 +1549,14 @@ static void igt_output_refresh(igt_output_t *output)
 			       -1);
 	}
 
-	if (output->config.connector) {
+	if (output->config.connector)
 		igt_atomic_fill_connector_props(display, output,
 			IGT_NUM_CONNECTOR_PROPS, igt_connector_prop_names);
 
-		if (output->props[IGT_CONNECTOR_BROADCAST_RGB])
-			igt_output_set_prop_value(output,
-						  IGT_CONNECTOR_BROADCAST_RGB,
-						  BROADCAST_RGB_FULL);
-	}
-
 	LOG(display, "%s: Selecting pipe %s\n", output->name,
 	    kmstest_pipe_name(output->pending_pipe));
 }
 
-static bool
-get_plane_property(int drm_fd, uint32_t plane_id, const char *name,
-		   uint32_t *prop_id /* out */, uint64_t *value /* out */,
-		   drmModePropertyPtr *prop /* out */)
-{
-	return kmstest_get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE,
-				    name, prop_id, value, prop);
-}
-
 static int
 igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
 {
@@ -1582,15 +1567,6 @@ igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t value)
 				 DRM_MODE_OBJECT_PLANE, prop_id, value);
 }
 
-static bool
-get_crtc_property(int drm_fd, uint32_t crtc_id, const char *name,
-		   uint32_t *prop_id /* out */, uint64_t *value /* out */,
-		   drmModePropertyPtr *prop /* out */)
-{
-	return kmstest_get_property(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC,
-				    name, prop_id, value, prop);
-}
-
 /*
  * Walk a plane's property list to determine its type.  If we don't
  * find a type property, then the kernel doesn't support universal
@@ -1601,14 +1577,112 @@ static int get_drm_plane_type(int drm_fd, uint32_t plane_id)
 	uint64_t value;
 	bool has_prop;
 
-	has_prop = get_plane_property(drm_fd, plane_id, "type",
-				      NULL /* prop_id */, &value, NULL);
+	has_prop = kmstest_get_property(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE,
+					"type", NULL, &value, NULL);
 	if (has_prop)
 		return (int)value;
 
 	return DRM_PLANE_TYPE_OVERLAY;
 }
 
+static void igt_plane_reset(igt_plane_t *plane)
+{
+	/* Reset src coordinates. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_W, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H, 0);
+
+	/* Reset crtc coordinates. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_X, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_Y, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_W, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, 0);
+
+	/* Reset binding to fb and crtc. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, 0);
+
+	/* Use default rotation */
+	if (igt_plane_has_prop(plane, IGT_PLANE_ROTATION)) {
+		plane->values[IGT_PLANE_ROTATION] =
+			igt_plane_get_prop(plane, IGT_PLANE_ROTATION);
+		igt_plane_clear_prop_changed(plane, IGT_PLANE_ROTATION);
+	}
+
+	igt_plane_clear_prop_changed(plane, IGT_PLANE_IN_FENCE_FD);
+	plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
+}
+
+static void igt_pipe_reset(igt_pipe_t *pipe)
+{
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_MODE_ID, 0);
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_ACTIVE, 0);
+	igt_pipe_obj_clear_prop_changed(pipe, IGT_CRTC_OUT_FENCE_PTR);
+
+	pipe->out_fence_fd = -1;
+}
+
+static void igt_output_reset(igt_output_t *output)
+{
+	output->pending_pipe = PIPE_NONE;
+	output->use_override_mode = false;
+	memset(&output->override_mode, 0, sizeof(output->override_mode));
+
+	igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, 0);
+
+	if (igt_output_has_prop(output, IGT_CONNECTOR_BROADCAST_RGB))
+		igt_output_set_prop_value(output, IGT_CONNECTOR_BROADCAST_RGB,
+					  BROADCAST_RGB_FULL);
+}
+
+/**
+ * igt_display_reset:
+ * @display: a pointer to an #igt_display_t structure
+ *
+ * Reset basic pipes, connectors and planes on @display back to default values.
+ * In particular, the following properties will be reset:
+ *
+ * For outputs:
+ * - %IGT_CONNECTOR_CRTC_ID
+ * - %IGT_CONNECTOR_BROADCAST_RGB (if applicable)
+ * - igt_output_override_mode() to default.
+ *
+ * For pipes:
+ * - %IGT_CRTC_MODE_ID (leaked)
+ * - %IGT_CRTC_ACTIVE
+ * - %IGT_CRTC_OUT_FENCE_PTR
+ *
+ * For planes:
+ * - %IGT_PLANE_SRC_*
+ * - %IGT_PLANE_CRTC_*
+ * - %IGT_PLANE_FB_ID
+ * - %IGT_PLANE_CRTC_ID
+ * - %IGT_PLANE_ROTATION
+ * - %IGT_PLANE_IN_FENCE_FD
+ */
+void igt_display_reset(igt_display_t *display)
+{
+	enum pipe pipe;
+	int i;
+
+	for_each_pipe(display, pipe) {
+		igt_pipe_t *pipe_obj = &display->pipes[pipe];
+		igt_plane_t *plane;
+
+		for_each_plane_on_pipe(display, pipe, plane)
+			igt_plane_reset(plane);
+
+		igt_pipe_reset(pipe_obj);
+	}
+
+	for (i = 0; i < display->n_outputs; i++) {
+		igt_output_t *output = &display->outputs[i];
+
+		igt_output_reset(output);
+	}
+}
+
 /**
  * igt_display_init:
  * @display: a pointer to an #igt_display_t structure
@@ -1648,7 +1722,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 	plane_resources = drmModeGetPlaneResources(display->drm_fd);
 	igt_assert(plane_resources);
 
-	for (i = 0; i < display->n_pipes; i++) {
+	for_each_pipe(display, i) {
 		igt_pipe_t *pipe = &display->pipes[i];
 		igt_plane_t *plane;
 		int p = 1;
@@ -1661,19 +1735,9 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		pipe->plane_cursor = -1;
 		pipe->plane_primary = -1;
 		pipe->planes = NULL;
-		pipe->out_fence_fd = -1;
 
 		igt_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS, igt_crtc_prop_names);
 
-		/* Force modeset disable on first commit */
-		igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
-		igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_ACTIVE);
-
-		get_crtc_property(display->drm_fd, pipe->crtc_id,
-				    "background_color", NULL,
-				    &pipe->values[IGT_CRTC_BACKGROUND],
-				    NULL);
-
 		/* count number of valid planes */
 		for (j = 0; j < plane_resources->count_planes; j++) {
 			drmModePlane *drm_plane;
@@ -1730,24 +1794,6 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 			plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
 
 			igt_fill_plane_props(display, plane, IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
-
-			get_plane_property(display->drm_fd, drm_plane->plane_id,
-					   "rotation",
-					   &plane->props[IGT_PLANE_ROTATION],
-					   &plane->values[IGT_PLANE_ROTATION],
-					   NULL);
-
-			/* Clear any residual framebuffer info on first commit. */
-			igt_plane_set_prop_changed(plane, IGT_PLANE_FB_ID);
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_ID);
-
-			/*
-			 * CRTC_X/Y are not changed in igt_plane_set_fb, so
-			 * force them to be sanitized in case they contain
-			 * garbage.
-			 */
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_X);
-			igt_plane_set_prop_changed(plane, IGT_PLANE_CRTC_Y);
 		}
 
 		/*
@@ -1782,18 +1828,18 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 		 * a pipe is set with igt_output_set_pipe().
 		 */
 		output->force_reprobe = true;
-		output->pending_pipe = PIPE_NONE;
 		output->id = resources->connectors[i];
 		output->display = display;
 
 		igt_output_refresh(output);
-
-		igt_output_set_prop_changed(output, IGT_CONNECTOR_CRTC_ID);
 	}
 
 	drmModeFreePlaneResources(plane_resources);
 	drmModeFreeResources(resources);
 
+	/* Set reasonable default values for every object in the display. */
+	igt_display_reset(display);
+
 	LOG_UNINDENT(display);
 }
 
lib/igt_kms.h +1 -0
index acc82913e0b7..e1883bf1b8a3 100644
@@ -353,6 +353,7 @@ struct igt_display {
 
 void igt_display_init(igt_display_t *display, int drm_fd);
 void igt_display_fini(igt_display_t *display);
+void igt_display_reset(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_try_commit_atomic(igt_display_t *display, uint32_t flags, void *user_data);
Signature · 6 lines
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

✗ Fi.CI.BAT: failure for series starting with lib/igt_kms: Add igt_display_reset function, v2. (rev2)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: series starting with lib/igt_kms: Add igt_display_reset function, v2. (rev2)
URL : https://patchwork.freedesktop.org/series/33934/
State : failure

== Summary ==

IGT patchset build failed on latest successful build 936b97165308e179880fc0f218192881953f2544 lib: Dump /sys/kernel/debug/suspend_stats after suspend failure

make all-recursive
Making all in lib
make all-recursive
Making all in .
CC igt_kms.lo
igt_kms.c: In function ‘igt_plane_reset’:
igt_kms.c:1609:4: error: implicit declaration of function ‘igt_plane_get_prop_value’ [-Werror=implicit-function-declaration]

    igt_plane_get_prop_value(plane, IGT_PLANE_ROTATION);
    ^~~~~~~~~~~~~~~~~~~~~~~~

igt_kms.c:1609:4: warning: nested extern declaration of ‘igt_plane_get_prop_value’ [-Wnested-externs]
cc1: some warnings being treated as errors
Makefile:738: recipe for target 'igt_kms.lo' failed
make[4]: *** [igt_kms.lo] Error 1
Makefile:761: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
Makefile:580: recipe for target 'all' failed
make[2]: *** [all] Error 2
Makefile:533: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
Makefile:465: recipe for target 'all' failed
make: *** [all] Error 2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

✓ Fi.CI.BAT: success for series starting with lib/igt_kms: Add igt_display_reset function, v3. (rev3)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: series starting with lib/igt_kms: Add igt_display_reset function, v3. (rev3)
URL : https://patchwork.freedesktop.org/series/33934/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 936b97165308e179880fc0f218192881953f2544 lib: Dump /sys/kernel/debug/suspend_stats after suspend failure

with latest DRM-Tip kernel build CI_DRM_3354
3878ad19ccd4 drm-tip: 2017y-11m-16d-15h-48m-14s UTC integration manifest

Testlist changes:
+igt@kms_chamelium@common-hpd-after-hibernate +igt@kms_chamelium@common-hpd-after-suspend +igt@kms_chamelium@dp-crc-fast +igt@kms_chamelium@dp-crc-multiple +igt@kms_chamelium@dp-crc-single +igt@kms_chamelium@dp-edid-change-during-hibernate +igt@kms_chamelium@dp-edid-change-during-suspend +igt@kms_chamelium@dp-edid-read +igt@kms_chamelium@dp-frame-dump +igt@kms_chamelium@dp-hpd +igt@kms_chamelium@dp-hpd-after-hibernate +igt@kms_chamelium@dp-hpd-after-suspend +igt@kms_chamelium@dp-hpd-fast +igt@kms_chamelium@dp-hpd-storm +igt@kms_chamelium@dp-hpd-storm-disable +igt@kms_chamelium@hdmi-crc-fast +igt@kms_chamelium@hdmi-crc-multiple +igt@kms_chamelium@hdmi-crc-single +igt@kms_chamelium@hdmi-edid-change-during-hibernate +igt@kms_chamelium@hdmi-edid-change-during-suspend +igt@kms_chamelium@hdmi-edid-read +igt@kms_chamelium@hdmi-frame-dump +igt@kms_chamelium@hdmi-hpd +igt@kms_chamelium@hdmi-hpd-after-hibernate +igt@kms_chamelium@hdmi-hpd-after-suspend +igt@kms_chamelium@hdmi-hpd-fast +igt@kms_chamelium@hdmi-hpd-storm +igt@kms_chamelium@hdmi-hpd-storm-disable +igt@kms_chamelium@vga-edid-read +igt@kms_chamelium@vga-frame-dump +igt@kms_chamelium@vga-hpd +igt@kms_chamelium@vga-hpd-after-hibernate +igt@kms_chamelium@vga-hpd-after-suspend +igt@kms_chamelium@vga-hpd-fast +igt@kms_chamelium@vga-hpd-without-ddc -igt@chamelium@common-hpd-after-hibernate -igt@chamelium@common-hpd-after-suspend -igt@chamelium@dp-crc-fast -igt@chamelium@dp-crc-multiple -igt@chamelium@dp-crc-single -igt@chamelium@dp-edid-change-during-hibernate -igt@chamelium@dp-edid-change-during-suspend -igt@chamelium@dp-edid-read -igt@chamelium@dp-frame-dump -igt@chamelium@dp-hpd -igt@chamelium@dp-hpd-after-hibernate -igt@chamelium@dp-hpd-after-suspend -igt@chamelium@dp-hpd-fast -igt@chamelium@dp-hpd-storm -igt@chamelium@dp-hpd-storm-disable -igt@chamelium@hdmi-crc-fast -igt@chamelium@hdmi-crc-multiple -igt@chamelium@hdmi-crc-single -igt@chamelium@hdmi-edid-change-during-hibernate -igt@chamelium@hdmi-edid-change-during-suspend -igt@chamelium@hdmi-edid-read -igt@chamelium@hdmi-frame-dump -igt@chamelium@hdmi-hpd -igt@chamelium@hdmi-hpd-after-hibernate -igt@chamelium@hdmi-hpd-after-suspend -igt@chamelium@hdmi-hpd-fast -igt@chamelium@hdmi-hpd-storm -igt@chamelium@hdmi-hpd-storm-disable -igt@chamelium@vga-edid-read -igt@chamelium@vga-frame-dump -igt@chamelium@vga-hpd -igt@chamelium@vga-hpd-after-hibernate -igt@chamelium@vga-hpd-after-suspend -igt@chamelium@vga-hpd-fast -igt@chamelium@vga-hpd-without-ddc

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-b:
                pass       -> INCOMPLETE (fi-snb-2520m) fdo#103713

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:444s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:456s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:381s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:541s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:279s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:517s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:519s
fi-byt-j1900     total:289  pass:254  dwarn:0   dfail:0   fail:0   skip:35  time:505s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:490s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:435s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:265s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:545s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:434s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:441s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:429s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:477s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:463s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:484s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:529s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:475s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:536s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:572s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:460s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:546s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:563s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:527s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:496s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:458s
fi-snb-2520m     total:246  pass:212  dwarn:0   dfail:0   fail:0   skip:33 
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:425s
Blacklisted hosts:
fi-cfl-s2        total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:478s
fi-cnl-y         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:567s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_512/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

✓ Fi.CI.IGT: success for series starting with lib/igt_kms: Add igt_display_reset function, v3. (rev3)

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: series starting with lib/igt_kms: Add igt_display_reset function, v3. (rev3)
URL : https://patchwork.freedesktop.org/series/33934/
State : success

== Summary ==

Test kms_frontbuffer_tracking:

        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                pass       -> FAIL       (shard-snb) fdo#101623
        Subgroup fbc-1p-primscrn-indfb-pgflip-blt:
                skip       -> PASS       (shard-hsw)
Test drv_module_reload:
        Subgroup basic-reload-inject:
                pass       -> DMESG-WARN (shard-snb) fdo#102707 +1
        Subgroup basic-reload:
                pass       -> DMESG-WARN (shard-snb) fdo#102848
Test kms_plane_multiple:
        Subgroup atomic-pipe-c-tiling-x:
                skip       -> PASS       (shard-hsw)
Test kms_flip:
        Subgroup dpms-vs-vblank-race:
                fail       -> PASS       (shard-hsw) fdo#103060

fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#102848 https://bugs.freedesktop.org/show_bug.cgi?id=102848
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060

shard-hsw        total:2584 pass:1472 dwarn:2   dfail:1   fail:10  skip:1099 time:9449s
shard-snb        total:2584 pass:1257 dwarn:3   dfail:1   fail:12  skip:1311 time:7912s

Blacklisted hosts:
shard-apl total:2584 pass:1616 dwarn:5 dfail:1 fail:26 skip:936 time:13244s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_512/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/4
#14 lore raw
In reply to Maarten Lankhorst
Quoted 285 lines · Maarten Lankhorst

A lot of code duplicates this, but it should be handled in the core. Add it and use it after igt_display_init(), the tests have to be converted one by one.

---
 lib/igt_kms.c | 162 +++++++++++++++++++++++++++++++++++++----------------
-----
 lib/igt_kms.h |   1 +
 2 files changed, 104 insertions(+), 59 deletions(-)
lib/igt_kms.c +1 -16
index 1d26b8ddbf43..239f4f17d22e 100644
@@ -1549,29 +1549,14 @@ static void igt_output_refresh(igt_output_t *output)
 			       -1);
 	}
 
-	if (output->config.connector) {
+	if (output->config.connector)
 		igt_atomic_fill_connector_props(display, output,
 			IGT_NUM_CONNECTOR_PROPS, igt_connector_prop_names);
 
-		if (output->props[IGT_CONNECTOR_BROADCAST_RGB])
-			igt_output_set_prop_value(output,
-						  IGT_CONNECTOR_BROADCAST_R
 GB,
-						  BROADCAST_RGB_FULL);
-	}
-
 	LOG(display, "%s: Selecting pipe %s\n", output->name,
 	    kmstest_pipe_name(output->pending_pipe));
 }
 
-static bool
-get_plane_property(int drm_fd, uint32_t plane_id, const char *name,
-		   uint32_t *prop_id /* out */, uint64_t *value /* out */,
-		   drmModePropertyPtr *prop /* out */)
-{
-	return kmstest_get_property(drm_fd, plane_id,
 DRM_MODE_OBJECT_PLANE,
-				    name, prop_id, value, prop);
-}
-
 static int

igt_plane_set_property(igt_plane_t *plane, uint32_t prop_id, uint64_t
value)
{

lib/igt_kms.c +0 -9
@@ -1582,15 +1567,6 @@ igt_plane_set_property(igt_plane_t *plane, uint32_t
 prop_id, uint64_t value)
 				 DRM_MODE_OBJECT_PLANE, prop_id, value);
 }
 
-static bool
-get_crtc_property(int drm_fd, uint32_t crtc_id, const char *name,
-		   uint32_t *prop_id /* out */, uint64_t *value /* out */,
-		   drmModePropertyPtr *prop /* out */)
-{
-	return kmstest_get_property(drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC,
-				    name, prop_id, value, prop);
-}
-
 /*
  * Walk a plane's property list to determine its type.  If we don't

* find a type property, then the kernel doesn't support universal

lib/igt_kms.c +56 -2
@@ -1601,14 +1577,110 @@ static int get_drm_plane_type(int drm_fd, uint32_t
 plane_id)
 	uint64_t value;
 	bool has_prop;
 
-	has_prop = get_plane_property(drm_fd, plane_id, "type",
-				      NULL /* prop_id */, &value, NULL);
+	has_prop = kmstest_get_property(drm_fd, plane_id,
 DRM_MODE_OBJECT_PLANE,
+					"type", NULL, &value, NULL);
 	if (has_prop)
 		return (int)value;
 
 	return DRM_PLANE_TYPE_OVERLAY;
 }
 
+static void igt_plane_reset(igt_plane_t *plane)
+{
+	/* Reset src coordinates. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_W, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_SRC_H, 0);
+
+	/* Reset crtc coordinates. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_X, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_Y, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_W, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_H, 0);
+
+	/* Reset binding to fb and crtc. */
+	igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, 0);
+	igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, 0);
+
+	/* Use default rotation */
+	if (igt_plane_has_prop(plane, IGT_PLANE_ROTATION))
+		igt_plane_set_prop_value(plane, IGT_PLANE_ROTATION,
+					 IGT_ROTATION_0);
+
+	igt_plane_clear_prop_changed(plane, IGT_PLANE_IN_FENCE_FD);
+	plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
+}
+
+static void igt_pipe_reset(igt_pipe_t *pipe)
+{
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_MODE_ID, 0);
+	igt_pipe_obj_set_prop_value(pipe, IGT_CRTC_ACTIVE, 0);
+	igt_pipe_obj_clear_prop_changed(pipe, IGT_CRTC_OUT_FENCE_PTR);
+
+	pipe->out_fence_fd = -1;
+}
+
+static void igt_output_reset(igt_output_t *output)
+{
+	output->pending_pipe = PIPE_NONE;
+	output->use_override_mode = false;
+	memset(&output->override_mode, 0, sizeof(output->override_mode));
+
+	igt_output_set_prop_value(output, IGT_CONNECTOR_CRTC_ID, 0);
+
+	if (igt_output_has_prop(output, IGT_CONNECTOR_BROADCAST_RGB))
+		igt_output_set_prop_value(output,
 IGT_CONNECTOR_BROADCAST_RGB,
+					  BROADCAST_RGB_FULL);
+}
+
+/**
+ * igt_display_reset:
+ * @display: a pointer to an #igt_display_t structure
+ *
+ * Reset basic pipes, connectors and planes on @display back to default

values.
+ * In particular, the following properties will be reset:
+ *
+ * For outputs:
+ * - %IGT_CONNECTOR_CRTC_ID
+ * - %IGT_CONNECTOR_BROADCAST_RGB (if applicable)
+ * - igt_output_override_mode() to default.
+ *
+ * For pipes:
+ * - %IGT_CRTC_MODE_ID (leaked)
+ * - %IGT_CRTC_ACTIVE
+ * - %IGT_CRTC_OUT_FENCE_PTR
+ *
+ * For planes:
+ * - %IGT_PLANE_SRC_*
+ * - %IGT_PLANE_CRTC_*
+ * - %IGT_PLANE_FB_ID
+ * - %IGT_PLANE_CRTC_ID
+ * - %IGT_PLANE_ROTATION
+ * - %IGT_PLANE_IN_FENCE_FD
+ */

lib/igt_kms.c +23 -1
+void igt_display_reset(igt_display_t *display)
+{
+	enum pipe pipe;
+	int i;
+
+	for_each_pipe(display, pipe) {
+		igt_pipe_t *pipe_obj = &display->pipes[pipe];
+		igt_plane_t *plane;
+
+		for_each_plane_on_pipe(display, pipe, plane)
+			igt_plane_reset(plane);
+
+		igt_pipe_reset(pipe_obj);
+	}
+
+	for (i = 0; i < display->n_outputs; i++) {
+		igt_output_t *output = &display->outputs[i];
+
+		igt_output_reset(output);
+	}
+}
+
 /**
  * igt_display_init:
  * @display: a pointer to an #igt_display_t structure
@@ -1648,7 +1720,7 @@ void igt_display_init(igt_display_t *display, int
 drm_fd)
 	plane_resources = drmModeGetPlaneResources(display->drm_fd);
 	igt_assert(plane_resources);
 
-	for (i = 0; i < display->n_pipes; i++) {
+	for_each_pipe(display, i) {
 		igt_pipe_t *pipe = &display->pipes[i];
 		igt_plane_t *plane;
lib/igt_kms.c +0 -10
 		int p = 1;
@@ -1661,19 +1733,9 @@ void igt_display_init(igt_display_t *display, int
 drm_fd)
 		pipe->plane_cursor = -1;
 		pipe->plane_primary = -1;
 		pipe->planes = NULL;
-		pipe->out_fence_fd = -1;
 
 		igt_fill_pipe_props(display, pipe, IGT_NUM_CRTC_PROPS,
 igt_crtc_prop_names);
 
-		/* Force modeset disable on first commit */
-		igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_MODE_ID);
-		igt_pipe_obj_set_prop_changed(pipe, IGT_CRTC_ACTIVE);
-
-		get_crtc_property(display->drm_fd, pipe->crtc_id,
-				    "background_color", NULL,
-				    &pipe->values[IGT_CRTC_BACKGROUND],
-				    NULL);
-
 		/* count number of valid planes */
lib/igt_kms.c +0 -4
 		for (j = 0; j < plane_resources->count_planes; j++) {
 			drmModePlane *drm_plane;
@@ -1730,24 +1792,6 @@ void igt_display_init(igt_display_t *display, int
 drm_fd)
 			plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL;
 
 			igt_fill_plane_props(display, plane,
 IGT_NUM_PLANE_PROPS, igt_plane_prop_names);
-
-			get_plane_property(display->drm_fd, drm_plane-
 >plane_id,
-					   "rotation",
-					   &plane-
Quoted 1 line

props[IGT_PLANE_ROTATION],

lib/igt_kms.c +0 -1
-					   &plane-
Quoted 1 line

values[IGT_PLANE_ROTATION],

lib/igt_kms.c +0 -3
-					   NULL);
-
-			/* Clear any residual framebuffer info on first

commit. */

lib/igt_kms.c +0 -2
-			igt_plane_set_prop_changed(plane, IGT_PLANE_FB_ID);
-			igt_plane_set_prop_changed(plane,

IGT_PLANE_CRTC_ID);

lib/igt_kms.c +0 -7
-
-			/*
-			 * CRTC_X/Y are not changed in igt_plane_set_fb, so
-			 * force them to be sanitized in case they contain
-			 * garbage.
-			 */
-			igt_plane_set_prop_changed(plane,

IGT_PLANE_CRTC_X);

lib/igt_kms.c +0 -1
-			igt_plane_set_prop_changed(plane,

IGT_PLANE_CRTC_Y);

lib/igt_kms.c +3 -3
 		}
 
 		/*
@@ -1782,18 +1826,18 @@ void igt_display_init(igt_display_t *display, int
 drm_fd)
 		 * a pipe is set with igt_output_set_pipe().
 		 */
 		output->force_reprobe = true;
-		output->pending_pipe = PIPE_NONE;
 		output->id = resources->connectors[i];
 		output->display = display;
 
 		igt_output_refresh(output);
-
-		igt_output_set_prop_changed(output, IGT_CONNECTOR_CRTC_ID);
 	}
 
 	drmModeFreePlaneResources(plane_resources);
 	drmModeFreeResources(resources);
 
+	/* Set reasonable default values for every object in the display.
 */
+	igt_display_reset(display);
+
 	LOG_UNINDENT(display);

}

lib/igt_kms.h +1 -0
index acc82913e0b7..e1883bf1b8a3 100644
@@ -353,6 +353,7 @@ struct igt_display {
 
 void igt_display_init(igt_display_t *display, int drm_fd);
 void igt_display_fini(igt_display_t *display);
+void igt_display_reset(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_try_commit_atomic(igt_display_t *display, uint32_t flags,
Quoted 1 line

void *user_data);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx