public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: igt-dev@lists.freedesktop.org
Cc: Eben Upton <eben@raspberrypi.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [igt-dev] [PATCH i-g-t RFC v2 3/4] lib/igt_vc4: Add helpers for underrun count and load tracker state
Date: Wed,  6 Feb 2019 16:00:58 +0100	[thread overview]
Message-ID: <20190206150059.24679-4-paul.kocialkowski@bootlin.com> (raw)
In-Reply-To: <20190206150059.24679-1-paul.kocialkowski@bootlin.com>

Introduce new helpers that allow getting the current underrun count
from debugfs and getting/setting the enabled state of the load tracker.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 lib/igt_vc4.c | 32 ++++++++++++++++++++++++++++++++
 lib/igt_vc4.h |  6 ++++++
 2 files changed, 38 insertions(+)

diff --git a/lib/igt_vc4.c b/lib/igt_vc4.c
index 16dfe67a44b1..1e2c2e636509 100644
--- a/lib/igt_vc4.c
+++ b/lib/igt_vc4.c
@@ -34,6 +34,7 @@
 #include "drmtest.h"
 #include "igt_aux.h"
 #include "igt_core.h"
+#include "igt_sysfs.h"
 #include "igt_vc4.h"
 #include "ioctl_wrappers.h"
 #include "intel_reg.h"
@@ -176,3 +177,34 @@ bool igt_vc4_purgeable_bo(int fd, int handle, bool purgeable)
 
 	return arg.retained;
 }
+
+int igt_vc4_get_underrun_count(int debugfs)
+{
+	int underrun_count;
+	char *underrun = igt_sysfs_get(debugfs, VC4_UNDERRUN_DEBUGFS);
+
+	igt_assert(underrun);
+
+	underrun_count = atoi(underrun);
+	free(underrun);
+
+	return underrun_count;
+}
+
+void igt_vc4_set_load_tracker(int debugfs, bool enable)
+{
+	igt_sysfs_set(debugfs, VC4_LOAD_TRACKER_DEBUGFS, enable ? "Y" : "N");
+}
+
+bool igt_vc4_get_load_tracker(int debugfs)
+{
+	bool enabled;
+	char *load_tracker = igt_sysfs_get(debugfs, VC4_LOAD_TRACKER_DEBUGFS);
+
+	igt_assert(load_tracker);
+
+	enabled = (load_tracker[0] == 'Y');
+	free(load_tracker);
+
+	return enabled;
+}
diff --git a/lib/igt_vc4.h b/lib/igt_vc4.h
index ebc8a3881b5e..0f7dba6b25e6 100644
--- a/lib/igt_vc4.h
+++ b/lib/igt_vc4.h
@@ -24,6 +24,9 @@
 #ifndef IGT_VC4_H
 #define IGT_VC4_H
 
+#define VC4_LOAD_TRACKER_DEBUGFS	"hvs_load_tracker"
+#define VC4_UNDERRUN_DEBUGFS		"hvs_underrun"
+
 uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval);
 int igt_vc4_create_bo(int fd, size_t size);
 void *igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot);
@@ -32,5 +35,8 @@ bool igt_vc4_purgeable_bo(int fd, int handle, bool purgeable);
 
 void igt_vc4_set_tiling(int fd, uint32_t handle, uint64_t modifier);
 uint64_t igt_vc4_get_tiling(int fd, uint32_t handle);
+int igt_vc4_get_underrun_count(int debugfs);
+void igt_vc4_set_load_tracker(int debugfs, bool enable);
+bool igt_vc4_get_load_tracker(int debugfs);
 
 #endif /* IGT_VC4_H */
-- 
2.20.1

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

  parent reply	other threads:[~2019-02-06 15:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-06 15:00 [igt-dev] [PATCH i-g-t RFC v2 0/4] VC4 load tracker testing Paul Kocialkowski
2019-02-06 15:00 ` [igt-dev] [PATCH i-g-t RFC v2 1/4] lib/igt_kms: Add helpers to count and iterate planes from pipe Paul Kocialkowski
2019-02-06 15:00 ` [igt-dev] [PATCH i-g-t RFC v2 2/4] lib/igt_kms: Add helpers to count and iterate planes from output Paul Kocialkowski
2019-02-06 15:00 ` Paul Kocialkowski [this message]
2019-02-06 15:00 ` [igt-dev] [PATCH i-g-t RFC v2 4/4] tests: Add VC4 load tracker tests Paul Kocialkowski
2019-02-06 16:07 ` [igt-dev] ✓ Fi.CI.BAT: success for VC4 load tracker testing (rev3) Patchwork
2019-02-06 16:59 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20190206150059.24679-4-paul.kocialkowski@bootlin.com \
    --to=paul.kocialkowski@bootlin.com \
    --cc=eben@raspberrypi.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=thomas.petazzoni@bootlin.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