Anonymous user
Native Intel graphics: Difference between revisions
no edit summary
[unchecked revision] | [unchecked revision] |
No edit summary |
|||
(10 intermediate revisions by 3 users not shown) | |||
Line 10:
===Prerequisites===
Before trying to implement a native driver for your OS, make sure
* Read the [[VGA Hardware]] page. Especially the part about display timings it is still relevant for modern graphics cards. You should know what horizontal/vertical active, total, sync start/end and blanking start/end values mean
* You need to be able to access [[PCI]] configuration space and find MMIO regions that are determined by BARs.
Line 39:
===Architecture overview===
G45 chips appear as devices on the PCI bus. They are identified a vendor ID of 0x8086 and a model-specific device ID. The PCI configuration space is used to access two BARs:
The chip supports two independent graphics pipelines. Each pipeline is made of the following:
Line 53:
* Intel's documentation is available [https://01.org/linuxgraphics/documentation/hardware-specification-prms here]. We are primarily interested in the [https://01.org/sites/default/files/documentation/g45_vol_3_register_0_0.pdf G45: Volume Three: Display Register] that describes the display registers. [https://01.org/sites/default/files/documentation/g45_vol_1a_core_updated.pdf G45: Volume 1a Graphics Core] documents the graphics memory interface and the PCI configuration space. The [https://01.org/sites/default/files/documentation/965_g35_vol_3_display_registers_updated.pdf G35: Volume Three: Display Registers] contains a few registers that are undocumented in the G45 manual but still must be programmed by the driver.
* The [http://lxr.free-electrons.com/source/drivers/gpu/drm/i915 i915 driver] of the Linux kernel. Almost all of the mode setting logic is in [
===Mode setting===
Line 64:
* Disable the display pipe.
* Disable the DPLL.
* Disable the legacy VGA emulation.
Enabling the display reverses this sequence:
Line 159 ⟶ 160:
Note that connectors must only be enabled or disabled while their respective pipes are enabled.
====Disabling the legacy VGA emulation====
The VGA emulation is controlled via the <code>VGACNTRL</code> register. For non-VGA modes the <code>VGA Display Disable</code> bit should be set. Likewise the <code>VGA Centering Enable</code> bits should be set to 0.
==Intel HD Graphics==
See [[Intel HD Graphics]].
==Debugging tips==
* While debugging a display driver logging messages to the screen is often not possible. Use [[Serial Ports]] instead.
* Because there are no emulators that emulate Intel graphics cards you have to test your driver on a physical machine. Make sure that you can recompile your driver and reboot your test machine with little effort. Things like [[PXE]] might help with that.
* Read the initial values of each register and ensure you understand them before you try to change the registers.
==Implementations in hobby OSs==
* [https://github.com/avdgrinten/managarm managarm] (as of commit 0e9d37c) has a G45 mode setting driver in [https://github.com/avdgrinten/managarm/blob/master/drivers/gfx/intel/src/main.cpp drivers/gfx/intel]. Note that the code makes heavy use of C++ features,
[[Category:Video]]
|