Removed a few obsolete files.

This commit is contained in:
Alexandre Julliard 2001-04-18 17:41:07 +00:00
parent c14bed35f6
commit b735928ba1
7 changed files with 0 additions and 1227 deletions

View File

@ -23,15 +23,12 @@ C_SRCS = \
@OPENGLFILES@ \
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 \

View File

@ -1,435 +0,0 @@
/* DirectDraw driver for XF86DGA2 primary surface
*
* Copyright 2000-2001 TransGaming Technologies Inc.
*/
#include "config.h"
#ifdef HAVE_LIBXXF86DGA2
#include "debugtools.h"
#include "ts_xlib.h"
#include "ts_xf86dga2.h"
#include "x11drv.h"
#include "ddraw.h"
#include <assert.h>
#include <stdlib.h>
#include "ddraw_private.h"
#include "ddraw/main.h"
#include "ddraw/user.h"
#include "ddraw/dga2.h"
#include "dclipper/main.h"
#include "dpalette/main.h"
#include "dsurface/main.h"
#include "dsurface/dib.h"
#include "dsurface/user.h"
#include "dsurface/dga2.h"
#include "options.h"
DEFAULT_DEBUG_CHANNEL(ddraw);
static ICOM_VTABLE(IDirectDraw7) XF86DGA2_DirectDraw_VTable;
static const DDDEVICEIDENTIFIER2 xf86dga2_device =
{
"display",
"XF86DGA2 Driver",
{ { 0x00010001, 0x00010001 } },
0, 0, 0, 0,
/* e2dcb020-dc60-11d1-8407-9714f5d50803 */
{0xe2dcb020,0xdc60,0x11d1,{0x84,0x07,0x97,0x14,0xf5,0xd5,0x08,0x03}},
0
};
HRESULT XF86DGA2_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
IUnknown* pUnkOuter, BOOL ex);
HRESULT XF86DGA2_DirectDraw_Initialize(IDirectDrawImpl*, const GUID*);
static const ddraw_driver xf86dga2_driver =
{
&xf86dga2_device,
20, /* XVidMode is 11 */
XF86DGA2_DirectDraw_Create,
XF86DGA2_DirectDraw_Initialize
};
static XDGAMode* modes;
static DWORD num_modes;
static int dga_event, dga_error;
/* Called from DllInit, which is synchronised so there are no threading
* concerns. */
static BOOL initialize(void)
{
int nmodes;
int major, minor;
if (X11DRV_GetXRootWindow() != DefaultRootWindow(display)) return FALSE;
/* FIXME: don't use PROFILE calls */
if (!PROFILE_GetWineIniBool("x11drv", "UseDGA", 1)) return FALSE;
if (!TSXDGAQueryExtension(display, &dga_event, &dga_error)) return FALSE;
if (!TSXDGAQueryVersion(display, &major, &minor)) return FALSE;
if (major < 2) return FALSE; /* only bother with DGA2 */
/* test that it works */
if (!TSXDGAOpenFramebuffer(display, DefaultScreen(display))) {
TRACE("disabling XF86DGA2 (insufficient permissions?)\n");
return FALSE;
}
TSXDGACloseFramebuffer(display, DefaultScreen(display));
TRACE("getting XF86DGA2 mode list\n");
modes = TSXDGAQueryModes(display, DefaultScreen(display), &nmodes);
if (!modes) return FALSE;
num_modes = nmodes;
TRACE("enabling XF86DGA2\n");
return TRUE;
}
static void cleanup(void)
{
TSXFree(modes);
}
static XDGAMode* choose_mode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP,
DWORD dwRefreshRate, DWORD dwFlags)
{
XDGAMode* best = NULL;
int depth, bpp, i;
switch (dwBPP) {
case 8:
depth = dwBPP; bpp = 8; break;
case 15:
case 16:
depth = dwBPP; bpp = 16; break;
case 24:
case 32:
depth = 24; bpp = dwBPP; break;
default:
ERR("invalid color depth (%ld)\n", dwBPP);
return NULL;
}
/* Choose the smallest mode that is large enough. */
for (i=0; i < num_modes; i++)
{
if (modes[i].viewportWidth >= dwWidth && modes[i].viewportHeight >= dwHeight &&
modes[i].depth == depth && modes[i].bitsPerPixel == bpp)
{
if (best == NULL) best = &modes[i];
else
{
if (modes[i].viewportWidth < best->viewportWidth
|| modes[i].viewportHeight < best->viewportHeight)
best = &modes[i];
}
}
}
if (!best)
{
TRACE("all modes too small\n");
/* use the largest */
for (i=1; i < num_modes; i++)
{
if (modes[i].depth == depth && modes[i].bitsPerPixel == bpp)
{
if (best == NULL) best = &modes[i];
else
{
if (modes[i].viewportWidth > best->viewportWidth
|| modes[i].viewportHeight > best->viewportHeight)
best = &modes[i];
}
}
}
}
if (!best)
{
ERR("requested color depth (%ld) not available, try reconfiguring X server\n", dwBPP);
return NULL;
}
TRACE("using %d %d for %lu %lu\n", best->viewportWidth, best->viewportHeight,
dwWidth, dwHeight);
return best;
}
BOOL DDRAW_XF86DGA2_Init(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
if (initialize())
DDRAW_register_driver(&xf86dga2_driver);
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
cleanup();
}
return TRUE;
}
/* Not called from the vtable. */
HRESULT XF86DGA2_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
{
HRESULT hr;
TRACE("\n");
hr = User_DirectDraw_Construct(This, ex);
if (FAILED(hr)) return hr;
This->final_release = XF86DGA2_DirectDraw_final_release;
This->create_primary = XF86DGA2_DirectDraw_create_primary;
This->create_backbuffer = XF86DGA2_DirectDraw_create_backbuffer;
ICOM_INIT_INTERFACE(This, IDirectDraw7, XF86DGA2_DirectDraw_VTable);
return S_OK;
}
/* This function is called from DirectDrawCreate(Ex) on the most-derived
* class to start construction.
* Not called from the vtable. */
HRESULT XF86DGA2_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
IUnknown* pUnkOuter, BOOL ex)
{
HRESULT hr;
IDirectDrawImpl* This;
TRACE("\n");
assert(pUnkOuter == NULL);
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IDirectDrawImpl)
+ sizeof(XF86DGA2_DirectDrawImpl));
if (This == NULL) return E_OUTOFMEMORY;
/* Note that this relation does *not* hold true if the DD object was
* CoCreateInstanced then Initialized. */
This->private = (XF86DGA2_DirectDrawImpl *)(This+1);
hr = XF86DGA2_DirectDraw_Construct(This, ex);
if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, This);
else
*pIface = ICOM_INTERFACE(This, IDirectDraw7);
return hr;
}
/* This function is called from Uninit_DirectDraw_Initialize on the
* most-derived-class to start initialization.
* Not called from the vtable. */
HRESULT XF86DGA2_DirectDraw_Initialize(IDirectDrawImpl *This, const GUID* guid)
{
HRESULT hr;
TRACE("\n");
This->private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(XF86DGA2_DirectDrawImpl));
if (This->private == NULL) return E_OUTOFMEMORY;
hr = XF86DGA2_DirectDraw_Construct(This, TRUE); /* XXX ex? */
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, This->private);
return hr;
}
return DD_OK;
}
/* Called from an internal function pointer. */
void XF86DGA2_DirectDraw_final_release(IDirectDrawImpl *This)
{
XF86DGA2_DDRAW_PRIV_VAR(priv, This);
if (priv->xf86dga2.current_mode) {
TSXDGASetMode(display, DefaultScreen(display), 0);
VirtualFree(priv->xf86dga2.current_mode->data, 0, MEM_RELEASE);
X11DRV_EVENT_SetInputMethod(X11DRV_INPUT_ABSOLUTE);
X11DRV_EVENT_SetDGAStatus(0, -1);
TSXFree(priv->xf86dga2.current_mode);
TSXDGACloseFramebuffer(display, DefaultScreen(display));
priv->xf86dga2.current_mode = NULL;
}
User_DirectDraw_final_release(This);
}
HRESULT XF86DGA2_DirectDraw_create_primary(IDirectDrawImpl* This,
const DDSURFACEDESC2* pDDSD,
LPDIRECTDRAWSURFACE7* ppSurf,
IUnknown* pUnkOuter)
{
if (This->cooperative_level & DDSCL_EXCLUSIVE)
return XF86DGA2_DirectDrawSurface_Create(This, pDDSD, ppSurf, pUnkOuter);
else
return User_DirectDrawSurface_Create(This, pDDSD, ppSurf, pUnkOuter);
}
HRESULT XF86DGA2_DirectDraw_create_backbuffer(IDirectDrawImpl* This,
const DDSURFACEDESC2* pDDSD,
LPDIRECTDRAWSURFACE7* ppSurf,
IUnknown* pUnkOuter,
IDirectDrawSurfaceImpl* primary)
{
if (This->cooperative_level & DDSCL_EXCLUSIVE)
return XF86DGA2_DirectDrawSurface_Create(This, pDDSD, ppSurf, pUnkOuter);
else
return User_DirectDrawSurface_Create(This, pDDSD, ppSurf, pUnkOuter);
}
HRESULT WINAPI
XF86DGA2_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
LPDDDEVICEIDENTIFIER2 pDDDI,
DWORD dwFlags)
{
*pDDDI = xf86dga2_device;
return DD_OK;
}
HRESULT WINAPI
XF86DGA2_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
{
ICOM_THIS(IDirectDrawImpl, iface);
HRESULT hr;
TRACE("\n");
hr = Main_DirectDraw_RestoreDisplayMode(iface);
if (SUCCEEDED(hr))
{
XF86DGA2_DDRAW_PRIV_VAR(priv, This);
if (priv->xf86dga2.current_mode)
{
TSXDGASetMode(display, DefaultScreen(display), 0);
VirtualFree(priv->xf86dga2.current_mode->data, 0, MEM_RELEASE);
X11DRV_EVENT_SetInputMethod(X11DRV_INPUT_ABSOLUTE);
X11DRV_EVENT_SetDGAStatus(0, -1);
TSXFree(priv->xf86dga2.current_mode);
TSXDGACloseFramebuffer(display, DefaultScreen(display));
priv->xf86dga2.current_mode = NULL;
}
}
return hr;
}
HRESULT WINAPI
XF86DGA2_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
DWORD dwHeight, DWORD dwBPP,
DWORD dwRefreshRate, DWORD dwFlags)
{
ICOM_THIS(IDirectDrawImpl, iface);
HRESULT hr;
TRACE("(%p)->(%ldx%ldx%ld,%ld Hz,%08lx)\n",This,dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);
hr = User_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP,
dwRefreshRate, dwFlags);
if (SUCCEEDED(hr))
{
XF86DGA2_DDRAW_PRIV_VAR(priv, This);
XDGADevice* old_mode = priv->xf86dga2.current_mode;
XDGAMode* new_mode;
int old_mode_num = old_mode ? old_mode->mode.num : 0;
new_mode = choose_mode(dwWidth, dwHeight, dwBPP, dwRefreshRate, dwFlags);
if (!new_mode)
{
return DDERR_INVALIDMODE;
}
if (new_mode && new_mode->num != old_mode_num)
{
XDGADevice * nm = NULL;
if (old_mode || TSXDGAOpenFramebuffer(display, DefaultScreen(display)))
nm = TSXDGASetMode(display, DefaultScreen(display), new_mode->num);
if (nm) {
TSXDGASetViewport(display, DefaultScreen(display), 0, 0, XDGAFlipImmediate);
if (old_mode) {
VirtualFree(old_mode->data, 0, MEM_RELEASE);
TSXFree(old_mode);
} else {
TSXDGASelectInput(display, DefaultScreen(display),
KeyPressMask|KeyReleaseMask|
ButtonPressMask|ButtonReleaseMask|
PointerMotionMask);
X11DRV_EVENT_SetDGAStatus(This->window, dga_event);
X11DRV_EVENT_SetInputMethod(X11DRV_INPUT_RELATIVE);
}
priv->xf86dga2.current_mode = nm;
priv->xf86dga2.next_vofs = 0;
TRACE("frame buffer at %p, pitch=%d, width=%d, height=%d\n", nm->data,
nm->mode.bytesPerScanline, nm->mode.imageWidth, nm->mode.imageHeight);
VirtualAlloc(nm->data, nm->mode.bytesPerScanline * nm->mode.imageHeight,
MEM_RESERVE|MEM_SYSTEM, PAGE_READWRITE);
} else {
/* argh */
ERR("failed\n");
/* XXX revert size data to previous mode */
if (!old_mode)
TSXDGACloseFramebuffer(display, DefaultScreen(display));
}
}
}
return hr;
}
static ICOM_VTABLE(IDirectDraw7) XF86DGA2_DirectDraw_VTable =
{
Main_DirectDraw_QueryInterface,
Main_DirectDraw_AddRef,
Main_DirectDraw_Release,
Main_DirectDraw_Compact,
Main_DirectDraw_CreateClipper,
Main_DirectDraw_CreatePalette,
Main_DirectDraw_CreateSurface,
Main_DirectDraw_DuplicateSurface,
User_DirectDraw_EnumDisplayModes,
Main_DirectDraw_EnumSurfaces,
Main_DirectDraw_FlipToGDISurface,
Main_DirectDraw_GetCaps,
Main_DirectDraw_GetDisplayMode,
Main_DirectDraw_GetFourCCCodes,
Main_DirectDraw_GetGDISurface,
Main_DirectDraw_GetMonitorFrequency,
Main_DirectDraw_GetScanLine,
Main_DirectDraw_GetVerticalBlankStatus,
Main_DirectDraw_Initialize,
XF86DGA2_DirectDraw_RestoreDisplayMode,
Main_DirectDraw_SetCooperativeLevel,
XF86DGA2_DirectDraw_SetDisplayMode,
Main_DirectDraw_WaitForVerticalBlank,
Main_DirectDraw_GetAvailableVidMem,
Main_DirectDraw_GetSurfaceFromDC,
Main_DirectDraw_RestoreAllSurfaces,
Main_DirectDraw_TestCooperativeLevel,
XF86DGA2_DirectDraw_GetDeviceIdentifier,
Main_DirectDraw_StartModeTest,
Main_DirectDraw_EvaluateMode
};
#endif /* HAVE_LIBXXF86DGA2 */

