summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2015-08-14 14:04:54 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2015-08-14 14:07:43 +0100
commit8af62be2ada2d4a2c618a48548f4248ef397582f (patch)
treebe92c84a85e2ea2a7f9ede659c2156703075d5bf /lib
parent5c07135b7bd23ce0beae67cfd8a71ac63f543859 (diff)
lib: Allow caller to use uint64_t sizes with intel_require_memory()
Allow the caller to ask how many extra large objects can be created and still fit into memory. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_aux.h3
-rw-r--r--lib/intel_os.c8
2 files changed, 5 insertions, 6 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 2979314a..95028665 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -86,11 +86,10 @@ uint64_t intel_get_avail_ram_mb(void);
uint64_t intel_get_total_ram_mb(void);
uint64_t intel_get_total_swap_mb(void);
-void intel_require_memory(uint32_t count, uint32_t size, unsigned mode);
+void intel_require_memory(uint32_t count, uint64_t size, unsigned mode);
#define CHECK_RAM 0x1
#define CHECK_SWAP 0x2
-
#define min(a, b) ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
diff --git a/lib/intel_os.c b/lib/intel_os.c
index f570d2c4..06361f4c 100644
--- a/lib/intel_os.c
+++ b/lib/intel_os.c
@@ -215,7 +215,7 @@ intel_get_total_swap_mb(void)
* assumption that any test that needs to check for memory requirements is a
* thrashing test unsuitable for slow simulated systems.
*/
-void intel_require_memory(uint32_t count, uint32_t size, unsigned mode)
+void intel_require_memory(uint32_t count, uint64_t size, unsigned mode)
{
/* rough estimate of how many bytes the kernel requires to track each object */
#define KERNEL_BO_OVERHEAD 512
@@ -225,8 +225,8 @@ void intel_require_memory(uint32_t count, uint32_t size, unsigned mode)
required *= size + KERNEL_BO_OVERHEAD;
required = ALIGN(required, 4096);
- igt_debug("Checking %u surfaces of size %u bytes (total %llu) against %s%s\n",
- count, size, (long long)required,
+ igt_debug("Checking %'u surfaces of size %'llu bytes (total %'llu) against %s%s\n",
+ count, (long long)size, (long long)required,
mode & (CHECK_RAM | CHECK_SWAP) ? "RAM" : "",
mode & CHECK_SWAP ? " + swap": "");
@@ -238,7 +238,7 @@ void intel_require_memory(uint32_t count, uint32_t size, unsigned mode)
total *= 1024 * 1024;
igt_skip_on_f(total <= required,
- "Estimated that we need %llu bytes for the test, but only have %llu bytes available (%s%s)\n",
+ "Estimated that we need %'llu bytes for the test, but only have %'llu bytes available (%s%s)\n",
(long long)required, (long long)total,
mode & (CHECK_RAM | CHECK_SWAP) ? "RAM" : "",
mode & CHECK_SWAP ? " + swap": "");