Graphics Memory Reporting Through WDDM: January 9, 2006
Graphics Memory Reporting Through WDDM: January 9, 2006
through WDDM
January 9, 2006
Abstract
This white paper provides inormation a!out the reporting o graphics memory
through the Windows "ista# Disp$ay Driver Mode$ %WDDM& on systems running
the Windows "ista operating system'
The current version o this paper is maintained on the We! at(
http())www'microsot'com)whdc)device)disp$ay)graphicsmemory'msp*
Reerences and resources discussed here are $isted at the end o this paper'
Contents
+ntroduction'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ,
Graphics Memory -oncepts'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ,
Dedicated versus .hared Graphics Memory'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''',
Discrete versus +ntegrated Graphics /dapters'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''',
0+1. /$$ocation versus Driver /$$ocation'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''2
Graphics Memory Reporting !eore WDDM''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''6
Graphics Memory Reporting through WDDM''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''6
-a$cu$ation o Graphics Memory'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''3
4*amp$e 5( 2266M0 Dedicated 1n6!oard Graphics Memory on a Des7top''''''''''''''''''''''''8
4*amp$e 2( ,26M0 Dedicated 1n60oard Graphics Memory on a Mo!i$e 9-''''''''''''''''''''50
4*amp$e ,( 2266M0 .hared Graphics Memory on a Mo!i$e 9-'''''''''''''''''''''''''''''''''''''''52
Retrieving Graphics Memory "a$ues on WDDM''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''5:
Resources'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 52
Graphics Memory Reporting through WDDM - 2
Disclaimer
This is a pre$iminary document and may !e changed su!stantia$$y prior to ina$ commercia$ re$ease o the
sotware descri!ed herein'
The inormation contained in this document represents the current view o Microsot -orporation on the
issues discussed as o the date o pu!$ication' 0ecause Microsot must respond to changing mar7et
conditions, it shou$d not !e interpreted to !e a commitment on the part o Microsot, and Microsot cannot
guarantee the accuracy o any inormation presented ater the date o pu!$ication'
This White 9aper is or inormationa$ purposes on$y' M+-R1.1;T M/<4. =1 W/RR/=T+4.,
4>9R4.., +M9?+4D 1R .T/T@T1RA, /. T1 TB4 +=;1RM/T+1= += TB+. D1-@M4=T'
-omp$ying with a$$ app$ica!$e copyright $aws is the responsi!i$ity o the user' Without $imiting the rights
under copyright, no part o this document may !e reproduced, stored in or introduced into a retrieva$
system, or transmitted in any orm or !y any means %e$ectronic, mechanica$, photocopying, recording, or
otherwise&, or or any purpose, without the e*press written permission o Microsot -orporation'
Microsot may have patents, patent app$ications, trademar7s, copyrights, or other inte$$ectua$ property
rights covering su!Cect matter in this document' 4*cept as e*press$y provided in any written $icense
agreement rom Microsot, the urnishing o this document does not give you any $icense to these
patents, trademar7s, copyrights, or other inte$$ectua$ property'
@n$ess otherwise noted, the e*amp$e companies, organiDations, products, domain names, e6mai$
addresses, $ogos, peop$e, p$aces and events depicted herein are ictitious, and no association with any
rea$ company, organiDation, product, domain name, emai$ address, $ogo, person, p$ace or event is
intended or shou$d !e inerred'
E 2006 Microsot -orporation' /$$ rights reserved'
Microsot, Direct>, Windows, and Windows "ista are either registered trademar7s or trademar7s o
Microsot -orporation in the @nited .tates and)or other countries'
The names o actua$ companies and products mentioned herein may !e the trademar7s o their
respective owners'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - 3
Introduction
The new Windows "ista# Disp$ay Driver Mode$ %WDDM& !rings undamenta$
changes to the management o graphics memory in a system' The "ideo Memory
Manager component is now responsi!$e or the virtua$iDation o the graphics
memory and or hand$ing the distri!ution o avai$a!$e graphics memory to various
app$ications such as the Des7top Window Manager and others that re$y on graphics
memory' Through new Microsot Direct>F app$ication programming interace %/9+&,
the "ideo Memory Manager a$so reports the graphics memory to end users and
ma7es it avai$a!$e to other app$ications'
This white paper discusses the various types o graphics memory and the new
reporting mechanism or Windows "ista end users'
Graphics Memory Concepts
This section discusses the !asic concepts re$ated to the various types o graphics
memory and their use !y dierent c$asses o graphics hardware' These concepts
are not new or speciic to Windows "ista, !ut are important to understand in re$ation
to the reporting o graphics memory in Windows "ista'
Dedicated versus hared Graphics Memory
Graphics memory is genera$$y c$assiied into two maCor types( dedicated and
shared'
Dedicated graphics memory, as the name suggests, is memory that is avai$a!$e
or e*c$usive use !y the graphics su!system' =on6graphics app$ications and other
su!systems in the operating system cannot access this type o memory' /n
e*amp$e o dedicated graphics memory is the memory that is physica$$y present on
the GdiscreteH graphics adapter' This has !een common$y reerred to as Gon6!oardH
or G$oca$ video memoryHIthat is, c$ose to the graphics processing unit %G9@&'
Dedicated memory, however, isnJt $imited to on6!oard memory' / portion o system
memory can a$so !e dedicated to the graphics su!system' This portion o system
memory is never avai$a!$e to other su!systems or app$ications and is e*c$usive$y
owned !y the graphics su!system'
hared system memory is a portion o the system memory that can !e used !y
the graphics su!system when needed' ;or discrete graphics adapters, this type o
memory is oten reerred to as Gnon6$oca$ video memoryHIthat is, ar rom the G9@'
The shared memory is avai$a!$e to other su!systems or non6graphics app$ications
when it is not !eing used !y the graphics su!system' Thus, it is never guaranteed
to !e avai$a!$e or graphics !ecause it cou$d a$ready !e in use'
Discrete versus Integrated Graphics Adapters
The dierences !etween a GdiscreteH graphics adapter and an GintegratedH graphics
adapter can !e high$ighted in the conte*t o dedicated versus shared graphics
memory'
Discrete graphics adapters are common$y connected to the system through either
the /cce$erated Graphics 9ort %/G9&, 9-+, or 9-+ 4*press !us' Most discrete
adapters have some amount o dedicated graphics memory with a very wide and
ast $oca$ memory !us to access it, oering much !etter perormance than the
system memory'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - !
Discrete graphics adapters can a$so access and use system memory through the
/G9 or 9-+ 4*press !usIthe non6$oca$ video memory discussed ear$ier' 0ecause
system memory is accessed across the system !us, accessing it is much s$ower
than accessing $oca$ memory'
Discrete graphics adapters genera$$y share a portion o system memory with the
-9@' Typica$$y, these adapters do not as7 or dedicated use o system memory or
graphics, thus $eaving more resources avai$a!$e or the rest o the system'
;igure 5 i$$ustrates the memory su!system o a typica$ discrete graphics adapter'
"ote# The !andwidth num!ers shown in ;igure 5 can vary rom system to system
and are given as an e*amp$e to esta!$ish an order o magnitude rather than an
e*act num!er or a speciic coniguration'
$igure %& 'ypical memory subsystem (or a )CI-*+press discrete adapter
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - ,
Integrated graphics adapters have the G9@ integrated within the chipset north
!ridge' They do not have high6speed memory connected e*c$usive$y to the G9@ as
is the case o discrete graphics adapters' /n integrated graphics adapter typica$$y
uses system memory or graphics purposes' +t a$ways dedicates a portion o the
system memory to the graphics su!system to guarantee a minimum amount o
memory resource avai$a!$e to the G9@ at a$$ times, simi$ar to the discrete adapters'
+t a$so shares another portion o system memory with other non6graphics
app$ications and su!systems'
;igure 2 i$$ustrates the memory system or a typica$ integrated graphics adapter'
$igure 2& 'ypical memory subsystem (or an integrated graphics adapter
-I. Allocation versus Driver Allocation
/n integrated graphics adapter can dedicate a portion o system memory to the
graphics su!system !y using two distinct mechanisms' /$though each method
reserves a portion o the system memory, they dier in the manner in which the
avai$a!$e memory is reported to the user'
-I. allocation# /n integrated graphics adapter can reserve a dedicated portion o
the system memory during the .ystem 0+1. power6on se$6test %91.T& phase o a
system startup' This method eective$y hides a portion o the system memory rom
the operating system' Thus, the reserved memory is not reported !y the operating
system as part o avai$a!$e memory resources'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - /
;or e*amp$e, i the 0+1. reserves 226 M0 o system memory rom a computer
system with 5 G0 o insta$$ed system memory, the operating system can see and
report on$y the remaining 3686M0 memory to the user through various contro$
pane$s or through Windows /9+s'
Driver allocation# The second mechanism that an integrated graphics adapter can
use to dedicate a portion o system memory or graphics e*c$usive use is or the
graphics driver to a$$ocate that memory in its initia$iDation routine during !oot' +n this
case, the operating system sti$$ reports this graphics memory as part o the system
memory even though this memory wonJt !e shared !y the graphics driver with any
other component in the system'
Ta7ing the same e*amp$e as !eore, i the graphics driver a$$ocates 226 M0 o
memory rom a computer system with a 5 G0 o insta$$ed system memory, the
operating system wi$$ sti$$ report 5 G0 o system memory to the user and
app$ications' /$though a dierent amount o memory is reported in these two cases,
the end6user impact is sti$$ the sameIthat is, on$y 368 M0 o memory is actua$$y
avai$a!$e to the rest o the system'
Graphics Memory Reporting be(ore WDDM
9rior to Windows "ista, graphics memory was reported as a sing$e num!er through
the -ontro$ 9ane$ Display app$ication' This num!er had no technica$ merit rom an
operating system perspective' The +B" graphics driver was so$e$y responsi!$e or
providing this num!er to the operating system, which simp$y reported it to the user
through the Display app$ication'
.ome $egacy /9+s e*posed two types o memory( $oca$ and non6$oca$' Bowever,
these num!ers were se$ected !y the driver and were most$y inaccurate'
/ num!er o modern discrete adapters are mar7eted as having an amount o
memory N, with that N !eing composed o !oth on6!oard high6speed memory and
system memory' ;or e*amp$e, a discrete adapter might c$aim to have 226 M0 o
graphics memoryK however, it on$y has 6: M0 o high6speed on6!oard memory, with
592 M0 ta7en rom system memory' 4*amp$es here inc$ude /T+Js ByperMemory
and ="+D+/Js Tur!o-ache techno$ogy'
Graphics Memory Reporting through WDDM
With the introduction o Windows "ista, the operating system is putting a much
heavier $oad on the G9@ than ever !eore' 1vera$$ system perormance is now
c$ose$y associated with the graphics su!system perormance and is direct$y aected
!y the amount o avai$a!$e graphics memory' Microsot is enhancing how graphics
memory is reported, so that end users can !etter understand the actors that
direct$y impact the system perormance'
+n WDDM, the operating system can accurate$y account or each o the graphics
memory contri!utors and report avai$a!$e memory precise$y through new /9+s' The
o$$owing are some o the c$ients that use this reporting(
Windows .ystem /ssessment Too$ %Win./T& chec7s or the avai$a!$e
graphics memory and ta7es the action to turn o or turn on the 9remium /ero
G$ass e*perience !ased on the amount o avai$a!$e memory'
Des7top Windows Manager %dwm'e*e& depends on the e*act state o the
avai$a!$e graphics memory on WDDM systems'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - 0
Direct> games and other graphics app$ications or Windows "ista must !e
a!$e to get accurate va$ues descri!ing the state o the graphics memory in the
system' /n inaccurate graphics memory num!er cou$d drastica$$y change the
game e*perience or the user, or e*amp$e'
Thus, Windows "ista ena!$es the critica$$y important capa!i$ity o reporting the
correct amount o graphics memory to the end user'
The o$$owing e*amp$es show the Display app$ication and Win./T app$et reports o
avai$a!$e memory, comparing num!ers reported or dierent adapter and memory
conigurations on Windows "ista versus Windows >9'
Calculation o( Graphics Memory
This section provides a detai$ed e*p$anation o how various memory num!ers are
ca$cu$ated'
'otal system memory
Tota$ amount o system memory visi!$e to the operating system' Memory
a$$ocated !y the 0+1. doesnJt appear in that amount' ;or e*amp$e, a system
with a 56G0 D+MM with a 0+1. reserving 5 M0 o memory wi$$ appear to have
5,02, M0 o system memory'
'otal system memory available (or graphics use
Tota$ amount o system memory that can !e dedicated or shared to the G9@,
ca$cu$ated as(
Tota$.ystemMemory/vai$a!$e;orGraphics L
M/>%%Tota$.ystemMemory 6 252& ) 2&, 6:M0&
Commit limit on aperture segment
The amount o system memory that the video memory manager wi$$ a$$ow to !e
pinned down %that is, memory mapped through an aperture segment& or G9@
usage at any given instant' The tota$ amount o system memory a$$ocated or
the G9@ might e*ceed the commit $imit great$yK however, the video memory
manager wi$$ ensure that on$y up to a commit $imit amount is actua$$y resident in
an aperture segment at any one time'
0y deau$t, the commit $imit on a particu$ar aperture segment is the siDe o that
segment' The driver can speciy a dierent commit $imit when it enumerates the
segment !y using the DXGK_SEGMENTDESCRIPTOR.CommitLimit ie$d' /
commit $imit speciied in such a way app$ies on$y to the particu$ar segment
!eing enumerated'
+n addition to per segment commit $imit, there is a g$o!a$ commit $imit on a$$
aperture segment' This g$o!a$ commit $imit is a$so reerred to as shared system
memory' This va$ue is computed !y the video memory manager !ut can !e
reduced to a $ower va$ue !y the driver using the D>G<MDR+"4R-/9.'
/perture.egment-ommit?imit capa!i$ity !itsK however, this is not
recommended'
The video memory manager wi$$ not a$$ow the per segment nor the g$o!a$
commit $imit to !e vio$ated' + a particu$ar segment as a commit $imit o 5 G0 !ut
the g$o!a$ commit $imit is 226 M0, the video memory manager wi$$ not a$$ow
more than 226 M0 o system memory to !e mapped into that segment'
Dedicated video memory
.um o the siDe o a$$ memory segments that do not have the speciied
PopulatedFromSystemMemory $ags'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - 1
Dedicated system memory
.um o the siDe o a$$ memory segments that have the speciied
PopulatedFromSystemMemory $ags' The va$ue cannot !e greater than
Tota$.ystemMemory/vai$a!$e;orGraphics'
hared system memory
Ma*.hared.ystemMemory L Tota$.ystemMemory/vai$a!$e;orGraphics 6
Dedicated.ystemMemory
.hared.ystemMemory L M+=%M+=%.um1-ommit?imit1n/$$/perture.egment,
D>G<MDR+"4R-/9.'/perture.egment-ommit?imit&,
Ma*.hared.ystemMemory&
'otal video memory
Tota$"ideoMemory L Dedicated"ideoMemory N Dedicated.ystemMemory N
.hared.ystemMemory
*+ample %# 2,/-M- Dedicated .n-board Graphics Memory on a
Des2top
This e*amp$e shows an /T+ discrete graphics adapter that has 226 M0 o dedicated
on6!oard graphics memory' +t a$so shares system memory or graphics purposes'
a& Display application 3 Windo4s 5ista
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - 6
b& )er(ormance In(ormation and 'ools application 3 Windo4s 5ista
c& Display application 3 Windo4s 7)
=ote that the sing$e GMemory .iDeH num!er reported in this case is Cust the
dedicated graphics memory'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - %8
*+ample 2# 32-M- Dedicated .n--oard Graphics Memory on a
Mobile )C
This e*amp$e shows an ="+D+/ Tur!o-ache techno$ogy discrete adapter present in
a mo!i$e 9-' This adapter has some dedicated on6!oard graphics memory, !ut it
most$y shares system memory or graphics'
a& Display application 3 Windo4s 5ista
b& )er(ormance In(ormation and 'ools application 3 Windo4s 5ista
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - %%
c& Display application 3 Windo4s 7)
;or Tur!o-ache systems $i7e the one shows here, the sing$e GMemory .iDeH
num!er reported is a com!ination, !ut not a tota$, o dedicated graphics memory
and shared system memory'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - %2
*+ample 3# 2,/-M- hared Graphics Memory on a Mobile )C
This e*amp$e shows an +nte$ @M/ %@niied Memory /rchitecture& Mo!i$e part that
has no dedicated graphics memory on the mother!oardK instead, it shares system
memory or a$$ graphics purposes'
a& Display application 3 Windo4s 5ista
b& )er(ormance In(ormation and 'ools application 3 Windo4s 5ista
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - %3
c& Display application 3 Windo4s 7)
+n @M/ systems $i7e the one shown in this e*amp$e, the GMemory .iDeH num!er
reported in Windows >9 is a com!ination o the dedicated system memory and
shared system memory'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - %!
Retrieving Graphics Memory 5alues on WDDM
.otware deve$opers who create graphics app$ications can use the Direct>50 /9+ in
Windows "ista to retrieve the accurate set o graphics memory va$ues on systems
that have WDDM drivers' The o$$owing are the critica$ steps invo$ved(
%& Graphics driver model determination#
0ecause the new reporting is avai$a!$e on$y on WDDM drivers, the app$ication
must irst conirm the driver mode$ !y using the o$$owing /9+'
HasWDDMDriver()
{
LPDIRECT3DCREATE9EX pD3D9Create9Ex = NULL
HM!DULE "D3D9 = NULL
"D3D9 = L#a$Li%rar&( L'$3$9($))' )
i* ( NULL == "D3D9 ) {
ret+r, *a)se
-
..
./ Tr& t# 0reate IDire0t3D9Ex i,ter*a0e (a)s# 1,#2, as a
DX9L i,ter*a0e)( T"is i,ter*a0e 0a, #,)& %e 0reate$ i* t"e $river
is a WDDM $river(
/.
..
pD3D9Create9Ex = (LPDIRECT3DCREATE9EX) 3etPr#0A$$ress( "D3D94
'Dire0t3DCreate9Ex' )
ret+r, pD3D9Create9Ex 5= NULL
-
2& Retrieval o( graphics memory values#
/ter the driver mode$ is determined to !e WDDM, the app$ication can use the
new Direct> 50 /9+ to get the va$ues o the graphics memory' The data
structure o interest is D>G+M/D/9T4RMD4.-, which is present in d*gi'h,
inc$uded in the Direct> .otware Deve$opment <it %.D<&' This wor7s or a$$
WDDM drivers and not Cust Direct>50 parts'
t&pe$e* str+0t DX3I6ADAPTER6DE7C
{
WCHAR Des0ripti#,8 9:; <
UINT =e,$#rI$
UINT Devi0eI$
UINT 7+%7&sI$
UINT Revisi#,
7I>E6T De$i0ate$=i$e#Me?#r&
7I>E6T De$i0ate$7&ste?Me?#r&
7I>E6T 7"are$7&ste?Me?#r&
LUID A$apterL+i$
- DX3I6ADAPTER6DE7C
0ecause o the e*tensive use o graphics in the Windows "ista des7top and Direct>
games, itJs important or sotware running on Windows "ista to !e a!$e to accurate$y
determine the amount o avai$a!$e graphics memory' The Windows "ista Disp$ay
Driver Mode$ manages the virtua$iDation o graphics memory in itse$ and a$so
ensures accurate reporting o various aspects o graphics memory' /pp$ication
deve$opers and sotware vendors are encouraged to ta7e advantage o the Direct>
50 /9+ or retrieving the accurate set o graphics memory va$ues on systems that
have WDDM drivers'
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'
Graphics Memory Reporting through WDDM - %,
Resources
9ueries# + you have Ouestions that are not addressed !y this document, send
e6mai$ to direct+ : microso(t&com'
Direct7 Developer Center on MD"
http())msdn'microsot'com)direct*)deau$t'asp*
Windo4s ;ogo )rogram Re<uirements uite= 5ersion 3&8
http())www'microsot'com)whdc)win$ogo)hwreOuirements'msp*
January 9, 2006
E 2006 Microsot -orporation' /$$ rights reserved'