1 /* DirectDraw using DGA or Xlib(XSHM)
3 * Copyright 1997-1999 Marcus Meissner
4 * Copyright 1998 Lionel Ulmer (most of Direct3D stuff)
17 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(ddraw);
22 #include "x11_private.h"
25 int XShmErrorFlag = 0;
28 static inline BOOL get_option( const char *name, BOOL def ) {
29 return PROFILE_GetWineIniBool( "x11drv", name, def );
33 DDRAW_XSHM_Available(void) {
35 if (get_option( "UseXShm", 1 )) {
36 if (TSXShmQueryExtension(display)) {
40 if (TSXShmQueryVersion(display, &major, &minor, &shpix))
48 static HRESULT X11_Create( LPDIRECTDRAW *lplpDD ) {
49 IDirectDrawImpl* ddraw;
51 x11_dd_private *x11priv;
53 if (lplpDD == NULL) /* Testing ... this driver works all the time */
56 *lplpDD = (LPDIRECTDRAW)HeapAlloc(
59 sizeof(IDirectDrawImpl)
61 ddraw = (IDirectDrawImpl*)*lplpDD;
62 ICOM_VTBL(ddraw)= &xlib_ddvt;
64 ddraw->private = HeapAlloc(
67 sizeof(x11_dd_private)
69 x11priv = (x11_dd_private*)ddraw->private;
71 /* At DirectDraw creation, the depth is the default depth */
72 depth = DefaultDepthOfScreen(X11DRV_GetXScreen());
74 switch (_common_depth_to_pixelformat(depth,(LPDIRECTDRAW)ddraw)) {
75 case -2: ERR("no depth conversion mode for depth %d found\n",depth); break;
76 case -1: WARN("No conversion needed for depth %d.\n",depth); break;
77 case 0: MESSAGE("Conversion needed from %d.\n",depth); break;
80 ddraw->d.height = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
81 ddraw->d.width = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
83 /* Test if XShm is available. */
84 if ((x11priv->xshm_active = DDRAW_XSHM_Available())) {
85 x11priv->xshm_compl = 0;
86 TRACE("Using XShm extension.\n");
92 /* Where do these GUIDs come from? mkuuid.
93 * They exist solely to distinguish between the targets Wine support,
94 * and should be different than any other GUIDs in existence.
96 static GUID X11_DirectDraw_GUID = { /* 1574a740-dc61-11d1-8407-f7875a7d1879 */
100 {0x84, 0x07, 0xf7, 0x87, 0x5a, 0x7d, 0x18, 0x79}
103 ddraw_driver x11_driver = {
104 &X11_DirectDraw_GUID,
106 "WINE X11 DirectDraw Driver",
111 DECL_GLOBAL_CONSTRUCTOR(X11_register) { ddraw_register_driver(&x11_driver); }