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 ___VBoxVideoVdma_h___
|
---|
13 | #define ___VBoxVideoVdma_h___
|
---|
14 |
|
---|
15 | #include <iprt/cdefs.h>
|
---|
16 | #include <VBox/VBoxVideo.h>
|
---|
17 | #include "../VBoxVideo.h"
|
---|
18 |
|
---|
19 | #if 0
|
---|
20 | typedef DECLCALLBACK(int) FNVBOXVDMASUBMIT(struct _DEVICE_EXTENSION* pDevExt, struct VBOXVDMAINFO * pInfo, HGSMIOFFSET offDr, PVOID pvContext);
|
---|
21 | typedef FNVBOXVDMASUBMIT *PFNVBOXVDMASUBMIT;
|
---|
22 |
|
---|
23 | typedef struct VBOXVDMASUBMIT
|
---|
24 | {
|
---|
25 | PFNVBOXVDMASUBMIT pfnSubmit;
|
---|
26 | PVOID pvContext;
|
---|
27 | } VBOXVDMASUBMIT, *PVBOXVDMASUBMIT;
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | /* start */
|
---|
31 | typedef enum
|
---|
32 | {
|
---|
33 | VBOXVDMAPIPE_STATE_CLOSED = 0,
|
---|
34 | VBOXVDMAPIPE_STATE_CREATED = 1,
|
---|
35 | VBOXVDMAPIPE_STATE_OPENNED = 2,
|
---|
36 | VBOXVDMAPIPE_STATE_CLOSING = 3
|
---|
37 | } VBOXVDMAPIPE_STATE;
|
---|
38 |
|
---|
39 | typedef struct VBOXVDMAPIPE
|
---|
40 | {
|
---|
41 | KSPIN_LOCK SinchLock;
|
---|
42 | KEVENT Event;
|
---|
43 | LIST_ENTRY CmdListHead;
|
---|
44 | VBOXVDMAPIPE_STATE enmState;
|
---|
45 | /* true iff the other end needs Event notification */
|
---|
46 | bool bNeedNotify;
|
---|
47 | } VBOXVDMAPIPE, *PVBOXVDMAPIPE;
|
---|
48 |
|
---|
49 | typedef struct VBOXVDMAPIPE_CMD_HDR
|
---|
50 | {
|
---|
51 | LIST_ENTRY ListEntry;
|
---|
52 | } VBOXVDMAPIPE_CMD_HDR, *PVBOXVDMAPIPE_CMD_HDR;
|
---|
53 |
|
---|
54 | #define VBOXVDMAPIPE_CMD_HDR_FROM_ENTRY(_pE) ( (PVBOXVDMAPIPE_CMD_HDR)((uint8_t *)(_pE) - RT_OFFSETOF(VBOXVDMAPIPE_CMD_HDR, ListEntry)) )
|
---|
55 |
|
---|
56 | typedef enum
|
---|
57 | {
|
---|
58 | VBOXVDMAPIPE_CMD_TYPE_UNDEFINED = 0,
|
---|
59 | VBOXVDMAPIPE_CMD_TYPE_RECTSINFO = 1,
|
---|
60 | VBOXVDMAPIPE_CMD_TYPE_DMACMD = 2
|
---|
61 | } VBOXVDMAPIPE_CMD_TYPE;
|
---|
62 |
|
---|
63 | typedef struct VBOXVDMAPIPE_CMD_DR
|
---|
64 | {
|
---|
65 | VBOXVDMAPIPE_CMD_HDR PipeHdr;
|
---|
66 | VBOXVDMAPIPE_CMD_TYPE enmType;
|
---|
67 | } VBOXVDMAPIPE_CMD_DR, *PVBOXVDMAPIPE_CMD_DR;
|
---|
68 |
|
---|
69 | #define VBOXVDMAPIPE_CMD_DR_FROM_ENTRY(_pE) ( (PVBOXVDMAPIPE_CMD_DR)VBOXVDMAPIPE_CMD_HDR_FROM_ENTRY(_pE) )
|
---|
70 |
|
---|
71 | typedef struct VBOXVDMAPIPE_CMD_RECTSINFO
|
---|
72 | {
|
---|
73 | VBOXVDMAPIPE_CMD_DR Hdr;
|
---|
74 | PVBOXWDDM_CONTEXT pContext;
|
---|
75 | RECT ContextRect;
|
---|
76 | VBOXWDDM_RECTS_INFO UpdateRects;
|
---|
77 | } VBOXVDMAPIPE_CMD_RECTSINFO, *PVBOXVDMAPIPE_CMD_RECTSINFO;
|
---|
78 |
|
---|
79 | typedef struct VBOXVDMAGG
|
---|
80 | {
|
---|
81 | VBOXVDMAPIPE CmdPipe;
|
---|
82 | PKTHREAD pThread;
|
---|
83 | } VBOXVDMAGG, *PVBOXVDMAGG;
|
---|
84 |
|
---|
85 | /* DMA commands are currently submitted over HGSMI */
|
---|
86 | typedef struct VBOXVDMAINFO
|
---|
87 | {
|
---|
88 | HGSMIHEAP CmdHeap;
|
---|
89 | UINT uLastCompletedPagingBufferCmdFenceId;
|
---|
90 | BOOL fEnabled;
|
---|
91 | #if 0
|
---|
92 | VBOXVDMASUBMIT Submitter;
|
---|
93 | #endif
|
---|
94 | /* dma-related commands list processed on the guest w/o host part involvement (guest-guest commands) */
|
---|
95 | VBOXVDMAGG DmaGg;
|
---|
96 | } VBOXVDMAINFO, *PVBOXVDMAINFO;
|
---|
97 |
|
---|
98 | int vboxVdmaCreate (struct _DEVICE_EXTENSION* pDevExt, VBOXVDMAINFO *pInfo, ULONG offBuffer, ULONG cbBuffer
|
---|
99 | #if 0
|
---|
100 | , PFNVBOXVDMASUBMIT pfnSubmit, PVOID pvContext
|
---|
101 | #endif
|
---|
102 | );
|
---|
103 | int vboxVdmaDisable (struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo);
|
---|
104 | int vboxVdmaEnable (struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo);
|
---|
105 | int vboxVdmaFlush (struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo);
|
---|
106 | int vboxVdmaDestroy (struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo);
|
---|
107 | int vboxVdmaCBufDrSubmit (struct _DEVICE_EXTENSION* pDevExt, PVBOXVDMAINFO pInfo, PVBOXVDMACBUF_DR pDr);
|
---|
108 | struct VBOXVDMACBUF_DR* vboxVdmaCBufDrCreate (PVBOXVDMAINFO pInfo, uint32_t cbTrailingData);
|
---|
109 | void vboxVdmaCBufDrFree (PVBOXVDMAINFO pInfo, struct VBOXVDMACBUF_DR* pDr);
|
---|
110 |
|
---|
111 | #define VBOXVDMACBUF_DR_DATA_OFFSET() (sizeof (VBOXVDMACBUF_DR))
|
---|
112 | #define VBOXVDMACBUF_DR_SIZE(_cbData) (VBOXVDMACBUF_DR_DATA_OFFSET() + (_cbData))
|
---|
113 | #define VBOXVDMACBUF_DR_DATA(_pDr) ( ((uint8_t*)(_pDr)) + VBOXVDMACBUF_DR_DATA_OFFSET() )
|
---|
114 | #endif /* #ifndef ___VBoxVideoVdma_h___ */
|
---|