Surfaces are allocated by the driver at initialization time (for the frame buffer and possibly the cursor), when brushes are being realized, and as a result of GDI calling DrvCreateDeviceBitmap. Surface allocation within the driver is implemented by the required method GPE::AllocSurface.