Mesa (main): vulkan/wsi: Add debug variables to force the SW and PRIME buffer blit paths
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jul 12 14:45:35 UTC 2022
Module: Mesa
Branch: main
Commit: af6f6ce065bed69b08d18470b148f6ca6e035597
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=af6f6ce065bed69b08d18470b148f6ca6e035597
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Fri Jul 8 16:21:25 2022 -0500
vulkan/wsi: Add debug variables to force the SW and PRIME buffer blit paths
Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17436>
---
src/vulkan/wsi/wsi_common.c | 18 ++++++++++++++++--
src/vulkan/wsi/wsi_common_private.h | 7 +++++++
src/vulkan/wsi/wsi_common_wayland.c | 3 ++-
src/vulkan/wsi/wsi_common_x11.c | 3 ++-
4 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 9be60dddf9c..7a8a95b109c 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -23,6 +23,7 @@
#include "wsi_common_private.h"
#include "wsi_common_entrypoints.h"
+#include "util/debug.h"
#include "util/macros.h"
#include "util/os_file.h"
#include "util/xmlconfig.h"
@@ -45,6 +46,16 @@
#include <unistd.h>
#endif
+uint64_t WSI_DEBUG;
+
+static const struct debug_control debug_control[] = {
+ { "buffer", WSI_DEBUG_BUFFER },
+ { "sw", WSI_DEBUG_SW },
+ { "noshm", WSI_DEBUG_NOSHM },
+ { "linear", WSI_DEBUG_LINEAR },
+ { NULL, },
+};
+
VkResult
wsi_device_init(struct wsi_device *wsi,
VkPhysicalDevice pdevice,
@@ -57,11 +68,14 @@ wsi_device_init(struct wsi_device *wsi,
const char *present_mode;
UNUSED VkResult result;
+ WSI_DEBUG = parse_debug_string(getenv("MESA_VK_WSI_DEBUG"), debug_control);
+
memset(wsi, 0, sizeof(*wsi));
wsi->instance_alloc = *alloc;
wsi->pdevice = pdevice;
- wsi->sw = sw_device;
+ wsi->sw = sw_device || (WSI_DEBUG & WSI_DEBUG_SW);
+ wsi->wants_linear = (WSI_DEBUG & WSI_DEBUG_LINEAR) != 0;
#define WSI_GET_CB(func) \
PFN_vk##func func = (PFN_vk##func)proc_addr(pdevice, "vk" #func)
WSI_GET_CB(GetPhysicalDeviceExternalSemaphoreProperties);
@@ -271,7 +285,7 @@ wsi_swapchain_init(const struct wsi_device *wsi,
chain->device = _device;
chain->alloc = *pAllocator;
- chain->use_buffer_blit = use_buffer_blit;
+ chain->use_buffer_blit = use_buffer_blit || (WSI_DEBUG & WSI_DEBUG_BUFFER);
if (wsi->sw && !wsi->wants_linear)
chain->use_buffer_blit = true;
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 0981d6cf06e..1d1d5a9efe6 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -30,6 +30,13 @@
struct wsi_image;
struct wsi_swapchain;
+#define WSI_DEBUG_BUFFER (1ull << 0)
+#define WSI_DEBUG_SW (1ull << 1)
+#define WSI_DEBUG_NOSHM (1ull << 2)
+#define WSI_DEBUG_LINEAR (1ull << 3)
+
+extern uint64_t WSI_DEBUG;
+
struct wsi_image_info {
VkImageCreateInfo create;
struct wsi_image_create_info wsi;
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 0b9bc6a9814..2ba6cb1389c 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -1299,7 +1299,8 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
chain->extent = pCreateInfo->imageExtent;
chain->vk_format = pCreateInfo->imageFormat;
if (wsi_device->sw) {
- chain->buffer_type = chain->base.wsi->has_import_memory_host ?
+ chain->buffer_type = (chain->base.wsi->has_import_memory_host &&
+ !(WSI_DEBUG & WSI_DEBUG_NOSHM)) ?
WSI_WL_BUFFER_GPU_SHM : WSI_WL_BUFFER_SHM_MEMCPY;
chain->shm_format = wl_shm_format_for_vk_format(chain->vk_format, alpha);
} else {
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index baccc8ffe78..f0f3d784a81 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -196,7 +196,8 @@ wsi_x11_connection_create(struct wsi_device *wsi_dev,
xcb_query_extension_reply_t *dri3_reply, *pres_reply, *randr_reply,
*amd_reply, *nv_reply, *shm_reply = NULL,
*xfixes_reply;
- bool wants_shm = wsi_dev->sw && wsi_dev->has_import_memory_host;
+ bool wants_shm = wsi_dev->sw && !(WSI_DEBUG & WSI_DEBUG_NOSHM) &&
+ wsi_dev->has_import_memory_host;
bool has_dri3_v1_2 = false;
bool has_present_v1_2 = false;
More information about the mesa-commit
mailing list