129
anv_i915_physical_device_init_memory_types(struct anv_physical_device *device)
131
if (anv_physical_device_has_vram(device)) {
132
device->memory.type_count = 3;
133
device->memory.types[0] = (struct anv_memory_type) {
134
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
137
device->memory.types[1] = (struct anv_memory_type) {
138
.propertyFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
139
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
140
VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
143
device->memory.types[2] = (struct anv_memory_type) {
144
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
145
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
146
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
147
/* This memory type either comes from heaps[0] if there is only
148
* mappable vram region, or from heaps[2] if there is both mappable &
149
* non-mappable vram regions.
151
.heapIndex = device->vram_non_mappable.size > 0 ? 2 : 0,
153
} else if (device->info.has_llc) {
154
/* Big core GPUs share LLC with the CPU and thus one memory type can be
155
* both cached and coherent at the same time.
157
* But some game engines can't handle single type well
158
* https://gitlab.freedesktop.org/mesa/mesa/-/issues/7360#note_1719438
160
* The second memory type w/out HOST_CACHED_BIT will get write-combining.
161
* See anv_AllocateMemory()).
163
* The Intel Vulkan driver for Windows also advertises these memory types.
165
device->memory.type_count = 3;
166
device->memory.types[0] = (struct anv_memory_type) {
167
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
170
device->memory.types[1] = (struct anv_memory_type) {
171
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
172
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
173
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
176
device->memory.types[2] = (struct anv_memory_type) {
177
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
178
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
179
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT |
180
VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
184
/* The spec requires that we expose a host-visible, coherent memory
185
* type, but Atom GPUs don't share LLC. Thus we offer two memory types
186
* to give the application a choice between cached, but not coherent and
187
* coherent but uncached (WC though).
189
device->memory.type_count = 2;
190
device->memory.types[0] = (struct anv_memory_type) {
191
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
192
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
193
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
196
device->memory.types[1] = (struct anv_memory_type) {
197
.propertyFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
198
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
199
VK_MEMORY_PROPERTY_HOST_CACHED_BIT,
129
208
anv_i915_device_setup_context(struct anv_device *device,
130
209
const VkDeviceCreateInfo *pCreateInfo,
131
210
const uint32_t num_queues)
150
229
for (uint32_t j = 0; j < queueCreateInfo->queueCount; j++)
151
230
engine_classes[engine_count++] = queue_family->engine_class;
153
if (!intel_gem_create_context_engines(device->fd,
232
if (!intel_gem_create_context_engines(device->fd, 0 /* flags */,
154
233
physical_device->engine_info,
155
234
engine_count, engine_classes,
156
235
(uint32_t *)&device->context_id))