[igt-dev] [PATCH i-g-t 1/2] lib/panfrost: Add a utility to madvise a buffer
Neil Roberts
nroberts at igalia.com
Fri Mar 5 11:12:45 UTC 2021
Signed-off-by: Neil Roberts <nroberts at igalia.com>
---
lib/igt_panfrost.c | 12 ++++++++++++
lib/igt_panfrost.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/lib/igt_panfrost.c b/lib/igt_panfrost.c
index 8b0c2b77..ffce66a2 100644
--- a/lib/igt_panfrost.c
+++ b/lib/igt_panfrost.c
@@ -127,6 +127,18 @@ void igt_panfrost_bo_mmap(int fd, struct panfrost_bo *bo)
igt_assert(bo->map);
}
+bool igt_panfrost_bo_madvise(int fd, struct panfrost_bo *bo, uint32_t madv)
+{
+ struct drm_panfrost_madvise madvise = {
+ .handle = bo->handle,
+ .madv = madv,
+ };
+
+ do_ioctl(fd, DRM_IOCTL_PANFROST_MADVISE, &madvise);
+
+ return madvise.retained;
+}
+
struct panfrost_submit *igt_panfrost_trivial_job(int fd, bool do_crash, int width, int height, uint32_t color)
{
struct panfrost_submit *submit;
diff --git a/lib/igt_panfrost.h b/lib/igt_panfrost.h
index cc7998dc..df326a6c 100644
--- a/lib/igt_panfrost.h
+++ b/lib/igt_panfrost.h
@@ -56,5 +56,6 @@ uint32_t igt_panfrost_get_param(int fd, int param);
void *igt_panfrost_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot);
void igt_panfrost_bo_mmap(int fd, struct panfrost_bo *bo);
+bool igt_panfrost_bo_madvise(int fd, struct panfrost_bo *bo, uint32_t madv);
#endif /* IGT_PANFROST_H */
--
2.29.2
More information about the igt-dev
mailing list