1 | /* $Id: VBoxMPVdma.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox WDDM Miniport driver
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #include "VBoxMPWddm.h"
|
---|
29 | #include "common/VBoxMPCommon.h"
|
---|
30 | #include "VBoxMPVdma.h"
|
---|
31 | #ifdef VBOX_WITH_VIDEOHWACCEL
|
---|
32 | #include "VBoxMPVhwa.h"
|
---|
33 | #endif
|
---|
34 | #include <iprt/asm.h>
|
---|
35 | #include <iprt/mem.h>
|
---|
36 |
|
---|
37 |
|
---|
38 | static DECLCALLBACK(void *) hgsmiEnvAlloc(void *pvEnv, HGSMISIZE cb)
|
---|
39 | {
|
---|
40 | NOREF(pvEnv);
|
---|
41 | return RTMemAlloc(cb);
|
---|
42 | }
|
---|
43 |
|
---|
44 | static DECLCALLBACK(void) hgsmiEnvFree(void *pvEnv, void *pv)
|
---|
45 | {
|
---|
46 | NOREF(pvEnv);
|
---|
47 | RTMemFree(pv);
|
---|
48 | }
|
---|
49 |
|
---|
50 | static HGSMIENV g_hgsmiEnvVdma =
|
---|
51 | {
|
---|
52 | NULL,
|
---|
53 | hgsmiEnvAlloc,
|
---|
54 | hgsmiEnvFree
|
---|
55 | };
|
---|
56 |
|
---|
57 | /* create a DMACommand buffer */
|
---|
58 | int vboxVdmaCreate(PVBOXMP_DEVEXT pDevExt, VBOXVDMAINFO *pInfo
|
---|
59 | )
|
---|
60 | {
|
---|
61 | RT_NOREF(pDevExt);
|
---|
62 | pInfo->fEnabled = FALSE;
|
---|
63 |
|
---|
64 | return VINF_SUCCESS;
|
---|
65 | }
|
---|
66 |
|
---|
67 | int vboxVdmaDisable (PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo)
|
---|
68 | {
|
---|
69 | RT_NOREF(pDevExt);
|
---|
70 |
|
---|
71 | if (!pInfo->fEnabled)
|
---|
72 | return VINF_ALREADY_INITIALIZED;
|
---|
73 |
|
---|
74 | /* ensure nothing else is submitted */
|
---|
75 | pInfo->fEnabled = FALSE;
|
---|
76 | return VINF_SUCCESS;
|
---|
77 | }
|
---|
78 |
|
---|
79 | int vboxVdmaEnable (PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo)
|
---|
80 | {
|
---|
81 | RT_NOREF(pDevExt);
|
---|
82 | Assert(!pInfo->fEnabled);
|
---|
83 | if (pInfo->fEnabled)
|
---|
84 | return VINF_ALREADY_INITIALIZED;
|
---|
85 | return VINF_SUCCESS;
|
---|
86 | }
|
---|
87 |
|
---|
88 | int vboxVdmaDestroy (PVBOXMP_DEVEXT pDevExt, PVBOXVDMAINFO pInfo)
|
---|
89 | {
|
---|
90 | int rc = VINF_SUCCESS;
|
---|
91 | Assert(!pInfo->fEnabled);
|
---|
92 | if (pInfo->fEnabled)
|
---|
93 | rc = vboxVdmaDisable (pDevExt, pInfo);
|
---|
94 | return rc;
|
---|
95 | }
|
---|