vulkan/wsi: Add debug variables to force the SW and PRIME buffer blit paths

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17436>
This commit is contained in:
Jason Ekstrand 2022-07-08 16:21:25 -05:00 committed by Marge Bot
parent 3ff7494a97
commit af6f6ce065
4 changed files with 27 additions and 4 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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 {

View file

@ -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;