diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-07-13 12:34:45 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-07-19 11:32:36 +0100 |
commit | 86f7b724ef18986bc58d35558d22e1ed3f8df4f9 (patch) | |
tree | d4f81c752eac621ab22cba23f9b1303732b12fb0 /tests/pm_rpm.c | |
parent | 7f85adc4050182f490c7a5c48db3d57cdb00af4e (diff) |
lib: Move trash_bos to their only user
Only pm_rpm still uses the igt_trash_aperture() and so we can remove it
from the lib and in the process convert it over from the legacy
libdrm_intel.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
Diffstat (limited to 'tests/pm_rpm.c')
-rw-r--r-- | tests/pm_rpm.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index 1f2647be..4268bb19 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -1295,25 +1295,36 @@ static void gem_idle_subtest(void) static void gem_evict_pwrite_subtest(void) { - static drm_intel_bufmgr *bufmgr; + struct { + uint32_t handle; + uint32_t *ptr; + } *trash_bos; + unsigned int num_trash_bos, n; uint32_t buf; - int i; - bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096); - igt_assert(bufmgr); - igt_init_aperture_trashers(bufmgr); + num_trash_bos = gem_mappable_aperture_size() / (1024*1024) + 1; + trash_bos = malloc(num_trash_bos * sizeof(*trash_bos)); + igt_assert(trash_bos); - igt_trash_aperture(); + for (n = 0; n < num_trash_bos; n++) { + trash_bos[n].handle = gem_create(drm_fd, 1024*1024); + trash_bos[n].ptr = gem_mmap__gtt(drm_fd, trash_bos[n].handle, + 1024*1024, PROT_WRITE); + *trash_bos[n].ptr = 0; + } disable_or_dpms_all_screens_and_wait(&ms_data, true); igt_assert(wait_for_suspended()); buf = 0; - for (i = 0; i < num_trash_bos; i++) - gem_write(drm_fd, trash_bos[i]->handle, 0, &buf, sizeof(buf)); + for (n = 0; n < num_trash_bos; n++) + gem_write(drm_fd, trash_bos[n].handle, 0, &buf, sizeof(buf)); - igt_cleanup_aperture_trashers(); - drm_intel_bufmgr_destroy(bufmgr); + for (n = 0; n < num_trash_bos; n++) { + munmap(trash_bos[n].ptr, 1024*1024); + gem_close(drm_fd, trash_bos[n].handle); + } + free(trash_bos); } /* This also triggered WARNs on dmesg at some point. */ |