bigscreen-beyond-vulkan-90hz

shim to get 90hz working on bigscreen beyond 2e in steamvr without monado
Log | Files | Refs

commit fbc144250aadc405b0d5b3837446dace9f828794
Author: Vineet Kumar <git@vineetk.net>
Date:   Sun, 22 Nov 2026 16:09:58 +0100

initial payload

Diffstat:
Abeyond-90hz-config.c | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aheadset-gpu-90hz.c | 532+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aheadset-gpu-90hz.exports | 8++++++++
3 files changed, 608 insertions(+), 0 deletions(-)

diff --git a/beyond-90hz-config.c b/beyond-90hz-config.c @@ -0,0 +1,68 @@ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <dlfcn.h> +#include <zlib.h> +#include <xcb/randr.h> +#include <stdio.h> +#include <string.h> +#include <stdbool.h> + +/* Local Beyond 90 Hz workaround: no device/firmware writes. + * vrserver: adjust the eye geometry in decompressed device configuration. + * vrcompositor: identify DP connector using the adjusted geometry; actual + * scanout selection uses a real Vulkan 90 Hz mode, not this RandR snapshot. + * Companion headset-gpu-90hz.c filters the Beyond's Vulkan mode list. */ +xcb_randr_mode_info_t *xcb_randr_get_screen_resources_modes( + const xcb_randr_get_screen_resources_reply_t *r) +{ + static xcb_randr_mode_info_t *(*next)(const xcb_randr_get_screen_resources_reply_t *); + if (!next) next=dlsym(RTLD_NEXT,"xcb_randr_get_screen_resources_modes"); + if (!next) return NULL; + xcb_randr_mode_info_t *m=next(r); + for (unsigned i=0; m && i<r->num_modes; ++i) + if (m[i].width==5088 && m[i].height==2544) { + m[i].width=3840; m[i].height=1920; + } + return m; +} + +/* Lighthouse requests DEEPBIND, otherwise bypassing the inflate interposer. */ +void *dlopen(const char *path, int flags) +{ + static void *(*next)(const char *,int); + if (!next) next=dlsym(RTLD_NEXT,"dlopen"); + if (path && strstr(path,"driver_lighthouse.so")) flags &= ~RTLD_DEEPBIND; + return next(path,flags); +} + +static unsigned char *size_value(unsigned char *p, size_t n, const char *key) +{ + unsigned char *k=memmem(p,n,key,strlen(key)), *end=p+n; + if (!k) return NULL; + k+=strlen(key); + while (k<end && *k!=':') ++k; + if (k<end) ++k; + while (k<end && (*k==' ' || *k=='\t')) ++k; + return end-k>=4 && !memcmp(k,"2544",4) ? k : NULL; +} + +int inflate(z_streamp s, int flush) +{ + static int (*next)(z_streamp,int); + if (!next) next=dlsym(RTLD_NEXT,"inflate"); + unsigned char *start=s->next_out; + uInt available=s->avail_out; + int result=next(s,flush); + size_t n=available-s->avail_out; + /* This headset emits both fields in one 135-byte JSON chunk. Only + * substitute the exact native Beyond dimensions; never change length. */ + unsigned char *w=size_value(start,n,"\"eye_target_width_in_pixels\""); + unsigned char *h=size_value(start,n,"\"eye_target_height_in_pixels\""); + if (w && h) { + memcpy(w,"1920",4); memcpy(h,"1920",4); + FILE *f=fopen("/tmp/beyond-90hz-config.log","a"); + if (f) { fprintf(f,"Adjusted native 2544x2544 eye geometry to 1920x1920 in memory\n"); fclose(f); } + } + return result; +} diff --git a/headset-gpu-90hz.c b/headset-gpu-90hz.c @@ -0,0 +1,532 @@ +/* Opt-in Vulkan layer: expose only the headset GPU, PCI 0000:07:00.0. + * + * Loader-robustness note: Valve's SteamRuntime loader (1.3.239 fork) hands the + * topmost layer a *trampoline* GIPA as pfnNextGetInstanceProcAddr. Resolving + * intercepted names through that trampoline at call time returns this layer's + * own functions (infinite recursion). Fix: resolve all downward function + * pointers once inside vkCreateInstance, while the child dispatch is still + * intact, and call those pointers directly thereafter. + */ +#include <vulkan/vulkan.h> +#include <vulkan/vk_layer.h> +#include <stdatomic.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#define _GNU_SOURCE 1 +#include <dlfcn.h> + +static void hgpu_log(const char *fmt, ...) +{ + FILE *f = fopen("/tmp/headset-gpu.log", "a"); + if (!f) return; + va_list ap; va_start(ap, fmt); + vfprintf(f, fmt, ap); va_end(ap); + fclose(f); +} + +static atomic_flag dispatch_lock = ATOMIC_FLAG_INIT; +static void dispatch_acquire(void) { while (atomic_flag_test_and_set_explicit(&dispatch_lock, memory_order_acquire)) { } } +static void dispatch_release(void) { atomic_flag_clear_explicit(&dispatch_lock, memory_order_release); } + +struct physical_device { + VkPhysicalDevice handle; + struct physical_device *next; +}; + +struct instance_dispatch { + VkInstance handle; /* app-visible handle */ + VkInstance child; /* handle produced by the node below */ + PFN_vkEnumeratePhysicalDevices enumerate; + PFN_vkEnumeratePhysicalDeviceGroups groups; + PFN_vkDestroyInstance destroy; + PFN_vkCreateDevice create_device; + PFN_vkGetDisplayModePropertiesKHR display_modes; + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR displays; + PFN_vkGetPhysicalDeviceProperties2 props2; + PFN_vkGetInstanceProcAddr next_gipa; /* for generic pass-through */ + struct physical_device *physical; + struct instance_dispatch *next; +}; + +struct device_dispatch { + VkDevice handle; + VkDevice child; + PFN_vkDestroyDevice destroy; + PFN_vkGetDeviceProcAddr gdpa; + struct device_dispatch *next; +}; + +static struct instance_dispatch *instances; +static struct device_dispatch *devices; + +static struct instance_dispatch *instance_entry(VkInstance handle) +{ + for (struct instance_dispatch *it = instances; it; it = it->next) + if (it->handle == handle) + return it; + return NULL; +} + +static VkResult remember_physical(VkInstance instance, VkPhysicalDevice physical) +{ + dispatch_acquire(); + for (struct instance_dispatch *it = instances; it; it = it->next) { + if (it->handle != instance) + continue; + for (struct physical_device *p = it->physical; p; p = p->next) { + if (p->handle == physical) { + dispatch_release(); + return VK_SUCCESS; + } + } + struct physical_device *p = malloc(sizeof(*p)); + if (!p) { + dispatch_release(); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + p->handle = physical; + p->next = it->physical; + it->physical = p; + dispatch_release(); + return VK_SUCCESS; + } + dispatch_release(); + return VK_ERROR_INITIALIZATION_FAILED; +} + +static VkInstance physical_owner(VkPhysicalDevice physical) +{ + VkInstance result = VK_NULL_HANDLE; + dispatch_acquire(); + for (struct instance_dispatch *it = instances; it; it = it->next) + for (struct physical_device *p = it->physical; p; p = p->next) + if (p->handle == physical) { + dispatch_release(); + return it->handle; + } + dispatch_release(); + return result; +} + +static const char *target_pci = "0000:07:00.0"; + +static void load_target(void) +{ + const char *env = getenv("STEAMVR_HEADSET_GPU"); + if (env && env[0] && strcmp(env, "1")) + target_pci = env; +} + +/* Mesa encodes the DRM PCI address into deviceUUID as + * [0..3]=domain (LE), [4]=bus, [5]=device<<3|func, [6..7]=0 + * on this driver stack, so bus 07 device 00 function 0 gives byte 4 = 0x07 + * and bus 03 gives 0x03. Match on that plus driverID == RADV. */ +static bool is_target(VkInstance instance, VkPhysicalDevice physical) +{ + struct instance_dispatch *entry; + dispatch_acquire(); + entry = instance_entry(instance); + dispatch_release(); + if (!entry || !entry->props2) + return false; + + VkPhysicalDeviceIDProperties idp = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES }; + VkPhysicalDeviceProperties2 props = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 }; + props.pNext = &idp; + entry->props2(physical, &props); + + + unsigned int bus = idp.deviceUUID[4]; + char text[32]; + snprintf(text, sizeof(text), "0000:%02x:00.0", bus); + static int uuid_budget = 12; + if (uuid_budget > 0) { + hgpu_log("is_target name=%s bus=%u -> %s target=%s\n", + props.properties.deviceName, bus, text, target_pci); + uuid_budget--; + } + return strcmp(text, target_pci) == 0; +} + + +static VKAPI_ATTR VkResult VKAPI_CALL enumerate_physical(VkInstance instance, + uint32_t *count, VkPhysicalDevice *physicals) +{ + static int log_budget = 20; + struct instance_dispatch *entry; + dispatch_acquire(); + entry = instance_entry(instance); + dispatch_release(); + if (log_budget > 0) { hgpu_log("enumerate_physical instance=%p entry=%p\n", (void *)instance, (void *)entry); log_budget--; } + if (!entry || !entry->enumerate) + return VK_ERROR_INITIALIZATION_FAILED; + uint32_t n = 0; + VkResult result = entry->enumerate(entry->child, &n, NULL); + if (result != VK_SUCCESS && result != VK_INCOMPLETE) + return result; + if (n == 0) { + if (count) *count = 0; + return VK_SUCCESS; + } + VkPhysicalDevice *all = calloc(n, sizeof(*all)); + if (!all) + return VK_ERROR_OUT_OF_HOST_MEMORY; + uint32_t cap = n; + result = entry->enumerate(entry->child, &cap, all); + if (result != VK_SUCCESS && result != VK_INCOMPLETE) { + free(all); + return result; + } + n = cap; + uint32_t kept = 0; + for (uint32_t i = 0; i < n; i++) { + if (!is_target(instance, all[i])) + continue; + if (physicals) { + if (kept >= *count) { free(all); return VK_INCOMPLETE; } + physicals[kept] = all[i]; + } + if (remember_physical(instance, all[i]) != VK_SUCCESS) { + free(all); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + kept++; + } + free(all); + *count = kept; + hgpu_log("enumerate_physical kept=%u\n", kept); + return VK_SUCCESS; +} + +static VKAPI_ATTR VkResult VKAPI_CALL enumerate_physical_device_groups(VkInstance instance, + uint32_t *count, VkPhysicalDeviceGroupProperties *groups) +{ + struct instance_dispatch *entry; + dispatch_acquire(); + entry = instance_entry(instance); + dispatch_release(); + if (!entry || !entry->groups) + return VK_ERROR_INITIALIZATION_FAILED; + uint32_t n = 0; + VkResult result = entry->groups(entry->child, &n, NULL); + if (result != VK_SUCCESS && result != VK_INCOMPLETE) + return result; + if (n == 0) { + if (count) *count = 0; + return VK_SUCCESS; + } + VkPhysicalDeviceGroupProperties *all = calloc(n, sizeof(*all)); + if (!all) + return VK_ERROR_OUT_OF_HOST_MEMORY; + for (uint32_t i = 0; i < n; i++) + all[i].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES; + uint32_t cap = n; + result = entry->groups(entry->child, &cap, all); + if (result != VK_SUCCESS && result != VK_INCOMPLETE) { + free(all); + return result; + } + n = cap; + uint32_t kept = 0; + for (uint32_t i = 0; i < n; i++) { + if (all[i].physicalDeviceCount == 0 || !is_target(instance, all[i].physicalDevices[0])) + continue; + if (groups) { + if (kept >= *count) { free(all); return VK_INCOMPLETE; } + groups[kept] = all[i]; + } + if (remember_physical(instance, all[i].physicalDevices[0]) != VK_SUCCESS) { + free(all); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + kept++; + } + free(all); + *count = kept; + return VK_SUCCESS; +} + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *info, + const VkAllocationCallbacks *allocator, VkInstance *instance) +{ + load_target(); + const VkLayerInstanceCreateInfo *chain = info->pNext; + hgpu_log("create_instance ENTER pNext=%p\n", (void *)info->pNext); + while (chain && (chain->sType != VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO || + chain->function != VK_LAYER_LINK_INFO)) + chain = chain->pNext; + if (!chain || !chain->u.pLayerInfo) { + hgpu_log("create_instance NO LINK INFO\n"); + return VK_ERROR_INITIALIZATION_FAILED; + } + PFN_vkGetInstanceProcAddr next = chain->u.pLayerInfo->pfnNextGetInstanceProcAddr; + if (!next) + return VK_ERROR_INITIALIZATION_FAILED; + struct instance_dispatch *entry = calloc(1, sizeof(*entry)); + if (!entry) + return VK_ERROR_OUT_OF_HOST_MEMORY; + ((VkLayerInstanceCreateInfo *)chain)->u.pLayerInfo = chain->u.pLayerInfo->pNext; + VkApplicationInfo app = {.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO}; + if (info->pApplicationInfo) + app = *info->pApplicationInfo; + uint32_t original = app.apiVersion; + if (app.apiVersion < VK_API_VERSION_1_1) + app.apiVersion = VK_API_VERSION_1_1; + VkInstanceCreateInfo copy = *info; + copy.pApplicationInfo = &app; + PFN_vkCreateInstance fn = (PFN_vkCreateInstance)next(VK_NULL_HANDLE, "vkCreateInstance"); + if (!fn) { + free(entry); + return VK_ERROR_INITIALIZATION_FAILED; + } + VkResult result = fn(&copy, allocator, instance); + if (result != VK_SUCCESS) { + free(entry); + return result; + } + hgpu_log("vkCreateInstance API %u.%u -> %u.%u\n", + VK_API_VERSION_MAJOR(original), VK_API_VERSION_MINOR(original), + VK_API_VERSION_MAJOR(app.apiVersion), VK_API_VERSION_MINOR(app.apiVersion)); + /* Resolve downward functions NOW, while the child dispatch is intact. */ + entry->handle = *instance; + entry->child = *instance; + entry->next_gipa = next; + entry->enumerate = (PFN_vkEnumeratePhysicalDevices)next(*instance, "vkEnumeratePhysicalDevices"); + entry->groups = (PFN_vkEnumeratePhysicalDeviceGroups)next(*instance, "vkEnumeratePhysicalDeviceGroups"); + entry->destroy = (PFN_vkDestroyInstance)next(*instance, "vkDestroyInstance"); + entry->create_device = (PFN_vkCreateDevice)next(*instance, "vkCreateDevice"); + entry->display_modes = (PFN_vkGetDisplayModePropertiesKHR)next(*instance, "vkGetDisplayModePropertiesKHR"); + entry->displays = (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)next(*instance, "vkGetPhysicalDeviceDisplayPropertiesKHR"); + entry->props2 = (PFN_vkGetPhysicalDeviceProperties2)next(*instance, "vkGetPhysicalDeviceProperties2"); + hgpu_log("create_instance handle=%p enumerate=%p groups=%p destroy=%p createdev=%p props2=%p\n", + (void *)entry->handle, (void *)entry->enumerate, (void *)entry->groups, + (void *)entry->destroy, (void *)entry->create_device, (void *)entry->props2); + dispatch_acquire(); + entry->next = instances; + instances = entry; + dispatch_release(); + return VK_SUCCESS; +} + +static VKAPI_ATTR void VKAPI_CALL destroy_instance(VkInstance instance, + const VkAllocationCallbacks *allocator) +{ + if (instance == VK_NULL_HANDLE) + return; + struct instance_dispatch *entry = NULL; + dispatch_acquire(); + for (struct instance_dispatch **it = &instances; *it; it = &(*it)->next) { + if ((*it)->handle == instance) { + entry = *it; + *it = entry->next; + break; + } + } + dispatch_release(); + if (!entry) + return; + PFN_vkDestroyInstance fn = entry->destroy; + if (fn) + fn(entry->child, allocator); + while (entry->physical) { + struct physical_device *p = entry->physical; + entry->physical = p->next; + free(p); + } + free(entry); +} + +static struct device_dispatch *device_entry(VkDevice handle) +{ + for (struct device_dispatch *it = devices; it; it = it->next) + if (it->handle == handle) + return it; + return NULL; +} + +static VKAPI_ATTR VkResult VKAPI_CALL create_device(VkPhysicalDevice physical, + const VkDeviceCreateInfo *info, const VkAllocationCallbacks *allocator, VkDevice *device) +{ + const VkLayerDeviceCreateInfo *chain = info->pNext; + while (chain && (chain->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO || + chain->function != VK_LAYER_LINK_INFO)) + chain = chain->pNext; + if (!chain || !chain->u.pLayerInfo) + return VK_ERROR_INITIALIZATION_FAILED; + VkInstance instance = physical_owner(physical); + struct instance_dispatch *ientry; + dispatch_acquire(); + ientry = instance_entry(instance); + dispatch_release(); + if (!ientry || !ientry->create_device) + return VK_ERROR_INITIALIZATION_FAILED; + PFN_vkGetDeviceProcAddr next_gdpa = chain->u.pLayerInfo->pfnNextGetDeviceProcAddr; + if (!next_gdpa) + return VK_ERROR_INITIALIZATION_FAILED; + struct device_dispatch *entry = calloc(1, sizeof(*entry)); + if (!entry) + return VK_ERROR_OUT_OF_HOST_MEMORY; + ((VkLayerDeviceCreateInfo *)chain)->u.pLayerInfo = chain->u.pLayerInfo->pNext; + VkResult result = ientry->create_device(physical, info, allocator, device); + if (result != VK_SUCCESS) { + free(entry); + return result; + } + entry->handle = *device; + entry->child = *device; + entry->gdpa = next_gdpa; + entry->destroy = (PFN_vkDestroyDevice)next_gdpa(*device, "vkDestroyDevice"); + hgpu_log("create_device handle=%p destroy=%p\n", (void *)entry->handle, (void *)entry->destroy); + dispatch_acquire(); + entry->next = devices; + devices = entry; + dispatch_release(); + return VK_SUCCESS; +} + +static VKAPI_ATTR void VKAPI_CALL destroy_device(VkDevice device, + const VkAllocationCallbacks *allocator) +{ + if (device == VK_NULL_HANDLE) + return; + struct device_dispatch *entry = NULL; + dispatch_acquire(); + for (struct device_dispatch **it = &devices; *it; it = &(*it)->next) { + if ((*it)->handle == device) { + entry = *it; + *it = entry->next; + break; + } + } + dispatch_release(); + if (!entry) + return; + PFN_vkDestroyDevice fn = entry->destroy; + VkDevice child = entry->child; + free(entry); + if (fn) + fn(child, allocator); +} + +static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL gdpa(VkDevice device, const char *name) +{ + if (!strcmp(name, "vkGetDeviceProcAddr")) + return (PFN_vkVoidFunction)gdpa; + if (!strcmp(name, "vkDestroyDevice")) + return (PFN_vkVoidFunction)destroy_device; + struct device_dispatch *entry; + dispatch_acquire(); + entry = device_entry(device); + dispatch_release(); + return entry && entry->gdpa ? entry->gdpa(device, name) : NULL; +} + +/* Work around SteamVR selecting full-resolution 75 Hz despite requesting 90 Hz. + * Only filter vrcompositor, and only a Beyond display exposing both known modes. + * Disable without rebuilding via /tmp/steamvr-disable-beyond-90hz-filter. */ +static VKAPI_ATTR VkResult VKAPI_CALL beyond_display_modes( + VkPhysicalDevice physical, VkDisplayKHR display, uint32_t *count, + VkDisplayModePropertiesKHR *out) +{ + VkInstance instance = physical_owner(physical); + struct instance_dispatch *entry; + dispatch_acquire(); + entry = instance_entry(instance); + dispatch_release(); + PFN_vkGetDisplayModePropertiesKHR fn = entry ? entry->display_modes : NULL; + if (!fn) return VK_ERROR_INITIALIZATION_FAILED; + char comm[64] = {0}; + FILE *f = fopen("/proc/self/comm", "r"); + if (f) { fgets(comm, sizeof(comm), f); fclose(f); } + f = fopen("/tmp/steamvr-disable-beyond-90hz-filter", "r"); + if (f) { fclose(f); return fn(physical, display, count, out); } + if (strncmp(comm, "vrcompositor", 12)) return fn(physical, display, count, out); + uint32_t n = 0; + VkResult r = fn(physical, display, &n, NULL); + if (r != VK_SUCCESS || !n) return fn(physical, display, count, out); + VkDisplayModePropertiesKHR *modes = calloc(n, sizeof(*modes)); + if (!modes) return VK_ERROR_OUT_OF_HOST_MEMORY; + r = fn(physical, display, &n, modes); + int selected = -1; + bool beyond = false; + if (r == VK_SUCCESS) for (uint32_t i = 0; i < n; ++i) { + VkDisplayModeParametersKHR p = modes[i].parameters; + if (p.visibleRegion.width == 5088 && p.visibleRegion.height == 2544 && + p.refreshRate >= 74900 && p.refreshRate <= 75100) beyond = true; + if (p.visibleRegion.width == 3840 && p.visibleRegion.height == 1920 && + p.refreshRate >= 89900 && p.refreshRate <= 90100) selected = (int)i; + } + if (!beyond || selected < 0) { free(modes); return fn(physical, display, count, out); } + if (!out) { *count = 1; r = VK_SUCCESS; } + else if (*count) { out[0] = modes[selected]; *count = 1; r = VK_SUCCESS; } + else { *count = 0; r = VK_INCOMPLETE; } + hgpu_log("Beyond 90Hz filter: exposing only 3840x1920@%u display=%p\n", + modes[selected].parameters.refreshRate, (void *)display); + free(modes); + return r; +} + +static VKAPI_ATTR VkResult VKAPI_CALL beyond_displays(VkPhysicalDevice physical, + uint32_t *count, VkDisplayPropertiesKHR *out) +{ + struct instance_dispatch *entry; + VkInstance owner = physical_owner(physical); + dispatch_acquire(); entry = instance_entry(owner); dispatch_release(); + if (!entry || !entry->displays) return VK_ERROR_INITIALIZATION_FAILED; + VkResult r = entry->displays(physical, count, out); + char comm[64] = {0}; FILE *f = fopen("/proc/self/comm", "r"); + if (f) { fgets(comm, sizeof(comm), f); fclose(f); } + if (out && (r == VK_SUCCESS || r == VK_INCOMPLETE) && !strncmp(comm,"vrcompositor",12)) + for (uint32_t i=0; i<*count; ++i) + if (out[i].physicalResolution.width==5088 && out[i].physicalResolution.height==2544) + out[i].physicalResolution = (VkExtent2D){3840,1920}; + return r; +} + +static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL gipa(VkInstance instance, const char *name) +{ + if (!name) + return NULL; + if (!strcmp(name, "vkGetInstanceProcAddr")) + return (PFN_vkVoidFunction)gipa; + if (!strcmp(name, "vkGetDeviceProcAddr")) + return (PFN_vkVoidFunction)gdpa; + if (!strcmp(name, "vkCreateInstance")) + return (PFN_vkVoidFunction)vkCreateInstance; + if (!strcmp(name, "vkDestroyInstance")) + return (PFN_vkVoidFunction)destroy_instance; + if (!strcmp(name, "vkCreateDevice")) + return (PFN_vkVoidFunction)create_device; + if (!strcmp(name, "vkDestroyDevice")) + return (PFN_vkVoidFunction)destroy_device; + if (!strcmp(name, "vkGetPhysicalDeviceDisplayPropertiesKHR")) + return (PFN_vkVoidFunction)beyond_displays; + if (!strcmp(name, "vkGetDisplayModePropertiesKHR")) + return (PFN_vkVoidFunction)beyond_display_modes; + if (!strcmp(name, "vkEnumeratePhysicalDevices")) + return (PFN_vkVoidFunction)enumerate_physical; + if (!strcmp(name, "vkEnumeratePhysicalDeviceGroups") || !strcmp(name, "vkEnumeratePhysicalDeviceGroupsKHR")) + return (PFN_vkVoidFunction)enumerate_physical_device_groups; + if (!instance) + return NULL; + struct instance_dispatch *entry; + dispatch_acquire(); + entry = instance_entry(instance); + dispatch_release(); + return entry && entry->next_gipa ? entry->next_gipa(instance, name) : NULL; +} + +VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *version) +{ + hgpu_log("negotiate loaderLayerInterfaceVersion=%u\n", version ? version->loaderLayerInterfaceVersion : 999); + if (!version || version->loaderLayerInterfaceVersion < 2) + return VK_ERROR_INITIALIZATION_FAILED; + version->loaderLayerInterfaceVersion = 2; + version->pfnGetInstanceProcAddr = gipa; + version->pfnGetDeviceProcAddr = gdpa; + version->pfnGetPhysicalDeviceProcAddr = gipa; + return VK_SUCCESS; +} diff --git a/headset-gpu-90hz.exports b/headset-gpu-90hz.exports @@ -0,0 +1,8 @@ +{ + global: + vkNegotiateLoaderLayerInterfaceVersion; + inflate; + dlopen; + xcb_randr_get_screen_resources_modes; + local: *; +};