From d18d91dedc64c29a4a44f6d5d2073d9c65f8295a Mon Sep 17 00:00:00 2001 From: Liav A Date: Sat, 29 May 2021 17:01:52 +0300 Subject: [PATCH] Kernel/Graphics: Add a proper method to check if Intel GPU is supported --- Kernel/Graphics/IntelNativeGraphicsAdapter.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Kernel/Graphics/IntelNativeGraphicsAdapter.cpp b/Kernel/Graphics/IntelNativeGraphicsAdapter.cpp index 2e1b98bc79..89d1e0278a 100644 --- a/Kernel/Graphics/IntelNativeGraphicsAdapter.cpp +++ b/Kernel/Graphics/IntelNativeGraphicsAdapter.cpp @@ -25,13 +25,26 @@ static constexpr IntelNativeGraphicsAdapter::PLLMaxSettings G35Limits { { 5, 10 } // p2 }; +static constexpr u16 supported_models[] { + { 0x29c2 }, // Intel G35 Adapter +}; + +static bool is_supported_model(u16 device_id) +{ + for (auto& id : supported_models) { + if (id == device_id) + return true; + } + return false; +} + #define DDC2_I2C_ADDRESS 0x50 RefPtr IntelNativeGraphicsAdapter::initialize(PCI::Address address) { auto id = PCI::get_id(address); VERIFY(id.vendor_id == 0x8086); - if (id.device_id != 0x29c2) + if (!is_supported_model(id.device_id)) return {}; return adopt_ref(*new IntelNativeGraphicsAdapter(address)); }