From 4589876ebce88ab598b4d7da03b092174a2be987 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 17:08:01 -0700 Subject: [PATCH 01/20] Adds Vulkan-Docs repo to externals --- .gitmodules | 4 ++++ External/Vulkan-Docs | 1 + 2 files changed, 5 insertions(+) create mode 160000 External/Vulkan-Docs diff --git a/.gitmodules b/.gitmodules index da27bc313..d0bd23dcc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -42,3 +42,7 @@ [submodule "External/xxhash"] path = External/xxhash url = https://github.com/FEX-Emu/xxHash.git +[submodule "External/Vulkan-Docs"] + shallow = true + path = External/Vulkan-Docs + url = https://github.com/KhronosGroup/Vulkan-Docs.git diff --git a/External/Vulkan-Docs b/External/Vulkan-Docs new file mode 160000 index 000000000..a0960966d --- /dev/null +++ b/External/Vulkan-Docs @@ -0,0 +1 @@ +Subproject commit a0960966d565bdfc6e853a0bc471e58fdbd374ef From e2b24f7f59f84cae552e2458a11be50b042839f5 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 17:54:30 -0700 Subject: [PATCH 02/20] Thunks: Support thunk init function on host Allows library to have an additional initialization function --- ThunkLibs/include/common/Host.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ThunkLibs/include/common/Host.h b/ThunkLibs/include/common/Host.h index 7cb811b55..836874018 100644 --- a/ThunkLibs/include/common/Host.h +++ b/ThunkLibs/include/common/Host.h @@ -14,6 +14,15 @@ typedef void fex_call_callback_t(uintptr_t callback, void *arg0, void* arg1); static fex_call_callback_t* call_guest; #define EXPORTS(name) extern "C" { ExportEntry* fexthunks_exports_##name(void *a0, uintptr_t a1) { call_guest = (fex_call_callback_t*)a0; fexldr_init_##name(); return exports; } } +#define EXPORTS_INIT(name, init_fn) \ + extern "C" { \ + ExportEntry* fexthunks_exports_##name(void *a0, uintptr_t a1) { \ + call_guest = (fex_call_callback_t*)a0; \ + fexldr_init_##name(); \ + init_fn (); \ + return exports; \ + } } + #define EXPORTS_WITH_CALLBACKS(name) extern "C" { ExportEntry* fexthunks_exports_##name(void *a0, uintptr_t a1) { call_guest = (fex_call_callback_t*)a0; (uintptr_t&)callback_unpacks = a1; fexldr_init_##name(); return exports; } } #define LOAD_LIB_INIT(init_fn) \ From 9451bc5273e95991efc873fd0c5a1df7fde6280f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:03:24 -0700 Subject: [PATCH 03/20] Thunks: Pass Vulkan XML to the thunks generators --- CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20b6a5318..c7c83f0b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -427,7 +427,10 @@ if (BUILD_THUNKS) PREFIX host-libs SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ThunkLibs/HostLibs" BINARY_DIR "Host" - CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" + CMAKE_ARGS + "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" + "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" + "-DVULKAN_XML=${CMAKE_SOURCE_DIR}/External/Vulkan-Docs/xml/vk.xml" INSTALL_COMMAND "" BUILD_ALWAYS ON ) @@ -445,7 +448,13 @@ if (BUILD_THUNKS) PREFIX guest-libs SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ThunkLibs/GuestLibs" BINARY_DIR "Guest" - CMAKE_ARGS "-DX86_C_COMPILER:STRING=${X86_C_COMPILER}" "-DX86_CXX_COMPILER:STRING=${X86_CXX_COMPILER}" "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" + CMAKE_ARGS + "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" + "-DX86_C_COMPILER:STRING=${X86_C_COMPILER}" + "-DX86_CXX_COMPILER:STRING=${X86_CXX_COMPILER}" + "-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" + "-DSTRUCT_VERIFIER=${CMAKE_SOURCE_DIR}/Scripts/StructPackVerifier.py" + "-DVULKAN_XML=${CMAKE_SOURCE_DIR}/External/Vulkan-Docs/xml/vk.xml" INSTALL_COMMAND "" BUILD_ALWAYS ON ) From 39c1751215591abde88f32101ee8e87f5b7c8d5d Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:05:03 -0700 Subject: [PATCH 04/20] Thunks: Adds a few more features to Generator python file This will be necessary for Vulkan --- ThunkLibs/Generators/ThunkHelpers.py | 39 +++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/ThunkLibs/Generators/ThunkHelpers.py b/ThunkLibs/Generators/ThunkHelpers.py index 5f75ca9ef..40176c276 100644 --- a/ThunkLibs/Generators/ThunkHelpers.py +++ b/ThunkLibs/Generators/ThunkHelpers.py @@ -58,8 +58,10 @@ def fn(cdecl): "args": list(filter(None, map(str.strip, args.split(',')))), "thunk": True, "pack": True, + "pack_pair": True, "unpack": True, "ldr_ptr": True, + "ldr_ptr_pair": True, "ldr": True, "tab_unpack": True, "tab_pack": True @@ -77,10 +79,18 @@ def no_pack(): global CurrentFunction CurrentFunction["pack"] = False +def no_pack_pair(): + global CurrentFunction + CurrentFunction["pack_pair"] = False + def no_ldr_ptr(): global CurrentFunction CurrentFunction["ldr_ptr"] = False +def no_ldr_ptr_pair(): + global CurrentFunction + CurrentFunction["ldr_ptr_pair"] = False + def no_ldr(): global CurrentFunction CurrentFunction["ldr"] = False @@ -191,6 +201,10 @@ def GenerateFunctionPack(lib, function): print("") +def GenerateFunctionPackPair(lib, function): + #define T(name) { #name, (PFN_vkVoidFunction*)fexfn_pack_##name } + print("PAIR({0}, fexfn_pack_{0}),".format(function["name"])) + ### ### function_unpacks ### Used in the Host to unpack and call the ldr_ptr @@ -208,8 +222,9 @@ def GenerateFunctionUnpack_args(args): return "".join(rv) def GenerateFunctionUnpack(lib, function): - print("static void fexfn_unpack_" + lib["name"] + "_" + function["name"] + "(void *argsv){") + Name = function["name"] + print("static void fexfn_unpack_" + lib["name"] + "_" + function["name"] + "(void *argsv){") if GenerateThunk_has_struct(function["return"], function["args"]): print("struct arg_t "+ GenerateThunk_struct(function["return"], function["args"]) + ";") print("auto args = (arg_t*)argsv;") @@ -231,6 +246,9 @@ def GenerateFunctionLdrPtr(lib, function): print("typedef " + function["return"] + " fexldr_type_" + lib["name"] + "_" + function["name"] + GenerateThunk_args(function["args"]) + ";") print("static fexldr_type_" + lib["name"] + "_" + function["name"] + " *fexldr_ptr_" + lib["name"] + "_" + function["name"] + ";") +def GenerateFunctionLdrPtrPair(lib, function): + print("PAIR({0}, &fexldr_ptr_{1}_{0}),".format(function["name"], lib["name"])) + ### ### ldr ### Used in Host @@ -245,6 +263,7 @@ def GenerateLdr_function_loader(lib, function, handle, dlsym_impl): def GenerateLdr_lib(lib): handle = "fexldr_ptr_" + lib["name"] + "_so" print("static void* " + handle + ";") + print("#define LDR_HANDLE {0}".format(handle)) print("extern \"C\" bool fexldr_init_" + lib["name"] + "() {") print(handle + " = dlopen(\""+ lib["filename"] +".so\", RTLD_LOCAL | RTLD_LAZY);"); @@ -306,6 +325,8 @@ def Generate(): print("// Generated: thunks") print('extern "C" {') IterateLibs(Libs, "functions", "thunk", GenerateFunctionThunk) + for lib in Libs.values(): + print('#define THUNKFUNC(name) fexthunks_{0}_##name'.format(lib["filename"])) print('}') if WhatToGenerate == "all" or WhatToGenerate == "function_packs": @@ -314,6 +335,10 @@ def Generate(): IterateLibs(Libs, "functions", "pack", GenerateFunctionPack) print('}') + if WhatToGenerate == "all" or WhatToGenerate == "function_pack_pair": + print("// Generated: function_pack_pair") + IterateLibs(Libs, "functions", "pack_pair", GenerateFunctionPackPair) + if WhatToGenerate == "all" or WhatToGenerate == "function_packs_public": print("// Generated: function_packs_public") print('extern "C" {') @@ -324,6 +349,8 @@ def Generate(): print("// Generated: function_unpacks") print('extern "C" {') IterateLibs(Libs, "functions", "unpack", GenerateFunctionUnpack) + for lib in Libs.values(): + print('#define UNPACKFUNC(name) fexfn_unpack_{0}_##name'.format(lib["filename"])) print('}') if WhatToGenerate == "all" or WhatToGenerate == "ldr": @@ -333,6 +360,14 @@ def Generate(): if WhatToGenerate == "all" or WhatToGenerate == "ldr_ptrs": print("// Generated: ldr_ptrs") IterateLibs(Libs, "functions", "ldr_ptr", GenerateFunctionLdrPtr) + for lib in Libs.values(): + print('#define LDR_PTR(name) fexldr_ptr_{0}_##name'.format(lib["filename"])) + + if WhatToGenerate == "all" or WhatToGenerate == "ldr_ptrs_pair": + print("// Generated: ldr_ptrs_pair") + IterateLibs(Libs, "functions", "ldr_ptr_pair", GenerateFunctionLdrPtrPair) + for lib in Libs.values(): + print('#define LDR_PTR(name) fexldr_ptr_{0}_##name'.format(lib["filename"])) if WhatToGenerate == "all" or WhatToGenerate == "tab_function_unpacks": print("// Generated: tab_function_unpacks") @@ -361,5 +396,3 @@ def Generate(): if WhatToGenerate == "all" or WhatToGenerate == "callback_typedefs": print("// Generated: callback_unpacks") IterateLibs(Libs, "callbacks", False, GenerateCallbackTypedefs) - - From 29debcda3dc220079ffbd979e856a5008c06dfc0 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:10:14 -0700 Subject: [PATCH 05/20] Thunks: Adds FEX malloc libraries These are required to expose FEX's allocators to the guest. Which is required when we are compiled with jemalloc, otherwise the libraries will crash on allocations. This needs to be done in stages otherwise glibc will load the library and as it is setting up symbols, replace malloc, which isn't set currently and cause a crash --- ThunkLibs/Generators/libfex_malloc.py | 23 +++ ThunkLibs/libfex_malloc/Guest.cpp | 54 ++++++ ThunkLibs/libfex_malloc/Host.cpp | 211 +++++++++++++++++++++++ ThunkLibs/libfex_malloc/Types.h | 27 +++ ThunkLibs/libfex_malloc_loader/Guest.cpp | 17 ++ ThunkLibs/libfex_malloc_symbols/Host.cpp | 29 ++++ 6 files changed, 361 insertions(+) create mode 100644 ThunkLibs/Generators/libfex_malloc.py create mode 100644 ThunkLibs/libfex_malloc/Guest.cpp create mode 100644 ThunkLibs/libfex_malloc/Host.cpp create mode 100644 ThunkLibs/libfex_malloc/Types.h create mode 100644 ThunkLibs/libfex_malloc_loader/Guest.cpp create mode 100644 ThunkLibs/libfex_malloc_symbols/Host.cpp diff --git a/ThunkLibs/Generators/libfex_malloc.py b/ThunkLibs/Generators/libfex_malloc.py new file mode 100644 index 000000000..f79d8bd72 --- /dev/null +++ b/ThunkLibs/Generators/libfex_malloc.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib("libfex_malloc") + +# FEX +fn("void fex_get_allocation_ptrs(AllocationPtrs *)") +no_ldr() + +# Memory allocators + +fn("void free(void*)"); no_unpack() +fn("void *calloc(size_t, size_t)"); no_unpack() +fn("void *memalign(size_t, size_t)"); no_unpack() +fn("void *realloc(void*, size_t)"); no_unpack() +fn("void *valloc(size_t)"); no_unpack() +fn("int posix_memalign(void**, size_t, size_t)"); no_unpack() +fn("void *aligned_alloc(size_t, size_t)"); no_unpack() +fn("size_t malloc_usable_size(void *)"); no_unpack() + +fn("void *malloc(size_t)"); no_unpack() + +Generate() diff --git a/ThunkLibs/libfex_malloc/Guest.cpp b/ThunkLibs/libfex_malloc/Guest.cpp new file mode 100644 index 000000000..3a4fed48a --- /dev/null +++ b/ThunkLibs/libfex_malloc/Guest.cpp @@ -0,0 +1,54 @@ +/* +$info$ +tags: thunklibs|fex_malloc +desc: Handles allocations between guest and host thunks +$end_info$ +*/ + +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "Types.h" + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +#include + +extern "C" { + void fex_malloc_NoOptimize() { + // Does nothing, just ensures our libraries pull it in + } + +# define ALIAS(fn) __attribute__((alias (#fn), used)) +# define PREALIAS(fn) ALIAS(fn) + + +void *__libc_calloc(size_t n, size_t size) PREALIAS(fexfn_pack_calloc); + +void __libc_free(void* ptr) PREALIAS(fexfn_pack_free); + +void *__libc_malloc(size_t size) PREALIAS(fexfn_pack_malloc); + +void *__libc_memalign(size_t align, size_t s) PREALIAS(fexfn_pack_memalign); + +void *__libc_realloc(void* ptr, size_t size) PREALIAS(fexfn_pack_realloc); + +void *__libc_valloc(size_t size) PREALIAS(fexfn_pack_valloc); + +int __posix_memalign(void** r, size_t a, size_t s) PREALIAS(fexfn_pack_posix_memalign); + +// If we replace libc malloc and an application calls the malloc_usable_size then we can get a crash +// Symbol doesn't alias exactly so just wrap it + +size_t __malloc_usable_size(void *ptr) { + return fexfn_pack_malloc_usable_size(ptr); +} +} + +LOAD_LIB(libfex_malloc) diff --git a/ThunkLibs/libfex_malloc/Host.cpp b/ThunkLibs/libfex_malloc/Host.cpp new file mode 100644 index 000000000..aa5554904 --- /dev/null +++ b/ThunkLibs/libfex_malloc/Host.cpp @@ -0,0 +1,211 @@ +/* +$info$ +tags: thunklibs|fex_malloc +desc: Handles allocations between guest and host thunks +$end_info$ +*/ + +#include +#include +#include +#include + +#include "common/Host.h" +#include + +#include "Types.h" + +#include "ldr_ptrs.inl" + +#include "function_unpacks.inl" + +void fexfn_impl_libfex_malloc_fex_get_allocation_ptrs(AllocationPtrs *Ptrs); + +extern "C" { + // FEX allocation routines + extern MallocPtr FEX_Malloc_Ptr; + extern FreePtr FEX_Free_Ptr; + extern CallocPtr FEX_Calloc_Ptr; + extern MemalignPtr FEX_Memalign_Ptr; + extern ReallocPtr FEX_Realloc_Ptr; + extern VallocPtr FEX_Valloc_Ptr; + extern PosixMemalignPtr FEX_PosixMemalign_Ptr; + extern AlignedAllocPtr FEX_AlignedAlloc_Ptr; + extern MallocUsablePtr FEX_MallocUsable_Ptr; +} + +extern "C" { + AllocationPtrs AllocationPointers { + .Malloc = FEX_Malloc_Ptr, + .Free = FEX_Free_Ptr, + .Calloc = FEX_Calloc_Ptr, + .Memalign = FEX_Memalign_Ptr, + .Realloc = FEX_Realloc_Ptr, + .Valloc = FEX_Valloc_Ptr, + .PosixMemalign = FEX_PosixMemalign_Ptr, + .AlignedAlloc = FEX_AlignedAlloc_Ptr, + .MallocUsable = FEX_MallocUsable_Ptr, + }; + + // Our allocators +# define ALIAS(fn) __attribute__((alias (#fn), used)) +# define PREALIAS(fn) ALIAS(fn) + + void *fex_malloc(size_t Size) { + return AllocationPointers.Malloc(Size); + } + void *__libc_malloc (size_t Size) __attribute__((alias ("fex_malloc"), used)); + void *malloc (size_t Size) __attribute__((alias ("fex_malloc"), used)); + + void fex_free(void *p) { + AllocationPointers.Free(p); + } + void __libc_free(void* ptr) PREALIAS(fex_free); + void __GI___libc_free(void* ptr) PREALIAS(fex_free); + void free(void* ptr) PREALIAS(fex_free); + + void *fex_calloc(size_t n, size_t size) { + return AllocationPointers.Calloc(n, size); + } + void *__libc_calloc(size_t n, size_t size) PREALIAS(fex_calloc); + void *calloc(size_t n, size_t size) PREALIAS(fex_calloc); + + void *fex_memalign(size_t align, size_t s) { + return AllocationPointers.Memalign(align, s); + } + void *__libc_memalign(size_t align, size_t s) PREALIAS(fex_memalign); + void *memalign(size_t align, size_t s) PREALIAS(fex_memalign); + + void *fex_realloc(void* ptr, size_t size) { + return AllocationPointers.Realloc(ptr, size); + } + void *__libc_realloc(void* ptr, size_t size) PREALIAS(fex_realloc); + void *realloc(void* ptr, size_t size) PREALIAS(fex_realloc); + + void *fex_valloc(size_t size) { + return AllocationPointers.Valloc(size); + } + void *__libc_valloc(size_t size) PREALIAS(fex_valloc); + void *valloc(size_t size) PREALIAS(fex_valloc); + + int fex_posix_memalign(void** r, size_t a, size_t s) { + return AllocationPointers.PosixMemalign(r, a, s); + } + int __posix_memalign(void** r, size_t a, size_t s) PREALIAS(fex_posix_memalign); + int posix_memalign(void** r, size_t a, size_t s) PREALIAS(fex_posix_memalign); + + void *fex_aligned_alloc(size_t a, size_t s) { + return AllocationPointers.AlignedAlloc(a, s); + } + void *aligned_alloc(size_t a, size_t s) PREALIAS(fex_aligned_alloc); + + size_t fex_malloc_usable_size(void *ptr) { + return AllocationPointers.MallocUsable(ptr); + } + + size_t __malloc_usable_size(void *ptr) { + return fex_malloc_usable_size(ptr); + } + size_t malloc_usable_size(void *ptr) { + return fex_malloc_usable_size(ptr); + } + + static void fexfn_unpack_libfex_malloc_malloc(void *argsv) { + struct arg_t {size_t a_0;void * rv;}; + auto args = (arg_t*)argsv; + args->rv = AllocationPointers.Malloc(args->a_0); + } + + static void fexfn_unpack_libfex_malloc_free(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + AllocationPointers.Free(args->a_0); + } + + static void fexfn_unpack_libfex_malloc_calloc(void *argsv){ + struct arg_t {size_t a_0;size_t a_1;void * rv;}; + auto args = (arg_t*)argsv; + args->rv = + AllocationPointers.Calloc + (args->a_0,args->a_1); + } + static void fexfn_unpack_libfex_malloc_memalign(void *argsv){ + struct arg_t {size_t a_0;size_t a_1;void * rv;}; + auto args = (arg_t*)argsv; + args->rv = + AllocationPointers.Memalign + (args->a_0,args->a_1); + } + static void fexfn_unpack_libfex_malloc_realloc(void *argsv){ + struct arg_t {void* a_0;size_t a_1;void * rv;}; + auto args = (arg_t*)argsv; + args->rv = + AllocationPointers.Realloc + (args->a_0,args->a_1); + } + static void fexfn_unpack_libfex_malloc_valloc(void *argsv){ + struct arg_t {size_t a_0;void * rv;}; + auto args = (arg_t*)argsv; + + args->rv = + AllocationPointers.Valloc + (args->a_0); + } + static void fexfn_unpack_libfex_malloc_posix_memalign(void *argsv){ + struct arg_t {void** a_0;size_t a_1;size_t a_2;int rv;}; + auto args = (arg_t*)argsv; + + args->rv = + AllocationPointers.PosixMemalign + (args->a_0,args->a_1,args->a_2); + } + static void fexfn_unpack_libfex_malloc_aligned_alloc(void *argsv){ + struct arg_t {size_t a_0;size_t a_1;void * rv;}; + auto args = (arg_t*)argsv; + + args->rv = + AllocationPointers.AlignedAlloc + (args->a_0,args->a_1); + } + static void fexfn_unpack_libfex_malloc_malloc_usable_size(void *argsv){ + struct arg_t {void * a_0;size_t rv;}; + auto args = (arg_t*)argsv; + + args->rv = + AllocationPointers.MallocUsable + (args->a_0); + } + +void (*__free_hook)(void *ptr) = fex_free; +void *(*__malloc_hook)(size_t size) = fex_malloc; +void *(*__realloc_hook)(void *ptr, size_t size) = fex_realloc; +void *(*__memalign_hook)(size_t alignment, size_t size) = + fex_memalign; +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_impl_libfex_malloc_fex_get_allocation_ptrs(AllocationPtrs *Ptrs) { + *Ptrs = AllocationPointers; +} + +static void init_lib() { + // Set pointers + AllocationPointers.Malloc = FEX_Malloc_Ptr; + AllocationPointers.Free = FEX_Free_Ptr; + AllocationPointers.Calloc = FEX_Calloc_Ptr; + AllocationPointers.Memalign = FEX_Memalign_Ptr; + AllocationPointers.Realloc = FEX_Realloc_Ptr; + AllocationPointers.Valloc = FEX_Valloc_Ptr; + AllocationPointers.PosixMemalign = FEX_PosixMemalign_Ptr; + AllocationPointers.AlignedAlloc = FEX_AlignedAlloc_Ptr; + AllocationPointers.MallocUsable = FEX_MallocUsable_Ptr; +} + +EXPORTS(libfex_malloc) +LOAD_LIB_INIT(init_lib) diff --git a/ThunkLibs/libfex_malloc/Types.h b/ThunkLibs/libfex_malloc/Types.h new file mode 100644 index 000000000..b89c6a8f3 --- /dev/null +++ b/ThunkLibs/libfex_malloc/Types.h @@ -0,0 +1,27 @@ +#pragma once + +#include + +using MallocPtr = void *(*)(size_t); +using FreePtr = void (*)(void*); +using CallocPtr = void *(*)(size_t, size_t); +using MemalignPtr = void *(*)(size_t, size_t); +using ReallocPtr = void *(*)(void*, size_t); +using VallocPtr = void *(*)(size_t); +using PosixMemalignPtr = int (*)(void**, size_t, size_t); +using AlignedAllocPtr = void *(*)(size_t, size_t); +using MallocUsablePtr = size_t (*)(void *); + +struct AllocationPtrs { + MallocPtr Malloc; + FreePtr Free; + CallocPtr Calloc; + MemalignPtr Memalign; + ReallocPtr Realloc; + VallocPtr Valloc; + PosixMemalignPtr PosixMemalign; + AlignedAllocPtr AlignedAlloc; + MallocUsablePtr MallocUsable; +}; + + diff --git a/ThunkLibs/libfex_malloc_loader/Guest.cpp b/ThunkLibs/libfex_malloc_loader/Guest.cpp new file mode 100644 index 000000000..96a6afd69 --- /dev/null +++ b/ThunkLibs/libfex_malloc_loader/Guest.cpp @@ -0,0 +1,17 @@ +/* +$info$ +tags: thunklibs|fex_malloc_loader +desc: Delays malloc symbol replacement until it is safe to run constructors +$end_info$ +*/ + +#include +#include +extern "C" { + __attribute__((constructor)) + static void loadlib() + { + fprintf(stderr, "Time to load mallocs\n"); + dlopen("/mnt/Work/Work/work/FEXNew/Build/Guest/libfex_malloc-guest.so", RTLD_GLOBAL | RTLD_NOW | RTLD_NODELETE | RTLD_DEEPBIND); + } +} diff --git a/ThunkLibs/libfex_malloc_symbols/Host.cpp b/ThunkLibs/libfex_malloc_symbols/Host.cpp new file mode 100644 index 000000000..a9b25caf1 --- /dev/null +++ b/ThunkLibs/libfex_malloc_symbols/Host.cpp @@ -0,0 +1,29 @@ +/* +$info$ +tags: thunklibs|fex_malloc_symbols +desc: Allows FEX to export allocation symbols +$end_info$ +*/ + +#include +#include +#include +#include + +#include "common/Host.h" +#include + +#include "../libfex_malloc/Types.h" + +extern "C" { + // FEX allocation routines + MallocPtr FEX_Malloc_Ptr = (MallocPtr)0x4142434445464748ULL; + FreePtr FEX_Free_Ptr = (FreePtr)0x4142434445464748ULL; + CallocPtr FEX_Calloc_Ptr = (CallocPtr)0x4142434445464748ULL; + MemalignPtr FEX_Memalign_Ptr = (MemalignPtr)0x4142434445464748ULL; + ReallocPtr FEX_Realloc_Ptr = (ReallocPtr)0x4142434445464748ULL; + VallocPtr FEX_Valloc_Ptr = (VallocPtr)0x4142434445464748ULL; + PosixMemalignPtr FEX_PosixMemalign_Ptr = (PosixMemalignPtr)0x4142434445464748ULL; + AlignedAllocPtr FEX_AlignedAlloc_Ptr = (AlignedAllocPtr)0x4142434445464748ULL; + MallocUsablePtr FEX_MallocUsable_Ptr = (MallocUsablePtr)0x4142434445464748ULL; +} From 798c6772b7f0576c4582d3ff27cf45079a4f02b2 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:12:22 -0700 Subject: [PATCH 06/20] Thunks: Adds libxcb --- ThunkLibs/Generators/libxcb.py | 809 +++++++++++ ThunkLibs/include/common/CrossArchEvent.h | 117 ++ ThunkLibs/libxcb/libxcb_Guest.cpp | 1606 +++++++++++++++++++++ ThunkLibs/libxcb/libxcb_Host.cpp | 139 ++ 4 files changed, 2671 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb.py create mode 100644 ThunkLibs/include/common/CrossArchEvent.h create mode 100644 ThunkLibs/libxcb/libxcb_Guest.cpp create mode 100644 ThunkLibs/libxcb/libxcb_Host.cpp diff --git a/ThunkLibs/Generators/libxcb.py b/ThunkLibs/Generators/libxcb.py new file mode 100644 index 000000000..aef267fa9 --- /dev/null +++ b/ThunkLibs/Generators/libxcb.py @@ -0,0 +1,809 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib("libxcb") + +# There is a paradigm inside of XCB of functions that return a pointer, a length, and an end +# The application is seemingly reading directly from some internal data structures +# This means the application doesn't have ownership of the pointers and shouldn't free them +# These are marked with ::Iterator:: + +# FEX +fn("void FEX_xcb_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() +fn("void FEX_GiveEvents(CrossArchEvent *, CrossArchEvent *, CBWork*)"); no_unpack() + +# xcb.h +fn("int xcb_flush(xcb_connection_t *)") +fn("uint32_t xcb_get_maximum_request_length(xcb_connection_t *)") +fn("void xcb_prefetch_maximum_request_length(xcb_connection_t *)") +fn("xcb_generic_event_t * xcb_wait_for_event(xcb_connection_t *)"); no_pack() +fn("xcb_generic_event_t * xcb_poll_for_event(xcb_connection_t *)"); no_pack() +fn("xcb_generic_event_t * xcb_poll_for_queued_event(xcb_connection_t *)"); no_pack() +fn("xcb_generic_event_t * xcb_poll_for_special_event(xcb_connection_t *, xcb_special_event_t *)"); no_pack() +fn("xcb_generic_event_t * xcb_wait_for_special_event(xcb_connection_t *, xcb_special_event_t *)"); no_pack() + +# Looks like unregister will free the memory of the result +fn("xcb_special_event_t * xcb_register_for_special_xge(xcb_connection_t *, xcb_extension_t *, uint32_t, uint32_t *)") +fn("void xcb_unregister_for_special_event(xcb_connection_t *, xcb_special_event_t *)") + +fn("xcb_generic_error_t * xcb_request_check(xcb_connection_t *, xcb_void_cookie_t)"); no_pack() +fn("void xcb_discard_reply(xcb_connection_t *, unsigned int)") +fn("void xcb_discard_reply64(xcb_connection_t *, uint64_t)") +fn("const struct xcb_query_extension_reply_t * xcb_get_extension_data(xcb_connection_t *, xcb_extension_t *)") +fn("void xcb_prefetch_extension_data(xcb_connection_t *, xcb_extension_t *)") + +# Documentation says that return must NOT be freed +fn("const struct xcb_setup_t * xcb_get_setup(xcb_connection_t *)") +fn("int xcb_get_file_descriptor(xcb_connection_t *)") +fn("int xcb_connection_has_error(xcb_connection_t *)") +# xcb_disconnect frees result +fn("xcb_connection_t * xcb_connect_to_fd(int, xcb_auth_info_t *)") + +fn("void xcb_disconnect(xcb_connection_t *)"); no_pack() + +# Second argument is owned by application on return +fn("int xcb_parse_display(const char *, char **, int *, int *)"); no_pack() + +# xcb_disconnect frees result +fn("xcb_connection_t * xcb_connect(const char *, int *)"); no_pack() +fn("xcb_connection_t * xcb_connect_to_display_with_auth_info(const char *, xcb_auth_info_t *, int *)"); no_pack() +fn("uint32_t xcb_generate_id(xcb_connection_t *)") +fn("uint64_t xcb_total_read(xcb_connection_t *)") +fn("uint64_t xcb_total_written(xcb_connection_t *)") + +# xcbext.h +fn("unsigned int xcb_send_request(xcb_connection_t *, int, struct iovec *, const xcb_protocol_request_t *)") +fn("unsigned int xcb_send_request_with_fds(xcb_connection_t *, int, struct iovec *, const xcb_protocol_request_t *, unsigned int, int *)") +fn("uint64_t xcb_send_request64(xcb_connection_t *, int, struct iovec *, const xcb_protocol_request_t *)") +fn("uint64_t xcb_send_request_with_fds64(xcb_connection_t *, int, struct iovec *, const xcb_protocol_request_t *, unsigned int, int *)") +fn("void xcb_send_fd(xcb_connection_t *, int)") +fn("int xcb_take_socket(xcb_connection_t *, CBType, void *, int, uint64_t *)"); no_thunk(); no_pack(); no_unpack(); no_tab_unpack() +#fn("int XIfEvent(Display*, XEvent*, XIfEventCBFN*, XPointer)"); no_thunk(); no_pack(); no_unpack(); no_tab_unpack() +#fn("int XIfEvent_internal(Display*, XEvent*, XIfEventCBFN*, XPointer)"); no_ldr(); +#cb("int XIfEventCB(Display*, XEvent*, XPointer)") + +fn("int xcb_take_socket_internal(xcb_connection_t *, CBType, void *, int, uint64_t *)"); no_ldr() +cb("void xcb_take_socket_cb(void*)"); no_cb_unpack() + +fn("int xcb_writev(xcb_connection_t *, struct iovec *, int, uint64_t)") +fn("void * xcb_wait_for_reply(xcb_connection_t *, unsigned int, xcb_generic_error_t **)"); no_pack() +fn("void * xcb_wait_for_reply64(xcb_connection_t *, uint64_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_poll_for_reply(xcb_connection_t *, unsigned int, void **, xcb_generic_error_t **)"); no_pack() +fn("int xcb_poll_for_reply64(xcb_connection_t *, uint64_t, void **, xcb_generic_error_t **)"); no_pack() + +# XXX: Who owns the return? +fn("int * xcb_get_reply_fds(xcb_connection_t *, void *, size_t)") +fn("int xcb_popcount(uint32_t)") +fn("int xcb_sumof(uint8_t *, int)") + +# xproto.h +fn("void xcb_char2b_next(xcb_char2b_iterator_t *)") +fn("xcb_generic_iterator_t xcb_char2b_end(xcb_char2b_iterator_t)") +fn("void xcb_window_next(xcb_window_iterator_t *)") +fn("xcb_generic_iterator_t xcb_window_end(xcb_window_iterator_t)") +fn("void xcb_pixmap_next(xcb_pixmap_iterator_t *)") +fn("xcb_generic_iterator_t xcb_pixmap_end(xcb_pixmap_iterator_t)") +fn("void xcb_cursor_next(xcb_cursor_iterator_t *)") +fn("xcb_generic_iterator_t xcb_cursor_end(xcb_cursor_iterator_t)") +fn("void xcb_font_next(xcb_font_iterator_t *)") +fn("xcb_generic_iterator_t xcb_font_end(xcb_font_iterator_t)") +fn("void xcb_gcontext_next(xcb_gcontext_iterator_t *)") +fn("xcb_generic_iterator_t xcb_gcontext_end(xcb_gcontext_iterator_t)") +fn("void xcb_colormap_next(xcb_colormap_iterator_t *)") +fn("xcb_generic_iterator_t xcb_colormap_end(xcb_colormap_iterator_t)") +fn("void xcb_atom_next(xcb_atom_iterator_t *)") +fn("xcb_generic_iterator_t xcb_atom_end(xcb_atom_iterator_t)") +fn("void xcb_drawable_next(xcb_drawable_iterator_t *)") +fn("xcb_generic_iterator_t xcb_drawable_end(xcb_drawable_iterator_t)") +fn("void xcb_fontable_next(xcb_fontable_iterator_t *)") +fn("xcb_generic_iterator_t xcb_fontable_end(xcb_fontable_iterator_t)") +fn("void xcb_bool32_next(xcb_bool32_iterator_t *)") +fn("xcb_generic_iterator_t xcb_bool32_end(xcb_bool32_iterator_t)") +fn("void xcb_visualid_next(xcb_visualid_iterator_t *)") +fn("xcb_generic_iterator_t xcb_visualid_end(xcb_visualid_iterator_t)") +fn("void xcb_timestamp_next(xcb_timestamp_iterator_t *)") +fn("xcb_generic_iterator_t xcb_timestamp_end(xcb_timestamp_iterator_t)") +fn("void xcb_keysym_next(xcb_keysym_iterator_t *)") +fn("xcb_generic_iterator_t xcb_keysym_end(xcb_keysym_iterator_t)") +fn("void xcb_keycode_next(xcb_keycode_iterator_t *)") +fn("xcb_generic_iterator_t xcb_keycode_end(xcb_keycode_iterator_t)") +fn("void xcb_keycode32_next(xcb_keycode32_iterator_t *)") +fn("xcb_generic_iterator_t xcb_keycode32_end(xcb_keycode32_iterator_t)") +fn("void xcb_button_next(xcb_button_iterator_t *)") +fn("xcb_generic_iterator_t xcb_button_end(xcb_button_iterator_t)") +fn("void xcb_point_next(xcb_point_iterator_t *)") +fn("xcb_generic_iterator_t xcb_point_end(xcb_point_iterator_t)") +fn("void xcb_rectangle_next(xcb_rectangle_iterator_t *)") +fn("xcb_generic_iterator_t xcb_rectangle_end(xcb_rectangle_iterator_t)") +fn("void xcb_arc_next(xcb_arc_iterator_t *)") +fn("xcb_generic_iterator_t xcb_arc_end(xcb_arc_iterator_t)") +fn("void xcb_format_next(xcb_format_iterator_t *)") +fn("xcb_generic_iterator_t xcb_format_end(xcb_format_iterator_t)") +fn("void xcb_visualtype_next(xcb_visualtype_iterator_t *)") +fn("xcb_generic_iterator_t xcb_visualtype_end(xcb_visualtype_iterator_t)") +fn("int xcb_depth_sizeof(const void *)") +# ::Iterator:: +fn("xcb_visualtype_t * xcb_depth_visuals(const xcb_depth_t *)") +fn("int xcb_depth_visuals_length(const xcb_depth_t *)") +fn("xcb_visualtype_iterator_t xcb_depth_visuals_iterator(const xcb_depth_t *)") + +fn("void xcb_depth_next(xcb_depth_iterator_t *)") +fn("xcb_generic_iterator_t xcb_depth_end(xcb_depth_iterator_t)") +fn("int xcb_screen_sizeof(const void *)") +fn("int xcb_screen_allowed_depths_length(const xcb_screen_t *)") +fn("xcb_depth_iterator_t xcb_screen_allowed_depths_iterator(const xcb_screen_t *)") +fn("void xcb_screen_next(xcb_screen_iterator_t *)") +fn("xcb_generic_iterator_t xcb_screen_end(xcb_screen_iterator_t)") +fn("int xcb_setup_request_sizeof(const void *)") + +# ::Iterator:: +fn("char * xcb_setup_request_authorization_protocol_name(const xcb_setup_request_t *)") +fn("int xcb_setup_request_authorization_protocol_name_length(const xcb_setup_request_t *)") +fn("xcb_generic_iterator_t xcb_setup_request_authorization_protocol_name_end(const xcb_setup_request_t *)") + +# ::Iterator:: +fn("char * xcb_setup_request_authorization_protocol_data(const xcb_setup_request_t *)") +fn("int xcb_setup_request_authorization_protocol_data_length(const xcb_setup_request_t *)") +fn("xcb_generic_iterator_t xcb_setup_request_authorization_protocol_data_end(const xcb_setup_request_t *)") + +fn("void xcb_setup_request_next(xcb_setup_request_iterator_t *)") +fn("xcb_generic_iterator_t xcb_setup_request_end(xcb_setup_request_iterator_t)") +fn("int xcb_setup_failed_sizeof(const void *)") +# XXX: Who owns result? +fn("char * xcb_setup_failed_reason(const xcb_setup_failed_t *)") + +fn("int xcb_setup_failed_reason_length(const xcb_setup_failed_t *)") +fn("xcb_generic_iterator_t xcb_setup_failed_reason_end(const xcb_setup_failed_t *)") +fn("void xcb_setup_failed_next(xcb_setup_failed_iterator_t *)") +fn("xcb_generic_iterator_t xcb_setup_failed_end(xcb_setup_failed_iterator_t)") +fn("int xcb_setup_authenticate_sizeof(const void *)") +# ::Iterator:: +fn("char * xcb_setup_authenticate_reason(const xcb_setup_authenticate_t *)") +fn("int xcb_setup_authenticate_reason_length(const xcb_setup_authenticate_t *)") +fn("xcb_generic_iterator_t xcb_setup_authenticate_reason_end(const xcb_setup_authenticate_t *)") + +fn("void xcb_setup_authenticate_next(xcb_setup_authenticate_iterator_t *)") +fn("xcb_generic_iterator_t xcb_setup_authenticate_end(xcb_setup_authenticate_iterator_t)") +fn("int xcb_setup_sizeof(const void *)") +# ::Iterator:: +fn("char * xcb_setup_vendor(const xcb_setup_t *)") +fn("int xcb_setup_vendor_length(const xcb_setup_t *)") +fn("xcb_generic_iterator_t xcb_setup_vendor_end(const xcb_setup_t *)") + +# ::Iterator:: +fn("xcb_format_t * xcb_setup_pixmap_formats(const xcb_setup_t *)") +fn("int xcb_setup_pixmap_formats_length(const xcb_setup_t *)") +fn("xcb_format_iterator_t xcb_setup_pixmap_formats_iterator(const xcb_setup_t *)") + +fn("int xcb_setup_roots_length(const xcb_setup_t *)") +fn("xcb_screen_iterator_t xcb_setup_roots_iterator(const xcb_setup_t *)") +fn("void xcb_setup_next(xcb_setup_iterator_t *)") +fn("xcb_generic_iterator_t xcb_setup_end(xcb_setup_iterator_t)") +fn("void xcb_client_message_data_next(xcb_client_message_data_iterator_t *)") +fn("xcb_generic_iterator_t xcb_client_message_data_end(xcb_client_message_data_iterator_t)") +fn("int xcb_create_window_value_list_serialize(void **, uint32_t, const xcb_create_window_value_list_t *)") +fn("int xcb_create_window_value_list_unpack(const void *, uint32_t, xcb_create_window_value_list_t *)") +fn("int xcb_create_window_value_list_sizeof(const void *, uint32_t)") +fn("int xcb_create_window_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_create_window_checked(xcb_connection_t *, uint8_t, xcb_window_t, xcb_window_t, int16_t, int16_t, uint16_t, uint16_t, uint16_t, uint16_t, xcb_visualid_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_create_window(xcb_connection_t *, uint8_t, xcb_window_t, xcb_window_t, int16_t, int16_t, uint16_t, uint16_t, uint16_t, uint16_t, xcb_visualid_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_create_window_aux_checked(xcb_connection_t *, uint8_t, xcb_window_t, xcb_window_t, int16_t, int16_t, uint16_t, uint16_t, uint16_t, uint16_t, xcb_visualid_t, uint32_t, const xcb_create_window_value_list_t *)") +fn("xcb_void_cookie_t xcb_create_window_aux(xcb_connection_t *, uint8_t, xcb_window_t, xcb_window_t, int16_t, int16_t, uint16_t, uint16_t, uint16_t, uint16_t, xcb_visualid_t, uint32_t, const xcb_create_window_value_list_t *)") +# XXX: Who owns result? +fn("void * xcb_create_window_value_list(const xcb_create_window_request_t *)") +fn("int xcb_change_window_attributes_value_list_serialize(void **, uint32_t, const xcb_change_window_attributes_value_list_t *)") +fn("int xcb_change_window_attributes_value_list_unpack(const void *, uint32_t, xcb_change_window_attributes_value_list_t *)") +fn("int xcb_change_window_attributes_value_list_sizeof(const void *, uint32_t)") +fn("int xcb_change_window_attributes_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_change_window_attributes_checked(xcb_connection_t *, xcb_window_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_change_window_attributes(xcb_connection_t *, xcb_window_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_change_window_attributes_aux_checked(xcb_connection_t *, xcb_window_t, uint32_t, const xcb_change_window_attributes_value_list_t *)") +fn("xcb_void_cookie_t xcb_change_window_attributes_aux(xcb_connection_t *, xcb_window_t, uint32_t, const xcb_change_window_attributes_value_list_t *)") +# XXX: Who owns result? +fn("void * xcb_change_window_attributes_value_list(const xcb_change_window_attributes_request_t *)") +fn("xcb_get_window_attributes_cookie_t xcb_get_window_attributes(xcb_connection_t *, xcb_window_t)") +fn("xcb_get_window_attributes_cookie_t xcb_get_window_attributes_unchecked(xcb_connection_t *, xcb_window_t)") +fn("xcb_get_window_attributes_reply_t * xcb_get_window_attributes_reply(xcb_connection_t *, xcb_get_window_attributes_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_destroy_window_checked(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_destroy_window(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_destroy_subwindows_checked(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_destroy_subwindows(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_change_save_set_checked(xcb_connection_t *, uint8_t, xcb_window_t)") +fn("xcb_void_cookie_t xcb_change_save_set(xcb_connection_t *, uint8_t, xcb_window_t)") +fn("xcb_void_cookie_t xcb_reparent_window_checked(xcb_connection_t *, xcb_window_t, xcb_window_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_reparent_window(xcb_connection_t *, xcb_window_t, xcb_window_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_map_window_checked(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_map_window(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_map_subwindows_checked(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_map_subwindows(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_unmap_window_checked(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_unmap_window(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_unmap_subwindows_checked(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_unmap_subwindows(xcb_connection_t *, xcb_window_t)") +fn("int xcb_configure_window_value_list_serialize(void **, uint16_t, const xcb_configure_window_value_list_t *)") +fn("int xcb_configure_window_value_list_unpack(const void *, uint16_t, xcb_configure_window_value_list_t *)") +fn("int xcb_configure_window_value_list_sizeof(const void *, uint16_t)") +fn("int xcb_configure_window_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_configure_window_checked(xcb_connection_t *, xcb_window_t, uint16_t, const void *)") +fn("xcb_void_cookie_t xcb_configure_window(xcb_connection_t *, xcb_window_t, uint16_t, const void *)") +fn("xcb_void_cookie_t xcb_configure_window_aux_checked(xcb_connection_t *, xcb_window_t, uint16_t, const xcb_configure_window_value_list_t *)") +fn("xcb_void_cookie_t xcb_configure_window_aux(xcb_connection_t *, xcb_window_t, uint16_t, const xcb_configure_window_value_list_t *)") +# XXX: Who owns result? +fn("void * xcb_configure_window_value_list(const xcb_configure_window_request_t *)") +fn("xcb_void_cookie_t xcb_circulate_window_checked(xcb_connection_t *, uint8_t, xcb_window_t)") +fn("xcb_void_cookie_t xcb_circulate_window(xcb_connection_t *, uint8_t, xcb_window_t)") +fn("xcb_get_geometry_cookie_t xcb_get_geometry(xcb_connection_t *, xcb_drawable_t)") +fn("xcb_get_geometry_cookie_t xcb_get_geometry_unchecked(xcb_connection_t *, xcb_drawable_t)") +fn("xcb_get_geometry_reply_t * xcb_get_geometry_reply(xcb_connection_t *, xcb_get_geometry_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_query_tree_sizeof(const void *)") +fn("xcb_query_tree_cookie_t xcb_query_tree(xcb_connection_t *, xcb_window_t)") +fn("xcb_query_tree_cookie_t xcb_query_tree_unchecked(xcb_connection_t *, xcb_window_t)") +# ::Iterator:: +fn("xcb_window_t * xcb_query_tree_children(const xcb_query_tree_reply_t *)") +fn("int xcb_query_tree_children_length(const xcb_query_tree_reply_t *)") +fn("xcb_generic_iterator_t xcb_query_tree_children_end(const xcb_query_tree_reply_t *)") + +fn("xcb_query_tree_reply_t * xcb_query_tree_reply(xcb_connection_t *, xcb_query_tree_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_intern_atom_sizeof(const void *)") +fn("xcb_intern_atom_cookie_t xcb_intern_atom(xcb_connection_t *, uint8_t, uint16_t, const char *)") +fn("xcb_intern_atom_cookie_t xcb_intern_atom_unchecked(xcb_connection_t *, uint8_t, uint16_t, const char *)") +fn("xcb_intern_atom_reply_t * xcb_intern_atom_reply(xcb_connection_t *, xcb_intern_atom_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_get_atom_name_sizeof(const void *)") +fn("xcb_get_atom_name_cookie_t xcb_get_atom_name(xcb_connection_t *, xcb_atom_t)") +fn("xcb_get_atom_name_cookie_t xcb_get_atom_name_unchecked(xcb_connection_t *, xcb_atom_t)") +# ::Iterator:: +fn("char * xcb_get_atom_name_name(const xcb_get_atom_name_reply_t *)") +fn("int xcb_get_atom_name_name_length(const xcb_get_atom_name_reply_t *)") +fn("xcb_generic_iterator_t xcb_get_atom_name_name_end(const xcb_get_atom_name_reply_t *)") + +fn("xcb_get_atom_name_reply_t * xcb_get_atom_name_reply(xcb_connection_t *, xcb_get_atom_name_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_change_property_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_change_property_checked(xcb_connection_t *, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint8_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_change_property(xcb_connection_t *, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint8_t, uint32_t, const void *)") +# ::Iterator:: +fn("void * xcb_change_property_data(const xcb_change_property_request_t *)") +fn("int xcb_change_property_data_length(const xcb_change_property_request_t *)") +fn("xcb_generic_iterator_t xcb_change_property_data_end(const xcb_change_property_request_t *)") + +fn("xcb_void_cookie_t xcb_delete_property_checked(xcb_connection_t *, xcb_window_t, xcb_atom_t)") +fn("xcb_void_cookie_t xcb_delete_property(xcb_connection_t *, xcb_window_t, xcb_atom_t)") +fn("int xcb_get_property_sizeof(const void *)") +fn("xcb_get_property_cookie_t xcb_get_property(xcb_connection_t *, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t)") +fn("xcb_get_property_cookie_t xcb_get_property_unchecked(xcb_connection_t *, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("void * xcb_get_property_value(const xcb_get_property_reply_t *)") +fn("int xcb_get_property_value_length(const xcb_get_property_reply_t *)") +fn("xcb_generic_iterator_t xcb_get_property_value_end(const xcb_get_property_reply_t *)") + +fn("xcb_get_property_reply_t * xcb_get_property_reply(xcb_connection_t *, xcb_get_property_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_list_properties_sizeof(const void *)") +fn("xcb_list_properties_cookie_t xcb_list_properties(xcb_connection_t *, xcb_window_t)") +fn("xcb_list_properties_cookie_t xcb_list_properties_unchecked(xcb_connection_t *, xcb_window_t)") +# ::Iterator:: +fn("xcb_atom_t * xcb_list_properties_atoms(const xcb_list_properties_reply_t *)") +fn("int xcb_list_properties_atoms_length(const xcb_list_properties_reply_t *)") +fn("xcb_generic_iterator_t xcb_list_properties_atoms_end(const xcb_list_properties_reply_t *)") + +fn("xcb_list_properties_reply_t * xcb_list_properties_reply(xcb_connection_t *, xcb_list_properties_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_set_selection_owner_checked(xcb_connection_t *, xcb_window_t, xcb_atom_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_set_selection_owner(xcb_connection_t *, xcb_window_t, xcb_atom_t, xcb_timestamp_t)") +fn("xcb_get_selection_owner_cookie_t xcb_get_selection_owner(xcb_connection_t *, xcb_atom_t)") +fn("xcb_get_selection_owner_cookie_t xcb_get_selection_owner_unchecked(xcb_connection_t *, xcb_atom_t)") +fn("xcb_get_selection_owner_reply_t * xcb_get_selection_owner_reply(xcb_connection_t *, xcb_get_selection_owner_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_convert_selection_checked(xcb_connection_t *, xcb_window_t, xcb_atom_t, xcb_atom_t, xcb_atom_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_convert_selection(xcb_connection_t *, xcb_window_t, xcb_atom_t, xcb_atom_t, xcb_atom_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_send_event_checked(xcb_connection_t *, uint8_t, xcb_window_t, uint32_t, const char *)") +fn("xcb_void_cookie_t xcb_send_event(xcb_connection_t *, uint8_t, xcb_window_t, uint32_t, const char *)") +fn("xcb_grab_pointer_cookie_t xcb_grab_pointer(xcb_connection_t *, uint8_t, xcb_window_t, uint16_t, uint8_t, uint8_t, xcb_window_t, xcb_cursor_t, xcb_timestamp_t)") +fn("xcb_grab_pointer_cookie_t xcb_grab_pointer_unchecked(xcb_connection_t *, uint8_t, xcb_window_t, uint16_t, uint8_t, uint8_t, xcb_window_t, xcb_cursor_t, xcb_timestamp_t)") +fn("xcb_grab_pointer_reply_t * xcb_grab_pointer_reply(xcb_connection_t *, xcb_grab_pointer_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_ungrab_pointer_checked(xcb_connection_t *, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_ungrab_pointer(xcb_connection_t *, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_grab_button_checked(xcb_connection_t *, uint8_t, xcb_window_t, uint16_t, uint8_t, uint8_t, xcb_window_t, xcb_cursor_t, uint8_t, uint16_t)") +fn("xcb_void_cookie_t xcb_grab_button(xcb_connection_t *, uint8_t, xcb_window_t, uint16_t, uint8_t, uint8_t, xcb_window_t, xcb_cursor_t, uint8_t, uint16_t)") +fn("xcb_void_cookie_t xcb_ungrab_button_checked(xcb_connection_t *, uint8_t, xcb_window_t, uint16_t)") +fn("xcb_void_cookie_t xcb_ungrab_button(xcb_connection_t *, uint8_t, xcb_window_t, uint16_t)") +fn("xcb_void_cookie_t xcb_change_active_pointer_grab_checked(xcb_connection_t *, xcb_cursor_t, xcb_timestamp_t, uint16_t)") +fn("xcb_void_cookie_t xcb_change_active_pointer_grab(xcb_connection_t *, xcb_cursor_t, xcb_timestamp_t, uint16_t)") +fn("xcb_grab_keyboard_cookie_t xcb_grab_keyboard(xcb_connection_t *, uint8_t, xcb_window_t, xcb_timestamp_t, uint8_t, uint8_t)") +fn("xcb_grab_keyboard_cookie_t xcb_grab_keyboard_unchecked(xcb_connection_t *, uint8_t, xcb_window_t, xcb_timestamp_t, uint8_t, uint8_t)") +fn("xcb_grab_keyboard_reply_t * xcb_grab_keyboard_reply(xcb_connection_t *, xcb_grab_keyboard_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_ungrab_keyboard_checked(xcb_connection_t *, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_ungrab_keyboard(xcb_connection_t *, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_grab_key_checked(xcb_connection_t *, uint8_t, xcb_window_t, uint16_t, xcb_keycode_t, uint8_t, uint8_t)") +fn("xcb_void_cookie_t xcb_grab_key(xcb_connection_t *, uint8_t, xcb_window_t, uint16_t, xcb_keycode_t, uint8_t, uint8_t)") +fn("xcb_void_cookie_t xcb_ungrab_key_checked(xcb_connection_t *, xcb_keycode_t, xcb_window_t, uint16_t)") +fn("xcb_void_cookie_t xcb_ungrab_key(xcb_connection_t *, xcb_keycode_t, xcb_window_t, uint16_t)") +fn("xcb_void_cookie_t xcb_allow_events_checked(xcb_connection_t *, uint8_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_allow_events(xcb_connection_t *, uint8_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_grab_server_checked(xcb_connection_t *)") +fn("xcb_void_cookie_t xcb_grab_server(xcb_connection_t *)") +fn("xcb_void_cookie_t xcb_ungrab_server_checked(xcb_connection_t *)") +fn("xcb_void_cookie_t xcb_ungrab_server(xcb_connection_t *)") +fn("xcb_query_pointer_cookie_t xcb_query_pointer(xcb_connection_t *, xcb_window_t)") +fn("xcb_query_pointer_cookie_t xcb_query_pointer_unchecked(xcb_connection_t *, xcb_window_t)") +fn("xcb_query_pointer_reply_t * xcb_query_pointer_reply(xcb_connection_t *, xcb_query_pointer_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("void xcb_timecoord_next(xcb_timecoord_iterator_t *)") +fn("xcb_generic_iterator_t xcb_timecoord_end(xcb_timecoord_iterator_t)") +fn("int xcb_get_motion_events_sizeof(const void *)") +fn("xcb_get_motion_events_cookie_t xcb_get_motion_events(xcb_connection_t *, xcb_window_t, xcb_timestamp_t, xcb_timestamp_t)") +fn("xcb_get_motion_events_cookie_t xcb_get_motion_events_unchecked(xcb_connection_t *, xcb_window_t, xcb_timestamp_t, xcb_timestamp_t)") +# ::Iterator:: +fn("xcb_timecoord_t * xcb_get_motion_events_events(const xcb_get_motion_events_reply_t *)") +fn("int xcb_get_motion_events_events_length(const xcb_get_motion_events_reply_t *)") +fn("xcb_timecoord_iterator_t xcb_get_motion_events_events_iterator(const xcb_get_motion_events_reply_t *)") + +fn("xcb_get_motion_events_reply_t * xcb_get_motion_events_reply(xcb_connection_t *, xcb_get_motion_events_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_translate_coordinates_cookie_t xcb_translate_coordinates(xcb_connection_t *, xcb_window_t, xcb_window_t, int16_t, int16_t)") +fn("xcb_translate_coordinates_cookie_t xcb_translate_coordinates_unchecked(xcb_connection_t *, xcb_window_t, xcb_window_t, int16_t, int16_t)") +fn("xcb_translate_coordinates_reply_t * xcb_translate_coordinates_reply(xcb_connection_t *, xcb_translate_coordinates_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_warp_pointer_checked(xcb_connection_t *, xcb_window_t, xcb_window_t, int16_t, int16_t, uint16_t, uint16_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_warp_pointer(xcb_connection_t *, xcb_window_t, xcb_window_t, int16_t, int16_t, uint16_t, uint16_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_set_input_focus_checked(xcb_connection_t *, uint8_t, xcb_window_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_set_input_focus(xcb_connection_t *, uint8_t, xcb_window_t, xcb_timestamp_t)") +fn("xcb_get_input_focus_cookie_t xcb_get_input_focus(xcb_connection_t *)") +fn("xcb_get_input_focus_cookie_t xcb_get_input_focus_unchecked(xcb_connection_t *)") +fn("xcb_get_input_focus_reply_t * xcb_get_input_focus_reply(xcb_connection_t *, xcb_get_input_focus_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_query_keymap_cookie_t xcb_query_keymap(xcb_connection_t *)") +fn("xcb_query_keymap_cookie_t xcb_query_keymap_unchecked(xcb_connection_t *)") +fn("xcb_query_keymap_reply_t * xcb_query_keymap_reply(xcb_connection_t *, xcb_query_keymap_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_open_font_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_open_font_checked(xcb_connection_t *, xcb_font_t, uint16_t, const char *)") +fn("xcb_void_cookie_t xcb_open_font(xcb_connection_t *, xcb_font_t, uint16_t, const char *)") +# ::Iterator:: +fn("char * xcb_open_font_name(const xcb_open_font_request_t *)") +fn("int xcb_open_font_name_length(const xcb_open_font_request_t *)") +fn("xcb_generic_iterator_t xcb_open_font_name_end(const xcb_open_font_request_t *)") + +fn("xcb_void_cookie_t xcb_close_font_checked(xcb_connection_t *, xcb_font_t)") +fn("xcb_void_cookie_t xcb_close_font(xcb_connection_t *, xcb_font_t)") +fn("void xcb_fontprop_next(xcb_fontprop_iterator_t *)") +fn("xcb_generic_iterator_t xcb_fontprop_end(xcb_fontprop_iterator_t)") +fn("void xcb_charinfo_next(xcb_charinfo_iterator_t *)") +fn("xcb_generic_iterator_t xcb_charinfo_end(xcb_charinfo_iterator_t)") +fn("int xcb_query_font_sizeof(const void *)") +fn("xcb_query_font_cookie_t xcb_query_font(xcb_connection_t *, xcb_fontable_t)") +fn("xcb_query_font_cookie_t xcb_query_font_unchecked(xcb_connection_t *, xcb_fontable_t)") +# ::Iterator:: +fn("xcb_fontprop_t * xcb_query_font_properties(const xcb_query_font_reply_t *)") +fn("int xcb_query_font_properties_length(const xcb_query_font_reply_t *)") +fn("xcb_fontprop_iterator_t xcb_query_font_properties_iterator(const xcb_query_font_reply_t *)") + +# ::Iterator:: +fn("xcb_charinfo_t * xcb_query_font_char_infos(const xcb_query_font_reply_t *)") +fn("int xcb_query_font_char_infos_length(const xcb_query_font_reply_t *)") +fn("xcb_charinfo_iterator_t xcb_query_font_char_infos_iterator(const xcb_query_font_reply_t *)") + +fn("xcb_query_font_reply_t * xcb_query_font_reply(xcb_connection_t *, xcb_query_font_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_query_text_extents_sizeof(const void *, uint32_t)") +fn("xcb_query_text_extents_cookie_t xcb_query_text_extents(xcb_connection_t *, xcb_fontable_t, uint32_t, const xcb_char2b_t *)") +fn("xcb_query_text_extents_cookie_t xcb_query_text_extents_unchecked(xcb_connection_t *, xcb_fontable_t, uint32_t, const xcb_char2b_t *)") +fn("xcb_query_text_extents_reply_t * xcb_query_text_extents_reply(xcb_connection_t *, xcb_query_text_extents_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_str_sizeof(const void *)") +# ::Iterator:: +fn("char * xcb_str_name(const xcb_str_t *)") +fn("int xcb_str_name_length(const xcb_str_t *)") +fn("xcb_generic_iterator_t xcb_str_name_end(const xcb_str_t *)") + +fn("void xcb_str_next(xcb_str_iterator_t *)") +fn("xcb_generic_iterator_t xcb_str_end(xcb_str_iterator_t)") +fn("int xcb_list_fonts_sizeof(const void *)") +fn("xcb_list_fonts_cookie_t xcb_list_fonts(xcb_connection_t *, uint16_t, uint16_t, const char *)") +fn("xcb_list_fonts_cookie_t xcb_list_fonts_unchecked(xcb_connection_t *, uint16_t, uint16_t, const char *)") +fn("int xcb_list_fonts_names_length(const xcb_list_fonts_reply_t *)") +fn("xcb_str_iterator_t xcb_list_fonts_names_iterator(const xcb_list_fonts_reply_t *)") +fn("xcb_list_fonts_reply_t * xcb_list_fonts_reply(xcb_connection_t *, xcb_list_fonts_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_list_fonts_with_info_sizeof(const void *)") +fn("xcb_list_fonts_with_info_cookie_t xcb_list_fonts_with_info(xcb_connection_t *, uint16_t, uint16_t, const char *)") +fn("xcb_list_fonts_with_info_cookie_t xcb_list_fonts_with_info_unchecked(xcb_connection_t *, uint16_t, uint16_t, const char *)") +# ::Iterator:: +fn("xcb_fontprop_t * xcb_list_fonts_with_info_properties(const xcb_list_fonts_with_info_reply_t *)") +fn("int xcb_list_fonts_with_info_properties_length(const xcb_list_fonts_with_info_reply_t *)") +fn("xcb_fontprop_iterator_t xcb_list_fonts_with_info_properties_iterator(const xcb_list_fonts_with_info_reply_t *)") + +# ::Iterator:: +fn("char * xcb_list_fonts_with_info_name(const xcb_list_fonts_with_info_reply_t *)") +fn("int xcb_list_fonts_with_info_name_length(const xcb_list_fonts_with_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_list_fonts_with_info_name_end(const xcb_list_fonts_with_info_reply_t *)") + +fn("xcb_list_fonts_with_info_reply_t * xcb_list_fonts_with_info_reply(xcb_connection_t *, xcb_list_fonts_with_info_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_set_font_path_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_set_font_path_checked(xcb_connection_t *, uint16_t, const xcb_str_t *)") +fn("xcb_void_cookie_t xcb_set_font_path(xcb_connection_t *, uint16_t, const xcb_str_t *)") +fn("int xcb_set_font_path_font_length(const xcb_set_font_path_request_t *)") +fn("xcb_str_iterator_t xcb_set_font_path_font_iterator(const xcb_set_font_path_request_t *)") +fn("int xcb_get_font_path_sizeof(const void *)") +fn("xcb_get_font_path_cookie_t xcb_get_font_path(xcb_connection_t *)") +fn("xcb_get_font_path_cookie_t xcb_get_font_path_unchecked(xcb_connection_t *)") +fn("int xcb_get_font_path_path_length(const xcb_get_font_path_reply_t *)") +fn("xcb_str_iterator_t xcb_get_font_path_path_iterator(const xcb_get_font_path_reply_t *)") +fn("xcb_get_font_path_reply_t * xcb_get_font_path_reply(xcb_connection_t *, xcb_get_font_path_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_create_pixmap_checked(xcb_connection_t *, uint8_t, xcb_pixmap_t, xcb_drawable_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_create_pixmap(xcb_connection_t *, uint8_t, xcb_pixmap_t, xcb_drawable_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_free_pixmap_checked(xcb_connection_t *, xcb_pixmap_t)") +fn("xcb_void_cookie_t xcb_free_pixmap(xcb_connection_t *, xcb_pixmap_t)") +fn("int xcb_create_gc_value_list_serialize(void **, uint32_t, const xcb_create_gc_value_list_t *)") +fn("int xcb_create_gc_value_list_unpack(const void *, uint32_t, xcb_create_gc_value_list_t *)") +fn("int xcb_create_gc_value_list_sizeof(const void *, uint32_t)") +fn("int xcb_create_gc_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_create_gc_checked(xcb_connection_t *, xcb_gcontext_t, xcb_drawable_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_create_gc(xcb_connection_t *, xcb_gcontext_t, xcb_drawable_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_create_gc_aux_checked(xcb_connection_t *, xcb_gcontext_t, xcb_drawable_t, uint32_t, const xcb_create_gc_value_list_t *)") +fn("xcb_void_cookie_t xcb_create_gc_aux(xcb_connection_t *, xcb_gcontext_t, xcb_drawable_t, uint32_t, const xcb_create_gc_value_list_t *)") +# XXX: Who owns result? +fn("void * xcb_create_gc_value_list(const xcb_create_gc_request_t *)") +fn("int xcb_change_gc_value_list_serialize(void **, uint32_t, const xcb_change_gc_value_list_t *)") +fn("int xcb_change_gc_value_list_unpack(const void *, uint32_t, xcb_change_gc_value_list_t *)") +fn("int xcb_change_gc_value_list_sizeof(const void *, uint32_t)") +fn("int xcb_change_gc_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_change_gc_checked(xcb_connection_t *, xcb_gcontext_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_change_gc(xcb_connection_t *, xcb_gcontext_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_change_gc_aux_checked(xcb_connection_t *, xcb_gcontext_t, uint32_t, const xcb_change_gc_value_list_t *)") +fn("xcb_void_cookie_t xcb_change_gc_aux(xcb_connection_t *, xcb_gcontext_t, uint32_t, const xcb_change_gc_value_list_t *)") +# XXX: Who owns result? +fn("void * xcb_change_gc_value_list(const xcb_change_gc_request_t *)") + +fn("xcb_void_cookie_t xcb_copy_gc_checked(xcb_connection_t *, xcb_gcontext_t, xcb_gcontext_t, uint32_t)") +fn("xcb_void_cookie_t xcb_copy_gc(xcb_connection_t *, xcb_gcontext_t, xcb_gcontext_t, uint32_t)") +fn("int xcb_set_dashes_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_set_dashes_checked(xcb_connection_t *, xcb_gcontext_t, uint16_t, uint16_t, const uint8_t *)") +fn("xcb_void_cookie_t xcb_set_dashes(xcb_connection_t *, xcb_gcontext_t, uint16_t, uint16_t, const uint8_t *)") +# ::Iterator:: +fn("uint8_t * xcb_set_dashes_dashes(const xcb_set_dashes_request_t *)") +fn("int xcb_set_dashes_dashes_length(const xcb_set_dashes_request_t *)") +fn("xcb_generic_iterator_t xcb_set_dashes_dashes_end(const xcb_set_dashes_request_t *)") + +fn("int xcb_set_clip_rectangles_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_set_clip_rectangles_checked(xcb_connection_t *, uint8_t, xcb_gcontext_t, int16_t, int16_t, uint32_t, const xcb_rectangle_t *)") +fn("xcb_void_cookie_t xcb_set_clip_rectangles(xcb_connection_t *, uint8_t, xcb_gcontext_t, int16_t, int16_t, uint32_t, const xcb_rectangle_t *)") +# ::Iterator:: +fn("xcb_rectangle_t * xcb_set_clip_rectangles_rectangles(const xcb_set_clip_rectangles_request_t *)") +fn("int xcb_set_clip_rectangles_rectangles_length(const xcb_set_clip_rectangles_request_t *)") +fn("xcb_rectangle_iterator_t xcb_set_clip_rectangles_rectangles_iterator(const xcb_set_clip_rectangles_request_t *)") + +fn("xcb_void_cookie_t xcb_free_gc_checked(xcb_connection_t *, xcb_gcontext_t)") +fn("xcb_void_cookie_t xcb_free_gc(xcb_connection_t *, xcb_gcontext_t)") +fn("xcb_void_cookie_t xcb_clear_area_checked(xcb_connection_t *, uint8_t, xcb_window_t, int16_t, int16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_clear_area(xcb_connection_t *, uint8_t, xcb_window_t, int16_t, int16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_copy_area_checked(xcb_connection_t *, xcb_drawable_t, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, int16_t, int16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_copy_area(xcb_connection_t *, xcb_drawable_t, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, int16_t, int16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_copy_plane_checked(xcb_connection_t *, xcb_drawable_t, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, int16_t, int16_t, uint16_t, uint16_t, uint32_t)") +fn("xcb_void_cookie_t xcb_copy_plane(xcb_connection_t *, xcb_drawable_t, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, int16_t, int16_t, uint16_t, uint16_t, uint32_t)") +fn("int xcb_poly_point_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_point_checked(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_point_t *)") +fn("xcb_void_cookie_t xcb_poly_point(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_point_t *)") +# ::Iterator:: +fn("xcb_point_t * xcb_poly_point_points(const xcb_poly_point_request_t *)") +fn("int xcb_poly_point_points_length(const xcb_poly_point_request_t *)") +fn("xcb_point_iterator_t xcb_poly_point_points_iterator(const xcb_poly_point_request_t *)") + +fn("int xcb_poly_line_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_line_checked(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_point_t *)") +fn("xcb_void_cookie_t xcb_poly_line(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_point_t *)") +# ::Iterator:: +fn("xcb_point_t * xcb_poly_line_points(const xcb_poly_line_request_t *)") +fn("int xcb_poly_line_points_length(const xcb_poly_line_request_t *)") +fn("xcb_point_iterator_t xcb_poly_line_points_iterator(const xcb_poly_line_request_t *)") + +fn("void xcb_segment_next(xcb_segment_iterator_t *)") +fn("xcb_generic_iterator_t xcb_segment_end(xcb_segment_iterator_t)") +fn("int xcb_poly_segment_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_segment_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_segment_t *)") +fn("xcb_void_cookie_t xcb_poly_segment(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_segment_t *)") +# ::Iterator:: +fn("xcb_segment_t * xcb_poly_segment_segments(const xcb_poly_segment_request_t *)") +fn("int xcb_poly_segment_segments_length(const xcb_poly_segment_request_t *)") +fn("xcb_segment_iterator_t xcb_poly_segment_segments_iterator(const xcb_poly_segment_request_t *)") + +fn("int xcb_poly_rectangle_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_rectangle_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_rectangle_t *)") +fn("xcb_void_cookie_t xcb_poly_rectangle(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_rectangle_t *)") +# ::Iterator:: +fn("xcb_rectangle_t * xcb_poly_rectangle_rectangles(const xcb_poly_rectangle_request_t *)") +fn("int xcb_poly_rectangle_rectangles_length(const xcb_poly_rectangle_request_t *)") +fn("xcb_rectangle_iterator_t xcb_poly_rectangle_rectangles_iterator(const xcb_poly_rectangle_request_t *)") + +fn("int xcb_poly_arc_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_arc_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_arc_t *)") +fn("xcb_void_cookie_t xcb_poly_arc(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_arc_t *)") +# ::Iterator:: +fn("xcb_arc_t * xcb_poly_arc_arcs(const xcb_poly_arc_request_t *)") +fn("int xcb_poly_arc_arcs_length(const xcb_poly_arc_request_t *)") +fn("xcb_arc_iterator_t xcb_poly_arc_arcs_iterator(const xcb_poly_arc_request_t *)") + +fn("int xcb_fill_poly_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_fill_poly_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint8_t, uint8_t, uint32_t, const xcb_point_t *)") +fn("xcb_void_cookie_t xcb_fill_poly(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint8_t, uint8_t, uint32_t, const xcb_point_t *)") +# ::Iterator:: +fn("xcb_point_t * xcb_fill_poly_points(const xcb_fill_poly_request_t *)") +fn("int xcb_fill_poly_points_length(const xcb_fill_poly_request_t *)") +fn("xcb_point_iterator_t xcb_fill_poly_points_iterator(const xcb_fill_poly_request_t *)") + +fn("int xcb_poly_fill_rectangle_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_fill_rectangle_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_rectangle_t *)") +fn("xcb_void_cookie_t xcb_poly_fill_rectangle(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_rectangle_t *)") +# ::Iterator:: +fn("xcb_rectangle_t * xcb_poly_fill_rectangle_rectangles(const xcb_poly_fill_rectangle_request_t *)") +fn("int xcb_poly_fill_rectangle_rectangles_length(const xcb_poly_fill_rectangle_request_t *)") +fn("xcb_rectangle_iterator_t xcb_poly_fill_rectangle_rectangles_iterator(const xcb_poly_fill_rectangle_request_t *)") + +fn("int xcb_poly_fill_arc_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_fill_arc_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_arc_t *)") +fn("xcb_void_cookie_t xcb_poly_fill_arc(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint32_t, const xcb_arc_t *)") +# ::Iterator:: +fn("xcb_arc_t * xcb_poly_fill_arc_arcs(const xcb_poly_fill_arc_request_t *)") +fn("int xcb_poly_fill_arc_arcs_length(const xcb_poly_fill_arc_request_t *)") +fn("xcb_arc_iterator_t xcb_poly_fill_arc_arcs_iterator(const xcb_poly_fill_arc_request_t *)") + +fn("int xcb_put_image_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_put_image_checked(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, uint16_t, uint16_t, int16_t, int16_t, uint8_t, uint8_t, uint32_t, const uint8_t *)") +fn("xcb_void_cookie_t xcb_put_image(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, uint16_t, uint16_t, int16_t, int16_t, uint8_t, uint8_t, uint32_t, const uint8_t *)") +# ::Iterator:: +fn("uint8_t * xcb_put_image_data(const xcb_put_image_request_t *)") +fn("int xcb_put_image_data_length(const xcb_put_image_request_t *)") +fn("xcb_generic_iterator_t xcb_put_image_data_end(const xcb_put_image_request_t *)") + +fn("int xcb_get_image_sizeof(const void *)") +fn("xcb_get_image_cookie_t xcb_get_image(xcb_connection_t *, uint8_t, xcb_drawable_t, int16_t, int16_t, uint16_t, uint16_t, uint32_t)") +fn("xcb_get_image_cookie_t xcb_get_image_unchecked(xcb_connection_t *, uint8_t, xcb_drawable_t, int16_t, int16_t, uint16_t, uint16_t, uint32_t)") +# ::Iterator:: +fn("uint8_t * xcb_get_image_data(const xcb_get_image_reply_t *)") +fn("int xcb_get_image_data_length(const xcb_get_image_reply_t *)") +fn("xcb_generic_iterator_t xcb_get_image_data_end(const xcb_get_image_reply_t *)") + +fn("xcb_get_image_reply_t * xcb_get_image_reply(xcb_connection_t *, xcb_get_image_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_poly_text_8_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_text_8_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, uint32_t, const uint8_t *)") +fn("xcb_void_cookie_t xcb_poly_text_8(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, uint32_t, const uint8_t *)") +# ::Iterator:: +fn("uint8_t * xcb_poly_text_8_items(const xcb_poly_text_8_request_t *)") +fn("int xcb_poly_text_8_items_length(const xcb_poly_text_8_request_t *)") +fn("xcb_generic_iterator_t xcb_poly_text_8_items_end(const xcb_poly_text_8_request_t *)") + +fn("int xcb_poly_text_16_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_poly_text_16_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, uint32_t, const uint8_t *)") +fn("xcb_void_cookie_t xcb_poly_text_16(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, uint32_t, const uint8_t *)") +# ::Iterator:: +fn("uint8_t * xcb_poly_text_16_items(const xcb_poly_text_16_request_t *)") +fn("int xcb_poly_text_16_items_length(const xcb_poly_text_16_request_t *)") +fn("xcb_generic_iterator_t xcb_poly_text_16_items_end(const xcb_poly_text_16_request_t *)") + +fn("int xcb_image_text_8_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_image_text_8_checked(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, const char *)") +fn("xcb_void_cookie_t xcb_image_text_8(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, const char *)") +# ::Iterator:: +fn("char * xcb_image_text_8_string(const xcb_image_text_8_request_t *)") +fn("int xcb_image_text_8_string_length(const xcb_image_text_8_request_t *)") +fn("xcb_generic_iterator_t xcb_image_text_8_string_end(const xcb_image_text_8_request_t *)") + +fn("int xcb_image_text_16_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_image_text_16_checked(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, const xcb_char2b_t *)") +fn("xcb_void_cookie_t xcb_image_text_16(xcb_connection_t *, uint8_t, xcb_drawable_t, xcb_gcontext_t, int16_t, int16_t, const xcb_char2b_t *)") +# ::Iterator:: +fn("xcb_char2b_t * xcb_image_text_16_string(const xcb_image_text_16_request_t *)") +fn("int xcb_image_text_16_string_length(const xcb_image_text_16_request_t *)") +fn("xcb_char2b_iterator_t xcb_image_text_16_string_iterator(const xcb_image_text_16_request_t *)") + +fn("xcb_void_cookie_t xcb_create_colormap_checked(xcb_connection_t *, uint8_t, xcb_colormap_t, xcb_window_t, xcb_visualid_t)") +fn("xcb_void_cookie_t xcb_create_colormap(xcb_connection_t *, uint8_t, xcb_colormap_t, xcb_window_t, xcb_visualid_t)") +fn("xcb_void_cookie_t xcb_free_colormap_checked(xcb_connection_t *, xcb_colormap_t)") +fn("xcb_void_cookie_t xcb_free_colormap(xcb_connection_t *, xcb_colormap_t)") +fn("xcb_void_cookie_t xcb_copy_colormap_and_free_checked(xcb_connection_t *, xcb_colormap_t, xcb_colormap_t)") +fn("xcb_void_cookie_t xcb_copy_colormap_and_free(xcb_connection_t *, xcb_colormap_t, xcb_colormap_t)") +fn("xcb_void_cookie_t xcb_install_colormap_checked(xcb_connection_t *, xcb_colormap_t)") +fn("xcb_void_cookie_t xcb_install_colormap(xcb_connection_t *, xcb_colormap_t)") +fn("xcb_void_cookie_t xcb_uninstall_colormap_checked(xcb_connection_t *, xcb_colormap_t)") +fn("xcb_void_cookie_t xcb_uninstall_colormap(xcb_connection_t *, xcb_colormap_t)") +fn("int xcb_list_installed_colormaps_sizeof(const void *)") +fn("xcb_list_installed_colormaps_cookie_t xcb_list_installed_colormaps(xcb_connection_t *, xcb_window_t)") +fn("xcb_list_installed_colormaps_cookie_t xcb_list_installed_colormaps_unchecked(xcb_connection_t *, xcb_window_t)") +# ::Iterator:: +fn("xcb_colormap_t * xcb_list_installed_colormaps_cmaps(const xcb_list_installed_colormaps_reply_t *)") +fn("int xcb_list_installed_colormaps_cmaps_length(const xcb_list_installed_colormaps_reply_t *)") +fn("xcb_generic_iterator_t xcb_list_installed_colormaps_cmaps_end(const xcb_list_installed_colormaps_reply_t *)") + +fn("xcb_list_installed_colormaps_reply_t * xcb_list_installed_colormaps_reply(xcb_connection_t *, xcb_list_installed_colormaps_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_alloc_color_cookie_t xcb_alloc_color(xcb_connection_t *, xcb_colormap_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_alloc_color_cookie_t xcb_alloc_color_unchecked(xcb_connection_t *, xcb_colormap_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_alloc_color_reply_t * xcb_alloc_color_reply(xcb_connection_t *, xcb_alloc_color_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_alloc_named_color_sizeof(const void *)") +fn("xcb_alloc_named_color_cookie_t xcb_alloc_named_color(xcb_connection_t *, xcb_colormap_t, uint16_t, const char *)") +fn("xcb_alloc_named_color_cookie_t xcb_alloc_named_color_unchecked(xcb_connection_t *, xcb_colormap_t, uint16_t, const char *)") +fn("xcb_alloc_named_color_reply_t * xcb_alloc_named_color_reply(xcb_connection_t *, xcb_alloc_named_color_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_alloc_color_cells_sizeof(const void *)") +fn("xcb_alloc_color_cells_cookie_t xcb_alloc_color_cells(xcb_connection_t *, uint8_t, xcb_colormap_t, uint16_t, uint16_t)") +fn("xcb_alloc_color_cells_cookie_t xcb_alloc_color_cells_unchecked(xcb_connection_t *, uint8_t, xcb_colormap_t, uint16_t, uint16_t)") +# ::Iterator:: +fn("uint32_t * xcb_alloc_color_cells_pixels(const xcb_alloc_color_cells_reply_t *)") +fn("int xcb_alloc_color_cells_pixels_length(const xcb_alloc_color_cells_reply_t *)") +fn("xcb_generic_iterator_t xcb_alloc_color_cells_pixels_end(const xcb_alloc_color_cells_reply_t *)") + +# ::Iterator:: +fn("uint32_t * xcb_alloc_color_cells_masks(const xcb_alloc_color_cells_reply_t *)") +fn("int xcb_alloc_color_cells_masks_length(const xcb_alloc_color_cells_reply_t *)") +fn("xcb_generic_iterator_t xcb_alloc_color_cells_masks_end(const xcb_alloc_color_cells_reply_t *)") + +fn("xcb_alloc_color_cells_reply_t * xcb_alloc_color_cells_reply(xcb_connection_t *, xcb_alloc_color_cells_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_alloc_color_planes_sizeof(const void *)") +fn("xcb_alloc_color_planes_cookie_t xcb_alloc_color_planes(xcb_connection_t *, uint8_t, xcb_colormap_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_alloc_color_planes_cookie_t xcb_alloc_color_planes_unchecked(xcb_connection_t *, uint8_t, xcb_colormap_t, uint16_t, uint16_t, uint16_t, uint16_t)") +# ::Iterator:: +fn("uint32_t * xcb_alloc_color_planes_pixels(const xcb_alloc_color_planes_reply_t *)") +fn("int xcb_alloc_color_planes_pixels_length(const xcb_alloc_color_planes_reply_t *)") +fn("xcb_generic_iterator_t xcb_alloc_color_planes_pixels_end(const xcb_alloc_color_planes_reply_t *)") + +fn("xcb_alloc_color_planes_reply_t * xcb_alloc_color_planes_reply(xcb_connection_t *, xcb_alloc_color_planes_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_free_colors_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_free_colors_checked(xcb_connection_t *, xcb_colormap_t, uint32_t, uint32_t, const uint32_t *)") +fn("xcb_void_cookie_t xcb_free_colors(xcb_connection_t *, xcb_colormap_t, uint32_t, uint32_t, const uint32_t *)") +# ::Iterator:: +fn("uint32_t * xcb_free_colors_pixels(const xcb_free_colors_request_t *)") +fn("int xcb_free_colors_pixels_length(const xcb_free_colors_request_t *)") +fn("xcb_generic_iterator_t xcb_free_colors_pixels_end(const xcb_free_colors_request_t *)") + +fn("void xcb_coloritem_next(xcb_coloritem_iterator_t *)") +fn("xcb_generic_iterator_t xcb_coloritem_end(xcb_coloritem_iterator_t)") +fn("int xcb_store_colors_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_store_colors_checked(xcb_connection_t *, xcb_colormap_t, uint32_t, const xcb_coloritem_t *)") +fn("xcb_void_cookie_t xcb_store_colors(xcb_connection_t *, xcb_colormap_t, uint32_t, const xcb_coloritem_t *)") +# ::Iterator:: +fn("xcb_coloritem_t * xcb_store_colors_items(const xcb_store_colors_request_t *)") +fn("int xcb_store_colors_items_length(const xcb_store_colors_request_t *)") +fn("xcb_coloritem_iterator_t xcb_store_colors_items_iterator(const xcb_store_colors_request_t *)") + +fn("int xcb_store_named_color_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_store_named_color_checked(xcb_connection_t *, uint8_t, xcb_colormap_t, uint32_t, uint16_t, const char *)") +fn("xcb_void_cookie_t xcb_store_named_color(xcb_connection_t *, uint8_t, xcb_colormap_t, uint32_t, uint16_t, const char *)") +# XXX: Who owns result? +fn("char * xcb_store_named_color_name(const xcb_store_named_color_request_t *)") + +fn("int xcb_store_named_color_name_length(const xcb_store_named_color_request_t *)") +fn("xcb_generic_iterator_t xcb_store_named_color_name_end(const xcb_store_named_color_request_t *)") +fn("void xcb_rgb_next(xcb_rgb_iterator_t *)") +fn("xcb_generic_iterator_t xcb_rgb_end(xcb_rgb_iterator_t)") +fn("int xcb_query_colors_sizeof(const void *, uint32_t)") +fn("xcb_query_colors_cookie_t xcb_query_colors(xcb_connection_t *, xcb_colormap_t, uint32_t, const uint32_t *)") +fn("xcb_query_colors_cookie_t xcb_query_colors_unchecked(xcb_connection_t *, xcb_colormap_t, uint32_t, const uint32_t *)") +# ::Iterator:: +fn("xcb_rgb_t * xcb_query_colors_colors(const xcb_query_colors_reply_t *)") +fn("int xcb_query_colors_colors_length(const xcb_query_colors_reply_t *)") +fn("xcb_rgb_iterator_t xcb_query_colors_colors_iterator(const xcb_query_colors_reply_t *)") + +fn("xcb_query_colors_reply_t * xcb_query_colors_reply(xcb_connection_t *, xcb_query_colors_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_lookup_color_sizeof(const void *)") +fn("xcb_lookup_color_cookie_t xcb_lookup_color(xcb_connection_t *, xcb_colormap_t, uint16_t, const char *)") +fn("xcb_lookup_color_cookie_t xcb_lookup_color_unchecked(xcb_connection_t *, xcb_colormap_t, uint16_t, const char *)") +fn("xcb_lookup_color_reply_t * xcb_lookup_color_reply(xcb_connection_t *, xcb_lookup_color_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_create_cursor_checked(xcb_connection_t *, xcb_cursor_t, xcb_pixmap_t, xcb_pixmap_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_create_cursor(xcb_connection_t *, xcb_cursor_t, xcb_pixmap_t, xcb_pixmap_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_create_glyph_cursor_checked(xcb_connection_t *, xcb_cursor_t, xcb_font_t, xcb_font_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_create_glyph_cursor(xcb_connection_t *, xcb_cursor_t, xcb_font_t, xcb_font_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_free_cursor_checked(xcb_connection_t *, xcb_cursor_t)") +fn("xcb_void_cookie_t xcb_free_cursor(xcb_connection_t *, xcb_cursor_t)") +fn("xcb_void_cookie_t xcb_recolor_cursor_checked(xcb_connection_t *, xcb_cursor_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_recolor_cursor(xcb_connection_t *, xcb_cursor_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_query_best_size_cookie_t xcb_query_best_size(xcb_connection_t *, uint8_t, xcb_drawable_t, uint16_t, uint16_t)") +fn("xcb_query_best_size_cookie_t xcb_query_best_size_unchecked(xcb_connection_t *, uint8_t, xcb_drawable_t, uint16_t, uint16_t)") +fn("xcb_query_best_size_reply_t * xcb_query_best_size_reply(xcb_connection_t *, xcb_query_best_size_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_query_extension_sizeof(const void *)") +fn("xcb_query_extension_cookie_t xcb_query_extension(xcb_connection_t *, uint16_t, const char *)") +fn("xcb_query_extension_cookie_t xcb_query_extension_unchecked(xcb_connection_t *, uint16_t, const char *)") +fn("xcb_query_extension_reply_t * xcb_query_extension_reply(xcb_connection_t *, xcb_query_extension_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_list_extensions_sizeof(const void *)") +fn("xcb_list_extensions_cookie_t xcb_list_extensions(xcb_connection_t *)") +fn("xcb_list_extensions_cookie_t xcb_list_extensions_unchecked(xcb_connection_t *)") +fn("int xcb_list_extensions_names_length(const xcb_list_extensions_reply_t *)") +fn("xcb_str_iterator_t xcb_list_extensions_names_iterator(const xcb_list_extensions_reply_t *)") +fn("xcb_list_extensions_reply_t * xcb_list_extensions_reply(xcb_connection_t *, xcb_list_extensions_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_change_keyboard_mapping_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_change_keyboard_mapping_checked(xcb_connection_t *, uint8_t, xcb_keycode_t, uint8_t, const xcb_keysym_t *)") +fn("xcb_void_cookie_t xcb_change_keyboard_mapping(xcb_connection_t *, uint8_t, xcb_keycode_t, uint8_t, const xcb_keysym_t *)") +# ::Iterator:: +fn("xcb_keysym_t * xcb_change_keyboard_mapping_keysyms(const xcb_change_keyboard_mapping_request_t *)") +fn("int xcb_change_keyboard_mapping_keysyms_length(const xcb_change_keyboard_mapping_request_t *)") +fn("xcb_generic_iterator_t xcb_change_keyboard_mapping_keysyms_end(const xcb_change_keyboard_mapping_request_t *)") + +fn("int xcb_get_keyboard_mapping_sizeof(const void *)") +fn("xcb_get_keyboard_mapping_cookie_t xcb_get_keyboard_mapping(xcb_connection_t *, xcb_keycode_t, uint8_t)") +fn("xcb_get_keyboard_mapping_cookie_t xcb_get_keyboard_mapping_unchecked(xcb_connection_t *, xcb_keycode_t, uint8_t)") +# ::Iterator:: +fn("xcb_keysym_t * xcb_get_keyboard_mapping_keysyms(const xcb_get_keyboard_mapping_reply_t *)") +fn("int xcb_get_keyboard_mapping_keysyms_length(const xcb_get_keyboard_mapping_reply_t *)") +fn("xcb_generic_iterator_t xcb_get_keyboard_mapping_keysyms_end(const xcb_get_keyboard_mapping_reply_t *)") + +fn("xcb_get_keyboard_mapping_reply_t * xcb_get_keyboard_mapping_reply(xcb_connection_t *, xcb_get_keyboard_mapping_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_change_keyboard_control_value_list_serialize(void **, uint32_t, const xcb_change_keyboard_control_value_list_t *)") +fn("int xcb_change_keyboard_control_value_list_unpack(const void *, uint32_t, xcb_change_keyboard_control_value_list_t *)") +fn("int xcb_change_keyboard_control_value_list_sizeof(const void *, uint32_t)") +fn("int xcb_change_keyboard_control_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_change_keyboard_control_checked(xcb_connection_t *, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_change_keyboard_control(xcb_connection_t *, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_change_keyboard_control_aux_checked(xcb_connection_t *, uint32_t, const xcb_change_keyboard_control_value_list_t *)") +fn("xcb_void_cookie_t xcb_change_keyboard_control_aux(xcb_connection_t *, uint32_t, const xcb_change_keyboard_control_value_list_t *)") +# XXX: Who owns result? +fn("void * xcb_change_keyboard_control_value_list(const xcb_change_keyboard_control_request_t *)") + +fn("xcb_get_keyboard_control_cookie_t xcb_get_keyboard_control(xcb_connection_t *)") +fn("xcb_get_keyboard_control_cookie_t xcb_get_keyboard_control_unchecked(xcb_connection_t *)") +fn("xcb_get_keyboard_control_reply_t * xcb_get_keyboard_control_reply(xcb_connection_t *, xcb_get_keyboard_control_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_bell_checked(xcb_connection_t *, int8_t)") +fn("xcb_void_cookie_t xcb_bell(xcb_connection_t *, int8_t)") +fn("xcb_void_cookie_t xcb_change_pointer_control_checked(xcb_connection_t *, int16_t, int16_t, int16_t, uint8_t, uint8_t)") +fn("xcb_void_cookie_t xcb_change_pointer_control(xcb_connection_t *, int16_t, int16_t, int16_t, uint8_t, uint8_t)") +fn("xcb_get_pointer_control_cookie_t xcb_get_pointer_control(xcb_connection_t *)") +fn("xcb_get_pointer_control_cookie_t xcb_get_pointer_control_unchecked(xcb_connection_t *)") +fn("xcb_get_pointer_control_reply_t * xcb_get_pointer_control_reply(xcb_connection_t *, xcb_get_pointer_control_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_set_screen_saver_checked(xcb_connection_t *, int16_t, int16_t, uint8_t, uint8_t)") +fn("xcb_void_cookie_t xcb_set_screen_saver(xcb_connection_t *, int16_t, int16_t, uint8_t, uint8_t)") +fn("xcb_get_screen_saver_cookie_t xcb_get_screen_saver(xcb_connection_t *)") +fn("xcb_get_screen_saver_cookie_t xcb_get_screen_saver_unchecked(xcb_connection_t *)") +fn("xcb_get_screen_saver_reply_t * xcb_get_screen_saver_reply(xcb_connection_t *, xcb_get_screen_saver_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_change_hosts_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_change_hosts_checked(xcb_connection_t *, uint8_t, uint8_t, uint16_t, const uint8_t *)") +fn("xcb_void_cookie_t xcb_change_hosts(xcb_connection_t *, uint8_t, uint8_t, uint16_t, const uint8_t *)") +# ::Iterator:: +fn("uint8_t * xcb_change_hosts_address(const xcb_change_hosts_request_t *)") +fn("int xcb_change_hosts_address_length(const xcb_change_hosts_request_t *)") +fn("xcb_generic_iterator_t xcb_change_hosts_address_end(const xcb_change_hosts_request_t *)") + +fn("int xcb_host_sizeof(const void *)") +# ::Iterator:: +fn("uint8_t * xcb_host_address(const xcb_host_t *)") +fn("int xcb_host_address_length(const xcb_host_t *)") +fn("xcb_generic_iterator_t xcb_host_address_end(const xcb_host_t *)") + +fn("void xcb_host_next(xcb_host_iterator_t *)") +fn("xcb_generic_iterator_t xcb_host_end(xcb_host_iterator_t)") +fn("int xcb_list_hosts_sizeof(const void *)") +fn("xcb_list_hosts_cookie_t xcb_list_hosts(xcb_connection_t *)") +fn("xcb_list_hosts_cookie_t xcb_list_hosts_unchecked(xcb_connection_t *)") +fn("int xcb_list_hosts_hosts_length(const xcb_list_hosts_reply_t *)") +fn("xcb_host_iterator_t xcb_list_hosts_hosts_iterator(const xcb_list_hosts_reply_t *)") +fn("xcb_list_hosts_reply_t * xcb_list_hosts_reply(xcb_connection_t *, xcb_list_hosts_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_set_access_control_checked(xcb_connection_t *, uint8_t)") +fn("xcb_void_cookie_t xcb_set_access_control(xcb_connection_t *, uint8_t)") +fn("xcb_void_cookie_t xcb_set_close_down_mode_checked(xcb_connection_t *, uint8_t)") +fn("xcb_void_cookie_t xcb_set_close_down_mode(xcb_connection_t *, uint8_t)") +fn("xcb_void_cookie_t xcb_kill_client_checked(xcb_connection_t *, uint32_t)") +fn("xcb_void_cookie_t xcb_kill_client(xcb_connection_t *, uint32_t)") +fn("int xcb_rotate_properties_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_rotate_properties_checked(xcb_connection_t *, xcb_window_t, uint16_t, int16_t, const xcb_atom_t *)") +fn("xcb_void_cookie_t xcb_rotate_properties(xcb_connection_t *, xcb_window_t, uint16_t, int16_t, const xcb_atom_t *)") +# ::Iterator:: +fn("xcb_atom_t * xcb_rotate_properties_atoms(const xcb_rotate_properties_request_t *)") +fn("int xcb_rotate_properties_atoms_length(const xcb_rotate_properties_request_t *)") +fn("xcb_generic_iterator_t xcb_rotate_properties_atoms_end(const xcb_rotate_properties_request_t *)") + +fn("xcb_void_cookie_t xcb_force_screen_saver_checked(xcb_connection_t *, uint8_t)") +fn("xcb_void_cookie_t xcb_force_screen_saver(xcb_connection_t *, uint8_t)") +fn("int xcb_set_pointer_mapping_sizeof(const void *)") +fn("xcb_set_pointer_mapping_cookie_t xcb_set_pointer_mapping(xcb_connection_t *, uint8_t, const uint8_t *)") +fn("xcb_set_pointer_mapping_cookie_t xcb_set_pointer_mapping_unchecked(xcb_connection_t *, uint8_t, const uint8_t *)") +fn("xcb_set_pointer_mapping_reply_t * xcb_set_pointer_mapping_reply(xcb_connection_t *, xcb_set_pointer_mapping_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_get_pointer_mapping_sizeof(const void *)") +fn("xcb_get_pointer_mapping_cookie_t xcb_get_pointer_mapping(xcb_connection_t *)") +fn("xcb_get_pointer_mapping_cookie_t xcb_get_pointer_mapping_unchecked(xcb_connection_t *)") +# ::Iterator:: +fn("uint8_t * xcb_get_pointer_mapping_map(const xcb_get_pointer_mapping_reply_t *)") +fn("int xcb_get_pointer_mapping_map_length(const xcb_get_pointer_mapping_reply_t *)") +fn("xcb_generic_iterator_t xcb_get_pointer_mapping_map_end(const xcb_get_pointer_mapping_reply_t *)") + +fn("xcb_get_pointer_mapping_reply_t * xcb_get_pointer_mapping_reply(xcb_connection_t *, xcb_get_pointer_mapping_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_set_modifier_mapping_sizeof(const void *)") +fn("xcb_set_modifier_mapping_cookie_t xcb_set_modifier_mapping(xcb_connection_t *, uint8_t, const xcb_keycode_t *)") +fn("xcb_set_modifier_mapping_cookie_t xcb_set_modifier_mapping_unchecked(xcb_connection_t *, uint8_t, const xcb_keycode_t *)") +fn("xcb_set_modifier_mapping_reply_t * xcb_set_modifier_mapping_reply(xcb_connection_t *, xcb_set_modifier_mapping_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_get_modifier_mapping_sizeof(const void *)") +fn("xcb_get_modifier_mapping_cookie_t xcb_get_modifier_mapping(xcb_connection_t *)") +fn("xcb_get_modifier_mapping_cookie_t xcb_get_modifier_mapping_unchecked(xcb_connection_t *)") +# ::Iterator:: +fn("xcb_keycode_t * xcb_get_modifier_mapping_keycodes(const xcb_get_modifier_mapping_reply_t *)") +fn("int xcb_get_modifier_mapping_keycodes_length(const xcb_get_modifier_mapping_reply_t *)") +fn("xcb_generic_iterator_t xcb_get_modifier_mapping_keycodes_end(const xcb_get_modifier_mapping_reply_t *)") + +fn("xcb_get_modifier_mapping_reply_t * xcb_get_modifier_mapping_reply(xcb_connection_t *, xcb_get_modifier_mapping_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_no_operation_checked(xcb_connection_t *)") +fn("xcb_void_cookie_t xcb_no_operation(xcb_connection_t *)") +Generate() diff --git a/ThunkLibs/include/common/CrossArchEvent.h b/ThunkLibs/include/common/CrossArchEvent.h new file mode 100644 index 000000000..8a0bd23ff --- /dev/null +++ b/ThunkLibs/include/common/CrossArchEvent.h @@ -0,0 +1,117 @@ +#pragma once + +#include +#include +#include +#include + +struct CrossArchEvent final { + std::atomic Futex; +}; + +static void WaitForWorkFunc(CrossArchEvent *Event) { + + // Wait for Futex value to become 1 + while (true) { + + // First step compare it with 1 already and see if we can early out + uint32_t One = 1; + if (Event->Futex.compare_exchange_strong(One, 0)) { + return; + } + + int Op = FUTEX_WAIT | FUTEX_PRIVATE_FLAG; + int Res = syscall(SYS_futex, + &Event->Futex, + Op, + nullptr, // Timeout + nullptr, // Addr + 0); + } +} + +static void NotifyWorkFunc(CrossArchEvent *Event) { + uint32_t Zero = 0; + if (Event->Futex.compare_exchange_strong(Zero, 1)) { + int Op = FUTEX_WAKE | FUTEX_PRIVATE_FLAG; + syscall(SYS_futex, + &Event->Futex, + Op, + nullptr, // Timeout + nullptr, // Addr + 0); + } +} + +//class CrossArchEvent final { +// private: +// /** +// * @brief Literally just an atomic bool that we are using for this class +// */ +// class Flag final { +// public: +// bool TestAndSet(bool SetValue = true) { +// bool Expected = !SetValue; +// return Value.compare_exchange_strong(Expected, SetValue); +// } +// +// bool TestAndClear() { +// return TestAndSet(false); +// } +// +// bool Get() { +// return Value.load(); +// } +// +// private: +// std::atomic_bool Value {false}; +// }; +// +// public: +// ~CrossArchEvent() { +// NotifyAll(); +// } +// void NotifyOne() { +// if (FlagObject.TestAndSet()) { +// std::lock_guard lk(MutexObject); +// CondObject.notify_one(); +// } +// } +// +// void NotifyAll() { +// if (FlagObject.TestAndSet()) { +// std::lock_guard lk(MutexObject); +// CondObject.notify_all(); +// } +// } +// +// void Wait() { +// // Have we signaled before we started waiting? +// if (FlagObject.TestAndClear()) +// return; +// +// std::unique_lock lk(MutexObject); +// CondObject.wait(lk, [this]{ return FlagObject.TestAndClear(); }); +// } +// +// template +// bool WaitFor(std::chrono::duration const& time) { +// // Have we signaled before we started waiting? +// if (FlagObject.TestAndClear()) +// return true; +// +// std::unique_lock lk(MutexObject); +// bool DidSignal = CondObject.wait_for(lk, time, [this]{ return FlagObject.TestAndClear(); }); +// return DidSignal; +// } +// void BusyWaitForWork() { +// while (!FlagObject.Get()); +// } +// +// private: +// std::mutex MutexObject; +// std::condition_variable CondObject; +// Flag FlagObject; +//}; + + diff --git a/ThunkLibs/libxcb/libxcb_Guest.cpp b/ThunkLibs/libxcb/libxcb_Guest.cpp new file mode 100644 index 000000000..eb17c2e7e --- /dev/null +++ b/ThunkLibs/libxcb/libxcb_Guest.cpp @@ -0,0 +1,1606 @@ +/* +$info$ +tags: thunklibs|xcb +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common/Guest.h" +#include "WorkEventData.h" +#include "common/CrossArchEvent.h" + +#include + +#include "callback_typedefs.inl" + +using CBType = void (*)(void *closure); + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" +#include "callback_unpacks.inl" + +static std::thread CBThread{}; +static std::atomic CBDone{false}; + +static CrossArchEvent WaitForWork{}; +static CrossArchEvent WorkDone{}; +static CBWork CBWorkData{}; + +void FEX_Helper_GiveEvents() { + struct { + CrossArchEvent *WaitForWork; + CrossArchEvent *WorkDone; + CBWork *Work; + } args; + + args.WaitForWork = &WaitForWork; + args.WorkDone = &WorkDone; + args.Work = &CBWorkData; + + fexthunks_libxcb_FEX_GiveEvents(&args); +} + +static void CallbackThreadFunc() { + // Set the thread name to make it easy to know what thread this is + pthread_setname_np(pthread_self(), "xcb:take_socket"); + + // Hand the host our helpers + FEX_Helper_GiveEvents(); + while (!CBDone) { + WaitForWorkFunc(&WaitForWork); + if (CBDone) { + return; + } + typedef void take_xcb_fn_t (void* a_0); + auto callback = reinterpret_cast(CBWorkData.cb); + + // On shutdown then callback can change to nullptr + if (callback) { + callback(CBWorkData.argsv); + } + NotifyWorkFunc(&WorkDone); + } +} + +// Callbacks +static void fexfn_unpack_libxcb_xcb_take_socket_cb(uintptr_t cb, void *argsv){ + // Hand the callback off to our native thread which will have proper TLS + CBWorkData.cb = cb; + CBWorkData.argsv = argsv; + // Tell the thread it has work + NotifyWorkFunc(&WaitForWork); + // Wait for the work to be done + WaitForWorkFunc(&WorkDone); +} + +extern "C" { + static void init_lib() { + // Start a guest side thread that allows us to do callbacks from xcb safely + if (!CBThread.joinable()) { + CBThread = std::thread(CallbackThreadFunc); + } + } + __attribute__((destructor)) static void close_lib() { + if (CBThread.joinable()) { + CBDone = true; + NotifyWorkFunc(&WaitForWork); + NotifyWorkFunc(&WorkDone); + CBThread.join(); + } + } + + xcb_extension_t xcb_big_requests_id = { + .name = "BIG-REQUESTS", + .global_id = 0, + }; + + xcb_extension_t xcb_xc_misc_id = { + .name = "XC-MISC", + .global_id = 0, + }; + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_init_extension(c, &xcb_big_requests_id); + FEX_xcb_init_extension(c, &xcb_xc_misc_id); + } + + int xcb_take_socket(xcb_connection_t * a_0,CBType a_1,void * a_2,int a_3,uint64_t * a_4){ + return xcb_take_socket_internal(a_0, a_1, a_2, a_3, a_4); + } + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_FEX_usable_size(&args); + return args.rv; + } + + static xcb_connection_t * fexfn_pack_xcb_connect(const char * a_0,int * a_1){ + struct {const char * a_0;int * a_1;xcb_connection_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1; + fexthunks_libxcb_xcb_connect(&args); + InitializeExtensions(args.rv); + return args.rv; + } + + static xcb_connection_t * fexfn_pack_xcb_connect_to_display_with_auth_info(const char * a_0,xcb_auth_info_t * a_1,int * a_2){ + struct {const char * a_0;xcb_auth_info_t * a_1;int * a_2;xcb_connection_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_connect_to_display_with_auth_info(&args); + InitializeExtensions(args.rv); + return args.rv; + } + + static void fexfn_pack_xcb_disconnect(xcb_connection_t * a_0){ + struct {xcb_connection_t * a_0;} args; + args.a_0 = a_0; + fexthunks_libxcb_xcb_disconnect(&args); + } + + static int fexfn_pack_xcb_parse_display(const char * a_0,char ** a_1,int * a_2,int * a_3){ + struct {const char * a_0;char ** a_1;int * a_2;int * a_3;int rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2;args.a_3 = a_3; + fexthunks_libxcb_xcb_parse_display(&args); + if (a_1 && *a_1) { + // Usable size + size_t Usable = FEX_malloc_usable_size(*a_1); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, *a_1, Usable); + + FEX_malloc_free_on_host(*a_1); + *a_1 = (char*)NewPtr; + } + + return args.rv; + } + + static xcb_generic_event_t * fexfn_pack_xcb_wait_for_event(xcb_connection_t * a_0){ + struct {xcb_connection_t * a_0;xcb_generic_event_t * rv;} args; + args.a_0 = a_0; + fexthunks_libxcb_xcb_wait_for_event(&args); + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_generic_event_t * fexfn_pack_xcb_poll_for_event(xcb_connection_t * a_0){ + struct {xcb_connection_t * a_0;xcb_generic_event_t * rv;} args; + args.a_0 = a_0; + fexthunks_libxcb_xcb_poll_for_event(&args); + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_generic_event_t * fexfn_pack_xcb_poll_for_queued_event(xcb_connection_t * a_0){ + struct {xcb_connection_t * a_0;xcb_generic_event_t * rv;} args; + args.a_0 = a_0; + fexthunks_libxcb_xcb_poll_for_queued_event(&args); + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_generic_event_t * fexfn_pack_xcb_poll_for_special_event(xcb_connection_t * a_0,xcb_special_event_t * a_1){ + struct {xcb_connection_t * a_0;xcb_special_event_t * a_1;xcb_generic_event_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1; + fexthunks_libxcb_xcb_poll_for_special_event(&args); + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_generic_event_t * fexfn_pack_xcb_wait_for_special_event(xcb_connection_t * a_0,xcb_special_event_t * a_1){ + struct {xcb_connection_t * a_0;xcb_special_event_t * a_1;xcb_generic_event_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1; + fexthunks_libxcb_xcb_wait_for_special_event(&args); + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_generic_error_t * fexfn_pack_xcb_request_check(xcb_connection_t * a_0,xcb_void_cookie_t a_1){ + struct {xcb_connection_t * a_0;xcb_void_cookie_t a_1;xcb_generic_error_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1; + fexthunks_libxcb_xcb_request_check(&args); + if (args.rv) { + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(sizeof(xcb_generic_error_t)); + memcpy(NewPtr, args.rv, sizeof(xcb_generic_error_t)); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + return args.rv; + } + + static void * fexfn_pack_xcb_wait_for_reply(xcb_connection_t * a_0, uint32_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;xcb_generic_error_t ** a_2;void * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_wait_for_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static void * fexfn_pack_xcb_wait_for_reply64(xcb_connection_t * a_0,uint64_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;uint64_t a_1;xcb_generic_error_t ** a_2;void * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_wait_for_reply64(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = NewPtr; + } + + return args.rv; + } + + static int fexfn_pack_xcb_poll_for_reply(xcb_connection_t * a_0,unsigned int a_1,void ** a_2,xcb_generic_error_t ** a_3){ + struct {xcb_connection_t * a_0;unsigned int a_1;void ** a_2;xcb_generic_error_t ** a_3;int rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2;args.a_3 = a_3; + fexthunks_libxcb_xcb_poll_for_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // Usable size + size_t Usable = FEX_malloc_usable_size(*a_2); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, *a_2, Usable); + + FEX_malloc_free_on_host(*a_2); + *a_2 = NewPtr; + } + + if (a_3 && *a_3) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_3, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_3); + + // User is expected to free this + *a_3 = NewError; + } + + return args.rv; + } + + static int fexfn_pack_xcb_poll_for_reply64(xcb_connection_t * a_0,uint64_t a_1,void ** a_2,xcb_generic_error_t ** a_3){ + struct {xcb_connection_t * a_0;uint64_t a_1;void ** a_2;xcb_generic_error_t ** a_3;int rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2;args.a_3 = a_3; + fexthunks_libxcb_xcb_poll_for_reply64(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // Usable size + size_t Usable = FEX_malloc_usable_size(*a_2); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, *a_2, Usable); + + FEX_malloc_free_on_host(*a_2); + *a_2 = NewPtr; + } + + if (a_3 && *a_3) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_3, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_3); + + // User is expected to free this + *a_3 = NewError; + } + + return args.rv; + } + + static xcb_query_extension_reply_t * fexfn_pack_xcb_query_extension_reply(xcb_connection_t * a_0,xcb_query_extension_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_query_extension_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_query_extension_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_query_extension_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + + return args.rv; + } + + static xcb_get_window_attributes_reply_t * fexfn_pack_xcb_get_window_attributes_reply(xcb_connection_t * a_0,xcb_get_window_attributes_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_window_attributes_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_window_attributes_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_window_attributes_reply(&args); + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + void *NewPtr = malloc(sizeof(xcb_get_window_attributes_reply_t)); + memcpy(NewPtr, args.rv, sizeof(xcb_get_window_attributes_reply_t)); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_geometry_reply_t * fexfn_pack_xcb_get_geometry_reply(xcb_connection_t * a_0,xcb_get_geometry_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_geometry_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_geometry_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_geometry_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + void *NewPtr = malloc(sizeof(xcb_get_geometry_reply_t)); + memcpy(NewPtr, args.rv, sizeof(xcb_get_geometry_reply_t)); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_intern_atom_reply_t * fexfn_pack_xcb_intern_atom_reply(xcb_connection_t * a_0,xcb_intern_atom_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_intern_atom_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_intern_atom_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_intern_atom_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_property_reply_t * fexfn_pack_xcb_get_property_reply(xcb_connection_t * a_0,xcb_get_property_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_property_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_property_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_property_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + void *NewPtr = malloc(sizeof(xcb_get_property_reply_t)); + memcpy(NewPtr, args.rv, sizeof(xcb_get_property_reply_t)); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_query_tree_reply_t * fexfn_pack_xcb_query_tree_reply(xcb_connection_t * a_0,xcb_query_tree_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_query_tree_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_query_tree_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_query_tree_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_atom_name_reply_t * fexfn_pack_xcb_get_atom_name_reply(xcb_connection_t * a_0,xcb_get_atom_name_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_atom_name_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_atom_name_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_atom_name_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_list_properties_reply_t * fexfn_pack_xcb_list_properties_reply(xcb_connection_t * a_0,xcb_list_properties_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_list_properties_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_list_properties_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_list_properties_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_selection_owner_reply_t * fexfn_pack_xcb_get_selection_owner_reply(xcb_connection_t * a_0,xcb_get_selection_owner_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_selection_owner_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_selection_owner_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_selection_owner_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_grab_pointer_reply_t * fexfn_pack_xcb_grab_pointer_reply(xcb_connection_t * a_0,xcb_grab_pointer_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_grab_pointer_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_grab_pointer_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_grab_pointer_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_grab_keyboard_reply_t * fexfn_pack_xcb_grab_keyboard_reply(xcb_connection_t * a_0,xcb_grab_keyboard_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_grab_keyboard_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_grab_keyboard_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_grab_keyboard_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_query_pointer_reply_t * fexfn_pack_xcb_query_pointer_reply(xcb_connection_t * a_0,xcb_query_pointer_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_query_pointer_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_query_pointer_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_query_pointer_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_motion_events_reply_t * fexfn_pack_xcb_get_motion_events_reply(xcb_connection_t * a_0,xcb_get_motion_events_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_motion_events_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_motion_events_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_motion_events_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_translate_coordinates_reply_t * fexfn_pack_xcb_translate_coordinates_reply(xcb_connection_t * a_0,xcb_translate_coordinates_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_translate_coordinates_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_translate_coordinates_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_translate_coordinates_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_input_focus_reply_t * fexfn_pack_xcb_get_input_focus_reply(xcb_connection_t * a_0,xcb_get_input_focus_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_input_focus_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_input_focus_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_input_focus_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_query_keymap_reply_t * fexfn_pack_xcb_query_keymap_reply(xcb_connection_t * a_0,xcb_query_keymap_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_query_keymap_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_query_keymap_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_query_keymap_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_query_font_reply_t * fexfn_pack_xcb_query_font_reply(xcb_connection_t * a_0,xcb_query_font_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_query_font_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_query_font_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_query_font_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_query_text_extents_reply_t * fexfn_pack_xcb_query_text_extents_reply(xcb_connection_t * a_0,xcb_query_text_extents_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_query_text_extents_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_query_text_extents_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_query_text_extents_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_list_fonts_reply_t * fexfn_pack_xcb_list_fonts_reply(xcb_connection_t * a_0,xcb_list_fonts_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_list_fonts_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_list_fonts_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_list_fonts_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_list_fonts_with_info_reply_t * fexfn_pack_xcb_list_fonts_with_info_reply(xcb_connection_t * a_0,xcb_list_fonts_with_info_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_list_fonts_with_info_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_list_fonts_with_info_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_list_fonts_with_info_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_font_path_reply_t * fexfn_pack_xcb_get_font_path_reply(xcb_connection_t * a_0,xcb_get_font_path_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_font_path_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_font_path_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_font_path_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_image_reply_t * fexfn_pack_xcb_get_image_reply(xcb_connection_t * a_0,xcb_get_image_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_image_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_image_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_image_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_list_installed_colormaps_reply_t * fexfn_pack_xcb_list_installed_colormaps_reply(xcb_connection_t * a_0,xcb_list_installed_colormaps_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_list_installed_colormaps_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_list_installed_colormaps_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_list_installed_colormaps_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_alloc_color_reply_t * fexfn_pack_xcb_alloc_color_reply(xcb_connection_t * a_0,xcb_alloc_color_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_alloc_color_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_alloc_color_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_alloc_color_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_alloc_named_color_reply_t * fexfn_pack_xcb_alloc_named_color_reply(xcb_connection_t * a_0,xcb_alloc_named_color_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_alloc_named_color_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_alloc_named_color_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_alloc_named_color_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_alloc_color_cells_reply_t * fexfn_pack_xcb_alloc_color_cells_reply(xcb_connection_t * a_0,xcb_alloc_color_cells_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_alloc_color_cells_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_alloc_color_cells_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_alloc_color_cells_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_alloc_color_planes_reply_t * fexfn_pack_xcb_alloc_color_planes_reply(xcb_connection_t * a_0,xcb_alloc_color_planes_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_alloc_color_planes_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_alloc_color_planes_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_alloc_color_planes_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_query_colors_reply_t * fexfn_pack_xcb_query_colors_reply(xcb_connection_t * a_0,xcb_query_colors_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_query_colors_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_query_colors_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_query_colors_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_lookup_color_reply_t * fexfn_pack_xcb_lookup_color_reply(xcb_connection_t * a_0,xcb_lookup_color_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_lookup_color_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_lookup_color_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_lookup_color_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_query_best_size_reply_t * fexfn_pack_xcb_query_best_size_reply(xcb_connection_t * a_0,xcb_query_best_size_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_query_best_size_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_query_best_size_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_query_best_size_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_list_extensions_reply_t * fexfn_pack_xcb_list_extensions_reply(xcb_connection_t * a_0,xcb_list_extensions_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_list_extensions_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_list_extensions_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_list_extensions_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_keyboard_mapping_reply_t * fexfn_pack_xcb_get_keyboard_mapping_reply(xcb_connection_t * a_0,xcb_get_keyboard_mapping_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_keyboard_mapping_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_keyboard_mapping_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_keyboard_mapping_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_keyboard_control_reply_t * fexfn_pack_xcb_get_keyboard_control_reply(xcb_connection_t * a_0,xcb_get_keyboard_control_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_keyboard_control_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_keyboard_control_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_keyboard_control_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_pointer_control_reply_t * fexfn_pack_xcb_get_pointer_control_reply(xcb_connection_t * a_0,xcb_get_pointer_control_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_pointer_control_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_pointer_control_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_pointer_control_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_screen_saver_reply_t * fexfn_pack_xcb_get_screen_saver_reply(xcb_connection_t * a_0,xcb_get_screen_saver_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_screen_saver_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_screen_saver_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_screen_saver_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_list_hosts_reply_t * fexfn_pack_xcb_list_hosts_reply(xcb_connection_t * a_0,xcb_list_hosts_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_list_hosts_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_list_hosts_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_list_hosts_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_set_pointer_mapping_reply_t * fexfn_pack_xcb_set_pointer_mapping_reply(xcb_connection_t * a_0,xcb_set_pointer_mapping_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_set_pointer_mapping_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_set_pointer_mapping_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_set_pointer_mapping_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_pointer_mapping_reply_t * fexfn_pack_xcb_get_pointer_mapping_reply(xcb_connection_t * a_0,xcb_get_pointer_mapping_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_pointer_mapping_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_pointer_mapping_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_pointer_mapping_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_set_modifier_mapping_reply_t * fexfn_pack_xcb_set_modifier_mapping_reply(xcb_connection_t * a_0,xcb_set_modifier_mapping_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_set_modifier_mapping_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_set_modifier_mapping_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_set_modifier_mapping_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_get_modifier_mapping_reply_t * fexfn_pack_xcb_get_modifier_mapping_reply(xcb_connection_t * a_0,xcb_get_modifier_mapping_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_get_modifier_mapping_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_get_modifier_mapping_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xcb_get_modifier_mapping_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + xcb_connection_t * xcb_connect(const char * a_0,int * a_2) __attribute__((alias("fexfn_pack_xcb_connect"))); + xcb_connection_t * xcb_connect_to_display_with_auth_info(const char * a_0,xcb_auth_info_t * a_1,int * a_2) __attribute__((alias("fexfn_pack_xcb_connect_to_display_with_auth_info"))); + void xcb_disconnect(xcb_connection_t * a_0) __attribute__((alias("fexfn_pack_xcb_disconnect"))); + int xcb_parse_display(const char * a_0,char ** a_1,int * a_2,int * a_3) __attribute__((alias("fexfn_pack_xcb_parse_display"))); + + xcb_generic_event_t * xcb_wait_for_event(xcb_connection_t * a_0) __attribute__((alias("fexfn_pack_xcb_wait_for_event"))); + xcb_generic_event_t * xcb_poll_for_event(xcb_connection_t * a_0) __attribute__((alias("fexfn_pack_xcb_poll_for_event"))); + xcb_generic_event_t * xcb_poll_for_queued_event(xcb_connection_t * a_0) __attribute__((alias("fexfn_pack_xcb_poll_for_queued_event"))); + xcb_generic_event_t * xcb_poll_for_special_event(xcb_connection_t * a_0,xcb_special_event_t * a_1) __attribute__((alias("fexfn_pack_xcb_poll_for_special_event"))); + xcb_generic_event_t * xcb_wait_for_special_event(xcb_connection_t * a_0,xcb_special_event_t * a_1) __attribute__((alias("fexfn_pack_xcb_wait_for_special_event"))); + xcb_generic_error_t * xcb_request_check(xcb_connection_t * a_0,xcb_void_cookie_t a_1) __attribute__((alias("fexfn_pack_xcb_request_check"))); + + void * xcb_wait_for_reply(xcb_connection_t * a_0, uint32_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_wait_for_reply"))); + void * xcb_wait_for_reply64(xcb_connection_t * a_0,uint64_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_wait_for_reply64"))); + int xcb_poll_for_reply(xcb_connection_t * a_0,unsigned int a_1,void ** a_2,xcb_generic_error_t ** a_3) __attribute__((alias("fexfn_pack_xcb_poll_for_reply"))); + int xcb_poll_for_reply64(xcb_connection_t * a_0,uint64_t a_1,void ** a_2,xcb_generic_error_t ** a_3) __attribute__((alias("fexfn_pack_xcb_poll_for_reply64"))); + + xcb_query_extension_reply_t * xcb_query_extension_reply(xcb_connection_t * a_0,xcb_query_extension_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_query_extension_reply"))); + + xcb_get_window_attributes_reply_t * xcb_get_window_attributes_reply(xcb_connection_t * a_0,xcb_get_window_attributes_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_window_attributes_reply"))); + xcb_get_geometry_reply_t * xcb_get_geometry_reply(xcb_connection_t * a_0,xcb_get_geometry_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_geometry_reply"))); + xcb_intern_atom_reply_t * xcb_intern_atom_reply(xcb_connection_t * a_0,xcb_intern_atom_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_intern_atom_reply"))); + + xcb_get_property_reply_t * xcb_get_property_reply(xcb_connection_t * a_0,xcb_get_property_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_property_reply"))); + xcb_query_tree_reply_t * xcb_query_tree_reply(xcb_connection_t * a_0,xcb_query_tree_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_query_tree_reply"))); + xcb_get_atom_name_reply_t * xcb_get_atom_name_reply(xcb_connection_t * a_0,xcb_get_atom_name_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_atom_name_reply"))); + xcb_list_properties_reply_t * xcb_list_properties_reply(xcb_connection_t * a_0,xcb_list_properties_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_list_properties_reply"))); + xcb_get_selection_owner_reply_t * xcb_get_selection_owner_reply(xcb_connection_t * a_0,xcb_get_selection_owner_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_selection_owner_reply"))); + xcb_grab_pointer_reply_t * xcb_grab_pointer_reply(xcb_connection_t * a_0,xcb_grab_pointer_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_grab_pointer_reply"))); + xcb_grab_keyboard_reply_t * xcb_grab_keyboard_reply(xcb_connection_t * a_0,xcb_grab_keyboard_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_grab_keyboard_reply"))); + xcb_query_pointer_reply_t * xcb_query_pointer_reply(xcb_connection_t * a_0,xcb_query_pointer_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_query_pointer_reply"))); + xcb_get_motion_events_reply_t * xcb_get_motion_events_reply(xcb_connection_t * a_0,xcb_get_motion_events_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_motion_events_reply"))); + xcb_translate_coordinates_reply_t * xcb_translate_coordinates_reply(xcb_connection_t * a_0,xcb_translate_coordinates_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_translate_coordinates_reply"))); + xcb_get_input_focus_reply_t * xcb_get_input_focus_reply(xcb_connection_t * a_0,xcb_get_input_focus_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_input_focus_reply"))); + xcb_query_keymap_reply_t * xcb_query_keymap_reply(xcb_connection_t * a_0,xcb_query_keymap_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_query_keymap_reply"))); + xcb_query_font_reply_t * xcb_query_font_reply(xcb_connection_t * a_0,xcb_query_font_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_query_font_reply"))); + xcb_query_text_extents_reply_t * xcb_query_text_extents_reply(xcb_connection_t * a_0,xcb_query_text_extents_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_query_text_extents_reply"))); + xcb_list_fonts_reply_t * xcb_list_fonts_reply(xcb_connection_t * a_0,xcb_list_fonts_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_list_fonts_reply"))); + xcb_list_fonts_with_info_reply_t * xcb_list_fonts_with_info_reply(xcb_connection_t * a_0,xcb_list_fonts_with_info_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_list_fonts_with_info_reply"))); + xcb_get_font_path_reply_t * xcb_get_font_path_reply(xcb_connection_t * a_0,xcb_get_font_path_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_font_path_reply"))); + xcb_get_image_reply_t * xcb_get_image_reply(xcb_connection_t * a_0,xcb_get_image_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_image_reply"))); + xcb_list_installed_colormaps_reply_t * xcb_list_installed_colormaps_reply(xcb_connection_t * a_0,xcb_list_installed_colormaps_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_list_installed_colormaps_reply"))); + xcb_alloc_color_reply_t * xcb_alloc_color_reply(xcb_connection_t * a_0,xcb_alloc_color_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_alloc_color_reply"))); + xcb_alloc_named_color_reply_t * xcb_alloc_named_color_reply(xcb_connection_t * a_0,xcb_alloc_named_color_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_alloc_named_color_reply"))); + xcb_alloc_color_cells_reply_t * xcb_alloc_color_cells_reply(xcb_connection_t * a_0,xcb_alloc_color_cells_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_alloc_color_cells_reply"))); + xcb_alloc_color_planes_reply_t * xcb_alloc_color_planes_reply(xcb_connection_t * a_0,xcb_alloc_color_planes_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_alloc_color_planes_reply"))); + xcb_query_colors_reply_t * xcb_query_colors_reply(xcb_connection_t * a_0,xcb_query_colors_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_query_colors_reply"))); + xcb_lookup_color_reply_t * xcb_lookup_color_reply(xcb_connection_t * a_0,xcb_lookup_color_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_lookup_color_reply"))); + xcb_query_best_size_reply_t * xcb_query_best_size_reply(xcb_connection_t * a_0,xcb_query_best_size_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_query_best_size_reply"))); + xcb_list_extensions_reply_t * xcb_list_extensions_reply(xcb_connection_t * a_0,xcb_list_extensions_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_list_extensions_reply"))); + xcb_get_keyboard_mapping_reply_t * xcb_get_keyboard_mapping_reply(xcb_connection_t * a_0,xcb_get_keyboard_mapping_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_keyboard_mapping_reply"))); + xcb_get_keyboard_control_reply_t * xcb_get_keyboard_control_reply(xcb_connection_t * a_0,xcb_get_keyboard_control_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_keyboard_control_reply"))); + xcb_get_pointer_control_reply_t * xcb_get_pointer_control_reply(xcb_connection_t * a_0,xcb_get_pointer_control_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_pointer_control_reply"))); + xcb_get_screen_saver_reply_t * xcb_get_screen_saver_reply(xcb_connection_t * a_0,xcb_get_screen_saver_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_screen_saver_reply"))); + xcb_list_hosts_reply_t * xcb_list_hosts_reply(xcb_connection_t * a_0,xcb_list_hosts_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_list_hosts_reply"))); + xcb_set_pointer_mapping_reply_t * xcb_set_pointer_mapping_reply(xcb_connection_t * a_0,xcb_set_pointer_mapping_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_set_pointer_mapping_reply"))); + xcb_get_pointer_mapping_reply_t * xcb_get_pointer_mapping_reply(xcb_connection_t * a_0,xcb_get_pointer_mapping_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_pointer_mapping_reply"))); + xcb_set_modifier_mapping_reply_t * xcb_set_modifier_mapping_reply(xcb_connection_t * a_0,xcb_set_modifier_mapping_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_set_modifier_mapping_reply"))); + xcb_get_modifier_mapping_reply_t * xcb_get_modifier_mapping_reply(xcb_connection_t * a_0,xcb_get_modifier_mapping_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_get_modifier_mapping_reply"))); +} + +struct { + #include "callback_unpacks_header.inl" +} callback_unpacks = { + #include "callback_unpacks_header_init.inl" +}; + +LOAD_LIB_WITH_CALLBACKS_INIT(libxcb, init_lib) diff --git a/ThunkLibs/libxcb/libxcb_Host.cpp b/ThunkLibs/libxcb/libxcb_Host.cpp new file mode 100644 index 000000000..59e2aef9f --- /dev/null +++ b/ThunkLibs/libxcb/libxcb_Host.cpp @@ -0,0 +1,139 @@ +/* +$info$ +tags: thunklibs|xcb +$end_info$ +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "common/CrossArchEvent.h" +#include "common/Host.h" +#include +#include + +using CBType = void (*)(void *closure); + +#include "callback_structs.inl" +#include "WorkEventData.h" +#include "callback_typedefs.inl" + +struct { + #include "callback_unpacks_header.inl" +} *callback_unpacks; + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + +struct xcb_take_socket_CB_args { + xcb_connection_t * conn; + CBType CBFunction; + void *closure; +}; + +CrossArchEvent *WaitForWork{}; +CrossArchEvent *WorkDone{}; +CBWork *Work{}; + +void fexfn_unpack_libxcb_FEX_xcb_init_extension(void *argsv); +static std::unordered_map CBArgs{}; + +void fexfn_unpack_libxcb_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +void fexfn_unpack_libxcb_FEX_GiveEvents(void *argsv){ + struct arg_t { + CrossArchEvent *WaitForWork; + CrossArchEvent *WorkDone; + CBWork* Work; + }; + + auto args = (arg_t*)argsv; + WaitForWork = args->WaitForWork; + WorkDone = args->WorkDone; + Work = args->Work; +} + +static void xcb_take_socket_cb(void *closure) { + xcb_take_socket_CB_args *Args = (xcb_take_socket_CB_args *)closure; + + // Signalling to the guest thread like this allows us to call the callback function from any thread without + // creating spurious thread objects inside of FEX + Work->cb = (uintptr_t)Args->CBFunction; + Work->argsv = Args->closure; + // Tell the thread it has work + NotifyWorkFunc(WaitForWork); + // Wait for the work to be done + WaitForWorkFunc(WorkDone); +} + +int fexfn_impl_libxcb_xcb_take_socket_internal(xcb_connection_t * a_0, CBType a_1, void * a_2, int a_3, uint64_t * a_4){ + xcb_take_socket_CB_args Args{}; + Args.conn = a_0; + Args.CBFunction = a_1; + Args.closure = a_2; + + auto Res = CBArgs.insert_or_assign(a_0, Args); + + return fexldr_ptr_libxcb_xcb_take_socket + (a_0, + xcb_take_socket_cb, + &Res.first->second, + a_3, + a_4); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_unpack_libxcb_FEX_xcb_init_extension(void *argsv){ + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + + if (strcmp(args->a_1->name, "BIG-REQUESTS") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_so, "xcb_big_requests_id"); + } + else if (strcmp(args->a_1->name, "XC-MISC") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_so, "xcb_xc_misc_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + if (!ext) { + fprintf(stderr, "Couldn't find extension symbol: '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} + +EXPORTS_WITH_CALLBACKS(libxcb) From 7bf8d09391f0b3e3820d750d088822a4448607b8 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:12:46 -0700 Subject: [PATCH 07/20] Thunks: Adds libxcb_dri2 --- ThunkLibs/Generators/libxcb_dri2.py | 80 ++++ ThunkLibs/libxcb_dri2/libxcb_dri2_Guest.cpp | 385 ++++++++++++++++++++ ThunkLibs/libxcb_dri2/libxcb_dri2_Host.cpp | 65 ++++ 3 files changed, 530 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb_dri2.py create mode 100644 ThunkLibs/libxcb_dri2/libxcb_dri2_Guest.cpp create mode 100644 ThunkLibs/libxcb_dri2/libxcb_dri2_Host.cpp diff --git a/ThunkLibs/Generators/libxcb_dri2.py b/ThunkLibs/Generators/libxcb_dri2.py new file mode 100644 index 000000000..45c471499 --- /dev/null +++ b/ThunkLibs/Generators/libxcb_dri2.py @@ -0,0 +1,80 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib_with_filename("libxcb_dri2", "libxcb-dri2") + +# FEX +fn("void FEX_xcb_dri2_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("void xcb_dri2_dri2_buffer_next(xcb_dri2_dri2_buffer_iterator_t *)") +fn("xcb_generic_iterator_t xcb_dri2_dri2_buffer_end(xcb_dri2_dri2_buffer_iterator_t)") +fn("void xcb_dri2_attach_format_next(xcb_dri2_attach_format_iterator_t *)") +fn("xcb_generic_iterator_t xcb_dri2_attach_format_end(xcb_dri2_attach_format_iterator_t)") +fn("xcb_dri2_query_version_cookie_t xcb_dri2_query_version(xcb_connection_t *, uint32_t, uint32_t)") +fn("xcb_dri2_query_version_cookie_t xcb_dri2_query_version_unchecked(xcb_connection_t *, uint32_t, uint32_t)") +fn("xcb_dri2_query_version_reply_t * xcb_dri2_query_version_reply(xcb_connection_t *, xcb_dri2_query_version_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_dri2_connect_sizeof(const void *)") +fn("xcb_dri2_connect_cookie_t xcb_dri2_connect(xcb_connection_t *, xcb_window_t, uint32_t)"); no_pack() +fn("xcb_dri2_connect_cookie_t xcb_dri2_connect_unchecked(xcb_connection_t *, xcb_window_t, uint32_t)"); no_pack() +# ::Iterator:: +fn("char * xcb_dri2_connect_driver_name(const xcb_dri2_connect_reply_t *)") +fn("int xcb_dri2_connect_driver_name_length(const xcb_dri2_connect_reply_t *)") +fn("xcb_generic_iterator_t xcb_dri2_connect_driver_name_end(const xcb_dri2_connect_reply_t *)") +# ::Iterator:: +fn("void * xcb_dri2_connect_alignment_pad(const xcb_dri2_connect_reply_t *)") +fn("int xcb_dri2_connect_alignment_pad_length(const xcb_dri2_connect_reply_t *)") +fn("xcb_generic_iterator_t xcb_dri2_connect_alignment_pad_end(const xcb_dri2_connect_reply_t *)") +# ::Iterator:: +fn("char * xcb_dri2_connect_device_name(const xcb_dri2_connect_reply_t *)") +fn("int xcb_dri2_connect_device_name_length(const xcb_dri2_connect_reply_t *)") +fn("xcb_generic_iterator_t xcb_dri2_connect_device_name_end(const xcb_dri2_connect_reply_t *)") +fn("xcb_dri2_connect_reply_t * xcb_dri2_connect_reply(xcb_connection_t *, xcb_dri2_connect_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_dri2_authenticate_cookie_t xcb_dri2_authenticate(xcb_connection_t *, xcb_window_t, uint32_t)") +fn("xcb_dri2_authenticate_cookie_t xcb_dri2_authenticate_unchecked(xcb_connection_t *, xcb_window_t, uint32_t)") +fn("xcb_dri2_authenticate_reply_t * xcb_dri2_authenticate_reply(xcb_connection_t *, xcb_dri2_authenticate_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_dri2_create_drawable_checked(xcb_connection_t *, xcb_drawable_t)") +fn("xcb_void_cookie_t xcb_dri2_create_drawable(xcb_connection_t *, xcb_drawable_t)") +fn("xcb_void_cookie_t xcb_dri2_destroy_drawable_checked(xcb_connection_t *, xcb_drawable_t)") +fn("xcb_void_cookie_t xcb_dri2_destroy_drawable(xcb_connection_t *, xcb_drawable_t)") +fn("int xcb_dri2_get_buffers_sizeof(const void *, uint32_t)") +fn("xcb_dri2_get_buffers_cookie_t xcb_dri2_get_buffers(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, const uint32_t *)") +fn("xcb_dri2_get_buffers_cookie_t xcb_dri2_get_buffers_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, const uint32_t *)") +# ::Iterator:: +fn("xcb_dri2_dri2_buffer_t * xcb_dri2_get_buffers_buffers(const xcb_dri2_get_buffers_reply_t *)") +fn("int xcb_dri2_get_buffers_buffers_length(const xcb_dri2_get_buffers_reply_t *)") +fn("xcb_dri2_dri2_buffer_iterator_t xcb_dri2_get_buffers_buffers_iterator(const xcb_dri2_get_buffers_reply_t *)") + +fn("xcb_dri2_get_buffers_reply_t * xcb_dri2_get_buffers_reply(xcb_connection_t *, xcb_dri2_get_buffers_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_dri2_copy_region_cookie_t xcb_dri2_copy_region(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, uint32_t)") +fn("xcb_dri2_copy_region_cookie_t xcb_dri2_copy_region_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, uint32_t)") +fn("xcb_dri2_copy_region_reply_t * xcb_dri2_copy_region_reply(xcb_connection_t *, xcb_dri2_copy_region_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_dri2_get_buffers_with_format_sizeof(const void *, uint32_t)") +fn("xcb_dri2_get_buffers_with_format_cookie_t xcb_dri2_get_buffers_with_format(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, const xcb_dri2_attach_format_t *)") +fn("xcb_dri2_get_buffers_with_format_cookie_t xcb_dri2_get_buffers_with_format_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, const xcb_dri2_attach_format_t *)") +# ::Iterator:: +fn("xcb_dri2_dri2_buffer_t * xcb_dri2_get_buffers_with_format_buffers(const xcb_dri2_get_buffers_with_format_reply_t *)") +fn("int xcb_dri2_get_buffers_with_format_buffers_length(const xcb_dri2_get_buffers_with_format_reply_t *)") +fn("xcb_dri2_dri2_buffer_iterator_t xcb_dri2_get_buffers_with_format_buffers_iterator(const xcb_dri2_get_buffers_with_format_reply_t *)") + +fn("xcb_dri2_get_buffers_with_format_reply_t * xcb_dri2_get_buffers_with_format_reply(xcb_connection_t *, xcb_dri2_get_buffers_with_format_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_dri2_swap_buffers_cookie_t xcb_dri2_swap_buffers(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)") +fn("xcb_dri2_swap_buffers_cookie_t xcb_dri2_swap_buffers_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)") +fn("xcb_dri2_swap_buffers_reply_t * xcb_dri2_swap_buffers_reply(xcb_connection_t *, xcb_dri2_swap_buffers_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_dri2_get_msc_cookie_t xcb_dri2_get_msc(xcb_connection_t *, xcb_drawable_t)") +fn("xcb_dri2_get_msc_cookie_t xcb_dri2_get_msc_unchecked(xcb_connection_t *, xcb_drawable_t)") +fn("xcb_dri2_get_msc_reply_t * xcb_dri2_get_msc_reply(xcb_connection_t *, xcb_dri2_get_msc_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_dri2_wait_msc_cookie_t xcb_dri2_wait_msc(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)") +fn("xcb_dri2_wait_msc_cookie_t xcb_dri2_wait_msc_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t)") +fn("xcb_dri2_wait_msc_reply_t * xcb_dri2_wait_msc_reply(xcb_connection_t *, xcb_dri2_wait_msc_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_dri2_wait_sbc_cookie_t xcb_dri2_wait_sbc(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t)") +fn("xcb_dri2_wait_sbc_cookie_t xcb_dri2_wait_sbc_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t, uint32_t)") +fn("xcb_dri2_wait_sbc_reply_t * xcb_dri2_wait_sbc_reply(xcb_connection_t *, xcb_dri2_wait_sbc_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_dri2_swap_interval_checked(xcb_connection_t *, xcb_drawable_t, uint32_t)") +fn("xcb_void_cookie_t xcb_dri2_swap_interval(xcb_connection_t *, xcb_drawable_t, uint32_t)") +fn("xcb_dri2_get_param_cookie_t xcb_dri2_get_param(xcb_connection_t *, xcb_drawable_t, uint32_t)") +fn("xcb_dri2_get_param_cookie_t xcb_dri2_get_param_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t)") +fn("xcb_dri2_get_param_reply_t * xcb_dri2_get_param_reply(xcb_connection_t *, xcb_dri2_get_param_cookie_t, xcb_generic_error_t **)"); no_pack() + +Generate() diff --git a/ThunkLibs/libxcb_dri2/libxcb_dri2_Guest.cpp b/ThunkLibs/libxcb_dri2/libxcb_dri2_Guest.cpp new file mode 100644 index 000000000..7d6326205 --- /dev/null +++ b/ThunkLibs/libxcb_dri2/libxcb_dri2_Guest.cpp @@ -0,0 +1,385 @@ +/* +$info$ +tags: thunklibs|xcb-dri2 +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + + +extern "C" { + xcb_extension_t xcb_dri2_id = { + .name = "DRI2", + .global_id = 0, + }; + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_dri2_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_dri2_FEX_usable_size(&args); + return args.rv; + } + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_dri2_init_extension(c, &xcb_dri2_id); + } + + static xcb_dri2_connect_cookie_t fexfn_pack_xcb_dri2_connect(xcb_connection_t * a_0,xcb_window_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;xcb_window_t a_1;uint32_t a_2;xcb_dri2_connect_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_connect(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_dri2_connect_cookie_t fexfn_pack_xcb_dri2_connect_unchecked(xcb_connection_t * a_0,xcb_window_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;xcb_window_t a_1;uint32_t a_2;xcb_dri2_connect_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_connect_unchecked(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_dri2_query_version_reply_t * fexfn_pack_xcb_dri2_query_version_reply(xcb_connection_t * a_0,xcb_dri2_query_version_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_query_version_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_query_version_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_query_version_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_connect_reply_t * fexfn_pack_xcb_dri2_connect_reply(xcb_connection_t * a_0,xcb_dri2_connect_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_connect_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_connect_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_connect_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_authenticate_reply_t * fexfn_pack_xcb_dri2_authenticate_reply(xcb_connection_t * a_0,xcb_dri2_authenticate_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_authenticate_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_authenticate_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_authenticate_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_get_buffers_reply_t * fexfn_pack_xcb_dri2_get_buffers_reply(xcb_connection_t * a_0,xcb_dri2_get_buffers_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_get_buffers_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_get_buffers_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_get_buffers_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_copy_region_reply_t * fexfn_pack_xcb_dri2_copy_region_reply(xcb_connection_t * a_0,xcb_dri2_copy_region_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_copy_region_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_copy_region_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_copy_region_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_get_buffers_with_format_reply_t * fexfn_pack_xcb_dri2_get_buffers_with_format_reply(xcb_connection_t * a_0,xcb_dri2_get_buffers_with_format_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_get_buffers_with_format_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_get_buffers_with_format_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_get_buffers_with_format_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_swap_buffers_reply_t * fexfn_pack_xcb_dri2_swap_buffers_reply(xcb_connection_t * a_0,xcb_dri2_swap_buffers_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_swap_buffers_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_swap_buffers_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_swap_buffers_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_get_msc_reply_t * fexfn_pack_xcb_dri2_get_msc_reply(xcb_connection_t * a_0,xcb_dri2_get_msc_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_get_msc_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_get_msc_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_get_msc_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_wait_msc_reply_t * fexfn_pack_xcb_dri2_wait_msc_reply(xcb_connection_t * a_0,xcb_dri2_wait_msc_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_wait_msc_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_wait_msc_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_wait_msc_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_wait_sbc_reply_t * fexfn_pack_xcb_dri2_wait_sbc_reply(xcb_connection_t * a_0,xcb_dri2_wait_sbc_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_wait_sbc_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_wait_sbc_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_wait_sbc_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri2_get_param_reply_t * fexfn_pack_xcb_dri2_get_param_reply(xcb_connection_t * a_0,xcb_dri2_get_param_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri2_get_param_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri2_get_param_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri2_xcb_dri2_get_param_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + xcb_dri2_connect_cookie_t xcb_dri2_connect(xcb_connection_t * a_0,xcb_window_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_dri2_connect"))); + xcb_dri2_connect_cookie_t xcb_dri2_connect_unchecked(xcb_connection_t * a_0,xcb_window_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_dri2_connect_unchecked"))); + xcb_dri2_query_version_reply_t * xcb_dri2_query_version_reply(xcb_connection_t * a_0,xcb_dri2_query_version_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_query_version_reply"))); + xcb_dri2_connect_reply_t * xcb_dri2_connect_reply(xcb_connection_t * a_0,xcb_dri2_connect_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_connect_reply"))); + xcb_dri2_authenticate_reply_t * xcb_dri2_authenticate_reply(xcb_connection_t * a_0,xcb_dri2_authenticate_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_authenticate_reply"))); + xcb_dri2_get_buffers_reply_t * xcb_dri2_get_buffers_reply(xcb_connection_t * a_0,xcb_dri2_get_buffers_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_get_buffers_reply"))); + xcb_dri2_copy_region_reply_t * xcb_dri2_copy_region_reply(xcb_connection_t * a_0,xcb_dri2_copy_region_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_copy_region_reply"))); + xcb_dri2_get_buffers_with_format_reply_t * xcb_dri2_get_buffers_with_format_reply(xcb_connection_t * a_0,xcb_dri2_get_buffers_with_format_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_get_buffers_with_format_reply"))); + xcb_dri2_swap_buffers_reply_t * xcb_dri2_swap_buffers_reply(xcb_connection_t * a_0,xcb_dri2_swap_buffers_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_swap_buffers_reply"))); + xcb_dri2_get_msc_reply_t * xcb_dri2_get_msc_reply(xcb_connection_t * a_0,xcb_dri2_get_msc_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_get_msc_reply"))); + xcb_dri2_wait_msc_reply_t * xcb_dri2_wait_msc_reply(xcb_connection_t * a_0,xcb_dri2_wait_msc_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_wait_msc_reply"))); + xcb_dri2_wait_sbc_reply_t * xcb_dri2_wait_sbc_reply(xcb_connection_t * a_0,xcb_dri2_wait_sbc_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_wait_sbc_reply"))); + xcb_dri2_get_param_reply_t * xcb_dri2_get_param_reply(xcb_connection_t * a_0,xcb_dri2_get_param_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri2_get_param_reply"))); +} + +LOAD_LIB(libxcb_dri2) diff --git a/ThunkLibs/libxcb_dri2/libxcb_dri2_Host.cpp b/ThunkLibs/libxcb_dri2/libxcb_dri2_Host.cpp new file mode 100644 index 000000000..757536ad4 --- /dev/null +++ b/ThunkLibs/libxcb_dri2/libxcb_dri2_Host.cpp @@ -0,0 +1,65 @@ +/* +$info$ +tags: thunklibs|xcb-dri2 +$end_info$ +*/ + +#include +#include + +#include +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + +void fexfn_unpack_libxcb_dri2_FEX_xcb_dri2_init_extension(void *argsv); + +void fexfn_unpack_libxcb_dri2_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_dri2_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_unpack_libxcb_dri2_FEX_xcb_dri2_init_extension(void *argsv){ + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + if (strcmp(args->a_1->name, "DRI2") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_dri2_so, "xcb_dri2_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + typedef const struct xcb_query_extension_reply_t * fexldr_type_libxcb_xcb_get_extension_data(xcb_connection_t * a_0,xcb_extension_t * a_1); + fexldr_type_libxcb_xcb_get_extension_data *fexldr_ptr_libxcb_xcb_get_extension_data; + + fexldr_ptr_libxcb_xcb_get_extension_data = (fexldr_type_libxcb_xcb_get_extension_data*)dlsym(RTLD_DEFAULT, "xcb_get_extension_data"); + + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} + +EXPORTS(libxcb_dri2) From 3ea8e4864d3c1aec47ff58d5530c1bfc7c62066a Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:13:01 -0700 Subject: [PATCH 08/20] Thunks: Adds libxcb_dri3 --- ThunkLibs/Generators/libxcb_dri3.py | 68 ++++++ ThunkLibs/libxcb_dri3/libxcb_dri3_Guest.cpp | 239 ++++++++++++++++++++ ThunkLibs/libxcb_dri3/libxcb_dri3_Host.cpp | 66 ++++++ 3 files changed, 373 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb_dri3.py create mode 100644 ThunkLibs/libxcb_dri3/libxcb_dri3_Guest.cpp create mode 100644 ThunkLibs/libxcb_dri3/libxcb_dri3_Host.cpp diff --git a/ThunkLibs/Generators/libxcb_dri3.py b/ThunkLibs/Generators/libxcb_dri3.py new file mode 100644 index 000000000..efa5aba47 --- /dev/null +++ b/ThunkLibs/Generators/libxcb_dri3.py @@ -0,0 +1,68 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib_with_filename("libxcb_dri3", "libxcb-dri3") + +# FEX +fn("void FEX_xcb_dri3_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("xcb_dri3_query_version_cookie_t xcb_dri3_query_version(xcb_connection_t *, uint32_t, uint32_t)"); no_pack() +fn("xcb_dri3_query_version_cookie_t xcb_dri3_query_version_unchecked(xcb_connection_t *, uint32_t, uint32_t)"); no_pack() +fn("xcb_dri3_query_version_reply_t * xcb_dri3_query_version_reply(xcb_connection_t *, xcb_dri3_query_version_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_dri3_open_cookie_t xcb_dri3_open(xcb_connection_t *, xcb_drawable_t, uint32_t)") +fn("xcb_dri3_open_cookie_t xcb_dri3_open_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t)") +fn("xcb_dri3_open_reply_t * xcb_dri3_open_reply(xcb_connection_t *, xcb_dri3_open_cookie_t, xcb_generic_error_t **)"); no_pack() +# XXX: Who owns result? +fn("int * xcb_dri3_open_reply_fds(xcb_connection_t *, xcb_dri3_open_reply_t *)") +fn("xcb_void_cookie_t xcb_dri3_pixmap_from_buffer_checked(xcb_connection_t *, xcb_pixmap_t, xcb_drawable_t, uint32_t, uint16_t, uint16_t, uint16_t, uint8_t, uint8_t, int32_t)") +fn("xcb_void_cookie_t xcb_dri3_pixmap_from_buffer(xcb_connection_t *, xcb_pixmap_t, xcb_drawable_t, uint32_t, uint16_t, uint16_t, uint16_t, uint8_t, uint8_t, int32_t)") +fn("xcb_dri3_buffer_from_pixmap_cookie_t xcb_dri3_buffer_from_pixmap(xcb_connection_t *, xcb_pixmap_t)") +fn("xcb_dri3_buffer_from_pixmap_cookie_t xcb_dri3_buffer_from_pixmap_unchecked(xcb_connection_t *, xcb_pixmap_t)") +fn("xcb_dri3_buffer_from_pixmap_reply_t * xcb_dri3_buffer_from_pixmap_reply(xcb_connection_t *, xcb_dri3_buffer_from_pixmap_cookie_t, xcb_generic_error_t **)") ; no_pack() +# XXX: Who owns result? +fn("int * xcb_dri3_buffer_from_pixmap_reply_fds(xcb_connection_t *, xcb_dri3_buffer_from_pixmap_reply_t *)") +fn("xcb_void_cookie_t xcb_dri3_fence_from_fd_checked(xcb_connection_t *, xcb_drawable_t, uint32_t, uint8_t, int32_t)") +fn("xcb_void_cookie_t xcb_dri3_fence_from_fd(xcb_connection_t *, xcb_drawable_t, uint32_t, uint8_t, int32_t)") +fn("xcb_dri3_fd_from_fence_cookie_t xcb_dri3_fd_from_fence(xcb_connection_t *, xcb_drawable_t, uint32_t)") +fn("xcb_dri3_fd_from_fence_cookie_t xcb_dri3_fd_from_fence_unchecked(xcb_connection_t *, xcb_drawable_t, uint32_t)") +fn("xcb_dri3_fd_from_fence_reply_t * xcb_dri3_fd_from_fence_reply(xcb_connection_t *, xcb_dri3_fd_from_fence_cookie_t, xcb_generic_error_t **)"); no_pack() +# XXX: Who owns result? +fn("int * xcb_dri3_fd_from_fence_reply_fds(xcb_connection_t *, xcb_dri3_fd_from_fence_reply_t *)") +fn("int xcb_dri3_get_supported_modifiers_sizeof(const void *)") +fn("xcb_dri3_get_supported_modifiers_cookie_t xcb_dri3_get_supported_modifiers(xcb_connection_t *, uint32_t, uint8_t, uint8_t)") +fn("xcb_dri3_get_supported_modifiers_cookie_t xcb_dri3_get_supported_modifiers_unchecked(xcb_connection_t *, uint32_t, uint8_t, uint8_t)") +# ::Iterator:: +fn("uint64_t * xcb_dri3_get_supported_modifiers_window_modifiers(const xcb_dri3_get_supported_modifiers_reply_t *)") +fn("int xcb_dri3_get_supported_modifiers_window_modifiers_length(const xcb_dri3_get_supported_modifiers_reply_t *)") +fn("xcb_generic_iterator_t xcb_dri3_get_supported_modifiers_window_modifiers_end(const xcb_dri3_get_supported_modifiers_reply_t *)") +# ::Iterator:: +fn("uint64_t * xcb_dri3_get_supported_modifiers_screen_modifiers(const xcb_dri3_get_supported_modifiers_reply_t *)") +fn("int xcb_dri3_get_supported_modifiers_screen_modifiers_length(const xcb_dri3_get_supported_modifiers_reply_t *)") +fn("xcb_generic_iterator_t xcb_dri3_get_supported_modifiers_screen_modifiers_end(const xcb_dri3_get_supported_modifiers_reply_t *)") + +fn("xcb_dri3_get_supported_modifiers_reply_t * xcb_dri3_get_supported_modifiers_reply(xcb_connection_t *, xcb_dri3_get_supported_modifiers_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_dri3_pixmap_from_buffers_checked(xcb_connection_t *, xcb_pixmap_t, xcb_window_t, uint8_t, uint16_t, uint16_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t, uint64_t, const int32_t *)") +fn("xcb_void_cookie_t xcb_dri3_pixmap_from_buffers(xcb_connection_t *, xcb_pixmap_t, xcb_window_t, uint8_t, uint16_t, uint16_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t, uint64_t, const int32_t *)") +fn("int xcb_dri3_buffers_from_pixmap_sizeof(const void *, int32_t)") +fn("xcb_dri3_buffers_from_pixmap_cookie_t xcb_dri3_buffers_from_pixmap(xcb_connection_t *, xcb_pixmap_t)") +fn("xcb_dri3_buffers_from_pixmap_cookie_t xcb_dri3_buffers_from_pixmap_unchecked(xcb_connection_t *, xcb_pixmap_t)") +# ::Iterator:: +fn("uint32_t * xcb_dri3_buffers_from_pixmap_strides(const xcb_dri3_buffers_from_pixmap_reply_t *)") +fn("int xcb_dri3_buffers_from_pixmap_strides_length(const xcb_dri3_buffers_from_pixmap_reply_t *)") +fn("xcb_generic_iterator_t xcb_dri3_buffers_from_pixmap_strides_end(const xcb_dri3_buffers_from_pixmap_reply_t *)") +# ::Iterator:: +fn("uint32_t * xcb_dri3_buffers_from_pixmap_offsets(const xcb_dri3_buffers_from_pixmap_reply_t *)") +fn("int xcb_dri3_buffers_from_pixmap_offsets_length(const xcb_dri3_buffers_from_pixmap_reply_t *)") +fn("xcb_generic_iterator_t xcb_dri3_buffers_from_pixmap_offsets_end(const xcb_dri3_buffers_from_pixmap_reply_t *)") +# ::Iterator:: +fn("int32_t * xcb_dri3_buffers_from_pixmap_buffers(const xcb_dri3_buffers_from_pixmap_reply_t *)") +fn("int xcb_dri3_buffers_from_pixmap_buffers_length(const xcb_dri3_buffers_from_pixmap_reply_t *)") +fn("xcb_generic_iterator_t xcb_dri3_buffers_from_pixmap_buffers_end(const xcb_dri3_buffers_from_pixmap_reply_t *)") + +fn("xcb_dri3_buffers_from_pixmap_reply_t * xcb_dri3_buffers_from_pixmap_reply(xcb_connection_t *, xcb_dri3_buffers_from_pixmap_cookie_t, xcb_generic_error_t **)"); no_pack() +# XXX: Who owns result? +fn("int * xcb_dri3_buffers_from_pixmap_reply_fds(xcb_connection_t *, xcb_dri3_buffers_from_pixmap_reply_t *)") + +Generate() diff --git a/ThunkLibs/libxcb_dri3/libxcb_dri3_Guest.cpp b/ThunkLibs/libxcb_dri3/libxcb_dri3_Guest.cpp new file mode 100644 index 000000000..288d96014 --- /dev/null +++ b/ThunkLibs/libxcb_dri3/libxcb_dri3_Guest.cpp @@ -0,0 +1,239 @@ +/* +$info$ +tags: thunklibs|xcb-dri3 +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { + xcb_extension_t xcb_dri3_id = { + .name = "DRI3", + .global_id = 0, + }; + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_dri3_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_dri3_FEX_usable_size(&args); + return args.rv; + } + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_dri3_init_extension(c, &xcb_dri3_id); + } + + static xcb_dri3_query_version_cookie_t fexfn_pack_xcb_dri3_query_version(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;uint32_t a_2;xcb_dri3_query_version_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri3_xcb_dri3_query_version(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_dri3_query_version_cookie_t fexfn_pack_xcb_dri3_query_version_unchecked(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;uint32_t a_2;xcb_dri3_query_version_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri3_xcb_dri3_query_version_unchecked(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_dri3_query_version_reply_t * fexfn_pack_xcb_dri3_query_version_reply(xcb_connection_t * a_0,xcb_dri3_query_version_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri3_query_version_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri3_query_version_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri3_xcb_dri3_query_version_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri3_open_reply_t * fexfn_pack_xcb_dri3_open_reply(xcb_connection_t * a_0,xcb_dri3_open_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri3_open_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri3_open_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri3_xcb_dri3_open_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri3_buffer_from_pixmap_reply_t * fexfn_pack_xcb_dri3_buffer_from_pixmap_reply(xcb_connection_t * a_0,xcb_dri3_buffer_from_pixmap_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri3_buffer_from_pixmap_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri3_buffer_from_pixmap_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri3_xcb_dri3_buffer_from_pixmap_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri3_fd_from_fence_reply_t * fexfn_pack_xcb_dri3_fd_from_fence_reply(xcb_connection_t * a_0,xcb_dri3_fd_from_fence_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri3_fd_from_fence_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri3_fd_from_fence_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri3_xcb_dri3_fd_from_fence_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri3_get_supported_modifiers_reply_t * fexfn_pack_xcb_dri3_get_supported_modifiers_reply(xcb_connection_t * a_0,xcb_dri3_get_supported_modifiers_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri3_get_supported_modifiers_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri3_get_supported_modifiers_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri3_xcb_dri3_get_supported_modifiers_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_dri3_buffers_from_pixmap_reply_t * fexfn_pack_xcb_dri3_buffers_from_pixmap_reply(xcb_connection_t * a_0,xcb_dri3_buffers_from_pixmap_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_dri3_buffers_from_pixmap_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_dri3_buffers_from_pixmap_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_dri3_xcb_dri3_buffers_from_pixmap_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + xcb_dri3_query_version_cookie_t xcb_dri3_query_version(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_dri3_query_version"))); + xcb_dri3_query_version_cookie_t xcb_dri3_query_version_unchecked(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_dri3_query_version_unchecked"))); + xcb_dri3_query_version_reply_t * xcb_dri3_query_version_reply(xcb_connection_t * a_0,xcb_dri3_query_version_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri3_query_version_reply"))); + xcb_dri3_open_reply_t * xcb_dri3_open_reply(xcb_connection_t * a_0,xcb_dri3_open_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri3_open_reply"))); + xcb_dri3_buffer_from_pixmap_reply_t * xcb_dri3_buffer_from_pixmap_reply(xcb_connection_t * a_0,xcb_dri3_buffer_from_pixmap_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri3_buffer_from_pixmap_reply"))); + xcb_dri3_fd_from_fence_reply_t * xcb_dri3_fd_from_fence_reply(xcb_connection_t * a_0,xcb_dri3_fd_from_fence_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri3_fd_from_fence_reply"))); + xcb_dri3_get_supported_modifiers_reply_t * xcb_dri3_get_supported_modifiers_reply(xcb_connection_t * a_0,xcb_dri3_get_supported_modifiers_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri3_get_supported_modifiers_reply"))); + xcb_dri3_buffers_from_pixmap_reply_t * xcb_dri3_buffers_from_pixmap_reply(xcb_connection_t * a_0,xcb_dri3_buffers_from_pixmap_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_dri3_buffers_from_pixmap_reply"))); +} + +LOAD_LIB(libxcb_dri3) diff --git a/ThunkLibs/libxcb_dri3/libxcb_dri3_Host.cpp b/ThunkLibs/libxcb_dri3/libxcb_dri3_Host.cpp new file mode 100644 index 000000000..5f4bd428f --- /dev/null +++ b/ThunkLibs/libxcb_dri3/libxcb_dri3_Host.cpp @@ -0,0 +1,66 @@ +/* +$info$ +tags: thunklibs|xcb-dri3 +$end_info$ +*/ + +#include +#include + +#include +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + +void fexfn_unpack_libxcb_dri3_FEX_xcb_dri3_init_extension(void *argsv); + +void fexfn_unpack_libxcb_dri3_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_dri3_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + + +#include "ldr.inl" + +void fexfn_unpack_libxcb_dri3_FEX_xcb_dri3_init_extension(void *argsv){ + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + if (strcmp(args->a_1->name, "DRI3") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_dri3_so, "xcb_dri3_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + typedef const struct xcb_query_extension_reply_t * fexldr_type_libxcb_xcb_get_extension_data(xcb_connection_t * a_0,xcb_extension_t * a_1); + fexldr_type_libxcb_xcb_get_extension_data *fexldr_ptr_libxcb_xcb_get_extension_data; + + fexldr_ptr_libxcb_xcb_get_extension_data = (fexldr_type_libxcb_xcb_get_extension_data*)dlsym(RTLD_DEFAULT, "xcb_get_extension_data"); + + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} + +EXPORTS(libxcb_dri3) From 7381240fb6cfc1f1b6d65dfe7daa8865ed89a41f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:13:15 -0700 Subject: [PATCH 09/20] Thunks: Adds libxcb_glx --- ThunkLibs/Generators/libxcb_glx.py | 724 ++++++++++ ThunkLibs/libxcb_glx/Guest.cpp | 2007 ++++++++++++++++++++++++++++ ThunkLibs/libxcb_glx/Host.cpp | 66 + 3 files changed, 2797 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb_glx.py create mode 100644 ThunkLibs/libxcb_glx/Guest.cpp create mode 100644 ThunkLibs/libxcb_glx/Host.cpp diff --git a/ThunkLibs/Generators/libxcb_glx.py b/ThunkLibs/Generators/libxcb_glx.py new file mode 100644 index 000000000..8a45e7065 --- /dev/null +++ b/ThunkLibs/Generators/libxcb_glx.py @@ -0,0 +1,724 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib_with_filename("libxcb_glx", "libxcb-glx") +# FEX +fn("void FEX_xcb_glx_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("void xcb_glx_pixmap_next(xcb_glx_pixmap_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_pixmap_end(xcb_glx_pixmap_iterator_t)") +fn("void xcb_glx_context_next(xcb_glx_context_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_context_end(xcb_glx_context_iterator_t)") +fn("void xcb_glx_pbuffer_next(xcb_glx_pbuffer_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_pbuffer_end(xcb_glx_pbuffer_iterator_t)") +fn("void xcb_glx_window_next(xcb_glx_window_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_window_end(xcb_glx_window_iterator_t)") +fn("void xcb_glx_fbconfig_next(xcb_glx_fbconfig_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_fbconfig_end(xcb_glx_fbconfig_iterator_t)") +fn("void xcb_glx_drawable_next(xcb_glx_drawable_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_drawable_end(xcb_glx_drawable_iterator_t)") +fn("void xcb_glx_float32_next(xcb_glx_float32_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_float32_end(xcb_glx_float32_iterator_t)") +fn("void xcb_glx_float64_next(xcb_glx_float64_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_float64_end(xcb_glx_float64_iterator_t)") +fn("void xcb_glx_bool32_next(xcb_glx_bool32_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_bool32_end(xcb_glx_bool32_iterator_t)") +fn("void xcb_glx_context_tag_next(xcb_glx_context_tag_iterator_t *)") +fn("xcb_generic_iterator_t xcb_glx_context_tag_end(xcb_glx_context_tag_iterator_t)") +fn("int xcb_glx_render_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_glx_render_checked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, const uint8_t *)") +fn("xcb_void_cookie_t xcb_glx_render(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, const uint8_t *)") +# ::Iterator:: +fn("uint8_t * xcb_glx_render_data(const xcb_glx_render_request_t *)") +fn("int xcb_glx_render_data_length(const xcb_glx_render_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_render_data_end(const xcb_glx_render_request_t *)") + +fn("int xcb_glx_render_large_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_render_large_checked(xcb_connection_t *, xcb_glx_context_tag_t, uint16_t, uint16_t, uint32_t, const uint8_t *)") +fn("xcb_void_cookie_t xcb_glx_render_large(xcb_connection_t *, xcb_glx_context_tag_t, uint16_t, uint16_t, uint32_t, const uint8_t *)") +fn("uint8_t * xcb_glx_render_large_data(const xcb_glx_render_large_request_t *)") +fn("int xcb_glx_render_large_data_length(const xcb_glx_render_large_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_render_large_data_end(const xcb_glx_render_large_request_t *)") +fn("xcb_void_cookie_t xcb_glx_create_context_checked(xcb_connection_t *, xcb_glx_context_t, xcb_visualid_t, uint32_t, xcb_glx_context_t, uint8_t)"); no_pack() +fn("xcb_void_cookie_t xcb_glx_create_context(xcb_connection_t *, xcb_glx_context_t, xcb_visualid_t, uint32_t, xcb_glx_context_t, uint8_t)"); no_pack() +fn("xcb_void_cookie_t xcb_glx_destroy_context_checked(xcb_connection_t *, xcb_glx_context_t)") +fn("xcb_void_cookie_t xcb_glx_destroy_context(xcb_connection_t *, xcb_glx_context_t)") +fn("xcb_glx_make_current_cookie_t xcb_glx_make_current(xcb_connection_t *, xcb_glx_drawable_t, xcb_glx_context_t, xcb_glx_context_tag_t)") +fn("xcb_glx_make_current_cookie_t xcb_glx_make_current_unchecked(xcb_connection_t *, xcb_glx_drawable_t, xcb_glx_context_t, xcb_glx_context_tag_t)") +fn("xcb_glx_make_current_reply_t * xcb_glx_make_current_reply(xcb_connection_t *, xcb_glx_make_current_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_is_direct_cookie_t xcb_glx_is_direct(xcb_connection_t *, xcb_glx_context_t)") +fn("xcb_glx_is_direct_cookie_t xcb_glx_is_direct_unchecked(xcb_connection_t *, xcb_glx_context_t)") +fn("xcb_glx_is_direct_reply_t * xcb_glx_is_direct_reply(xcb_connection_t *, xcb_glx_is_direct_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_query_version_cookie_t xcb_glx_query_version(xcb_connection_t *, uint32_t, uint32_t)") +fn("xcb_glx_query_version_cookie_t xcb_glx_query_version_unchecked(xcb_connection_t *, uint32_t, uint32_t)") +fn("xcb_glx_query_version_reply_t * xcb_glx_query_version_reply(xcb_connection_t *, xcb_glx_query_version_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_glx_wait_gl_checked(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_wait_gl(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_wait_x_checked(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_wait_x(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_copy_context_checked(xcb_connection_t *, xcb_glx_context_t, xcb_glx_context_t, uint32_t, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_copy_context(xcb_connection_t *, xcb_glx_context_t, xcb_glx_context_t, uint32_t, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_swap_buffers_checked(xcb_connection_t *, xcb_glx_context_tag_t, xcb_glx_drawable_t)") +fn("xcb_void_cookie_t xcb_glx_swap_buffers(xcb_connection_t *, xcb_glx_context_tag_t, xcb_glx_drawable_t)") +fn("xcb_void_cookie_t xcb_glx_use_x_font_checked(xcb_connection_t *, xcb_glx_context_tag_t, xcb_font_t, uint32_t, uint32_t, uint32_t)") +fn("xcb_void_cookie_t xcb_glx_use_x_font(xcb_connection_t *, xcb_glx_context_tag_t, xcb_font_t, uint32_t, uint32_t, uint32_t)") +fn("xcb_void_cookie_t xcb_glx_create_glx_pixmap_checked(xcb_connection_t *, uint32_t, xcb_visualid_t, xcb_pixmap_t, xcb_glx_pixmap_t)") +fn("xcb_void_cookie_t xcb_glx_create_glx_pixmap(xcb_connection_t *, uint32_t, xcb_visualid_t, xcb_pixmap_t, xcb_glx_pixmap_t)") +fn("int xcb_glx_get_visual_configs_sizeof(const void *)") +fn("xcb_glx_get_visual_configs_cookie_t xcb_glx_get_visual_configs(xcb_connection_t *, uint32_t)") +fn("xcb_glx_get_visual_configs_cookie_t xcb_glx_get_visual_configs_unchecked(xcb_connection_t *, uint32_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_get_visual_configs_property_list(const xcb_glx_get_visual_configs_reply_t *)") +fn("int xcb_glx_get_visual_configs_property_list_length(const xcb_glx_get_visual_configs_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_visual_configs_property_list_end(const xcb_glx_get_visual_configs_reply_t *)") + +fn("xcb_glx_get_visual_configs_reply_t * xcb_glx_get_visual_configs_reply(xcb_connection_t *, xcb_glx_get_visual_configs_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_glx_destroy_glx_pixmap_checked(xcb_connection_t *, xcb_glx_pixmap_t)") +fn("xcb_void_cookie_t xcb_glx_destroy_glx_pixmap(xcb_connection_t *, xcb_glx_pixmap_t)") +fn("int xcb_glx_vendor_private_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_glx_vendor_private_checked(xcb_connection_t *, uint32_t, xcb_glx_context_tag_t, uint32_t, const uint8_t *)") +fn("xcb_void_cookie_t xcb_glx_vendor_private(xcb_connection_t *, uint32_t, xcb_glx_context_tag_t, uint32_t, const uint8_t *)") +# ::Iterator:: +fn("uint8_t * xcb_glx_vendor_private_data(const xcb_glx_vendor_private_request_t *)") +fn("int xcb_glx_vendor_private_data_length(const xcb_glx_vendor_private_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_vendor_private_data_end(const xcb_glx_vendor_private_request_t *)") + +fn("int xcb_glx_vendor_private_with_reply_sizeof(const void *, uint32_t)") +fn("xcb_glx_vendor_private_with_reply_cookie_t xcb_glx_vendor_private_with_reply(xcb_connection_t *, uint32_t, xcb_glx_context_tag_t, uint32_t, const uint8_t *)") +fn("xcb_glx_vendor_private_with_reply_cookie_t xcb_glx_vendor_private_with_reply_unchecked(xcb_connection_t *, uint32_t, xcb_glx_context_tag_t, uint32_t, const uint8_t *)") +# ::Iterator:: +fn("uint8_t * xcb_glx_vendor_private_with_reply_data_2(const xcb_glx_vendor_private_with_reply_reply_t *)") +fn("int xcb_glx_vendor_private_with_reply_data_2_length(const xcb_glx_vendor_private_with_reply_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_vendor_private_with_reply_data_2_end(const xcb_glx_vendor_private_with_reply_reply_t *)") + +fn("xcb_glx_vendor_private_with_reply_reply_t * xcb_glx_vendor_private_with_reply_reply(xcb_connection_t *, xcb_glx_vendor_private_with_reply_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_query_extensions_string_cookie_t xcb_glx_query_extensions_string(xcb_connection_t *, uint32_t)") +fn("xcb_glx_query_extensions_string_cookie_t xcb_glx_query_extensions_string_unchecked(xcb_connection_t *, uint32_t)") +fn("xcb_glx_query_extensions_string_reply_t * xcb_glx_query_extensions_string_reply(xcb_connection_t *, xcb_glx_query_extensions_string_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_query_server_string_sizeof(const void *)") +fn("xcb_glx_query_server_string_cookie_t xcb_glx_query_server_string(xcb_connection_t *, uint32_t, uint32_t)") +fn("xcb_glx_query_server_string_cookie_t xcb_glx_query_server_string_unchecked(xcb_connection_t *, uint32_t, uint32_t)") +# ::Iterator:: +fn("char * xcb_glx_query_server_string_string(const xcb_glx_query_server_string_reply_t *)") +fn("int xcb_glx_query_server_string_string_length(const xcb_glx_query_server_string_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_query_server_string_string_end(const xcb_glx_query_server_string_reply_t *)") + +fn("xcb_glx_query_server_string_reply_t * xcb_glx_query_server_string_reply(xcb_connection_t *, xcb_glx_query_server_string_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_client_info_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_client_info_checked(xcb_connection_t *, uint32_t, uint32_t, uint32_t, const char *)") +fn("xcb_void_cookie_t xcb_glx_client_info(xcb_connection_t *, uint32_t, uint32_t, uint32_t, const char *)") +# ::Iterator:: +fn("char * xcb_glx_client_info_string(const xcb_glx_client_info_request_t *)") +fn("int xcb_glx_client_info_string_length(const xcb_glx_client_info_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_client_info_string_end(const xcb_glx_client_info_request_t *)") + +fn("int xcb_glx_get_fb_configs_sizeof(const void *)") +fn("xcb_glx_get_fb_configs_cookie_t xcb_glx_get_fb_configs(xcb_connection_t *, uint32_t)") +fn("xcb_glx_get_fb_configs_cookie_t xcb_glx_get_fb_configs_unchecked(xcb_connection_t *, uint32_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_get_fb_configs_property_list(const xcb_glx_get_fb_configs_reply_t *)") +fn("int xcb_glx_get_fb_configs_property_list_length(const xcb_glx_get_fb_configs_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_fb_configs_property_list_end(const xcb_glx_get_fb_configs_reply_t *)") + +fn("xcb_glx_get_fb_configs_reply_t * xcb_glx_get_fb_configs_reply(xcb_connection_t *, xcb_glx_get_fb_configs_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_create_pixmap_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_create_pixmap_checked(xcb_connection_t *, uint32_t, xcb_glx_fbconfig_t, xcb_pixmap_t, xcb_glx_pixmap_t, uint32_t, const uint32_t *)") +fn("xcb_void_cookie_t xcb_glx_create_pixmap(xcb_connection_t *, uint32_t, xcb_glx_fbconfig_t, xcb_pixmap_t, xcb_glx_pixmap_t, uint32_t, const uint32_t *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_create_pixmap_attribs(const xcb_glx_create_pixmap_request_t *)") +fn("int xcb_glx_create_pixmap_attribs_length(const xcb_glx_create_pixmap_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_create_pixmap_attribs_end(const xcb_glx_create_pixmap_request_t *)") + +fn("xcb_void_cookie_t xcb_glx_destroy_pixmap_checked(xcb_connection_t *, xcb_glx_pixmap_t)") +fn("xcb_void_cookie_t xcb_glx_destroy_pixmap(xcb_connection_t *, xcb_glx_pixmap_t)") +fn("xcb_void_cookie_t xcb_glx_create_new_context_checked(xcb_connection_t *, xcb_glx_context_t, xcb_glx_fbconfig_t, uint32_t, uint32_t, xcb_glx_context_t, uint8_t)") +fn("xcb_void_cookie_t xcb_glx_create_new_context(xcb_connection_t *, xcb_glx_context_t, xcb_glx_fbconfig_t, uint32_t, uint32_t, xcb_glx_context_t, uint8_t)") +fn("int xcb_glx_query_context_sizeof(const void *)") +fn("xcb_glx_query_context_cookie_t xcb_glx_query_context(xcb_connection_t *, xcb_glx_context_t)") +fn("xcb_glx_query_context_cookie_t xcb_glx_query_context_unchecked(xcb_connection_t *, xcb_glx_context_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_query_context_attribs(const xcb_glx_query_context_reply_t *)") +fn("int xcb_glx_query_context_attribs_length(const xcb_glx_query_context_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_query_context_attribs_end(const xcb_glx_query_context_reply_t *)") + +fn("xcb_glx_query_context_reply_t * xcb_glx_query_context_reply(xcb_connection_t *, xcb_glx_query_context_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_make_context_current_cookie_t xcb_glx_make_context_current(xcb_connection_t *, xcb_glx_context_tag_t, xcb_glx_drawable_t, xcb_glx_drawable_t, xcb_glx_context_t)") +fn("xcb_glx_make_context_current_cookie_t xcb_glx_make_context_current_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, xcb_glx_drawable_t, xcb_glx_drawable_t, xcb_glx_context_t)") +fn("xcb_glx_make_context_current_reply_t * xcb_glx_make_context_current_reply(xcb_connection_t *, xcb_glx_make_context_current_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_create_pbuffer_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_create_pbuffer_checked(xcb_connection_t *, uint32_t, xcb_glx_fbconfig_t, xcb_glx_pbuffer_t, uint32_t, const uint32_t *)") +fn("xcb_void_cookie_t xcb_glx_create_pbuffer(xcb_connection_t *, uint32_t, xcb_glx_fbconfig_t, xcb_glx_pbuffer_t, uint32_t, const uint32_t *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_create_pbuffer_attribs(const xcb_glx_create_pbuffer_request_t *)") +fn("int xcb_glx_create_pbuffer_attribs_length(const xcb_glx_create_pbuffer_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_create_pbuffer_attribs_end(const xcb_glx_create_pbuffer_request_t *)") + +fn("xcb_void_cookie_t xcb_glx_destroy_pbuffer_checked(xcb_connection_t *, xcb_glx_pbuffer_t)") +fn("xcb_void_cookie_t xcb_glx_destroy_pbuffer(xcb_connection_t *, xcb_glx_pbuffer_t)") +fn("int xcb_glx_get_drawable_attributes_sizeof(const void *)") +fn("xcb_glx_get_drawable_attributes_cookie_t xcb_glx_get_drawable_attributes(xcb_connection_t *, xcb_glx_drawable_t)") +fn("xcb_glx_get_drawable_attributes_cookie_t xcb_glx_get_drawable_attributes_unchecked(xcb_connection_t *, xcb_glx_drawable_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_get_drawable_attributes_attribs(const xcb_glx_get_drawable_attributes_reply_t *)") +fn("int xcb_glx_get_drawable_attributes_attribs_length(const xcb_glx_get_drawable_attributes_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_drawable_attributes_attribs_end(const xcb_glx_get_drawable_attributes_reply_t *)") + +fn("xcb_glx_get_drawable_attributes_reply_t * xcb_glx_get_drawable_attributes_reply(xcb_connection_t *, xcb_glx_get_drawable_attributes_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_change_drawable_attributes_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_change_drawable_attributes_checked(xcb_connection_t *, xcb_glx_drawable_t, uint32_t, const uint32_t *)") +fn("xcb_void_cookie_t xcb_glx_change_drawable_attributes(xcb_connection_t *, xcb_glx_drawable_t, uint32_t, const uint32_t *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_change_drawable_attributes_attribs(const xcb_glx_change_drawable_attributes_request_t *)") +fn("int xcb_glx_change_drawable_attributes_attribs_length(const xcb_glx_change_drawable_attributes_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_change_drawable_attributes_attribs_end(const xcb_glx_change_drawable_attributes_request_t *)") + +fn("int xcb_glx_create_window_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_create_window_checked(xcb_connection_t *, uint32_t, xcb_glx_fbconfig_t, xcb_window_t, xcb_glx_window_t, uint32_t, const uint32_t *)") +fn("xcb_void_cookie_t xcb_glx_create_window(xcb_connection_t *, uint32_t, xcb_glx_fbconfig_t, xcb_window_t, xcb_glx_window_t, uint32_t, const uint32_t *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_create_window_attribs(const xcb_glx_create_window_request_t *)") +fn("int xcb_glx_create_window_attribs_length(const xcb_glx_create_window_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_create_window_attribs_end(const xcb_glx_create_window_request_t *)") + +fn("xcb_void_cookie_t xcb_glx_delete_window_checked(xcb_connection_t *, xcb_glx_window_t)") +fn("xcb_void_cookie_t xcb_glx_delete_window(xcb_connection_t *, xcb_glx_window_t)") +fn("int xcb_glx_set_client_info_arb_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_set_client_info_arb_checked(xcb_connection_t *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, const uint32_t *, const char *, const char *)") +fn("xcb_void_cookie_t xcb_glx_set_client_info_arb(xcb_connection_t *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, const uint32_t *, const char *, const char *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_set_client_info_arb_gl_versions(const xcb_glx_set_client_info_arb_request_t *)") +fn("int xcb_glx_set_client_info_arb_gl_versions_length(const xcb_glx_set_client_info_arb_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_set_client_info_arb_gl_versions_end(const xcb_glx_set_client_info_arb_request_t *)") + +# ::Iterator:: +fn("char * xcb_glx_set_client_info_arb_gl_extension_string(const xcb_glx_set_client_info_arb_request_t *)") +fn("int xcb_glx_set_client_info_arb_gl_extension_string_length(const xcb_glx_set_client_info_arb_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_set_client_info_arb_gl_extension_string_end(const xcb_glx_set_client_info_arb_request_t *)") + +# ::Iterator:: +fn("char * xcb_glx_set_client_info_arb_glx_extension_string(const xcb_glx_set_client_info_arb_request_t *)") +fn("int xcb_glx_set_client_info_arb_glx_extension_string_length(const xcb_glx_set_client_info_arb_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_set_client_info_arb_glx_extension_string_end(const xcb_glx_set_client_info_arb_request_t *)") + +fn("int xcb_glx_create_context_attribs_arb_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_create_context_attribs_arb_checked(xcb_connection_t *, xcb_glx_context_t, xcb_glx_fbconfig_t, uint32_t, xcb_glx_context_t, uint8_t, uint32_t, const uint32_t *)") +fn("xcb_void_cookie_t xcb_glx_create_context_attribs_arb(xcb_connection_t *, xcb_glx_context_t, xcb_glx_fbconfig_t, uint32_t, xcb_glx_context_t, uint8_t, uint32_t, const uint32_t *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_create_context_attribs_arb_attribs(const xcb_glx_create_context_attribs_arb_request_t *)") +fn("int xcb_glx_create_context_attribs_arb_attribs_length(const xcb_glx_create_context_attribs_arb_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_create_context_attribs_arb_attribs_end(const xcb_glx_create_context_attribs_arb_request_t *)") + +fn("int xcb_glx_set_client_info_2arb_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_set_client_info_2arb_checked(xcb_connection_t *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, const uint32_t *, const char *, const char *)") +fn("xcb_void_cookie_t xcb_glx_set_client_info_2arb(xcb_connection_t *, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, const uint32_t *, const char *, const char *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_set_client_info_2arb_gl_versions(const xcb_glx_set_client_info_2arb_request_t *)") +fn("int xcb_glx_set_client_info_2arb_gl_versions_length(const xcb_glx_set_client_info_2arb_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_set_client_info_2arb_gl_versions_end(const xcb_glx_set_client_info_2arb_request_t *)") + +# ::Iterator:: +fn("char * xcb_glx_set_client_info_2arb_gl_extension_string(const xcb_glx_set_client_info_2arb_request_t *)") +fn("int xcb_glx_set_client_info_2arb_gl_extension_string_length(const xcb_glx_set_client_info_2arb_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_set_client_info_2arb_gl_extension_string_end(const xcb_glx_set_client_info_2arb_request_t *)") + +# ::Iterator:: +fn("char * xcb_glx_set_client_info_2arb_glx_extension_string(const xcb_glx_set_client_info_2arb_request_t *)") +fn("int xcb_glx_set_client_info_2arb_glx_extension_string_length(const xcb_glx_set_client_info_2arb_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_set_client_info_2arb_glx_extension_string_end(const xcb_glx_set_client_info_2arb_request_t *)") + +fn("xcb_void_cookie_t xcb_glx_new_list_checked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_void_cookie_t xcb_glx_new_list(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_void_cookie_t xcb_glx_end_list_checked(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_end_list(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_delete_lists_checked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t)") +fn("xcb_void_cookie_t xcb_glx_delete_lists(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t)") +fn("xcb_glx_gen_lists_cookie_t xcb_glx_gen_lists(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +fn("xcb_glx_gen_lists_cookie_t xcb_glx_gen_lists_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +fn("xcb_glx_gen_lists_reply_t * xcb_glx_gen_lists_reply(xcb_connection_t *, xcb_glx_gen_lists_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_glx_feedback_buffer_checked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, int32_t)") +fn("xcb_void_cookie_t xcb_glx_feedback_buffer(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, int32_t)") +fn("xcb_void_cookie_t xcb_glx_select_buffer_checked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +fn("xcb_void_cookie_t xcb_glx_select_buffer(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +fn("int xcb_glx_render_mode_sizeof(const void *)") +fn("xcb_glx_render_mode_cookie_t xcb_glx_render_mode(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_render_mode_cookie_t xcb_glx_render_mode_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_render_mode_data(const xcb_glx_render_mode_reply_t *)") +fn("int xcb_glx_render_mode_data_length(const xcb_glx_render_mode_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_render_mode_data_end(const xcb_glx_render_mode_reply_t *)") + +fn("xcb_glx_render_mode_reply_t * xcb_glx_render_mode_reply(xcb_connection_t *, xcb_glx_render_mode_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_finish_cookie_t xcb_glx_finish(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_glx_finish_cookie_t xcb_glx_finish_unchecked(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_glx_finish_reply_t * xcb_glx_finish_reply(xcb_connection_t *, xcb_glx_finish_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_glx_pixel_storef_checked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, xcb_glx_float32_t)") +fn("xcb_void_cookie_t xcb_glx_pixel_storef(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, xcb_glx_float32_t)") +fn("xcb_void_cookie_t xcb_glx_pixel_storei_checked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t)") +fn("xcb_void_cookie_t xcb_glx_pixel_storei(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t)") +fn("int xcb_glx_read_pixels_sizeof(const void *)") +fn("xcb_glx_read_pixels_cookie_t xcb_glx_read_pixels(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, uint8_t, uint8_t)") +fn("xcb_glx_read_pixels_cookie_t xcb_glx_read_pixels_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, uint8_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_read_pixels_data(const xcb_glx_read_pixels_reply_t *)") +fn("int xcb_glx_read_pixels_data_length(const xcb_glx_read_pixels_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_read_pixels_data_end(const xcb_glx_read_pixels_reply_t *)") + +fn("xcb_glx_read_pixels_reply_t * xcb_glx_read_pixels_reply(xcb_connection_t *, xcb_glx_read_pixels_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_booleanv_sizeof(const void *)") +fn("xcb_glx_get_booleanv_cookie_t xcb_glx_get_booleanv(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +fn("xcb_glx_get_booleanv_cookie_t xcb_glx_get_booleanv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_booleanv_data(const xcb_glx_get_booleanv_reply_t *)") +fn("int xcb_glx_get_booleanv_data_length(const xcb_glx_get_booleanv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_booleanv_data_end(const xcb_glx_get_booleanv_reply_t *)") + +fn("xcb_glx_get_booleanv_reply_t * xcb_glx_get_booleanv_reply(xcb_connection_t *, xcb_glx_get_booleanv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_clip_plane_sizeof(const void *)") +fn("xcb_glx_get_clip_plane_cookie_t xcb_glx_get_clip_plane(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +fn("xcb_glx_get_clip_plane_cookie_t xcb_glx_get_clip_plane_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +# ::Iterator:: +fn("xcb_glx_float64_t * xcb_glx_get_clip_plane_data(const xcb_glx_get_clip_plane_reply_t *)") +fn("int xcb_glx_get_clip_plane_data_length(const xcb_glx_get_clip_plane_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_clip_plane_data_end(const xcb_glx_get_clip_plane_reply_t *)") + +fn("xcb_glx_get_clip_plane_reply_t * xcb_glx_get_clip_plane_reply(xcb_connection_t *, xcb_glx_get_clip_plane_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_doublev_sizeof(const void *)") +fn("xcb_glx_get_doublev_cookie_t xcb_glx_get_doublev(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_get_doublev_cookie_t xcb_glx_get_doublev_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float64_t * xcb_glx_get_doublev_data(const xcb_glx_get_doublev_reply_t *)") +fn("int xcb_glx_get_doublev_data_length(const xcb_glx_get_doublev_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_doublev_data_end(const xcb_glx_get_doublev_reply_t *)") + +fn("xcb_glx_get_doublev_reply_t * xcb_glx_get_doublev_reply(xcb_connection_t *, xcb_glx_get_doublev_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_get_error_cookie_t xcb_glx_get_error(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_glx_get_error_cookie_t xcb_glx_get_error_unchecked(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_glx_get_error_reply_t * xcb_glx_get_error_reply(xcb_connection_t *, xcb_glx_get_error_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_floatv_sizeof(const void *)") +fn("xcb_glx_get_floatv_cookie_t xcb_glx_get_floatv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_get_floatv_cookie_t xcb_glx_get_floatv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_floatv_data(const xcb_glx_get_floatv_reply_t *)") +fn("int xcb_glx_get_floatv_data_length(const xcb_glx_get_floatv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_floatv_data_end(const xcb_glx_get_floatv_reply_t *)") + +fn("xcb_glx_get_floatv_reply_t * xcb_glx_get_floatv_reply(xcb_connection_t *, xcb_glx_get_floatv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_integerv_sizeof(const void *)") +fn("xcb_glx_get_integerv_cookie_t xcb_glx_get_integerv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_get_integerv_cookie_t xcb_glx_get_integerv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_integerv_data(const xcb_glx_get_integerv_reply_t *)") +fn("int xcb_glx_get_integerv_data_length(const xcb_glx_get_integerv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_integerv_data_end(const xcb_glx_get_integerv_reply_t *)") + +fn("xcb_glx_get_integerv_reply_t * xcb_glx_get_integerv_reply(xcb_connection_t *, xcb_glx_get_integerv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_lightfv_sizeof(const void *)") +fn("xcb_glx_get_lightfv_cookie_t xcb_glx_get_lightfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_lightfv_cookie_t xcb_glx_get_lightfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_lightfv_data(const xcb_glx_get_lightfv_reply_t *)") +fn("int xcb_glx_get_lightfv_data_length(const xcb_glx_get_lightfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_lightfv_data_end(const xcb_glx_get_lightfv_reply_t *)") + +fn("xcb_glx_get_lightfv_reply_t * xcb_glx_get_lightfv_reply(xcb_connection_t *, xcb_glx_get_lightfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_lightiv_sizeof(const void *)") +fn("xcb_glx_get_lightiv_cookie_t xcb_glx_get_lightiv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_lightiv_cookie_t xcb_glx_get_lightiv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_lightiv_data(const xcb_glx_get_lightiv_reply_t *)") +fn("int xcb_glx_get_lightiv_data_length(const xcb_glx_get_lightiv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_lightiv_data_end(const xcb_glx_get_lightiv_reply_t *)") + +fn("xcb_glx_get_lightiv_reply_t * xcb_glx_get_lightiv_reply(xcb_connection_t *, xcb_glx_get_lightiv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_mapdv_sizeof(const void *)") +fn("xcb_glx_get_mapdv_cookie_t xcb_glx_get_mapdv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_mapdv_cookie_t xcb_glx_get_mapdv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float64_t * xcb_glx_get_mapdv_data(const xcb_glx_get_mapdv_reply_t *)") +fn("int xcb_glx_get_mapdv_data_length(const xcb_glx_get_mapdv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_mapdv_data_end(const xcb_glx_get_mapdv_reply_t *)") + +fn("xcb_glx_get_mapdv_reply_t * xcb_glx_get_mapdv_reply(xcb_connection_t *, xcb_glx_get_mapdv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_mapfv_sizeof(const void *)") +fn("xcb_glx_get_mapfv_cookie_t xcb_glx_get_mapfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_mapfv_cookie_t xcb_glx_get_mapfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_mapfv_data(const xcb_glx_get_mapfv_reply_t *)") +fn("int xcb_glx_get_mapfv_data_length(const xcb_glx_get_mapfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_mapfv_data_end(const xcb_glx_get_mapfv_reply_t *)") + +fn("xcb_glx_get_mapfv_reply_t * xcb_glx_get_mapfv_reply(xcb_connection_t *, xcb_glx_get_mapfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_mapiv_sizeof(const void *)") +fn("xcb_glx_get_mapiv_cookie_t xcb_glx_get_mapiv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_mapiv_cookie_t xcb_glx_get_mapiv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_mapiv_data(const xcb_glx_get_mapiv_reply_t *)") +fn("int xcb_glx_get_mapiv_data_length(const xcb_glx_get_mapiv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_mapiv_data_end(const xcb_glx_get_mapiv_reply_t *)") + +fn("xcb_glx_get_mapiv_reply_t * xcb_glx_get_mapiv_reply(xcb_connection_t *, xcb_glx_get_mapiv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_materialfv_sizeof(const void *)") +fn("xcb_glx_get_materialfv_cookie_t xcb_glx_get_materialfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_materialfv_cookie_t xcb_glx_get_materialfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_materialfv_data(const xcb_glx_get_materialfv_reply_t *)") +fn("int xcb_glx_get_materialfv_data_length(const xcb_glx_get_materialfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_materialfv_data_end(const xcb_glx_get_materialfv_reply_t *)") + +fn("xcb_glx_get_materialfv_reply_t * xcb_glx_get_materialfv_reply(xcb_connection_t *, xcb_glx_get_materialfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_materialiv_sizeof(const void *)") +fn("xcb_glx_get_materialiv_cookie_t xcb_glx_get_materialiv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_materialiv_cookie_t xcb_glx_get_materialiv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_materialiv_data(const xcb_glx_get_materialiv_reply_t *)") +fn("int xcb_glx_get_materialiv_data_length(const xcb_glx_get_materialiv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_materialiv_data_end(const xcb_glx_get_materialiv_reply_t *)") + +fn("xcb_glx_get_materialiv_reply_t * xcb_glx_get_materialiv_reply(xcb_connection_t *, xcb_glx_get_materialiv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_pixel_mapfv_sizeof(const void *)") +fn("xcb_glx_get_pixel_mapfv_cookie_t xcb_glx_get_pixel_mapfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_get_pixel_mapfv_cookie_t xcb_glx_get_pixel_mapfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_pixel_mapfv_data(const xcb_glx_get_pixel_mapfv_reply_t *)") +fn("int xcb_glx_get_pixel_mapfv_data_length(const xcb_glx_get_pixel_mapfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_pixel_mapfv_data_end(const xcb_glx_get_pixel_mapfv_reply_t *)") + +fn("xcb_glx_get_pixel_mapfv_reply_t * xcb_glx_get_pixel_mapfv_reply(xcb_connection_t *, xcb_glx_get_pixel_mapfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_pixel_mapuiv_sizeof(const void *)") +fn("xcb_glx_get_pixel_mapuiv_cookie_t xcb_glx_get_pixel_mapuiv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_get_pixel_mapuiv_cookie_t xcb_glx_get_pixel_mapuiv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_get_pixel_mapuiv_data(const xcb_glx_get_pixel_mapuiv_reply_t *)") +fn("int xcb_glx_get_pixel_mapuiv_data_length(const xcb_glx_get_pixel_mapuiv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_pixel_mapuiv_data_end(const xcb_glx_get_pixel_mapuiv_reply_t *)") + +fn("xcb_glx_get_pixel_mapuiv_reply_t * xcb_glx_get_pixel_mapuiv_reply(xcb_connection_t *, xcb_glx_get_pixel_mapuiv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_pixel_mapusv_sizeof(const void *)") +fn("xcb_glx_get_pixel_mapusv_cookie_t xcb_glx_get_pixel_mapusv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_get_pixel_mapusv_cookie_t xcb_glx_get_pixel_mapusv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +# ::Iterator:: +fn("uint16_t * xcb_glx_get_pixel_mapusv_data(const xcb_glx_get_pixel_mapusv_reply_t *)") +fn("int xcb_glx_get_pixel_mapusv_data_length(const xcb_glx_get_pixel_mapusv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_pixel_mapusv_data_end(const xcb_glx_get_pixel_mapusv_reply_t *)") + +fn("xcb_glx_get_pixel_mapusv_reply_t * xcb_glx_get_pixel_mapusv_reply(xcb_connection_t *, xcb_glx_get_pixel_mapusv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_polygon_stipple_sizeof(const void *)") +fn("xcb_glx_get_polygon_stipple_cookie_t xcb_glx_get_polygon_stipple(xcb_connection_t *, xcb_glx_context_tag_t, uint8_t)") +fn("xcb_glx_get_polygon_stipple_cookie_t xcb_glx_get_polygon_stipple_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_polygon_stipple_data(const xcb_glx_get_polygon_stipple_reply_t *)") +fn("int xcb_glx_get_polygon_stipple_data_length(const xcb_glx_get_polygon_stipple_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_polygon_stipple_data_end(const xcb_glx_get_polygon_stipple_reply_t *)") + +fn("xcb_glx_get_polygon_stipple_reply_t * xcb_glx_get_polygon_stipple_reply(xcb_connection_t *, xcb_glx_get_polygon_stipple_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_string_sizeof(const void *)") +fn("xcb_glx_get_string_cookie_t xcb_glx_get_string(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_get_string_cookie_t xcb_glx_get_string_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +# ::Iterator:: +fn("char * xcb_glx_get_string_string(const xcb_glx_get_string_reply_t *)") +fn("int xcb_glx_get_string_string_length(const xcb_glx_get_string_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_string_string_end(const xcb_glx_get_string_reply_t *)") + +fn("xcb_glx_get_string_reply_t * xcb_glx_get_string_reply(xcb_connection_t *, xcb_glx_get_string_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_envfv_sizeof(const void *)") +fn("xcb_glx_get_tex_envfv_cookie_t xcb_glx_get_tex_envfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_tex_envfv_cookie_t xcb_glx_get_tex_envfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_float32_t * xcb_glx_get_tex_envfv_data(const xcb_glx_get_tex_envfv_reply_t *)") +fn("int xcb_glx_get_tex_envfv_data_length(const xcb_glx_get_tex_envfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_envfv_data_end(const xcb_glx_get_tex_envfv_reply_t *)") +fn("xcb_glx_get_tex_envfv_reply_t * xcb_glx_get_tex_envfv_reply(xcb_connection_t *, xcb_glx_get_tex_envfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_enviv_sizeof(const void *)") +fn("xcb_glx_get_tex_enviv_cookie_t xcb_glx_get_tex_enviv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_tex_enviv_cookie_t xcb_glx_get_tex_enviv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_tex_enviv_data(const xcb_glx_get_tex_enviv_reply_t *)") +fn("int xcb_glx_get_tex_enviv_data_length(const xcb_glx_get_tex_enviv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_enviv_data_end(const xcb_glx_get_tex_enviv_reply_t *)") + +fn("xcb_glx_get_tex_enviv_reply_t * xcb_glx_get_tex_enviv_reply(xcb_connection_t *, xcb_glx_get_tex_enviv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_gendv_sizeof(const void *)") +fn("xcb_glx_get_tex_gendv_cookie_t xcb_glx_get_tex_gendv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_tex_gendv_cookie_t xcb_glx_get_tex_gendv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float64_t * xcb_glx_get_tex_gendv_data(const xcb_glx_get_tex_gendv_reply_t *)") +fn("int xcb_glx_get_tex_gendv_data_length(const xcb_glx_get_tex_gendv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_gendv_data_end(const xcb_glx_get_tex_gendv_reply_t *)") + +fn("xcb_glx_get_tex_gendv_reply_t * xcb_glx_get_tex_gendv_reply(xcb_connection_t *, xcb_glx_get_tex_gendv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_genfv_sizeof(const void *)") +fn("xcb_glx_get_tex_genfv_cookie_t xcb_glx_get_tex_genfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_tex_genfv_cookie_t xcb_glx_get_tex_genfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_tex_genfv_data(const xcb_glx_get_tex_genfv_reply_t *)") +fn("int xcb_glx_get_tex_genfv_data_length(const xcb_glx_get_tex_genfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_genfv_data_end(const xcb_glx_get_tex_genfv_reply_t *)") + +fn("xcb_glx_get_tex_genfv_reply_t * xcb_glx_get_tex_genfv_reply(xcb_connection_t *, xcb_glx_get_tex_genfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_geniv_sizeof(const void *)") +fn("xcb_glx_get_tex_geniv_cookie_t xcb_glx_get_tex_geniv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_tex_geniv_cookie_t xcb_glx_get_tex_geniv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_tex_geniv_data(const xcb_glx_get_tex_geniv_reply_t *)") +fn("int xcb_glx_get_tex_geniv_data_length(const xcb_glx_get_tex_geniv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_geniv_data_end(const xcb_glx_get_tex_geniv_reply_t *)") + +fn("xcb_glx_get_tex_geniv_reply_t * xcb_glx_get_tex_geniv_reply(xcb_connection_t *, xcb_glx_get_tex_geniv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_image_sizeof(const void *)") +fn("xcb_glx_get_tex_image_cookie_t xcb_glx_get_tex_image(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t, uint32_t, uint32_t, uint8_t)") +fn("xcb_glx_get_tex_image_cookie_t xcb_glx_get_tex_image_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t, uint32_t, uint32_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_tex_image_data(const xcb_glx_get_tex_image_reply_t *)") +fn("int xcb_glx_get_tex_image_data_length(const xcb_glx_get_tex_image_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_image_data_end(const xcb_glx_get_tex_image_reply_t *)") + +fn("xcb_glx_get_tex_image_reply_t * xcb_glx_get_tex_image_reply(xcb_connection_t *, xcb_glx_get_tex_image_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_parameterfv_sizeof(const void *)") +fn("xcb_glx_get_tex_parameterfv_cookie_t xcb_glx_get_tex_parameterfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_tex_parameterfv_cookie_t xcb_glx_get_tex_parameterfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_tex_parameterfv_data(const xcb_glx_get_tex_parameterfv_reply_t *)") +fn("int xcb_glx_get_tex_parameterfv_data_length(const xcb_glx_get_tex_parameterfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_parameterfv_data_end(const xcb_glx_get_tex_parameterfv_reply_t *)") + +fn("xcb_glx_get_tex_parameterfv_reply_t * xcb_glx_get_tex_parameterfv_reply(xcb_connection_t *, xcb_glx_get_tex_parameterfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_parameteriv_sizeof(const void *)") +fn("xcb_glx_get_tex_parameteriv_cookie_t xcb_glx_get_tex_parameteriv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_tex_parameteriv_cookie_t xcb_glx_get_tex_parameteriv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_tex_parameteriv_data(const xcb_glx_get_tex_parameteriv_reply_t *)") +fn("int xcb_glx_get_tex_parameteriv_data_length(const xcb_glx_get_tex_parameteriv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_parameteriv_data_end(const xcb_glx_get_tex_parameteriv_reply_t *)") + +fn("xcb_glx_get_tex_parameteriv_reply_t * xcb_glx_get_tex_parameteriv_reply(xcb_connection_t *, xcb_glx_get_tex_parameteriv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_level_parameterfv_sizeof(const void *)") +fn("xcb_glx_get_tex_level_parameterfv_cookie_t xcb_glx_get_tex_level_parameterfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t, uint32_t)") +fn("xcb_glx_get_tex_level_parameterfv_cookie_t xcb_glx_get_tex_level_parameterfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_tex_level_parameterfv_data(const xcb_glx_get_tex_level_parameterfv_reply_t *)") +fn("int xcb_glx_get_tex_level_parameterfv_data_length(const xcb_glx_get_tex_level_parameterfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_level_parameterfv_data_end(const xcb_glx_get_tex_level_parameterfv_reply_t *)") + +fn("xcb_glx_get_tex_level_parameterfv_reply_t * xcb_glx_get_tex_level_parameterfv_reply(xcb_connection_t *, xcb_glx_get_tex_level_parameterfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_tex_level_parameteriv_sizeof(const void *)") +fn("xcb_glx_get_tex_level_parameteriv_cookie_t xcb_glx_get_tex_level_parameteriv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t, uint32_t)") +fn("xcb_glx_get_tex_level_parameteriv_cookie_t xcb_glx_get_tex_level_parameteriv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_tex_level_parameteriv_data(const xcb_glx_get_tex_level_parameteriv_reply_t *)") +fn("int xcb_glx_get_tex_level_parameteriv_data_length(const xcb_glx_get_tex_level_parameteriv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_tex_level_parameteriv_data_end(const xcb_glx_get_tex_level_parameteriv_reply_t *)") + +fn("xcb_glx_get_tex_level_parameteriv_reply_t * xcb_glx_get_tex_level_parameteriv_reply(xcb_connection_t *, xcb_glx_get_tex_level_parameteriv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_is_enabled_cookie_t xcb_glx_is_enabled(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_is_enabled_cookie_t xcb_glx_is_enabled_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_is_enabled_reply_t * xcb_glx_is_enabled_reply(xcb_connection_t *, xcb_glx_is_enabled_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_is_list_cookie_t xcb_glx_is_list(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_is_list_cookie_t xcb_glx_is_list_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_is_list_reply_t * xcb_glx_is_list_reply(xcb_connection_t *, xcb_glx_is_list_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_glx_flush_checked(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("xcb_void_cookie_t xcb_glx_flush(xcb_connection_t *, xcb_glx_context_tag_t)") +fn("int xcb_glx_are_textures_resident_sizeof(const void *)") +fn("xcb_glx_are_textures_resident_cookie_t xcb_glx_are_textures_resident(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, const uint32_t *)") +fn("xcb_glx_are_textures_resident_cookie_t xcb_glx_are_textures_resident_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, const uint32_t *)") +# ::Iterator:: +fn("uint8_t * xcb_glx_are_textures_resident_data(const xcb_glx_are_textures_resident_reply_t *)") +fn("int xcb_glx_are_textures_resident_data_length(const xcb_glx_are_textures_resident_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_are_textures_resident_data_end(const xcb_glx_are_textures_resident_reply_t *)") + +fn("xcb_glx_are_textures_resident_reply_t * xcb_glx_are_textures_resident_reply(xcb_connection_t *, xcb_glx_are_textures_resident_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_delete_textures_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_delete_textures_checked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, const uint32_t *)") +fn("xcb_void_cookie_t xcb_glx_delete_textures(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, const uint32_t *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_delete_textures_textures(const xcb_glx_delete_textures_request_t *)") +fn("int xcb_glx_delete_textures_textures_length(const xcb_glx_delete_textures_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_delete_textures_textures_end(const xcb_glx_delete_textures_request_t *)") + +fn("int xcb_glx_gen_textures_sizeof(const void *)") +fn("xcb_glx_gen_textures_cookie_t xcb_glx_gen_textures(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +fn("xcb_glx_gen_textures_cookie_t xcb_glx_gen_textures_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_gen_textures_data(const xcb_glx_gen_textures_reply_t *)") +fn("int xcb_glx_gen_textures_data_length(const xcb_glx_gen_textures_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_gen_textures_data_end(const xcb_glx_gen_textures_reply_t *)") + +fn("xcb_glx_gen_textures_reply_t * xcb_glx_gen_textures_reply(xcb_connection_t *, xcb_glx_gen_textures_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_is_texture_cookie_t xcb_glx_is_texture(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_is_texture_cookie_t xcb_glx_is_texture_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_is_texture_reply_t * xcb_glx_is_texture_reply(xcb_connection_t *, xcb_glx_is_texture_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_color_table_sizeof(const void *)") +fn("xcb_glx_get_color_table_cookie_t xcb_glx_get_color_table(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t)") +fn("xcb_glx_get_color_table_cookie_t xcb_glx_get_color_table_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_color_table_data(const xcb_glx_get_color_table_reply_t *)") +fn("int xcb_glx_get_color_table_data_length(const xcb_glx_get_color_table_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_color_table_data_end(const xcb_glx_get_color_table_reply_t *)") + +fn("xcb_glx_get_color_table_reply_t * xcb_glx_get_color_table_reply(xcb_connection_t *, xcb_glx_get_color_table_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_color_table_parameterfv_sizeof(const void *)") +fn("xcb_glx_get_color_table_parameterfv_cookie_t xcb_glx_get_color_table_parameterfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_color_table_parameterfv_cookie_t xcb_glx_get_color_table_parameterfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_color_table_parameterfv_data(const xcb_glx_get_color_table_parameterfv_reply_t *)") +fn("int xcb_glx_get_color_table_parameterfv_data_length(const xcb_glx_get_color_table_parameterfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_color_table_parameterfv_data_end(const xcb_glx_get_color_table_parameterfv_reply_t *)") + +fn("xcb_glx_get_color_table_parameterfv_reply_t * xcb_glx_get_color_table_parameterfv_reply(xcb_connection_t *, xcb_glx_get_color_table_parameterfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_color_table_parameteriv_sizeof(const void *)") +fn("xcb_glx_get_color_table_parameteriv_cookie_t xcb_glx_get_color_table_parameteriv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_color_table_parameteriv_cookie_t xcb_glx_get_color_table_parameteriv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_color_table_parameteriv_data(const xcb_glx_get_color_table_parameteriv_reply_t *)") +fn("int xcb_glx_get_color_table_parameteriv_data_length(const xcb_glx_get_color_table_parameteriv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_color_table_parameteriv_data_end(const xcb_glx_get_color_table_parameteriv_reply_t *)") + +fn("xcb_glx_get_color_table_parameteriv_reply_t * xcb_glx_get_color_table_parameteriv_reply(xcb_connection_t *, xcb_glx_get_color_table_parameteriv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_convolution_filter_sizeof(const void *)") +fn("xcb_glx_get_convolution_filter_cookie_t xcb_glx_get_convolution_filter(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t)") +fn("xcb_glx_get_convolution_filter_cookie_t xcb_glx_get_convolution_filter_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_convolution_filter_data(const xcb_glx_get_convolution_filter_reply_t *)") +fn("int xcb_glx_get_convolution_filter_data_length(const xcb_glx_get_convolution_filter_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_convolution_filter_data_end(const xcb_glx_get_convolution_filter_reply_t *)") + +fn("xcb_glx_get_convolution_filter_reply_t * xcb_glx_get_convolution_filter_reply(xcb_connection_t *, xcb_glx_get_convolution_filter_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_convolution_parameterfv_sizeof(const void *)") +fn("xcb_glx_get_convolution_parameterfv_cookie_t xcb_glx_get_convolution_parameterfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_convolution_parameterfv_cookie_t xcb_glx_get_convolution_parameterfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_convolution_parameterfv_data(const xcb_glx_get_convolution_parameterfv_reply_t *)") +fn("int xcb_glx_get_convolution_parameterfv_data_length(const xcb_glx_get_convolution_parameterfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_convolution_parameterfv_data_end(const xcb_glx_get_convolution_parameterfv_reply_t *)") + +fn("xcb_glx_get_convolution_parameterfv_reply_t * xcb_glx_get_convolution_parameterfv_reply(xcb_connection_t *, xcb_glx_get_convolution_parameterfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_convolution_parameteriv_sizeof(const void *)") +fn("xcb_glx_get_convolution_parameteriv_cookie_t xcb_glx_get_convolution_parameteriv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_convolution_parameteriv_cookie_t xcb_glx_get_convolution_parameteriv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_convolution_parameteriv_data(const xcb_glx_get_convolution_parameteriv_reply_t *)") +fn("int xcb_glx_get_convolution_parameteriv_data_length(const xcb_glx_get_convolution_parameteriv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_convolution_parameteriv_data_end(const xcb_glx_get_convolution_parameteriv_reply_t *)") + +fn("xcb_glx_get_convolution_parameteriv_reply_t * xcb_glx_get_convolution_parameteriv_reply(xcb_connection_t *, xcb_glx_get_convolution_parameteriv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_separable_filter_sizeof(const void *)") +fn("xcb_glx_get_separable_filter_cookie_t xcb_glx_get_separable_filter(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t)") +fn("xcb_glx_get_separable_filter_cookie_t xcb_glx_get_separable_filter_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_separable_filter_rows_and_cols(const xcb_glx_get_separable_filter_reply_t *)") +fn("int xcb_glx_get_separable_filter_rows_and_cols_length(const xcb_glx_get_separable_filter_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_separable_filter_rows_and_cols_end(const xcb_glx_get_separable_filter_reply_t *)") + +fn("xcb_glx_get_separable_filter_reply_t * xcb_glx_get_separable_filter_reply(xcb_connection_t *, xcb_glx_get_separable_filter_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_histogram_sizeof(const void *)") +fn("xcb_glx_get_histogram_cookie_t xcb_glx_get_histogram(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t)") +fn("xcb_glx_get_histogram_cookie_t xcb_glx_get_histogram_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_histogram_data(const xcb_glx_get_histogram_reply_t *)") +fn("int xcb_glx_get_histogram_data_length(const xcb_glx_get_histogram_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_histogram_data_end(const xcb_glx_get_histogram_reply_t *)") + +fn("xcb_glx_get_histogram_reply_t * xcb_glx_get_histogram_reply(xcb_connection_t *, xcb_glx_get_histogram_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_histogram_parameterfv_sizeof(const void *)") +fn("xcb_glx_get_histogram_parameterfv_cookie_t xcb_glx_get_histogram_parameterfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_histogram_parameterfv_cookie_t xcb_glx_get_histogram_parameterfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_histogram_parameterfv_data(const xcb_glx_get_histogram_parameterfv_reply_t *)") +fn("int xcb_glx_get_histogram_parameterfv_data_length(const xcb_glx_get_histogram_parameterfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_histogram_parameterfv_data_end(const xcb_glx_get_histogram_parameterfv_reply_t *)") + +fn("xcb_glx_get_histogram_parameterfv_reply_t * xcb_glx_get_histogram_parameterfv_reply(xcb_connection_t *, xcb_glx_get_histogram_parameterfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_histogram_parameteriv_sizeof(const void *)") +fn("xcb_glx_get_histogram_parameteriv_cookie_t xcb_glx_get_histogram_parameteriv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_histogram_parameteriv_cookie_t xcb_glx_get_histogram_parameteriv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_histogram_parameteriv_data(const xcb_glx_get_histogram_parameteriv_reply_t *)") +fn("int xcb_glx_get_histogram_parameteriv_data_length(const xcb_glx_get_histogram_parameteriv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_histogram_parameteriv_data_end(const xcb_glx_get_histogram_parameteriv_reply_t *)") + +fn("xcb_glx_get_histogram_parameteriv_reply_t * xcb_glx_get_histogram_parameteriv_reply(xcb_connection_t *, xcb_glx_get_histogram_parameteriv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_minmax_sizeof(const void *)") +fn("xcb_glx_get_minmax_cookie_t xcb_glx_get_minmax(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t)") +fn("xcb_glx_get_minmax_cookie_t xcb_glx_get_minmax_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t, uint32_t, uint8_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_minmax_data(const xcb_glx_get_minmax_reply_t *)") +fn("int xcb_glx_get_minmax_data_length(const xcb_glx_get_minmax_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_minmax_data_end(const xcb_glx_get_minmax_reply_t *)") + +fn("xcb_glx_get_minmax_reply_t * xcb_glx_get_minmax_reply(xcb_connection_t *, xcb_glx_get_minmax_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_minmax_parameterfv_sizeof(const void *)") +fn("xcb_glx_get_minmax_parameterfv_cookie_t xcb_glx_get_minmax_parameterfv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_minmax_parameterfv_cookie_t xcb_glx_get_minmax_parameterfv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("xcb_glx_float32_t * xcb_glx_get_minmax_parameterfv_data(const xcb_glx_get_minmax_parameterfv_reply_t *)") +fn("int xcb_glx_get_minmax_parameterfv_data_length(const xcb_glx_get_minmax_parameterfv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_minmax_parameterfv_data_end(const xcb_glx_get_minmax_parameterfv_reply_t *)") + +fn("xcb_glx_get_minmax_parameterfv_reply_t * xcb_glx_get_minmax_parameterfv_reply(xcb_connection_t *, xcb_glx_get_minmax_parameterfv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_minmax_parameteriv_sizeof(const void *)") +fn("xcb_glx_get_minmax_parameteriv_cookie_t xcb_glx_get_minmax_parameteriv(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_minmax_parameteriv_cookie_t xcb_glx_get_minmax_parameteriv_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_minmax_parameteriv_data(const xcb_glx_get_minmax_parameteriv_reply_t *)") +fn("int xcb_glx_get_minmax_parameteriv_data_length(const xcb_glx_get_minmax_parameteriv_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_minmax_parameteriv_data_end(const xcb_glx_get_minmax_parameteriv_reply_t *)") + +fn("xcb_glx_get_minmax_parameteriv_reply_t * xcb_glx_get_minmax_parameteriv_reply(xcb_connection_t *, xcb_glx_get_minmax_parameteriv_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_compressed_tex_image_arb_sizeof(const void *)") +fn("xcb_glx_get_compressed_tex_image_arb_cookie_t xcb_glx_get_compressed_tex_image_arb(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t)") +fn("xcb_glx_get_compressed_tex_image_arb_cookie_t xcb_glx_get_compressed_tex_image_arb_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, int32_t)") +# ::Iterator:: +fn("uint8_t * xcb_glx_get_compressed_tex_image_arb_data(const xcb_glx_get_compressed_tex_image_arb_reply_t *)") +fn("int xcb_glx_get_compressed_tex_image_arb_data_length(const xcb_glx_get_compressed_tex_image_arb_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_compressed_tex_image_arb_data_end(const xcb_glx_get_compressed_tex_image_arb_reply_t *)") + +fn("xcb_glx_get_compressed_tex_image_arb_reply_t * xcb_glx_get_compressed_tex_image_arb_reply(xcb_connection_t *, xcb_glx_get_compressed_tex_image_arb_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_delete_queries_arb_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_glx_delete_queries_arb_checked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, const uint32_t *)") +fn("xcb_void_cookie_t xcb_glx_delete_queries_arb(xcb_connection_t *, xcb_glx_context_tag_t, int32_t, const uint32_t *)") +# ::Iterator:: +fn("uint32_t * xcb_glx_delete_queries_arb_ids(const xcb_glx_delete_queries_arb_request_t *)") +fn("int xcb_glx_delete_queries_arb_ids_length(const xcb_glx_delete_queries_arb_request_t *)") +fn("xcb_generic_iterator_t xcb_glx_delete_queries_arb_ids_end(const xcb_glx_delete_queries_arb_request_t *)") + +fn("int xcb_glx_gen_queries_arb_sizeof(const void *)") +fn("xcb_glx_gen_queries_arb_cookie_t xcb_glx_gen_queries_arb(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +fn("xcb_glx_gen_queries_arb_cookie_t xcb_glx_gen_queries_arb_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, int32_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_gen_queries_arb_data(const xcb_glx_gen_queries_arb_reply_t *)") +fn("int xcb_glx_gen_queries_arb_data_length(const xcb_glx_gen_queries_arb_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_gen_queries_arb_data_end(const xcb_glx_gen_queries_arb_reply_t *)") + +fn("xcb_glx_gen_queries_arb_reply_t * xcb_glx_gen_queries_arb_reply(xcb_connection_t *, xcb_glx_gen_queries_arb_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_glx_is_query_arb_cookie_t xcb_glx_is_query_arb(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_is_query_arb_cookie_t xcb_glx_is_query_arb_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t)") +fn("xcb_glx_is_query_arb_reply_t * xcb_glx_is_query_arb_reply(xcb_connection_t *, xcb_glx_is_query_arb_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_queryiv_arb_sizeof(const void *)") +fn("xcb_glx_get_queryiv_arb_cookie_t xcb_glx_get_queryiv_arb(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_queryiv_arb_cookie_t xcb_glx_get_queryiv_arb_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_queryiv_arb_data(const xcb_glx_get_queryiv_arb_reply_t *)") +fn("int xcb_glx_get_queryiv_arb_data_length(const xcb_glx_get_queryiv_arb_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_queryiv_arb_data_end(const xcb_glx_get_queryiv_arb_reply_t *)") + +fn("xcb_glx_get_queryiv_arb_reply_t * xcb_glx_get_queryiv_arb_reply(xcb_connection_t *, xcb_glx_get_queryiv_arb_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_query_objectiv_arb_sizeof(const void *)") +fn("xcb_glx_get_query_objectiv_arb_cookie_t xcb_glx_get_query_objectiv_arb(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_query_objectiv_arb_cookie_t xcb_glx_get_query_objectiv_arb_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("int32_t * xcb_glx_get_query_objectiv_arb_data(const xcb_glx_get_query_objectiv_arb_reply_t *)") +fn("int xcb_glx_get_query_objectiv_arb_data_length(const xcb_glx_get_query_objectiv_arb_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_query_objectiv_arb_data_end(const xcb_glx_get_query_objectiv_arb_reply_t *)") + +fn("xcb_glx_get_query_objectiv_arb_reply_t * xcb_glx_get_query_objectiv_arb_reply(xcb_connection_t *, xcb_glx_get_query_objectiv_arb_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_glx_get_query_objectuiv_arb_sizeof(const void *)") +fn("xcb_glx_get_query_objectuiv_arb_cookie_t xcb_glx_get_query_objectuiv_arb(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +fn("xcb_glx_get_query_objectuiv_arb_cookie_t xcb_glx_get_query_objectuiv_arb_unchecked(xcb_connection_t *, xcb_glx_context_tag_t, uint32_t, uint32_t)") +# ::Iterator:: +fn("uint32_t * xcb_glx_get_query_objectuiv_arb_data(const xcb_glx_get_query_objectuiv_arb_reply_t *)") +fn("int xcb_glx_get_query_objectuiv_arb_data_length(const xcb_glx_get_query_objectuiv_arb_reply_t *)") +fn("xcb_generic_iterator_t xcb_glx_get_query_objectuiv_arb_data_end(const xcb_glx_get_query_objectuiv_arb_reply_t *)") + +fn("xcb_glx_get_query_objectuiv_arb_reply_t * xcb_glx_get_query_objectuiv_arb_reply(xcb_connection_t *, xcb_glx_get_query_objectuiv_arb_cookie_t, xcb_generic_error_t **)"); no_pack() + +Generate() diff --git a/ThunkLibs/libxcb_glx/Guest.cpp b/ThunkLibs/libxcb_glx/Guest.cpp new file mode 100644 index 000000000..07ecf0b19 --- /dev/null +++ b/ThunkLibs/libxcb_glx/Guest.cpp @@ -0,0 +1,2007 @@ +/* +$info$ +tags: thunklibs|xcb-glx +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { + xcb_extension_t xcb_glx_id = { + .name = "GLX", + .global_id = 0, + }; + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_glx_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_glx_FEX_usable_size(&args); + return args.rv; + } + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_glx_init_extension(c, &xcb_glx_id); + } + + static xcb_void_cookie_t fexfn_pack_xcb_glx_create_context_checked(xcb_connection_t * a_0,xcb_glx_context_t a_1,xcb_visualid_t a_2,uint32_t a_3,xcb_glx_context_t a_4,uint8_t a_5){ + struct {xcb_connection_t * a_0;xcb_glx_context_t a_1;xcb_visualid_t a_2;uint32_t a_3;xcb_glx_context_t a_4;uint8_t a_5;xcb_void_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2;args.a_3 = a_3;args.a_4 = a_4;args.a_5 = a_5; + fexthunks_libxcb_glx_xcb_glx_create_context_checked(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_void_cookie_t fexfn_pack_xcb_glx_create_context(xcb_connection_t * a_0,xcb_glx_context_t a_1,xcb_visualid_t a_2,uint32_t a_3,xcb_glx_context_t a_4,uint8_t a_5){ + struct {xcb_connection_t * a_0;xcb_glx_context_t a_1;xcb_visualid_t a_2;uint32_t a_3;xcb_glx_context_t a_4;uint8_t a_5;xcb_void_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2;args.a_3 = a_3;args.a_4 = a_4;args.a_5 = a_5; + fexthunks_libxcb_glx_xcb_glx_create_context(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_glx_make_current_reply_t * fexfn_pack_xcb_glx_make_current_reply(xcb_connection_t * a_0,xcb_glx_make_current_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_make_current_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_make_current_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_make_current_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_is_direct_reply_t * fexfn_pack_xcb_glx_is_direct_reply(xcb_connection_t * a_0,xcb_glx_is_direct_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_is_direct_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_is_direct_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_is_direct_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_query_version_reply_t * fexfn_pack_xcb_glx_query_version_reply(xcb_connection_t * a_0,xcb_glx_query_version_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_query_version_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_query_version_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_query_version_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + static xcb_glx_get_visual_configs_reply_t * fexfn_pack_xcb_glx_get_visual_configs_reply(xcb_connection_t * a_0,xcb_glx_get_visual_configs_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_visual_configs_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_visual_configs_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_visual_configs_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_vendor_private_with_reply_reply_t * fexfn_pack_xcb_glx_vendor_private_with_reply_reply(xcb_connection_t * a_0,xcb_glx_vendor_private_with_reply_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_vendor_private_with_reply_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_vendor_private_with_reply_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_vendor_private_with_reply_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_query_extensions_string_reply_t * fexfn_pack_xcb_glx_query_extensions_string_reply(xcb_connection_t * a_0,xcb_glx_query_extensions_string_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_query_extensions_string_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_query_extensions_string_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_query_extensions_string_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_query_server_string_reply_t * fexfn_pack_xcb_glx_query_server_string_reply(xcb_connection_t * a_0,xcb_glx_query_server_string_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_query_server_string_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_query_server_string_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_query_server_string_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_fb_configs_reply_t * fexfn_pack_xcb_glx_get_fb_configs_reply(xcb_connection_t * a_0,xcb_glx_get_fb_configs_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_fb_configs_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_fb_configs_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_fb_configs_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_query_context_reply_t * fexfn_pack_xcb_glx_query_context_reply(xcb_connection_t * a_0,xcb_glx_query_context_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_query_context_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_query_context_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_query_context_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_make_context_current_reply_t * fexfn_pack_xcb_glx_make_context_current_reply(xcb_connection_t * a_0,xcb_glx_make_context_current_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_make_context_current_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_make_context_current_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_make_context_current_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_drawable_attributes_reply_t * fexfn_pack_xcb_glx_get_drawable_attributes_reply(xcb_connection_t * a_0,xcb_glx_get_drawable_attributes_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_drawable_attributes_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_drawable_attributes_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_drawable_attributes_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_gen_lists_reply_t * fexfn_pack_xcb_glx_gen_lists_reply(xcb_connection_t * a_0,xcb_glx_gen_lists_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_gen_lists_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_gen_lists_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_gen_lists_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_render_mode_reply_t * fexfn_pack_xcb_glx_render_mode_reply(xcb_connection_t * a_0,xcb_glx_render_mode_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_render_mode_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_render_mode_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_render_mode_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_finish_reply_t * fexfn_pack_xcb_glx_finish_reply(xcb_connection_t * a_0,xcb_glx_finish_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_finish_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_finish_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_finish_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_read_pixels_reply_t * fexfn_pack_xcb_glx_read_pixels_reply(xcb_connection_t * a_0,xcb_glx_read_pixels_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_read_pixels_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_read_pixels_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_read_pixels_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_booleanv_reply_t * fexfn_pack_xcb_glx_get_booleanv_reply(xcb_connection_t * a_0,xcb_glx_get_booleanv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_booleanv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_booleanv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_booleanv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_clip_plane_reply_t * fexfn_pack_xcb_glx_get_clip_plane_reply(xcb_connection_t * a_0,xcb_glx_get_clip_plane_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_clip_plane_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_clip_plane_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_clip_plane_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_doublev_reply_t * fexfn_pack_xcb_glx_get_doublev_reply(xcb_connection_t * a_0,xcb_glx_get_doublev_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_doublev_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_doublev_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_doublev_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_error_reply_t * fexfn_pack_xcb_glx_get_error_reply(xcb_connection_t * a_0,xcb_glx_get_error_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_error_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_error_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_error_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_floatv_reply_t * fexfn_pack_xcb_glx_get_floatv_reply(xcb_connection_t * a_0,xcb_glx_get_floatv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_floatv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_floatv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_floatv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_integerv_reply_t * fexfn_pack_xcb_glx_get_integerv_reply(xcb_connection_t * a_0,xcb_glx_get_integerv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_integerv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_integerv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_integerv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_lightfv_reply_t * fexfn_pack_xcb_glx_get_lightfv_reply(xcb_connection_t * a_0,xcb_glx_get_lightfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_lightfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_lightfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_lightfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_lightiv_reply_t * fexfn_pack_xcb_glx_get_lightiv_reply(xcb_connection_t * a_0,xcb_glx_get_lightiv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_lightiv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_lightiv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_lightiv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_mapdv_reply_t * fexfn_pack_xcb_glx_get_mapdv_reply(xcb_connection_t * a_0,xcb_glx_get_mapdv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_mapdv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_mapdv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_mapdv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_mapfv_reply_t * fexfn_pack_xcb_glx_get_mapfv_reply(xcb_connection_t * a_0,xcb_glx_get_mapfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_mapfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_mapfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_mapfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_mapiv_reply_t * fexfn_pack_xcb_glx_get_mapiv_reply(xcb_connection_t * a_0,xcb_glx_get_mapiv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_mapiv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_mapiv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_mapiv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_materialfv_reply_t * fexfn_pack_xcb_glx_get_materialfv_reply(xcb_connection_t * a_0,xcb_glx_get_materialfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_materialfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_materialfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_materialfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_materialiv_reply_t * fexfn_pack_xcb_glx_get_materialiv_reply(xcb_connection_t * a_0,xcb_glx_get_materialiv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_materialiv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_materialiv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_materialiv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_pixel_mapfv_reply_t * fexfn_pack_xcb_glx_get_pixel_mapfv_reply(xcb_connection_t * a_0,xcb_glx_get_pixel_mapfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_pixel_mapfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_pixel_mapfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_pixel_mapfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_pixel_mapuiv_reply_t * fexfn_pack_xcb_glx_get_pixel_mapuiv_reply(xcb_connection_t * a_0,xcb_glx_get_pixel_mapuiv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_pixel_mapuiv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_pixel_mapuiv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_pixel_mapuiv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_pixel_mapusv_reply_t * fexfn_pack_xcb_glx_get_pixel_mapusv_reply(xcb_connection_t * a_0,xcb_glx_get_pixel_mapusv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_pixel_mapusv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_pixel_mapusv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_pixel_mapusv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_polygon_stipple_reply_t * fexfn_pack_xcb_glx_get_polygon_stipple_reply(xcb_connection_t * a_0,xcb_glx_get_polygon_stipple_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_polygon_stipple_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_polygon_stipple_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_polygon_stipple_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_string_reply_t * fexfn_pack_xcb_glx_get_string_reply(xcb_connection_t * a_0,xcb_glx_get_string_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_string_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_string_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_string_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_envfv_reply_t * fexfn_pack_xcb_glx_get_tex_envfv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_envfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_envfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_envfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_envfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_enviv_reply_t * fexfn_pack_xcb_glx_get_tex_enviv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_enviv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_enviv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_enviv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_enviv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_gendv_reply_t * fexfn_pack_xcb_glx_get_tex_gendv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_gendv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_gendv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_gendv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_gendv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_genfv_reply_t * fexfn_pack_xcb_glx_get_tex_genfv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_genfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_genfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_genfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_genfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_geniv_reply_t * fexfn_pack_xcb_glx_get_tex_geniv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_geniv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_geniv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_geniv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_geniv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_image_reply_t * fexfn_pack_xcb_glx_get_tex_image_reply(xcb_connection_t * a_0,xcb_glx_get_tex_image_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_image_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_image_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_image_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_parameterfv_reply_t * fexfn_pack_xcb_glx_get_tex_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_parameterfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_parameterfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_parameterfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_parameteriv_reply_t * fexfn_pack_xcb_glx_get_tex_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_parameteriv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_parameteriv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_parameteriv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_level_parameterfv_reply_t * fexfn_pack_xcb_glx_get_tex_level_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_level_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_level_parameterfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_level_parameterfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_level_parameterfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_tex_level_parameteriv_reply_t * fexfn_pack_xcb_glx_get_tex_level_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_level_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_tex_level_parameteriv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_tex_level_parameteriv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_tex_level_parameteriv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_is_enabled_reply_t * fexfn_pack_xcb_glx_is_enabled_reply(xcb_connection_t * a_0,xcb_glx_is_enabled_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_is_enabled_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_is_enabled_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_is_enabled_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_is_list_reply_t * fexfn_pack_xcb_glx_is_list_reply(xcb_connection_t * a_0,xcb_glx_is_list_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_is_list_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_is_list_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_is_list_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_are_textures_resident_reply_t * fexfn_pack_xcb_glx_are_textures_resident_reply(xcb_connection_t * a_0,xcb_glx_are_textures_resident_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_are_textures_resident_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_are_textures_resident_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_are_textures_resident_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_gen_textures_reply_t * fexfn_pack_xcb_glx_gen_textures_reply(xcb_connection_t * a_0,xcb_glx_gen_textures_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_gen_textures_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_gen_textures_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_gen_textures_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_is_texture_reply_t * fexfn_pack_xcb_glx_is_texture_reply(xcb_connection_t * a_0,xcb_glx_is_texture_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_is_texture_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_is_texture_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_is_texture_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_color_table_reply_t * fexfn_pack_xcb_glx_get_color_table_reply(xcb_connection_t * a_0,xcb_glx_get_color_table_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_color_table_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_color_table_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_color_table_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_color_table_parameterfv_reply_t * fexfn_pack_xcb_glx_get_color_table_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_color_table_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_color_table_parameterfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_color_table_parameterfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_color_table_parameterfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_color_table_parameteriv_reply_t * fexfn_pack_xcb_glx_get_color_table_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_color_table_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_color_table_parameteriv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_color_table_parameteriv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_color_table_parameteriv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_convolution_filter_reply_t * fexfn_pack_xcb_glx_get_convolution_filter_reply(xcb_connection_t * a_0,xcb_glx_get_convolution_filter_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_convolution_filter_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_convolution_filter_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_convolution_filter_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_convolution_parameterfv_reply_t * fexfn_pack_xcb_glx_get_convolution_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_convolution_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_convolution_parameterfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_convolution_parameterfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_convolution_parameterfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_convolution_parameteriv_reply_t * fexfn_pack_xcb_glx_get_convolution_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_convolution_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_convolution_parameteriv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_convolution_parameteriv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_convolution_parameteriv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_separable_filter_reply_t * fexfn_pack_xcb_glx_get_separable_filter_reply(xcb_connection_t * a_0,xcb_glx_get_separable_filter_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_separable_filter_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_separable_filter_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_separable_filter_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_histogram_reply_t * fexfn_pack_xcb_glx_get_histogram_reply(xcb_connection_t * a_0,xcb_glx_get_histogram_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_histogram_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_histogram_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_histogram_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_histogram_parameterfv_reply_t * fexfn_pack_xcb_glx_get_histogram_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_histogram_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_histogram_parameterfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_histogram_parameterfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_histogram_parameterfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_histogram_parameteriv_reply_t * fexfn_pack_xcb_glx_get_histogram_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_histogram_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_histogram_parameteriv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_histogram_parameteriv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_histogram_parameteriv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_minmax_reply_t * fexfn_pack_xcb_glx_get_minmax_reply(xcb_connection_t * a_0,xcb_glx_get_minmax_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_minmax_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_minmax_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_minmax_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_minmax_parameterfv_reply_t * fexfn_pack_xcb_glx_get_minmax_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_minmax_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_minmax_parameterfv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_minmax_parameterfv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_minmax_parameterfv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_minmax_parameteriv_reply_t * fexfn_pack_xcb_glx_get_minmax_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_minmax_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_minmax_parameteriv_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_minmax_parameteriv_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_minmax_parameteriv_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_compressed_tex_image_arb_reply_t * fexfn_pack_xcb_glx_get_compressed_tex_image_arb_reply(xcb_connection_t * a_0,xcb_glx_get_compressed_tex_image_arb_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_compressed_tex_image_arb_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_compressed_tex_image_arb_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_compressed_tex_image_arb_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_gen_queries_arb_reply_t * fexfn_pack_xcb_glx_gen_queries_arb_reply(xcb_connection_t * a_0,xcb_glx_gen_queries_arb_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_gen_queries_arb_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_gen_queries_arb_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_gen_queries_arb_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_is_query_arb_reply_t * fexfn_pack_xcb_glx_is_query_arb_reply(xcb_connection_t * a_0,xcb_glx_is_query_arb_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_is_query_arb_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_is_query_arb_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_is_query_arb_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_queryiv_arb_reply_t * fexfn_pack_xcb_glx_get_queryiv_arb_reply(xcb_connection_t * a_0,xcb_glx_get_queryiv_arb_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_queryiv_arb_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_queryiv_arb_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_queryiv_arb_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_query_objectiv_arb_reply_t * fexfn_pack_xcb_glx_get_query_objectiv_arb_reply(xcb_connection_t * a_0,xcb_glx_get_query_objectiv_arb_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_query_objectiv_arb_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_query_objectiv_arb_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_query_objectiv_arb_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_glx_get_query_objectuiv_arb_reply_t * fexfn_pack_xcb_glx_get_query_objectuiv_arb_reply(xcb_connection_t * a_0,xcb_glx_get_query_objectuiv_arb_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_glx_get_query_objectuiv_arb_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_glx_get_query_objectuiv_arb_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_glx_xcb_glx_get_query_objectuiv_arb_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + xcb_void_cookie_t xcb_glx_create_context_checked(xcb_connection_t * a_0,xcb_glx_context_t a_1,xcb_visualid_t a_2,uint32_t a_3,xcb_glx_context_t a_4,uint8_t a_5) __attribute__((alias("fexfn_pack_xcb_glx_create_context_checked"))); + xcb_void_cookie_t xcb_glx_create_context(xcb_connection_t * a_0,xcb_glx_context_t a_1,xcb_visualid_t a_2,uint32_t a_3,xcb_glx_context_t a_4,uint8_t a_5) __attribute__((alias("fexfn_pack_xcb_glx_create_context"))); + xcb_glx_make_current_reply_t * xcb_glx_make_current_reply(xcb_connection_t * a_0,xcb_glx_make_current_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_make_current_reply"))); + xcb_glx_is_direct_reply_t * xcb_glx_is_direct_reply(xcb_connection_t * a_0,xcb_glx_is_direct_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_is_direct_reply"))); + xcb_glx_query_version_reply_t * xcb_glx_query_version_reply(xcb_connection_t * a_0,xcb_glx_query_version_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_query_version_reply"))); + xcb_glx_get_visual_configs_reply_t * xcb_glx_get_visual_configs_reply(xcb_connection_t * a_0,xcb_glx_get_visual_configs_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_visual_configs_reply"))); + xcb_glx_vendor_private_with_reply_reply_t * xcb_glx_vendor_private_with_reply_reply(xcb_connection_t * a_0,xcb_glx_vendor_private_with_reply_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_vendor_private_with_reply_reply"))); + xcb_glx_query_extensions_string_reply_t * xcb_glx_query_extensions_string_reply(xcb_connection_t * a_0,xcb_glx_query_extensions_string_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_query_extensions_string_reply"))); + xcb_glx_query_server_string_reply_t * xcb_glx_query_server_string_reply(xcb_connection_t * a_0,xcb_glx_query_server_string_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_query_server_string_reply"))); + xcb_glx_get_fb_configs_reply_t * xcb_glx_get_fb_configs_reply(xcb_connection_t * a_0,xcb_glx_get_fb_configs_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_fb_configs_reply"))); + xcb_glx_query_context_reply_t * xcb_glx_query_context_reply(xcb_connection_t * a_0,xcb_glx_query_context_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_query_context_reply"))); + xcb_glx_make_context_current_reply_t * xcb_glx_make_context_current_reply(xcb_connection_t * a_0,xcb_glx_make_context_current_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_make_context_current_reply"))); + xcb_glx_get_drawable_attributes_reply_t * xcb_glx_get_drawable_attributes_reply(xcb_connection_t * a_0,xcb_glx_get_drawable_attributes_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_drawable_attributes_reply"))); + xcb_glx_gen_lists_reply_t * xcb_glx_gen_lists_reply(xcb_connection_t * a_0,xcb_glx_gen_lists_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_gen_lists_reply"))); + xcb_glx_render_mode_reply_t * xcb_glx_render_mode_reply(xcb_connection_t * a_0,xcb_glx_render_mode_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_render_mode_reply"))); + xcb_glx_finish_reply_t * xcb_glx_finish_reply(xcb_connection_t * a_0,xcb_glx_finish_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_finish_reply"))); + xcb_glx_read_pixels_reply_t * xcb_glx_read_pixels_reply(xcb_connection_t * a_0,xcb_glx_read_pixels_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_read_pixels_reply"))); + xcb_glx_get_booleanv_reply_t * xcb_glx_get_booleanv_reply(xcb_connection_t * a_0,xcb_glx_get_booleanv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_booleanv_reply"))); + xcb_glx_get_clip_plane_reply_t * xcb_glx_get_clip_plane_reply(xcb_connection_t * a_0,xcb_glx_get_clip_plane_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_clip_plane_reply"))); + xcb_glx_get_doublev_reply_t * xcb_glx_get_doublev_reply(xcb_connection_t * a_0,xcb_glx_get_doublev_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_doublev_reply"))); + xcb_glx_get_error_reply_t * xcb_glx_get_error_reply(xcb_connection_t * a_0,xcb_glx_get_error_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_error_reply"))); + xcb_glx_get_floatv_reply_t * xcb_glx_get_floatv_reply(xcb_connection_t * a_0,xcb_glx_get_floatv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_floatv_reply"))); + xcb_glx_get_integerv_reply_t * xcb_glx_get_integerv_reply(xcb_connection_t * a_0,xcb_glx_get_integerv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_integerv_reply"))); + xcb_glx_get_lightfv_reply_t * xcb_glx_get_lightfv_reply(xcb_connection_t * a_0,xcb_glx_get_lightfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_lightfv_reply"))); + xcb_glx_get_lightiv_reply_t * xcb_glx_get_lightiv_reply(xcb_connection_t * a_0,xcb_glx_get_lightiv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_lightiv_reply"))); + xcb_glx_get_mapdv_reply_t * xcb_glx_get_mapdv_reply(xcb_connection_t * a_0,xcb_glx_get_mapdv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_mapdv_reply"))); + xcb_glx_get_mapfv_reply_t * xcb_glx_get_mapfv_reply(xcb_connection_t * a_0,xcb_glx_get_mapfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_mapfv_reply"))); + xcb_glx_get_mapiv_reply_t * xcb_glx_get_mapiv_reply(xcb_connection_t * a_0,xcb_glx_get_mapiv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_mapiv_reply"))); + xcb_glx_get_materialfv_reply_t * xcb_glx_get_materialfv_reply(xcb_connection_t * a_0,xcb_glx_get_materialfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_materialfv_reply"))); + xcb_glx_get_materialiv_reply_t * xcb_glx_get_materialiv_reply(xcb_connection_t * a_0,xcb_glx_get_materialiv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_materialiv_reply"))); + xcb_glx_get_pixel_mapfv_reply_t * xcb_glx_get_pixel_mapfv_reply(xcb_connection_t * a_0,xcb_glx_get_pixel_mapfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_pixel_mapfv_reply"))); + xcb_glx_get_pixel_mapuiv_reply_t * xcb_glx_get_pixel_mapuiv_reply(xcb_connection_t * a_0,xcb_glx_get_pixel_mapuiv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_pixel_mapuiv_reply"))); + xcb_glx_get_pixel_mapusv_reply_t * xcb_glx_get_pixel_mapusv_reply(xcb_connection_t * a_0,xcb_glx_get_pixel_mapusv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_pixel_mapusv_reply"))); + xcb_glx_get_polygon_stipple_reply_t * xcb_glx_get_polygon_stipple_reply(xcb_connection_t * a_0,xcb_glx_get_polygon_stipple_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_polygon_stipple_reply"))); + xcb_glx_get_string_reply_t * xcb_glx_get_string_reply(xcb_connection_t * a_0,xcb_glx_get_string_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_string_reply"))); + xcb_glx_get_tex_envfv_reply_t * xcb_glx_get_tex_envfv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_envfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_envfv_reply"))); + xcb_glx_get_tex_enviv_reply_t * xcb_glx_get_tex_enviv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_enviv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_enviv_reply"))); + xcb_glx_get_tex_gendv_reply_t * xcb_glx_get_tex_gendv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_gendv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_gendv_reply"))); + xcb_glx_get_tex_genfv_reply_t * xcb_glx_get_tex_genfv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_genfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_genfv_reply"))); + xcb_glx_get_tex_geniv_reply_t * xcb_glx_get_tex_geniv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_geniv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_geniv_reply"))); + xcb_glx_get_tex_image_reply_t * xcb_glx_get_tex_image_reply(xcb_connection_t * a_0,xcb_glx_get_tex_image_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_image_reply"))); + xcb_glx_get_tex_parameterfv_reply_t * xcb_glx_get_tex_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_parameterfv_reply"))); + xcb_glx_get_tex_parameteriv_reply_t * xcb_glx_get_tex_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_parameteriv_reply"))); + xcb_glx_get_tex_level_parameterfv_reply_t * xcb_glx_get_tex_level_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_level_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_level_parameterfv_reply"))); + xcb_glx_get_tex_level_parameteriv_reply_t * xcb_glx_get_tex_level_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_tex_level_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_tex_level_parameteriv_reply"))); + xcb_glx_is_enabled_reply_t * xcb_glx_is_enabled_reply(xcb_connection_t * a_0,xcb_glx_is_enabled_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_is_enabled_reply"))); + xcb_glx_is_list_reply_t * xcb_glx_is_list_reply(xcb_connection_t * a_0,xcb_glx_is_list_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_is_list_reply"))); + xcb_glx_are_textures_resident_reply_t * xcb_glx_are_textures_resident_reply(xcb_connection_t * a_0,xcb_glx_are_textures_resident_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_are_textures_resident_reply"))); + xcb_glx_gen_textures_reply_t * xcb_glx_gen_textures_reply(xcb_connection_t * a_0,xcb_glx_gen_textures_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_gen_textures_reply"))); + xcb_glx_is_texture_reply_t * xcb_glx_is_texture_reply(xcb_connection_t * a_0,xcb_glx_is_texture_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_is_texture_reply"))); + xcb_glx_get_color_table_reply_t * xcb_glx_get_color_table_reply(xcb_connection_t * a_0,xcb_glx_get_color_table_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_color_table_reply"))); + xcb_glx_get_color_table_parameterfv_reply_t * xcb_glx_get_color_table_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_color_table_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_color_table_parameterfv_reply"))); + xcb_glx_get_color_table_parameteriv_reply_t * xcb_glx_get_color_table_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_color_table_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_color_table_parameteriv_reply"))); + xcb_glx_get_convolution_filter_reply_t * xcb_glx_get_convolution_filter_reply(xcb_connection_t * a_0,xcb_glx_get_convolution_filter_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_convolution_filter_reply"))); + xcb_glx_get_convolution_parameterfv_reply_t * xcb_glx_get_convolution_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_convolution_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_convolution_parameterfv_reply"))); + xcb_glx_get_convolution_parameteriv_reply_t * xcb_glx_get_convolution_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_convolution_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_convolution_parameteriv_reply"))); + xcb_glx_get_separable_filter_reply_t * xcb_glx_get_separable_filter_reply(xcb_connection_t * a_0,xcb_glx_get_separable_filter_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_separable_filter_reply"))); + xcb_glx_get_histogram_reply_t * xcb_glx_get_histogram_reply(xcb_connection_t * a_0,xcb_glx_get_histogram_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_histogram_reply"))); + xcb_glx_get_histogram_parameterfv_reply_t * xcb_glx_get_histogram_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_histogram_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_histogram_parameterfv_reply"))); + xcb_glx_get_histogram_parameteriv_reply_t * xcb_glx_get_histogram_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_histogram_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_histogram_parameteriv_reply"))); + xcb_glx_get_minmax_reply_t * xcb_glx_get_minmax_reply(xcb_connection_t * a_0,xcb_glx_get_minmax_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_minmax_reply"))); + xcb_glx_get_minmax_parameterfv_reply_t * xcb_glx_get_minmax_parameterfv_reply(xcb_connection_t * a_0,xcb_glx_get_minmax_parameterfv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_minmax_parameterfv_reply"))); + xcb_glx_get_minmax_parameteriv_reply_t * xcb_glx_get_minmax_parameteriv_reply(xcb_connection_t * a_0,xcb_glx_get_minmax_parameteriv_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_minmax_parameteriv_reply"))); + xcb_glx_get_compressed_tex_image_arb_reply_t * xcb_glx_get_compressed_tex_image_arb_reply(xcb_connection_t * a_0,xcb_glx_get_compressed_tex_image_arb_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_compressed_tex_image_arb_reply"))); + xcb_glx_gen_queries_arb_reply_t * xcb_glx_gen_queries_arb_reply(xcb_connection_t * a_0,xcb_glx_gen_queries_arb_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_gen_queries_arb_reply"))); + xcb_glx_is_query_arb_reply_t * xcb_glx_is_query_arb_reply(xcb_connection_t * a_0,xcb_glx_is_query_arb_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_is_query_arb_reply"))); + xcb_glx_get_queryiv_arb_reply_t * xcb_glx_get_queryiv_arb_reply(xcb_connection_t * a_0,xcb_glx_get_queryiv_arb_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_queryiv_arb_reply"))); + xcb_glx_get_query_objectiv_arb_reply_t * xcb_glx_get_query_objectiv_arb_reply(xcb_connection_t * a_0,xcb_glx_get_query_objectiv_arb_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_query_objectiv_arb_reply"))); + xcb_glx_get_query_objectuiv_arb_reply_t * xcb_glx_get_query_objectuiv_arb_reply(xcb_connection_t * a_0,xcb_glx_get_query_objectuiv_arb_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_glx_get_query_objectuiv_arb_reply"))); +} + +LOAD_LIB(libxcb_glx) diff --git a/ThunkLibs/libxcb_glx/Host.cpp b/ThunkLibs/libxcb_glx/Host.cpp new file mode 100644 index 000000000..9f557563f --- /dev/null +++ b/ThunkLibs/libxcb_glx/Host.cpp @@ -0,0 +1,66 @@ +/* +$info$ +tags: thunklibs|xcb-glx +$end_info$ +*/ + +#include +#include + +#include +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + + +void fexfn_unpack_libxcb_glx_FEX_xcb_glx_init_extension(void *argsv); + +void fexfn_unpack_libxcb_glx_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_glx_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_unpack_libxcb_glx_FEX_xcb_glx_init_extension(void *argsv){ + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + if (strcmp(args->a_1->name, "GLX") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_glx_so, "xcb_glx_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + typedef const struct xcb_query_extension_reply_t * fexldr_type_libxcb_xcb_get_extension_data(xcb_connection_t * a_0,xcb_extension_t * a_1); + fexldr_type_libxcb_xcb_get_extension_data *fexldr_ptr_libxcb_xcb_get_extension_data; + + fexldr_ptr_libxcb_xcb_get_extension_data = (fexldr_type_libxcb_xcb_get_extension_data*)dlsym(RTLD_DEFAULT, "xcb_get_extension_data"); + + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} + +EXPORTS(libxcb_glx) From c0aad64578d07de0cab69fbc4f20e2ca3b572b2d Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:13:49 -0700 Subject: [PATCH 10/20] Thunks: Adds libxcb_present --- ThunkLibs/Generators/libxcb_present.py | 38 ++++++++ ThunkLibs/libxcb_present/Guest.cpp | 123 +++++++++++++++++++++++++ ThunkLibs/libxcb_present/Host.cpp | 66 +++++++++++++ 3 files changed, 227 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb_present.py create mode 100644 ThunkLibs/libxcb_present/Guest.cpp create mode 100644 ThunkLibs/libxcb_present/Host.cpp diff --git a/ThunkLibs/Generators/libxcb_present.py b/ThunkLibs/Generators/libxcb_present.py new file mode 100644 index 000000000..d4f3c9116 --- /dev/null +++ b/ThunkLibs/Generators/libxcb_present.py @@ -0,0 +1,38 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib_with_filename("libxcb_present", "libxcb-present") +# FEX +fn("void FEX_xcb_present_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("void xcb_present_notify_next(xcb_present_notify_iterator_t *)") +fn("xcb_generic_iterator_t xcb_present_notify_end(xcb_present_notify_iterator_t)") +fn("xcb_present_query_version_cookie_t xcb_present_query_version(xcb_connection_t *, uint32_t, uint32_t)"); no_pack() +fn("xcb_present_query_version_cookie_t xcb_present_query_version_unchecked(xcb_connection_t *, uint32_t, uint32_t)"); no_pack() +fn("xcb_present_query_version_reply_t * xcb_present_query_version_reply(xcb_connection_t *, xcb_present_query_version_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_present_pixmap_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_present_pixmap_checked(xcb_connection_t *, xcb_window_t, xcb_pixmap_t, uint32_t, xcb_xfixes_region_t, xcb_xfixes_region_t, int16_t, int16_t, xcb_randr_crtc_t, xcb_sync_fence_t, xcb_sync_fence_t, uint32_t, uint64_t, uint64_t, uint64_t, uint32_t, const xcb_present_notify_t *)") +fn("xcb_void_cookie_t xcb_present_pixmap(xcb_connection_t *, xcb_window_t, xcb_pixmap_t, uint32_t, xcb_xfixes_region_t, xcb_xfixes_region_t, int16_t, int16_t, xcb_randr_crtc_t, xcb_sync_fence_t, xcb_sync_fence_t, uint32_t, uint64_t, uint64_t, uint64_t, uint32_t, const xcb_present_notify_t *)") +# ::Iterator:: +fn("xcb_present_notify_t * xcb_present_pixmap_notifies(const xcb_present_pixmap_request_t *)") +fn("int xcb_present_pixmap_notifies_length(const xcb_present_pixmap_request_t *)") +fn("xcb_present_notify_iterator_t xcb_present_pixmap_notifies_iterator(const xcb_present_pixmap_request_t *)") + +fn("xcb_void_cookie_t xcb_present_notify_msc_checked(xcb_connection_t *, xcb_window_t, uint32_t, uint64_t, uint64_t, uint64_t)") +fn("xcb_void_cookie_t xcb_present_notify_msc(xcb_connection_t *, xcb_window_t, uint32_t, uint64_t, uint64_t, uint64_t)") +fn("void xcb_present_event_next(xcb_present_event_iterator_t *)") +fn("xcb_generic_iterator_t xcb_present_event_end(xcb_present_event_iterator_t)") +fn("xcb_void_cookie_t xcb_present_select_input_checked(xcb_connection_t *, xcb_present_event_t, xcb_window_t, uint32_t)") +fn("xcb_void_cookie_t xcb_present_select_input(xcb_connection_t *, xcb_present_event_t, xcb_window_t, uint32_t)") +fn("xcb_present_query_capabilities_cookie_t xcb_present_query_capabilities(xcb_connection_t *, uint32_t)") +fn("xcb_present_query_capabilities_cookie_t xcb_present_query_capabilities_unchecked(xcb_connection_t *, uint32_t)") +fn("xcb_present_query_capabilities_reply_t * xcb_present_query_capabilities_reply(xcb_connection_t *, xcb_present_query_capabilities_cookie_t, xcb_generic_error_t **)"); no_pack(); +fn("int xcb_present_redirect_notify_sizeof(const void *, uint32_t)") +# ::Iterator:: +fn("xcb_present_notify_t * xcb_present_redirect_notify_notifies(const xcb_present_redirect_notify_event_t *)") +fn("int xcb_present_redirect_notify_notifies_length(const xcb_present_redirect_notify_event_t *)") +fn("xcb_present_notify_iterator_t xcb_present_redirect_notify_notifies_iterator(const xcb_present_redirect_notify_event_t *)") + +Generate() diff --git a/ThunkLibs/libxcb_present/Guest.cpp b/ThunkLibs/libxcb_present/Guest.cpp new file mode 100644 index 000000000..7baeb2ded --- /dev/null +++ b/ThunkLibs/libxcb_present/Guest.cpp @@ -0,0 +1,123 @@ +/* +$info$ +tags: thunklibs|xcb-present +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { + xcb_extension_t xcb_present_id = { + .name = "Present", + .global_id = 0, + }; + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_present_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_present_FEX_usable_size(&args); + return args.rv; + } + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_present_init_extension(c, &xcb_present_id); + } + + static xcb_present_query_version_cookie_t fexfn_pack_xcb_present_query_version(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;uint32_t a_2;xcb_present_query_version_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_present_xcb_present_query_version(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_present_query_version_cookie_t fexfn_pack_xcb_present_query_version_unchecked(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;uint32_t a_2;xcb_present_query_version_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_present_xcb_present_query_version_unchecked(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_present_query_version_reply_t * fexfn_pack_xcb_present_query_version_reply(xcb_connection_t * a_0,xcb_present_query_version_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_present_query_version_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_present_query_version_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_present_xcb_present_query_version_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_present_query_capabilities_reply_t * fexfn_pack_xcb_present_query_capabilities_reply(xcb_connection_t * a_0,xcb_present_query_capabilities_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_present_query_capabilities_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_present_query_capabilities_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_present_xcb_present_query_capabilities_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + xcb_present_query_version_cookie_t xcb_present_query_version(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_present_query_version"))); + xcb_present_query_version_cookie_t xcb_present_query_version_unchecked(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_present_query_version_unchecked"))); + xcb_present_query_version_reply_t * xcb_present_query_version_reply(xcb_connection_t * a_0,xcb_present_query_version_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_present_query_version_reply"))); + xcb_present_query_capabilities_reply_t * xcb_present_query_capabilities_reply(xcb_connection_t * a_0,xcb_present_query_capabilities_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_present_query_capabilities_reply"))); +} + +LOAD_LIB(libxcb_present) diff --git a/ThunkLibs/libxcb_present/Host.cpp b/ThunkLibs/libxcb_present/Host.cpp new file mode 100644 index 000000000..b9589706a --- /dev/null +++ b/ThunkLibs/libxcb_present/Host.cpp @@ -0,0 +1,66 @@ +/* +$info$ +tags: thunklibs|xcb-present +$end_info$ +*/ + +#include +#include + +#include +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + + +void fexfn_unpack_libxcb_present_FEX_xcb_present_init_extension(void *argsv); + +void fexfn_unpack_libxcb_present_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_present_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_unpack_libxcb_present_FEX_xcb_present_init_extension(void *argsv){ + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + if (strcmp(args->a_1->name, "Present") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_present_so, "xcb_present_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + typedef const struct xcb_query_extension_reply_t * fexldr_type_libxcb_xcb_get_extension_data(xcb_connection_t * a_0,xcb_extension_t * a_1); + fexldr_type_libxcb_xcb_get_extension_data *fexldr_ptr_libxcb_xcb_get_extension_data; + + fexldr_ptr_libxcb_xcb_get_extension_data = (fexldr_type_libxcb_xcb_get_extension_data*)dlsym(RTLD_DEFAULT, "xcb_get_extension_data"); + + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} + +EXPORTS(libxcb_present) From c5490821fcbce3d6a825faa132a3370a27d3ce65 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:14:03 -0700 Subject: [PATCH 11/20] Thunks: Adds libxcb_randr --- ThunkLibs/Generators/libxcb_randr.py | 400 +++++++++++++ ThunkLibs/libxcb_randr/Guest.cpp | 866 +++++++++++++++++++++++++++ ThunkLibs/libxcb_randr/Host.cpp | 66 ++ 3 files changed, 1332 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb_randr.py create mode 100644 ThunkLibs/libxcb_randr/Guest.cpp create mode 100644 ThunkLibs/libxcb_randr/Host.cpp diff --git a/ThunkLibs/Generators/libxcb_randr.py b/ThunkLibs/Generators/libxcb_randr.py new file mode 100644 index 000000000..e8cb005e5 --- /dev/null +++ b/ThunkLibs/Generators/libxcb_randr.py @@ -0,0 +1,400 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib_with_filename("libxcb_randr", "libxcb-randr") + +# FEX +fn("void FEX_xcb_randr_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("void xcb_randr_mode_next(xcb_randr_mode_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_mode_end(xcb_randr_mode_iterator_t)") +fn("void xcb_randr_crtc_next(xcb_randr_crtc_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_crtc_end(xcb_randr_crtc_iterator_t)") +fn("void xcb_randr_output_next(xcb_randr_output_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_output_end(xcb_randr_output_iterator_t)") +fn("void xcb_randr_provider_next(xcb_randr_provider_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_provider_end(xcb_randr_provider_iterator_t)") +fn("void xcb_randr_lease_next(xcb_randr_lease_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_lease_end(xcb_randr_lease_iterator_t)") +fn("void xcb_randr_screen_size_next(xcb_randr_screen_size_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_screen_size_end(xcb_randr_screen_size_iterator_t)") +fn("int xcb_randr_refresh_rates_sizeof(const void *)") +# ::Iterator:: +fn("uint16_t * xcb_randr_refresh_rates_rates(const xcb_randr_refresh_rates_t *)") +fn("int xcb_randr_refresh_rates_rates_length(const xcb_randr_refresh_rates_t *)") +fn("xcb_generic_iterator_t xcb_randr_refresh_rates_rates_end(const xcb_randr_refresh_rates_t *)") + +fn("void xcb_randr_refresh_rates_next(xcb_randr_refresh_rates_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_refresh_rates_end(xcb_randr_refresh_rates_iterator_t)") +fn("xcb_randr_query_version_cookie_t xcb_randr_query_version(xcb_connection_t *, uint32_t, uint32_t)"); no_pack() +fn("xcb_randr_query_version_cookie_t xcb_randr_query_version_unchecked(xcb_connection_t *, uint32_t, uint32_t)"); no_pack() +fn("xcb_randr_query_version_reply_t * xcb_randr_query_version_reply(xcb_connection_t *, xcb_randr_query_version_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_randr_set_screen_config_cookie_t xcb_randr_set_screen_config(xcb_connection_t *, xcb_window_t, xcb_timestamp_t, xcb_timestamp_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_randr_set_screen_config_cookie_t xcb_randr_set_screen_config_unchecked(xcb_connection_t *, xcb_window_t, xcb_timestamp_t, xcb_timestamp_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_randr_set_screen_config_reply_t * xcb_randr_set_screen_config_reply(xcb_connection_t *, xcb_randr_set_screen_config_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_randr_select_input_checked(xcb_connection_t *, xcb_window_t, uint16_t)") +fn("xcb_void_cookie_t xcb_randr_select_input(xcb_connection_t *, xcb_window_t, uint16_t)") +fn("int xcb_randr_get_screen_info_sizeof(const void *)") +fn("xcb_randr_get_screen_info_cookie_t xcb_randr_get_screen_info(xcb_connection_t *, xcb_window_t)") +fn("xcb_randr_get_screen_info_cookie_t xcb_randr_get_screen_info_unchecked(xcb_connection_t *, xcb_window_t)") +# ::Iterator:: +fn("xcb_randr_screen_size_t * xcb_randr_get_screen_info_sizes(const xcb_randr_get_screen_info_reply_t *)") +fn("int xcb_randr_get_screen_info_sizes_length(const xcb_randr_get_screen_info_reply_t *)") +fn("xcb_randr_screen_size_iterator_t xcb_randr_get_screen_info_sizes_iterator(const xcb_randr_get_screen_info_reply_t *)") + +fn("int xcb_randr_get_screen_info_rates_length(const xcb_randr_get_screen_info_reply_t *)") +fn("xcb_randr_refresh_rates_iterator_t xcb_randr_get_screen_info_rates_iterator(const xcb_randr_get_screen_info_reply_t *)") +fn("xcb_randr_get_screen_info_reply_t * xcb_randr_get_screen_info_reply(xcb_connection_t *, xcb_randr_get_screen_info_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_randr_get_screen_size_range_cookie_t xcb_randr_get_screen_size_range(xcb_connection_t *, xcb_window_t)") +fn("xcb_randr_get_screen_size_range_cookie_t xcb_randr_get_screen_size_range_unchecked(xcb_connection_t *, xcb_window_t)") +fn("xcb_randr_get_screen_size_range_reply_t * xcb_randr_get_screen_size_range_reply(xcb_connection_t *, xcb_randr_get_screen_size_range_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_randr_set_screen_size_checked(xcb_connection_t *, xcb_window_t, uint16_t, uint16_t, uint32_t, uint32_t)") +fn("xcb_void_cookie_t xcb_randr_set_screen_size(xcb_connection_t *, xcb_window_t, uint16_t, uint16_t, uint32_t, uint32_t)") +fn("void xcb_randr_mode_info_next(xcb_randr_mode_info_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_mode_info_end(xcb_randr_mode_info_iterator_t)") +fn("int xcb_randr_get_screen_resources_sizeof(const void *)") +fn("xcb_randr_get_screen_resources_cookie_t xcb_randr_get_screen_resources(xcb_connection_t *, xcb_window_t)") +fn("xcb_randr_get_screen_resources_cookie_t xcb_randr_get_screen_resources_unchecked(xcb_connection_t *, xcb_window_t)") +# ::Iterator:: +fn("xcb_randr_crtc_t * xcb_randr_get_screen_resources_crtcs(const xcb_randr_get_screen_resources_reply_t *)") +fn("int xcb_randr_get_screen_resources_crtcs_length(const xcb_randr_get_screen_resources_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_screen_resources_crtcs_end(const xcb_randr_get_screen_resources_reply_t *)") +# ::Iterator:: +fn("xcb_randr_output_t * xcb_randr_get_screen_resources_outputs(const xcb_randr_get_screen_resources_reply_t *)") +fn("int xcb_randr_get_screen_resources_outputs_length(const xcb_randr_get_screen_resources_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_screen_resources_outputs_end(const xcb_randr_get_screen_resources_reply_t *)") +# ::Iterator:: +fn("xcb_randr_mode_info_t * xcb_randr_get_screen_resources_modes(const xcb_randr_get_screen_resources_reply_t *)") +fn("int xcb_randr_get_screen_resources_modes_length(const xcb_randr_get_screen_resources_reply_t *)") +fn("xcb_randr_mode_info_iterator_t xcb_randr_get_screen_resources_modes_iterator(const xcb_randr_get_screen_resources_reply_t *)") +# ::Iterator:: +fn("uint8_t * xcb_randr_get_screen_resources_names(const xcb_randr_get_screen_resources_reply_t *)") +fn("int xcb_randr_get_screen_resources_names_length(const xcb_randr_get_screen_resources_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_screen_resources_names_end(const xcb_randr_get_screen_resources_reply_t *)") + +fn("xcb_randr_get_screen_resources_reply_t * xcb_randr_get_screen_resources_reply(xcb_connection_t *, xcb_randr_get_screen_resources_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_get_output_info_sizeof(const void *)") +fn("xcb_randr_get_output_info_cookie_t xcb_randr_get_output_info(xcb_connection_t *, xcb_randr_output_t, xcb_timestamp_t)") +fn("xcb_randr_get_output_info_cookie_t xcb_randr_get_output_info_unchecked(xcb_connection_t *, xcb_randr_output_t, xcb_timestamp_t)") +# ::Iterator:: +fn("xcb_randr_crtc_t * xcb_randr_get_output_info_crtcs(const xcb_randr_get_output_info_reply_t *)") +fn("int xcb_randr_get_output_info_crtcs_length(const xcb_randr_get_output_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_output_info_crtcs_end(const xcb_randr_get_output_info_reply_t *)") +# ::Iterator:: +fn("xcb_randr_mode_t * xcb_randr_get_output_info_modes(const xcb_randr_get_output_info_reply_t *)") +fn("int xcb_randr_get_output_info_modes_length(const xcb_randr_get_output_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_output_info_modes_end(const xcb_randr_get_output_info_reply_t *)") +# ::Iterator:: +fn("xcb_randr_output_t * xcb_randr_get_output_info_clones(const xcb_randr_get_output_info_reply_t *)") +fn("int xcb_randr_get_output_info_clones_length(const xcb_randr_get_output_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_output_info_clones_end(const xcb_randr_get_output_info_reply_t *)") +# ::Iterator:: +fn("uint8_t * xcb_randr_get_output_info_name(const xcb_randr_get_output_info_reply_t *)") +fn("int xcb_randr_get_output_info_name_length(const xcb_randr_get_output_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_output_info_name_end(const xcb_randr_get_output_info_reply_t *)") + +fn("xcb_randr_get_output_info_reply_t * xcb_randr_get_output_info_reply(xcb_connection_t *, xcb_randr_get_output_info_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_list_output_properties_sizeof(const void *)") +fn("xcb_randr_list_output_properties_cookie_t xcb_randr_list_output_properties(xcb_connection_t *, xcb_randr_output_t)") +fn("xcb_randr_list_output_properties_cookie_t xcb_randr_list_output_properties_unchecked(xcb_connection_t *, xcb_randr_output_t)") +# ::Iterator:: +fn("xcb_atom_t * xcb_randr_list_output_properties_atoms(const xcb_randr_list_output_properties_reply_t *)") +fn("int xcb_randr_list_output_properties_atoms_length(const xcb_randr_list_output_properties_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_list_output_properties_atoms_end(const xcb_randr_list_output_properties_reply_t *)") + +fn("xcb_randr_list_output_properties_reply_t * xcb_randr_list_output_properties_reply(xcb_connection_t *, xcb_randr_list_output_properties_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_query_output_property_sizeof(const void *)") +fn("xcb_randr_query_output_property_cookie_t xcb_randr_query_output_property(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t)") +fn("xcb_randr_query_output_property_cookie_t xcb_randr_query_output_property_unchecked(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t)") +# ::Iterator:: +fn("int32_t * xcb_randr_query_output_property_valid_values(const xcb_randr_query_output_property_reply_t *)") +fn("int xcb_randr_query_output_property_valid_values_length(const xcb_randr_query_output_property_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_query_output_property_valid_values_end(const xcb_randr_query_output_property_reply_t *)") + +fn("xcb_randr_query_output_property_reply_t * xcb_randr_query_output_property_reply(xcb_connection_t *, xcb_randr_query_output_property_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_configure_output_property_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_randr_configure_output_property_checked(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t, uint8_t, uint8_t, uint32_t, const int32_t *)") +fn("xcb_void_cookie_t xcb_randr_configure_output_property(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t, uint8_t, uint8_t, uint32_t, const int32_t *)") +# ::Iterator:: +fn("int32_t * xcb_randr_configure_output_property_values(const xcb_randr_configure_output_property_request_t *)") +fn("int xcb_randr_configure_output_property_values_length(const xcb_randr_configure_output_property_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_configure_output_property_values_end(const xcb_randr_configure_output_property_request_t *)") + +fn("int xcb_randr_change_output_property_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_randr_change_output_property_checked(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t, xcb_atom_t, uint8_t, uint8_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_randr_change_output_property(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t, xcb_atom_t, uint8_t, uint8_t, uint32_t, const void *)") +# ::Iterator:: +fn("void * xcb_randr_change_output_property_data(const xcb_randr_change_output_property_request_t *)") +fn("int xcb_randr_change_output_property_data_length(const xcb_randr_change_output_property_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_change_output_property_data_end(const xcb_randr_change_output_property_request_t *)") + +fn("xcb_void_cookie_t xcb_randr_delete_output_property_checked(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t)") +fn("xcb_void_cookie_t xcb_randr_delete_output_property(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t)") +fn("int xcb_randr_get_output_property_sizeof(const void *)") +fn("xcb_randr_get_output_property_cookie_t xcb_randr_get_output_property(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t, uint8_t, uint8_t)") +fn("xcb_randr_get_output_property_cookie_t xcb_randr_get_output_property_unchecked(xcb_connection_t *, xcb_randr_output_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t, uint8_t, uint8_t)") +# ::Iterator:: +fn("uint8_t * xcb_randr_get_output_property_data(const xcb_randr_get_output_property_reply_t *)") +fn("int xcb_randr_get_output_property_data_length(const xcb_randr_get_output_property_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_output_property_data_end(const xcb_randr_get_output_property_reply_t *)") + +fn("xcb_randr_get_output_property_reply_t * xcb_randr_get_output_property_reply(xcb_connection_t *, xcb_randr_get_output_property_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_create_mode_sizeof(const void *, uint32_t)") +fn("xcb_randr_create_mode_cookie_t xcb_randr_create_mode(xcb_connection_t *, xcb_window_t, xcb_randr_mode_info_t, uint32_t, const char *)") +fn("xcb_randr_create_mode_cookie_t xcb_randr_create_mode_unchecked(xcb_connection_t *, xcb_window_t, xcb_randr_mode_info_t, uint32_t, const char *)") +fn("xcb_randr_create_mode_reply_t * xcb_randr_create_mode_reply(xcb_connection_t *, xcb_randr_create_mode_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_randr_destroy_mode_checked(xcb_connection_t *, xcb_randr_mode_t)") +fn("xcb_void_cookie_t xcb_randr_destroy_mode(xcb_connection_t *, xcb_randr_mode_t)") +fn("xcb_void_cookie_t xcb_randr_add_output_mode_checked(xcb_connection_t *, xcb_randr_output_t, xcb_randr_mode_t)") +fn("xcb_void_cookie_t xcb_randr_add_output_mode(xcb_connection_t *, xcb_randr_output_t, xcb_randr_mode_t)") +fn("xcb_void_cookie_t xcb_randr_delete_output_mode_checked(xcb_connection_t *, xcb_randr_output_t, xcb_randr_mode_t)") +fn("xcb_void_cookie_t xcb_randr_delete_output_mode(xcb_connection_t *, xcb_randr_output_t, xcb_randr_mode_t)") +fn("int xcb_randr_get_crtc_info_sizeof(const void *)") +fn("xcb_randr_get_crtc_info_cookie_t xcb_randr_get_crtc_info(xcb_connection_t *, xcb_randr_crtc_t, xcb_timestamp_t)") +fn("xcb_randr_get_crtc_info_cookie_t xcb_randr_get_crtc_info_unchecked(xcb_connection_t *, xcb_randr_crtc_t, xcb_timestamp_t)") +# ::Iterator:: +fn("xcb_randr_output_t * xcb_randr_get_crtc_info_outputs(const xcb_randr_get_crtc_info_reply_t *)") +fn("int xcb_randr_get_crtc_info_outputs_length(const xcb_randr_get_crtc_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_info_outputs_end(const xcb_randr_get_crtc_info_reply_t *)") +# ::Iterator:: +fn("xcb_randr_output_t * xcb_randr_get_crtc_info_possible(const xcb_randr_get_crtc_info_reply_t *)") +fn("int xcb_randr_get_crtc_info_possible_length(const xcb_randr_get_crtc_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_info_possible_end(const xcb_randr_get_crtc_info_reply_t *)") + +fn("xcb_randr_get_crtc_info_reply_t * xcb_randr_get_crtc_info_reply(xcb_connection_t *, xcb_randr_get_crtc_info_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_set_crtc_config_sizeof(const void *, uint32_t)") +fn("xcb_randr_set_crtc_config_cookie_t xcb_randr_set_crtc_config(xcb_connection_t *, xcb_randr_crtc_t, xcb_timestamp_t, xcb_timestamp_t, int16_t, int16_t, xcb_randr_mode_t, uint16_t, uint32_t, const xcb_randr_output_t *)") +fn("xcb_randr_set_crtc_config_cookie_t xcb_randr_set_crtc_config_unchecked(xcb_connection_t *, xcb_randr_crtc_t, xcb_timestamp_t, xcb_timestamp_t, int16_t, int16_t, xcb_randr_mode_t, uint16_t, uint32_t, const xcb_randr_output_t *)") +fn("xcb_randr_set_crtc_config_reply_t * xcb_randr_set_crtc_config_reply(xcb_connection_t *, xcb_randr_set_crtc_config_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_randr_get_crtc_gamma_size_cookie_t xcb_randr_get_crtc_gamma_size(xcb_connection_t *, xcb_randr_crtc_t)") +fn("xcb_randr_get_crtc_gamma_size_cookie_t xcb_randr_get_crtc_gamma_size_unchecked(xcb_connection_t *, xcb_randr_crtc_t)") +fn("xcb_randr_get_crtc_gamma_size_reply_t * xcb_randr_get_crtc_gamma_size_reply(xcb_connection_t *, xcb_randr_get_crtc_gamma_size_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_get_crtc_gamma_sizeof(const void *)") +fn("xcb_randr_get_crtc_gamma_cookie_t xcb_randr_get_crtc_gamma(xcb_connection_t *, xcb_randr_crtc_t)") +fn("xcb_randr_get_crtc_gamma_cookie_t xcb_randr_get_crtc_gamma_unchecked(xcb_connection_t *, xcb_randr_crtc_t)") +# ::Iterator:: +fn("uint16_t * xcb_randr_get_crtc_gamma_red(const xcb_randr_get_crtc_gamma_reply_t *)") +fn("int xcb_randr_get_crtc_gamma_red_length(const xcb_randr_get_crtc_gamma_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_gamma_red_end(const xcb_randr_get_crtc_gamma_reply_t *)") +# ::Iterator:: +fn("uint16_t * xcb_randr_get_crtc_gamma_green(const xcb_randr_get_crtc_gamma_reply_t *)") +fn("int xcb_randr_get_crtc_gamma_green_length(const xcb_randr_get_crtc_gamma_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_gamma_green_end(const xcb_randr_get_crtc_gamma_reply_t *)") +# ::Iterator:: +fn("uint16_t * xcb_randr_get_crtc_gamma_blue(const xcb_randr_get_crtc_gamma_reply_t *)") +fn("int xcb_randr_get_crtc_gamma_blue_length(const xcb_randr_get_crtc_gamma_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_gamma_blue_end(const xcb_randr_get_crtc_gamma_reply_t *)") + +fn("xcb_randr_get_crtc_gamma_reply_t * xcb_randr_get_crtc_gamma_reply(xcb_connection_t *, xcb_randr_get_crtc_gamma_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_set_crtc_gamma_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_randr_set_crtc_gamma_checked(xcb_connection_t *, xcb_randr_crtc_t, uint16_t, const uint16_t *, const uint16_t *, const uint16_t *)") +fn("xcb_void_cookie_t xcb_randr_set_crtc_gamma(xcb_connection_t *, xcb_randr_crtc_t, uint16_t, const uint16_t *, const uint16_t *, const uint16_t *)") +# ::Iterator:: +fn("uint16_t * xcb_randr_set_crtc_gamma_red(const xcb_randr_set_crtc_gamma_request_t *)") +fn("int xcb_randr_set_crtc_gamma_red_length(const xcb_randr_set_crtc_gamma_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_set_crtc_gamma_red_end(const xcb_randr_set_crtc_gamma_request_t *)") +# ::Iterator:: +fn("uint16_t * xcb_randr_set_crtc_gamma_green(const xcb_randr_set_crtc_gamma_request_t *)") +fn("int xcb_randr_set_crtc_gamma_green_length(const xcb_randr_set_crtc_gamma_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_set_crtc_gamma_green_end(const xcb_randr_set_crtc_gamma_request_t *)") +# ::Iterator:: +fn("uint16_t * xcb_randr_set_crtc_gamma_blue(const xcb_randr_set_crtc_gamma_request_t *)") +fn("int xcb_randr_set_crtc_gamma_blue_length(const xcb_randr_set_crtc_gamma_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_set_crtc_gamma_blue_end(const xcb_randr_set_crtc_gamma_request_t *)") + +fn("int xcb_randr_get_screen_resources_current_sizeof(const void *)") +fn("xcb_randr_get_screen_resources_current_cookie_t xcb_randr_get_screen_resources_current(xcb_connection_t *, xcb_window_t)") +fn("xcb_randr_get_screen_resources_current_cookie_t xcb_randr_get_screen_resources_current_unchecked(xcb_connection_t *, xcb_window_t)") +# ::Iterator:: +fn("xcb_randr_crtc_t * xcb_randr_get_screen_resources_current_crtcs(const xcb_randr_get_screen_resources_current_reply_t *)") +fn("int xcb_randr_get_screen_resources_current_crtcs_length(const xcb_randr_get_screen_resources_current_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_screen_resources_current_crtcs_end(const xcb_randr_get_screen_resources_current_reply_t *)") +# ::Iterator:: +fn("xcb_randr_output_t * xcb_randr_get_screen_resources_current_outputs(const xcb_randr_get_screen_resources_current_reply_t *)") +fn("int xcb_randr_get_screen_resources_current_outputs_length(const xcb_randr_get_screen_resources_current_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_screen_resources_current_outputs_end(const xcb_randr_get_screen_resources_current_reply_t *)") +# ::Iterator:: +fn("xcb_randr_mode_info_t * xcb_randr_get_screen_resources_current_modes(const xcb_randr_get_screen_resources_current_reply_t *)") +fn("int xcb_randr_get_screen_resources_current_modes_length(const xcb_randr_get_screen_resources_current_reply_t *)") +fn("xcb_randr_mode_info_iterator_t xcb_randr_get_screen_resources_current_modes_iterator(const xcb_randr_get_screen_resources_current_reply_t *)") +# ::Iterator:: +fn("uint8_t * xcb_randr_get_screen_resources_current_names(const xcb_randr_get_screen_resources_current_reply_t *)") +fn("int xcb_randr_get_screen_resources_current_names_length(const xcb_randr_get_screen_resources_current_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_screen_resources_current_names_end(const xcb_randr_get_screen_resources_current_reply_t *)") + +fn("xcb_randr_get_screen_resources_current_reply_t * xcb_randr_get_screen_resources_current_reply(xcb_connection_t *, xcb_randr_get_screen_resources_current_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_set_crtc_transform_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_randr_set_crtc_transform_checked(xcb_connection_t *, xcb_randr_crtc_t, xcb_render_transform_t, uint16_t, const char *, uint32_t, const xcb_render_fixed_t *)") +fn("xcb_void_cookie_t xcb_randr_set_crtc_transform(xcb_connection_t *, xcb_randr_crtc_t, xcb_render_transform_t, uint16_t, const char *, uint32_t, const xcb_render_fixed_t *)") +# ::Iterator:: +fn("char * xcb_randr_set_crtc_transform_filter_name(const xcb_randr_set_crtc_transform_request_t *)") +fn("int xcb_randr_set_crtc_transform_filter_name_length(const xcb_randr_set_crtc_transform_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_set_crtc_transform_filter_name_end(const xcb_randr_set_crtc_transform_request_t *)") +# ::Iterator:: +fn("xcb_render_fixed_t * xcb_randr_set_crtc_transform_filter_params(const xcb_randr_set_crtc_transform_request_t *)") +fn("int xcb_randr_set_crtc_transform_filter_params_length(const xcb_randr_set_crtc_transform_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_set_crtc_transform_filter_params_end(const xcb_randr_set_crtc_transform_request_t *)") + +fn("int xcb_randr_get_crtc_transform_sizeof(const void *)") +fn("xcb_randr_get_crtc_transform_cookie_t xcb_randr_get_crtc_transform(xcb_connection_t *, xcb_randr_crtc_t)") +fn("xcb_randr_get_crtc_transform_cookie_t xcb_randr_get_crtc_transform_unchecked(xcb_connection_t *, xcb_randr_crtc_t)") +# ::Iterator:: +fn("char * xcb_randr_get_crtc_transform_pending_filter_name(const xcb_randr_get_crtc_transform_reply_t *)") +fn("int xcb_randr_get_crtc_transform_pending_filter_name_length(const xcb_randr_get_crtc_transform_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_transform_pending_filter_name_end(const xcb_randr_get_crtc_transform_reply_t *)") +# ::Iterator:: +fn("xcb_render_fixed_t * xcb_randr_get_crtc_transform_pending_params(const xcb_randr_get_crtc_transform_reply_t *)") +fn("int xcb_randr_get_crtc_transform_pending_params_length(const xcb_randr_get_crtc_transform_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_transform_pending_params_end(const xcb_randr_get_crtc_transform_reply_t *)") +# ::Iterator:: +fn("char * xcb_randr_get_crtc_transform_current_filter_name(const xcb_randr_get_crtc_transform_reply_t *)") +fn("int xcb_randr_get_crtc_transform_current_filter_name_length(const xcb_randr_get_crtc_transform_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_transform_current_filter_name_end(const xcb_randr_get_crtc_transform_reply_t *)") +# ::Iterator:: +fn("xcb_render_fixed_t * xcb_randr_get_crtc_transform_current_params(const xcb_randr_get_crtc_transform_reply_t *)") +fn("int xcb_randr_get_crtc_transform_current_params_length(const xcb_randr_get_crtc_transform_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_crtc_transform_current_params_end(const xcb_randr_get_crtc_transform_reply_t *)") + +fn("xcb_randr_get_crtc_transform_reply_t * xcb_randr_get_crtc_transform_reply(xcb_connection_t *, xcb_randr_get_crtc_transform_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_randr_get_panning_cookie_t xcb_randr_get_panning(xcb_connection_t *, xcb_randr_crtc_t)") +fn("xcb_randr_get_panning_cookie_t xcb_randr_get_panning_unchecked(xcb_connection_t *, xcb_randr_crtc_t)") +fn("xcb_randr_get_panning_reply_t * xcb_randr_get_panning_reply(xcb_connection_t *, xcb_randr_get_panning_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_randr_set_panning_cookie_t xcb_randr_set_panning(xcb_connection_t *, xcb_randr_crtc_t, xcb_timestamp_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, int16_t, int16_t, int16_t, int16_t)") +fn("xcb_randr_set_panning_cookie_t xcb_randr_set_panning_unchecked(xcb_connection_t *, xcb_randr_crtc_t, xcb_timestamp_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, int16_t, int16_t, int16_t, int16_t)") +fn("xcb_randr_set_panning_reply_t * xcb_randr_set_panning_reply(xcb_connection_t *, xcb_randr_set_panning_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_randr_set_output_primary_checked(xcb_connection_t *, xcb_window_t, xcb_randr_output_t)") +fn("xcb_void_cookie_t xcb_randr_set_output_primary(xcb_connection_t *, xcb_window_t, xcb_randr_output_t)") +fn("xcb_randr_get_output_primary_cookie_t xcb_randr_get_output_primary(xcb_connection_t *, xcb_window_t)") +fn("xcb_randr_get_output_primary_cookie_t xcb_randr_get_output_primary_unchecked(xcb_connection_t *, xcb_window_t)") +fn("xcb_randr_get_output_primary_reply_t * xcb_randr_get_output_primary_reply(xcb_connection_t *, xcb_randr_get_output_primary_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_get_providers_sizeof(const void *)") +fn("xcb_randr_get_providers_cookie_t xcb_randr_get_providers(xcb_connection_t *, xcb_window_t)") +fn("xcb_randr_get_providers_cookie_t xcb_randr_get_providers_unchecked(xcb_connection_t *, xcb_window_t)") +# ::Iterator:: +fn("xcb_randr_provider_t * xcb_randr_get_providers_providers(const xcb_randr_get_providers_reply_t *)") +fn("int xcb_randr_get_providers_providers_length(const xcb_randr_get_providers_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_providers_providers_end(const xcb_randr_get_providers_reply_t *)") + +fn("xcb_randr_get_providers_reply_t * xcb_randr_get_providers_reply(xcb_connection_t *, xcb_randr_get_providers_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_get_provider_info_sizeof(const void *)") +fn("xcb_randr_get_provider_info_cookie_t xcb_randr_get_provider_info(xcb_connection_t *, xcb_randr_provider_t, xcb_timestamp_t)") +fn("xcb_randr_get_provider_info_cookie_t xcb_randr_get_provider_info_unchecked(xcb_connection_t *, xcb_randr_provider_t, xcb_timestamp_t)") +# ::Iterator:: +fn("xcb_randr_crtc_t * xcb_randr_get_provider_info_crtcs(const xcb_randr_get_provider_info_reply_t *)") +fn("int xcb_randr_get_provider_info_crtcs_length(const xcb_randr_get_provider_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_provider_info_crtcs_end(const xcb_randr_get_provider_info_reply_t *)") +# ::Iterator:: +fn("xcb_randr_output_t * xcb_randr_get_provider_info_outputs(const xcb_randr_get_provider_info_reply_t *)") +fn("int xcb_randr_get_provider_info_outputs_length(const xcb_randr_get_provider_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_provider_info_outputs_end(const xcb_randr_get_provider_info_reply_t *)") +# ::Iterator:: +fn("xcb_randr_provider_t * xcb_randr_get_provider_info_associated_providers(const xcb_randr_get_provider_info_reply_t *)") +fn("int xcb_randr_get_provider_info_associated_providers_length(const xcb_randr_get_provider_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_provider_info_associated_providers_end(const xcb_randr_get_provider_info_reply_t *)") +# ::Iterator:: +fn("uint32_t * xcb_randr_get_provider_info_associated_capability(const xcb_randr_get_provider_info_reply_t *)") +fn("int xcb_randr_get_provider_info_associated_capability_length(const xcb_randr_get_provider_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_provider_info_associated_capability_end(const xcb_randr_get_provider_info_reply_t *)") +# ::Iterator:: +fn("char * xcb_randr_get_provider_info_name(const xcb_randr_get_provider_info_reply_t *)") +fn("int xcb_randr_get_provider_info_name_length(const xcb_randr_get_provider_info_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_provider_info_name_end(const xcb_randr_get_provider_info_reply_t *)") + +fn("xcb_randr_get_provider_info_reply_t * xcb_randr_get_provider_info_reply(xcb_connection_t *, xcb_randr_get_provider_info_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_randr_set_provider_offload_sink_checked(xcb_connection_t *, xcb_randr_provider_t, xcb_randr_provider_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_randr_set_provider_offload_sink(xcb_connection_t *, xcb_randr_provider_t, xcb_randr_provider_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_randr_set_provider_output_source_checked(xcb_connection_t *, xcb_randr_provider_t, xcb_randr_provider_t, xcb_timestamp_t)") +fn("xcb_void_cookie_t xcb_randr_set_provider_output_source(xcb_connection_t *, xcb_randr_provider_t, xcb_randr_provider_t, xcb_timestamp_t)") +fn("int xcb_randr_list_provider_properties_sizeof(const void *)") +fn("xcb_randr_list_provider_properties_cookie_t xcb_randr_list_provider_properties(xcb_connection_t *, xcb_randr_provider_t)") +fn("xcb_randr_list_provider_properties_cookie_t xcb_randr_list_provider_properties_unchecked(xcb_connection_t *, xcb_randr_provider_t)") +# ::Iterator:: +fn("xcb_atom_t * xcb_randr_list_provider_properties_atoms(const xcb_randr_list_provider_properties_reply_t *)") +fn("int xcb_randr_list_provider_properties_atoms_length(const xcb_randr_list_provider_properties_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_list_provider_properties_atoms_end(const xcb_randr_list_provider_properties_reply_t *)") + +fn("xcb_randr_list_provider_properties_reply_t * xcb_randr_list_provider_properties_reply(xcb_connection_t *, xcb_randr_list_provider_properties_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_query_provider_property_sizeof(const void *)") +fn("xcb_randr_query_provider_property_cookie_t xcb_randr_query_provider_property(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t)") +fn("xcb_randr_query_provider_property_cookie_t xcb_randr_query_provider_property_unchecked(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t)") +# ::Iterator:: +fn("int32_t * xcb_randr_query_provider_property_valid_values(const xcb_randr_query_provider_property_reply_t *)") +fn("int xcb_randr_query_provider_property_valid_values_length(const xcb_randr_query_provider_property_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_query_provider_property_valid_values_end(const xcb_randr_query_provider_property_reply_t *)") + +fn("xcb_randr_query_provider_property_reply_t * xcb_randr_query_provider_property_reply(xcb_connection_t *, xcb_randr_query_provider_property_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_configure_provider_property_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_randr_configure_provider_property_checked(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t, uint8_t, uint8_t, uint32_t, const int32_t *)") +fn("xcb_void_cookie_t xcb_randr_configure_provider_property(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t, uint8_t, uint8_t, uint32_t, const int32_t *)") +# ::Iterator:: +fn("int32_t * xcb_randr_configure_provider_property_values(const xcb_randr_configure_provider_property_request_t *)") +fn("int xcb_randr_configure_provider_property_values_length(const xcb_randr_configure_provider_property_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_configure_provider_property_values_end(const xcb_randr_configure_provider_property_request_t *)") + +fn("int xcb_randr_change_provider_property_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_randr_change_provider_property_checked(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t, xcb_atom_t, uint8_t, uint8_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_randr_change_provider_property(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t, xcb_atom_t, uint8_t, uint8_t, uint32_t, const void *)") +# ::Iterator:: +fn("void * xcb_randr_change_provider_property_data(const xcb_randr_change_provider_property_request_t *)") +fn("int xcb_randr_change_provider_property_data_length(const xcb_randr_change_provider_property_request_t *)") +fn("xcb_generic_iterator_t xcb_randr_change_provider_property_data_end(const xcb_randr_change_provider_property_request_t *)") + +fn("xcb_void_cookie_t xcb_randr_delete_provider_property_checked(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t)") +fn("xcb_void_cookie_t xcb_randr_delete_provider_property(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t)") +fn("int xcb_randr_get_provider_property_sizeof(const void *)") +fn("xcb_randr_get_provider_property_cookie_t xcb_randr_get_provider_property(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t, uint8_t, uint8_t)") +fn("xcb_randr_get_provider_property_cookie_t xcb_randr_get_provider_property_unchecked(xcb_connection_t *, xcb_randr_provider_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t, uint8_t, uint8_t)") +# ::Iterator:: +fn("void * xcb_randr_get_provider_property_data(const xcb_randr_get_provider_property_reply_t *)") +fn("int xcb_randr_get_provider_property_data_length(const xcb_randr_get_provider_property_reply_t *)") +fn("xcb_generic_iterator_t xcb_randr_get_provider_property_data_end(const xcb_randr_get_provider_property_reply_t *)") + +fn("xcb_randr_get_provider_property_reply_t * xcb_randr_get_provider_property_reply(xcb_connection_t *, xcb_randr_get_provider_property_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("void xcb_randr_crtc_change_next(xcb_randr_crtc_change_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_crtc_change_end(xcb_randr_crtc_change_iterator_t)") +fn("void xcb_randr_output_change_next(xcb_randr_output_change_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_output_change_end(xcb_randr_output_change_iterator_t)") +fn("void xcb_randr_output_property_next(xcb_randr_output_property_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_output_property_end(xcb_randr_output_property_iterator_t)") +fn("void xcb_randr_provider_change_next(xcb_randr_provider_change_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_provider_change_end(xcb_randr_provider_change_iterator_t)") +fn("void xcb_randr_provider_property_next(xcb_randr_provider_property_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_provider_property_end(xcb_randr_provider_property_iterator_t)") +fn("void xcb_randr_resource_change_next(xcb_randr_resource_change_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_resource_change_end(xcb_randr_resource_change_iterator_t)") +fn("int xcb_randr_monitor_info_sizeof(const void *)") +# ::Iterator:: +fn("xcb_randr_output_t * xcb_randr_monitor_info_outputs(const xcb_randr_monitor_info_t *)") +fn("int xcb_randr_monitor_info_outputs_length(const xcb_randr_monitor_info_t *)") +fn("xcb_generic_iterator_t xcb_randr_monitor_info_outputs_end(const xcb_randr_monitor_info_t *)") + +fn("void xcb_randr_monitor_info_next(xcb_randr_monitor_info_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_monitor_info_end(xcb_randr_monitor_info_iterator_t)") +fn("int xcb_randr_get_monitors_sizeof(const void *)") +fn("xcb_randr_get_monitors_cookie_t xcb_randr_get_monitors(xcb_connection_t *, xcb_window_t, uint8_t)") +fn("xcb_randr_get_monitors_cookie_t xcb_randr_get_monitors_unchecked(xcb_connection_t *, xcb_window_t, uint8_t)") +fn("int xcb_randr_get_monitors_monitors_length(const xcb_randr_get_monitors_reply_t *)") +fn("xcb_randr_monitor_info_iterator_t xcb_randr_get_monitors_monitors_iterator(const xcb_randr_get_monitors_reply_t *)") +fn("xcb_randr_get_monitors_reply_t * xcb_randr_get_monitors_reply(xcb_connection_t *, xcb_randr_get_monitors_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_randr_set_monitor_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_randr_set_monitor_checked(xcb_connection_t *, xcb_window_t, xcb_randr_monitor_info_t *)") +fn("xcb_void_cookie_t xcb_randr_set_monitor(xcb_connection_t *, xcb_window_t, xcb_randr_monitor_info_t *)") +# Application doesn't own pointer, returns an internal data structure +fn("xcb_randr_monitor_info_t * xcb_randr_set_monitor_monitorinfo(const xcb_randr_set_monitor_request_t *)") +fn("xcb_void_cookie_t xcb_randr_delete_monitor_checked(xcb_connection_t *, xcb_window_t, xcb_atom_t)") +fn("xcb_void_cookie_t xcb_randr_delete_monitor(xcb_connection_t *, xcb_window_t, xcb_atom_t)") +fn("int xcb_randr_create_lease_sizeof(const void *)") +fn("xcb_randr_create_lease_cookie_t xcb_randr_create_lease(xcb_connection_t *, xcb_window_t, xcb_randr_lease_t, uint16_t, uint16_t, const xcb_randr_crtc_t *, const xcb_randr_output_t *)") +fn("xcb_randr_create_lease_cookie_t xcb_randr_create_lease_unchecked(xcb_connection_t *, xcb_window_t, xcb_randr_lease_t, uint16_t, uint16_t, const xcb_randr_crtc_t *, const xcb_randr_output_t *)") +fn("xcb_randr_create_lease_reply_t * xcb_randr_create_lease_reply(xcb_connection_t *, xcb_randr_create_lease_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int * xcb_randr_create_lease_reply_fds(xcb_connection_t *, xcb_randr_create_lease_reply_t *)") +fn("xcb_void_cookie_t xcb_randr_free_lease_checked(xcb_connection_t *, xcb_randr_lease_t, uint8_t)") +fn("xcb_void_cookie_t xcb_randr_free_lease(xcb_connection_t *, xcb_randr_lease_t, uint8_t)") +fn("void xcb_randr_lease_notify_next(xcb_randr_lease_notify_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_lease_notify_end(xcb_randr_lease_notify_iterator_t)") +fn("void xcb_randr_notify_data_next(xcb_randr_notify_data_iterator_t *)") +fn("xcb_generic_iterator_t xcb_randr_notify_data_end(xcb_randr_notify_data_iterator_t)") + +Generate() diff --git a/ThunkLibs/libxcb_randr/Guest.cpp b/ThunkLibs/libxcb_randr/Guest.cpp new file mode 100644 index 000000000..225b3cc27 --- /dev/null +++ b/ThunkLibs/libxcb_randr/Guest.cpp @@ -0,0 +1,866 @@ +/* +$info$ +tags: thunklibs|xcb-randr +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { + xcb_extension_t xcb_randr_id = { + .name = "RANDR", + .global_id = 0, + }; + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_randr_init_extension(c, &xcb_randr_id); + } + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_randr_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_randr_FEX_usable_size(&args); + return args.rv; + } + + static xcb_randr_query_version_cookie_t fexfn_pack_xcb_randr_query_version(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;uint32_t a_2;xcb_randr_query_version_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_query_version(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_randr_query_version_cookie_t fexfn_pack_xcb_randr_query_version_unchecked(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;uint32_t a_2;xcb_randr_query_version_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_query_version_unchecked(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_randr_query_version_reply_t * fexfn_pack_xcb_randr_query_version_reply(xcb_connection_t * a_0,xcb_randr_query_version_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_query_version_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_query_version_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_query_version_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_set_screen_config_reply_t * fexfn_pack_xcb_randr_set_screen_config_reply(xcb_connection_t * a_0,xcb_randr_set_screen_config_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_set_screen_config_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_set_screen_config_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_set_screen_config_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_screen_size_range_reply_t * fexfn_pack_xcb_randr_get_screen_size_range_reply(xcb_connection_t * a_0,xcb_randr_get_screen_size_range_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_screen_size_range_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_screen_size_range_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_screen_size_range_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_screen_resources_reply_t * fexfn_pack_xcb_randr_get_screen_resources_reply(xcb_connection_t * a_0,xcb_randr_get_screen_resources_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_screen_resources_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_screen_resources_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_screen_resources_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_output_info_reply_t * fexfn_pack_xcb_randr_get_output_info_reply(xcb_connection_t * a_0,xcb_randr_get_output_info_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_output_info_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_output_info_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_output_info_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_list_output_properties_reply_t * fexfn_pack_xcb_randr_list_output_properties_reply(xcb_connection_t * a_0,xcb_randr_list_output_properties_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_list_output_properties_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_list_output_properties_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_list_output_properties_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_query_output_property_reply_t * fexfn_pack_xcb_randr_query_output_property_reply(xcb_connection_t * a_0,xcb_randr_query_output_property_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_query_output_property_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_query_output_property_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_query_output_property_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_output_property_reply_t * fexfn_pack_xcb_randr_get_output_property_reply(xcb_connection_t * a_0,xcb_randr_get_output_property_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_output_property_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_output_property_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_output_property_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_create_mode_reply_t * fexfn_pack_xcb_randr_create_mode_reply(xcb_connection_t * a_0,xcb_randr_create_mode_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_create_mode_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_create_mode_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_create_mode_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_crtc_info_reply_t * fexfn_pack_xcb_randr_get_crtc_info_reply(xcb_connection_t * a_0,xcb_randr_get_crtc_info_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_crtc_info_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_crtc_info_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_crtc_info_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_set_crtc_config_reply_t * fexfn_pack_xcb_randr_set_crtc_config_reply(xcb_connection_t * a_0,xcb_randr_set_crtc_config_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_set_crtc_config_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_set_crtc_config_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_set_crtc_config_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_crtc_gamma_size_reply_t * fexfn_pack_xcb_randr_get_crtc_gamma_size_reply(xcb_connection_t * a_0,xcb_randr_get_crtc_gamma_size_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_crtc_gamma_size_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_crtc_gamma_size_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_crtc_gamma_size_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_crtc_gamma_reply_t * fexfn_pack_xcb_randr_get_crtc_gamma_reply(xcb_connection_t * a_0,xcb_randr_get_crtc_gamma_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_crtc_gamma_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_crtc_gamma_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_crtc_gamma_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_screen_resources_current_reply_t * fexfn_pack_xcb_randr_get_screen_resources_current_reply(xcb_connection_t * a_0,xcb_randr_get_screen_resources_current_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_screen_resources_current_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_screen_resources_current_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_screen_resources_current_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_crtc_transform_reply_t * fexfn_pack_xcb_randr_get_crtc_transform_reply(xcb_connection_t * a_0,xcb_randr_get_crtc_transform_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_crtc_transform_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_crtc_transform_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_crtc_transform_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_panning_reply_t * fexfn_pack_xcb_randr_get_panning_reply(xcb_connection_t * a_0,xcb_randr_get_panning_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_panning_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_panning_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_panning_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_set_panning_reply_t * fexfn_pack_xcb_randr_set_panning_reply(xcb_connection_t * a_0,xcb_randr_set_panning_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_set_panning_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_set_panning_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_set_panning_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_output_primary_reply_t * fexfn_pack_xcb_randr_get_output_primary_reply(xcb_connection_t * a_0,xcb_randr_get_output_primary_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_output_primary_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_output_primary_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_output_primary_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_providers_reply_t * fexfn_pack_xcb_randr_get_providers_reply(xcb_connection_t * a_0,xcb_randr_get_providers_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_providers_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_providers_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_providers_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_provider_info_reply_t * fexfn_pack_xcb_randr_get_provider_info_reply(xcb_connection_t * a_0,xcb_randr_get_provider_info_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_provider_info_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_provider_info_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_provider_info_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_list_provider_properties_reply_t * fexfn_pack_xcb_randr_list_provider_properties_reply(xcb_connection_t * a_0,xcb_randr_list_provider_properties_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_list_provider_properties_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_list_provider_properties_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_list_provider_properties_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_query_provider_property_reply_t * fexfn_pack_xcb_randr_query_provider_property_reply(xcb_connection_t * a_0,xcb_randr_query_provider_property_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_query_provider_property_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_query_provider_property_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_query_provider_property_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_provider_property_reply_t * fexfn_pack_xcb_randr_get_provider_property_reply(xcb_connection_t * a_0,xcb_randr_get_provider_property_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_provider_property_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_provider_property_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_provider_property_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_get_monitors_reply_t * fexfn_pack_xcb_randr_get_monitors_reply(xcb_connection_t * a_0,xcb_randr_get_monitors_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_get_monitors_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_get_monitors_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_get_monitors_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_randr_create_lease_reply_t * fexfn_pack_xcb_randr_create_lease_reply(xcb_connection_t * a_0,xcb_randr_create_lease_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_randr_create_lease_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_randr_create_lease_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_randr_xcb_randr_create_lease_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + xcb_randr_query_version_cookie_t xcb_randr_query_version(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_randr_query_version"))); + xcb_randr_query_version_cookie_t xcb_randr_query_version_unchecked(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_randr_query_version_unchecked"))); + xcb_randr_query_version_reply_t * xcb_randr_query_version_reply(xcb_connection_t * a_0,xcb_randr_query_version_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_query_version_reply"))); + + xcb_randr_set_screen_config_reply_t * xcb_randr_set_screen_config_reply(xcb_connection_t * a_0,xcb_randr_set_screen_config_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_set_screen_config_reply"))); + xcb_randr_get_screen_size_range_reply_t * xcb_randr_get_screen_size_range_reply(xcb_connection_t * a_0,xcb_randr_get_screen_size_range_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_screen_size_range_reply"))); + xcb_randr_get_screen_resources_reply_t * xcb_randr_get_screen_resources_reply(xcb_connection_t * a_0,xcb_randr_get_screen_resources_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_screen_resources_reply"))); + xcb_randr_get_output_info_reply_t * xcb_randr_get_output_info_reply(xcb_connection_t * a_0,xcb_randr_get_output_info_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_output_info_reply"))); + xcb_randr_list_output_properties_reply_t * xcb_randr_list_output_properties_reply(xcb_connection_t * a_0,xcb_randr_list_output_properties_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_list_output_properties_reply"))); + xcb_randr_query_output_property_reply_t * xcb_randr_query_output_property_reply(xcb_connection_t * a_0,xcb_randr_query_output_property_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_query_output_property_reply"))); + xcb_randr_get_output_property_reply_t * xcb_randr_get_output_property_reply(xcb_connection_t * a_0,xcb_randr_get_output_property_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_output_property_reply"))); + xcb_randr_create_mode_reply_t * xcb_randr_create_mode_reply(xcb_connection_t * a_0,xcb_randr_create_mode_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_create_mode_reply"))); + xcb_randr_get_crtc_info_reply_t * xcb_randr_get_crtc_info_reply(xcb_connection_t * a_0,xcb_randr_get_crtc_info_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_crtc_info_reply"))); + xcb_randr_set_crtc_config_reply_t * xcb_randr_set_crtc_config_reply(xcb_connection_t * a_0,xcb_randr_set_crtc_config_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_set_crtc_config_reply"))); + xcb_randr_get_crtc_gamma_size_reply_t * xcb_randr_get_crtc_gamma_size_reply(xcb_connection_t * a_0,xcb_randr_get_crtc_gamma_size_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_crtc_gamma_size_reply"))); + xcb_randr_get_crtc_gamma_reply_t * xcb_randr_get_crtc_gamma_reply(xcb_connection_t * a_0,xcb_randr_get_crtc_gamma_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_crtc_gamma_reply"))); + xcb_randr_get_screen_resources_current_reply_t * xcb_randr_get_screen_resources_current_reply(xcb_connection_t * a_0,xcb_randr_get_screen_resources_current_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_screen_resources_current_reply"))); + xcb_randr_get_crtc_transform_reply_t * xcb_randr_get_crtc_transform_reply(xcb_connection_t * a_0,xcb_randr_get_crtc_transform_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_crtc_transform_reply"))); + xcb_randr_get_panning_reply_t * xcb_randr_get_panning_reply(xcb_connection_t * a_0,xcb_randr_get_panning_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_panning_reply"))); + xcb_randr_set_panning_reply_t * xcb_randr_set_panning_reply(xcb_connection_t * a_0,xcb_randr_set_panning_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_set_panning_reply"))); + xcb_randr_get_output_primary_reply_t * xcb_randr_get_output_primary_reply(xcb_connection_t * a_0,xcb_randr_get_output_primary_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_output_primary_reply"))); + xcb_randr_get_providers_reply_t * xcb_randr_get_providers_reply(xcb_connection_t * a_0,xcb_randr_get_providers_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_providers_reply"))); + xcb_randr_get_provider_info_reply_t * xcb_randr_get_provider_info_reply(xcb_connection_t * a_0,xcb_randr_get_provider_info_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_provider_info_reply"))); + xcb_randr_list_provider_properties_reply_t * xcb_randr_list_provider_properties_reply(xcb_connection_t * a_0,xcb_randr_list_provider_properties_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_list_provider_properties_reply"))); + xcb_randr_query_provider_property_reply_t * xcb_randr_query_provider_property_reply(xcb_connection_t * a_0,xcb_randr_query_provider_property_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_query_provider_property_reply"))); + xcb_randr_get_provider_property_reply_t * xcb_randr_get_provider_property_reply(xcb_connection_t * a_0,xcb_randr_get_provider_property_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_provider_property_reply"))); + xcb_randr_get_monitors_reply_t * xcb_randr_get_monitors_reply(xcb_connection_t * a_0,xcb_randr_get_monitors_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_get_monitors_reply"))); + xcb_randr_create_lease_reply_t * xcb_randr_create_lease_reply(xcb_connection_t * a_0,xcb_randr_create_lease_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_randr_create_lease_reply"))); +} + +LOAD_LIB(libxcb_randr) diff --git a/ThunkLibs/libxcb_randr/Host.cpp b/ThunkLibs/libxcb_randr/Host.cpp new file mode 100644 index 000000000..6b01d941d --- /dev/null +++ b/ThunkLibs/libxcb_randr/Host.cpp @@ -0,0 +1,66 @@ +/* +$info$ +tags: thunklibs|xcb-randr +$end_info$ +*/ + +#include +#include + +#include +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + + +void fexfn_unpack_libxcb_randr_FEX_xcb_randr_init_extension(void *argsv); + +void fexfn_unpack_libxcb_randr_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_randr_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_unpack_libxcb_randr_FEX_xcb_randr_init_extension(void *argsv){ + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + if (strcmp(args->a_1->name, "RANDR") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_randr_so, "xcb_randr_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + typedef const struct xcb_query_extension_reply_t * fexldr_type_libxcb_xcb_get_extension_data(xcb_connection_t * a_0,xcb_extension_t * a_1); + fexldr_type_libxcb_xcb_get_extension_data *fexldr_ptr_libxcb_xcb_get_extension_data; + + fexldr_ptr_libxcb_xcb_get_extension_data = (fexldr_type_libxcb_xcb_get_extension_data*)dlsym(RTLD_DEFAULT, "xcb_get_extension_data"); + + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} + +EXPORTS(libxcb_randr) From ec6140fde024d5999e95027e108113362b671843 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:14:18 -0700 Subject: [PATCH 12/20] Thunks: Adds libxcb_shm --- ThunkLibs/Generators/libxcb_shm.py | 34 +++++ ThunkLibs/libxcb_shm/libxcb_shm_Guest.cpp | 154 ++++++++++++++++++++++ ThunkLibs/libxcb_shm/libxcb_shm_Host.cpp | 65 +++++++++ 3 files changed, 253 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb_shm.py create mode 100644 ThunkLibs/libxcb_shm/libxcb_shm_Guest.cpp create mode 100644 ThunkLibs/libxcb_shm/libxcb_shm_Host.cpp diff --git a/ThunkLibs/Generators/libxcb_shm.py b/ThunkLibs/Generators/libxcb_shm.py new file mode 100644 index 000000000..e70048cf8 --- /dev/null +++ b/ThunkLibs/Generators/libxcb_shm.py @@ -0,0 +1,34 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib_with_filename("libxcb_shm", "libxcb-shm") + +# FEX +fn("void FEX_xcb_shm_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("void xcb_shm_seg_next(xcb_shm_seg_iterator_t *)") +fn("xcb_generic_iterator_t xcb_shm_seg_end(xcb_shm_seg_iterator_t)") +fn("xcb_shm_query_version_cookie_t xcb_shm_query_version(xcb_connection_t *)"); no_pack() +fn("xcb_shm_query_version_cookie_t xcb_shm_query_version_unchecked(xcb_connection_t *)"); no_pack() +fn("xcb_shm_query_version_reply_t * xcb_shm_query_version_reply(xcb_connection_t *, xcb_shm_query_version_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_shm_attach_checked(xcb_connection_t *, xcb_shm_seg_t, uint32_t, uint8_t)") +fn("xcb_void_cookie_t xcb_shm_attach(xcb_connection_t *, xcb_shm_seg_t, uint32_t, uint8_t)") +fn("xcb_void_cookie_t xcb_shm_detach_checked(xcb_connection_t *, xcb_shm_seg_t)") +fn("xcb_void_cookie_t xcb_shm_detach(xcb_connection_t *, xcb_shm_seg_t)") +fn("xcb_void_cookie_t xcb_shm_put_image_checked(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, int16_t, int16_t, uint8_t, uint8_t, uint8_t, xcb_shm_seg_t, uint32_t)") +fn("xcb_void_cookie_t xcb_shm_put_image(xcb_connection_t *, xcb_drawable_t, xcb_gcontext_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, int16_t, int16_t, uint8_t, uint8_t, uint8_t, xcb_shm_seg_t, uint32_t)") +fn("xcb_shm_get_image_cookie_t xcb_shm_get_image(xcb_connection_t *, xcb_drawable_t, int16_t, int16_t, uint16_t, uint16_t, uint32_t, uint8_t, xcb_shm_seg_t, uint32_t)") +fn("xcb_shm_get_image_cookie_t xcb_shm_get_image_unchecked(xcb_connection_t *, xcb_drawable_t, int16_t, int16_t, uint16_t, uint16_t, uint32_t, uint8_t, xcb_shm_seg_t, uint32_t)") +fn("xcb_shm_get_image_reply_t * xcb_shm_get_image_reply(xcb_connection_t *, xcb_shm_get_image_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_shm_create_pixmap_checked(xcb_connection_t *, xcb_pixmap_t, xcb_drawable_t, uint16_t, uint16_t, uint8_t, xcb_shm_seg_t, uint32_t)") +fn("xcb_void_cookie_t xcb_shm_create_pixmap(xcb_connection_t *, xcb_pixmap_t, xcb_drawable_t, uint16_t, uint16_t, uint8_t, xcb_shm_seg_t, uint32_t)") +fn("xcb_void_cookie_t xcb_shm_attach_fd_checked(xcb_connection_t *, xcb_shm_seg_t, int32_t, uint8_t)") +fn("xcb_void_cookie_t xcb_shm_attach_fd(xcb_connection_t *, xcb_shm_seg_t, int32_t, uint8_t)") +fn("xcb_shm_create_segment_cookie_t xcb_shm_create_segment(xcb_connection_t *, xcb_shm_seg_t, uint32_t, uint8_t)") +fn("xcb_shm_create_segment_cookie_t xcb_shm_create_segment_unchecked(xcb_connection_t *, xcb_shm_seg_t, uint32_t, uint8_t)") +fn("xcb_shm_create_segment_reply_t * xcb_shm_create_segment_reply(xcb_connection_t *, xcb_shm_create_segment_cookie_t, xcb_generic_error_t **)"); no_pack() +# XXX: Who owns result? +fn("int * xcb_shm_create_segment_reply_fds(xcb_connection_t *, xcb_shm_create_segment_reply_t *)") +Generate() diff --git a/ThunkLibs/libxcb_shm/libxcb_shm_Guest.cpp b/ThunkLibs/libxcb_shm/libxcb_shm_Guest.cpp new file mode 100644 index 000000000..0a750cced --- /dev/null +++ b/ThunkLibs/libxcb_shm/libxcb_shm_Guest.cpp @@ -0,0 +1,154 @@ +/* +$info$ +tags: thunklibs|xcb-shm +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { + xcb_extension_t xcb_shm_id = { + .name = "MIT-SHM", + .global_id = 0, + }; + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_shm_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_shm_FEX_usable_size(&args); + return args.rv; + } + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_shm_init_extension(c, &xcb_shm_id); + } + + static xcb_shm_query_version_cookie_t fexfn_pack_xcb_shm_query_version(xcb_connection_t * a_0){ + struct {xcb_connection_t * a_0;xcb_shm_query_version_cookie_t rv;} args; + args.a_0 = a_0; + fexthunks_libxcb_shm_xcb_shm_query_version(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_shm_query_version_cookie_t fexfn_pack_xcb_shm_query_version_unchecked(xcb_connection_t * a_0){ + struct {xcb_connection_t * a_0;xcb_shm_query_version_cookie_t rv;} args; + args.a_0 = a_0; + fexthunks_libxcb_shm_xcb_shm_query_version_unchecked(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_shm_query_version_reply_t * fexfn_pack_xcb_shm_query_version_reply(xcb_connection_t * a_0,xcb_shm_query_version_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_shm_query_version_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_shm_query_version_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_shm_xcb_shm_query_version_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_shm_get_image_reply_t * fexfn_pack_xcb_shm_get_image_reply(xcb_connection_t * a_0,xcb_shm_get_image_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_shm_get_image_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_shm_get_image_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_shm_xcb_shm_get_image_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_shm_create_segment_reply_t * fexfn_pack_xcb_shm_create_segment_reply(xcb_connection_t * a_0,xcb_shm_create_segment_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_shm_create_segment_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_shm_create_segment_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_shm_xcb_shm_create_segment_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + + xcb_shm_query_version_cookie_t xcb_shm_query_version(xcb_connection_t * a_0) __attribute__((alias("fexfn_pack_xcb_shm_query_version"))); + xcb_shm_query_version_cookie_t xcb_shm_query_version_unchecked(xcb_connection_t * a_0) __attribute__((alias("fexfn_pack_xcb_shm_query_version_unchecked"))); + xcb_shm_query_version_reply_t * xcb_shm_query_version_reply(xcb_connection_t * a_0,xcb_shm_query_version_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_shm_query_version_reply"))); + xcb_shm_get_image_reply_t * xcb_shm_get_image_reply(xcb_connection_t * a_0,xcb_shm_get_image_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_shm_get_image_reply"))); + xcb_shm_create_segment_reply_t * xcb_shm_create_segment_reply(xcb_connection_t * a_0,xcb_shm_create_segment_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_shm_create_segment_reply"))); +} + + +LOAD_LIB(libxcb_shm) diff --git a/ThunkLibs/libxcb_shm/libxcb_shm_Host.cpp b/ThunkLibs/libxcb_shm/libxcb_shm_Host.cpp new file mode 100644 index 000000000..cb5df4451 --- /dev/null +++ b/ThunkLibs/libxcb_shm/libxcb_shm_Host.cpp @@ -0,0 +1,65 @@ +/* +$info$ +tags: thunklibs|xcb-shm +$end_info$ +*/ + +#include +#include + +#include +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + +void fexfn_unpack_libxcb_shm_FEX_xcb_shm_init_extension(void *argsv); + +void fexfn_unpack_libxcb_shm_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_shm_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_unpack_libxcb_shm_FEX_xcb_shm_init_extension(void *argsv){ + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + if (strcmp(args->a_1->name, "MIT-SHM") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_shm_so, "xcb_shm_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + typedef const struct xcb_query_extension_reply_t * fexldr_type_libxcb_xcb_get_extension_data(xcb_connection_t * a_0,xcb_extension_t * a_1); + fexldr_type_libxcb_xcb_get_extension_data *fexldr_ptr_libxcb_xcb_get_extension_data; + + fexldr_ptr_libxcb_xcb_get_extension_data = (fexldr_type_libxcb_xcb_get_extension_data*)dlsym(RTLD_DEFAULT, "xcb_get_extension_data"); + + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} + +EXPORTS(libxcb_shm) From f3c20f27437d840dac3daf6827f00d59db814af5 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:14:32 -0700 Subject: [PATCH 13/20] Thunks: Adds libxcb_sync --- ThunkLibs/Generators/libxcb_sync.py | 106 +++++++++++++ ThunkLibs/libxcb_sync/Guest.cpp | 238 ++++++++++++++++++++++++++++ ThunkLibs/libxcb_sync/Host.cpp | 66 ++++++++ 3 files changed, 410 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb_sync.py create mode 100644 ThunkLibs/libxcb_sync/Guest.cpp create mode 100644 ThunkLibs/libxcb_sync/Host.cpp diff --git a/ThunkLibs/Generators/libxcb_sync.py b/ThunkLibs/Generators/libxcb_sync.py new file mode 100644 index 000000000..fadcebdd5 --- /dev/null +++ b/ThunkLibs/Generators/libxcb_sync.py @@ -0,0 +1,106 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib_with_filename("libxcb_sync", "libxcb-sync") + +# FEX +fn("void FEX_xcb_sync_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("void xcb_sync_alarm_next(xcb_sync_alarm_iterator_t *)") +fn("xcb_generic_iterator_t xcb_sync_alarm_end(xcb_sync_alarm_iterator_t)") +fn("void xcb_sync_counter_next(xcb_sync_counter_iterator_t *)") +fn("xcb_generic_iterator_t xcb_sync_counter_end(xcb_sync_counter_iterator_t)") +fn("void xcb_sync_fence_next(xcb_sync_fence_iterator_t *)") +fn("xcb_generic_iterator_t xcb_sync_fence_end(xcb_sync_fence_iterator_t)") +fn("void xcb_sync_int64_next(xcb_sync_int64_iterator_t *)") +fn("xcb_generic_iterator_t xcb_sync_int64_end(xcb_sync_int64_iterator_t)") +fn("int xcb_sync_systemcounter_sizeof(const void *)") +fn("char * xcb_sync_systemcounter_name(const xcb_sync_systemcounter_t *)") +fn("int xcb_sync_systemcounter_name_length(const xcb_sync_systemcounter_t *)") +fn("xcb_generic_iterator_t xcb_sync_systemcounter_name_end(const xcb_sync_systemcounter_t *)") +fn("void xcb_sync_systemcounter_next(xcb_sync_systemcounter_iterator_t *)") +fn("xcb_generic_iterator_t xcb_sync_systemcounter_end(xcb_sync_systemcounter_iterator_t)") +fn("void xcb_sync_trigger_next(xcb_sync_trigger_iterator_t *)") +fn("xcb_generic_iterator_t xcb_sync_trigger_end(xcb_sync_trigger_iterator_t)") +fn("void xcb_sync_waitcondition_next(xcb_sync_waitcondition_iterator_t *)") +fn("xcb_generic_iterator_t xcb_sync_waitcondition_end(xcb_sync_waitcondition_iterator_t)") +fn("xcb_sync_initialize_cookie_t xcb_sync_initialize(xcb_connection_t *, uint8_t, uint8_t)"); no_pack() +fn("xcb_sync_initialize_cookie_t xcb_sync_initialize_unchecked(xcb_connection_t *, uint8_t, uint8_t)"); no_pack() +fn("xcb_sync_initialize_reply_t * xcb_sync_initialize_reply(xcb_connection_t *, xcb_sync_initialize_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_sync_list_system_counters_sizeof(const void *)") +fn("xcb_sync_list_system_counters_cookie_t xcb_sync_list_system_counters(xcb_connection_t *)") +fn("xcb_sync_list_system_counters_cookie_t xcb_sync_list_system_counters_unchecked(xcb_connection_t *)") +fn("int xcb_sync_list_system_counters_counters_length(const xcb_sync_list_system_counters_reply_t *)") +fn("xcb_sync_systemcounter_iterator_t xcb_sync_list_system_counters_counters_iterator(const xcb_sync_list_system_counters_reply_t *)") +fn("xcb_sync_list_system_counters_reply_t * xcb_sync_list_system_counters_reply(xcb_connection_t *, xcb_sync_list_system_counters_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_sync_create_counter_checked(xcb_connection_t *, xcb_sync_counter_t, xcb_sync_int64_t)") +fn("xcb_void_cookie_t xcb_sync_create_counter(xcb_connection_t *, xcb_sync_counter_t, xcb_sync_int64_t)") +fn("xcb_void_cookie_t xcb_sync_destroy_counter_checked(xcb_connection_t *, xcb_sync_counter_t)") +fn("xcb_void_cookie_t xcb_sync_destroy_counter(xcb_connection_t *, xcb_sync_counter_t)") +fn("xcb_sync_query_counter_cookie_t xcb_sync_query_counter(xcb_connection_t *, xcb_sync_counter_t)") +fn("xcb_sync_query_counter_cookie_t xcb_sync_query_counter_unchecked(xcb_connection_t *, xcb_sync_counter_t)") +fn("xcb_sync_query_counter_reply_t * xcb_sync_query_counter_reply(xcb_connection_t *, xcb_sync_query_counter_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_sync_await_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_sync_await_checked(xcb_connection_t *, uint32_t, const xcb_sync_waitcondition_t *)") +fn("xcb_void_cookie_t xcb_sync_await(xcb_connection_t *, uint32_t, const xcb_sync_waitcondition_t *)") +# ::Iterator:: +fn("xcb_sync_waitcondition_t * xcb_sync_await_wait_list(const xcb_sync_await_request_t *)") +fn("int xcb_sync_await_wait_list_length(const xcb_sync_await_request_t *)") +fn("xcb_sync_waitcondition_iterator_t xcb_sync_await_wait_list_iterator(const xcb_sync_await_request_t *)") + +fn("xcb_void_cookie_t xcb_sync_change_counter_checked(xcb_connection_t *, xcb_sync_counter_t, xcb_sync_int64_t)") +fn("xcb_void_cookie_t xcb_sync_change_counter(xcb_connection_t *, xcb_sync_counter_t, xcb_sync_int64_t)") +fn("xcb_void_cookie_t xcb_sync_set_counter_checked(xcb_connection_t *, xcb_sync_counter_t, xcb_sync_int64_t)") +fn("xcb_void_cookie_t xcb_sync_set_counter(xcb_connection_t *, xcb_sync_counter_t, xcb_sync_int64_t)") +# XXX: void**? +fn("int xcb_sync_create_alarm_value_list_serialize(void **, uint32_t, const xcb_sync_create_alarm_value_list_t *)") +fn("int xcb_sync_create_alarm_value_list_unpack(const void *, uint32_t, xcb_sync_create_alarm_value_list_t *)") +fn("int xcb_sync_create_alarm_value_list_sizeof(const void *, uint32_t)") +fn("int xcb_sync_create_alarm_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_sync_create_alarm_checked(xcb_connection_t *, xcb_sync_alarm_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_sync_create_alarm(xcb_connection_t *, xcb_sync_alarm_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_sync_create_alarm_aux_checked(xcb_connection_t *, xcb_sync_alarm_t, uint32_t, const xcb_sync_create_alarm_value_list_t *)") +fn("xcb_void_cookie_t xcb_sync_create_alarm_aux(xcb_connection_t *, xcb_sync_alarm_t, uint32_t, const xcb_sync_create_alarm_value_list_t *)") +fn("void * xcb_sync_create_alarm_value_list(const xcb_sync_create_alarm_request_t *)") +# XXX: void**? +fn("int xcb_sync_change_alarm_value_list_serialize(void **, uint32_t, const xcb_sync_change_alarm_value_list_t *)") +fn("int xcb_sync_change_alarm_value_list_unpack(const void *, uint32_t, xcb_sync_change_alarm_value_list_t *)") +fn("int xcb_sync_change_alarm_value_list_sizeof(const void *, uint32_t)") +fn("int xcb_sync_change_alarm_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_sync_change_alarm_checked(xcb_connection_t *, xcb_sync_alarm_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_sync_change_alarm(xcb_connection_t *, xcb_sync_alarm_t, uint32_t, const void *)") +fn("xcb_void_cookie_t xcb_sync_change_alarm_aux_checked(xcb_connection_t *, xcb_sync_alarm_t, uint32_t, const xcb_sync_change_alarm_value_list_t *)") +fn("xcb_void_cookie_t xcb_sync_change_alarm_aux(xcb_connection_t *, xcb_sync_alarm_t, uint32_t, const xcb_sync_change_alarm_value_list_t *)") +# XXX: Who owns result? +fn("void * xcb_sync_change_alarm_value_list(const xcb_sync_change_alarm_request_t *)") +fn("xcb_void_cookie_t xcb_sync_destroy_alarm_checked(xcb_connection_t *, xcb_sync_alarm_t)") +fn("xcb_void_cookie_t xcb_sync_destroy_alarm(xcb_connection_t *, xcb_sync_alarm_t)") +fn("xcb_sync_query_alarm_cookie_t xcb_sync_query_alarm(xcb_connection_t *, xcb_sync_alarm_t)") +fn("xcb_sync_query_alarm_cookie_t xcb_sync_query_alarm_unchecked(xcb_connection_t *, xcb_sync_alarm_t)") +fn("xcb_sync_query_alarm_reply_t * xcb_sync_query_alarm_reply(xcb_connection_t *, xcb_sync_query_alarm_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_sync_set_priority_checked(xcb_connection_t *, uint32_t, int32_t)") +fn("xcb_void_cookie_t xcb_sync_set_priority(xcb_connection_t *, uint32_t, int32_t)") +fn("xcb_sync_get_priority_cookie_t xcb_sync_get_priority(xcb_connection_t *, uint32_t)") +fn("xcb_sync_get_priority_cookie_t xcb_sync_get_priority_unchecked(xcb_connection_t *, uint32_t)") +fn("xcb_sync_get_priority_reply_t * xcb_sync_get_priority_reply(xcb_connection_t *, xcb_sync_get_priority_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_sync_create_fence_checked(xcb_connection_t *, xcb_drawable_t, xcb_sync_fence_t, uint8_t)") +fn("xcb_void_cookie_t xcb_sync_create_fence(xcb_connection_t *, xcb_drawable_t, xcb_sync_fence_t, uint8_t)") +fn("xcb_void_cookie_t xcb_sync_trigger_fence_checked(xcb_connection_t *, xcb_sync_fence_t)") +fn("xcb_void_cookie_t xcb_sync_trigger_fence(xcb_connection_t *, xcb_sync_fence_t)") +fn("xcb_void_cookie_t xcb_sync_reset_fence_checked(xcb_connection_t *, xcb_sync_fence_t)") +fn("xcb_void_cookie_t xcb_sync_reset_fence(xcb_connection_t *, xcb_sync_fence_t)") +fn("xcb_void_cookie_t xcb_sync_destroy_fence_checked(xcb_connection_t *, xcb_sync_fence_t)") +fn("xcb_void_cookie_t xcb_sync_destroy_fence(xcb_connection_t *, xcb_sync_fence_t)") +fn("xcb_sync_query_fence_cookie_t xcb_sync_query_fence(xcb_connection_t *, xcb_sync_fence_t)") +fn("xcb_sync_query_fence_cookie_t xcb_sync_query_fence_unchecked(xcb_connection_t *, xcb_sync_fence_t)") +fn("xcb_sync_query_fence_reply_t * xcb_sync_query_fence_reply(xcb_connection_t *, xcb_sync_query_fence_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_sync_await_fence_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_sync_await_fence_checked(xcb_connection_t *, uint32_t, const xcb_sync_fence_t *)") +fn("xcb_void_cookie_t xcb_sync_await_fence(xcb_connection_t *, uint32_t, const xcb_sync_fence_t *)") +# ::Iterator:: +fn("xcb_sync_fence_t * xcb_sync_await_fence_fence_list(const xcb_sync_await_fence_request_t *)") +fn("int xcb_sync_await_fence_fence_list_length(const xcb_sync_await_fence_request_t *)") +fn("xcb_generic_iterator_t xcb_sync_await_fence_fence_list_end(const xcb_sync_await_fence_request_t *)") +Generate() diff --git a/ThunkLibs/libxcb_sync/Guest.cpp b/ThunkLibs/libxcb_sync/Guest.cpp new file mode 100644 index 000000000..ad8da7bad --- /dev/null +++ b/ThunkLibs/libxcb_sync/Guest.cpp @@ -0,0 +1,238 @@ +/* +$info$ +tags: thunklibs|xcb-sync +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { + xcb_extension_t xcb_sync_id = { + .name = "SYNC", + .global_id = 0, + }; + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_sync_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_sync_FEX_usable_size(&args); + return args.rv; + } + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_sync_init_extension(c, &xcb_sync_id); + } + + static xcb_sync_initialize_cookie_t fexfn_pack_xcb_sync_initialize(xcb_connection_t * a_0,uint8_t a_1,uint8_t a_2){ + struct {xcb_connection_t * a_0;uint8_t a_1;uint8_t a_2;xcb_sync_initialize_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_sync_xcb_sync_initialize(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_sync_initialize_cookie_t fexfn_pack_xcb_sync_initialize_unchecked(xcb_connection_t * a_0,uint8_t a_1,uint8_t a_2){ + struct {xcb_connection_t * a_0;uint8_t a_1;uint8_t a_2;xcb_sync_initialize_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_sync_xcb_sync_initialize_unchecked(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_sync_initialize_reply_t * fexfn_pack_xcb_sync_initialize_reply(xcb_connection_t * a_0,xcb_sync_initialize_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_sync_initialize_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_sync_initialize_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_sync_xcb_sync_initialize_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_sync_list_system_counters_reply_t * fexfn_pack_xcb_sync_list_system_counters_reply(xcb_connection_t * a_0,xcb_sync_list_system_counters_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_sync_list_system_counters_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_sync_list_system_counters_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_sync_xcb_sync_list_system_counters_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_sync_query_counter_reply_t * fexfn_pack_xcb_sync_query_counter_reply(xcb_connection_t * a_0,xcb_sync_query_counter_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_sync_query_counter_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_sync_query_counter_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_sync_xcb_sync_query_counter_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_sync_query_alarm_reply_t * fexfn_pack_xcb_sync_query_alarm_reply(xcb_connection_t * a_0,xcb_sync_query_alarm_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_sync_query_alarm_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_sync_query_alarm_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_sync_xcb_sync_query_alarm_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_sync_get_priority_reply_t * fexfn_pack_xcb_sync_get_priority_reply(xcb_connection_t * a_0,xcb_sync_get_priority_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_sync_get_priority_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_sync_get_priority_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_sync_xcb_sync_get_priority_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_sync_query_fence_reply_t * fexfn_pack_xcb_sync_query_fence_reply(xcb_connection_t * a_0,xcb_sync_query_fence_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_sync_query_fence_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_sync_query_fence_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_sync_xcb_sync_query_fence_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + return args.rv; + } + + xcb_sync_initialize_cookie_t xcb_sync_initialize(xcb_connection_t * a_0,uint8_t a_1,uint8_t a_2) __attribute__((alias("fexfn_pack_xcb_sync_initialize"))); + xcb_sync_initialize_cookie_t xcb_sync_initialize_unchecked(xcb_connection_t * a_0,uint8_t a_1,uint8_t a_2) __attribute__((alias("fexfn_pack_xcb_sync_initialize_unchecked"))); + xcb_sync_initialize_reply_t * xcb_sync_initialize_reply(xcb_connection_t * a_0,xcb_sync_initialize_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_sync_initialize_reply"))); + xcb_sync_list_system_counters_reply_t * xcb_sync_list_system_counters_reply(xcb_connection_t * a_0,xcb_sync_list_system_counters_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_sync_list_system_counters_reply"))); + xcb_sync_query_counter_reply_t * xcb_sync_query_counter_reply(xcb_connection_t * a_0,xcb_sync_query_counter_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_sync_query_counter_reply"))); + xcb_sync_query_alarm_reply_t * xcb_sync_query_alarm_reply(xcb_connection_t * a_0,xcb_sync_query_alarm_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_sync_query_alarm_reply"))); + xcb_sync_get_priority_reply_t * xcb_sync_get_priority_reply(xcb_connection_t * a_0,xcb_sync_get_priority_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_sync_get_priority_reply"))); + xcb_sync_query_fence_reply_t * xcb_sync_query_fence_reply(xcb_connection_t * a_0,xcb_sync_query_fence_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_sync_query_fence_reply"))); +} + +LOAD_LIB(libxcb_sync) diff --git a/ThunkLibs/libxcb_sync/Host.cpp b/ThunkLibs/libxcb_sync/Host.cpp new file mode 100644 index 000000000..69db57e42 --- /dev/null +++ b/ThunkLibs/libxcb_sync/Host.cpp @@ -0,0 +1,66 @@ +/* +$info$ +tags: thunklibs|xcb-sync +$end_info$ +*/ + +#include +#include + +#include +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + + +void fexfn_unpack_libxcb_sync_FEX_xcb_sync_init_extension(void *argsv); + +void fexfn_unpack_libxcb_sync_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_sync_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_unpack_libxcb_sync_FEX_xcb_sync_init_extension(void *argsv){ + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + if (strcmp(args->a_1->name, "SYNC") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_sync_so, "xcb_sync_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + typedef const struct xcb_query_extension_reply_t * fexldr_type_libxcb_xcb_get_extension_data(xcb_connection_t * a_0,xcb_extension_t * a_1); + fexldr_type_libxcb_xcb_get_extension_data *fexldr_ptr_libxcb_xcb_get_extension_data; + + fexldr_ptr_libxcb_xcb_get_extension_data = (fexldr_type_libxcb_xcb_get_extension_data*)dlsym(RTLD_DEFAULT, "xcb_get_extension_data"); + + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} + +EXPORTS(libxcb_sync) From f98627da32ffb373fe3a6f97f69f617018630a5f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:14:48 -0700 Subject: [PATCH 14/20] Thunks: Adds libxcb_xfixes --- ThunkLibs/Generators/libxcb_xfixes.py | 146 ++++++++++++ .../libxcb_xfixes/libxcb_xfixes_Guest.cpp | 210 ++++++++++++++++++ .../libxcb_xfixes/libxcb_xfixes_Host.cpp | 64 ++++++ 3 files changed, 420 insertions(+) create mode 100644 ThunkLibs/Generators/libxcb_xfixes.py create mode 100644 ThunkLibs/libxcb_xfixes/libxcb_xfixes_Guest.cpp create mode 100644 ThunkLibs/libxcb_xfixes/libxcb_xfixes_Host.cpp diff --git a/ThunkLibs/Generators/libxcb_xfixes.py b/ThunkLibs/Generators/libxcb_xfixes.py new file mode 100644 index 000000000..ab02b7c93 --- /dev/null +++ b/ThunkLibs/Generators/libxcb_xfixes.py @@ -0,0 +1,146 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib_with_filename("libxcb_xfixes", "libxcb-xfixes") + +# FEX +fn("void FEX_xcb_xfixes_init_extension(xcb_connection_t *, xcb_extension_t *)"); no_unpack() +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("xcb_xfixes_query_version_cookie_t xcb_xfixes_query_version(xcb_connection_t *, uint32_t, uint32_t)"); no_pack() +fn("xcb_xfixes_query_version_cookie_t xcb_xfixes_query_version_unchecked(xcb_connection_t *, uint32_t, uint32_t)"); no_pack() +fn("xcb_xfixes_query_version_reply_t * xcb_xfixes_query_version_reply(xcb_connection_t *, xcb_xfixes_query_version_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_xfixes_change_save_set_checked(xcb_connection_t *, uint8_t, uint8_t, uint8_t, xcb_window_t)") +fn("xcb_void_cookie_t xcb_xfixes_change_save_set(xcb_connection_t *, uint8_t, uint8_t, uint8_t, xcb_window_t)") +fn("xcb_void_cookie_t xcb_xfixes_select_selection_input_checked(xcb_connection_t *, xcb_window_t, xcb_atom_t, uint32_t)") +fn("xcb_void_cookie_t xcb_xfixes_select_selection_input(xcb_connection_t *, xcb_window_t, xcb_atom_t, uint32_t)") +fn("xcb_void_cookie_t xcb_xfixes_select_cursor_input_checked(xcb_connection_t *, xcb_window_t, uint32_t)") +fn("xcb_void_cookie_t xcb_xfixes_select_cursor_input(xcb_connection_t *, xcb_window_t, uint32_t)") +fn("int xcb_xfixes_get_cursor_image_sizeof(const void *)") +fn("xcb_xfixes_get_cursor_image_cookie_t xcb_xfixes_get_cursor_image(xcb_connection_t *)") +fn("xcb_xfixes_get_cursor_image_cookie_t xcb_xfixes_get_cursor_image_unchecked(xcb_connection_t *)") +# ::Iterator:: +fn("uint32_t * xcb_xfixes_get_cursor_image_cursor_image(const xcb_xfixes_get_cursor_image_reply_t *)") +fn("int xcb_xfixes_get_cursor_image_cursor_image_length(const xcb_xfixes_get_cursor_image_reply_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_get_cursor_image_cursor_image_end(const xcb_xfixes_get_cursor_image_reply_t *)") + +fn("xcb_xfixes_get_cursor_image_reply_t * xcb_xfixes_get_cursor_image_reply(xcb_connection_t *, xcb_xfixes_get_cursor_image_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("void xcb_xfixes_region_next(xcb_xfixes_region_iterator_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_region_end(xcb_xfixes_region_iterator_t)") +fn("int xcb_xfixes_create_region_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_xfixes_create_region_checked(xcb_connection_t *, xcb_xfixes_region_t, uint32_t, const xcb_rectangle_t *)") +fn("xcb_void_cookie_t xcb_xfixes_create_region(xcb_connection_t *, xcb_xfixes_region_t, uint32_t, const xcb_rectangle_t *)") +# ::Iterator:: +fn("xcb_rectangle_t * xcb_xfixes_create_region_rectangles(const xcb_xfixes_create_region_request_t *)") +fn("int xcb_xfixes_create_region_rectangles_length(const xcb_xfixes_create_region_request_t *)") +fn("xcb_rectangle_iterator_t xcb_xfixes_create_region_rectangles_iterator(const xcb_xfixes_create_region_request_t *)") + +fn("xcb_void_cookie_t xcb_xfixes_create_region_from_bitmap_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_pixmap_t)") +fn("xcb_void_cookie_t xcb_xfixes_create_region_from_bitmap(xcb_connection_t *, xcb_xfixes_region_t, xcb_pixmap_t)") +fn("xcb_void_cookie_t xcb_xfixes_create_region_from_window_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_window_t, xcb_shape_kind_t)") +fn("xcb_void_cookie_t xcb_xfixes_create_region_from_window(xcb_connection_t *, xcb_xfixes_region_t, xcb_window_t, xcb_shape_kind_t)") +fn("xcb_void_cookie_t xcb_xfixes_create_region_from_gc_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_gcontext_t)") +fn("xcb_void_cookie_t xcb_xfixes_create_region_from_gc(xcb_connection_t *, xcb_xfixes_region_t, xcb_gcontext_t)") +fn("xcb_void_cookie_t xcb_xfixes_create_region_from_picture_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_render_picture_t)") +fn("xcb_void_cookie_t xcb_xfixes_create_region_from_picture(xcb_connection_t *, xcb_xfixes_region_t, xcb_render_picture_t)") +fn("xcb_void_cookie_t xcb_xfixes_destroy_region_checked(xcb_connection_t *, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_destroy_region(xcb_connection_t *, xcb_xfixes_region_t)") +fn("int xcb_xfixes_set_region_sizeof(const void *, uint32_t)") +fn("xcb_void_cookie_t xcb_xfixes_set_region_checked(xcb_connection_t *, xcb_xfixes_region_t, uint32_t, const xcb_rectangle_t *)") +fn("xcb_void_cookie_t xcb_xfixes_set_region(xcb_connection_t *, xcb_xfixes_region_t, uint32_t, const xcb_rectangle_t *)") +# ::Iterator:: +fn("xcb_rectangle_t * xcb_xfixes_set_region_rectangles(const xcb_xfixes_set_region_request_t *)") +fn("int xcb_xfixes_set_region_rectangles_length(const xcb_xfixes_set_region_request_t *)") +fn("xcb_rectangle_iterator_t xcb_xfixes_set_region_rectangles_iterator(const xcb_xfixes_set_region_request_t *)") + +fn("xcb_void_cookie_t xcb_xfixes_copy_region_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_copy_region(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_union_region_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_union_region(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_intersect_region_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_intersect_region(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_subtract_region_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_subtract_region(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_invert_region_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_rectangle_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_invert_region(xcb_connection_t *, xcb_xfixes_region_t, xcb_rectangle_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_translate_region_checked(xcb_connection_t *, xcb_xfixes_region_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_xfixes_translate_region(xcb_connection_t *, xcb_xfixes_region_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_xfixes_region_extents_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_region_extents(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t)") +fn("int xcb_xfixes_fetch_region_sizeof(const void *)") +fn("xcb_xfixes_fetch_region_cookie_t xcb_xfixes_fetch_region(xcb_connection_t *, xcb_xfixes_region_t)") +fn("xcb_xfixes_fetch_region_cookie_t xcb_xfixes_fetch_region_unchecked(xcb_connection_t *, xcb_xfixes_region_t)") +# ::Iterator:: +fn("xcb_rectangle_t * xcb_xfixes_fetch_region_rectangles(const xcb_xfixes_fetch_region_reply_t *)") +fn("int xcb_xfixes_fetch_region_rectangles_length(const xcb_xfixes_fetch_region_reply_t *)") +fn("xcb_rectangle_iterator_t xcb_xfixes_fetch_region_rectangles_iterator(const xcb_xfixes_fetch_region_reply_t *)") + +fn("xcb_xfixes_fetch_region_reply_t * xcb_xfixes_fetch_region_reply(xcb_connection_t *, xcb_xfixes_fetch_region_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("xcb_void_cookie_t xcb_xfixes_set_gc_clip_region_checked(xcb_connection_t *, xcb_gcontext_t, xcb_xfixes_region_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_xfixes_set_gc_clip_region(xcb_connection_t *, xcb_gcontext_t, xcb_xfixes_region_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_xfixes_set_window_shape_region_checked(xcb_connection_t *, xcb_window_t, xcb_shape_kind_t, int16_t, int16_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_set_window_shape_region(xcb_connection_t *, xcb_window_t, xcb_shape_kind_t, int16_t, int16_t, xcb_xfixes_region_t)") +fn("xcb_void_cookie_t xcb_xfixes_set_picture_clip_region_checked(xcb_connection_t *, xcb_render_picture_t, xcb_xfixes_region_t, int16_t, int16_t)") +fn("xcb_void_cookie_t xcb_xfixes_set_picture_clip_region(xcb_connection_t *, xcb_render_picture_t, xcb_xfixes_region_t, int16_t, int16_t)") +fn("int xcb_xfixes_set_cursor_name_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_xfixes_set_cursor_name_checked(xcb_connection_t *, xcb_cursor_t, uint16_t, const char *)") +fn("xcb_void_cookie_t xcb_xfixes_set_cursor_name(xcb_connection_t *, xcb_cursor_t, uint16_t, const char *)") +# ::Iterator:: +fn("char * xcb_xfixes_set_cursor_name_name(const xcb_xfixes_set_cursor_name_request_t *)") +fn("int xcb_xfixes_set_cursor_name_name_length(const xcb_xfixes_set_cursor_name_request_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_set_cursor_name_name_end(const xcb_xfixes_set_cursor_name_request_t *)") + +fn("int xcb_xfixes_get_cursor_name_sizeof(const void *)") +fn("xcb_xfixes_get_cursor_name_cookie_t xcb_xfixes_get_cursor_name(xcb_connection_t *, xcb_cursor_t)") +fn("xcb_xfixes_get_cursor_name_cookie_t xcb_xfixes_get_cursor_name_unchecked(xcb_connection_t *, xcb_cursor_t)") +# ::Iterator:: +fn("char * xcb_xfixes_get_cursor_name_name(const xcb_xfixes_get_cursor_name_reply_t *)") +fn("int xcb_xfixes_get_cursor_name_name_length(const xcb_xfixes_get_cursor_name_reply_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_get_cursor_name_name_end(const xcb_xfixes_get_cursor_name_reply_t *)") + +fn("xcb_xfixes_get_cursor_name_reply_t * xcb_xfixes_get_cursor_name_reply(xcb_connection_t *, xcb_xfixes_get_cursor_name_cookie_t, xcb_generic_error_t **)"); no_pack() +fn("int xcb_xfixes_get_cursor_image_and_name_sizeof(const void *)") +fn("xcb_xfixes_get_cursor_image_and_name_cookie_t xcb_xfixes_get_cursor_image_and_name(xcb_connection_t *)") +fn("xcb_xfixes_get_cursor_image_and_name_cookie_t xcb_xfixes_get_cursor_image_and_name_unchecked(xcb_connection_t *)") +# ::Iterator:: +fn("uint32_t * xcb_xfixes_get_cursor_image_and_name_cursor_image(const xcb_xfixes_get_cursor_image_and_name_reply_t *)") +fn("int xcb_xfixes_get_cursor_image_and_name_cursor_image_length(const xcb_xfixes_get_cursor_image_and_name_reply_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_get_cursor_image_and_name_cursor_image_end(const xcb_xfixes_get_cursor_image_and_name_reply_t *)") + +# ::Iterator:: +fn("char * xcb_xfixes_get_cursor_image_and_name_name(const xcb_xfixes_get_cursor_image_and_name_reply_t *)") +fn("int xcb_xfixes_get_cursor_image_and_name_name_length(const xcb_xfixes_get_cursor_image_and_name_reply_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_get_cursor_image_and_name_name_end(const xcb_xfixes_get_cursor_image_and_name_reply_t *)") + +fn("xcb_xfixes_get_cursor_image_and_name_reply_t * xcb_xfixes_get_cursor_image_and_name_reply(xcb_connection_t *, xcb_xfixes_get_cursor_image_and_name_cookie_t, xcb_generic_error_t **)") ; no_pack() +fn("xcb_void_cookie_t xcb_xfixes_change_cursor_checked(xcb_connection_t *, xcb_cursor_t, xcb_cursor_t)") +fn("xcb_void_cookie_t xcb_xfixes_change_cursor(xcb_connection_t *, xcb_cursor_t, xcb_cursor_t)") +fn("int xcb_xfixes_change_cursor_by_name_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_xfixes_change_cursor_by_name_checked(xcb_connection_t *, xcb_cursor_t, uint16_t, const char *)") +fn("xcb_void_cookie_t xcb_xfixes_change_cursor_by_name(xcb_connection_t *, xcb_cursor_t, uint16_t, const char *)") +# ::Iterator:: +fn("char * xcb_xfixes_change_cursor_by_name_name(const xcb_xfixes_change_cursor_by_name_request_t *)") +fn("int xcb_xfixes_change_cursor_by_name_name_length(const xcb_xfixes_change_cursor_by_name_request_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_change_cursor_by_name_name_end(const xcb_xfixes_change_cursor_by_name_request_t *)") + +fn("xcb_void_cookie_t xcb_xfixes_expand_region_checked(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_xfixes_expand_region(xcb_connection_t *, xcb_xfixes_region_t, xcb_xfixes_region_t, uint16_t, uint16_t, uint16_t, uint16_t)") +fn("xcb_void_cookie_t xcb_xfixes_hide_cursor_checked(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_xfixes_hide_cursor(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_xfixes_show_cursor_checked(xcb_connection_t *, xcb_window_t)") +fn("xcb_void_cookie_t xcb_xfixes_show_cursor(xcb_connection_t *, xcb_window_t)") +fn("void xcb_xfixes_barrier_next(xcb_xfixes_barrier_iterator_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_barrier_end(xcb_xfixes_barrier_iterator_t)") +fn("int xcb_xfixes_create_pointer_barrier_sizeof(const void *)") +fn("xcb_void_cookie_t xcb_xfixes_create_pointer_barrier_checked(xcb_connection_t *, xcb_xfixes_barrier_t, xcb_window_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, const uint16_t *)") +fn("xcb_void_cookie_t xcb_xfixes_create_pointer_barrier(xcb_connection_t *, xcb_xfixes_barrier_t, xcb_window_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, const uint16_t *)") +# ::Iterator:: +fn("uint16_t * xcb_xfixes_create_pointer_barrier_devices(const xcb_xfixes_create_pointer_barrier_request_t *)") +fn("int xcb_xfixes_create_pointer_barrier_devices_length(const xcb_xfixes_create_pointer_barrier_request_t *)") +fn("xcb_generic_iterator_t xcb_xfixes_create_pointer_barrier_devices_end(const xcb_xfixes_create_pointer_barrier_request_t *)") + +fn("xcb_void_cookie_t xcb_xfixes_delete_pointer_barrier_checked(xcb_connection_t *, xcb_xfixes_barrier_t)") +fn("xcb_void_cookie_t xcb_xfixes_delete_pointer_barrier(xcb_connection_t *, xcb_xfixes_barrier_t)") + +Generate() diff --git a/ThunkLibs/libxcb_xfixes/libxcb_xfixes_Guest.cpp b/ThunkLibs/libxcb_xfixes/libxcb_xfixes_Guest.cpp new file mode 100644 index 000000000..1047727c2 --- /dev/null +++ b/ThunkLibs/libxcb_xfixes/libxcb_xfixes_Guest.cpp @@ -0,0 +1,210 @@ +/* +$info$ +tags: thunklibs|xcb-xfixes +$end_info$ +*/ + +#include +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { + xcb_extension_t xcb_xfixes_id = { + .name = "XFIXES", + .global_id = 0, + }; + + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libxcb_xfixes_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libxcb_xfixes_FEX_usable_size(&args); + return args.rv; + } + + static void InitializeExtensions(xcb_connection_t *c) { + FEX_xcb_xfixes_init_extension(c, &xcb_xfixes_id); + } + + static xcb_xfixes_query_version_cookie_t fexfn_pack_xcb_xfixes_query_version(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;uint32_t a_2;xcb_xfixes_query_version_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xfixes_xcb_xfixes_query_version(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_xfixes_query_version_cookie_t fexfn_pack_xcb_xfixes_query_version_unchecked(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2){ + struct {xcb_connection_t * a_0;uint32_t a_1;uint32_t a_2;xcb_xfixes_query_version_cookie_t rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xfixes_xcb_xfixes_query_version_unchecked(&args); + InitializeExtensions(a_0); + return args.rv; + } + + static xcb_xfixes_query_version_reply_t * fexfn_pack_xcb_xfixes_query_version_reply(xcb_connection_t * a_0,xcb_xfixes_query_version_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_xfixes_query_version_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_xfixes_query_version_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xfixes_xcb_xfixes_query_version_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_xfixes_get_cursor_image_reply_t * fexfn_pack_xcb_xfixes_get_cursor_image_reply(xcb_connection_t * a_0,xcb_xfixes_get_cursor_image_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_xfixes_get_cursor_image_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_xfixes_get_cursor_image_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xfixes_xcb_xfixes_get_cursor_image_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_xfixes_fetch_region_reply_t * fexfn_pack_xcb_xfixes_fetch_region_reply(xcb_connection_t * a_0,xcb_xfixes_fetch_region_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_xfixes_fetch_region_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_xfixes_fetch_region_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xfixes_xcb_xfixes_fetch_region_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_xfixes_get_cursor_name_reply_t * fexfn_pack_xcb_xfixes_get_cursor_name_reply(xcb_connection_t * a_0,xcb_xfixes_get_cursor_name_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_xfixes_get_cursor_name_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_xfixes_get_cursor_name_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xfixes_xcb_xfixes_get_cursor_name_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + static xcb_xfixes_get_cursor_image_and_name_reply_t * fexfn_pack_xcb_xfixes_get_cursor_image_and_name_reply(xcb_connection_t * a_0,xcb_xfixes_get_cursor_image_and_name_cookie_t a_1,xcb_generic_error_t ** a_2){ + struct {xcb_connection_t * a_0;xcb_xfixes_get_cursor_image_and_name_cookie_t a_1;xcb_generic_error_t ** a_2;xcb_xfixes_get_cursor_image_and_name_reply_t * rv;} args; + args.a_0 = a_0;args.a_1 = a_1;args.a_2 = a_2; + fexthunks_libxcb_xfixes_xcb_xfixes_get_cursor_image_and_name_reply(&args); + + // We now need to do some fixups here + if (a_2 && *a_2) { + // If the error code pointer exists then we need to copy the contents and free the host facing pointer + xcb_generic_error_t *NewError = (xcb_generic_error_t *)malloc(sizeof(xcb_generic_error_t)); + memcpy(NewError, *a_2, sizeof(xcb_generic_error_t)); + FEX_malloc_free_on_host(*a_2); + + // User is expected to free this + *a_2 = NewError; + } + + if (args.rv) { + constexpr size_t ResultSize = sizeof(std::remove_pointer::type); + void *NewPtr = malloc(ResultSize); + memcpy(NewPtr, args.rv, ResultSize); + + FEX_malloc_free_on_host(args.rv); + args.rv = (decltype(args.rv))NewPtr; + } + + return args.rv; + } + + xcb_xfixes_query_version_cookie_t xcb_xfixes_query_version(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_xfixes_query_version"))); + xcb_xfixes_query_version_cookie_t xcb_xfixes_query_version_unchecked(xcb_connection_t * a_0,uint32_t a_1,uint32_t a_2) __attribute__((alias("fexfn_pack_xcb_xfixes_query_version_unchecked"))); + xcb_xfixes_query_version_reply_t * xcb_xfixes_query_version_reply(xcb_connection_t * a_0,xcb_xfixes_query_version_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_xfixes_query_version_reply"))); + xcb_xfixes_get_cursor_image_reply_t * xcb_xfixes_get_cursor_image_reply(xcb_connection_t * a_0,xcb_xfixes_get_cursor_image_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_xfixes_get_cursor_image_reply"))); + xcb_xfixes_fetch_region_reply_t * xcb_xfixes_fetch_region_reply(xcb_connection_t * a_0,xcb_xfixes_fetch_region_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_xfixes_fetch_region_reply"))); + xcb_xfixes_get_cursor_name_reply_t * xcb_xfixes_get_cursor_name_reply(xcb_connection_t * a_0,xcb_xfixes_get_cursor_name_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_xfixes_get_cursor_name_reply"))); + xcb_xfixes_get_cursor_image_and_name_reply_t * xcb_xfixes_get_cursor_image_and_name_reply(xcb_connection_t * a_0,xcb_xfixes_get_cursor_image_and_name_cookie_t a_1,xcb_generic_error_t ** a_2) __attribute__((alias("fexfn_pack_xcb_xfixes_get_cursor_image_and_name_reply"))); +} + +LOAD_LIB(libxcb_xfixes) diff --git a/ThunkLibs/libxcb_xfixes/libxcb_xfixes_Host.cpp b/ThunkLibs/libxcb_xfixes/libxcb_xfixes_Host.cpp new file mode 100644 index 000000000..5180a84e9 --- /dev/null +++ b/ThunkLibs/libxcb_xfixes/libxcb_xfixes_Host.cpp @@ -0,0 +1,64 @@ +/* +$info$ +tags: thunklibs|xcb-xfixes +$end_info$ +*/ + +#include +#include + +#include +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + +void fexfn_unpack_libxcb_xfixes_FEX_xcb_xfixes_init_extension(void *argsv); + +void fexfn_unpack_libxcb_xfixes_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libxcb_xfixes_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +void fexfn_unpack_libxcb_xfixes_FEX_xcb_xfixes_init_extension(void *argsv) { + struct arg_t {xcb_connection_t * a_0;xcb_extension_t * a_1;}; + auto args = (arg_t*)argsv; + xcb_extension_t *ext{}; + if (strcmp(args->a_1->name, "XFIXES") == 0) { + ext = (xcb_extension_t *)dlsym(fexldr_ptr_libxcb_xfixes_so, "xcb_xfixes_id"); + } + else { + fprintf(stderr, "Unknown xcb extension '%s'\n", args->a_1->name); + __builtin_trap(); + return; + } + + typedef const struct xcb_query_extension_reply_t * fexldr_type_libxcb_xcb_get_extension_data(xcb_connection_t * a_0,xcb_extension_t * a_1); + fexldr_type_libxcb_xcb_get_extension_data *fexldr_ptr_libxcb_xcb_get_extension_data; + + fexldr_ptr_libxcb_xcb_get_extension_data = (fexldr_type_libxcb_xcb_get_extension_data*)dlsym(RTLD_DEFAULT, "xcb_get_extension_data"); + + auto res = fexldr_ptr_libxcb_xcb_get_extension_data(args->a_0, ext); + + // Copy over the global id + args->a_1->global_id = ext->global_id; +} +EXPORTS(libxcb_xfixes) From 4a3bd7cd13bb9b84634805c8ae9da5bf0dd6421e Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:15:02 -0700 Subject: [PATCH 15/20] Thunks: Adds libxshmfence --- ThunkLibs/Generators/libxshmfence.py | 12 ++++++++++++ ThunkLibs/libxshmfence/Guest.cpp | 23 +++++++++++++++++++++++ ThunkLibs/libxshmfence/Host.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 ThunkLibs/Generators/libxshmfence.py create mode 100644 ThunkLibs/libxshmfence/Guest.cpp create mode 100644 ThunkLibs/libxshmfence/Host.cpp diff --git a/ThunkLibs/Generators/libxshmfence.py b/ThunkLibs/Generators/libxshmfence.py new file mode 100644 index 000000000..0cb54fbc3 --- /dev/null +++ b/ThunkLibs/Generators/libxshmfence.py @@ -0,0 +1,12 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib("libxshmfence") +fn("int xshmfence_trigger(struct xshmfence *)") +fn("int xshmfence_await(struct xshmfence *)") +fn("int xshmfence_query(struct xshmfence *)") +fn("void xshmfence_reset(struct xshmfence *)") +fn("int xshmfence_alloc_shm()") +fn("struct xshmfence * xshmfence_map_shm(int)") +fn("void xshmfence_unmap_shm(struct xshmfence *)") +Generate() diff --git a/ThunkLibs/libxshmfence/Guest.cpp b/ThunkLibs/libxshmfence/Guest.cpp new file mode 100644 index 000000000..e256b2956 --- /dev/null +++ b/ThunkLibs/libxshmfence/Guest.cpp @@ -0,0 +1,23 @@ +/* +$info$ +tags: thunklibs|xshmfence +$end_info$ +*/ + +extern "C" { +#include +} + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +LOAD_LIB(libxshmfence) diff --git a/ThunkLibs/libxshmfence/Host.cpp b/ThunkLibs/libxshmfence/Host.cpp new file mode 100644 index 000000000..afd89c29a --- /dev/null +++ b/ThunkLibs/libxshmfence/Host.cpp @@ -0,0 +1,25 @@ +/* +$info$ +tags: thunklibs|xshmfence +$end_info$ +*/ + +#include + +#include + +#include "common/Host.h" +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +EXPORTS(libxshmfence) + From c3230f6a919d7710cde38c91e7a41c242ce5a640 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:15:19 -0700 Subject: [PATCH 16/20] Thunks: Adds libdrm --- ThunkLibs/Generators/libdrm.py | 155 +++++++++++++++++++++++++++++++++ ThunkLibs/libdrm/Guest.cpp | 130 +++++++++++++++++++++++++++ ThunkLibs/libdrm/Host.cpp | 38 ++++++++ 3 files changed, 323 insertions(+) create mode 100644 ThunkLibs/Generators/libdrm.py create mode 100644 ThunkLibs/libdrm/Guest.cpp create mode 100644 ThunkLibs/libdrm/Host.cpp diff --git a/ThunkLibs/Generators/libdrm.py b/ThunkLibs/Generators/libdrm.py new file mode 100644 index 000000000..77ca2a133 --- /dev/null +++ b/ThunkLibs/Generators/libdrm.py @@ -0,0 +1,155 @@ +#!/usr/bin/python3 +from ThunkHelpers import * + +lib("libdrm") + +# FEX +fn("size_t FEX_usable_size(void*)"); no_unpack() +fn("void FEX_free_on_host(void*)"); no_unpack() + +fn("int drmIoctl(int, unsigned long, void *)") +fn("void * drmGetHashTable()") +fn("drmHashEntry * drmGetEntry(int)") +fn("int drmAvailable()") +fn("int drmOpen(const char *, const char *)") +fn("int drmOpenWithType(const char *, const char *, int)") +fn("int drmOpenControl(int)") +fn("int drmOpenRender(int)") +fn("int drmClose(int)") +fn("drmVersionPtr drmGetVersion(int)") +fn("drmVersionPtr drmGetLibVersion(int)") +fn("int drmGetCap(int, uint64_t, uint64_t *)") +fn("void drmFreeVersion(drmVersionPtr)") +fn("int drmGetMagic(int, drm_magic_t*)") +fn("char * drmGetBusid(int)") +fn("int drmGetInterruptFromBusID(int, int, int, int)") +fn("int drmGetMap(int, int, drm_handle_t *, drmSize *, drmMapType *, drmMapFlags *, drm_handle_t *, int *)") +fn("int drmGetClient(int, int, int *, int *, int *, unsigned long *, unsigned long *)") +fn("int drmGetStats(int, drmStatsT *)") +fn("int drmSetInterfaceVersion(int, drmSetVersion *)") +fn("int drmCommandNone(int, unsigned long)") +fn("int drmCommandRead(int, unsigned long, void *, unsigned long)") +fn("int drmCommandWrite(int, unsigned long, void *, unsigned long)") +fn("int drmCommandWriteRead(int, unsigned long, void *, unsigned long)") +fn("void drmFreeBusid(const char *)") +fn("int drmSetBusid(int, const char *)") +fn("int drmAuthMagic(int, drm_magic_t)") +fn("int drmAddMap(int, drm_handle_t, drmSize, drmMapType, drmMapFlags, drm_handle_t *)") +fn("int drmRmMap(int, drm_handle_t)") +fn("int drmAddContextPrivateMapping(int, drm_context_t, drm_handle_t)") +fn("int drmAddBufs(int, int, int, drmBufDescFlags, int)") +fn("int drmMarkBufs(int, double, double)") +fn("int drmCreateContext(int, drm_context_t *)") +fn("int drmSetContextFlags(int, drm_context_t, drm_context_tFlags)") +fn("int drmGetContextFlags(int, drm_context_t, drm_context_tFlagsPtr)") +fn("int drmAddContextTag(int, drm_context_t, void *)") +fn("int drmDelContextTag(int, drm_context_t)") +fn("void * drmGetContextTag(int, drm_context_t)") +fn("drm_context_t * drmGetReservedContextList(int, int*)") +fn("void drmFreeReservedContextList(drm_context_t *)") +fn("int drmSwitchToContext(int, drm_context_t)") +fn("int drmDestroyContext(int, drm_context_t)") +fn("int drmCreateDrawable(int, drm_drawable_t *)") +fn("int drmDestroyDrawable(int, drm_drawable_t)") +fn("int drmUpdateDrawableInfo(int, drm_drawable_t, drm_drawable_info_type_t, unsigned int, void *)") +fn("int drmCtlInstHandler(int, int)") +fn("int drmCtlUninstHandler(int)") +fn("int drmSetClientCap(int, uint64_t, uint64_t)") +fn("int drmCrtcGetSequence(int, uint32_t, uint64_t *, uint64_t *)") +fn("int drmCrtcQueueSequence(int, uint32_t, uint32_t, uint64_t, uint64_t *, uint64_t)") +fn("int drmMap(int, drm_handle_t, drmSize, drmAddressPtr)") +fn("int drmUnmap(drmAddress, drmSize)") +fn("drmBufInfoPtr drmGetBufInfo(int)") +fn("drmBufMapPtr drmMapBufs(int)") +fn("int drmUnmapBufs(drmBufMapPtr)") +fn("int drmDMA(int, drmDMAReqPtr)") +fn("int drmFreeBufs(int, int, int *)") +fn("int drmGetLock(int, drm_context_t, drmLockFlags)") +fn("int drmUnlock(int, drm_context_t)") +fn("int drmFinish(int, int, drmLockFlags)") +fn("int drmGetContextPrivateMapping(int, drm_context_t, drm_handle_t*)") +#fn("int drmAgpAcquire(int)") +#fn("int drmAgpRelease(int)") +#fn("int drmAgpEnable(int, unsigned long)") +#fn("int drmAgpAlloc(int, unsigned long, unsigned long, unsigned long *, int *)") +#fn("int drmAgpFree(int, int)") +#fn("int drmAgpBind(int, int, unsigned long)") +#fn("int drmAgpUnbind(int, int)") +#fn("int drmAgpVersionMajor(int)") +#fn("int drmAgpVersionMinor(int)") +#fn("unsigned long drmAgpGetMode(int)") +#fn("unsigned long drmAgpBase(int)") +#fn("unsigned long drmAgpSize(int)") +#fn("unsigned long drmAgpMemoryUsed(int)") +#fn("unsigned long drmAgpMemoryAvail(int)") +#fn("unsigned int drmAgpVendorId(int)") +#fn("unsigned int drmAgpDeviceId(int)") +fn("int drmScatterGatherAlloc(int, unsigned long, drm_handle_t*)") +fn("int drmScatterGatherFree(int, drm_handle_t)") +fn("int drmWaitVBlank(int, drmVBlankPtr)") +fn("void drmSetServerInfo(drmServerInfoPtr)") +fn("int drmError(int, const char *)") +fn("void * drmMalloc(int)") +fn("void drmFree(void *)") +fn("void * drmHashCreate()") +fn("int drmHashDestroy(void *)") +fn("int drmHashLookup(void *, unsigned long, void **)") +fn("int drmHashInsert(void *, unsigned long, void *)") +fn("int drmHashDelete(void *, unsigned long)") +fn("int drmHashFirst(void *, unsigned long *, void **)") +fn("int drmHashNext(void *, unsigned long *, void **)") +fn("void * drmRandomCreate(unsigned long)") +fn("int drmRandomDestroy(void *)") +fn("unsigned long drmRandom(void *)") +fn("double drmRandomDouble(void *)") +fn("void * drmSLCreate()") +fn("int drmSLDestroy(void *)") +fn("int drmSLLookup(void *, unsigned long, void **)") +fn("int drmSLInsert(void *, unsigned long, void *)") +fn("int drmSLDelete(void *, unsigned long)") +fn("int drmSLNext(void *, unsigned long *, void **)") +fn("int drmSLFirst(void *, unsigned long *, void **)") +fn("void drmSLDump(void *)") +fn("int drmSLLookupNeighbors(void *, unsigned long, unsigned long *, void **, unsigned long *, void **)") +fn("int drmOpenOnce(void *, const char *, int *)") +fn("int drmOpenOnceWithType(const char *, int *, int)") +fn("void drmCloseOnce(int)") +fn("void drmMsg(const char *, ...)"); no_pack(); no_unpack(); no_tab_unpack() +fn("int drmSetMaster(int)") +fn("int drmDropMaster(int)") +fn("int drmIsMaster(int)") +fn("int drmHandleEvent(int, drmEventContextPtr)") +# Application has ownership of the returned pointers +fn("char * drmGetDeviceNameFromFd(int)"); no_pack() +fn("char * drmGetDeviceNameFromFd2(int)"); no_pack() + +fn("int drmGetNodeTypeFromFd(int)") +fn("int drmPrimeHandleToFD(int, uint32_t, uint32_t, int *)") +fn("int drmPrimeFDToHandle(int, int, uint32_t *)") +# Application has ownership of the returned pointers +fn("char * drmGetPrimaryDeviceNameFromFd(int)"); no_pack() +fn("char * drmGetRenderDeviceNameFromFd(int)"); no_pack() + +fn("int drmGetDevice(int, drmDevicePtr *)") +fn("void drmFreeDevice(drmDevicePtr *)") +fn("int drmGetDevices(drmDevicePtr*, int)") +fn("void drmFreeDevices(drmDevicePtr*, int)") +fn("int drmGetDevice2(int, uint32_t, drmDevicePtr *)") +fn("int drmGetDevices2(uint32_t, drmDevicePtr*, int)") +fn("int drmDevicesEqual(drmDevicePtr, drmDevicePtr)") +fn("int drmSyncobjCreate(int, uint32_t, uint32_t *)") +fn("int drmSyncobjDestroy(int, uint32_t)") +fn("int drmSyncobjHandleToFD(int, uint32_t, int *)") +fn("int drmSyncobjFDToHandle(int, int, uint32_t *)") +fn("int drmSyncobjImportSyncFile(int, uint32_t, int)") +fn("int drmSyncobjExportSyncFile(int, uint32_t, int *)") +fn("int drmSyncobjWait(int, uint32_t *, unsigned int, int64_t, unsigned int, uint32_t *)") +fn("int drmSyncobjReset(int, const uint32_t *, uint32_t)") +fn("int drmSyncobjSignal(int, const uint32_t *, uint32_t)") +fn("int drmSyncobjTimelineSignal(int, const uint32_t *, uint64_t *, uint32_t)") +fn("int drmSyncobjTimelineWait(int, uint32_t *, uint64_t *, unsigned int, int64_t, unsigned int, uint32_t *)") +fn("int drmSyncobjQuery(int, uint32_t *, uint64_t *, uint32_t)") +fn("int drmSyncobjQuery2(int, uint32_t *, uint64_t *, uint32_t, uint32_t)") +fn("int drmSyncobjTransfer(int, uint32_t, uint64_t, uint32_t, uint64_t, uint32_t)") + +Generate() diff --git a/ThunkLibs/libdrm/Guest.cpp b/ThunkLibs/libdrm/Guest.cpp new file mode 100644 index 000000000..a951a35c0 --- /dev/null +++ b/ThunkLibs/libdrm/Guest.cpp @@ -0,0 +1,130 @@ +/* +$info$ +tags: thunklibs|drm +$end_info$ +*/ + +#include + +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { + void FEX_malloc_free_on_host(void *Ptr) { + struct {void *p;} args; + args.p = Ptr; + fexthunks_libdrm_FEX_free_on_host(&args); + } + + size_t FEX_malloc_usable_size(void *Ptr) { + struct {void *p; size_t rv;} args; + args.p = Ptr; + fexthunks_libdrm_FEX_usable_size(&args); + return args.rv; + } + + static void fexfn_pack_drmMsg(const char *format,...){ + va_list ap; + if (1) { + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + } + } + + static char * fexfn_pack_drmGetDeviceNameFromFd(int a_0){ + struct {int a_0;char * rv;} args; + args.a_0 = a_0; + fexthunks_libdrm_drmGetDeviceNameFromFd(&args); + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (char*)NewPtr; + } + + return args.rv; + } + + static char * fexfn_pack_drmGetDeviceNameFromFd2(int a_0){ + struct {int a_0;char * rv;} args; + args.a_0 = a_0; + fexthunks_libdrm_drmGetDeviceNameFromFd2(&args); + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (char*)NewPtr; + } + + return args.rv; + } + + static char * fexfn_pack_drmGetPrimaryDeviceNameFromFd(int a_0){ + struct {int a_0;char * rv;} args; + args.a_0 = a_0; + fexthunks_libdrm_drmGetPrimaryDeviceNameFromFd(&args); + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (char*)NewPtr; + } + + return args.rv; + } + + static char * fexfn_pack_drmGetRenderDeviceNameFromFd(int a_0){ + struct {int a_0;char * rv;} args; + args.a_0 = a_0; + fexthunks_libdrm_drmGetRenderDeviceNameFromFd(&args); + + if (args.rv) { + // Usable size + size_t Usable = FEX_malloc_usable_size(args.rv); + + // This will be a bit wasteful but this is an unsized pointer + void *NewPtr = malloc(Usable); + memcpy(NewPtr, args.rv, Usable); + + FEX_malloc_free_on_host(args.rv); + args.rv = (char*)NewPtr; + } + + return args.rv; + } + + void drmMsg(const char *format,...) __attribute__((alias("fexfn_pack_drmMsg"))); + char * drmGetDeviceNameFromFd(int a_0) __attribute__((alias("fexfn_pack_drmGetDeviceNameFromFd"))); + char * drmGetDeviceNameFromFd2(int a_0) __attribute__((alias("fexfn_pack_drmGetDeviceNameFromFd2"))); + char * drmGetPrimaryDeviceNameFromFd(int a_0) __attribute__((alias("fexfn_pack_drmGetPrimaryDeviceNameFromFd"))); + char * drmGetRenderDeviceNameFromFd(int a_0) __attribute__((alias("fexfn_pack_drmGetRenderDeviceNameFromFd"))); + +} + +LOAD_LIB(libdrm) diff --git a/ThunkLibs/libdrm/Host.cpp b/ThunkLibs/libdrm/Host.cpp new file mode 100644 index 000000000..4e8fb4726 --- /dev/null +++ b/ThunkLibs/libdrm/Host.cpp @@ -0,0 +1,38 @@ +/* +$info$ +tags: thunklibs|drm +$end_info$ +*/ + +#include + +#include + +#include "common/Host.h" +#include +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + +void fexfn_unpack_libdrm_FEX_usable_size(void *argsv){ + struct arg_t {void* a_0;size_t rv;}; + auto args = (arg_t*)argsv; + args->rv = malloc_usable_size(args->a_0); +} + +void fexfn_unpack_libdrm_FEX_free_on_host(void *argsv){ + struct arg_t {void* a_0;}; + auto args = (arg_t*)argsv; + free(args->a_0); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +EXPORTS(libdrm) + From c0fc4c462327ddb07922d83fa0a78ed375af3c9f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:15:38 -0700 Subject: [PATCH 17/20] Thunks: Adds libvulkan This is specifically the device loader rather than the libvulkan loader library. This is meant to override what is provided in the ICD files, not the loader. There's no real need to replace the loader, it's quite complex --- ThunkLibs/Generators/libvulkan_device.py | 542 +++++++++++++++++++++++ ThunkLibs/libvulkan_device/Guest.cpp | 116 +++++ ThunkLibs/libvulkan_device/Host.cpp | 190 ++++++++ 3 files changed, 848 insertions(+) create mode 100644 ThunkLibs/Generators/libvulkan_device.py create mode 100644 ThunkLibs/libvulkan_device/Guest.cpp create mode 100644 ThunkLibs/libvulkan_device/Host.cpp diff --git a/ThunkLibs/Generators/libvulkan_device.py b/ThunkLibs/Generators/libvulkan_device.py new file mode 100644 index 000000000..40dada8fa --- /dev/null +++ b/ThunkLibs/Generators/libvulkan_device.py @@ -0,0 +1,542 @@ +#!/usr/bin/python3 +import xml.etree.ElementTree as ET +from dataclasses import dataclass, field +from ThunkHelpers import * +import sys + +# Skip functions that we need to hand generate +SkipGenFunctions = { + # We need to handle these manually + "vkGetDeviceProcAddr", + "vkGetInstanceProcAddr", + "vkCreateShaderModule", + "vkCreateInstance", + "vkCreateDevice", + "vkAllocateMemory", + "vkFreeMemory", + + # Causing thunk problems + "vkCmdSetFragmentShadingRateKHR", + "vkCmdSetFragmentShadingRateEnumNV", +} + +SkipExtensionFunctions = { + # Android things + "VK_ANDROID_external_memory_android_hardware_buffer", + "VK_ANDROID_native_buffer", + "VK_KHR_android_surface", + # MacOS/IOS things + "VK_EXT_metal_surface", + "VK_MVK_macos_surface", + "VK_MVK_ios_surface", + # Windows things + "VK_KHR_win32_surface", + "VK_KHR_external_memory_win32", + "VK_KHR_external_fence_win32", + "VK_KHR_external_semaphore_win32", + "VK_NV_external_memory_win32", + # Fuchsia things + "VK_FUCHSIA_external_memory", + "VK_FUCHSIA_external_semaphore", + "VK_FUCHSIA_imagepipe_surface", + "VK_FUCHSIA_buffer_collection", + # Various random OS + "VK_QNX_screen_surface", + "VK_GGP_stream_descriptor_surface", + "VK_GGP_frame_token", + "VK_NN_vi_surface", + # DirectFB support + "VK_EXT_directfb_surface", + # Requires vk_video + "VK_EXT_video_decode_h264", + "VK_EXT_video_encode_h264", + "VK_EXT_video_decode_h265", + "VK_EXT_video_encode_h265", +} + +@dataclass +class FunctionDef: + Ret : str + Name: str + Params: str + Extensions: dict + def __init__(self, Ret, Name, Params): + self.Ret = Ret + self.Name = Name + self.Params = Params + self.Extensions = {} + +@dataclass +class StructMember: + Type: str + Name: str + Str: str + def __init__(self, Type, Name, Str): + self.Type = Type + self.Name = Name + self.Str = Str + +@dataclass +class StructDef: + Type: str + Name: str + Emitted: bool + Members: list + Requires: list + def __init__(self, Type, Name): + self.Type = Type + self.Name = Name; + self.Emitted = False + self.Members = [] + self.Requires = [] + +@dataclass +class EnumDef: + Type: str + Name: str + Members: list + Aliases: list + def __init__(self, Type, Name): + self.Type = Type + self.Name = Name + self.Members = [] + self.Aliases = [] +@dataclass +class BaseTypeDef: + Type: str + Name: str + Str: str + Requires: list + Emitted: bool + def __init__(self, Type, Name, Str): + self.Type = Type + self.Name = Name + self.Str = Str + self.Requires = [] + self.Emitted = False + +BaseTypeDefs = {} +DefineDefs = [] +EnumDefs = {} +StructDefs = {} +FunctionDefs = {} + +# Some additional dependency tracking here +# Hard to get correct ordering otherwise +AdditionalStructDefines = { + 'VkDebugUtilsMessengerCreateInfoEXT': 'PFN_vkDebugUtilsMessengerCallbackEXT', + 'VkDeviceDeviceMemoryReportCreateInfoEXT': 'PFN_vkDeviceMemoryReportCallbackEXT', +} + +def LoadVulkanXML(Filename): + return ET.parse(Filename) + +# Walks the enums element in the XML and pulls them all out +def parse_enums(root): + for enum in root.findall('enums'): + if 'type' in enum.attrib: + Type = enum.attrib['type'] + Name = enum.attrib['name'] + if Type == 'enum': + # Actually an enum + Def = EnumDef(Type, Name) + for value in enum.findall('enum'): + if 'alias' in value.attrib: + Def.Members.append("{0} = {1},".format(value.attrib['name'], value.attrib['alias'])) + else: + Def.Members.append("{0} = {1},".format(value.attrib['name'], value.attrib['value'])) + EnumDefs[Name] = Def + elif Type == 'bitmask': + Def = EnumDef("enum", Name) + for value in enum.findall('enum'): + # XXX: Skip aliases for now + if 'alias' in value.attrib: + continue + + if 'bitpos' in value.attrib: + # enum is a bit position + Def.Members.append("\t{0} = (1ULL << {1}),".format(value.attrib['name'], value.attrib['bitpos'])) + elif 'value' in value.attrib: + # enum is a value + Def.Members.append("{0} = {1},".format(value.attrib['name'], value.attrib['value'])) + EnumDefs[Name] = Def + + else: + # Just some constants + for type in enum: + # XXX: Skip aliases for now + if 'alias' in type.attrib: + continue + + Type = type.attrib['type'] + Name = type.attrib['name'] + BaseType = "constexpr {0} {1} = {2};".format(Type, Name, type.attrib['value']) + Def = BaseTypeDef(Type, Name, BaseType) + BaseTypeDefs[Name] = Def + +def print_enums(): + for EnumName, Enum in EnumDefs.items(): + print("{0} {1} {{".format(Enum.Type, Enum.Name)) + for Member in Enum.Members: + print("\t{0}".format(Member)) + print("};") + + for Alias in Enum.Aliases: + print("typedef {0} {1};".format(Enum.Name, Alias)) + + print("\n") + +# Walks the types elemnet in the XML and pulls the types out that we care about +# This includes structs, unions, defines, 'basetypes', bitmasks, function pointers +# handles, and enums (aliases only) +def parse_types(root): + NumStructs = 0 + for types in root.findall('types'): + for type in types: + if 'category' in type.attrib: + if 'requires' in type.attrib: + # If what we require is in the skips then skip this + Require = type.attrib['requires'] + if (Require in SkipGenFunctions or + Require in SkipExtensionFunctions): + continue + + Category = type.attrib['category'] + if (Category == 'struct' or + Category == 'union'): + Name = type.attrib['name'] + Def = StructDef(Category, Name) + for member in type.findall('member'): + for comment in member.findall('comment'): + # Struct member has a comment inline + # Delete it + member.remove(comment) + Member = " ".join(member.itertext()) + Def.Members.append(StructMember("".join(member.find('type').itertext()), "".join(member.find('name').itertext()), Member)) + + # Add additional requirements + if Name in AdditionalStructDefines: + Def.Requires.append(AdditionalStructDefines[Name]) + + StructDefs[Name] = Def + NumStructs += 1 + + elif Category == 'define': + BaseType = "".join(type.itertext()) + DefineDefs.append(BaseType) + elif Category == 'basetype': + # Get the basetype name + Type = "basetype" # "".join(type.find('type').itertext()) + Name = "".join(type.find('name').itertext()) + BaseType = "".join(type.itertext()) + Def = BaseTypeDef(Type, Name, BaseType) + BaseTypeDefs[Name] = Def + elif Category == 'bitmask': + if 'alias' in type.attrib: + # + # typedef VkGeometryFlagsKHR VkGeometryFlagsNV; + Name = type.attrib['name'] + FullName = "typedef {0} {1};".format(type.attrib['alias'], Name) + Def = BaseTypeDef(type.attrib['alias'], type.attrib['name'], FullName) + BaseTypeDefs[Name] = Def + else: + # Get the bitmask name + Type = "".join(type.find('type').itertext()) + Name = "".join(type.find('name').itertext()) + BaseType = "".join(type.itertext()) + Def = BaseTypeDef(Type, Name, BaseType) + BaseTypeDefs[Name] = Def + elif Category == 'funcpointer': + Name = "".join(type.find('name').itertext()) + FullName = "".join(type.itertext()) + Def = BaseTypeDef("$funcpointer", Name, FullName) + if 'requires' in type.attrib: + Def.Requires.append(type.attrib['requires']) + BaseTypeDefs[Name] = Def + elif Category == 'handle': + if 'alias' in type.attrib: + Name = type.attrib['name'] + FullName = "typedef {0} {1};".format(type.attrib['alias'], Name) + Def = BaseTypeDef(type.attrib['alias'], Name, FullName) + BaseTypeDefs[Name] = Def + else: + Type = "".join(type.find('type').itertext()) + Name = "".join(type.find('name').itertext()) + BaseType = "".join(type.itertext()) + Def = BaseTypeDef(Type, Name, BaseType) + BaseTypeDefs[Name] = Def + elif Category == 'enum': + # Only handle aliases here + if 'alias' in type.attrib: + Def = EnumDefs[type.attrib['alias']] + Def.Aliases.append(type.attrib['name']) + +def print_base_type(BaseType): + if BaseType.Emitted: + return BaseType + + # Check to see if requirements are already emitted + for Require in BaseType.Requires: + if Require in StructDefs: + # Check if requirement relies on struct + # if it does and the struct isn't emitted yet then skip it + if not StructDefs[Require].Emitted: + return BaseType + + print(BaseType.Str) + BaseType.Emitted = True + return BaseType + +def print_remaining_base_types(): + for BaseTypeName, BaseType in BaseTypeDefs.items(): + BaseTypeDefs[BaseTypeName] = print_base_type(BaseType) + +def print_struct(StructName): + # If not a struct define type skip it + if not StructName in StructDefs: + return + + Struct = StructDefs[StructName] + # Skip if already emitted + if Struct.Emitted: + return + + # Check if our requirements are already emitted + for Require in Struct.Requires: + if Require in BaseTypeDefs: + if not BaseTypeDefs[Require].Emitted: + return + + Struct.Emitted = True + + # Walk children and emit if necessary + for member in Struct.Members: + print_struct(member.Type) + + Annotate = "" + Annotate = "__attribute__((annotate(\"fex-match\")))" + print("{0} {1} {2} {{".format(Struct.Type, Annotate, Struct.Name)) + for member in Struct.Members: + print("\t{0};".format(member.Str)) + print("};") + + # The requirements for base types might have changed + # print any new ones still remaining + print_remaining_base_types() + +def print_types(): + # Defines first + for Define in DefineDefs: + print(Define) + + # Base types second + print_remaining_base_types() + + # Structs third + for i in range(0, 2): + for StructName, Struct in StructDefs.items(): + # First walk the struct members and ensure any dependency is already emitted + # This ensures correct struct dependency output since the xml doesn't order correctly + for member in Struct.Members: + print_struct(member.Type) + + # Now print this struct + print_struct(Struct.Name) + +# Walks the commands element in the XML and pulls out all functions +# This will be used to generate the thunks that we need to hit +def parse_commands(root): + for command in root.findall('commands'): + for func in command: + func_string = "" + + # Skip the alias, will be handled afterwards + if ('alias' in func.attrib): + continue + + proto = func.find('proto') + ReturnType = proto.find('type').text + Name = proto.find('name').text + + # Skip any function marked as skippable by name + if (Name in SkipGenFunctions): + continue + + func_string += ReturnType + " " + Name + + FuncArgs = "" + params = func.findall('param') + for i in range(0, len(params)): + param = params[i] + # we need to strip out the argument name here + # Iter all the parameter's text and add it to a list + ParamDefs = [] + for Def in param.itertext(): + ParamDefs.append(Def) + Params = "" + + # Walk the list of parameter defs and drop the final element + # We don't want the variable name here + for j in range(0, len(ParamDefs)): + if (j + 1) != len(ParamDefs): + Params += ParamDefs[j] + + # If you just want everything with the argument definition + # Params = "".join(param.itertext()) + + # Now append the parameter list we generated + FuncArgs += Params + if (i + 1) != len(params): + FuncArgs += ", " + + FuncDef = FunctionDef(ReturnType, Name, FuncArgs); + FunctionDefs[Name] = FuncDef + +def parse_aliases(root): + for command in root.findall('commands'): + for func in command: + func_string = "" + + if not ('alias' in func.attrib): + continue + + AliasFunc = func.attrib['alias'] + FuncName = func.attrib['name'] + + if (FuncName in SkipGenFunctions): + continue + + if (AliasFunc in SkipGenFunctions): + continue + + if (AliasFunc in FunctionDefs): + OriginalAlias = FunctionDefs[AliasFunc] + + FuncAlias = FunctionDef(OriginalAlias.Ret, FuncName, OriginalAlias.Params) + FuncAlias.Extensions = OriginalAlias.Extensions + FunctionDefs[FuncName] = FuncAlias + else: + print("Couldn't find alias {0} for {1}".format(AliasFunc, FuncName)) + sys.exit(-1) + +def remove_commands(commands): + for command in commands: + CommandName = command.attrib['name'] + if CommandName in FunctionDefs: + del FunctionDefs[CommandName] + +def remove_types(types): + for type in types: + TypeName = type.attrib['name'] + if TypeName in StructDefs: + del StructDefs[TypeName] + +def remove_extensions(root): + for extensions in root.findall('extensions'): + for extension in extensions: + # First remove anything from the base extension + if extension.attrib['name'] in SkipExtensionFunctions: + remove_commands(extension.iter('command')) + remove_types(extension.iter('type')) + + # Now remove any sub requirements + for require in extension.findall('require'): + if 'extension' in require.attrib: + if require.attrib['extension'] in SkipExtensionFunctions: + remove_commands(require.iter('command')) + remove_types(require.iter('type')) + +def export_vulkan(): + for FuncName, FuncDef in FunctionDefs.items(): + fn("{0} {1}({2})".format(FuncDef.Ret, FuncDef.Name, FuncDef.Params)) + +def export_instance_vulkan(): + for FuncName, FuncDef in FunctionDefs.items(): + print("// T({0}),".format(FuncDef.Name)) + +def parse_vulkan(XML, PrintHeader): + xml = LoadVulkanXML(XML) + root = xml.getroot() + parse_enums(root) + parse_types(root) + parse_commands(root) + # Need to remove extensions before aliases since we don't track extension types through it + remove_extensions(root) + parse_aliases(root) + + if PrintHeader: + # Print some defines that are necessary + print("#include ") + print("#include ") + print("#include ") + print("#include ") + print("#include ") + print("#define VKAPI_ATTR") + print("#define VKAPI_CALL") + print("#define VKAPI_PTR") + print("#define FEX_ANNOTATE(annotation_str) __attribute__((annotate(annotation_str)))") + + print_enums() + print_types() + export_instance_vulkan() + +if len(sys.argv) < 2: + print("Usage: {0} libvulkan_{device} vk.xml [--print-header] [--print-thunks]".format(sys.argv[0])) + sys.exit(0) + +LibName = sys.argv[1] +VulkanXML = sys.argv[2] +PrintHeader = False +PrintThunks = False +NumToErase = 2 +for i in range(3, len(sys.argv)): + if sys.argv[i] == '--print-header': + PrintHeader = True + NumToErase += 1 + elif sys.argv[i] == '--print-thunks': + PrintThunks = True + NumToErase += 1 + +# Just to fall in line with what the other thunk handlers expect +for i in range(0, NumToErase): + sys.argv.pop(1) + +parse_vulkan(VulkanXML, PrintHeader) + +if PrintThunks: + lib(LibName) + + # Functions here + export_vulkan() + + fn("PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice,const char*)") + no_pack() + no_unpack() + + fn("PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance,const char*)") + no_pack() + no_unpack() + + fn("VkResult vkCreateShaderModule(VkDevice,const VkShaderModuleCreateInfo* ,const VkAllocationCallbacks* ,VkShaderModule* )") + no_unpack() + + fn("void vkCmdSetBlendConstants(VkCommandBuffer, const float*)") + no_pack() + no_unpack() + + fn("VkResult vkCreateInstance(const VkInstanceCreateInfo*,const VkAllocationCallbacks*,VkInstance*)") + no_unpack() + + fn("VkResult vkCreateDevice(VkPhysicalDevice,const VkDeviceCreateInfo*,const VkAllocationCallbacks*,VkDevice*)") + no_unpack() + + fn("VkResult vkAllocateMemory(VkDevice,const VkMemoryAllocateInfo*,const VkAllocationCallbacks*,VkDeviceMemory*)") + no_unpack() + + fn("void vkFreeMemory(VkDevice,VkDeviceMemory,const VkAllocationCallbacks*)") + no_unpack() + + fn("VkResult vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice,uint32_t,VkSurfaceKHR,VkBool32*)") + no_unpack() + + Generate() diff --git a/ThunkLibs/libvulkan_device/Guest.cpp b/ThunkLibs/libvulkan_device/Guest.cpp new file mode 100644 index 000000000..847d0b3e3 --- /dev/null +++ b/ThunkLibs/libvulkan_device/Guest.cpp @@ -0,0 +1,116 @@ +/* +$info$ +tags: thunklibs|vulkan +$end_info$ +*/ + +#include "Header.inl" + +#include +#include +#include +#include +#include +#include +#include + +#include "common/Guest.h" +#include + +#include "thunks.inl" +#include "function_packs.inl" +#include "function_packs_public.inl" + +extern "C" { +static bool Setup{}; +static std::unordered_map PtrsToLookUp{}; + +static PFN_vkVoidFunction fexfn_pack_vkGetDeviceProcAddr(VkDevice a_0,const char* a_1); +static PFN_vkVoidFunction fexfn_pack_vkGetInstanceProcAddr(VkInstance a_0,const char* a_1); +static void fexfn_pack_vkCmdSetBlendConstants(VkCommandBuffer a_0,const float a_1[4]); + +// Setup can't be done on shared library constructor +// Needs to be deferred until post-constructor phase to remove the chance of crashing +static void DoSetup() { + const std::vector> Map = {{ +#define PAIR(name, ptr) { #name, (PFN_vkVoidFunction*) ptr } +#include "function_pack_pair.inl" +#undef PAIR + }}; + for (auto &It : Map) { + PtrsToLookUp[It.first] = It.second; + } + Setup = true; +} +static PFN_vkVoidFunction fexfn_pack_vkGetDeviceProcAddr(VkDevice a_0,const char* a_1){ + if (!Setup) { + DoSetup(); + } + + struct {VkDevice a_0;const char* a_1;PFN_vkVoidFunction rv;} args; + args.a_0 = a_0;args.a_1 = a_1; + THUNKFUNC(vkGetDeviceProcAddr)(&args); + + if (args.rv == nullptr) { + // Early out if our instance doesn't have the pointer + // Definitely means we don't support it + return nullptr; + } + + // Okay, we found a host side function for this + // Now return our local instance of this function + auto It = PtrsToLookUp.find(a_1); + void *ptr{}; + if (It != PtrsToLookUp.end()) { + ptr = It->second; + } + if (ptr == nullptr) { + fprintf(stderr, "\tvkGetDeviceProcAddr: Couldn't find Guest symbol: '%s'\n", a_1); + __builtin_trap(); + } + return (PFN_vkVoidFunction)ptr; +} + +static PFN_vkVoidFunction fexfn_pack_vkGetInstanceProcAddr(VkInstance a_0,const char* a_1){ + if (!Setup) { + DoSetup(); + } + + // Search our host install first to see if the pointer exists + // This also populates a map on the host facing side + struct {VkInstance a_0;const char* a_1;PFN_vkVoidFunction rv;} args; + args.a_0 = a_0;args.a_1 = a_1; + THUNKFUNC(vkGetInstanceProcAddr)(&args); + if (args.rv == nullptr) { + // Early out if our instance doesn't have the pointer + // Definitely means we don't support it + return nullptr; + } + + void *ptr{}; + + auto It = PtrsToLookUp.find(a_1); + if (It != PtrsToLookUp.end()) { + ptr = (void*)(It->second); + } + if (ptr == nullptr) { + fprintf(stderr, "\tvkGetInstanceProcAddr: Couldn't find Guest symbol: '%s'\n", a_1); + __builtin_trap(); + } + return (PFN_vkVoidFunction)ptr; +} + +static void fexfn_pack_vkCmdSetBlendConstants(VkCommandBuffer a_0,const float a_1[4]){ + struct {VkCommandBuffer a_0; float a_1[4];} args; + args.a_0 = a_0; + memcpy(args.a_1, a_1, sizeof(float) * 4); + THUNKFUNC(vkCmdSetBlendConstants)(&args); +} + +PFN_vkVoidFunction vkGetDeviceProcAddr(VkDevice a_0,const char* a_1) __attribute__((alias("fexfn_pack_vkGetDeviceProcAddr"))); +PFN_vkVoidFunction vkGetInstanceProcAddr(VkInstance a_0,const char* a_1) __attribute__((alias("fexfn_pack_vkGetInstanceProcAddr"))); +void vkCmdSetBlendConstants(VkCommandBuffer a_0,const float a_1[4]) __attribute__((alias("fexfn_pack_vkCmdSetBlendConstants"))); +} + +#define DOLOAD(name) LOAD_LIB(name) +DOLOAD(LIBLIB_NAME) diff --git a/ThunkLibs/libvulkan_device/Host.cpp b/ThunkLibs/libvulkan_device/Host.cpp new file mode 100644 index 000000000..f89980ecc --- /dev/null +++ b/ThunkLibs/libvulkan_device/Host.cpp @@ -0,0 +1,190 @@ +/* +$info$ +tags: thunklibs|vulkan +$end_info$ +*/ + +#include "Header.inl" + +#include +#include +#include +#include +#include + +#include "common/Host.h" +#include + +#include "ldr_ptrs.inl" +#include "function_unpacks.inl" + +static bool SetupDev{}; +static bool SetupInstance{}; +std::mutex SetupMutex{}; + +static std::unordered_map PtrsToLookUp{}; + +const std::vector> Map = {{ + // Our local function +#define PAIR(name, ptr) { #name, (PFN_vkVoidFunction*) ptr } +#include "ldr_ptrs_pair.inl" +#undef PAIR +}}; + +static void DoSetupWithDevice(VkDevice dev) { + std::unique_lock lk {SetupMutex}; + for (auto &It : Map) { + auto Lookup = PtrsToLookUp.find(It.first); + if (Lookup != PtrsToLookUp.end() && *Lookup->second == nullptr) + { + auto Res = LDR_PTR(vkGetDeviceProcAddr)(dev,It.first); + if (Res) { + *PtrsToLookUp[It.first] = Res; + } + } + } + SetupDev = true; +} + +static void DoSetupWithInstance(VkInstance instance) { + std::unique_lock lk {SetupMutex}; + + for (auto &It : Map) { + auto Lookup = PtrsToLookUp.find(It.first); + //if (Lookup != PtrsToLookUp.end() && *Lookup->second == nullptr) + { + PFN_vkVoidFunction Res = LDR_PTR(vkGetInstanceProcAddr)(instance, It.first); + if (Res) { + *Lookup->second = Res; + } + } + } + + SetupInstance = true; +} + +static void UNPACKFUNC(vkGetDeviceProcAddr)(void *argsv){ + struct arg_t {VkDevice a_0;const char* a_1;PFN_vkVoidFunction rv;}; + auto args = (arg_t*)argsv; + + if (!SetupDev) { + DoSetupWithDevice(args->a_0); + } + + // Just return the host facing function pointer + // The guest will handle mapping if this exists + args->rv = + LDR_PTR(vkGetDeviceProcAddr) + (args->a_0,args->a_1); + + // Store the result if it exists + // This way when a guest calls across the boundary, it calls directly in to the host + if (args->rv) { + *PtrsToLookUp[args->a_1] = args->rv; + } +} + +static void UNPACKFUNC(vkGetInstanceProcAddr)(void *argsv){ + struct arg_t {VkInstance a_0;const char* a_1;PFN_vkVoidFunction rv;}; + auto args = (arg_t*)argsv; + + if (!SetupInstance) { + DoSetupWithInstance(args->a_0); + } + + // Just return the host facing function pointer + // The guest will handle mapping if it exists + args->rv = + LDR_PTR(vkGetInstanceProcAddr) + (args->a_0,args->a_1); + + // Store the result if it exists + // This way when a guest calls across the boundary, it calls directly in to the host + if (args->rv) { + *PtrsToLookUp[args->a_1] = args->rv; + } +} + +static void UNPACKFUNC(vkCreateShaderModule)(void *argsv){ + struct arg_t {VkDevice a_0;const VkShaderModuleCreateInfo* a_1;const VkAllocationCallbacks* a_2;VkShaderModule* a_3;VkResult rv;}; + auto args = (arg_t*)argsv; + args->rv = + LDR_PTR(vkCreateShaderModule) + (args->a_0,args->a_1, nullptr,args->a_3); + +} + +static void UNPACKFUNC(vkCmdSetBlendConstants)(void *argsv){ + struct arg_t {VkCommandBuffer a_0;const float a_1[4];}; + auto args = (arg_t*)argsv; + LDR_PTR(vkCmdSetBlendConstants) + (args->a_0,args->a_1); +} + +static void UNPACKFUNC(vkCreateInstance)(void *argsv){ + struct arg_t {const VkInstanceCreateInfo* a_0;const VkAllocationCallbacks* a_1;VkInstance* a_2;VkResult rv;}; + auto args = (arg_t*)argsv; + args->rv = + LDR_PTR(vkCreateInstance) + (args->a_0, nullptr,args->a_2); +} + +static void UNPACKFUNC(vkCreateDevice)(void *argsv){ + struct arg_t {VkPhysicalDevice a_0;const VkDeviceCreateInfo* a_1;const VkAllocationCallbacks* a_2;VkDevice* a_3;VkResult rv;}; + auto args = (arg_t*)argsv; + args->rv = + LDR_PTR(vkCreateDevice) + (args->a_0,args->a_1, nullptr,args->a_3); +} + +static void UNPACKFUNC(vkAllocateMemory)(void *argsv){ + struct arg_t {VkDevice a_0;const VkMemoryAllocateInfo* a_1;const VkAllocationCallbacks* a_2;VkDeviceMemory* a_3;VkResult rv;}; + auto args = (arg_t*)argsv; + args->rv = + LDR_PTR(vkAllocateMemory) + (args->a_0,args->a_1,nullptr,args->a_3); +} +static void UNPACKFUNC(vkFreeMemory)(void *argsv){ + struct arg_t {VkDevice a_0;VkDeviceMemory a_1;const VkAllocationCallbacks* a_2;}; + auto args = (arg_t*)argsv; + LDR_PTR(vkFreeMemory) + (args->a_0,args->a_1,nullptr); +} + +static void UNPACKFUNC(vkGetPhysicalDeviceSurfaceSupportKHR)(void *argsv){ + struct arg_t {VkPhysicalDevice a_0;uint32_t a_1;VkSurfaceKHR a_2;VkBool32* a_3;VkResult rv;}; + auto args = (arg_t*)argsv; + args->rv = LDR_PTR(vkGetPhysicalDeviceSurfaceSupportKHR) + (args->a_0,args->a_1,args->a_2,args->a_3); +} + +static ExportEntry exports[] = { + #include "tab_function_unpacks.inl" + { nullptr, nullptr } +}; + +#include "ldr.inl" + +static void DoSetup() { + for (auto &It : Map) { + PtrsToLookUp[It.first] = It.second; + } +} + +static void init_func() { + // Initialize some initial pointers that we can get while loading + (void*&)LDR_PTR(vkGetInstanceProcAddr) = dlsym(LDR_HANDLE, "vkGetInstanceProcAddr"); + if (LDR_PTR(vkGetInstanceProcAddr) == nullptr) { + (void*&)LDR_PTR(vkGetInstanceProcAddr) = dlsym(LDR_HANDLE, "vk_icdGetInstanceProcAddr"); + } + + (void*&)LDR_PTR(vkEnumerateInstanceVersion) = (void *) LDR_PTR(vkGetInstanceProcAddr)(nullptr, "vkEnumerateInstanceVersion"); + (void*&)LDR_PTR(vkEnumerateInstanceExtensionProperties) = (void *) LDR_PTR(vkGetInstanceProcAddr)(nullptr, "vkEnumerateInstanceExtensionProperties"); + (void*&)LDR_PTR(vkEnumerateInstanceLayerProperties) = (void*) LDR_PTR(vkGetInstanceProcAddr)(nullptr, "vkEnumerateInstanceLayerProperties"); + (void*&)LDR_PTR(vkCreateInstance) = (void*) LDR_PTR(vkGetInstanceProcAddr)(nullptr, "vkCreateInstance"); + + DoSetup(); +} + +#define DOEXPORT_INIT(name, init) EXPORTS_INIT(name, init) +DOEXPORT_INIT(LIBLIB_NAME, init_func) From 14b0cc5af4786b1632576a4c1d9642e3d349f397 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:17:26 -0700 Subject: [PATCH 18/20] Thunks: Wires up all the new thunks to the generators --- ThunkLibs/GuestLibs/CMakeLists.txt | 182 +++++++++++++++++++++++++++-- ThunkLibs/HostLibs/CMakeLists.txt | 111 ++++++++++++++++-- ThunkLibs/include/common/Guest.h | 4 + 3 files changed, 275 insertions(+), 22 deletions(-) diff --git a/ThunkLibs/GuestLibs/CMakeLists.txt b/ThunkLibs/GuestLibs/CMakeLists.txt index 4424b48e6..22a4629b5 100644 --- a/ThunkLibs/GuestLibs/CMakeLists.txt +++ b/ThunkLibs/GuestLibs/CMakeLists.txt @@ -11,9 +11,9 @@ set (DATA_DIRECTORY "${CMAKE_INSTALL_PREFIX}/share/fex-emu" CACHE PATH "global d set(CMAKE_C_COMPILER "${X86_C_COMPILER}") set(CMAKE_CXX_COMPILER "${X86_CXX_COMPILER}") -function(generate NAME) +function(generate_with_name NAME LIBNAME) foreach(WHAT IN LISTS ARGN) - set(OUTFOLDER "${CMAKE_CURRENT_BINARY_DIR}/gen/${NAME}") + set(OUTFOLDER "${CMAKE_CURRENT_BINARY_DIR}/gen/${LIBNAME}") set(OUTFILE "${OUTFOLDER}/${WHAT}.inl") set(GENERATOR "${CMAKE_CURRENT_SOURCE_DIR}/../Generators/${NAME}.py") set(HELPER "${CMAKE_CURRENT_SOURCE_DIR}/../Generators/ThunkHelpers.py") @@ -26,17 +26,33 @@ function(generate NAME) DEPENDS "${GENERATOR}" DEPENDS "${HELPER}" DEPENDS "${OUTFOLDER}" - COMMAND "python3" "${GENERATOR}" "${WHAT}" > "${OUTFILE}" + COMMAND "python3" "${GENERATOR}" ${WITH_ARGS} "${WHAT}" > "${OUTFILE}" ) list(APPEND OUTPUTS "${OUTFILE}") endforeach() - set(GEN_${NAME} ${OUTPUTS} PARENT_SCOPE) + if (DEFINED GEN_${LIBNAME}) + list(APPEND OUTPUTS "${GEN_${LIBNAME}}") + set(GEN_${LIBNAME} ${OUTPUTS} PARENT_SCOPE) + else() + set(GEN_${LIBNAME} ${OUTPUTS} PARENT_SCOPE) + endif() +endfunction() + +function(generate NAME) + generate_with_name(${NAME} ${NAME} ${ARGV}) + # Pass the details up the stack + if (DEFINED GEN_${NAME}) + list(APPEND OUTPUTS "${GEN_${NAME}}") + set(GEN_${NAME} ${OUTPUTS} PARENT_SCOPE) + else() + set(GEN_${NAME} ${OUTPUTS} PARENT_SCOPE) + endif() endfunction() add_custom_target(ThunkGuestsInstall) -function(add_guest_lib NAME) +function(add_guest_lib_with_name NAME LIBNAME) set (SOURCE_FILE ../lib${NAME}/lib${NAME}_Guest.cpp) get_filename_component(SOURCE_FILE_ABS "${SOURCE_FILE}" ABSOLUTE) if (NOT EXISTS "${SOURCE_FILE_ABS}") @@ -47,15 +63,35 @@ function(add_guest_lib NAME) endif() endif() - add_library(${NAME}-guest SHARED ${SOURCE_FILE} ${GEN_lib${NAME}}) - target_include_directories(${NAME}-guest PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/gen/lib${NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/../include") + add_library(${LIBNAME}-guest SHARED ${SOURCE_FILE} ${GEN_lib${LIBNAME}}) + target_include_directories(${LIBNAME}-guest PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/gen/lib${LIBNAME}" "${CMAKE_CURRENT_SOURCE_DIR}/../include") - add_custom_target(${NAME}-guest-install + ## Tell GCC to not complain about ignored attributes + target_compile_options(${LIBNAME}-guest PRIVATE -Wno-attributes) + target_compile_options(${LIBNAME}-guest PRIVATE -DLIB_NAME=${LIBNAME} -DLIBLIB_NAME=lib${LIBNAME}) + + # Make all of our libraries rely on our allocator guest library + # Skip linking to themselves though + if (NOT NAME STREQUAL "fex_malloc") + target_link_libraries(${LIBNAME}-guest PRIVATE fex_malloc-guest) + endif() + + add_custom_target(${LIBNAME}-guest-install COMMAND ${CMAKE_COMMAND} -E make_directory ${DATA_DIRECTORY}/GuestThunks/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lib${NAME}-guest.so ${DATA_DIRECTORY}/GuestThunks/) - add_dependencies(ThunkGuestsInstall ${NAME}-guest-install) + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lib${LIBNAME}-guest.so ${DATA_DIRECTORY}/GuestThunks/) + add_dependencies(ThunkGuestsInstall ${LIBNAME}-guest-install) endfunction() +function(add_guest_lib NAME) + add_guest_lib_with_name(${NAME} ${NAME} ${ARGV}) +endfunction() + +add_guest_lib(fex_malloc_loader) +target_link_libraries(fex_malloc_loader-guest PRIVATE dl) + +generate(libfex_malloc thunks function_packs function_packs_public) +add_guest_lib(fex_malloc) + generate(libasound thunks function_packs function_packs_public) add_guest_lib(asound) @@ -84,3 +120,129 @@ add_guest_lib(Xrender) generate(libXfixes thunks function_packs function_packs_public) add_guest_lib(Xfixes) + +set (VULKAN_LIBS + vulkan_radeon + vulkan_lvp + vulkan_freedreno + vulkan_intel + vulkan_panfrost + vulkan_virtio +) + +foreach (LIB IN LISTS VULKAN_LIBS) + set(WITH_ARGS "lib${LIB}" "${VULKAN_XML}" "--print-header") + generate_with_name(libvulkan_device lib${LIB} Header) + set(WITH_ARGS "") + + set(WITH_ARGS "lib${LIB}" "${VULKAN_XML}" "--print-thunks") + generate_with_name(libvulkan_device lib${LIB} thunks function_packs function_packs_public function_pack_pair) + add_guest_lib_with_name(vulkan_device ${LIB}) + set(WITH_ARGS "") +endforeach() + +# Struct verification on generated headers + +if (BUILD_TESTS) + include(CTest) + enable_testing() + message(STATUS "Unit tests are enabled") + + set(HEADERS_TO_VERIFY + "${CMAKE_CURRENT_BINARY_DIR}/gen/libvulkan_radeon/Header.inl" x86_64 # This needs to match structs to 64bit structs + ) + + list(LENGTH HEADERS_TO_VERIFY ARG_COUNT) + math(EXPR ARG_COUNT "${ARG_COUNT}-1") + message(STATUS "Number of tests: ${ARG_COUNT}") + + set (ARGS + "-x" "c++" + "-std=c++20" + "-fno-operator-names") +# Global include directories + get_directory_property (INC_DIRS INCLUDE_DIRECTORIES) + list(TRANSFORM INC_DIRS PREPEND "-I") + list(APPEND ARGS ${INC_DIRS}) + + list(APPEND ARGS "-I${CMAKE_CURRENT_BINARY_DIR}/gen/vulkan_radeon/") + + foreach(Index RANGE 0 ${ARG_COUNT} 2) + math(EXPR TEST_TYPE_INDEX "${Index}+1") + + list(GET HEADERS_TO_VERIFY ${Index} HEADER) + list(GET HEADERS_TO_VERIFY ${TEST_TYPE_INDEX} TEST_TYPE) + + file(RELATIVE_PATH REL_HEADER ${CMAKE_BINARY_DIR} "${HEADER}") + set(TEST_NAME "${TEST_DESC}/Guest_Test_verify_${HEADER}") + set(TEST_NAME_ARCH "${TEST_DESC}/Guest_Test_verify_arch_${HEADER}") + + add_test( + NAME ${TEST_NAME}_x86_64 + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMAND "python3" "${STRUCT_VERIFIER}" "-c1" "x86_64" "${REL_HEADER}" ${ARGS}) + + add_test( + NAME ${TEST_NAME}_aarch64 + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMAND "python3" "${STRUCT_VERIFIER}" "-c1" "aarch64" "${REL_HEADER}" ${ARGS}) + + add_test( + NAME ${TEST_NAME_ARCH}_x86_64 + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMAND "python3" "${STRUCT_VERIFIER}" "-c1" "x86_64" "-c2" "${TEST_TYPE}" "${REL_HEADER}" ${ARGS}) + + add_test( + NAME ${TEST_NAME_ARCH}_aarch64 + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + COMMAND "python3" "${STRUCT_VERIFIER}" "-c1" "aarch64" "-c2" "${TEST_TYPE}" "${REL_HEADER}" ${ARGS}) + + set_property(TEST ${TEST_NAME}_x86_64 APPEND PROPERTY DEPENDS "${HEADER}") + set_property(TEST ${TEST_NAME}_aarch64 APPEND PROPERTY DEPENDS "${HEADER}") + set_property(TEST ${TEST_NAME_ARCH}_x86_64 APPEND PROPERTY DEPENDS "${HEADER}") + set_property(TEST ${TEST_NAME_ARCH}_aarch64 APPEND PROPERTY DEPENDS "${HEADER}") + endforeach() + + execute_process(COMMAND "nproc" OUTPUT_VARIABLE CORES) + string(STRIP ${CORES} CORES) + + add_custom_target( + struct_verifier_guest + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + USES_TERMINAL + COMMAND "ctest" "--timeout" "302" "-j${CORES}" "-R" "Guest_Test_verify*") +endif() + +generate(libxcb thunks function_packs function_packs_public callback_structs callback_unpacks_header callback_unpacks_header_init callback_unpacks callback_typedefs) +add_guest_lib(xcb) + +generate(libxcb_dri2 thunks function_packs function_packs_public) +add_guest_lib(xcb_dri2) + +generate(libxcb_dri3 thunks function_packs function_packs_public) +add_guest_lib(xcb_dri3) + +generate(libxcb_xfixes thunks function_packs function_packs_public) +add_guest_lib(xcb_xfixes) + +generate(libxcb_shm thunks function_packs function_packs_public) +add_guest_lib(xcb_shm) + +generate(libxcb_sync thunks function_packs function_packs_public) +add_guest_lib(xcb_sync) + +generate(libxcb_present thunks function_packs function_packs_public) +add_guest_lib(xcb_present) + +generate(libxcb_randr thunks function_packs function_packs_public) +add_guest_lib(xcb_randr) + +generate(libxcb_glx thunks function_packs function_packs_public) +add_guest_lib(xcb_glx) + +generate(libxshmfence thunks function_packs function_packs_public) +add_guest_lib(xshmfence) + +generate(libdrm thunks function_packs function_packs_public) +add_guest_lib(drm) +target_include_directories(drm-guest PRIVATE /usr/include/drm/) diff --git a/ThunkLibs/HostLibs/CMakeLists.txt b/ThunkLibs/HostLibs/CMakeLists.txt index ee0f8e40f..987717919 100644 --- a/ThunkLibs/HostLibs/CMakeLists.txt +++ b/ThunkLibs/HostLibs/CMakeLists.txt @@ -4,9 +4,9 @@ project(host-thunks) set(CMAKE_CXX_STANDARD 17) set (DATA_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib/fex-emu" CACHE PATH "global data directory") -function(generate NAME) +function(generate_with_name NAME LIBNAME) foreach(WHAT IN LISTS ARGN) - set(OUTFOLDER "${CMAKE_CURRENT_BINARY_DIR}/gen/${NAME}") + set(OUTFOLDER "${CMAKE_CURRENT_BINARY_DIR}/gen/${LIBNAME}") set(OUTFILE "${OUTFOLDER}/${WHAT}.inl") set(GENERATOR "${CMAKE_CURRENT_SOURCE_DIR}/../Generators/${NAME}.py") set(HELPER "${CMAKE_CURRENT_SOURCE_DIR}/../Generators/ThunkHelpers.py") @@ -19,16 +19,31 @@ function(generate NAME) DEPENDS "${GENERATOR}" DEPENDS "${HELPER}" DEPENDS "${OUTFOLDER}" - COMMAND "python3" "${GENERATOR}" "${WHAT}" > "${OUTFILE}" + COMMAND "python3" "${GENERATOR}" ${WITH_ARGS} "${WHAT}" > "${OUTFILE}" ) list(APPEND OUTPUTS "${OUTFILE}") endforeach() - set(GEN_${NAME} ${OUTPUTS} PARENT_SCOPE) + if (DEFINED GEN_${LIBNAME}) + list(APPEND OUTPUTS "${GEN_${LIBNAME}}") + set(GEN_${LIBNAME} ${OUTPUTS} PARENT_SCOPE) + else() + set(GEN_${LIBNAME} ${OUTPUTS} PARENT_SCOPE) + endif() endfunction() -add_custom_target(ThunkHostsInstall) -function(add_host_lib NAME) +function(generate NAME) + generate_with_name(${NAME} ${NAME} ${ARGV}) + # Pass the details up the stack + if (DEFINED GEN_${NAME}) + list(APPEND OUTPUTS "${GEN_${NAME}}") + set(GEN_${NAME} ${OUTPUTS} PARENT_SCOPE) + else() + set(GEN_${NAME} ${OUTPUTS} PARENT_SCOPE) + endif() +endfunction() + +function(add_host_lib_with_name NAME LIBNAME) set (SOURCE_FILE ../lib${NAME}/lib${NAME}_Host.cpp) get_filename_component(SOURCE_FILE_ABS "${SOURCE_FILE}" ABSOLUTE) if (NOT EXISTS "${SOURCE_FILE_ABS}") @@ -39,16 +54,34 @@ function(add_host_lib NAME) endif() endif() - add_library(${NAME}-host SHARED ${SOURCE_FILE} ${GEN_lib${NAME}}) - target_include_directories(${NAME}-host PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/gen/lib${NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/../include") - target_link_libraries(${NAME}-host PRIVATE dl) + add_library(${LIBNAME}-host SHARED ${SOURCE_FILE} ${GEN_lib${LIBNAME}}) + target_include_directories(${LIBNAME}-host PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/gen/lib${LIBNAME}" "${CMAKE_CURRENT_SOURCE_DIR}/../include") + target_link_libraries(${LIBNAME}-host PRIVATE dl) + target_compile_options(${LIBNAME}-host PRIVATE -DLIB_NAME=${LIBNAME} -DLIBLIB_NAME=lib${LIBNAME}) - add_custom_target(${NAME}-host-install + # Make all of the libraries rely on the host allocator library + # Skip linking to themselves though + if (NOT (NAME STREQUAL "fex_malloc" OR NAME STREQUAL "fex_malloc_symbols")) + target_link_libraries(${LIBNAME}-host PRIVATE fex_malloc-host) + endif() + + add_custom_target(${LIBNAME}-host-install COMMAND ${CMAKE_COMMAND} -E make_directory ${DATA_DIRECTORY}/HostThunks/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lib${NAME}-host.so ${DATA_DIRECTORY}/HostThunks/) - add_dependencies(ThunkHostsInstall ${NAME}-host-install) + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lib${LIBNAME}-host.so ${DATA_DIRECTORY}/HostThunks/) + add_dependencies(ThunkHostsInstall ${LIBNAME}-host-install) endfunction() +add_custom_target(ThunkHostsInstall) + +function(add_host_lib NAME) + add_host_lib_with_name(${NAME} ${NAME} ${ARGV}) +endfunction() + +add_host_lib(fex_malloc_symbols) + +generate(libfex_malloc function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(fex_malloc) + generate(libasound function_unpacks tab_function_unpacks ldr ldr_ptrs) add_host_lib(asound) @@ -78,3 +111,57 @@ add_host_lib(Xrender) generate(libXfixes function_unpacks tab_function_unpacks ldr ldr_ptrs) add_host_lib(Xfixes) + +set (VULKAN_LIBS + vulkan_radeon + vulkan_lvp + vulkan_freedreno + vulkan_intel + vulkan_panfrost + vulkan_virtio +) + +foreach (LIB IN LISTS VULKAN_LIBS) + set(WITH_ARGS "lib${LIB}" "${VULKAN_XML}" "--print-header") + generate_with_name(libvulkan_device lib${LIB} Header) + set(WITH_ARGS "") + + set(WITH_ARGS "lib${LIB}" "${VULKAN_XML}" "--print-thunks") + generate_with_name(libvulkan_device lib${LIB} function_unpacks tab_function_unpacks ldr ldr_ptrs ldr_ptrs_pair) + add_host_lib_with_name(vulkan_device ${LIB}) + set(WITH_ARGS "") +endforeach() + +generate(libxcb function_unpacks tab_function_unpacks ldr ldr_ptrs callback_packs callback_structs callback_unpacks_header callback_typedefs) +add_host_lib(xcb) + +generate(libxcb_dri2 function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xcb_dri2) + +generate(libxcb_dri3 function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xcb_dri3) + +generate(libxcb_xfixes function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xcb_xfixes) + +generate(libxcb_shm function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xcb_shm) + +generate(libxcb_sync function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xcb_sync) + +generate(libxcb_present function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xcb_present) + +generate(libxcb_randr function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xcb_randr) + +generate(libxcb_glx function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xcb_glx) + +generate(libxshmfence function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(xshmfence) + +generate(libdrm function_unpacks tab_function_unpacks ldr ldr_ptrs) +add_host_lib(drm) +target_include_directories(drm-host PRIVATE /usr/include/drm/) diff --git a/ThunkLibs/include/common/Guest.h b/ThunkLibs/include/common/Guest.h index be0f3cfe6..9f079a43d 100644 --- a/ThunkLibs/include/common/Guest.h +++ b/ThunkLibs/include/common/Guest.h @@ -8,6 +8,10 @@ struct LoadlibArgs { uintptr_t CallbackThunks; }; +extern "C" { + extern void fex_malloc_NoOptimize(); +} + #define LOAD_LIB(name) \ MAKE_THUNK(fex, loadlib, "0x27, 0x7e, 0xb7, 0x69, 0x5b, 0xe9, 0xab, 0x12, 0x6e, 0xf7, 0x85, 0x9d, 0x4b, 0xc9, 0xa2, 0x44, 0x46, 0xcf, 0xbd, 0xb5, 0x87, 0x43, 0xef, 0x28, 0xa2, 0x65, 0xba, 0xfc, 0x89, 0x0f, 0x77, 0x80") \ __attribute__((constructor)) static void loadlib() \ From cb21f52f93bb20a7c1fe4a4f0c63d8d0cadbb377 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Oct 2021 18:18:12 -0700 Subject: [PATCH 19/20] Thunks: Have the ThunkHandler load the FEX malloc symbol libraries If the thunk configuration is enabled then preemptively load the libraries. Since they will need to be loaded for any thunking library. This is because we need to ALWAYS share the allocators to the thunks. --- .../Source/Interface/Context/Context.h | 1 + .../FEXCore/Source/Interface/Core/Core.cpp | 2 +- .../Source/Interface/HLE/Thunks/Thunks.cpp | 71 ++++++++++++++++--- .../Source/Interface/HLE/Thunks/Thunks.h | 6 +- 4 files changed, 69 insertions(+), 11 deletions(-) diff --git a/External/FEXCore/Source/Interface/Context/Context.h b/External/FEXCore/Source/Interface/Context/Context.h index 3959355bc..faf25b441 100644 --- a/External/FEXCore/Source/Interface/Context/Context.h +++ b/External/FEXCore/Source/Interface/Context/Context.h @@ -124,6 +124,7 @@ namespace FEXCore::Context { FEX_CONFIG_OPT(MaxInstPerBlock, MAXINST); FEX_CONFIG_OPT(RootFSPath, ROOTFS); FEX_CONFIG_OPT(ThunkHostLibsPath, THUNKHOSTLIBS); + FEX_CONFIG_OPT(ThunkConfigFile, THUNKCONFIG); FEX_CONFIG_OPT(DumpIR, DUMPIR); FEX_CONFIG_OPT(StaticRegisterAllocation, SRA); } Config; diff --git a/External/FEXCore/Source/Interface/Core/Core.cpp b/External/FEXCore/Source/Interface/Core/Core.cpp index 266954c1f..80cc2613a 100644 --- a/External/FEXCore/Source/Interface/Core/Core.cpp +++ b/External/FEXCore/Source/Interface/Core/Core.cpp @@ -245,7 +245,7 @@ namespace FEXCore::Context { } FEXCore::Core::InternalThreadState* Context::InitCore(FEXCore::CodeLoader *Loader) { - ThunkHandler.reset(FEXCore::ThunkHandler::Create()); + ThunkHandler.reset(FEXCore::ThunkHandler::Create(this)); LocalLoader = Loader; using namespace FEXCore::Core; diff --git a/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp b/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp index d99e4e25e..e16175d10 100644 --- a/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp +++ b/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp @@ -16,6 +16,7 @@ $end_info$ #include #include "FEXCore/Core/X86Enums.h" +#include #include #include #include @@ -32,7 +33,6 @@ static thread_local FEXCore::Core::InternalThreadState *Thread; namespace FEXCore { - struct ExportEntry { uint8_t *sha256; ThunkedFunction* Fn; }; class ThunkHandler_impl final: public ThunkHandler { @@ -50,18 +50,17 @@ namespace FEXCore { Set arg0/1 to arg regs, use CTX::HandleCallback to handle the callback */ static void CallCallback(void *callback, void *arg0, void* arg1) { - Thread->CurrentFrame->State.gregs[FEXCore::X86State::REG_RDI] = (uintptr_t)arg0; - Thread->CurrentFrame->State.gregs[FEXCore::X86State::REG_RSI] = (uintptr_t)arg1; + Thread->CurrentFrame->State.gregs[FEXCore::X86State::REG_RDI] = (uintptr_t)arg0; + Thread->CurrentFrame->State.gregs[FEXCore::X86State::REG_RSI] = (uintptr_t)arg1; - Thread->CTX->HandleCallback(Thread, (uintptr_t)callback); + Thread->CTX->HandleCallback(Thread, (uintptr_t)callback); } static void LoadLib(void *ArgsV) { + auto CTX = Thread->CTX; auto Args = reinterpret_cast(ArgsV); - auto CTX = Thread->CTX; - auto Name = Args->Name; auto CallbackThunks = Args->CallbackThunks; @@ -103,6 +102,9 @@ namespace FEXCore { } } + // Allocator symbols to make thunks work with JEMalloc + void *FEX_Malloc_Symbols{}; + void *FEX_Malloc{}; public: ThunkedFunction* LookupThunk(const IR::SHA256Sum &sha256) { @@ -122,12 +124,63 @@ namespace FEXCore { ::Thread = Thread; } - ThunkHandler_impl() { + ThunkHandler_impl(FEXCore::Context::Context *ctx) { + // If we are provided a thunks configuration file + // Then preemptively load our memory allocations libraries + if (!ctx->Config.ThunkConfigFile().empty()) { + // Set the static context so callbacks from a host thread can actually execute emulated code + auto SOName = ctx->Config.ThunkHostLibsPath() + "/libfex_malloc_symbols-host.so"; + FEX_Malloc_Symbols = dlopen(SOName.c_str(), RTLD_GLOBAL | RTLD_NOW); + + if (!FEX_Malloc_Symbols) { + LogMan::Msg::E("Load lib: failed to dlopen %s: %s", SOName.c_str(), dlerror()); + return; + } + +#define GET_SET(name, ptr) \ + do { \ + void **sym = (void**)dlsym(FEX_Malloc_Symbols, #name); \ + if (!sym) { \ + LogMan::Msg::E("Load lib: Failed to dlsym '" #name "'\n"); \ + return; \ + } \ + *sym = (void*)ptr; \ + } while(0) + GET_SET(FEX_Malloc_Ptr, ::malloc); + GET_SET(FEX_Free_Ptr, ::free); + GET_SET(FEX_Calloc_Ptr, ::calloc); + GET_SET(FEX_Memalign_Ptr, ::memalign); + GET_SET(FEX_Realloc_Ptr, ::realloc); + GET_SET(FEX_Valloc_Ptr, ::valloc); + GET_SET(FEX_PosixMemalign_Ptr, ::posix_memalign); + GET_SET(FEX_AlignedAlloc_Ptr, ::aligned_alloc); + GET_SET(FEX_MallocUsable_Ptr, ::malloc_usable_size); +#undef GET_SET + + SOName = ctx->Config.ThunkHostLibsPath() + "/libfex_malloc-host.so"; + + FEX_Malloc = dlopen(SOName.c_str(), RTLD_GLOBAL | RTLD_NOW); + + if (!FEX_Malloc) { + LogMan::Msg::E("Load lib: failed to dlopen %s: %s", SOName.c_str(), dlerror()); + __builtin_trap(); + return; + } + } + } + + ~ThunkHandler_impl() { + if (FEX_Malloc) { + dlclose(FEX_Malloc); + } + if (FEX_Malloc_Symbols) { + dlclose(FEX_Malloc_Symbols); + } } }; - ThunkHandler* ThunkHandler::Create() { - return new ThunkHandler_impl(); + ThunkHandler* ThunkHandler::Create(FEXCore::Context::Context *ctx) { + return new ThunkHandler_impl(ctx); } } diff --git a/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.h b/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.h index 2a7e1f848..7161a5b79 100644 --- a/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.h +++ b/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.h @@ -6,6 +6,10 @@ $end_info$ #pragma once +namespace FEXCore::Context { + struct Context; +} + namespace FEXCore::Core { struct InternalThreadState; } @@ -23,6 +27,6 @@ namespace FEXCore { virtual void RegisterTLSState(FEXCore::Core::InternalThreadState *Thread) = 0; virtual ~ThunkHandler() { } - static ThunkHandler* Create(); + static ThunkHandler* Create(FEXCore::Context::Context *ctx); }; }; From 0d0ce38050a0b478d822ed208e4ee6c6f08b9f33 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 6 Oct 2021 11:53:48 -0700 Subject: [PATCH 20/20] Thunks: Disable malloc libraries Keeping this in the commit history to go back to later. While these are required for static-pie builds to work, with the glibc bug we can't use those yet. Disable for now since it is is unnecessary. --- .../FEXCore/Source/Interface/Core/Core.cpp | 2 +- .../Source/Interface/HLE/Thunks/Thunks.cpp | 58 +------------------ .../Source/Interface/HLE/Thunks/Thunks.h | 2 +- ThunkLibs/GuestLibs/CMakeLists.txt | 14 ++--- ThunkLibs/HostLibs/CMakeLists.txt | 12 +--- ThunkLibs/include/common/Guest.h | 8 --- 6 files changed, 12 insertions(+), 84 deletions(-) diff --git a/External/FEXCore/Source/Interface/Core/Core.cpp b/External/FEXCore/Source/Interface/Core/Core.cpp index 80cc2613a..266954c1f 100644 --- a/External/FEXCore/Source/Interface/Core/Core.cpp +++ b/External/FEXCore/Source/Interface/Core/Core.cpp @@ -245,7 +245,7 @@ namespace FEXCore::Context { } FEXCore::Core::InternalThreadState* Context::InitCore(FEXCore::CodeLoader *Loader) { - ThunkHandler.reset(FEXCore::ThunkHandler::Create(this)); + ThunkHandler.reset(FEXCore::ThunkHandler::Create()); LocalLoader = Loader; using namespace FEXCore::Core; diff --git a/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp b/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp index e16175d10..6c37d719d 100644 --- a/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp +++ b/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp @@ -102,9 +102,6 @@ namespace FEXCore { } } - // Allocator symbols to make thunks work with JEMalloc - void *FEX_Malloc_Symbols{}; - void *FEX_Malloc{}; public: ThunkedFunction* LookupThunk(const IR::SHA256Sum &sha256) { @@ -124,63 +121,14 @@ namespace FEXCore { ::Thread = Thread; } - ThunkHandler_impl(FEXCore::Context::Context *ctx) { - // If we are provided a thunks configuration file - // Then preemptively load our memory allocations libraries - if (!ctx->Config.ThunkConfigFile().empty()) { - // Set the static context so callbacks from a host thread can actually execute emulated code - auto SOName = ctx->Config.ThunkHostLibsPath() + "/libfex_malloc_symbols-host.so"; - - FEX_Malloc_Symbols = dlopen(SOName.c_str(), RTLD_GLOBAL | RTLD_NOW); - - if (!FEX_Malloc_Symbols) { - LogMan::Msg::E("Load lib: failed to dlopen %s: %s", SOName.c_str(), dlerror()); - return; - } - -#define GET_SET(name, ptr) \ - do { \ - void **sym = (void**)dlsym(FEX_Malloc_Symbols, #name); \ - if (!sym) { \ - LogMan::Msg::E("Load lib: Failed to dlsym '" #name "'\n"); \ - return; \ - } \ - *sym = (void*)ptr; \ - } while(0) - GET_SET(FEX_Malloc_Ptr, ::malloc); - GET_SET(FEX_Free_Ptr, ::free); - GET_SET(FEX_Calloc_Ptr, ::calloc); - GET_SET(FEX_Memalign_Ptr, ::memalign); - GET_SET(FEX_Realloc_Ptr, ::realloc); - GET_SET(FEX_Valloc_Ptr, ::valloc); - GET_SET(FEX_PosixMemalign_Ptr, ::posix_memalign); - GET_SET(FEX_AlignedAlloc_Ptr, ::aligned_alloc); - GET_SET(FEX_MallocUsable_Ptr, ::malloc_usable_size); -#undef GET_SET - - SOName = ctx->Config.ThunkHostLibsPath() + "/libfex_malloc-host.so"; - - FEX_Malloc = dlopen(SOName.c_str(), RTLD_GLOBAL | RTLD_NOW); - - if (!FEX_Malloc) { - LogMan::Msg::E("Load lib: failed to dlopen %s: %s", SOName.c_str(), dlerror()); - __builtin_trap(); - return; - } - } + ThunkHandler_impl() { } ~ThunkHandler_impl() { - if (FEX_Malloc) { - dlclose(FEX_Malloc); - } - if (FEX_Malloc_Symbols) { - dlclose(FEX_Malloc_Symbols); - } } }; - ThunkHandler* ThunkHandler::Create(FEXCore::Context::Context *ctx) { - return new ThunkHandler_impl(ctx); + ThunkHandler* ThunkHandler::Create() { + return new ThunkHandler_impl(); } } diff --git a/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.h b/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.h index 7161a5b79..f40ede12f 100644 --- a/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.h +++ b/External/FEXCore/Source/Interface/HLE/Thunks/Thunks.h @@ -27,6 +27,6 @@ namespace FEXCore { virtual void RegisterTLSState(FEXCore::Core::InternalThreadState *Thread) = 0; virtual ~ThunkHandler() { } - static ThunkHandler* Create(FEXCore::Context::Context *ctx); + static ThunkHandler* Create(); }; }; diff --git a/ThunkLibs/GuestLibs/CMakeLists.txt b/ThunkLibs/GuestLibs/CMakeLists.txt index 22a4629b5..88fdfa874 100644 --- a/ThunkLibs/GuestLibs/CMakeLists.txt +++ b/ThunkLibs/GuestLibs/CMakeLists.txt @@ -70,12 +70,6 @@ function(add_guest_lib_with_name NAME LIBNAME) target_compile_options(${LIBNAME}-guest PRIVATE -Wno-attributes) target_compile_options(${LIBNAME}-guest PRIVATE -DLIB_NAME=${LIBNAME} -DLIBLIB_NAME=lib${LIBNAME}) - # Make all of our libraries rely on our allocator guest library - # Skip linking to themselves though - if (NOT NAME STREQUAL "fex_malloc") - target_link_libraries(${LIBNAME}-guest PRIVATE fex_malloc-guest) - endif() - add_custom_target(${LIBNAME}-guest-install COMMAND ${CMAKE_COMMAND} -E make_directory ${DATA_DIRECTORY}/GuestThunks/ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lib${LIBNAME}-guest.so ${DATA_DIRECTORY}/GuestThunks/) @@ -86,11 +80,11 @@ function(add_guest_lib NAME) add_guest_lib_with_name(${NAME} ${NAME} ${ARGV}) endfunction() -add_guest_lib(fex_malloc_loader) -target_link_libraries(fex_malloc_loader-guest PRIVATE dl) +#add_guest_lib(fex_malloc_loader) +#target_link_libraries(fex_malloc_loader-guest PRIVATE dl) -generate(libfex_malloc thunks function_packs function_packs_public) -add_guest_lib(fex_malloc) +#generate(libfex_malloc thunks function_packs function_packs_public) +#add_guest_lib(fex_malloc) generate(libasound thunks function_packs function_packs_public) add_guest_lib(asound) diff --git a/ThunkLibs/HostLibs/CMakeLists.txt b/ThunkLibs/HostLibs/CMakeLists.txt index 987717919..5f92797b3 100644 --- a/ThunkLibs/HostLibs/CMakeLists.txt +++ b/ThunkLibs/HostLibs/CMakeLists.txt @@ -59,12 +59,6 @@ function(add_host_lib_with_name NAME LIBNAME) target_link_libraries(${LIBNAME}-host PRIVATE dl) target_compile_options(${LIBNAME}-host PRIVATE -DLIB_NAME=${LIBNAME} -DLIBLIB_NAME=lib${LIBNAME}) - # Make all of the libraries rely on the host allocator library - # Skip linking to themselves though - if (NOT (NAME STREQUAL "fex_malloc" OR NAME STREQUAL "fex_malloc_symbols")) - target_link_libraries(${LIBNAME}-host PRIVATE fex_malloc-host) - endif() - add_custom_target(${LIBNAME}-host-install COMMAND ${CMAKE_COMMAND} -E make_directory ${DATA_DIRECTORY}/HostThunks/ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_BINARY_DIR}/lib${LIBNAME}-host.so ${DATA_DIRECTORY}/HostThunks/) @@ -77,10 +71,10 @@ function(add_host_lib NAME) add_host_lib_with_name(${NAME} ${NAME} ${ARGV}) endfunction() -add_host_lib(fex_malloc_symbols) +#add_host_lib(fex_malloc_symbols) -generate(libfex_malloc function_unpacks tab_function_unpacks ldr ldr_ptrs) -add_host_lib(fex_malloc) +#generate(libfex_malloc function_unpacks tab_function_unpacks ldr ldr_ptrs) +#add_host_lib(fex_malloc) generate(libasound function_unpacks tab_function_unpacks ldr ldr_ptrs) add_host_lib(asound) diff --git a/ThunkLibs/include/common/Guest.h b/ThunkLibs/include/common/Guest.h index 9f079a43d..551128559 100644 --- a/ThunkLibs/include/common/Guest.h +++ b/ThunkLibs/include/common/Guest.h @@ -8,17 +8,12 @@ struct LoadlibArgs { uintptr_t CallbackThunks; }; -extern "C" { - extern void fex_malloc_NoOptimize(); -} - #define LOAD_LIB(name) \ MAKE_THUNK(fex, loadlib, "0x27, 0x7e, 0xb7, 0x69, 0x5b, 0xe9, 0xab, 0x12, 0x6e, 0xf7, 0x85, 0x9d, 0x4b, 0xc9, 0xa2, 0x44, 0x46, 0xcf, 0xbd, 0xb5, 0x87, 0x43, 0xef, 0x28, 0xa2, 0x65, 0xba, 0xfc, 0x89, 0x0f, 0x77, 0x80") \ __attribute__((constructor)) static void loadlib() \ { \ LoadlibArgs args = { #name, 0 }; \ fexthunks_fex_loadlib(&args); \ - fex_malloc_NoOptimize(); \ } #define LOAD_LIB_INIT(name, init_fn) \ MAKE_THUNK(fex, loadlib, "0x27, 0x7e, 0xb7, 0x69, 0x5b, 0xe9, 0xab, 0x12, 0x6e, 0xf7, 0x85, 0x9d, 0x4b, 0xc9, 0xa2, 0x44, 0x46, 0xcf, 0xbd, 0xb5, 0x87, 0x43, 0xef, 0x28, 0xa2, 0x65, 0xba, 0xfc, 0x89, 0x0f, 0x77, 0x80") \ @@ -27,7 +22,6 @@ extern "C" { LoadlibArgs args = { #name, 0 }; \ fexthunks_fex_loadlib(&args); \ init_fn (); \ - fex_malloc_NoOptimize(); \ } #define LOAD_LIB_WITH_CALLBACKS(name) \ @@ -36,7 +30,6 @@ extern "C" { { \ LoadlibArgs args = { #name, (uintptr_t)&callback_unpacks }; \ fexthunks_fex_loadlib(&args); \ - fex_malloc_NoOptimize(); \ } #define LOAD_LIB_WITH_CALLBACKS_INIT(name, init_fn) \ @@ -46,5 +39,4 @@ extern "C" { LoadlibArgs args = { #name, (uintptr_t)&callback_unpacks }; \ fexthunks_fex_loadlib(&args); \ init_fn (); \ - fex_malloc_NoOptimize(); \ }