uint32_t size;
uint64_t offset;
void *map;
+ /* Whether the buffer has been positionned in the GTT already. */
+ bool gtt_mapped : 1;
/* Tracks userspace mmapping of the buffer */
bool user_mapped : 1;
/* Using the i915-gem mmapping ioctl & execbuffer ioctl, track whether a
bo->map = gem_mmap(fd, obj->handle, 0, bo->size);
fail_if(bo->map == MAP_FAILED, "bo mmap failed\n");
- if (aub_use_execlists(&aub_file))
+ if (aub_use_execlists(&aub_file) && !bo->gtt_mapped) {
aub_map_ppgtt(&aub_file, bo->offset, bo->size);
+ bo->gtt_mapped = true;
+ }
}
batch_index = (execbuffer2->flags & I915_EXEC_BATCH_FIRST) ? 0 :
bo->size = size;
bo->map = map;
bo->user_mapped = false;
+ bo->gtt_mapped = false;
}
static void
if (bo->map && !IS_USERPTR(bo->map))
munmap(bo->map, bo->size);
- bo->size = 0;
- bo->map = NULL;
- bo->user_mapped = false;
+ memset(bo, 0, sizeof(*bo));
}
__attribute__ ((visibility ("default"))) int