1 | /** @file
|
---|
2 | * VBox Host Guest Shared Memory Interface (HGSMI) - command contexts.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2017 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 |
|
---|
27 | #ifndef ___VBox_Graphics_HGSMIContext_h___
|
---|
28 | #define ___VBox_Graphics_HGSMIContext_h___
|
---|
29 |
|
---|
30 | #include "HGSMI.h"
|
---|
31 | #include "HGSMIChSetup.h"
|
---|
32 | #include "VBoxVideoIPRT.h"
|
---|
33 |
|
---|
34 | #ifdef VBOX_WDDM_MINIPORT
|
---|
35 | # include "wddm/VBoxMPShgsmi.h"
|
---|
36 | typedef VBOXSHGSMI HGSMIGUESTCMDHEAP;
|
---|
37 | # define HGSMIGUESTCMDHEAP_GET(_p) (&(_p)->Heap)
|
---|
38 | #else
|
---|
39 | typedef HGSMIHEAP HGSMIGUESTCMDHEAP;
|
---|
40 | # define HGSMIGUESTCMDHEAP_GET(_p) (_p)
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | RT_C_DECLS_BEGIN
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Structure grouping the context needed for submitting commands to the host
|
---|
47 | * via HGSMI
|
---|
48 | */
|
---|
49 | typedef struct HGSMIGUESTCOMMANDCONTEXT
|
---|
50 | {
|
---|
51 | /** Information about the memory heap located in VRAM from which data
|
---|
52 | * structures to be sent to the host are allocated. */
|
---|
53 | HGSMIGUESTCMDHEAP heapCtx;
|
---|
54 | /** The I/O port used for submitting commands to the host by writing their
|
---|
55 | * offsets into the heap. */
|
---|
56 | RTIOPORT port;
|
---|
57 | } HGSMIGUESTCOMMANDCONTEXT, *PHGSMIGUESTCOMMANDCONTEXT;
|
---|
58 |
|
---|
59 |
|
---|
60 | /**
|
---|
61 | * Structure grouping the context needed for receiving commands from the host
|
---|
62 | * via HGSMI
|
---|
63 | */
|
---|
64 | typedef struct HGSMIHOSTCOMMANDCONTEXT
|
---|
65 | {
|
---|
66 | /** Information about the memory area located in VRAM in which the host
|
---|
67 | * places data structures to be read by the guest. */
|
---|
68 | HGSMIAREA areaCtx;
|
---|
69 | /** Convenience structure used for matching host commands to handlers. */
|
---|
70 | /** @todo handlers are registered individually in code rather than just
|
---|
71 | * passing a static structure in order to gain extra flexibility. There is
|
---|
72 | * currently no expected usage case for this though. Is the additional
|
---|
73 | * complexity really justified? */
|
---|
74 | HGSMICHANNELINFO channels;
|
---|
75 | /** Flag to indicate that one thread is currently processing the command
|
---|
76 | * queue. */
|
---|
77 | volatile bool fHostCmdProcessing;
|
---|
78 | /* Pointer to the VRAM location where the HGSMI host flags are kept. */
|
---|
79 | volatile HGSMIHOSTFLAGS *pfHostFlags;
|
---|
80 | /** The I/O port used for receiving commands from the host as offsets into
|
---|
81 | * the memory area and sending back confirmations (command completion,
|
---|
82 | * IRQ acknowlegement). */
|
---|
83 | RTIOPORT port;
|
---|
84 | } HGSMIHOSTCOMMANDCONTEXT, *PHGSMIHOSTCOMMANDCONTEXT;
|
---|
85 |
|
---|
86 | /** @name HGSMI context initialisation APIs.
|
---|
87 | * @{ */
|
---|
88 |
|
---|
89 | /** @todo we should provide a cleanup function too as part of the API */
|
---|
90 | DECLHIDDEN(int) VBoxHGSMISetupGuestContext(PHGSMIGUESTCOMMANDCONTEXT pCtx,
|
---|
91 | void *pvGuestHeapMemory,
|
---|
92 | uint32_t cbGuestHeapMemory,
|
---|
93 | uint32_t offVRAMGuestHeapMemory,
|
---|
94 | const HGSMIENV *pEnv);
|
---|
95 | DECLHIDDEN(void) VBoxHGSMISetupHostContext(PHGSMIHOSTCOMMANDCONTEXT pCtx,
|
---|
96 | void *pvBaseMapping,
|
---|
97 | uint32_t offHostFlags,
|
---|
98 | void *pvHostAreaMapping,
|
---|
99 | uint32_t offVRAMHostArea,
|
---|
100 | uint32_t cbHostArea);
|
---|
101 |
|
---|
102 | /** @} */
|
---|
103 |
|
---|
104 | RT_C_DECLS_END
|
---|
105 |
|
---|
106 | #endif
|
---|
107 |
|
---|