2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS GDI32
4 * PURPOSE: GDI DirectX inteface
5 * FILE: lib/gdi32/misc/gdientry.c
6 * PROGRAMERS: Alex Ionescu (alex@relsoft.net)
7 * Magnus Olsen (magnus@greatlord.com)
10 /* INCLUDES ******************************************************************/
20 /* DATA **********************************************************************/
25 #define GetDdHandle(Handle) ((HANDLE)Handle ? (HANDLE)Handle : ghDirectDraw)
29 /* CALLBACKS *****************************************************************/
34 * DdAddAttachedSurface
38 DdAddAttachedSurface(LPDDHAL_ADDATTACHEDSURFACEDATA Attach
)
41 return NtGdiDdAddAttachedSurface((HANDLE
)Attach
->lpDDSurface
->hDDSurface
,
42 (HANDLE
)Attach
->lpSurfAttached
->hDDSurface
,
43 (PDD_ADDATTACHEDSURFACEDATA
)Attach
);
53 DdBlt(LPDDHAL_BLTDATA Blt
)
57 /* Use the right surface */
58 if (Blt
->lpDDSrcSurface
)
60 Surface
= (HANDLE
)Blt
->lpDDSrcSurface
->hDDSurface
;
64 return NtGdiDdBlt((HANDLE
)Blt
->lpDDDestSurface
->hDDSurface
, Surface
, (PDD_BLTDATA
)Blt
);
74 DdDestroySurface(LPDDHAL_DESTROYSURFACEDATA pDestroySurface
)
76 DWORD Return
= DDHAL_DRIVER_NOTHANDLED
;
79 if (pDestroySurface
->lpDDSurface
->hDDSurface
)
81 /* Check if we shoudl really destroy it */
82 RealDestroy
= !(pDestroySurface
->lpDDSurface
->dwFlags
& DDRAWISURF_DRIVERMANAGED
) ||
83 !(pDestroySurface
->lpDDSurface
->dwFlags
& DDRAWISURF_INVALID
);
86 Return
= NtGdiDdDestroySurface((HANDLE
)pDestroySurface
->lpDDSurface
->hDDSurface
, RealDestroy
);
99 DdFlip(LPDDHAL_FLIPDATA Flip
)
102 * See http://msdn2.microsoft.com/en-us/library/ms794213.aspx and
103 * http://msdn2.microsoft.com/en-us/library/ms792675.aspx
106 HANDLE hSurfaceCurrentLeft
= NULL
;
107 HANDLE hSurfaceTargetLeft
= NULL
;
109 /* Auto flip off or on */
110 if (Flip
->dwFlags
& DDFLIP_STEREO
)
112 if ( (Flip
->lpSurfTargLeft
) &&
113 (Flip
->lpSurfCurrLeft
))
116 hSurfaceTargetLeft
= (HANDLE
) Flip
->lpSurfTargLeft
->hDDSurface
;
117 hSurfaceCurrentLeft
= (HANDLE
) Flip
->lpSurfCurrLeft
->hDDSurface
;
122 return NtGdiDdFlip( (HANDLE
) Flip
->lpSurfCurr
->hDDSurface
,
123 (HANDLE
) Flip
->lpSurfTarg
->hDDSurface
,
126 (PDD_FLIPDATA
) Flip
);
136 DdLock(LPDDHAL_LOCKDATA Lock
)
140 return NtGdiDdLock((HANDLE
)Lock
->lpDDSurface
->hDDSurface
,
142 (HANDLE
)Lock
->lpDDSurface
->hDC
);
152 DdUnlock(LPDDHAL_UNLOCKDATA Unlock
)
155 return NtGdiDdUnlock((HANDLE
)Unlock
->lpDDSurface
->hDDSurface
,
156 (PDD_UNLOCKDATA
)Unlock
);
166 DdGetBltStatus(LPDDHAL_GETBLTSTATUSDATA GetBltStatus
)
169 return NtGdiDdGetBltStatus((HANDLE
)GetBltStatus
->lpDDSurface
->hDDSurface
,
170 (PDD_GETBLTSTATUSDATA
)GetBltStatus
);
180 DdGetFlipStatus(LPDDHAL_GETFLIPSTATUSDATA GetFlipStatus
)
183 return NtGdiDdGetFlipStatus((HANDLE
)GetFlipStatus
->lpDDSurface
->hDDSurface
,
184 (PDD_GETFLIPSTATUSDATA
)GetFlipStatus
);
194 DdUpdateOverlay(LPDDHAL_UPDATEOVERLAYDATA UpdateOverlay
)
197 /* We have to handle this manually here */
198 if (UpdateOverlay
->dwFlags
& DDOVER_KEYDEST
)
200 /* Use the override */
201 UpdateOverlay
->dwFlags
&= ~DDOVER_KEYDEST
;
202 UpdateOverlay
->dwFlags
|= DDOVER_KEYDESTOVERRIDE
;
204 /* Set the overlay */
205 UpdateOverlay
->overlayFX
.dckDestColorkey
=
206 UpdateOverlay
->lpDDDestSurface
->ddckCKDestOverlay
;
208 if (UpdateOverlay
->dwFlags
& DDOVER_KEYSRC
)
210 /* Use the override */
211 UpdateOverlay
->dwFlags
&= ~DDOVER_KEYSRC
;
212 UpdateOverlay
->dwFlags
|= DDOVER_KEYSRCOVERRIDE
;
214 /* Set the overlay */
215 UpdateOverlay
->overlayFX
.dckSrcColorkey
=
216 UpdateOverlay
->lpDDSrcSurface
->ddckCKSrcOverlay
;
220 return NtGdiDdUpdateOverlay((HANDLE
)UpdateOverlay
->lpDDDestSurface
->hDDSurface
,
221 (HANDLE
)UpdateOverlay
->lpDDSrcSurface
->hDDSurface
,
222 (PDD_UPDATEOVERLAYDATA
)UpdateOverlay
);
228 * DdSetOverlayPosition
232 DdSetOverlayPosition(LPDDHAL_SETOVERLAYPOSITIONDATA SetOverlayPosition
)
235 return NtGdiDdSetOverlayPosition( (HANDLE
)SetOverlayPosition
->lpDDSrcSurface
->hDDSurface
,
236 (HANDLE
)SetOverlayPosition
->lpDDDestSurface
->hDDSurface
,
237 (PDD_SETOVERLAYPOSITIONDATA
) SetOverlayPosition
);
243 * DdWaitForVerticalBlank
247 DdWaitForVerticalBlank(LPDDHAL_WAITFORVERTICALBLANKDATA WaitForVerticalBlank
)
250 return NtGdiDdWaitForVerticalBlank(GetDdHandle(
251 WaitForVerticalBlank
->lpDD
->hDD
),
252 (PDD_WAITFORVERTICALBLANKDATA
)
253 WaitForVerticalBlank
);
263 DdCanCreateSurface(LPDDHAL_CANCREATESURFACEDATA CanCreateSurface
)
266 * Note : This functions are basic same, in win32k
267 * NtGdiDdCanCreateD3DBuffer and NtGdiDdCanCreateSurface are mergs
268 * toghter in win32k at end and retrurn same data, it is still sepreated
269 * at user mode but in kmode it is not.
273 return NtGdiDdCanCreateSurface(GetDdHandle(CanCreateSurface
->lpDD
->hDD
),
274 (PDD_CANCREATESURFACEDATA
)CanCreateSurface
);
284 DdCreateSurface(LPDDHAL_CREATESURFACEDATA pCreateSurface
)
286 DWORD Return
= DDHAL_DRIVER_NOTHANDLED
;
287 ULONG SurfaceCount
= pCreateSurface
->dwSCnt
;
288 DD_SURFACE_LOCAL DdSurfaceLocal
;
289 DD_SURFACE_MORE DdSurfaceMore
;
290 DD_SURFACE_GLOBAL DdSurfaceGlobal
;
292 HANDLE hPrevSurface
, hSurface
;
294 PDD_SURFACE_LOCAL pDdSurfaceLocal
= NULL
;
295 PDD_SURFACE_MORE pDdSurfaceMore
= NULL
;
296 PDD_SURFACE_GLOBAL pDdSurfaceGlobal
= NULL
;
298 PDD_SURFACE_LOCAL ptmpDdSurfaceLocal
= NULL
;
299 PDD_SURFACE_MORE ptmpDdSurfaceMore
= NULL
;
300 PDD_SURFACE_GLOBAL ptmpDdSurfaceGlobal
= NULL
;
301 PHANDLE phSurface
= NULL
, puhSurface
= NULL
;
303 LPDDSURFACEDESC pSurfaceDesc
= NULL
;
305 /* TODO: Optimize speed. Most games/dx apps/programs do not want one surface, they want at least two.
306 * So we need increase the stack to contain two surfaces instead of one. This will increase
307 * the speed of the apps when allocating buffers. How to increase the surface stack space:
308 * we need to create a struct for DD_SURFACE_LOCAL DdSurfaceLocal, DD_SURFACE_MORE DdSurfaceMore
309 * DD_SURFACE_GLOBAL DdSurfaceGlobal, HANDLE hPrevSurface, hSurface like
310 * struct { DD_SURFACE_LOCAL DdSurfaceLocal1, DD_SURFACE_LOCAL DdSurfaceLocal2 }
311 * in a way that it may contain two surfaces, maybe even four. We need to watch what is most common before
312 * we create the size. Activate this IF when you start doing the optimze and please also
313 * take reports from users which value they got here.
318 sprintf ( buffer
, "Function %s : Optimze max to %d Surface ? (%s:%d)\n", __FUNCTION__
, (int)SurfaceCount
,__FILE__
,__LINE__
);
319 OutputDebugStringA(buffer
);
323 /* Check how many surfaces there are */
324 if (SurfaceCount
!= 1)
326 /* We got more than one surface, so we need to allocate memory for them */
327 pDdSurfaceLocal
= (PDD_SURFACE_LOCAL
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(DD_SURFACE_LOCAL
) * SurfaceCount
));
328 pDdSurfaceMore
= (PDD_SURFACE_MORE
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(DD_SURFACE_MORE
) * SurfaceCount
));
329 pDdSurfaceGlobal
= (PDD_SURFACE_GLOBAL
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(DD_SURFACE_GLOBAL
) * SurfaceCount
));
330 phSurface
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(HANDLE
) * SurfaceCount
));
331 puhSurface
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(HANDLE
) * SurfaceCount
));
333 /* Check if we successfully allocated all memory we need */
334 if ((pDdSurfaceLocal
== NULL
) || (pDdSurfaceMore
== NULL
) || (pDdSurfaceGlobal
== NULL
) || (phSurface
== NULL
) || (puhSurface
== NULL
))
336 pCreateSurface
->ddRVal
= DDERR_OUTOFMEMORY
;
338 if ( pDdSurfaceLocal
!= NULL
)
340 HeapFree(GetProcessHeap(), 0, pDdSurfaceLocal
);
343 if ( pDdSurfaceMore
!= NULL
)
345 HeapFree(GetProcessHeap(), 0, pDdSurfaceMore
);
348 if ( pDdSurfaceGlobal
!= NULL
)
350 HeapFree(GetProcessHeap(), 0, pDdSurfaceGlobal
);
353 if ( phSurface
!= NULL
)
355 HeapFree(GetProcessHeap(), 0, phSurface
);
358 if ( puhSurface
!= NULL
)
360 HeapFree(GetProcessHeap(), 0, puhSurface
);
363 return DDHAL_DRIVER_HANDLED
;
368 /* We'll use what we have on the stack */
369 pDdSurfaceLocal
= &DdSurfaceLocal
;
370 pDdSurfaceMore
= &DdSurfaceMore
;
371 pDdSurfaceGlobal
= &DdSurfaceGlobal
;
372 phSurface
= &hPrevSurface
;
373 puhSurface
= &hSurface
;
375 /* Clear the structures */
376 RtlZeroMemory(&DdSurfaceLocal
, sizeof(DdSurfaceLocal
));
377 RtlZeroMemory(&DdSurfaceGlobal
, sizeof(DdSurfaceGlobal
));
378 RtlZeroMemory(&DdSurfaceMore
, sizeof(DdSurfaceMore
));
381 /* check if we got a surface or not */
384 /* Loop for each surface */
385 ptmpDdSurfaceGlobal
= pDdSurfaceGlobal
;
386 ptmpDdSurfaceLocal
= pDdSurfaceLocal
;
387 ptmpDdSurfaceMore
= pDdSurfaceMore
;
388 pSurfaceDesc
= pCreateSurface
->lpDDSurfaceDesc
;
390 for (i
= 0; i
< SurfaceCount
; i
++)
392 LPDDRAWI_DDRAWSURFACE_LCL lcl
= pCreateSurface
->lplpSList
[i
];
393 LPDDRAWI_DDRAWSURFACE_GBL gpl
= pCreateSurface
->lplpSList
[i
]->lpGbl
;
395 phSurface
[i
] = (HANDLE
)lcl
->hDDSurface
;
396 ptmpDdSurfaceLocal
->ddsCaps
.dwCaps
= lcl
->ddsCaps
.dwCaps
;
398 ptmpDdSurfaceLocal
->dwFlags
= (ptmpDdSurfaceLocal
->dwFlags
&
399 (0xB0000000 | DDRAWISURF_INMASTERSPRITELIST
|
400 DDRAWISURF_HELCB
| DDRAWISURF_FRONTBUFFER
|
401 DDRAWISURF_BACKBUFFER
| DDRAWISURF_INVALID
|
402 DDRAWISURF_DCIBUSY
| DDRAWISURF_DCILOCK
)) |
403 (lcl
->dwFlags
& DDRAWISURF_DRIVERMANAGED
);
405 ptmpDdSurfaceGlobal
->wWidth
= gpl
->wWidth
;
406 ptmpDdSurfaceGlobal
->wHeight
= gpl
->wHeight
;
407 ptmpDdSurfaceGlobal
->lPitch
= gpl
->lPitch
;
408 ptmpDdSurfaceGlobal
->fpVidMem
= gpl
->fpVidMem
;
409 ptmpDdSurfaceGlobal
->dwBlockSizeX
= gpl
->dwBlockSizeX
;
410 ptmpDdSurfaceGlobal
->dwBlockSizeY
= gpl
->dwBlockSizeY
;
412 if (lcl
->dwFlags
& DDRAWISURF_HASPIXELFORMAT
)
414 RtlCopyMemory( &ptmpDdSurfaceGlobal
->ddpfSurface
,
416 sizeof(DDPIXELFORMAT
));
418 ptmpDdSurfaceGlobal
->ddpfSurface
.dwSize
= sizeof(DDPIXELFORMAT
);
422 RtlCopyMemory( &ptmpDdSurfaceGlobal
->ddpfSurface
,
423 &gpl
->lpDD
->vmiData
.ddpfDisplay
,
424 sizeof(DDPIXELFORMAT
));
427 /* Note if lcl->lpSurfMore is NULL zero out
428 * ptmpDdSurfaceMore->ddsCapsEx.dwCaps2,
429 * dwCaps3, dwCaps4, ptmpDdSurfaceMore->dwSurfaceHandle
433 ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps2
= lcl
->lpSurfMore
->ddsCapsEx
.dwCaps2
;
434 ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps3
= lcl
->lpSurfMore
->ddsCapsEx
.dwCaps3
;
435 ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps4
= lcl
->lpSurfMore
->ddsCapsEx
.dwCaps4
;
436 ptmpDdSurfaceMore
->dwSurfaceHandle
= lcl
->lpSurfMore
->dwSurfaceHandle
;
440 /* count to next SurfaceCount */
441 ptmpDdSurfaceGlobal
= (PDD_SURFACE_GLOBAL
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceGlobal
)) + sizeof(DD_SURFACE_GLOBAL
));
442 ptmpDdSurfaceLocal
= (PDD_SURFACE_LOCAL
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceLocal
)) + sizeof(DD_SURFACE_LOCAL
));
443 ptmpDdSurfaceMore
= (PDD_SURFACE_MORE
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceMore
)) + sizeof(DD_SURFACE_MORE
));
447 /* Call win32k now */
448 pCreateSurface
->ddRVal
= DDERR_GENERIC
;
450 Return
= NtGdiDdCreateSurface(GetDdHandle(pCreateSurface
->lpDD
->hDD
),
456 (PDD_CREATESURFACEDATA
)pCreateSurface
,
459 if (SurfaceCount
== 0)
461 pCreateSurface
->ddRVal
= DDERR_GENERIC
;
465 ptmpDdSurfaceMore
= pDdSurfaceMore
;
466 ptmpDdSurfaceGlobal
= pDdSurfaceGlobal
;
467 ptmpDdSurfaceLocal
= pDdSurfaceLocal
;
469 for (i
=0;i
<SurfaceCount
;i
++)
471 LPDDRAWI_DDRAWSURFACE_LCL lcl
= pCreateSurface
->lplpSList
[i
];
472 LPDDRAWI_DDRAWSURFACE_GBL gpl
= pCreateSurface
->lplpSList
[i
]->lpGbl
;
474 gpl
->lPitch
= ptmpDdSurfaceGlobal
->lPitch
;
475 gpl
->fpVidMem
= ptmpDdSurfaceGlobal
->fpVidMem
;
476 gpl
->dwBlockSizeX
= ptmpDdSurfaceGlobal
->dwBlockSizeX
;
477 gpl
->dwBlockSizeY
= ptmpDdSurfaceGlobal
->dwBlockSizeY
;
479 if (lcl
->dwFlags
& DDRAWISURF_HASPIXELFORMAT
)
481 RtlCopyMemory( &gpl
->ddpfSurface
, &ptmpDdSurfaceGlobal
->ddpfSurface
, sizeof(DDPIXELFORMAT
));
484 if (pCreateSurface
->ddRVal
!= DD_OK
)
489 NtGdiDdDeleteSurfaceObject( (HANDLE
)lcl
->hDDSurface
);
496 lcl
->hDDSurface
= (ULONG_PTR
) puhSurface
[i
];
499 lcl
->ddsCaps
.dwCaps
= ptmpDdSurfaceLocal
->ddsCaps
.dwCaps
;
502 lcl
->lpSurfMore
->ddsCapsEx
.dwCaps2
= ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps2
;
503 lcl
->lpSurfMore
->ddsCapsEx
.dwCaps3
= ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps3
;
504 lcl
->lpSurfMore
->ddsCapsEx
.dwCaps4
= ptmpDdSurfaceMore
->ddsCapsEx
.dwCaps4
;
507 /* count to next SurfaceCount */
508 ptmpDdSurfaceGlobal
= (PDD_SURFACE_GLOBAL
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceGlobal
)) + sizeof(DD_SURFACE_GLOBAL
));
509 ptmpDdSurfaceLocal
= (PDD_SURFACE_LOCAL
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceLocal
)) + sizeof(DD_SURFACE_LOCAL
));
510 ptmpDdSurfaceMore
= (PDD_SURFACE_MORE
) (((PBYTE
) ((ULONG_PTR
) ptmpDdSurfaceMore
)) + sizeof(DD_SURFACE_MORE
));
514 /* Check if we have to free all our local allocations */
515 if (SurfaceCount
> 1)
517 if ( pDdSurfaceLocal
!= NULL
)
519 HeapFree(GetProcessHeap(), 0, pDdSurfaceLocal
);
522 if ( pDdSurfaceMore
!= NULL
)
524 HeapFree(GetProcessHeap(), 0, pDdSurfaceMore
);
527 if ( pDdSurfaceGlobal
!= NULL
)
529 HeapFree(GetProcessHeap(), 0, pDdSurfaceGlobal
);
532 if ( phSurface
!= NULL
)
534 HeapFree(GetProcessHeap(), 0, phSurface
);
537 if ( puhSurface
!= NULL
)
539 HeapFree(GetProcessHeap(), 0, puhSurface
);
554 DdSetColorKey(LPDDHAL_SETCOLORKEYDATA pSetColorKey
)
557 return NtGdiDdSetColorKey((HANDLE
)pSetColorKey
->lpDDSurface
->hDDSurface
,
558 (PDD_SETCOLORKEYDATA
)pSetColorKey
);
568 DdGetScanLine(LPDDHAL_GETSCANLINEDATA pGetScanLine
)
571 return NtGdiDdGetScanLine(GetDdHandle(pGetScanLine
->lpDD
->hDD
),
572 (PDD_GETSCANLINEDATA
)pGetScanLine
);
583 DvpCreateVideoPort(LPDDHAL_CREATEVPORTDATA pDvdCreatePort
)
585 pDvdCreatePort
->lpVideoPort
->hDDVideoPort
=
586 NtGdiDvpCreateVideoPort(GetDdHandle(pDvdCreatePort
->lpDD
->lpGbl
->hDD
),
587 (PDD_CREATEVPORTDATA
) pDvdCreatePort
);
599 DvpDestroyVideoPort(LPDDHAL_DESTROYVPORTDATA pDvdDestoryPort
)
601 return NtGdiDvpDestroyVideoPort(pDvdDestoryPort
->lpVideoPort
->hDDVideoPort
, (PDD_DESTROYVPORTDATA
)pDvdDestoryPort
);
611 DvpFlipVideoPort(LPDDHAL_FLIPVPORTDATA pDvdPortFlip
)
613 return NtGdiDvpFlipVideoPort(pDvdPortFlip
->lpVideoPort
->hDDVideoPort
,
614 (HANDLE
)pDvdPortFlip
->lpSurfCurr
->hDDSurface
,
615 (HANDLE
)pDvdPortFlip
->lpSurfTarg
->hDDSurface
,
616 (PDD_FLIPVPORTDATA
) pDvdPortFlip
);
622 * DvpGetVideoPortBandwidth
626 DvpGetVideoPortBandwidth(LPDDHAL_GETVPORTBANDWIDTHDATA pDvdPortBandWidth
)
628 return NtGdiDvpGetVideoPortBandwidth(pDvdPortBandWidth
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTBANDWIDTHDATA
)pDvdPortBandWidth
);
638 DvpColorControl(LPDDHAL_VPORTCOLORDATA pDvdPortColorControl
)
640 return NtGdiDvpColorControl(pDvdPortColorControl
->lpVideoPort
->hDDVideoPort
, (PDD_VPORTCOLORDATA
) pDvdPortColorControl
);
646 * DvpGetVideoSignalStatus
650 DvpGetVideoSignalStatus(LPDDHAL_GETVPORTSIGNALDATA pDvdPortVideoSignalStatus
)
652 return NtGdiDvpGetVideoSignalStatus(pDvdPortVideoSignalStatus
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTSIGNALDATA
) pDvdPortVideoSignalStatus
);
658 * DvpGetVideoPortFlipStatus
662 DvpGetVideoPortFlipStatus(LPDDHAL_GETVPORTFLIPSTATUSDATA pDvdPortVideoPortFlipStatus
)
664 return NtGdiDvpGetVideoPortFlipStatus(GetDdHandle(pDvdPortVideoPortFlipStatus
->lpDD
->lpGbl
->hDD
), (PDD_GETVPORTFLIPSTATUSDATA
) pDvdPortVideoPortFlipStatus
);
671 * DvpCanCreateVideoPort
675 DvpCanCreateVideoPort(LPDDHAL_CANCREATEVPORTDATA pDvdCanCreateVideoPort
)
677 return NtGdiDvpCanCreateVideoPort(GetDdHandle(pDvdCanCreateVideoPort
->lpDD
->lpGbl
->hDD
), (PDD_CANCREATEVPORTDATA
) pDvdCanCreateVideoPort
);
682 * DvpWaitForVideoPortSync
686 DvpWaitForVideoPortSync(LPDDHAL_WAITFORVPORTSYNCDATA pDvdWaitForVideoPortSync
)
688 return NtGdiDvpWaitForVideoPortSync(pDvdWaitForVideoPortSync
->lpVideoPort
->hDDVideoPort
, (PDD_WAITFORVPORTSYNCDATA
) pDvdWaitForVideoPortSync
);
698 DvpUpdateVideoPort(LPDDHAL_UPDATEVPORTDATA pDvdUpdateVideoPort
)
701 * Windows XP limit to max 10 handles of videoport surface and Vbi
702 * ReactOS doing same to keep compatible, if it is more that 10
703 * videoport surface or vbi the stack will be curpted in windows xp
704 * ReactOS safe guard againts that
708 HANDLE phSurfaceVideo
[10];
709 HANDLE phSurfaceVbi
[10];
711 if (pDvdUpdateVideoPort
->dwFlags
!= DDRAWI_VPORTSTOP
)
714 DWORD dwNumVBIAutoflip
;
716 /* Take copy of lplpDDSurface for the handle value will be modify in dxg */
717 dwNumAutoflip
= pDvdUpdateVideoPort
->dwNumAutoflip
;
718 if ((dwNumAutoflip
== 0) &&
719 (pDvdUpdateVideoPort
->lplpDDSurface
== 0))
724 if (dwNumAutoflip
!= 0)
726 if (dwNumAutoflip
>10)
730 memcpy(phSurfaceVideo
,pDvdUpdateVideoPort
->lplpDDSurface
,dwNumAutoflip
*sizeof(HANDLE
));
733 /* Take copy of lplpDDVBISurface for the handle value will be modify in dxg */
734 dwNumVBIAutoflip
= pDvdUpdateVideoPort
->dwNumVBIAutoflip
;
735 if ( (dwNumVBIAutoflip
== 0) &&
736 (pDvdUpdateVideoPort
->lplpDDVBISurface
== 0) )
741 if (dwNumVBIAutoflip
!= 0)
743 if (dwNumVBIAutoflip
>10)
745 dwNumVBIAutoflip
= 10;
747 memcpy(phSurfaceVbi
,pDvdUpdateVideoPort
->lplpDDVBISurface
,dwNumVBIAutoflip
*sizeof(HANDLE
));
752 return NtGdiDvpUpdateVideoPort(pDvdUpdateVideoPort
->lpVideoPort
->hDDVideoPort
,phSurfaceVideo
,phSurfaceVbi
, (PDD_UPDATEVPORTDATA
)pDvdUpdateVideoPort
);
758 * DvpWaitForVideoPortSync
762 DvpGetVideoPortField(LPDDHAL_FLIPVPORTDATA pDvdGetVideoPortField
)
764 return NtGdiDvpGetVideoPortField(pDvdGetVideoPortField
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTFIELDDATA
)pDvdGetVideoPortField
);
770 * DvpWaitForVideoPortSync
774 DvpGetVideoPortInputFormats(LPDDHAL_GETVPORTINPUTFORMATDATA pDvdGetVideoPortInputFormat
)
776 return NtGdiDvpGetVideoPortInputFormats(pDvdGetVideoPortInputFormat
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTINPUTFORMATDATA
) pDvdGetVideoPortInputFormat
);
782 * DvpGetVideoPortLine
786 DvpGetVideoPortLine(LPDDHAL_GETVPORTLINEDATA pDvdGetVideoPortLine
)
788 return NtGdiDvpGetVideoPortLine(pDvdGetVideoPortLine
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTLINEDATA
)pDvdGetVideoPortLine
);
794 * DvpGetVideoPortOutputFormats
798 DvpGetVideoPortOutputFormats(LPDDHAL_GETVPORTLINEDATA pDvdGetVideoPortOutputFormat
)
800 return NtGdiDvpGetVideoPortLine(pDvdGetVideoPortOutputFormat
->lpVideoPort
->hDDVideoPort
, (PDD_GETVPORTLINEDATA
)pDvdGetVideoPortOutputFormat
);
806 * DvpGetVideoPortConnectInfo
810 DvpGetVideoPortConnectInfo(LPDDHAL_GETVPORTCONNECTDATA pDvdGetVideoPortInfo
)
812 return NtGdiDvpGetVideoPortConnectInfo( GetDdHandle( pDvdGetVideoPortInfo
->lpDD
->lpGbl
->hDD
) , (PDD_GETVPORTCONNECTDATA
) pDvdGetVideoPortInfo
);
818 * DdGetAvailDriverMemory
822 DdGetAvailDriverMemory(LPDDHAL_GETAVAILDRIVERMEMORYDATA pDdGetAvailDriverMemory
)
824 return NtGdiDdGetAvailDriverMemory(GetDdHandle( pDdGetAvailDriverMemory
->lpDD
->hDD
), (PDD_GETAVAILDRIVERMEMORYDATA
) pDdGetAvailDriverMemory
);
834 DdAlphaBlt(LPDDHAL_BLTDATA pDdAlphaBlt
)
836 HANDLE hDDSrcSurface
= 0;
838 if (pDdAlphaBlt
->lpDDSrcSurface
!= 0)
840 hDDSrcSurface
= (HANDLE
) pDdAlphaBlt
->lpDDSrcSurface
->hDDSurface
;
843 return NtGdiDdAlphaBlt((HANDLE
)pDdAlphaBlt
->lpDDDestSurface
->hDDSurface
, hDDSrcSurface
, (PDD_BLTDATA
)&pDdAlphaBlt
);
853 DdCreateSurfaceEx(LPDDHAL_CREATESURFACEEXDATA pDdCreateSurfaceEx
)
855 pDdCreateSurfaceEx
->ddRVal
= NtGdiDdCreateSurfaceEx( GetDdHandle(pDdCreateSurfaceEx
->lpDDLcl
->lpGbl
->hDD
),
856 (HANDLE
)pDdCreateSurfaceEx
->lpDDSLcl
->hDDSurface
,
857 pDdCreateSurfaceEx
->lpDDSLcl
->lpSurfMore
->dwSurfaceHandle
);
868 DdColorControl(LPDDHAL_COLORCONTROLDATA pDdColorControl
)
870 return NtGdiDdColorControl( (HANDLE
) pDdColorControl
->lpDDSurface
->hDDSurface
, (PDD_COLORCONTROLDATA
) &pDdColorControl
);
880 DdSetExclusiveMode(LPDDHAL_SETEXCLUSIVEMODEDATA pDdSetExclusiveMode
)
882 return NtGdiDdSetExclusiveMode( GetDdHandle(pDdSetExclusiveMode
->lpDD
->hDD
), (PDD_SETEXCLUSIVEMODEDATA
) &pDdSetExclusiveMode
);
892 DdFlipToGDISurface(LPDDHAL_FLIPTOGDISURFACEDATA pDdFlipToGDISurface
)
894 return NtGdiDdFlipToGDISurface( GetDdHandle(pDdFlipToGDISurface
->lpDD
->hDD
), (PDD_FLIPTOGDISURFACEDATA
) &pDdFlipToGDISurface
);
900 DdGetDriverInfo(LPDDHAL_GETDRIVERINFODATA pData
)
902 DDHAL_GETDRIVERINFODATA pDrvInfoData
;
903 DWORD retValue
= DDHAL_DRIVER_NOTHANDLED
;
906 /* FIXME add SEH around this functions */
908 RtlZeroMemory(&pDrvInfoData
, sizeof (DDHAL_GETDRIVERINFODATA
));
909 RtlCopyMemory(&pDrvInfoData
.guidInfo
, &pData
->guidInfo
, sizeof(GUID
));
911 hDD
= GetDdHandle(pData
->dwContext
);
913 pDrvInfoData
.dwSize
= sizeof (DDHAL_GETDRIVERINFODATA
);
914 pDrvInfoData
.ddRVal
= DDERR_GENERIC
;
915 pDrvInfoData
.dwContext
= (ULONG_PTR
)hDD
;
918 /* Videoport Callbacks check and setup for DirectX/ ReactX */
919 if (IsEqualGUID(&pData
->guidInfo
, &GUID_VideoPortCallbacks
))
921 DDHAL_DDVIDEOPORTCALLBACKS pDvdPort
;
922 DDHAL_DDVIDEOPORTCALLBACKS
* pUserDvdPort
= (DDHAL_DDVIDEOPORTCALLBACKS
*)pData
->lpvData
;
924 /* Clear internal out buffer and set it up*/
925 RtlZeroMemory(&pDvdPort
, DDVIDEOPORTCALLBACKSSIZE
);
926 pDvdPort
.dwSize
= DDVIDEOPORTCALLBACKSSIZE
;
928 /* set up internal buffer */
929 pDrvInfoData
.lpvData
= (PVOID
)&pDvdPort
;
930 pDrvInfoData
.dwExpectedSize
= DDVIDEOPORTCALLBACKSSIZE
;
933 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
935 /* Setup user out buffer and convert kmode callbacks to user mode */
936 pUserDvdPort
->dwSize
= DDVIDEOPORTCALLBACKSSIZE
;
937 pUserDvdPort
->dwFlags
= pDrvInfoData
.dwFlags
= 0;
939 pUserDvdPort
->dwFlags
= (pDrvInfoData
.dwFlags
& ~(DDHAL_VPORT32_CREATEVIDEOPORT
| DDHAL_VPORT32_FLIP
|
940 DDHAL_VPORT32_DESTROY
| DDHAL_VPORT32_UPDATE
| DDHAL_VPORT32_WAITFORSYNC
)) |
941 (DDHAL_VPORT32_CREATEVIDEOPORT
| DDHAL_VPORT32_FLIP
|
942 DDHAL_VPORT32_DESTROY
| DDHAL_VPORT32_UPDATE
);
944 pData
->dwActualSize
= DDVIDEOPORTCALLBACKSSIZE
;
945 pUserDvdPort
->CreateVideoPort
= (LPDDHALVPORTCB_CREATEVIDEOPORT
) DvpCreateVideoPort
;
946 pUserDvdPort
->FlipVideoPort
= (LPDDHALVPORTCB_FLIP
) DvpFlipVideoPort
;
947 pUserDvdPort
->DestroyVideoPort
= (LPDDHALVPORTCB_DESTROYVPORT
) DvpDestroyVideoPort
;
948 pUserDvdPort
->UpdateVideoPort
= (LPDDHALVPORTCB_UPDATE
) DvpUpdateVideoPort
;
950 if (pDvdPort
.CanCreateVideoPort
)
952 pUserDvdPort
->CanCreateVideoPort
= (LPDDHALVPORTCB_CANCREATEVIDEOPORT
) DvpCanCreateVideoPort
;
955 if (pDvdPort
.GetVideoPortBandwidth
)
957 pUserDvdPort
->GetVideoPortBandwidth
= (LPDDHALVPORTCB_GETBANDWIDTH
) DvpGetVideoPortBandwidth
;
960 if (pDvdPort
.GetVideoPortInputFormats
)
962 pUserDvdPort
->GetVideoPortInputFormats
= (LPDDHALVPORTCB_GETINPUTFORMATS
) DvpGetVideoPortInputFormats
;
965 if (pDvdPort
.GetVideoPortOutputFormats
)
967 pUserDvdPort
->GetVideoPortOutputFormats
= (LPDDHALVPORTCB_GETOUTPUTFORMATS
) DvpGetVideoPortOutputFormats
;
970 if (pDvdPort
.GetVideoPortField
)
972 pUserDvdPort
->GetVideoPortField
= (LPDDHALVPORTCB_GETFIELD
) DvpGetVideoPortField
;
975 if (pDvdPort
.GetVideoPortLine
)
977 pUserDvdPort
->GetVideoPortLine
= (LPDDHALVPORTCB_GETLINE
) DvpGetVideoPortLine
;
980 if (pDvdPort
.GetVideoPortConnectInfo
)
982 pUserDvdPort
->GetVideoPortConnectInfo
= (LPDDHALVPORTCB_GETVPORTCONNECT
) DvpGetVideoPortConnectInfo
;
985 if (pDvdPort
.GetVideoPortFlipStatus
)
987 pUserDvdPort
->GetVideoPortFlipStatus
= (LPDDHALVPORTCB_GETFLIPSTATUS
) DvpGetVideoPortFlipStatus
;
990 if (pDvdPort
.WaitForVideoPortSync
)
992 pUserDvdPort
->WaitForVideoPortSync
= (LPDDHALVPORTCB_WAITFORSYNC
) DvpWaitForVideoPortSync
;
995 if (pDvdPort
.GetVideoSignalStatus
)
997 pUserDvdPort
->GetVideoSignalStatus
= (LPDDHALVPORTCB_GETSIGNALSTATUS
) DvpGetVideoSignalStatus
;
1000 if (pDvdPort
.ColorControl
)
1002 pUserDvdPort
->ColorControl
= (LPDDHALVPORTCB_COLORCONTROL
) DvpColorControl
;
1005 /* Windows XP never repot back the true return value,
1006 * it only report back if we have a driver or not
1007 * ReactOS keep this behoir to be compatible with
1010 pData
->ddRVal
= retValue
;
1013 /* Color Control Callbacks check and setup for DirectX/ ReactX */
1014 if (IsEqualGUID(&pData
->guidInfo
, &GUID_ColorControlCallbacks
))
1016 DDHAL_DDCOLORCONTROLCALLBACKS pColorControl
;
1017 DDHAL_DDCOLORCONTROLCALLBACKS
* pUserColorControl
= (DDHAL_DDCOLORCONTROLCALLBACKS
*)pData
->lpvData
;
1019 /* Clear internal out buffer and set it up*/
1020 RtlZeroMemory(&pColorControl
, DDCOLORCONTROLCALLBACKSSIZE
);
1021 pColorControl
.dwSize
= DDCOLORCONTROLCALLBACKSSIZE
;
1023 /* set up internal buffer */
1024 pDrvInfoData
.lpvData
= (PVOID
)&pColorControl
;
1025 pDrvInfoData
.dwExpectedSize
= DDCOLORCONTROLCALLBACKSSIZE
;
1028 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1030 pData
->dwActualSize
= DDCOLORCONTROLCALLBACKSSIZE
;
1031 pData
->dwFlags
= pDrvInfoData
.dwFlags
;
1033 pUserColorControl
->dwSize
= DDCOLORCONTROLCALLBACKSSIZE
;
1034 pUserColorControl
->dwFlags
= pUserColorControl
->dwFlags
;
1036 if (pColorControl
.ColorControl
!= NULL
)
1038 pUserColorControl
->ColorControl
= (LPDDHALCOLORCB_COLORCONTROL
) DdColorControl
;
1041 /* Windows XP never repot back the true return value,
1042 * it only report back if we have a driver or not
1043 * ReactOS keep this behoir to be compatible with
1046 pData
->ddRVal
= retValue
;
1049 /* Misc Callbacks check and setup for DirectX/ ReactX */
1050 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_MiscellaneousCallbacks
))
1052 DDHAL_DDMISCELLANEOUSCALLBACKS pMisc
;
1053 DDHAL_DDMISCELLANEOUSCALLBACKS
* pUserMisc
= (DDHAL_DDMISCELLANEOUSCALLBACKS
*)pData
->lpvData
;
1055 /* Clear internal out buffer and set it up*/
1056 RtlZeroMemory(&pMisc
, DDMISCELLANEOUSCALLBACKSSIZE
);
1057 pMisc
.dwSize
= DDMISCELLANEOUSCALLBACKSSIZE
;
1059 /* set up internal buffer */
1060 pDrvInfoData
.lpvData
= (PVOID
)&pMisc
;
1061 pDrvInfoData
.dwExpectedSize
= DDMISCELLANEOUSCALLBACKSSIZE
;
1064 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1066 pData
->dwActualSize
= DDMISCELLANEOUSCALLBACKSSIZE
;
1068 /* Only one callbacks are supported */
1069 pUserMisc
->dwFlags
= pMisc
.dwFlags
& DDHAL_MISCCB32_GETAVAILDRIVERMEMORY
;
1070 pUserMisc
->GetAvailDriverMemory
= (LPDDHAL_GETAVAILDRIVERMEMORY
) DdGetAvailDriverMemory
;
1072 /* This callbacks are only for win9x and theirfor it is not longer use in NT or ReactOS
1073 * pUserMisc->UpdateNonLocalHeap;
1074 * pUserMisc->GetHeapAlignment;
1075 * pUserMisc->GetSysmemBltStatus; */
1077 /* Windows XP never repot back the true return value,
1078 * it only report back if we have a driver or not
1079 * ReactOS keep this behoir to be compatible with
1082 pData
->ddRVal
= retValue
;
1085 /* Misc 2 Callbacks check and setup for DirectX/ ReactX */
1086 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_Miscellaneous2Callbacks
))
1088 DDHAL_DDMISCELLANEOUS2CALLBACKS pMisc
;
1089 DDHAL_DDMISCELLANEOUS2CALLBACKS
* pUserMisc
= (DDHAL_DDMISCELLANEOUS2CALLBACKS
*)pData
->lpvData
;
1091 /* Clear internal out buffer and set it up*/
1092 RtlZeroMemory(&pMisc
, DDMISCELLANEOUS2CALLBACKSSIZE
);
1093 pMisc
.dwSize
= DDMISCELLANEOUS2CALLBACKSSIZE
;
1095 /* set up internal buffer */
1096 pDrvInfoData
.lpvData
= (PVOID
)&pMisc
;
1097 pDrvInfoData
.dwExpectedSize
= DDMISCELLANEOUS2CALLBACKSSIZE
;
1100 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1102 pData
->dwActualSize
= DDMISCELLANEOUS2CALLBACKSSIZE
;
1104 pUserMisc
->dwFlags
= pMisc
.dwFlags
;
1106 /* This functions are not documneted in MSDN for this struct, here is directx/reactx alpha blend */
1107 if ( pMisc
.Reserved
)
1109 pUserMisc
->Reserved
= (LPVOID
) DdAlphaBlt
;
1112 if ( pMisc
.CreateSurfaceEx
)
1114 pUserMisc
->CreateSurfaceEx
= (LPDDHAL_CREATESURFACEEX
) DdCreateSurfaceEx
;
1117 if ( pMisc
.GetDriverState
)
1119 pUserMisc
->GetDriverState
= (LPDDHAL_GETDRIVERSTATE
) NtGdiDdGetDriverState
;
1122 /* NOTE : pUserMisc->DestroyDDLocal is outdated and are not beign tuch */
1124 /* Windows XP never repot back the true return value,
1125 * it only report back if we have a driver or not
1126 * ReactOS keep this behoir to be compatible with
1129 pData
->ddRVal
= retValue
;
1132 /* NT Callbacks check and setup for DirectX/ ReactX */
1133 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_NTCallbacks
))
1135 /* MS does not have DHAL_* version of this callbacks
1136 * so we are force using PDD_* callbacks here
1138 DD_NTCALLBACKS pNtKernel
;
1139 PDD_NTCALLBACKS pUserNtKernel
= (PDD_NTCALLBACKS
)pData
->lpvData
;
1141 /* Clear internal out buffer and set it up*/
1142 RtlZeroMemory(&pNtKernel
, sizeof(DD_NTCALLBACKS
));
1143 pNtKernel
.dwSize
= sizeof(DD_NTCALLBACKS
);
1145 /* set up internal buffer */
1146 pDrvInfoData
.lpvData
= (PVOID
)&pNtKernel
;
1147 pDrvInfoData
.dwExpectedSize
= sizeof(DD_NTCALLBACKS
) ;
1150 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1152 pData
->dwActualSize
= sizeof(DD_NTCALLBACKS
);
1154 pUserNtKernel
->dwSize
= sizeof(DD_NTCALLBACKS
);
1155 pUserNtKernel
->dwFlags
= pNtKernel
.dwFlags
;
1156 pUserNtKernel
->FreeDriverMemory
= 0;
1158 if (pNtKernel
.SetExclusiveMode
)
1160 pUserNtKernel
->SetExclusiveMode
= (PDD_SETEXCLUSIVEMODE
) DdSetExclusiveMode
;
1163 if (pNtKernel
.FlipToGDISurface
)
1165 pUserNtKernel
->FlipToGDISurface
= (PDD_FLIPTOGDISURFACE
) DdFlipToGDISurface
;
1168 /* Windows XP never repot back the true return value,
1169 * it only report back if we have a driver or not
1170 * ReactOS keep this behoir to be compatible with
1173 pData
->ddRVal
= retValue
;
1176 /* D3D Callbacks version 2 check and setup for DirectX/ ReactX */
1177 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_D3DCallbacks2
))
1179 // FIXME GUID_D3DCallbacks2
1182 /* D3D Callbacks version 3 check and setup for DirectX/ ReactX */
1183 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_D3DCallbacks3
))
1185 // FIXME GUID_D3DCallbacks3
1188 /* D3DParseUnknownCommand Callbacks check and setup for DirectX/ ReactX */
1189 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_D3DParseUnknownCommandCallback
))
1191 // FIXME GUID_D3DParseUnknownCommandCallback
1194 /* MotionComp Callbacks check and setup for DirectX/ ReactX */
1195 else if (IsEqualGUID(&pData
->guidInfo
, &GUID_MotionCompCallbacks
))
1197 // FIXME GUID_MotionCompCallbacks
1200 /* FIXME VPE2 Callbacks check and setup for DirectX/ ReactX */
1201 //else if (IsEqualGUID(&pData->guidInfo, &GUID_VPE2Callbacks))
1203 // FIXME GUID_VPE2Callbacks
1207 /* set up internal buffer */
1208 pDrvInfoData
.dwExpectedSize
= pData
->dwExpectedSize
;
1209 pDrvInfoData
.lpvData
= pData
->lpvData
;
1211 /* We do not cover all callbacks for user mode, they are only cover by kmode */
1212 retValue
= NtGdiDdGetDriverInfo(hDD
, (PDD_GETDRIVERINFODATA
)&pDrvInfoData
);
1214 /* Setup return data */
1215 pData
->dwActualSize
= pDrvInfoData
.dwActualSize
;
1216 pData
->lpvData
= pDrvInfoData
.lpvData
;
1217 /* Windows XP never repot back the true return value,
1218 * it only report back if we have a driver or not
1219 * ReactOS keep this behoir to be compatible with
1222 pData
->ddRVal
= retValue
;
1236 D3dContextCreate(LPD3DHAL_CONTEXTCREATEDATA pdcci
)
1238 HANDLE hSurfZ
= NULL
;
1240 if (pdcci
->lpDDSZLcl
)
1242 hSurfZ
= (HANDLE
)pdcci
->lpDDSZLcl
->hDDSurface
;
1245 return NtGdiD3dContextCreate(GetDdHandle(pdcci
->lpDDLcl
->hDD
),
1246 (HANDLE
)pdcci
->lpDDSLcl
->hDDSurface
,
1248 (D3DNTHAL_CONTEXTCREATEI
*)pdcci
);
1254 * DdCanCreateD3DBuffer
1258 DdCanCreateD3DBuffer(LPDDHAL_CANCREATESURFACEDATA CanCreateD3DBuffer
)
1261 * Note : This functions are basic same, in win32k
1262 * NtGdiDdCanCreateD3DBuffer and NtGdiDdCanCreateSurface are mergs
1263 * toghter in win32k at end and retrurn same data, it is still sepreated
1264 * at user mode but in kmode it is not.
1268 return NtGdiDdCanCreateD3DBuffer(GetDdHandle(CanCreateD3DBuffer
->lpDD
->hDD
),
1269 (PDD_CANCREATESURFACEDATA
)CanCreateD3DBuffer
);
1280 DdCreateD3DBuffer(LPDDHAL_CREATESURFACEDATA pCreateSurface
)
1282 HANDLE puhSurface
= 0;
1283 DDRAWI_DDRAWSURFACE_GBL
*pSurfGBL
;
1284 DDRAWI_DDRAWSURFACE_LCL
*pSurfLcl
;
1285 DD_SURFACE_GLOBAL puSurfaceGlobalData
;
1286 DD_SURFACE_MORE puSurfaceMoreData
;
1287 DD_SURFACE_LOCAL puSurfaceLocalData
;
1290 /* Zero all local memory pointer */
1291 RtlZeroMemory(&puSurfaceGlobalData
, sizeof(DD_SURFACE_GLOBAL
) );
1292 RtlZeroMemory(&puSurfaceMoreData
, sizeof(DD_SURFACE_MORE
) ) ;
1293 RtlZeroMemory(&puSurfaceLocalData
, sizeof(DD_SURFACE_LOCAL
) );
1295 pCreateSurface
->dwSCnt
= 1;
1296 pSurfLcl
= pCreateSurface
->lplpSList
[0];
1297 pSurfGBL
= pSurfLcl
->lpGbl
;
1299 /* Convert DDRAWI_DDRAWSURFACE_GBL to DD_SURFACE_GLOBAL */
1300 puSurfaceGlobalData
.wWidth
= pSurfGBL
->wWidth
;
1301 puSurfaceGlobalData
.wHeight
= pSurfGBL
->wHeight
;
1302 puSurfaceGlobalData
.dwLinearSize
= pSurfGBL
->dwLinearSize
;
1303 puSurfaceGlobalData
.fpVidMem
= pSurfGBL
->fpVidMem
;
1304 puSurfaceGlobalData
.dwBlockSizeX
= pSurfGBL
->dwBlockSizeX
;
1305 puSurfaceGlobalData
.dwBlockSizeY
= pSurfGBL
->dwBlockSizeY
;
1307 /* Convert DDRAWI_DDRAWSURFACE_MORE to DD_SURFACE_MORE */
1308 puSurfaceMoreData
.dwSurfaceHandle
= pSurfLcl
->lpSurfMore
->dwSurfaceHandle
;
1309 puSurfaceMoreData
.ddsCapsEx
.dwCaps2
= pSurfLcl
->lpSurfMore
->ddsCapsEx
.dwCaps2
;
1310 puSurfaceMoreData
.ddsCapsEx
.dwCaps3
= pSurfLcl
->lpSurfMore
->ddsCapsEx
.dwCaps3
;
1311 puSurfaceMoreData
.ddsCapsEx
.dwCaps4
= pSurfLcl
->lpSurfMore
->ddsCapsEx
.dwCaps4
;
1313 /* Convert DDRAWI_DDRAWSURFACE_LCL to DD_SURFACE_LOCAL */
1314 puSurfaceLocalData
.dwFlags
= pSurfLcl
->dwFlags
;
1315 puSurfaceLocalData
.ddsCaps
.dwCaps
= pSurfLcl
->ddsCaps
.dwCaps
;
1318 retValue
= NtGdiDdCreateD3DBuffer( GetDdHandle(pCreateSurface
->lpDD
->hDD
),
1319 (HANDLE
*)&pSurfLcl
->hDDSurface
,
1320 pCreateSurface
->lpDDSurfaceDesc
,
1321 &puSurfaceGlobalData
,
1322 &puSurfaceLocalData
,
1324 (DD_CREATESURFACEDATA
*) pCreateSurface
,
1327 /* Setup surface handle if we got one back */
1328 if ( puhSurface
!= NULL
)
1330 pCreateSurface
->lplpSList
[0]->hDDSurface
= (ULONG_PTR
)puhSurface
;
1333 /* Convert DD_SURFACE_GLOBAL to DDRAWI_DDRAWSURFACE_GBL */
1334 pSurfGBL
->dwLinearSize
= puSurfaceGlobalData
.dwLinearSize
;
1335 pSurfGBL
->fpVidMem
= puSurfaceGlobalData
.fpVidMem
;
1336 pSurfGBL
->dwBlockSizeX
= puSurfaceGlobalData
.dwBlockSizeX
;
1337 pSurfGBL
->dwBlockSizeY
= puSurfaceGlobalData
.dwBlockSizeY
;
1345 * DdDestroyD3DBuffer
1349 DdDestroyD3DBuffer(LPDDHAL_DESTROYSURFACEDATA pDestroySurface
)
1352 if ( pDestroySurface
->lpDDSurface
->hDDSurface
)
1355 retValue
= NtGdiDdDestroyD3DBuffer((HANDLE
)pDestroySurface
->lpDDSurface
->hDDSurface
);
1368 DdLockD3D(LPDDHAL_LOCKDATA Lock
)
1372 return NtGdiDdLockD3D((HANDLE
)Lock
->lpDDSurface
->hDDSurface
, (PDD_LOCKDATA
)Lock
);
1382 DdUnlockD3D(LPDDHAL_UNLOCKDATA Unlock
)
1385 return NtGdiDdUnlock((HANDLE
)Unlock
->lpDDSurface
->hDDSurface
,
1386 (PDD_UNLOCKDATA
)Unlock
);
1390 /* PRIVATE FUNCTIONS *********************************************************/
1394 bDDCreateSurface(LPDDRAWI_DDRAWSURFACE_LCL pSurface
,
1397 DD_SURFACE_LOCAL SurfaceLocal
;
1398 DD_SURFACE_GLOBAL SurfaceGlobal
;
1399 DD_SURFACE_MORE SurfaceMore
;
1402 RtlZeroMemory(&SurfaceLocal
, sizeof(DD_SURFACE_LOCAL
));
1403 RtlZeroMemory(&SurfaceGlobal
, sizeof(DD_SURFACE_GLOBAL
));
1404 RtlZeroMemory(&SurfaceMore
, sizeof(DD_SURFACE_MORE
));
1406 /* Set up SurfaceLocal struct */
1407 SurfaceLocal
.ddsCaps
.dwCaps
= pSurface
->ddsCaps
.dwCaps
;
1408 SurfaceLocal
.dwFlags
= pSurface
->dwFlags
;
1410 /* Set up SurfaceMore struct */
1411 RtlMoveMemory(&SurfaceMore
.ddsCapsEx
,
1412 &pSurface
->ddckCKDestBlt
,
1414 SurfaceMore
.dwSurfaceHandle
= (DWORD
)pSurface
->dbnOverlayNode
.object_int
->lpVtbl
;
1416 /* Set up SurfaceGlobal struct */
1417 SurfaceGlobal
.fpVidMem
= pSurface
->lpGbl
->fpVidMem
;
1418 SurfaceGlobal
.dwLinearSize
= pSurface
->lpGbl
->dwLinearSize
;
1419 SurfaceGlobal
.wHeight
= pSurface
->lpGbl
->wHeight
;
1420 SurfaceGlobal
.wWidth
= pSurface
->lpGbl
->wWidth
;
1422 /* Check if we have a pixel format */
1423 if (pSurface
->dwFlags
& DDSD_PIXELFORMAT
)
1425 /* Use global one */
1426 SurfaceGlobal
.ddpfSurface
= pSurface
->lpGbl
->lpDD
->vmiData
.ddpfDisplay
;
1427 SurfaceGlobal
.ddpfSurface
.dwSize
= sizeof(DDPIXELFORMAT
);
1432 SurfaceGlobal
.ddpfSurface
= pSurface
->lpGbl
->lpDD
->vmiData
.ddpfDisplay
;
1435 /* Create the object */
1436 pSurface
->hDDSurface
= (DWORD
)NtGdiDdCreateSurfaceObject(GetDdHandle(pSurface
->lpGbl
->lpDD
->hDD
),
1437 (HANDLE
)pSurface
->hDDSurface
,
1444 if (pSurface
->hDDSurface
) return TRUE
;
1448 /* PUBLIC FUNCTIONS **********************************************************/
1457 DdCreateDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal
,
1460 BOOL Return
= FALSE
;
1462 /* Check if the global hDC (hdc == 0) is being used */
1465 /* We'll only allow this if the global object doesn't exist yet */
1469 if ((hdc
= CreateDCW(L
"Display", NULL
, NULL
, NULL
)))
1471 /* Create the DDraw Object */
1472 ghDirectDraw
= NtGdiDdCreateDirectDrawObject(hdc
);
1479 /* If we created the object, or had one ...*/
1482 /* Increase count and set success */
1487 /* Zero the handle */
1488 pDirectDrawGlobal
->hDD
= 0;
1492 /* Using the per-process object, so create it */
1493 pDirectDrawGlobal
->hDD
= (ULONG_PTR
)NtGdiDdCreateDirectDrawObject(hdc
);
1495 /* Set the return value */
1496 Return
= pDirectDrawGlobal
->hDD
? TRUE
: FALSE
;
1499 /* Return to caller */
1510 DdQueryDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal
,
1511 LPDDHALINFO pHalInfo
,
1512 LPDDHAL_DDCALLBACKS pDDCallbacks
,
1513 LPDDHAL_DDSURFACECALLBACKS pDDSurfaceCallbacks
,
1514 LPDDHAL_DDPALETTECALLBACKS pDDPaletteCallbacks
,
1515 LPD3DHAL_CALLBACKS pD3dCallbacks
,
1516 LPD3DHAL_GLOBALDRIVERDATA pD3dDriverData
,
1517 LPDDHAL_DDEXEBUFCALLBACKS pD3dBufferCallbacks
,
1518 LPDDSURFACEDESC pD3dTextureFormats
,
1522 PVIDEOMEMORY VidMemList
= NULL
;
1524 D3DNTHAL_CALLBACKS D3dCallbacks
;
1525 D3DNTHAL_GLOBALDRIVERDATA D3dDriverData
;
1526 DD_D3DBUFCALLBACKS D3dBufferCallbacks
;
1527 DWORD CallbackFlags
[3];
1528 DWORD dwNumHeaps
=0, FourCCs
=0;
1532 /* Clear the structures */
1533 RtlZeroMemory(&HalInfo
, sizeof(DD_HALINFO
));
1534 RtlZeroMemory(&D3dCallbacks
, sizeof(D3DNTHAL_CALLBACKS
));
1535 RtlZeroMemory(&D3dDriverData
, sizeof(D3DNTHAL_GLOBALDRIVERDATA
));
1536 RtlZeroMemory(&D3dBufferCallbacks
, sizeof(DD_D3DBUFCALLBACKS
));
1537 RtlZeroMemory(CallbackFlags
, sizeof(DWORD
)*3);
1539 /* Note : XP always alloc 24*sizeof(VIDEOMEMORY) of pvmlist so we change it to it */
1540 if ( (pvmList
!= NULL
) &&
1541 (pHalInfo
->vmiData
.dwNumHeaps
!= 0) )
1543 VidMemList
= (PVIDEOMEMORY
) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, (sizeof(VIDEOMEMORY
) * 24 ) * pHalInfo
->vmiData
.dwNumHeaps
);
1548 if (!NtGdiDdQueryDirectDrawObject(GetDdHandle(pDirectDrawGlobal
->hDD
),
1553 &D3dBufferCallbacks
,
1560 /* We failed, free the memory and return */
1565 /* Clear the incoming pointer */
1566 RtlZeroMemory(pHalInfo
, sizeof(DDHALINFO
));
1568 /* Convert all the data */
1569 pHalInfo
->dwSize
= sizeof(DDHALINFO
);
1570 pHalInfo
->lpDDCallbacks
= pDDCallbacks
;
1571 pHalInfo
->lpDDSurfaceCallbacks
= pDDSurfaceCallbacks
;
1572 pHalInfo
->lpDDPaletteCallbacks
= pDDPaletteCallbacks
;
1574 /* Check for NT5+ D3D Data */
1575 if ( (D3dCallbacks
.dwSize
!= 0) &&
1576 (D3dDriverData
.dwSize
!= 0) )
1578 /* Write these down */
1579 pHalInfo
->lpD3DGlobalDriverData
= (ULONG_PTR
)pD3dDriverData
;
1580 pHalInfo
->lpD3DHALCallbacks
= (ULONG_PTR
)pD3dCallbacks
;
1582 /* Check for Buffer Callbacks */
1583 if (D3dBufferCallbacks
.dwSize
)
1585 /* Write this one too */
1586 pHalInfo
->lpDDExeBufCallbacks
= pD3dBufferCallbacks
;
1590 /* Continue converting the rest */
1591 pHalInfo
->vmiData
.dwFlags
= HalInfo
.vmiData
.dwFlags
;
1592 pHalInfo
->vmiData
.dwDisplayWidth
= HalInfo
.vmiData
.dwDisplayWidth
;
1593 pHalInfo
->vmiData
.dwDisplayHeight
= HalInfo
.vmiData
.dwDisplayHeight
;
1594 pHalInfo
->vmiData
.lDisplayPitch
= HalInfo
.vmiData
.lDisplayPitch
;
1595 pHalInfo
->vmiData
.fpPrimary
= 0;
1597 RtlCopyMemory( &pHalInfo
->vmiData
.ddpfDisplay
,
1598 &HalInfo
.vmiData
.ddpfDisplay
,
1599 sizeof(DDPIXELFORMAT
));
1601 pHalInfo
->vmiData
.dwOffscreenAlign
= HalInfo
.vmiData
.dwOffscreenAlign
;
1602 pHalInfo
->vmiData
.dwOverlayAlign
= HalInfo
.vmiData
.dwOverlayAlign
;
1603 pHalInfo
->vmiData
.dwTextureAlign
= HalInfo
.vmiData
.dwTextureAlign
;
1604 pHalInfo
->vmiData
.dwZBufferAlign
= HalInfo
.vmiData
.dwZBufferAlign
;
1605 pHalInfo
->vmiData
.dwAlphaAlign
= HalInfo
.vmiData
.dwAlphaAlign
;
1607 pHalInfo
->vmiData
.dwNumHeaps
= dwNumHeaps
;
1608 pHalInfo
->vmiData
.pvmList
= pvmList
;
1610 RtlCopyMemory( &pHalInfo
->ddCaps
,
1612 sizeof(DDCORECAPS
));
1614 pHalInfo
->ddCaps
.dwNumFourCCCodes
= FourCCs
;
1615 pHalInfo
->lpdwFourCC
= pdwFourCC
;
1617 /* always force rope 0x1000 for hal it mean only source copy is supported */
1618 pHalInfo
->ddCaps
.dwRops
[6] = 0x1000;
1620 /* Set the HAL flags what ReactX got from the driver
1621 * Windows XP force setting DDHALINFO_GETDRIVERINFOSET if the driver does not set it
1622 * and ReactX doing same to keep compatible with drivers, but the driver are
1623 * force support DdGetDriverInfo acoriding MSDN but it seam some driver do not set
1624 * this flag even it is being supported. that is mean. It is small hack to keep
1625 * bad driver working, that trust this is always being setting by it self at end
1627 pHalInfo
->dwFlags
= (HalInfo
.dwFlags
& ~DDHALINFO_GETDRIVERINFOSET
) | DDHALINFO_GETDRIVERINFOSET
;
1628 pHalInfo
->GetDriverInfo
= (LPDDHAL_GETDRIVERINFO
) DdGetDriverInfo
;
1630 /* Now check if we got any DD callbacks */
1633 /* Zero the structure */
1634 RtlZeroMemory(pDDCallbacks
, sizeof(DDHAL_DDCALLBACKS
));
1635 pDDCallbacks
->dwSize
= sizeof(DDHAL_DDCALLBACKS
);
1637 /* Set the flags for this structure
1638 * Windows XP force setting DDHAL_CB32_CREATESURFACE if the driver does not set it
1639 * and ReactX doing same to keep compatible with drivers, but the driver are
1640 * force support pDDCallbacks acoriding MSDN but it seam some driver do not set
1641 * this flag even it is being supported. that is mean. It is small hack to keep
1642 * bad driver working, that trust this is always being setting by it self at end
1644 Flags
= (CallbackFlags
[0] & ~DDHAL_CB32_CREATESURFACE
) | DDHAL_CB32_CREATESURFACE
;
1645 pDDCallbacks
->dwFlags
= Flags
;
1647 /* Write the always-on functions */
1648 pDDCallbacks
->CreateSurface
= DdCreateSurface
;
1650 /* Now write the pointers, if applicable */
1651 if (Flags
& DDHAL_CB32_WAITFORVERTICALBLANK
)
1653 pDDCallbacks
->WaitForVerticalBlank
= DdWaitForVerticalBlank
;
1655 if (Flags
& DDHAL_CB32_CANCREATESURFACE
)
1657 pDDCallbacks
->CanCreateSurface
= DdCanCreateSurface
;
1659 if (Flags
& DDHAL_CB32_GETSCANLINE
)
1661 pDDCallbacks
->GetScanLine
= DdGetScanLine
;
1665 /* Check for DD Surface Callbacks */
1666 if (pDDSurfaceCallbacks
)
1668 /* Zero the structures */
1669 RtlZeroMemory(pDDSurfaceCallbacks
, sizeof(DDHAL_DDSURFACECALLBACKS
));
1670 pDDSurfaceCallbacks
->dwSize
= sizeof(DDHAL_DDSURFACECALLBACKS
);
1672 /* Set the flags for this structure
1673 * Windows XP force setting DDHAL_SURFCB32_LOCK, DDHAL_SURFCB32_UNLOCK,
1674 * DDHAL_SURFCB32_SETCOLORKEY, DDHAL_SURFCB32_DESTROYSURFACE if the driver
1675 * does not set it and ReactX doing same to keep compatible with drivers,
1676 * but the driver are force support pDDSurfaceCallbacks acoriding MSDN but it seam
1677 * some driver do not set this flag even it is being supported. that is mean.
1678 * It is small hack to keep bad driver working, that trust this is always being
1679 * setting by it self at end
1682 Flags
= (CallbackFlags
[1] & ~(DDHAL_SURFCB32_LOCK
| DDHAL_SURFCB32_UNLOCK
|
1683 DDHAL_SURFCB32_SETCOLORKEY
| DDHAL_SURFCB32_DESTROYSURFACE
)) |
1684 (DDHAL_SURFCB32_LOCK
| DDHAL_SURFCB32_UNLOCK
|
1685 DDHAL_SURFCB32_SETCOLORKEY
| DDHAL_SURFCB32_DESTROYSURFACE
);
1687 pDDSurfaceCallbacks
->dwFlags
= Flags
;
1689 /* Write the always-on functions */
1690 pDDSurfaceCallbacks
->Lock
= DdLock
;
1691 pDDSurfaceCallbacks
->Unlock
= DdUnlock
;
1692 pDDSurfaceCallbacks
->SetColorKey
= DdSetColorKey
;
1693 pDDSurfaceCallbacks
->DestroySurface
= DdDestroySurface
;
1695 /* Write the optional ones */
1696 if (Flags
& DDHAL_SURFCB32_FLIP
)
1698 pDDSurfaceCallbacks
->Flip
= DdFlip
;
1700 if (Flags
& DDHAL_SURFCB32_BLT
)
1702 pDDSurfaceCallbacks
->Blt
= DdBlt
;
1704 if (Flags
& DDHAL_SURFCB32_GETBLTSTATUS
)
1706 pDDSurfaceCallbacks
->GetBltStatus
= DdGetBltStatus
;
1708 if (Flags
& DDHAL_SURFCB32_GETFLIPSTATUS
)
1710 pDDSurfaceCallbacks
->GetFlipStatus
= DdGetFlipStatus
;
1712 if (Flags
& DDHAL_SURFCB32_UPDATEOVERLAY
)
1714 pDDSurfaceCallbacks
->UpdateOverlay
= DdUpdateOverlay
;
1716 if (Flags
& DDHAL_SURFCB32_SETOVERLAYPOSITION
)
1718 pDDSurfaceCallbacks
->SetOverlayPosition
= DdSetOverlayPosition
;
1720 if (Flags
& DDHAL_SURFCB32_ADDATTACHEDSURFACE
)
1722 pDDSurfaceCallbacks
->AddAttachedSurface
= DdAddAttachedSurface
;
1726 /* Check for DD Palette Callbacks, This interface are dead for user mode,
1727 * only what it can support are being report back.
1729 if (pDDPaletteCallbacks
)
1731 /* Zero the struct */
1732 RtlZeroMemory(pDDPaletteCallbacks
, sizeof(DDHAL_DDPALETTECALLBACKS
));
1734 /* Write the header */
1735 pDDPaletteCallbacks
->dwSize
= sizeof(DDHAL_DDPALETTECALLBACKS
);
1736 pDDPaletteCallbacks
->dwFlags
= CallbackFlags
[2];
1741 /* Zero the struct */
1742 RtlZeroMemory(pD3dCallbacks
, sizeof(DDHAL_DDEXEBUFCALLBACKS
));
1744 /* Check if we have one */
1745 if (D3dCallbacks
.dwSize
)
1747 /* Write the header */
1748 pD3dCallbacks
->dwSize
= sizeof(DDHAL_DDEXEBUFCALLBACKS
);
1750 /* Now check for each callback */
1751 if (D3dCallbacks
.ContextCreate
)
1753 pD3dCallbacks
->ContextCreate
= (LPD3DHAL_CONTEXTCREATECB
) D3dContextCreate
;
1755 if (D3dCallbacks
.ContextDestroy
)
1757 pD3dCallbacks
->ContextDestroy
= (LPD3DHAL_CONTEXTDESTROYCB
) NtGdiD3dContextDestroy
;
1759 if (D3dCallbacks
.ContextDestroyAll
)
1761 pD3dCallbacks
->ContextDestroyAll
= (LPD3DHAL_CONTEXTDESTROYALLCB
) NtGdiD3dContextDestroyAll
;
1766 /* Check for D3D Driver Data */
1769 /* Copy the struct */
1770 RtlMoveMemory(pD3dDriverData
, &D3dDriverData
, sizeof(D3DHAL_GLOBALDRIVERDATA
));
1772 /* Write the pointer to the texture formats */
1773 pD3dDriverData
->lpTextureFormats
= pD3dTextureFormats
;
1776 /* Check for D3D Buffer Callbacks */
1777 if (pD3dBufferCallbacks
)
1779 /* Zero the struct */
1780 RtlZeroMemory(pD3dBufferCallbacks
, sizeof(DDHAL_DDEXEBUFCALLBACKS
));
1782 if ( D3dBufferCallbacks
.dwSize
)
1784 pD3dBufferCallbacks
->dwSize
= D3dBufferCallbacks
.dwSize
;
1786 pD3dBufferCallbacks
->dwFlags
= D3dBufferCallbacks
.dwFlags
;
1787 if ( D3dBufferCallbacks
.CanCreateD3DBuffer
)
1789 pD3dBufferCallbacks
->CanCreateExecuteBuffer
= (LPDDHALEXEBUFCB_CANCREATEEXEBUF
)DdCanCreateD3DBuffer
;
1792 if ( D3dBufferCallbacks
.CanCreateD3DBuffer
)
1794 pD3dBufferCallbacks
->CreateExecuteBuffer
= (LPDDHALEXEBUFCB_CREATEEXEBUF
) DdCreateD3DBuffer
;
1797 if ( D3dBufferCallbacks
.DestroyD3DBuffer
)
1799 pD3dBufferCallbacks
->DestroyExecuteBuffer
= (LPDDHALEXEBUFCB_DESTROYEXEBUF
) DdDestroyD3DBuffer
;
1802 if ( D3dBufferCallbacks
.LockD3DBuffer
)
1804 pD3dBufferCallbacks
->LockExecuteBuffer
= (LPDDHALEXEBUFCB_LOCKEXEBUF
) DdLockD3D
;
1807 if ( D3dBufferCallbacks
.UnlockD3DBuffer
)
1809 pD3dBufferCallbacks
->UnlockExecuteBuffer
= (LPDDHALEXEBUFCB_UNLOCKEXEBUF
) DdUnlockD3D
;
1815 /* FIXME VidMemList */
1820 HeapFree(GetProcessHeap(), 0, VidMemList
);
1833 DdDeleteDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal
)
1835 BOOL Return
= FALSE
;
1837 /* If this is the global object */
1838 if(pDirectDrawGlobal
->hDD
)
1841 Return
= NtGdiDdDeleteDirectDrawObject((HANDLE
)pDirectDrawGlobal
->hDD
);
1844 pDirectDrawGlobal
->hDD
= 0;
1847 else if (ghDirectDraw
)
1849 /* Always success here */
1852 /* Make sure this is the last instance */
1853 if (!(--gcDirectDraw
))
1855 /* Delete the object */
1856 Return
= NtGdiDdDeleteDirectDrawObject(ghDirectDraw
);
1875 DdCreateSurfaceObject( LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
,
1876 BOOL bPrimarySurface
)
1878 return bDDCreateSurface(pSurfaceLocal
, TRUE
);
1889 DdDeleteSurfaceObject(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
)
1891 BOOL Return
= FALSE
;
1893 /* Make sure there is one */
1894 if (pSurfaceLocal
->hDDSurface
)
1897 Return
= NtGdiDdDeleteSurfaceObject((HANDLE
)pSurfaceLocal
->hDDSurface
);
1898 pSurfaceLocal
->hDDSurface
= 0;
1911 DdResetVisrgn(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
,
1914 /* Call win32k directly */
1915 return NtGdiDdResetVisrgn((HANDLE
) pSurfaceLocal
->hDDSurface
, hWnd
);
1925 DdGetDC(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
,
1926 LPPALETTEENTRY pColorTable
)
1928 /* Call win32k directly */
1929 return NtGdiDdGetDC(pColorTable
, (HANDLE
) pSurfaceLocal
->hDDSurface
);
1939 DdReleaseDC(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal
)
1941 /* Call win32k directly */
1942 return NtGdiDdReleaseDC((HANDLE
) pSurfaceLocal
->hDDSurface
);
1951 DdCreateDIBSection(HDC hdc
,
1952 CONST BITMAPINFO
*pbmi
,
1958 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1969 DdReenableDirectDrawObject(LPDDRAWI_DIRECTDRAW_GBL pDirectDrawGlobal
,
1972 /* Call win32k directly */
1973 return NtGdiDdReenableDirectDrawObject(GetDdHandle(pDirectDrawGlobal
->hDD
),
1985 DdAttachSurface( LPDDRAWI_DDRAWSURFACE_LCL pSurfaceFrom
,
1986 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceTo
)
1988 /* Create Surface if it does not exits one */
1989 if (!pSurfaceFrom
->hDDSurface
)
1991 if (!bDDCreateSurface(pSurfaceFrom
, FALSE
))
1997 /* Create Surface if it does not exits one */
1998 if (!pSurfaceTo
->hDDSurface
)
2000 if (!bDDCreateSurface(pSurfaceTo
, FALSE
))
2007 return NtGdiDdAttachSurface((HANDLE
)pSurfaceFrom
->hDDSurface
,
2008 (HANDLE
)pSurfaceTo
->hDDSurface
);
2018 DdUnattachSurface(LPDDRAWI_DDRAWSURFACE_LCL pSurface
,
2019 LPDDRAWI_DDRAWSURFACE_LCL pSurfaceAttached
)
2022 NtGdiDdUnattachSurface((HANDLE
)pSurface
->hDDSurface
,
2023 (HANDLE
)pSurfaceAttached
->hDDSurface
);
2033 DdQueryDisplaySettingsUniqueness()
2035 return GdiSharedHandleTable
->flDeviceUniq
;
2045 DdGetDxHandle(LPDDRAWI_DIRECTDRAW_LCL pDDraw
,
2046 LPDDRAWI_DDRAWSURFACE_LCL pSurface
,
2050 HANDLE hSurface
= (HANDLE
)pSurface
->hDDSurface
;
2052 /* Check if we already have a surface */
2055 /* We don't have one, use the DirectDraw Object handle instead */
2057 hDD
= GetDdHandle(pDDraw
->lpGbl
->hDD
);
2061 return (HANDLE
)NtGdiDdGetDxHandle(hDD
, hSurface
, bRelease
);
2071 DdSetGammaRamp(LPDDRAWI_DIRECTDRAW_LCL pDDraw
,
2075 /* Call win32k directly */
2076 return NtGdiDdSetGammaRamp(GetDdHandle(pDDraw
->lpGbl
->hDD
),