mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-21 21:32:56 +00:00
Exercise the whole aperture with tiled blits
After full-gtt, gem_tiled_blits doesn't allocate enough to force eviction. So query the total aperture and accommodate. Also introduce a similar test that utilizes fences rather than use the BLT to perform the tiling and detiling. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
+24
-13
@@ -61,6 +61,16 @@ static drm_intel_bufmgr *bufmgr;
|
||||
struct intel_batchbuffer *batch;
|
||||
static int width = 512, height = 512;
|
||||
|
||||
static uint64_t
|
||||
gem_aperture_size(int fd)
|
||||
{
|
||||
struct drm_i915_gem_get_aperture aperture;
|
||||
|
||||
aperture.aper_size = 512*1024*1024;
|
||||
(void)drmIoctl(fd, DRM_IOCTL_I915_GEM_GET_APERTURE, &aperture);
|
||||
return aperture.aper_size;
|
||||
}
|
||||
|
||||
static drm_intel_bo *
|
||||
create_bo(uint32_t start_val)
|
||||
{
|
||||
@@ -79,10 +89,8 @@ create_bo(uint32_t start_val)
|
||||
/* Fill the BO with dwords starting at start_val */
|
||||
drm_intel_bo_map(linear_bo, 1);
|
||||
linear = linear_bo->virtual;
|
||||
|
||||
for (i = 0; i < 1024 * 1024 / 4; i++) {
|
||||
for (i = 0; i < 1024 * 1024 / 4; i++)
|
||||
linear[i] = start_val++;
|
||||
}
|
||||
drm_intel_bo_unmap(linear_bo);
|
||||
|
||||
intel_copy_bo (batch, bo, linear_bo, width, height);
|
||||
@@ -122,20 +130,23 @@ check_bo(drm_intel_bo *bo, uint32_t start_val)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
int bo_count = 768; /* 768MB of objects */
|
||||
drm_intel_bo *bo[bo_count];
|
||||
uint32_t bo_start_val[bo_count];
|
||||
drm_intel_bo *bo[4096];
|
||||
uint32_t bo_start_val[4096];
|
||||
uint32_t start = 0;
|
||||
int i;
|
||||
int i, fd, count;
|
||||
|
||||
fd = drm_open_any();
|
||||
|
||||
count = 3 * gem_aperture_size(fd) / (1024*1024) / 2;
|
||||
count += (count & 1) == 0;
|
||||
printf("Using %d 1MiB buffers\n", count);
|
||||
assert(count <= 4096);
|
||||
|
||||
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
|
||||
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
|
||||
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
|
||||
|
||||
for (i = 0; i < bo_count; i++) {
|
||||
for (i = 0; i < count; i++) {
|
||||
bo[i] = create_bo(start);
|
||||
bo_start_val[i] = start;
|
||||
|
||||
@@ -147,9 +158,9 @@ int main(int argc, char **argv)
|
||||
start += 1024 * 1024 / 4;
|
||||
}
|
||||
|
||||
for (i = 0; i < bo_count * 4; i++) {
|
||||
int src = random() % bo_count;
|
||||
int dst = random() % bo_count;
|
||||
for (i = 0; i < count * 4; i++) {
|
||||
int src = random() % count;
|
||||
int dst = random() % count;
|
||||
|
||||
if (src == dst)
|
||||
continue;
|
||||
@@ -163,7 +174,7 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
}
|
||||
|
||||
for (i = 0; i < bo_count; i++) {
|
||||
for (i = 0; i < count; i++) {
|
||||
/*
|
||||
printf("check %d\n", i);
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user