mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
v3dv: implement VK_KHR_get_physical_device_properties2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
parent
ecd0b1f4b1
commit
0fd72b6ac4
4 changed files with 165 additions and 17 deletions
|
|
@ -484,6 +484,21 @@ v3dv_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
|
|||
};
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures2 *pFeatures)
|
||||
{
|
||||
v3dv_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
|
||||
|
||||
vk_foreach_struct(ext, pFeatures->pNext) {
|
||||
switch (ext->sType) {
|
||||
default:
|
||||
v3dv_debug_ignored_stype(ext->sType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties *pProperties)
|
||||
|
|
@ -661,6 +676,21 @@ v3dv_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
|
|||
pdevice->pipeline_cache_uuid, VK_UUID_SIZE);
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties2 *pProperties)
|
||||
{
|
||||
v3dv_GetPhysicalDeviceProperties(physicalDevice, &pProperties->properties);
|
||||
|
||||
vk_foreach_struct(ext, pProperties->pNext) {
|
||||
switch (ext->sType) {
|
||||
default:
|
||||
v3dv_debug_ignored_stype(ext->sType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* We support exactly one queue family. */
|
||||
static const VkQueueFamilyProperties
|
||||
v3dv_queue_family_properties = {
|
||||
|
|
@ -684,6 +714,22 @@ v3dv_GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pQueueFamilyPropertyCount,
|
||||
VkQueueFamilyProperties2 *pQueueFamilyProperties)
|
||||
{
|
||||
VK_OUTARRAY_MAKE(out, pQueueFamilyProperties, pQueueFamilyPropertyCount);
|
||||
|
||||
vk_outarray_append(&out, p) {
|
||||
p->queueFamilyProperties = v3dv_queue_family_properties;
|
||||
|
||||
vk_foreach_struct(s, p->pNext) {
|
||||
v3dv_debug_ignored_stype(s->sType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties *pMemoryProperties)
|
||||
|
|
@ -692,6 +738,21 @@ v3dv_GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice,
|
|||
*pMemoryProperties = device->memory;
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties2 *pMemoryProperties)
|
||||
{
|
||||
v3dv_GetPhysicalDeviceMemoryProperties(physicalDevice,
|
||||
&pMemoryProperties->memoryProperties);
|
||||
|
||||
vk_foreach_struct(ext, pMemoryProperties->pNext) {
|
||||
switch (ext->sType) {
|
||||
default:
|
||||
v3dv_debug_ignored_stype(ext->sType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PFN_vkVoidFunction
|
||||
v3dv_GetInstanceProcAddr(VkInstance _instance,
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ API_VERSIONS = [
|
|||
MAX_API_VERSION = None # Computed later
|
||||
|
||||
EXTENSIONS = [
|
||||
Extension('VK_KHR_get_physical_device_properties2', 1, True),
|
||||
Extension('VK_EXT_debug_report', 9, True),
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -281,41 +281,55 @@ v3dv_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
|
|||
};
|
||||
}
|
||||
|
||||
VkResult
|
||||
v3dv_GetPhysicalDeviceImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkImageType type,
|
||||
VkImageTiling tiling,
|
||||
VkImageUsageFlags usage,
|
||||
VkImageCreateFlags createFlags,
|
||||
VkImageFormatProperties *pImageFormatProperties)
|
||||
void
|
||||
v3dv_GetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties2 *pFormatProperties)
|
||||
{
|
||||
const struct v3dv_format *v3dv_format = v3dv_get_format(format);
|
||||
v3dv_GetPhysicalDeviceFormatProperties(physicalDevice, format,
|
||||
&pFormatProperties->formatProperties);
|
||||
|
||||
vk_foreach_struct(ext, pFormatProperties->pNext) {
|
||||
switch (ext->sType) {
|
||||
default:
|
||||
v3dv_debug_ignored_stype(ext->sType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static VkResult
|
||||
get_image_format_properties(
|
||||
struct v3dv_physical_device *physical_device,
|
||||
const VkPhysicalDeviceImageFormatInfo2 *info,
|
||||
VkImageFormatProperties *pImageFormatProperties,
|
||||
VkSamplerYcbcrConversionImageFormatProperties *pYcbcrImageFormatProperties)
|
||||
{
|
||||
const struct v3dv_format *v3dv_format = v3dv_get_format(info->format);
|
||||
VkFormatFeatureFlags format_feature_flags =
|
||||
image_format_features(format, v3dv_format, tiling);
|
||||
image_format_features(info->format, v3dv_format, info->tiling);
|
||||
if (!format_feature_flags)
|
||||
goto unsupported;
|
||||
|
||||
if (usage & VK_IMAGE_USAGE_SAMPLED_BIT) {
|
||||
if (info->usage & VK_IMAGE_USAGE_SAMPLED_BIT) {
|
||||
if (!(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) {
|
||||
goto unsupported;
|
||||
}
|
||||
}
|
||||
|
||||
if (usage & VK_IMAGE_USAGE_STORAGE_BIT) {
|
||||
if (info->usage & VK_IMAGE_USAGE_STORAGE_BIT) {
|
||||
if (!(format_feature_flags & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT)) {
|
||||
goto unsupported;
|
||||
}
|
||||
}
|
||||
|
||||
if (usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
|
||||
if (info->usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) {
|
||||
if (!(format_feature_flags & VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT)) {
|
||||
goto unsupported;
|
||||
}
|
||||
}
|
||||
|
||||
if (usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
|
||||
if (info->usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) {
|
||||
if (!(format_feature_flags &
|
||||
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT)) {
|
||||
goto unsupported;
|
||||
|
|
@ -326,7 +340,7 @@ v3dv_GetPhysicalDeviceImageFormatProperties(
|
|||
* these limits available in the physical device and read them from there
|
||||
* wherever we need them.
|
||||
*/
|
||||
switch (type) {
|
||||
switch (info->type) {
|
||||
case VK_IMAGE_TYPE_1D:
|
||||
pImageFormatProperties->maxExtent.width = 4096;
|
||||
pImageFormatProperties->maxExtent.height = 1;
|
||||
|
|
@ -354,7 +368,7 @@ v3dv_GetPhysicalDeviceImageFormatProperties(
|
|||
|
||||
pImageFormatProperties->sampleCounts = VK_SAMPLE_COUNT_1_BIT;
|
||||
|
||||
if (tiling == VK_IMAGE_TILING_LINEAR)
|
||||
if (info->tiling == VK_IMAGE_TILING_LINEAR)
|
||||
pImageFormatProperties->maxMipLevels = 1;
|
||||
|
||||
pImageFormatProperties->maxResourceSize = 0xffffffff; /* 32-bit allocation */
|
||||
|
|
@ -373,6 +387,64 @@ unsupported:
|
|||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
VkResult
|
||||
v3dv_GetPhysicalDeviceImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkImageType type,
|
||||
VkImageTiling tiling,
|
||||
VkImageUsageFlags usage,
|
||||
VkImageCreateFlags createFlags,
|
||||
VkImageFormatProperties *pImageFormatProperties)
|
||||
{
|
||||
V3DV_FROM_HANDLE(v3dv_physical_device, physical_device, physicalDevice);
|
||||
|
||||
const VkPhysicalDeviceImageFormatInfo2 info = {
|
||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
|
||||
.pNext = NULL,
|
||||
.format = format,
|
||||
.type = type,
|
||||
.tiling = tiling,
|
||||
.usage = usage,
|
||||
.flags = createFlags,
|
||||
};
|
||||
|
||||
return get_image_format_properties(physical_device, &info,
|
||||
pImageFormatProperties, NULL);
|
||||
}
|
||||
|
||||
VkResult
|
||||
v3dv_GetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceImageFormatInfo2 *base_info,
|
||||
VkImageFormatProperties2 *base_props)
|
||||
{
|
||||
V3DV_FROM_HANDLE(v3dv_physical_device, physical_device, physicalDevice);
|
||||
|
||||
/* Extract input structs */
|
||||
vk_foreach_struct_const(s, base_info->pNext) {
|
||||
switch (s->sType) {
|
||||
default:
|
||||
v3dv_debug_ignored_stype(s->sType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Extract output structs */
|
||||
vk_foreach_struct(s, base_props->pNext) {
|
||||
switch (s->sType) {
|
||||
default:
|
||||
v3dv_debug_ignored_stype(s->sType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
VkResult result =
|
||||
get_image_format_properties(physical_device, base_info,
|
||||
&base_props->imageFormatProperties, NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceSparseImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
|
|
@ -386,3 +458,13 @@ v3dv_GetPhysicalDeviceSparseImageFormatProperties(
|
|||
{
|
||||
*pPropertyCount = 0;
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_GetPhysicalDeviceSparseImageFormatProperties2(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo,
|
||||
uint32_t *pPropertyCount,
|
||||
VkSparseImageFormatProperties2 *pProperties)
|
||||
{
|
||||
*pPropertyCount = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include <string.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vulkan/vk_icd.h>
|
||||
#include <vk_enum_to_str.h>
|
||||
|
||||
#include <xf86drm.h>
|
||||
|
||||
|
|
@ -724,6 +725,9 @@ VkResult __vk_errorf(struct v3dv_instance *instance, VkResult error,
|
|||
void v3dv_loge(const char *format, ...) v3dv_printflike(1, 2);
|
||||
void v3dv_loge_v(const char *format, va_list va);
|
||||
|
||||
#define v3dv_debug_ignored_stype(sType) \
|
||||
v3dv_loge("%s: ignored VkStructureType %u:%s\n", __func__, (sType), vk_StructureType_to_str(sType))
|
||||
|
||||
const struct v3dv_format *v3dv_get_format(VkFormat);
|
||||
const uint8_t *v3dv_get_format_swizzle(VkFormat f);
|
||||
void v3dv_get_internal_type_bpp_for_output_format(uint32_t format, uint32_t *type, uint32_t *bpp);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue