Commit fc67be9a authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

Added support for DirectDraw overlays using the XVideo extension.

parent dc71c0c9
......@@ -402,4 +402,5 @@ extern void _dump_surface_desc(DDSURFACEDESC *lpddsd);
extern void _dump_cooperativelevel(DWORD cooplevel);
extern void _dump_surface_desc(DDSURFACEDESC *lpddsd);
extern void _dump_DDCOLORKEY(void *in);
extern void _dump_DDOVERLAY(DWORD flagmask) ;
#endif /* __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H */
......@@ -51,6 +51,44 @@ void _dump_DDBLTFX(DWORD flagmask) {
DPRINTF("\n");
}
void _dump_DDOVERLAY(DWORD flagmask) {
int i;
const struct {
DWORD mask;
char *name;
} flags[] = {
#define FE(x) { x, #x},
FE(DDOVER_ALPHADEST)
FE(DDOVER_ALPHADESTCONSTOVERRIDE)
FE(DDOVER_ALPHADESTNEG)
FE(DDOVER_ALPHADESTSURFACEOVERRIDE)
FE(DDOVER_ALPHAEDGEBLEND)
FE(DDOVER_ALPHASRC)
FE(DDOVER_ALPHASRCCONSTOVERRIDE)
FE(DDOVER_ALPHASRCNEG)
FE(DDOVER_ALPHASRCSURFACEOVERRIDE)
FE(DDOVER_HIDE)
FE(DDOVER_KEYDEST)
FE(DDOVER_KEYDESTOVERRIDE)
FE(DDOVER_KEYSRC)
FE(DDOVER_KEYSRCOVERRIDE)
FE(DDOVER_SHOW)
FE(DDOVER_ADDDIRTYRECT)
FE(DDOVER_REFRESHDIRTYRECTS)
FE(DDOVER_REFRESHALL)
FE(DDOVER_DDFX)
FE(DDOVER_AUTOFLIP)
FE(DDOVER_BOB)
FE(DDOVER_OVERRIDEBOBWEAVE)
FE(DDOVER_INTERLEAVED)
#undef FE
};
for (i=0;i<sizeof(flags)/sizeof(flags[0]);i++)
if (flags[i].mask & flagmask)
DPRINTF("%s ",flags[i].name);
DPRINTF("\n");
}
void _dump_DDBLTFAST(DWORD flagmask) {
int i;
const struct {
......@@ -216,12 +254,13 @@ void _dump_pixelformat(void *in) {
DPRINTF("( ");
_dump_pixelformat_flag(pf->dwFlags);
if (pf->dwFlags & DDPF_FOURCC) {
DPRINTF(", dwFourCC (%08lx) : %c%c%c%c",
pf->dwFourCC,
DPRINTF(", dwFourCC code '%c%c%c%c' (0x%08lx) - %ld bits per pixel",
(unsigned char)( pf->dwFourCC &0xff),
(unsigned char)((pf->dwFourCC>> 8)&0xff),
(unsigned char)((pf->dwFourCC>>16)&0xff),
(unsigned char)((pf->dwFourCC>>24)&0xff)
(unsigned char)((pf->dwFourCC>>24)&0xff),
pf->dwFourCC,
pf->u.dwYUVBitCount
);
}
if (pf->dwFlags & DDPF_RGB) {
......
......@@ -44,6 +44,64 @@ DDRAW_XSHM_Available(void) {
return FALSE;
}
#ifdef HAVE_XVIDEO
static BOOL
DDRAW_XVIDEO_Available(x11_dd_private *x11ddp) {
unsigned int p_version, p_release, p_request_base, p_event_base, p_error_base;
if (TSXvQueryExtension(display, &p_version, &p_release, &p_request_base,
&p_event_base, &p_error_base) == Success) {
XvAdaptorInfo *ai;
int num_adaptators, i, default_port;
if ((p_version < 2) || ((p_version == 2) && (p_release < 2))) {
TRACE("XVideo extension does NOT support needed features (need version 2.2) !\n");
return FALSE;
}
if (TSXvQueryAdaptors(display, X11DRV_GetXRootWindow(), &num_adaptators, &ai) != Success) {
TRACE("Failed to get list of adaptators.\n");
return FALSE;
}
if (num_adaptators == 0) {
TRACE("No XVideo supporting adaptators found.\n");
return FALSE;
}
default_port = PROFILE_GetWineIniInt("x11drv", "XVideoPort", -1);
for (i = 0; i < num_adaptators; i++) {
if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask)) {
/* This supports everything I want : XvImages and the possibility to put something */
if (default_port == -1) {
default_port = ai[i].base_id;
break;
} else {
if ((ai[i].base_id <= default_port) &&
((ai[i].base_id + ai[i].num_ports) > default_port)) {
break;
}
}
}
}
if (i == num_adaptators) {
if (default_port != -1) {
ERR("User specified port (%d) not found.\n", default_port);
} else {
TRACE("No input + image capable device found.\n");
}
TSXvFreeAdaptorInfo(ai);
return FALSE;
}
x11ddp->port_id = default_port;
TRACE("XVideo support available (using version %d.%d)\n", p_version, p_release);
TSXvFreeAdaptorInfo(ai);
return TRUE;
}
return FALSE;
}
#endif
static HRESULT X11_Create( LPDIRECTDRAW *lplpDD ) {
IDirectDrawImpl* ddraw;
int depth;
......@@ -88,6 +146,13 @@ static HRESULT X11_Create( LPDIRECTDRAW *lplpDD ) {
TRACE("Using XShm extension.\n");
}
#endif
#ifdef HAVE_XVIDEO
/* Test if XVideo support is available */
if ((x11priv->xvideo_active = DDRAW_XVIDEO_Available(x11priv))) {
TRACE("Using XVideo extension on port '%ld'.\n", x11priv->port_id);
}
#endif
return DD_OK;
}
......
......@@ -18,6 +18,13 @@
# include "ts_xshm.h"
#endif /* defined(HAVE_LIBXXSHM) */
#ifdef HAVE_XVIDEO
#include "ts_xvideo.h"
#else
/* Fake type so that NOT to have too many #ifdef XVideo lying around */
typedef int XvImage;
#endif
#include "x11drv.h"
#include "ddraw_private.h"
......@@ -34,6 +41,10 @@ typedef struct x11_dd_private {
#ifdef HAVE_LIBXXSHM
int xshm_active, xshm_compl;
#endif /* defined(HAVE_LIBXXSHM) */
#ifdef HAVE_XVIDEO
BOOL xvideo_active;
XvPortID port_id;
#endif
Window drawable;
void *device_capabilities;
} x11_dd_private;
......@@ -47,7 +58,18 @@ extern HRESULT WINAPI Xlib_IDirectDrawPaletteImpl_SetEntries(LPDIRECTDRAWPALETTE
extern ULONG WINAPI Xlib_IDirectDrawPaletteImpl_Release(LPDIRECTDRAWPALETTE iface);
typedef struct x11_ds_private {
XImage *image;
BOOL is_overlay;
union {
XImage *image;
struct {
/* The 'image' field should be in FIRST !!!! The Flip function depends on that... */
XvImage *image;
BOOL shown;
RECT src_rect;
RECT dst_rect;
LPDIRECTDRAWSURFACE dest_surface;
} overlay;
} info;
#ifdef HAVE_LIBXXSHM
XShmSegmentInfo shminfo;
#endif
......
......@@ -811,6 +811,31 @@ typedef struct _DDPIXELFORMAT {
#define DDOVERFX_MIRRORLEFTRIGHT 0x00000002
#define DDOVERFX_MIRRORUPDOWN 0x00000004
/* UpdateOverlay flags */
#define DDOVER_ALPHADEST 0x00000001
#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002
#define DDOVER_ALPHADESTNEG 0x00000004
#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008
#define DDOVER_ALPHAEDGEBLEND 0x00000010
#define DDOVER_ALPHASRC 0x00000020
#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040
#define DDOVER_ALPHASRCNEG 0x00000080
#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100
#define DDOVER_HIDE 0x00000200
#define DDOVER_KEYDEST 0x00000400
#define DDOVER_KEYDESTOVERRIDE 0x00000800
#define DDOVER_KEYSRC 0x00001000
#define DDOVER_KEYSRCOVERRIDE 0x00002000
#define DDOVER_SHOW 0x00004000
#define DDOVER_ADDDIRTYRECT 0x00008000
#define DDOVER_REFRESHDIRTYRECTS 0x00010000
#define DDOVER_REFRESHALL 0x00020000
#define DDOVER_DDFX 0x00080000
#define DDOVER_AUTOFLIP 0x00100000
#define DDOVER_BOB 0x00200000
#define DDOVER_OVERRIDEBOBWEAVE 0x00400000
#define DDOVER_INTERLEAVED 0x00800000
/* DDCOLORKEY.dwFlags */
#define DDPF_ALPHAPIXELS 0x00000001
#define DDPF_ALPHA 0x00000002
......
......@@ -113,6 +113,9 @@ DesktopDoubleBuffered = N
; Code page used for captions in managed mode
; 0 means default ANSI code page (CP_ACP == 0)
TextCP=0
; Use this if you have more than one port for video on your setup
; (Wine uses for now the first 'input image' it founds).
;; XVideoPort = 43
[fonts]
;Read documentation/fonts before adding aliases
......
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