VirtualBox

source: vbox/trunk/include/VBox/Graphics/HGSMIBuffers.h@ 67040

Last change on this file since 67040 was 66685, checked in by vboxsync, 8 years ago

bugref:8524: Additions/linux: play nicely with distribution-installed Additions
[PATCH] Add HGSMIBuffers.h header file

Add a HGSMIBuffers.h header file and move the HGSMI heap setup and
buffer free / alloc / submit function declarations there, as the
linux vboxvideo driver is going to provide its own version of these.

Signed-off-by: Hans de Goede <hdegoede@…>

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/** @file
2 * VBox Host Guest Shared Memory Interface (HGSMI) buffer management.
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_HGSMIBuffers_h___
28#define ___VBox_Graphics_HGSMIBuffers_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
43RT_C_DECLS_BEGIN
44
45/**
46 * Structure grouping the context needed for submitting commands to the host
47 * via HGSMI
48 */
49typedef 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 */
64typedef 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 Base HGSMI Buffer APIs
87 * @{ */
88
89/** Acknowlege an IRQ. */
90DECLINLINE(void) VBoxHGSMIClearIrq(PHGSMIHOSTCOMMANDCONTEXT pCtx)
91{
92 VBVO_PORT_WRITE_U32(pCtx->port, HGSMIOFFSET_VOID);
93}
94
95DECLHIDDEN(void) VBoxHGSMISetupHostContext(PHGSMIHOSTCOMMANDCONTEXT pCtx,
96 void *pvBaseMapping,
97 uint32_t offHostFlags,
98 void *pvHostAreaMapping,
99 uint32_t offVRAMHostArea,
100 uint32_t cbHostArea);
101DECLHIDDEN(void) VBoxHGSMIHostCmdComplete(PHGSMIHOSTCOMMANDCONTEXT pCtx,
102 void *pvMem);
103DECLHIDDEN(void) VBoxHGSMIProcessHostQueue(PHGSMIHOSTCOMMANDCONTEXT pCtx);
104/** @todo we should provide a cleanup function too as part of the API */
105DECLHIDDEN(int) VBoxHGSMISetupGuestContext(PHGSMIGUESTCOMMANDCONTEXT pCtx,
106 void *pvGuestHeapMemory,
107 uint32_t cbGuestHeapMemory,
108 uint32_t offVRAMGuestHeapMemory,
109 const HGSMIENV *pEnv);
110DECLHIDDEN(void *) VBoxHGSMIBufferAlloc(PHGSMIGUESTCOMMANDCONTEXT pCtx,
111 HGSMISIZE cbData,
112 uint8_t u8Ch,
113 uint16_t u16Op);
114DECLHIDDEN(void) VBoxHGSMIBufferFree(PHGSMIGUESTCOMMANDCONTEXT pCtx,
115 void *pvBuffer);
116DECLHIDDEN(int) VBoxHGSMIBufferSubmit(PHGSMIGUESTCOMMANDCONTEXT pCtx,
117 void *pvBuffer);
118/** @} */
119
120RT_C_DECLS_END
121
122#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette