Native Intel graphics

From OSDev.wiki
Revision as of 18:58, 11 February 2017 by osdev>Korona (Created page with "=Introduction= Intel has produced a number of graphics chips that are integrated into their chipsets and processors. Most notably modern Intel processors often come with Inte...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

Intel has produced a number of graphics chips that are integrated into their chipsets and processors. Most notably modern Intel processors often come with Intel HD graphics chips. Wikipedia contains a list of all those chips. This page explains how to drive a subset of those cards. In particular it explains how to change the graphics resolution and how to manage the hardware provided frame buffers. It does not yet explain how the GPU can be used to accelerate 2D and 3D graphics operations via shader programs.

Prerequisites

Before trying to implement a native driver for your OS make sure to understand the basics first.

  • Read the VGA Hardware page. Especially the part about display timings 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 also need to know what a pixel clock is.
  • You need to be able to access PCI configuration space and find MMIO regions that are determined by BARs.

Getting EDID via DDC

Generation 4 GMA desktop chips (aka Intel G45)

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 first BAR points to a MMIO region that contains all registers of the card. The second BAR allows access to the graphics memory.

Mode setting

Mode setting proceeds in two phases: First the display hardware needs to be deactivated. After that it can be reprogrammed and enabled again in another mode.

More specifically disabling the display hardware consists of the following steps:

  • Disable all output connectors.
  • Disable all planes. This includes the primary plane and cursor planes.
  • Disable the display pipe.
  • Disable the DPLL.

Enabling the display reverses this sequence:

  • Program the DPLL to generate a suitable pixel clock and enable it. Wait for the clock to stabilize.
  • Setup the display timings of your desired mode and enable the display pipe.
  • Set a framebuffer address and stride and enable the primary plane and all secondary planes that you wish to use.
  • Enable the output connectors.

Programming the DPLL

Programming the display pipes

Handling planes

Enabling and disabling connectors