mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-23 06:46:02 +00:00
Non-Adreno round 3: bridge images, Venus GL, shared buffers, Steam GPU drawing
- vkbridge: the memory model skips lazily allocated types. Mali-G615 lists DEVICE_LOCAL|LAZILY_ALLOCATED first; taken as the device-local type it left images with no memory type (self-test "image clear/draw: setup" FAIL, gamescope "No compatible image memory type"). - Session: a bridge self-test that fails images or draws falls back to the runtime's driver pair for that session (BL_VKBRIDGE_FALLBACK_ICD); Setup and the graphics report say so. - Venus: the Mali compatibility layer runs in every process but gamescope (DROIDDECK_MALI_COMPAT=1), so Zink in Steam and Xwayland gets nullDescriptor; null texel-buffer views get stand-ins too. Without nullDescriptor the session's GL goes to llvmpipe. - gamescope 0129: a refused compute pipeline is named with its SPIR-V capabilities. - Compositor: a buffer on two surfaces at once (gamescope's planes while a notification is up) is released only when the last one lets go. - Open driver pairs: processes.txt timeline for the first three minutes; Setup "Steam interface: GPU drawing" turns off software web compositing.
This commit is contained in:
1 parent
7464bd7697
commit
55b30fbf1d
17 files changed
+282
-18
No files matched your search
@@ -6,7 +6,8 @@
|
||||
* - robustness2's nullDescriptor: VK_NULL_HANDLE buffers, image views and vertex buffers in
|
||||
* descriptor writes (plain, template and push) and vertex-buffer binds are replaced with small
|
||||
* stand-ins the layer owns. robustBufferAccess2 itself maps to robustBufferAccess (layer.c).
|
||||
* A texel-buffer view stays null: its format is not known here.
|
||||
* A null texel-buffer view gets an RGBA8 (uniform) or R32_UINT (storage) view of the stand-in
|
||||
* buffer: its format is not known here, but Zink leaves them unbound and never reads them.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -72,7 +73,8 @@ static bool null_resources(struct device *dev)
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,
|
||||
.size = NULL_BUFFER_SIZE,
|
||||
.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
|
||||
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
|
||||
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT |
|
||||
VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT,
|
||||
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
|
||||
};
|
||||
if (dev->CreateBuffer(dev->handle, &binfo, NULL, &dev->null_buffer) != VK_SUCCESS)
|
||||
@@ -130,6 +132,18 @@ static bool null_resources(struct device *dev)
|
||||
};
|
||||
if (dev->CreateImageView(dev->handle, &vinfo, NULL, &dev->null_view) != VK_SUCCESS)
|
||||
return false;
|
||||
/* Texel views are optional: a write that needs one and has none keeps its null. */
|
||||
VkBufferViewCreateInfo tinfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO,
|
||||
.buffer = dev->null_buffer,
|
||||
.format = VK_FORMAT_R8G8B8A8_UNORM,
|
||||
.range = VK_WHOLE_SIZE,
|
||||
};
|
||||
if (dev->CreateBufferView(dev->handle, &tinfo, NULL, &dev->null_uniform_texel) != VK_SUCCESS)
|
||||
dev->null_uniform_texel = VK_NULL_HANDLE;
|
||||
tinfo.format = VK_FORMAT_R32_UINT;
|
||||
if (dev->CreateBufferView(dev->handle, &tinfo, NULL, &dev->null_storage_texel) != VK_SUCCESS)
|
||||
dev->null_storage_texel = VK_NULL_HANDLE;
|
||||
dev->null_ready = 1;
|
||||
layer_log("nullDescriptor: stand-in buffer and 1x1 image ready");
|
||||
return true;
|
||||
@@ -145,6 +159,8 @@ void null_resources_destroy(struct device *dev)
|
||||
}
|
||||
}
|
||||
map_free(&dev->templates);
|
||||
if (dev->null_uniform_texel) dev->DestroyBufferView(dev->handle, dev->null_uniform_texel, NULL);
|
||||
if (dev->null_storage_texel) dev->DestroyBufferView(dev->handle, dev->null_storage_texel, NULL);
|
||||
if (dev->null_view) dev->DestroyImageView(dev->handle, dev->null_view, NULL);
|
||||
if (dev->null_image) dev->DestroyImage(dev->handle, dev->null_image, NULL);
|
||||
if (dev->null_image_memory) dev->FreeMemory(dev->handle, dev->null_image_memory, NULL);
|
||||
@@ -164,6 +180,18 @@ static bool is_image_type(VkDescriptorType t)
|
||||
t == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER || t == VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
|
||||
}
|
||||
|
||||
static bool is_texel_type(VkDescriptorType t)
|
||||
{
|
||||
return t == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER || t == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
|
||||
}
|
||||
|
||||
static void fix_texel(struct device *dev, VkDescriptorType t, VkBufferView *view)
|
||||
{
|
||||
if (*view != VK_NULL_HANDLE || !null_resources(dev))
|
||||
return;
|
||||
*view = t == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER ? dev->null_storage_texel : dev->null_uniform_texel;
|
||||
}
|
||||
|
||||
static void fix_buffer(struct device *dev, VkDescriptorBufferInfo *info)
|
||||
{
|
||||
if (info->buffer != VK_NULL_HANDLE || !null_resources(dev))
|
||||
@@ -194,6 +222,8 @@ static VkWriteDescriptorSet *fix_writes(struct device *dev, uint32_t count, cons
|
||||
if (is_image_type(w->descriptorType) && w->pImageInfo && w->pImageInfo[j].imageView == VK_NULL_HANDLE &&
|
||||
w->descriptorType != VK_DESCRIPTOR_TYPE_SAMPLER)
|
||||
null_found = true;
|
||||
if (is_texel_type(w->descriptorType) && w->pTexelBufferView && w->pTexelBufferView[j] == VK_NULL_HANDLE)
|
||||
null_found = true;
|
||||
}
|
||||
if (!null_found)
|
||||
continue;
|
||||
@@ -209,6 +239,13 @@ static VkWriteDescriptorSet *fix_writes(struct device *dev, uint32_t count, cons
|
||||
fix_buffer(dev, &b[j]);
|
||||
copies[i].pBufferInfo = b;
|
||||
(*scratch)[(*scratch_count)++] = b;
|
||||
} else if (is_texel_type(w->descriptorType)) {
|
||||
VkBufferView *v = malloc(w->descriptorCount * sizeof(*v));
|
||||
memcpy(v, w->pTexelBufferView, w->descriptorCount * sizeof(*v));
|
||||
for (uint32_t j = 0; j < w->descriptorCount; j++)
|
||||
fix_texel(dev, w->descriptorType, &v[j]);
|
||||
copies[i].pTexelBufferView = v;
|
||||
(*scratch)[(*scratch_count)++] = v;
|
||||
} else {
|
||||
VkDescriptorImageInfo *im = malloc(w->descriptorCount * sizeof(*im));
|
||||
memcpy(im, w->pImageInfo, w->descriptorCount * sizeof(*im));
|
||||
@@ -320,13 +357,15 @@ static void *fix_template_data(struct device *dev, VkDescriptorUpdateTemplate tm
|
||||
const VkDescriptorUpdateTemplateEntry *e = &t->entries[i];
|
||||
bool buffer = is_buffer_type(e->descriptorType);
|
||||
bool image = is_image_type(e->descriptorType);
|
||||
if (!buffer && !image)
|
||||
bool texel = is_texel_type(e->descriptorType);
|
||||
if (!buffer && !image && !texel)
|
||||
continue;
|
||||
for (uint32_t j = 0; j < e->descriptorCount; j++) {
|
||||
size_t at = e->offset + (size_t)j * e->stride;
|
||||
const char *src = (const char *)(copy ? copy : data) + at;
|
||||
bool null_handle = buffer ? ((const VkDescriptorBufferInfo *)src)->buffer == VK_NULL_HANDLE
|
||||
: ((const VkDescriptorImageInfo *)src)->imageView == VK_NULL_HANDLE;
|
||||
bool null_handle = buffer ? ((const VkDescriptorBufferInfo *)src)->buffer == VK_NULL_HANDLE
|
||||
: texel ? *(const VkBufferView *)src == VK_NULL_HANDLE
|
||||
: ((const VkDescriptorImageInfo *)src)->imageView == VK_NULL_HANDLE;
|
||||
if (!null_handle)
|
||||
continue;
|
||||
if (!copy) {
|
||||
@@ -335,6 +374,8 @@ static void *fix_template_data(struct device *dev, VkDescriptorUpdateTemplate tm
|
||||
}
|
||||
if (buffer)
|
||||
fix_buffer(dev, (VkDescriptorBufferInfo *)((char *)copy + at));
|
||||
else if (texel)
|
||||
fix_texel(dev, e->descriptorType, (VkBufferView *)((char *)copy + at));
|
||||
else
|
||||
fix_image(dev, (VkDescriptorImageInfo *)((char *)copy + at));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#define _GNU_SOURCE
|
||||
#include "mali_compat.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -133,13 +135,19 @@ void map_free(struct handle_map *map)
|
||||
*map = (struct handle_map){0};
|
||||
}
|
||||
|
||||
/* Wine processes only: the Steam client and gamescope run fine without the layer, and their
|
||||
* Zink would otherwise start using the made-up features too. */
|
||||
/* Wine processes by default. DROIDDECK_MALI_COMPAT=1 (the app's Venus route) turns it on everywhere
|
||||
* but gamescope, so Zink in the Steam client and Xwayland gets robustness2's nullDescriptor, which it
|
||||
* requires; gamescope runs fine on the driver's own features. =all includes gamescope too. */
|
||||
static bool wanted(void)
|
||||
{
|
||||
const char *setting = getenv("DROIDDECK_MALI_COMPAT");
|
||||
if (setting)
|
||||
return strcmp(setting, "0") != 0;
|
||||
if (setting) {
|
||||
if (strcmp(setting, "0") == 0)
|
||||
return false;
|
||||
if (strcmp(setting, "all") == 0)
|
||||
return true;
|
||||
return strcmp(program_invocation_short_name, "gamescope") != 0;
|
||||
}
|
||||
return getenv("WINEPREFIX") != NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,8 @@ struct instance {
|
||||
X(GetImageMemoryRequirements) \
|
||||
X(BindImageMemory) \
|
||||
X(DestroyImageView) \
|
||||
X(CreateBufferView) \
|
||||
X(DestroyBufferView) \
|
||||
X(UpdateDescriptorSets) \
|
||||
X(CmdPushDescriptorSet) \
|
||||
X(CreateDescriptorUpdateTemplate) \
|
||||
@@ -157,6 +159,9 @@ struct device {
|
||||
VkImage null_image;
|
||||
VkDeviceMemory null_image_memory;
|
||||
VkImageView null_view;
|
||||
/* Texel-buffer stand-ins: RGBA8 for uniform (sampled) texel buffers, R32_UINT for storage. */
|
||||
VkBufferView null_uniform_texel;
|
||||
VkBufferView null_storage_texel;
|
||||
struct device *next;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user