mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 21:35:59 +00:00
Non-Adreno round 8: bridge sharing fallback and crash detail, Venus diagnostics and 1.2 gate, compositor disconnect reasons, RADV upstream
- Mali bridge: the self-test fails "memory sharing" when the server offers no host-visible memory type (no sharing method passed, RP4 Pro G77); the session then falls back to the PanVK pair like a failed draw, and Setup says the bridge cannot share memory with that driver. Without a pair to fall back on, the log says so. - Mali bridge: a guarded driver crash now logs the sub-command it was in, the fault address and pc (library + offset via dladdr), the command buffer's level, begin flags, pool flags and state, and the last 32 replayed commands. Begin on an executable buffer from a pool without RESET_COMMAND_BUFFER_BIT is logged once (implicit reset). - Venus: vulkan-summary.txt gets the device extension list and key features (full vulkaninfo in vulkan-full.txt); a failed GL probe runs once with VN_DEBUG=init,result, ZINK_DEBUG=mem, MESA_LOG_LEVEL=debug and the layer trace into glprobe-trace.txt. The Mali compatibility layer's trace covers every pre-device query (devices, memory, queue families, formats, image formats, external handles) and names the extensions. - Venus: off when the phone's driver reports Vulkan below 1.2 (gamescope skips such a device); Setup and the graphics report say why and the session uses the PanVK pair. - Compositor: libwayland's own disconnect reasons go to wayland.log, and a client's buffer may grow to 1 MB before a slow reader is dropped. A session that ended without teardown records Android's exit reasons. - Drivers: RADV-Xclipse upstream (radv-xclipse-upstream) is a manual choice for Xclipse; Auto keeps radv-xclipse.
This commit is contained in:
1 parent
521d666046
commit
a4d47cf33e
21 files changed
+646
-25
No files matched your search
@@ -132,13 +132,26 @@ if [ "${BL_VKBRIDGE:-0}" = 1 ]; then
|
||||
step "vkbridge self-test"
|
||||
bl_vkb_smoke=$(timeout 60 /usr/local/bin/droiddeck-vkbridge-smoke 2>&1)
|
||||
printf '%s\n' "$bl_vkb_smoke" | sed 's/^/== vkbridge: /'
|
||||
if printf '%s\n' "$bl_vkb_smoke" | grep -qE '^FAIL (image clear|draw)' && [ -r "${BL_VKBRIDGE_FALLBACK_ICD:-}" ]; then
|
||||
bl_vkb_why=
|
||||
if printf '%s\n' "$bl_vkb_smoke" | grep -qE '^FAIL memory sharing'; then
|
||||
bl_vkb_why=memory
|
||||
elif printf '%s\n' "$bl_vkb_smoke" | grep -qE '^FAIL (image clear|draw)'; then
|
||||
bl_vkb_why=draw
|
||||
fi
|
||||
if [ -n "$bl_vkb_why" ] && [ -r "${BL_VKBRIDGE_FALLBACK_ICD:-}" ]; then
|
||||
export VK_DRIVER_FILES=$BL_VKBRIDGE_FALLBACK_ICD VK_ICD_FILENAMES=$BL_VKBRIDGE_FALLBACK_ICD BL_VKBRIDGE=0
|
||||
export BL_OPEN_DRIVER=1 BL_DRM_STANDIN=/dev/mali0
|
||||
[ "${BL_STEAM_GPU_COMPOSITING:-0}" = 1 ] || export BL_STEAM_SOFT_COMPOSITING=1
|
||||
echo "== vkbridge: self-test failed images or draws; this session uses the PanVK pair instead ($BL_VKBRIDGE_FALLBACK_ICD)"
|
||||
[ -n "${BL_DEBUG_DIR:-}" ] && echo "$BL_VKBRIDGE_FALLBACK_ICD" > "$BL_DEBUG_DIR/vkbridge-fallback" 2>/dev/null
|
||||
if [ "$bl_vkb_why" = memory ]; then
|
||||
echo "== vkbridge: memory sharing = none (no method passed the server's self-test); this session uses the PanVK pair instead ($BL_VKBRIDGE_FALLBACK_ICD)"
|
||||
else
|
||||
echo "== vkbridge: self-test failed images or draws; this session uses the PanVK pair instead ($BL_VKBRIDGE_FALLBACK_ICD)"
|
||||
fi
|
||||
[ -n "${BL_DEBUG_DIR:-}" ] && printf '%s\n%s\n' "$BL_VKBRIDGE_FALLBACK_ICD" "$bl_vkb_why" > "$BL_DEBUG_DIR/vkbridge-fallback" 2>/dev/null
|
||||
elif [ -n "$bl_vkb_why" ]; then
|
||||
echo "== vkbridge: self-test failed ($bl_vkb_why) and no PanVK pair is installed to fall back on; expect a black screen or a lost device - set a Mali driver pair in Setup"
|
||||
fi
|
||||
unset bl_vkb_why
|
||||
unset bl_vkb_smoke
|
||||
if command -v vulkaninfo >/dev/null 2>&1; then
|
||||
timeout 30 vulkaninfo --summary 2>&1 | sed -n '/^Devices:/,$p' | head -40 | sed 's/^/== vulkaninfo: /'
|
||||
@@ -172,6 +185,15 @@ if [ "${BL_GAME_LOGS:-0}" = 1 ] && [ -z "${BL_INSIDE:-}" ] && [ -n "${BL_DEBUG_D
|
||||
if command -v vulkaninfo >/dev/null 2>&1; then
|
||||
timeout 10 vulkaninfo --summary
|
||||
echo "== vulkaninfo exit: $?"
|
||||
if timeout 20 vulkaninfo > "$BL_DEBUG_DIR/vulkan-full.txt" 2>&1; then
|
||||
echo "== device extensions (full list in vulkan-full.txt):"
|
||||
sed -n '/^Device Extensions:/,/^$/p' "$BL_DEBUG_DIR/vulkan-full.txt" | grep -o 'VK_[A-Za-z0-9_]*' | sort -u | tr '\n' ' ' | fold -s -w 200
|
||||
echo
|
||||
echo "== key features:"
|
||||
grep -E '^[[:space:]]+(robustBufferAccess2?|robustImageAccess2?|nullDescriptor|logicOp|fillModeNonSolid|shaderClipDistance|shaderCullDistance|dualSrcBlend|geometryShader|scalarBlockLayout|timelineSemaphore|dynamicRendering|synchronization2|maintenance4|maintenance5|maintenance6|shaderDrawParameters|descriptorIndexing|bufferDeviceAddress|vulkanMemoryModel|hostQueryReset|imagelessFramebuffer|samplerYcbcrConversion|shaderInt64|shaderFloat64|shaderInt16|shaderFloat16|storageBuffer16BitAccess|extendedDynamicState[23]?|vertexInputDynamicState|customBorderColors|customBorderColorWithoutFormat|depthClipEnable|multiViewport|textureCompressionBC|indexTypeUint8|rectangularLines|bresenhamLines|transformFeedback|geometryStreams|graphicsPipelineLibrary|pushDescriptor|primitiveTopologyListRestart|dynamicRenderingLocalRead|shaderDemoteToHelperInvocation|subgroupSizeControl|computeFullSubgroups|inlineUniformBlock|pipelineCreationCacheControl) = ' "$BL_DEBUG_DIR/vulkan-full.txt" | sed 's/^[[:space:]]*/ /' | sort -u
|
||||
else
|
||||
echo "== full vulkaninfo failed or timed out (exit $?)"
|
||||
fi
|
||||
else
|
||||
echo "== vulkaninfo is not in this runtime; GPU nodes:"
|
||||
ls -l /dev/kgsl-3d0 /dev/mali0 /dev/dri 2>&1
|
||||
@@ -994,7 +1016,10 @@ BUSCONF
|
||||
LIBGL_DEBUG=verbose MESA_LOG_LEVEL=debug timeout 20 /usr/local/bin/droiddeck-glprobe 2>&1 | grep -v drirc | head -60 | sed 's/^/== glprobe: /'
|
||||
if [ "${PIPESTATUS[0]}" = 1 ]; then
|
||||
VK_LOADER_DEBUG=error,warn timeout 20 /usr/local/bin/droiddeck-glprobe 2>&1 | grep -v drirc | head -40 | sed 's/^/== glprobe (loader): /'
|
||||
DROIDDECK_MALI_COMPAT_TRACE=1 MESA_DEBUG=1 LIBGL_DEBUG=verbose timeout 20 /usr/local/bin/droiddeck-glprobe 2>&1 | grep -v drirc | head -80 | sed 's/^/== glprobe (trace): /'
|
||||
DROIDDECK_MALI_COMPAT_TRACE=1 MESA_DEBUG=1 MESA_LOG_LEVEL=debug LIBGL_DEBUG=verbose ZINK_DEBUG=mem VN_DEBUG=init,result,log_ctx_info \
|
||||
timeout 30 /usr/local/bin/droiddeck-glprobe > "${BL_DEBUG_DIR:-/tmp}/glprobe-trace.txt" 2>&1
|
||||
grep -v drirc "${BL_DEBUG_DIR:-/tmp}/glprobe-trace.txt" | head -120 | sed 's/^/== glprobe (trace): /'
|
||||
echo "== glprobe (trace): last pre-device query before Zink gave up: $(grep 'droiddeck-mali-compat: trace:' "${BL_DEBUG_DIR:-/tmp}/glprobe-trace.txt" | grep -v 'trace: extensions:' | tail -1)"
|
||||
command -v vulkaninfo >/dev/null 2>&1 && DROIDDECK_MALI_COMPAT_TRACE=1 timeout 20 vulkaninfo --summary 2>&1 | head -40 | sed 's/^/== glprobe (vulkaninfo): /'
|
||||
bl_gl_ok=
|
||||
for bl_variant in "ZINK_DEBUG=" "ZINK_DEBUG= ZINK_DESCRIPTORS=auto" "ZINK_DEBUG= LIBGL_KOPPER_DISABLE=true" "ZINK_DEBUG= DROIDDECK_MALI_COMPAT=0"; do
|
||||
|
||||
@@ -414,8 +414,10 @@ static VKAPI_ATTR VkResult VKAPI_CALL EnumerateDeviceExtensionProperties(VkPhysi
|
||||
inst->EnumerateDeviceExtensionProperties(physical_device, NULL, &own, all);
|
||||
memcpy(all + own, extra, extra_count * sizeof(*extra));
|
||||
uint32_t total = own + extra_count;
|
||||
if (tracing())
|
||||
if (tracing()) {
|
||||
layer_log("trace: vkEnumerateDeviceExtensionProperties: %u from the driver, %u added by the layer", own, extra_count);
|
||||
trace_extension_names(all, total);
|
||||
}
|
||||
uint32_t n = *count < total ? *count : total;
|
||||
memcpy(properties, all, n * sizeof(*all));
|
||||
free(all);
|
||||
@@ -470,6 +472,8 @@ static VKAPI_ATTR VkResult VKAPI_CALL CreateInstance(const VkInstanceCreateInfo
|
||||
LOAD_KHR(GetPhysicalDeviceImageFormatProperties2)
|
||||
#undef LOAD
|
||||
#undef LOAD_KHR
|
||||
if (tracing())
|
||||
trace_load(inst);
|
||||
/* Without the Vulkan 1.1 queries there is no way to answer the chained ones. */
|
||||
if (!inst->GetPhysicalDeviceFeatures2 || !inst->GetPhysicalDeviceProperties2 ||
|
||||
!inst->GetPhysicalDeviceFormatProperties2 || !inst->GetPhysicalDeviceImageFormatProperties2)
|
||||
@@ -781,6 +785,11 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance i
|
||||
if (!strcmp(name, "vkCreateDevice"))
|
||||
return (PFN_vkVoidFunction)CreateDevice;
|
||||
PFN_vkVoidFunction next = inst->gipa(instance, name);
|
||||
if (next && tracing()) {
|
||||
PFN_vkVoidFunction traced = trace_hook(inst, name);
|
||||
if (traced)
|
||||
return traced;
|
||||
}
|
||||
if (!next || !inst->active)
|
||||
return next;
|
||||
for (size_t i = 0; i < sizeof(physical_device_hooks) / sizeof(physical_device_hooks[0]); i++) {
|
||||
|
||||
@@ -70,6 +70,13 @@ struct instance {
|
||||
PFN_vkGetPhysicalDeviceFormatProperties2 GetPhysicalDeviceFormatProperties2;
|
||||
PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
|
||||
PFN_vkGetPhysicalDeviceImageFormatProperties2 GetPhysicalDeviceImageFormatProperties2;
|
||||
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties2 GetPhysicalDeviceMemoryProperties2;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties2 GetPhysicalDeviceQueueFamilyProperties2;
|
||||
PFN_vkGetPhysicalDeviceExternalBufferProperties GetPhysicalDeviceExternalBufferProperties;
|
||||
PFN_vkGetPhysicalDeviceExternalSemaphoreProperties GetPhysicalDeviceExternalSemaphoreProperties;
|
||||
PFN_vkGetPhysicalDeviceExternalFenceProperties GetPhysicalDeviceExternalFenceProperties;
|
||||
pthread_mutex_t lock;
|
||||
struct physical_device physical_devices[8];
|
||||
uint32_t physical_device_count;
|
||||
@@ -273,6 +280,11 @@ struct instance *instance_from_handle(const void *dispatchable);
|
||||
/* What the GPU lacks of the features the layer can make up for. */
|
||||
uint32_t physical_device_gaps(struct instance *inst, VkPhysicalDevice physical_device);
|
||||
|
||||
/* trace.c (DROIDDECK_MALI_COMPAT_TRACE=1) */
|
||||
void trace_load(struct instance *inst);
|
||||
PFN_vkVoidFunction trace_hook(struct instance *inst, const char *name);
|
||||
void trace_extension_names(const VkExtensionProperties *ext, uint32_t n);
|
||||
|
||||
|
||||
/* draw.c */
|
||||
VKAPI_ATTR void VKAPI_CALL CmdDrawIndirect(VkCommandBuffer cmd, VkBuffer buffer, VkDeviceSize offset, uint32_t draw_count, uint32_t stride);
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* DROIDDECK_MALI_COMPAT_TRACE=1: the physical-device queries an application makes before
|
||||
* vkCreateDevice, logged as they pass through. Zink on Venus over an older Mali driver gave up
|
||||
* after vkGetPhysicalDeviceProperties2 without a word (its release builds print nothing there),
|
||||
* so the last query in the log is where it stopped.
|
||||
*/
|
||||
#include "mali_compat.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static uint32_t format_queries;
|
||||
|
||||
static bool format_worth_logging(uint32_t n, VkFormatFeatureFlags linear, VkFormatFeatureFlags optimal, VkFormatFeatureFlags buffer)
|
||||
{
|
||||
return n == 1 || n % 25 == 0 || (!linear && !optimal && !buffer);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR VkResult VKAPI_CALL TraceEnumeratePhysicalDevices(VkInstance instance, uint32_t *count, VkPhysicalDevice *devices)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(instance);
|
||||
VkResult r = inst->EnumeratePhysicalDevices(instance, count, devices);
|
||||
layer_log("trace: vkEnumeratePhysicalDevices (%s): %d, %u device(s)", devices ? "list" : "count", (int)r, count ? *count : 0);
|
||||
return r;
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceMemoryProperties(VkPhysicalDevice pd, VkPhysicalDeviceMemoryProperties *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
inst->GetPhysicalDeviceMemoryProperties(pd, p);
|
||||
char types[384] = "";
|
||||
size_t o = 0;
|
||||
for (uint32_t i = 0; i < p->memoryTypeCount && o + 16 < sizeof(types); i++)
|
||||
o += (size_t)snprintf(types + o, sizeof(types) - o, " %u:h%u/0x%x", i, p->memoryTypes[i].heapIndex,
|
||||
(unsigned)p->memoryTypes[i].propertyFlags);
|
||||
layer_log("trace: vkGetPhysicalDeviceMemoryProperties: %u heaps, %u types:%s", p->memoryHeapCount, p->memoryTypeCount, types);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice pd, VkPhysicalDeviceMemoryProperties2 *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
inst->GetPhysicalDeviceMemoryProperties2(pd, p);
|
||||
char chain[160] = "";
|
||||
size_t o = 0;
|
||||
for (VkBaseOutStructure *s = p->pNext; s && o + 16 < sizeof(chain); s = s->pNext)
|
||||
o += (size_t)snprintf(chain + o, sizeof(chain) - o, " %d", (int)s->sType);
|
||||
layer_log("trace: vkGetPhysicalDeviceMemoryProperties2: %u heaps, %u types, chain:%s", p->memoryProperties.memoryHeapCount,
|
||||
p->memoryProperties.memoryTypeCount, chain);
|
||||
}
|
||||
|
||||
static void log_queue_families(const char *what, uint32_t n, const VkQueueFamilyProperties *(*at)(const void *, uint32_t), const void *arr)
|
||||
{
|
||||
char fams[256] = "";
|
||||
size_t o = 0;
|
||||
for (uint32_t i = 0; arr && i < n && o + 24 < sizeof(fams); i++) {
|
||||
const VkQueueFamilyProperties *q = at(arr, i);
|
||||
o += (size_t)snprintf(fams + o, sizeof(fams) - o, " %u:0x%x*%u", i, (unsigned)q->queueFlags, q->queueCount);
|
||||
}
|
||||
layer_log("trace: %s: %u famil%s%s", what, n, n == 1 ? "y" : "ies", fams);
|
||||
}
|
||||
|
||||
static const VkQueueFamilyProperties *qf1(const void *a, uint32_t i) { return &((const VkQueueFamilyProperties *)a)[i]; }
|
||||
static const VkQueueFamilyProperties *qf2(const void *a, uint32_t i) { return &((const VkQueueFamilyProperties2 *)a)[i].queueFamilyProperties; }
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice pd, uint32_t *n, VkQueueFamilyProperties *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
inst->GetPhysicalDeviceQueueFamilyProperties(pd, n, p);
|
||||
log_queue_families("vkGetPhysicalDeviceQueueFamilyProperties", n ? *n : 0, qf1, p);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice pd, uint32_t *n, VkQueueFamilyProperties2 *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
inst->GetPhysicalDeviceQueueFamilyProperties2(pd, n, p);
|
||||
log_queue_families("vkGetPhysicalDeviceQueueFamilyProperties2", n ? *n : 0, qf2, p);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceFormatProperties(VkPhysicalDevice pd, VkFormat format, VkFormatProperties *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
if (inst->active) GetPhysicalDeviceFormatProperties(pd, format, p);
|
||||
else inst->GetPhysicalDeviceFormatProperties(pd, format, p);
|
||||
uint32_t n = __atomic_add_fetch(&format_queries, 1, __ATOMIC_RELAXED);
|
||||
if (format_worth_logging(n, p->linearTilingFeatures, p->optimalTilingFeatures, p->bufferFeatures))
|
||||
layer_log("trace: vkGetPhysicalDeviceFormatProperties #%u: format %d linear 0x%x optimal 0x%x buffer 0x%x", n, (int)format,
|
||||
(unsigned)p->linearTilingFeatures, (unsigned)p->optimalTilingFeatures, (unsigned)p->bufferFeatures);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceFormatProperties2(VkPhysicalDevice pd, VkFormat format, VkFormatProperties2 *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
if (inst->active) GetPhysicalDeviceFormatProperties2(pd, format, p);
|
||||
else inst->GetPhysicalDeviceFormatProperties2(pd, format, p);
|
||||
uint32_t n = __atomic_add_fetch(&format_queries, 1, __ATOMIC_RELAXED);
|
||||
const VkFormatProperties *f = &p->formatProperties;
|
||||
if (format_worth_logging(n, f->linearTilingFeatures, f->optimalTilingFeatures, f->bufferFeatures))
|
||||
layer_log("trace: vkGetPhysicalDeviceFormatProperties2 #%u: format %d linear 0x%x optimal 0x%x buffer 0x%x", n, (int)format,
|
||||
(unsigned)f->linearTilingFeatures, (unsigned)f->optimalTilingFeatures, (unsigned)f->bufferFeatures);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR VkResult VKAPI_CALL TraceGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice pd, VkFormat format, VkImageType type,
|
||||
VkImageTiling tiling, VkImageUsageFlags usage,
|
||||
VkImageCreateFlags flags, VkImageFormatProperties *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
VkResult r = inst->active ? GetPhysicalDeviceImageFormatProperties(pd, format, type, tiling, usage, flags, p)
|
||||
: inst->GetPhysicalDeviceImageFormatProperties(pd, format, type, tiling, usage, flags, p);
|
||||
if (r != VK_SUCCESS)
|
||||
layer_log("trace: vkGetPhysicalDeviceImageFormatProperties: format %d type %d tiling %d usage 0x%x flags 0x%x -> %d", (int)format,
|
||||
(int)type, (int)tiling, (unsigned)usage, (unsigned)flags, (int)r);
|
||||
return r;
|
||||
}
|
||||
|
||||
static VKAPI_ATTR VkResult VKAPI_CALL TraceGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice pd, const VkPhysicalDeviceImageFormatInfo2 *info,
|
||||
VkImageFormatProperties2 *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
VkResult r = inst->active ? GetPhysicalDeviceImageFormatProperties2(pd, info, p) : inst->GetPhysicalDeviceImageFormatProperties2(pd, info, p);
|
||||
if (r != VK_SUCCESS)
|
||||
layer_log("trace: vkGetPhysicalDeviceImageFormatProperties2: format %d type %d tiling %d usage 0x%x flags 0x%x -> %d", (int)info->format,
|
||||
(int)info->type, (int)info->tiling, (unsigned)info->usage, (unsigned)info->flags, (int)r);
|
||||
return r;
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice pd, const VkPhysicalDeviceExternalBufferInfo *info,
|
||||
VkExternalBufferProperties *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
inst->GetPhysicalDeviceExternalBufferProperties(pd, info, p);
|
||||
layer_log("trace: vkGetPhysicalDeviceExternalBufferProperties: handle 0x%x usage 0x%x -> features 0x%x", (unsigned)info->handleType,
|
||||
(unsigned)info->usage, (unsigned)p->externalMemoryProperties.externalMemoryFeatures);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice pd,
|
||||
const VkPhysicalDeviceExternalSemaphoreInfo *info,
|
||||
VkExternalSemaphoreProperties *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
inst->GetPhysicalDeviceExternalSemaphoreProperties(pd, info, p);
|
||||
layer_log("trace: vkGetPhysicalDeviceExternalSemaphoreProperties: handle 0x%x -> features 0x%x", (unsigned)info->handleType,
|
||||
(unsigned)p->externalSemaphoreFeatures);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL TraceGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice pd, const VkPhysicalDeviceExternalFenceInfo *info,
|
||||
VkExternalFenceProperties *p)
|
||||
{
|
||||
struct instance *inst = instance_from_handle(pd);
|
||||
inst->GetPhysicalDeviceExternalFenceProperties(pd, info, p);
|
||||
layer_log("trace: vkGetPhysicalDeviceExternalFenceProperties: handle 0x%x -> features 0x%x", (unsigned)info->handleType,
|
||||
(unsigned)p->externalFenceFeatures);
|
||||
}
|
||||
|
||||
void trace_extension_names(const VkExtensionProperties *ext, uint32_t n)
|
||||
{
|
||||
char line[400];
|
||||
size_t o = 0;
|
||||
line[0] = 0;
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
size_t len = strlen(ext[i].extensionName);
|
||||
if (o && o + len + 2 > sizeof(line)) {
|
||||
layer_log("trace: extensions:%s", line);
|
||||
o = 0;
|
||||
line[0] = 0;
|
||||
}
|
||||
o += (size_t)snprintf(line + o, sizeof(line) - o, " %s", ext[i].extensionName);
|
||||
}
|
||||
if (o) layer_log("trace: extensions:%s", line);
|
||||
}
|
||||
|
||||
void trace_load(struct instance *inst)
|
||||
{
|
||||
#define T_LOAD(name) inst->name = (PFN_vk##name)inst->gipa(inst->handle, "vk" #name);
|
||||
#define T_LOAD_KHR(name) \
|
||||
if (!inst->name) \
|
||||
inst->name = (PFN_vk##name)inst->gipa(inst->handle, "vk" #name "KHR");
|
||||
T_LOAD(EnumeratePhysicalDevices)
|
||||
T_LOAD(GetPhysicalDeviceMemoryProperties2)
|
||||
T_LOAD_KHR(GetPhysicalDeviceMemoryProperties2)
|
||||
T_LOAD(GetPhysicalDeviceQueueFamilyProperties)
|
||||
T_LOAD(GetPhysicalDeviceQueueFamilyProperties2)
|
||||
T_LOAD_KHR(GetPhysicalDeviceQueueFamilyProperties2)
|
||||
T_LOAD(GetPhysicalDeviceExternalBufferProperties)
|
||||
T_LOAD_KHR(GetPhysicalDeviceExternalBufferProperties)
|
||||
T_LOAD(GetPhysicalDeviceExternalSemaphoreProperties)
|
||||
T_LOAD_KHR(GetPhysicalDeviceExternalSemaphoreProperties)
|
||||
T_LOAD(GetPhysicalDeviceExternalFenceProperties)
|
||||
T_LOAD_KHR(GetPhysicalDeviceExternalFenceProperties)
|
||||
#undef T_LOAD
|
||||
#undef T_LOAD_KHR
|
||||
}
|
||||
|
||||
struct trace_hook {
|
||||
const char *name;
|
||||
PFN_vkVoidFunction function;
|
||||
size_t next_offset;
|
||||
};
|
||||
|
||||
#define TH(fn, field) {"vk" #fn, (PFN_vkVoidFunction)Trace##field, offsetof(struct instance, field)}
|
||||
|
||||
static const struct trace_hook trace_hooks[] = {
|
||||
TH(EnumeratePhysicalDevices, EnumeratePhysicalDevices),
|
||||
TH(GetPhysicalDeviceMemoryProperties, GetPhysicalDeviceMemoryProperties),
|
||||
TH(GetPhysicalDeviceMemoryProperties2, GetPhysicalDeviceMemoryProperties2),
|
||||
TH(GetPhysicalDeviceMemoryProperties2KHR, GetPhysicalDeviceMemoryProperties2),
|
||||
TH(GetPhysicalDeviceQueueFamilyProperties, GetPhysicalDeviceQueueFamilyProperties),
|
||||
TH(GetPhysicalDeviceQueueFamilyProperties2, GetPhysicalDeviceQueueFamilyProperties2),
|
||||
TH(GetPhysicalDeviceQueueFamilyProperties2KHR, GetPhysicalDeviceQueueFamilyProperties2),
|
||||
TH(GetPhysicalDeviceFormatProperties, GetPhysicalDeviceFormatProperties),
|
||||
TH(GetPhysicalDeviceFormatProperties2, GetPhysicalDeviceFormatProperties2),
|
||||
TH(GetPhysicalDeviceFormatProperties2KHR, GetPhysicalDeviceFormatProperties2),
|
||||
TH(GetPhysicalDeviceImageFormatProperties, GetPhysicalDeviceImageFormatProperties),
|
||||
TH(GetPhysicalDeviceImageFormatProperties2, GetPhysicalDeviceImageFormatProperties2),
|
||||
TH(GetPhysicalDeviceImageFormatProperties2KHR, GetPhysicalDeviceImageFormatProperties2),
|
||||
TH(GetPhysicalDeviceExternalBufferProperties, GetPhysicalDeviceExternalBufferProperties),
|
||||
TH(GetPhysicalDeviceExternalBufferPropertiesKHR, GetPhysicalDeviceExternalBufferProperties),
|
||||
TH(GetPhysicalDeviceExternalSemaphoreProperties, GetPhysicalDeviceExternalSemaphoreProperties),
|
||||
TH(GetPhysicalDeviceExternalSemaphorePropertiesKHR, GetPhysicalDeviceExternalSemaphoreProperties),
|
||||
TH(GetPhysicalDeviceExternalFenceProperties, GetPhysicalDeviceExternalFenceProperties),
|
||||
TH(GetPhysicalDeviceExternalFencePropertiesKHR, GetPhysicalDeviceExternalFenceProperties),
|
||||
};
|
||||
|
||||
PFN_vkVoidFunction trace_hook(struct instance *inst, const char *name)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(trace_hooks) / sizeof(trace_hooks[0]); i++) {
|
||||
if (strcmp(name, trace_hooks[i].name)) continue;
|
||||
void *next = *(void **)((char *)inst + trace_hooks[i].next_offset);
|
||||
return next ? trace_hooks[i].function : NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -473,6 +473,11 @@ int main(int argc, char **argv)
|
||||
vkGetPhysicalDeviceMemoryProperties(pd, &mp);
|
||||
for (uint32_t i = 0; i < mp.memoryTypeCount; i++)
|
||||
printf(" memory type %u: heap %u flags 0x%x\n", i, mp.memoryTypes[i].heapIndex, mp.memoryTypes[i].propertyFlags);
|
||||
int host_visible = 0;
|
||||
for (uint32_t i = 0; i < mp.memoryTypeCount; i++)
|
||||
if (mp.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) host_visible = 1;
|
||||
/* The server offers HOST_VISIBLE only through a memory-sharing method that passed its self-test. */
|
||||
check(host_visible, "memory sharing", host_visible ? "" : "none (no host-visible memory type; the server found no way to share memory with this driver)");
|
||||
uint32_t nq = 0;
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(pd, &nq, NULL);
|
||||
VkQueueFamilyProperties qp[16];
|
||||
|
||||
Reference in new issue
Block a user