All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH igt 6/9] igt: Add a helper function for mapping VC4 BOs.
Date: Wed,  3 Feb 2016 13:41:40 -0800	[thread overview]
Message-ID: <1454535703-660-6-git-send-email-eric@anholt.net> (raw)
In-Reply-To: <1454535703-660-1-git-send-email-eric@anholt.net>

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 lib/igt_vc4.c | 20 ++++++++++++++++++++
 lib/igt_vc4.h |  1 +
 2 files changed, 21 insertions(+)

diff --git a/lib/igt_vc4.c b/lib/igt_vc4.c
index 62e1345..15804e9 100644
--- a/lib/igt_vc4.c
+++ b/lib/igt_vc4.c
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <signal.h>
 #include <errno.h>
+#include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
@@ -104,3 +105,22 @@ uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval)
 
 	return create.handle;
 }
+
+void *
+igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot)
+{
+	struct drm_vc4_mmap_bo mmap_bo = {
+		.handle = handle,
+	};
+	int ret;
+	void *ptr;
+
+	ret = ioctl(fd, DRM_IOCTL_VC4_MMAP_BO, &mmap_bo);
+	igt_assert(ret == 0);
+
+	ptr = mmap(0, size, prot, MAP_SHARED, fd, mmap_bo.offset);
+	if (ptr == MAP_FAILED)
+		return NULL;
+	else
+		return ptr;
+}
diff --git a/lib/igt_vc4.h b/lib/igt_vc4.h
index 4622034..d428f39 100644
--- a/lib/igt_vc4.h
+++ b/lib/igt_vc4.h
@@ -25,5 +25,6 @@
 #define IGT_VC4_H
 
 uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval);
+void *igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot);
 
 #endif /* IGT_VC4_H */
-- 
2.7.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-02-03 21:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 21:41 [PATCH igt 1/9] configure.ac: Test for libdrm_vc4 and build vc4 tests based on it Eric Anholt
2016-02-03 21:41 ` [PATCH igt 2/9] igt: Add support for DRIVER_VC4 flags on tests Eric Anholt
2016-02-03 21:41 ` [PATCH igt 3/9] igt/vc4_wait_seqno: Add a test for VC4's wait-for-seqno ioctl Eric Anholt
2016-02-03 21:41 ` [PATCH igt 4/9] igt/vc4_wait_bo: Add a test for VC4's wait-for-BO ioctl Eric Anholt
2016-02-04 15:22   ` Daniel Stone
2016-02-04 21:43     ` Eric Anholt
2016-02-03 21:41 ` [PATCH igt 5/9] igt: Add a helper function for getting a VC4 BO that's been drawn to Eric Anholt
2016-02-03 21:41 ` Eric Anholt [this message]
2016-02-03 21:41 ` [PATCH igt 7/9] igt: Add a helper function for creating VC4 BOs Eric Anholt
2016-02-03 21:41 ` [PATCH igt 8/9] igt/vc4_create_bo: Test various paths in BO creation Eric Anholt
2016-02-03 21:41 ` [PATCH igt 9/9] igt/vc4_wait_bo: Add tests with rendering performed Eric Anholt

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=1454535703-660-6-git-send-email-eric@anholt.net \
    --to=eric@anholt.net \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.