View File

@ -1,48 +0,0 @@
/* Copyright 2000-2001 TransGaming Technologies, Inc. */
#ifndef WINE_DDRAW_DDRAW_DGA2_H_INCLUDED
#define WINE_DDRAW_DDRAW_DGA2_H_INCLUDED
#include <X11/extensions/xf86dga.h>
#define XF86DGA2_DDRAW_PRIV(ddraw) \
((XF86DGA2_DirectDrawImpl*)((ddraw)->private))
#define XF86DGA2_DDRAW_PRIV_VAR(name,ddraw) \
XF86DGA2_DirectDrawImpl* name = XF86DGA2_DDRAW_PRIV(ddraw)
typedef struct
{
XDGADevice* current_mode;
DWORD next_vofs;
} XF86DGA2_DirectDrawImpl_Part;
typedef struct
{
User_DirectDrawImpl_Part user;
XF86DGA2_DirectDrawImpl_Part xf86dga2;
} XF86DGA2_DirectDrawImpl;
void XF86DGA2_DirectDraw_final_release(IDirectDrawImpl* This);
HRESULT XF86DGA2_DirectDraw_create_primary(IDirectDrawImpl* This,
const DDSURFACEDESC2* pDDSD,
LPDIRECTDRAWSURFACE7* ppSurf,
LPUNKNOWN pOuter);
HRESULT XF86DGA2_DirectDraw_create_backbuffer(IDirectDrawImpl* This,
const DDSURFACEDESC2* pDDSD,
LPDIRECTDRAWSURFACE7* ppSurf,
LPUNKNOWN pOuter,
IDirectDrawSurfaceImpl* primary);
HRESULT XF86DGA2_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex);
HRESULT XF86DGA2_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
IUnknown* pUnkOuter, BOOL ex);
HRESULT WINAPI
XF86DGA2_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
LPDDDEVICEIDENTIFIER2 pDDDI,
DWORD dwFlags);
HRESULT WINAPI
XF86DGA2_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
DWORD dwHeight, DWORD dwBPP,
DWORD dwRefreshRate, DWORD dwFlags);
HRESULT WINAPI
XF86DGA2_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface);
#endif

View File

@ -1,397 +0,0 @@
/* DirectDraw driver for User-based primary surfaces
* with XF86VidMode mode switching in full-screen mode.
*
* Copyright 2000-2001 TransGaming Technologies Inc.
*/
#include "config.h"
#ifdef HAVE_LIBXXF86VM
#include "debugtools.h"
#include "ts_xlib.h"
#include "ts_xf86vmode.h"
#include "x11drv.h"
#include "ddraw.h"
#include <assert.h>
#include <stdlib.h>
#include "ddraw_private.h"
#include "ddraw/main.h"
#include "ddraw/user.h"
#include "ddraw/xvidmode.h"
#include "dclipper/main.h"
#include "dpalette/main.h"
#include "dsurface/main.h"
#include "dsurface/dib.h"
#include "dsurface/user.h"
#include "options.h"
#include "win.h"
DEFAULT_DEBUG_CHANNEL(ddraw);
static ICOM_VTABLE(IDirectDraw7) XVidMode_DirectDraw_VTable;
static const DDDEVICEIDENTIFIER2 xvidmode_device =
{
"display",
"XF86VidMode",
{ { 0x00010001, 0x00010001 } },
0, 0, 0, 0,
/* 40c1b248-9d7d-4a29-b7d7-4cd8109f3d5d */
{0x40c1b248,0x9d7d,0x4a29,{0xd7,0xb7,0x4c,0xd8,0x10,0x9f,0x3d,0x5d}},
0
};
HRESULT XVidMode_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
IUnknown* pUnkOuter, BOOL ex);
HRESULT XVidMode_DirectDraw_Initialize(IDirectDrawImpl*, const GUID*);
static const ddraw_driver xvidmode_driver =
{
&xvidmode_device,
11, /* User is 10 */
XVidMode_DirectDraw_Create,
XVidMode_DirectDraw_Initialize
};
static XF86VidModeModeInfo** modes;
static DWORD num_modes;
/* Called from DllInit, which is synchronised so there are no threading
* concerns. */
static BOOL initialize(void)
{
int nmodes;
int major, minor;
if (X11DRV_GetXRootWindow() != DefaultRootWindow(display)) return FALSE;
if (!TSXF86VidModeQueryVersion(display, &major, &minor)) return FALSE;
if (!TSXF86VidModeGetAllModeLines(display, DefaultScreen(display), &nmodes,
&modes))
return FALSE;
num_modes = nmodes;
TRACE("enabling XVidMode\n");
return TRUE;
}
static void cleanup(void)
{
TSXFree(modes);
}
static HRESULT set_display_mode(XF86VidModeModeInfo* mode)
{
int screen = DefaultScreen(display);
TRACE("%d %d\n", mode->hdisplay, mode->vdisplay);
/* This is questionable. Programs should leave switching unlocked when
* they exit. So the only reason the display should be locked is if
* another really doesn't want switches to happen. Maybe it would be better
* to detect an XF86VideModeZoomLocked error. */
TSXF86VidModeLockModeSwitch(display, screen, False);
TSXSync(display, False);
TSXF86VidModeSwitchToMode(display, screen, mode);
TSXSync(display, False);
#if 0 /* doesn't work for me */
TSXF86VidModeSetViewPort(display, screen, 0, 0);
#else
TSXWarpPointer(display, None, RootWindow(display, screen), 0, 0, 0, 0, 0,
0);
#endif
TSXFlush(display);
return S_OK;
}
static XF86VidModeModeInfo* choose_mode(DWORD dwWidth, DWORD dwHeight,
DWORD dwRefreshRate, DWORD dwFlags)
{
XF86VidModeModeInfo* best = NULL;
int i;
/* Choose the smallest mode that is large enough. */
for (i=0; i < num_modes; i++)
{
if (modes[i]->hdisplay >= dwWidth && modes[i]->vdisplay >= dwHeight)
{
if (best == NULL) best = modes[i];
else
{
if (modes[i]->hdisplay < best->hdisplay
|| modes[i]->vdisplay < best->vdisplay)
best = modes[i];
}
}
}
/* all modes were too small, use the largest */
if (best == NULL)
{
TRACE("all modes too small\n");
for (i=1; i < num_modes; i++)
{
if (best == NULL) best = modes[i];
else
{
if (modes[i]->hdisplay > best->hdisplay
|| modes[i]->vdisplay > best->vdisplay)
best = modes[i];
}
}
}
TRACE("using %d %d for %lu %lu\n", best->hdisplay, best->vdisplay,
dwWidth, dwHeight);
return best;
}
static XF86VidModeModeInfo* get_current_mode(void)
{
XF86VidModeModeLine line;
int dotclock;
int i;
TSXF86VidModeGetModeLine(display, DefaultScreen(display), &dotclock,
&line);
for (i=0; i < num_modes; i++)
{
if (modes[i]->dotclock == dotclock
&& modes[i]->hdisplay == line.hdisplay
&& modes[i]->hsyncstart == line.hsyncstart
&& modes[i]->hsyncend == line.hsyncend
&& modes[i]->htotal == line.htotal
/* && modes[i]->hskew == line.hskew */
&& modes[i]->vdisplay == line.vdisplay
&& modes[i]->vsyncstart == line.vsyncstart
&& modes[i]->vsyncend == line.vsyncend
&& modes[i]->vtotal == line.vtotal
&& modes[i]->flags == line.flags)
return modes[i];
}
WARN("this can't happen\n");
return modes[0]; /* should be the mode that X started in */
}
BOOL DDRAW_XVidMode_Init(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
if (fdwReason == DLL_PROCESS_ATTACH)
{
if (initialize())
DDRAW_register_driver(&xvidmode_driver);
}
else if (fdwReason == DLL_PROCESS_DETACH)
{
cleanup();
}
return TRUE;
}
/* Not called from the vtable. */
HRESULT XVidMode_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
{
XVIDMODE_DDRAW_PRIV_VAR(priv,This);
HRESULT hr;
TRACE("\n");
hr = User_DirectDraw_Construct(This, ex);
if (FAILED(hr)) return hr;
This->final_release = XVidMode_DirectDraw_final_release;
priv->xvidmode.original_mode = get_current_mode();
priv->xvidmode.current_mode = priv->xvidmode.original_mode;
ICOM_INIT_INTERFACE(This, IDirectDraw7, XVidMode_DirectDraw_VTable);
return S_OK;
}
/* This function is called from DirectDrawCreate(Ex) on the most-derived
* class to start construction.
* Not called from the vtable. */
HRESULT XVidMode_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
IUnknown* pUnkOuter, BOOL ex)
{
HRESULT hr;
IDirectDrawImpl* This;
TRACE("\n");
assert(pUnkOuter == NULL);
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(IDirectDrawImpl)
+ sizeof(XVidMode_DirectDrawImpl));
if (This == NULL) return E_OUTOFMEMORY;
/* Note that this relation does *not* hold true if the DD object was
* CoCreateInstanced then Initialized. */
This->private = (XVidMode_DirectDrawImpl *)(This+1);
hr = XVidMode_DirectDraw_Construct(This, ex);
if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, This);
else
*pIface = ICOM_INTERFACE(This, IDirectDraw7);
return hr;
}
/* This function is called from Uninit_DirectDraw_Initialize on the
* most-derived-class to start initialization.
* Not called from the vtable. */
HRESULT XVidMode_DirectDraw_Initialize(IDirectDrawImpl *This, const GUID* guid)
{
HRESULT hr;
TRACE("\n");
This->private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(XVidMode_DirectDrawImpl));
if (This->private == NULL) return E_OUTOFMEMORY;
hr = XVidMode_DirectDraw_Construct(This, TRUE); /* XXX ex? */
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, This->private);
return hr;
}
return DD_OK;
}
/* Called from an internal function pointer. */
void XVidMode_DirectDraw_final_release(IDirectDrawImpl *This)
{
XVIDMODE_DDRAW_PRIV_VAR(priv, This);
if (priv->xvidmode.current_mode != priv->xvidmode.original_mode)
set_display_mode(priv->xvidmode.original_mode);
User_DirectDraw_final_release(This);
}
HRESULT WINAPI
XVidMode_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
LPDDDEVICEIDENTIFIER2 pDDDI,
DWORD dwFlags)
{
*pDDDI = xvidmode_device;
return DD_OK;
}
HRESULT WINAPI
XVidMode_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
{
ICOM_THIS(IDirectDrawImpl, iface);
HRESULT hr;
TRACE("\n");
hr = Main_DirectDraw_RestoreDisplayMode(iface);
if (SUCCEEDED(hr))
{
XVIDMODE_DDRAW_PRIV_VAR(priv, This);
if (priv->xvidmode.current_mode != priv->xvidmode.original_mode)
{
set_display_mode(priv->xvidmode.original_mode);
priv->xvidmode.current_mode = priv->xvidmode.original_mode;
}
}
return hr;
}
HRESULT WINAPI
XVidMode_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
DWORD dwHeight, DWORD dwBPP,
DWORD dwRefreshRate, DWORD dwFlags)
{
ICOM_THIS(IDirectDrawImpl, iface);
HRESULT hr;
TRACE("(%p)->(%ldx%ldx%ld,%ld Hz,%08lx)\n",This,dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);
hr = User_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, dwBPP,
dwRefreshRate, dwFlags);
if (SUCCEEDED(hr))
{
XVIDMODE_DDRAW_PRIV_VAR(priv, This);
XF86VidModeModeInfo* new_mode;
WND *tmpWnd = WIN_FindWndPtr(This->window);
Window x11Wnd = X11DRV_WND_GetXWindow(tmpWnd);
WIN_ReleaseWndPtr(tmpWnd);
new_mode = choose_mode(dwWidth, dwHeight, dwRefreshRate, dwFlags);
if (new_mode != NULL && new_mode != priv->xvidmode.current_mode)
{
priv->xvidmode.current_mode = new_mode;
set_display_mode(priv->xvidmode.current_mode);
}
if (PROFILE_GetWineIniBool( "x11drv", "DXGrab", 0)) {
/* Confine cursor movement (risky, but the user asked for it) */
TSXGrabPointer(display, x11Wnd, True, 0, GrabModeAsync, GrabModeAsync, x11Wnd, None, CurrentTime);
}
}
return hr;
}
static ICOM_VTABLE(IDirectDraw7) XVidMode_DirectDraw_VTable =
{
Main_DirectDraw_QueryInterface,
Main_DirectDraw_AddRef,
Main_DirectDraw_Release,
Main_DirectDraw_Compact,
Main_DirectDraw_CreateClipper,
Main_DirectDraw_CreatePalette,
Main_DirectDraw_CreateSurface,
Main_DirectDraw_DuplicateSurface,
User_DirectDraw_EnumDisplayModes,
Main_DirectDraw_EnumSurfaces,
Main_DirectDraw_FlipToGDISurface,
Main_DirectDraw_GetCaps,
Main_DirectDraw_GetDisplayMode,
Main_DirectDraw_GetFourCCCodes,
Main_DirectDraw_GetGDISurface,
Main_DirectDraw_GetMonitorFrequency,
Main_DirectDraw_GetScanLine,
Main_DirectDraw_GetVerticalBlankStatus,
Main_DirectDraw_Initialize,
XVidMode_DirectDraw_RestoreDisplayMode,
Main_DirectDraw_SetCooperativeLevel,
XVidMode_DirectDraw_SetDisplayMode,
Main_DirectDraw_WaitForVerticalBlank,
Main_DirectDraw_GetAvailableVidMem,
Main_DirectDraw_GetSurfaceFromDC,
Main_DirectDraw_RestoreAllSurfaces,
Main_DirectDraw_TestCooperativeLevel,
XVidMode_DirectDraw_GetDeviceIdentifier,
Main_DirectDraw_StartModeTest,
Main_DirectDraw_EvaluateMode
};
#endif /* HAVE_LIBXXF86VM */

View File

@ -1,39 +0,0 @@
/* Copyright 2000-2001 TransGaming Technologies, Inc. */
#ifndef WINE_DDRAW_DDRAW_XVIDMODE_H_INCLUDED
#define WINE_DDRAW_DDRAW_XVIDMODE_H_INCLUDED
#include <X11/extensions/xf86vmode.h>
#define XVIDMODE_DDRAW_PRIV(ddraw) \
((XVidMode_DirectDrawImpl*)((ddraw)->private))
#define XVIDMODE_DDRAW_PRIV_VAR(name,ddraw) \
XVidMode_DirectDrawImpl* name = XVIDMODE_DDRAW_PRIV(ddraw)
typedef struct
{
XF86VidModeModeInfo* original_mode;
XF86VidModeModeInfo* current_mode;
} XVidMode_DirectDrawImpl_Part;
typedef struct
{
User_DirectDrawImpl_Part user;
XVidMode_DirectDrawImpl_Part xvidmode;
} XVidMode_DirectDrawImpl;
void XVidMode_DirectDraw_final_release(IDirectDrawImpl* This);
HRESULT XVidMode_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex);
HRESULT XVidMode_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
IUnknown* pUnkOuter, BOOL ex);
HRESULT WINAPI
XVidMode_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
LPDDDEVICEIDENTIFIER2 pDDDI,
DWORD dwFlags);
HRESULT WINAPI
XVidMode_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
DWORD dwHeight, DWORD dwBPP,
DWORD dwRefreshRate, DWORD dwFlags);
HRESULT WINAPI
XVidMode_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface);
#endif

