/* We don't advertise DISJOINT for modifiers with aux, and therefore we
* don't handle queries of the modifier's "aux plane" here.
*/
- assert(!isl_drm_modifier_has_aux(image->drm_format_mod));
+ assert(!isl_drm_modifier_has_aux(image->vk.drm_format_mod));
plane = aspect - VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT;
} else {
enum anv_image_memory_binding binding =
ANV_IMAGE_MEMORY_BINDING_PLANE_0 + plane;
- if (image->drm_format_mod != DRM_FORMAT_MOD_INVALID)
+ if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID)
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
/* We believe that 256B alignment may be sufficient, but we choose 4K due to
enum anv_image_memory_binding binding =
ANV_IMAGE_MEMORY_BINDING_PLANE_0 + plane;
- if (image->drm_format_mod != DRM_FORMAT_MOD_INVALID &&
- !isl_drm_modifier_has_aux(image->drm_format_mod))
+ if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID &&
+ !isl_drm_modifier_has_aux(image->vk.drm_format_mod))
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
result = add_surface(device, image, &image->planes[plane].aux_surface,
if (anv_surface_is_valid(&plane->aux_surface)) {
enum anv_image_memory_binding binding = primary_binding;
- if (image->drm_format_mod != DRM_FORMAT_MOD_INVALID &&
- !isl_drm_modifier_has_aux(image->drm_format_mod))
+ if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID &&
+ !isl_drm_modifier_has_aux(image->vk.drm_format_mod))
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
/* Display hardware requires that the aux surface start at
if (plane->fast_clear_memory_range.size > 0) {
enum anv_image_memory_binding binding = primary_binding;
- if (image->drm_format_mod != DRM_FORMAT_MOD_INVALID)
+ if (image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID)
binding = ANV_IMAGE_MEMORY_BINDING_PRIVATE;
/* We believe that 256B alignment may be sufficient, but we choose 4K
const struct anv_image *image)
{
/* Image must have a modifier if and only if it has modifier tiling. */
- assert((image->drm_format_mod != DRM_FORMAT_MOD_INVALID) ==
+ assert((image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID) ==
(image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT));
- if (image->drm_format_mod == DRM_FORMAT_MOD_INVALID)
+ if (image->vk.drm_format_mod == DRM_FORMAT_MOD_INVALID)
return VK_SUCCESS;
const struct isl_drm_modifier_info *isl_mod_info =
- isl_drm_modifier_get_info(image->drm_format_mod);
+ isl_drm_modifier_get_info(image->vk.drm_format_mod);
/* Driver must support the modifier. */
assert(isl_drm_modifier_get_score(&device->info, isl_mod_info->modifier));
}
assert(isl_mod_info);
+ assert(image->vk.drm_format_mod == DRM_FORMAT_MOD_INVALID);
+ image->vk.drm_format_mod = isl_mod_info->modifier;
}
image->needs_set_tiling = wsi_info && wsi_info->scanout;
- image->drm_format_mod = isl_mod_info ? isl_mod_info->modifier :
- DRM_FORMAT_MOD_INVALID;
for (int i = 0; i < ANV_IMAGE_MEMORY_BINDING_END; ++i) {
image->bindings[i] = (struct anv_image_binding) {
VkImageDrmFormatModifierListCreateInfoEXT local_modifier_info = {
.sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT,
.drmFormatModifierCount = 1,
- .pDrmFormatModifiers = &swapchain_image->drm_format_mod,
+ .pDrmFormatModifiers = &swapchain_image->vk.drm_format_mod,
};
- if (swapchain_image->drm_format_mod != DRM_FORMAT_MOD_INVALID)
+ if (swapchain_image->vk.drm_format_mod != DRM_FORMAT_MOD_INVALID)
__vk_append_struct(&local_create_info, &local_modifier_info);
assert(swapchain_image->vk.image_type == local_create_info.imageType);
unreachable("bad VkImageAspectFlags");
}
- if (mem_plane == 1 && isl_drm_modifier_has_aux(image->drm_format_mod)) {
+ if (mem_plane == 1 && isl_drm_modifier_has_aux(image->vk.drm_format_mod)) {
assert(image->n_planes == 1);
/* If the memory binding differs between primary and aux, then the
* returned offset will be incorrect.
}
}
-VkResult anv_GetImageDrmFormatModifierPropertiesEXT(
- VkDevice device,
- VkImage _image,
- VkImageDrmFormatModifierPropertiesEXT* pProperties)
-{
- ANV_FROM_HANDLE(anv_image, image, _image);
-
- assert(pProperties->sType ==
- VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT);
-
- pProperties->drmFormatModifier = image->drm_format_mod;
-
- return VK_SUCCESS;
-}
-
/**
* This function returns the assumed isl_aux_state for a given VkImageLayout.
* Because Vulkan image layouts don't map directly to isl_aux_state enums, the
assert(image->vk.aspects == VK_IMAGE_ASPECT_COLOR_BIT);
enum isl_aux_state aux_state =
- isl_drm_modifier_get_default_aux_state(image->drm_format_mod);
+ isl_drm_modifier_get_default_aux_state(image->vk.drm_format_mod);
switch (aux_state) {
default:
#include <vulkan/vulkan_android.h>
+#ifndef _WIN32
+#include <drm-uapi/drm_fourcc.h>
+#endif
+
#include "vk_alloc.h"
+#include "vk_common_entrypoints.h"
#include "vk_device.h"
#include "vk_format.h"
#include "vk_util.h"
else
image->external_handle_types = 0;
+#ifndef _WIN32
+ image->drm_format_mod = ((1ULL << 56) - 1) /* DRM_FORMAT_MOD_INVALID */;
+#endif
+
#ifdef ANDROID
const VkExternalFormatANDROID *ext_format =
vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_FORMAT_ANDROID);
vk_object_free(device, alloc, image);
}
+#ifndef _WIN32
+VKAPI_ATTR VkResult VKAPI_CALL
+vk_common_GetImageDrmFormatModifierPropertiesEXT(UNUSED VkDevice device,
+ VkImage _image,
+ VkImageDrmFormatModifierPropertiesEXT *pProperties)
+{
+ VK_FROM_HANDLE(vk_image, image, _image);
+
+ assert(pProperties->sType ==
+ VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT);
+
+ assert(image->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT);
+ pProperties->drmFormatModifier = image->drm_format_mod;
+
+ return VK_SUCCESS;
+}
+#endif
+
void
vk_image_set_format(struct vk_image *image, VkFormat format)
{