## Display Device Driver Reference for OS/2

[prev][next][parent][TOC]

### eddq_Escape - s3qesc.c (EDDQESC.C for XGA)

The eddq_Escape() function processes various escape functions supported by the S3 driver. One of the main uses for these escape functions is the support for full-motion video by OS/2 Multimedia. Full-motion video works by drawing directly into the frame buffer of the video device. In order to do this, MMPM/2 must obtain a pointer to the aperture of the video adapter. It then informs the driver that it is going to draw directly into a rectangular region on the display. If the aperture is smaller than the size of the memory on the video adapter, then MMPM/2 might have to switch banks while it is drawing. Finally, when it is finished, it must inform the presentation display driver that it has finished drawing onto the display. The escape functions that are required to support multimedia are:

    DEVESC_GETAPERTURE 33000l

    DEVESC_GETAPERTURE is handled by the function GetAperture(PULONG pcOutCount,
    PAPERTURE pAperture).

    What this function does is return the following structure (located in
    eddtypet.h):

    typedef struct _APERTURE {  /* aperture */
       ULONG ulPhysAddr;
       ULONG ulApertureSize;
       ULONG ulScanLineSize;
       RECTL rctlScreen;
    } APERTURE;

The ulPhysAddr data field must be set to the physical address of the aperture in memory. In the case of the S3 driver, the aperture can be the 64KB aperture at A0000, a 1MB aperture located in the 24-bit AT-bus address space, or a 4MB aperture located in the 32-bit VL-bus address space. GetAperture() calls FindS3Aperture(). FindS3Aperture searches for the aperture in a number of ways.

First, it searches the environment to see if it can find a string matching "VIDEO_APERTURE." If so, it uses the value obtained as the base address of the aperture.

If it does not find an environment variable, it looks at the size of system memory, and several S3 registers in an attempt to find the address of the aperture. It then tests the aperture, and if the test fails, it falls back to the 64KB A0000 aperture.

The ulApertureSize field must be set, in bytes, to the size of the aperture . The ulScanLineSize field must be set, in bytes, to the width of a scanline. The rctlScreen function must be set to the minimum and maximum coordinates of the visible display. For example, at 1024 x 768:

            rctlScreen.xLeft = 0;
            rctlScreen.yTop = 0;
            rctlScreen.xRight = 1023;
            rctlScreen.yBottom = 767;