#include "util/timespec.h"
#include "util/u_atomic.h"
#include "compiler/glsl_types.h"
-#include "util/xmlpool.h"
+#include "util/driconf.h"
static struct radv_timeline_point *
radv_timeline_find_point_at_least_locked(struct radv_device *device,
static const char *
radv_get_compiler_string(struct radv_physical_device *pdevice)
{
- if (pdevice->use_aco) {
+ if (!pdevice->use_llvm) {
/* Some games like SotTR apply shader workarounds if the LLVM
* version is too old or if the LLVM version string is
* missing. This gives 2-5% performance with SotTR and ACO.
device->local_fd = fd;
device->ws->query_info(device->ws, &device->rad_info);
- device->use_aco = instance->perftest_flags & RADV_PERFTEST_ACO;
+ device->use_llvm = instance->debug_flags & RADV_DEBUG_LLVM;
snprintf(device->name, sizeof(device->name),
"AMD RADV %s (%s)",
}
/* These flags affect shader compilation. */
- uint64_t shader_env_flags = (device->use_aco ? 0x2 : 0);
+ uint64_t shader_env_flags = (device->use_llvm ? 0 : 0x2);
/* The gpu id is already embedded in the uuid so we just pass "radv"
* when creating the cache.
disk_cache_format_hex_id(buf, device->cache_uuid, VK_UUID_SIZE * 2);
device->disk_cache = disk_cache_create(device->name, buf, shader_env_flags);
- if (device->rad_info.chip_class < GFX8)
+ if (device->rad_info.chip_class < GFX8 || !device->use_llvm)
fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
radv_get_driver_uuid(&device->driver_uuid);
device->dcc_msaa_allowed =
(device->instance->perftest_flags & RADV_PERFTEST_DCC_MSAA);
- device->use_shader_ballot = (device->use_aco && device->rad_info.chip_class >= GFX8) ||
- (device->instance->perftest_flags & RADV_PERFTEST_SHADER_BALLOT);
-
device->use_ngg = device->rad_info.chip_class >= GFX10 &&
device->rad_info.family != CHIP_NAVI14 &&
!(device->instance->debug_flags & RADV_DEBUG_NO_NGG);
/* TODO: Implement NGG GS with ACO. */
- device->use_ngg_gs = device->use_ngg && !device->use_aco;
+ device->use_ngg_gs = device->use_ngg && device->use_llvm;
device->use_ngg_streamout = false;
/* Determine the number of threads per wave for all stages. */
{"checkir", RADV_DEBUG_CHECKIR},
{"nothreadllvm", RADV_DEBUG_NOTHREADLLVM},
{"nobinning", RADV_DEBUG_NOBINNING},
- {"noloadstoreopt", RADV_DEBUG_NO_LOAD_STORE_OPT},
{"nongg", RADV_DEBUG_NO_NGG},
- {"noshaderballot", RADV_DEBUG_NO_SHADER_BALLOT},
{"allentrypoints", RADV_DEBUG_ALL_ENTRYPOINTS},
{"metashaders", RADV_DEBUG_DUMP_META_SHADERS},
{"nomemorycache", RADV_DEBUG_NO_MEMORY_CACHE},
+ {"llvm", RADV_DEBUG_LLVM},
{NULL, 0}
};
{"localbos", RADV_PERFTEST_LOCAL_BOS},
{"dccmsaa", RADV_PERFTEST_DCC_MSAA},
{"bolist", RADV_PERFTEST_BO_LIST},
- {"shader_ballot", RADV_PERFTEST_SHADER_BALLOT},
{"tccompatcmask", RADV_PERFTEST_TC_COMPAT_CMASK},
{"cswave32", RADV_PERFTEST_CS_WAVE_32},
{"pswave32", RADV_PERFTEST_PS_WAVE_32},
{"gewave32", RADV_PERFTEST_GE_WAVE_32},
{"dfsm", RADV_PERFTEST_DFSM},
- {"aco", RADV_PERFTEST_ACO},
{NULL, 0}
};
if (!strcmp(name, "DOOM_VFR")) {
/* Work around a Doom VFR game bug */
instance->debug_flags |= RADV_DEBUG_NO_DYNAMIC_BOUNDS;
- } else if (!strcmp(name, "MonsterHunterWorld.exe")) {
- /* Workaround for a WaW hazard when LLVM moves/merges
- * load/store memory operations.
- * See https://reviews.llvm.org/D61313
- */
- if (LLVM_VERSION_MAJOR < 9)
- instance->debug_flags |= RADV_DEBUG_NO_LOAD_STORE_OPT;
- } else if (!strcmp(name, "Wolfenstein: Youngblood")) {
- if (!(instance->debug_flags & RADV_DEBUG_NO_SHADER_BALLOT) &&
- !(instance->perftest_flags & RADV_PERFTEST_ACO)) {
- /* Force enable VK_AMD_shader_ballot because it looks
- * safe and it gives a nice boost (+20% on Vega 56 at
- * this time). It also prevents corruption on LLVM.
- */
- instance->perftest_flags |= RADV_PERFTEST_SHADER_BALLOT;
- }
} else if (!strcmp(name, "Fledge")) {
/*
* Zero VRAM for "The Surge 2"
} else if (!strcmp(name, "DOOMEternal")) {
/* Zero VRAM for Doom Eternal to fix rendering issues. */
instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
+ } else if (!strcmp(name, "Red Dead Redemption 2")) {
+ /* Work around a RDR2 game bug */
+ instance->debug_flags |= RADV_DEBUG_DISCARD_TO_DEMOTE;
}
}
* rendering issues.
*/
instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
+ } else if (!strcmp(engine_name, "Quantic Dream Engine")) {
+ /* Fix various artifacts in Detroit: Become Human */
+ instance->debug_flags |= RADV_DEBUG_ZERO_VRAM;
}
}
+
+ instance->enable_mrt_output_nan_fixup =
+ driQueryOptionb(&instance->dri_options,
+ "radv_enable_mrt_output_nan_fixup");
+
+ if (driQueryOptionb(&instance->dri_options, "radv_no_dynamic_bounds"))
+ instance->debug_flags |= RADV_DEBUG_NO_DYNAMIC_BOUNDS;
}
static const char radv_dri_options_xml[] =
DRI_CONF_ADAPTIVE_SYNC("true")
DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(0)
DRI_CONF_VK_X11_STRICT_IMAGE_COUNT("false")
+ DRI_CONF_VK_X11_ENSURE_MIN_IMAGE_COUNT("false")
DRI_CONF_RADV_REPORT_LLVM9_VERSION_STRING("false")
+ DRI_CONF_RADV_ENABLE_MRT_OUTPUT_NAN_FIXUP("false")
+ DRI_CONF_RADV_NO_DYNAMIC_BOUNDS("false")
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
instance->perftest_flags = parse_debug_string(getenv("RADV_PERFTEST"),
radv_perftest_options);
- if (instance->perftest_flags & RADV_PERFTEST_ACO)
- fprintf(stderr, "WARNING: Experimental compiler backend enabled. Here be dragons! Incorrect rendering, GPU hangs and/or resets are likely\n");
-
if (instance->debug_flags & RADV_DEBUG_STARTUP)
radv_logi("Created an instance");
.shaderCullDistance = true,
.shaderFloat64 = true,
.shaderInt64 = true,
- .shaderInt16 = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8,
+ .shaderInt16 = true,
.sparseBinding = true,
.variableMultisampleRate = true,
.shaderResourceMinLod = true,
{
assert(f->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES);
- f->storageBuffer16BitAccess = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- f->uniformAndStorageBuffer16BitAccess = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- f->storagePushConstant16 = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- f->storageInputOutput16 = pdevice->rad_info.has_packed_math_16bit && (LLVM_VERSION_MAJOR >= 9 || pdevice->use_aco);
+ f->storageBuffer16BitAccess = true;
+ f->uniformAndStorageBuffer16BitAccess = true;
+ f->storagePushConstant16 = true;
+ f->storageInputOutput16 = pdevice->rad_info.has_packed_math_16bit && (LLVM_VERSION_MAJOR >= 9 || !pdevice->use_llvm);
f->multiview = true;
f->multiviewGeometryShader = true;
f->multiviewTessellationShader = true;
f->samplerMirrorClampToEdge = true;
f->drawIndirectCount = true;
- f->storageBuffer8BitAccess = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- f->uniformAndStorageBuffer8BitAccess = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- f->storagePushConstant8 = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
- f->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9 || pdevice->use_aco;
- f->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9 || pdevice->use_aco;
- f->shaderFloat16 = pdevice->rad_info.has_packed_math_16bit && !pdevice->use_aco;
- f->shaderInt8 = !pdevice->use_aco || pdevice->rad_info.chip_class >= GFX8;
+ f->storageBuffer8BitAccess = true;
+ f->uniformAndStorageBuffer8BitAccess = true;
+ f->storagePushConstant8 = true;
+ f->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9 || !pdevice->use_llvm;
+ f->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9 || !pdevice->use_llvm;
+ f->shaderFloat16 = pdevice->rad_info.has_packed_math_16bit;
+ f->shaderInt8 = true;
f->descriptorIndexing = true;
f->shaderInputAttachmentArrayDynamicIndexing = true;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT: {
VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT *features =
(VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT *)ext;
- features->shaderDemoteToHelperInvocation = pdevice->use_aco;
+ features->shaderDemoteToHelperInvocation = LLVM_VERSION_MAJOR >= 9 || !pdevice->use_llvm;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT: {
.maxCullDistances = 8,
.maxCombinedClipAndCullDistances = 8,
.discreteQueuePriorities = 2,
- .pointSizeRange = { 0.0, 8192.0 },
- .lineWidthRange = { 0.0, 8192.0 },
+ .pointSizeRange = { 0.0, 8191.875 },
+ .lineWidthRange = { 0.0, 8191.875 },
.pointSizeGranularity = (1.0 / 8.0),
.lineWidthGranularity = (1.0 / 8.0),
.strictLines = false, /* FINISHME */
device->border_color_data.colors_gpu_ptr =
device->ws->buffer_map(device->border_color_data.bo);
+ if (!device->border_color_data.colors_gpu_ptr)
+ return vk_error(device->physical_device->instance, VK_ERROR_OUT_OF_DEVICE_MEMORY);
pthread_mutex_init(&device->border_color_data.mutex, NULL);
return VK_SUCCESS;
}
*max_offchip_buffers_p = max_offchip_buffers;
- if (device->physical_device->rad_info.chip_class >= GFX7) {
+ if (device->physical_device->rad_info.chip_class >= GFX10_3) {
+ hs_offchip_param = S_03093C_OFFCHIP_BUFFERING_GFX103(max_offchip_buffers - 1) |
+ S_03093C_OFFCHIP_GRANULARITY_GFX103(offchip_granularity);
+ } else if (device->physical_device->rad_info.chip_class >= GFX7) {
if (device->physical_device->rad_info.chip_class >= GFX8)
--max_offchip_buffers;
hs_offchip_param =
if (descriptor_bo != queue->descriptor_bo) {
uint32_t *map = (uint32_t*)queue->device->ws->buffer_map(descriptor_bo);
+ if (!map)
+ goto fail;
if (scratch_bo) {
uint64_t scratch_va = radv_buffer_get_va(scratch_bo);
RADV_CMD_FLAG_START_PIPELINE_STATS, 0);
}
- if (!queue->device->ws->cs_finalize(cs))
+ if (queue->device->ws->cs_finalize(cs) != VK_SUCCESS)
goto fail;
}
}
pthread_mutex_unlock(&queue->pending_mutex);
- queue->device->ws->ctx_wait_idle(queue->hw_ctx,
- radv_queue_family_to_ring(queue->queue_family_index),
- queue->queue_idx);
+ if (!queue->device->ws->ctx_wait_idle(queue->hw_ctx,
+ radv_queue_family_to_ring(queue->queue_family_index),
+ queue->queue_idx))
+ return VK_ERROR_DEVICE_LOST;
+
return VK_SUCCESS;
}
for (unsigned i = 0; i < RADV_MAX_QUEUE_FAMILIES; i++) {
for (unsigned q = 0; q < device->queue_count[i]; q++) {
- radv_QueueWaitIdle(radv_queue_to_handle(&device->queues[i][q]));
+ VkResult result =
+ radv_QueueWaitIdle(radv_queue_to_handle(&device->queues[i][q]));
+
+ if (result != VK_SUCCESS)
+ return result;
}
}
return VK_SUCCESS;
return VK_SUCCESS;
}
-
+static void radv_destroy_event(struct radv_device *device,
+ const VkAllocationCallbacks* pAllocator,
+ struct radv_event *event)
+{
+ device->ws->buffer_destroy(event->bo);
+ vk_object_base_finish(&event->base);
+ vk_free2(&device->vk.alloc, pAllocator, event);
+}
VkResult radv_CreateEvent(
VkDevice _device,
}
event->map = (uint64_t*)device->ws->buffer_map(event->bo);
+ if (!event->map) {
+ radv_destroy_event(device, pAllocator, event);
+ return vk_error(device->instance, VK_ERROR_OUT_OF_DEVICE_MEMORY);
+ }
*pEvent = radv_event_to_handle(event);
if (!event)
return;
- device->ws->buffer_destroy(event->bo);
- vk_object_base_finish(&event->base);
- vk_free2(&device->vk.alloc, pAllocator, event);
+
+ radv_destroy_event(device, pAllocator, event);
}
VkResult radv_GetEventStatus(