All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing
@ 2016-12-14  9:04 Robert Foss
  2016-12-14  9:04 ` [PATCH i-g-t v2 01/12] tests/kms_atomic_transition: use igt timeout instead of blocking Robert Foss
                   ` (11 more replies)
  0 siblings, 12 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:04 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso

This series adds in/out fence testing to kms_atomic_transition test and makes some minor cleanups.

This series can be found here:
https://git.collabora.com/cgit/user/robertfoss/intel-gpu-tools.git/log/?h=fences_v2

Gustavo Padovan (11):
  tests/kms_atomic_transition: use igt timeout instead of blocking
  tests/kms_atomic_transition: don't assume max pipes
  lib/igt_kms: move igt_kms_get_alt_edid() to the right place
  lib/igt_kms: export properties names
  tests/kms_atomic: use global atomic properties definitions
  lib/igt_kms: Add support for the OUT_FENCE_PTR property
  tests/kms_atomic: stress possible fence settings
  tests/kms_atomic_transition: add fencing parameter to
    run_transition_tests
  tests/kms_atomic_transition: add out_fences tests
  tests/kms_atomic_transition: add in_fences tests
  tests/kms_atomic_transition: set out_fence for all crtcs

Robert Foss (1):
  lib/igt_kms: Add support for the IN_FENCE_FD property

 lib/igt_kms.c                 | 103 +++++++++++---
 lib/igt_kms.h                 |  31 +++++
 tests/kms_atomic.c            | 309 +++++++++++++++++++++++++++++-------------
 tests/kms_atomic_transition.c | 147 ++++++++++++++++++--
 4 files changed, 458 insertions(+), 132 deletions(-)

-- 
2.11.0

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

^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 01/12] tests/kms_atomic_transition: use igt timeout instead of blocking
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
@ 2016-12-14  9:04 ` Robert Foss
  2016-12-14  9:04 ` [PATCH i-g-t v2 02/12] tests/kms_atomic_transition: don't assume max pipes Robert Foss
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:04 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

If the event never arrives we can timeout and end the test.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_atomic_transition.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 19779935..fb8864e8 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -297,7 +297,9 @@ static void commit_display(igt_display_t *display, unsigned event_mask, bool non
 		struct drm_event_vblank *vblank = (void *)buf;
 		uint32_t crtc_id, pipe = I915_MAX_PIPES;
 
+		igt_set_timeout(3, "Timed out while reading drm_fd\n");
 		ret = read(display->drm_fd, buf, sizeof(buf));
+		igt_reset_timeout();
 		if (ret < 0 && (errno == EINTR || errno == EAGAIN))
 			continue;
 
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 02/12] tests/kms_atomic_transition: don't assume max pipes
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
  2016-12-14  9:04 ` [PATCH i-g-t v2 01/12] tests/kms_atomic_transition: use igt timeout instead of blocking Robert Foss
@ 2016-12-14  9:04 ` Robert Foss
  2016-12-14  9:05 ` [PATCH i-g-t v2 03/12] lib/igt_kms: move igt_kms_get_alt_edid() to the right place Robert Foss
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:04 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_atomic_transition.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index fb8864e8..5575ac18 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -398,7 +398,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 {
 	struct igt_fb fbs[2];
 	int i, j;
-	unsigned iter_max = 1 << I915_MAX_PIPES;
+	unsigned iter_max = 1 << display->n_pipes;
 	igt_pipe_crc_t *pipe_crcs[I915_MAX_PIPES];
 	igt_output_t *output;
 	unsigned width = 0, height = 0;
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 03/12] lib/igt_kms: move igt_kms_get_alt_edid() to the right place
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
  2016-12-14  9:04 ` [PATCH i-g-t v2 01/12] tests/kms_atomic_transition: use igt timeout instead of blocking Robert Foss
  2016-12-14  9:04 ` [PATCH i-g-t v2 02/12] tests/kms_atomic_transition: don't assume max pipes Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14  9:05 ` [PATCH i-g-t v2 04/12] lib/igt_kms: export properties names Robert Foss
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 989704e1..aa9fd161 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -153,23 +153,6 @@ const unsigned char* igt_kms_get_base_edid(void)
 #define EDID_NAME alt_edid
 #include "igt_edid_template.h"
 
-/**
- * igt_kms_get_alt_edid:
- *
- * Get an alternate edid block, which includes the following modes:
- *
- *  - 1400x1050 60Hz
- *  - 1920x1080 60Hz
- *  - 1280x720 60Hz
- *  - 1024x768 60Hz
- *  - 800x600 60Hz
- *  - 640x480 60Hz
- *
- * This can be extended with further features using functions such as
- * #kmstest_edid_add_3d.
- *
- * Returns: an alternate edid block
- */
 static const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	"SRC_X",
 	"SRC_Y",
@@ -297,6 +280,23 @@ igt_atomic_fill_pipe_props(igt_display_t *display, igt_pipe_t *pipe,
 	drmModeFreeObjectProperties(props);
 }
 
+/**
+ * igt_kms_get_alt_edid:
+ *
+ * Get an alternate edid block, which includes the following modes:
+ *
+ *  - 1400x1050 60Hz
+ *  - 1920x1080 60Hz
+ *  - 1280x720 60Hz
+ *  - 1024x768 60Hz
+ *  - 800x600 60Hz
+ *  - 640x480 60Hz
+ *
+ * This can be extended with further features using functions such as
+ * #kmstest_edid_add_3d.
+ *
+ * Returns: an alternate edid block
+ */
 const unsigned char* igt_kms_get_alt_edid(void)
 {
 	update_edid_csum(alt_edid);
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 04/12] lib/igt_kms: export properties names
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (2 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 03/12] lib/igt_kms: move igt_kms_get_alt_edid() to the right place Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14  9:05 ` [PATCH i-g-t v2 05/12] tests/kms_atomic: use global atomic properties definitions Robert Foss
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c |  6 +++---
 lib/igt_kms.h | 23 +++++++++++++++++++++++
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index aa9fd161..8aaff5b8 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -153,7 +153,7 @@ const unsigned char* igt_kms_get_base_edid(void)
 #define EDID_NAME alt_edid
 #include "igt_edid_template.h"
 
-static const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
+const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	"SRC_X",
 	"SRC_Y",
 	"SRC_W",
@@ -168,7 +168,7 @@ static const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	"rotation"
 };
 
-static const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
+const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
 	"background_color",
 	"CTM",
 	"DEGAMMA_LUT",
@@ -177,7 +177,7 @@ static const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
 	"ACTIVE"
 };
 
-static const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
+const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
 	"scaling mode",
 	"CRTC_ID"
 };
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 6422adc0..dbe81bcb 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -113,12 +113,28 @@ enum igt_atomic_crtc_properties {
        IGT_NUM_CRTC_PROPS
 };
 
+/**
+ * igt_crtc_prop_names
+ *
+ * igt_crtc_prop_names contains a list of crtc property names,
+ * as indexed by the igt_atomic_crtc_properties enum.
+ */
+extern const char *igt_crtc_prop_names[];
+
 enum igt_atomic_connector_properties {
        IGT_CONNECTOR_SCALING_MODE = 0,
        IGT_CONNECTOR_CRTC_ID,
        IGT_NUM_CONNECTOR_PROPS
 };
 
+/**
+ * igt_connector_prop_names
+ *
+ * igt_connector_prop_names contains a list of crtc property names,
+ * as indexed by the igt_atomic_connector_properties enum.
+ */
+extern const char *igt_connector_prop_names[];
+
 struct kmstest_connector_config {
 	drmModeCrtc *crtc;
 	drmModeConnector *connector;
@@ -214,6 +230,13 @@ enum igt_atomic_plane_properties {
        IGT_NUM_PLANE_PROPS
 };
 
+/**
+ * igt_plane_prop_names
+ *
+ * igt_plane_prop_names contains a list of crtc property names,
+ * as indexed by the igt_atomic_plane_properties enum.
+ */
+extern const char *igt_plane_prop_names[];
 
 typedef struct igt_display igt_display_t;
 typedef struct igt_pipe igt_pipe_t;
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 05/12] tests/kms_atomic: use global atomic properties definitions
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (3 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 04/12] lib/igt_kms: export properties names Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14  9:05 ` [PATCH i-g-t v2 06/12] lib/igt_kms: Add support for the IN_FENCE_FD property Robert Foss
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_atomic.c | 123 ++++++++++++++++-------------------------------------
 1 file changed, 37 insertions(+), 86 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 1441fdfd..8b648eba 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -105,55 +105,6 @@ static const char *plane_type_prop_names[NUM_PLANE_TYPE_PROPS] = {
 	"Cursor"
 };
 
-enum plane_properties {
-	PLANE_SRC_X = 0,
-	PLANE_SRC_Y,
-	PLANE_SRC_W,
-	PLANE_SRC_H,
-	PLANE_CRTC_X,
-	PLANE_CRTC_Y,
-	PLANE_CRTC_W,
-	PLANE_CRTC_H,
-	PLANE_FB_ID,
-	PLANE_CRTC_ID,
-	PLANE_TYPE,
-	NUM_PLANE_PROPS
-};
-
-static const char *plane_prop_names[NUM_PLANE_PROPS] = {
-	"SRC_X",
-	"SRC_Y",
-	"SRC_W",
-	"SRC_H",
-	"CRTC_X",
-	"CRTC_Y",
-	"CRTC_W",
-	"CRTC_H",
-	"FB_ID",
-	"CRTC_ID",
-	"type"
-};
-
-enum crtc_properties {
-	CRTC_MODE_ID = 0,
-	CRTC_ACTIVE,
-	NUM_CRTC_PROPS
-};
-
-static const char *crtc_prop_names[NUM_CRTC_PROPS] = {
-	"MODE_ID",
-	"ACTIVE"
-};
-
-enum connector_properties {
-	CONNECTOR_CRTC_ID = 0,
-	NUM_CONNECTOR_PROPS
-};
-
-static const char *connector_prop_names[NUM_CONNECTOR_PROPS] = {
-	"CRTC_ID"
-};
-
 struct kms_atomic_blob {
 	uint32_t id; /* 0 if not already allocated */
 	size_t len;
@@ -197,9 +148,9 @@ struct kms_atomic_state {
 
 struct kms_atomic_desc {
 	int fd;
-	uint32_t props_connector[NUM_CONNECTOR_PROPS];
-	uint32_t props_crtc[NUM_CRTC_PROPS];
-	uint32_t props_plane[NUM_PLANE_PROPS];
+	uint32_t props_connector[IGT_NUM_CONNECTOR_PROPS];
+	uint32_t props_crtc[IGT_NUM_CRTC_PROPS];
+	uint32_t props_plane[IGT_NUM_PLANE_PROPS];
 	uint64_t props_plane_type[NUM_PLANE_TYPE_PROPS];
 };
 
@@ -280,7 +231,7 @@ connector_get_current_state(struct kms_atomic_connector_state *connector)
 	for (i = 0; i < props->count_props; i++) {
 		uint32_t *prop_ids = connector->state->desc->props_connector;
 
-		if (props->props[i] == prop_ids[CONNECTOR_CRTC_ID])
+		if (props->props[i] == prop_ids[IGT_CONNECTOR_CRTC_ID])
 			connector->crtc_id = props->prop_values[i];
 	}
 	drmModeFreeObjectProperties(props);
@@ -348,16 +299,16 @@ find_connector(struct kms_atomic_state *state,
 static void plane_populate_req(struct kms_atomic_plane_state *plane,
 			       drmModeAtomicReq *req)
 {
-	plane_set_prop(req, plane, PLANE_CRTC_ID, plane->crtc_id);
-	plane_set_prop(req, plane, PLANE_FB_ID, plane->fb_id);
-	plane_set_prop(req, plane, PLANE_SRC_X, plane->src_x);
-	plane_set_prop(req, plane, PLANE_SRC_Y, plane->src_y);
-	plane_set_prop(req, plane, PLANE_SRC_W, plane->src_w);
-	plane_set_prop(req, plane, PLANE_SRC_H, plane->src_h);
-	plane_set_prop(req, plane, PLANE_CRTC_X, plane->crtc_x);
-	plane_set_prop(req, plane, PLANE_CRTC_Y, plane->crtc_y);
-	plane_set_prop(req, plane, PLANE_CRTC_W, plane->crtc_w);
-	plane_set_prop(req, plane, PLANE_CRTC_H, plane->crtc_h);
+	plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane->crtc_id);
+	plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane->fb_id);
+	plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane->src_x);
+	plane_set_prop(req, plane, IGT_PLANE_SRC_Y, plane->src_y);
+	plane_set_prop(req, plane, IGT_PLANE_SRC_W, plane->src_w);
+	plane_set_prop(req, plane, IGT_PLANE_SRC_H, plane->src_h);
+	plane_set_prop(req, plane, IGT_PLANE_CRTC_X, plane->crtc_x);
+	plane_set_prop(req, plane, IGT_PLANE_CRTC_Y, plane->crtc_y);
+	plane_set_prop(req, plane, IGT_PLANE_CRTC_W, plane->crtc_w);
+	plane_set_prop(req, plane, IGT_PLANE_CRTC_H, plane->crtc_h);
 }
 
 static void plane_get_current_state(struct kms_atomic_plane_state *plane)
@@ -373,27 +324,27 @@ static void plane_get_current_state(struct kms_atomic_plane_state *plane)
 	for (i = 0; i < props->count_props; i++) {
 		uint32_t *prop_ids = desc->props_plane;
 
-		if (props->props[i] == prop_ids[PLANE_CRTC_ID])
+		if (props->props[i] == prop_ids[IGT_PLANE_CRTC_ID])
 			plane->crtc_id = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_FB_ID])
+		else if (props->props[i] == prop_ids[IGT_PLANE_FB_ID])
 			plane->fb_id = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_CRTC_X])
+		else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_X])
 			plane->crtc_x = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_CRTC_Y])
+		else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_Y])
 			plane->crtc_y = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_CRTC_W])
+		else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_W])
 			plane->crtc_w = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_CRTC_H])
+		else if (props->props[i] == prop_ids[IGT_PLANE_CRTC_H])
 			plane->crtc_h = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_SRC_X])
+		else if (props->props[i] == prop_ids[IGT_PLANE_SRC_X])
 			plane->src_x = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_SRC_Y])
+		else if (props->props[i] == prop_ids[IGT_PLANE_SRC_Y])
 			plane->src_y = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_SRC_W])
+		else if (props->props[i] == prop_ids[IGT_PLANE_SRC_W])
 			plane->src_w = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_SRC_H])
+		else if (props->props[i] == prop_ids[IGT_PLANE_SRC_H])
 			plane->src_h = props->prop_values[i];
-		else if (props->props[i] == prop_ids[PLANE_TYPE]) {
+		else if (props->props[i] == prop_ids[IGT_PLANE_TYPE]) {
 			int j;
 
 			for (j = 0; j < ARRAY_SIZE(desc->props_plane_type); j++) {
@@ -473,8 +424,8 @@ find_plane(struct kms_atomic_state *state, enum plane_type type,
 static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
 			      drmModeAtomicReq *req)
 {
-	crtc_set_prop(req, crtc, CRTC_MODE_ID, crtc->mode.id);
-	crtc_set_prop(req, crtc, CRTC_ACTIVE, crtc->active);
+	crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc->mode.id);
+	crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active);
 }
 
 static void crtc_get_current_state(struct kms_atomic_crtc_state *crtc)
@@ -489,7 +440,7 @@ static void crtc_get_current_state(struct kms_atomic_crtc_state *crtc)
 	for (i = 0; i < props->count_props; i++) {
 		uint32_t *prop_ids = crtc->state->desc->props_crtc;
 
-		if (props->props[i] == prop_ids[CRTC_MODE_ID]) {
+		if (props->props[i] == prop_ids[IGT_CRTC_MODE_ID]) {
 			drmModePropertyBlobPtr blob;
 
 			crtc->mode.id = props->prop_values[i];
@@ -509,7 +460,7 @@ static void crtc_get_current_state(struct kms_atomic_crtc_state *crtc)
 				crtc->mode.data = blob->data;
 			crtc->mode.len = blob->length;
 		}
-		else if (props->props[i] == prop_ids[CRTC_ACTIVE]) {
+		else if (props->props[i] == prop_ids[IGT_CRTC_ACTIVE]) {
 			crtc->active = props->prop_values[i];
 		}
 	}
@@ -618,7 +569,7 @@ static void crtc_commit_legacy(struct kms_atomic_crtc_state *crtc,
 
 	for (i = 0; i < props->count_props; i++) {
 		if (props->props[i] !=
-		    crtc->state->desc->props_crtc[CRTC_MODE_ID])
+		    crtc->state->desc->props_crtc[IGT_CRTC_MODE_ID])
 			continue;
 		crtc->mode.id = props->prop_values[i];
 		break;
@@ -747,20 +698,20 @@ static void atomic_setup(struct kms_atomic_state *state)
 	igt_assert(state->connectors);
 
 	fill_obj_props(desc->fd, res->crtcs[0],
-		       DRM_MODE_OBJECT_CRTC, NUM_CRTC_PROPS,
-		       crtc_prop_names, desc->props_crtc);
+		       DRM_MODE_OBJECT_CRTC, IGT_NUM_CRTC_PROPS,
+		       igt_crtc_prop_names, desc->props_crtc);
 
 	fill_obj_props(desc->fd, res_plane->planes[0],
-		       DRM_MODE_OBJECT_PLANE, NUM_PLANE_PROPS,
-		       plane_prop_names, desc->props_plane);
+		       DRM_MODE_OBJECT_PLANE, IGT_NUM_PLANE_PROPS,
+		       igt_plane_prop_names, desc->props_plane);
 	fill_obj_prop_map(desc->fd, res_plane->planes[0],
 			  DRM_MODE_OBJECT_PLANE, "type",
 			  NUM_PLANE_TYPE_PROPS, plane_type_prop_names,
 			  desc->props_plane_type);
 
 	fill_obj_props(desc->fd, res->connectors[0],
-		       DRM_MODE_OBJECT_CONNECTOR, NUM_CONNECTOR_PROPS,
-		       connector_prop_names, desc->props_connector);
+		       DRM_MODE_OBJECT_CONNECTOR, IGT_NUM_CONNECTOR_PROPS,
+		       igt_connector_prop_names, desc->props_connector);
 
 	for (i = 0; i < state->num_crtcs; i++) {
 		struct kms_atomic_crtc_state *crtc = &state->crtcs[i];
@@ -1236,7 +1187,7 @@ static void atomic_invalid_params(struct kms_atomic_crtc_state *crtc,
 
 	/* Valid property, valid value. */
 	for (i = 0; i < ARRAY_SIZE(props_raw); i++) {
-		props_raw[i] = desc->props_crtc[CRTC_MODE_ID];
+		props_raw[i] = desc->props_crtc[IGT_CRTC_MODE_ID];
 		values_raw[i] = crtc->mode.id;
 	}
 	do_ioctl(desc->fd, DRM_IOCTL_MODE_ATOMIC, &ioc);
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 06/12] lib/igt_kms: Add support for the IN_FENCE_FD property
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (4 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 05/12] tests/kms_atomic: use global atomic properties definitions Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14 16:04   ` Brian Starkey
  2016-12-14  9:05 ` [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property Robert Foss
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso

Add support dor the IN_FENCE_FD property to enable setting in fences for atomic
commits.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c | 20 ++++++++++++++++++++
 lib/igt_kms.h |  5 +++++
 2 files changed, 25 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 8aaff5b8..8ca49d86 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -164,6 +164,7 @@ const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 	"CRTC_H",
 	"FB_ID",
 	"CRTC_ID",
+	"IN_FENCE_FD",
 	"type",
 	"rotation"
 };
@@ -1426,6 +1427,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 			n_planes++;
 			plane->pipe = pipe;
 			plane->drm_plane = drm_plane;
+			plane->fence_fd = -1;
 
 			if (is_atomic == 0) {
 				display->is_atomic = 1;
@@ -1712,6 +1714,11 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe,
 	    plane->index,
 	    fb_id);
 
+	if (plane->fence_fd >= 0) {
+		uint64_t fence_fd = (int64_t) plane->fence_fd;
+		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_IN_FENCE_FD, fence_fd);
+	}
+
 	if (plane->fb_changed) {
 		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_ID, fb_id ? crtc_id : 0);
 		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_FB_ID, fb_id);
@@ -2522,6 +2529,19 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
 	plane->size_changed = true;
 }
 
+/**
+ * igt_plane_set_fence_fd:
+ * @plane: plane
+ * @fence_fd: fence fd, disable fence_fd by setting it to -1
+ *
+ * This function sets a fence fd to enable a commit to wait for some event to
+ * occur before completing.
+ */
+void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd)
+{
+	plane->fence_fd = fence_fd;
+}
+
 void igt_plane_set_position(igt_plane_t *plane, int x, int y)
 {
 	igt_pipe_t *pipe = plane->pipe;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index dbe81bcb..9766807c 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -225,6 +225,7 @@ enum igt_atomic_plane_properties {
 
        IGT_PLANE_FB_ID,
        IGT_PLANE_CRTC_ID,
+       IGT_PLANE_IN_FENCE_FD,
        IGT_PLANE_TYPE,
        IGT_PLANE_ROTATION,
        IGT_NUM_PLANE_PROPS
@@ -284,6 +285,9 @@ typedef struct {
 	uint32_t src_h;
 
 	igt_rotation_t rotation;
+
+	/* in fence fd */
+	int32_t fence_fd;
 	uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
 } igt_plane_t;
 
@@ -367,6 +371,7 @@ void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length);
 void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
 
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
+void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
 void igt_plane_set_position(igt_plane_t *plane, int x, int y);
 void igt_plane_set_size(igt_plane_t *plane, int w, int h);
 void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (5 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 06/12] lib/igt_kms: Add support for the IN_FENCE_FD property Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14 16:13   ` Brian Starkey
  2016-12-14  9:05 ` [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings Robert Foss
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Add support for the OUT_FENCE_PTR property to enable setting out fences for
atomic commits.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c | 21 ++++++++++++++++++++-
 lib/igt_kms.h |  3 +++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 8ca49d86..fe1b356d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -175,7 +175,8 @@ const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
 	"DEGAMMA_LUT",
 	"GAMMA_LUT",
 	"MODE_ID",
-	"ACTIVE"
+	"ACTIVE",
+	"OUT_FENCE_PTR"
 };
 
 const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
@@ -2103,6 +2104,10 @@ static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRe
 		igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE, !!output);
 	}
 
