When a surface is no longer needed, a GDI call to DrvDisableSurface informs the display driver that the surface created for the current hardware device by DrvEnableSurface is to be disabled. If the surface is tying up any resources, the driver must free them.
After the surface is disabled, GDI calls DrvDisablePDEV to inform the driver that the hardware device is no longer needed. The driver then frees any memory and resources that were allocated during the processing of DrvEnablePDEV.
Figure 5.5 shows GDI's calling sequence for disabling the video hardware.
Figure 5.5 Disabling the Video Hardware