dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Guido Günther" <agx@sigxcpu.org>
To: Lucas Stach <l.stach@pengutronix.de>,
	Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH libdrm] tests: Test mapping different caching types on etnaviv
Date: Fri, 14 Sep 2018 14:05:53 +0200	[thread overview]
Message-ID: <20180914120553.GA19648@bogon.m.sigxcpu.org> (raw)

This makes it simple to test if all cache types are mappable.

Signed-off-by: Guido Günther <guido.gunther@puri.sm>
---
Prompted by 

  https://lists.freedesktop.org/archives/etnaviv/2018-September/001946.html

 tests/etnaviv/etnaviv_bo_cache_test.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/etnaviv/etnaviv_bo_cache_test.c b/tests/etnaviv/etnaviv_bo_cache_test.c
index 7fb06293..0ad37e19 100644
--- a/tests/etnaviv/etnaviv_bo_cache_test.c
+++ b/tests/etnaviv/etnaviv_bo_cache_test.c
@@ -28,6 +28,7 @@
 #include <assert.h>
 
 #include <fcntl.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -78,6 +79,28 @@ static void test_size_rounding(struct etna_device *dev)
 	printf("ok\n");
 }
 
+
+static void test_write(struct etna_device *dev, uint32_t flags)
+{
+	struct etna_bo *bo;
+	uint32_t *buf;
+
+	/* allocate, map, write to, and free of a bo */
+	printf("testing bo map with flags 0x%"PRIx32"... ", flags);
+	fflush(stdout);
+
+	bo = etna_bo_new(dev, 0x100, flags);
+	assert(bo);
+	buf = etna_bo_map(bo);
+	assert(buf);
+	assert(!etna_bo_cpu_prep(bo, DRM_ETNA_PREP_WRITE));
+	memset(buf, 0, 0x100);
+	etna_bo_cpu_fini(bo);
+	etna_bo_del(bo);
+
+	printf("ok\n");
+}
+
 int main(int argc, char *argv[])
 {
 	struct etna_device *dev;
@@ -107,6 +130,9 @@ int main(int argc, char *argv[])
 
 	test_cache(dev);
 	test_size_rounding(dev);
+	test_write(dev, ETNA_BO_CACHED);
+	test_write(dev, ETNA_BO_WC);
+	test_write(dev, ETNA_BO_UNCACHED);
 
 	etna_device_del(dev);
 
-- 
2.18.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2018-09-14 12:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 12:05 Guido Günther [this message]
2018-10-04 13:20 ` [PATCH libdrm] tests: Test mapping different caching types on etnaviv Emil Velikov
2018-10-04 13:43   ` Lucas Stach
2018-10-04 14:53     ` Guido Günther

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=20180914120553.GA19648@bogon.m.sigxcpu.org \
    --to=agx@sigxcpu.org \
    --cc=christian.gmeiner@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=l.stach@pengutronix.de \
    /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