Commit 51177f96 authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Added DGA2 driver to DirectDraw.

parent 5e65e2dd
......@@ -128,6 +128,8 @@ AC_SUBST(XFILES)
XFILES=""
AC_SUBST(DGA_SRCS)
DGA_SRCS=""
AC_SUBST(DGA2_SRCS)
DGA2_SRCS=""
AC_SUBST(MESA_SRCS)
MESA_SRCS=""
if test "$have_x" = "yes"
......@@ -173,6 +175,7 @@ then
AC_DEFINE(HAVE_LIBXXF86DGA)
X_PRE_LIBS="$X_PRE_LIBS -lXxf86dga"
DGA_SRCS='$(DGA_SRCS)'
DGA2_SRCS='$(DGA2_SRCS)'
,,$X_LIBS -lXext -lX11 $X_EXTRA_LIBS
)
if test "$ac_cv_lib_Xxf86dga_XDGAQueryExtension" = "no"
......
......@@ -26,9 +26,15 @@ DGA_SRCS = \
dsurface/dga.c \
dga.c
DGA2_SRCS= \
dga2.c \
dsurface/dga2.c \
ddraw/dga2.c
XFILES = \
@DGA_SRCS@ \
@MESA_SRCS@ \
@DGA2_SRCS@ \
ddraw/x11.c \
dpalette/x11.c \
dsurface/x11.c \
......
......@@ -82,18 +82,6 @@ DDRAW_DGA_Available(void)
return 0;
}
#ifdef HAVE_LIBXXF86DGA2
if (majver >= 2) {
/* We have DGA 2.0 available ! */
if (TSXDGAOpenFramebuffer(display, DefaultScreen(display))) {
TSXDGACloseFramebuffer(display, DefaultScreen(display));
return_value = 2;
} else
return_value = 0;
return return_value;
}
#endif /* defined(HAVE_LIBXXF86DGA2) */
/* You don't have to be root to use DGA extensions. Simply having access
* to /dev/mem will do the trick
* This can be achieved by adding the user to the "kmem" group on
......@@ -139,105 +127,47 @@ DGA_Create( LPDIRECTDRAW *lplpDD ) {
ddraw->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(dga_dd_private));
dgpriv = (dga_dd_private*)ddraw->private;
#ifdef HAVE_LIBXXF86DGA2
if (dga_version == 1) {
dgpriv->version = 1;
#endif /* defined(HAVE_LIBXXF86DGA2) */
TSXF86DGAQueryVersion(display,&major,&minor);
TRACE("XF86DGA is version %d.%d\n",major,minor);
TSXF86DGAQueryDirectVideo(display,DefaultScreen(display),&flags);
if (!(flags & XF86DGADirectPresent))
MESSAGE("direct video is NOT PRESENT.\n");
TSXF86DGAGetVideo(display,DefaultScreen(display),&addr,&width,&banksize,&memsize);
dgpriv->fb_width = width;
TSXF86DGAGetViewPortSize(display,DefaultScreen(display),&width,&height);
TSXF86DGASetViewPort(display,DefaultScreen(display),0,0);
dgpriv->fb_height = height;
TRACE("video framebuffer: begin %p, width %d,banksize %d,memsize %d\n",
addr,width,banksize,memsize
);
TRACE("viewport height: %d\n",height);
/* Get the screen dimensions as seen by Wine.
* In that case, it may be better to ignore the -desktop mode and
* return the real screen size => print a warning
*/
ddraw->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
ddraw->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
if ((ddraw->d.height != height) || (ddraw->d.width != width))
WARN("You seem to be running in -desktop mode. This may prove dangerous in DGA mode...\n");
dgpriv->fb_addr = addr;
dgpriv->fb_memsize = memsize;
dgpriv->vpmask = 0;
/* just assume the default depth is the DGA depth too */
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
_common_depth_to_pixelformat(depth, &(ddraw->d.directdraw_pixelformat), &(ddraw->d.screen_pixelformat), NULL);
TSXF86DGAQueryVersion(display,&major,&minor);
TRACE("XF86DGA is version %d.%d\n",major,minor);
TSXF86DGAQueryDirectVideo(display,DefaultScreen(display),&flags);
if (!(flags & XF86DGADirectPresent))
MESSAGE("direct video is NOT PRESENT.\n");
TSXF86DGAGetVideo(display,DefaultScreen(display),&addr,&width,&banksize,&memsize);
dgpriv->fb_width = width;
TSXF86DGAGetViewPortSize(display,DefaultScreen(display),&width,&height);
TSXF86DGASetViewPort(display,DefaultScreen(display),0,0);
dgpriv->fb_height = height;
TRACE("video framebuffer: begin %p, width %d,banksize %d,memsize %d\n",
addr,width,banksize,memsize
);
TRACE("viewport height: %d\n",height);
/* Get the screen dimensions as seen by Wine.
* In that case, it may be better to ignore the -desktop mode and
* return the real screen size => print a warning
*/
ddraw->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
ddraw->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
if ((ddraw->d.height != height) || (ddraw->d.width != width))
WARN("You seem to be running in -desktop mode. This may prove dangerous in DGA mode...\n");
dgpriv->fb_addr = addr;
dgpriv->fb_memsize = memsize;
dgpriv->vpmask = 0;
/* The cast is because DGA2's install colormap does not return a value whereas
DGA1 version does */
dgpriv->InstallColormap = (void (*)(Display *, int, Colormap)) TSXF86DGAInstallColormap;
/* just assume the default depth is the DGA depth too */
depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
_common_depth_to_pixelformat(depth, &(ddraw->d.directdraw_pixelformat), &(ddraw->d.screen_pixelformat), NULL);
#ifdef RESTORE_SIGNALS
SIGNAL_Init();
SIGNAL_Init();
#endif
#ifdef HAVE_LIBXXF86DGA2
} else {
XDGAMode *modes;
int i, num_modes;
int mode_to_use = 0;
dgpriv->version = 2;
TSXDGAQueryVersion(display,&major,&minor);
TRACE("XDGA is version %d.%d\n",major,minor);
TRACE("Opening the frame buffer.\n");
if (!TSXDGAOpenFramebuffer(display, DefaultScreen(display))) {
ERR("Error opening the frame buffer !!!\n");
return DDERR_GENERIC;
}
/* List all available modes */
modes = TSXDGAQueryModes(display, DefaultScreen(display), &num_modes);
dgpriv->modes = modes;
dgpriv->num_modes = num_modes;
TRACE("Available modes :\n");
for (i = 0; i < num_modes; i++) {
if (TRACE_ON(ddraw)) {
DPRINTF(" %d) - %s (FB: %dx%d / VP: %dx%d) - depth %d -",
modes[i].num,
modes[i].name, modes[i].imageWidth, modes[i].imageHeight,
modes[i].viewportWidth, modes[i].viewportHeight,
modes[i].depth
);
#define XX(x) if (modes[i].flags & x) DPRINTF(" "#x" ");
XX(XDGAConcurrentAccess);
XX(XDGASolidFillRect);
XX(XDGABlitRect);
XX(XDGABlitTransRect);
XX(XDGAPixmap);
#undef XX
DPRINTF("\n");
}
if ((MONITOR_GetHeight(&MONITOR_PrimaryMonitor) == modes[i].viewportHeight) &&
(MONITOR_GetWidth(&MONITOR_PrimaryMonitor) == modes[i].viewportWidth) &&
(MONITOR_GetDepth(&MONITOR_PrimaryMonitor) == modes[i].depth)
) {
mode_to_use = modes[i].num;
}
}
if (mode_to_use == 0) {
ERR("Could not find mode !\n");
mode_to_use = 1;
} else {
DPRINTF("Using mode number %d\n", mode_to_use);
}
/* Initialize the frame buffer */
_DGA_Initialize_FrameBuffer(*lplpDD, mode_to_use);
/* Set the input handling for relative mouse movements */
X11DRV_EVENT_SetInputMethod(X11DRV_INPUT_RELATIVE);
}
#endif /* defined(HAVE_LIBXXF86DGA2) */
return DD_OK;
}
......
/* DirectDraw using DGA2
*
* Based (well, plagiarized :-) ) on Marcus' dga.c
*/
#include "config.h"
#include "winerror.h"
#include <unistd.h>
#include <assert.h>
#ifdef HAVE_SYS_SIGNAL_H
# include <sys/signal.h>
#endif
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include "gdi.h"
#include "heap.h"
#include "dc.h"
#include "win.h"
#include "wine/exception.h"
#include "ddraw.h"
#include "d3d.h"
#include "debugtools.h"
#include "spy.h"
#include "message.h"
#include "options.h"
#include "monitor.h"
#include "dga2_private.h"
DEFAULT_DEBUG_CHANNEL(ddraw);
static inline BOOL get_option( const char *name, BOOL def ) {
return PROFILE_GetWineIniBool( "x11drv", name, def );
}
static BYTE
DDRAW_DGA2_Available(void)
{
int evbase, evret, majver, minver;
static BYTE return_value = 0xFF;
/* This prevents from probing X times for DGA */
if (return_value != 0xFF)
return return_value;
if (!get_option( "UseDGA", 1 )) {
TRACE("UseDGA disabled.\n");
return_value = 0;
return 0;
}
/* First, query the extenstion and its version */
if (!TSXF86DGAQueryExtension(display,&evbase,&evret)) {
TRACE("DGA extension not detected.\n");
return_value = 0;
return 0;
}
if (!TSXF86DGAQueryVersion(display,&majver,&minver)) {
TRACE("DGA version not detected.\n");
return_value = 0;
return 0;
}
if (majver >= 2) {
/* We have DGA 2.0 available ! */
if (TSXDGAOpenFramebuffer(display, DefaultScreen(display))) {
TSXDGACloseFramebuffer(display, DefaultScreen(display));
return_value = 2;
} else
return_value = 0;
return return_value;
}
return 0;
}
HRESULT
DGA2_Create( LPDIRECTDRAW *lplpDD ) {
IDirectDrawImpl* ddraw;
dga2_dd_private* dgpriv;
int major,minor;
int dga_version;
XDGAMode *modes;
int i, num_modes;
int mode_to_use = 0;
/* Get DGA availability / version */
dga_version = DDRAW_DGA2_Available();
if (dga_version == 0)
return DDERR_GENERIC;
/* If we were just testing ... return OK */
if (lplpDD == NULL)
return DD_OK;
ddraw = (IDirectDrawImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectDrawImpl));
*lplpDD = (LPDIRECTDRAW)ddraw;
ddraw->ref = 1;
ICOM_VTBL(ddraw) = &dga2_ddvt;
ddraw->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(dga2_dd_private));
dgpriv = (dga2_dd_private*)ddraw->private;
TSXDGAQueryVersion(display,&major,&minor);
TRACE("XDGA is version %d.%d\n",major,minor);
TRACE("Opening the frame buffer.\n");
if (!TSXDGAOpenFramebuffer(display, DefaultScreen(display))) {
ERR("Error opening the frame buffer !!!\n");
return DDERR_GENERIC;
}
/* List all available modes */
modes = TSXDGAQueryModes(display, DefaultScreen(display), &num_modes);
dgpriv->modes = modes;
dgpriv->num_modes = num_modes;
TRACE("Available modes :\n");
for (i = 0; i < num_modes; i++) {
if (TRACE_ON(ddraw)) {
DPRINTF(" %d) - %s (FB: %dx%d / VP: %dx%d) - depth %d -",
modes[i].num,
modes[i].name, modes[i].imageWidth, modes[i].imageHeight,
modes[i].viewportWidth, modes[i].viewportHeight,
modes[i].depth
);
#define XX(x) if (modes[i].flags & x) DPRINTF(" "#x" ");
XX(XDGAConcurrentAccess);
XX(XDGASolidFillRect);
XX(XDGABlitRect);
XX(XDGABlitTransRect);
XX(XDGAPixmap);
#undef XX
DPRINTF("\n");
}
if ((MONITOR_GetHeight(&MONITOR_PrimaryMonitor) == modes[i].viewportHeight) &&
(MONITOR_GetWidth(&MONITOR_PrimaryMonitor) == modes[i].viewportWidth) &&
(MONITOR_GetDepth(&MONITOR_PrimaryMonitor) == modes[i].depth)
) {
mode_to_use = modes[i].num;
}
}
if (mode_to_use == 0) {
ERR("Could not find mode !\n");
mode_to_use = 1;
} else {
DPRINTF("Using mode number %d\n", mode_to_use);
}
dgpriv->DGA.InstallColormap = TSXDGAInstallColormap;
/* Initialize the frame buffer */
_DGA2_Initialize_FrameBuffer(ddraw, mode_to_use);
/* Set the input handling for relative mouse movements */
X11DRV_EVENT_SetInputMethod(X11DRV_INPUT_RELATIVE);
return DD_OK;
}
/* Where do these GUIDs come from? mkuuid.
* They exist solely to distinguish between the targets Wine support,
* and should be different than any other GUIDs in existence.
*/
static GUID DGA2_DirectDraw_GUID = { /* e2dcb020-dc60-11d1-8407-9714f5d50803 */
0xe2dcb020,
0xdc60,
0x11d1,
{0x84, 0x07, 0x97, 0x14, 0xf5, 0xd5, 0x08, 0x03}
};
ddraw_driver dga2_driver = {
&DGA2_DirectDraw_GUID,
"display",
"WINE XF86DGA2 DirectDraw Driver",
150,
DGA2_Create
};
#ifdef __GNUC__
static void DGA2_register(void) __attribute__((constructor));
#else /* defined(__GNUC__) */
static void __asm__dummy_dll_init(void) {
asm("\t.section .init ,\"ax\"\n"
"\tcall DGA2_register\n"
"\t.previous\n");
}
#endif /* defined(__GNUC__) */
static void DGA2_register(void) { ddraw_register_driver(&dga2_driver); }
#ifndef __WINE_DDRAW_DGA2_PRIVATE_H
#define __WINE_DDRAW_DGA2_PRIVATE_H
#include "ddraw_private.h"
#include "x11_private.h"
#include "dga_private.h"
#include "ts_xf86dga.h"
#include "ts_xf86dga2.h"
extern ICOM_VTABLE(IDirectDrawSurface4) dga2_dds4vt;
extern ICOM_VTABLE(IDirectDraw) dga2_ddvt;
typedef struct dga2_dd_private {
/* Reuse of the DGA code */
dga_dd_private DGA;
XDGADevice *dev;
XDGAMode *modes;
int num_modes;
} dga2_dd_private;
typedef x11_dp_private dga2_dp_private; /* reuse X11 palette stuff */
typedef dga_ds_private dga2_ds_private; /* reuse of DGA1 surface stuff */
extern void _DGA2_Initialize_FrameBuffer(IDirectDrawImpl *This, int mode);
#endif /* __WINE_DDRAW_DGA2_PRIVATE_H */
......@@ -5,9 +5,6 @@
#include "x11_private.h"
#include "ts_xf86dga.h"
#ifdef HAVE_LIBXXF86DGA2
# include "ts_xf86dga2.h"
#endif /* defined(HAVE_LIBXXF86DGA2) */
#ifdef HAVE_LIBXXF86VM
# include "ts_xf86vmode.h"
......@@ -15,10 +12,6 @@ extern XF86VidModeModeInfo *orig_mode;
#endif /* defined(HAVE_LIBXXF86VM) */
extern ICOM_VTABLE(IDirectDrawSurface4) dga_dds4vt;
#ifdef HAVE_LIBXXF86DGA2
extern ICOM_VTABLE(IDirectDrawSurface4) dga2_dds4vt;
#endif /* defined(HAVE_LIBXXF86DGA2) */
extern ICOM_VTABLE(IDirectDraw) dga_ddvt;
extern ICOM_VTABLE(IDirectDrawPalette) dga_ddpalvt;
......@@ -28,12 +21,7 @@ typedef struct dga_dd_private {
caddr_t fb_addr; /* start address of the framebuffer */
DWORD fb_memsize; /* total memory on the card */
DWORD vpmask; /* viewports in use flag bitmap */
DWORD version; /* DGA version */
#ifdef HAVE_LIBXXF86DGA2
XDGADevice *dev;
XDGAMode *modes;
int num_modes;
#endif
void (*InstallColormap)(Display *, int, Colormap) ;
} dga_dd_private;
typedef x11_dp_private dga_dp_private; /* reuse X11 palette stuff */
......@@ -42,8 +30,17 @@ typedef struct dga_ds_private {
DWORD fb_height;
} dga_ds_private;
#ifdef HAVE_LIBXXF86DGA2
extern void _DGA_Initialize_FrameBuffer(IDirectDrawImpl *This, int mode);
#endif
/* For usage in DGA2 */
extern ULONG WINAPI DGA_IDirectDrawSurface4Impl_Release(LPDIRECTDRAWSURFACE4 iface) ;
extern HRESULT WINAPI DGA_IDirectDrawSurface4Impl_SetPalette(LPDIRECTDRAWSURFACE4 iface,LPDIRECTDRAWPALETTE pal) ;
extern HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT(LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsd,
LPDIRECTDRAWSURFACE *lpdsf,IUnknown *lpunk) ;
extern HRESULT WINAPI DGA_IDirectDraw2Impl_QueryInterface(LPDIRECTDRAW2 iface,REFIID refiid,LPVOID *obj) ;
extern HRESULT WINAPI DGA_IDirectDraw2Impl_GetCaps(LPDIRECTDRAW2 iface,LPDDCAPS caps1,LPDDCAPS caps2) ;
extern HRESULT WINAPI DGA_IDirectDraw2Impl_GetDisplayMode(LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsfd) ;
extern HRESULT WINAPI DGA_IDirectDraw2Impl_GetAvailableVidMem(LPDIRECTDRAW2 iface,LPDDSCAPS ddscaps,LPDWORD total,LPDWORD free) ;
#endif /* __WINE_DDRAW_DGA_PRIVATE_H */
......@@ -55,12 +55,7 @@ HRESULT WINAPI DGA_IDirectDrawPaletteImpl_SetEntries(
This->palents[start+i].peGreen = palent[i].peGreen;
This->palents[start+i].peFlags = palent[i].peFlags;
}
#ifdef HAVE_LIBXXF86DGA2
if (ddpriv->version == 2) {
TSXDGAInstallColormap(display,DefaultScreen(display),dppriv->cm);
} else
#endif /* defined(HAVE_LIBXXF86DGA2) */
TSXF86DGAInstallColormap(display,DefaultScreen(display),dppriv->cm);
ddpriv->InstallColormap(display,DefaultScreen(display),dppriv->cm);
return DD_OK;
}
ICOM_VTABLE(IDirectDrawPalette) dga_ddpalvt =
......
......@@ -69,46 +69,6 @@ HRESULT WINAPI DGA_IDirectDrawSurface4Impl_Flip(
return DD_OK;
}
#ifdef HAVE_LIBXXF86DGA2
HRESULT WINAPI DGA2_IDirectDrawSurface4Impl_Flip(
LPDIRECTDRAWSURFACE4 iface,LPDIRECTDRAWSURFACE4 flipto,DWORD dwFlags
) {
ICOM_THIS(IDirectDrawSurface4Impl,iface);
IDirectDrawSurface4Impl* iflipto=(IDirectDrawSurface4Impl*)flipto;
DWORD xheight;
DSPRIVATE(This);
dga_ds_private *fspriv;
LPBYTE surf;
TRACE("(%p)->Flip(%p,%08lx)\n",This,iflipto,dwFlags);
iflipto = _common_find_flipto(This,iflipto);
/* and flip! */
fspriv = (dga_ds_private*)iflipto->private;
TSXDGASetViewport(display,DefaultScreen(display),0,fspriv->fb_height, XDGAFlipRetrace);
TSXDGASync(display,DefaultScreen(display));
TSXFlush(display);
if (iflipto->s.palette) {
DPPRIVATE(iflipto->s.palette);
if (dppriv->cm)
TSXDGAInstallColormap(display,DefaultScreen(display),dppriv->cm);
}
/* We need to switch the lowlevel surfaces, for DGA this is: */
/* The height within the framebuffer */
xheight = dspriv->fb_height;
dspriv->fb_height = fspriv->fb_height;
fspriv->fb_height = xheight;
/* And the assciated surface pointer */
surf = This->s.surface_desc.u1.lpSurface;
This->s.surface_desc.u1.lpSurface = iflipto->s.surface_desc.u1.lpSurface;
iflipto->s.surface_desc.u1.lpSurface = surf;
return DD_OK;
}
#endif /* defined(HAVE_LIBXXF86DGA2) */
HRESULT WINAPI DGA_IDirectDrawSurface4Impl_SetPalette(
LPDIRECTDRAWSURFACE4 iface,LPDIRECTDRAWPALETTE pal
) {
......@@ -129,12 +89,7 @@ HRESULT WINAPI DGA_IDirectDrawSurface4Impl_SetPalette(
IDirectDrawPalette_Release( (IDirectDrawPalette*)This->s.palette );
This->s.palette = ipal;
fppriv = (dga_dp_private*)This->s.palette->private;
#ifdef HAVE_LIBXXF86DGA2
if (ddpriv->version == 2)
TSXDGAInstallColormap(display,DefaultScreen(display),fppriv->cm);
else
#endif /* defined(HAVE_LIBXXF86DGA2) */
TSXF86DGAInstallColormap(display,DefaultScreen(display),fppriv->cm);
ddpriv->InstallColormap(display,DefaultScreen(display),fppriv->cm);
}
return DD_OK;
}
......@@ -218,55 +173,3 @@ ICOM_VTABLE(IDirectDrawSurface4) dga_dds4vt =
IDirectDrawSurface4Impl_GetUniquenessValue,
IDirectDrawSurface4Impl_ChangeUniquenessValue
};
#ifdef HAVE_LIBXXF86DGA2
ICOM_VTABLE(IDirectDrawSurface4) dga2_dds4vt =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirectDrawSurface4Impl_QueryInterface,
IDirectDrawSurface4Impl_AddRef,
DGA_IDirectDrawSurface4Impl_Release,
IDirectDrawSurface4Impl_AddAttachedSurface,
IDirectDrawSurface4Impl_AddOverlayDirtyRect,
IDirectDrawSurface4Impl_Blt,
IDirectDrawSurface4Impl_BltBatch,
IDirectDrawSurface4Impl_BltFast,
IDirectDrawSurface4Impl_DeleteAttachedSurface,
IDirectDrawSurface4Impl_EnumAttachedSurfaces,
IDirectDrawSurface4Impl_EnumOverlayZOrders,
DGA2_IDirectDrawSurface4Impl_Flip,
IDirectDrawSurface4Impl_GetAttachedSurface,
IDirectDrawSurface4Impl_GetBltStatus,
IDirectDrawSurface4Impl_GetCaps,
IDirectDrawSurface4Impl_GetClipper,
IDirectDrawSurface4Impl_GetColorKey,
IDirectDrawSurface4Impl_GetDC,
IDirectDrawSurface4Impl_GetFlipStatus,
IDirectDrawSurface4Impl_GetOverlayPosition,
IDirectDrawSurface4Impl_GetPalette,
IDirectDrawSurface4Impl_GetPixelFormat,
IDirectDrawSurface4Impl_GetSurfaceDesc,
IDirectDrawSurface4Impl_Initialize,
IDirectDrawSurface4Impl_IsLost,
IDirectDrawSurface4Impl_Lock,
IDirectDrawSurface4Impl_ReleaseDC,
IDirectDrawSurface4Impl_Restore,
IDirectDrawSurface4Impl_SetClipper,
IDirectDrawSurface4Impl_SetColorKey,
IDirectDrawSurface4Impl_SetOverlayPosition,
DGA_IDirectDrawSurface4Impl_SetPalette,
IDirectDrawSurface4Impl_Unlock,
IDirectDrawSurface4Impl_UpdateOverlay,
IDirectDrawSurface4Impl_UpdateOverlayDisplay,
IDirectDrawSurface4Impl_UpdateOverlayZOrder,
IDirectDrawSurface4Impl_GetDDInterface,
IDirectDrawSurface4Impl_PageLock,
IDirectDrawSurface4Impl_PageUnlock,
IDirectDrawSurface4Impl_SetSurfaceDesc,
IDirectDrawSurface4Impl_SetPrivateData,
IDirectDrawSurface4Impl_GetPrivateData,
IDirectDrawSurface4Impl_FreePrivateData,
IDirectDrawSurface4Impl_GetUniquenessValue,
IDirectDrawSurface4Impl_ChangeUniquenessValue
};
#endif /* defined(HAVE_LIBXXF86DGA2) */
/* DirectDrawSurface XF86DGA implementation
*
* DGA2's specific DirectDrawSurface routines
*/
#include "config.h"
#include "winerror.h"
#include <unistd.h>
#include <assert.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "debugtools.h"
#include "dga2_private.h"
DEFAULT_DEBUG_CHANNEL(ddraw);
#define DDPRIVATE(x) dga2_dd_private *ddpriv = ((dga2_dd_private*)(x)->private)
#define DPPRIVATE(x) dga2_dp_private *dppriv = ((dga2_dp_private*)(x)->private)
#define DSPRIVATE(x) dga2_ds_private *dspriv = ((dga2_ds_private*)(x)->private)
HRESULT WINAPI DGA2_IDirectDrawSurface4Impl_Flip(
LPDIRECTDRAWSURFACE4 iface,LPDIRECTDRAWSURFACE4 flipto,DWORD dwFlags
) {
ICOM_THIS(IDirectDrawSurface4Impl,iface);
IDirectDrawSurface4Impl* iflipto=(IDirectDrawSurface4Impl*)flipto;
DWORD xheight;
DSPRIVATE(This);
dga_ds_private *fspriv;
LPBYTE surf;
TRACE("(%p)->Flip(%p,%08lx)\n",This,iflipto,dwFlags);
iflipto = _common_find_flipto(This,iflipto);
/* and flip! */
fspriv = (dga_ds_private*)iflipto->private;
TSXDGASetViewport(display,DefaultScreen(display),0,fspriv->fb_height, XDGAFlipRetrace);
TSXDGASync(display,DefaultScreen(display));
TSXFlush(display);
if (iflipto->s.palette) {
DPPRIVATE(iflipto->s.palette);
if (dppriv->cm)
TSXDGAInstallColormap(display,DefaultScreen(display),dppriv->cm);
}
/* We need to switch the lowlevel surfaces, for DGA this is: */
/* The height within the framebuffer */
xheight = dspriv->fb_height;
dspriv->fb_height = fspriv->fb_height;
fspriv->fb_height = xheight;
/* And the assciated surface pointer */
surf = This->s.surface_desc.u1.lpSurface;
This->s.surface_desc.u1.lpSurface = iflipto->s.surface_desc.u1.lpSurface;
iflipto->s.surface_desc.u1.lpSurface = surf;
return DD_OK;
}
ICOM_VTABLE(IDirectDrawSurface4) dga2_dds4vt =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IDirectDrawSurface4Impl_QueryInterface,
IDirectDrawSurface4Impl_AddRef,
DGA_IDirectDrawSurface4Impl_Release,
IDirectDrawSurface4Impl_AddAttachedSurface,
IDirectDrawSurface4Impl_AddOverlayDirtyRect,
IDirectDrawSurface4Impl_Blt,
IDirectDrawSurface4Impl_BltBatch,
IDirectDrawSurface4Impl_BltFast,
IDirectDrawSurface4Impl_DeleteAttachedSurface,
IDirectDrawSurface4Impl_EnumAttachedSurfaces,
IDirectDrawSurface4Impl_EnumOverlayZOrders,
DGA2_IDirectDrawSurface4Impl_Flip,
IDirectDrawSurface4Impl_GetAttachedSurface,
IDirectDrawSurface4Impl_GetBltStatus,
IDirectDrawSurface4Impl_GetCaps,
IDirectDrawSurface4Impl_GetClipper,
IDirectDrawSurface4Impl_GetColorKey,
IDirectDrawSurface4Impl_GetDC,
IDirectDrawSurface4Impl_GetFlipStatus,
IDirectDrawSurface4Impl_GetOverlayPosition,
IDirectDrawSurface4Impl_GetPalette,
IDirectDrawSurface4Impl_GetPixelFormat,
IDirectDrawSurface4Impl_GetSurfaceDesc,
IDirectDrawSurface4Impl_Initialize,
IDirectDrawSurface4Impl_IsLost,
IDirectDrawSurface4Impl_Lock,
IDirectDrawSurface4Impl_ReleaseDC,
IDirectDrawSurface4Impl_Restore,
IDirectDrawSurface4Impl_SetClipper,
IDirectDrawSurface4Impl_SetColorKey,
IDirectDrawSurface4Impl_SetOverlayPosition,
DGA_IDirectDrawSurface4Impl_SetPalette,
IDirectDrawSurface4Impl_Unlock,
IDirectDrawSurface4Impl_UpdateOverlay,
IDirectDrawSurface4Impl_UpdateOverlayDisplay,
IDirectDrawSurface4Impl_UpdateOverlayZOrder,
IDirectDrawSurface4Impl_GetDDInterface,
IDirectDrawSurface4Impl_PageLock,
IDirectDrawSurface4Impl_PageUnlock,
IDirectDrawSurface4Impl_SetSurfaceDesc,
IDirectDrawSurface4Impl_SetPrivateData,
IDirectDrawSurface4Impl_GetPrivateData,
IDirectDrawSurface4Impl_FreePrivateData,
IDirectDrawSurface4Impl_GetUniquenessValue,
IDirectDrawSurface4Impl_ChangeUniquenessValue
};
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