title: Graphics driver "hello world" example?
body: <p>What are the steps necessary to create a GPU driver that render pixels on a display? Basically just the simplest "hello world" example of creating a GPU driver, such as turning the screen red or just showing a single pixel. Where do you start?</p>
  
  <p>I would like to hack on the GPU directly, without any C or OpenGL abstraction or any of that. I am using Mac OSX, and I think I have the Intel HD i7 graphics card, so <a href="http://renderingpipeline.com/graphics-literature/low-level-gpu-documentation/">these docs</a> seemed like a good fit:</p>
  
  <ul>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol1_Part1r2.pdf">Volume 1 Part 1: Graphics Core</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol1_Part2r2.pdf">Volume 1 Part 2: Graphics Core – MMIO, Media Registers &amp; Programming Environment</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol1_Part3r2.pdf">Volume 1 Part 3: Graphics Core – Memory Interface and Commands Render Engine</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol1_Part4r2.pdf">Volume 1 Part 4: Graphics Core – Video Codec Engine</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol1_Part5r2.pdf">Volume 1 Part 5: Graphics Core – Blitter Engine</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol2_Part1r2.pdf">Volume 2 Part 1: 3D/Media – 3D Pipeline</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol2_Part2r2.pdf">Volume 2 Part 2: 3D/Media – Media</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol3_Part1r2.pdf">Volume 3 Part 1: Display Registers – VGA Registers</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol3_Part2r2.pdf">Volume 3 Part 2: Display Registers – CPU Registers</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol3_Part3r2.pdf">Volume 3 Part 3: PCH Display Registers</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol4_Part1r2.pdf">Volume 4 Part 1: Subsystem and Cores – Shared Functions</a></li>
  <li><a href="http://files.renderingpipeline.com/gpudocs/intel/hd/IHD_OS_Vol4_Part2_July_28_10.pdf">Volume 4 Part 2: Subsystem and Cores – Message Gateway, URB, Video Motion, and IS</a></li>
  </ul>
  
  <p>The Mesa3D project says that there are a number of open source graphics drivers, and Wikipedia says that Intel produces these docs so that you can write an open source driver if you want, but don't explain how.</p>
  
  <p>I also came across <a href="https://github.com/jagregory/abrash-black-book">Michael Abrash's Graphics Programming Black Book</a>, which explains a lot.</p>
  
  <p>However that is a bit much to bite off all at once. And there doesn't seem to be any information on how to get started hacking on a GPU driver, a "hello world" project.</p>
  
  <p>For example:</p>
  
  <ul>
  <li>To learn assembly, you can just <code>brew install nasm</code>, write some assembly, compile, and run it to print "hello world".</li>
  <li>To learn Arduino, you can plug in an Arduino board into your computer via a USB cable, install their software, and upload some C code directly to the board and run it, to show a blinking LED light.</li>
  </ul>
  
  <p>How do you do that same sort of thing for the graphics card?</p>
  
  <p><em>The hello world example doesn't necessarily have to work (though that would be cool if it did!); even just outlining what it would take in a higher-level/practical sense would be helpful. If it's not possible on a Mac, or even on Linux, that would be good to know. But even then the question remains, where do you start in writing a graphics driver?</em></p>