* Descriptor set layouts.
*/
-/* RENDER_SURFACE_STATE is a bit smaller (48b) but since it is aligned to 64
- * and we can't put anything else there we use 64b.
- */
-#define ANV_SURFACE_STATE_SIZE (64)
-
static enum anv_descriptor_data
anv_descriptor_data_for_type(const struct anv_physical_device *device,
VkDescriptorType type)
}
static uint32_t
-anv_surface_state_to_handle(struct anv_state state)
+anv_surface_state_to_handle(struct anv_physical_device *device,
+ struct anv_state state)
{
/* Bits 31:12 of the bindless surface offset in the extended message
* descriptor is bits 25:6 of the byte-based address.
*/
assert(state.offset >= 0);
uint32_t offset = state.offset;
- assert((offset & 0x3f) == 0 && offset < (1 << 26));
- return offset << 6;
+ if (device->uses_ex_bso) {
+ assert((offset & 0x3f) == 0);
+ return offset;
+ } else {
+ assert((offset & 0x3f) == 0 && offset < (1 << 26));
+ return offset << 6;
+ }
}
void
(desc->layout == VK_IMAGE_LAYOUT_GENERAL) ?
image_view->planes[p].general_sampler_surface_state :
image_view->planes[p].optimal_sampler_surface_state;
- desc_data[p].image = anv_surface_state_to_handle(sstate.state);
+ desc_data[p].image =
+ anv_surface_state_to_handle(device->physical, sstate.state);
}
}
assert(image_view->n_planes == 1);
struct anv_storage_image_descriptor desc_data = {
.vanilla = anv_surface_state_to_handle(
- image_view->planes[0].storage_surface_state.state),
+ device->physical,
+ image_view->planes[0].storage_surface_state.state),
};
memcpy(desc_map, &desc_data, sizeof(desc_data));
}
if (data & ANV_DESCRIPTOR_SAMPLED_IMAGE) {
struct anv_sampled_image_descriptor desc_data = {
- .image = anv_surface_state_to_handle(buffer_view->surface_state),
+ .image = anv_surface_state_to_handle(
+ device->physical,
+ buffer_view->surface_state),
};
memcpy(desc_map, &desc_data, sizeof(desc_data));
}
if (data & ANV_DESCRIPTOR_STORAGE_IMAGE) {
struct anv_storage_image_descriptor desc_data = {
.vanilla = anv_surface_state_to_handle(
- buffer_view->storage_surface_state),
+ device->physical,
+ buffer_view->storage_surface_state),
};
memcpy(desc_map, &desc_data, sizeof(desc_data));
}
device->video_decode_enabled = debug_get_bool_option("ANV_VIDEO_DECODE", false);
+ device->uses_ex_bso = device->info.verx10 >= 125;
+
/* Check if we can read the GPU timestamp register from the CPU */
uint64_t u64_ignore;
device->has_reg_timestamp = intel_gem_read_render_timestamp(fd,
device->compiler->constant_buffer_0_is_relative = false;
device->compiler->supports_shader_constants = true;
device->compiler->indirect_ubos_use_sampler = device->info.ver < 12;
+ device->compiler->extended_bindless_surface_offset = device->uses_ex_bso;
isl_device_init(&device->isl_dev, &device->info);
* twice a bunch of times (or a bunch of null descriptors), we can safely
* advertise a larger limit here.
*/
- const unsigned max_bindless_views = 1 << 20;
+ const unsigned max_bindless_views =
+ anv_physical_device_bindless_heap_size(pdevice) / ANV_SURFACE_STATE_SIZE;
p->maxUpdateAfterBindDescriptorsInAllPools = max_bindless_views;
p->shaderUniformBufferArrayNonUniformIndexingNative = false;
p->shaderSampledImageArrayNonUniformIndexingNative = false;
#define MAX_VIEWS_FOR_PRIMITIVE_REPLICATION 16
#define MAX_SAMPLE_LOCATIONS 16
+/* RENDER_SURFACE_STATE is a bit smaller (48b) but since it is aligned to 64
+ * and we can't put anything else there we use 64b.
+ */
+#define ANV_SURFACE_STATE_SIZE (64)
+
/* From the Skylake PRM Vol. 7 "Binding Table Surface State Model":
*
* "The surface state model is used when a Binding Table Index (specified
/** True if we can create protected contexts. */
bool has_protected_contexts;
+ /**/
+ bool uses_ex_bso;
+
bool always_flush_cache;
/**
struct intel_measure_device measure_device;
};
+static inline uint32_t
+anv_physical_device_bindless_heap_size(const struct anv_physical_device *device)
+{
+ return device->uses_ex_bso ?
+ 128 * 1024 * 1024 /* 128 MiB */ :
+ 64 * 1024 * 1024 /* 64 MiB */;
+}
+
static inline bool
anv_physical_device_has_vram(const struct anv_physical_device *device)
{
sba.DynamicStateBufferSizeModifyEnable = true;
sba.InstructionBuffersizeModifyEnable = true;
sba.BindlessSurfaceStateBaseAddress =
- (struct anv_address) { device->bindless_surface_state_pool.block_pool.bo, 0 };
- sba.BindlessSurfaceStateSize = (1 << 20) - 1;
+ (struct anv_address) { .offset =
+ device->physical->va.bindless_surface_state_pool.addr,
+ };
+ sba.BindlessSurfaceStateSize =
+ anv_physical_device_bindless_heap_size(device->physical) / ANV_SURFACE_STATE_SIZE - 1;
sba.BindlessSurfaceStateMOCS = mocs;
sba.BindlessSurfaceStateBaseAddressModifyEnable = true;
#if GFX_VER >= 11
sba.BindlessSurfaceStateBaseAddress =
(struct anv_address) { .offset =
- device->physical->va.bindless_surface_state_pool.addr,
- };
- sba.BindlessSurfaceStateSize = (1 << 20) - 1;
+ device->physical->va.bindless_surface_state_pool.addr, };
+ sba.BindlessSurfaceStateSize =
+ anv_physical_device_bindless_heap_size(device->physical) / ANV_SURFACE_STATE_SIZE - 1;
sba.BindlessSurfaceStateMOCS = mocs;
sba.BindlessSurfaceStateBaseAddressModifyEnable = true;