View File

@ -1,254 +0,0 @@
/* XF86DGA2 primary surface driver
*
* Copyright 2000 TransGaming Technologies Inc.
*/
#include "config.h"
#ifdef HAVE_LIBXXF86DGA2
#include "ts_xlib.h"
#include "ts_xf86dga2.h"
#include "x11drv.h"
#include "winerror.h"
#include <assert.h>
#include <stdlib.h>
#include "debugtools.h"
#include "ddraw_private.h"
#include "ddraw/user.h"
#include "ddraw/dga2.h"
#include "dsurface/main.h"
#include "dsurface/dib.h"
#include "dsurface/dga2.h"
DEFAULT_DEBUG_CHANNEL(ddraw);
static ICOM_VTABLE(IDirectDrawSurface7) XF86DGA2_IDirectDrawSurface7_VTable;
HRESULT
XF86DGA2_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl* This,
IDirectDrawImpl* pDD,
const DDSURFACEDESC2* pDDSD)
{
XF86DGA2_PRIV_VAR(priv, This);
XF86DGA2_DDRAW_PRIV_VAR(ddpriv, pDD);
HRESULT hr;
XDGADevice* mode;
TRACE("(%p,%p,%p)\n",This,pDD,pDDSD);
if (!ddpriv->xf86dga2.current_mode) {
/* we need a mode! */
hr = XF86DGA2_DirectDraw_SetDisplayMode(ICOM_INTERFACE(pDD, IDirectDraw7),
pDD->width, pDD->height,
pDD->pixelformat.u1.dwRGBBitCount,
0, 0);
if (FAILED(hr)) return hr;
}
/* grab framebuffer data from current_mode */
mode = ddpriv->xf86dga2.current_mode;
priv->xf86dga2.fb_pitch = mode->mode.bytesPerScanline;
priv->xf86dga2.fb_vofs = ddpriv->xf86dga2.next_vofs;
priv->xf86dga2.fb_addr = mode->data +
priv->xf86dga2.fb_pitch * priv->xf86dga2.fb_vofs;
TRACE("vofs=%ld, addr=%p\n", priv->xf86dga2.fb_vofs, priv->xf86dga2.fb_addr);
/* fill in surface_desc before we construct DIB from it */
This->surface_desc = *pDDSD;
This->surface_desc.lpSurface = priv->xf86dga2.fb_addr;
This->surface_desc.u1.lPitch = priv->xf86dga2.fb_pitch;
This->surface_desc.dwFlags |= DDSD_LPSURFACE | DDSD_PITCH;
hr = DIB_DirectDrawSurface_Construct(This, pDD, &This->surface_desc);
if (FAILED(hr)) return hr;
if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) {
priv->xf86dga2.pal = TSXDGACreateColormap(display, DefaultScreen(display), mode, AllocAll);
TSXDGAInstallColormap(display, DefaultScreen(display), priv->xf86dga2.pal);
}
ddpriv->xf86dga2.next_vofs += pDDSD->dwHeight;
ICOM_INIT_INTERFACE(This, IDirectDrawSurface7,
XF86DGA2_IDirectDrawSurface7_VTable);
This->final_release = XF86DGA2_DirectDrawSurface_final_release;
This->duplicate_surface = XF86DGA2_DirectDrawSurface_duplicate_surface;
This->flip_data = XF86DGA2_DirectDrawSurface_flip_data;
This->flip_update = XF86DGA2_DirectDrawSurface_flip_update;
This->set_palette = XF86DGA2_DirectDrawSurface_set_palette;
This->update_palette = XF86DGA2_DirectDrawSurface_update_palette;
This->get_display_window = XF86DGA2_DirectDrawSurface_get_display_window;
return DD_OK;
}
HRESULT
XF86DGA2_DirectDrawSurface_Create(IDirectDrawImpl *pDD,
const DDSURFACEDESC2 *pDDSD,
LPDIRECTDRAWSURFACE7 *ppSurf,
IUnknown *pUnkOuter)
{
IDirectDrawSurfaceImpl* This;
HRESULT hr;
assert(pUnkOuter == NULL);
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*This) + sizeof(XF86DGA2_DirectDrawSurfaceImpl));
if (This == NULL) return E_OUTOFMEMORY;
This->private = (XF86DGA2_DirectDrawSurfaceImpl*)(This+1);
hr = XF86DGA2_DirectDrawSurface_Construct(This, pDD, pDDSD);
if (FAILED(hr))
HeapFree(GetProcessHeap(), 0, This);
else
*ppSurf = ICOM_INTERFACE(This, IDirectDrawSurface7);
return hr;
}
void XF86DGA2_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This)
{
XF86DGA2_PRIV_VAR(priv, This);
DIB_DirectDrawSurface_final_release(This);
if (priv->xf86dga2.pal)
TSXFreeColormap(display, priv->xf86dga2.pal);
}
void XF86DGA2_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal)
{
DIB_DirectDrawSurface_set_palette(This, pal);
}
void XF86DGA2_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal,
DWORD dwStart, DWORD dwCount,
LPPALETTEENTRY palent)
{
XF86DGA2_PRIV_VAR(priv, This);
if (This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
{
XColor c;
int n;
c.flags = DoRed|DoGreen|DoBlue;
c.pixel = dwStart;
for (n=0; n<dwCount; n++,c.pixel++) {
c.red = palent[n].peRed << 8;
c.green = palent[n].peGreen << 8;
c.blue = palent[n].peBlue << 8;
TSXStoreColor(display, priv->xf86dga2.pal, &c);
}
TSXFlush(display);
}
}
HRESULT XF86DGA2_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This,
LPDIRECTDRAWSURFACE7* ppDup)
{
return XF86DGA2_DirectDrawSurface_Create(This->ddraw_owner,
&This->surface_desc, ppDup, NULL);
}
BOOL XF86DGA2_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back,
DWORD dwFlags)
{
XF86DGA2_PRIV_VAR(front_priv, front);
XF86DGA2_PRIV_VAR(back_priv, back);
{
DWORD tmp;
tmp = front_priv->xf86dga2.fb_vofs;
front_priv->xf86dga2.fb_vofs = back_priv->xf86dga2.fb_vofs;
back_priv->xf86dga2.fb_vofs = tmp;
}
{
LPVOID tmp;
tmp = front_priv->xf86dga2.fb_addr;
front_priv->xf86dga2.fb_addr = back_priv->xf86dga2.fb_addr;
back_priv->xf86dga2.fb_addr = tmp;
}
return DIB_DirectDrawSurface_flip_data(front, back, dwFlags);
}
void XF86DGA2_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This, DWORD dwFlags)
{
XF86DGA2_PRIV_VAR(priv, This);
/* XXX having the Flip's dwFlags would be nice here */
TSXDGASetViewport(display, DefaultScreen(display),
0, priv->xf86dga2.fb_vofs, XDGAFlipImmediate);
}
HWND XF86DGA2_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This)
{
/* there's a potential drawable in the ddraw object's current_mode->pixmap...
* perhaps it's possible to use it for the Direct3D rendering as well? */
return 0;
}
static ICOM_VTABLE(IDirectDrawSurface7) XF86DGA2_IDirectDrawSurface7_VTable =
{
Main_DirectDrawSurface_QueryInterface,
Main_DirectDrawSurface_AddRef,
Main_DirectDrawSurface_Release,
Main_DirectDrawSurface_AddAttachedSurface,
Main_DirectDrawSurface_AddOverlayDirtyRect,
DIB_DirectDrawSurface_Blt,
Main_DirectDrawSurface_BltBatch,
DIB_DirectDrawSurface_BltFast,
Main_DirectDrawSurface_DeleteAttachedSurface,
Main_DirectDrawSurface_EnumAttachedSurfaces,
Main_DirectDrawSurface_EnumOverlayZOrders,
Main_DirectDrawSurface_Flip,
Main_DirectDrawSurface_GetAttachedSurface,
Main_DirectDrawSurface_GetBltStatus,
Main_DirectDrawSurface_GetCaps,
Main_DirectDrawSurface_GetClipper,
Main_DirectDrawSurface_GetColorKey,
Main_DirectDrawSurface_GetDC,
Main_DirectDrawSurface_GetFlipStatus,
Main_DirectDrawSurface_GetOverlayPosition,
Main_DirectDrawSurface_GetPalette,
Main_DirectDrawSurface_GetPixelFormat,
Main_DirectDrawSurface_GetSurfaceDesc,
Main_DirectDrawSurface_Initialize,
Main_DirectDrawSurface_IsLost,
Main_DirectDrawSurface_Lock,
Main_DirectDrawSurface_ReleaseDC,
DIB_DirectDrawSurface_Restore,
Main_DirectDrawSurface_SetClipper,
Main_DirectDrawSurface_SetColorKey,
Main_DirectDrawSurface_SetOverlayPosition,
Main_DirectDrawSurface_SetPalette,
Main_DirectDrawSurface_Unlock,
Main_DirectDrawSurface_UpdateOverlay,
Main_DirectDrawSurface_UpdateOverlayDisplay,
Main_DirectDrawSurface_UpdateOverlayZOrder,
Main_DirectDrawSurface_GetDDInterface,
Main_DirectDrawSurface_PageLock,
Main_DirectDrawSurface_PageUnlock,
DIB_DirectDrawSurface_SetSurfaceDesc,
Main_DirectDrawSurface_SetPrivateData,
Main_DirectDrawSurface_GetPrivateData,
Main_DirectDrawSurface_FreePrivateData,
Main_DirectDrawSurface_GetUniquenessValue,
Main_DirectDrawSurface_ChangeUniquenessValue,
Main_DirectDrawSurface_SetPriority,
Main_DirectDrawSurface_GetPriority,
Main_DirectDrawSurface_SetLOD,
Main_DirectDrawSurface_GetLOD
};
#endif /* HAVE_LIBXXF86DGA2 */

