[Mesa-dev] [PATCH 10/14] vulkan/wsi: Add drm_modifier member to wsi_image

Daniel Stone daniels at collabora.com
Fri Jul 21 13:42:13 UTC 2017


Not yet used anywhere.

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 src/amd/vulkan/radv_wsi.c   | 6 ++++++
 src/intel/vulkan/anv_wsi.c  | 9 +++++++++
 src/vulkan/wsi/wsi_common.h | 1 +
 3 files changed, 16 insertions(+)

diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index be6f341ef8..a406056fff 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -27,6 +27,11 @@
 #include "radv_meta.h"
 #include "wsi_common.h"
 #include "vk_util.h"
+#include <drm_fourcc.h>
+
+#ifndef DRM_FORMAT_MOD_INVALID
+#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
+#endif
 
 static const struct wsi_callbacks wsi_cbs = {
    .get_phys_device_format_properties = radv_GetPhysicalDeviceFormatProperties,
@@ -257,6 +262,7 @@ radv_wsi_image_create(VkDevice device_h,
 	if (!radv_get_memory_fd(device, memory, &wsi_image->fds[0]))
 		goto fail;
 	wsi_image->num_planes = 1;
+	wsi_image->drm_modifier = DRM_FORMAT_MOD_INVALID;
 	wsi_image->sizes[0] = image->size;
 	wsi_image->offsets[0] = image->offset;
 	wsi_image->row_pitches[0] = surface->u.legacy.level[0].nblk_x * surface->bpe;
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 5023f3445b..c772438219 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -259,6 +259,15 @@ anv_wsi_image_create(VkDevice device_h,
 
    wsi_image->image = image_h;
    wsi_image->memory = memory_h;
+
+   /* We don't yet allow sharing of aux planes with the winsys. Doing so
+    * would require a separate external_aux_usage member in the anv_image,
+    * to disambiguate between the case where we allocate an aux usage for our
+    * own internal use, as opposed to when the winsys can use it. Else we may
+    * incorrectly pass CCS surfaces to a non-CCS-aware winsys/kernel.
+    */
+   wsi_image->drm_modifier =
+      isl_drm_modifier_from_tiling(surface->isl.tiling, ISL_AUX_USAGE_NONE);
    wsi_image->num_planes = 1;
    wsi_image->fds[0] = fd;
    wsi_image->sizes[0] = image->size;
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 33fa8c2b0d..ee0fb8357a 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -36,6 +36,7 @@ struct wsi_image_base {
    VkImage linear_image;
    VkDeviceMemory linear_memory;
 
+   uint64_t drm_modifier;
    int num_planes;
    uint32_t sizes[4];
    uint32_t offsets[4];
-- 
2.13.2



More information about the mesa-dev mailing list