Compare commits

...

30 Commits

Author SHA1 Message Date
Chad Versace
e44b35b37e anv/TODO: Updates for VK_EXT_image_drm_format_modifier 2017-11-07 06:14:17 -08:00
Chad Versace
944e61008a RFC: anv: Kill vkCreateDmaBufImageINTEL()
Replaced by VK_EXT_external_memory_dma_buf and
VK_EXT_image_drm_format_modifier.
2017-11-07 06:14:17 -08:00
Chad Versace
d545897f1a RFC: anv: Enable VK_EXT_image_drm_format_modifier
The draft spec lives at
http://kiwitree.net/~chadv/vulkan/#1.0-VK_EXT_image_drm_format_modifier.

This extension spec has a complete, working API. I'm happy with the API,
and believe it's good enough. But the spec language has some outstanding
issues that prevent it from being submitted as-is to Khronos: the spec
language needs more polish, and the appendix chaper has a list of
incomplete TODOs.
2017-11-07 06:14:17 -08:00
Chad Versace
bd1790f1d9 RFC: anv: Support VkImageExplicitDrmFormatModifierCreateInfoEXT
Incremental implementation of VK_EXT_image_drm_format_modifier.
2017-11-07 06:14:17 -08:00
Chad Versace
2685679968 RFC: anv: Support vkGetImageSubresourceLayout with modifiers
Incremental implementation of VK_EXT_image_drm_format_modifier.
2017-11-07 06:14:17 -08:00
Chad Versace
373ecbf8ab RFC: anv: Support VkImageDrmFormatModifierListCreateInfoEXT
Incremental implementation of VK_EXT_image_drm_format_modifier.
2017-11-07 06:14:14 -08:00
Chad Versace
c8f0b002da RFC: anv: Support VkPhysicalDeviceImageDrmFormatModifierInfoEXT
Incremental implementation of VK_EXT_image_drm_format_modifier.
2017-11-07 04:59:23 -08:00
Chad Versace
8e166eecee RFC: anv: Support VkDrmFormatModifierPropertiesListEXT
Incremental implementation of VK_EXT_image_drm_format_modifier.
2017-11-07 04:58:59 -08:00
Chad Versace
4cd3a73ed1 RFC: anv: Implement VK_EXT_queue_family_foreign
The draft spec lives at
http://kiwitree.net/~chadv/vulkan/#1.0-VK_EXT_queue_family_foreign.

I plan to ask Khronos to merge the spec this week.

By itself, this extension does nothing. It's only useful in its
interaction with other external memory extensions.

In the short term, at least, anvil will do nothing on transitions
to/from the foreign queue. There does exist, though, some possibility to
eventually distinguish between transitions on
VK_QUEUE_FAMILY_EXTERNAL_KHR and VK_QUEUE_FAMILY_FOREIGN_EXT for ccs_e
images.
2017-11-07 04:58:57 -08:00
Chad Versace
70161846d8 RFC: anv: Implement VK_EXT_external_memory_dma_buf
The draft spec lives at
http://kiwitree.net/~chadv/vulkan/#1.0-VK_EXT_external_memory_dma_buf.

I plan to ask Khronos to merge the spec this week.
2017-11-07 04:58:55 -08:00
Chad Versace
17ef581adb HACK: vulkan: Install Vulkan headers
This allows me to build apps against new extensions without installing
an updated loader.
2017-11-07 04:26:05 -08:00
Chad Versace
d71413dd6b HACK: vulkan: Update headers and registry to chadv/1.0-dma-buf@a79a0ab 2017-11-07 04:26:05 -08:00
Chad Versace
22478b2a77 anv: Refactor anv_GetImageSubresourceLayout()
Its helper function, anv_surface_get_subresource_layout(), was not very
helpful. So fold it into the main function.
2017-11-07 04:26:05 -08:00
Chad Versace
a104d1cd49 anv/image: Refactor choice of isl_tiling_flags_t
Instead of choosing the tiling flags inside make_surface(), which is
called once per aspect in a loop, and which chooses the same tiling for
each aspect, choose the tiling flags exactly once before entering the
aspect loop.
2017-11-07 04:26:04 -08:00
Chad Versace
a4486851a9 anv: Refactor anv_get_format_plane() - explicit unsupported
The same local variable, 'plane_format', was returned on success *and*
failure. Be more explicit in distinguishing the two cases: return
'plane_format' on success and return 'unsupported' on failure.

This simplifies the diff in upcoming patches for
VK_EXT_image_drm_format_modifier.
2017-11-07 04:26:04 -08:00
Chad Versace
d83cea80e2 anv: Remove anv_physical_device_get_format_properties()
Fold its body into its sole caller,
anv_GetPhysicalDeviceFormatProperties().
2017-11-07 04:26:01 -08:00
Chad Versace
609011efdf anv: Simplify anv_physical_device_get_format_properties()
Now that get_image_format_properties() returns the correct
VkFormatFeatureFlags, we can remove the unneeded if-branch and some
local variables.
2017-11-07 04:25:57 -08:00
Chad Versace
8c0913a9df anv: Simplify anv_get_image_format_properties()
Now that get_image_format_features() has a VkImageTiling parameter, we
can bypass anv_physical_device_get_format_properties() and call
get_image_format_features() directly.
2017-11-07 04:25:41 -08:00
Chad Versace
ef2210dc92 anv: Rename get_image_format_properties()
The name is misleading. It looks like vkGetPhysicalDeviceImageFormatProperties(),
but it actually implement vkGetPhysicalDeviceFormatProperties. Let's
rename it to what it actually does, get_image_format_features(), because it
returns VkFormatFeatureFlags.

For consistency, also rename get_buffer_format_properties() to
get_buffer_format_features().
2017-11-07 04:24:01 -08:00
Chad Versace
05d4bee6e6 anv: Fix get_image_format_properties() - YCbCr
Teach it to calculate the format features for YCbCr.

The goal (which is completed in this patch) is to incrementally fix
get_image_format_properties() to return a correct result.  Previously,
it returned incorrect VkFormatFeatureFlags which the caller needed clean
up.
2017-11-07 04:24:01 -08:00
Chad Versace
a1129f62cd anv: Fix get_image_format_properties() - 3-channel formats
Teach it to calculate the format features for 3-channel formats.

The goal is to incrementally fix get_image_format_properties() to return
a correct result.  Currently, it returns incorrect VkFormatFeatureFlags
which the caller must clean up.
2017-11-07 04:24:01 -08:00
Chad Versace
819d1bf09e anv: Refactor get_image_format_properties() - Reduce params
Replace parameters 'enum isl_format' and 'struct anv_format_plane' with
new parameter 'const struct anv_format *'.

The goal is to incrementally fix get_image_format_properties() to return
a correct result.  Currently, it returns incorrect VkFormatFeatureFlags
which the caller must clean up.
2017-11-07 04:24:01 -08:00
Chad Versace
2a6da977c1 anv: Refactor get_image_format_properties() - base_isl_format
Rename parameter 'base' to 'base_isl_format'.
2017-11-07 04:24:01 -08:00
Chad Versace
76386219f2 anv: Refactor get_image_format_properties() - plane_format
Rename parameter 'format' to 'plane_format'.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2017-11-07 04:24:01 -08:00
Chad Versace
3db0bb0364 anv: Fix get_image_format_properties() - ASTC
Teach it to calculate the format features for ASTC.

The goal is to incrementally fix get_image_format_properties() to return
a correct result.  Currently, it returns incorrect VkFormatFeatureFlags
which the caller must clean up.

v2: New commit message

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v1)
2017-11-07 04:24:00 -08:00
Chad Versace
0d43429ede anv: Fix get_image_format_properties() - depthstencil (v2)
Teach it to calculate the features of depthstencil formats.

The goal is to incrementally fix get_image_format_properties() to return
a correct result.  Currently, it returns incorrect VkFormatFeatureFlags
which the caller must clean up.

v2: New commit message

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v1)
2017-11-07 04:24:00 -08:00
Chad Versace
6a309c52c7 anv: Better types for 'aspect' function params
Some functions have a comment that says "Exactly one bit must be in
'aspect'". So change the type of their 'aspect' parameter from
VkImageAspectFlags to VkImageAspectFlagBits.
2017-11-07 04:24:00 -08:00
Chad Versace
24f839f53a anv: Refactor get_buffer_format_properties()
Make it a stand-alone function. Pre-patch, for some formats the function
returned incorrect VkFormatFeatureFlags which were cleaned up by the
caller.

This prepares for a cleaner implementation of
VK_EXT_image_drm_format_modifier.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2017-11-07 04:24:00 -08:00
Chad Versace
39f8866a85 anv: Suffix anv-private 'VK' tokens with 'ANV'
I saw VK_IMAGE_ASPECT_ANY_COLOR_BIT while hacking anv_formats.c and got
confused. "Huh? What extension added that?". No extension defines it;
anv_private.h defines it.

To remove confusion, rename the anv-private VK tokens as if they were
extension tokens with the ANV vendor suffix.

I found only two such tokens:

    VK_IMAGE_ASPECT_ANY_COLOR_BIT
    VK_IMAGE_ASPECT_PLANES_BITS

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2017-11-07 04:24:00 -08:00
Chad Versace
05c3ec7e89 anv: Remove unused variable 'gen'
In anv_physical_device_get_format_properties().

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2017-11-07 04:24:00 -08:00
18 changed files with 738 additions and 454 deletions

View File

@@ -66,3 +66,14 @@ if with_egl
subdir : 'EGL',
)
endif
# HACK
if _vulkan_drivers != []
install_headers(
'vulkan/vk_android_native_buffer.h',
'vulkan/vk_icd.h',
'vulkan/vk_platform.h',
'vulkan/vulkan.h',
subdir : 'vulkan',
)
endif

View File