+	if (pipe_obj->out_fence_ptr)
+		igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_OUT_FENCE_PTR,
+		    (uint64_t)(uintptr_t) pipe_obj->out_fence_ptr);
+
 	/*
 	 *	TODO: Add all crtc level properties here
 	 */
@@ -2683,6 +2688,20 @@ igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
 }
 
 /**
+ * igt_pipe_set_out_fence_ptr:
+ * @pipe: pipe pointer to which background color to be set
+ * @fence_ptr: out fence pointer
+ *
+ * Sets the out fence pointer that will be passed to the kernel in
+ * the atomic ioctl. When the kernel returns the out fence pointer
+ * will contain the fd number of the out fence created by KMS.
+ */
+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr)
+{
+	pipe->out_fence_ptr = fence_ptr;
+}
+
+/**
  * igt_crtc_set_background:
  * @pipe: pipe pointer to which background color to be set
  * @background: background color value in BGR 16bpc
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 9766807c..8eb611c0 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -110,6 +110,7 @@ enum igt_atomic_crtc_properties {
        IGT_CRTC_GAMMA_LUT,
        IGT_CRTC_MODE_ID,
        IGT_CRTC_ACTIVE,
+       IGT_CRTC_OUT_FENCE_PTR,
        IGT_NUM_CRTC_PROPS
 };
 
@@ -316,6 +317,7 @@ struct igt_pipe {
 
 	uint64_t mode_blob;
 	bool mode_changed;
+	int64_t *out_fence_ptr;
 };
 
 typedef struct {
@@ -369,6 +371,7 @@ static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
 void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
 void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length);
 void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr);
 
 void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
 void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (6 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14 16:39   ` Brian Starkey
  2016-12-14  9:05 ` [PATCH i-g-t v2 09/12] tests/kms_atomic_transition: add fencing parameter to run_transition_tests Robert Foss
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_atomic.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 176 insertions(+), 10 deletions(-)

diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
index 8b648eba..a557ac60 100644
--- a/tests/kms_atomic.c
+++ b/tests/kms_atomic.c
@@ -44,6 +44,7 @@
 #include "drmtest.h"
 #include "igt.h"
 #include "igt_aux.h"
+#include "sw_sync.h"
 
 #ifndef DRM_CLIENT_CAP_ATOMIC
 #define DRM_CLIENT_CAP_ATOMIC 3
@@ -126,6 +127,7 @@ struct kms_atomic_plane_state {
 	uint32_t fb_id; /* 0 to disable */
 	uint32_t src_x, src_y, src_w, src_h; /* 16.16 fixed-point */
 	uint32_t crtc_x, crtc_y, crtc_w, crtc_h; /* normal integers */
+	int32_t fence_fd;
 };
 
 struct kms_atomic_crtc_state {
@@ -133,6 +135,7 @@ struct kms_atomic_crtc_state {
 	uint32_t obj;
 	int idx;
 	bool active;
+	uint64_t out_fence_ptr;
 	struct kms_atomic_blob mode;
 };
 
@@ -190,11 +193,13 @@ static uint32_t blob_duplicate(int fd, uint32_t id_orig)
 	crtc_populate_req(crtc, req); \
 	plane_populate_req(plane, req); \
 	do_atomic_commit((crtc)->state->desc->fd, req, flags); \
-	crtc_check_current_state(crtc, plane, relax); \
-	plane_check_current_state(plane, relax); \
+	if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { \
+		crtc_check_current_state(crtc, plane, relax); \
+		plane_check_current_state(plane, relax); \
+	} \
 }
 
-#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req, relax, e) { \
+#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req, flags, relax, e) { \
 	drmModeAtomicSetCursor(req, 0); \
 	crtc_populate_req(crtc, req); \
 	plane_populate_req(plane, req); \
@@ -299,6 +304,9 @@ find_connector(struct kms_atomic_state *state,
 static void plane_populate_req(struct kms_atomic_plane_state *plane,
 			       drmModeAtomicReq *req)
 {
+	if (plane->fence_fd)
+		plane_set_prop(req, plane, IGT_PLANE_IN_FENCE_FD, plane->fence_fd);
+
 	plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane->crtc_id);
 	plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane->fb_id);
 	plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane->src_x);
@@ -424,6 +432,10 @@ find_plane(struct kms_atomic_state *state, enum plane_type type,
 static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
 			      drmModeAtomicReq *req)
 {
+	if (crtc->out_fence_ptr)
+		crtc_set_prop(req, crtc, IGT_CRTC_OUT_FENCE_PTR,
+			      crtc->out_fence_ptr);
+
 	crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc->mode.id);
 	crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active);
 }
@@ -1052,6 +1064,37 @@ static void plane_invalid_params(struct kms_atomic_crtc_state *crtc,
 	drmModeAtomicFree(req);
 }
 
+static void plane_invalid_params_fence(struct kms_atomic_crtc_state *crtc,
+				struct kms_atomic_plane_state *plane_old,
+				struct kms_atomic_connector_state *conn)
+{
+	struct kms_atomic_plane_state plane = *plane_old;
+	drmModeAtomicReq *req = drmModeAtomicAlloc();
+	int timeline, fence_fd;
+
+	igt_require_sw_sync();
+
+	/* invalid fence fd */
+	plane.fence_fd = plane.state->desc->fd;
+	plane.crtc_id = plane_old->crtc_id;
+	plane_commit_atomic_err(&plane, plane_old, req,
+	                        ATOMIC_RELAX_NONE, EINVAL);
+
+	/* Valid fence_fd but invalid CRTC */
+	timeline = sw_sync_timeline_create();
+	fence_fd =  sw_sync_fence_create(timeline, 1);
+	plane.fence_fd = fence_fd;
+	plane.crtc_id = ~0U;
+	plane_commit_atomic_err(&plane, plane_old, req,
+	                        ATOMIC_RELAX_NONE, EINVAL);
+
+	plane.fence_fd = -1;
+	close(fence_fd);
+	close(timeline);
+
+	drmModeAtomicFree(req);
+}
+
 static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
 				struct kms_atomic_plane_state *plane,
 				struct kms_atomic_connector_state *conn)
@@ -1063,30 +1106,32 @@ static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
 
 	/* Pass a series of invalid object IDs for the mode ID. */
 	crtc.mode.id = plane->obj;
-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
 	                       ATOMIC_RELAX_NONE, EINVAL);
 
 	crtc.mode.id = crtc.obj;
-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
 	                       ATOMIC_RELAX_NONE, EINVAL);
 
 	crtc.mode.id = conn->obj;
-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
 	                       ATOMIC_RELAX_NONE, EINVAL);
 
 	crtc.mode.id = plane->fb_id;
-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
 	                       ATOMIC_RELAX_NONE, EINVAL);
 
+	/* successful TEST_ONLY with fences set */
 	crtc.mode.id = crtc_old->mode.id;
-	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
+	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE,
+			   DRM_MODE_ATOMIC_TEST_ONLY);
 
 	/* Create a blob which is the wrong size to be a valid mode. */
 	do_or_die(drmModeCreatePropertyBlob(crtc.state->desc->fd,
 					    crtc.mode.data,
 					    sizeof(struct drm_mode_modeinfo) - 1,
 					    &crtc.mode.id));
-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
 	                       ATOMIC_RELAX_NONE, EINVAL);
 
 
@@ -1094,15 +1139,107 @@ static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
 					    crtc.mode.data,
 					    sizeof(struct drm_mode_modeinfo) + 1,
 					    &crtc.mode.id));
-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
 	                       ATOMIC_RELAX_NONE, EINVAL);
 
+
 	/* Restore the CRTC and check the state matches the old. */
 	crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);
 
 	drmModeAtomicFree(req);
 }
 
+static void crtc_invalid_params_fence(struct kms_atomic_crtc_state *crtc_old,
+				struct kms_atomic_plane_state *plane,
+				struct kms_atomic_connector_state *conn)
+{
+	struct kms_atomic_crtc_state crtc = *crtc_old;
+	drmModeAtomicReq *req = drmModeAtomicAlloc();
+	int timeline, fence_fd, *out_fence;
+
+	igt_require_sw_sync();
+
+	/* invalid out_fence_ptr */
+	crtc.mode.id = crtc_old->mode.id;
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) crtc_invalid_params;
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
+	                       ATOMIC_RELAX_NONE, EFAULT);
+
+	/* invalid out_fence_ptr */
+	crtc.mode.id = crtc_old->mode.id;
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0x8;
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
+	                       ATOMIC_RELAX_NONE, EFAULT);
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
+
+	/* valid in fence but not allowed prop on crtc */
+	timeline = sw_sync_timeline_create();
+	fence_fd =  sw_sync_fence_create(timeline, 1);
+	plane->fence_fd = fence_fd;
+	crtc.active = false;
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
+			       ATOMIC_RELAX_NONE, EINVAL);
+
+	out_fence = malloc(sizeof(uint64_t));
+	igt_assert(out_fence);
+
+
+	/* valid out fence ptr and flip event but not allowed prop on crtc */
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
+			       ATOMIC_RELAX_NONE, EINVAL);
+
+	/* valid out fence ptr and flip event but not allowed prop on crtc */
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+			       DRM_MODE_PAGE_FLIP_EVENT,
+			       ATOMIC_RELAX_NONE, EINVAL);
+
+	/* valid page flip event but not allowed prop on crtc */
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+			       DRM_MODE_PAGE_FLIP_EVENT,
+			       ATOMIC_RELAX_NONE, EINVAL);
+	crtc.active = true;
+
+	/* valid out fence  ptr and flip event but invalid prop on crtc */
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
+	crtc.mode.id = plane->fb_id;
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
+			       ATOMIC_RELAX_NONE, EINVAL);
+
+	/* valid out fence ptr and flip event but invalid prop on crtc */
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+			       DRM_MODE_PAGE_FLIP_EVENT,
+			       ATOMIC_RELAX_NONE, EINVAL);
+
+	/* valid page flip event but invalid prop on crtc */
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
+			       DRM_MODE_PAGE_FLIP_EVENT,
+			       ATOMIC_RELAX_NONE, EINVAL);
+
+	/* successful TEST_ONLY with fences set */
+	plane->fence_fd = fence_fd;
+	crtc.mode.id = crtc_old->mode.id;
+	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE,
+			   DRM_MODE_ATOMIC_TEST_ONLY);
+	igt_assert(*out_fence == -1);
+	close(fence_fd);
+	close(timeline);
+
+	/* reset fences */
+	plane->fence_fd = -1;
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
+	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
+
+	/* out fence ptr but not page flip event */
+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
+	crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);
+
+	free(out_fence);
+	drmModeAtomicFree(req);
+}
+
 /* Abuse the atomic ioctl directly in order to test various invalid conditions,
  * which the libdrm wrapper won't allow us to create. */
 static void atomic_invalid_params(struct kms_atomic_crtc_state *crtc,
@@ -1306,6 +1443,20 @@ igt_main
 		atomic_state_free(scratch);
 	}
 
+	igt_subtest("plane_invalid_params_fence") {
+		struct kms_atomic_state *scratch = atomic_state_dup(current);
+		struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
+		struct kms_atomic_plane_state *plane =
+			find_plane(current, PLANE_TYPE_PRIMARY, crtc);
+		struct kms_atomic_connector_state *conn =
+			find_connector(scratch, crtc);
+
+		igt_require(crtc);
+		igt_require(plane);
+		plane_invalid_params_fence(crtc, plane, conn);
+		atomic_state_free(scratch);
+	}
+
 	igt_subtest("crtc_invalid_params") {
 		struct kms_atomic_state *scratch = atomic_state_dup(current);
 		struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
@@ -1321,6 +1472,21 @@ igt_main
 		atomic_state_free(scratch);
 	}
 
+	igt_subtest("crtc_invalid_params_fence") {
+		struct kms_atomic_state *scratch = atomic_state_dup(current);
+		struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
+		struct kms_atomic_plane_state *plane =
+			find_plane(scratch, NUM_PLANE_TYPE_PROPS, crtc);
+		struct kms_atomic_connector_state *conn =
+			find_connector(scratch, crtc);
+
+		igt_require(crtc);
+		igt_require(plane);
+		igt_require(conn);
+		crtc_invalid_params_fence(crtc, plane, conn);
+		atomic_state_free(scratch);
+	}
+
 	igt_subtest("atomic_invalid_params") {
 		struct kms_atomic_state *scratch = atomic_state_dup(current);
 		struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 09/12] tests/kms_atomic_transition: add fencing parameter to run_transition_tests
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (7 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14  9:05 ` [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests Robert Foss
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_atomic_transition.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 5575ac18..b7d99975 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -121,7 +121,7 @@ enum transition_type {
  * so test this and make sure it works.
  */
 static void
-run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output, enum transition_type type, bool nonblocking)
+run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output, enum transition_type type, bool nonblocking, bool fencing)
 {
 	struct igt_fb fb, argb_fb;
 	drmModeModeInfo *mode, override_mode;
@@ -586,19 +586,19 @@ igt_main
 
 	igt_subtest("plane-all-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false);
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
 
 	igt_subtest("plane-all-transition-nonblocking")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true);
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
 
 	igt_subtest("plane-all-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false);
+			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
 
 	igt_subtest("plane-toggle-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false);
+			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);
 
 	for (i = 1; i <= I915_MAX_PIPES; i++) {
 		igt_subtest_f("%ix-modeset-transitions", i)
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (8 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 09/12] tests/kms_atomic_transition: add fencing parameter to run_transition_tests Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14 16:57   ` Brian Starkey
  2016-12-14  9:05 ` [PATCH i-g-t v2 11/12] tests/kms_atomic_transition: add in_fences tests Robert Foss
  2016-12-14  9:05 ` [PATCH i-g-t v2 12/12] tests/kms_atomic_transition: set out_fence for all crtcs Robert Foss
  11 siblings, 1 reply; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c                 | 22 ++++++++++++++++++++++
 tests/kms_atomic_transition.c | 32 ++++++++++++++++++++++++++++++--
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index fe1b356d..eb59ab36 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -49,6 +49,7 @@
 #include "intel_chipset.h"
 #include "igt_debugfs.h"
 #include "igt_sysfs.h"
+#include "sw_sync.h"
 
 /**
  * SECTION:igt_kms
@@ -2184,6 +2185,27 @@ static int igt_atomic_commit(igt_display_t *display, uint32_t flags, void *user_
 	}
 
 	ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
+	if (!ret) {
+		int64_t *fence_ptr;
+
+		for_each_pipe(display, pipe) {
+			igt_pipe_t *pipe_obj = &display->pipes[pipe];
+
+			fence_ptr = pipe_obj->out_fence_ptr;
+			if (!fence_ptr)
+				continue;
+
+			if (flags & DRM_MODE_ATOMIC_TEST_ONLY) {
+				igt_assert(*fence_ptr == -1);
+			} else {
+				igt_assert(*fence_ptr >= 0);
+				ret = sw_sync_wait(*fence_ptr, 1000);
+				igt_assert(ret == 0);
+				close(*fence_ptr);
+			}
+		}
+	}
+
 	drmModeAtomicFree(req);
 	return ret;
 
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index b7d99975..08f9499f 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -132,6 +132,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	struct plane_parms parms[IGT_MAX_PLANES];
 	bool skip_test = false;
 	unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
+	int out_fence, ret;
 
 	if (nonblocking)
 		flags |= DRM_MODE_ATOMIC_NONBLOCK;
@@ -198,9 +199,11 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	 * planes to fix this
 	 */
 	while (1) {
-		int ret;
-
 		wm_setup_plane(display, pipe, iter_max - 1, parms);
+
+		if (fencing)
+			igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
+			    (int64_t *) &out_fence);
 		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
 		if (ret != -EINVAL || n_planes < 3)
@@ -231,6 +234,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 
 		wm_setup_plane(display, pipe, i, parms);
 
+		if (fencing)
+			igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
+
 		igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
 		drmHandleEvent(display->drm_fd, &drm_events);
 
@@ -239,6 +245,10 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 
 			wm_setup_plane(display, pipe, 0, parms);
 
+			if (fencing)
+				igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
+				    (int64_t *) &out_fence);
+
 			igt_display_commit_atomic(display, flags, (void *)0UL);
 
 			drmHandleEvent(display->drm_fd, &drm_events);
@@ -252,6 +262,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, &override_mode);
 
+				if (fencing)
+					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
+
 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)j);
 				drmHandleEvent(display->drm_fd, &drm_events);
 
@@ -259,6 +272,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, NULL);
 
+				if (fencing)
+					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
+
 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
 				drmHandleEvent(display->drm_fd, &drm_events);
 			}
@@ -588,14 +604,26 @@ igt_main
 		for_each_pipe_with_valid_output(&display, pipe, output)
 			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
 
+	igt_subtest("plane-all-transition-fencing")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true);
+
 	igt_subtest("plane-all-transition-nonblocking")
 		for_each_pipe_with_valid_output(&display, pipe, output)
 			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
 
+	igt_subtest("plane-all-transition-nonblocking-fencing")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true);
+
 	igt_subtest("plane-all-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
 			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
 
+	igt_subtest("plane-all-modeset-transition-fencing")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true);
+
 	igt_subtest("plane-toggle-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
 			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 11/12] tests/kms_atomic_transition: add in_fences tests
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (9 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  2016-12-14  9:05 ` [PATCH i-g-t v2 12/12] tests/kms_atomic_transition: set out_fence for all crtcs Robert Foss
  11 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_atomic_transition.c | 95 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 85 insertions(+), 10 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 08f9499f..c2ec89d7 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -23,7 +23,9 @@
 
 #include "igt.h"
 #include "drmtest.h"
+#include "sw_sync.h"
 #include <errno.h>
+#include <pthread.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
@@ -111,6 +113,81 @@ enum transition_type {
 	TRANSITION_MODESET_DISABLE,
 };
 
+int timeline[IGT_MAX_PLANES];
+pthread_t thread[IGT_MAX_PLANES];
+int seqno[IGT_MAX_PLANES];
+
+static void prepare_fencing(igt_display_t *display, enum pipe pipe)
+{
+	igt_plane_t *plane;
+
+	igt_require_sw_sync();
+
+	for_each_plane_on_pipe(display, pipe, plane)
+		timeline[plane->index] = sw_sync_timeline_create();
+}
+
+static void unprepare_fencing(igt_display_t *display, enum pipe pipe)
+{
+	igt_plane_t *plane;
+
+	for_each_plane_on_pipe(display, pipe, plane)
+		close(timeline[plane->index]);
+}
+
+static void *fence_inc_thread(void *arg)
+{
+	int t = *((int *) arg);
+
+	pthread_detach(pthread_self());
+
+	usleep(5000);
+	sw_sync_timeline_inc(t, 1);
+	return NULL;
+}
+
+static void configure_fencing(igt_display_t *display, enum pipe pipe)
+{
+	igt_plane_t *plane;
+	int i, fd, ret;
+
+	for_each_plane_on_pipe(display, pipe, plane) {
+
+		if (!plane->fb)
+			continue;
+
+		i = plane->index;
+
+		seqno[i]++;
+		fd = sw_sync_fence_create(timeline[i], seqno[i]);
+		igt_plane_set_fence_fd(plane, fd);
+		ret = pthread_create(&thread[i], NULL, fence_inc_thread, &timeline[i]);
+		igt_assert_eq(ret, 0);
+	}
+}
+
+static void clear_fencing(igt_display_t *display, enum pipe pipe)
+{
+	igt_plane_t *plane;
+
+	for_each_plane_on_pipe(display, pipe, plane)
+		igt_plane_set_fence_fd(plane, -1);
+}
+
+static void atomic_commit(igt_display_t *display, enum pipe pipe, unsigned int flags, void *data, bool fencing, int *out_fence)
+{
+	if (fencing) {
+		configure_fencing(display, pipe);
+		igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
+		    (int64_t *) out_fence);
+	}
+
+	igt_display_commit_atomic(display, flags, data);
+
+	if (fencing)
+		clear_fencing(display, pipe);
+}
+
 /*
  * 1. Set primary plane to a known fb.
  * 2. Make sure getcrtc returns the correct fb id.
@@ -134,6 +211,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
 	int out_fence, ret;
 
+	if (fencing)
+		prepare_fencing(display, pipe);
+
 	if (nonblocking)
 		flags |= DRM_MODE_ATOMIC_NONBLOCK;
 
@@ -234,10 +314,8 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 
 		wm_setup_plane(display, pipe, i, parms);
 
-		if (fencing)
-			igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
+		atomic_commit(display, pipe, flags, (void *)(unsigned long)i, fencing, &out_fence);
 
-		igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
 		drmHandleEvent(display->drm_fd, &drm_events);
 
 		if (type == TRANSITION_MODESET_DISABLE) {
@@ -262,19 +340,14 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, &override_mode);
 
-				if (fencing)
-					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
-
-				igt_display_commit_atomic(display, flags, (void *)(unsigned long)j);
+				atomic_commit(display, pipe, flags, (void *)(unsigned long)i, fencing, &out_fence);
 				drmHandleEvent(display->drm_fd, &drm_events);
 
 				wm_setup_plane(display, pipe, i, parms);
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, NULL);
 
-				if (fencing)
-					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
-
+				atomic_commit(display, pipe, flags, (void *)(unsigned long)i, fencing, &out_fence);
 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
 				drmHandleEvent(display->drm_fd, &drm_events);
 			}
@@ -282,6 +355,8 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	}
 
 cleanup:
+	unprepare_fencing(display, pipe);
+
 	igt_output_set_pipe(output, PIPE_NONE);
 
 	for_each_plane_on_pipe(display, pipe, plane)
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH i-g-t v2 12/12] tests/kms_atomic_transition: set out_fence for all crtcs
  2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
                   ` (10 preceding siblings ...)
  2016-12-14  9:05 ` [PATCH i-g-t v2 11/12] tests/kms_atomic_transition: add in_fences tests Robert Foss
@ 2016-12-14  9:05 ` Robert Foss
  11 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-14  9:05 UTC (permalink / raw)
  To: intel-gfx, Gustavo Padovan, Brian Starkey, Daniel Vetter, Tomeu Vizoso
  Cc: Gustavo Padovan

From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 tests/kms_atomic_transition.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index c2ec89d7..d7f599b4 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -485,7 +485,7 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc
 	}
 }
 
