VirtualBox

source: vbox/trunk/include/VBox/Graphics/VBoxUhgsmi.h@ 89363

Last change on this file since 89363 was 85121, checked in by vboxsync, 4 years ago

iprt/cdefs.h: Refactored the typedef use of DECLCALLBACK as well as DECLCALLBACKMEMBER to wrap the whole expression, similar to the DECLR?CALLBACKMEMBER macros. This allows adding a throw() at the end when compiling with the VC++ compiler to indicate that the callbacks won't throw anything, so we can stop supressing the C5039 warning about passing functions that can potential throw C++ exceptions to extern C code that can't necessarily cope with such (unwind,++). Introduced a few _EX variations that allows specifying different/no calling convention too, as that's handy when dynamically resolving host APIs. Fixed numerous places missing DECLCALLBACK and such. Left two angry @todos regarding use of CreateThread. bugref:9794

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: VBoxUhgsmi.h 85121 2020-07-08 19:33:26Z vboxsync $ */
2/** @file
3 * Document me, pretty please.
4 */
5
6/*
7 * Copyright (C) 2010-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef VBOX_INCLUDED_Graphics_VBoxUhgsmi_h
28#define VBOX_INCLUDED_Graphics_VBoxUhgsmi_h
29#ifndef RT_WITHOUT_PRAGMA_ONCE
30# pragma once
31#endif
32
33#include <iprt/cdefs.h>
34#include <iprt/types.h>
35
36typedef struct VBOXUHGSMI *PVBOXUHGSMI;
37
38typedef struct VBOXUHGSMI_BUFFER *PVBOXUHGSMI_BUFFER;
39
40typedef union VBOXUHGSMI_BUFFER_TYPE_FLAGS
41{
42 uint32_t Value;
43 struct
44 {
45 uint32_t fCommand : 1;
46 uint32_t Reserved : 31;
47 } s;
48} VBOXUHGSMI_BUFFER_TYPE_FLAGS;
49
50typedef union VBOXUHGSMI_BUFFER_LOCK_FLAGS
51{
52 uint32_t Value;
53 struct
54 {
55 uint32_t fReadOnly : 1;
56 uint32_t fWriteOnly : 1;
57 uint32_t fDonotWait : 1;
58 uint32_t fDiscard : 1;
59 uint32_t fLockEntire : 1;
60 uint32_t Reserved : 27;
61 } s;
62} VBOXUHGSMI_BUFFER_LOCK_FLAGS;
63
64typedef union VBOXUHGSMI_BUFFER_SUBMIT_FLAGS
65{
66 uint32_t Value;
67 struct
68 {
69 uint32_t fHostReadOnly : 1;
70 uint32_t fHostWriteOnly : 1;
71 uint32_t fDoNotRetire : 1; /**< the buffer will be used in a subsequent command */
72 uint32_t fEntireBuffer : 1;
73 uint32_t Reserved : 28;
74 } s;
75} VBOXUHGSMI_BUFFER_SUBMIT_FLAGS, *PVBOXUHGSMI_BUFFER_SUBMIT_FLAGS;
76
77/* the caller can specify NULL as a hSynch and specify a valid enmSynchType to make UHGSMI create a proper object itself,
78 * */
79typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_CREATE,(PVBOXUHGSMI pHgsmi, uint32_t cbBuf, VBOXUHGSMI_BUFFER_TYPE_FLAGS fType,
80 PVBOXUHGSMI_BUFFER* ppBuf));
81typedef FNVBOXUHGSMI_BUFFER_CREATE *PFNVBOXUHGSMI_BUFFER_CREATE;
82
83typedef struct VBOXUHGSMI_BUFFER_SUBMIT
84{
85 PVBOXUHGSMI_BUFFER pBuf;
86 uint32_t offData;
87 uint32_t cbData;
88 VBOXUHGSMI_BUFFER_SUBMIT_FLAGS fFlags;
89} VBOXUHGSMI_BUFFER_SUBMIT, *PVBOXUHGSMI_BUFFER_SUBMIT;
90
91typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_SUBMIT,(PVBOXUHGSMI pHgsmi, PVBOXUHGSMI_BUFFER_SUBMIT aBuffers,
92 uint32_t cBuffers));
93typedef FNVBOXUHGSMI_BUFFER_SUBMIT *PFNVBOXUHGSMI_BUFFER_SUBMIT;
94
95typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_DESTROY,(PVBOXUHGSMI_BUFFER pBuf));
96typedef FNVBOXUHGSMI_BUFFER_DESTROY *PFNVBOXUHGSMI_BUFFER_DESTROY;
97
98typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_LOCK,(PVBOXUHGSMI_BUFFER pBuf, uint32_t offLock, uint32_t cbLock,
99 VBOXUHGSMI_BUFFER_LOCK_FLAGS fFlags, void**pvLock));
100typedef FNVBOXUHGSMI_BUFFER_LOCK *PFNVBOXUHGSMI_BUFFER_LOCK;
101
102typedef DECLCALLBACKTYPE(int, FNVBOXUHGSMI_BUFFER_UNLOCK,(PVBOXUHGSMI_BUFFER pBuf));
103typedef FNVBOXUHGSMI_BUFFER_UNLOCK *PFNVBOXUHGSMI_BUFFER_UNLOCK;
104
105typedef struct VBOXUHGSMI
106{
107 PFNVBOXUHGSMI_BUFFER_CREATE pfnBufferCreate;
108 PFNVBOXUHGSMI_BUFFER_SUBMIT pfnBufferSubmit;
109 /** User custom data. */
110 void *pvUserData;
111} VBOXUHGSMI;
112
113typedef struct VBOXUHGSMI_BUFFER
114{
115 PFNVBOXUHGSMI_BUFFER_LOCK pfnLock;
116 PFNVBOXUHGSMI_BUFFER_UNLOCK pfnUnlock;
117 PFNVBOXUHGSMI_BUFFER_DESTROY pfnDestroy;
118
119 /* r/o data added for ease of access and simplicity
120 * modifying it leads to unpredictable behavior */
121 VBOXUHGSMI_BUFFER_TYPE_FLAGS fType;
122 uint32_t cbBuffer;
123 /** User custom data. */
124 void *pvUserData;
125} VBOXUHGSMI_BUFFER;
126
127#define VBoxUhgsmiBufferCreate(_pUhgsmi, _cbBuf, _fType, _ppBuf) ((_pUhgsmi)->pfnBufferCreate(_pUhgsmi, _cbBuf, _fType, _ppBuf))
128#define VBoxUhgsmiBufferSubmit(_pUhgsmi, _aBuffers, _cBuffers) ((_pUhgsmi)->pfnBufferSubmit(_pUhgsmi, _aBuffers, _cBuffers))
129
130#define VBoxUhgsmiBufferLock(_pBuf, _offLock, _cbLock, _fFlags, _pvLock) ((_pBuf)->pfnLock(_pBuf, _offLock, _cbLock, _fFlags, _pvLock))
131#define VBoxUhgsmiBufferUnlock(_pBuf) ((_pBuf)->pfnUnlock(_pBuf))
132#define VBoxUhgsmiBufferDestroy(_pBuf) ((_pBuf)->pfnDestroy(_pBuf))
133
134#endif /* !VBOX_INCLUDED_Graphics_VBoxUhgsmi_h */
135
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