Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gil Dekel <gildekel@google.com>
To: igt-dev@lists.freedesktop.org
Cc: Gil Dekel <gildekel@google.com>,
	 Thadeu Lima de Souza Cascardo <cascardo@igalia.com>,
	Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	 Mark Yacoub <markyacoub@google.com>
Subject: [PATCH i-g-t] lib/igt_kms: Skip connectors that can't scan out
Date: Sat, 14 Nov 2026 17:28:55 -0500	[thread overview]
Message-ID: <20261114222855.1403127-1-gildekel@google.com> (raw)

igt_output_is_connected() trusts the connector status alone. Some
drivers expose writeback outputs as always-connected
DRM_MODE_CONNECTOR_VIRTUAL connectors next to their eDP and DP
connectors; the downstream msm SDE driver is one. IGT then picks such
a connector as a display. Its first modeset fails with -EINVAL because
no writeback framebuffer is attached, and every test that calls
igt_display_require() fails in its fixture.

Commit 321448df7fc9 ("lib/igt_kms: Do not treat writeback and virtual
connectors as connected") skipped all virtual connectors. It broke VKMS,
which has nothing but virtual connectors, and was reverted.

Add kmstest_connector_is_scanout_sink(), which decides from the uAPI
alone:
- Writeback connectors, and any connector exposing WRITEBACK_FB_ID,
  are never scanout sinks.
- On devices that only expose virtual connectors (VKMS, virtio-gpu,
  vmwgfx, ...), the virtual connectors are the displays and are left
  alone.
- Next to physical connectors, a connected virtual connector is hidden
  only if the kernel rejects a TEST_ONLY commit that lights it up with
  a plain XRGB8888 primary plane on every CRTC it can use. If the probe
  can't be sent (no atomic cap, or not DRM master), the connector is
  kept.

igt_display_reset_outputs() caches the result per output, and
igt_output_is_connected() honours it. kms_setmode enumerates
connectors itself on a legacy fd, so it enables the atomic cap just
long enough to classify them in its fixture. kms_writeback walks
for_each_output() and still finds its connector.

Cc: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: Mark Yacoub <markyacoub@google.com>
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Gil Dekel <gildekel@google.com>
---
 lib/igt_kms.c       | 466 ++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_kms.h       |  16 +-
 tests/kms_setmode.c |  39 ++++
 3 files changed, 519 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 915c6a8a2..bae0f386b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2020,6 +2020,449 @@ void igt_sort_connector_modes(drmModeConnector *connector,
 	      comparator);
 }
 
