diff options
author | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2021-09-28 11:47:05 -0700 |
---|---|---|
committer | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2021-09-29 08:13:49 -0700 |
commit | 22643ce4014a0b2dc52ce7916b2f657e2a7757c3 (patch) | |
tree | 18766ccd6af6d4b3d095419d375b01066aec0584 /tests | |
parent | 6ac2da7fd6b13f04f9aa0ec10f86b831d2756946 (diff) |
Return allocated size in gem_create_in_memory_regions() and friends
Often the allocated size is of interest and is different from the
requested size. Therefore return allocated size for the object (by
__gem_create_ext()) in gem_create_in_memory_regions() and friends.
v2: Assign buf->size correctly in __intel_buf_init (Zbigniew)
Cc: Andrzej Turko <andrzej.turko@linux.intel.com>
Cc: Zbigniew Kempczynski <zbigniew.kempczynski@intel.com>
Cc: John Harrison <John.C.Harrison@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Reviewed-by: Zbigniew KempczyĆski <zbigniew.kempczynski@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/i915/gem_exec_basic.c | 6 | ||||
-rw-r--r-- | tests/i915/gem_gpgpu_fill.c | 3 | ||||
-rw-r--r-- | tests/i915/gem_media_fill.c | 3 | ||||
-rw-r--r-- | tests/kms_addfb_basic.c | 2 | ||||
-rw-r--r-- | tests/kms_prime.c | 4 |
5 files changed, 10 insertions, 8 deletions
diff --git a/tests/i915/gem_exec_basic.c b/tests/i915/gem_exec_basic.c index 008a35d0..04e2209c 100644 --- a/tests/i915/gem_exec_basic.c +++ b/tests/i915/gem_exec_basic.c @@ -28,12 +28,12 @@ IGT_TEST_DESCRIPTION("Basic sanity check of execbuf-ioctl rings."); -static uint32_t batch_create(int fd, uint32_t batch_size, uint32_t region) +static uint32_t batch_create(int fd, uint64_t batch_size, uint32_t region) { const uint32_t bbe = MI_BATCH_BUFFER_END; uint32_t handle; - handle = gem_create_in_memory_regions(fd, batch_size, region); + handle = gem_create_in_memory_regions(fd, &batch_size, region); gem_write(fd, handle, 0, &bbe, sizeof(bbe)); return handle; @@ -44,7 +44,7 @@ igt_main const struct intel_execution_engine2 *e; struct drm_i915_query_memory_regions *query_info; struct igt_collection *regions, *set; - uint32_t batch_size; + uint64_t batch_size; const intel_ctx_t *ctx; int fd = -1; diff --git a/tests/i915/gem_gpgpu_fill.c b/tests/i915/gem_gpgpu_fill.c index 74a227f6..76f4d7c6 100644 --- a/tests/i915/gem_gpgpu_fill.c +++ b/tests/i915/gem_gpgpu_fill.c @@ -68,6 +68,7 @@ create_buf(data_t *data, int width, int height, uint8_t color, uint32_t region) struct intel_buf *buf; uint8_t *ptr; uint32_t handle; + uint64_t size = SIZE; int i; buf = calloc(1, sizeof(*buf)); @@ -77,7 +78,7 @@ create_buf(data_t *data, int width, int height, uint8_t color, uint32_t region) * Legacy code uses 32 bpp after buffer creation. * Let's do the same due to keep shader intact. */ - handle = gem_create_in_memory_regions(data->drm_fd, SIZE, region); + handle = gem_create_in_memory_regions(data->drm_fd, &size, region); intel_buf_init_using_handle(data->bops, handle, buf, width/4, height, 32, 0, I915_TILING_NONE, 0); diff --git a/tests/i915/gem_media_fill.c b/tests/i915/gem_media_fill.c index 1d08df24..3d7d6fa2 100644 --- a/tests/i915/gem_media_fill.c +++ b/tests/i915/gem_media_fill.c @@ -69,12 +69,13 @@ create_buf(data_t *data, int width, int height, uint8_t color, uint32_t region) struct intel_buf *buf; uint32_t handle; uint8_t *ptr; + uint64_t size = SIZE; int i; buf = calloc(1, sizeof(*buf)); igt_assert(buf); - handle = gem_create_in_memory_regions(data->drm_fd, SIZE, region); + handle = gem_create_in_memory_regions(data->drm_fd, &size, region); /* * Legacy code uses 32 bpp after buffer creation. diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c index 55f4852d..62fa78a5 100644 --- a/tests/kms_addfb_basic.c +++ b/tests/kms_addfb_basic.c @@ -158,7 +158,7 @@ static void invalid_tests(int fd) igt_require(gem_has_lmem(fd)); igt_calc_fb_size(fd, f.width, f.height, DRM_FORMAT_XRGB8888, 0, &size, &stride); - handle = gem_create_in_memory_regions(fd, size, REGION_SMEM); + handle = gem_create_in_memory_regions(fd, &size, REGION_SMEM); f.handles[0] = handle; do_ioctl_err(fd, DRM_IOCTL_MODE_ADDFB2, &f, EREMOTE); } diff --git a/tests/kms_prime.c b/tests/kms_prime.c index 5cdb5597..ea459414 100644 --- a/tests/kms_prime.c +++ b/tests/kms_prime.c @@ -112,10 +112,10 @@ static void prepare_scratch(int exporter_fd, struct dumb_bo *scratch, igt_calc_fb_size(exporter_fd, mode->hdisplay, mode->vdisplay, DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_NONE, &scratch->size, &scratch->pitch); if (gem_has_lmem(exporter_fd)) - scratch->handle = gem_create_in_memory_regions(exporter_fd, scratch->size, + scratch->handle = gem_create_in_memory_regions(exporter_fd, &scratch->size, REGION_LMEM(0), REGION_SMEM); else - scratch->handle = gem_create_in_memory_regions(exporter_fd, scratch->size, + scratch->handle = gem_create_in_memory_regions(exporter_fd, &scratch->size, REGION_SMEM); ptr = gem_mmap__device_coherent(exporter_fd, scratch->handle, 0, scratch->size, |