-static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblocking)
+static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblocking, bool fencing)
 {
 	struct igt_fb fbs[2];
 	int i, j;
@@ -494,6 +494,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 	igt_output_t *output;
 	unsigned width = 0, height = 0;
 	bool skip_test = false;
+	int out_fence[I915_MAX_PIPES];
 
 	for_each_connected_output(display, output) {
 		drmModeModeInfo *mode = igt_output_get_mode(output);
@@ -531,6 +532,11 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 			igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
 		} else
 			igt_plane_set_fb(plane, NULL);
+
+		if(fencing)
+			igt_pipe_set_out_fence_ptr(&display->pipes[i],
+						   (int64_t *) &out_fence[i]);
+
 	}
 
 	/*
@@ -618,7 +624,7 @@ cleanup:
 
 }
 
-static void run_modeset_transition(igt_display_t *display, int requested_outputs, bool nonblocking)
+static void run_modeset_transition(igt_display_t *display, int requested_outputs, bool nonblocking, bool fencing)
 {
 	igt_output_t *outputs[I915_MAX_PIPES] = {};
 	int num_outputs = 0;
@@ -646,7 +652,7 @@ static void run_modeset_transition(igt_display_t *display, int requested_outputs
 		      "Should have at least %i outputs, found %i\n",
 		      requested_outputs, num_outputs);
 
-	run_modeset_tests(display, requested_outputs, nonblocking);
+	run_modeset_tests(display, requested_outputs, nonblocking, fencing);
 }
 
 igt_main
@@ -705,10 +711,16 @@ igt_main
 
 	for (i = 1; i <= I915_MAX_PIPES; i++) {
 		igt_subtest_f("%ix-modeset-transitions", i)
-			run_modeset_transition(&display, i, false);
+			run_modeset_transition(&display, i, false, false);
 
 		igt_subtest_f("%ix-modeset-transitions-nonblocking", i)
-			run_modeset_transition(&display, i, true);
+			run_modeset_transition(&display, i, true, false);
+
+		igt_subtest_f("%ix-modeset-transitions-fencing", i)
+			run_modeset_transition(&display, i, false, true);
+
+		igt_subtest_f("%ix-modeset-transitions-nonblocking-fencing", i)
+			run_modeset_transition(&display, i, true, true);
 	}
 
 	igt_fixture {
-- 
2.11.0

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

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 06/12] lib/igt_kms: Add support for the IN_FENCE_FD property
  2016-12-14  9:05 ` [PATCH i-g-t v2 06/12] lib/igt_kms: Add support for the IN_FENCE_FD property Robert Foss
@ 2016-12-14 16:04   ` Brian Starkey
  2016-12-15 12:36     ` Robert Foss
  0 siblings, 1 reply; 24+ messages in thread
From: Brian Starkey @ 2016-12-14 16:04 UTC (permalink / raw)
  To: Robert Foss; +Cc: Gustavo Padovan, intel-gfx, Tomeu Vizoso

Hi,

On Wed, Dec 14, 2016 at 04:05:03AM -0500, Robert Foss wrote:
>Add support dor the IN_FENCE_FD property to enable setting in fences for atomic
>commits.
>
>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>---
> lib/igt_kms.c | 20 ++++++++++++++++++++
> lib/igt_kms.h |  5 +++++
> 2 files changed, 25 insertions(+)
>
>diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>index 8aaff5b8..8ca49d86 100644
>--- a/lib/igt_kms.c
>+++ b/lib/igt_kms.c
>@@ -164,6 +164,7 @@ const char *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
> 	"CRTC_H",
> 	"FB_ID",
> 	"CRTC_ID",
>+	"IN_FENCE_FD",
> 	"type",
> 	"rotation"
> };
>@@ -1426,6 +1427,7 @@ void igt_display_init(igt_display_t *display, int drm_fd)
> 			n_planes++;
> 			plane->pipe = pipe;
> 			plane->drm_plane = drm_plane;
>+			plane->fence_fd = -1;
>
> 			if (is_atomic == 0) {
> 				display->is_atomic = 1;
>@@ -1712,6 +1714,11 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe,
> 	    plane->index,
> 	    fb_id);
>
>+	if (plane->fence_fd >= 0) {
>+		uint64_t fence_fd = (int64_t) plane->fence_fd;
>+		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_IN_FENCE_FD, fence_fd);

Should you reset plane->fence_fd to -1 here? Or tests should
explicitly clear it for each commit?

Cheers,
Brian
>+	}
>+
> 	if (plane->fb_changed) {
> 		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_ID, fb_id ? crtc_id : 0);
> 		igt_atomic_populate_plane_req(req, plane, IGT_PLANE_FB_ID, fb_id);
>@@ -2522,6 +2529,19 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
> 	plane->size_changed = true;
> }
>
>+/**
>+ * igt_plane_set_fence_fd:
>+ * @plane: plane
>+ * @fence_fd: fence fd, disable fence_fd by setting it to -1
>+ *
>+ * This function sets a fence fd to enable a commit to wait for some event to
>+ * occur before completing.
>+ */
>+void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd)
>+{
>+	plane->fence_fd = fence_fd;
>+}
>+
> void igt_plane_set_position(igt_plane_t *plane, int x, int y)
> {
> 	igt_pipe_t *pipe = plane->pipe;
>diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>index dbe81bcb..9766807c 100644
>--- a/lib/igt_kms.h
>+++ b/lib/igt_kms.h
>@@ -225,6 +225,7 @@ enum igt_atomic_plane_properties {
>
>        IGT_PLANE_FB_ID,
>        IGT_PLANE_CRTC_ID,
>+       IGT_PLANE_IN_FENCE_FD,
>        IGT_PLANE_TYPE,
>        IGT_PLANE_ROTATION,
>        IGT_NUM_PLANE_PROPS
>@@ -284,6 +285,9 @@ typedef struct {
> 	uint32_t src_h;
>
> 	igt_rotation_t rotation;
>+
>+	/* in fence fd */
>+	int32_t fence_fd;
> 	uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
> } igt_plane_t;
>
>@@ -367,6 +371,7 @@ void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length);
> void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
>
> void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
>+void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
> void igt_plane_set_position(igt_plane_t *plane, int x, int y);
> void igt_plane_set_size(igt_plane_t *plane, int w, int h);
> void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
>-- 
>2.11.0
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property
  2016-12-14  9:05 ` [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property Robert Foss
@ 2016-12-14 16:13   ` Brian Starkey
  2016-12-16  8:21     ` Robert Foss
  0 siblings, 1 reply; 24+ messages in thread
From: Brian Starkey @ 2016-12-14 16:13 UTC (permalink / raw)
  To: Robert Foss; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso

Hi,

On Wed, Dec 14, 2016 at 04:05:04AM -0500, Robert Foss wrote:
>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
>Add support for the OUT_FENCE_PTR property to enable setting out fences for
>atomic commits.
>
>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>---
> lib/igt_kms.c | 21 ++++++++++++++++++++-
> lib/igt_kms.h |  3 +++
> 2 files changed, 23 insertions(+), 1 deletion(-)
>
>diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>index 8ca49d86..fe1b356d 100644
>--- a/lib/igt_kms.c
>+++ b/lib/igt_kms.c
>@@ -175,7 +175,8 @@ const char *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
> 	"DEGAMMA_LUT",
> 	"GAMMA_LUT",
> 	"MODE_ID",
>-	"ACTIVE"
>+	"ACTIVE",
>+	"OUT_FENCE_PTR"
> };
>
> const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>@@ -2103,6 +2104,10 @@ static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRe
> 		igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE, !!output);
> 	}
>
>+	if (pipe_obj->out_fence_ptr)
>+		igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_OUT_FENCE_PTR,
>+		    (uint64_t)(uintptr_t) pipe_obj->out_fence_ptr);
>+
> 	/*
> 	 *	TODO: Add all crtc level properties here
> 	 */
>@@ -2683,6 +2688,20 @@ igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length)
> }
>
> /**
>+ * igt_pipe_set_out_fence_ptr:
>+ * @pipe: pipe pointer to which background color to be set
>+ * @fence_ptr: out fence pointer
>+ *
>+ * Sets the out fence pointer that will be passed to the kernel in
>+ * the atomic ioctl. When the kernel returns the out fence pointer
>+ * will contain the fd number of the out fence created by KMS.
>+ */
>+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr)
>+{
>+	pipe->out_fence_ptr = fence_ptr;
>+}
>+
>+/**
>  * igt_crtc_set_background:
>  * @pipe: pipe pointer to which background color to be set
>  * @background: background color value in BGR 16bpc
>diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>index 9766807c..8eb611c0 100644
>--- a/lib/igt_kms.h
>+++ b/lib/igt_kms.h
>@@ -110,6 +110,7 @@ enum igt_atomic_crtc_properties {
>        IGT_CRTC_GAMMA_LUT,
>        IGT_CRTC_MODE_ID,
>        IGT_CRTC_ACTIVE,
>+       IGT_CRTC_OUT_FENCE_PTR,
>        IGT_NUM_CRTC_PROPS
> };
>
>@@ -316,6 +317,7 @@ struct igt_pipe {
>
> 	uint64_t mode_blob;
> 	bool mode_changed;
>+	int64_t *out_fence_ptr;

I prefer the interface that got suggested before - igt_pipe gets an
"int64_t out_fence;" member which tests can query to get the fence
value:

int igt_pipe_get_last_out_fence(igt_pipe_t *pipe);

..and the kernel only ever receives a pointer to pipe->out_fence.

The only reason I can see for a test to want to provide its own fence
pointer is to test invalid pointer values - and I think it's OK for
that test to set the property directly instead of making setting a
custom fence pointer the common case for all users.

If we don't want to get a fence for every commit then I guess there
could be a way for a test to request an out-fence for just the next
commit on a pipe (or the inverse - disable fencing for a particular
commit):

void igt_pipe_request_out_fence(igt_pipe_t *pipe);

-Brian

> };
>
> typedef struct {
>@@ -369,6 +371,7 @@ static inline bool igt_plane_supports_rotation(igt_plane_t *plane)
> void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
> void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length);
> void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
>+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr);
>
> void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
> void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
>-- 
>2.11.0
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings
  2016-12-14  9:05 ` [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings Robert Foss
@ 2016-12-14 16:39   ` Brian Starkey
  2016-12-16  8:35     ` Robert Foss
  0 siblings, 1 reply; 24+ messages in thread
From: Brian Starkey @ 2016-12-14 16:39 UTC (permalink / raw)
  To: Robert Foss; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso

Hi,

On Wed, Dec 14, 2016 at 04:05:05AM -0500, Robert Foss wrote:
>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>---
> tests/kms_atomic.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 176 insertions(+), 10 deletions(-)
>
>diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
>index 8b648eba..a557ac60 100644
>--- a/tests/kms_atomic.c
>+++ b/tests/kms_atomic.c
>@@ -44,6 +44,7 @@
> #include "drmtest.h"
> #include "igt.h"
> #include "igt_aux.h"
>+#include "sw_sync.h"
>
> #ifndef DRM_CLIENT_CAP_ATOMIC
> #define DRM_CLIENT_CAP_ATOMIC 3
>@@ -126,6 +127,7 @@ struct kms_atomic_plane_state {
> 	uint32_t fb_id; /* 0 to disable */
> 	uint32_t src_x, src_y, src_w, src_h; /* 16.16 fixed-point */
> 	uint32_t crtc_x, crtc_y, crtc_w, crtc_h; /* normal integers */
>+	int32_t fence_fd;
> };
>
> struct kms_atomic_crtc_state {
>@@ -133,6 +135,7 @@ struct kms_atomic_crtc_state {
> 	uint32_t obj;
> 	int idx;
> 	bool active;
>+	uint64_t out_fence_ptr;
> 	struct kms_atomic_blob mode;
> };
>
>@@ -190,11 +193,13 @@ static uint32_t blob_duplicate(int fd, uint32_t id_orig)
> 	crtc_populate_req(crtc, req); \
> 	plane_populate_req(plane, req); \
> 	do_atomic_commit((crtc)->state->desc->fd, req, flags); \
>-	crtc_check_current_state(crtc, plane, relax); \
>-	plane_check_current_state(plane, relax); \
>+	if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { \
>+		crtc_check_current_state(crtc, plane, relax); \
>+		plane_check_current_state(plane, relax); \
>+	} \
> }
>
>-#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req, relax, e) { \
>+#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req, flags, relax, e) { \
> 	drmModeAtomicSetCursor(req, 0); \
> 	crtc_populate_req(crtc, req); \
> 	plane_populate_req(plane, req); \
>@@ -299,6 +304,9 @@ find_connector(struct kms_atomic_state *state,
> static void plane_populate_req(struct kms_atomic_plane_state *plane,
> 			       drmModeAtomicReq *req)
> {
>+	if (plane->fence_fd)
>+		plane_set_prop(req, plane, IGT_PLANE_IN_FENCE_FD, plane->fence_fd);
>+
> 	plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane->crtc_id);
> 	plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane->fb_id);
> 	plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane->src_x);
>@@ -424,6 +432,10 @@ find_plane(struct kms_atomic_state *state, enum plane_type type,
> static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
> 			      drmModeAtomicReq *req)
> {
>+	if (crtc->out_fence_ptr)
>+		crtc_set_prop(req, crtc, IGT_CRTC_OUT_FENCE_PTR,
>+			      crtc->out_fence_ptr);
>+
> 	crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc->mode.id);
> 	crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active);
> }
>@@ -1052,6 +1064,37 @@ static void plane_invalid_params(struct kms_atomic_crtc_state *crtc,
> 	drmModeAtomicFree(req);
> }
>
>+static void plane_invalid_params_fence(struct kms_atomic_crtc_state *crtc,
>+				struct kms_atomic_plane_state *plane_old,
>+				struct kms_atomic_connector_state *conn)
>+{
>+	struct kms_atomic_plane_state plane = *plane_old;
>+	drmModeAtomicReq *req = drmModeAtomicAlloc();
>+	int timeline, fence_fd;
>+
>+	igt_require_sw_sync();
>+
>+	/* invalid fence fd */
>+	plane.fence_fd = plane.state->desc->fd;
>+	plane.crtc_id = plane_old->crtc_id;
>+	plane_commit_atomic_err(&plane, plane_old, req,
>+	                        ATOMIC_RELAX_NONE, EINVAL);
>+
>+	/* Valid fence_fd but invalid CRTC */
>+	timeline = sw_sync_timeline_create();
>+	fence_fd =  sw_sync_fence_create(timeline, 1);
>+	plane.fence_fd = fence_fd;
>+	plane.crtc_id = ~0U;
>+	plane_commit_atomic_err(&plane, plane_old, req,
>+	                        ATOMIC_RELAX_NONE, EINVAL);
>+
>+	plane.fence_fd = -1;
>+	close(fence_fd);
>+	close(timeline);
>+
>+	drmModeAtomicFree(req);
>+}
>+
> static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
> 				struct kms_atomic_plane_state *plane,
> 				struct kms_atomic_connector_state *conn)
>@@ -1063,30 +1106,32 @@ static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
>
> 	/* Pass a series of invalid object IDs for the mode ID. */
> 	crtc.mode.id = plane->obj;
>-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
> 	                       ATOMIC_RELAX_NONE, EINVAL);
>
> 	crtc.mode.id = crtc.obj;
>-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
> 	                       ATOMIC_RELAX_NONE, EINVAL);
>
> 	crtc.mode.id = conn->obj;
>-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
> 	                       ATOMIC_RELAX_NONE, EINVAL);
>
> 	crtc.mode.id = plane->fb_id;
>-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
> 	                       ATOMIC_RELAX_NONE, EINVAL);
>
>+	/* successful TEST_ONLY with fences set */
> 	crtc.mode.id = crtc_old->mode.id;
>-	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
>+	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE,
>+			   DRM_MODE_ATOMIC_TEST_ONLY);
>
> 	/* Create a blob which is the wrong size to be a valid mode. */
> 	do_or_die(drmModeCreatePropertyBlob(crtc.state->desc->fd,
> 					    crtc.mode.data,
> 					    sizeof(struct drm_mode_modeinfo) - 1,
> 					    &crtc.mode.id));
>-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
> 	                       ATOMIC_RELAX_NONE, EINVAL);
>
>
>@@ -1094,15 +1139,107 @@ static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
> 					    crtc.mode.data,
> 					    sizeof(struct drm_mode_modeinfo) + 1,
> 					    &crtc.mode.id));
>-	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
> 	                       ATOMIC_RELAX_NONE, EINVAL);
>
>+
> 	/* Restore the CRTC and check the state matches the old. */
> 	crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);
>
> 	drmModeAtomicFree(req);
> }
>
>+static void crtc_invalid_params_fence(struct kms_atomic_crtc_state *crtc_old,
>+				struct kms_atomic_plane_state *plane,
>+				struct kms_atomic_connector_state *conn)
>+{
>+	struct kms_atomic_crtc_state crtc = *crtc_old;
>+	drmModeAtomicReq *req = drmModeAtomicAlloc();
>+	int timeline, fence_fd, *out_fence;
>+
>+	igt_require_sw_sync();
>+
>+	/* invalid out_fence_ptr */
>+	crtc.mode.id = crtc_old->mode.id;
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) crtc_invalid_params;
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>+	                       ATOMIC_RELAX_NONE, EFAULT);
>+
>+	/* invalid out_fence_ptr */
>+	crtc.mode.id = crtc_old->mode.id;
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0x8;
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>+	                       ATOMIC_RELAX_NONE, EFAULT);
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>+
>+	/* valid in fence but not allowed prop on crtc */
>+	timeline = sw_sync_timeline_create();
>+	fence_fd =  sw_sync_fence_create(timeline, 1);
>+	plane->fence_fd = fence_fd;
>+	crtc.active = false;
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>+			       ATOMIC_RELAX_NONE, EINVAL);
>+
>+	out_fence = malloc(sizeof(uint64_t));
>+	igt_assert(out_fence);
>+
>+
>+	/* valid out fence ptr and flip event but not allowed prop on crtc */
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>+			       ATOMIC_RELAX_NONE, EINVAL);
>+
>+	/* valid out fence ptr and flip event but not allowed prop on crtc */
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+			       DRM_MODE_PAGE_FLIP_EVENT,
>+			       ATOMIC_RELAX_NONE, EINVAL);
>+
>+	/* valid page flip event but not allowed prop on crtc */
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+			       DRM_MODE_PAGE_FLIP_EVENT,
>+			       ATOMIC_RELAX_NONE, EINVAL);
>+	crtc.active = true;
>+
>+	/* valid out fence  ptr and flip event but invalid prop on crtc */
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>+	crtc.mode.id = plane->fb_id;
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>+			       ATOMIC_RELAX_NONE, EINVAL);
>+
>+	/* valid out fence ptr and flip event but invalid prop on crtc */
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+			       DRM_MODE_PAGE_FLIP_EVENT,
>+			       ATOMIC_RELAX_NONE, EINVAL);
>+
>+	/* valid page flip event but invalid prop on crtc */
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>+	crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>+			       DRM_MODE_PAGE_FLIP_EVENT,
>+			       ATOMIC_RELAX_NONE, EINVAL);
>+
>+	/* successful TEST_ONLY with fences set */
>+	plane->fence_fd = fence_fd;
>+	crtc.mode.id = crtc_old->mode.id;
>+	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE,
>+			   DRM_MODE_ATOMIC_TEST_ONLY);
>+	igt_assert(*out_fence == -1);
>+	close(fence_fd);
>+	close(timeline);
>+
>+	/* reset fences */
>+	plane->fence_fd = -1;
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>+	crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
>+
>+	/* out fence ptr but not page flip event */
>+	crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>+	crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);

What are the previous two commits for? They don't seem to be invalid.

>+
>+	free(out_fence);

Need to close(*out_fence) before freeing it?

-Brian

