Write-Combining Memory in Video Miniport Drivers
Write-combining is a special caching mode that batches writes to the same cache line so they can be transferred in a single bus clock. This paper describes how a video miniport driver designates write-combining memory in Windows.
The information in this paper applies to display adapter drivers that follow the Windows 2000 display driver model and run on Windows 2000 and later operating systems, including Windows Vista and Windows Server 2008
Write-Combining Memory in Video Miniport Drivers
Write-combining is a special caching mode that batches writes to the same cache line so they can be transferred in a single bus clock. Although write-combining does not preserve ordering of writes, the improved performance is usually an acceptable tradeoff for frame buffers.
The information in this article applies to video miniport drivers that follow the Windows 2000 display driver model and run on Windows 2000 and later operating systems, including Windows Vista and Windows Server 2008 The information in this paper does not apply to drivers that follow the Windows Vista Display Driver Model (WDDM), which does not use the video port driver.
How a Video Miniport Driver Designates Memory as Write-Combining
A video miniport driver can designate memory as write-combining in the following ways:
For a range of system memory, a video miniport driver calls VideoPortMapMemory or VideoPortGetDeviceBase with the InIoSpace parameter set with VIDEO_MEMORY_SPACE_P6CACHE. (This flag works for both P6- and non-P6-architecture systems.)
For a range of physical addresses that the AGP controller can decode, a video miniport driver first calls VideoPortQueryServices to obtain pointers to AGP functions implemented by the video port driver, and then calls AgpReservePhysical with the Caching parameter set to VpWriteCombined and AgpReserveVirtual to map the reserved range to system memory.
The mechanism that Windows uses to enable write-combining memory depends on the processor and chipset on the system:
On systems with older processors (Pentium Pro and Pentium II processors), Windows uses the Memory Type Range Register (MTRR) settings. The MTRRs allow mapping of memory types to regions of physical address space.
On systems with newer processors (Pentium III, Pentium 4, and Intel Xeon processors), Windows uses the Page Attribute Table (PAT) extension settings. The PAT extension allows memory types to be assigned on a page-by-page basis.
On systems with chipsets that are known to perform write-combining incorrectly, Windows disables write-combining altogether. Chipsets with the following Plug and Play IDs fall into this category:
0x84CA8086
0x60100E11
0x00091166
0x00081166
0x1219103C
0x121A103C
Note A user can explicitly disable write-combining memory for any chipset through a standard display-control application that provides this capability. In Windows Server 2003, Windows XP, and Windows 2000, disabling of write-combining memory through a display-control application affects only VideoPortMapMemory, VideoPortGetDeviceBase, and kernel mapping of a memory region. It does not affect the user-mode mapping of a region or memory that is allocated through the video port driver's AGP interface.
Resources
Related topics
Display and Graphics - Architecture and Driver Support
Video Port Driver Support for AGP