1 | /*
|
---|
2 | * Copyright (C) 2010 Oracle Corporation
|
---|
3 | *
|
---|
4 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
5 | * available from http://www.virtualbox.org. This file is free software;
|
---|
6 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
7 | * General Public License (GPL) as published by the Free Software
|
---|
8 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
9 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
10 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
11 | */
|
---|
12 | #ifndef ___VBoxVideoShgsmi_h___
|
---|
13 | #define ___VBoxVideoShgsmi_h___
|
---|
14 |
|
---|
15 | #include <iprt/cdefs.h>
|
---|
16 | #include <VBox/VBoxVideo.h>
|
---|
17 | #include "../VBoxVideo.h"
|
---|
18 |
|
---|
19 | typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION(struct _HGSMIHEAP * pHeap, void *pvCmd, void *pvContext);
|
---|
20 | typedef FNVBOXSHGSMICMDCOMPLETION *PFNVBOXSHGSMICMDCOMPLETION;
|
---|
21 |
|
---|
22 | typedef DECLCALLBACK(void) FNVBOXSHGSMICMDCOMPLETION_IRQ(struct _HGSMIHEAP * pHeap, void *pvCmd, void *pvContext,
|
---|
23 | PFNVBOXSHGSMICMDCOMPLETION *ppfnCompletion, void **ppvCompletion);
|
---|
24 | typedef FNVBOXSHGSMICMDCOMPLETION_IRQ *PFNVBOXSHGSMICMDCOMPLETION_IRQ;
|
---|
25 |
|
---|
26 | typedef struct VBOXSHGSMILIST_ENTRY
|
---|
27 | {
|
---|
28 | struct VBOXSHGSMILIST_ENTRY *pNext;
|
---|
29 | } VBOXSHGSMILIST_ENTRY, *PVBOXSHGSMILIST_ENTRY;
|
---|
30 |
|
---|
31 | typedef struct VBOXSHGSMILIST
|
---|
32 | {
|
---|
33 | PVBOXSHGSMILIST_ENTRY pFirst;
|
---|
34 | PVBOXSHGSMILIST_ENTRY pLast;
|
---|
35 | } VBOXSHGSMILIST, *PVBOXSHGSMILIST;
|
---|
36 |
|
---|
37 | DECLINLINE(bool) vboxSHGSMIListIsEmpty(PVBOXSHGSMILIST pList)
|
---|
38 | {
|
---|
39 | return !pList->pFirst;
|
---|
40 | }
|
---|
41 |
|
---|
42 | DECLINLINE(void) vboxSHGSMIListInit(PVBOXSHGSMILIST pList)
|
---|
43 | {
|
---|
44 | pList->pFirst = pList->pLast = NULL;
|
---|
45 | }
|
---|
46 |
|
---|
47 | DECLINLINE(void) vboxSHGSMIListPut(PVBOXSHGSMILIST pList, PVBOXSHGSMILIST_ENTRY pFirst, PVBOXSHGSMILIST_ENTRY pLast)
|
---|
48 | {
|
---|
49 | Assert(pFirst);
|
---|
50 | Assert(pLast);
|
---|
51 | pLast->pNext = NULL;
|
---|
52 | if (pList->pLast)
|
---|
53 | {
|
---|
54 | Assert(pList->pFirst);
|
---|
55 | pList->pLast->pNext = pFirst;
|
---|
56 | pList->pLast = pLast;
|
---|
57 | }
|
---|
58 | else
|
---|
59 | {
|
---|
60 | Assert(!pList->pFirst);
|
---|
61 | pList->pFirst = pFirst;
|
---|
62 | pList->pLast = pLast;
|
---|
63 | }
|
---|
64 | }
|
---|
65 |
|
---|
66 | DECLINLINE(void) vboxSHGSMIListCat(PVBOXSHGSMILIST pList1, PVBOXSHGSMILIST pList2)
|
---|
67 | {
|
---|
68 | vboxSHGSMIListPut(pList1, pList2->pFirst, pList2->pLast);
|
---|
69 | pList2->pFirst = pList2->pLast = NULL;
|
---|
70 | }
|
---|
71 |
|
---|
72 | DECLINLINE(void) vboxSHGSMIListDetach(PVBOXSHGSMILIST pList, PVBOXSHGSMILIST_ENTRY *ppFirst, PVBOXSHGSMILIST_ENTRY *ppLast)
|
---|
73 | {
|
---|
74 | *ppFirst = pList->pFirst;
|
---|
75 | if (ppLast)
|
---|
76 | *ppLast = pList->pLast;
|
---|
77 | pList->pFirst = NULL;
|
---|
78 | pList->pLast = NULL;
|
---|
79 | }
|
---|
80 |
|
---|
81 | DECLINLINE(void) vboxSHGSMIListDetach2List(PVBOXSHGSMILIST pList, PVBOXSHGSMILIST pDstList)
|
---|
82 | {
|
---|
83 | vboxSHGSMIListDetach(pList, &pDstList->pFirst, &pDstList->pLast);
|
---|
84 | }
|
---|
85 |
|
---|
86 | DECLINLINE(void) vboxSHGSMIListDetachEntries(PVBOXSHGSMILIST pList, PVBOXSHGSMILIST_ENTRY pBeforeDetach, PVBOXSHGSMILIST_ENTRY pLast2Detach)
|
---|
87 | {
|
---|
88 | if (pBeforeDetach)
|
---|
89 | {
|
---|
90 | pBeforeDetach->pNext = pLast2Detach->pNext;
|
---|
91 | if (!pBeforeDetach->pNext)
|
---|
92 | pList->pLast = pBeforeDetach;
|
---|
93 | }
|
---|
94 | else
|
---|
95 | {
|
---|
96 | pList->pFirst = pLast2Detach->pNext;
|
---|
97 | if (!pList->pFirst)
|
---|
98 | pList->pLast = NULL;
|
---|
99 | }
|
---|
100 | pLast2Detach->pNext = NULL;
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 | const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchEvent(struct _HGSMIHEAP * pHeap, PVOID pvBuff, RTSEMEVENT hEventSem);
|
---|
105 | const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepSynch(struct _HGSMIHEAP * pHeap, PVOID pCmd);
|
---|
106 | const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynch(struct _HGSMIHEAP * pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION pfnCompletion, PVOID pvCompletion, uint32_t fFlags);
|
---|
107 | const VBOXSHGSMIHEADER* VBoxSHGSMICommandPrepAsynchIrq(struct _HGSMIHEAP * pHeap, PVOID pvBuff, PFNVBOXSHGSMICMDCOMPLETION_IRQ pfnCompletion, PVOID pvCompletion, uint32_t fFlags);
|
---|
108 |
|
---|
109 | void VBoxSHGSMICommandDoneAsynch(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader);
|
---|
110 | int VBoxSHGSMICommandDoneSynch(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader);
|
---|
111 | void VBoxSHGSMICommandCancelAsynch(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader);
|
---|
112 | void VBoxSHGSMICommandCancelSynch(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader);
|
---|
113 |
|
---|
114 | DECLINLINE(HGSMIOFFSET) VBoxSHGSMICommandOffset(struct _HGSMIHEAP * pHeap, const VBOXSHGSMIHEADER* pHeader)
|
---|
115 | {
|
---|
116 | return HGSMIHeapBufferOffset(pHeap, (void*)pHeader);
|
---|
117 | }
|
---|
118 |
|
---|
119 | void* VBoxSHGSMICommandAlloc(struct _HGSMIHEAP * pHeap, HGSMISIZE cbData, uint8_t u8Channel, uint16_t u16ChannelInfo);
|
---|
120 | void VBoxSHGSMICommandFree(struct _HGSMIHEAP * pHeap, void *pvBuffer);
|
---|
121 | int VBoxSHGSMICommandProcessCompletion(struct _HGSMIHEAP * pHeap, VBOXSHGSMIHEADER* pCmd, bool bIrq, PVBOXSHGSMILIST pPostProcessList);
|
---|
122 | int VBoxSHGSMICommandPostprocessCompletion(struct _HGSMIHEAP * pHeap, PVBOXSHGSMILIST pPostProcessList);
|
---|
123 |
|
---|
124 | #endif /* #ifndef ___VBoxVideoShgsmi_h___ */
|
---|