[igt-dev] [PATCH i-g-t] lib/igt_kms: Set writeback connector capacity to fix VC4 testing

Paul Kocialkowski paul.kocialkowski at bootlin.com
Wed Nov 14 15:31:49 UTC 2018


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 at 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



More information about the igt-dev mailing list