+static bool connector_type_is_physical(uint32_t connector_type)
+{
+	return connector_type != DRM_MODE_CONNECTOR_VIRTUAL &&
+	       connector_type != DRM_MODE_CONNECTOR_WRITEBACK;
+}
+
+static bool device_has_physical_connector(int drm_fd, const drmModeRes *res)
+{
+	for (int i = 0; i < res->count_connectors; i++) {
+		drmModeConnector *c;
+		bool physical;
+
+		c = drmModeGetConnectorCurrent(drm_fd, res->connectors[i]);
+		if (!c)
+			continue;
+
+		physical = connector_type_is_physical(c->connector_type);
+		drmModeFreeConnector(c);
+
+		if (physical)
+			return true;
+	}
+
+	return false;
+}
+
+/* Plane properties used by the scanout probe. */
+enum probe_plane_prop {
+	PROBE_PLANE_FB_ID,
+	PROBE_PLANE_CRTC_ID,
+	PROBE_PLANE_SRC_X,
+	PROBE_PLANE_SRC_Y,
+	PROBE_PLANE_SRC_W,
+	PROBE_PLANE_SRC_H,
+	PROBE_PLANE_CRTC_X,
+	PROBE_PLANE_CRTC_Y,
+	PROBE_PLANE_CRTC_W,
+	PROBE_PLANE_CRTC_H,
+	PROBE_PLANE_TYPE,
+	PROBE_PLANE_NUM_PROPS
+};
+
+static const char * const probe_plane_prop_names[PROBE_PLANE_NUM_PROPS] = {
+	[PROBE_PLANE_FB_ID] = "FB_ID",
+	[PROBE_PLANE_CRTC_ID] = "CRTC_ID",
+	[PROBE_PLANE_SRC_X] = "SRC_X",
+	[PROBE_PLANE_SRC_Y] = "SRC_Y",
+	[PROBE_PLANE_SRC_W] = "SRC_W",
+	[PROBE_PLANE_SRC_H] = "SRC_H",
+	[PROBE_PLANE_CRTC_X] = "CRTC_X",
+	[PROBE_PLANE_CRTC_Y] = "CRTC_Y",
+	[PROBE_PLANE_CRTC_W] = "CRTC_W",
+	[PROBE_PLANE_CRTC_H] = "CRTC_H",
+	[PROBE_PLANE_TYPE] = "type",
+};
+
+struct probe_plane {
+	uint32_t id;
+	uint32_t possible_crtcs;
+	uint32_t props[PROBE_PLANE_NUM_PROPS];
+	uint64_t values[PROBE_PLANE_NUM_PROPS];
+};
+
+struct probe_connector {
+	uint32_t id;
+	uint32_t crtc_id_prop;
+	uint64_t crtc_id;
+};
+
+struct scanout_probe {
+	int drm_fd;
+	const drmModeConnector *connector;
+	uint32_t conn_crtc_id_prop;
+	const drmModeModeInfo *mode;
+	uint32_t mode_blob;
+	uint32_t fb_id;
+	struct probe_connector *others;
+	int n_others;
+	struct probe_plane *planes;
+	int n_planes;
+};
+
+/* Looks up the ids and current values of @n named properties of an object. */
+static bool probe_lookup_props(int drm_fd, uint32_t obj_id, uint32_t obj_type,
+			       const char * const names[], int n,
+			       uint32_t ids[], uint64_t values[])
+{
+	drmModeObjectPropertiesPtr props;
+	int found = 0;
+
+	props = drmModeObjectGetProperties(drm_fd, obj_id, obj_type);
+	if (!props)
+		return false;
+
+	for (int i = 0; i < props->count_props; i++) {
+		drmModePropertyPtr prop = drmModeGetProperty(drm_fd, props->props[i]);
+
+		if (!prop)
+			continue;
+
+		for (int j = 0; j < n; j++) {
+			if (strcmp(prop->name, names[j]))
+				continue;
+
+			ids[j] = props->props[i];
+			values[j] = props->prop_values[i];
+			found++;
+			break;
+		}
+
+		drmModeFreeProperty(prop);
+	}
+
+	drmModeFreeObjectProperties(props);
+
+	return found == n;
+}
+
+static void probe_add(drmModeAtomicReq *req, uint32_t obj_id,
+		      uint32_t prop_id, uint64_t value)
+{
+	igt_assert_lte(0, drmModeAtomicAddProperty(req, obj_id, prop_id, value));
+}
+
+/* Returns an XRGB8888 dumb framebuffer id for @mode, or 0 on failure. */
+static uint32_t probe_fb_create(int drm_fd, const drmModeModeInfo *mode,
+				uint32_t *handle)
+{
+	struct drm_mode_create_dumb create = {
+		.width = mode->hdisplay,
+		.height = mode->vdisplay,
+		.bpp = 32,
+	};
+	uint32_t handles[4] = { 0 }, pitches[4] = { 0 }, offsets[4] = { 0 };
+	uint32_t fb_id = 0;
+
+	*handle = 0;
+
+	/* The buffer is never mapped, so its pages are never allocated. */
+	if (drmIoctl(drm_fd, DRM_IOCTL_MODE_CREATE_DUMB, &create))
+		return 0;
+
+	handles[0] = create.handle;
+	pitches[0] = create.pitch;
+	if (drmModeAddFB2(drm_fd, mode->hdisplay, mode->vdisplay,
+			  DRM_FORMAT_XRGB8888, handles, pitches, offsets,
+			  &fb_id, 0)) {
+		__kmstest_dumb_destroy(drm_fd, create.handle);
+		return 0;
+	}
+
+	*handle = create.handle;
+
+	return fb_id;
+}
+
+/*
+ * TEST_ONLY commit that lights up the probed connector on @crtc_id with
+ * the probe mode and, if available, the probe fb on a primary plane.
+ * Other connectors and planes on that CRTC are detached in the same
+ * request. No writeback framebuffer is attached.
+ */
+static int probe_scanout_on_crtc(const struct scanout_probe *p,
+				 uint32_t crtc_id, int crtc_idx)
+{
+	static const char * const crtc_prop_names[] = { "MODE_ID", "ACTIVE" };
+	uint32_t crtc_props[2];
+	uint64_t crtc_values[2];
+	bool have_primary = false;
+	drmModeAtomicReq *req;
+	int ret;
+
+	if (!probe_lookup_props(p->drm_fd, crtc_id, DRM_MODE_OBJECT_CRTC,
+				crtc_prop_names, 2, crtc_props, crtc_values))
+		return -EOPNOTSUPP;
+
+	req = drmModeAtomicAlloc();
+	igt_assert(req);
+
+	probe_add(req, crtc_id, crtc_props[0], p->mode_blob);
+	probe_add(req, crtc_id, crtc_props[1], 1);
+	probe_add(req, p->connector->connector_id, p->conn_crtc_id_prop,
+		  crtc_id);
+
+	for (int i = 0; i < p->n_others; i++)
+		if (p->others[i].crtc_id == crtc_id)
+			probe_add(req, p->others[i].id,
+				  p->others[i].crtc_id_prop, 0);
+
+	for (int i = 0; i < p->n_planes; i++) {
+		const struct probe_plane *plane = &p->planes[i];
+		const uint32_t *props = plane->props;
+		const drmModeModeInfo *mode = p->mode;
+
+		if (p->fb_id && !have_primary &&
+		    plane->possible_crtcs & (1u << crtc_idx) &&
+		    plane->values[PROBE_PLANE_TYPE] == DRM_PLANE_TYPE_PRIMARY) {
+			probe_add(req, plane->id, props[PROBE_PLANE_FB_ID],
+				  p->fb_id);
+			probe_add(req, plane->id, props[PROBE_PLANE_CRTC_ID],
+				  crtc_id);
+			probe_add(req, plane->id, props[PROBE_PLANE_SRC_X], 0);
+			probe_add(req, plane->id, props[PROBE_PLANE_SRC_Y], 0);
+			probe_add(req, plane->id, props[PROBE_PLANE_SRC_W],
+				  (uint64_t)mode->hdisplay << 16);
+			probe_add(req, plane->id, props[PROBE_PLANE_SRC_H],
+				  (uint64_t)mode->vdisplay << 16);
+			probe_add(req, plane->id, props[PROBE_PLANE_CRTC_X], 0);
+			probe_add(req, plane->id, props[PROBE_PLANE_CRTC_Y], 0);
+			probe_add(req, plane->id, props[PROBE_PLANE_CRTC_W],
+				  mode->hdisplay);
+			probe_add(req, plane->id, props[PROBE_PLANE_CRTC_H],
+				  mode->vdisplay);
+			have_primary = true;
+		} else if (plane->values[PROBE_PLANE_CRTC_ID] == crtc_id) {
+			probe_add(req, plane->id, props[PROBE_PLANE_FB_ID], 0);
+			probe_add(req, plane->id, props[PROBE_PLANE_CRTC_ID], 0);
+		}
+	}
+
+	ret = drmModeAtomicCommit(p->drm_fd, req,
+				  DRM_MODE_ATOMIC_TEST_ONLY |
+				  DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
+	drmModeAtomicFree(req);
+
+	return ret;
+}
+
+/*
+ * Asks the kernel, with TEST_ONLY commits on each possible CRTC, whether
+ * @connector can be lit up as a display without a writeback framebuffer.
+ *
+ * Returns 0 if a CRTC accepts it, otherwise the last error. -ENOENT,
+ * -EOPNOTSUPP and -EACCES mean no probe reached the atomic check:
+ * @connector is disconnected, @drm_fd lacks the atomic client cap
+ * (atomic properties are hidden), or @drm_fd is not DRM master.
+ */
+static int probe_scanout_sink(int drm_fd, const drmModeRes *res,
+			      const drmModeConnector *connector)
+{
+	struct scanout_probe p = { .drm_fd = drm_fd, .connector = connector };
+	drmModePlaneRes *plane_res;
+	uint32_t possible_crtcs = 0, handle;
+	int ret = -ENODEV;
+
+	if (connector->connection != DRM_MODE_CONNECTED ||
+	    !connector->count_modes)
+		return -ENOENT;
+
+	if (!kmstest_get_property(drm_fd, connector->connector_id,
+				  DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID",
+				  &p.conn_crtc_id_prop, NULL, NULL))
+		return -EOPNOTSUPP;
+
+	for (int i = 0; i < connector->count_encoders; i++) {
+		drmModeEncoder *encoder;
+
+		encoder = drmModeGetEncoder(drm_fd, connector->encoders[i]);
+		if (!encoder)
+			continue;
+
+		possible_crtcs |= encoder->possible_crtcs;
+		drmModeFreeEncoder(encoder);
+	}
+
+	/* The smallest mode keeps the probe framebuffer small. */
+	p.mode = &connector->modes[0];
+	for (int i = 1; i < connector->count_modes; i++) {
+		const drmModeModeInfo *m = &connector->modes[i];
+
+		if (m->hdisplay * m->vdisplay <
+		    p.mode->hdisplay * p.mode->vdisplay)
+			p.mode = m;
+	}
+
+	p.others = calloc(res->count_connectors, sizeof(*p.others));
+	igt_assert(p.others);
+	for (int i = 0; i < res->count_connectors; i++) {
+		struct probe_connector *other = &p.others[p.n_others];
+
+		if (res->connectors[i] == connector->connector_id)
+			continue;
+
+		if (kmstest_get_property(drm_fd, res->connectors[i],
+					 DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID",
+					 &other->crtc_id_prop, &other->crtc_id,
+					 NULL)) {
+			other->id = res->connectors[i];
+			p.n_others++;
+		}
+	}
+
+	plane_res = drmModeGetPlaneResources(drm_fd);
+	if (plane_res && plane_res->count_planes) {
+		p.planes = calloc(plane_res->count_planes, sizeof(*p.planes));
+		igt_assert(p.planes);
+	}
+	for (int i = 0; p.planes && i < plane_res->count_planes; i++) {
+		struct probe_plane *plane = &p.planes[p.n_planes];
+		drmModePlane *drm_plane;
+
+		drm_plane = drmModeGetPlane(drm_fd, plane_res->planes[i]);
+		if (!drm_plane)
+			continue;
+
+		plane->id = drm_plane->plane_id;
+		plane->possible_crtcs = drm_plane->possible_crtcs;
+		drmModeFreePlane(drm_plane);
+
+		if (probe_lookup_props(drm_fd, plane->id, DRM_MODE_OBJECT_PLANE,
+				       probe_plane_prop_names,
+				       PROBE_PLANE_NUM_PROPS, plane->props,
+				       plane->values))
+			p.n_planes++;
+	}
+	drmModeFreePlaneResources(plane_res);
+
+	ret = drmModeCreatePropertyBlob(drm_fd, p.mode, sizeof(*p.mode),
+					&p.mode_blob);
+	if (ret)
+		goto out;
+
+	/* Without an fb, still probe with the CRTC and connector alone. */
+	p.fb_id = probe_fb_create(drm_fd, p.mode, &handle);
+
+	ret = -ENODEV;
+	for (int i = 0; i < res->count_crtcs && i < 32; i++) {
+		if (!(possible_crtcs & (1u << i)))
+			continue;
+
+		ret = probe_scanout_on_crtc(&p, res->crtcs[i], i);
+		if (!ret)
+			break;
+	}
+
+	if (p.fb_id) {
+		drmModeRmFB(drm_fd, p.fb_id);
+		__kmstest_dumb_destroy(drm_fd, handle);
+	}
+	drmModeDestroyPropertyBlob(drm_fd, p.mode_blob);
+out:
+	free(p.planes);
+	free(p.others);
+
+	return ret;
+}
+
+static const char *probe_result_str(int ret)
+{
+	switch (ret) {
+	case -ENOENT:
+		return "disconnected";
+	case -EOPNOTSUPP:
+		return "no atomic client cap";
+	case -EACCES:
+		return "not DRM master";
+	default:
+		return strerror(-ret);
+	}
+}
+
+/* True if @ret means no probe reached the atomic check. */
+static bool probe_inconclusive(int ret)
+{
+	return ret == -ENOENT || ret == -EOPNOTSUPP || ret == -EACCES;
+}
+
+static bool connector_is_scanout_sink(int drm_fd, const drmModeRes *res,
+				      const drmModeConnector *connector,
+				      bool has_writeback_fb_id)
+{
+	int ret;
+
+	if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK ||
+	    has_writeback_fb_id)
+		return false;
+
+	if (connector->connector_type != DRM_MODE_CONNECTOR_VIRTUAL)
+		return true;
+
+	/* On virtual-only devices (VKMS, virtio-gpu, ...) these are the displays. */
+	if (!device_has_physical_connector(drm_fd, res))
+		return true;
+
+	/*
+	 * Next to physical connectors, a virtual connector may be a
+	 * writeback or concurrent writeback sink that rejects any commit
+	 * without an output fb. Only hide it when the kernel says so.
+	 */
+	ret = probe_scanout_sink(drm_fd, res, connector);
+	if (!ret)
+		return true;
+
+	if (probe_inconclusive(ret)) {
+		igt_debug("%s-%d: scanout probe not sent (%s), assuming a scanout sink\n",
+			  kmstest_connector_type_str(connector->connector_type),
+			  connector->connector_type_id, probe_result_str(ret));
+		return true;
+	}
+
+	igt_debug("%s-%d: kernel rejected a plain modeset (%s), not a scanout sink\n",
+		  kmstest_connector_type_str(connector->connector_type),
+		  connector->connector_type_id, probe_result_str(ret));
+
+	return false;
+}
+
+/**
+ * kmstest_connector_is_scanout_sink:
+ * @drm_fd: DRM fd
+ * @res: libdrm resources of @drm_fd
+ * @connector: libdrm connector to check
+ *
+ * Checks whether @connector drives a display that can be lit up with a
+ * plain modeset, as opposed to a memory sink that needs an output
+ * framebuffer on every commit.
+ *
+ * Writeback connectors, and any connector that exposes WRITEBACK_FB_ID,
+ * are never scanout sinks. Physical connectors always are.
+ *
+ * Virtual connectors are scanout sinks on devices that only expose
+ * virtual connectors (VKMS, virtio-gpu, vmwgfx, ...). Next to physical
+ * connectors, where some drivers use them for writeback outputs, a
+ * connected virtual connector is not a scanout sink if the kernel
+ * rejects a TEST_ONLY commit that lights it up with a plain primary
+ * plane on any of its CRTCs. That probe needs DRM master and the atomic
+ * client cap on @drm_fd. Without them the connector is assumed to be a
+ * scanout sink. This function never changes the client caps of @drm_fd.
+ *
+ * Returns: True if @connector is a scanout sink, false otherwise.
+ */
+bool kmstest_connector_is_scanout_sink(int drm_fd, const drmModeRes *res,
+				       const drmModeConnector *connector)
+{
+	bool has_writeback_fb_id =
+		kmstest_get_property(drm_fd, connector->connector_id,
+				     DRM_MODE_OBJECT_CONNECTOR,
+				     "WRITEBACK_FB_ID", NULL, NULL, NULL);
+
+	return connector_is_scanout_sink(drm_fd, res, connector,
+					 has_writeback_fb_id);
+}
+
 /**
  * kmstest_get_connector_default_mode:
  * @drm_fd: DRM fd
@@ -2943,6 +3386,29 @@ void igt_display_reset_outputs(igt_display_t *display)
 		}
 	}
 
+	/*
+	 * Must be known before the first igt_output_is_connected() call
+	 * below, which skips outputs that aren't scanout sinks.
+	 */
+	for (i = 0; i < display->n_outputs; i++) {
+		igt_output_t *output = &display->outputs[i];
+		drmModeConnector *connector = output->config.connector;
+
+		if (!connector)
+			continue;
+
+		output->non_scanout_sink =
+			!connector_is_scanout_sink(display->drm_fd, resources,
+						   connector,
+						   output->props[IGT_CONNECTOR_WRITEBACK_FB_ID]);
+
+		if (output->non_scanout_sink &&
+		    connector->connector_type == DRM_MODE_CONNECTOR_VIRTUAL &&
+		    connector->connection == DRM_MODE_CONNECTED)
+			igt_info("%s: not a scanout sink, not used as a display\n",
+				 output->name);
+	}
+
 	/* Set reasonable default values for every object in the
 	 * display. */
 	igt_display_reset(display);
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index dfcb91e02..ac28a576e 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -285,6 +285,8 @@ bool kmstest_probe_connector_config(int drm_fd, uint32_t connector_id,
 				    unsigned long crtc_idx_mask,
 				    struct kmstest_connector_config *config);
 void kmstest_free_connector_config(struct kmstest_connector_config *config);
