## Display Device Driver Reference for OS/2

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

### Using the Accelerator Function Between PM and WIN-OS2

When both your PM display driver and your WIN-OS/2 seamless display driver use the graphic accelerator function, you need a proper semaphore control.

The supplement file HWS2S.BLT is the sample for BitBlt handling using hardware assist. HWS2S.BLT is in the \DDK_x86\SRC_DBCS\SEAMLESS directory. The WIN-OS2 display driver should wait until the RAM semaphore pmdd_screen_ busy is not zero before doing BitBlt handling. (The pmdd_screen_busy sempahore is common to the PM display driver and the WIN-OS2 display driver .) After BitBlt handling completes, the hardware-busy flag is set to let the PM display driver use the hardware assist.

It is possible to make a semaphore common to the PM driver and the WIN-OS/2 driver as shown in the sample that follows, where the pmdd_screen_busy semaphore is in the structure PMDD_IO in IPC.INC for the WIN-OS2 driver and in the structure _SM_WINDRV for the PM driver. The sample shows "pmdd_ screen_busy" in a shared RAM area between the PM driver and the WIN-OS2 driver.

Shared RAM Area of PM side (in \DDK_x86\SRC_DBCS\VGA32\VGAINC\SEAMLESS.INC file):

     _SM_WINDRV      struct
         signature           db  "VG01" ; string to synchronize interface to VDM
         exclude             dd  ?      ; pointer to cursor far_exclude() function
         .
         .
         .
         ulLastPalUpdate     dd  ?      ; time stamp of last palette update
         pHWPalette          dd  ?      ; 16:16 ptr to copy of PM driver
    HWPalette

         pmdd_screen_busy    dd  ?      ; 16:16 ptr of screen_busy.
    <==SEMAPHORE      .
         .
     _SM_WINDRV      ends

Shared RAM Area of WIN-OS2 side (in IPC.INC file):

     PMDD_IO  struc
         signature           dd  ?       ; 4bytes to synch interface to PMDD
         pfexclude           dd  ?       ; ptr to PMDD's exclude() function
         .
         .
         .
         ulLastPalUpdate     dd  ?       ; time stamp of last palette update
         pHWPalette          dd  ?       ; 16:16 ptr to copy of PM's HWPalette

         pmdd_screen_busy    dd  ?       ; 16:16 ptr of screen_busy. <==SEMAPHORE
         .
     PMDD_IO  ends

By using the pmdd_screen_busy semaphore field, you can implement exclusive access of the accelerator function as follows:

           .
           .
           .
           mov     ax,DataBASE
           mov     ds,ax
           assumes ds,Data
           lds     si,init_struct.pmdd_io
           lds     si, [si].pmdd_screen_busy
           xor     ax, ax
    @@:
           xchg    al, [si]         ; Get the access right.
           or      al, al                     ; Check
           jz      @B                         ; If 1 then OK, else loop.
           .
           .
           .
         ********************************
         * Access Accelerator Function  *
         ********************************
           .
           .
           .
           mov     byte ptr [si], 1 ; Release the access right.