Skip to contentSkip to conversation

tests: Test mapping different caching types on etnaviv

PATCH In review Guido Günther 3 participants 4 messages Sep 14, 2018 – Oct 4, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests: Test mapping different caching types on etnaviv

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

---
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(+)
tests/etnaviv/etnaviv_bo_cache_test.c +26 -0
index 7fb06293..0ad37e19 100644
@@ -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);
 
Signature · 5 lines
2.18.0
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw

[adding etnaviv@ for bigger exposure]

Hi Guido,

Quoted 12 lines · Guido Günther

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

---
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(+)

Patch looks spot on, sadly my etnaviv knowledge is a bit limited.

Ideally one of the etna devs will double-check it, but from my POV

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Am Donnerstag, den 04.10.2018, 14:20 +0100 schrieb Emil Velikov:

Quoted 14 lines

[adding etnaviv@ for bigger exposure]

Hi Guido,

Quoted 10 lines · Guido Günther

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

Quoted 1 line
Quoted 1 line

---
Prompted by

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

Quoted 8 lines
Quoted 3 lines

 tests/etnaviv/etnaviv_bo_cache_test.c | 26 ++++++++++++++++++++++++++

 1 file changed, 26 insertions(+)

Patch looks spot on, sadly my etnaviv knowledge is a bit limited.

Ideally one of the etna devs will double-check it, but from my POV

Quoted 1 line

Nope, this test has nothing to do with the BO cache, which is a userspace buffer cache layer, while the caching modes map to how CPU accesses to the buffer mmap space are treated by the hardware.

So if we want to keep this test, it needs to be split into a separate test.

Regards,
Lucas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Hi,

Quoted 22 lines · Lucas Stach

Am Donnerstag, den 04.10.2018, 14:20 +0100 schrieb Emil Velikov:

Quoted 21 lines

[adding etnaviv@ for bigger exposure]

Hi Guido,

Quoted 13 lines · Guido Günther

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

Quoted 1 line
Quoted 1 line

---
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(+)

Patch looks spot on, sadly my etnaviv knowledge is a bit limited.

Ideally one of the etna devs will double-check it, but from my POV

Quoted 8 lines
Quoted 1 line
Quoted 1 line

Nope, this test has nothing to do with the BO cache, which is a userspace buffer cache layer, while the caching modes map to how CPU accesses to the buffer mmap space are treated by the hardware.

So if we want to keep this test, it needs to be split into a separate test.

After sending this I also realized that it would might be better suited for igt-gpu-tools. Would it fit in there? If so'd rework it and add it there.
Cheers,
-- Guido
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel