Skip to contentSkip to conversation

tests/kms_dirtyfb: Add missing files

PATCH New Jouni Högander 1 participant 1 message Aug 8, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/kms_dirtyfb: Add missing files

Previously applied patches:

tests/i915/kms_frontbuffer_tracking: Split drrs into library tests/i915/kms_frontbuffer_tracking: Split fbc into library tests/kms_dirtyfb: Add new test for dirtyfb ioctl

were missing new files. Fix current build breakage by adding these missing files.

---
 lib/i915/intel_drrs.c    | 133 +++++++++++++++++
 lib/i915/intel_drrs.h    |  17 +++
 lib/i915/intel_fbc.c     |  96 +++++++++++++
 lib/i915/intel_fbc.h     |  19 +++
 tests/i915/kms_dirtyfb.c | 303 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 568 insertions(+)
 create mode 100644 lib/i915/intel_drrs.c
 create mode 100644 lib/i915/intel_drrs.h
 create mode 100644 lib/i915/intel_fbc.c
 create mode 100644 lib/i915/intel_fbc.h
 create mode 100644 tests/i915/kms_dirtyfb.c
lib/i915/intel_drrs.c new file +133 -0
new file mode 100644
index 000000000..2f83e1394
@@ -0,0 +1,133 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#include <fcntl.h>
+
+#include "igt.h"
+#include "igt_sysfs.h"
+
+#include "intel_drrs.h"
+
+/**
+ * intel_is_drrs_supported:
+ * @device: fd of the device
+ * @pipe: Display pipe
+ *
+ * Check if DRRS is supported on given pipe.
+ *
+ * Returns:
+ * true if DRRS is supported and false otherwise.
+ */
+bool intel_is_drrs_supported(int device, enum pipe pipe)
+{
+	char buf[256];
+	int dir;
+
+	dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+	igt_require_fd(dir);
+	igt_debugfs_simple_read(dir, "i915_drrs_status", buf, sizeof(buf));
+	close(dir);
+	if (*buf == '\0')
+		return false;
+
+	return !strcasestr(buf, "DRRS enabled:");
+}
+
+/**
+ * intel_output_has_drrs
+ * @device: fd of the device
+ * @output: Display output
+ *
+ * Check if drrs used on given output.
+ *
+ * Returns:
+ * true if DRRS is used and false otherwise.
+ */
+bool intel_output_has_drrs(int device, igt_output_t *output)
+{
+	char buf[256];
+	int dir;
+
+	dir = igt_debugfs_connector_dir(device, output->name, O_DIRECTORY);
+	igt_require_fd(dir);
+	igt_debugfs_simple_read(dir, "i915_drrs_type", buf, sizeof(buf));
+	close(dir);
+
+	return strstr(buf, "seamless");
+}
+
+static void drrs_set(int device, enum pipe pipe, unsigned int val)
+{
+	char buf[2];
+	int dir, ret;
+
+	igt_debug("Manually %sabling DRRS. %u\n", val ? "en" : "dis", val);
+	snprintf(buf, sizeof(buf), "%d", val);
+
+	dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+	igt_require_fd(dir);
+	ret = igt_sysfs_write(dir, "i915_drrs_ctl", buf, sizeof(buf) - 1);
+
+	/*
+	 * drrs_enable() is called on DRRS capable platform only,
+	 * whereas drrs_disable() is called on all platforms.
+	 * So handle the failure of debugfs_write only for drrs_enable().
+	 */
+	if (val)
+		igt_assert_f(ret == (sizeof(buf) - 1), "debugfs_write failed");
+}
+
+/**
+ * intel_drrs_enable:
+ * @device: fd of the device
+ * @pipe: Display pipe
+ *
+ * Enable DRRS on given pipe
+ *
+ * Returns:
+ * none
+ */
+void intel_drrs_enable(int device, enum pipe pipe)
+{
+	drrs_set(device, pipe, 1);
+}
+
+/**
+ * intel_drrs_disable:
+ * @device: fd of the device
+ * @pipe: Display pipe
+ *
+ * Disable DRRS on given pipe
+ *
+ * Returns:
+ * none
+ */
+void intel_drrs_disable(int device, enum pipe pipe)
+{
+	drrs_set(device, pipe, 0);
+}
+
+/**
+ * intel_is_drrs_inactive:
+ * @device: fd of the device
+ * @pipe: Display pipe
+ *
+ * Check if drrs is inactive on given pipe
+ *
+ * Returns:
+ * true if inactive and false otherwise
+ */
+bool intel_is_drrs_inactive(int device, enum pipe pipe)
+{
+	char buf[256];
+	int dir;
+
+	dir = igt_debugfs_pipe_dir(device, pipe, O_DIRECTORY);
+	igt_require_fd(dir);
+	igt_debugfs_simple_read(dir, "i915_drrs_status", buf, sizeof(buf));
+	close(dir);
+
+	return strstr(buf, "DRRS active: no");
+}
lib/i915/intel_drrs.h new file +17 -0
new file mode 100644
index 000000000..d4d27a5f9
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef INTEL_DRRS_H
+#define INTEL_DRRS_H
+
+#include "igt.h"
+
+bool intel_is_drrs_supported(int device, enum pipe pipe);
+bool intel_output_has_drrs(int device, igt_output_t *output);
+void intel_drrs_enable(int device, enum pipe pipe);
+void intel_drrs_disable(int device, enum pipe pipe);
+bool intel_is_drrs_inactive(int device, enum pipe pipe);
+
+#endif
lib/i915/intel_fbc.c new file +96 -0

96 lines not on this page · raw message

lib/i915/intel_fbc.h new file +19 -0
new file mode 100644
index 000000000..901bf984b
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef INTEL_FBC_H
+#define INTEL_FBC_H
+
+#include "igt.h"
+
+#define intel_fbc_enable(device) igt_set_module_param_int(device, "enable_fbc", 1)
+#define intel_fbc_disable(device) igt_set_module_param_int(device, "enable_fbc", 0)
+
+bool intel_fbc_supported_on_chipset(int device, enum pipe pipe);
+bool intel_fbc_wait_until_enabled(int device, enum pipe pipe);
+bool intel_fbc_is_enabled(int device, enum pipe pipe, int log_level);
+
+#endif
+
tests/i915/kms_dirtyfb.c new file +303 -0

303 lines not on this page · raw message

Signature · 1 line
2.34.1