* IN THE SOFTWARE.
*/
+#include <dlfcn.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <sys/stat.h>
#include "radv_private.h"
#include "util/strtod.h"
#include "ac_llvm_util.h"
#include "vk_format.h"
#include "sid.h"
-#include "radv_timestamp.h"
#include "util/debug.h"
struct radv_dispatch_table dtable;
+static int
+radv_get_function_timestamp(void *ptr, uint32_t* timestamp)
+{
+ Dl_info info;
+ struct stat st;
+ if (!dladdr(ptr, &info) || !info.dli_fname) {
+ return -1;
+ }
+ if (stat(info.dli_fname, &st)) {
+ return -1;
+ }
+ *timestamp = st.st_mtim.tv_sec;
+ return 0;
+}
+
+static int
+radv_device_get_cache_uuid(enum radeon_family family, void *uuid)
+{
+ uint32_t mesa_timestamp, llvm_timestamp;
+ uint16_t f = family;
+ memset(uuid, 0, VK_UUID_SIZE);
+ if (radv_get_function_timestamp(radv_device_get_cache_uuid, &mesa_timestamp) ||
+ radv_get_function_timestamp(LLVMInitializeAMDGPUTargetInfo, &llvm_timestamp))
+ return -1;
+
+ memcpy(uuid, &mesa_timestamp, 4);
+ memcpy((char*)uuid + 4, &llvm_timestamp, 4);
+ memcpy((char*)uuid + 8, &f, 2);
+ snprintf((char*)uuid + 10, VK_UUID_SIZE - 10, "radv");
+ return 0;
+}
+
static VkResult
radv_physical_device_init(struct radv_physical_device *device,
struct radv_instance *instance,
goto fail;
}
+ if (radv_device_get_cache_uuid(device->rad_info.family, device->uuid)) {
+ radv_finish_wsi(device);
+ device->ws->destroy(device->ws);
+ result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+ "cannot generate UUID");
+ goto fail;
+ }
+
fprintf(stderr, "WARNING: radv is not a conformant vulkan implementation, testing use only.\n");
device->name = device->rad_info.name;
+ close(fd);
return VK_SUCCESS;
fail:
};
static const VkExtensionProperties device_extensions[] = {
+ {
+ .extensionName = VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME,
+ .specVersion = 1,
+ },
{
.extensionName = VK_KHR_SWAPCHAIN_EXTENSION_NAME,
.specVersion = 68,
},
+ {
+ .extensionName = VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME,
+ .specVersion = 1,
+ },
+ {
+ .extensionName = VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME,
+ .specVersion = 1,
+ },
};
static void *
.largePoints = true,
.alphaToOne = true,
.multiViewport = false,
- .samplerAnisotropy = false, /* FINISHME */
+ .samplerAnisotropy = true,
.textureCompressionETC2 = false,
.textureCompressionASTC_LDR = false,
.textureCompressionBC = true,
};
}
-void
-radv_device_get_cache_uuid(void *uuid)
-{
- memset(uuid, 0, VK_UUID_SIZE);
- snprintf(uuid, VK_UUID_SIZE, "radv-%s", RADV_TIMESTAMP);
-}
-
void radv_GetPhysicalDeviceProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties* pProperties)
.maxGeometryTotalOutputComponents = 1024,
.maxFragmentInputComponents = 128,
.maxFragmentOutputAttachments = 8,
- .maxFragmentDualSrcAttachments = 2,
+ .maxFragmentDualSrcAttachments = 1,
.maxFragmentCombinedOutputResources = 8,
.maxComputeSharedMemorySize = 32768,
.maxComputeWorkGroupCount = { 65535, 65535, 65535 },
};
strcpy(pProperties->deviceName, pdevice->name);
- radv_device_get_cache_uuid(pProperties->pipelineCacheUUID);
+ memcpy(pProperties->pipelineCacheUUID, pdevice->uuid, VK_UUID_SIZE);
}
void radv_GetPhysicalDeviceQueueFamilyProperties(
};
}
-static VkResult
+static void
radv_queue_init(struct radv_device *device, struct radv_queue *queue)
{
queue->_loader_data.loaderMagic = ICD_LOADER_MAGIC;
queue->device = device;
-
- return VK_SUCCESS;
}
static void
}
device->allow_fast_clears = env_var_as_boolean("RADV_FAST_CLEARS", false);
device->allow_dcc = !env_var_as_boolean("RADV_DCC_DISABLE", false);
+ device->shader_stats_dump = env_var_as_boolean("RADV_SHADER_STATS", false);
if (device->allow_fast_clears && device->allow_dcc)
radv_finishme("DCC fast clears have not been tested\n");
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
{
- unsigned i;
if (pProperties == NULL) {
*pPropertyCount = ARRAY_SIZE(global_extensions);
return VK_SUCCESS;
}
- for (i = 0; i < *pPropertyCount; i++)
- memcpy(&pProperties[i], &global_extensions[i], sizeof(VkExtensionProperties));
+ *pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(global_extensions));
+ typed_memcpy(pProperties, global_extensions, *pPropertyCount);
- *pPropertyCount = i;
- if (i < ARRAY_SIZE(global_extensions))
+ if (*pPropertyCount < ARRAY_SIZE(global_extensions))
return VK_INCOMPLETE;
return VK_SUCCESS;
uint32_t* pPropertyCount,
VkExtensionProperties* pProperties)
{
- unsigned i;
-
if (pProperties == NULL) {
*pPropertyCount = ARRAY_SIZE(device_extensions);
return VK_SUCCESS;
}
- for (i = 0; i < *pPropertyCount; i++)
- memcpy(&pProperties[i], &device_extensions[i], sizeof(VkExtensionProperties));
+ *pPropertyCount = MIN2(*pPropertyCount, ARRAY_SIZE(device_extensions));
+ typed_memcpy(pProperties, device_extensions, *pPropertyCount);
- *pPropertyCount = i;
- if (i < ARRAY_SIZE(device_extensions))
+ if (*pPropertyCount < ARRAY_SIZE(device_extensions))
return VK_INCOMPLETE;
+
return VK_SUCCESS;
}
uint32_t max_aniso = pCreateInfo->anisotropyEnable && pCreateInfo->maxAnisotropy > 1.0 ?
(uint32_t) pCreateInfo->maxAnisotropy : 0;
uint32_t max_aniso_ratio = radv_tex_aniso_filter(max_aniso);
- bool is_vi;
- is_vi = (device->instance->physicalDevice.rad_info.chip_class >= VI);
-
- if (!is_vi && max_aniso > 0) {
- radv_finishme("Anisotropic filtering must be disabled manually "
- "by the shader on SI-CI when BASE_LEVEL == LAST_LEVEL\n");
- max_aniso = max_aniso_ratio = 0;
- }
+ bool is_vi = (device->instance->physicalDevice.rad_info.chip_class >= VI);
sampler->state[0] = (S_008F30_CLAMP_X(radv_tex_wrap(pCreateInfo->addressModeU)) |
S_008F30_CLAMP_Y(radv_tex_wrap(pCreateInfo->addressModeV)) |