aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <chadversary@chromium.org>2019-07-26 10:23:15 -0700
committerChad Versace <chadversary@chromium.org>2019-10-18 15:47:20 -0700
commitb01f3d424cad2fb320804393fd81fdb6fbf6f074 (patch)
tree8eec0639883462fc19d1fc853a90cb439e2a4f4c
parente38801b376ae977a749dcdc24f9a4bbd425ed69f (diff)
downloadmesa-anv-image-cleanup.zip
mesa-anv-image-cleanup.tar.xz
anv: Replace anv_image_create_info::isl_tiling_flags -> drm_format_modanv-image-cleanup
The field 'isl_tiling_flags' offered more flexibility than needed. The driver set at most one flag; and when set, the driver translated the sole flag into a DRM format modifier. This patch enforces that convention by replacing field 'isl_tiling_flags' with 'drm_format_mod'. Now anv_image_create_info's behavior when overriding tiling is aligned with VK_EXT_image_drm_format_modifier; that is, anv_image_create_info::drm_format_mod is analagous to VkImageDrmFormatModifierExplicitCreateInfoEXT::drmFormatModifier. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
-rw-r--r--src/intel/vulkan/anv_android.c8
-rw-r--r--src/intel/vulkan/anv_image.c14
-rw-r--r--src/intel/vulkan/anv_intel.c5
-rw-r--r--src/intel/vulkan/anv_private.h4
4 files changed, 12 insertions, 19 deletions
diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c
index a8c1d48..5dc9de3 100644
--- a/src/intel/vulkan/anv_android.c
+++ b/src/intel/vulkan/anv_android.c
@@ -413,6 +413,7 @@ anv_image_from_external(
struct anv_image_create_info anv_info = {
.vk_info = base_info,
+ .drm_format_mod = DRM_FORMAT_MOD_INVALID,
.isl_extra_usage_flags = ISL_SURF_USAGE_DISABLE_AUX_BIT,
.external_format = true,
};
@@ -447,6 +448,7 @@ anv_image_from_gralloc(VkDevice device_h,
struct anv_image_create_info anv_info = {
.vk_info = base_info,
+ .drm_format_mod = DRM_FORMAT_MOD_INVALID,
.isl_extra_usage_flags = ISL_SURF_USAGE_DISABLE_AUX_BIT,
};
@@ -478,13 +480,13 @@ anv_image_from_gralloc(VkDevice device_h,
int i915_tiling = anv_gem_get_tiling(device, bo->gem_handle);
switch (i915_tiling) {
case I915_TILING_NONE:
- anv_info.isl_tiling_flags = ISL_TILING_LINEAR_BIT;
+ anv_info.drm_format_mod = DRM_FORMAT_MOD_LINEAR;
break;
case I915_TILING_X:
- anv_info.isl_tiling_flags = ISL_TILING_X_BIT;
+ anv_info.drm_format_mod = I915_FORMAT_MOD_X_TILED;
break;
case I915_TILING_Y:
- anv_info.isl_tiling_flags = ISL_TILING_Y0_BIT;
+ anv_info.drm_format_mod = I915_FORMAT_MOD_Y_TILED;
break;
case -1:
result = vk_errorf(device->instance, device,
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index bd00bc8..e34c77f 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -111,9 +111,6 @@ choose_isl_tiling_flags(const struct anv_image_create_info *anv_info,
break;
}
- if (anv_info->isl_tiling_flags)
- flags &= anv_info->isl_tiling_flags;
-
if (legacy_scanout)
flags &= ISL_TILING_LINEAR_BIT | ISL_TILING_X_BIT;
@@ -703,18 +700,10 @@ anv_image_from_swapchain(VkDevice device,
local_create_info.samples = VK_SAMPLE_COUNT_1_BIT;
local_create_info.usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
- /* If the image has a particular modifier, specify that modifier. */
- struct wsi_image_create_info local_wsi_info = {
- .sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA,
- .modifier_count = 1,
- .modifiers = &swapchain_image->drm_format_mod,
- };
- if (swapchain_image->drm_format_mod != DRM_FORMAT_MOD_INVALID)
- __vk_append_struct(&local_create_info, &local_wsi_info);
-
return anv_image_create(device,
&(struct anv_image_create_info) {
.vk_info = &local_create_info,
+ .drm_format_mod = swapchain_image->drm_format_mod,
.external_format = swapchain_image->external_format,
},
pAllocator,
@@ -761,6 +750,7 @@ anv_CreateImage(VkDevice device,
return anv_image_create(device,
&(struct anv_image_create_info) {
.vk_info = pCreateInfo,
+ .drm_format_mod = DRM_FORMAT_MOD_INVALID,
.external_format = use_external_format,
},
pAllocator,
diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c
index 146fc41..59900c7 100644
--- a/src/intel/vulkan/anv_intel.c
+++ b/src/intel/vulkan/anv_intel.c
@@ -27,6 +27,8 @@
#include <unistd.h>
#include <fcntl.h>
+#include "drm-uapi/drm_fourcc.h"
+
#include "anv_private.h"
VkResult anv_CreateDmaBufImageINTEL(
@@ -51,7 +53,7 @@ VkResult anv_CreateDmaBufImageINTEL(
result = anv_image_create(_device,
&(struct anv_image_create_info) {
- .isl_tiling_flags = ISL_TILING_X_BIT,
+ .drm_format_mod = I915_FORMAT_MOD_X_TILED,
.stride = pCreateInfo->strideInBytes,
.vk_info = &(VkImageCreateInfo) {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
@@ -61,7 +63,6 @@ VkResult anv_CreateDmaBufImageINTEL(
.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,
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 9370d2e..0e8a7d6 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -3500,8 +3500,8 @@ void anv_image_fill_surface_state(struct anv_device *device,
struct anv_image_create_info {
const VkImageCreateInfo *vk_info;
- /** An opt-in bitmask which filters an ISL-mapping of the Vulkan tiling. */
- isl_tiling_flags_t isl_tiling_flags;
+ /** Force a specific tiling unless DRM_FORMAT_MOD_INVALID. */
+ uint64_t drm_format_mod;
/** These flags will be added to any derived from VkImageCreateInfo. */
isl_surf_usage_flags_t isl_extra_usage_flags;