diff --git a/modules/nixos/hardware/graphics/vk/hasvk14_layer.c b/modules/nixos/hardware/graphics/vk/hasvk14_layer.c index 847394e..dd8e2ab 100644 --- a/modules/nixos/hardware/graphics/vk/hasvk14_layer.c +++ b/modules/nixos/hardware/graphics/vk/hasvk14_layer.c @@ -41,22 +41,16 @@ HaVK14_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, link = (VkLayerInstanceCreateInfo *)link->pNext; if (!link) return VK_ERROR_INITIALIZATION_FAILED; - g_next_gipa = link->u.pLayerInfo->pfnNextGetInstanceProcAddr; link->u.pLayerInfo = link->u.pLayerInfo->pNext; - PFN_vkCreateInstance next_ci = (PFN_vkCreateInstance)g_next_gipa(NULL, "vkCreateInstance"); - VkResult res = next_ci(pCreateInfo, pAllocator, pInstance); if (res != VK_SUCCESS) return res; - g_next_gdp = (PFN_vkGetPhysicalDeviceProperties) g_next_gipa(*pInstance, "vkGetPhysicalDeviceProperties"); - g_next_gdp2 = (PFN_vkGetPhysicalDeviceProperties2) g_next_gipa(*pInstance, "vkGetPhysicalDeviceProperties2"); - if (!g_next_gdp2) { g_next_gdp2 = (PFN_vkGetPhysicalDeviceProperties2) g_next_gipa(*pInstance, "vkGetPhysicalDeviceProperties2KHR"); @@ -70,12 +64,8 @@ HaVK14_GetPhysicalDeviceProperties(VkPhysicalDevice device, VkPhysicalDeviceProperties *props) { if (g_next_gdp) g_next_gdp(device, props); - if (props && is_intel_below_14(props->vendorID, props->apiVersion)) { props->apiVersion = HASVK14_API_VERSION; - - strncpy(props->deviceName, "Intel(R) HD Graphics 9000 (IVB GT2)", VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 1); - props->deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 1] = '\0'; } } @@ -84,17 +74,11 @@ HaVK14_GetPhysicalDeviceProperties2(VkPhysicalDevice device, VkPhysicalDeviceProperties2 *props2) { if (g_next_gdp2) g_next_gdp2(device, props2); - if (!props2) return; - VkPhysicalDeviceProperties *props = &props2->properties; if (!is_intel_below_14(props->vendorID, props->apiVersion)) return; props->apiVersion = HASVK14_API_VERSION; - - strncpy(props->deviceName, "Intel(R) HD Graphics 9000 (IVB GT2)", VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 1); - props->deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 1] = '\0'; - VkBaseOutStructure *s = (VkBaseOutStructure *)props2->pNext; while (s) { if (s->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES) { @@ -114,6 +98,7 @@ HaVK14_GetPhysicalDeviceProperties2(VkPhysicalDevice device, VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL HaVK14_GetInstanceProcAddr(VkInstance instance, const char *pName) { + #define INTERCEPT(fn) \ if (strcmp(pName, "vk" #fn) == 0) return (PFN_vkVoidFunction)HaVK14_##fn; diff --git a/patches/hd4000-hasvk13.patch b/patches/hd4000-hasvk13.patch deleted file mode 100644 index acdfb3e..0000000 --- a/patches/hd4000-hasvk13.patch +++ /dev/null @@ -1,150 +0,0 @@ -diff --git a/src/intel/vulkan_hasvk/anv_device.c b/src/intel/vulkan_hasvk/anv_device.c -index 9000e9b..b91a1d9 100644 ---- a/src/intel/vulkan_hasvk/anv_device.c -+++ b/src/intel/vulkan_hasvk/anv_device.c -@@ -767,7 +767,11 @@ get_properties_1_2(const struct anv_physical_device *pdevice, - else { - p->conformanceVersion = (VkConformanceVersion) { - .major = 1, -- .minor = pdevice->use_softpin ? 3 : 2, -+#ifdef HASVK_FORCE_VK_1_3 -+ .minor = 3, -+#else -+ .minor = pdevice->use_softpin ? 3 : 2, -+#endif - .subminor = 0, - .patch = 0, - }; -@@ -979,6 +983,8 @@ get_properties(const struct anv_physical_device *pdevice, - *props = (struct vk_properties) { - #if DETECT_OS_ANDROID - .apiVersion = ANV_API_VERSION, -+#elif defined(HASVK_FORCE_VK_1_3) -+ .apiVersion = ANV_API_VERSION_1_3, - #else - .apiVersion = (pdevice->use_softpin || pdevice->instance->report_vk_1_3) ? - ANV_API_VERSION_1_3 : ANV_API_VERSION_1_2, -diff --git a/src/intel/vulkan_hasvk/meson.build b/src/intel/vulkan_hasvk/meson.build -index 2e34cd6..4b292eb 100644 ---- a/src/intel/vulkan_hasvk/meson.build -+++ b/src/intel/vulkan_hasvk/meson.build -@@ -208,6 +208,119 @@ if with_symbols_check - ) - endif - -+# ============================================================================= -+# Experimental Vulkan 1.3 variant for Gen7 (HD 4000) hardware. -+# This builds the same HasVK driver but with -DHASVK_FORCE_VK_1_3=1, -+# which forces the driver to always report Vulkan 1.3 API version and -+# conformance regardless of softpin support. This is experimental and -+# intended for applications that require VK 1.3 to run. -+# ============================================================================= -+ -+icd_file_name_13 = libname_prefix + 'vulkan_intel_hasvk13.' + libname_suffix -+ -+intel_hasvk13_icd = custom_target( -+ 'intel_hasvk13_icd', -+ input : [vk_icd_gen, vk_api_xml], -+ output : 'intel_hasvk13_icd.' + vulkan_manifest_suffix, -+ command : [ -+ prog_python, '@INPUT0@', -+ '--api-version', '1.3', '--xml', '@INPUT1@', -+ '--sizeof-pointer', sizeof_pointer, -+ '--icd-lib-path', vulkan_icd_lib_path, -+ '--icd-filename', icd_file_name_13, -+ '--out', '@OUTPUT@', -+ ], -+ build_by_default : true, -+ install_dir : with_vulkan_icd_dir, -+ install_tag : 'runtime', -+ install : true, -+) -+ -+_dev_icdname_13 = 'intel_hasvk13_devenv_icd.@0@.json'.format(host_machine.cpu()) -+_dev_icd_13 = custom_target( -+ 'intel_hasvk13_devenv_icd', -+ input : [vk_icd_gen, vk_api_xml], -+ output : _dev_icdname_13, -+ command : [ -+ prog_python, '@INPUT0@', -+ '--api-version', '1.3', '--xml', '@INPUT1@', -+ '--sizeof-pointer', sizeof_pointer, -+ '--icd-lib-path', meson.current_build_dir(), -+ '--icd-filename', icd_file_name_13, -+ '--out', '@OUTPUT@', -+ ], -+ build_by_default : true, -+) -+ -+# Build per-hw-ver static libs with VK 1.3 force flag -+libanv_per_hw_ver_libs_13 = [] -+foreach g : [['70', ['gfx7_cmd_buffer.c']], -+ ['75', ['gfx7_cmd_buffer.c']], -+ ['80', ['gfx8_cmd_buffer.c']]] -+ _gfx_ver = g[0] -+ libanv_per_hw_ver_libs_13 += static_library( -+ 'anv_per_hw_ver@0@_vk13'.format(_gfx_ver), -+ [anv_per_hw_ver_files, g[1], anv_hasvk_entrypoints[0]], -+ include_directories : [ -+ inc_include, inc_src, inc_intel, -+ ], -+ c_args : [ -+ no_override_init_args, sse2_args, -+ '-DGFX_VERx10=@0@'.format(_gfx_ver), -+ '-DHASVK_FORCE_VK_1_3=1', -+ ], -+ gnu_symbol_visibility : 'hidden', -+ dependencies : [ -+ dep_libdrm, dep_valgrind, idep_nir_headers, idep_genxml, -+ idep_vulkan_util_headers, idep_vulkan_wsi_headers, -+ idep_vulkan_runtime_headers, idep_intel_driver_ds_headers, -+ idep_intel_blorp_elk, idep_mesautil, -+ ], -+ ) -+endforeach -+ -+# Build common static lib with VK 1.3 force flag -+libanv_hasvk13_common = static_library( -+ 'anv_hasvk13_common', -+ [ -+ libanv_files, anv_hasvk_entrypoints, sha1_h, -+ gen_xml_pack, -+ ], -+ include_directories : [ -+ inc_include, inc_src, inc_intel, -+ inc_util, -+ ], -+ c_args : anv_flags + ['-DHASVK_FORCE_VK_1_3=1'], -+ cpp_args : anv_cpp_flags, -+ gnu_symbol_visibility : 'hidden', -+ dependencies : anv_deps, -+) -+ -+libvulkan_intel_hasvk13 = shared_library( -+ 'vulkan_intel_hasvk13', -+ [files('anv_gem.c'), anv_hasvk_entrypoints[0]], -+ include_directories : [ -+ inc_include, inc_src, inc_intel, -+ ], -+ link_whole : [libanv_hasvk13_common, libanv_per_hw_ver_libs_13], -+ link_with : [ -+ libisl, libintel_perf, -+ ], -+ dependencies : [ -+ dep_thread, dep_dl, dep_m, anv_deps, idep_libintel_common, -+ idep_nir, idep_genxml, idep_vulkan_util, idep_vulkan_wsi, -+ idep_vulkan_runtime, idep_mesautil, idep_xmlconfig, -+ idep_intel_driver_ds, idep_intel_dev, idep_intel_blorp_elk, -+ idep_intel_decoder_elk, idep_intel_compiler_elk, -+ ], -+ c_args : anv_flags + ['-DHASVK_FORCE_VK_1_3=1'], -+ gnu_symbol_visibility : 'hidden', -+ link_args : [vulkan_icd_link_args, ld_args_build_id, -+ ld_args_bsymbolic, ld_args_gc_sections], -+ link_depends : vulkan_icd_link_depends, -+ install : true, -+) -+ - # HasVK and its tests can only run on x86 - if with_tests and host_machine.cpu_family().startswith('x86') - libvulkan_intel_hasvk_test = static_library(