Commit 71c69849 authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Implemented DirectDraw's Hardware Abstraction Layer (HAL) interface.

Disabled DirectDraw's old XVidMode and DGA2 drivers, it now depends on the display driver (x11drv) HAL implementations of these features.
parent 9bebbc5d
......@@ -24,15 +24,18 @@ C_SRCS = \
convert.c \
dclipper/main.c \
ddraw/dga2.c \
ddraw/hal.c \
ddraw/main.c \
ddraw/thunks.c \
ddraw/user.c \
ddraw/xvidmode.c \
dpalette/hal.c \
dpalette/main.c \
dsurface/dga2.c \
dsurface/dib.c \
dsurface/fakezbuffer.c \
dsurface/gamma.c \
dsurface/hal.c \
dsurface/main.c \
dsurface/thunks.c \
dsurface/user.c \
......
/* Copyright 2001 TransGaming Technologies, Inc. */
#ifndef WINE_DDRAW_DDRAW_HAL_H_INCLUDED
#define WINE_DDRAW_DDRAW_HAL_H_INCLUDED
#define HAL_DDRAW_PRIV(ddraw) \
((HAL_DirectDrawImpl*)((ddraw)->private))
#define HAL_DDRAW_PRIV_VAR(name,ddraw) \
HAL_DirectDrawImpl* name = HAL_DDRAW_PRIV(ddraw)
typedef struct
{
DWORD next_vofs;
} HAL_DirectDrawImpl_Part;
typedef struct
{
User_DirectDrawImpl_Part user;
HAL_DirectDrawImpl_Part hal;
} HAL_DirectDrawImpl;
void HAL_DirectDraw_final_release(IDirectDrawImpl* This);
HRESULT HAL_DirectDraw_create_primary(IDirectDrawImpl* This,
const DDSURFACEDESC2* pDDSD,
LPDIRECTDRAWSURFACE7* ppSurf,
LPUNKNOWN pOuter);
HRESULT HAL_DirectDraw_create_backbuffer(IDirectDrawImpl* This,
const DDSURFACEDESC2* pDDSD,
LPDIRECTDRAWSURFACE7* ppSurf,
LPUNKNOWN pOuter,
IDirectDrawSurfaceImpl* primary);
HRESULT HAL_DirectDraw_create_texture(IDirectDrawImpl* This,
const DDSURFACEDESC2* pDDSD,
LPDIRECTDRAWSURFACE7* ppSurf,
LPUNKNOWN pOuter,
DWORD dwMipMapLevel);
HRESULT HAL_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex);
HRESULT HAL_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
IUnknown* pUnkOuter, BOOL ex);
HRESULT WINAPI
HAL_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
LPDDDEVICEIDENTIFIER2 pDDDI,
DWORD dwFlags);
HRESULT WINAPI
HAL_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
DWORD dwHeight, DWORD dwBPP,
DWORD dwRefreshRate, DWORD dwFlags);
HRESULT WINAPI
HAL_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface);
#endif
/* DirectDrawPalette HAL driver
*
* Copyright 2001 TransGaming Technologies Inc.
*/
#include "config.h"
#include "winerror.h"
#include "debugtools.h"
#include <assert.h>
#include <string.h>
#include "ddraw_private.h"
#include "dpalette/main.h"
#include "dpalette/hal.h"
#include "ddraw/main.h"
DEFAULT_DEBUG_CHANNEL(ddraw);
static ICOM_VTABLE(IDirectDrawPalette) DDRAW_HAL_Palette_VTable;
/******************************************************************************
* IDirectDrawPalette
*/
HRESULT HAL_DirectDrawPalette_Construct(IDirectDrawPaletteImpl* This,
IDirectDrawImpl* pDD, DWORD dwFlags)
{
LPDDRAWI_DIRECTDRAW_GBL dd_gbl = pDD->local.lpGbl;
DDHAL_CREATEPALETTEDATA data;
HRESULT hr;
hr = Main_DirectDrawPalette_Construct(This, pDD, dwFlags);
if (FAILED(hr)) return hr;
This->final_release = HAL_DirectDrawPalette_final_release;
ICOM_INIT_INTERFACE(This, IDirectDrawPalette, DDRAW_HAL_Palette_VTable);
/* initialize HAL palette */
data.lpDD = dd_gbl;
data.lpDDPalette = &This->global;
data.lpColorTable = NULL;
data.ddRVal = 0;
data.CreatePalette = dd_gbl->lpDDCBtmp->HALDD.CreatePalette;
if (data.CreatePalette)
data.CreatePalette(&data);
return DD_OK;
}
HRESULT
HAL_DirectDrawPalette_Create(IDirectDrawImpl* pDD, DWORD dwFlags,
LPDIRECTDRAWPALETTE* ppPalette,
LPUNKNOWN pUnkOuter)
{
IDirectDrawPaletteImpl* This;
HRESULT hr;
if (pUnkOuter != NULL)
return CLASS_E_NOAGGREGATION; /* unchecked */
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
if (This == NULL) return E_OUTOFMEMORY;
hr = HAL_DirectDrawPalette_Construct(This, pDD, dwFlags);
if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, This);
else
*ppPalette = ICOM_INTERFACE(This, IDirectDrawPalette);
return hr;
}
HRESULT WINAPI
HAL_DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
DWORD dwStart, DWORD dwCount,
LPPALETTEENTRY palent)
{
ICOM_THIS(IDirectDrawPaletteImpl,iface);
LPDDRAWI_DIRECTDRAW_GBL dd_gbl = This->local.lpDD_lcl->lpGbl;
DDHAL_SETENTRIESDATA data;
TRACE("(%p)->SetEntries(%08lx,%ld,%ld,%p)\n",This,dwFlags,dwStart,dwCount,
palent);
data.lpDD = dd_gbl;
data.lpDDPalette = &This->global;
data.dwBase = dwStart;
data.dwNumEntries = dwCount;
data.lpEntries = palent;
data.ddRVal = 0;
data.SetEntries = dd_gbl->lpDDCBtmp->HALDDPalette.SetEntries;
if (data.SetEntries)
data.SetEntries(&data);
return Main_DirectDrawPalette_SetEntries(iface, dwFlags, dwStart, dwCount, palent);
}
void HAL_DirectDrawPalette_final_release(IDirectDrawPaletteImpl* This)
{
LPDDRAWI_DIRECTDRAW_GBL dd_gbl = This->local.lpDD_lcl->lpGbl;
DDHAL_DESTROYPALETTEDATA data;
/* destroy HAL palette */
data.lpDD = dd_gbl;
data.lpDDPalette = &This->global;
data.ddRVal = 0;
data.DestroyPalette = dd_gbl->lpDDCBtmp->HALDDPalette.DestroyPalette;
if (data.DestroyPalette)
data.DestroyPalette(&data);
Main_DirectDrawPalette_final_release(This);
}
static ICOM_VTABLE(IDirectDrawPalette) DDRAW_HAL_Palette_VTable =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
Main_DirectDrawPalette_QueryInterface,
Main_DirectDrawPalette_AddRef,
Main_DirectDrawPalette_Release,
Main_DirectDrawPalette_GetCaps,
Main_DirectDrawPalette_GetEntries,
Main_DirectDrawPalette_Initialize,
HAL_DirectDrawPalette_SetEntries
};
/* Copyright 2000-2001 TransGaming Technologies Inc. */
#ifndef WINE_DDRAW_DPALETTE_HAL_H_INCLUDED
#define WINE_DDRAW_DPALETTE_HAL_H_INCLUDED
HRESULT HAL_DirectDrawPalette_Construct(IDirectDrawPaletteImpl* This,
IDirectDrawImpl* pDD, DWORD dwFlags);
void HAL_DirectDrawPalette_final_release(IDirectDrawPaletteImpl* This);
HRESULT
HAL_DirectDrawPalette_Create(IDirectDrawImpl* pDD, DWORD dwFlags,
LPDIRECTDRAWPALETTE* ppPalette,
LPUNKNOWN pUnkOuter);
HRESULT WINAPI
HAL_DirectDrawPalette_SetEntries(LPDIRECTDRAWPALETTE iface, DWORD dwFlags,
DWORD dwStart, DWORD dwCount,
LPPALETTEENTRY palent);
#endif
/* Copyright 2000-2001 TransGaming Technologies Inc. */
#ifndef DDRAW_DSURFACE_HAL_H_INCLUDED
#define DDRAW_DSURFACE_HAL_H_INCLUDED
#define HAL_PRIV(surf) ((HAL_DirectDrawSurfaceImpl*)((surf)->private))
#define HAL_PRIV_VAR(name,surf) \
HAL_DirectDrawSurfaceImpl* name = HAL_PRIV(surf)
struct HAL_DirectDrawSurfaceImpl_Part
{
DWORD need_late;
LPVOID fb_addr;
DWORD fb_pitch, fb_vofs;
};
typedef struct
{
struct DIB_DirectDrawSurfaceImpl_Part dib;
struct User_DirectDrawSurfaceImpl_Part user;
struct HAL_DirectDrawSurfaceImpl_Part hal;
} HAL_DirectDrawSurfaceImpl;
HRESULT
HAL_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl* This,
IDirectDrawImpl* pDD,
const DDSURFACEDESC2* pDDSD);
HRESULT
HAL_DirectDrawSurface_Create(IDirectDrawImpl *pDD,
const DDSURFACEDESC2 *pDDSD,
LPDIRECTDRAWSURFACE7 *ppSurf,
IUnknown *pUnkOuter);
void HAL_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This);
HRESULT HAL_DirectDrawSurface_late_allocate(IDirectDrawSurfaceImpl* This);
void HAL_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal);
void HAL_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal,
DWORD dwStart, DWORD dwCount,
LPPALETTEENTRY palent);
HRESULT HAL_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This,
LPDIRECTDRAWSURFACE7* ppDup);
void HAL_DirectDrawSurface_lock_update(IDirectDrawSurfaceImpl* This,
LPCRECT pRect);
void HAL_DirectDrawSurface_unlock_update(IDirectDrawSurfaceImpl* This,
LPCRECT pRect);
BOOL HAL_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back,
DWORD dwFlags);
void HAL_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This,
DWORD dwFlags);
HWND HAL_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This);
#endif
......@@ -2,7 +2,7 @@
*
* Copyright 1997-1999 Marcus Meissner
* Copyright 1998 Lionel Ulmer (most of Direct3D stuff)
* Copyright 2000 TransGaming Technologies Inc.
* Copyright 2000-2001 TransGaming Technologies Inc.
*
* This file contains the (internal) driver registration functions,
* driver enumeration APIs and DirectDraw creation functions.
......@@ -479,15 +479,9 @@ BOOL WINAPI DDRAW_DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
/* If we were sufficiently cool, DDraw drivers would just be COM
* objects, registered with a particular component category. */
DDRAW_HAL_Init(hInstDLL, fdwReason, lpv);
DDRAW_User_Init(hInstDLL, fdwReason, lpv);
#ifdef HAVE_LIBXXF86VM
DDRAW_XVidMode_Init(hInstDLL, fdwReason, lpv);
#endif
#ifdef HAVE_LIBXXF86DGA2
DDRAW_XF86DGA2_Init(hInstDLL, fdwReason, lpv);
#endif
if (DDRAW_num_drivers > 0)
DDRAW_default_driver = DDRAW_ChooseDefaultDriver();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment