[Mesa-dev] [RFC v5 14/19] vulkan/wsi: Add drm_modifier member to wsi_image

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Mon Nov 6 22:02:44 UTC 2017


From: Daniel Stone <daniels at collabora.com>

Not yet used anywhere.

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

diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index 6b352aebf9..fb32bb83e0 100644
--- a/src/amd/vulkan/Makefile.am
+++ b/src/amd/vulkan/Makefile.am
@@ -31,6 +31,7 @@ lib_LTLIBRARIES = libvulkan_radeon.la
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/include/drm-uapi \
 	-I$(top_builddir)/src \
 	-I$(top_srcdir)/src \
 	-I$(top_srcdir)/src/vulkan/wsi \
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index b535dc22f4..66082c4ae0 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -28,6 +28,7 @@
 #include "wsi_common.h"
 #include "vk_util.h"
 #include "util/macros.h"
+#include <drm_fourcc.h>
 
 MAYBE_UNUSED static const struct wsi_callbacks wsi_cbs = {
    .get_phys_device_format_properties = radv_GetPhysicalDeviceFormatProperties,
@@ -223,6 +224,7 @@ radv_wsi_image_create(VkDevice device_h,
 	wsi_image->image = image_h;
 	wsi_image->memory = memory_h;
 	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;
 	if (device->physical_device->rad_info.chip_class >= GFX9)
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index ae40f1f2f4..929905052d 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -266,6 +266,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 b6c5a438b1..c8a2df08f1 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -33,6 +33,8 @@
 struct wsi_image_base {
    VkImage image;
    VkDeviceMemory memory;
+
+   uint64_t drm_modifier;
    int num_planes;
    uint32_t sizes[4];
    uint32_t offsets[4];
-- 
2.13.0



More information about the mesa-dev mailing list