[Mesa-dev] [RFC v4 18/23] vulkan/wsi: Add drm_modifier member to wsi_image

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Mon Oct 16 07:04:28 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  | 8 ++++++++
 src/vulkan/wsi/wsi_common.h | 1 +
 4 files changed, 12 insertions(+)

diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index 19ec3f47f7..c947f9b48a 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 30999bdca6..189bee03ce 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,
@@ -259,6 +260,7 @@ radv_wsi_image_create(VkDevice device_h,
 		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;
 	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 607d2aa49d..780799bcaf 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -265,6 +265,14 @@ anv_wsi_image_create(VkDevice device_h,
    wsi_image->linear_image = VK_NULL_HANDLE;
    wsi_image->linear_memory = VK_NULL_HANDLE;
 
+   /* 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.0



More information about the mesa-dev mailing list