View File

@ -1,51 +0,0 @@
/* Copyright 2000 TransGaming Technologies Inc. */
#ifndef DDRAW_DSURFACE_DGA2_H_INCLUDED
#define DDRAW_DSURFACE_DGA2_H_INCLUDED
#define XF86DGA2_PRIV(surf) ((XF86DGA2_DirectDrawSurfaceImpl*)((surf)->private))
#define XF86DGA2_PRIV_VAR(name,surf) \
XF86DGA2_DirectDrawSurfaceImpl* name = XF86DGA2_PRIV(surf)
struct XF86DGA2_DirectDrawSurfaceImpl_Part
{
LPVOID fb_addr;
DWORD fb_pitch, fb_vofs;
Colormap pal;
};
typedef struct
{
struct DIB_DirectDrawSurfaceImpl_Part dib;
struct XF86DGA2_DirectDrawSurfaceImpl_Part xf86dga2;
} XF86DGA2_DirectDrawSurfaceImpl;
HRESULT
XF86DGA2_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl* This,
IDirectDrawImpl* pDD,
const DDSURFACEDESC2* pDDSD);
HRESULT
XF86DGA2_DirectDrawSurface_Create(IDirectDrawImpl *pDD,
const DDSURFACEDESC2 *pDDSD,
LPDIRECTDRAWSURFACE7 *ppSurf,
IUnknown *pUnkOuter);
void XF86DGA2_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This);
void XF86DGA2_DirectDrawSurface_set_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal);
void XF86DGA2_DirectDrawSurface_update_palette(IDirectDrawSurfaceImpl* This,
IDirectDrawPaletteImpl* pal,
DWORD dwStart, DWORD dwCount,
LPPALETTEENTRY palent);
HRESULT XF86DGA2_DirectDrawSurface_duplicate_surface(IDirectDrawSurfaceImpl* This,
LPDIRECTDRAWSURFACE7* ppDup);
BOOL XF86DGA2_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
IDirectDrawSurfaceImpl* back,
DWORD dwFlags);
void XF86DGA2_DirectDrawSurface_flip_update(IDirectDrawSurfaceImpl* This, DWORD dwFlags);
HWND XF86DGA2_DirectDrawSurface_get_display_window(IDirectDrawSurfaceImpl* This);
#endif