uint64_t gtt_size;
int available_fences;
int pci_device;
+ int gen;
char bo_reuse;
char fenced_relocs;
} drm_intel_bufmgr_gem;
return size;
/* 965+ just need multiples of page size for tiling */
- if (!IS_GEN2(bufmgr_gem) && !IS_GEN3(bufmgr_gem))
+ if (bufmgr_gem->gen >= 4)
return ROUND_UP_TO(size, 4096);
/* Older chips need powers of two, of at least 512k or 1M */
- if (!IS_GEN2(bufmgr_gem)) {
+ if (bufmgr_gem->gen == 2) {
min_size = 1024*1024;
max_size = 128*1024*1024;
} else {
return ROUND_UP_TO(pitch, tile_width);
/* 965 is flexible */
- if (!IS_GEN2(bufmgr_gem) && !IS_GEN3(bufmgr_gem))
+ if (bufmgr_gem->gen >= 4)
return ROUND_UP_TO(pitch, tile_width);
/* Pre-965 needs power of two tile width */
* aperture. Optimal packing is for wimps.
*/
size = bo_gem->bo.size;
- if ((IS_GEN2(bufmgr_gem) || IS_GEN3(bufmgr_gem))
- && bo_gem->tiling_mode != I915_TILING_NONE)
+ if (bufmgr_gem->gen < 4 && bo_gem->tiling_mode != I915_TILING_NONE)
size *= 2;
bo_gem->reloc_tree_size = size;
need_fence = 0;
/* We never use HW fences for rendering on 965+ */
- if (IS_GEN4(bufmgr_gem))
+ if (bufmgr_gem->gen >= 4)
need_fence = 0;
/* Create a new relocation list if needed */
*/
assert(!bo_gem->used_as_reloc_target);
bo_gem->reloc_tree_size += target_bo_gem->reloc_tree_size;
- /* An object needing a fence is a tiled buffer, and so it won't have
+ /* An object needing a fence is a tiled buffer, so it won't have
* relocs to other buffers.
*/
if (need_fence)
fprintf(stderr, "param: %d, val: %d\n", gp.param, *gp.value);
}
+ if (IS_GEN2(bufmgr_gem))
+ bufmgr_gem->gen = 2;
+ else if (IS_GEN3(bufmgr_gem))
+ bufmgr_gem->gen = 3;
+ else if (IS_GEN4(bufmgr_gem))
+ bufmgr_gem->gen = 4;
+ else
+ bufmgr_gem->gen = 6;
+
gp.param = I915_PARAM_HAS_EXECBUF2;
ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
if (!ret)
exec2 = 1;
- if (IS_GEN2(bufmgr_gem) || IS_GEN3(bufmgr_gem)) {
+ if (bufmgr_gem->gen < 4) {
gp.param = I915_PARAM_NUM_FENCES_AVAIL;
gp.value = &bufmgr_gem->available_fences;
ret = ioctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);