@@ -37,6 +37,20 @@ IGT_TEST_DESCRIPTION(
#define DRRS_STATUS_BYTES_CNT 1000
+#define INTEL_FRONTBUFFER_BITS_PER_PIPE 4
+#define INTEL_FRONTBUFFER_BITS \
+ (INTEL_FRONTBUFFER_BITS_PER_PIPE * I915_MAX_PIPES)
+#define INTEL_FRONTBUFFER_PRIMARY(pipe) \
+ (1 << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))
+#define INTEL_FRONTBUFFER_CURSOR(pipe) \
+ (1 << (1 + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
+#define INTEL_FRONTBUFFER_SPRITE(pipe) \
+ (1 << (2 + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
+#define INTEL_FRONTBUFFER_OVERLAY(pipe) \
+ (1 << (3 + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
+#define INTEL_FRONTBUFFER_ALL_MASK(pipe) \
+ (0xf << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))
+
typedef struct {
int drm_fd;
uint32_t devid;
@@ -126,6 +140,36 @@ static bool is_drrs_state(data_t *data, const char str[15])
return strstr(status, str) != NULL;
}
+/*
+ * drrs_fb_status_update:
+ *
+ * drm front buffer tracking is not notifying the FB status change in
+ * many cases.
+ * Hence to test the DRRS module independently we are providing the DRRS
+ * invalidate and flush calls through a debugfs. NOTE: Additional kernel
+ * patch is required to add the required debugfs and to detach the DRRS module
+ * from the front buffer tracking implementation
+ */
+static void drrs_fb_status_update(data_t *data, unsigned fb_status_bits,
+ bool rendered)
+{
+ FILE *ctl;
+ size_t written;
+ struct fb_status fb_status;
+
+ igt_info("Entry to drrs_fb_status_update with fb_status_bits %u\n",
+ fb_status_bits);
+
+ ctl = igt_debugfs_fopen("i915_drrs_fb_status", "r+");
+
+ fb_status.rendered = rendered;
+ fb_status.fb_bits = fb_status_bits;
+
+ written = fwrite(&fb_status, sizeof(fb_status), 1, ctl);
+ igt_assert_eq(written, 1);
+
+ fclose(ctl);
+}
static bool prepare_crtc(data_t *data)
{
@@ -196,6 +240,15 @@ static bool execute_test(data_t *data)
return false;
}
+ /*
+ * FIXME: When Front buffer tracking is fixed, remove
+ * next two function calls.
+ */
+ drrs_fb_status_update(data, INTEL_FRONTBUFFER_PRIMARY(data->pipe),
+ false);
+ drrs_fb_status_update(data, INTEL_FRONTBUFFER_PRIMARY(data->pipe),
+ true);
+
igt_wait_for_vblank(data->drm_fd, data->pipe);
@@ -222,6 +275,15 @@ static bool execute_test(data_t *data)
igt_plane_set_fb(data->primary, &data->fb[0]);
igt_display_commit(display);
+ /*
+ * FIXME: When Front buffer tracking is fixed, remove
+ * next two function calls.
+ */
+ drrs_fb_status_update(data, INTEL_FRONTBUFFER_PRIMARY(data->pipe),
+ false);
+ drrs_fb_status_update(data, INTEL_FRONTBUFFER_PRIMARY(data->pipe),
+ true);
+
igt_wait_for_vblank(data->drm_fd, data->pipe);
if (is_drrs_state(data, "DRRS_HIGH_RR")) {
@@ -246,6 +308,15 @@ static bool execute_test(data_t *data)
igt_plane_set_fb(data->primary, &data->fb[1]);
igt_display_commit(display);
+ /*
+ * FIXME: When Front buffer tracking is fixed, remove
+ * next two function calls.
+ */
+ drrs_fb_status_update(data, INTEL_FRONTBUFFER_PRIMARY(data->pipe),
+ false);
+ drrs_fb_status_update(data, INTEL_FRONTBUFFER_PRIMARY(data->pipe),
+ true);
+
igt_wait_for_vblank(data->drm_fd, data->pipe);
if (is_drrs_state(data, "DRRS_HIGH_RR")) {
At present there are some functional issues at front buffer tracking. So to test the DRRS feature and the DRRS test apps, we have added a debugfs to provide the fb change notification. Corresponding calls implemented in this change DO NOT MERGE: As this is a temperary fix to test the DRRS independent of the front buffer tracking. This will be dropped once the front buffer tracking is fixed. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> --- tests/kms_drrs.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)