summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_formats.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-13 16:44:07 -0800
committerDaniel Stone <[email protected]>2018-02-21 22:37:10 +0000
commitc757fd2852849a5c8db92032ff66b6bbe5073f1c (patch)
tree8594c24ed51d12120c089317e19696d1a957a8f7 /src/intel/vulkan/anv_formats.c
parentadca1e4a92a53a403b7620c3356dcf038f0bcecc (diff)
anv/image: Add support for modifiers for WSI
This adds support for the modifiers portion of the WSI "extension". Reviewed-by: Daniel Stone <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_formats.c')
-rw-r--r--src/intel/vulkan/anv_formats.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 4075ae8e620..9c52ad5acbd 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -22,6 +22,7 @@
*/
#include "anv_private.h"
+#include "drm_fourcc.h"
#include "vk_enum_to_str.h"
#include "vk_format_info.h"
#include "vk_util.h"
@@ -651,6 +652,38 @@ get_buffer_format_features(const struct gen_device_info *devinfo,
return flags;
}
+static void
+get_wsi_format_modifier_properties_list(const struct anv_physical_device *physical_device,
+ VkFormat vk_format,
+ struct wsi_format_modifier_properties_list *list)
+{
+ const struct anv_format *anv_format = anv_get_format(vk_format);
+
+ VK_OUTARRAY_MAKE(out, list->modifier_properties, &list->modifier_count);
+
+ /* This is a simplified list where all the modifiers are available */
+ assert(vk_format == VK_FORMAT_B8G8R8_SRGB ||
+ vk_format == VK_FORMAT_B8G8R8_UNORM ||
+ vk_format == VK_FORMAT_B8G8R8A8_SRGB ||
+ vk_format == VK_FORMAT_B8G8R8A8_UNORM);
+
+ uint64_t modifiers[] = {
+ DRM_FORMAT_MOD_LINEAR,
+ I915_FORMAT_MOD_X_TILED,
+ I915_FORMAT_MOD_Y_TILED,
+ };
+
+ for (uint32_t i = 0; i < ARRAY_SIZE(modifiers); i++) {
+ vk_outarray_append(&out, mod_props) {
+ mod_props->modifier = modifiers[i];
+ if (isl_drm_modifier_has_aux(modifiers[i]))
+ mod_props->modifier_plane_count = 2;
+ else
+ mod_props->modifier_plane_count = anv_format->n_planes;
+ }
+ }
+}
+
void anv_GetPhysicalDeviceFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat vk_format,
@@ -677,11 +710,16 @@ void anv_GetPhysicalDeviceFormatProperties2KHR(
VkFormat format,
VkFormatProperties2KHR* pFormatProperties)
{
+ ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice);
anv_GetPhysicalDeviceFormatProperties(physicalDevice, format,
&pFormatProperties->formatProperties);
vk_foreach_struct(ext, pFormatProperties->pNext) {
switch (ext->sType) {
+ case VK_STRUCTURE_TYPE_WSI_FORMAT_MODIFIER_PROPERTIES_LIST_MESA:
+ get_wsi_format_modifier_properties_list(physical_device, format,
+ (void *)ext);
+ break;
default:
anv_debug_ignored_stype(ext->sType);
break;