PDEV Negotiation

One of the primary responsibilities of any graphics driver is to enable a PDEV whenever a request is made by GDI. A PDEV is a logical representation of the physical device; it is defined by the driver. Refer to DrvEnablePDEV for more information on enabling PDEVs.

Through DrvEnablePDEV, the driver must provide information to GDI that describes the requested device and its capabilities. One piece of important information that the driver gives GDI is the set of GCAPS_XXX flags in flGraphicsCaps member of the DEVINFO structure.

The GCAPS flags allow GDI to determine what operations the PDEV supports. For example, GDI tests the GCAPS flags that indicate whether the PDEV can handle Bezier curves and geometric wide lines before GDI attempts to call DrvStrokePath to draw paths with these primitive types. If the GCAPS flags indicate that the PDEV cannot handle these primitive types, GDI will break down the lines or curves so it can make simpler calls to the driver.

From the driver’s side, whenever the driver gets an advanced path-related call from GDI, it can return FALSE if the path or clipping is too complex for the device to process and the function called is not one of the following that requires specific driver support:

·DrvStrokePath

·DrvPaint

·DrvTextOut

·DrvCopyBits

·DrvBitBlt

The driver cannot return FALSE from DrvStrokePath when handling a cosmetic line because the driver must handle any complex clipping or styling for cosmetic lines. However, DrvStrokePath can return FALSE if the path has Bezier curves or geometric lines. When this occurs, GDI breaks the call down to simpler calls, just as it does if the capability bits are not set. For example, if DrvStrokePath returns FALSE when it is sent a geometric line, GDI simplifies the line and calls DrvFillPath or DrvPaint.

If DrvStrokePath is to report an error, it must return DDI_ERROR.

DrvPaint and DrvTextOut can return FALSE to report an error, but not to notify GDI that the operation is too complex.

This kind of negotiation between GDI and the driver, for functions that depend on the PDEV, permits GDI and the driver to produce high quality output without excess communication.