On 10 Jan 2001, Alexandre Julliard wrote:

> Ove Kaaven <[EMAIL PROTECTED]> writes:
> 
> > I've been thinking about going about all this in a different way. Instead
> > of loading up dlls/ddraw with driver-dependent code, perhaps we should
> > consider driver separation not only in dsound (like it's done now, with
> > IDsDriver in the wineoss driver), and like I want to do with dinput
> > (IDiDriver in winmm's joystick driver etc), but also in ddraw?
> > 
> > So the x11drv (and any future graphics drivers) would export a
> > IDdDriver-or-whatever-it's-called COM interface, that dlls/ddraw could
> > then build upon, just like in windoze. All the DGA, DXGrab, and GLX code
> > would then have to be moved into the x11drv, obviously, so it'd be a lot
> > of work, but it'd certainly give us some advantages as well...
> 
> If there are defined COM interfaces that allow doing this, then yes
> that would definitely be a good thing.

I've looked at the DDK, and it seems that whoever designed DirectDraw/3D
weren't the same guys that designed DirectSound. There isn't exactly a COM
interface, rather the HAL interface is a range of C structures and
callbacks (although GUIDs and vtables seem to be referenced here and
there), e.g.

typedef struct _DDHAL_DDCALLBACKS
{
    DWORD            dwSize;
    DWORD            dwFlags;
    LPDDHAL_DESTROYDRIVER    DestroyDriver;
    LPDDHAL_CREATESURFACE    CreateSurface;
    LPDDHAL_SETCOLORKEY      SetColorKey;
    LPDDHAL_SETMODE      SetMode;
    LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank;
    LPDDHAL_CANCREATESURFACE     CanCreateSurface;
    LPDDHAL_CREATEPALETTE    CreatePalette;
    LPDDHAL_GETSCANLINE      GetScanLine;
    // *** New fields for DX2 *** //
    LPDDHAL_SETEXCLUSIVEMODE     SetExclusiveMode;
    LPDDHAL_FLIPTOGDISURFACE     FlipToGDISurface;
} DDHAL_DDCALLBACKS;

typedef struct _DDHAL_DDSURFACECALLBACKS
{
    DWORD               dwSize;
    DWORD               dwFlags;
    LPDDHALSURFCB_DESTROYSURFACE    DestroySurface;
    LPDDHALSURFCB_FLIP          Flip;
    LPDDHALSURFCB_SETCLIPLIST       SetClipList;
    LPDDHALSURFCB_LOCK          Lock;
    LPDDHALSURFCB_UNLOCK        Unlock;
    LPDDHALSURFCB_BLT           Blt;
    LPDDHALSURFCB_SETCOLORKEY       SetColorKey;
    LPDDHALSURFCB_ADDATTACHEDSURFACE    AddAttachedSurface;
    LPDDHALSURFCB_GETBLTSTATUS      GetBltStatus;
    LPDDHALSURFCB_GETFLIPSTATUS     GetFlipStatus;
    LPDDHALSURFCB_UPDATEOVERLAY     UpdateOverlay;
    LPDDHALSURFCB_SETOVERLAYPOSITION    SetOverlayPosition;
    LPVOID              reserved4;
    LPDDHALSURFCB_SETPALETTE        SetPalette;
} DDHAL_DDSURFACECALLBACKS;

The display driver uses the following structure to register itself with
DirectDraw.

typedef struct _DDHALINFO
{
    DWORD                       dwSize;
    LPDDHAL_DDCALLBACKS         lpDDCallbacks;      // direct draw object callbacks
    LPDDHAL_DDSURFACECALLBACKS  lpDDSurfaceCallbacks;   // surface object callbacks
    LPDDHAL_DDPALETTECALLBACKS  lpDDPaletteCallbacks;   // palette object callbacks
    VIDMEMINFO                  vmiData;        // video memory info
    DDCORECAPS                  ddCaps;         // core hw specific caps
    DWORD                       dwMonitorFrequency; // monitor frequency in current 
mode
    LPDDHAL_GETDRIVERINFO       GetDriverInfo;          // callback to get arbitrary 
vtable from driver
    DWORD                       dwModeIndex;        // current mode: index into array
    LPDWORD                     lpdwFourCC;     // fourcc codes supported
    DWORD                       dwNumModes;     // number of modes supported
    LPDDHALMODEINFO             lpModeInfo;     // mode information
    DWORD                       dwFlags;        // create flags
    LPVOID                      lpPDevice;      // physical device ptr
    DWORD                       hInstance;      // instance handle of driver
    //------- Fields added in Version 2.0 -------
    ULONG_PTR                    lpD3DGlobalDriverData;  // D3D global Data
    ULONG_PTR                   lpD3DHALCallbacks;  // D3D callbacks
    LPDDHAL_DDEXEBUFCALLBACKS   lpDDExeBufCallbacks;    // Execute buffer pseudo 
object callbacks
} DDHALINFO;

What do you think?


Reply via email to