1 | /* $Id: VBoxMPVdma.cpp 93115 2022-01-01 11:31:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox WDDM Miniport driver
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2022 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #include "VBoxMPWddm.h"
|
---|
19 | #include "common/VBoxMPCommon.h"
|
---|
20 | #include "VBoxMPVdma.h"
|
---|
21 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
22 | #include "VBoxMPVhwa.h"
|
---|
23 | #endif
|
---|
24 | #include <iprt/asm.h>
|
---|
25 | #include <iprt/mem.h>
|
---|
26 |
|
---|
27 |
|
---|
28 | static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb)
|
---|
29 | {
|
---|
30 | NOREF(pvEnv);
|
---|
31 | return RTMemAlloc(cb);
|
---|
32 | }
|
---|
33 |
|
---|
34 | static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv)
|
---|
35 | {
|
---|
36 | NOREF(pvEnv);
|
---|
37 | RTMemFree(pv);
|
---|
38 | }
|
---|
39 |
|
---|
40 | static HGSMIENV g_hgsmiEnvVdma =
|
---|
41 | {
|
---|
42 | NULL,
|
---|
43 | hgsmiEnvAlloc,
|
---|
44 | hgsmiEnvFree
|
---|
45 | };
|
---|
46 |
|
---|
47 | /* create a DMACommand buffer */
|
---|
48 | int vboxVdmaCreate(PVBOXMP_DEVEXT pDevExt, VBOXVDMAINFO *pInfo
|
---|
49 | )
|
---|
50 | {
|
---|
51 | RT_NOREF(pDevExt);
|
---|
52 | pInfo->fEnabled = FALSE;
|
---|
53 |
|
---|
54 | return VINF_SUCCESS;
|
---|
55 | }
|
---|
56 |
|
---|
57 | int vboxVdmaDisable (PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo)
|
---|
58 | {
|
---|
59 | RT_NOREF(pDevExt);
|
---|
60 |
|
---|
61 | if (!pInfo->fEnabled)
|
---|
62 | return VINF_ALREADY_INITIALIZED;
|
---|
63 |
|
---|
64 | /* ensure nothing else is submitted */
|
---|
65 | pInfo->fEnabled = FALSE;
|
---|
66 | return VINF_SUCCESS;
|
---|
67 | }
|
---|
68 |
|
---|
69 | int vboxVdmaEnable (PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo)
|
---|
70 | {
|
---|
71 | RT_NOREF(pDevExt);
|
---|
72 | Assert(!pInfo->fEnabled);
|
---|
73 | if (pInfo->fEnabled)
|
---|
74 | return VINF_ALREADY_INITIALIZED;
|
---|
75 | return VINF_SUCCESS;
|
---|
76 | }
|
---|
77 |
|
---|
78 | int vboxVdmaDestroy (PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo)
|
---|
79 | {
|
---|
80 | int rc = VINF_SUCCESS;
|
---|
81 | Assert(!pInfo->fEnabled);
|
---|
82 | if (pInfo->fEnabled)
|
---|
83 | rc = vboxVdmaDisable (pDevExt, pInfo);
|
---|
84 | return rc;
|
---|
85 | }
|
---|