From 1e1a00252f0afc6a393953f19c2d4e0d9e29beca Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Thu, 18 Jun 2026 04:23:06 +0200 Subject: [PATCH] adding DRM device search and intel pci device map --- build.zig | 6 +- build.zig.zon | 6 + src/ape/ApeInstance.zig | 10 +- src/intel/FlintInstance.zig | 54 ++++- src/intel/FlintPhysicalDevice.zig | 31 ++- src/intel/i915/kmd.zig | 0 src/intel/lib.zig | 13 +- src/intel/pci_ids.zig | 332 ++++++++++++++++++++++++++++++ src/intel/xe/kmd.zig | 0 src/software/SoftInstance.zig | 6 +- src/vulkan/Instance.zig | 18 +- src/vulkan/PhysicalDevice.zig | 2 +- src/vulkan/drm.zig | 34 +++ src/vulkan/lib.zig | 1 + src/vulkan/lib_vulkan.zig | 41 ++-- 15 files changed, 509 insertions(+), 45 deletions(-) create mode 100644 src/intel/i915/kmd.zig create mode 100644 src/intel/pci_ids.zig create mode 100644 src/intel/xe/kmd.zig create mode 100644 src/vulkan/drm.zig diff --git a/build.zig b/build.zig index a0bf912..e011eb9 100644 --- a/build.zig +++ b/build.zig @@ -78,6 +78,7 @@ pub fn build(b: *std.Build) !void { }).module("vulkan-zig"); const zmath = b.dependency("zmath", .{}).module("root"); + const drm = b.dependency("drm", .{}).module("drm"); const logs_option: LogType = b.option(LogType, "logs", "Driver logs") orelse .none; @@ -85,8 +86,9 @@ pub fn build(b: *std.Build) !void { options.addOption(std.SemanticVersion, "driver_version", driver_version); options.addOption(LogType, "logs", logs_option); - base_mod.addImport("zmath", zmath); base_mod.addImport("vulkan", vulkan); + base_mod.addImport("zmath", zmath); + base_mod.addImport("drm", drm); const base_c_includes = b.addTranslateC(.{ .root_source_file = b.path("src/vulkan/c_includes.h"), @@ -289,6 +291,8 @@ fn customFlint( _: bool, ) !void { lib_mod.addImport("intel_c", base_c_mod); + + lib_mod.addImport("soft_c", base_c_mod); } fn optionsFlint(b: *std.Build, options: *Step.Options) !void { diff --git a/build.zig.zon b/build.zig.zon index 8ea540f..b2406cb 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -25,6 +25,12 @@ .url = "git+https://git.kbz8.me/kbz_8/Vulkan-CTS-bin.git#b316a134bc0aa7ac21d9c57a1df588809824dcdc", .hash = "N-V-__8AAF9uOh0I4P_99za7N822J3JwsDaqONrFVrcEQo59", }, + .drm = .{ + .url = "git+https://git.kbz8.me/kbz_8/zig-drm.git#409f58daa8f5174b2fcb8897f1c30f0b0729b611", + .hash = "drm-0.0.1-uWWar5YwAQCiTNOcqtYqt_yL19B0_Q-YLjPNkRysFSnR", + }, + + // Soft dependencies .SPIRV_Interpreter = .{ .url = "git+https://git.kbz8.me/kbz_8/SPIRV-Interpreter#42554a5cc1069e8174b377e95ce2ac2d802a44ff", .hash = "SPIRV_Interpreter-0.0.1-ajmpn0GXBwD01BnmV_Kf8EeNqTDoyuq7UvHVaq-WoBP0", diff --git a/src/ape/ApeInstance.zig b/src/ape/ApeInstance.zig index 3af2c27..02267bb 100644 --- a/src/ape/ApeInstance.zig +++ b/src/ape/ApeInstance.zig @@ -1,7 +1,9 @@ const std = @import("std"); const vk = @import("vulkan"); const base = @import("base"); + const soft = @import("soft"); +const flint = @import("flint"); const Dispatchable = base.Dispatchable; const VkError = base.VkError; @@ -37,6 +39,10 @@ pub fn create(allocator: std.mem.Allocator, infos: *const vk.InstanceCreateInfo) errdefer soft_instance.deinit(allocator) catch {}; self.backend_instances.append(allocator, soft_instance) catch return VkError.OutOfHostMemory; + const flint_instance = try flint.Instance.create(allocator, infos); + errdefer flint_instance.deinit(allocator) catch {}; + self.backend_instances.append(allocator, flint_instance) catch return VkError.OutOfHostMemory; + return &self.interface; } @@ -47,7 +53,7 @@ fn destroy(interface: *Interface, allocator: std.mem.Allocator) VkError!void { allocator.destroy(self); } -fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator) VkError!void { +fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, _: []base.drm.Card) VkError!void { const self: *Self = @alignCast(@fieldParentPtr("interface", interface)); for (self.backend_instances.items) |backend| { @@ -66,7 +72,7 @@ fn appendBackendPhysicalDevices(self: *Self, allocator: std.mem.Allocator, backe fn releasePhysicalDevices(interface: *Interface, allocator: std.mem.Allocator) VkError!void { for (interface.physical_devices.items) |physical_device| { - try physical_device.object.releasePhysicalDevice(allocator); + try physical_device.object.release(allocator); physical_device.destroy(allocator); } diff --git a/src/intel/FlintInstance.zig b/src/intel/FlintInstance.zig index 8b7224e..09f8fea 100644 --- a/src/intel/FlintInstance.zig +++ b/src/intel/FlintInstance.zig @@ -1,6 +1,8 @@ const std = @import("std"); const vk = @import("vulkan"); const base = @import("base"); +const lib = @import("lib.zig"); + const FlintPhysicalDevice = @import("FlintPhysicalDevice.zig"); const Dispatchable = base.Dispatchable; @@ -59,17 +61,59 @@ fn destroy(interface: *Interface, allocator: std.mem.Allocator) VkError!void { allocator.destroy(self); } -fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator) VkError!void { - _ = interface; - _ = allocator; +fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, devices: []base.drm.Card) VkError!void { + if (interface.physical_devices.items.len != 0) { + return; + } + + const io_var = interface.io(); + + for (devices[0..]) |device| { + const drm_device = device.getDevice(io_var, allocator, .{}) catch continue; + + if (drm_device.node_type != .render or + std.meta.activeTag(drm_device.device_info) != .pci or + drm_device.device_info.pci.vendor_id != lib.INTEL_PCI_VENDOR_ID) + continue; + + const physical_device = try FlintPhysicalDevice.create(allocator, interface, &drm_device); + errdefer physical_device.interface.release(allocator) catch {}; + + const dispatchable = try Dispatchable(base.PhysicalDevice).wrap(allocator, &physical_device.interface); + errdefer dispatchable.destroy(allocator); + + interface.physical_devices.append(allocator, dispatchable) catch return VkError.OutOfHostMemory; + } } fn releasePhysicalDevices(interface: *Interface, allocator: std.mem.Allocator) VkError!void { - _ = interface; - _ = allocator; + var result: ?VkError = null; + + for (interface.physical_devices.items) |physical_device| { + physical_device.object.release(allocator) catch |err| { + if (result == null) { + result = err; + } + }; + physical_device.destroy(allocator); + } + + interface.physical_devices.deinit(allocator); + interface.physical_devices = .empty; + + if (result) |err| { + return err; + } } fn io(interface: *Interface) std.Io { const self: *Self = @alignCast(@fieldParentPtr("interface", interface)); return self.io_impl; } + +fn mapDeviceEnumerationError(err: anyerror) VkError { + return switch (err) { + error.OutOfMemory => VkError.OutOfHostMemory, + else => VkError.InitializationFailed, + }; +} diff --git a/src/intel/FlintPhysicalDevice.zig b/src/intel/FlintPhysicalDevice.zig index be6bb51..612686f 100644 --- a/src/intel/FlintPhysicalDevice.zig +++ b/src/intel/FlintPhysicalDevice.zig @@ -4,6 +4,8 @@ const vk = @import("vulkan"); const base = @import("base"); const lib = @import("lib.zig"); +const pci_ids = @import("pci_ids.zig").map; + const FlintDevice = @import("FlintDevice.zig"); const VkError = base.VkError; @@ -29,7 +31,7 @@ pub const EXTENSIONS = [_]vk.ExtensionProperties{ interface: Interface, -pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*Self { +pub fn create(allocator: std.mem.Allocator, instance: *base.Instance, drm_device: *const base.drm.Device) VkError!*Self { const self = allocator.create(Self) catch return VkError.OutOfHostMemory; errdefer allocator.destroy(self); @@ -52,10 +54,31 @@ pub fn create(allocator: std.mem.Allocator, instance: *base.Instance) VkError!*S }; interface.props.api_version = @bitCast(lib.VULKAN_VERSION); + interface.props.vendor_id = lib.INTEL_PCI_VENDOR_ID; interface.props.driver_version = @bitCast(base.DRIVER_VERSION); - interface.props.device_id = lib.DEVICE_ID; - interface.props.device_type = .cpu; - interface.props.pipeline_cache_uuid = lib.PIPELINE_CACHE_UUID; + interface.props.device_id = drm_device.device_info.pci.device_id; + interface.props.device_type = .integrated_gpu; + + @memset(interface.props.device_name[0..], 0); + + for (pci_ids[0..]) |pci| { + if (pci.id != drm_device.device_info.pci.device_id) + continue; + + if (pci.is_discrete) + interface.props.device_type = .discrete_gpu; + + const len = @min(vk.MAX_PHYSICAL_DEVICE_NAME_SIZE, pci.name.len); + @memcpy(interface.props.device_name[0..len], pci.name[0..len]); + + const driver_mark = " [Flint ApeDriver]"; + + @memcpy(interface.props.device_name[len .. len + driver_mark.len], driver_mark); + + break; + } + + interface.props.pipeline_cache_uuid = undefined; interface.props.limits = .{ .max_image_dimension_1d = 4096, .max_image_dimension_2d = 4096, diff --git a/src/intel/i915/kmd.zig b/src/intel/i915/kmd.zig new file mode 100644 index 0000000..e69de29 diff --git a/src/intel/lib.zig b/src/intel/lib.zig index 968e9a5..068d2ae 100644 --- a/src/intel/lib.zig +++ b/src/intel/lib.zig @@ -36,6 +36,10 @@ pub const Instance = FlintInstance; pub const DRIVER_NAME = "Flint"; +pub const PHYSICAL_DEVICE_DEFAULT_NAME = "Unkown Intel device"; + +pub const INTEL_PCI_VENDOR_ID = 0x8086; + pub const VULKAN_VERSION = vk.makeApiVersion( 0, config.flint_vulkan_version.major, @@ -43,10 +47,11 @@ pub const VULKAN_VERSION = vk.makeApiVersion( config.flint_vulkan_version.patch, ); -pub const DEVICE_ID = 0x00000000; -pub const PIPELINE_CACHE_UUID: [vk.UUID_SIZE]u8 = "ApeFlintCacheUUI".*; - -pub const PHYSICAL_DEVICE_DEFAULT_NAME = "Ape Flint device"; +pub const KmdType = enum { + Invalid, + I915, + Xe, +}; pub const std_options = base.std_options; diff --git a/src/intel/pci_ids.zig b/src/intel/pci_ids.zig new file mode 100644 index 0000000..ecd4ecd --- /dev/null +++ b/src/intel/pci_ids.zig @@ -0,0 +1,332 @@ +const std = @import("std"); + +const PciInfo = struct { + id: u16, + name: []const u8, + is_discrete: bool, +}; + +pub const map = [_]PciInfo{ + .{ .id = 0x1602, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x1606, .name = "Intel(R) Broadwell-U GT1 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x160a, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x160b, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x160d, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x160e, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x1612, .name = "Intel(R) Broadwell-H GT2 (HD Graphics 5600)", .is_discrete = false }, + .{ .id = 0x1616, .name = "Intel(R) Broadwell-U GT2 (HD Graphics 5500)", .is_discrete = false }, + .{ .id = 0x161a, .name = "Intel(R) Broadwell-U (HD Graphics P5700)", .is_discrete = false }, + .{ .id = 0x161b, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x161d, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x161e, .name = "Intel(R) Broadwell-Y GT2 (HD Graphics 5300)", .is_discrete = false }, + .{ .id = 0x1622, .name = "Intel(R) Broadwell-DT/H GT3 (Iris(R) Pro Graphics 6200)", .is_discrete = false }, + .{ .id = 0x1626, .name = "Intel(R) Broadwell-U GT3 (HD Graphics 6000)", .is_discrete = false }, + .{ .id = 0x162a, .name = "Intel(R) Broadwell-DT GT3 (Iris(R) Pro Graphics P6300)", .is_discrete = false }, + .{ .id = 0x162b, .name = "Intel(R) Broadwell-U GT3 (Iris(R) Graphics 6100)", .is_discrete = false }, + .{ .id = 0x162d, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x162e, .name = "Intel(R) Broadwell-U (HD Graphics)", .is_discrete = false }, + + .{ .id = 0x1902, .name = "Intel(R) Skylake-S GT1 (HD Graphics 510)", .is_discrete = false }, + .{ .id = 0x1906, .name = "Intel(R) Skylake-U GT1 (HD Graphics 510)", .is_discrete = false }, + .{ .id = 0x190a, .name = "Intel(R) Skylake GT1 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x190b, .name = "Intel(R) Skylake GT1 (HD Graphics 510)", .is_discrete = false }, + .{ .id = 0x190e, .name = "Intel(R) Skylake GT1 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x1912, .name = "Intel(R) Skylake-S GT2 (HD Graphics 530)", .is_discrete = false }, + .{ .id = 0x1913, .name = "Intel(R) Skylake GT1.5 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x1915, .name = "Intel(R) Skylake GT1.5 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x1916, .name = "Intel(R) Skylake-U GT2 (HD Graphics 520)", .is_discrete = false }, + .{ .id = 0x1917, .name = "Intel(R) Skylake GT2 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x191a, .name = "Intel(R) Skylake GT2 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x191b, .name = "Intel(R) Skylake-H GT2 (HD Graphics 530)", .is_discrete = false }, + .{ .id = 0x191d, .name = "Intel(R) Skylake-DT/H GT2 (HD Graphics P530)", .is_discrete = false }, + .{ .id = 0x191e, .name = "Intel(R) Skylake-Y GT2 (HD Graphics 515)", .is_discrete = false }, + .{ .id = 0x1921, .name = "Intel(R) Skylake GT2 (HD Graphics 520)", .is_discrete = false }, + .{ .id = 0x1923, .name = "Intel(R) Skylake GT2 (HD Graphics 535)", .is_discrete = false }, + .{ .id = 0x1926, .name = "Intel(R) Skylake-U GT3 (Iris(R) Graphics 540)", .is_discrete = false }, + .{ .id = 0x1927, .name = "Intel(R) Skylake-U GT3 (Iris(R) Graphics 550)", .is_discrete = false }, + .{ .id = 0x192a, .name = "Intel(R) Skylake GT3 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x192b, .name = "Intel(R) Skylake GT3 (Iris(R) Graphics 555)", .is_discrete = false }, + .{ .id = 0x192d, .name = "Intel(R) Skylake-H GT3 (Iris(R) Graphics P555)", .is_discrete = false }, + .{ .id = 0x1932, .name = "Intel(R) Skylake GT4 (Iris(R) Pro Graphics 580)", .is_discrete = false }, + .{ .id = 0x193a, .name = "Intel(R) Skylake-H GT4 (Iris(R) Pro Graphics P580)", .is_discrete = false }, + .{ .id = 0x193b, .name = "Intel(R) Skylake-H GT4 (Iris(R) Pro Graphics 580)", .is_discrete = false }, + .{ .id = 0x193d, .name = "Intel(R) Skylake-H GT4 (Iris(R) Pro Graphics P580)", .is_discrete = false }, + + .{ .id = 0x0a84, .name = "Intel(R) HD Graphics", .is_discrete = false }, + .{ .id = 0x1a84, .name = "Intel(R) HD Graphics", .is_discrete = false }, + .{ .id = 0x1a85, .name = "Intel(R) HD Graphics", .is_discrete = false }, + .{ .id = 0x5a84, .name = "Intel(R) ApolloLake (HD Graphics 505)", .is_discrete = false }, + .{ .id = 0x5a85, .name = "Intel(R) ApolloLake GT1 (HD Graphics 500)", .is_discrete = false }, + + .{ .id = 0x3184, .name = "Intel(R) GeminiLake (UHD Graphics 605)", .is_discrete = false }, + .{ .id = 0x3185, .name = "Intel(R) GeminiLake (UHD Graphics 600)", .is_discrete = false }, + + .{ .id = 0x5902, .name = "Intel(R) KabyLake-S GT1 (HD Graphics 610)", .is_discrete = false }, + .{ .id = 0x5906, .name = "Intel(R) KabyLake-U GT1 (HD Graphics 610)", .is_discrete = false }, + .{ .id = 0x590a, .name = "Intel(R) KabyLake GT1 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x5908, .name = "Intel(R) KabyLake GT1 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x590b, .name = "Intel(R) KabyLake GT1 (HD Graphics 610)", .is_discrete = false }, + .{ .id = 0x590e, .name = "Intel(R) KabyLake GT1 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x5913, .name = "Intel(R) KabyLake GT2 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x5915, .name = "Intel(R) KabyLake GT2 (HD Graphics)", .is_discrete = false }, + .{ .id = 0x5917, .name = "Intel(R) KabyLake-R GT2 (UHD Graphics 620)", .is_discrete = false }, + .{ .id = 0x5912, .name = "Intel(R) KabyLake-S GT2 (HD Graphics 630)", .is_discrete = false }, + .{ .id = 0x5916, .name = "Intel(R) KabyLake-U GT2 (HD Graphics 620)", .is_discrete = false }, + .{ .id = 0x591a, .name = "Intel(R) KabyLake GT2 (HD Graphics P630)", .is_discrete = false }, + .{ .id = 0x591b, .name = "Intel(R) KabyLake-H GT2 (HD Graphics 630)", .is_discrete = false }, + .{ .id = 0x591d, .name = "Intel(R) KabyLake-DT GT2 (HD Graphics P630)", .is_discrete = false }, + .{ .id = 0x591e, .name = "Intel(R) KabyLake-Y GT2 (HD Graphics 615)", .is_discrete = false }, + .{ .id = 0x5921, .name = "Intel(R) KabyLake GT2 (HD Graphics 620)", .is_discrete = false }, + .{ .id = 0x5923, .name = "Intel(R) KabyLake GT2 (HD Graphics 635)", .is_discrete = false }, + .{ .id = 0x5926, .name = "Intel(R) KabyLake-U GT3 (Iris(R) Plus Graphics 640)", .is_discrete = false }, + .{ .id = 0x5927, .name = "Intel(R) KabyLake-U GT3 (Iris(R) Plus Graphics 650)", .is_discrete = false }, + .{ .id = 0x593b, .name = "Intel(R) KabyLake GT2 (HD Graphics)", .is_discrete = false }, + + .{ .id = 0x591c, .name = "Intel(R) KabyLake-Y GT2 (UHD Graphics 615)", .is_discrete = false }, + .{ .id = 0x87c0, .name = "Intel(R) AmberLake-Y GT2 (UHD Graphics 617)", .is_discrete = false }, + + .{ .id = 0x87ca, .name = "Intel(R) AmberLake-Y GT2 (UHD Graphics 617)", .is_discrete = false }, + + .{ .id = 0x3e90, .name = "Intel(R) CoffeeLake-S GT1 (UHD Graphics 610)", .is_discrete = false }, + .{ .id = 0x3e93, .name = "Intel(R) CoffeeLake-S GT1 (UHD Graphics 610)", .is_discrete = false }, + .{ .id = 0x3e99, .name = "Intel(R) CoffeeLake-S GT1 (UHD Graphics 610)", .is_discrete = false }, + .{ .id = 0x3e9c, .name = "Intel(R) CoffeeLake-S GT1 (UHD Graphics 610)", .is_discrete = false }, + .{ .id = 0x3e91, .name = "Intel(R) CoffeeLake-S GT2 (UHD Graphics 630)", .is_discrete = false }, + .{ .id = 0x3e92, .name = "Intel(R) CoffeeLake-S GT2 (UHD Graphics 630)", .is_discrete = false }, + .{ .id = 0x3e96, .name = "Intel(R) CoffeeLake-S GT2 (UHD Graphics P630)", .is_discrete = false }, + .{ .id = 0x3e98, .name = "Intel(R) CoffeeLake-S GT2 (UHD Graphics 630)", .is_discrete = false }, + .{ .id = 0x3e9a, .name = "Intel(R) CoffeeLake-S GT2 (UHD Graphics P630)", .is_discrete = false }, + .{ .id = 0x3e9b, .name = "Intel(R) CoffeeLake-H GT2 (UHD Graphics 630)", .is_discrete = false }, + .{ .id = 0x3e94, .name = "Intel(R) CoffeeLake-S GT2 (UHD Graphics P630)", .is_discrete = false }, + .{ .id = 0x3ea9, .name = "Intel(R) CoffeeLake-U GT2 (UHD Graphics 620)", .is_discrete = false }, + .{ .id = 0x3ea5, .name = "Intel(R) CoffeeLake-U GT3e (Iris(R) Plus Graphics 655)", .is_discrete = false }, + .{ .id = 0x3ea6, .name = "Intel(R) CoffeeLake-U GT3 (Iris(R) Plus Graphics 645)", .is_discrete = false }, + .{ .id = 0x3ea7, .name = "Intel(R) CoffeeLake-U (HD Graphics)", .is_discrete = false }, + .{ .id = 0x3ea8, .name = "Intel(R) CoffeeLake-U GT3 (Iris(R) Plus Graphics 655)", .is_discrete = false }, + + .{ .id = 0x3ea1, .name = "Intel(R) WhiskeyLake-U GT1 (UHD Graphics 610)", .is_discrete = false }, + .{ .id = 0x3ea4, .name = "Intel(R) WhiskeyLake-U (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x3ea0, .name = "Intel(R) WhiskeyLake-U GT2 (UHD Graphics 620)", .is_discrete = false }, + .{ .id = 0x3ea3, .name = "Intel(R) WhiskeyLake-U (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x3ea2, .name = "Intel(R) WhiskeyLake-U (UHD Graphics)", .is_discrete = false }, + + .{ .id = 0x9b21, .name = "Intel(R) CometLake-U GT2 (UHD Graphics 620)", .is_discrete = false }, + .{ .id = 0x9ba0, .name = "Intel(R) CometLake GT1 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9ba2, .name = "Intel(R) CometLake GT1 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9ba4, .name = "Intel(R) CometLake-H GT1 (UHD Graphics 610)", .is_discrete = false }, + .{ .id = 0x9ba5, .name = "Intel(R) CometLake GT1 (UHD Graphics 610)", .is_discrete = false }, + .{ .id = 0x9ba8, .name = "Intel(R) CometLake-S GT1 (UHD Graphics 610)", .is_discrete = false }, + .{ .id = 0x9baa, .name = "Intel(R) CometLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9bab, .name = "Intel(R) CometLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9bac, .name = "Intel(R) CometLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9b41, .name = "Intel(R) CometLake-U GT2 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9bc0, .name = "Intel(R) CometLake GT2 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9bc2, .name = "Intel(R) CometLake GT2 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9bc4, .name = "Intel(R) CometLake-H GT2 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9bc5, .name = "Intel(R) CometLake-S GT2 (UHD Graphics 630)", .is_discrete = false }, + .{ .id = 0x9bc6, .name = "Intel(R) CometLake-S GT2 (UHD Graphics P630)", .is_discrete = false }, + .{ .id = 0x9bc8, .name = "Intel(R) CometLake-S GT2 (UHD Graphics 630)", .is_discrete = false }, + .{ .id = 0x9bca, .name = "Intel(R) CometLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9bcb, .name = "Intel(R) CometLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9bcc, .name = "Intel(R) CometLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9be6, .name = "Intel(R) CometLake-S GT2 (UHD Graphics P630)", .is_discrete = false }, + .{ .id = 0x9bf6, .name = "Intel(R) CoffeeLake-S GT2 (UHD Graphics P630)", .is_discrete = false }, + + .{ .id = 0x8a50, .name = "Intel(R) IceLake (HD Graphics)", .is_discrete = false }, + .{ .id = 0x8a51, .name = "Intel(R) IceLake GT2 (Iris(R) Plus Graphics G7)", .is_discrete = false }, + .{ .id = 0x8a52, .name = "Intel(R) IceLake GT2 (Iris(R) Plus Graphics G7)", .is_discrete = false }, + .{ .id = 0x8a53, .name = "Intel(R) IceLake GT2 (Iris(R) Plus Graphics G7)", .is_discrete = false }, + .{ .id = 0x8a54, .name = "Intel(R) IceLake GT2 (Iris(R) Plus Graphics)", .is_discrete = false }, + .{ .id = 0x8a56, .name = "Intel(R) IceLake GT1 (UHD Graphics G1)", .is_discrete = false }, + .{ .id = 0x8a57, .name = "Intel(R) IceLake (HD Graphics)", .is_discrete = false }, + .{ .id = 0x8a58, .name = "Intel(R) IceLake-Y GT1 (UHD Graphics G1)", .is_discrete = false }, + .{ .id = 0x8a59, .name = "Intel(R) IceLake (HD Graphics)", .is_discrete = false }, + .{ .id = 0x8a5a, .name = "Intel(R) IceLake GT2 (Iris(R) Plus Graphics G4)", .is_discrete = false }, + .{ .id = 0x8a5b, .name = "Intel(R) IceLake (HD Graphics)", .is_discrete = false }, + .{ .id = 0x8a5c, .name = "Intel(R) IceLake GT2 (Iris(R) Plus Graphics G4)", .is_discrete = false }, + .{ .id = 0x8a5d, .name = "Intel(R) IceLake (HD Graphics)", .is_discrete = false }, + .{ .id = 0x8a71, .name = "Intel(R) IceLake (HD Graphics)", .is_discrete = false }, + + .{ .id = 0x4541, .name = "Intel(R) ElkhartLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4551, .name = "Intel(R) ElkhartLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4555, .name = "Intel(R) ElkhartLake (UHD Graphics Gen11 16EU)", .is_discrete = false }, + .{ .id = 0x4557, .name = "Intel(R) ElkhartLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4570, .name = "Intel(R) ElkhartLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4571, .name = "Intel(R) ElkhartLake (UHD Graphics Gen11 32EU)", .is_discrete = false }, + .{ .id = 0x4e51, .name = "Intel(R) JasperLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4e55, .name = "Intel(R) JasperLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4e57, .name = "Intel(R) JasperLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4e61, .name = "Intel(R) JasperLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4e71, .name = "Intel(R) JasperLake (UHD Graphics)", .is_discrete = false }, + + .{ .id = 0x4c8a, .name = "Intel(R) RocketLake-S GT1 (UHD Graphics 750)", .is_discrete = false }, + .{ .id = 0x4c8b, .name = "Intel(R) RocketLake-S GT1 (UHD Graphics 730)", .is_discrete = false }, + .{ .id = 0x4c8c, .name = "Intel(R) RocketLake-S (Graphics)", .is_discrete = false }, + .{ .id = 0x4c90, .name = "Intel(R) RocketLake-S GT1 (UHD Graphics P750)", .is_discrete = false }, + .{ .id = 0x4c9a, .name = "Intel(R) RocketLake-S (UHD Graphics)", .is_discrete = false }, + + .{ .id = 0x4680, .name = "Intel(R) AlderLake-S GT1 (UHD Graphics 770)", .is_discrete = false }, + .{ .id = 0x4682, .name = "Intel(R) AlderLake-S GT1 (UHD Graphics 730)", .is_discrete = false }, + .{ .id = 0x4688, .name = "Intel(R) AlderLake-HX GT1 (UHD Graphics 770)", .is_discrete = false }, + .{ .id = 0x468a, .name = "Intel(R) AlderLake-S (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x468b, .name = "Intel(R) AlderLake-S (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x4690, .name = "Intel(R) AlderLake-S GT1 (UHD Graphics 770)", .is_discrete = false }, + .{ .id = 0x4692, .name = "Intel(R) AlderLake-S GT1 (UHD Graphics 730)", .is_discrete = false }, + .{ .id = 0x4693, .name = "Intel(R) AlderLake-S GT1 (UHD Graphics 710)", .is_discrete = false }, + + .{ .id = 0x4626, .name = "Intel(R) AlderLake-P (Integrated Graphics Controller)", .is_discrete = false }, + .{ .id = 0x4628, .name = "Intel(R) AlderLake-UP3 GT2 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x462a, .name = "Intel(R) AlderLake-P (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x46a0, .name = "Intel(R) AlderLake-P GT2 (Graphics)", .is_discrete = false }, + .{ .id = 0x46a1, .name = "Intel(R) AlderLake-P (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x46a2, .name = "Intel(R) AlderLake-P (Graphics)", .is_discrete = false }, + .{ .id = 0x46a3, .name = "Intel(R) AlderLake-P GT1 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x46a6, .name = "Intel(R) AlderLake-P GT2 (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0x46a8, .name = "Intel(R) AlderLake-UP3 GT2 (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0x46aa, .name = "Intel(R) AlderLake-UP4 GT2 (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0x46b0, .name = "Intel(R) AlderLake-P (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0x46b1, .name = "Intel(R) AlderLake-P (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0x46b2, .name = "Intel(R) AlderLake-P (Graphics)", .is_discrete = false }, + .{ .id = 0x46b3, .name = "Intel(R) AlderLake-UP3 GT1 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x46c0, .name = "Intel(R) AlderLake-M GT1 (Graphics)", .is_discrete = false }, + .{ .id = 0x46c1, .name = "Intel(R) AlderLake-M (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0x46c2, .name = "Intel(R) AlderLake-M (Graphics)", .is_discrete = false }, + .{ .id = 0x46c3, .name = "Intel(R) AlderLake-UP4 GT1 (UHD Graphics)", .is_discrete = false }, + + .{ .id = 0x46d0, .name = "Intel(R) AlderLake-N (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x46d1, .name = "Intel(R) AlderLake-N (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x46d2, .name = "Intel(R) AlderLake-N (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x46d3, .name = "Intel(R) AlderLake-N (Intel Graphics)", .is_discrete = false }, + .{ .id = 0x46d4, .name = "Intel(R) AlderLake-N (Intel Graphics)", .is_discrete = false }, + + .{ .id = 0x9a40, .name = "Intel(R) TigerLake-UP4 GT2 (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0x9a49, .name = "Intel(R) TigerLake-LP GT2 (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0x9a59, .name = "Intel(R) TigerLake (Graphics)", .is_discrete = false }, + .{ .id = 0x9a60, .name = "Intel(R) TigerLake-H GT1 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9a68, .name = "Intel(R) TigerLake-H GT1 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9a70, .name = "Intel(R) TigerLake-H GT1 (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9a78, .name = "Intel(R) TigerLake-LP GT2 (UHD Graphics G4)", .is_discrete = false }, + .{ .id = 0x9ac0, .name = "Intel(R) TigerLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9ac9, .name = "Intel(R) TigerLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9ad9, .name = "Intel(R) TigerLake (UHD Graphics)", .is_discrete = false }, + .{ .id = 0x9af8, .name = "Intel(R) TigerLake (UHD Graphics)", .is_discrete = false }, + + .{ .id = 0xa780, .name = "Intel(R) RaptorLake-S GT1 (UHD Graphics 770)", .is_discrete = false }, + .{ .id = 0xa781, .name = "Intel(R) RaptorLake-S (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa782, .name = "Intel(R) RaptorLake-S (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa783, .name = "Intel(R) RaptorLake-S (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa788, .name = "Intel(R) RaptorLake-S (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa789, .name = "Intel(R) RaptorLake-S (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa78a, .name = "Intel(R) RaptorLake-S (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa78b, .name = "Intel(R) RaptorLake-S (UHD Graphics)", .is_discrete = false }, + + .{ .id = 0xa720, .name = "Intel(R) RaptorLake-P (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa721, .name = "Intel(R) RaptorLake-P (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa7a0, .name = "Intel(R) RaptorLake-P (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0xa7a1, .name = "Intel(R) RaptorLake-P (Iris(R) Xe Graphics)", .is_discrete = false }, + .{ .id = 0xa7a8, .name = "Intel(R) RaptorLake-P (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa7a9, .name = "Intel(R) RaptorLake-P (UHD Graphics)", .is_discrete = false }, + .{ .id = 0xa7aa, .name = "Intel(R) RaptorLake-P (Intel Graphics)", .is_discrete = false }, + .{ .id = 0xa7ab, .name = "Intel(R) RaptorLake-P (Intel Graphics)", .is_discrete = false }, + .{ .id = 0xa7ac, .name = "Intel(R) RaptorLake-U (Intel Graphics)", .is_discrete = false }, + .{ .id = 0xa7ad, .name = "Intel(R) RaptorLake-U (Intel Graphics)", .is_discrete = false }, + + .{ .id = 0x4905, .name = "Intel(R) DG1 (Iris(R) Xe MAX Graphics)", .is_discrete = true }, + .{ .id = 0x4906, .name = "Intel(R) DG1 (Iris(R) Xe Pod)", .is_discrete = true }, + .{ .id = 0x4907, .name = "Intel(R) SG1 (Server GPU SG-18M)", .is_discrete = true }, + .{ .id = 0x4908, .name = "Intel(R) DG1 (Iris(R) Xe Graphics)", .is_discrete = true }, + .{ .id = 0x4909, .name = "Intel(R) DG1 (Iris(R) Xe MAX 100)", .is_discrete = true }, + + .{ .id = 0x5690, .name = "Intel(R) DG2 (Arc(tm) A770M Graphics)", .is_discrete = true }, + .{ .id = 0x5691, .name = "Intel(R) DG2 (Arc(tm) A730M Graphics)", .is_discrete = true }, + .{ .id = 0x5692, .name = "Intel(R) DG2 (Arc(tm) A550M Graphics)", .is_discrete = true }, + .{ .id = 0x5693, .name = "Intel(R) DG2 (Arc(tm) A370M Graphics)", .is_discrete = true }, + .{ .id = 0x5694, .name = "Intel(R) DG2 (Arc(tm) A350M Graphics)", .is_discrete = true }, + .{ .id = 0x5695, .name = "Intel(R) DG2 (Iris(R) Xe MAX A200M Graphics)", .is_discrete = true }, + .{ .id = 0x5696, .name = "Intel(R) DG2 (Arc(tm) A570M Graphics)", .is_discrete = true }, + .{ .id = 0x5697, .name = "Intel(R) DG2 (Arc(tm) A530M Graphics)", .is_discrete = true }, + .{ .id = 0x56a0, .name = "Intel(R) DG2 (Arc(tm) A770 Graphics)", .is_discrete = true }, + .{ .id = 0x56a1, .name = "Intel(R) DG2 (Arc(tm) A750 Graphics)", .is_discrete = true }, + .{ .id = 0x56a2, .name = "Intel(R) DG2 (Arc(tm) A580 Graphics)", .is_discrete = true }, + .{ .id = 0x56a3, .name = "Intel(R) DG2 (Arc(tm) Xe Graphics)", .is_discrete = true }, + .{ .id = 0x56a4, .name = "Intel(R) DG2 (Arc(tm) Xe Graphics)", .is_discrete = true }, + .{ .id = 0x56a5, .name = "Intel(R) DG2 (Arc(tm) A380 Graphics)", .is_discrete = true }, + .{ .id = 0x56a6, .name = "Intel(R) DG2 (Arc(tm) A310 Graphics)", .is_discrete = true }, + .{ .id = 0x56b0, .name = "Intel(R) DG2 (Arc(tm) Pro A30M Graphics)", .is_discrete = true }, + .{ .id = 0x56b1, .name = "Intel(R) DG2 (Arc(tm) Pro A40/A50 Graphics)", .is_discrete = true }, + .{ .id = 0x56b2, .name = "Intel(R) DG2 (Arc(tm) Pro A60M Graphics)", .is_discrete = true }, + .{ .id = 0x56b3, .name = "Intel(R) DG2 (Arc(tm) Pro A60 Graphics)", .is_discrete = true }, + .{ .id = 0x56ba, .name = "Intel(R) DG2 (Arc(tm) A380E Graphics)", .is_discrete = true }, + .{ .id = 0x56bb, .name = "Intel(R) DG2 (Arc(tm) A310E Graphics)", .is_discrete = true }, + .{ .id = 0x56bc, .name = "Intel(R) DG2 (Arc(tm) A370E Graphics)", .is_discrete = true }, + .{ .id = 0x56bd, .name = "Intel(R) DG2 (Arc(tm) A350E Graphics)", .is_discrete = true }, + .{ .id = 0x56be, .name = "Intel(R) DG2 (Arc(tm) A750E Graphics)", .is_discrete = true }, + .{ .id = 0x56bf, .name = "Intel(R) DG2 (Arc(tm) A580E Graphics)", .is_discrete = true }, + .{ .id = 0x56c0, .name = "Intel(R) ATS-M (Data Center GPU Flex 170)", .is_discrete = true }, + .{ .id = 0x56c1, .name = "Intel(R) ATS-M (Data Center GPU Flex 140)", .is_discrete = true }, + .{ .id = 0x56c2, .name = "Intel(R) ATS-M (Data Center GPU Flex 170V)", .is_discrete = true }, + + .{ .id = 0x6420, .name = "Intel(R) LunarLake (Intel Graphics)", .is_discrete = false }, + .{ .id = 0x64a0, .name = "Intel(R) LunarLake (Arc(tm) Graphics 130V/140V)", .is_discrete = false }, + .{ .id = 0x64b0, .name = "Intel(R) LunarLake (Intel Graphics)", .is_discrete = false }, + + .{ .id = 0x7d40, .name = "Intel(R) MeteorLake-M (Intel Graphics)", .is_discrete = false }, + .{ .id = 0x7d45, .name = "Intel(R) MeteorLake-P (Intel Graphics)", .is_discrete = false }, + .{ .id = 0x7d55, .name = "Intel(R) MeteorLake-P (Intel Arc Graphics)", .is_discrete = false }, + .{ .id = 0x7d60, .name = "Intel(R) MeteorLake-M (Intel Graphics)", .is_discrete = false }, + .{ .id = 0x7dd5, .name = "Intel(R) MeteorLake-P (Intel Graphics)", .is_discrete = false }, + + .{ .id = 0x7d41, .name = "Intel(R) ArrowLake-U (Intel Graphics)", .is_discrete = false }, + .{ .id = 0x7d51, .name = "Intel(R) ArrowLake-P (Arc(tm) Pro 130T/140T Graphics)", .is_discrete = false }, + .{ .id = 0x7d67, .name = "Intel(R) ArrowLake-S (Intel Graphics)", .is_discrete = false }, + .{ .id = 0x7dd1, .name = "Intel(R) ArrowLake-P (Intel Graphics)", .is_discrete = false }, + .{ .id = 0xb640, .name = "Intel(R) ArrowLake-H (Intel Graphics)", .is_discrete = false }, + + .{ .id = 0xe202, .name = "Intel(R) Battlemage G21 (Intel Graphics)", .is_discrete = true }, + .{ .id = 0xe209, .name = "Intel(R) Battlemage G21 (Intel Graphics)", .is_discrete = true }, + .{ .id = 0xe20b, .name = "Intel(R) Battlemage G21 (Arc(tm) B580 Graphics)", .is_discrete = true }, + .{ .id = 0xe20c, .name = "Intel(R) Battlemage G21 (Arc(tm) B570 Graphics)", .is_discrete = true }, + .{ .id = 0xe20d, .name = "Intel(R) Battlemage G21 (Intel Graphics)", .is_discrete = true }, + .{ .id = 0xe210, .name = "Intel(R) Battlemage G21 (Intel Graphics)", .is_discrete = true }, + .{ .id = 0xe211, .name = "Intel(R) Battlemage G21 (Arc(tm) Pro B60 Graphics)", .is_discrete = true }, + .{ .id = 0xe212, .name = "Intel(R) Battlemage G21 (Arc(tm) Pro B50 Graphics)", .is_discrete = true }, + .{ .id = 0xe215, .name = "Intel(R) Battlemage G21 (Intel Graphics)", .is_discrete = true }, + .{ .id = 0xe216, .name = "Intel(R) Battlemage G21 (Intel Graphics)", .is_discrete = true }, + .{ .id = 0xe220, .name = "Intel(R) Battlemage G31 (Intel Graphics)", .is_discrete = true }, + .{ .id = 0xe221, .name = "Intel(R) Battlemage G31 (Intel Graphics)", .is_discrete = true }, + .{ .id = 0xe222, .name = "Intel(R) Battlemage G31 (Arc(tm) Pro B65 Graphics)", .is_discrete = true }, + .{ .id = 0xe223, .name = "Intel(R) Battlemage G31 (Arc(tm) Pro B70 Graphics)", .is_discrete = true }, + + .{ .id = 0xb080, .name = "Intel(R) PantherLake (Arc(tm) B390 Graphics)", .is_discrete = false }, + .{ .id = 0xb081, .name = "Intel(R) PantherLake (Arc(tm) B370 Graphics)", .is_discrete = false }, + .{ .id = 0xb082, .name = "Intel(R) PantherLake (Arc(tm) B390 Graphics)", .is_discrete = false }, + .{ .id = 0xb083, .name = "Intel(R) PantherLake (Arc(tm) B370 Graphics)", .is_discrete = false }, + .{ .id = 0xb084, .name = "Intel(R) PantherLake (Arc(tm) Pro B390 Graphics)", .is_discrete = false }, + .{ .id = 0xb085, .name = "Intel(R) PantherLake (Arc(tm) Pro B370 Graphics)", .is_discrete = false }, + .{ .id = 0xb086, .name = "Intel(R) PantherLake (Arc(tm) Pro B390 Graphics)", .is_discrete = false }, + .{ .id = 0xb087, .name = "Intel(R) PantherLake (Arc(tm) Pro B370 Graphics)", .is_discrete = false }, + .{ .id = 0xb08f, .name = "Intel(R) PantherLake (Intel Graphics)", .is_discrete = false }, + .{ .id = 0xb090, .name = "Intel(R) PantherLake (Intel Graphics)", .is_discrete = false }, + .{ .id = 0xb0a0, .name = "Intel(R) PantherLake (Intel Graphics)", .is_discrete = false }, + .{ .id = 0xb0b0, .name = "Intel(R) PantherLake (Intel Graphics)", .is_discrete = false }, + + .{ .id = 0xfd80, .name = "Intel(R) WildcatLake (Intel Graphics)", .is_discrete = false }, + .{ .id = 0xfd81, .name = "Intel(R) WildcatLake (Intel Graphics)", .is_discrete = false }, + + .{ .id = 0xd740, .name = "Intel(R) NVL-S (Graphics)", .is_discrete = false }, + .{ .id = 0xd741, .name = "Intel(R) NVL-U (Graphics)", .is_discrete = false }, + .{ .id = 0xd742, .name = "Intel(R) NVL-H (Graphics)", .is_discrete = false }, + .{ .id = 0xd743, .name = "Intel(R) NVL-HX (Graphics)", .is_discrete = false }, + .{ .id = 0xd744, .name = "Intel(R) NVL-UL (Graphics)", .is_discrete = false }, + .{ .id = 0xd745, .name = "Intel(R) NVL-HX (Graphics)", .is_discrete = false }, + + .{ .id = 0xd750, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, + .{ .id = 0xd751, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, + .{ .id = 0xd752, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, + .{ .id = 0xd753, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, + .{ .id = 0xd754, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, + .{ .id = 0xd755, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, + .{ .id = 0xd756, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, + .{ .id = 0xd757, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, + .{ .id = 0xd75f, .name = "Intel(R) NVL-P (Graphics)", .is_discrete = false }, +}; diff --git a/src/intel/xe/kmd.zig b/src/intel/xe/kmd.zig new file mode 100644 index 0000000..e69de29 diff --git a/src/software/SoftInstance.zig b/src/software/SoftInstance.zig index 325e297..1240373 100644 --- a/src/software/SoftInstance.zig +++ b/src/software/SoftInstance.zig @@ -57,10 +57,10 @@ fn destroy(interface: *Interface, allocator: std.mem.Allocator) VkError!void { allocator.destroy(self); } -fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator) VkError!void { +fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator, _: []base.drm.Card) VkError!void { // Software driver has only one physical device (the CPU) const physical_device = try SoftPhysicalDevice.create(allocator, interface); - errdefer physical_device.interface.releasePhysicalDevice(allocator) catch {}; + errdefer physical_device.interface.release(allocator) catch {}; const dispatchable = try Dispatchable(base.PhysicalDevice).wrap(allocator, &physical_device.interface); errdefer dispatchable.destroy(allocator); interface.physical_devices.append(allocator, dispatchable) catch return VkError.OutOfHostMemory; @@ -68,7 +68,7 @@ fn requestPhysicalDevices(interface: *Interface, allocator: std.mem.Allocator) V fn releasePhysicalDevices(interface: *Interface, allocator: std.mem.Allocator) VkError!void { for (interface.physical_devices.items) |physical_device| { - try physical_device.object.releasePhysicalDevice(allocator); + try physical_device.object.release(allocator); physical_device.destroy(allocator); } diff --git a/src/vulkan/Instance.zig b/src/vulkan/Instance.zig index 3284c87..fa5d083 100644 --- a/src/vulkan/Instance.zig +++ b/src/vulkan/Instance.zig @@ -3,6 +3,8 @@ const builtin = @import("builtin"); const vk = @import("vulkan"); const config = @import("lib.zig").config; const utils = @import("utils.zig"); +const drm = @import("drm.zig"); +const lib = @import("lib.zig"); const VkError = @import("error_set.zig").VkError; const Dispatchable = @import("Dispatchable.zig").Dispatchable; @@ -31,12 +33,13 @@ const DeviceAllocator = struct { pub const EXTENSIONS = [_]vk.ExtensionProperties{}; physical_devices: std.ArrayList(*Dispatchable(PhysicalDevice)), + dispatch_table: *const DispatchTable, vtable: *const VTable, pub const VTable = struct { releasePhysicalDevices: *const fn (*Self, std.mem.Allocator) VkError!void, - requestPhysicalDevices: *const fn (*Self, std.mem.Allocator) VkError!void, + requestPhysicalDevices: *const fn (*Self, std.mem.Allocator, []lib.drm.Card) VkError!void, io: *const fn (*Self) std.Io, }; @@ -144,10 +147,10 @@ pub fn enumerateExtensionProperties(layer_name: ?[]const u8, count: *u32, p_prop } pub fn enumerateVersion(version: *u32) VkError!void { - if (!builtin.is_test) { - version.* = @bitCast(root.VULKAN_VERSION); - } else { + if (comptime builtin.is_test) { version.* = @bitCast(vk.makeApiVersion(0, 1, 0, 0)); + } else { + version.* = @bitCast(root.VULKAN_VERSION); } } @@ -156,11 +159,16 @@ pub fn releasePhysicalDevices(self: *Self, allocator: std.mem.Allocator) VkError } pub fn requestPhysicalDevices(self: *Self, allocator: std.mem.Allocator) VkError!void { - try self.vtable.requestPhysicalDevices(self, allocator); + const devices = try drm.enumerateDrmPhysicalDevices(allocator, self); + defer allocator.free(devices); + + try self.vtable.requestPhysicalDevices(self, allocator, devices); + if (self.physical_devices.items.len == 0) { std.log.scoped(.vkCreateInstance).err("No VkPhysicalDevice found", .{}); return; } + for (self.physical_devices.items) |physical_device| { std.log.scoped(.vkCreateInstance).debug("Found VkPhysicalDevice named {s}", .{physical_device.object.props.device_name}); } diff --git a/src/vulkan/PhysicalDevice.zig b/src/vulkan/PhysicalDevice.zig index 3b0c4bf..737cfae 100644 --- a/src/vulkan/PhysicalDevice.zig +++ b/src/vulkan/PhysicalDevice.zig @@ -137,7 +137,7 @@ pub inline fn getSparseImageFormatProperties( return self.dispatch_table.getSparseImageFormatProperties(self, format, image_type, samples, tiling, usage, properties); } -pub fn releasePhysicalDevice(self: *Self, allocator: std.mem.Allocator) VkError!void { +pub fn release(self: *Self, allocator: std.mem.Allocator) VkError!void { self.queue_family_props.deinit(allocator); self.queue_family_props = .empty; try self.dispatch_table.release(self, allocator); diff --git a/src/vulkan/drm.zig b/src/vulkan/drm.zig new file mode 100644 index 0000000..99f4db7 --- /dev/null +++ b/src/vulkan/drm.zig @@ -0,0 +1,34 @@ +const std = @import("std"); +const drm = @import("drm"); + +const Instance = @import("Instance.zig"); +const VkError = @import("error_set.zig").VkError; + +pub fn enumerateDrmPhysicalDevices(allocator: std.mem.Allocator, instance: *Instance) VkError![]drm.Card { + const io = instance.io(); + + var devices: std.ArrayList(drm.Card) = .empty; + errdefer { + for (devices.items[0..]) |card| { + card.close(io); + } + devices.deinit(allocator); + } + + var dri_dir = std.Io.Dir.openDirAbsolute(io, drm.dir_name, .{ .iterate = true }) catch return VkError.InitializationFailed; + defer dri_dir.close(io); + + var iterator = dri_dir.iterate(); + while (iterator.next(io) catch return VkError.InitializationFailed) |entry| { + if (entry.kind != .character_device) + continue; + + const path = std.fmt.allocPrint(allocator, "{s}/{s}", .{ drm.dir_name, entry.name }) catch return VkError.OutOfHostMemory; + defer allocator.free(path); + + const card = drm.Card.open(io, path) catch continue; + devices.append(allocator, card) catch return VkError.OutOfHostMemory; + } + + return devices.toOwnedSlice(allocator) catch VkError.OutOfHostMemory; +} diff --git a/src/vulkan/lib.zig b/src/vulkan/lib.zig index 9defdfe..36a8ebf 100644 --- a/src/vulkan/lib.zig +++ b/src/vulkan/lib.zig @@ -13,6 +13,7 @@ pub const logger = @import("logger.zig"); pub const format = @import("format.zig"); pub const config = @import("config"); pub const utils = @import("utils.zig"); +pub const drm = @import("drm"); pub const Dispatchable = @import("Dispatchable.zig").Dispatchable; pub const fallback_host_allocator = @import("fallback_host_allocator.zig").fallback_host_allocator; diff --git a/src/vulkan/lib_vulkan.zig b/src/vulkan/lib_vulkan.zig index e803757..a53d92e 100644 --- a/src/vulkan/lib_vulkan.zig +++ b/src/vulkan/lib_vulkan.zig @@ -335,9 +335,10 @@ pub export fn apeCreateInstance(info: *const vk.InstanceCreateInfo, callbacks: ? var instance: *lib.Instance = undefined; if (!builtin.is_test) { - // Will call impl instead of interface as root refs the impl module + // Will call impl instead of interface as `root` refs the impl module instance = root.Instance.create(allocator, info) catch |err| return toVkResult(err); } + instance.requestPhysicalDevices(allocator) catch |err| { if (!builtin.is_test) instance.deinit(allocator) catch {}; return toVkResult(err); @@ -392,25 +393,6 @@ pub export fn apeDestroyInstance(p_instance: vk.Instance, callbacks: ?*const vk. dispatchable.destroy(allocator); } -pub export fn apeEnumeratePhysicalDevices(p_instance: vk.Instance, count: *u32, p_devices: ?[*]vk.PhysicalDevice) callconv(vk.vulkan_call_conv) vk.Result { - entryPointBeginLogTrace(.vkEnumeratePhysicalDevices); - defer entryPointEndLogTrace(); - - const instance = Dispatchable(Instance).fromHandleObject(p_instance) catch |err| return toVkResult(err); - const available = instance.physical_devices.items.len; - if (p_devices) |devices| { - const write_count = @min(count.*, available); - for (0..write_count) |i| { - devices[i] = instance.physical_devices.items[i].toVkHandle(vk.PhysicalDevice); - } - count.* = @intCast(write_count); - if (write_count < available) return .incomplete; - } else { - count.* = @intCast(available); - } - return .success; -} - pub export fn apeEnumeratePhysicalDeviceGroups(p_instance: vk.Instance, count: *u32, p_groups: ?[*]vk.PhysicalDeviceGroupProperties) callconv(vk.vulkan_call_conv) vk.Result { entryPointBeginLogTrace(.vkEnumeratePhysicalDeviceGroups); defer entryPointEndLogTrace(); @@ -445,6 +427,25 @@ pub export fn apeEnumeratePhysicalDeviceGroupsKHR(p_instance: vk.Instance, count return @call(.always_inline, apeEnumeratePhysicalDeviceGroups, .{ p_instance, count, p_groups }); } +pub export fn apeEnumeratePhysicalDevices(p_instance: vk.Instance, count: *u32, p_devices: ?[*]vk.PhysicalDevice) callconv(vk.vulkan_call_conv) vk.Result { + entryPointBeginLogTrace(.vkEnumeratePhysicalDevices); + defer entryPointEndLogTrace(); + + const instance = Dispatchable(Instance).fromHandleObject(p_instance) catch |err| return toVkResult(err); + const available = instance.physical_devices.items.len; + if (p_devices) |devices| { + const write_count = @min(count.*, available); + for (0..write_count) |i| { + devices[i] = instance.physical_devices.items[i].toVkHandle(vk.PhysicalDevice); + } + count.* = @intCast(write_count); + if (write_count < available) return .incomplete; + } else { + count.* = @intCast(available); + } + return .success; +} + // Physical Device functions ================================================================================================================================= pub export fn apeCreateDevice(p_physical_device: vk.PhysicalDevice, info: *const vk.DeviceCreateInfo, callbacks: ?*const vk.AllocationCallbacks, p_device: *vk.Device) callconv(vk.vulkan_call_conv) vk.Result {