+bool kmstest_connector_is_scanout_sink(int drm_fd, const drmModeRes *res,
+				       const drmModeConnector *connector);
 
 void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode);
 bool kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
@@ -512,6 +514,8 @@ typedef struct {
 	struct kmstest_connector_config config;
 	char *name;
 	bool force_reprobe;
+	/* Set by igt_display_reset_outputs(), see kmstest_connector_is_scanout_sink(). */
+	bool non_scanout_sink;
 	igt_crtc_t *pending_crtc;
 	bool use_override_mode;
 	drmModeModeInfo override_mode;
@@ -668,8 +672,12 @@ void igt_wait_for_vblank_ts_seq(igt_crtc_t *crtc, uint64_t *ts_ns, unsigned int
  * igt_output_is_connected:
  * @output: #igt_output_t to check.
  *
- * Returns: True if given @output's connection status is CONNECTED,
- * else False.
+ * Outputs that aren't scanout sinks (writeback connectors, and virtual
+ * connectors used as writeback outputs) are never reported as
+ * connected, see kmstest_connector_is_scanout_sink().
+ *
+ * Returns: True if given @output is a scanout sink whose connection
+ * status is CONNECTED, else False.
  */
 static inline bool igt_output_is_connected(igt_output_t *output)
 {
@@ -678,6 +686,10 @@ static inline bool igt_output_is_connected(igt_output_t *output)
 	    !output->config.connector->count_modes)
 		return false;
 
+	/* Memory sinks need an output fb and can't be lit up with a modeset. */
+	if (output->non_scanout_sink)
+		return false;
+
 	if (output->config.connector->connection == DRM_MODE_CONNECTED)
 		return true;
 
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index a65ea8b23..f105a6ad1 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -92,6 +92,7 @@
 
 static int drm_fd;
 static drmModeRes *drm_resources;
+static bool *non_scanout_sink;
 static int filter_test_id;
 static bool dry_run;
 static bool extended = false;
@@ -895,6 +896,9 @@ static int get_connectors(drmModeRes *resources, int *connector_idxs,
 		igt_assert_lt(connector_idx, resources->count_connectors);
 		connector_id = resources->connectors[connector_idx];
 
+		if (non_scanout_sink[connector_idx])
+			goto err;
+
 		if (get_one_connector(resources, connector_id, &cconfs[i]) < 0)
 			goto err;
 
@@ -1047,6 +1051,38 @@ static void restore_cpu_deep_sleep_at_exit(int sig)
 	igt_pm_enable_cpu_deep_sleep();
 }
 
+/*
+ * Marks the connectors that can't be lit up with a plain modeset, such
+ * as writeback outputs exposed as virtual connectors. Probing those
+ * needs the atomic cap, so enable it only here: every modeset in this
+ * test stays legacy.
+ */
+static void find_non_scanout_sinks(void)
+{
+	bool atomic = !drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
+
+	non_scanout_sink = calloc(drm_resources->count_connectors,
+				  sizeof(*non_scanout_sink));
+	igt_assert(non_scanout_sink);
+
+	for (int i = 0; i < drm_resources->count_connectors; i++) {
+		drmModeConnector *connector;
+
+		connector = drmModeGetConnector(drm_fd,
+						drm_resources->connectors[i]);
+		if (!connector)
+			continue;
+
+		non_scanout_sink[i] =
+			!kmstest_connector_is_scanout_sink(drm_fd, drm_resources,
+							   connector);
+		drmModeFreeConnector(connector);
+	}
+
+	if (atomic)
+		igt_assert_eq(drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ATOMIC, 0), 0);
+}
+
 static int opt_handler(int opt, int opt_index, void *data)
 {
 	switch (opt) {
@@ -1103,6 +1139,8 @@ int igt_main_args("det:", NULL, help_str, opt_handler, NULL)
 		drm_resources = drmModeGetResources(drm_fd);
 		igt_require(drm_resources);
 
+		find_non_scanout_sinks();
+
 		max_dotclock = igt_get_max_dotclock(drm_fd);
 	}
 
@@ -1143,6 +1181,7 @@ int igt_main_args("det:", NULL, help_str, opt_handler, NULL)
 	}
 
 	igt_fixture() {
+		free(non_scanout_sink);
 		drmModeFreeResources(drm_resources);
 		drm_close_driver(drm_fd);
 	}
-- 
Gil Dekel, Software Engineer, Google / ChromeOS Display and Graphics


             reply	other threads:[~2026-11-16  5:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 22:28 Gil Dekel [this message]
2026-11-15  0:18 ` [PATCH i-g-t v2] lib/igt_kms: Skip connectors that can't scan out Gil Dekel
2026-11-16  6:08 ` ✓ Xe.CI.BAT: success for lib/igt_kms: Skip connectors that can't scan out (rev2) Patchwork
2026-11-16  6:28 ` ✓ i915.CI.BAT: " Patchwork
2026-11-16  7:39 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-16  9:01 ` ✗ i915.CI.Full: failure " Patchwork
2026-11-16 10:09 ` [PATCH i-g-t] lib/igt_kms: Skip connectors that can't scan out Jani Nikula
2026-11-17  3:13   ` Gil Dekel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261114222855.1403127-1-gildekel@google.com \
    --to=gildekel@google.com \
    --cc=cascardo@igalia.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=markyacoub@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox