public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] lib/igt_kms: Set writeback connector capacity to fix VC4 testing
@ 2018-11-14 15:31 Paul Kocialkowski
  2018-11-14 15:50 ` Boris Brezillon
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Paul Kocialkowski @ 2018-11-14 15:31 UTC (permalink / raw)
  To: igt-dev; +Cc: eben, Thomas Petazzoni

Support for writeback connectors was recently introduced in DRM, with
an implementation in the VC4 DRM driver. This unfortunately broke IGT
testing for the driver due to always-failing atomic commits.

After boot up, the writeback connector is attached to a CRTC, with a
virtual encoder and a plane (that takes the same framebuffer as the
primary plane).

Because IGT configures all the available planes, this plane is no
longer associated with the writeback CRTC. The connector remains
associated with the CRTC as the core does not automatically clean it up.
IGT is not aware of the writeback connector (hidden by default), so it
does not detach the CRTC. As a result, the atomic commit fails because
the CRTC is moving to a disabled state with a connector still attached.

Fix this issue by setting the writeback connector cap before getting
DRM resources so that the connector can be discovered and the CRTC
can be detached by IGT. Since it requires atomic support, make it
conditional and move the atomic capability before getting DRM resources.

The associated cap definitions are also updated to include the required
writeback one.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 include/drm-uapi/drm.h | 16 ++++++++++++++++
 lib/igt_kms.c          |  8 ++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/include/drm-uapi/drm.h b/include/drm-uapi/drm.h
index f0bd91de..85c685a2 100644
--- a/include/drm-uapi/drm.h
+++ b/include/drm-uapi/drm.h
@@ -674,6 +674,22 @@ struct drm_get_cap {
  */
 #define DRM_CLIENT_CAP_ATOMIC	3
 
+/**
+ * DRM_CLIENT_CAP_ASPECT_RATIO
+ *
+ * If set to 1, the DRM core will provide aspect ratio information in modes.
+ */
+#define DRM_CLIENT_CAP_ASPECT_RATIO    4
+
+/**
+ * DRM_CLIENT_CAP_WRITEBACK_CONNECTORS
+ *
+ * If set to 1, the DRM core will expose special connectors to be used for
+ * writing back to memory the scene setup in the commit. Depends on client
+ * also supporting DRM_CLIENT_CAP_ATOMIC
+ */
+#define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS	5
+
 /** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */
 struct drm_set_client_cap {
 	__u64 capability;
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index d806ccc1..4f356b8b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1882,6 +1882,12 @@ bool igt_display_init(igt_display_t *display, int drm_fd)
 
 	display->drm_fd = drm_fd;
 
+	if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0) {
+		display->is_atomic = 1;
+
+		drmSetClientCap(drm_fd, DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);
+	}
+
 	resources = drmModeGetResources(display->drm_fd);
 	if (!resources)
 		goto out;
@@ -1895,8 +1901,6 @@ bool igt_display_init(igt_display_t *display, int drm_fd)
 	igt_assert_f(display->pipes, "Failed to allocate memory for %d pipes\n", display->n_pipes);
 
 	drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
-	if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1) == 0)
-		display->is_atomic = 1;
 
 	plane_resources = drmModeGetPlaneResources(display->drm_fd);
 	igt_assert(plane_resources);
-- 
2.19.1

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

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

end of thread, other threads:[~2018-11-15 16:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-14 15:31 [igt-dev] [PATCH i-g-t] lib/igt_kms: Set writeback connector capacity to fix VC4 testing Paul Kocialkowski
2018-11-14 15:50 ` Boris Brezillon
2018-11-15 16:36   ` Paul Kocialkowski
2018-11-14 16:42 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-11-15  3:07 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox