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