@@ -43,7 +43,7 @@ extern "C" {
#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
// Version of this file
#define VK_HEADER_VERSION 64
#define VK_HEADER_VERSION 65
#define VK_NULL_HANDLE 0
@@ -147,6 +147,7 @@ typedef enum VkResult {
VK_ERROR_INVALID_SHADER_NV = -1000012000,
VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000,
VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = -1000072003,
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT = -1000158000,
VK_ERROR_NOT_PERMITTED_EXT = -1000174001,
VK_RESULT_BEGIN_RANGE = VK_ERROR_FRAGMENTED_POOL,
VK_RESULT_END_RANGE = VK_INCOMPLETE,
@@ -352,6 +353,11 @@ typedef enum VkStructureType {
VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR = 1000156005,
VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR = 1000157000,
VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = 1000157001,
VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT = 1000158000,
VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT = 1000158001,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT = 1000158002,
VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT = 1000158003,
VK_STRUCTURE_TYPE_IMAGE_EXCPLICIT_DRM_FORMAT_MODIFIER_CREATE_INFO_EXT = 1000158004,
VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160000,
VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160001,
VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = 1000174000,
@@ -628,6 +634,7 @@ typedef enum VkImageType {
typedef enum VkImageTiling {
VK_IMAGE_TILING_OPTIMAL = 0,
VK_IMAGE_TILING_LINEAR = 1,
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT = 1000158000,
VK_IMAGE_TILING_BEGIN_RANGE = VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_TILING_END_RANGE = VK_IMAGE_TILING_LINEAR,
VK_IMAGE_TILING_RANGE_SIZE = (VK_IMAGE_TILING_LINEAR - VK_IMAGE_TILING_OPTIMAL + 1),
@@ -1209,6 +1216,7 @@ typedef enum VkImageAspectFlagBits {
VK_IMAGE_ASPECT_PLANE_0_BIT_KHR = 0x00000010,
VK_IMAGE_ASPECT_PLANE_1_BIT_KHR = 0x00000020,
VK_IMAGE_ASPECT_PLANE_2_BIT_KHR = 0x00000040,
VK_IMAGE_ASPECT_PLANE_3_BIT_EXT = 0x00000080,
VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageAspectFlagBits;
typedef VkFlags VkImageAspectFlags;
@@ -4195,6 +4203,7 @@ typedef enum VkExternalMemoryHandleTypeFlagBitsKHR {
VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 0x00000010,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 0x00000020,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 0x00000040,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT = 0x00000080,
VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkExternalMemoryHandleTypeFlagBitsKHR;
typedef VkFlags VkExternalMemoryHandleTypeFlagsKHR;
@@ -6616,6 +6625,17 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(
#endif
#endif /* VK_USE_PLATFORM_MACOS_MVK */
#define VK_EXT_external_memory_dma_buf 1
#define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION 1
#define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME "VK_EXT_external_memory_dma_buf"
#define VK_EXT_queue_family_foreign 1
#define VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION 1
#define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME "VK_EXT_queue_family_foreign"
#define VK_QUEUE_FAMILY_FOREIGN_EXT (~0U-2)
#define VK_EXT_sampler_filter_minmax 1
#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1
#define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax"
@@ -6839,6 +6859,54 @@ typedef struct VkPipelineCoverageModulationStateCreateInfoNV {
#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage"
#define VK_EXT_image_drm_format_modifier 1
#define VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION 1
#define VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME "VK_EXT_image_drm_format_modifier"
typedef struct VkDrmFormatModifierPropertiesEXT {
uint64_t drmFormatModifier;
uint32_t drmFormatModifierPlaneCount;
VkFormatFeatureFlags drmFormatModifierTilingFeatures;
} VkDrmFormatModifierPropertiesEXT;
typedef struct VkDrmFormatModifierPropertiesListEXT {
VkStructureType sType;
void* pNext;
uint32_t drmFormatModifierCount;
VkDrmFormatModifierPropertiesEXT* pDrmFormatModifierProperties;
} VkDrmFormatModifierPropertiesListEXT;
typedef struct VkPhysicalDeviceImageDrmFormatModifierInfoEXT {
VkStructureType sType;
const void* pNext;
uint64_t drmFormatModifier;
} VkPhysicalDeviceImageDrmFormatModifierInfoEXT;
typedef struct VkImageDrmFormatModifierListCreateInfoEXT {
VkStructureType sType;
const void* pNext;
uint32_t drmFormatModifierCount;
const uint64_t* pDrmFormatModifiers;
} VkImageDrmFormatModifierListCreateInfoEXT;
typedef struct VkImageExplicitDrmFormatModifierCreateInfoEXT {
VkStructureType sType;
const void* pNext;
uint64_t drmFormatModifier;
uint32_t planeCount;
VkSubresourceLayout* pPlaneLayouts;
} VkImageExplicitDrmFormatModifierCreateInfoEXT;
typedef VkResult (VKAPI_PTR *PFN_vkGetImageDrmFormatModifierEXT)(VkDevice device, VkImage image, uint64_t* pDrmFormatModifier);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkGetImageDrmFormatModifierEXT(
VkDevice device,
VkImage image,
uint64_t* pDrmFormatModifier);
#endif
#define VK_EXT_validation_cache 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkValidationCacheEXT)

View File

@@ -1,62 +0,0 @@
/*
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#ifndef __VULKAN_INTEL_H__
#define __VULKAN_INTEL_H__
#include "vulkan.h"
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
#define VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL 1024
typedef struct VkDmaBufImageCreateInfo_
{
VkStructureType sType; // Must be VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL
const void* pNext; // Pointer to next structure.
int fd;
VkFormat format;
VkExtent3D extent; // Depth must be 1
uint32_t strideInBytes;
} VkDmaBufImageCreateInfo;
typedef VkResult (VKAPI_PTR *PFN_vkCreateDmaBufImageINTEL)(VkDevice device, const VkDmaBufImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMem, VkImage* pImage);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkCreateDmaBufImageINTEL(
VkDevice _device,
const VkDmaBufImageCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDeviceMemory* pMem,
VkImage* pImage);
#endif
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // __VULKAN_INTEL_H__

View File

@@ -67,7 +67,6 @@ typedef uint32_t xcb_visualid_t;
typedef uint32_t xcb_window_t;
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_intel.h>
#include <vulkan/vk_icd.h>
#include "radv_entrypoints.h"

View File

@@ -215,7 +215,6 @@ VULKAN_FILES := \
vulkan/anv_formats.c \
vulkan/anv_genX.h \
vulkan/anv_image.c \
vulkan/anv_intel.c \
vulkan/anv_nir.h \
vulkan/anv_nir_apply_pipeline_layout.c \
vulkan/anv_nir_lower_input_attachments.c \

View File

@@ -74,9 +74,6 @@ noinst_HEADERS += \
$(top_srcdir)/include/vulkan/vk_platform.h \
$(top_srcdir)/include/vulkan/vulkan.h
vulkan_include_HEADERS = \
$(top_srcdir)/include/vulkan/vulkan_intel.h
lib_LTLIBRARIES += vulkan/libvulkan_intel.la
check_LTLIBRARIES += vulkan/libvulkan-test.la

View File

@@ -11,3 +11,19 @@ Performance:
- Pushing pieces of UBOs?
- Enable guardband clipping
- Use soft-pin to avoid relocations
VK_EXT_image_drm_format_modifiers:
[-] Modifiers
[x] DRM_FORMAT_MOD_LINEAR
[x] I915_FORMAT_MOD_X_TILED
[x] I915_FORMAT_MOD_Y_TILED
[ ] I915_FORMAT_MOD_Y_TILED_CCS
[x] vkGetPhysicalDeviceFormatProperties2KHR
[x] vkGetPhysicalDeviceImageFormatProperties2KHR
[x] vkCreateImage
[x] VkImageDrmFormatModifierListCreateInfoEXT
[x] VkImageExplicitDrmFormatModifierEXT
[ ] Resolve CCS on foreign queue transition
[x] vkGetImageDrmFormatModifierEXT
[x] vkGetImageSubresouceLayout
[x] Kill vkCreateImageDmaBufINTEL

View File

@@ -777,7 +777,7 @@ void anv_CmdClearColorImage(
if (pRanges[r].aspectMask == 0)
continue;
assert(pRanges[r].aspectMask & VK_IMAGE_ASPECT_ANY_COLOR_BIT);
assert(pRanges[r].aspectMask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
struct blorp_surf surf;
get_blorp_surf_for_anv_image(image, pRanges[r].aspectMask,
@@ -1068,7 +1068,7 @@ void anv_CmdClearAttachments(
BLORP_BATCH_NO_EMIT_DEPTH_STENCIL);
for (uint32_t a = 0; a < attachmentCount; ++a) {
if (pAttachments[a].aspectMask & VK_IMAGE_ASPECT_ANY_COLOR_BIT) {
if (pAttachments[a].aspectMask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) {
assert(pAttachments[a].aspectMask == VK_IMAGE_ASPECT_COLOR_BIT);
clear_color_attachment(cmd_buffer, &batch,
&pAttachments[a],
@@ -1668,7 +1668,7 @@ anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
/* The resolved subresource range must have a CCS buffer. */
assert(level < anv_image_aux_levels(image, aspect));
assert(layer_count <= anv_image_aux_layers(image, aspect, level));
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT && image->samples == 1);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV && image->samples == 1);
/* Create a binding table for this surface state. */
uint32_t binding_table;

View File

@@ -1538,11 +1538,11 @@ VkResult anv_AllocateMemory(
* ignored.
*/
if (fd_info && fd_info->handleType) {
/* At the moment, we only support the OPAQUE_FD memory type which is
* just a GEM buffer.
*/
/* At the moment, we support only the below handle types. */
assert(fd_info->handleType ==
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR);
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR ||
fd_info->handleType ==
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT);
result = anv_bo_cache_import(device, &device->bo_cache,
fd_info->fd, &mem->bo);
@@ -1616,9 +1616,8 @@ VkResult anv_GetMemoryFdKHR(
assert(pGetFdInfo->sType == VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR);
/* We support only one handle type. */
assert(pGetFdInfo->handleType ==
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR);
assert(pGetFdInfo->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR ||
pGetFdInfo->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT);
return anv_bo_cache_export(dev, &dev->bo_cache, mem->bo, pFd);
}

View File

@@ -359,16 +359,6 @@ def main():
entrypoints += get_entrypoints(doc, get_entrypoints_defines(doc),
start_index=len(entrypoints))
# Manually add CreateDmaBufImageINTEL for which we don't have an extension
# defined.
entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL',
'VkDevice device, ' +
'const VkDmaBufImageCreateInfo* pCreateInfo, ' +
'const VkAllocationCallbacks* pAllocator,' +
'VkDeviceMemory* pMem,' +
'VkImage* pImage', len(entrypoints),
cal_hash('vkCreateDmaBufImageINTEL'), None))
# For outputting entrypoints.h we generate a anv_EntryPoint() prototype
# per entry point.
try:

View File

@@ -86,6 +86,9 @@ EXTENSIONS = [
Extension('VK_KHR_xlib_surface', 6, 'VK_USE_PLATFORM_XLIB_KHR'),
Extension('VK_KHX_multiview', 1, True),
Extension('VK_EXT_debug_report', 8, True),
Extension('VK_EXT_external_memory_dma_buf', 1, True),
Extension('VK_EXT_image_drm_format_modifier', 1, True),
Extension('VK_EXT_queue_family_foreign', 1, True),
]
class VkVersion:

View File

@@ -21,6 +21,8 @@
* IN THE SOFTWARE.
*/
#include <drm_fourcc.h>
#include "anv_private.h"
#include "vk_enum_to_str.h"
#include "vk_format_info.h"
@@ -409,32 +411,47 @@ anv_get_format(VkFormat vk_format)
*/
struct anv_format_plane
anv_get_format_plane(const struct gen_device_info *devinfo, VkFormat vk_format,
VkImageAspectFlags aspect, VkImageTiling tiling)
VkImageAspectFlagBits aspect, VkImageTiling tiling)
{
const struct anv_format *format = anv_get_format(vk_format);
struct anv_format_plane plane_format = {
const struct anv_format_plane unsupported = {
.isl_format = ISL_FORMAT_UNSUPPORTED,
};
if (format == NULL)
return plane_format;
return unsupported;
uint32_t plane = anv_image_aspect_to_plane(vk_format_aspects(vk_format), aspect);
plane_format = format->planes[plane];
struct anv_format_plane plane_format = format->planes[plane];
if (plane_format.isl_format == ISL_FORMAT_UNSUPPORTED)
return plane_format;
return unsupported;
if (aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
if (tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
return unsupported;
assert(vk_format_aspects(vk_format) &
(VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT));
return plane_format;
}
assert((aspect & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT) == 0);
assert((aspect & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0);
const struct isl_format_layout *isl_layout =
isl_format_get_layout(plane_format.isl_format);
/* For VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, the image's driver-internal
* format must be the user-facing VkFormat. Modifying the VkFormat in any
* way, including swizzling, is illegal.
*/
/* For now, for no reason other than FUD, we decline to support texture
* compression with modifiers.
*/
if (tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT &&
isl_layout->txc != ISL_TXC_NONE)
return unsupported;
if (tiling == VK_IMAGE_TILING_OPTIMAL &&
!util_is_power_of_two(isl_layout->bpb)) {
/* Tiled formats *must* be power-of-two because we need up upload
@@ -456,7 +473,8 @@ anv_get_format_plane(const struct gen_device_info *devinfo, VkFormat vk_format,
/* The B4G4R4A4 format isn't available prior to Broadwell so we have to fall
* back to a format with a more complex swizzle.
*/
if (vk_format == VK_FORMAT_B4G4R4A4_UNORM_PACK16 && devinfo->gen < 8) {
if (tiling != VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT &&
vk_format == VK_FORMAT_B4G4R4A4_UNORM_PACK16 && devinfo->gen < 8) {
plane_format.isl_format = ISL_FORMAT_B4G4R4A4_UNORM;
plane_format.swizzle = ISL_SWIZZLE(GREEN, RED, ALPHA, BLUE);
}
@@ -466,19 +484,81 @@ anv_get_format_plane(const struct gen_device_info *devinfo, VkFormat vk_format,
// Format capabilities
/**
* Parameter drm_format_mod must be DRM_FORMAT_MOD_INVALID unless vk_tiling is
* VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.
*/
static VkFormatFeatureFlags
get_image_format_properties(const struct gen_device_info *devinfo,
enum isl_format base, struct anv_format_plane format)
get_image_format_features(const struct gen_device_info *devinfo,
VkFormat vk_format,
const struct anv_format *anv_format,
VkImageTiling vk_tiling,
uint64_t drm_format_mod)
{
if (format.isl_format == ISL_FORMAT_UNSUPPORTED)
VkFormatFeatureFlags flags = 0;
if (vk_tiling != VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
assert(drm_format_mod == DRM_FORMAT_MOD_INVALID);
if (anv_format == NULL)
return 0;
VkFormatFeatureFlags flags = 0;
if (isl_format_supports_sampling(devinfo, format.isl_format)) {
const VkImageAspectFlags aspects = vk_format_aspects(vk_format);
if (aspects & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
if (vk_tiling != VK_IMAGE_TILING_OPTIMAL)
return 0;
flags |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
if (aspects == VK_IMAGE_ASPECT_DEPTH_BIT || devinfo->gen >= 8)
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
flags |= VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR |
VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR;
return flags;
}
const struct anv_format_plane plane_format =
anv_get_format_plane(devinfo, vk_format, VK_IMAGE_ASPECT_COLOR_BIT,
vk_tiling);
if (plane_format.isl_format == ISL_FORMAT_UNSUPPORTED)
return 0;
const struct isl_format_layout *isl_layout =
isl_format_get_layout(plane_format.isl_format);
if (vk_tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
assert(isl_layout->txc == ISL_TXC_NONE);
/* For VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT, the base format and
* non-base format must be the same, because the image's driver-internal
* format must be the user-facing VkFormat. Modifying the VkFormat in any
* way, including swizzling, is illegal.
*/
struct anv_format_plane base_plane_format = plane_format;
if (vk_tiling == VK_IMAGE_TILING_OPTIMAL) {
base_plane_format = anv_get_format_plane(devinfo, vk_format,
VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_TILING_LINEAR);
}
enum isl_format base_isl_format = base_plane_format.isl_format;
/* ASTC textures must be in Y-tiled memory */
if (vk_tiling != VK_IMAGE_TILING_OPTIMAL &&
isl_layout->txc == ISL_TXC_ASTC)
return 0;
if (isl_format_supports_sampling(devinfo, plane_format.isl_format)) {
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
VK_FORMAT_FEATURE_BLIT_SRC_BIT;
if (isl_format_supports_filtering(devinfo, format.isl_format))
if (isl_format_supports_filtering(devinfo, plane_format.isl_format))
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
}
@@ -486,22 +566,23 @@ get_image_format_properties(const struct gen_device_info *devinfo,
* moved, then blending won't work correctly. The PRM tells us
* straight-up not to render to such a surface.
*/
if (isl_format_supports_rendering(devinfo, format.isl_format) &&
format.swizzle.a == ISL_CHANNEL_SELECT_ALPHA) {
if (isl_format_supports_rendering(devinfo, plane_format.isl_format) &&
plane_format.swizzle.a == ISL_CHANNEL_SELECT_ALPHA) {
flags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT;
if (isl_format_supports_alpha_blending(devinfo, format.isl_format))
if (isl_format_supports_alpha_blending(devinfo, plane_format.isl_format))
flags |= VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT;
}
/* Load/store is determined based on base format. This prevents RGB
* formats from showing up as load/store capable.
*/
if (isl_is_storage_image_format(base))
if (isl_is_storage_image_format(base_isl_format))
flags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
if (base == ISL_FORMAT_R32_SINT || base == ISL_FORMAT_R32_UINT)
if (base_isl_format == ISL_FORMAT_R32_SINT ||
base_isl_format == ISL_FORMAT_R32_UINT)
flags |= VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT;
if (flags) {
@@ -509,125 +590,55 @@ get_image_format_properties(const struct gen_device_info *devinfo,
VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR;
}
return flags;
}
static VkFormatFeatureFlags
get_buffer_format_properties(const struct gen_device_info *devinfo,
enum isl_format format)
{
if (format == ISL_FORMAT_UNSUPPORTED)
return 0;
VkFormatFeatureFlags flags = 0;
if (isl_format_supports_sampling(devinfo, format) &&
!isl_format_is_compressed(format))
flags |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
if (isl_format_supports_vertex_fetch(devinfo, format))
flags |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
if (isl_is_storage_image_format(format))
flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
if (format == ISL_FORMAT_R32_SINT || format == ISL_FORMAT_R32_UINT)
flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
return flags;
}
static void
anv_physical_device_get_format_properties(struct anv_physical_device *physical_device,
VkFormat vk_format,
VkFormatProperties *out_properties)
{
int gen = physical_device->info.gen * 10;
if (physical_device->info.is_haswell)
gen += 5;
const struct anv_format *format = anv_get_format(vk_format);
VkFormatFeatureFlags linear = 0, tiled = 0, buffer = 0;
if (format == NULL) {
/* Nothing to do here */
} else if (vk_format_is_depth_or_stencil(vk_format)) {
tiled |= VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT;
if (vk_format_aspects(vk_format) == VK_IMAGE_ASPECT_DEPTH_BIT ||
physical_device->info.gen >= 8)
tiled |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT;
tiled |= VK_FORMAT_FEATURE_BLIT_SRC_BIT |
VK_FORMAT_FEATURE_BLIT_DST_BIT |
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR |
VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR;
} else {
struct anv_format_plane linear_fmt, tiled_fmt;
linear_fmt = anv_get_format_plane(&physical_device->info, vk_format,
VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_TILING_LINEAR);
tiled_fmt = anv_get_format_plane(&physical_device->info, vk_format,
VK_IMAGE_ASPECT_COLOR_BIT,
VK_IMAGE_TILING_OPTIMAL);
linear = get_image_format_properties(&physical_device->info,
linear_fmt.isl_format, linear_fmt);
tiled = get_image_format_properties(&physical_device->info,
linear_fmt.isl_format, tiled_fmt);
buffer = get_buffer_format_properties(&physical_device->info,
linear_fmt.isl_format);
/* XXX: We handle 3-channel formats by switching them out for RGBX or
* RGBA formats behind-the-scenes. This works fine for textures
* because the upload process will fill in the extra channel.
* We could also support it for render targets, but it will take
* substantially more work and we have enough RGBX formats to handle
* what most clients will want.
*/
if (linear_fmt.isl_format != ISL_FORMAT_UNSUPPORTED &&
!util_is_power_of_two(isl_format_layouts[linear_fmt.isl_format].bpb) &&
isl_format_rgb_to_rgbx(linear_fmt.isl_format) == ISL_FORMAT_UNSUPPORTED) {
tiled &= ~VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT &
~VK_FORMAT_FEATURE_BLIT_DST_BIT;
}
/* ASTC textures must be in Y-tiled memory */
if (isl_format_get_layout(linear_fmt.isl_format)->txc == ISL_TXC_ASTC)
linear = 0;
/* XXX: We handle 3-channel formats by switching them out for RGBX or
* RGBA formats behind-the-scenes. This works fine for textures
* because the upload process will fill in the extra channel.
* We could also support it for render targets, but it will take
* substantially more work and we have enough RGBX formats to handle
* what most clients will want.
*/
if (vk_tiling == VK_IMAGE_TILING_OPTIMAL &&
base_isl_format != ISL_FORMAT_UNSUPPORTED &&
!util_is_power_of_two(isl_format_layouts[base_isl_format].bpb) &&
isl_format_rgb_to_rgbx(base_isl_format) == ISL_FORMAT_UNSUPPORTED) {
flags &= ~VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT;
flags &= ~VK_FORMAT_FEATURE_BLIT_DST_BIT;
}
if (format && format->can_ycbcr) {
VkFormatFeatureFlags ycbcr_features = 0;
if (anv_format->can_ycbcr) {
if (vk_tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
/* FINISHME(chadv): Support YUV with DRM format modifiers. */
return 0;
}
/* The sampler doesn't have support for mid point when it handles YUV on
* its own.
*/
if (isl_format_is_yuv(format->planes[0].isl_format)) {
if (isl_format_is_yuv(anv_format->planes[0].isl_format)) {
/* TODO: We've disabled linear implicit reconstruction with the
* sampler. The failures show a slightly out of range values on the
* bottom left of the sampled image.
*/
ycbcr_features |= VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR;
flags |= VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR;
} else {
ycbcr_features |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR |
VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR;
flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR |
VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR;
}
/* We can support cosited chroma locations when handle planes with our
* own shader snippets.
*/
for (unsigned p = 0; p < format->n_planes; p++) {
if (format->planes[p].denominator_scales[0] > 1 ||
format->planes[p].denominator_scales[1] > 1) {
ycbcr_features |= VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR;
for (unsigned p = 0; p < anv_format->n_planes; p++) {
if (anv_format->planes[p].denominator_scales[0] > 1 ||
anv_format->planes[p].denominator_scales[1] > 1) {
flags |= VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR;
break;
}
}
if (format->n_planes > 1)
ycbcr_features |= VK_FORMAT_FEATURE_DISJOINT_BIT_KHR;
linear |= ycbcr_features;
tiled |= ycbcr_features;
if (anv_format->n_planes > 1)
flags |= VK_FORMAT_FEATURE_DISJOINT_BIT_KHR;
const VkFormatFeatureFlags disallowed_ycbcr_image_features =
VK_FORMAT_FEATURE_BLIT_SRC_BIT |
@@ -636,42 +647,161 @@ anv_physical_device_get_format_properties(struct anv_physical_device *physical_d
VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT |
VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
linear &= ~disallowed_ycbcr_image_features;
tiled &= ~disallowed_ycbcr_image_features;
buffer = 0;
flags &= ~disallowed_ycbcr_image_features;
}
out_properties->linearTilingFeatures = linear;
out_properties->optimalTilingFeatures = tiled;
out_properties->bufferFeatures = buffer;
if (vk_tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
switch (drm_format_mod) {
default:
unreachable("bad DRM format modifier");
case DRM_FORMAT_MOD_LINEAR:
break;
case I915_FORMAT_MOD_X_TILED:
/* TODO(chadv): Should we support X-tiled storage images? */
flags &= ~VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT;
flags &= ~VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT;
break;
case I915_FORMAT_MOD_Y_TILED:
break;
}
}
return;
return flags;
}
static VkFormatFeatureFlags
get_buffer_format_features(const struct gen_device_info *devinfo,
VkFormat vk_format,
const struct anv_format *anv_format)
{
VkFormatFeatureFlags flags = 0;
if (anv_format == NULL)
return 0;
const enum isl_format isl_format = anv_format->planes[0].isl_format;
if (isl_format == ISL_FORMAT_UNSUPPORTED)
return 0;
if (anv_format->n_planes > 1)
return 0;
if (anv_format->can_ycbcr)
return 0;
if (vk_format_is_depth_or_stencil(vk_format))
return 0;
if (isl_format_supports_sampling(devinfo, isl_format) &&
!isl_format_is_compressed(isl_format))
flags |= VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT;
if (isl_format_supports_vertex_fetch(devinfo, isl_format))
flags |= VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT;
if (isl_is_storage_image_format(isl_format))
flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT;
if (isl_format == ISL_FORMAT_R32_SINT || isl_format == ISL_FORMAT_R32_UINT)
flags |= VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT;
return flags;
}
/**
* Fill the VkDrmFormatModifierPropertiesEXT struct if the VkFormat supports
* the DRM format modifier, and return true. On failure, the output struct
* has undefined content.
*/
static bool
get_drm_format_modifier_properties(const struct anv_physical_device *physical_device,
VkFormat vk_format,
const struct anv_format *anv_format,
uint64_t drm_format_mod,
VkDrmFormatModifierPropertiesEXT *props)
{
const struct gen_device_info *devinfo = &physical_device->info;
*props = (VkDrmFormatModifierPropertiesEXT) {
.drmFormatModifier = drm_format_mod,
.drmFormatModifierPlaneCount = anv_format->n_planes,
.drmFormatModifierTilingFeatures =
get_image_format_features(devinfo, vk_format, anv_format,
VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT,
drm_format_mod),
};
if (props->drmFormatModifierTilingFeatures == 0)
return false;
return true;
}
static void
get_drm_format_modifier_properties_list(const struct anv_physical_device *physical_device,
VkFormat vk_format,
VkDrmFormatModifierPropertiesListEXT *drm_list)
{
const struct anv_format *anv_format = anv_get_format(vk_format);
VK_OUTARRAY_MAKE(out, drm_list->pDrmFormatModifierProperties,
&drm_list->drmFormatModifierCount);
#define TRY_MOD(mod) ({ \
VkDrmFormatModifierPropertiesEXT tmp_props; \
if (get_drm_format_modifier_properties(physical_device, vk_format, \
anv_format, (mod), &tmp_props)) { \
vk_outarray_append(&out, drm_props) { *drm_props = tmp_props; }; \
} \
})
TRY_MOD(I915_FORMAT_MOD_Y_TILED);
TRY_MOD(I915_FORMAT_MOD_X_TILED);
TRY_MOD(DRM_FORMAT_MOD_LINEAR);
#undef TRY_MOD
}
void anv_GetPhysicalDeviceFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkFormat vk_format,
VkFormatProperties* pFormatProperties)
{
ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
const struct gen_device_info *devinfo = &physical_device->info;
const struct anv_format *anv_format = anv_get_format(vk_format);
anv_physical_device_get_format_properties(
physical_device,
format,
pFormatProperties);
*pFormatProperties = (VkFormatProperties) {
.linearTilingFeatures =
get_image_format_features(devinfo, vk_format, anv_format,
VK_IMAGE_TILING_LINEAR,
DRM_FORMAT_MOD_INVALID),
.optimalTilingFeatures =
get_image_format_features(devinfo, vk_format, anv_format,
VK_IMAGE_TILING_OPTIMAL,
DRM_FORMAT_MOD_INVALID),
.bufferFeatures =
get_buffer_format_features(devinfo, vk_format, anv_format),
};
}
void anv_GetPhysicalDeviceFormatProperties2KHR(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkFormat vk_format,
VkFormatProperties2KHR* pFormatProperties)
{
anv_GetPhysicalDeviceFormatProperties(physicalDevice, format,
ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
anv_GetPhysicalDeviceFormatProperties(physicalDevice, vk_format,
&pFormatProperties->formatProperties);
vk_foreach_struct(ext, pFormatProperties->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT:
get_drm_format_modifier_properties_list(physical_device, vk_format,
(VkDrmFormatModifierPropertiesListEXT *)ext);
break;
default:
anv_debug_ignored_stype(ext->sType);
break;
@@ -683,38 +813,48 @@ static VkResult
anv_get_image_format_properties(
struct anv_physical_device *physical_device,
const VkPhysicalDeviceImageFormatInfo2KHR *info,
const VkPhysicalDeviceImageDrmFormatModifierInfoEXT *drm_info,
VkImageFormatProperties *pImageFormatProperties,
VkSamplerYcbcrConversionImageFormatPropertiesKHR *pYcbcrImageFormatProperties)
{
VkFormatProperties format_props;
VkFormatFeatureFlags format_feature_flags;
VkExtent3D maxExtent;
uint32_t maxMipLevels;
uint32_t maxArraySize;
VkSampleCountFlags sampleCounts = VK_SAMPLE_COUNT_1_BIT;
const struct gen_device_info *devinfo = &physical_device->info;
const struct anv_format *format = anv_get_format(info->format);
if (format == NULL)
goto unsupported;
anv_physical_device_get_format_properties(physical_device, info->format,
&format_props);
/* Extract the VkFormatFeatureFlags that are relevant for the queried
* tiling.
*/
if (info->tiling == VK_IMAGE_TILING_LINEAR) {
format_feature_flags = format_props.linearTilingFeatures;
} else if (info->tiling == VK_IMAGE_TILING_OPTIMAL) {
format_feature_flags = format_props.optimalTilingFeatures;
} else {
unreachable("bad VkImageTiling");
uint64_t drm_format_mod = DRM_FORMAT_MOD_INVALID;
if (drm_info) {
assert(info->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT);
drm_format_mod = drm_info->drmFormatModifier;
}
VkFormatFeatureFlags format_feature_flags =
get_image_format_features(devinfo, info->format, format, info->tiling,
drm_format_mod);
/* The core Vulkan spec places strict constraints on the image capabilities
* advertised here. For example, the core spec requires that
* maxMipLevels == log2(maxWidth) + 1
* when tiling is VK_IMAGE_TILING_OPTIMAL; and requires that
* maxExtent >= VkPhysicalDeviceLimits::maxImageDimension${N}D.
* However, the VK_EXT_image_drm_format_modifier specification grants the
* implementation the freedom to further restrict the image capabilities
* when tiling is VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.
*/
switch (info->type) {
default:
unreachable("bad VkImageType");
case VK_IMAGE_TYPE_1D:
/* We reject 1D images with modifiers due to FUD */
if (drm_info)
goto unsupported;
maxExtent.width = 16384;
maxExtent.height = 1;
maxExtent.depth = 1;
@@ -729,10 +869,20 @@ anv_get_image_format_properties(
maxExtent.width = 16384;
maxExtent.height = 16384;
maxExtent.depth = 1;
maxMipLevels = 15; /* log2(maxWidth) + 1 */
maxArraySize = 2048;
if (drm_info) {
maxMipLevels = 1;
maxArraySize = 1;
} else {
maxMipLevels = 15; /* log2(maxWidth) + 1 */
maxArraySize = 2048;
}
break;
case VK_IMAGE_TYPE_3D:
/* We reject 3D images with modifiers due to FUD */
if (drm_info)
goto unsupported;
maxExtent.width = 2048;
maxExtent.height = 2048;
maxExtent.depth = 2048;
@@ -857,11 +1007,11 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties(
.flags = createFlags,
};
return anv_get_image_format_properties(physical_device, &info,
return anv_get_image_format_properties(physical_device, &info, NULL,
pImageFormatProperties, NULL);
}
static const VkExternalMemoryPropertiesKHR prime_fd_props = {
static const VkExternalMemoryPropertiesKHR opaque_fd_props = {
/* If we can handle external, then we can both import and export it. */
.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR |
VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR,
@@ -872,6 +1022,17 @@ static const VkExternalMemoryPropertiesKHR prime_fd_props = {
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR,
};
static const VkExternalMemoryPropertiesKHR dma_buf_props = {
/* If we can handle external, then we can both import and export it. */
.externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR |
VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR,
/* For the moment, let's not support mixing and matching */
.exportFromImportedHandleTypes =
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
.compatibleHandleTypes =
VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
};
VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceImageFormatInfo2KHR* base_info,
@@ -879,6 +1040,7 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR(
{
ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
const VkPhysicalDeviceExternalImageFormatInfoKHR *external_info = NULL;
const VkPhysicalDeviceImageDrmFormatModifierInfoEXT *drm_info = NULL;
VkExternalImageFormatPropertiesKHR *external_props = NULL;
VkSamplerYcbcrConversionImageFormatPropertiesKHR *ycbcr_props = NULL;
VkResult result;
@@ -889,6 +1051,9 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR:
external_info = (const void *) s;
break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT:
drm_info = (const void *) s;
break;
default:
anv_debug_ignored_stype(s->sType);
break;
@@ -911,7 +1076,7 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR(
}
result = anv_get_image_format_properties(physical_device, base_info,
&base_props->imageFormatProperties, ycbcr_props);
drm_info, &base_props->imageFormatProperties, ycbcr_props);
if (result != VK_SUCCESS)
goto fail;
@@ -925,7 +1090,10 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR(
switch (external_info->handleType) {
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR:
if (external_props)
external_props->externalMemoryProperties = prime_fd_props;
external_props->externalMemoryProperties = opaque_fd_props;
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT:
if (external_props)
external_props->externalMemoryProperties = dma_buf_props;
break;
default:
/* From the Vulkan 1.0.42 spec:
@@ -1006,7 +1174,10 @@ void anv_GetPhysicalDeviceExternalBufferPropertiesKHR(
switch (pExternalBufferInfo->handleType) {
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR:
pExternalBufferProperties->externalMemoryProperties = prime_fd_props;
pExternalBufferProperties->externalMemoryProperties = opaque_fd_props;
return;
case VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT:
pExternalBufferProperties->externalMemoryProperties = dma_buf_props;
return;
default:
goto unsupported;

View File

@@ -27,6 +27,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <drm_fourcc.h>
#include "anv_private.h"
#include "util/debug.h"
@@ -34,15 +35,13 @@
#include "vk_format_info.h"
/**
* Exactly one bit must be set in \a aspect.
*/
static isl_surf_usage_flags_t
choose_isl_surf_usage(VkImageCreateFlags vk_create_flags,
VkImageUsageFlags vk_usage,
choose_isl_surf_usage(const VkImageCreateInfo *vk_info,
isl_surf_usage_flags_t isl_extra_usage,
VkImageAspectFlags aspect)
VkImageAspectFlagBits aspect)
{
VkImageCreateFlags vk_create_flags = vk_info->flags;
VkImageUsageFlags vk_usage = vk_info->usage;
isl_surf_usage_flags_t isl_usage = isl_extra_usage;
if (vk_usage & VK_IMAGE_USAGE_SAMPLED_BIT)
@@ -90,14 +89,45 @@ choose_isl_surf_usage(VkImageCreateFlags vk_create_flags,
isl_usage |= ISL_SURF_USAGE_RENDER_TARGET_BIT;
}
if (vk_info->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT)
isl_usage |= ISL_SURF_USAGE_DISABLE_AUX_BIT;
return isl_usage;
}
/**
* Exactly one bit must be set in \a aspect.
*/
static isl_tiling_flags_t
choose_isl_tiling_flags(const struct anv_image_create_info *anv_info,
const struct isl_drm_modifier_info *isl_mod_info)
{
const VkImageCreateInfo *base_info = anv_info->vk_info;
isl_tiling_flags_t flags = 0;
switch (base_info->tiling) {
default:
unreachable("bad VkImageTiling");
case VK_IMAGE_TILING_OPTIMAL:
assert(isl_mod_info == NULL);
flags = ISL_TILING_ANY_MASK;
break;
case VK_IMAGE_TILING_LINEAR:
assert(isl_mod_info == NULL);
flags = ISL_TILING_LINEAR_BIT;
break;
case VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT:
flags = 1 << isl_mod_info->tiling;
break;
}
if (anv_info->isl_tiling_flags)
flags &= anv_info->isl_tiling_flags;
assert(flags);
return flags;
}
static struct anv_surface *
get_surface(struct anv_image *image, VkImageAspectFlags aspect)
get_surface(struct anv_image *image, VkImageAspectFlagBits aspect)
{
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
return &image->planes[plane].surface;
@@ -209,7 +239,7 @@ add_fast_clear_state_buffer(struct anv_image *image,
{
assert(image && device);
assert(image->planes[plane].aux_surface.isl.size > 0 &&
image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT);
image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
/* The offset to the buffer of clear values must be dword-aligned for GPU
* memcpy operations. It is located immediately after the auxiliary surface.
@@ -253,14 +283,14 @@ add_fast_clear_state_buffer(struct anv_image *image,
/**
* Initialize the anv_image::*_surface selected by \a aspect. Then update the
* image's memory requirements (that is, the image's size and alignment).
*
* Exactly one bit must be set in \a aspect.
*/
static VkResult
make_surface(const struct anv_device *dev,
struct anv_image *image,
const struct anv_image_create_info *anv_info,
VkImageAspectFlags aspect)
const VkImageExplicitDrmFormatModifierCreateInfoEXT *explicit_drm_info,
isl_tiling_flags_t tiling_flags,
VkImageAspectFlagBits aspect)
{
const VkImageCreateInfo *vk_info = anv_info->vk_info;
bool ok UNUSED;
@@ -271,18 +301,6 @@ make_surface(const struct anv_device *dev,
[VK_IMAGE_TYPE_3D] = ISL_SURF_DIM_3D,
};
/* Translate the Vulkan tiling to an equivalent ISL tiling, then filter the
* result with an optionally provided ISL tiling argument.
*/
isl_tiling_flags_t tiling_flags =
(vk_info->tiling == VK_IMAGE_TILING_LINEAR) ?
ISL_TILING_LINEAR_BIT : ISL_TILING_ANY_MASK;
if (anv_info->isl_tiling_flags)
tiling_flags &= anv_info->isl_tiling_flags;
assert(tiling_flags);
image->extent = anv_sanitize_image_extent(vk_info->imageType,
vk_info->extent);
@@ -291,9 +309,15 @@ make_surface(const struct anv_device *dev,
anv_get_format_plane(&dev->info, image->vk_format, aspect, image->tiling);
struct anv_surface *anv_surf = &image->planes[plane].surface;
const VkSubresourceLayout *drm_plane_layout = explicit_drm_info ?
&explicit_drm_info->pPlaneLayouts[plane] : NULL;
const isl_surf_usage_flags_t usage =
choose_isl_surf_usage(vk_info->flags, image->usage,
anv_info->isl_extra_usage_flags, aspect);
choose_isl_surf_usage(vk_info, anv_info->isl_extra_usage_flags, aspect);
uint32_t row_pitch = anv_info->stride;
if (explicit_drm_info)
row_pitch = drm_plane_layout->rowPitch;
/* If an image is created as BLOCK_TEXEL_VIEW_COMPATIBLE, then we need to
* fall back to linear on Broadwell and earlier because we aren't
@@ -320,19 +344,72 @@ make_surface(const struct anv_device *dev,
.array_len = vk_info->arrayLayers,
.samples = vk_info->samples,
.min_alignment = 0,
.row_pitch = anv_info->stride,
.row_pitch = row_pitch,
.usage = usage,
.tiling_flags = tiling_flags);
/* isl_surf_init() will fail only if provided invalid input. Invalid input
* is illegal in Vulkan.
*/
assert(ok);
if (!ok) {
/* isl_surf_init() fails only when provided invalid input. Invalid input
* is illegal in Vulkan unless
* VkImageExplicitDrmFormatModifierCreateInfoEXT is given.
*/
assert(explicit_drm_info);
return vk_errorf(dev->instance, dev,
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT,
"isl_surf_init() failed for plane %u", plane);
}
if (explicit_drm_info) {
/* The VK_EXT_image_drm_format_modifier spec permits support of any
* image, but we restrict support to simple images.
*/
assert(aspect == VK_IMAGE_ASPECT_COLOR_BIT);
assert(image->type == VK_IMAGE_TYPE_2D);
assert(image->array_size == 1);
assert(image->samples == 1);
/* FINISHME: YCbCr images with DRM format modifiers */
assert(!anv_get_format(image->vk_format)->can_ycbcr);
if (drm_plane_layout->size < anv_surf->isl.size) {
return vk_errorf(dev->instance, dev,
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT,
"VkSubresourceLayout::size too small for plane %u", plane);
}
if (drm_plane_layout->offset & (anv_surf->isl.alignment - 1)) {
return vk_errorf(dev->instance, dev,
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT,
"VkSubresourceLayout::offset misaligned for plane "
"%u", plane);
}
if (drm_plane_layout->arrayPitch != 0) {
return vk_errorf(dev->instance, dev,
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT,
"VkSubresourceLayout::arrayPitch must be 0");
}
if (drm_plane_layout->depthPitch != 0) {
return vk_errorf(dev->instance, dev,
VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT,
"VkSubresourceLayout::depthPitch must be 0");
}
anv_surf->offset = drm_plane_layout->offset;
image->planes[plane].offset = drm_plane_layout->offset;
image->planes[plane].alignment = anv_surf->isl.alignment;
image->planes[plane].size = drm_plane_layout->size;
image->size = image->planes[plane].offset + image->planes[plane].size;
image->alignment = image->planes[plane].alignment;
} else {
add_surface(image, anv_surf, plane);
}
image->planes[plane].aux_usage = ISL_AUX_USAGE_NONE;
add_surface(image, anv_surf, plane);
/* If an image is created as BLOCK_TEXEL_VIEW_COMPATIBLE, then we need to
* create an identical tiled shadow surface for use while texturing so we
* don't get garbage performance.
@@ -394,7 +471,7 @@ make_surface(const struct anv_device *dev,
add_surface(image, &image->planes[plane].aux_surface, plane);
image->planes[plane].aux_usage = ISL_AUX_USAGE_HIZ;
}
} else if ((aspect & VK_IMAGE_ASPECT_ANY_COLOR_BIT) && vk_info->samples == 1) {
} else if ((aspect & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) && vk_info->samples == 1) {
/* TODO: Disallow compression with :
*
* 1) non multiplanar images (We appear to hit a sampler bug with
@@ -451,7 +528,7 @@ make_surface(const struct anv_device *dev,
}
}
}
} else if ((aspect & VK_IMAGE_ASPECT_ANY_COLOR_BIT) && vk_info->samples > 1) {
} else if ((aspect & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) && vk_info->samples > 1) {
assert(!(vk_info->usage & VK_IMAGE_USAGE_STORAGE_BIT));
assert(image->planes[plane].aux_surface.isl.size == 0);
ok = isl_surf_get_mcs_surf(&dev->isl_dev,
@@ -486,6 +563,38 @@ make_surface(const struct anv_device *dev,
return VK_SUCCESS;
}
static uint32_t
score_drm_format_mod(uint64_t mod)
{
switch (mod) {
default: unreachable("bad DRM format modifier");
case I915_FORMAT_MOD_Y_TILED: return 3;
case I915_FORMAT_MOD_X_TILED: return 2;
case DRM_FORMAT_MOD_LINEAR: return 1;
}
}
static const struct isl_drm_modifier_info *
choose_drm_format_mod(const VkImageDrmFormatModifierListCreateInfoEXT *mod_list)
{
uint64_t best_mod = UINT64_MAX;
uint32_t best_score = 0;
for (uint32_t i = 0; i < mod_list->drmFormatModifierCount; ++i) {
uint64_t mod = mod_list->pDrmFormatModifiers[i];
uint32_t score = score_drm_format_mod(mod);
if (score > best_score) {
best_mod = mod;
best_score = score;
}
}
assert(best_score != 0);
return isl_drm_modifier_get_info(best_mod);
}
VkResult
anv_image_create(VkDevice _device,
const struct anv_image_create_info *create_info,
@@ -494,11 +603,31 @@ anv_image_create(VkDevice _device,
{
ANV_FROM_HANDLE(anv_device, device, _device);
const VkImageCreateInfo *pCreateInfo = create_info->vk_info;
const VkImageDrmFormatModifierListCreateInfoEXT *vk_mod_list = NULL;
const VkImageExplicitDrmFormatModifierCreateInfoEXT *explicit_drm_info = NULL;
const struct isl_drm_modifier_info *isl_mod_info = NULL;
struct anv_image *image = NULL;
VkResult r;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
/* Extract input structs */
vk_foreach_struct_const(s, pCreateInfo->pNext) {
switch (s->sType) {
case VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT:
vk_mod_list = (const VkImageDrmFormatModifierListCreateInfoEXT *) s;
isl_mod_info = choose_drm_format_mod(vk_mod_list);
break;
case VK_STRUCTURE_TYPE_IMAGE_EXCPLICIT_DRM_FORMAT_MODIFIER_CREATE_INFO_EXT:
explicit_drm_info = (const VkImageExplicitDrmFormatModifierCreateInfoEXT *) s;
isl_mod_info = isl_drm_modifier_get_info(explicit_drm_info->drmFormatModifier);
break;
default:
anv_debug_ignored_stype(s->sType);
break;
}
}
anv_assert(pCreateInfo->mipLevels > 0);
anv_assert(pCreateInfo->arrayLayers > 0);
anv_assert(pCreateInfo->samples > 0);
@@ -523,14 +652,21 @@ anv_image_create(VkDevice _device,
image->tiling = pCreateInfo->tiling;
image->disjoint = pCreateInfo->flags & VK_IMAGE_CREATE_DISJOINT_BIT_KHR;
if (isl_mod_info)
image->drm_format_mod = isl_mod_info->modifier;
const struct anv_format *format = anv_get_format(image->vk_format);
assert(format != NULL);
const isl_tiling_flags_t isl_tiling_flags =
choose_isl_tiling_flags(create_info, isl_mod_info);
image->n_planes = format->n_planes;
uint32_t b;
for_each_bit(b, image->aspects) {
r = make_surface(device, image, create_info, (1 << b));
r = make_surface(device, image, create_info, explicit_drm_info,
isl_tiling_flags, (1 << b));
if (r != VK_SUCCESS)
goto fail;
}
@@ -667,12 +803,18 @@ VkResult anv_BindImageMemory2KHR(
return VK_SUCCESS;
}
static void
anv_surface_get_subresource_layout(struct anv_image *image,
struct anv_surface *surface,
const VkImageSubresource *subresource,
VkSubresourceLayout *layout)
void anv_GetImageSubresourceLayout(
VkDevice device,
VkImage _image,
const VkImageSubresource* subresource,
VkSubresourceLayout* layout)
{
ANV_FROM_HANDLE(anv_image, image, _image);
const struct anv_surface *surface =
get_surface(image, subresource->aspectMask);
assert(__builtin_popcount(subresource->aspectMask) == 1);
/* If we are on a non-zero mip level or array slice, we need to
* calculate a real offset.
*/
@@ -681,25 +823,22 @@ anv_surface_get_subresource_layout(struct anv_image *image,
layout->offset = surface->offset;
layout->rowPitch = surface->isl.row_pitch;
layout->depthPitch = isl_surf_get_array_pitch(&surface->isl);
layout->arrayPitch = isl_surf_get_array_pitch(&surface->isl);
layout->size = surface->isl.size;
}
void anv_GetImageSubresourceLayout(
VkDevice device,
VkImage _image,
const VkImageSubresource* pSubresource,
VkSubresourceLayout* pLayout)
{
ANV_FROM_HANDLE(anv_image, image, _image);
assert(__builtin_popcount(pSubresource->aspectMask) == 1);
anv_surface_get_subresource_layout(image,
get_surface(image,
pSubresource->aspectMask),
pSubresource, pLayout);
if (image->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT &&
image->drm_format_mod != DRM_FORMAT_MOD_LINEAR) {
/* We currently support DRM format modifiers on tiled images only when
* the image is "simple".
*/
assert(image->levels == 1);
assert(image->array_size == 1);
assert(image->samples == 1);
layout->depthPitch = 0;
layout->arrayPitch = 0;
} else {
layout->depthPitch = isl_surf_get_array_pitch(&surface->isl);
layout->arrayPitch = isl_surf_get_array_pitch(&surface->isl);
}
}
/**
@@ -751,7 +890,7 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
/* The following switch currently only handles depth stencil aspects.
* TODO: Handle the color aspect.
*/
if (image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT)
if (image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV)
return image->planes[plane].aux_usage;
switch (layout) {
@@ -786,7 +925,7 @@ anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
/* Sampling Layouts */
case VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL:
assert((image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT) == 0);
assert((image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0);
/* Fall-through */
case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR:
@@ -1034,7 +1173,7 @@ anv_image_fill_surface_state(struct anv_device *device,
static VkImageAspectFlags
remap_aspect_flags(VkImageAspectFlags view_aspects)
{
if (view_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT) {
if (view_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) {
if (_mesa_bitcount(view_aspects) == 1)
return VK_IMAGE_ASPECT_COLOR_BIT;
@@ -1394,15 +1533,15 @@ anv_image_get_surface_for_aspect_mask(const struct anv_image *image,
}
break;
case VK_IMAGE_ASPECT_PLANE_0_BIT_KHR:
assert((image->aspects & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT) == 0);
assert((image->aspects & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0);
sanitized_mask = VK_IMAGE_ASPECT_PLANE_0_BIT_KHR;
break;
case VK_IMAGE_ASPECT_PLANE_1_BIT_KHR:
assert((image->aspects & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT) == 0);
assert((image->aspects & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0);
sanitized_mask = VK_IMAGE_ASPECT_PLANE_1_BIT_KHR;
break;
case VK_IMAGE_ASPECT_PLANE_2_BIT_KHR:
assert((image->aspects & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT) == 0);
assert((image->aspects & ~VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0);
sanitized_mask = VK_IMAGE_ASPECT_PLANE_2_BIT_KHR;
break;
default:
@@ -1413,3 +1552,13 @@ anv_image_get_surface_for_aspect_mask(const struct anv_image *image,
uint32_t plane = anv_image_aspect_to_plane(image->aspects, sanitized_mask);
return &image->planes[plane].surface;
}
VkResult
anv_GetImageDrmFormatModifierEXT(VkDevice device_h,
VkImage image_h,
uint64_t *pDrmFormatModifier)
{
ANV_FROM_HANDLE(anv_image, image, image_h);
*pDrmFormatModifier = image->drm_format_mod;
return VK_SUCCESS;
}

View File

@@ -1,117 +0,0 @@
/*
* Copyright © 2015 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include "anv_private.h"
VkResult anv_CreateDmaBufImageINTEL(
VkDevice _device,
const VkDmaBufImageCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDeviceMemory* pMem,
VkImage* pImage)
{
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_device_memory *mem;
struct anv_image *image;
VkResult result;
VkImage image_h;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL);
mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (mem == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
result = anv_image_create(_device,
&(struct anv_image_create_info) {
.isl_tiling_flags = ISL_TILING_X_BIT,
.stride = pCreateInfo->strideInBytes,
.vk_info =
&(VkImageCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.imageType = VK_IMAGE_TYPE_2D,
.format = pCreateInfo->format,
.extent = pCreateInfo->extent,
.mipLevels = 1,
.arrayLayers = 1,
.samples = 1,
/* FIXME: Need a way to use X tiling to allow scanout */
.tiling = VK_IMAGE_TILING_OPTIMAL,
.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
.flags = 0,
}},
pAllocator, &image_h);
if (result != VK_SUCCESS)
goto fail;
close(pCreateInfo->fd);
image = anv_image_from_handle(image_h);
result = anv_bo_cache_import(device, &device->bo_cache,
pCreateInfo->fd, &mem->bo);
if (result != VK_SUCCESS)
goto fail_import;
VkDeviceSize aligned_image_size = align_u64(image->size, 4096);
if (mem->bo->size < aligned_image_size) {
result = vk_errorf(device->instance, device,
VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR,
"dma-buf too small for image in "
"vkCreateDmaBufImageINTEL: %"PRIu64"B < "PRIu64"B",
mem->bo->size, aligned_image_size);
anv_bo_cache_release(device, &device->bo_cache, mem->bo);
goto fail_import;
}
if (device->instance->physicalDevice.supports_48bit_addresses)
mem->bo->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
image->planes[0].bo = mem->bo;
image->planes[0].bo_offset = 0;
assert(image->extent.width > 0);
assert(image->extent.height > 0);
assert(image->extent.depth == 1);
*pMem = anv_device_memory_to_handle(mem);
*pImage = anv_image_to_handle(image);
return VK_SUCCESS;
fail_import:
vk_free2(&device->alloc, pAllocator, image);
fail:
vk_free2(&device->alloc, pAllocator, mem);
return result;
}

View File

@@ -67,7 +67,6 @@ struct anv_debug_report_callback;
struct gen_l3_config;
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_intel.h>
#include <vulkan/vk_icd.h>
#include <vulkan/vk_android_native_buffer.h>
@@ -1552,12 +1551,12 @@ anv_pipe_invalidate_bits_for_access_flags(VkAccessFlags flags)
return pipe_bits;
}
#define VK_IMAGE_ASPECT_ANY_COLOR_BIT ( \
#define VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV ( \
VK_IMAGE_ASPECT_COLOR_BIT | \
VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | \
VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | \
VK_IMAGE_ASPECT_PLANE_2_BIT_KHR)
#define VK_IMAGE_ASPECT_PLANES_BITS ( \
#define VK_IMAGE_ASPECT_PLANES_BITS_ANV ( \
VK_IMAGE_ASPECT_PLANE_0_BIT_KHR | \
VK_IMAGE_ASPECT_PLANE_1_BIT_KHR | \
VK_IMAGE_ASPECT_PLANE_2_BIT_KHR)
@@ -2253,7 +2252,7 @@ static inline VkImageAspectFlags
anv_plane_to_aspect(VkImageAspectFlags image_aspects,
uint32_t plane)
{
if (image_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT) {
if (image_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) {
if (_mesa_bitcount(image_aspects) > 1)
return VK_IMAGE_ASPECT_PLANE_0_BIT_KHR << plane;
return VK_IMAGE_ASPECT_COLOR_BIT;
@@ -2280,7 +2279,7 @@ anv_get_format_planes(VkFormat vk_format)
struct anv_format_plane
anv_get_format_plane(const struct gen_device_info *devinfo, VkFormat vk_format,
VkImageAspectFlags aspect, VkImageTiling tiling);
VkImageAspectFlagBits aspect, VkImageTiling tiling);
static inline enum isl_format
anv_get_isl_format(const struct gen_device_info *devinfo, VkFormat vk_format,
@@ -2337,6 +2336,12 @@ struct anv_image {
VkImageUsageFlags usage; /**< Superset of VkImageCreateInfo::usage. */
VkImageTiling tiling; /** VkImageCreateInfo::tiling */
/**
* Must be DRM_FORMAT_MOD_INVALID unless tiling is
* VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.
*/
uint64_t drm_format_mod;
VkDeviceSize size;
uint32_t alignment;
@@ -2547,7 +2552,7 @@ anv_image_expand_aspects(const struct anv_image *image,
/* If the underlying image has color plane aspects and
* VK_IMAGE_ASPECT_COLOR_BIT has been requested, then return the aspects of
* the underlying image. */
if ((image->aspects & VK_IMAGE_ASPECT_PLANES_BITS) != 0 &&
if ((image->aspects & VK_IMAGE_ASPECT_PLANES_BITS_ANV) != 0 &&
aspects == VK_IMAGE_ASPECT_COLOR_BIT)
return image->aspects;
@@ -2562,8 +2567,8 @@ anv_image_aspects_compatible(VkImageAspectFlags aspects1,
return true;
/* Only 1 color aspects are compatibles. */
if ((aspects1 & VK_IMAGE_ASPECT_ANY_COLOR_BIT) != 0 &&
(aspects2 & VK_IMAGE_ASPECT_ANY_COLOR_BIT) != 0 &&
if ((aspects1 & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) != 0 &&
(aspects2 & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) != 0 &&
_mesa_bitcount(aspects1) == _mesa_bitcount(aspects2))
return true;

View File

@@ -439,7 +439,7 @@ get_fast_clear_state_address(const struct anv_device *device,
enum fast_clear_state_field field)
{
assert(device && image);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
assert(level < anv_image_aux_levels(image, aspect));
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
@@ -478,7 +478,7 @@ genX(set_image_needs_resolve)(struct anv_cmd_buffer *cmd_buffer,
unsigned level, bool needs_resolve)
{
assert(cmd_buffer && image);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
assert(level < anv_image_aux_levels(image, aspect));
const struct anv_address resolve_flag_addr =
@@ -502,7 +502,7 @@ genX(load_needs_resolve_predicate)(struct anv_cmd_buffer *cmd_buffer,
unsigned level)
{
assert(cmd_buffer && image);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
assert(level < anv_image_aux_levels(image, aspect));
const struct anv_address resolve_flag_addr =
@@ -531,7 +531,7 @@ init_fast_clear_state_entry(struct anv_cmd_buffer *cmd_buffer,
unsigned level)
{
assert(cmd_buffer && image);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
assert(level < anv_image_aux_levels(image, aspect));
uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
@@ -601,7 +601,7 @@ genX(copy_fast_clear_dwords)(struct anv_cmd_buffer *cmd_buffer,
bool copy_from_surface_state)
{
assert(cmd_buffer && image);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT);
assert(image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
assert(level < anv_image_aux_levels(image, aspect));
struct anv_bo *ss_bo =
@@ -658,7 +658,7 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
{
/* Validate the inputs. */
assert(cmd_buffer);
assert(image && image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT);
assert(image && image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV);
/* These values aren't supported for simplicity's sake. */
assert(level_count != VK_REMAINING_MIP_LEVELS &&
layer_count != VK_REMAINING_ARRAY_LAYERS);
@@ -941,7 +941,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
VkImageAspectFlags att_aspects = vk_format_aspects(att->format);
VkImageAspectFlags clear_aspects = 0;
if (att_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT) {
if (att_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) {
/* color attachment */
if (att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) {
clear_aspects |= VK_IMAGE_ASPECT_COLOR_BIT;
@@ -968,7 +968,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
anv_assert(iview->n_planes == 1);
union isl_color_value clear_color = { .u32 = { 0, } };
if (att_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT) {
if (att_aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) {
assert(att_aspects == VK_IMAGE_ASPECT_COLOR_BIT);
color_attachment_compute_aux_usage(cmd_buffer->device,
state, i, begin->renderArea,
@@ -1434,7 +1434,7 @@ void genX(CmdPipelineBarrier)(
transition_depth_buffer(cmd_buffer, image,
pImageMemoryBarriers[i].oldLayout,
pImageMemoryBarriers[i].newLayout);
} else if (range->aspectMask & VK_IMAGE_ASPECT_ANY_COLOR_BIT) {
} else if (range->aspectMask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) {
VkImageAspectFlags color_aspects =
anv_image_expand_aspects(image, range->aspectMask);
uint32_t aspect_bit;
@@ -1648,7 +1648,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
}
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
assert(stage == MESA_SHADER_FRAGMENT);
if ((desc->image_view->aspect_mask & VK_IMAGE_ASPECT_ANY_COLOR_BIT) == 0) {
if ((desc->image_view->aspect_mask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) == 0) {
/* For depth and stencil input attachments, we treat it like any
* old texture that a user may have bound.
*/
@@ -2947,7 +2947,7 @@ cmd_buffer_subpass_transition_layouts(struct anv_cmd_buffer * const cmd_buffer,
att_state->input_aux_usage != att_state->aux_usage;
if (subpass_end) {
target_layout = att_desc->final_layout;
} else if (iview->aspect_mask & VK_IMAGE_ASPECT_ANY_COLOR_BIT &&
} else if (iview->aspect_mask & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV &&
!input_needs_resolve) {
/* Layout transitions before the final only help to enable sampling as
* an input attachment. If the input attachment supports sampling
@@ -2966,7 +2966,7 @@ cmd_buffer_subpass_transition_layouts(struct anv_cmd_buffer * const cmd_buffer,
att_state->aux_usage =
anv_layout_to_aux_usage(&cmd_buffer->device->info, image,
VK_IMAGE_ASPECT_DEPTH_BIT, target_layout);
} else if (image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT) {
} else if (image->aspects & VK_IMAGE_ASPECT_ANY_COLOR_BIT_ANV) {
assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);
transition_color_buffer(cmd_buffer, image, VK_IMAGE_ASPECT_COLOR_BIT,
iview->planes[0].isl.base_level, 1,

View File

@@ -95,7 +95,6 @@ libanv_files = files(
'anv_formats.c',
'anv_genX.h',
'anv_image.c',
'anv_intel.c',
'anv_nir.h',
'anv_nir_apply_pipeline_layout.c',
'anv_nir_lower_input_attachments.c',

View File

@@ -107,7 +107,7 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<type category="define">// Vulkan 1.0 version number
#define <name>VK_API_VERSION_1_0</name> <type>VK_MAKE_VERSION</type>(1, 0, 0)// Patch version should always be set to 0</type>
<type category="define">// Version of this file
#define <name>VK_HEADER_VERSION</name> 64</type>
#define <name>VK_HEADER_VERSION</name> 65</type>
<type category="define">
#define <name>VK_DEFINE_HANDLE</name>(object) typedef struct object##_T* object;</type>
@@ -2646,6 +2646,35 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<member>const <type>void</type>* <name>pNext</name></member> <!-- Pointer to next structure -->
<member><type>VkQueueGlobalPriorityEXT</type> <name>globalPriority</name></member>
</type>
<type category="struct" name="VkDrmFormatModifierPropertiesListEXT" returnedonly="true">
<member values="VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT"><type>VkStructureType</type> <name>sType</name></member>
<member><type>void</type>* <name>pNext</name></member>
<member optional="true"><type>uint32_t</type> <name>drmFormatModifierCount</name></member>
<member optional="true,false" len="drmFormatModifierCount"><type>VkDrmFormatModifierPropertiesEXT</type>* <name>pDrmFormatModifierProperties</name></member>
</type>
<type category="struct" name="VkDrmFormatModifierPropertiesEXT" returnedonly="true">
<member><type>uint64_t</type> <name>drmFormatModifier</name></member>
<member><type>uint32_t</type> <name>drmFormatModifierPlaneCount</name></member>
<member><type>VkFormatFeatureFlags</type> <name>drmFormatModifierTilingFeatures</name></member>
</type>
<type category="struct" name="VkPhysicalDeviceImageDrmFormatModifierInfoEXT">
<member values="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
<member>const <type>void</type>* <name>pNext</name></member>
<member><type>uint64_t</type> <name>drmFormatModifier</name></member>
</type>
<type category="struct" name="VkImageDrmFormatModifierListCreateInfoEXT">
<member values="VK_STRUCTURE_TYPE_FLEXIBLE_DRM_FORMAT_MODIFIER_LIST_IMAGE_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
<member>const <type>void</type>* <name>pNext</name></member>
<member><type>uint32_t</type> <name>drmFormatModifierCount</name></member>
<member>const <type>uint64_t</type>* <name>pDrmFormatModifiers</name></member>
</type>
<type category="struct" name="VkImageExplicitDrmFormatModifierCreateInfoEXT">
<member values="VK_STRUCTURE_TYPE_IMAGE_EXCPLICIT_DRM_FORMAT_MODIFIER_CREATE_INFO_EXT"><type>VkStructureType</type> <name>sType</name></member>
<member>const <type>void</type>* <name>pNext</name></member>
<member><type>uint64_t</type> <name>drmFormatModifier</name></member>
<member optional="false"><type>uint32_t</type> <name>planeCount</name></member>
<member len="planeCount"><type>VkSubresourceLayout</type>* <name>pPlaneLayouts</name></member>
</type>
</types>
<comment>Vulkan enumerant (token) definitions</comment>
@@ -2666,6 +2695,7 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<enum value="1" name="VK_TRUE"/>
<enum value="0" name="VK_FALSE"/>
<enum value="(~0U)" name="VK_QUEUE_FAMILY_IGNORED"/>
<enum value="(~0U-2)" name="VK_QUEUE_FAMILY_FOREIGN_EXT"/>
<enum value="(~0U-1)" name="VK_QUEUE_FAMILY_EXTERNAL_KHR"/>
<enum value="(~0U)" name="VK_SUBPASS_EXTERNAL"/>
<enum value="32" name="VK_MAX_DEVICE_GROUP_SIZE_KHX"/>
@@ -5434,6 +5464,12 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<param optional="false,true"><type>size_t</type>* <name>pInfoSize</name></param>
<param optional="true" len="pInfoSize"><type>void</type>* <name>pInfo</name></param>
</command>
<command>
<proto><type>VkResult</type> <name>vkGetImageDrmFormatModifierEXT</name></proto>
<param><type>VkDevice</type> <name>device</name></param>
<param><type>VkImage</type> <name>image</name></param>
<param optional="false"><type>uint64_t</type>* <name>pDrmFormatModifier</name></param>
</command>
</commands>
<feature api="vulkan" name="VK_VERSION_1_0" number="1.0" comment="Vulkan core API interface definitions">
@@ -6940,16 +6976,18 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<enum value="&quot;VK_MVK_moltenvk&quot;" name="VK_MVK_MOLTENVK_EXTENSION_NAME"/>
</require>
</extension>
<extension name="VK_MESA_extension_126" number="126" author="MESA" contact="Chad Versace @chadversary" supported="disabled">
<extension name="VK_EXT_external_memory_dma_buf" number="126" type="device" requires="VK_KHR_external_memory_fd" author="EXT" contact="Chad Versace @chadversary" supported="vulkan">
<require>
<enum value="0" name="VK_MESA_EXTENSION_126_SPEC_VERSION"/>
<enum value="&quot;VK_MESA_extension_126&quot;" name="VK_MESA_EXTENSION_126_EXTENSION_NAME"/>
<enum value="1" name="VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION"/>
<enum value="&quot;VK_EXT_external_memory_dma_buf&quot;" name="VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME"/>
<enum bitpos="7" extends="VkExternalMemoryHandleTypeFlagBitsKHR" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT"/>
</require>
</extension>
<extension name="VK_MESA_extension_127" number="127" author="MESA" contact="Chad Versace @chadversary" supported="disabled">
<extension name="VK_EXT_queue_family_foreign" number="127" type="device" author="EXT" requires="VK_KHR_external_memory" contact="Chad Versace @chadversary" supported="vulkan">
<require>
<enum value="0" name="VK_MESA_EXTENSION_127_SPEC_VERSION"/>
<enum value="&quot;VK_MESA_extension_127&quot;" name="VK_MESA_EXTENSION_127_EXTENSION_NAME"/>
<enum value="1" name="VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION"/>
<enum value="&quot;VK_EXT_queue_family_foreign&quot;" name="VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME"/>
<enum name="VK_QUEUE_FAMILY_FOREIGN_EXT"/>
</require>
</extension>
<extension name="VK_KHR_dedicated_allocation" number="128" type="device" author="KHR" requires="VK_KHR_get_memory_requirements2" contact="James Jones @cubanismo" supported="vulkan">
@@ -7310,10 +7348,29 @@ private version is maintained in the 1.0 branch of the member gitlab server.
<type name="VkBindImageMemoryInfoKHR"/>
</require>
</extension>
<extension name="VK_EXT_extension_159" number="159" author="EXT" contact="Chad Versace @chadversary" supported="disabled">
<extension name="VK_EXT_image_drm_format_modifier" number="159" type="device" requires="VK_KHR_bind_memory2,VK_KHR_sampler_ycbcr_conversion" author="EXT" contact="Chad Versace @chadversary" supported="vulkan">
<require>
<enum value="0" name="VK_EXT_EXTENSION_159_SPEC_VERSION"/>
<enum value="&quot;VK_EXT_extension_159&quot;" name="VK_EXT_EXTENSION_159_EXTENSION_NAME"/>
<enum value="1" name="VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION"/>
<enum value="&quot;VK_EXT_image_drm_format_modifier&quot;" name="VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME"/>
<enum offset="0" dir="-" extends="VkResult" name="VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT"/>
<enum offset="0" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT"/>
<enum offset="1" extends="VkStructureType" name="VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT"/>
<enum offset="2" extends="VkStructureType" name="VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT"/>
<enum offset="3" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT"/>
<enum offset="4" extends="VkStructureType" name="VK_STRUCTURE_TYPE_IMAGE_EXCPLICIT_DRM_FORMAT_MODIFIER_CREATE_INFO_EXT"/>
<enum offset="0" extends="VkImageTiling" name="VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT"/>
<enum bitpos="7" extends="VkImageAspectFlagBits" name="VK_IMAGE_ASPECT_PLANE_3_BIT_EXT"/>
<type name="VkDrmFormatModifierPropertiesListEXT"/>
<type name="VkDrmFormatModifierPropertiesEXT"/>
<type name="VkPhysicalDeviceImageDrmFormatModifierInfoEXT"/>
<type name="VkImageDrmFormatModifierListCreateInfoEXT"/>
<type name="VkImageExplicitDrmFormatModifierCreateInfoEXT"/>
<command name="vkGetImageDrmFormatModifierEXT"/>
</require>
</extension>
<extension name="VK_EXT_extension_160" number="160" author="EXT" contact="Mark Young @MarkY_LunarG" supported="disabled">