summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-04-08 11:31:16 +0300
committerAndrew Kaster <andrewdkaster@gmail.com>2023-02-19 15:01:01 -0700
commite393071a9bf829ac84c6fd17f0990569c2cce689 (patch)
tree6d98c68f44420dd760b3315dd76e0806ae3b85c4
parent8042ae43c339f59980ae953bbae2ea2d5a743241 (diff)
downloadserenity-e393071a9bf829ac84c6fd17f0990569c2cce689.zip
Kernel/IntelGraphics: Add Generation enum to the Definitions file
This will be used to annotate which Generation is being used for each Intel iGPU we discover.
-rw-r--r--Kernel/Graphics/Intel/Definitions.h5
-rw-r--r--Kernel/Graphics/Intel/DisplayConnectorGroup.cpp8
-rw-r--r--Kernel/Graphics/Intel/DisplayConnectorGroup.h9
-rw-r--r--Kernel/Graphics/Intel/NativeGraphicsAdapter.cpp3
4 files changed, 13 insertions, 12 deletions
diff --git a/Kernel/Graphics/Intel/Definitions.h b/Kernel/Graphics/Intel/Definitions.h
index 699a8d2231..2e3116cb47 100644
--- a/Kernel/Graphics/Intel/Definitions.h
+++ b/Kernel/Graphics/Intel/Definitions.h
@@ -10,6 +10,11 @@
namespace Kernel::IntelGraphics {
+enum class Generation {
+ Gen4,
+ Gen9,
+};
+
struct PLLSettings;
struct PLLParameterLimit {
diff --git a/Kernel/Graphics/Intel/DisplayConnectorGroup.cpp b/Kernel/Graphics/Intel/DisplayConnectorGroup.cpp
index 3106dc68fb..bc8f7b7b16 100644
--- a/Kernel/Graphics/Intel/DisplayConnectorGroup.cpp
+++ b/Kernel/Graphics/Intel/DisplayConnectorGroup.cpp
@@ -122,7 +122,7 @@ Optional<IntelGraphics::PLLSettings> IntelDisplayConnectorGroup::create_pll_sett
return {};
}
-ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> IntelDisplayConnectorGroup::try_create(Badge<IntelNativeGraphicsAdapter>, Generation generation, MMIORegion const& first_region, MMIORegion const& second_region)
+ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> IntelDisplayConnectorGroup::try_create(Badge<IntelNativeGraphicsAdapter>, IntelGraphics::Generation generation, MMIORegion const& first_region, MMIORegion const& second_region)
{
auto registers_region = TRY(MM.allocate_kernel_region(first_region.pci_bar_paddr, first_region.pci_bar_space_length, "Intel Native Graphics Registers"sv, Memory::Region::Access::ReadWrite));
// NOTE: 0x5100 is the offset of the start of the GMBus registers
@@ -132,7 +132,7 @@ ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> IntelDisplayConnectorGrou
return connector_group;
}
-IntelDisplayConnectorGroup::IntelDisplayConnectorGroup(Generation generation, NonnullOwnPtr<GMBusConnector> gmbus_connector, NonnullOwnPtr<Memory::Region> registers_region, MMIORegion const& first_region, MMIORegion const& second_region)
+IntelDisplayConnectorGroup::IntelDisplayConnectorGroup(IntelGraphics::Generation generation, NonnullOwnPtr<GMBusConnector> gmbus_connector, NonnullOwnPtr<Memory::Region> registers_region, MMIORegion const& first_region, MMIORegion const& second_region)
: m_mmio_first_region(first_region)
, m_mmio_second_region(second_region)
, m_assigned_mmio_registers_region(m_mmio_first_region)
@@ -172,7 +172,7 @@ ErrorOr<void> IntelDisplayConnectorGroup::initialize_connectors()
// NOTE: Intel Graphics Generation 4 is pretty ancient beast, and we should not
// assume we can find a VBT for it. Just initialize the (assumed) CRT connector and be done with it.
- if (m_generation == Generation::Gen4) {
+ if (m_generation == IntelGraphics::Generation::Gen4) {
TRY(initialize_gen4_connectors());
} else {
VERIFY_NOT_REACHED();
@@ -232,7 +232,7 @@ ErrorOr<void> IntelDisplayConnectorGroup::set_mode_setting(IntelNativeDisplayCon
DisplayConnector::ModeSetting actual_mode_setting = mode_setting;
actual_mode_setting.horizontal_stride = actual_mode_setting.horizontal_active * sizeof(u32);
VERIFY(actual_mode_setting.horizontal_stride != 0);
- if (m_generation == Generation::Gen4) {
+ if (m_generation == IntelGraphics::Generation::Gen4) {
TRY(set_gen4_mode_setting(connector, actual_mode_setting));
} else {
VERIFY_NOT_REACHED();
diff --git a/Kernel/Graphics/Intel/DisplayConnectorGroup.h b/Kernel/Graphics/Intel/DisplayConnectorGroup.h
index db14ab4414..d9024454bc 100644
--- a/Kernel/Graphics/Intel/DisplayConnectorGroup.h
+++ b/Kernel/Graphics/Intel/DisplayConnectorGroup.h
@@ -25,9 +25,6 @@ class IntelDisplayConnectorGroup : public RefCounted<IntelDisplayConnectorGroup>
friend class IntelNativeGraphicsAdapter;
public:
- enum class Generation {
- Gen4,
- };
struct MMIORegion {
enum class BARAssigned {
BAR0,
@@ -47,13 +44,13 @@ private:
};
public:
- static ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> try_create(Badge<IntelNativeGraphicsAdapter>, Generation, MMIORegion const&, MMIORegion const&);
+ static ErrorOr<NonnullLockRefPtr<IntelDisplayConnectorGroup>> try_create(Badge<IntelNativeGraphicsAdapter>, IntelGraphics::Generation, MMIORegion const&, MMIORegion const&);
ErrorOr<void> set_safe_mode_setting(Badge<IntelNativeDisplayConnector>, IntelNativeDisplayConnector&);
ErrorOr<void> set_mode_setting(Badge<IntelNativeDisplayConnector>, IntelNativeDisplayConnector&, DisplayConnector::ModeSetting const&);
private:
- IntelDisplayConnectorGroup(Generation generation, NonnullOwnPtr<GMBusConnector>, NonnullOwnPtr<Memory::Region> registers_region, MMIORegion const&, MMIORegion const&);
+ IntelDisplayConnectorGroup(IntelGraphics::Generation generation, NonnullOwnPtr<GMBusConnector>, NonnullOwnPtr<Memory::Region> registers_region, MMIORegion const&, MMIORegion const&);
ErrorOr<void> set_mode_setting(IntelNativeDisplayConnector&, DisplayConnector::ModeSetting const&);
@@ -95,7 +92,7 @@ private:
const MMIORegion m_mmio_second_region;
MMIORegion const& m_assigned_mmio_registers_region;
- const Generation m_generation;
+ const IntelGraphics::Generation m_generation;
NonnullOwnPtr<Memory::Region> m_registers_region;
NonnullOwnPtr<GMBusConnector> m_gmbus_connector;
};
diff --git a/Kernel/Graphics/Intel/NativeGraphicsAdapter.cpp b/Kernel/Graphics/Intel/NativeGraphicsAdapter.cpp
index 7252417033..eee9fab920 100644
--- a/Kernel/Graphics/Intel/NativeGraphicsAdapter.cpp
+++ b/Kernel/Graphics/Intel/NativeGraphicsAdapter.cpp
@@ -54,10 +54,9 @@ ErrorOr<void> IntelNativeGraphicsAdapter::initialize_adapter()
PCI::enable_io_space(device_identifier());
PCI::enable_memory_space(device_identifier());
- using Generation = IntelDisplayConnectorGroup::Generation;
switch (device_identifier().hardware_id().device_id) {
case 0x29c2:
- m_connector_group = TRY(IntelDisplayConnectorGroup::try_create({}, Generation::Gen4, first_region, second_region));
+ m_connector_group = TRY(IntelDisplayConnectorGroup::try_create({}, IntelGraphics::Generation::Gen4, first_region, second_region));
return {};
default:
return Error::from_errno(ENODEV);