>+	drmModeAtomicFree(req);
>+}
>+
> /* Abuse the atomic ioctl directly in order to test various invalid conditions,
>  * which the libdrm wrapper won't allow us to create. */
> static void atomic_invalid_params(struct kms_atomic_crtc_state *crtc,
>@@ -1306,6 +1443,20 @@ igt_main
> 		atomic_state_free(scratch);
> 	}
>
>+	igt_subtest("plane_invalid_params_fence") {
>+		struct kms_atomic_state *scratch = atomic_state_dup(current);
>+		struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>+		struct kms_atomic_plane_state *plane =
>+			find_plane(current, PLANE_TYPE_PRIMARY, crtc);
>+		struct kms_atomic_connector_state *conn =
>+			find_connector(scratch, crtc);
>+
>+		igt_require(crtc);
>+		igt_require(plane);
>+		plane_invalid_params_fence(crtc, plane, conn);
>+		atomic_state_free(scratch);
>+	}
>+
> 	igt_subtest("crtc_invalid_params") {
> 		struct kms_atomic_state *scratch = atomic_state_dup(current);
> 		struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>@@ -1321,6 +1472,21 @@ igt_main
> 		atomic_state_free(scratch);
> 	}
>
>+	igt_subtest("crtc_invalid_params_fence") {
>+		struct kms_atomic_state *scratch = atomic_state_dup(current);
>+		struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>+		struct kms_atomic_plane_state *plane =
>+			find_plane(scratch, NUM_PLANE_TYPE_PROPS, crtc);
>+		struct kms_atomic_connector_state *conn =
>+			find_connector(scratch, crtc);
>+
>+		igt_require(crtc);
>+		igt_require(plane);
>+		igt_require(conn);
>+		crtc_invalid_params_fence(crtc, plane, conn);
>+		atomic_state_free(scratch);
>+	}
>+
> 	igt_subtest("atomic_invalid_params") {
> 		struct kms_atomic_state *scratch = atomic_state_dup(current);
> 		struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>-- 
>2.11.0
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests
  2016-12-14  9:05 ` [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests Robert Foss
@ 2016-12-14 16:57   ` Brian Starkey
  2016-12-16  8:59     ` Robert Foss
  0 siblings, 1 reply; 24+ messages in thread
From: Brian Starkey @ 2016-12-14 16:57 UTC (permalink / raw)
  To: Robert Foss; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso

On Wed, Dec 14, 2016 at 04:05:07AM -0500, Robert Foss wrote:
>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>---
> lib/igt_kms.c                 | 22 ++++++++++++++++++++++
> tests/kms_atomic_transition.c | 32 ++++++++++++++++++++++++++++++--
> 2 files changed, 52 insertions(+), 2 deletions(-)
>
>diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>index fe1b356d..eb59ab36 100644
>--- a/lib/igt_kms.c
>+++ b/lib/igt_kms.c
>@@ -49,6 +49,7 @@
> #include "intel_chipset.h"
> #include "igt_debugfs.h"
> #include "igt_sysfs.h"
>+#include "sw_sync.h"
>
> /**
>  * SECTION:igt_kms
>@@ -2184,6 +2185,27 @@ static int igt_atomic_commit(igt_display_t *display, uint32_t flags, void *user_
> 	}
>
> 	ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
>+	if (!ret) {
>+		int64_t *fence_ptr;
>+
>+		for_each_pipe(display, pipe) {
>+			igt_pipe_t *pipe_obj = &display->pipes[pipe];
>+
>+			fence_ptr = pipe_obj->out_fence_ptr;
>+			if (!fence_ptr)
>+				continue;
>+
>+			if (flags & DRM_MODE_ATOMIC_TEST_ONLY) {
>+				igt_assert(*fence_ptr == -1);
>+			} else {
>+				igt_assert(*fence_ptr >= 0);
>+				ret = sw_sync_wait(*fence_ptr, 1000);
>+				igt_assert(ret == 0);
>+				close(*fence_ptr);
>+			}
>+		}
>+	}
>+
> 	drmModeAtomicFree(req);
> 	return ret;
>
>diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
>index b7d99975..08f9499f 100644
>--- a/tests/kms_atomic_transition.c
>+++ b/tests/kms_atomic_transition.c
>@@ -132,6 +132,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> 	struct plane_parms parms[IGT_MAX_PLANES];
> 	bool skip_test = false;
> 	unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
>+	int out_fence, ret;

out_fence needs to be 64-bit.

>
> 	if (nonblocking)
> 		flags |= DRM_MODE_ATOMIC_NONBLOCK;
>@@ -198,9 +199,11 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> 	 * planes to fix this
> 	 */
> 	while (1) {
>-		int ret;
>-
> 		wm_setup_plane(display, pipe, iter_max - 1, parms);
>+
>+		if (fencing)
>+			igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>+			    (int64_t *) &out_fence);
> 		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
>
> 		if (ret != -EINVAL || n_planes < 3)
>@@ -231,6 +234,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
>
> 		wm_setup_plane(display, pipe, i, parms);
>
>+		if (fencing)
>+			igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
>+
> 		igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
> 		drmHandleEvent(display->drm_fd, &drm_events);
>
>@@ -239,6 +245,10 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
>
> 			wm_setup_plane(display, pipe, 0, parms);
>
>+			if (fencing)
>+				igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>+				    (int64_t *) &out_fence);
>+
> 			igt_display_commit_atomic(display, flags, (void *)0UL);
>
> 			drmHandleEvent(display->drm_fd, &drm_events);
>@@ -252,6 +262,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> 				if (type == TRANSITION_MODESET)
> 					igt_output_override_mode(output, &override_mode);
>
>+				if (fencing)
>+					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
>+
> 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)j);
> 				drmHandleEvent(display->drm_fd, &drm_events);
>
>@@ -259,6 +272,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> 				if (type == TRANSITION_MODESET)
> 					igt_output_override_mode(output, NULL);
>
>+				if (fencing)
>+					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
>+
> 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
> 				drmHandleEvent(display->drm_fd, &drm_events);
> 			}
>@@ -588,14 +604,26 @@ igt_main
> 		for_each_pipe_with_valid_output(&display, pipe, output)
> 			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
>
>+	igt_subtest("plane-all-transition-fencing")
>+		for_each_pipe_with_valid_output(&display, pipe, output)
>+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true);
>+
> 	igt_subtest("plane-all-transition-nonblocking")
> 		for_each_pipe_with_valid_output(&display, pipe, output)
> 			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
>
>+	igt_subtest("plane-all-transition-nonblocking-fencing")
>+		for_each_pipe_with_valid_output(&display, pipe, output)
>+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true);
>+

This test makes my kernel very unhappy running on drm-next on mali-dp.
Any ideas?

WARN -> Stall -> BUG:

[  131.657643] WARNING: CPU: 0 PID: 2124 at drivers/gpu/drm/drm_atomic_helper.c:1041 drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
[  131.670293] Modules linked in: mali_dp tda998x drm_kms_helper drm ip_tables x_tables ipv6
[  131.678416]
[  131.679890] CPU: 0 PID: 2124 Comm: kms_atomic_tran Not tainted 4.9.0-rc8 #267
[  131.686950] Hardware name: ARM Juno development board (r0) (DT)
[  131.692806] task: ffff800970ae0000 task.stack: ffff8009746c0000
[  131.698732] PC is at drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
[  131.706206] LR is at drm_atomic_helper_commit+0x7c/0x11c [drm_kms_helper]
[  131.712923] pc : [<ffff000000bdba1c>] lr : [<ffff000000bde958>] pstate: 20000145
[  131.720241] sp : ffff8009746c3b40
[  131.723516] x29: ffff8009746c3b40 x28: ffff80096fd40c00
[  131.728778] x27: 0000000022d216e0 x26: ffff80096fd40a80
[  131.734039] x25: 0000000000000018 x24: 0000000000000001
[  131.739300] x23: ffff80096fd40a80 x22: 0000000000000001
[  131.744561] x21: ffff80096fd40c00 x20: 0000000000000000
[  131.749823] x19: ffff80096fd40b00 x18: 0000000000000000
[  131.755084] x17: 0000ffffa5f64b00 x16: ffff0000081e7c88
[  131.760344] x15: 0000000000000000 x14: 0000000000000000
[  131.765605] x13: 0000000000000007 x12: 000000000000ca35
[  131.770865] x11: 0000000000000006 x10: 000000000000ca35
[  131.776126] x9 : 0000000000000000 x8 : ffff80097479f500
[  131.781387] x7 : 0000000000000000 x6 : 000000000000003f
[  131.786647] x5 : ffff80096fd40648 x4 : 0000000000000000
[  131.791908] x3 : ffff80096fd40600 x2 : 0000000000000001
[  131.797168] x1 : 0000000000000000 x0 : ffff80096f61f280
[  131.802429]
[  131.803898] ---[ end trace f3a899d81ca41342 ]---
[  131.808464] Call trace:
[  131.810882] Exception stack(0xffff8009746c3970 to 0xffff8009746c3aa0)
[  131.817256] 3960:                                   ffff80096fd40b00 0001000000000000
[  131.825008] 3980: ffff8009746c3b40 ffff000000bdba1c ffff8009746c3a30 ffff0000080fe1e4
[  131.832759] 39a0: ffff0000009c3038 ffff80097085b800 0000000000000001 ffff8009746c3d70
[  131.840509] 39c0: ffff80096fd40a80 0000000000000001 0000000000000018 ffff80096fd40a80
[  131.848260] 39e0: 0000000022d216e0 ffff80096fd40c00 ffff80097085c038 0000000000000000
[  131.856010] 3a00: ffff000008e15130 0000000000000140 ffff80096f61f280 0000000000000000
[  131.863761] 3a20: 0000000000000001 ffff80096fd40600 0000000000000000 ffff80096fd40648
[  131.871511] 3a40: 000000000000003f 0000000000000000 ffff80097479f500 0000000000000000
[  131.879262] 3a60: 000000000000ca35 0000000000000006 000000000000ca35 0000000000000007
[  131.887012] 3a80: 0000000000000000 0000000000000000 ffff0000081e7c88 0000ffffa5f64b00
[  131.894830] [<ffff000000bdba1c>] drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
[  131.903338] [<ffff000000bde958>] drm_atomic_helper_commit+0x7c/0x11c [drm_kms_helper]
[  131.911252] [<ffff0000009a10a8>] drm_atomic_commit+0x48/0x68 [drm]
[  131.917532] [<ffff0000009a26f4>] drm_mode_atomic_ioctl+0x42c/0xa40 [drm]
[  131.924324] [<ffff00000098d8e8>] drm_ioctl+0x188/0x458 [drm]
[  131.929929] [<ffff0000081e75a0>] do_vfs_ioctl+0xb4/0x79c
[  131.935186] [<ffff0000081e7d0c>] SyS_ioctl+0x84/0x98
[  131.940101] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4
n:2124) igt-kms-CRITICAL: Last errno: 62, Timer expired
****  END  ****
Subtest plane-all-transition-nonblocking-fencing: FAIL (2.151s)
[  363.609017] INFO: task kworker/u12:4:1087 blocked for more than 120 seconds.
[  363.616021]       Tainted: G        W       4.9.0-rc8 #267
[  363.621473] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  363.629237] kworker/u12:4   D    0  1087      2 0x00000000
[  363.634770] Workqueue: events_unbound commit_work [drm_kms_helper]
[  363.640903] Call trace:
[  363.643328] [<ffff000008085550>] __switch_to+0x90/0xa4
[  363.648431] [<ffff000008881ac8>] __schedule+0x178/0x564
[  363.653618] [<ffff000008881ef0>] schedule+0x3c/0xa0
[  363.658461] [<ffff000008884c34>] schedule_timeout+0x148/0x218
[  363.664165] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
[  363.670383] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
[  363.676495] [<ffff000000bdb9b8>] drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
[  363.685017] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
[  363.691646] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
[  363.698211] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
[  363.703912] [<ffff0000080d346c>] worker_thread+0x58/0x434
[  363.709269] [<ffff0000080d8f24>] kthread+0xd4/0xe8
[  363.714024] [<ffff000008082e80>] ret_from_fork+0x10/0x50
[  484.440951] INFO: task kworker/u12:4:1087 blocked for more than 120 seconds.
[  484.440957]       Tainted: G        W       4.9.0-rc8 #267
[  484.440959] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  484.440966] kworker/u12:4   D    0  1087      2 0x00000000
[  484.441059] Workqueue: events_unbound commit_work [drm_kms_helper]
[  484.441060] Call trace:
[  484.441072] [<ffff000008085550>] __switch_to+0x90/0xa4
[  484.441080] [<ffff000008881ac8>] __schedule+0x178/0x564
[  484.441085] [<ffff000008881ef0>] schedule+0x3c/0xa0
[  484.441092] [<ffff000008884c34>] schedule_timeout+0x148/0x218
[  484.441099] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
[  484.441105] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
[  484.441177] [<ffff000000bdb9b8>] drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
[  484.441250] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
[  484.441321] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
[  484.441329] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
[  484.441334] [<ffff0000080d346c>] worker_thread+0x58/0x434
[  484.441339] [<ffff0000080d8f24>] kthread+0xd4/0xe8
[  484.441344] [<ffff000008082e80>] ret_from_fork+0x10/0x50
[  485.464997] [drm:drm_atomic_helper_swap_state [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] hw_done timed out
[  495.704997] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] hw_done timed out
[  505.944998] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] flip_done timed out
[  506.391339] ------------[ cut here ]------------
[  506.395909] kernel BUG at drivers/dma-buf/dma-fence.c:178!
[  506.401337] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[  506.406763] Modules linked in: mali_dp tda998x drm_kms_helper drm ip_tables x_tables ipv6
[  506.414894] CPU: 3 PID: 2124 Comm: kms_atomic_tran Tainted: G        W       4.9.0-rc8 #267
[  506.423158] Hardware name: ARM Juno development board (r0) (DT)
[  506.429015] task: ffff800970ae0000 task.stack: ffff8009746c0000
[  506.434879] PC is at dma_fence_release+0x44/0x48
[  506.439448] LR is at sync_file_free+0x48/0x70
[  506.443757] pc : [<ffff00000852e504>] lr : [<ffff00000852f7cc>] pstate: 80000145
[  506.451074] sp : ffff8009746c3b70
[  506.454349] x29: ffff8009746c3b70 x28: ffff8009746c0000
[  506.459610] x27: 0000000000000001 x26: ffff000008d3728c
[  506.464870] x25: ffff800975d10510 x24: ffff8009768d3b50
[  506.470130] x23: ffff800976c3ec20 x22: ffff8009720c7e40
[  506.475390] x21: ffff8009768d3b50 x20: 0000000000000010
[  506.480650] x19: ffff80096f61f100 x18: 0000000000000000
[  506.485909] x17: 4000000000000000 x16: ffffffffffffffff
[  506.491170] x15: 0000000000000040 x14: dead000000000100
[  506.496430] x13: dead000000000200 x12: 00000000ffffffff
[  506.501690] x11: 0000000000000068 x10: ffff800975f18700
[  506.506950] x9 : 0000000040000000 x8 : 0000000000210d00
[  506.512210] x7 : ffff800970ae0678 x6 : 0000000000000000
[  506.517470] x5 : 0000000000000000 x4 : 0000000000000000
[  506.522730] x3 : ffff800976753ce0 x2 : ffff80096f61f2a0
[  506.527989] x1 : 0000000000000000 x0 : ffff80096f61f280
[  506.533248]
[  506.534719] Process kms_atomic_tran (pid: 2124, stack limit = 0xffff8009746c0020)
[  506.542124] Stack: (0xffff8009746c3b70 to 0xffff8009746c4000)
[  506.547810] 3b60:                                   ffff8009746c3b80 ffff00000852f7cc
[  506.555561] 3b80: ffff8009746c3ba0 ffff00000852f824 ffff800975d10500 ffff8009768d3b50
[  506.563311] 3ba0: ffff8009746c3bb0 ffff0000081d6b24 ffff8009746c3c00 ffff0000081d6cc0
[  506.571062] 3bc0: ffff80097479bf00 ffff800970ae0678 ffff800970ae0000 ffff800970ae06ac
[  506.578813] 3be0: ffff000008e0f000 ffff800975f18768 0000000008430000 ffff0000080da458
[  506.586564] 3c00: ffff8009746c3c10 ffff0000080d72d4 ffff8009746c3c50 ffff0000080c016c
[  506.594314] 3c20: ffff800970ae0000 ffff8009746c3cb0 0000000000000001 ffff800970ac0000
[  506.602065] 3c40: ffff000008d35000 ffff0000080c0168 ffff8009746c3cc0 ffff0000080c088c
[  506.609815] 3c60: ffff800970ac0000 0000000000000002 ffff8009746c0000 ffff800970ac0000
[  506.617566] 3c80: ffff800974608000 ffff8009746c3de8 0000000008430000 ffff000008d3728c
[  506.625316] 3ca0: 0000000000000001 ffff8009746c0000 ffff8009746c3cf0 ffff0000080ca3dc
[  506.633067] 3cc0: ffff8009746c3cf0 ffff0000080ca514 ffff8009746c0000 ffff8009746c3e08
[  506.640818] 3ce0: ffff800974608808 ffff800970ac0000 ffff8009746c3d70 ffff000008087850
[  506.648568] 3d00: 0000000000000201 ffff8009746c3de8 ffff8009746c0000 ffff8009746c3ec0
[  506.656319] 3d20: 0000000000000000 ffff8009746c3ec0 0000000000000123 000000000000008b
[  506.664069] 3d40: ffff000008892000 ffff8009746c0000 0000000000000000 0000000000000000
[  506.671820] 3d60: 5555000000004100 ffff000008b04a20 ffff8009746c3e90 ffff000008087e2c
[  506.679570] 3d80: 0000000000000201 ffff8009746c0000 ffff8009746c0000 ffff8009746c3ec0
[  506.687320] 3da0: 0000000000000000 0000000000000015 0000000000000123 000000000000008b
[  506.695071] 3dc0: ffff000008892000 ffff8009746c0000 0000000000000000 0000000000000000
[  506.702821] 3de0: ffff8009746c3e20 ffff0000081decc4 ffff8009746c3e40 ffff0000081472d0
[  506.710572] 3e00: ffff8009748fa800 0000000000000002 00000000fffffffa 000000000000084c
[  506.718322] 3e20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  506.726072] 3e40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  506.733822] 3e60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  506.741572] 3e80: 0000000000000000 ffff000008082f58 0000000000000000 ffff000008082ddc
[  506.749323] 3ea0: 0000000000000200 0000ffffeac382b8 ffffffffffffffff 0000ffffa625d6c8
[  506.757073] 3ec0: 0000000000000003 00000000c03864bc 0000ffffeac382b8 0000000000000011
[  506.764823] 3ee0: 0000000022d216a0 0000000000000005 0000000000000022 0000000022d213b0
[  506.772573] 3f00: 000000000000001d 0000000000000000 0000001000000020 0000ffffeac38400
[  506.780323] 3f20: 0000001300000020 0000000000000000 0000000000000000 0000000000000000
[  506.788074] 3f40: 0000ffffa6230278 0000ffffa5f64b00 0000000000000000 0000000022d216c0
[  506.795824] 3f60: 0000ffffeac382b8 00000000c03864bc 0000000000000003 0000000022d1d410
[  506.803575] 3f80: 0000000000000022 0000000022d216e0 0000000022d217b0 0000000022d1c7e0
[  506.811325] 3fa0: 0000000000000010 0000ffffeac38220 0000ffffa621797c 0000ffffeac38220
[  506.819075] 3fc0: 0000ffffa5f64b08 0000000060000000 0000000000000000 ffffffffffffffff
[  506.826825] 3fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  506.834572] Call trace:
[  506.836990] Exception stack(0xffff8009746c39a0 to 0xffff8009746c3ad0)
[  506.843365] 39a0: ffff80096f61f100 0001000000000000 ffff8009746c3b70 ffff00000852e504
[  506.851115] 39c0: ffff8009746c0000 0000000180170016 0000000100170017 ffff7e0025dbbf80
[  506.858866] 39e0: ffff8009746c3b00 ffff0000081bb910 ffff80096ec34800 ffff8009746c0000
[  506.866617] 3a00: ffff00000819826c ffff7e0025d39500 ffff8009746c3b30 ffff0000081bbe50
[  506.874367] 3a20: ffff7e0025bd87c0 ffff8009746c0000 0000000000158143 ffff80096f61f580
[  506.882118] 3a40: ffff80096f61f280 0000000000000000 ffff80096f61f2a0 ffff800976753ce0
[  506.889867] 3a60: 0000000000000000 0000000000000000 0000000000000000 ffff800970ae0678
[  506.897618] 3a80: 0000000000210d00 0000000040000000 ffff800975f18700 0000000000000068
[  506.905368] 3aa0: 00000000ffffffff dead000000000200 dead000000000100 0000000000000040
[  506.913117] 3ac0: ffffffffffffffff 4000000000000000
[  506.917945] [<ffff00000852e504>] dma_fence_release+0x44/0x48
[  506.923546] [<ffff00000852f7cc>] sync_file_free+0x48/0x70
[  506.928888] [<ffff00000852f824>] sync_file_release+0x30/0x3c
[  506.934490] [<ffff0000081d6b24>] __fput+0x94/0x1d8
[  506.939229] [<ffff0000081d6cc0>] ____fput+0xc/0x14
[  506.943972] [<ffff0000080d72d4>] task_work_run+0xc4/0xe4
[  506.949230] [<ffff0000080c016c>] do_exit+0x2d0/0x980
[  506.954143] [<ffff0000080c088c>] do_group_exit+0x40/0x9c
[  506.959401] [<ffff0000080ca514>] get_signal+0x1e8/0x4f0
[  506.964573] [<ffff000008087850>] do_signal+0x198/0x554
[  506.969657] [<ffff000008087e2c>] do_notify_resume+0x88/0xa4
[  506.975171] [<ffff000008082ddc>] work_pending+0x8/0x10
[  506.980257] Code: 8b010000 97ef7a27 a8c17bfd d65f03c0 (d4210000)
[  506.988726] ---[ end trace f3a899d81ca41343 ]---
[  506.993312] Fixing recursive fault but reboot is needed!

Thanks,
Brian
> 	igt_subtest("plane-all-modeset-transition")
> 		for_each_pipe_with_valid_output(&display, pipe, output)
> 			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
>
>+	igt_subtest("plane-all-modeset-transition-fencing")
>+		for_each_pipe_with_valid_output(&display, pipe, output)
>+			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true);
>+
> 	igt_subtest("plane-toggle-modeset-transition")
> 		for_each_pipe_with_valid_output(&display, pipe, output)
> 			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);
>-- 
>2.11.0
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 06/12] lib/igt_kms: Add support for the IN_FENCE_FD property
  2016-12-14 16:04   ` Brian Starkey
@ 2016-12-15 12:36     ` Robert Foss
  0 siblings, 0 replies; 24+ messages in thread
From: Robert Foss @ 2016-12-15 12:36 UTC (permalink / raw)
  To: Brian Starkey; +Cc: Gustavo Padovan, intel-gfx, Tomeu Vizoso



On 2016-12-14 11:04 AM, Brian Starkey wrote:
> Hi,
>
> On Wed, Dec 14, 2016 at 04:05:03AM -0500, Robert Foss wrote:
>> Add support dor the IN_FENCE_FD property to enable setting in fences
>> for atomic
>> commits.
>>
>> Signed-off-by: Robert Foss <robert.foss@collabora.com>
>> ---
>> lib/igt_kms.c | 20 ++++++++++++++++++++
>> lib/igt_kms.h |  5 +++++
>> 2 files changed, 25 insertions(+)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 8aaff5b8..8ca49d86 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -164,6 +164,7 @@ const char
>> *igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
>>     "CRTC_H",
>>     "FB_ID",
>>     "CRTC_ID",
>> +    "IN_FENCE_FD",
>>     "type",
>>     "rotation"
>> };
>> @@ -1426,6 +1427,7 @@ void igt_display_init(igt_display_t *display,
>> int drm_fd)
>>             n_planes++;
>>             plane->pipe = pipe;
>>             plane->drm_plane = drm_plane;
>> +            plane->fence_fd = -1;
>>
>>             if (is_atomic == 0) {
>>                 display->is_atomic = 1;
>> @@ -1712,6 +1714,11 @@ igt_atomic_prepare_plane_commit(igt_plane_t
>> *plane, igt_pipe_t *pipe,
>>         plane->index,
>>         fb_id);
>>
>> +    if (plane->fence_fd >= 0) {
>> +        uint64_t fence_fd = (int64_t) plane->fence_fd;
>> +        igt_atomic_populate_plane_req(req, plane,
>> IGT_PLANE_IN_FENCE_FD, fence_fd);
>
> Should you reset plane->fence_fd to -1 here? Or tests should
> explicitly clear it for each commit?
>

Resetting it to -1 seems like a good idea to me, if anyone has other 
preferences, just give me a shout.

> Cheers,
> Brian
>> +    }
>> +
>>     if (plane->fb_changed) {
>>         igt_atomic_populate_plane_req(req, plane, IGT_PLANE_CRTC_ID,
>> fb_id ? crtc_id : 0);
>>         igt_atomic_populate_plane_req(req, plane, IGT_PLANE_FB_ID,
>> fb_id);
>> @@ -2522,6 +2529,19 @@ void igt_plane_set_fb(igt_plane_t *plane,
>> struct igt_fb *fb)
>>     plane->size_changed = true;
>> }
>>
>> +/**
>> + * igt_plane_set_fence_fd:
>> + * @plane: plane
>> + * @fence_fd: fence fd, disable fence_fd by setting it to -1
>> + *
>> + * This function sets a fence fd to enable a commit to wait for some
>> event to
>> + * occur before completing.
>> + */
>> +void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd)
>> +{
>> +    plane->fence_fd = fence_fd;
>> +}
>> +
>> void igt_plane_set_position(igt_plane_t *plane, int x, int y)
>> {
>>     igt_pipe_t *pipe = plane->pipe;
>> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>> index dbe81bcb..9766807c 100644
>> --- a/lib/igt_kms.h
>> +++ b/lib/igt_kms.h
>> @@ -225,6 +225,7 @@ enum igt_atomic_plane_properties {
>>
>>        IGT_PLANE_FB_ID,
>>        IGT_PLANE_CRTC_ID,
>> +       IGT_PLANE_IN_FENCE_FD,
>>        IGT_PLANE_TYPE,
>>        IGT_PLANE_ROTATION,
>>        IGT_NUM_PLANE_PROPS
>> @@ -284,6 +285,9 @@ typedef struct {
>>     uint32_t src_h;
>>
>>     igt_rotation_t rotation;
>> +
>> +    /* in fence fd */
>> +    int32_t fence_fd;
>>     uint32_t atomic_props_plane[IGT_NUM_PLANE_PROPS];
>> } igt_plane_t;
>>
>> @@ -367,6 +371,7 @@ void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe,
>> void *ptr, size_t length);
>> void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
>>
>> void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
>> +void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
>> void igt_plane_set_position(igt_plane_t *plane, int x, int y);
>> void igt_plane_set_size(igt_plane_t *plane, int w, int h);
>> void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
>> --
>> 2.11.0
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property
  2016-12-14 16:13   ` Brian Starkey
@ 2016-12-16  8:21     ` Robert Foss
  2016-12-16 18:57       ` Brian Starkey
  0 siblings, 1 reply; 24+ messages in thread
From: Robert Foss @ 2016-12-16  8:21 UTC (permalink / raw)
  To: Brian Starkey; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso



On 2016-12-14 11:13 AM, Brian Starkey wrote:
> Hi,
>
> On Wed, Dec 14, 2016 at 04:05:04AM -0500, Robert Foss wrote:
>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>
>> Add support for the OUT_FENCE_PTR property to enable setting out
>> fences for
>> atomic commits.
>>
>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>> Signed-off-by: Robert Foss <robert.foss@collabora.com>
>> ---
>> lib/igt_kms.c | 21 ++++++++++++++++++++-
>> lib/igt_kms.h |  3 +++
>> 2 files changed, 23 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index 8ca49d86..fe1b356d 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -175,7 +175,8 @@ const char
>> *igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
>>     "DEGAMMA_LUT",
>>     "GAMMA_LUT",
>>     "MODE_ID",
>> -    "ACTIVE"
>> +    "ACTIVE",
>> +    "OUT_FENCE_PTR"
>> };
>>
>> const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>> @@ -2103,6 +2104,10 @@ static void
>> igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRe
>>         igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE,
>> !!output);
>>     }
>>
>> +    if (pipe_obj->out_fence_ptr)
>> +        igt_atomic_populate_crtc_req(req, pipe_obj,
>> IGT_CRTC_OUT_FENCE_PTR,
>> +            (uint64_t)(uintptr_t) pipe_obj->out_fence_ptr);
>> +
>>     /*
>>      *    TODO: Add all crtc level properties here
>>      */
>> @@ -2683,6 +2688,20 @@ igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void
>> *ptr, size_t length)
>> }
>>
>> /**
>> + * igt_pipe_set_out_fence_ptr:
>> + * @pipe: pipe pointer to which background color to be set
>> + * @fence_ptr: out fence pointer
>> + *
>> + * Sets the out fence pointer that will be passed to the kernel in
>> + * the atomic ioctl. When the kernel returns the out fence pointer
>> + * will contain the fd number of the out fence created by KMS.
>> + */
>> +void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr)
>> +{
>> +    pipe->out_fence_ptr = fence_ptr;
>> +}
>> +
>> +/**
>>  * igt_crtc_set_background:
>>  * @pipe: pipe pointer to which background color to be set
>>  * @background: background color value in BGR 16bpc
>> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>> index 9766807c..8eb611c0 100644
>> --- a/lib/igt_kms.h
>> +++ b/lib/igt_kms.h
>> @@ -110,6 +110,7 @@ enum igt_atomic_crtc_properties {
>>        IGT_CRTC_GAMMA_LUT,
>>        IGT_CRTC_MODE_ID,
>>        IGT_CRTC_ACTIVE,
>> +       IGT_CRTC_OUT_FENCE_PTR,
>>        IGT_NUM_CRTC_PROPS
>> };
>>
>> @@ -316,6 +317,7 @@ struct igt_pipe {
>>
>>     uint64_t mode_blob;
>>     bool mode_changed;
>> +    int64_t *out_fence_ptr;
>
> I prefer the interface that got suggested before - igt_pipe gets an
> "int64_t out_fence;" member which tests can query to get the fence
> value:
>
> int igt_pipe_get_last_out_fence(igt_pipe_t *pipe);
>
> ..and the kernel only ever receives a pointer to pipe->out_fence.
>
> The only reason I can see for a test to want to provide its own fence
> pointer is to test invalid pointer values - and I think it's OK for
> that test to set the property directly instead of making setting a
> custom fence pointer the common case for all users.
>
> If we don't want to get a fence for every commit then I guess there
> could be a way for a test to request an out-fence for just the next
> commit on a pipe (or the inverse - disable fencing for a particular
> commit):
>
> void igt_pipe_request_out_fence(igt_pipe_t *pipe);
>
> -Brian

Now I see what you meant in the v1 discussion, I'll amend the 
implementation in v3 to be the one mentioned above.

The only question I have is about igt_pipe_get_last_out_fence(), is it 
really necessary? I don't foresee a function like that ever doing more 
than just returning a struct member. Is it not a bit redundant?


Rob.

>
>> };
>>
>> typedef struct {
>> @@ -369,6 +371,7 @@ static inline bool
>> igt_plane_supports_rotation(igt_plane_t *plane)
>> void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t
>> length);
>> void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length);
>> void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
>> +void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr);
>>
>> void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
>> void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
>> --
>> 2.11.0
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings
  2016-12-14 16:39   ` Brian Starkey
@ 2016-12-16  8:35     ` Robert Foss
  2016-12-16 19:05       ` Brian Starkey
  0 siblings, 1 reply; 24+ messages in thread
From: Robert Foss @ 2016-12-16  8:35 UTC (permalink / raw)
  To: Brian Starkey; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso



On 2016-12-14 11:39 AM, Brian Starkey wrote:
> Hi,
>
> On Wed, Dec 14, 2016 at 04:05:05AM -0500, Robert Foss wrote:
>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>
>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>> Signed-off-by: Robert Foss <robert.foss@collabora.com>
>> ---
>> tests/kms_atomic.c | 186
>> ++++++++++++++++++++++++++++++++++++++++++++++++++---
>> 1 file changed, 176 insertions(+), 10 deletions(-)
>>
>> diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
>> index 8b648eba..a557ac60 100644
>> --- a/tests/kms_atomic.c
>> +++ b/tests/kms_atomic.c
>> @@ -44,6 +44,7 @@
>> #include "drmtest.h"
>> #include "igt.h"
>> #include "igt_aux.h"
>> +#include "sw_sync.h"
>>
>> #ifndef DRM_CLIENT_CAP_ATOMIC
>> #define DRM_CLIENT_CAP_ATOMIC 3
>> @@ -126,6 +127,7 @@ struct kms_atomic_plane_state {
>>     uint32_t fb_id; /* 0 to disable */
>>     uint32_t src_x, src_y, src_w, src_h; /* 16.16 fixed-point */
>>     uint32_t crtc_x, crtc_y, crtc_w, crtc_h; /* normal integers */
>> +    int32_t fence_fd;
>> };
>>
>> struct kms_atomic_crtc_state {
>> @@ -133,6 +135,7 @@ struct kms_atomic_crtc_state {
>>     uint32_t obj;
>>     int idx;
>>     bool active;
>> +    uint64_t out_fence_ptr;
>>     struct kms_atomic_blob mode;
>> };
>>
>> @@ -190,11 +193,13 @@ static uint32_t blob_duplicate(int fd, uint32_t
>> id_orig)
>>     crtc_populate_req(crtc, req); \
>>     plane_populate_req(plane, req); \
>>     do_atomic_commit((crtc)->state->desc->fd, req, flags); \
>> -    crtc_check_current_state(crtc, plane, relax); \
>> -    plane_check_current_state(plane, relax); \
>> +    if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { \
>> +        crtc_check_current_state(crtc, plane, relax); \
>> +        plane_check_current_state(plane, relax); \
>> +    } \
>> }
>>
>> -#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req,
>> relax, e) { \
>> +#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req,
>> flags, relax, e) { \
>>     drmModeAtomicSetCursor(req, 0); \
>>     crtc_populate_req(crtc, req); \
>>     plane_populate_req(plane, req); \
>> @@ -299,6 +304,9 @@ find_connector(struct kms_atomic_state *state,
>> static void plane_populate_req(struct kms_atomic_plane_state *plane,
>>                    drmModeAtomicReq *req)
>> {
>> +    if (plane->fence_fd)
>> +        plane_set_prop(req, plane, IGT_PLANE_IN_FENCE_FD,
>> plane->fence_fd);
>> +
>>     plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane->crtc_id);
>>     plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane->fb_id);
>>     plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane->src_x);
>> @@ -424,6 +432,10 @@ find_plane(struct kms_atomic_state *state, enum
>> plane_type type,
>> static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
>>                   drmModeAtomicReq *req)
>> {
>> +    if (crtc->out_fence_ptr)
>> +        crtc_set_prop(req, crtc, IGT_CRTC_OUT_FENCE_PTR,
>> +                  crtc->out_fence_ptr);
>> +
>>     crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc->mode.id);
>>     crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active);
>> }
>> @@ -1052,6 +1064,37 @@ static void plane_invalid_params(struct
>> kms_atomic_crtc_state *crtc,
>>     drmModeAtomicFree(req);
>> }
>>
>> +static void plane_invalid_params_fence(struct kms_atomic_crtc_state
>> *crtc,
>> +                struct kms_atomic_plane_state *plane_old,
>> +                struct kms_atomic_connector_state *conn)
>> +{
>> +    struct kms_atomic_plane_state plane = *plane_old;
>> +    drmModeAtomicReq *req = drmModeAtomicAlloc();
>> +    int timeline, fence_fd;
>> +
>> +    igt_require_sw_sync();
>> +
>> +    /* invalid fence fd */
>> +    plane.fence_fd = plane.state->desc->fd;
>> +    plane.crtc_id = plane_old->crtc_id;
>> +    plane_commit_atomic_err(&plane, plane_old, req,
>> +                            ATOMIC_RELAX_NONE, EINVAL);
>> +
>> +    /* Valid fence_fd but invalid CRTC */
>> +    timeline = sw_sync_timeline_create();
>> +    fence_fd =  sw_sync_fence_create(timeline, 1);
>> +    plane.fence_fd = fence_fd;
>> +    plane.crtc_id = ~0U;
>> +    plane_commit_atomic_err(&plane, plane_old, req,
>> +                            ATOMIC_RELAX_NONE, EINVAL);
>> +
>> +    plane.fence_fd = -1;
>> +    close(fence_fd);
>> +    close(timeline);
>> +
>> +    drmModeAtomicFree(req);
>> +}
>> +
>> static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
>>                 struct kms_atomic_plane_state *plane,
>>                 struct kms_atomic_connector_state *conn)
>> @@ -1063,30 +1106,32 @@ static void crtc_invalid_params(struct
>> kms_atomic_crtc_state *crtc_old,
>>
>>     /* Pass a series of invalid object IDs for the mode ID. */
>>     crtc.mode.id = plane->obj;
>> -    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>                            ATOMIC_RELAX_NONE, EINVAL);
>>
>>     crtc.mode.id = crtc.obj;
>> -    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>                            ATOMIC_RELAX_NONE, EINVAL);
>>
>>     crtc.mode.id = conn->obj;
>> -    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>                            ATOMIC_RELAX_NONE, EINVAL);
>>
>>     crtc.mode.id = plane->fb_id;
>> -    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>                            ATOMIC_RELAX_NONE, EINVAL);
>>
>> +    /* successful TEST_ONLY with fences set */
>>     crtc.mode.id = crtc_old->mode.id;
>> -    crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
>> +    crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE,
>> +               DRM_MODE_ATOMIC_TEST_ONLY);
>>
>>     /* Create a blob which is the wrong size to be a valid mode. */
>>     do_or_die(drmModeCreatePropertyBlob(crtc.state->desc->fd,
>>                         crtc.mode.data,
>>                         sizeof(struct drm_mode_modeinfo) - 1,
>>                         &crtc.mode.id));
>> -    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>                            ATOMIC_RELAX_NONE, EINVAL);
>>
>>
>> @@ -1094,15 +1139,107 @@ static void crtc_invalid_params(struct
>> kms_atomic_crtc_state *crtc_old,
>>                         crtc.mode.data,
>>                         sizeof(struct drm_mode_modeinfo) + 1,
>>                         &crtc.mode.id));
>> -    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>                            ATOMIC_RELAX_NONE, EINVAL);
>>
>> +
>>     /* Restore the CRTC and check the state matches the old. */
>>     crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);
>>
>>     drmModeAtomicFree(req);
>> }
>>
>> +static void crtc_invalid_params_fence(struct kms_atomic_crtc_state
>> *crtc_old,
>> +                struct kms_atomic_plane_state *plane,
>> +                struct kms_atomic_connector_state *conn)
>> +{
>> +    struct kms_atomic_crtc_state crtc = *crtc_old;
>> +    drmModeAtomicReq *req = drmModeAtomicAlloc();
>> +    int timeline, fence_fd, *out_fence;
>> +
>> +    igt_require_sw_sync();
>> +
>> +    /* invalid out_fence_ptr */
>> +    crtc.mode.id = crtc_old->mode.id;
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) crtc_invalid_params;
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>> +                           ATOMIC_RELAX_NONE, EFAULT);
>> +
>> +    /* invalid out_fence_ptr */
>> +    crtc.mode.id = crtc_old->mode.id;
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0x8;
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>> +                           ATOMIC_RELAX_NONE, EFAULT);
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>> +
>> +    /* valid in fence but not allowed prop on crtc */
>> +    timeline = sw_sync_timeline_create();
>> +    fence_fd =  sw_sync_fence_create(timeline, 1);
>> +    plane->fence_fd = fence_fd;
>> +    crtc.active = false;
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>> +                   ATOMIC_RELAX_NONE, EINVAL);
>> +
>> +    out_fence = malloc(sizeof(uint64_t));
>> +    igt_assert(out_fence);
>> +
>> +
>> +    /* valid out fence ptr and flip event but not allowed prop on
>> crtc */
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>> +                   ATOMIC_RELAX_NONE, EINVAL);
>> +
>> +    /* valid out fence ptr and flip event but not allowed prop on
>> crtc */
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +                   DRM_MODE_PAGE_FLIP_EVENT,
>> +                   ATOMIC_RELAX_NONE, EINVAL);
>> +
>> +    /* valid page flip event but not allowed prop on crtc */
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +                   DRM_MODE_PAGE_FLIP_EVENT,
>> +                   ATOMIC_RELAX_NONE, EINVAL);
>> +    crtc.active = true;
>> +
>> +    /* valid out fence  ptr and flip event but invalid prop on crtc */
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>> +    crtc.mode.id = plane->fb_id;
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>> +                   ATOMIC_RELAX_NONE, EINVAL);
>> +
>> +    /* valid out fence ptr and flip event but invalid prop on crtc */
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +                   DRM_MODE_PAGE_FLIP_EVENT,
>> +                   ATOMIC_RELAX_NONE, EINVAL);
>> +
>> +    /* valid page flip event but invalid prop on crtc */
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>> +    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>> +                   DRM_MODE_PAGE_FLIP_EVENT,
>> +                   ATOMIC_RELAX_NONE, EINVAL);
>> +
>> +    /* successful TEST_ONLY with fences set */
>> +    plane->fence_fd = fence_fd;
>> +    crtc.mode.id = crtc_old->mode.id;
>> +    crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE,
>> +               DRM_MODE_ATOMIC_TEST_ONLY);
>> +    igt_assert(*out_fence == -1);
>> +    close(fence_fd);
>> +    close(timeline);
>> +
>> +    /* reset fences */
>> +    plane->fence_fd = -1;
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>> +    crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
>> +
>> +    /* out fence ptr but not page flip event */
>> +    crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>> +    crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);
>
> What are the previous two commits for? They don't seem to be invalid.

