## Display Device Driver Reference for OS/2

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

### Checklist for Palette Management Support

To enable current Windows driver palette management support in a seamless display driver, follow the steps below:

1.Make sure that the following structure is part of the PM-SL share data, that is, the PMDD_IO_STRUC structure defined in IPC.INC.

         SL_PaletteData struc

            bfPaletteIsFixed     db  ?       ;TRUE if palette manager not enabled.

            ulLastPalUpdate      dd  ?       ;Time stamp of last foreground realize.

            pHWPalette           dd  ?       ;16-bit pointer to HWPalette structure.

         SL_PaletteData ends

2.Add SEAMLESS_ESC_PALINIT function support in Windows entry Control ( lpDevice, Function, lpInData, lpOutData), do the following:

a.Claim the support of SEAMLESS_ESC_PALINIT when this function is being queried.

b.When Function = SEAMLESS_ESC_PALINIT, return the address of init_Struct- >pmdd_io.SL_PaletteData in the buffer whose address is in lpOutData.

This address, &(init_Struct->pmdd_io.SL_PaletteData), must be in 16-bit sel :offset format.

Note:

If init_Struct->pmdd_io is a 32-bit address of the PM-SL share area, you have to thunk the &(init_Struct->pmdd_io.SL_PaletteData) 32-bit address to 16-bit sel:off format, using the following algorithm:

             sel = (high word of the 32-bit address * 8) | 7
             off = the low word of the 32-bit address.

If this function is not implemented, or not correctly implemented, a General Protection Fault will occur.

3.Change Windows entry SetPalette() as follows:

       if( lpPalette != NULL ) {

         a) Request_Semaphore(..)

         b) Update the hardware palette in exactly the same way as you do in

            regular Windows driver.

         c) Clear_Semaphore(..)

       } else {

         Update the private copy of the hardware palette image if there is one being

         kept in the data segment.

       }

4.Change Windows entry UpdateColors() as follows:

Call check_hw_access() for HW_FORCEREADWRITE hardware state before any screen update.

If check_hw_access() returns Success, call request_semaphore() as you do before all hardware access and clear_semaphore() after you are done updating the screen.

5.Change check_hw_access() in IPC.ASM as follows:

Add HW_FORCEREADWRITE as one of the possible values in AL when this call is made. Here is an example of code needed to add to check_hw_access():

       check_hw_access PROC FAR

             .....

             cmp     al, HW_READWRITE        ;Request for HW_READWRITE access?

             jnz     check_forcereadwrite    ;No, go check for HW_FORCEREADWRITE

                                             ;access.

             .....

       check_forcereadwrite:

             cmp     al, HW_FORCEREADWRITE   ;Request for HW_FORCEREADWRITE access?

             jnz     check_write_access      ;No, go check for HW_WRITEONLY access.

             VWIN_ENTER_CRITSEC              ;Turn off interrupts from VWIN.

             mov     hw_virgin, HW_DOREPAINT ;Repaint when HW_READWRITE allowed.

             mov     ax, SEAMLESS_FORCEPAINT ;Paint the whole VDM.

             call    winshield_callback      ;

             VWIN_EXIT_CRITSEC               ;Turn on interrupts from VWIN.

             jmp     check_exit_bad          ;We are done. Exit.

             ....

       check_hw_access ENDP

6.Remarks

Values for symbolic names used above are as follows:

       SEAMLESS_ESC_PALINIT    equ  6010     ;Pass back address of 1st entry of the

                                             ;palette-related data in PM-SL share

                                             ;area.

       HW_FORCEREADWRITE       equ   'F'     ;Request R/W hardware state. If not

                                             ;available, ask winshield to do force

                                             ;repaint when the driver is once again

                                             ;allowed to draw the screen.