Bewerken

Delen via


Using Aspect Ratio and Custom Scaling Modes

To support aspect-ratio-preserving stretched scaling and custom scaling modes available beginning with Windows 7 (where DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7), the following capabilities are added to VidPN present path data used by display miniport drivers:

Specifying Scaling Modes

The behavior and appearance of the desktop on the monitor using these scaling modes is described in Scaling the Desktop Image. When the display mode manager (DMM) calls the DxgkDdiEnumVidPnCofuncModality function, the driver must set the members of D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT according to the types of scaling that the VidPN present path supports, as follows:

Identity Scaling
If the path can display content with no transformation, set the Identity member of D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT to a nonzero value. When DxgkDdiEnumVidPnCofuncModality is called, set the Scaling member of the D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION structure to D3DKMDT_VPPS_IDENTITY.

Centered Scaling
If the path can display content unscaled and centered on the target, set D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT.Centered. When DxgkDdiEnumVidPnCofuncModality is called, set D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION.Scaling to D3DKMDT_VPPS_CENTERED.

Stretched Scaling
If the path can display content that is scaled to fit the target while not preserving the aspect ratio of the source, set D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT.Stretched. When DxgkDdiEnumVidPnCofuncModality is called, set D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION.Scaling to D3DKMDT_VPPS_STRETCHED.

Aspect-Ratio-Preserving Stretched Scaling
If the path can scale source content to fit the target while preserving the aspect ratio of the source, set D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT.AspectRatioCenteredMax. When DxgkDdiEnumVidPnCofuncModality is called, set D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION.Scaling to D3DKMDT_VPPS_ASPECTRATIOCENTEREDMAX.

Custom Scaling
If the path can display one or more scaling modes that are not described by the other D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT structure members, set D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT.Custom. When DxgkDdiEnumVidPnCofuncModality is called, set D3DKMDT_VIDPN_PRESENT_PATH_TRANSFORMATION.Scaling to D3DKMDT_VPPS_CUSTOM. Independent hardware vendors (IHVs) can use private escape values to inform the driver how to interpret custom scaling on a given target.

If the current pinned target and source modes have the same aspect ratio but are different sizes, the display miniport driver should set only the Stretched and Centered members. In this case DMM will clear any nonzero value of the AspectRatioCenteredMax member.

API to DDI Scaling

The correspondence of user-mode API scaling values to the display miniport driver DDI scaling values in the D3DKMDT_VIDPN_PRESENT_PATH_SCALING enumeration is shown in the following table.

SetDisplayConfig API Scaling Value DDI Scaling Value

DC_IDENTITY

D3DKMDT_VPPS_IDENTITY

DC_CENTERED

D3DKMDT_VPPS_CENTERED

DC_STRETCHED

D3DKMDT_VPPS_STRETCHED

DC_ASPRATIOMAX

D3DKMDT_VPPS_ASPECTRATIOCENTEREDMAX

DC_CUSTOM

D3DKMDT_VPPS_CUSTOM

DC_PREFERRED

D3DKMDT_VPPS_PREFERRED

This mapping can be used with the tables in Scaling the Desktop Image to understand how user-mode scaling types are translated into DDI scaling types that are sent to the display miniport driver.

Scaling and Driver Versions

The behavior of different display miniport driver versions running on different versions of the operating system are shown in the following table.

Driver Version Operating System Version

DXGKDDI_INTERFACE_VERSION < DXGKDDI_INTERFACE_VERSION_WIN7

and

>= DXGKDDI_INTERFACE_VERSION_VISTA

DXGKDDI_INTERFACE_VERSION >= DXGKDDI_INTERFACE_VERSION_WIN7

Windows Vista

The driver has Windows Vista behavior.

The driver must check the operating system version during initialization and should never expose or use the AspectRatioCenteredMax and Custom members of D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT. If the driver violates this requirement, DMM will ignore AspectRatioCenteredMax and Custom and will only recognize the Identity, Centered, or Stretched members. If the driver attempts to pin the D3DKMDT_VPPS_ASPECTRATIOCENTEREDMAX scaling mode on any VidPN path, DMM will return the status code STATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION and will treat this scaling mode the same as full-screen stretch mode.

Windows 7

The operating system clears the values of the AspectRatioCenteredMax and Custom members and assumes that the driver does not support aspect-ratio-preserving stretched scaling and custom scaling modes. DMM will only set scaling modes D3DKMDT_VPPS_IDENTITY, D3DKMDT_VPPS_STRETCHED, or D3DKMDT_VPPS_CENTERED. The driver behaves as on Windows Vista.

The driver should support the AspectRatioCenteredMax member, and the operating system uses it from Control Panel applications. The driver can optionally implement customized functionality by setting the Custom member.

DMM will always confirm that the driver interface >= DXGKDDI_INTERFACE_VERSION_WIN7 before it attempts to check and use the AspectRatioCenteredMax or Custom members of D3DKMDT_VIDPN_PRESENT_PATH_SCALING_SUPPORT.

Important   A display miniport driver that supports the D3DKMDT_VPPS_ASPECTRATIOCENTEREDMAX or D3DKMDT_VPPS_CUSTOM values should never set a value of D3DKMDT_VPPS_NOTSPECIFIED.

Scaling With Multiple Adapters

The values of the scaling types D3DKMDT_VPPS_ASPECTRATIOCENTEREDMAX and D3DKMDT_VPPS_CUSTOM introduced with Windows 7 are stored in the CCD connection database that is associated with a graphics processing unit (GPU). If the user moves a monitor from one GPU with a driver that supports these scaling members to another GPU, the second GPU might not be supported by the original driver. In this case the operating system will map these scaling types to the system default scaling.

If both GPUs support the scaling types D3DKMDT_VPPS_ASPECTRATIOCENTEREDMAX and D3DKMDT_VPPS_CUSTOM, and the driver for the first GPU implements the D3DKMDT_VPPS_CUSTOM custom scaling request, then if the user switches the monitor to the second GPU, the driver for the second GPU will probably not know how to interpret the custom scaling request. In this case the second driver should fail a call to the DxgkDdiCommitVidPn function and should return the STATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED status code; the operating system will map this scaling type to the system default scaling.