They don't seem to be invalid to me either, would you prefer to have 
them separated out into a subtest without invalid in its name?

>
>> +
>> +    free(out_fence);
>
> Need to close(*out_fence) before freeing it?
>
> -Brian

Yep, fixing in v3.

>
>> +    drmModeAtomicFree(req);
>> +}
>> +
>> /* Abuse the atomic ioctl directly in order to test various invalid
>> conditions,
>>  * which the libdrm wrapper won't allow us to create. */
>> static void atomic_invalid_params(struct kms_atomic_crtc_state *crtc,
>> @@ -1306,6 +1443,20 @@ igt_main
>>         atomic_state_free(scratch);
>>     }
>>
>> +    igt_subtest("plane_invalid_params_fence") {
>> +        struct kms_atomic_state *scratch = atomic_state_dup(current);
>> +        struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>> +        struct kms_atomic_plane_state *plane =
>> +            find_plane(current, PLANE_TYPE_PRIMARY, crtc);
>> +        struct kms_atomic_connector_state *conn =
>> +            find_connector(scratch, crtc);
>> +
>> +        igt_require(crtc);
>> +        igt_require(plane);
>> +        plane_invalid_params_fence(crtc, plane, conn);
>> +        atomic_state_free(scratch);
>> +    }
>> +
>>     igt_subtest("crtc_invalid_params") {
>>         struct kms_atomic_state *scratch = atomic_state_dup(current);
>>         struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>> @@ -1321,6 +1472,21 @@ igt_main
>>         atomic_state_free(scratch);
>>     }
>>
>> +    igt_subtest("crtc_invalid_params_fence") {
>> +        struct kms_atomic_state *scratch = atomic_state_dup(current);
>> +        struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>> +        struct kms_atomic_plane_state *plane =
>> +            find_plane(scratch, NUM_PLANE_TYPE_PROPS, crtc);
>> +        struct kms_atomic_connector_state *conn =
>> +            find_connector(scratch, crtc);
>> +
>> +        igt_require(crtc);
>> +        igt_require(plane);
>> +        igt_require(conn);
>> +        crtc_invalid_params_fence(crtc, plane, conn);
>> +        atomic_state_free(scratch);
>> +    }
>> +
>>     igt_subtest("atomic_invalid_params") {
>>         struct kms_atomic_state *scratch = atomic_state_dup(current);
>>         struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>> --
>> 2.11.0
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests
  2016-12-14 16:57   ` Brian Starkey
@ 2016-12-16  8:59     ` Robert Foss
  2016-12-16 19:06       ` Brian Starkey
  0 siblings, 1 reply; 24+ messages in thread
From: Robert Foss @ 2016-12-16  8:59 UTC (permalink / raw)
  To: Brian Starkey; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso



On 2016-12-14 11:57 AM, Brian Starkey wrote:
> On Wed, Dec 14, 2016 at 04:05:07AM -0500, Robert Foss wrote:
>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>
>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>> Signed-off-by: Robert Foss <robert.foss@collabora.com>
>> ---
>> lib/igt_kms.c                 | 22 ++++++++++++++++++++++
>> tests/kms_atomic_transition.c | 32 ++++++++++++++++++++++++++++++--
>> 2 files changed, 52 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index fe1b356d..eb59ab36 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -49,6 +49,7 @@
>> #include "intel_chipset.h"
>> #include "igt_debugfs.h"
>> #include "igt_sysfs.h"
>> +#include "sw_sync.h"
>>
>> /**
>>  * SECTION:igt_kms
>> @@ -2184,6 +2185,27 @@ static int igt_atomic_commit(igt_display_t
>> *display, uint32_t flags, void *user_
>>     }
>>
>>     ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
>> +    if (!ret) {
>> +        int64_t *fence_ptr;
>> +
>> +        for_each_pipe(display, pipe) {
>> +            igt_pipe_t *pipe_obj = &display->pipes[pipe];
>> +
>> +            fence_ptr = pipe_obj->out_fence_ptr;
>> +            if (!fence_ptr)
>> +                continue;
>> +
>> +            if (flags & DRM_MODE_ATOMIC_TEST_ONLY) {
>> +                igt_assert(*fence_ptr == -1);
>> +            } else {
>> +                igt_assert(*fence_ptr >= 0);
>> +                ret = sw_sync_wait(*fence_ptr, 1000);
>> +                igt_assert(ret == 0);
>> +                close(*fence_ptr);
>> +            }
>> +        }
>> +    }
>> +
>>     drmModeAtomicFree(req);
>>     return ret;
>>
>> diff --git a/tests/kms_atomic_transition.c
>> b/tests/kms_atomic_transition.c
>> index b7d99975..08f9499f 100644
>> --- a/tests/kms_atomic_transition.c
>> +++ b/tests/kms_atomic_transition.c
>> @@ -132,6 +132,7 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>     struct plane_parms parms[IGT_MAX_PLANES];
>>     bool skip_test = false;
>>     unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
>> +    int out_fence, ret;
>
> out_fence needs to be 64-bit.

Ack, fixed in v3.

>
>>
>>     if (nonblocking)
>>         flags |= DRM_MODE_ATOMIC_NONBLOCK;
>> @@ -198,9 +199,11 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>      * planes to fix this
>>      */
>>     while (1) {
>> -        int ret;
>> -
>>         wm_setup_plane(display, pipe, iter_max - 1, parms);
>> +
>> +        if (fencing)
>> +            igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> +                (int64_t *) &out_fence);
>>         ret = igt_display_try_commit_atomic(display,
>> DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
>>
>>         if (ret != -EINVAL || n_planes < 3)
>> @@ -231,6 +234,9 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>
>>         wm_setup_plane(display, pipe, i, parms);
>>
>> +        if (fencing)
>> +            igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> &out_fence);
>> +
>>         igt_display_commit_atomic(display, flags, (void *)(unsigned
>> long)i);
>>         drmHandleEvent(display->drm_fd, &drm_events);
>>
>> @@ -239,6 +245,10 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>
>>             wm_setup_plane(display, pipe, 0, parms);
>>
>> +            if (fencing)
>> +                igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> +                    (int64_t *) &out_fence);
>> +
>>             igt_display_commit_atomic(display, flags, (void *)0UL);
>>
>>             drmHandleEvent(display->drm_fd, &drm_events);
>> @@ -252,6 +262,9 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>                 if (type == TRANSITION_MODESET)
>>                     igt_output_override_mode(output, &override_mode);
>>
>> +                if (fencing)
>> +                    igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> &out_fence);
>> +
>>                 igt_display_commit_atomic(display, flags, (void
>> *)(unsigned long)j);
>>                 drmHandleEvent(display->drm_fd, &drm_events);
>>
>> @@ -259,6 +272,9 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>                 if (type == TRANSITION_MODESET)
>>                     igt_output_override_mode(output, NULL);
>>
>> +                if (fencing)
>> +                    igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> &out_fence);
>> +
>>                 igt_display_commit_atomic(display, flags, (void
>> *)(unsigned long)i);
>>                 drmHandleEvent(display->drm_fd, &drm_events);
>>             }
>> @@ -588,14 +604,26 @@ igt_main
>>         for_each_pipe_with_valid_output(&display, pipe, output)
>>             run_transition_test(&display, pipe, output,
>> TRANSITION_PLANES, false, false);
>>
>> +    igt_subtest("plane-all-transition-fencing")
>> +        for_each_pipe_with_valid_output(&display, pipe, output)
>> +            run_transition_test(&display, pipe, output,
>> TRANSITION_PLANES, false, true);
>> +
>>     igt_subtest("plane-all-transition-nonblocking")
>>         for_each_pipe_with_valid_output(&display, pipe, output)
>>             run_transition_test(&display, pipe, output,
>> TRANSITION_PLANES, true, false);
>>
>> +    igt_subtest("plane-all-transition-nonblocking-fencing")
>> +        for_each_pipe_with_valid_output(&display, pipe, output)
>> +            run_transition_test(&display, pipe, output,
>> TRANSITION_PLANES, true, true);
>> +
>
> This test makes my kernel very unhappy running on drm-next on mali-dp.
> Any ideas?

Hmm. I haven't seen anything like this.
I did my testing on drm-misc/drm-misc-next, unfortunately I don't have 
any access to mali hardware of any kind :/

Rob.

>
> WARN -> Stall -> BUG:
>
> [  131.657643] WARNING: CPU: 0 PID: 2124 at
> drivers/gpu/drm/drm_atomic_helper.c:1041
> drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
> [  131.670293] Modules linked in: mali_dp tda998x drm_kms_helper drm
> ip_tables x_tables ipv6
> [  131.678416]
> [  131.679890] CPU: 0 PID: 2124 Comm: kms_atomic_tran Not tainted
> 4.9.0-rc8 #267
> [  131.686950] Hardware name: ARM Juno development board (r0) (DT)
> [  131.692806] task: ffff800970ae0000 task.stack: ffff8009746c0000
> [  131.698732] PC is at drm_atomic_helper_wait_for_fences+0xcc/0xd4
> [drm_kms_helper]
> [  131.706206] LR is at drm_atomic_helper_commit+0x7c/0x11c
> [drm_kms_helper]
> [  131.712923] pc : [<ffff000000bdba1c>] lr : [<ffff000000bde958>]
> pstate: 20000145
> [  131.720241] sp : ffff8009746c3b40
> [  131.723516] x29: ffff8009746c3b40 x28: ffff80096fd40c00
> [  131.728778] x27: 0000000022d216e0 x26: ffff80096fd40a80
> [  131.734039] x25: 0000000000000018 x24: 0000000000000001
> [  131.739300] x23: ffff80096fd40a80 x22: 0000000000000001
> [  131.744561] x21: ffff80096fd40c00 x20: 0000000000000000
> [  131.749823] x19: ffff80096fd40b00 x18: 0000000000000000
> [  131.755084] x17: 0000ffffa5f64b00 x16: ffff0000081e7c88
> [  131.760344] x15: 0000000000000000 x14: 0000000000000000
> [  131.765605] x13: 0000000000000007 x12: 000000000000ca35
> [  131.770865] x11: 0000000000000006 x10: 000000000000ca35
> [  131.776126] x9 : 0000000000000000 x8 : ffff80097479f500
> [  131.781387] x7 : 0000000000000000 x6 : 000000000000003f
> [  131.786647] x5 : ffff80096fd40648 x4 : 0000000000000000
> [  131.791908] x3 : ffff80096fd40600 x2 : 0000000000000001
> [  131.797168] x1 : 0000000000000000 x0 : ffff80096f61f280
> [  131.802429]
> [  131.803898] ---[ end trace f3a899d81ca41342 ]---
> [  131.808464] Call trace:
> [  131.810882] Exception stack(0xffff8009746c3970 to 0xffff8009746c3aa0)
> [  131.817256] 3960:                                   ffff80096fd40b00
> 0001000000000000
> [  131.825008] 3980: ffff8009746c3b40 ffff000000bdba1c ffff8009746c3a30
> ffff0000080fe1e4
> [  131.832759] 39a0: ffff0000009c3038 ffff80097085b800 0000000000000001
> ffff8009746c3d70
> [  131.840509] 39c0: ffff80096fd40a80 0000000000000001 0000000000000018
> ffff80096fd40a80
> [  131.848260] 39e0: 0000000022d216e0 ffff80096fd40c00 ffff80097085c038
> 0000000000000000
> [  131.856010] 3a00: ffff000008e15130 0000000000000140 ffff80096f61f280
> 0000000000000000
> [  131.863761] 3a20: 0000000000000001 ffff80096fd40600 0000000000000000
> ffff80096fd40648
> [  131.871511] 3a40: 000000000000003f 0000000000000000 ffff80097479f500
> 0000000000000000
> [  131.879262] 3a60: 000000000000ca35 0000000000000006 000000000000ca35
> 0000000000000007
> [  131.887012] 3a80: 0000000000000000 0000000000000000 ffff0000081e7c88
> 0000ffffa5f64b00
> [  131.894830] [<ffff000000bdba1c>]
> drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
> [  131.903338] [<ffff000000bde958>] drm_atomic_helper_commit+0x7c/0x11c
> [drm_kms_helper]
> [  131.911252] [<ffff0000009a10a8>] drm_atomic_commit+0x48/0x68 [drm]
> [  131.917532] [<ffff0000009a26f4>] drm_mode_atomic_ioctl+0x42c/0xa40 [drm]
> [  131.924324] [<ffff00000098d8e8>] drm_ioctl+0x188/0x458 [drm]
> [  131.929929] [<ffff0000081e75a0>] do_vfs_ioctl+0xb4/0x79c
> [  131.935186] [<ffff0000081e7d0c>] SyS_ioctl+0x84/0x98
> [  131.940101] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4
> n:2124) igt-kms-CRITICAL: Last errno: 62, Timer expired
> ****  END  ****
> Subtest plane-all-transition-nonblocking-fencing: FAIL (2.151s)
> [  363.609017] INFO: task kworker/u12:4:1087 blocked for more than 120
> seconds.
> [  363.616021]       Tainted: G        W       4.9.0-rc8 #267
> [  363.621473] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
> disables this message.
> [  363.629237] kworker/u12:4   D    0  1087      2 0x00000000
> [  363.634770] Workqueue: events_unbound commit_work [drm_kms_helper]
> [  363.640903] Call trace:
> [  363.643328] [<ffff000008085550>] __switch_to+0x90/0xa4
> [  363.648431] [<ffff000008881ac8>] __schedule+0x178/0x564
> [  363.653618] [<ffff000008881ef0>] schedule+0x3c/0xa0
> [  363.658461] [<ffff000008884c34>] schedule_timeout+0x148/0x218
> [  363.664165] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
> [  363.670383] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
> [  363.676495] [<ffff000000bdb9b8>]
> drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
> [  363.685017] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
> [  363.691646] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
> [  363.698211] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
> [  363.703912] [<ffff0000080d346c>] worker_thread+0x58/0x434
> [  363.709269] [<ffff0000080d8f24>] kthread+0xd4/0xe8
> [  363.714024] [<ffff000008082e80>] ret_from_fork+0x10/0x50
> [  484.440951] INFO: task kworker/u12:4:1087 blocked for more than 120
> seconds.
> [  484.440957]       Tainted: G        W       4.9.0-rc8 #267
> [  484.440959] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
> disables this message.
> [  484.440966] kworker/u12:4   D    0  1087      2 0x00000000
> [  484.441059] Workqueue: events_unbound commit_work [drm_kms_helper]
> [  484.441060] Call trace:
> [  484.441072] [<ffff000008085550>] __switch_to+0x90/0xa4
> [  484.441080] [<ffff000008881ac8>] __schedule+0x178/0x564
> [  484.441085] [<ffff000008881ef0>] schedule+0x3c/0xa0
> [  484.441092] [<ffff000008884c34>] schedule_timeout+0x148/0x218
> [  484.441099] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
> [  484.441105] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
> [  484.441177] [<ffff000000bdb9b8>]
> drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
> [  484.441250] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
> [  484.441321] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
> [  484.441329] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
> [  484.441334] [<ffff0000080d346c>] worker_thread+0x58/0x434
> [  484.441339] [<ffff0000080d8f24>] kthread+0xd4/0xe8
> [  484.441344] [<ffff000008082e80>] ret_from_fork+0x10/0x50
> [  485.464997] [drm:drm_atomic_helper_swap_state [drm_kms_helper]]
> *ERROR* [CRTC:32:crtc-0] hw_done timed out
> [  495.704997] [drm:drm_atomic_helper_wait_for_dependencies
> [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] hw_done timed out
> [  505.944998] [drm:drm_atomic_helper_wait_for_dependencies
> [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] flip_done timed out
> [  506.391339] ------------[ cut here ]------------
> [  506.395909] kernel BUG at drivers/dma-buf/dma-fence.c:178!
> [  506.401337] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
> [  506.406763] Modules linked in: mali_dp tda998x drm_kms_helper drm
> ip_tables x_tables ipv6
> [  506.414894] CPU: 3 PID: 2124 Comm: kms_atomic_tran Tainted: G
> W       4.9.0-rc8 #267
> [  506.423158] Hardware name: ARM Juno development board (r0) (DT)
> [  506.429015] task: ffff800970ae0000 task.stack: ffff8009746c0000
> [  506.434879] PC is at dma_fence_release+0x44/0x48
> [  506.439448] LR is at sync_file_free+0x48/0x70
> [  506.443757] pc : [<ffff00000852e504>] lr : [<ffff00000852f7cc>]
> pstate: 80000145
> [  506.451074] sp : ffff8009746c3b70
> [  506.454349] x29: ffff8009746c3b70 x28: ffff8009746c0000
> [  506.459610] x27: 0000000000000001 x26: ffff000008d3728c
> [  506.464870] x25: ffff800975d10510 x24: ffff8009768d3b50
> [  506.470130] x23: ffff800976c3ec20 x22: ffff8009720c7e40
> [  506.475390] x21: ffff8009768d3b50 x20: 0000000000000010
> [  506.480650] x19: ffff80096f61f100 x18: 0000000000000000
> [  506.485909] x17: 4000000000000000 x16: ffffffffffffffff
> [  506.491170] x15: 0000000000000040 x14: dead000000000100
> [  506.496430] x13: dead000000000200 x12: 00000000ffffffff
> [  506.501690] x11: 0000000000000068 x10: ffff800975f18700
> [  506.506950] x9 : 0000000040000000 x8 : 0000000000210d00
> [  506.512210] x7 : ffff800970ae0678 x6 : 0000000000000000
> [  506.517470] x5 : 0000000000000000 x4 : 0000000000000000
> [  506.522730] x3 : ffff800976753ce0 x2 : ffff80096f61f2a0
> [  506.527989] x1 : 0000000000000000 x0 : ffff80096f61f280
> [  506.533248]
> [  506.534719] Process kms_atomic_tran (pid: 2124, stack limit =
> 0xffff8009746c0020)
> [  506.542124] Stack: (0xffff8009746c3b70 to 0xffff8009746c4000)
> [  506.547810] 3b60:                                   ffff8009746c3b80
> ffff00000852f7cc
> [  506.555561] 3b80: ffff8009746c3ba0 ffff00000852f824 ffff800975d10500
> ffff8009768d3b50
> [  506.563311] 3ba0: ffff8009746c3bb0 ffff0000081d6b24 ffff8009746c3c00
> ffff0000081d6cc0
> [  506.571062] 3bc0: ffff80097479bf00 ffff800970ae0678 ffff800970ae0000
> ffff800970ae06ac
> [  506.578813] 3be0: ffff000008e0f000 ffff800975f18768 0000000008430000
> ffff0000080da458
> [  506.586564] 3c00: ffff8009746c3c10 ffff0000080d72d4 ffff8009746c3c50
> ffff0000080c016c
> [  506.594314] 3c20: ffff800970ae0000 ffff8009746c3cb0 0000000000000001
> ffff800970ac0000
> [  506.602065] 3c40: ffff000008d35000 ffff0000080c0168 ffff8009746c3cc0
> ffff0000080c088c
> [  506.609815] 3c60: ffff800970ac0000 0000000000000002 ffff8009746c0000
> ffff800970ac0000
> [  506.617566] 3c80: ffff800974608000 ffff8009746c3de8 0000000008430000
> ffff000008d3728c
> [  506.625316] 3ca0: 0000000000000001 ffff8009746c0000 ffff8009746c3cf0
> ffff0000080ca3dc
> [  506.633067] 3cc0: ffff8009746c3cf0 ffff0000080ca514 ffff8009746c0000
> ffff8009746c3e08
> [  506.640818] 3ce0: ffff800974608808 ffff800970ac0000 ffff8009746c3d70
> ffff000008087850
> [  506.648568] 3d00: 0000000000000201 ffff8009746c3de8 ffff8009746c0000
> ffff8009746c3ec0
> [  506.656319] 3d20: 0000000000000000 ffff8009746c3ec0 0000000000000123
> 000000000000008b
> [  506.664069] 3d40: ffff000008892000 ffff8009746c0000 0000000000000000
> 0000000000000000
> [  506.671820] 3d60: 5555000000004100 ffff000008b04a20 ffff8009746c3e90
> ffff000008087e2c
> [  506.679570] 3d80: 0000000000000201 ffff8009746c0000 ffff8009746c0000
> ffff8009746c3ec0
> [  506.687320] 3da0: 0000000000000000 0000000000000015 0000000000000123
> 000000000000008b
> [  506.695071] 3dc0: ffff000008892000 ffff8009746c0000 0000000000000000
> 0000000000000000
> [  506.702821] 3de0: ffff8009746c3e20 ffff0000081decc4 ffff8009746c3e40
> ffff0000081472d0
> [  506.710572] 3e00: ffff8009748fa800 0000000000000002 00000000fffffffa
> 000000000000084c
> [  506.718322] 3e20: 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000
> [  506.726072] 3e40: 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000
> [  506.733822] 3e60: 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000
> [  506.741572] 3e80: 0000000000000000 ffff000008082f58 0000000000000000
> ffff000008082ddc
> [  506.749323] 3ea0: 0000000000000200 0000ffffeac382b8 ffffffffffffffff
> 0000ffffa625d6c8
> [  506.757073] 3ec0: 0000000000000003 00000000c03864bc 0000ffffeac382b8
> 0000000000000011
> [  506.764823] 3ee0: 0000000022d216a0 0000000000000005 0000000000000022
> 0000000022d213b0
> [  506.772573] 3f00: 000000000000001d 0000000000000000 0000001000000020
> 0000ffffeac38400
> [  506.780323] 3f20: 0000001300000020 0000000000000000 0000000000000000
> 0000000000000000
> [  506.788074] 3f40: 0000ffffa6230278 0000ffffa5f64b00 0000000000000000
> 0000000022d216c0
> [  506.795824] 3f60: 0000ffffeac382b8 00000000c03864bc 0000000000000003
> 0000000022d1d410
> [  506.803575] 3f80: 0000000000000022 0000000022d216e0 0000000022d217b0
> 0000000022d1c7e0
> [  506.811325] 3fa0: 0000000000000010 0000ffffeac38220 0000ffffa621797c
> 0000ffffeac38220
> [  506.819075] 3fc0: 0000ffffa5f64b08 0000000060000000 0000000000000000
> ffffffffffffffff
> [  506.826825] 3fe0: 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000
> [  506.834572] Call trace:
> [  506.836990] Exception stack(0xffff8009746c39a0 to 0xffff8009746c3ad0)
> [  506.843365] 39a0: ffff80096f61f100 0001000000000000 ffff8009746c3b70
> ffff00000852e504
> [  506.851115] 39c0: ffff8009746c0000 0000000180170016 0000000100170017
> ffff7e0025dbbf80
> [  506.858866] 39e0: ffff8009746c3b00 ffff0000081bb910 ffff80096ec34800
> ffff8009746c0000
> [  506.866617] 3a00: ffff00000819826c ffff7e0025d39500 ffff8009746c3b30
> ffff0000081bbe50
> [  506.874367] 3a20: ffff7e0025bd87c0 ffff8009746c0000 0000000000158143
> ffff80096f61f580
> [  506.882118] 3a40: ffff80096f61f280 0000000000000000 ffff80096f61f2a0
> ffff800976753ce0
> [  506.889867] 3a60: 0000000000000000 0000000000000000 0000000000000000
> ffff800970ae0678
> [  506.897618] 3a80: 0000000000210d00 0000000040000000 ffff800975f18700
> 0000000000000068
> [  506.905368] 3aa0: 00000000ffffffff dead000000000200 dead000000000100
> 0000000000000040
> [  506.913117] 3ac0: ffffffffffffffff 4000000000000000
> [  506.917945] [<ffff00000852e504>] dma_fence_release+0x44/0x48
> [  506.923546] [<ffff00000852f7cc>] sync_file_free+0x48/0x70
> [  506.928888] [<ffff00000852f824>] sync_file_release+0x30/0x3c
> [  506.934490] [<ffff0000081d6b24>] __fput+0x94/0x1d8
> [  506.939229] [<ffff0000081d6cc0>] ____fput+0xc/0x14
> [  506.943972] [<ffff0000080d72d4>] task_work_run+0xc4/0xe4
> [  506.949230] [<ffff0000080c016c>] do_exit+0x2d0/0x980
> [  506.954143] [<ffff0000080c088c>] do_group_exit+0x40/0x9c
> [  506.959401] [<ffff0000080ca514>] get_signal+0x1e8/0x4f0
> [  506.964573] [<ffff000008087850>] do_signal+0x198/0x554
> [  506.969657] [<ffff000008087e2c>] do_notify_resume+0x88/0xa4
> [  506.975171] [<ffff000008082ddc>] work_pending+0x8/0x10
> [  506.980257] Code: 8b010000 97ef7a27 a8c17bfd d65f03c0 (d4210000)
> [  506.988726] ---[ end trace f3a899d81ca41343 ]---
> [  506.993312] Fixing recursive fault but reboot is needed!
>
> Thanks,
> Brian
>>     igt_subtest("plane-all-modeset-transition")
>>         for_each_pipe_with_valid_output(&display, pipe, output)
>>             run_transition_test(&display, pipe, output,
>> TRANSITION_MODESET, false, false);
>>
>> +    igt_subtest("plane-all-modeset-transition-fencing")
>> +        for_each_pipe_with_valid_output(&display, pipe, output)
>> +            run_transition_test(&display, pipe, output,
>> TRANSITION_MODESET, false, true);
>> +
>>     igt_subtest("plane-toggle-modeset-transition")
>>         for_each_pipe_with_valid_output(&display, pipe, output)
>>             run_transition_test(&display, pipe, output,
>> TRANSITION_MODESET_DISABLE, false, false);
>> --
>> 2.11.0
>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property
  2016-12-16  8:21     ` Robert Foss
@ 2016-12-16 18:57       ` Brian Starkey
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Starkey @ 2016-12-16 18:57 UTC (permalink / raw)
  To: Robert Foss; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso

On Fri, Dec 16, 2016 at 03:21:45AM -0500, Robert Foss wrote:
>
>
>On 2016-12-14 11:13 AM, Brian Starkey wrote:
>>Hi,
>>
>>On Wed, Dec 14, 2016 at 04:05:04AM -0500, Robert Foss wrote:
>>>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>
>>>Add support for the OUT_FENCE_PTR property to enable setting out
>>>fences for
>>>atomic commits.
>>>
>>>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>>>---
>>>lib/igt_kms.c | 21 ++++++++++++++++++++-
>>>lib/igt_kms.h |  3 +++
>>>2 files changed, 23 insertions(+), 1 deletion(-)
>>>
>>>diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>>>index 8ca49d86..fe1b356d 100644
>>>--- a/lib/igt_kms.c
>>>+++ b/lib/igt_kms.c
>>>@@ -175,7 +175,8 @@ const char
>>>*igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
>>>    "DEGAMMA_LUT",
>>>    "GAMMA_LUT",
>>>    "MODE_ID",
>>>-    "ACTIVE"
>>>+    "ACTIVE",
>>>+    "OUT_FENCE_PTR"
>>>};
>>>
>>>const char *igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>>>@@ -2103,6 +2104,10 @@ static void
>>>igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRe
>>>        igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_ACTIVE,
>>>!!output);
>>>    }
>>>
>>>+    if (pipe_obj->out_fence_ptr)
>>>+        igt_atomic_populate_crtc_req(req, pipe_obj,
>>>IGT_CRTC_OUT_FENCE_PTR,
>>>+            (uint64_t)(uintptr_t) pipe_obj->out_fence_ptr);
>>>+
>>>    /*
>>>     *    TODO: Add all crtc level properties here
>>>     */
>>>@@ -2683,6 +2688,20 @@ igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void
>>>*ptr, size_t length)
>>>}
>>>
>>>/**
>>>+ * igt_pipe_set_out_fence_ptr:
>>>+ * @pipe: pipe pointer to which background color to be set
>>>+ * @fence_ptr: out fence pointer
>>>+ *
>>>+ * Sets the out fence pointer that will be passed to the kernel in
>>>+ * the atomic ioctl. When the kernel returns the out fence pointer
>>>+ * will contain the fd number of the out fence created by KMS.
>>>+ */
>>>+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr)
>>>+{
>>>+    pipe->out_fence_ptr = fence_ptr;
>>>+}
>>>+
>>>+/**
>>> * igt_crtc_set_background:
>>> * @pipe: pipe pointer to which background color to be set
>>> * @background: background color value in BGR 16bpc
>>>diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>>>index 9766807c..8eb611c0 100644
>>>--- a/lib/igt_kms.h
>>>+++ b/lib/igt_kms.h
>>>@@ -110,6 +110,7 @@ enum igt_atomic_crtc_properties {
>>>       IGT_CRTC_GAMMA_LUT,
>>>       IGT_CRTC_MODE_ID,
>>>       IGT_CRTC_ACTIVE,
>>>+       IGT_CRTC_OUT_FENCE_PTR,
>>>       IGT_NUM_CRTC_PROPS
>>>};
>>>
>>>@@ -316,6 +317,7 @@ struct igt_pipe {
>>>
>>>    uint64_t mode_blob;
>>>    bool mode_changed;
>>>+    int64_t *out_fence_ptr;
>>
>>I prefer the interface that got suggested before - igt_pipe gets an
>>"int64_t out_fence;" member which tests can query to get the fence
>>value:
>>
>>int igt_pipe_get_last_out_fence(igt_pipe_t *pipe);
>>
>>..and the kernel only ever receives a pointer to pipe->out_fence.
>>
>>The only reason I can see for a test to want to provide its own fence
>>pointer is to test invalid pointer values - and I think it's OK for
>>that test to set the property directly instead of making setting a
>>custom fence pointer the common case for all users.
>>
>>If we don't want to get a fence for every commit then I guess there
>>could be a way for a test to request an out-fence for just the next
>>commit on a pipe (or the inverse - disable fencing for a particular
>>commit):
>>
>>void igt_pipe_request_out_fence(igt_pipe_t *pipe);
>>
>>-Brian
>
>Now I see what you meant in the v1 discussion, I'll amend the 
>implementation in v3 to be the one mentioned above.
>

Partly... my main point on v1 was just to make sure the pointer was to
a 64-bit type.

>The only question I have is about igt_pipe_get_last_out_fence(), is 
>it really necessary? I don't foresee a function like that ever doing 
>more than just returning a struct member. Is it not a bit redundant?
>

I see two reasons for it:
  - It means tests only deal with plain ints, which I think Chris was
    fairly adamant about on v1.
  - The getter can set pipe->out_fence to -1 when its called, making
    the ownership of the fd obvious.

In this case I guess before each commit out_fence needs to be checked,
close()'d if it looks valid, and set to -1 too.

Cheers,
Brian

>
>Rob.
>
>>
>>>};
>>>
>>>typedef struct {
>>>@@ -369,6 +371,7 @@ static inline bool
>>>igt_plane_supports_rotation(igt_plane_t *plane)
>>>void igt_pipe_set_degamma_lut(igt_pipe_t *pipe, void *ptr, size_t
>>>length);
>>>void igt_pipe_set_ctm_matrix(igt_pipe_t *pipe, void *ptr, size_t length);
>>>void igt_pipe_set_gamma_lut(igt_pipe_t *pipe, void *ptr, size_t length);
>>>+void igt_pipe_set_out_fence_ptr(igt_pipe_t *pipe, int64_t *fence_ptr);
>>>
>>>void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb);
>>>void igt_plane_set_fence_fd(igt_plane_t *plane, uint32_t fence_fd);
>>>--
>>>2.11.0
>>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings
  2016-12-16  8:35     ` Robert Foss
@ 2016-12-16 19:05       ` Brian Starkey
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Starkey @ 2016-12-16 19:05 UTC (permalink / raw)
  To: Robert Foss; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso

On Fri, Dec 16, 2016 at 03:35:36AM -0500, Robert Foss wrote:
>
>
>On 2016-12-14 11:39 AM, Brian Starkey wrote:
>>Hi,
>>
>>On Wed, Dec 14, 2016 at 04:05:05AM -0500, Robert Foss wrote:
>>>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>
>>>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>>>---
>>>tests/kms_atomic.c | 186
>>>++++++++++++++++++++++++++++++++++++++++++++++++++---
>>>1 file changed, 176 insertions(+), 10 deletions(-)
>>>
>>>diff --git a/tests/kms_atomic.c b/tests/kms_atomic.c
>>>index 8b648eba..a557ac60 100644
>>>--- a/tests/kms_atomic.c
>>>+++ b/tests/kms_atomic.c
>>>@@ -44,6 +44,7 @@
>>>#include "drmtest.h"
>>>#include "igt.h"
>>>#include "igt_aux.h"
>>>+#include "sw_sync.h"
>>>
>>>#ifndef DRM_CLIENT_CAP_ATOMIC
>>>#define DRM_CLIENT_CAP_ATOMIC 3
>>>@@ -126,6 +127,7 @@ struct kms_atomic_plane_state {
>>>    uint32_t fb_id; /* 0 to disable */
>>>    uint32_t src_x, src_y, src_w, src_h; /* 16.16 fixed-point */
>>>    uint32_t crtc_x, crtc_y, crtc_w, crtc_h; /* normal integers */
>>>+    int32_t fence_fd;
>>>};
>>>
>>>struct kms_atomic_crtc_state {
>>>@@ -133,6 +135,7 @@ struct kms_atomic_crtc_state {
>>>    uint32_t obj;
>>>    int idx;
>>>    bool active;
>>>+    uint64_t out_fence_ptr;
>>>    struct kms_atomic_blob mode;
>>>};
>>>
>>>@@ -190,11 +193,13 @@ static uint32_t blob_duplicate(int fd, uint32_t
>>>id_orig)
>>>    crtc_populate_req(crtc, req); \
>>>    plane_populate_req(plane, req); \
>>>    do_atomic_commit((crtc)->state->desc->fd, req, flags); \
>>>-    crtc_check_current_state(crtc, plane, relax); \
>>>-    plane_check_current_state(plane, relax); \
>>>+    if (!(flags & DRM_MODE_ATOMIC_TEST_ONLY)) { \
>>>+        crtc_check_current_state(crtc, plane, relax); \
>>>+        plane_check_current_state(plane, relax); \
>>>+    } \
>>>}
>>>
>>>-#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req,
>>>relax, e) { \
>>>+#define crtc_commit_atomic_err(crtc, plane, crtc_old, plane_old, req,
>>>flags, relax, e) { \
>>>    drmModeAtomicSetCursor(req, 0); \
>>>    crtc_populate_req(crtc, req); \
>>>    plane_populate_req(plane, req); \
>>>@@ -299,6 +304,9 @@ find_connector(struct kms_atomic_state *state,
>>>static void plane_populate_req(struct kms_atomic_plane_state *plane,
>>>                   drmModeAtomicReq *req)
>>>{
>>>+    if (plane->fence_fd)
>>>+        plane_set_prop(req, plane, IGT_PLANE_IN_FENCE_FD,
>>>plane->fence_fd);
>>>+
>>>    plane_set_prop(req, plane, IGT_PLANE_CRTC_ID, plane->crtc_id);
>>>    plane_set_prop(req, plane, IGT_PLANE_FB_ID, plane->fb_id);
>>>    plane_set_prop(req, plane, IGT_PLANE_SRC_X, plane->src_x);
>>>@@ -424,6 +432,10 @@ find_plane(struct kms_atomic_state *state, enum
>>>plane_type type,
>>>static void crtc_populate_req(struct kms_atomic_crtc_state *crtc,
>>>                  drmModeAtomicReq *req)
>>>{
>>>+    if (crtc->out_fence_ptr)
>>>+        crtc_set_prop(req, crtc, IGT_CRTC_OUT_FENCE_PTR,
>>>+                  crtc->out_fence_ptr);
>>>+
>>>    crtc_set_prop(req, crtc, IGT_CRTC_MODE_ID, crtc->mode.id);
>>>    crtc_set_prop(req, crtc, IGT_CRTC_ACTIVE, crtc->active);
>>>}
>>>@@ -1052,6 +1064,37 @@ static void plane_invalid_params(struct
>>>kms_atomic_crtc_state *crtc,
>>>    drmModeAtomicFree(req);
>>>}
>>>
>>>+static void plane_invalid_params_fence(struct kms_atomic_crtc_state
>>>*crtc,
>>>+                struct kms_atomic_plane_state *plane_old,
>>>+                struct kms_atomic_connector_state *conn)
>>>+{
>>>+    struct kms_atomic_plane_state plane = *plane_old;
>>>+    drmModeAtomicReq *req = drmModeAtomicAlloc();
>>>+    int timeline, fence_fd;
>>>+
>>>+    igt_require_sw_sync();
>>>+
>>>+    /* invalid fence fd */
>>>+    plane.fence_fd = plane.state->desc->fd;
>>>+    plane.crtc_id = plane_old->crtc_id;
>>>+    plane_commit_atomic_err(&plane, plane_old, req,
>>>+                            ATOMIC_RELAX_NONE, EINVAL);
>>>+
>>>+    /* Valid fence_fd but invalid CRTC */
>>>+    timeline = sw_sync_timeline_create();
>>>+    fence_fd =  sw_sync_fence_create(timeline, 1);
>>>+    plane.fence_fd = fence_fd;
>>>+    plane.crtc_id = ~0U;
>>>+    plane_commit_atomic_err(&plane, plane_old, req,
>>>+                            ATOMIC_RELAX_NONE, EINVAL);
>>>+
>>>+    plane.fence_fd = -1;
>>>+    close(fence_fd);
>>>+    close(timeline);
>>>+
>>>+    drmModeAtomicFree(req);
>>>+}
>>>+
>>>static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,
>>>                struct kms_atomic_plane_state *plane,
>>>                struct kms_atomic_connector_state *conn)
>>>@@ -1063,30 +1106,32 @@ static void crtc_invalid_params(struct
>>>kms_atomic_crtc_state *crtc_old,
>>>
>>>    /* Pass a series of invalid object IDs for the mode ID. */
>>>    crtc.mode.id = plane->obj;
>>>-    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>                           ATOMIC_RELAX_NONE, EINVAL);
>>>
>>>    crtc.mode.id = crtc.obj;
>>>-    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>                           ATOMIC_RELAX_NONE, EINVAL);
>>>
>>>    crtc.mode.id = conn->obj;
>>>-    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>                           ATOMIC_RELAX_NONE, EINVAL);
>>>
>>>    crtc.mode.id = plane->fb_id;
>>>-    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>                           ATOMIC_RELAX_NONE, EINVAL);
>>>
>>>+    /* successful TEST_ONLY with fences set */
>>>    crtc.mode.id = crtc_old->mode.id;
>>>-    crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
>>>+    crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE,
>>>+               DRM_MODE_ATOMIC_TEST_ONLY);
>>>
>>>    /* Create a blob which is the wrong size to be a valid mode. */
>>>    do_or_die(drmModeCreatePropertyBlob(crtc.state->desc->fd,
>>>                        crtc.mode.data,
>>>                        sizeof(struct drm_mode_modeinfo) - 1,
>>>                        &crtc.mode.id));
>>>-    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>                           ATOMIC_RELAX_NONE, EINVAL);
>>>
>>>
>>>@@ -1094,15 +1139,107 @@ static void crtc_invalid_params(struct
>>>kms_atomic_crtc_state *crtc_old,
>>>                        crtc.mode.data,
>>>                        sizeof(struct drm_mode_modeinfo) + 1,
>>>                        &crtc.mode.id));
>>>-    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>                           ATOMIC_RELAX_NONE, EINVAL);
>>>
>>>+
>>>    /* Restore the CRTC and check the state matches the old. */
>>>    crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);
>>>
>>>    drmModeAtomicFree(req);
>>>}
>>>
>>>+static void crtc_invalid_params_fence(struct kms_atomic_crtc_state
>>>*crtc_old,
>>>+                struct kms_atomic_plane_state *plane,
>>>+                struct kms_atomic_connector_state *conn)
>>>+{
>>>+    struct kms_atomic_crtc_state crtc = *crtc_old;
>>>+    drmModeAtomicReq *req = drmModeAtomicAlloc();
>>>+    int timeline, fence_fd, *out_fence;
>>>+
>>>+    igt_require_sw_sync();
>>>+
>>>+    /* invalid out_fence_ptr */
>>>+    crtc.mode.id = crtc_old->mode.id;
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) crtc_invalid_params;
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>+                           ATOMIC_RELAX_NONE, EFAULT);
>>>+
>>>+    /* invalid out_fence_ptr */
>>>+    crtc.mode.id = crtc_old->mode.id;
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0x8;
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>+                           ATOMIC_RELAX_NONE, EFAULT);
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>>>+
>>>+    /* valid in fence but not allowed prop on crtc */
>>>+    timeline = sw_sync_timeline_create();
>>>+    fence_fd =  sw_sync_fence_create(timeline, 1);
>>>+    plane->fence_fd = fence_fd;
>>>+    crtc.active = false;
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>+                   ATOMIC_RELAX_NONE, EINVAL);
>>>+
>>>+    out_fence = malloc(sizeof(uint64_t));
>>>+    igt_assert(out_fence);
>>>+
>>>+
>>>+    /* valid out fence ptr and flip event but not allowed prop on
>>>crtc */
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>+                   ATOMIC_RELAX_NONE, EINVAL);
>>>+
>>>+    /* valid out fence ptr and flip event but not allowed prop on
>>>crtc */
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+                   DRM_MODE_PAGE_FLIP_EVENT,
>>>+                   ATOMIC_RELAX_NONE, EINVAL);
>>>+
>>>+    /* valid page flip event but not allowed prop on crtc */
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+                   DRM_MODE_PAGE_FLIP_EVENT,
>>>+                   ATOMIC_RELAX_NONE, EINVAL);
>>>+    crtc.active = true;
>>>+
>>>+    /* valid out fence  ptr and flip event but invalid prop on crtc */
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>>>+    crtc.mode.id = plane->fb_id;
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req, 0,
>>>+                   ATOMIC_RELAX_NONE, EINVAL);
>>>+
>>>+    /* valid out fence ptr and flip event but invalid prop on crtc */
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+                   DRM_MODE_PAGE_FLIP_EVENT,
>>>+                   ATOMIC_RELAX_NONE, EINVAL);
>>>+
>>>+    /* valid page flip event but invalid prop on crtc */
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>>>+    crtc_commit_atomic_err(&crtc, plane, crtc_old, plane, req,
>>>+                   DRM_MODE_PAGE_FLIP_EVENT,
>>>+                   ATOMIC_RELAX_NONE, EINVAL);
>>>+
>>>+    /* successful TEST_ONLY with fences set */
>>>+    plane->fence_fd = fence_fd;
>>>+    crtc.mode.id = crtc_old->mode.id;
>>>+    crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE,
>>>+               DRM_MODE_ATOMIC_TEST_ONLY);
>>>+    igt_assert(*out_fence == -1);
>>>+    close(fence_fd);
>>>+    close(timeline);
>>>+
>>>+    /* reset fences */
>>>+    plane->fence_fd = -1;
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) 0;
>>>+    crtc_commit_atomic(&crtc, plane, req, ATOMIC_RELAX_NONE, 0);
>>>+
>>>+    /* out fence ptr but not page flip event */
>>>+    crtc.out_fence_ptr = (uint64_t)(uintptr_t) out_fence;
>>>+    crtc_commit_atomic(crtc_old, plane, req, ATOMIC_RELAX_NONE, 0);
>>
>>What are the previous two commits for? They don't seem to be invalid.
>
>They don't seem to be invalid to me either, would you prefer to have 
>them separated out into a subtest without invalid in its name?
>

If you don't think splitting them out is too excessive, then yeah.
I think the last one isn't really needed at all - isn't it exercising
the same code-paths as the normal, valid "*-fencing" tests?

Anyway, at least a comment saying they aren't invalid could save some
head-scratching.

Cheers,
Brian

>>
>>>+
>>>+    free(out_fence);
>>
>>Need to close(*out_fence) before freeing it?
>>
>>-Brian
>
>Yep, fixing in v3.
>
>>
>>>+    drmModeAtomicFree(req);
>>>+}
>>>+
>>>/* Abuse the atomic ioctl directly in order to test various invalid
>>>conditions,
>>> * which the libdrm wrapper won't allow us to create. */
>>>static void atomic_invalid_params(struct kms_atomic_crtc_state *crtc,
>>>@@ -1306,6 +1443,20 @@ igt_main
>>>        atomic_state_free(scratch);
>>>    }
>>>
>>>+    igt_subtest("plane_invalid_params_fence") {
>>>+        struct kms_atomic_state *scratch = atomic_state_dup(current);
>>>+        struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>>>+        struct kms_atomic_plane_state *plane =
>>>+            find_plane(current, PLANE_TYPE_PRIMARY, crtc);
>>>+        struct kms_atomic_connector_state *conn =
>>>+            find_connector(scratch, crtc);
>>>+
>>>+        igt_require(crtc);
>>>+        igt_require(plane);
>>>+        plane_invalid_params_fence(crtc, plane, conn);
>>>+        atomic_state_free(scratch);
>>>+    }
>>>+
>>>    igt_subtest("crtc_invalid_params") {
>>>        struct kms_atomic_state *scratch = atomic_state_dup(current);
>>>        struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>>>@@ -1321,6 +1472,21 @@ igt_main
>>>        atomic_state_free(scratch);
>>>    }
>>>
>>>+    igt_subtest("crtc_invalid_params_fence") {
>>>+        struct kms_atomic_state *scratch = atomic_state_dup(current);
>>>+        struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>>>+        struct kms_atomic_plane_state *plane =
>>>+            find_plane(scratch, NUM_PLANE_TYPE_PROPS, crtc);
>>>+        struct kms_atomic_connector_state *conn =
>>>+            find_connector(scratch, crtc);
>>>+
>>>+        igt_require(crtc);
>>>+        igt_require(plane);
>>>+        igt_require(conn);
>>>+        crtc_invalid_params_fence(crtc, plane, conn);
>>>+        atomic_state_free(scratch);
>>>+    }
>>>+
>>>    igt_subtest("atomic_invalid_params") {
>>>        struct kms_atomic_state *scratch = atomic_state_dup(current);
>>>        struct kms_atomic_crtc_state *crtc = find_crtc(scratch, true);
>>>--
>>>2.11.0
>>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests
  2016-12-16  8:59     ` Robert Foss
@ 2016-12-16 19:06       ` Brian Starkey
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Starkey @ 2016-12-16 19:06 UTC (permalink / raw)
  To: Robert Foss; +Cc: Gustavo Padovan, intel-gfx, Gustavo Padovan, Tomeu Vizoso

On Fri, Dec 16, 2016 at 03:59:00AM -0500, Robert Foss wrote:
>
>
>On 2016-12-14 11:57 AM, Brian Starkey wrote:
>>On Wed, Dec 14, 2016 at 04:05:07AM -0500, Robert Foss wrote:
>>>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>
>>>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>>>---
>>>lib/igt_kms.c                 | 22 ++++++++++++++++++++++
>>>tests/kms_atomic_transition.c | 32 ++++++++++++++++++++++++++++++--
>>>2 files changed, 52 insertions(+), 2 deletions(-)
>>>
>>>diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>>>index fe1b356d..eb59ab36 100644
>>>--- a/lib/igt_kms.c
>>>+++ b/lib/igt_kms.c
>>>@@ -49,6 +49,7 @@
>>>#include "intel_chipset.h"
>>>#include "igt_debugfs.h"
>>>#include "igt_sysfs.h"
>>>+#include "sw_sync.h"
>>>
>>>/**
>>> * SECTION:igt_kms
>>>@@ -2184,6 +2185,27 @@ static int igt_atomic_commit(igt_display_t
>>>*display, uint32_t flags, void *user_
>>>    }
>>>
>>>    ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
>>>+    if (!ret) {
>>>+        int64_t *fence_ptr;
>>>+
>>>+        for_each_pipe(display, pipe) {
>>>+            igt_pipe_t *pipe_obj = &display->pipes[pipe];
>>>+
>>>+            fence_ptr = pipe_obj->out_fence_ptr;
>>>+            if (!fence_ptr)
>>>+                continue;
>>>+
>>>+            if (flags & DRM_MODE_ATOMIC_TEST_ONLY) {
>>>+                igt_assert(*fence_ptr == -1);
>>>+            } else {
>>>+                igt_assert(*fence_ptr >= 0);
>>>+                ret = sw_sync_wait(*fence_ptr, 1000);
>>>+                igt_assert(ret == 0);
>>>+                close(*fence_ptr);
>>>+            }
>>>+        }
>>>+    }
>>>+
>>>    drmModeAtomicFree(req);
>>>    return ret;
>>>
>>>diff --git a/tests/kms_atomic_transition.c
>>>b/tests/kms_atomic_transition.c
>>>index b7d99975..08f9499f 100644
>>>--- a/tests/kms_atomic_transition.c
>>>+++ b/tests/kms_atomic_transition.c
>>>@@ -132,6 +132,7 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>    struct plane_parms parms[IGT_MAX_PLANES];
>>>    bool skip_test = false;
>>>    unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
>>>+    int out_fence, ret;
>>
>>out_fence needs to be 64-bit.
>
>Ack, fixed in v3.
>
>>
>>>
>>>    if (nonblocking)
>>>        flags |= DRM_MODE_ATOMIC_NONBLOCK;
>>>@@ -198,9 +199,11 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>     * planes to fix this
>>>     */
>>>    while (1) {
>>>-        int ret;
>>>-
>>>        wm_setup_plane(display, pipe, iter_max - 1, parms);
>>>+
>>>+        if (fencing)
>>>+            igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>+                (int64_t *) &out_fence);
>>>        ret = igt_display_try_commit_atomic(display,
>>>DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
>>>
>>>        if (ret != -EINVAL || n_planes < 3)
>>>@@ -231,6 +234,9 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>
>>>        wm_setup_plane(display, pipe, i, parms);
>>>
>>>+        if (fencing)
>>>+            igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>&out_fence);
>>>+
>>>        igt_display_commit_atomic(display, flags, (void *)(unsigned
>>>long)i);
>>>        drmHandleEvent(display->drm_fd, &drm_events);
>>>
>>>@@ -239,6 +245,10 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>
>>>            wm_setup_plane(display, pipe, 0, parms);
>>>
>>>+            if (fencing)
>>>+                igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>+                    (int64_t *) &out_fence);
>>>+
>>>            igt_display_commit_atomic(display, flags, (void *)0UL);
>>>
>>>            drmHandleEvent(display->drm_fd, &drm_events);
>>>@@ -252,6 +262,9 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>                if (type == TRANSITION_MODESET)
>>>                    igt_output_override_mode(output, &override_mode);
>>>
>>>+                if (fencing)
>>>+                    igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>&out_fence);
>>>+
>>>                igt_display_commit_atomic(display, flags, (void
>>>*)(unsigned long)j);
>>>                drmHandleEvent(display->drm_fd, &drm_events);
>>>
>>>@@ -259,6 +272,9 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>                if (type == TRANSITION_MODESET)
>>>                    igt_output_override_mode(output, NULL);
>>>
>>>+                if (fencing)
>>>+                    igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>&out_fence);
>>>+
>>>                igt_display_commit_atomic(display, flags, (void
>>>*)(unsigned long)i);
>>>                drmHandleEvent(display->drm_fd, &drm_events);
>>>            }
>>>@@ -588,14 +604,26 @@ igt_main
>>>        for_each_pipe_with_valid_output(&display, pipe, output)
>>>            run_transition_test(&display, pipe, output,
>>>TRANSITION_PLANES, false, false);
>>>
>>>+    igt_subtest("plane-all-transition-fencing")
>>>+        for_each_pipe_with_valid_output(&display, pipe, output)
>>>+            run_transition_test(&display, pipe, output,
>>>TRANSITION_PLANES, false, true);
>>>+
>>>    igt_subtest("plane-all-transition-nonblocking")
>>>        for_each_pipe_with_valid_output(&display, pipe, output)
>>>            run_transition_test(&display, pipe, output,
>>>TRANSITION_PLANES, true, false);
>>>
>>>+    igt_subtest("plane-all-transition-nonblocking-fencing")
>>>+        for_each_pipe_with_valid_output(&display, pipe, output)
>>>+            run_transition_test(&display, pipe, output,
>>>TRANSITION_PLANES, true, true);
>>>+
>>
>>This test makes my kernel very unhappy running on drm-next on mali-dp.
>>Any ideas?
>
>Hmm. I haven't seen anything like this.
>I did my testing on drm-misc/drm-misc-next, unfortunately I don't 
>have any access to mali hardware of any kind :/
>

Yeah fair enough. I'll see if I can figure any more out when I'm back
in the office in January.

-Brian

>Rob.
>
>>
>>WARN -> Stall -> BUG:
>>
>>[  131.657643] WARNING: CPU: 0 PID: 2124 at
>>drivers/gpu/drm/drm_atomic_helper.c:1041
>>drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
>>[  131.670293] Modules linked in: mali_dp tda998x drm_kms_helper drm
>>ip_tables x_tables ipv6
>>[  131.678416]
>>[  131.679890] CPU: 0 PID: 2124 Comm: kms_atomic_tran Not tainted
>>4.9.0-rc8 #267
>>[  131.686950] Hardware name: ARM Juno development board (r0) (DT)
>>[  131.692806] task: ffff800970ae0000 task.stack: ffff8009746c0000
>>[  131.698732] PC is at drm_atomic_helper_wait_for_fences+0xcc/0xd4
>>[drm_kms_helper]
>>[  131.706206] LR is at drm_atomic_helper_commit+0x7c/0x11c
>>[drm_kms_helper]
>>[  131.712923] pc : [<ffff000000bdba1c>] lr : [<ffff000000bde958>]
>>pstate: 20000145
>>[  131.720241] sp : ffff8009746c3b40
>>[  131.723516] x29: ffff8009746c3b40 x28: ffff80096fd40c00
>>[  131.728778] x27: 0000000022d216e0 x26: ffff80096fd40a80
>>[  131.734039] x25: 0000000000000018 x24: 0000000000000001
>>[  131.739300] x23: ffff80096fd40a80 x22: 0000000000000001
>>[  131.744561] x21: ffff80096fd40c00 x20: 0000000000000000
>>[  131.749823] x19: ffff80096fd40b00 x18: 0000000000000000
>>[  131.755084] x17: 0000ffffa5f64b00 x16: ffff0000081e7c88
>>[  131.760344] x15: 0000000000000000 x14: 0000000000000000
>>[  131.765605] x13: 0000000000000007 x12: 000000000000ca35
>>[  131.770865] x11: 0000000000000006 x10: 000000000000ca35
>>[  131.776126] x9 : 0000000000000000 x8 : ffff80097479f500
>>[  131.781387] x7 : 0000000000000000 x6 : 000000000000003f
>>[  131.786647] x5 : ffff80096fd40648 x4 : 0000000000000000
>>[  131.791908] x3 : ffff80096fd40600 x2 : 0000000000000001
>>[  131.797168] x1 : 0000000000000000 x0 : ffff80096f61f280
>>[  131.802429]
>>[  131.803898] ---[ end trace f3a899d81ca41342 ]---
>>[  131.808464] Call trace:
>>[  131.810882] Exception stack(0xffff8009746c3970 to 0xffff8009746c3aa0)
>>[  131.817256] 3960:                                   ffff80096fd40b00
>>0001000000000000
>>[  131.825008] 3980: ffff8009746c3b40 ffff000000bdba1c ffff8009746c3a30
>>ffff0000080fe1e4
>>[  131.832759] 39a0: ffff0000009c3038 ffff80097085b800 0000000000000001
>>ffff8009746c3d70
>>[  131.840509] 39c0: ffff80096fd40a80 0000000000000001 0000000000000018
>>ffff80096fd40a80
>>[  131.848260] 39e0: 0000000022d216e0 ffff80096fd40c00 ffff80097085c038
>>0000000000000000
>>[  131.856010] 3a00: ffff000008e15130 0000000000000140 ffff80096f61f280
>>0000000000000000
>>[  131.863761] 3a20: 0000000000000001 ffff80096fd40600 0000000000000000
>>ffff80096fd40648
>>[  131.871511] 3a40: 000000000000003f 0000000000000000 ffff80097479f500
>>0000000000000000
>>[  131.879262] 3a60: 000000000000ca35 0000000000000006 000000000000ca35
>>0000000000000007
>>[  131.887012] 3a80: 0000000000000000 0000000000000000 ffff0000081e7c88
>>0000ffffa5f64b00
>>[  131.894830] [<ffff000000bdba1c>]
>>drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
>>[  131.903338] [<ffff000000bde958>] drm_atomic_helper_commit+0x7c/0x11c
>>[drm_kms_helper]
>>[  131.911252] [<ffff0000009a10a8>] drm_atomic_commit+0x48/0x68 [drm]
>>[  131.917532] [<ffff0000009a26f4>] drm_mode_atomic_ioctl+0x42c/0xa40 [drm]
>>[  131.924324] [<ffff00000098d8e8>] drm_ioctl+0x188/0x458 [drm]
>>[  131.929929] [<ffff0000081e75a0>] do_vfs_ioctl+0xb4/0x79c
>>[  131.935186] [<ffff0000081e7d0c>] SyS_ioctl+0x84/0x98
>>[  131.940101] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4
>>n:2124) igt-kms-CRITICAL: Last errno: 62, Timer expired
>>****  END  ****
>>Subtest plane-all-transition-nonblocking-fencing: FAIL (2.151s)
>>[  363.609017] INFO: task kworker/u12:4:1087 blocked for more than 120
>>seconds.
>>[  363.616021]       Tainted: G        W       4.9.0-rc8 #267
>>[  363.621473] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
>>disables this message.
>>[  363.629237] kworker/u12:4   D    0  1087      2 0x00000000
>>[  363.634770] Workqueue: events_unbound commit_work [drm_kms_helper]
>>[  363.640903] Call trace:
>>[  363.643328] [<ffff000008085550>] __switch_to+0x90/0xa4
>>[  363.648431] [<ffff000008881ac8>] __schedule+0x178/0x564
>>[  363.653618] [<ffff000008881ef0>] schedule+0x3c/0xa0
>>[  363.658461] [<ffff000008884c34>] schedule_timeout+0x148/0x218
>>[  363.664165] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
>>[  363.670383] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
>>[  363.676495] [<ffff000000bdb9b8>]
>>drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
>>[  363.685017] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
>>[  363.691646] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
>>[  363.698211] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
>>[  363.703912] [<ffff0000080d346c>] worker_thread+0x58/0x434
>>[  363.709269] [<ffff0000080d8f24>] kthread+0xd4/0xe8
>>[  363.714024] [<ffff000008082e80>] ret_from_fork+0x10/0x50
>>[  484.440951] INFO: task kworker/u12:4:1087 blocked for more than 120
>>seconds.
>>[  484.440957]       Tainted: G        W       4.9.0-rc8 #267
>>[  484.440959] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
>>disables this message.
>>[  484.440966] kworker/u12:4   D    0  1087      2 0x00000000
>>[  484.441059] Workqueue: events_unbound commit_work [drm_kms_helper]
>>[  484.441060] Call trace:
>>[  484.441072] [<ffff000008085550>] __switch_to+0x90/0xa4
>>[  484.441080] [<ffff000008881ac8>] __schedule+0x178/0x564
>>[  484.441085] [<ffff000008881ef0>] schedule+0x3c/0xa0
>>[  484.441092] [<ffff000008884c34>] schedule_timeout+0x148/0x218
>>[  484.441099] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
>>[  484.441105] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
>>[  484.441177] [<ffff000000bdb9b8>]
>>drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
>>[  484.441250] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
>>[  484.441321] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
>>[  484.441329] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
>>[  484.441334] [<ffff0000080d346c>] worker_thread+0x58/0x434
>>[  484.441339] [<ffff0000080d8f24>] kthread+0xd4/0xe8
>>[  484.441344] [<ffff000008082e80>] ret_from_fork+0x10/0x50
>>[  485.464997] [drm:drm_atomic_helper_swap_state [drm_kms_helper]]
>>*ERROR* [CRTC:32:crtc-0] hw_done timed out
>>[  495.704997] [drm:drm_atomic_helper_wait_for_dependencies
>>[drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] hw_done timed out
>>[  505.944998] [drm:drm_atomic_helper_wait_for_dependencies
>>[drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] flip_done timed out
>>[  506.391339] ------------[ cut here ]------------
>>[  506.395909] kernel BUG at drivers/dma-buf/dma-fence.c:178!
>>[  506.401337] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
>>[  506.406763] Modules linked in: mali_dp tda998x drm_kms_helper drm
>>ip_tables x_tables ipv6
>>[  506.414894] CPU: 3 PID: 2124 Comm: kms_atomic_tran Tainted: G
>>W       4.9.0-rc8 #267
>>[  506.423158] Hardware name: ARM Juno development board (r0) (DT)
>>[  506.429015] task: ffff800970ae0000 task.stack: ffff8009746c0000
>>[  506.434879] PC is at dma_fence_release+0x44/0x48
>>[  506.439448] LR is at sync_file_free+0x48/0x70
>>[  506.443757] pc : [<ffff00000852e504>] lr : [<ffff00000852f7cc>]
>>pstate: 80000145
>>[  506.451074] sp : ffff8009746c3b70
>>[  506.454349] x29: ffff8009746c3b70 x28: ffff8009746c0000
>>[  506.459610] x27: 0000000000000001 x26: ffff000008d3728c
>>[  506.464870] x25: ffff800975d10510 x24: ffff8009768d3b50
>>[  506.470130] x23: ffff800976c3ec20 x22: ffff8009720c7e40
>>[  506.475390] x21: ffff8009768d3b50 x20: 0000000000000010
>>[  506.480650] x19: ffff80096f61f100 x18: 0000000000000000
>>[  506.485909] x17: 4000000000000000 x16: ffffffffffffffff
>>[  506.491170] x15: 0000000000000040 x14: dead000000000100
>>[  506.496430] x13: dead000000000200 x12: 00000000ffffffff
>>[  506.501690] x11: 0000000000000068 x10: ffff800975f18700
>>[  506.506950] x9 : 0000000040000000 x8 : 0000000000210d00
>>[  506.512210] x7 : ffff800970ae0678 x6 : 0000000000000000
>>[  506.517470] x5 : 0000000000000000 x4 : 0000000000000000
>>[  506.522730] x3 : ffff800976753ce0 x2 : ffff80096f61f2a0
>>[  506.527989] x1 : 0000000000000000 x0 : ffff80096f61f280
>>[  506.533248]
>>[  506.534719] Process kms_atomic_tran (pid: 2124, stack limit =
>>0xffff8009746c0020)
>>[  506.542124] Stack: (0xffff8009746c3b70 to 0xffff8009746c4000)
>>[  506.547810] 3b60:                                   ffff8009746c3b80
>>ffff00000852f7cc
>>[  506.555561] 3b80: ffff8009746c3ba0 ffff00000852f824 ffff800975d10500
>>ffff8009768d3b50
>>[  506.563311] 3ba0: ffff8009746c3bb0 ffff0000081d6b24 ffff8009746c3c00
>>ffff0000081d6cc0
>>[  506.571062] 3bc0: ffff80097479bf00 ffff800970ae0678 ffff800970ae0000
>>ffff800970ae06ac
>>[  506.578813] 3be0: ffff000008e0f000 ffff800975f18768 0000000008430000
>>ffff0000080da458
>>[  506.586564] 3c00: ffff8009746c3c10 ffff0000080d72d4 ffff8009746c3c50
>>ffff0000080c016c
>>[  506.594314] 3c20: ffff800970ae0000 ffff8009746c3cb0 0000000000000001
>>ffff800970ac0000
>>[  506.602065] 3c40: ffff000008d35000 ffff0000080c0168 ffff8009746c3cc0
>>ffff0000080c088c
>>[  506.609815] 3c60: ffff800970ac0000 0000000000000002 ffff8009746c0000
>>ffff800970ac0000
>>[  506.617566] 3c80: ffff800974608000 ffff8009746c3de8 0000000008430000
>>ffff000008d3728c
>>[  506.625316] 3ca0: 0000000000000001 ffff8009746c0000 ffff8009746c3cf0
>>ffff0000080ca3dc
>>[  506.633067] 3cc0: ffff8009746c3cf0 ffff0000080ca514 ffff8009746c0000
>>ffff8009746c3e08
>>[  506.640818] 3ce0: ffff800974608808 ffff800970ac0000 ffff8009746c3d70
>>ffff000008087850
>>[  506.648568] 3d00: 0000000000000201 ffff8009746c3de8 ffff8009746c0000
>>ffff8009746c3ec0
>>[  506.656319] 3d20: 0000000000000000 ffff8009746c3ec0 0000000000000123
>>000000000000008b
>>[  506.664069] 3d40: ffff000008892000 ffff8009746c0000 0000000000000000
>>0000000000000000
>>[  506.671820] 3d60: 5555000000004100 ffff000008b04a20 ffff8009746c3e90
>>ffff000008087e2c
>>[  506.679570] 3d80: 0000000000000201 ffff8009746c0000 ffff8009746c0000
>>ffff8009746c3ec0
>>[  506.687320] 3da0: 0000000000000000 0000000000000015 0000000000000123
>>000000000000008b
>>[  506.695071] 3dc0: ffff000008892000 ffff8009746c0000 0000000000000000
>>0000000000000000
>>[  506.702821] 3de0: ffff8009746c3e20 ffff0000081decc4 ffff8009746c3e40
>>ffff0000081472d0
>>[  506.710572] 3e00: ffff8009748fa800 0000000000000002 00000000fffffffa
>>000000000000084c
>>[  506.718322] 3e20: 0000000000000000 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.726072] 3e40: 0000000000000000 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.733822] 3e60: 0000000000000000 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.741572] 3e80: 0000000000000000 ffff000008082f58 0000000000000000
>>ffff000008082ddc
>>[  506.749323] 3ea0: 0000000000000200 0000ffffeac382b8 ffffffffffffffff
>>0000ffffa625d6c8
>>[  506.757073] 3ec0: 0000000000000003 00000000c03864bc 0000ffffeac382b8
>>0000000000000011
>>[  506.764823] 3ee0: 0000000022d216a0 0000000000000005 0000000000000022
>>0000000022d213b0
>>[  506.772573] 3f00: 000000000000001d 0000000000000000 0000001000000020
>>0000ffffeac38400
>>[  506.780323] 3f20: 0000001300000020 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.788074] 3f40: 0000ffffa6230278 0000ffffa5f64b00 0000000000000000
>>0000000022d216c0
>>[  506.795824] 3f60: 0000ffffeac382b8 00000000c03864bc 0000000000000003
>>0000000022d1d410
>>[  506.803575] 3f80: 0000000000000022 0000000022d216e0 0000000022d217b0
>>0000000022d1c7e0
>>[  506.811325] 3fa0: 0000000000000010 0000ffffeac38220 0000ffffa621797c
>>0000ffffeac38220
>>[  506.819075] 3fc0: 0000ffffa5f64b08 0000000060000000 0000000000000000
>>ffffffffffffffff
>>[  506.826825] 3fe0: 0000000000000000 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.834572] Call trace:
>>[  506.836990] Exception stack(0xffff8009746c39a0 to 0xffff8009746c3ad0)
>>[  506.843365] 39a0: ffff80096f61f100 0001000000000000 ffff8009746c3b70
>>ffff00000852e504
>>[  506.851115] 39c0: ffff8009746c0000 0000000180170016 0000000100170017
>>ffff7e0025dbbf80
>>[  506.858866] 39e0: ffff8009746c3b00 ffff0000081bb910 ffff80096ec34800
>>ffff8009746c0000
>>[  506.866617] 3a00: ffff00000819826c ffff7e0025d39500 ffff8009746c3b30
>>ffff0000081bbe50
>>[  506.874367] 3a20: ffff7e0025bd87c0 ffff8009746c0000 0000000000158143
>>ffff80096f61f580
>>[  506.882118] 3a40: ffff80096f61f280 0000000000000000 ffff80096f61f2a0
>>ffff800976753ce0
>>[  506.889867] 3a60: 0000000000000000 0000000000000000 0000000000000000
>>ffff800970ae0678
>>[  506.897618] 3a80: 0000000000210d00 0000000040000000 ffff800975f18700
>>0000000000000068
>>[  506.905368] 3aa0: 00000000ffffffff dead000000000200 dead000000000100
>>0000000000000040
>>[  506.913117] 3ac0: ffffffffffffffff 4000000000000000
>>[  506.917945] [<ffff00000852e504>] dma_fence_release+0x44/0x48
>>[  506.923546] [<ffff00000852f7cc>] sync_file_free+0x48/0x70
>>[  506.928888] [<ffff00000852f824>] sync_file_release+0x30/0x3c
>>[  506.934490] [<ffff0000081d6b24>] __fput+0x94/0x1d8
>>[  506.939229] [<ffff0000081d6cc0>] ____fput+0xc/0x14
>>[  506.943972] [<ffff0000080d72d4>] task_work_run+0xc4/0xe4
>>[  506.949230] [<ffff0000080c016c>] do_exit+0x2d0/0x980
>>[  506.954143] [<ffff0000080c088c>] do_group_exit+0x40/0x9c
>>[  506.959401] [<ffff0000080ca514>] get_signal+0x1e8/0x4f0
>>[  506.964573] [<ffff000008087850>] do_signal+0x198/0x554
>>[  506.969657] [<ffff000008087e2c>] do_notify_resume+0x88/0xa4
>>[  506.975171] [<ffff000008082ddc>] work_pending+0x8/0x10
>>[  506.980257] Code: 8b010000 97ef7a27 a8c17bfd d65f03c0 (d4210000)
>>[  506.988726] ---[ end trace f3a899d81ca41343 ]---
>>[  506.993312] Fixing recursive fault but reboot is needed!
>>
>>Thanks,
>>Brian
>>>    igt_subtest("plane-all-modeset-transition")
>>>        for_each_pipe_with_valid_output(&display, pipe, output)
>>>            run_transition_test(&display, pipe, output,
>>>TRANSITION_MODESET, false, false);
>>>
>>>+    igt_subtest("plane-all-modeset-transition-fencing")
>>>+        for_each_pipe_with_valid_output(&display, pipe, output)
>>>+            run_transition_test(&display, pipe, output,
>>>TRANSITION_MODESET, false, true);
>>>+
>>>    igt_subtest("plane-toggle-modeset-transition")
>>>        for_each_pipe_with_valid_output(&display, pipe, output)
>>>            run_transition_test(&display, pipe, output,
>>>TRANSITION_MODESET_DISABLE, false, false);
>>>--
>>>2.11.0
>>>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2016-12-16 19:06 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-14  9:04 [PATCH i-g-t v2 00/12] tests/kms_atomic_transition add fence testing Robert Foss
2016-12-14  9:04 ` [PATCH i-g-t v2 01/12] tests/kms_atomic_transition: use igt timeout instead of blocking Robert Foss
2016-12-14  9:04 ` [PATCH i-g-t v2 02/12] tests/kms_atomic_transition: don't assume max pipes Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 03/12] lib/igt_kms: move igt_kms_get_alt_edid() to the right place Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 04/12] lib/igt_kms: export properties names Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 05/12] tests/kms_atomic: use global atomic properties definitions Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 06/12] lib/igt_kms: Add support for the IN_FENCE_FD property Robert Foss
2016-12-14 16:04   ` Brian Starkey
2016-12-15 12:36     ` Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 07/12] lib/igt_kms: Add support for the OUT_FENCE_PTR property Robert Foss
2016-12-14 16:13   ` Brian Starkey
2016-12-16  8:21     ` Robert Foss
2016-12-16 18:57       ` Brian Starkey
2016-12-14  9:05 ` [PATCH i-g-t v2 08/12] tests/kms_atomic: stress possible fence settings Robert Foss
2016-12-14 16:39   ` Brian Starkey
2016-12-16  8:35     ` Robert Foss
2016-12-16 19:05       ` Brian Starkey
2016-12-14  9:05 ` [PATCH i-g-t v2 09/12] tests/kms_atomic_transition: add fencing parameter to run_transition_tests Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 10/12] tests/kms_atomic_transition: add out_fences tests Robert Foss
2016-12-14 16:57   ` Brian Starkey
2016-12-16  8:59     ` Robert Foss
2016-12-16 19:06       ` Brian Starkey
2016-12-14  9:05 ` [PATCH i-g-t v2 11/12] tests/kms_atomic_transition: add in_fences tests Robert Foss
2016-12-14  9:05 ` [PATCH i-g-t v2 12/12] tests/kms_atomic_transition: set out_fence for all crtcs Robert Foss

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.