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:
The412Banner committed 2026-10-15 18:53:40 -04:00
1 parent 75612da44b
commit b0c694d9e1
21 files changed
+646 -25

No files matched your search

+148 -4
View File
@@ -10,21 +10,41 @@
#define _GNU_SOURCE
#include "vkb_server.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CBT_BUCKETS 1024
enum { CBT_INITIAL, CBT_RECORDING, CBT_EXECUTABLE };
typedef struct cbt_entry {
VkCommandBuffer cb;
VkCommandPool pool;
VkCommandBufferLevel level;
int state;
VkCommandBufferUsageFlags begin_flags;
int inheritance;
uint32_t begins;
struct cbt_entry *next;
} cbt_entry;
typedef struct cbt_pool {
VkCommandPool pool;
VkCommandPoolCreateFlags flags;
uint32_t qfam;
struct cbt_pool *next;
} cbt_pool;
typedef struct vkb_cbtrack {
pthread_mutex_t lock;
cbt_entry *b[CBT_BUCKETS];
VkCommandBuffer last_refused;
cbt_pool *pools;
int warned_implicit_reset;
PFN_vkCreateCommandPool create_pool;
PFN_vkResetCommandPool reset_pool;
PFN_vkResetCommandBuffer reset_cb;
PFN_vkAllocateCommandBuffers alloc;
PFN_vkFreeCommandBuffers free_cbs;
PFN_vkDestroyCommandPool destroy_pool;
@@ -47,11 +67,55 @@ static vkb_cbtrack *cur(void)
return t ? t->cbtrack : NULL;
}
static int known_locked(vkb_cbtrack *k, VkCommandBuffer cb)
static cbt_entry *find_locked(vkb_cbtrack *k, VkCommandBuffer cb)
{
for (cbt_entry *e = k->b[bucket(cb)]; e; e = e->next)
if (e->cb == cb) return 1;
return 0;
if (e->cb == cb) return e;
return NULL;
}
static int known_locked(vkb_cbtrack *k, VkCommandBuffer cb) { return find_locked(k, cb) != NULL; }
static cbt_pool *pool_locked(vkb_cbtrack *k, VkCommandPool pool)
{
for (cbt_pool *p = k->pools; p; p = p->next)
if (p->pool == pool) return p;
return NULL;
}
static const char *state_name(int s) { return s == CBT_RECORDING ? "recording" : s == CBT_EXECUTABLE ? "executable" : "initial"; }
void vkb_cbtrack_describe(vkb_srv_table *t, VkCommandBuffer cb, char *out, size_t n)
{
vkb_cbtrack *k = t ? t->cbtrack : NULL;
if (!k) {
snprintf(out, n, "command buffer %p (not tracked)", (void *)cb);
return;
}
pthread_mutex_lock(&k->lock);
cbt_entry *e = find_locked(k, cb);
cbt_pool *p = e ? pool_locked(k, e->pool) : NULL;
if (!e)
snprintf(out, n, "command buffer %p: unknown to this device", (void *)cb);
else
snprintf(out, n, "command buffer %p: level %s, state %s, begin #%u flags 0x%x%s; pool %p flags %s (queue family %d)",
(void *)cb, e->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY ? "secondary" : "primary", state_name(e->state),
e->begins, (unsigned)e->begin_flags, e->inheritance ? " with inheritance info" : "", (void *)e->pool,
p ? (p->flags & VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT ? "RESET_COMMAND_BUFFER" : "0") : "unknown",
p ? (int)p->qfam : -1);
if (p && (p->flags & ~VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT))
snprintf(out + strlen(out), n - strlen(out), " +0x%x", (unsigned)(p->flags & ~VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT));
pthread_mutex_unlock(&k->lock);
}
void vkb_cbtrack_ended(vkb_srv_table *t, VkCommandBuffer cb)
{
vkb_cbtrack *k = t ? t->cbtrack : NULL;
if (!k) return;
pthread_mutex_lock(&k->lock);
cbt_entry *e = find_locked(k, cb);
if (e) e->state = CBT_EXECUTABLE;
pthread_mutex_unlock(&k->lock);
}
int vkb_cbtrack_known(vkb_srv_table *t, VkCommandBuffer cb, const char *what)
@@ -80,8 +144,10 @@ static VKAPI_ATTR VkResult VKAPI_CALL cbt_AllocateCommandBuffers(VkDevice device
if (!out[i] || known_locked(k, out[i])) continue;
cbt_entry *e = malloc(sizeof(*e));
if (!e) continue;
memset(e, 0, sizeof(*e));
e->cb = out[i];
e->pool = info->commandPool;
e->level = info->level;
unsigned h = bucket(out[i]);
e->next = k->b[h];
k->b[h] = e;
@@ -122,15 +188,82 @@ static VKAPI_ATTR void VKAPI_CALL cbt_DestroyCommandPool(VkDevice device, VkComm
if (pool) {
pthread_mutex_lock(&k->lock);
forget_locked(k, VK_NULL_HANDLE, pool);
for (cbt_pool **pp = &k->pools; *pp; pp = &(*pp)->next) {
if ((*pp)->pool == pool) {
cbt_pool *p = *pp;
*pp = p->next;
free(p);
break;
}
}
pthread_mutex_unlock(&k->lock);
}
k->destroy_pool(device, pool, a);
}
static VKAPI_ATTR VkResult VKAPI_CALL cbt_CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *info,
const VkAllocationCallbacks *a, VkCommandPool *out)
{
vkb_cbtrack *k = cur();
VkResult r = k->create_pool(device, info, a, out);
if (r != VK_SUCCESS || !info || !out) return r;
cbt_pool *p = calloc(1, sizeof(*p));
if (!p) return r;
p->pool = *out;
p->flags = info->flags;
p->qfam = info->queueFamilyIndex;
pthread_mutex_lock(&k->lock);
p->next = k->pools;
k->pools = p;
pthread_mutex_unlock(&k->lock);
return r;
}
static VKAPI_ATTR VkResult VKAPI_CALL cbt_ResetCommandPool(VkDevice device, VkCommandPool pool, VkCommandPoolResetFlags flags)
{
vkb_cbtrack *k = cur();
pthread_mutex_lock(&k->lock);
for (unsigned h = 0; h < CBT_BUCKETS; h++)
for (cbt_entry *e = k->b[h]; e; e = e->next)
if (e->pool == pool) e->state = CBT_INITIAL;
pthread_mutex_unlock(&k->lock);
return k->reset_pool(device, pool, flags);
}
static VKAPI_ATTR VkResult VKAPI_CALL cbt_ResetCommandBuffer(VkCommandBuffer cb, VkCommandBufferResetFlags flags)
{
vkb_cbtrack *k = cur();
if (!vkb_cbtrack_known(vkb_srv_current_table(), cb, "vkResetCommandBuffer")) return VK_ERROR_DEVICE_LOST;
pthread_mutex_lock(&k->lock);
cbt_entry *e = find_locked(k, cb);
if (e) e->state = CBT_INITIAL;
pthread_mutex_unlock(&k->lock);
return k->reset_cb(cb, flags);
}
static VKAPI_ATTR VkResult VKAPI_CALL cbt_BeginCommandBuffer(VkCommandBuffer cb, const VkCommandBufferBeginInfo *info)
{
vkb_cbtrack *k = cur();
if (!vkb_cbtrack_known(vkb_srv_current_table(), cb, "vkBeginCommandBuffer")) return VK_ERROR_DEVICE_LOST;
vkb_srv_table *t = vkb_srv_current_table();
if (!vkb_cbtrack_known(t, cb, "vkBeginCommandBuffer")) return VK_ERROR_DEVICE_LOST;
pthread_mutex_lock(&k->lock);
cbt_entry *e = find_locked(k, cb);
int bad_reset = 0, prev = CBT_INITIAL;
if (e) {
cbt_pool *p = pool_locked(k, e->pool);
prev = e->state;
bad_reset = prev != CBT_INITIAL && p && !(p->flags & VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT) && !k->warned_implicit_reset;
if (bad_reset) k->warned_implicit_reset = 1;
e->state = CBT_RECORDING;
e->begins++;
e->begin_flags = info ? info->flags : 0;
e->inheritance = info && info->pInheritanceInfo;
}
pthread_mutex_unlock(&k->lock);
if (bad_reset)
VKB_WARN("device %u: vkBeginCommandBuffer on command buffer %p in the %s state, from a pool without "
"RESET_COMMAND_BUFFER_BIT (an implicit reset the spec does not allow; logged once)", t ? t->id : 0, (void *)cb,
state_name(prev));
return k->begin(cb, info);
}
@@ -162,6 +295,9 @@ void vkb_cbtrack_device_init(vkb_srv_table *t)
vkb_cbtrack *k = calloc(1, sizeof(*k));
if (!k) return;
pthread_mutex_init(&k->lock, NULL);
k->create_pool = t->dt.vkCreateCommandPool;
k->reset_pool = t->dt.vkResetCommandPool;
k->reset_cb = t->dt.vkResetCommandBuffer;
k->alloc = t->dt.vkAllocateCommandBuffers;
k->free_cbs = t->dt.vkFreeCommandBuffers;
k->destroy_pool = t->dt.vkDestroyCommandPool;
@@ -175,6 +311,9 @@ void vkb_cbtrack_device_init(vkb_srv_table *t)
t->dt.vkBeginCommandBuffer = cbt_BeginCommandBuffer;
t->dt.vkQueueSubmit = cbt_QueueSubmit;
if (k->submit2) t->dt.vkQueueSubmit2 = cbt_QueueSubmit2;
if (k->create_pool) t->dt.vkCreateCommandPool = cbt_CreateCommandPool;
if (k->reset_pool) t->dt.vkResetCommandPool = cbt_ResetCommandPool;
if (k->reset_cb) t->dt.vkResetCommandBuffer = cbt_ResetCommandBuffer;
}
void vkb_cbtrack_device_destroy(vkb_srv_table *t)
@@ -188,6 +327,11 @@ void vkb_cbtrack_device_destroy(vkb_srv_table *t)
free(e);
}
}
while (k->pools) {
cbt_pool *p = k->pools;
k->pools = p->next;
free(p);
}
pthread_mutex_destroy(&k->lock);
free(k);
t->cbtrack = NULL;