xref: /reactos/win32ss/reactx/ntddraw/dvp.c (revision 24757e30)
1 /*
2  * COPYRIGHT:        See COPYING in the top level directory
3  * PROJECT:          ReactOS kernel
4  * PURPOSE:          Native DirectDraw implementation
5  * FILE:             win32ss/reactx/ntddraw/dvp.c
6  * PROGRAMER:        Magnus olsen (magnus@greatlord.com)
7  * REVISION HISTORY:
8  *       19/1-2006   Magnus Olsen
9  */
10 
11 #include <win32k.h>
12 
13 // #define NDEBUG
14 #include <debug.h>
15 
16 /************************************************************************/
17 /* NtGdiDvpCanCreateVideoPort                                           */
18 /************************************************************************/
19 DWORD
20 APIENTRY
NtGdiDvpCanCreateVideoPort(HANDLE hDirectDraw,PDD_CANCREATEVPORTDATA puCanCreateVPortData)21 NtGdiDvpCanCreateVideoPort(HANDLE hDirectDraw,
22                            PDD_CANCREATEVPORTDATA puCanCreateVPortData)
23 {
24     PGD_DVPCANCREATEVIDEOPORT pfnDvpCanCreateVideoPort = (PGD_DVPCANCREATEVIDEOPORT)gpDxFuncs[DXG_INDEX_DxDvpCanCreateVideoPort].pfn;
25 
26     if (pfnDvpCanCreateVideoPort == NULL)
27     {
28         DPRINT1("Warning: no pfnDvpCanCreateVideoPort\n");
29         return DDHAL_DRIVER_NOTHANDLED;
30     }
31 
32     DPRINT("Calling dxg.sys pfnDvpCanCreateVideoPort\n");
33     return pfnDvpCanCreateVideoPort(hDirectDraw, puCanCreateVPortData);
34 }
35 
36 /************************************************************************/
37 /* NtGdiDvpColorControl                                                 */
38 /************************************************************************/
39 DWORD
40 APIENTRY
NtGdiDvpColorControl(HANDLE hVideoPort,PDD_VPORTCOLORDATA puVPortColorData)41 NtGdiDvpColorControl(HANDLE hVideoPort,
42                      PDD_VPORTCOLORDATA puVPortColorData)
43 {
44     PGD_DVPCOLORCONTROL pfnDvpColorControl = (PGD_DVPCOLORCONTROL)gpDxFuncs[DXG_INDEX_DxDvpColorControl].pfn;
45 
46     if (pfnDvpColorControl == NULL)
47     {
48         DPRINT1("Warning: no pfnDvpColorControl\n");
49         return DDHAL_DRIVER_NOTHANDLED;
50     }
51 
52     DPRINT("Calling dxg.sys pfnDvpColorControl\n");
53     return pfnDvpColorControl(hVideoPort, puVPortColorData);
54 }
55 
56 /************************************************************************/
57 /* NtGdiDvpCreateVideoPort                                              */
58 /************************************************************************/
59 HANDLE
60 APIENTRY
NtGdiDvpCreateVideoPort(HANDLE hDirectDraw,PDD_CREATEVPORTDATA puCreateVPortData)61 NtGdiDvpCreateVideoPort(HANDLE hDirectDraw,
62                         PDD_CREATEVPORTDATA puCreateVPortData)
63 {
64     PGD_DVPCREATEVIDEOPORT pfnDvpCreateVideoPort = (PGD_DVPCREATEVIDEOPORT)gpDxFuncs[DXG_INDEX_DxDvpCreateVideoPort].pfn;
65 
66     if (pfnDvpCreateVideoPort == NULL)
67     {
68         DPRINT1("Warning: no pfnDvpCreateVideoPort\n");
69         return DDHAL_DRIVER_NOTHANDLED;
70     }
71 
72     DPRINT("Calling dxg.sys pfnDvpCreateVideoPort\n");
73     return pfnDvpCreateVideoPort(hDirectDraw, puCreateVPortData);
74 }
75 
76 /************************************************************************/
77 /* NtGdiDvpDestroyVideoPort                                             */
78 /************************************************************************/
79 DWORD
80 APIENTRY
NtGdiDvpDestroyVideoPort(HANDLE hVideoPort,PDD_DESTROYVPORTDATA puDestroyVPortData)81 NtGdiDvpDestroyVideoPort(HANDLE hVideoPort,
82                          PDD_DESTROYVPORTDATA puDestroyVPortData)
83 {
84     PGD_DVPDESTROYVIDEOPORT pfnDvpDestroyVideoPort =
85         (PGD_DVPDESTROYVIDEOPORT)gpDxFuncs[DXG_INDEX_DxDvpDestroyVideoPort].pfn;
86 
87     if (pfnDvpDestroyVideoPort == NULL)
88     {
89         DPRINT1("Warning: no pfnDvpDestroyVideoPort\n");
90         return DDHAL_DRIVER_NOTHANDLED;
91     }
92 
93     DPRINT("Calling dxg.sys pfnDvpDestroyVideoPort\n");
94     return pfnDvpDestroyVideoPort(hVideoPort, puDestroyVPortData);
95 }
96 
97 /************************************************************************/
98 /* NtGdiDvpFlipVideoPort                                                */
99 /************************************************************************/
100 DWORD
101 APIENTRY
NtGdiDvpFlipVideoPort(HANDLE hVideoPort,HANDLE hDDSurfaceCurrent,HANDLE hDDSurfaceTarget,PDD_FLIPVPORTDATA puFlipVPortData)102 NtGdiDvpFlipVideoPort(HANDLE hVideoPort,
103                       HANDLE hDDSurfaceCurrent,
104                       HANDLE hDDSurfaceTarget,
105                       PDD_FLIPVPORTDATA puFlipVPortData)
106 {
107     PGD_DVPFLIPVIDEOPORT pfnDvpFlipVideoPort =
108         (PGD_DVPFLIPVIDEOPORT)gpDxFuncs[DXG_INDEX_DxDvpFlipVideoPort].pfn;
109 
110     if (pfnDvpFlipVideoPort == NULL)
111     {
112         DPRINT1("Warning: no pfnDvpFlipVideoPort\n");
113         return DDHAL_DRIVER_NOTHANDLED;
114     }
115 
116     DPRINT("Calling dxg.sys pfnDvpFlipVideoPort\n");
117     return pfnDvpFlipVideoPort(hVideoPort, hDDSurfaceCurrent, hDDSurfaceTarget, puFlipVPortData);
118 }
119 
120 /************************************************************************/
121 /* NtGdiDvpGetVideoPortBandwidth                                        */
122 /************************************************************************/
123 DWORD
124 APIENTRY
NtGdiDvpGetVideoPortBandwidth(HANDLE hVideoPort,PDD_GETVPORTBANDWIDTHDATA puGetVPortBandwidthData)125 NtGdiDvpGetVideoPortBandwidth(HANDLE hVideoPort,
126                               PDD_GETVPORTBANDWIDTHDATA puGetVPortBandwidthData)
127 {
128     PGD_DVPGETVIDEOPORTBANDWITH pfnDvpGetVideoPortBandwidth = (PGD_DVPGETVIDEOPORTBANDWITH)gpDxFuncs[DXG_INDEX_DxDvpGetVideoPortBandwidth].pfn;
129 
130     if (pfnDvpGetVideoPortBandwidth == NULL)
131     {
132         DPRINT1("Warning: no pfnDvpGetVideoPortBandwidth\n");
133         return DDHAL_DRIVER_NOTHANDLED;
134     }
135 
136     DPRINT("Calling dxg.sys pfnDvpGetVideoPortBandwidth\n");
137     return pfnDvpGetVideoPortBandwidth(hVideoPort, puGetVPortBandwidthData);
138 }
139 
140 /************************************************************************/
141 /* NtGdiDvpGetVideoPortFlipStatus                                       */
142 /************************************************************************/
143 DWORD
144 APIENTRY
NtGdiDvpGetVideoPortFlipStatus(HANDLE hDirectDraw,PDD_GETVPORTFLIPSTATUSDATA puGetVPortFlipStatusData)145 NtGdiDvpGetVideoPortFlipStatus(HANDLE hDirectDraw,
146                                PDD_GETVPORTFLIPSTATUSDATA puGetVPortFlipStatusData)
147 {
148     PGD_DXDVPGETVIDEOPORTFLIPSTATUS pfnDvpGetVideoPortFlipStatus = (PGD_DXDVPGETVIDEOPORTFLIPSTATUS)gpDxFuncs[DXG_INDEX_DxDvpGetVideoPortFlipStatus].pfn;
149 
150     if (pfnDvpGetVideoPortFlipStatus == NULL)
151     {
152         DPRINT1("Warning: no pfnDvpGetVideoPortFlipStatus\n");
153         return DDHAL_DRIVER_NOTHANDLED;
154     }
155 
156     DPRINT("Calling dxg.sys pfnDvpGetVideoPortFlipStatus\n");
157     return pfnDvpGetVideoPortFlipStatus(hDirectDraw, puGetVPortFlipStatusData);
158 }
159 
160 /************************************************************************/
161 /* NtGdiDvpGetVideoPortInputFormats                                     */
162 /************************************************************************/
163 DWORD
164 APIENTRY
NtGdiDvpGetVideoPortInputFormats(HANDLE hVideoPort,PDD_GETVPORTINPUTFORMATDATA puGetVPortInputFormatData)165 NtGdiDvpGetVideoPortInputFormats(HANDLE hVideoPort,
166                                  PDD_GETVPORTINPUTFORMATDATA puGetVPortInputFormatData)
167 {
168     PGD_DXDVPGETVIDEOPORTINPUTFORMATS pfnDvpGetVideoPortInputFormats = (PGD_DXDVPGETVIDEOPORTINPUTFORMATS)gpDxFuncs[DXG_INDEX_DxDvpGetVideoPortInputFormats].pfn;
169 
170     if (pfnDvpGetVideoPortInputFormats == NULL)
171     {
172         DPRINT1("Warning: no pfnDvpGetVideoPortInputFormats\n");
173         return DDHAL_DRIVER_NOTHANDLED;
174     }
175 
176     DPRINT("Calling dxg.sys pfnDvpGetVideoPortInputFormats\n");
177     return pfnDvpGetVideoPortInputFormats(hVideoPort, puGetVPortInputFormatData);
178 }
179 
180 /************************************************************************/
181 /* NtGdiDvpGetVideoPortLine                                             */
182 /************************************************************************/
183 DWORD
184 APIENTRY
NtGdiDvpGetVideoPortLine(HANDLE hVideoPort,PDD_GETVPORTLINEDATA puGetVPortLineData)185 NtGdiDvpGetVideoPortLine(HANDLE hVideoPort,
186                          PDD_GETVPORTLINEDATA puGetVPortLineData)
187 {
188     PGD_DXDVPGETVIDEOPORTLINE pfnDvpGetVideoPortLine = (PGD_DXDVPGETVIDEOPORTLINE)gpDxFuncs[DXG_INDEX_DxDvpGetVideoPortLine].pfn;
189 
190     if (pfnDvpGetVideoPortLine == NULL)
191     {
192         DPRINT1("Warning: no pfnDvpGetVideoPortLine\n");
193         return DDHAL_DRIVER_NOTHANDLED;
194     }
195 
196     DPRINT("Calling dxg.sys pfnDvpGetVideoPortLine\n");
197     return pfnDvpGetVideoPortLine(hVideoPort, puGetVPortLineData);
198 }
199 
200 /************************************************************************/
201 /* NtGdiDvpGetVideoPortOutputFormats                                    */
202 /************************************************************************/
203 DWORD
204 APIENTRY
NtGdiDvpGetVideoPortOutputFormats(HANDLE hVideoPort,PDD_GETVPORTOUTPUTFORMATDATA puGetVPortOutputFormatData)205 NtGdiDvpGetVideoPortOutputFormats(HANDLE hVideoPort,
206                                   PDD_GETVPORTOUTPUTFORMATDATA puGetVPortOutputFormatData)
207 {
208     PGD_DXDVPGETVIDEOPORTOUTPUTFORMATS pfnDvpGetVideoPortOutputFormats = (PGD_DXDVPGETVIDEOPORTOUTPUTFORMATS)gpDxFuncs[DXG_INDEX_DxDvpGetVideoPortOutputFormats].pfn;
209 
210     if (pfnDvpGetVideoPortOutputFormats == NULL)
211     {
212         DPRINT1("Warning: no pfnDvpGetVideoPortOutputFormats\n");
213         return DDHAL_DRIVER_NOTHANDLED;
214     }
215 
216     DPRINT("Calling dxg.sys pfnDvpGetVideoPortOutputFormats\n");
217     return pfnDvpGetVideoPortOutputFormats(hVideoPort, puGetVPortOutputFormatData);
218 }
219 
220 /************************************************************************/
221 /* NtGdiDvpGetVideoPortConnectInfo                                      */
222 /************************************************************************/
223 DWORD
224 APIENTRY
NtGdiDvpGetVideoPortConnectInfo(HANDLE hDirectDraw,PDD_GETVPORTCONNECTDATA puGetVPortConnectData)225 NtGdiDvpGetVideoPortConnectInfo(HANDLE hDirectDraw,
226                                 PDD_GETVPORTCONNECTDATA puGetVPortConnectData)
227 {
228     PGD_DXDVPGETVIDEOPORTCONNECTINFO pfnDvpGetVideoPortConnectInfo = (PGD_DXDVPGETVIDEOPORTCONNECTINFO)gpDxFuncs[DXG_INDEX_DxDvpGetVideoPortConnectInfo].pfn;
229 
230     if (pfnDvpGetVideoPortConnectInfo == NULL)
231     {
232         DPRINT1("Warning: no pfnDvpGetVideoPortConnectInfo\n");
233         return DDHAL_DRIVER_NOTHANDLED;
234     }
235 
236     DPRINT("Calling dxg.sys pfnDvpGetVideoPortConnectInfo\n");
237     return pfnDvpGetVideoPortConnectInfo(hDirectDraw, puGetVPortConnectData);
238 }
239 
240 /************************************************************************/
241 /* NtGdiDvpGetVideoSignalStatus                                         */
242 /************************************************************************/
243 DWORD
244 APIENTRY
NtGdiDvpGetVideoSignalStatus(HANDLE hVideoPort,PDD_GETVPORTSIGNALDATA puGetVPortSignalData)245 NtGdiDvpGetVideoSignalStatus(HANDLE hVideoPort,
246                              PDD_GETVPORTSIGNALDATA puGetVPortSignalData)
247 {
248     PGD_DXDVPGETVIDEOSIGNALSTATUS pfnDvpGetVideoSignalStatus = (PGD_DXDVPGETVIDEOSIGNALSTATUS)gpDxFuncs[DXG_INDEX_DxDvpGetVideoSignalStatus].pfn;
249 
250     if (pfnDvpGetVideoSignalStatus == NULL)
251     {
252         DPRINT1("Warning: no pfnDvpGetVideoSignalStatus\n");
253         return DDHAL_DRIVER_NOTHANDLED;
254     }
255 
256     DPRINT("Calling dxg.sys pfnDvpGetVideoSignalStatus\n");
257     return pfnDvpGetVideoSignalStatus(hVideoPort, puGetVPortSignalData);
258 }
259 
260 /************************************************************************/
261 /* NtGdiDvpUpdateVideoPort                                              */
262 /************************************************************************/
263 DWORD
264 APIENTRY
NtGdiDvpUpdateVideoPort(HANDLE hVideoPort,HANDLE * phSurfaceVideo,HANDLE * phSurfaceVbi,PDD_UPDATEVPORTDATA puUpdateVPortData)265 NtGdiDvpUpdateVideoPort(HANDLE hVideoPort,
266                         HANDLE* phSurfaceVideo,
267                         HANDLE* phSurfaceVbi,
268                         PDD_UPDATEVPORTDATA puUpdateVPortData)
269 {
270     PGD_DXDVPUPDATEVIDEOPORT pfnDvpUpdateVideoPort = (PGD_DXDVPUPDATEVIDEOPORT)gpDxFuncs[DXG_INDEX_DxDvpUpdateVideoPort].pfn;
271 
272     if (pfnDvpUpdateVideoPort == NULL)
273     {
274         DPRINT1("Warning: no pfnDvpUpdateVideoPort\n");
275         return DDHAL_DRIVER_NOTHANDLED;
276     }
277 
278     DPRINT("Calling dxg.sys pfnDvpUpdateVideoPort\n");
279     return pfnDvpUpdateVideoPort(hVideoPort, phSurfaceVideo, phSurfaceVbi, puUpdateVPortData);
280 }
281 
282 /************************************************************************/
283 /* NtGdiDvpWaitForVideoPortSync                                         */
284 /************************************************************************/
285 DWORD
286 APIENTRY
NtGdiDvpWaitForVideoPortSync(HANDLE hVideoPort,PDD_WAITFORVPORTSYNCDATA puWaitForVPortSyncData)287 NtGdiDvpWaitForVideoPortSync(HANDLE hVideoPort,
288                              PDD_WAITFORVPORTSYNCDATA puWaitForVPortSyncData)
289 {
290     PGD_DXDVPWAITFORVIDEOPORTSYNC pfnDvpWaitForVideoPortSync = (PGD_DXDVPWAITFORVIDEOPORTSYNC)gpDxFuncs[DXG_INDEX_DxDvpWaitForVideoPortSync].pfn;
291 
292     if (pfnDvpWaitForVideoPortSync == NULL)
293     {
294         DPRINT1("Warning: no pfnDvpWaitForVideoPortSync\n");
295         return DDHAL_DRIVER_NOTHANDLED;
296     }
297 
298     DPRINT("Calling dxg.sys pfnDvpWaitForVideoPortSync\n");
299     return pfnDvpWaitForVideoPortSync(hVideoPort, puWaitForVPortSyncData);
300 }
301 
302 /************************************************************************/
303 /* NtGdiDvpAcquireNotification                                          */
304 /************************************************************************/
305 DWORD
306 APIENTRY
NtGdiDvpAcquireNotification(HANDLE hVideoPort,HANDLE * hEvent,LPDDVIDEOPORTNOTIFY pNotify)307 NtGdiDvpAcquireNotification(HANDLE hVideoPort,
308                             HANDLE* hEvent,
309                             LPDDVIDEOPORTNOTIFY pNotify)
310 {
311     PGD_DXDVPACQUIRENOTIFICATION pfnDvpAcquireNotification = (PGD_DXDVPACQUIRENOTIFICATION)gpDxFuncs[DXG_INDEX_DxDvpAcquireNotification].pfn;
312 
313     if (pfnDvpAcquireNotification == NULL)
314     {
315         DPRINT1("Warning: no pfnDvpAcquireNotification\n");
316         return DDHAL_DRIVER_NOTHANDLED;
317     }
318 
319     DPRINT("Calling dxg.sys pfnDvpAcquireNotification\n");
320     return pfnDvpAcquireNotification(hVideoPort, hEvent, pNotify);
321 }
322 
323 /************************************************************************/
324 /* NtGdiDvpReleaseNotification                                          */
325 /************************************************************************/
326 DWORD
327 APIENTRY
NtGdiDvpReleaseNotification(HANDLE hVideoPort,HANDLE hEvent)328 NtGdiDvpReleaseNotification(HANDLE hVideoPort,
329                             HANDLE hEvent)
330 {
331     PGD_DXDVPRELEASENOTIFICATION pfnDvpReleaseNotification = (PGD_DXDVPRELEASENOTIFICATION)gpDxFuncs[DXG_INDEX_DxDvpReleaseNotification].pfn;
332 
333     if (pfnDvpReleaseNotification == NULL)
334     {
335         DPRINT1("Warning: no pfnDvpReleaseNotification\n");
336         return DDHAL_DRIVER_NOTHANDLED;
337     }
338 
339     DPRINT("Calling dxg.sys pfnDvpReleaseNotification\n");
340     return pfnDvpReleaseNotification(hVideoPort, hEvent);
341 }
342 
343 /************************************************************************/
344 /* NtGdiDvpGetVideoPortField                                            */
345 /************************************************************************/
346 DWORD
347 APIENTRY
NtGdiDvpGetVideoPortField(HANDLE hVideoPort,PDD_GETVPORTFIELDDATA puGetVPortFieldData)348 NtGdiDvpGetVideoPortField(HANDLE hVideoPort,
349                           PDD_GETVPORTFIELDDATA puGetVPortFieldData)
350 {
351     PGD_DXDVPGETVIDEOPORTFIELD pfnDvpGetVideoPortField = (PGD_DXDVPGETVIDEOPORTFIELD)gpDxFuncs[DXG_INDEX_DxDvpGetVideoPortField].pfn;
352 
353     if (pfnDvpGetVideoPortField == NULL)
354     {
355         DPRINT1("Warning: no pfnDvpGetVideoPortField\n");
356         return DDHAL_DRIVER_NOTHANDLED;
357     }
358 
359     DPRINT("Calling dxg.sys pfnDvpGetVideoPortField\n");
360     return pfnDvpGetVideoPortField(hVideoPort, puGetVPortFieldData);
361 }
362