public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v6 5/7] tests/kms_fbcon_fbt: Handle FBC enabled on fbcon in GEN9+
Date: Tue, 24 Mar 2020 13:29:28 -0700	[thread overview]
Message-ID: <20200324202930.30231-5-jose.souza@intel.com> (raw)
In-Reply-To: <20200324202930.30231-1-jose.souza@intel.com>

As now kernel enables FBC on linear surfaces on GEN9+, it will allow
FBC to be enabled on fbcon, so doing the changes he to tests this new
case.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 tests/kms_fbcon_fbt.c | 42 ++++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/tests/kms_fbcon_fbt.c b/tests/kms_fbcon_fbt.c
index b8000a24..081d57f6 100644
--- a/tests/kms_fbcon_fbt.c
+++ b/tests/kms_fbcon_fbt.c
@@ -42,6 +42,7 @@ struct drm_info {
 	int debugfs_fd;
 	drmModeResPtr res;
 	drmModeConnectorPtr connectors[MAX_CONNECTORS];
+	int devid;
 };
 
 static void wait_user(const char *msg)
@@ -67,6 +68,8 @@ static void setup_drm(struct drm_info *drm)
 		drm->connectors[i] = drmModeGetConnectorCurrent(drm->fd,
 						drm->res->connectors[i]);
 
+	drm->devid = intel_get_drm_devid(drm->fd);
+
 	kmstest_set_vt_graphics_mode();
 }
 
@@ -139,19 +142,30 @@ static bool fbc_wait_until_disabled(int debugfs_fd)
 	return r;
 }
 
-static bool fbc_wait_until_update(int debugfs)
+static bool fbc_not_compressing_enabled(int debugfs_fd)
+{
+	char buf[128];
+
+	igt_debugfs_simple_read(debugfs_fd, "i915_fbc_status", buf,
+				sizeof(buf));
+	return strstr(buf, "FBC enabled\nCompressing: no");
+}
+
+static bool fbc_wait_until_update(struct drm_info *drm)
 {
 	/*
-	 * FBC is not expected to be enabled because fbcon do not uses a tiled
-	 * framebuffer so a fence can not be setup on the framebuffer and FBC
-	 * code requires a fence to accurate track frontbuffer modifications
-	 * (what maybe is not necessary anymore as we now have
-	 * intel_fbc_invalidate()/flush()).
+	 * As now kernel enables FBC on linear surfaces on GEN9+, check if the
+	 * fbcon cursor blinking is causing the FBC to uncompress the
+	 * framebuffer.
 	 *
-	 * If one day fbcon starts to use a tiled framebuffer we would need to
-	 * check the 'Compressing' status as in each blink it would be disabled.
+	 * For older GENs FBC is still expected to be disabled as it still
+	 * relies on a tiled and fenceable framebuffer to track modifications.
 	 */
-	return fbc_wait_until_disabled(debugfs);
+	if (AT_LEAST_GEN(drm->devid, 9))
+		return igt_wait(fbc_not_compressing_enabled(drm->debugfs_fd),
+				2000, 1);
+	else
+		return fbc_wait_until_disabled(drm->debugfs_fd);
 }
 
 typedef bool (*connector_possible_fn)(drmModeConnectorPtr connector);
@@ -220,9 +234,9 @@ static bool psr_supported_on_chipset(int debugfs_fd)
 	return psr_sink_support(debugfs_fd, PSR_MODE_1);
 }
 
-static bool psr_wait_until_update(int debugfs_fd)
+static bool psr_wait_until_update(struct drm_info *drm)
 {
-	return psr_long_wait_update(debugfs_fd, PSR_MODE_1);
+	return psr_long_wait_update(drm->debugfs_fd, PSR_MODE_1);
 }
 
 static void disable_features(int debugfs_fd)
@@ -245,7 +259,7 @@ static inline void psr_debugfs_enable(int debugfs_fd)
 struct feature {
 	bool (*supported_on_chipset)(int debugfs_fd);
 	bool (*wait_until_enabled)(int debugfs_fd);
-	bool (*wait_until_update)(int debugfs_fd);
+	bool (*wait_until_update)(struct drm_info *drm);
 	bool (*connector_possible_fn)(drmModeConnectorPtr connector);
 	void (*enable)(int debugfs_fd);
 } fbc = {
@@ -295,13 +309,13 @@ static void subtest(struct drm_info *drm, struct feature *feature, bool suspend)
 	sleep(3);
 
 	wait_user("Back to fbcon.");
-	igt_assert(feature->wait_until_update(drm->debugfs_fd));
+	igt_assert(feature->wait_until_update(drm));
 
 	if (suspend) {
 		igt_system_suspend_autoresume(SUSPEND_STATE_MEM,
 					      SUSPEND_TEST_NONE);
 		sleep(5);
-		igt_assert(feature->wait_until_update(drm->debugfs_fd));
+		igt_assert(feature->wait_until_update(drm));
 	}
 }
 
-- 
2.26.0

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

  parent reply	other threads:[~2020-03-24 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 20:29 [igt-dev] [PATCH i-g-t v6 1/7] tests/kms_frontbuffer_tracking: Add tiling to test_mode José Roberto de Souza
2020-03-24 20:29 ` [igt-dev] [PATCH i-g-t v6 2/7] tests/kms_frontbuffer_tracking: Improve tiling test coverage José Roberto de Souza
2020-03-24 20:29 ` [igt-dev] [PATCH i-g-t v6 3/7] tests/kms_frontbuffer_tracking: Enable positive test on linear tiling José Roberto de Souza
2020-03-24 20:29 ` [igt-dev] [PATCH i-g-t v6 4/7] tests/kms_fbcon_fbt: Reduce execution time José Roberto de Souza
2020-03-24 20:29 ` José Roberto de Souza [this message]
2020-03-24 20:29 ` [igt-dev] [PATCH i-g-t v6 6/7] DO_NOT_MERGE: Revert "tests/kms_frontbuffer_tracking: Enable positive test on linear tiling" José Roberto de Souza
2020-03-24 20:29 ` [igt-dev] [PATCH i-g-t v6 7/7] DO_NOT_MERGE: Revert "tests/kms_fbcon_fbt: Handle FBC enabled on fbcon in GEN9+" José Roberto de Souza
2020-03-24 22:03 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v6,1/7] tests/kms_frontbuffer_tracking: Add tiling to test_mode Patchwork
2020-03-25  0:23 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

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=20200324202930.30231-5-jose.souza@intel.com \
    --to=jose.souza@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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