[PATCH i-g-t v2 2/3] igt: Add igt_vc4_get_param() helper

Boris Brezillon
2017-10-04T10:22:25Z

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
Changes in v2:
- New patch
---
lib/igt_vc4.c | 15 +++++++++++++++
lib/igt_vc4.h | 1 +
2 files changed, 16 insertions(+)

diff --git a/lib/igt_vc4.c b/lib/igt_vc4.c
index b75c063204ec..f98c16754c9c 100644
--- a/lib/igt_vc4.c
+++ b/lib/igt_vc4.c
@@ -129,6 +129,21 @@ igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot)
return ptr;
}

+int igt_vc4_get_param(int fd, uint32_t param, uint64_t *val)
+{
+ struct drm_vc4_get_param arg = {
+ .param = param,
+ };
+ int ret;
+
+ ret = igt_ioctl(fd, DRM_IOCTL_VC4_GET_PARAM, &arg);
+ if (ret)
+ return ret;
+
+ *val = arg.value;
+ return 0;
+}
+
bool igt_vc4_purgeable_bo(int fd, int handle, bool purgeable)
{
struct drm_vc4_gem_madvise arg = {
diff --git a/lib/igt_vc4.h b/lib/igt_vc4.h
index 9f0fc59910f6..df65017fe397 100644
--- a/lib/igt_vc4.h
+++ b/lib/igt_vc4.h
@@ -27,6 +27,7 @@
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);
+int igt_vc4_get_param(int fd, uint32_t param, uint64_t *val);
bool igt_vc4_purgeable_bo(int fd, int handle, bool purgeable);

#endif /* IGT_VC4_H */
--
2.11.0