As promised, the following details, on a patch by patch basis, how support for a new asic is added to the radeon drm. This post covers the patches in http://people.freedesktop.org/~agd5f/evergreen_kms/set1/ which add basic modesetting support for evergreen asics.
0001 is just a cleanup of atombios.h to make merging upstream changes easier. 0002 brings in the atombios.h changes needed for evergreen asics. The atombios rom on evergreen asics has updated data and command tables and this patch adds the definitions needed for properly using those tables.
0003 adds the chip family enums used in the driver. The chip family is set based on the pci id and is used to differentiate between different asic families in the driver. All evergreen chips have a common display block (called DCE version 4). This patch also adds a convenience macro, ASIC_IS_DCE4. This is mainly used in the modesetting code to select the appropriate code paths for evergreen chips.
0004 adds the modesetting register definitions that will be used in later patches.
0005 is the initial evergreen support patch. It adds a new file, evergreen.c, that has the evergreen specific asic functions defined in it. At this point all that is implemented is support for setting up the MC (memory controller) and setting the proper number of crtcs (6 rather than 2 as on previous asics). There is still no modesetting support yet.
0006 disables the vblank support functions in the crtc dpms code for evergreen asics (note the use of the ASIC_IS_DCE4 macro). These are disabled for now as the driver does not implement interrupt support at this point (interrupt support is added in patch set2, I’ll go into that in a future post). Leaving them enabled without support for vblank interrupts would result in a potential hang when that code is called.
0007 adds support for the evergreen crtc color lookup tables. These tables are used to adjust the colors sent from the crtc to the monitor. They are the mechanism used to implement support for gamma correction using xgamma or xrandr.
0008 adds support for evergreen hardware cursors. Hardware cursors are a special image that gets blended into the data stream sent from the crtc to the monitor. Hardware cursors are not actually drawn on the framebuffer, rather they are drawn to a separate buffer and blended into the framebuffer data stream at the position specified.
0009 adds support for setting the non-timing related aspects of the crtc: base address, x/y offset, pitch, and data format. The base address specifies the location in vram where the crtc will be reading data out of to be sent to the monitor. For multi-head, each crtc points to a different location in vram; for clone modes, each crtc points to the same location. The data format defines the number of bits per pixel and the ordering of the channels (32 bits per pixel, 8 bits per channel, ARGB ordering for example). The pitch is the width of the buffer the crtc is scanning out of. Pitch is used to tell the crtc where the next scanline begins. Finally the x/y offset is used to implement things like virtual desktops (i.e., the mode on your monitor is like a window looking into a larger desktop; when you move the cursor to the edge of the window, the window moves to show the rest of the desktop). It’s basically an offset that’s added to the base address so that the crtc will scan out a slightly different location in vram.
Additionally this patch selects the proper crtc timing command table to use. The crtc timing and scaler setup command table parameter structures did not have any major changes for evergreen, so the existing code could be used for them.
0010 adds atombios support for digital encoders (TMDS, HDMI, LVDS, DisplayPort). The digital encoder and transmitter control table parameters changed to accommodate changes in the hardware. The new parameter formats were added in atombios.h updates in patch 0002. This patch sets up the new parameters properly so that the digital outputs can be properly enabled and disabled. The analog encoder table parameters did not change for evergreen, so there is nothing to change for evergreen.
The PLLs used for the crtc and transmitter clocks need to be adjusted in some cases. This can include making changes to the requested clock itself, or specifying certain restrictions when selecting the PLL dividers. 0011 adds evergreen support to the PLL adjust function.
0012 adds support for actually programming the display PLLs. As I mentioned previously, the PLL setup is fairly complex on evergreen in order to support up to 6 independent monitors. This patch adds support for changes in the SetPixelClock command table parameters as well as general infrastructure changes to handle PLL allocation properly.
Finally 0013 adds the new evergreen PCI ids. With the ids added, the driver will now load on evergreen hardware.
That covers basic modesetting support. The next set, http://people.freedesktop.org/~agd5f/evergreen_kms/set2/ focuses on the infrastructure needed to support acceleration. I’ll cover that in a future post.