1 | /* $Id: HGSMIContext.h 69307 2017-10-25 13:46:45Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Host Guest Shared Memory Interface (HGSMI) - command contexts.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2017 Oracle Corporation
|
---|
8 | *
|
---|
9 | * Permission is hereby granted, free of charge, to any person
|
---|
10 | * obtaining a copy of this software and associated documentation
|
---|
11 | * files (the "Software"), to deal in the Software without
|
---|
12 | * restriction, including without limitation the rights to use,
|
---|
13 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
14 | * copies of the Software, and to permit persons to whom the
|
---|
15 | * Software is furnished to do so, subject to the following
|
---|
16 | * conditions:
|
---|
17 | *
|
---|
18 | * The above copyright notice and this permission notice shall be
|
---|
19 | * included in all copies or substantial portions of the Software.
|
---|
20 | *
|
---|
21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
25 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
26 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
28 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
29 | */
|
---|
30 |
|
---|
31 |
|
---|
32 | #ifndef ___VBox_Graphics_HGSMIContext_h___
|
---|
33 | #define ___VBox_Graphics_HGSMIContext_h___
|
---|
34 |
|
---|
35 | #include "HGSMI.h"
|
---|
36 | #include "HGSMIChSetup.h"
|
---|
37 | #include "VBoxVideoIPRT.h"
|
---|
38 |
|
---|
39 | #ifdef VBOX_WDDM_MINIPORT
|
---|
40 | # include "wddm/VBoxMPShgsmi.h"
|
---|
41 | typedef VBOXSHGSMI HGSMIGUESTCMDHEAP;
|
---|
42 | # define HGSMIGUESTCMDHEAP_GET(_p) (&(_p)->Heap)
|
---|
43 | #else
|
---|
44 | typedef HGSMIHEAP HGSMIGUESTCMDHEAP;
|
---|
45 | # define HGSMIGUESTCMDHEAP_GET(_p) (_p)
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | RT_C_DECLS_BEGIN
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Structure grouping the context needed for submitting commands to the host
|
---|
52 | * via HGSMI
|
---|
53 | */
|
---|
54 | typedef struct HGSMIGUESTCOMMANDCONTEXT
|
---|
55 | {
|
---|
56 | /** Information about the memory heap located in VRAM from which data
|
---|
57 | * structures to be sent to the host are allocated. */
|
---|
58 | HGSMIGUESTCMDHEAP heapCtx;
|
---|
59 | /** The I/O port used for submitting commands to the host by writing their
|
---|
60 | * offsets into the heap. */
|
---|
61 | RTIOPORT port;
|
---|
62 | } HGSMIGUESTCOMMANDCONTEXT, *PHGSMIGUESTCOMMANDCONTEXT;
|
---|
63 |
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Structure grouping the context needed for receiving commands from the host
|
---|
67 | * via HGSMI
|
---|
68 | */
|
---|
69 | typedef struct HGSMIHOSTCOMMANDCONTEXT
|
---|
70 | {
|
---|
71 | /** Information about the memory area located in VRAM in which the host
|
---|
72 | * places data structures to be read by the guest. */
|
---|
73 | HGSMIAREA areaCtx;
|
---|
74 | /** Convenience structure used for matching host commands to handlers. */
|
---|
75 | /** @todo handlers are registered individually in code rather than just
|
---|
76 | * passing a static structure in order to gain extra flexibility. There is
|
---|
77 | * currently no expected usage case for this though. Is the additional
|
---|
78 | * complexity really justified? */
|
---|
79 | HGSMICHANNELINFO channels;
|
---|
80 | /** Flag to indicate that one thread is currently processing the command
|
---|
81 | * queue. */
|
---|
82 | volatile bool fHostCmdProcessing;
|
---|
83 | /* Pointer to the VRAM location where the HGSMI host flags are kept. */
|
---|
84 | volatile HGSMIHOSTFLAGS *pfHostFlags;
|
---|
85 | /** The I/O port used for receiving commands from the host as offsets into
|
---|
86 | * the memory area and sending back confirmations (command completion,
|
---|
87 | * IRQ acknowlegement). */
|
---|
88 | RTIOPORT port;
|
---|
89 | } HGSMIHOSTCOMMANDCONTEXT, *PHGSMIHOSTCOMMANDCONTEXT;
|
---|
90 |
|
---|
91 | /** @name HGSMI context initialisation APIs.
|
---|
92 | * @{ */
|
---|
93 |
|
---|
94 | /** @todo we should provide a cleanup function too as part of the API */
|
---|
95 | DECLHIDDEN(int) VBoxHGSMISetupGuestContext(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
96 | void *pvGuestHeapMemory,
|
---|
97 | uint32_t cbGuestHeapMemory,
|
---|
98 | uint32_t offVRAMGuestHeapMemory,
|
---|
99 | const HGSMIENV *pEnv);
|
---|
100 | DECLHIDDEN(void) VBoxHGSMISetupHostContext(PHGSMIHOSTCOMMANDCONTEXT pCtx,
|
---|
101 | void *pvBaseMapping,
|
---|
102 | uint32_t offHostFlags,
|
---|
103 | void *pvHostAreaMapping,
|
---|
104 | uint32_t offVRAMHostArea,
|
---|
105 | uint32_t cbHostArea);
|
---|
106 |
|
---|
107 | /** @} */
|
---|
108 |
|
---|
109 | RT_C_DECLS_END
|
---|
110 |
|
---|
111 | #endif
|
---|
112 |
|
---|