summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaíra Canal <mcanal@igalia.com>2022-11-11 17:56:13 -0300
committerMaíra Canal <mcanal@igalia.com>2022-12-19 08:58:21 -0300
commit39f66d51fc9fd3daafab646a64585eedb956f55b (patch)
tree5098cdff6846f232c4d50c1b5ff2231bd302ca41
parent97cbed3d8b22a549a86955df0670513b9bcba564 (diff)
lib/igt_vc4: Add PAGE_SIZE macro to VC4
Some VC4 tests use the page memory size, so create a macro to define the page size as 4096 and replace this value for the macro in the VC4 tests. Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Melissa Wen <mwen@igalia.com>
-rw-r--r--lib/igt_vc4.h2
-rw-r--r--tests/vc4/vc4_create_bo.c4
-rw-r--r--tests/vc4/vc4_label_bo.c6
-rw-r--r--tests/vc4/vc4_lookup_fail.c4
-rw-r--r--tests/vc4/vc4_tiling.c12
-rw-r--r--tests/vc4/vc4_wait_bo.c4
6 files changed, 17 insertions, 15 deletions
diff --git a/lib/igt_vc4.h b/lib/igt_vc4.h
index a088d0a36..ddce90daa 100644
--- a/lib/igt_vc4.h
+++ b/lib/igt_vc4.h
@@ -26,6 +26,8 @@
#include "vc4_drm.h"
+#define PAGE_SIZE 4096
+
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);
diff --git a/tests/vc4/vc4_create_bo.c b/tests/vc4/vc4_create_bo.c
index 46d1c9541..c4909b494 100644
--- a/tests/vc4/vc4_create_bo.c
+++ b/tests/vc4/vc4_create_bo.c
@@ -33,7 +33,7 @@ igt_main
}
igt_subtest("create-bo-4096") {
- int handle = igt_vc4_create_bo(fd, 4096);
+ int handle = igt_vc4_create_bo(fd, PAGE_SIZE);
gem_close(fd, handle);
}
@@ -52,7 +52,7 @@ igt_main
* to convince it to land as the only one of its size in the
* kernel BO cache
*/
- size_t size = 3 * 4096, i;
+ size_t size = 3 * PAGE_SIZE, i;
/* Make a BO and free it on our main fd. */
handle = igt_vc4_create_bo(fd, size);
diff --git a/tests/vc4/vc4_label_bo.c b/tests/vc4/vc4_label_bo.c
index 6fc53ce8b..dd8b5f9ac 100644
--- a/tests/vc4/vc4_label_bo.c
+++ b/tests/vc4/vc4_label_bo.c
@@ -47,7 +47,7 @@ igt_main
fd = drm_open_driver(DRIVER_VC4);
igt_subtest("set-label") {
- int handle = igt_vc4_create_bo(fd, 4096);
+ int handle = igt_vc4_create_bo(fd, PAGE_SIZE);
set_label(fd, handle, "a test label", 0);
set_label(fd, handle, "a new test label", 0);
gem_close(fd, handle);
@@ -58,7 +58,7 @@ igt_main
}
igt_subtest("set-bad-name") {
- int handle = igt_vc4_create_bo(fd, 4096);
+ int handle = igt_vc4_create_bo(fd, PAGE_SIZE);
struct drm_vc4_label_bo label = {
.handle = handle,
@@ -72,7 +72,7 @@ igt_main
}
igt_subtest("set-kernel-name") {
- int handle = igt_vc4_create_bo(fd, 4096);
+ int handle = igt_vc4_create_bo(fd, PAGE_SIZE);
set_label(fd, handle, "BCL", 0);
set_label(fd, handle, "a test label", 0);
set_label(fd, handle, "BCL", 0);
diff --git a/tests/vc4/vc4_lookup_fail.c b/tests/vc4/vc4_lookup_fail.c
index e5a03540f..5e709a7d3 100644
--- a/tests/vc4/vc4_lookup_fail.c
+++ b/tests/vc4/vc4_lookup_fail.c
@@ -22,7 +22,7 @@
*/
#include "igt.h"
-#include "vc4_drm.h"
+#include "igt_vc4.h"
#include "vc4_packet.h"
igt_main
@@ -33,7 +33,7 @@ igt_main
fd = drm_open_driver(DRIVER_VC4);
igt_subtest("bad-color-write") {
- uint32_t size = 4096;
+ uint32_t size = PAGE_SIZE;
/* A single row will be a page. */
uint32_t width = 1024;
uint32_t height = size / (width * 4);
diff --git a/tests/vc4/vc4_tiling.c b/tests/vc4/vc4_tiling.c
index 0d37c8b1f..372b1fed8 100644
--- a/tests/vc4/vc4_tiling.c
+++ b/tests/vc4/vc4_tiling.c
@@ -47,7 +47,7 @@ igt_main
}
igt_subtest("get-bad-flags") {
- int bo = igt_vc4_create_bo(fd, 4096);
+ int bo = igt_vc4_create_bo(fd, PAGE_SIZE);
struct drm_vc4_get_tiling get = {
.handle = bo,
.flags = 0xd0d0d0d0,
@@ -57,7 +57,7 @@ igt_main
}
igt_subtest("set-bad-flags") {
- int bo = igt_vc4_create_bo(fd, 4096);
+ int bo = igt_vc4_create_bo(fd, PAGE_SIZE);
struct drm_vc4_set_tiling set = {
.handle = bo,
.flags = 0xd0d0d0d0,
@@ -68,7 +68,7 @@ igt_main
}
igt_subtest("get-bad-modifier") {
- int bo = igt_vc4_create_bo(fd, 4096);
+ int bo = igt_vc4_create_bo(fd, PAGE_SIZE);
struct drm_vc4_get_tiling get = {
.handle = bo,
.modifier = 0xd0d0d0d0,
@@ -78,7 +78,7 @@ igt_main
}
igt_subtest("set-bad-modifier") {
- int bo = igt_vc4_create_bo(fd, 4096);
+ int bo = igt_vc4_create_bo(fd, PAGE_SIZE);
struct drm_vc4_set_tiling set = {
.handle = bo,
.modifier = 0xd0d0d0d0,
@@ -88,7 +88,7 @@ igt_main
}
igt_subtest("set-get") {
- int bo = igt_vc4_create_bo(fd, 4096);
+ int bo = igt_vc4_create_bo(fd, PAGE_SIZE);
/* Default is untiled. */
igt_assert(igt_vc4_get_tiling(fd, bo) == DRM_FORMAT_MOD_LINEAR);
@@ -109,7 +109,7 @@ igt_main
/* Some size that probably nobody else is using, to
* encourage getting the same BO back from the cache.
*/
- int size = 91 * 4096;
+ int size = 91 * PAGE_SIZE;
int bo;
bo = igt_vc4_create_bo(fd, size);
diff --git a/tests/vc4/vc4_wait_bo.c b/tests/vc4/vc4_wait_bo.c
index 8c7437f87..386642b9f 100644
--- a/tests/vc4/vc4_wait_bo.c
+++ b/tests/vc4/vc4_wait_bo.c
@@ -28,7 +28,7 @@
static void
test_used_bo(int fd, uint64_t timeout)
{
- size_t size = 4096;
+ size_t size = PAGE_SIZE;
uint32_t clearval = 0xaabbccdd + timeout;
int handle = igt_vc4_get_cleared_bo(fd, size, clearval);
struct drm_vc4_wait_bo wait = {
@@ -64,7 +64,7 @@ igt_main
igt_fixture {
fd = drm_open_driver(DRIVER_VC4);
- bo_handle = igt_vc4_create_bo(fd, 4096);
+ bo_handle = igt_vc4_create_bo(fd, PAGE_SIZE);
}
igt_subtest("bad-bo") {