1 | /* $Id: DevVGA-SVGA-cmd.cpp 94265 2022-03-16 10:33:19Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMware SVGA device - implementation of VMSVGA commands.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2022 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 |
|
---|
18 | #ifndef IN_RING3
|
---|
19 | # error "DevVGA-SVGA-cmd.cpp is only for ring-3 code"
|
---|
20 | #endif
|
---|
21 |
|
---|
22 |
|
---|
23 | #define LOG_GROUP LOG_GROUP_DEV_VMSVGA
|
---|
24 | #include <iprt/mem.h>
|
---|
25 | #include <VBox/AssertGuest.h>
|
---|
26 | #include <VBox/log.h>
|
---|
27 | #include <VBox/vmm/pdmdev.h>
|
---|
28 | #include <VBoxVideo.h>
|
---|
29 |
|
---|
30 | /* should go BEFORE any other DevVGA include to make all DevVGA.h config defines be visible */
|
---|
31 | #include "DevVGA.h"
|
---|
32 |
|
---|
33 | /* Should be included after DevVGA.h/DevVGA-SVGA.h to pick all defines. */
|
---|
34 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
35 | # include "DevVGA-SVGA3d.h"
|
---|
36 | #endif
|
---|
37 | #include "DevVGA-SVGA-internal.h"
|
---|
38 |
|
---|
39 | #include <iprt/formats/bmp.h>
|
---|
40 | #include <stdio.h>
|
---|
41 |
|
---|
42 | #if defined(LOG_ENABLED) || defined(VBOX_STRICT)
|
---|
43 | # define SVGA_CASE_ID2STR(idx) case idx: return #idx
|
---|
44 |
|
---|
45 | static const char *vmsvgaFifo3dCmdToString(SVGAFifo3dCmdId enmCmdId)
|
---|
46 | {
|
---|
47 | switch (enmCmdId)
|
---|
48 | {
|
---|
49 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LEGACY_BASE);
|
---|
50 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DEFINE);
|
---|
51 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DESTROY);
|
---|
52 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_COPY);
|
---|
53 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_STRETCHBLT);
|
---|
54 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DMA);
|
---|
55 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CONTEXT_DEFINE);
|
---|
56 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CONTEXT_DESTROY);
|
---|
57 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETTRANSFORM);
|
---|
58 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETZRANGE);
|
---|
59 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETRENDERSTATE);
|
---|
60 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETRENDERTARGET);
|
---|
61 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETTEXTURESTATE);
|
---|
62 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETMATERIAL);
|
---|
63 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETLIGHTDATA);
|
---|
64 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETLIGHTENABLED);
|
---|
65 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETVIEWPORT);
|
---|
66 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETCLIPPLANE);
|
---|
67 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CLEAR);
|
---|
68 | SVGA_CASE_ID2STR(SVGA_3D_CMD_PRESENT);
|
---|
69 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SHADER_DEFINE);
|
---|
70 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SHADER_DESTROY);
|
---|
71 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_SHADER);
|
---|
72 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_SHADER_CONST);
|
---|
73 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW_PRIMITIVES);
|
---|
74 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETSCISSORRECT);
|
---|
75 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BEGIN_QUERY);
|
---|
76 | SVGA_CASE_ID2STR(SVGA_3D_CMD_END_QUERY);
|
---|
77 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WAIT_FOR_QUERY);
|
---|
78 | SVGA_CASE_ID2STR(SVGA_3D_CMD_PRESENT_READBACK);
|
---|
79 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN);
|
---|
80 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DEFINE_V2);
|
---|
81 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GENERATE_MIPMAPS);
|
---|
82 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD4); /* SVGA_3D_CMD_VIDEO_CREATE_DECODER */
|
---|
83 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD5); /* SVGA_3D_CMD_VIDEO_DESTROY_DECODER */
|
---|
84 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD6); /* SVGA_3D_CMD_VIDEO_CREATE_PROCESSOR */
|
---|
85 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD7); /* SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR */
|
---|
86 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD8); /* SVGA_3D_CMD_VIDEO_DECODE_START_FRAME */
|
---|
87 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD9); /* SVGA_3D_CMD_VIDEO_DECODE_RENDER */
|
---|
88 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD10); /* SVGA_3D_CMD_VIDEO_DECODE_END_FRAME */
|
---|
89 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD11); /* SVGA_3D_CMD_VIDEO_PROCESS_FRAME */
|
---|
90 | SVGA_CASE_ID2STR(SVGA_3D_CMD_ACTIVATE_SURFACE);
|
---|
91 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEACTIVATE_SURFACE);
|
---|
92 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SCREEN_DMA);
|
---|
93 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD1);
|
---|
94 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD2);
|
---|
95 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD12); /* Old SVGA_3D_CMD_LOGICOPS_BITBLT */
|
---|
96 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD13); /* Old SVGA_3D_CMD_LOGICOPS_TRANSBLT */
|
---|
97 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD14); /* Old SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
|
---|
98 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD15); /* Old SVGA_3D_CMD_LOGICOPS_COLORFILL */
|
---|
99 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD16); /* Old SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
|
---|
100 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD17); /* Old SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND */
|
---|
101 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_OTABLE_BASE);
|
---|
102 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_OTABLE);
|
---|
103 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_MOB);
|
---|
104 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_MOB);
|
---|
105 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD3);
|
---|
106 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING);
|
---|
107 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE);
|
---|
108 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SURFACE);
|
---|
109 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SURFACE);
|
---|
110 | SVGA_CASE_ID2STR(SVGA_3D_CMD_COND_BIND_GB_SURFACE);
|
---|
111 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_IMAGE);
|
---|
112 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_SURFACE);
|
---|
113 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_IMAGE);
|
---|
114 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_SURFACE);
|
---|
115 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_IMAGE);
|
---|
116 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_SURFACE);
|
---|
117 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_CONTEXT);
|
---|
118 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_CONTEXT);
|
---|
119 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_CONTEXT);
|
---|
120 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_CONTEXT);
|
---|
121 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_CONTEXT);
|
---|
122 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SHADER);
|
---|
123 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SHADER);
|
---|
124 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SHADER);
|
---|
125 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_OTABLE_BASE64);
|
---|
126 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BEGIN_GB_QUERY);
|
---|
127 | SVGA_CASE_ID2STR(SVGA_3D_CMD_END_GB_QUERY);
|
---|
128 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WAIT_FOR_GB_QUERY);
|
---|
129 | SVGA_CASE_ID2STR(SVGA_3D_CMD_NOP);
|
---|
130 | SVGA_CASE_ID2STR(SVGA_3D_CMD_ENABLE_GART);
|
---|
131 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DISABLE_GART);
|
---|
132 | SVGA_CASE_ID2STR(SVGA_3D_CMD_MAP_MOB_INTO_GART);
|
---|
133 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UNMAP_GART_RANGE);
|
---|
134 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SCREENTARGET);
|
---|
135 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SCREENTARGET);
|
---|
136 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SCREENTARGET);
|
---|
137 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_SCREENTARGET);
|
---|
138 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL);
|
---|
139 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL);
|
---|
140 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE);
|
---|
141 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GB_SCREEN_DMA);
|
---|
142 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH);
|
---|
143 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GB_MOB_FENCE);
|
---|
144 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V2);
|
---|
145 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_MOB64);
|
---|
146 | SVGA_CASE_ID2STR(SVGA_3D_CMD_REDEFINE_GB_MOB64);
|
---|
147 | SVGA_CASE_ID2STR(SVGA_3D_CMD_NOP_ERROR);
|
---|
148 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_STREAMS);
|
---|
149 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_DECLS);
|
---|
150 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_DIVISORS);
|
---|
151 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW);
|
---|
152 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW_INDEXED);
|
---|
153 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_CONTEXT);
|
---|
154 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_CONTEXT);
|
---|
155 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_CONTEXT);
|
---|
156 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_CONTEXT);
|
---|
157 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_INVALIDATE_CONTEXT);
|
---|
158 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER);
|
---|
159 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER_RESOURCES);
|
---|
160 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER);
|
---|
161 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SAMPLERS);
|
---|
162 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW);
|
---|
163 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED);
|
---|
164 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INSTANCED);
|
---|
165 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED);
|
---|
166 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_AUTO);
|
---|
167 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_INPUT_LAYOUT);
|
---|
168 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS);
|
---|
169 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_INDEX_BUFFER);
|
---|
170 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_TOPOLOGY);
|
---|
171 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_RENDERTARGETS);
|
---|
172 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_BLEND_STATE);
|
---|
173 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE);
|
---|
174 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_RASTERIZER_STATE);
|
---|
175 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_QUERY);
|
---|
176 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_QUERY);
|
---|
177 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_QUERY);
|
---|
178 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_QUERY_OFFSET);
|
---|
179 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BEGIN_QUERY);
|
---|
180 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_END_QUERY);
|
---|
181 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_QUERY);
|
---|
182 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_PREDICATION);
|
---|
183 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SOTARGETS);
|
---|
184 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VIEWPORTS);
|
---|
185 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SCISSORRECTS);
|
---|
186 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW);
|
---|
187 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW);
|
---|
188 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_COPY_REGION);
|
---|
189 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_COPY);
|
---|
190 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRESENTBLT);
|
---|
191 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_GENMIPS);
|
---|
192 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE);
|
---|
193 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_SUBRESOURCE);
|
---|
194 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE);
|
---|
195 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW);
|
---|
196 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW);
|
---|
197 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW);
|
---|
198 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW);
|
---|
199 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW);
|
---|
200 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW);
|
---|
201 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT);
|
---|
202 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT);
|
---|
203 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_BLEND_STATE);
|
---|
204 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_BLEND_STATE);
|
---|
205 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE);
|
---|
206 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE);
|
---|
207 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE);
|
---|
208 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE);
|
---|
209 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE);
|
---|
210 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE);
|
---|
211 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SHADER);
|
---|
212 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SHADER);
|
---|
213 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_SHADER);
|
---|
214 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT);
|
---|
215 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT);
|
---|
216 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_STREAMOUTPUT);
|
---|
217 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_COTABLE);
|
---|
218 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_COTABLE);
|
---|
219 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BUFFER_COPY);
|
---|
220 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER);
|
---|
221 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK);
|
---|
222 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_MOVE_QUERY);
|
---|
223 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_ALL_QUERY);
|
---|
224 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_ALL_QUERY);
|
---|
225 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER);
|
---|
226 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_MOB_FENCE_64);
|
---|
227 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_ALL_SHADER);
|
---|
228 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_HINT);
|
---|
229 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BUFFER_UPDATE);
|
---|
230 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET);
|
---|
231 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET);
|
---|
232 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET);
|
---|
233 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET);
|
---|
234 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET);
|
---|
235 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET);
|
---|
236 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER);
|
---|
237 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SCREEN_COPY);
|
---|
238 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED1);
|
---|
239 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2);
|
---|
240 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED3);
|
---|
241 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED4);
|
---|
242 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED5);
|
---|
243 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED6);
|
---|
244 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED7);
|
---|
245 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED8);
|
---|
246 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GROW_OTABLE);
|
---|
247 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_GROW_COTABLE);
|
---|
248 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INTRA_SURFACE_COPY);
|
---|
249 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V3);
|
---|
250 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_RESOLVE_COPY);
|
---|
251 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_RESOLVE_COPY);
|
---|
252 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_CONVERT_REGION);
|
---|
253 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_CONVERT);
|
---|
254 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WHOLE_SURFACE_COPY);
|
---|
255 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_UA_VIEW);
|
---|
256 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_UA_VIEW);
|
---|
257 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT);
|
---|
258 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT);
|
---|
259 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT);
|
---|
260 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_UA_VIEWS);
|
---|
261 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT);
|
---|
262 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT);
|
---|
263 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DISPATCH);
|
---|
264 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DISPATCH_INDIRECT);
|
---|
265 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WRITE_ZERO_SURFACE);
|
---|
266 | SVGA_CASE_ID2STR(SVGA_3D_CMD_HINT_ZERO_SURFACE);
|
---|
267 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER);
|
---|
268 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT);
|
---|
269 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_BITBLT);
|
---|
270 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_TRANSBLT);
|
---|
271 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_STRETCHBLT);
|
---|
272 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_COLORFILL);
|
---|
273 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_ALPHABLEND);
|
---|
274 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND);
|
---|
275 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_1);
|
---|
276 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_2);
|
---|
277 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V4);
|
---|
278 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_CS_UA_VIEWS);
|
---|
279 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_MIN_LOD);
|
---|
280 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_3);
|
---|
281 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_4);
|
---|
282 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2);
|
---|
283 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB);
|
---|
284 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER_IFACE);
|
---|
285 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_STREAMOUTPUT);
|
---|
286 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS);
|
---|
287 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_SHADER_IFACE);
|
---|
288 | SVGA_CASE_ID2STR(SVGA_3D_CMD_MAX);
|
---|
289 | SVGA_CASE_ID2STR(SVGA_3D_CMD_FUTURE_MAX);
|
---|
290 | }
|
---|
291 | return "UNKNOWN_3D";
|
---|
292 | }
|
---|
293 |
|
---|
294 | /**
|
---|
295 | * FIFO command name lookup
|
---|
296 | *
|
---|
297 | * @returns FIFO command string or "UNKNOWN"
|
---|
298 | * @param u32Cmd FIFO command
|
---|
299 | */
|
---|
300 | const char *vmsvgaR3FifoCmdToString(uint32_t u32Cmd)
|
---|
301 | {
|
---|
302 | switch (u32Cmd)
|
---|
303 | {
|
---|
304 | SVGA_CASE_ID2STR(SVGA_CMD_INVALID_CMD);
|
---|
305 | SVGA_CASE_ID2STR(SVGA_CMD_UPDATE);
|
---|
306 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_FILL);
|
---|
307 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_COPY);
|
---|
308 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_ROP_COPY);
|
---|
309 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_CURSOR);
|
---|
310 | SVGA_CASE_ID2STR(SVGA_CMD_DISPLAY_CURSOR);
|
---|
311 | SVGA_CASE_ID2STR(SVGA_CMD_MOVE_CURSOR);
|
---|
312 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_ALPHA_CURSOR);
|
---|
313 | SVGA_CASE_ID2STR(SVGA_CMD_UPDATE_VERBOSE);
|
---|
314 | SVGA_CASE_ID2STR(SVGA_CMD_FRONT_ROP_FILL);
|
---|
315 | SVGA_CASE_ID2STR(SVGA_CMD_FENCE);
|
---|
316 | SVGA_CASE_ID2STR(SVGA_CMD_ESCAPE);
|
---|
317 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_SCREEN);
|
---|
318 | SVGA_CASE_ID2STR(SVGA_CMD_DESTROY_SCREEN);
|
---|
319 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_GMRFB);
|
---|
320 | SVGA_CASE_ID2STR(SVGA_CMD_BLIT_GMRFB_TO_SCREEN);
|
---|
321 | SVGA_CASE_ID2STR(SVGA_CMD_BLIT_SCREEN_TO_GMRFB);
|
---|
322 | SVGA_CASE_ID2STR(SVGA_CMD_ANNOTATION_FILL);
|
---|
323 | SVGA_CASE_ID2STR(SVGA_CMD_ANNOTATION_COPY);
|
---|
324 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_GMR2);
|
---|
325 | SVGA_CASE_ID2STR(SVGA_CMD_REMAP_GMR2);
|
---|
326 | SVGA_CASE_ID2STR(SVGA_CMD_DEAD);
|
---|
327 | SVGA_CASE_ID2STR(SVGA_CMD_DEAD_2);
|
---|
328 | SVGA_CASE_ID2STR(SVGA_CMD_NOP);
|
---|
329 | SVGA_CASE_ID2STR(SVGA_CMD_NOP_ERROR);
|
---|
330 | SVGA_CASE_ID2STR(SVGA_CMD_MAX);
|
---|
331 | default:
|
---|
332 | if ( u32Cmd >= SVGA_3D_CMD_BASE
|
---|
333 | && u32Cmd < SVGA_3D_CMD_MAX)
|
---|
334 | return vmsvgaFifo3dCmdToString((SVGAFifo3dCmdId)u32Cmd);
|
---|
335 | }
|
---|
336 | return "UNKNOWN";
|
---|
337 | }
|
---|
338 | # undef SVGA_CASE_ID2STR
|
---|
339 | #endif /* LOG_ENABLED || VBOX_STRICT */
|
---|
340 |
|
---|
341 |
|
---|
342 | /*
|
---|
343 | *
|
---|
344 | * Guest-Backed Objects (GBO).
|
---|
345 | *
|
---|
346 | */
|
---|
347 |
|
---|
348 | /**
|
---|
349 | * HC access handler for GBOs which require write protection, i.e. OTables, etc.
|
---|
350 | *
|
---|
351 | * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
|
---|
352 | * @param pVM VM Handle.
|
---|
353 | * @param pVCpu The cross context CPU structure for the calling EMT.
|
---|
354 | * @param GCPhys The physical address the guest is writing to.
|
---|
355 | * @param pvPhys The HC mapping of that address.
|
---|
356 | * @param pvBuf What the guest is reading/writing.
|
---|
357 | * @param cbBuf How much it's reading/writing.
|
---|
358 | * @param enmAccessType The access type.
|
---|
359 | * @param enmOrigin Who is making the access.
|
---|
360 | * @param uUser The VMM automatically sets this to the address of
|
---|
361 | * the device instance.
|
---|
362 | */
|
---|
363 | DECLCALLBACK(VBOXSTRICTRC)
|
---|
364 | vmsvgaR3GboAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
|
---|
365 | PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
|
---|
366 | {
|
---|
367 | RT_NOREF(pVM, pVCpu, pvPhys, enmAccessType);
|
---|
368 |
|
---|
369 | if (RT_LIKELY(enmOrigin == PGMACCESSORIGIN_DEVICE || enmOrigin == PGMACCESSORIGIN_DEBUGGER))
|
---|
370 | return VINF_PGM_HANDLER_DO_DEFAULT;
|
---|
371 |
|
---|
372 | PPDMDEVINS pDevIns = (PPDMDEVINS)uUser;
|
---|
373 | AssertPtrReturn(pDevIns, VERR_INTERNAL_ERROR_4);
|
---|
374 | AssertReturn(pDevIns->u32Version == PDM_DEVINSR3_VERSION, VERR_INTERNAL_ERROR_5);
|
---|
375 | PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
|
---|
376 | PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC);
|
---|
377 | PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
378 |
|
---|
379 | /*
|
---|
380 | * The guest is not allowed to access the memory.
|
---|
381 | * Set the error condition.
|
---|
382 | */
|
---|
383 | ASMAtomicWriteBool(&pThis->svga.fBadGuest, true);
|
---|
384 |
|
---|
385 | /* Try to find the GBO which the guest is accessing. */
|
---|
386 | char const *pszTarget = NULL;
|
---|
387 | for (uint32_t i = 0; i < RT_ELEMENTS(pSvgaR3State->aGboOTables) && !pszTarget; ++i)
|
---|
388 | {
|
---|
389 | PVMSVGAGBO pGbo = &pSvgaR3State->aGboOTables[i];
|
---|
390 | if (pGbo->cDescriptors)
|
---|
391 | {
|
---|
392 | for (uint32_t j = 0; j < pGbo->cDescriptors; ++j)
|
---|
393 | {
|
---|
394 | if ( GCPhys >= pGbo->paDescriptors[j].GCPhys
|
---|
395 | && GCPhys < pGbo->paDescriptors[j].GCPhys + pGbo->paDescriptors[j].cPages * GUEST_PAGE_SIZE)
|
---|
396 | {
|
---|
397 | switch (i)
|
---|
398 | {
|
---|
399 | case SVGA_OTABLE_MOB: pszTarget = "SVGA_OTABLE_MOB"; break;
|
---|
400 | case SVGA_OTABLE_SURFACE: pszTarget = "SVGA_OTABLE_SURFACE"; break;
|
---|
401 | case SVGA_OTABLE_CONTEXT: pszTarget = "SVGA_OTABLE_CONTEXT"; break;
|
---|
402 | case SVGA_OTABLE_SHADER: pszTarget = "SVGA_OTABLE_SHADER"; break;
|
---|
403 | case SVGA_OTABLE_SCREENTARGET: pszTarget = "SVGA_OTABLE_SCREENTARGET"; break;
|
---|
404 | case SVGA_OTABLE_DXCONTEXT: pszTarget = "SVGA_OTABLE_DXCONTEXT"; break;
|
---|
405 | default: pszTarget = "Unknown OTABLE"; break;
|
---|
406 | }
|
---|
407 | break;
|
---|
408 | }
|
---|
409 | }
|
---|
410 | }
|
---|
411 | }
|
---|
412 |
|
---|
413 | LogRelMax(8, ("VMSVGA: invalid guest access to page %RGp, target %s:\n"
|
---|
414 | "%.*Rhxd\n",
|
---|
415 | GCPhys, pszTarget ? pszTarget : "unknown", RT_MIN(cbBuf, 256), pvBuf));
|
---|
416 |
|
---|
417 | return VINF_PGM_HANDLER_DO_DEFAULT;
|
---|
418 | }
|
---|
419 |
|
---|
420 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
421 |
|
---|
422 | static int vmsvgaR3GboCreate(PVMSVGAR3STATE pSvgaR3State, SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, bool fGCPhys64, bool fWriteProtected, PVMSVGAGBO pGbo)
|
---|
423 | {
|
---|
424 | ASSERT_GUEST_RETURN(sizeInBytes <= _128M, VERR_INVALID_PARAMETER); /** @todo Less than SVGA_REG_MOB_MAX_SIZE */
|
---|
425 |
|
---|
426 | /*
|
---|
427 | * The 'baseAddress' is a page number and points to the 'root page' of the GBO.
|
---|
428 | * Content of the root page depends on the ptDepth value:
|
---|
429 | * SVGA3D_MOBFMT_PTDEPTH[64]_0 - the only data page;
|
---|
430 | * SVGA3D_MOBFMT_PTDEPTH[64]_1 - array of page numbers for data pages;
|
---|
431 | * SVGA3D_MOBFMT_PTDEPTH[64]_2 - array of page numbers for SVGA3D_MOBFMT_PTDEPTH[64]_1 pages.
|
---|
432 | * The code below extracts the page addresses of the GBO.
|
---|
433 | */
|
---|
434 |
|
---|
435 | /* Verify and normalize the ptDepth value. */
|
---|
436 | if (RT_LIKELY( ptDepth == SVGA3D_MOBFMT_PTDEPTH64_0
|
---|
437 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH64_1
|
---|
438 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH64_2))
|
---|
439 | ASSERT_GUEST_RETURN(fGCPhys64, VERR_INVALID_PARAMETER);
|
---|
440 | else if ( ptDepth == SVGA3D_MOBFMT_PTDEPTH_0
|
---|
441 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH_1
|
---|
442 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH_2)
|
---|
443 | {
|
---|
444 | ASSERT_GUEST_RETURN(!fGCPhys64, VERR_INVALID_PARAMETER);
|
---|
445 | /* Shift ptDepth to the SVGA3D_MOBFMT_PTDEPTH64_x range. */
|
---|
446 | ptDepth = (SVGAMobFormat)(ptDepth + SVGA3D_MOBFMT_PTDEPTH64_0 - SVGA3D_MOBFMT_PTDEPTH_0);
|
---|
447 | }
|
---|
448 | else if (ptDepth == SVGA3D_MOBFMT_RANGE)
|
---|
449 | { }
|
---|
450 | else
|
---|
451 | ASSERT_GUEST_FAILED_RETURN(VERR_INVALID_PARAMETER);
|
---|
452 |
|
---|
453 | uint32_t const cPPNsPerPage = X86_PAGE_SIZE / (fGCPhys64 ? sizeof(PPN64) : sizeof(PPN));
|
---|
454 |
|
---|
455 | pGbo->cbTotal = sizeInBytes;
|
---|
456 | pGbo->cTotalPages = (sizeInBytes + X86_PAGE_SIZE - 1) >> X86_PAGE_SHIFT;
|
---|
457 |
|
---|
458 | /* Allocate the maximum amount possible (everything non-continuous) */
|
---|
459 | PVMSVGAGBODESCRIPTOR paDescriptors = (PVMSVGAGBODESCRIPTOR)RTMemAlloc(pGbo->cTotalPages * sizeof(VMSVGAGBODESCRIPTOR));
|
---|
460 | AssertReturn(paDescriptors, VERR_NO_MEMORY);
|
---|
461 |
|
---|
462 | int rc = VINF_SUCCESS;
|
---|
463 | if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_0)
|
---|
464 | {
|
---|
465 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages == 1,
|
---|
466 | RTMemFree(paDescriptors),
|
---|
467 | VERR_INVALID_PARAMETER);
|
---|
468 |
|
---|
469 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
470 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
471 | paDescriptors[0].GCPhys = GCPhys;
|
---|
472 | paDescriptors[0].cPages = 1;
|
---|
473 | }
|
---|
474 | else if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_1)
|
---|
475 | {
|
---|
476 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages <= cPPNsPerPage,
|
---|
477 | RTMemFree(paDescriptors),
|
---|
478 | VERR_INVALID_PARAMETER);
|
---|
479 |
|
---|
480 | /* Read the root page. */
|
---|
481 | uint8_t au8RootPage[X86_PAGE_SIZE];
|
---|
482 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
483 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhys, &au8RootPage, sizeof(au8RootPage));
|
---|
484 | if (RT_SUCCESS(rc))
|
---|
485 | {
|
---|
486 | PPN64 *paPPN64 = (PPN64 *)&au8RootPage[0];
|
---|
487 | PPN *paPPN32 = (PPN *)&au8RootPage[0];
|
---|
488 | for (uint32_t iPPN = 0; iPPN < pGbo->cTotalPages; ++iPPN)
|
---|
489 | {
|
---|
490 | GCPhys = (RTGCPHYS)(fGCPhys64 ? paPPN64[iPPN] : paPPN32[iPPN]) << X86_PAGE_SHIFT;
|
---|
491 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
492 | paDescriptors[iPPN].GCPhys = GCPhys;
|
---|
493 | paDescriptors[iPPN].cPages = 1;
|
---|
494 | }
|
---|
495 | }
|
---|
496 | }
|
---|
497 | else if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_2)
|
---|
498 | {
|
---|
499 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages <= cPPNsPerPage * cPPNsPerPage,
|
---|
500 | RTMemFree(paDescriptors),
|
---|
501 | VERR_INVALID_PARAMETER);
|
---|
502 |
|
---|
503 | /* Read the Level2 root page. */
|
---|
504 | uint8_t au8RootPageLevel2[X86_PAGE_SIZE];
|
---|
505 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
506 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhys, &au8RootPageLevel2, sizeof(au8RootPageLevel2));
|
---|
507 | if (RT_SUCCESS(rc))
|
---|
508 | {
|
---|
509 | uint32_t cPagesLeft = pGbo->cTotalPages;
|
---|
510 |
|
---|
511 | PPN64 *paPPN64Level2 = (PPN64 *)&au8RootPageLevel2[0];
|
---|
512 | PPN *paPPN32Level2 = (PPN *)&au8RootPageLevel2[0];
|
---|
513 |
|
---|
514 | uint32_t const cPPNsLevel2 = (pGbo->cTotalPages + cPPNsPerPage - 1) / cPPNsPerPage;
|
---|
515 | for (uint32_t iPPNLevel2 = 0; iPPNLevel2 < cPPNsLevel2; ++iPPNLevel2)
|
---|
516 | {
|
---|
517 | /* Read the Level1 root page. */
|
---|
518 | uint8_t au8RootPage[X86_PAGE_SIZE];
|
---|
519 | RTGCPHYS GCPhysLevel1 = (RTGCPHYS)(fGCPhys64 ? paPPN64Level2[iPPNLevel2] : paPPN32Level2[iPPNLevel2]) << X86_PAGE_SHIFT;
|
---|
520 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
521 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhysLevel1, &au8RootPage, sizeof(au8RootPage));
|
---|
522 | if (RT_SUCCESS(rc))
|
---|
523 | {
|
---|
524 | PPN64 *paPPN64 = (PPN64 *)&au8RootPage[0];
|
---|
525 | PPN *paPPN32 = (PPN *)&au8RootPage[0];
|
---|
526 |
|
---|
527 | uint32_t const cPPNs = RT_MIN(cPagesLeft, cPPNsPerPage);
|
---|
528 | for (uint32_t iPPN = 0; iPPN < cPPNs; ++iPPN)
|
---|
529 | {
|
---|
530 | GCPhys = (RTGCPHYS)(fGCPhys64 ? paPPN64[iPPN] : paPPN32[iPPN]) << X86_PAGE_SHIFT;
|
---|
531 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
532 | paDescriptors[iPPN + iPPNLevel2 * cPPNsPerPage].GCPhys = GCPhys;
|
---|
533 | paDescriptors[iPPN + iPPNLevel2 * cPPNsPerPage].cPages = 1;
|
---|
534 | }
|
---|
535 | cPagesLeft -= cPPNs;
|
---|
536 | }
|
---|
537 | }
|
---|
538 | }
|
---|
539 | }
|
---|
540 | else if (ptDepth == SVGA3D_MOBFMT_RANGE)
|
---|
541 | {
|
---|
542 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
543 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
544 | paDescriptors[0].GCPhys = GCPhys;
|
---|
545 | paDescriptors[0].cPages = pGbo->cTotalPages;
|
---|
546 | }
|
---|
547 | else
|
---|
548 | {
|
---|
549 | AssertFailed();
|
---|
550 | return VERR_INTERNAL_ERROR; /* ptDepth should be already verified. */
|
---|
551 | }
|
---|
552 |
|
---|
553 | /* Compress the descriptors. */
|
---|
554 | if (ptDepth != SVGA3D_MOBFMT_RANGE)
|
---|
555 | {
|
---|
556 | uint32_t iDescriptor = 0;
|
---|
557 | for (uint32_t i = 1; i < pGbo->cTotalPages; ++i)
|
---|
558 | {
|
---|
559 | /* Continuous physical memory? */
|
---|
560 | if (paDescriptors[i].GCPhys == paDescriptors[iDescriptor].GCPhys + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE)
|
---|
561 | {
|
---|
562 | Assert(paDescriptors[iDescriptor].cPages);
|
---|
563 | paDescriptors[iDescriptor].cPages++;
|
---|
564 | Log5Func(("Page %x GCPhys=%RGp successor\n", i, paDescriptors[i].GCPhys));
|
---|
565 | }
|
---|
566 | else
|
---|
567 | {
|
---|
568 | iDescriptor++;
|
---|
569 | paDescriptors[iDescriptor].GCPhys = paDescriptors[i].GCPhys;
|
---|
570 | paDescriptors[iDescriptor].cPages = 1;
|
---|
571 | Log5Func(("Page %x GCPhys=%RGp\n", i, paDescriptors[iDescriptor].GCPhys));
|
---|
572 | }
|
---|
573 | }
|
---|
574 |
|
---|
575 | pGbo->cDescriptors = iDescriptor + 1;
|
---|
576 | Log5Func(("Nr of descriptors %d\n", pGbo->cDescriptors));
|
---|
577 | }
|
---|
578 | else
|
---|
579 | pGbo->cDescriptors = 1;
|
---|
580 |
|
---|
581 | if (RT_LIKELY(pGbo->cDescriptors < pGbo->cTotalPages))
|
---|
582 | {
|
---|
583 | pGbo->paDescriptors = (PVMSVGAGBODESCRIPTOR)RTMemRealloc(paDescriptors, pGbo->cDescriptors * sizeof(VMSVGAGBODESCRIPTOR));
|
---|
584 | AssertReturn(pGbo->paDescriptors, VERR_NO_MEMORY);
|
---|
585 | }
|
---|
586 | else
|
---|
587 | pGbo->paDescriptors = paDescriptors;
|
---|
588 |
|
---|
589 | #if 1 /// @todo PGMHandlerPhysicalRegister asserts deep in PGM code with enmKind of a page being out of range.
|
---|
590 | fWriteProtected = false;
|
---|
591 | #endif
|
---|
592 | if (fWriteProtected)
|
---|
593 | {
|
---|
594 | pGbo->fGboFlags |= VMSVGAGBO_F_WRITE_PROTECTED;
|
---|
595 | for (uint32_t i = 0; i < pGbo->cDescriptors; ++i)
|
---|
596 | {
|
---|
597 | rc = PDMDevHlpPGMHandlerPhysicalRegister(pSvgaR3State->pDevIns,
|
---|
598 | pGbo->paDescriptors[i].GCPhys,
|
---|
599 | pGbo->paDescriptors[i].GCPhys
|
---|
600 | + pGbo->paDescriptors[i].cPages * GUEST_PAGE_SIZE - 1,
|
---|
601 | pSvgaR3State->hGboAccessHandlerType, "VMSVGA GBO");
|
---|
602 | AssertRC(rc);
|
---|
603 | }
|
---|
604 | }
|
---|
605 |
|
---|
606 | return VINF_SUCCESS;
|
---|
607 | }
|
---|
608 |
|
---|
609 |
|
---|
610 | static void vmsvgaR3GboDestroy(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
611 | {
|
---|
612 | if (RT_LIKELY(VMSVGA_IS_GBO_CREATED(pGbo)))
|
---|
613 | {
|
---|
614 | if (pGbo->fGboFlags & VMSVGAGBO_F_WRITE_PROTECTED)
|
---|
615 | {
|
---|
616 | for (uint32_t i = 0; i < pGbo->cDescriptors; ++i)
|
---|
617 | {
|
---|
618 | int rc = PDMDevHlpPGMHandlerPhysicalDeregister(pSvgaR3State->pDevIns, pGbo->paDescriptors[i].GCPhys);
|
---|
619 | AssertRC(rc);
|
---|
620 | }
|
---|
621 | }
|
---|
622 | RTMemFree(pGbo->paDescriptors);
|
---|
623 | RT_ZERO(pGbo);
|
---|
624 | }
|
---|
625 | }
|
---|
626 |
|
---|
627 | /** @todo static void vmsvgaR3GboWriteProtect(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo, bool fWriteProtect) */
|
---|
628 |
|
---|
629 | typedef enum VMSVGAGboTransferDirection
|
---|
630 | {
|
---|
631 | VMSVGAGboTransferDirection_Read,
|
---|
632 | VMSVGAGboTransferDirection_Write,
|
---|
633 | } VMSVGAGboTransferDirection;
|
---|
634 |
|
---|
635 | static int vmsvgaR3GboTransfer(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
636 | uint32_t off, void *pvData, uint32_t cbData,
|
---|
637 | VMSVGAGboTransferDirection enmDirection)
|
---|
638 | {
|
---|
639 | //DEBUG_BREAKPOINT_TEST();
|
---|
640 | int rc = VINF_SUCCESS;
|
---|
641 | uint8_t *pu8CurrentHost = (uint8_t *)pvData;
|
---|
642 |
|
---|
643 | /* Find the right descriptor */
|
---|
644 | PCVMSVGAGBODESCRIPTOR const paDescriptors = pGbo->paDescriptors;
|
---|
645 | uint32_t iDescriptor = 0; /* Index in the descriptor array. */
|
---|
646 | uint32_t offDescriptor = 0; /* GMR offset of the current descriptor. */
|
---|
647 | while (offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE <= off)
|
---|
648 | {
|
---|
649 | offDescriptor += paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE;
|
---|
650 | AssertReturn(offDescriptor < pGbo->cbTotal, VERR_INTERNAL_ERROR); /* overflow protection */
|
---|
651 | ++iDescriptor;
|
---|
652 | AssertReturn(iDescriptor < pGbo->cDescriptors, VERR_INTERNAL_ERROR);
|
---|
653 | }
|
---|
654 |
|
---|
655 | while (cbData)
|
---|
656 | {
|
---|
657 | uint32_t cbToCopy;
|
---|
658 | if (off + cbData <= offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE)
|
---|
659 | cbToCopy = cbData;
|
---|
660 | else
|
---|
661 | {
|
---|
662 | cbToCopy = (offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE - off);
|
---|
663 | AssertReturn(cbToCopy <= cbData, VERR_INVALID_PARAMETER);
|
---|
664 | }
|
---|
665 |
|
---|
666 | RTGCPHYS const GCPhys = paDescriptors[iDescriptor].GCPhys + off - offDescriptor;
|
---|
667 | Log5Func(("%s phys=%RGp\n", (enmDirection == VMSVGAGboTransferDirection_Read) ? "READ" : "WRITE", GCPhys));
|
---|
668 |
|
---|
669 | /*
|
---|
670 | * We are deliberately using the non-PCI version of PDMDevHlpPCIPhys[Read|Write] as the
|
---|
671 | * guest-side VMSVGA driver seems to allocate non-DMA (regular physical) addresses,
|
---|
672 | * see @bugref{9654#c75}.
|
---|
673 | */
|
---|
674 | if (enmDirection == VMSVGAGboTransferDirection_Read)
|
---|
675 | rc = PDMDevHlpPhysRead(pSvgaR3State->pDevIns, GCPhys, pu8CurrentHost, cbToCopy);
|
---|
676 | else
|
---|
677 | rc = PDMDevHlpPhysWrite(pSvgaR3State->pDevIns, GCPhys, pu8CurrentHost, cbToCopy);
|
---|
678 | AssertRCBreak(rc);
|
---|
679 |
|
---|
680 | cbData -= cbToCopy;
|
---|
681 | off += cbToCopy;
|
---|
682 | pu8CurrentHost += cbToCopy;
|
---|
683 |
|
---|
684 | /* Go to the next descriptor if there's anything left. */
|
---|
685 | if (cbData)
|
---|
686 | {
|
---|
687 | offDescriptor += paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE;
|
---|
688 | AssertReturn(offDescriptor < pGbo->cbTotal, VERR_INTERNAL_ERROR);
|
---|
689 | ++iDescriptor;
|
---|
690 | AssertReturn(iDescriptor < pGbo->cDescriptors, VERR_INTERNAL_ERROR);
|
---|
691 | }
|
---|
692 | }
|
---|
693 | return rc;
|
---|
694 | }
|
---|
695 |
|
---|
696 |
|
---|
697 | static int vmsvgaR3GboWrite(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
698 | uint32_t off, void const *pvData, uint32_t cbData)
|
---|
699 | {
|
---|
700 | return vmsvgaR3GboTransfer(pSvgaR3State, pGbo,
|
---|
701 | off, (void *)pvData, cbData,
|
---|
702 | VMSVGAGboTransferDirection_Write);
|
---|
703 | }
|
---|
704 |
|
---|
705 |
|
---|
706 | static int vmsvgaR3GboRead(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
707 | uint32_t off, void *pvData, uint32_t cbData)
|
---|
708 | {
|
---|
709 | return vmsvgaR3GboTransfer(pSvgaR3State, pGbo,
|
---|
710 | off, pvData, cbData,
|
---|
711 | VMSVGAGboTransferDirection_Read);
|
---|
712 | }
|
---|
713 |
|
---|
714 |
|
---|
715 | static int vmsvgaR3GboBackingStoreCreate(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo, uint32_t cbValid)
|
---|
716 | {
|
---|
717 | int rc;
|
---|
718 |
|
---|
719 | /* Just reread the data if pvHost has been allocated already. */
|
---|
720 | if (!(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED))
|
---|
721 | pGbo->pvHost = RTMemAllocZ(pGbo->cbTotal);
|
---|
722 |
|
---|
723 | if (pGbo->pvHost)
|
---|
724 | {
|
---|
725 | cbValid = RT_MIN(cbValid, pGbo->cbTotal);
|
---|
726 | rc = vmsvgaR3GboRead(pSvgaR3State, pGbo, 0, pGbo->pvHost, cbValid);
|
---|
727 | }
|
---|
728 | else
|
---|
729 | rc = VERR_NO_MEMORY;
|
---|
730 |
|
---|
731 | if (RT_SUCCESS(rc))
|
---|
732 | pGbo->fGboFlags |= VMSVGAGBO_F_HOST_BACKED;
|
---|
733 | else
|
---|
734 | {
|
---|
735 | RTMemFree(pGbo->pvHost);
|
---|
736 | pGbo->pvHost = NULL;
|
---|
737 | }
|
---|
738 | return rc;
|
---|
739 | }
|
---|
740 |
|
---|
741 |
|
---|
742 | static void vmsvgaR3GboBackingStoreDelete(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
743 | {
|
---|
744 | RT_NOREF(pSvgaR3State);
|
---|
745 | AssertReturnVoid(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED);
|
---|
746 | RTMemFree(pGbo->pvHost);
|
---|
747 | pGbo->pvHost = NULL;
|
---|
748 | pGbo->fGboFlags &= ~VMSVGAGBO_F_HOST_BACKED;
|
---|
749 | }
|
---|
750 |
|
---|
751 |
|
---|
752 | static int vmsvgaR3GboBackingStoreWriteToGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
753 | {
|
---|
754 | AssertReturn(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED, VERR_INVALID_STATE);
|
---|
755 | return vmsvgaR3GboWrite(pSvgaR3State, pGbo, 0, pGbo->pvHost, pGbo->cbTotal);
|
---|
756 | }
|
---|
757 |
|
---|
758 |
|
---|
759 | static int vmsvgaR3GboBackingStoreReadFromGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
760 | {
|
---|
761 | AssertReturn(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED, VERR_INVALID_STATE);
|
---|
762 | return vmsvgaR3GboRead(pSvgaR3State, pGbo, 0, pGbo->pvHost, pGbo->cbTotal);
|
---|
763 | }
|
---|
764 |
|
---|
765 |
|
---|
766 |
|
---|
767 | /*
|
---|
768 | *
|
---|
769 | * Object Tables.
|
---|
770 | *
|
---|
771 | */
|
---|
772 |
|
---|
773 | static int vmsvgaR3OTableVerifyIndex(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
774 | uint32_t idx, uint32_t cbEntry)
|
---|
775 | {
|
---|
776 | RT_NOREF(pSvgaR3State);
|
---|
777 |
|
---|
778 | /* The table must exist and the index must be within the table. */
|
---|
779 | ASSERT_GUEST_RETURN(VMSVGA_IS_GBO_CREATED(pGboOTable), VERR_INVALID_PARAMETER);
|
---|
780 | ASSERT_GUEST_RETURN(idx < pGboOTable->cbTotal / cbEntry, VERR_INVALID_PARAMETER);
|
---|
781 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
782 | return VINF_SUCCESS;
|
---|
783 | }
|
---|
784 |
|
---|
785 |
|
---|
786 | static int vmsvgaR3OTableRead(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
787 | uint32_t idx, uint32_t cbEntry,
|
---|
788 | void *pvData, uint32_t cbData)
|
---|
789 | {
|
---|
790 | AssertReturn(cbData <= cbEntry, VERR_INVALID_PARAMETER);
|
---|
791 |
|
---|
792 | int rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, pGboOTable, idx, cbEntry);
|
---|
793 | if (RT_SUCCESS(rc))
|
---|
794 | {
|
---|
795 | uint32_t const off = idx * cbEntry;
|
---|
796 | rc = vmsvgaR3GboRead(pSvgaR3State, pGboOTable, off, pvData, cbData);
|
---|
797 | }
|
---|
798 | return rc;
|
---|
799 | }
|
---|
800 |
|
---|
801 | static int vmsvgaR3OTableWrite(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
802 | uint32_t idx, uint32_t cbEntry,
|
---|
803 | void const *pvData, uint32_t cbData)
|
---|
804 | {
|
---|
805 | AssertReturn(cbData <= cbEntry, VERR_INVALID_PARAMETER);
|
---|
806 |
|
---|
807 | int rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, pGboOTable, idx, cbEntry);
|
---|
808 | if (RT_SUCCESS(rc))
|
---|
809 | {
|
---|
810 | uint32_t const off = idx * cbEntry;
|
---|
811 | rc = vmsvgaR3GboWrite(pSvgaR3State, pGboOTable, off, pvData, cbData);
|
---|
812 | }
|
---|
813 | return rc;
|
---|
814 | }
|
---|
815 |
|
---|
816 |
|
---|
817 | int vmsvgaR3OTableReadSurface(PVMSVGAR3STATE pSvgaR3State, uint32_t sid, SVGAOTableSurfaceEntry *pEntrySurface)
|
---|
818 | {
|
---|
819 | return vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
820 | sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, pEntrySurface, sizeof(SVGAOTableSurfaceEntry));
|
---|
821 | }
|
---|
822 |
|
---|
823 |
|
---|
824 | /*
|
---|
825 | *
|
---|
826 | * The guest's Memory OBjects (MOB).
|
---|
827 | *
|
---|
828 | */
|
---|
829 |
|
---|
830 | static int vmsvgaR3MobCreate(PVMSVGAR3STATE pSvgaR3State,
|
---|
831 | SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, SVGAMobId mobid,
|
---|
832 | bool fGCPhys64, PVMSVGAMOB pMob)
|
---|
833 | {
|
---|
834 | RT_ZERO(*pMob);
|
---|
835 |
|
---|
836 | /* Update the entry in the pSvgaR3State->pGboOTableMob. */
|
---|
837 | SVGAOTableMobEntry entry;
|
---|
838 | entry.ptDepth = ptDepth;
|
---|
839 | entry.sizeInBytes = sizeInBytes;
|
---|
840 | entry.base = baseAddress;
|
---|
841 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
842 | mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
843 | if (RT_SUCCESS(rc))
|
---|
844 | {
|
---|
845 | /* Create the corresponding GBO. */
|
---|
846 | rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, fGCPhys64, /* fWriteProtected = */ false, &pMob->Gbo);
|
---|
847 | if (RT_SUCCESS(rc))
|
---|
848 | {
|
---|
849 | /* Add to the tree of known GBOs and the LRU list. */
|
---|
850 | pMob->Core.Key = mobid;
|
---|
851 | if (RTAvlU32Insert(&pSvgaR3State->MOBTree, &pMob->Core))
|
---|
852 | {
|
---|
853 | RTListPrepend(&pSvgaR3State->MOBLRUList, &pMob->nodeLRU);
|
---|
854 | return VINF_SUCCESS;
|
---|
855 | }
|
---|
856 |
|
---|
857 | vmsvgaR3GboDestroy(pSvgaR3State, &pMob->Gbo);
|
---|
858 | }
|
---|
859 | }
|
---|
860 |
|
---|
861 | return rc;
|
---|
862 | }
|
---|
863 |
|
---|
864 |
|
---|
865 | static int vmsvgaR3MobDestroy(PVMSVGAR3STATE pSvgaR3State, SVGAMobId mobid)
|
---|
866 | {
|
---|
867 | /* Update the entry in the pSvgaR3State->pGboOTableMob. */
|
---|
868 | SVGAOTableMobEntry entry;
|
---|
869 | RT_ZERO(entry);
|
---|
870 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
871 | mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
872 |
|
---|
873 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTAvlU32Remove(&pSvgaR3State->MOBTree, mobid);
|
---|
874 | if (pMob)
|
---|
875 | {
|
---|
876 | RTListNodeRemove(&pMob->nodeLRU);
|
---|
877 | vmsvgaR3GboDestroy(pSvgaR3State, &pMob->Gbo);
|
---|
878 | RTMemFree(pMob);
|
---|
879 | return VINF_SUCCESS;
|
---|
880 | }
|
---|
881 |
|
---|
882 | return VERR_INVALID_PARAMETER;
|
---|
883 | }
|
---|
884 |
|
---|
885 |
|
---|
886 | PVMSVGAMOB vmsvgaR3MobGet(PVMSVGAR3STATE pSvgaR3State, SVGAMobId RT_UNTRUSTED_GUEST mobid)
|
---|
887 | {
|
---|
888 | if (mobid == SVGA_ID_INVALID)
|
---|
889 | return NULL;
|
---|
890 |
|
---|
891 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTAvlU32Get(&pSvgaR3State->MOBTree, mobid);
|
---|
892 | if (pMob)
|
---|
893 | {
|
---|
894 | /* Move to the head of the LRU list. */
|
---|
895 | RTListNodeRemove(&pMob->nodeLRU);
|
---|
896 | RTListPrepend(&pSvgaR3State->MOBLRUList, &pMob->nodeLRU);
|
---|
897 | }
|
---|
898 | else
|
---|
899 | ASSERT_GUEST_FAILED();
|
---|
900 |
|
---|
901 | return pMob;
|
---|
902 | }
|
---|
903 |
|
---|
904 |
|
---|
905 | /** Create a host ring-3 pointer to the MOB data.
|
---|
906 | * Current approach is to allocate a host memory buffer and copy the guest MOB data if necessary.
|
---|
907 | * @param pSvgaR3State R3 device state.
|
---|
908 | * @param pMob The MOB.
|
---|
909 | * @param cbValid How many bytes of the guest backing memory contain valid data.
|
---|
910 | * @return VBox status.
|
---|
911 | */
|
---|
912 | /** @todo uint32_t cbValid -> uint32_t offStart, uint32_t cbData */
|
---|
913 | int vmsvgaR3MobBackingStoreCreate(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob, uint32_t cbValid)
|
---|
914 | {
|
---|
915 | AssertReturn(pMob, VERR_INVALID_PARAMETER);
|
---|
916 | return vmsvgaR3GboBackingStoreCreate(pSvgaR3State, &pMob->Gbo, cbValid);
|
---|
917 | }
|
---|
918 |
|
---|
919 |
|
---|
920 | void vmsvgaR3MobBackingStoreDelete(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
921 | {
|
---|
922 | if (pMob)
|
---|
923 | vmsvgaR3GboBackingStoreDelete(pSvgaR3State, &pMob->Gbo);
|
---|
924 | }
|
---|
925 |
|
---|
926 |
|
---|
927 | int vmsvgaR3MobBackingStoreWriteToGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
928 | {
|
---|
929 | if (pMob)
|
---|
930 | return vmsvgaR3GboBackingStoreWriteToGuest(pSvgaR3State, &pMob->Gbo);
|
---|
931 | return VERR_INVALID_PARAMETER;
|
---|
932 | }
|
---|
933 |
|
---|
934 |
|
---|
935 | int vmsvgaR3MobBackingStoreReadFromGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
936 | {
|
---|
937 | if (pMob)
|
---|
938 | return vmsvgaR3GboBackingStoreReadFromGuest(pSvgaR3State, &pMob->Gbo);
|
---|
939 | return VERR_INVALID_PARAMETER;
|
---|
940 | }
|
---|
941 |
|
---|
942 |
|
---|
943 | void *vmsvgaR3MobBackingStorePtr(PVMSVGAMOB pMob, uint32_t off)
|
---|
944 | {
|
---|
945 | if (pMob && (pMob->Gbo.fGboFlags & VMSVGAGBO_F_HOST_BACKED))
|
---|
946 | {
|
---|
947 | if (off <= pMob->Gbo.cbTotal)
|
---|
948 | return (uint8_t *)pMob->Gbo.pvHost + off;
|
---|
949 | }
|
---|
950 | return NULL;
|
---|
951 | }
|
---|
952 |
|
---|
953 |
|
---|
954 | int vmsvgaR3UpdateGBSurface(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBox)
|
---|
955 | {
|
---|
956 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
957 |
|
---|
958 | SVGAOTableSurfaceEntry entrySurface;
|
---|
959 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
960 | pImageId->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
961 | if (RT_SUCCESS(rc))
|
---|
962 | {
|
---|
963 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
964 | if (pMob)
|
---|
965 | {
|
---|
966 | VMSVGA3D_MAPPED_SURFACE map;
|
---|
967 | rc = vmsvga3dSurfaceMap(pThisCC, pImageId, pBox, VMSVGA3D_SURFACE_MAP_WRITE, &map);
|
---|
968 | if (RT_SUCCESS(rc))
|
---|
969 | {
|
---|
970 | /* Copy MOB -> mapped surface. */
|
---|
971 | uint32_t offSrc = pBox->x * map.cbPixel
|
---|
972 | + pBox->y * entrySurface.size.width * map.cbPixel
|
---|
973 | + pBox->z * entrySurface.size.height * entrySurface.size.width * map.cbPixel;
|
---|
974 | uint8_t *pu8Dst = (uint8_t *)map.pvData;
|
---|
975 | for (uint32_t z = 0; z < pBox->d; ++z)
|
---|
976 | {
|
---|
977 | for (uint32_t y = 0; y < pBox->h; ++y)
|
---|
978 | {
|
---|
979 | rc = vmsvgaR3GboRead(pSvgaR3State, &pMob->Gbo, offSrc, pu8Dst, pBox->w * map.cbPixel);
|
---|
980 | if (RT_FAILURE(rc))
|
---|
981 | break;
|
---|
982 |
|
---|
983 | pu8Dst += map.cbRowPitch;
|
---|
984 | offSrc += entrySurface.size.width * map.cbPixel;
|
---|
985 | }
|
---|
986 |
|
---|
987 | pu8Dst += map.cbDepthPitch;
|
---|
988 | offSrc += entrySurface.size.height * entrySurface.size.width * map.cbPixel;
|
---|
989 | }
|
---|
990 |
|
---|
991 | vmsvga3dSurfaceUnmap(pThisCC, pImageId, &map, /* fWritten= */ true);
|
---|
992 | }
|
---|
993 | }
|
---|
994 | else
|
---|
995 | rc = VERR_INVALID_STATE;
|
---|
996 | }
|
---|
997 |
|
---|
998 | return rc;
|
---|
999 | }
|
---|
1000 |
|
---|
1001 |
|
---|
1002 | int vmsvgaR3UpdateGBSurfaceEx(PVGASTATECC pThisCC, SVGA3dSurfaceImageId const *pImageId, SVGA3dBox const *pBoxDst, SVGA3dPoint const *pPtSrc)
|
---|
1003 | {
|
---|
1004 | /* pPtSrc must be verified by the caller. */
|
---|
1005 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1006 |
|
---|
1007 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1008 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1009 | pImageId->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1010 | if (RT_SUCCESS(rc))
|
---|
1011 | {
|
---|
1012 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1013 | if (pMob)
|
---|
1014 | {
|
---|
1015 | VMSVGA3D_MAPPED_SURFACE map;
|
---|
1016 | rc = vmsvga3dSurfaceMap(pThisCC, pImageId, pBoxDst, VMSVGA3D_SURFACE_MAP_WRITE, &map);
|
---|
1017 | if (RT_SUCCESS(rc))
|
---|
1018 | {
|
---|
1019 | /* Copy MOB -> mapped surface. */
|
---|
1020 | uint32_t offSrc = pPtSrc->x * map.cbPixel
|
---|
1021 | + pPtSrc->y * entrySurface.size.width * map.cbPixel
|
---|
1022 | + pPtSrc->z * entrySurface.size.height * entrySurface.size.width * map.cbPixel;
|
---|
1023 | uint8_t *pu8Dst = (uint8_t *)map.pvData;
|
---|
1024 | for (uint32_t z = 0; z < pBoxDst->d; ++z)
|
---|
1025 | {
|
---|
1026 | for (uint32_t y = 0; y < pBoxDst->h; ++y)
|
---|
1027 | {
|
---|
1028 | rc = vmsvgaR3GboRead(pSvgaR3State, &pMob->Gbo, offSrc, pu8Dst, pBoxDst->w * map.cbPixel);
|
---|
1029 | if (RT_FAILURE(rc))
|
---|
1030 | break;
|
---|
1031 |
|
---|
1032 | pu8Dst += map.cbRowPitch;
|
---|
1033 | offSrc += entrySurface.size.width * map.cbPixel;
|
---|
1034 | }
|
---|
1035 |
|
---|
1036 | pu8Dst += map.cbDepthPitch;
|
---|
1037 | offSrc += entrySurface.size.height * entrySurface.size.width * map.cbPixel;
|
---|
1038 | }
|
---|
1039 |
|
---|
1040 | vmsvga3dSurfaceUnmap(pThisCC, pImageId, &map, /* fWritten= */ true);
|
---|
1041 | }
|
---|
1042 | }
|
---|
1043 | else
|
---|
1044 | rc = VERR_INVALID_STATE;
|
---|
1045 | }
|
---|
1046 |
|
---|
1047 | return rc;
|
---|
1048 | }
|
---|
1049 |
|
---|
1050 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
1051 |
|
---|
1052 | /*
|
---|
1053 | * Screen objects.
|
---|
1054 | */
|
---|
1055 | VMSVGASCREENOBJECT *vmsvgaR3GetScreenObject(PVGASTATECC pThisCC, uint32_t idScreen)
|
---|
1056 | {
|
---|
1057 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
1058 | if ( idScreen < (uint32_t)RT_ELEMENTS(pSVGAState->aScreens)
|
---|
1059 | && pSVGAState
|
---|
1060 | && pSVGAState->aScreens[idScreen].fDefined)
|
---|
1061 | {
|
---|
1062 | return &pSVGAState->aScreens[idScreen];
|
---|
1063 | }
|
---|
1064 | return NULL;
|
---|
1065 | }
|
---|
1066 |
|
---|
1067 | void vmsvgaR3ResetScreens(PVGASTATE pThis, PVGASTATECC pThisCC)
|
---|
1068 | {
|
---|
1069 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
1070 | if (pThis->svga.f3DEnabled)
|
---|
1071 | {
|
---|
1072 | for (uint32_t idScreen = 0; idScreen < (uint32_t)RT_ELEMENTS(pThisCC->svga.pSvgaR3State->aScreens); ++idScreen)
|
---|
1073 | {
|
---|
1074 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, idScreen);
|
---|
1075 | if (pScreen)
|
---|
1076 | vmsvga3dDestroyScreen(pThisCC, pScreen);
|
---|
1077 | }
|
---|
1078 | }
|
---|
1079 | #else
|
---|
1080 | RT_NOREF(pThis, pThisCC);
|
---|
1081 | #endif
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 |
|
---|
1085 | /**
|
---|
1086 | * Copy a rectangle of pixels within guest VRAM.
|
---|
1087 | */
|
---|
1088 | static void vmsvgaR3RectCopy(PVGASTATECC pThisCC, VMSVGASCREENOBJECT const *pScreen, uint32_t srcX, uint32_t srcY,
|
---|
1089 | uint32_t dstX, uint32_t dstY, uint32_t width, uint32_t height, unsigned cbFrameBuffer)
|
---|
1090 | {
|
---|
1091 | if (!width || !height)
|
---|
1092 | return; /* Nothing to do, don't even bother. */
|
---|
1093 |
|
---|
1094 | /*
|
---|
1095 | * The guest VRAM (aka GFB) is considered to be a bitmap in the format
|
---|
1096 | * corresponding to the current display mode.
|
---|
1097 | */
|
---|
1098 | uint32_t const cbPixel = RT_ALIGN(pScreen->cBpp, 8) / 8;
|
---|
1099 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch : width * cbPixel;
|
---|
1100 | uint8_t const *pSrc;
|
---|
1101 | uint8_t *pDst;
|
---|
1102 | unsigned const cbRectWidth = width * cbPixel;
|
---|
1103 | unsigned uMaxOffset;
|
---|
1104 |
|
---|
1105 | uMaxOffset = (RT_MAX(srcY, dstY) + height) * cbScanline + (RT_MAX(srcX, dstX) + width) * cbPixel;
|
---|
1106 | if (uMaxOffset >= cbFrameBuffer)
|
---|
1107 | {
|
---|
1108 | Log(("Max offset (%u) too big for framebuffer (%u bytes), ignoring!\n", uMaxOffset, cbFrameBuffer));
|
---|
1109 | return; /* Just don't listen to a bad guest. */
|
---|
1110 | }
|
---|
1111 |
|
---|
1112 | pSrc = pDst = pThisCC->pbVRam;
|
---|
1113 | pSrc += srcY * cbScanline + srcX * cbPixel;
|
---|
1114 | pDst += dstY * cbScanline + dstX * cbPixel;
|
---|
1115 |
|
---|
1116 | if (srcY >= dstY)
|
---|
1117 | {
|
---|
1118 | /* Source below destination, copy top to bottom. */
|
---|
1119 | for (; height > 0; height--)
|
---|
1120 | {
|
---|
1121 | memmove(pDst, pSrc, cbRectWidth);
|
---|
1122 | pSrc += cbScanline;
|
---|
1123 | pDst += cbScanline;
|
---|
1124 | }
|
---|
1125 | }
|
---|
1126 | else
|
---|
1127 | {
|
---|
1128 | /* Source above destination, copy bottom to top. */
|
---|
1129 | pSrc += cbScanline * (height - 1);
|
---|
1130 | pDst += cbScanline * (height - 1);
|
---|
1131 | for (; height > 0; height--)
|
---|
1132 | {
|
---|
1133 | memmove(pDst, pSrc, cbRectWidth);
|
---|
1134 | pSrc -= cbScanline;
|
---|
1135 | pDst -= cbScanline;
|
---|
1136 | }
|
---|
1137 | }
|
---|
1138 | }
|
---|
1139 |
|
---|
1140 |
|
---|
1141 | /**
|
---|
1142 | * Common worker for changing the pointer shape.
|
---|
1143 | *
|
---|
1144 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
1145 | * @param pSVGAState The VMSVGA ring-3 instance data.
|
---|
1146 | * @param fAlpha Whether there is alpha or not.
|
---|
1147 | * @param xHot Hotspot x coordinate.
|
---|
1148 | * @param yHot Hotspot y coordinate.
|
---|
1149 | * @param cx Width.
|
---|
1150 | * @param cy Height.
|
---|
1151 | * @param pbData Heap copy of the cursor data. Consumed.
|
---|
1152 | * @param cbData The size of the data.
|
---|
1153 | */
|
---|
1154 | static void vmsvgaR3InstallNewCursor(PVGASTATECC pThisCC, PVMSVGAR3STATE pSVGAState, bool fAlpha,
|
---|
1155 | uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, uint8_t *pbData, uint32_t cbData)
|
---|
1156 | {
|
---|
1157 | LogRel2(("vmsvgaR3InstallNewCursor: cx=%d cy=%d xHot=%d yHot=%d fAlpha=%d cbData=%#x\n", cx, cy, xHot, yHot, fAlpha, cbData));
|
---|
1158 | #ifdef LOG_ENABLED
|
---|
1159 | if (LogIs2Enabled())
|
---|
1160 | {
|
---|
1161 | uint32_t cbAndLine = RT_ALIGN(cx, 8) / 8;
|
---|
1162 | if (!fAlpha)
|
---|
1163 | {
|
---|
1164 | Log2(("VMSVGA Cursor AND mask (%d,%d):\n", cx, cy));
|
---|
1165 | for (uint32_t y = 0; y < cy; y++)
|
---|
1166 | {
|
---|
1167 | Log2(("%3u:", y));
|
---|
1168 | uint8_t const *pbLine = &pbData[y * cbAndLine];
|
---|
1169 | for (uint32_t x = 0; x < cx; x += 8)
|
---|
1170 | {
|
---|
1171 | uint8_t b = pbLine[x / 8];
|
---|
1172 | char szByte[12];
|
---|
1173 | szByte[0] = b & 0x80 ? '*' : ' '; /* most significant bit first */
|
---|
1174 | szByte[1] = b & 0x40 ? '*' : ' ';
|
---|
1175 | szByte[2] = b & 0x20 ? '*' : ' ';
|
---|
1176 | szByte[3] = b & 0x10 ? '*' : ' ';
|
---|
1177 | szByte[4] = b & 0x08 ? '*' : ' ';
|
---|
1178 | szByte[5] = b & 0x04 ? '*' : ' ';
|
---|
1179 | szByte[6] = b & 0x02 ? '*' : ' ';
|
---|
1180 | szByte[7] = b & 0x01 ? '*' : ' ';
|
---|
1181 | szByte[8] = '\0';
|
---|
1182 | Log2(("%s", szByte));
|
---|
1183 | }
|
---|
1184 | Log2(("\n"));
|
---|
1185 | }
|
---|
1186 | }
|
---|
1187 |
|
---|
1188 | Log2(("VMSVGA Cursor XOR mask (%d,%d):\n", cx, cy));
|
---|
1189 | uint32_t const *pu32Xor = (uint32_t const *)&pbData[RT_ALIGN_32(cbAndLine * cy, 4)];
|
---|
1190 | for (uint32_t y = 0; y < cy; y++)
|
---|
1191 | {
|
---|
1192 | Log2(("%3u:", y));
|
---|
1193 | uint32_t const *pu32Line = &pu32Xor[y * cx];
|
---|
1194 | for (uint32_t x = 0; x < cx; x++)
|
---|
1195 | Log2((" %08x", pu32Line[x]));
|
---|
1196 | Log2(("\n"));
|
---|
1197 | }
|
---|
1198 | }
|
---|
1199 | #endif
|
---|
1200 |
|
---|
1201 | int rc = pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, true /*fVisible*/, fAlpha, xHot, yHot, cx, cy, pbData);
|
---|
1202 | AssertRC(rc);
|
---|
1203 |
|
---|
1204 | if (pSVGAState->Cursor.fActive)
|
---|
1205 | RTMemFreeZ(pSVGAState->Cursor.pData, pSVGAState->Cursor.cbData);
|
---|
1206 |
|
---|
1207 | pSVGAState->Cursor.fActive = true;
|
---|
1208 | pSVGAState->Cursor.xHotspot = xHot;
|
---|
1209 | pSVGAState->Cursor.yHotspot = yHot;
|
---|
1210 | pSVGAState->Cursor.width = cx;
|
---|
1211 | pSVGAState->Cursor.height = cy;
|
---|
1212 | pSVGAState->Cursor.cbData = cbData;
|
---|
1213 | pSVGAState->Cursor.pData = pbData;
|
---|
1214 | }
|
---|
1215 |
|
---|
1216 |
|
---|
1217 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
1218 |
|
---|
1219 | /*
|
---|
1220 | * SVGA_3D_CMD_* handlers.
|
---|
1221 | */
|
---|
1222 |
|
---|
1223 |
|
---|
1224 | /** SVGA_3D_CMD_SURFACE_DEFINE 1040, SVGA_3D_CMD_SURFACE_DEFINE_V2 1070
|
---|
1225 | *
|
---|
1226 | * @param pThisCC The VGA/VMSVGA state for the current context.
|
---|
1227 | * @param pCmd The VMSVGA command.
|
---|
1228 | * @param cMipLevelSizes Number of elements in the paMipLevelSizes array.
|
---|
1229 | * @param paMipLevelSizes Arrays of surface sizes for each face and miplevel.
|
---|
1230 | */
|
---|
1231 | static void vmsvga3dCmdDefineSurface(PVGASTATECC pThisCC, SVGA3dCmdDefineSurface_v2 const *pCmd,
|
---|
1232 | uint32_t cMipLevelSizes, SVGA3dSize *paMipLevelSizes)
|
---|
1233 | {
|
---|
1234 | ASSERT_GUEST_RETURN_VOID(pCmd->sid < SVGA3D_MAX_SURFACE_IDS);
|
---|
1235 | ASSERT_GUEST_RETURN_VOID(cMipLevelSizes >= 1);
|
---|
1236 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1237 |
|
---|
1238 | /* Number of faces (cFaces) is specified as the number of the first non-zero elements in the 'face' array.
|
---|
1239 | * Since only plain surfaces (cFaces == 1) and cubemaps (cFaces == 6) are supported
|
---|
1240 | * (see also SVGA3dCmdDefineSurface definition in svga3d_reg.h), we ignore anything else.
|
---|
1241 | */
|
---|
1242 | uint32_t cRemainingMipLevels = cMipLevelSizes;
|
---|
1243 | uint32_t cFaces = 0;
|
---|
1244 | for (uint32_t i = 0; i < SVGA3D_MAX_SURFACE_FACES; ++i)
|
---|
1245 | {
|
---|
1246 | if (pCmd->face[i].numMipLevels == 0)
|
---|
1247 | break;
|
---|
1248 |
|
---|
1249 | /* All SVGA3dSurfaceFace structures must have the same value of numMipLevels field */
|
---|
1250 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels == pCmd->face[0].numMipLevels);
|
---|
1251 |
|
---|
1252 | /* numMipLevels value can't be greater than the number of remaining elements in the paMipLevelSizes array. */
|
---|
1253 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels <= cRemainingMipLevels);
|
---|
1254 | cRemainingMipLevels -= pCmd->face[i].numMipLevels;
|
---|
1255 |
|
---|
1256 | ++cFaces;
|
---|
1257 | }
|
---|
1258 | for (uint32_t i = cFaces; i < SVGA3D_MAX_SURFACE_FACES; ++i)
|
---|
1259 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels == 0);
|
---|
1260 |
|
---|
1261 | /* cFaces must be 6 for a cubemap and 1 otherwise. */
|
---|
1262 | ASSERT_GUEST_RETURN_VOID(cFaces == (uint32_t)((pCmd->surfaceFlags & SVGA3D_SURFACE_CUBEMAP) ? 6 : 1));
|
---|
1263 |
|
---|
1264 | /* Sum of face[i].numMipLevels must be equal to cMipLevels. */
|
---|
1265 | ASSERT_GUEST_RETURN_VOID(cRemainingMipLevels == 0);
|
---|
1266 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1267 |
|
---|
1268 | /* Verify paMipLevelSizes */
|
---|
1269 | uint32_t cWidth = paMipLevelSizes[0].width;
|
---|
1270 | uint32_t cHeight = paMipLevelSizes[0].height;
|
---|
1271 | uint32_t cDepth = paMipLevelSizes[0].depth;
|
---|
1272 | for (uint32_t i = 1; i < pCmd->face[0].numMipLevels; ++i)
|
---|
1273 | {
|
---|
1274 | cWidth >>= 1;
|
---|
1275 | if (cWidth == 0) cWidth = 1;
|
---|
1276 | cHeight >>= 1;
|
---|
1277 | if (cHeight == 0) cHeight = 1;
|
---|
1278 | cDepth >>= 1;
|
---|
1279 | if (cDepth == 0) cDepth = 1;
|
---|
1280 | for (uint32_t iFace = 0; iFace < cFaces; ++iFace)
|
---|
1281 | {
|
---|
1282 | uint32_t const iMipLevelSize = iFace * pCmd->face[0].numMipLevels + i;
|
---|
1283 | ASSERT_GUEST_RETURN_VOID( cWidth == paMipLevelSizes[iMipLevelSize].width
|
---|
1284 | && cHeight == paMipLevelSizes[iMipLevelSize].height
|
---|
1285 | && cDepth == paMipLevelSizes[iMipLevelSize].depth);
|
---|
1286 | }
|
---|
1287 | }
|
---|
1288 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1289 |
|
---|
1290 | /* Create the surface. */
|
---|
1291 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
1292 | pCmd->multisampleCount, pCmd->autogenFilter,
|
---|
1293 | pCmd->face[0].numMipLevels, &paMipLevelSizes[0], /* arraySize = */ 0, /* fAllocMipLevels = */ true);
|
---|
1294 | }
|
---|
1295 |
|
---|
1296 |
|
---|
1297 | /* SVGA_3D_CMD_DEFINE_GB_MOB 1093 */
|
---|
1298 | static void vmsvga3dCmdDefineGBMob(PVGASTATECC pThisCC, SVGA3dCmdDefineGBMob const *pCmd)
|
---|
1299 | {
|
---|
1300 | DEBUG_BREAKPOINT_TEST();
|
---|
1301 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1302 |
|
---|
1303 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
1304 |
|
---|
1305 | /* Maybe just update the OTable and create Gbo when the MOB is actually accessed? */
|
---|
1306 | /* Allocate a structure for the MOB. */
|
---|
1307 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTMemAllocZ(sizeof(*pMob));
|
---|
1308 | AssertPtrReturnVoid(pMob);
|
---|
1309 |
|
---|
1310 | int rc = vmsvgaR3MobCreate(pSvgaR3State, pCmd->ptDepth, pCmd->base, pCmd->sizeInBytes, pCmd->mobid, /*fGCPhys64=*/ false, pMob);
|
---|
1311 | if (RT_SUCCESS(rc))
|
---|
1312 | {
|
---|
1313 | return;
|
---|
1314 | }
|
---|
1315 |
|
---|
1316 | AssertFailed();
|
---|
1317 |
|
---|
1318 | RTMemFree(pMob);
|
---|
1319 | }
|
---|
1320 |
|
---|
1321 |
|
---|
1322 | /* SVGA_3D_CMD_DESTROY_GB_MOB 1094 */
|
---|
1323 | static void vmsvga3dCmdDestroyGBMob(PVGASTATECC pThisCC, SVGA3dCmdDestroyGBMob const *pCmd)
|
---|
1324 | {
|
---|
1325 | //DEBUG_BREAKPOINT_TEST();
|
---|
1326 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1327 |
|
---|
1328 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
1329 |
|
---|
1330 | int rc = vmsvgaR3MobDestroy(pSvgaR3State, pCmd->mobid);
|
---|
1331 | if (RT_SUCCESS(rc))
|
---|
1332 | {
|
---|
1333 | return;
|
---|
1334 | }
|
---|
1335 |
|
---|
1336 | AssertFailed();
|
---|
1337 | }
|
---|
1338 |
|
---|
1339 |
|
---|
1340 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE 1097 */
|
---|
1341 | static void vmsvga3dCmdDefineGBSurface(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface const *pCmd)
|
---|
1342 | {
|
---|
1343 | //DEBUG_BREAKPOINT_TEST();
|
---|
1344 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1345 |
|
---|
1346 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
1347 | SVGAOTableSurfaceEntry entry;
|
---|
1348 | RT_ZERO(entry);
|
---|
1349 | entry.format = pCmd->format;
|
---|
1350 | entry.surface1Flags = pCmd->surfaceFlags;
|
---|
1351 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
1352 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
1353 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
1354 | entry.size = pCmd->size;
|
---|
1355 | entry.mobid = SVGA_ID_INVALID;
|
---|
1356 | // entry.arraySize = 0;
|
---|
1357 | // entry.mobPitch = 0;
|
---|
1358 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1359 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1360 | if (RT_SUCCESS(rc))
|
---|
1361 | {
|
---|
1362 | /* Create the host surface. */
|
---|
1363 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
1364 | pCmd->multisampleCount, pCmd->autogenFilter,
|
---|
1365 | pCmd->numMipLevels, &pCmd->size, /* arraySize = */ 0, /* fAllocMipLevels = */ false);
|
---|
1366 | }
|
---|
1367 | }
|
---|
1368 |
|
---|
1369 |
|
---|
1370 | /* SVGA_3D_CMD_DESTROY_GB_SURFACE 1098 */
|
---|
1371 | static void vmsvga3dCmdDestroyGBSurface(PVGASTATECC pThisCC, SVGA3dCmdDestroyGBSurface const *pCmd)
|
---|
1372 | {
|
---|
1373 | //DEBUG_BREAKPOINT_TEST();
|
---|
1374 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1375 |
|
---|
1376 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
1377 | SVGAOTableSurfaceEntry entry;
|
---|
1378 | RT_ZERO(entry);
|
---|
1379 | entry.mobid = SVGA_ID_INVALID;
|
---|
1380 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1381 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1382 |
|
---|
1383 | vmsvga3dSurfaceDestroy(pThisCC, pCmd->sid);
|
---|
1384 | }
|
---|
1385 |
|
---|
1386 |
|
---|
1387 | /* SVGA_3D_CMD_BIND_GB_SURFACE 1099 */
|
---|
1388 | static void vmsvga3dCmdBindGBSurface(PVGASTATECC pThisCC, SVGA3dCmdBindGBSurface const *pCmd)
|
---|
1389 | {
|
---|
1390 | //DEBUG_BREAKPOINT_TEST();
|
---|
1391 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1392 |
|
---|
1393 | /* Assign the mobid to the surface. */
|
---|
1394 | int rc = VINF_SUCCESS;
|
---|
1395 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
1396 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
1397 | pCmd->mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE);
|
---|
1398 | if (RT_SUCCESS(rc))
|
---|
1399 | {
|
---|
1400 | SVGAOTableSurfaceEntry entry;
|
---|
1401 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1402 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1403 | if (RT_SUCCESS(rc))
|
---|
1404 | {
|
---|
1405 | entry.mobid = pCmd->mobid;
|
---|
1406 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1407 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1408 | if (RT_SUCCESS(rc))
|
---|
1409 | {
|
---|
1410 | /* */
|
---|
1411 | }
|
---|
1412 | }
|
---|
1413 | }
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 |
|
---|
1417 | typedef union
|
---|
1418 | {
|
---|
1419 | float f;
|
---|
1420 | uint32_t u;
|
---|
1421 | } Unsigned2Float;
|
---|
1422 |
|
---|
1423 | float float16ToFloat(uint16_t f16)
|
---|
1424 | {
|
---|
1425 | /* Format specs from Wiki: [15] = sign, [14:10] = exponent, [9:0] = fraction */
|
---|
1426 | uint16_t const f = f16 & 0x3FF;
|
---|
1427 | uint16_t const e = (f16 >> 10) & 0x1F;
|
---|
1428 | uint16_t const s = (f16 >> 15) & 0x1;
|
---|
1429 | Unsigned2Float u2f;
|
---|
1430 |
|
---|
1431 | if (e == 0)
|
---|
1432 | {
|
---|
1433 | if (f == 0)
|
---|
1434 | {
|
---|
1435 | /* zero, -0 */
|
---|
1436 | u2f.u = (s << 31) | (0 << 23) | 0;
|
---|
1437 | return u2f.f;
|
---|
1438 | }
|
---|
1439 |
|
---|
1440 | /* subnormal numbers: (-1)^signbit * 2^-14 * 0.significantbits */
|
---|
1441 | float const k = 1.0f / 16384.0f; /* 2^-14 */
|
---|
1442 | return (s ? -1.0f : 1.0f) * k * (float)f / 1024.0f;
|
---|
1443 | }
|
---|
1444 |
|
---|
1445 | if (e == 31)
|
---|
1446 | {
|
---|
1447 | if (f == 0)
|
---|
1448 | {
|
---|
1449 | /* +-infinity */
|
---|
1450 | u2f.u = (s << 31) | (0xFF << 23) | 0;
|
---|
1451 | return u2f.f;
|
---|
1452 | }
|
---|
1453 |
|
---|
1454 | /* NaN */
|
---|
1455 | u2f.u = (s << 31) | (0xFF << 23) | 1;
|
---|
1456 | return u2f.f;
|
---|
1457 | }
|
---|
1458 |
|
---|
1459 | /* normalized value: (-1)^signbit * 2^(exponent - 15) * 1.significantbits */
|
---|
1460 | /* Build the float, adjusting for exponent bias (float32 bias is 127, float16 is 15)
|
---|
1461 | * and number of bits in the fraction (float32 has 23, float16 has 10). */
|
---|
1462 | u2f.u = (s << 31) | ((e + 127 - 15) << 23) | (f << (23 - 10));
|
---|
1463 | return u2f.f;
|
---|
1464 | }
|
---|
1465 |
|
---|
1466 |
|
---|
1467 | static int vmsvga3dBmpWrite(const char *pszFilename, VMSVGA3D_MAPPED_SURFACE const *pMap)
|
---|
1468 | {
|
---|
1469 | if (pMap->cbPixel != 4 && pMap->format != SVGA3D_R16G16B16A16_FLOAT)
|
---|
1470 | return VERR_NOT_SUPPORTED;
|
---|
1471 |
|
---|
1472 | int const w = pMap->box.w;
|
---|
1473 | int const h = pMap->box.h;
|
---|
1474 |
|
---|
1475 | const int cbBitmap = w * h * 4;
|
---|
1476 |
|
---|
1477 | FILE *f = fopen(pszFilename, "wb");
|
---|
1478 | if (!f)
|
---|
1479 | return VERR_FILE_NOT_FOUND;
|
---|
1480 |
|
---|
1481 | {
|
---|
1482 | BMPFILEHDR fileHdr;
|
---|
1483 | RT_ZERO(fileHdr);
|
---|
1484 | fileHdr.uType = BMP_HDR_MAGIC;
|
---|
1485 | fileHdr.cbFileSize = sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR) + cbBitmap;
|
---|
1486 | fileHdr.offBits = sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR);
|
---|
1487 |
|
---|
1488 | BMPWIN3XINFOHDR coreHdr;
|
---|
1489 | RT_ZERO(coreHdr);
|
---|
1490 | coreHdr.cbSize = sizeof(coreHdr);
|
---|
1491 | coreHdr.uWidth = w;
|
---|
1492 | coreHdr.uHeight = -h;
|
---|
1493 | coreHdr.cPlanes = 1;
|
---|
1494 | coreHdr.cBits = 32;
|
---|
1495 | coreHdr.cbSizeImage = cbBitmap;
|
---|
1496 |
|
---|
1497 | fwrite(&fileHdr, 1, sizeof(fileHdr), f);
|
---|
1498 | fwrite(&coreHdr, 1, sizeof(coreHdr), f);
|
---|
1499 | }
|
---|
1500 |
|
---|
1501 | if (pMap->cbPixel == 4)
|
---|
1502 | {
|
---|
1503 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1504 | for (int32_t y = 0; y < h; ++y)
|
---|
1505 | {
|
---|
1506 | fwrite(s, 1, w * pMap->cbPixel, f);
|
---|
1507 |
|
---|
1508 | s += pMap->cbRowPitch;
|
---|
1509 | }
|
---|
1510 | }
|
---|
1511 | else if (pMap->format == SVGA3D_R16G16B16A16_FLOAT)
|
---|
1512 | {
|
---|
1513 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1514 | for (int32_t y = 0; y < h; ++y)
|
---|
1515 | {
|
---|
1516 | for (int32_t x = 0; x < w; ++x)
|
---|
1517 | {
|
---|
1518 | uint16_t const *pu16Pixel = (uint16_t *)(s + x * 8);
|
---|
1519 | uint8_t r = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[0]));
|
---|
1520 | uint8_t g = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[1]));
|
---|
1521 | uint8_t b = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[2]));
|
---|
1522 | uint8_t a = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[3]));
|
---|
1523 | uint32_t u32Pixel = b + (g << 8) + (r << 16) + (a << 24);
|
---|
1524 | fwrite(&u32Pixel, 1, 4, f);
|
---|
1525 | }
|
---|
1526 |
|
---|
1527 | s += pMap->cbRowPitch;
|
---|
1528 | }
|
---|
1529 | }
|
---|
1530 |
|
---|
1531 | fclose(f);
|
---|
1532 |
|
---|
1533 | return VINF_SUCCESS;
|
---|
1534 | }
|
---|
1535 |
|
---|
1536 |
|
---|
1537 | void vmsvga3dMapWriteBmpFile(VMSVGA3D_MAPPED_SURFACE const *pMap, char const *pszPrefix)
|
---|
1538 | {
|
---|
1539 | static int idxBitmap = 0;
|
---|
1540 | char *pszFilename = RTStrAPrintf2("bmp\\%s%d.bmp", pszPrefix, idxBitmap++);
|
---|
1541 | int rc = vmsvga3dBmpWrite(pszFilename, pMap);
|
---|
1542 | Log(("WriteBmpFile %s %Rrc\n", pszFilename, rc)); RT_NOREF(rc);
|
---|
1543 | RTStrFree(pszFilename);
|
---|
1544 | }
|
---|
1545 |
|
---|
1546 |
|
---|
1547 | static int vmsvgaR3TransferSurfaceLevel(PVGASTATECC pThisCC,
|
---|
1548 | PVMSVGAMOB pMob,
|
---|
1549 | SVGA3dSurfaceImageId const *pImage,
|
---|
1550 | SVGA3dBox const *pBox,
|
---|
1551 | SVGA3dTransferType enmTransfer)
|
---|
1552 | {
|
---|
1553 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1554 |
|
---|
1555 | VMSVGA3D_SURFACE_MAP enmMapType;
|
---|
1556 | if (enmTransfer == SVGA3D_WRITE_HOST_VRAM)
|
---|
1557 | enmMapType = pBox
|
---|
1558 | ? VMSVGA3D_SURFACE_MAP_WRITE
|
---|
1559 | : VMSVGA3D_SURFACE_MAP_WRITE_DISCARD;
|
---|
1560 | else if (enmTransfer == SVGA3D_READ_HOST_VRAM)
|
---|
1561 | enmMapType = VMSVGA3D_SURFACE_MAP_READ;
|
---|
1562 | else
|
---|
1563 | AssertFailedReturn(VERR_INVALID_PARAMETER);
|
---|
1564 |
|
---|
1565 | VMSGA3D_BOX_DIMENSIONS dims;
|
---|
1566 | int rc = vmsvga3dGetBoxDimensions(pThisCC, pImage, pBox, &dims);
|
---|
1567 | AssertRCReturn(rc, rc);
|
---|
1568 |
|
---|
1569 | VMSVGA3D_MAPPED_SURFACE map;
|
---|
1570 | rc = vmsvga3dSurfaceMap(pThisCC, pImage, pBox, enmMapType, &map);
|
---|
1571 | if (RT_SUCCESS(rc))
|
---|
1572 | {
|
---|
1573 | /* Copy mapped surface <-> MOB. */
|
---|
1574 | uint8_t *pu8Map = (uint8_t *)map.pvData;
|
---|
1575 | uint32_t offMob = dims.offSubresource + dims.offBox;
|
---|
1576 | for (uint32_t z = 0; z < dims.cDepth; ++z)
|
---|
1577 | {
|
---|
1578 | for (uint32_t y = 0; y < dims.cyBlocks; ++y)
|
---|
1579 | {
|
---|
1580 | if (enmTransfer == SVGA3D_READ_HOST_VRAM)
|
---|
1581 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, offMob, pu8Map, dims.cbRow);
|
---|
1582 | else
|
---|
1583 | rc = vmsvgaR3GboRead(pSvgaR3State, &pMob->Gbo, offMob, pu8Map, dims.cbRow);
|
---|
1584 | AssertRCBreak(rc);
|
---|
1585 |
|
---|
1586 | pu8Map += map.cbRowPitch;
|
---|
1587 | offMob += dims.cbPitch;
|
---|
1588 | }
|
---|
1589 | /** @todo Take into account map.cbDepthPitch */
|
---|
1590 | }
|
---|
1591 |
|
---|
1592 | // vmsvga3dMapWriteBmpFile(&map, "Dynamic");
|
---|
1593 |
|
---|
1594 | bool const fWritten = (enmTransfer == SVGA3D_WRITE_HOST_VRAM);
|
---|
1595 | vmsvga3dSurfaceUnmap(pThisCC, pImage, &map, fWritten);
|
---|
1596 | }
|
---|
1597 |
|
---|
1598 | return rc;
|
---|
1599 | }
|
---|
1600 |
|
---|
1601 |
|
---|
1602 | /* SVGA_3D_CMD_UPDATE_GB_IMAGE 1101 */
|
---|
1603 | static void vmsvga3dCmdUpdateGBImage(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBImage const *pCmd)
|
---|
1604 | {
|
---|
1605 | //DEBUG_BREAKPOINT_TEST();
|
---|
1606 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1607 |
|
---|
1608 | LogFlowFunc(("sid=%u @%u,%u,%u %ux%ux%u\n",
|
---|
1609 | pCmd->image.sid, pCmd->box.x, pCmd->box.y, pCmd->box.z, pCmd->box.w, pCmd->box.h, pCmd->box.d));
|
---|
1610 |
|
---|
1611 | /*
|
---|
1612 | SVGA3dSurfaceFormat format;
|
---|
1613 | SVGA3dSurface1Flags surface1Flags;
|
---|
1614 | uint32 numMipLevels;
|
---|
1615 | uint32 multisampleCount;
|
---|
1616 | SVGA3dTextureFilter autogenFilter;
|
---|
1617 | SVGA3dSize size;
|
---|
1618 | SVGAMobId mobid;
|
---|
1619 | uint32 arraySize;
|
---|
1620 | uint32 mobPitch;
|
---|
1621 | SVGA3dSurface2Flags surface2Flags;
|
---|
1622 | uint8 multisamplePattern;
|
---|
1623 | uint8 qualityLevel;
|
---|
1624 | uint16 bufferByteStride;
|
---|
1625 | float minLOD;
|
---|
1626 | */
|
---|
1627 |
|
---|
1628 | /* "update a surface from its backing MOB." */
|
---|
1629 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1630 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1631 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1632 | if (RT_SUCCESS(rc))
|
---|
1633 | {
|
---|
1634 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1635 | if (pMob)
|
---|
1636 | {
|
---|
1637 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &pCmd->image, &pCmd->box, SVGA3D_WRITE_HOST_VRAM);
|
---|
1638 | AssertRC(rc);
|
---|
1639 | }
|
---|
1640 | }
|
---|
1641 | }
|
---|
1642 |
|
---|
1643 |
|
---|
1644 | /* SVGA_3D_CMD_UPDATE_GB_SURFACE 1102 */
|
---|
1645 | static void vmsvga3dCmdUpdateGBSurface(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBSurface const *pCmd)
|
---|
1646 | {
|
---|
1647 | //DEBUG_BREAKPOINT_TEST();
|
---|
1648 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1649 |
|
---|
1650 | LogFlowFunc(("sid=%u\n",
|
---|
1651 | pCmd->sid));
|
---|
1652 |
|
---|
1653 | /* "update a surface from its backing MOB." */
|
---|
1654 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1655 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1656 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1657 | if (RT_SUCCESS(rc))
|
---|
1658 | {
|
---|
1659 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1660 | if (pMob)
|
---|
1661 | {
|
---|
1662 | uint32 const arraySize = vmsvga3dGetArrayElements(pThisCC, pCmd->sid);
|
---|
1663 | for (uint32_t iArray = 0; iArray < arraySize; ++iArray)
|
---|
1664 | {
|
---|
1665 | for (uint32_t iMipmap = 0; iMipmap < entrySurface.numMipLevels; ++iMipmap)
|
---|
1666 | {
|
---|
1667 | SVGA3dSurfaceImageId image;
|
---|
1668 | image.sid = pCmd->sid;
|
---|
1669 | image.face = iArray;
|
---|
1670 | image.mipmap = iMipmap;
|
---|
1671 |
|
---|
1672 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_WRITE_HOST_VRAM);
|
---|
1673 | AssertRCBreak(rc);
|
---|
1674 | }
|
---|
1675 | }
|
---|
1676 | }
|
---|
1677 | }
|
---|
1678 | }
|
---|
1679 |
|
---|
1680 |
|
---|
1681 | /* SVGA_3D_CMD_READBACK_GB_IMAGE 1103 */
|
---|
1682 | static void vmsvga3dCmdReadbackGBImage(PVGASTATECC pThisCC, SVGA3dCmdReadbackGBImage const *pCmd)
|
---|
1683 | {
|
---|
1684 | //DEBUG_BREAKPOINT_TEST();
|
---|
1685 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1686 |
|
---|
1687 | LogFlowFunc(("sid=%u, face=%u, mipmap=%u\n",
|
---|
1688 | pCmd->image.sid, pCmd->image.face, pCmd->image.mipmap));
|
---|
1689 |
|
---|
1690 | /* Read a surface to its backing MOB. */
|
---|
1691 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1692 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1693 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1694 | if (RT_SUCCESS(rc))
|
---|
1695 | {
|
---|
1696 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1697 | if (pMob)
|
---|
1698 | {
|
---|
1699 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &pCmd->image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
1700 | AssertRC(rc);
|
---|
1701 | }
|
---|
1702 | }
|
---|
1703 | }
|
---|
1704 |
|
---|
1705 |
|
---|
1706 | /* SVGA_3D_CMD_READBACK_GB_SURFACE 1104 */
|
---|
1707 | static void vmsvga3dCmdReadbackGBSurface(PVGASTATECC pThisCC, SVGA3dCmdReadbackGBSurface const *pCmd)
|
---|
1708 | {
|
---|
1709 | //DEBUG_BREAKPOINT_TEST();
|
---|
1710 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1711 |
|
---|
1712 | LogFlowFunc(("sid=%u\n",
|
---|
1713 | pCmd->sid));
|
---|
1714 |
|
---|
1715 | /* Read a surface to its backing MOB. */
|
---|
1716 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1717 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1718 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1719 | if (RT_SUCCESS(rc))
|
---|
1720 | {
|
---|
1721 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1722 | if (pMob)
|
---|
1723 | {
|
---|
1724 | uint32 const arraySize = vmsvga3dGetArrayElements(pThisCC, pCmd->sid);
|
---|
1725 | for (uint32_t iArray = 0; iArray < arraySize; ++iArray)
|
---|
1726 | {
|
---|
1727 | for (uint32_t iMipmap = 0; iMipmap < entrySurface.numMipLevels; ++iMipmap)
|
---|
1728 | {
|
---|
1729 | SVGA3dSurfaceImageId image;
|
---|
1730 | image.sid = pCmd->sid;
|
---|
1731 | image.face = iArray;
|
---|
1732 | image.mipmap = iMipmap;
|
---|
1733 |
|
---|
1734 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
1735 | AssertRCBreak(rc);
|
---|
1736 | }
|
---|
1737 | }
|
---|
1738 | }
|
---|
1739 | }
|
---|
1740 | }
|
---|
1741 |
|
---|
1742 |
|
---|
1743 | /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE 1105 */
|
---|
1744 | static void vmsvga3dCmdInvalidateGBImage(PVGASTATECC pThisCC, SVGA3dCmdInvalidateGBImage const *pCmd)
|
---|
1745 | {
|
---|
1746 | //DEBUG_BREAKPOINT_TEST();
|
---|
1747 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->image.sid, pCmd->image.face, pCmd->image.mipmap);
|
---|
1748 | }
|
---|
1749 |
|
---|
1750 |
|
---|
1751 | /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE 1106 */
|
---|
1752 | static void vmsvga3dCmdInvalidateGBSurface(PVGASTATECC pThisCC, SVGA3dCmdInvalidateGBSurface const *pCmd)
|
---|
1753 | {
|
---|
1754 | //DEBUG_BREAKPOINT_TEST();
|
---|
1755 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->sid, SVGA_ID_INVALID, SVGA_ID_INVALID);
|
---|
1756 | }
|
---|
1757 |
|
---|
1758 |
|
---|
1759 | /* SVGA_3D_CMD_SET_OTABLE_BASE64 1115 */
|
---|
1760 | static void vmsvga3dCmdSetOTableBase64(PVGASTATECC pThisCC, SVGA3dCmdSetOTableBase64 const *pCmd)
|
---|
1761 | {
|
---|
1762 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1763 |
|
---|
1764 | /*
|
---|
1765 | * Create a GBO for the table.
|
---|
1766 | */
|
---|
1767 | PVMSVGAGBO pGbo;
|
---|
1768 | if (pCmd->type <= RT_ELEMENTS(pSvgaR3State->aGboOTables))
|
---|
1769 | {
|
---|
1770 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1771 | pGbo = &pSvgaR3State->aGboOTables[pCmd->type];
|
---|
1772 | }
|
---|
1773 | else
|
---|
1774 | {
|
---|
1775 | ASSERT_GUEST_FAILED();
|
---|
1776 | pGbo = NULL;
|
---|
1777 | }
|
---|
1778 |
|
---|
1779 | if (pGbo)
|
---|
1780 | {
|
---|
1781 | /* Recreate. */
|
---|
1782 | vmsvgaR3GboDestroy(pSvgaR3State, pGbo);
|
---|
1783 | int rc = vmsvgaR3GboCreate(pSvgaR3State, pCmd->ptDepth, pCmd->baseAddress, pCmd->sizeInBytes, /*fGCPhys64=*/ true, /* fWriteProtected = */ true, pGbo);
|
---|
1784 | AssertRC(rc);
|
---|
1785 | }
|
---|
1786 | }
|
---|
1787 |
|
---|
1788 |
|
---|
1789 | /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET 1124 */
|
---|
1790 | static void vmsvga3dCmdDefineGBScreenTarget(PVGASTATE pThis, PVGASTATECC pThisCC, SVGA3dCmdDefineGBScreenTarget const *pCmd)
|
---|
1791 | {
|
---|
1792 | //DEBUG_BREAKPOINT_TEST();
|
---|
1793 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1794 |
|
---|
1795 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1796 | ASSERT_GUEST_RETURN_VOID(pCmd->width > 0 && pCmd->width <= pThis->svga.u32MaxWidth); /* SVGA_REG_SCREENTARGET_MAX_WIDTH */
|
---|
1797 | ASSERT_GUEST_RETURN_VOID(pCmd->height > 0 && pCmd->height <= pThis->svga.u32MaxHeight); /* SVGA_REG_SCREENTARGET_MAX_HEIGHT */
|
---|
1798 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1799 |
|
---|
1800 | /* Update the entry in the pSvgaR3State->pGboOTableScreenTarget. */
|
---|
1801 | SVGAOTableScreenTargetEntry entry;
|
---|
1802 | RT_ZERO(entry);
|
---|
1803 | entry.image.sid = SVGA_ID_INVALID;
|
---|
1804 | // entry.image.face = 0;
|
---|
1805 | // entry.image.mipmap = 0;
|
---|
1806 | entry.width = pCmd->width;
|
---|
1807 | entry.height = pCmd->height;
|
---|
1808 | entry.xRoot = pCmd->xRoot;
|
---|
1809 | entry.yRoot = pCmd->yRoot;
|
---|
1810 | entry.flags = pCmd->flags;
|
---|
1811 | entry.dpi = pCmd->dpi;
|
---|
1812 |
|
---|
1813 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1814 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1815 | if (RT_SUCCESS(rc))
|
---|
1816 | {
|
---|
1817 | /* Screen objects and screen targets are similar, therefore we will use the same for both. */
|
---|
1818 | /** @todo Generic screen object/target interface. */
|
---|
1819 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1820 | pScreen->fDefined = true;
|
---|
1821 | pScreen->fModified = true;
|
---|
1822 | pScreen->fuScreen = SVGA_SCREEN_MUST_BE_SET
|
---|
1823 | | (RT_BOOL(pCmd->flags & SVGA_STFLAG_PRIMARY) ? SVGA_SCREEN_IS_PRIMARY : 0);
|
---|
1824 | pScreen->idScreen = pCmd->stid;
|
---|
1825 |
|
---|
1826 | pScreen->xOrigin = pCmd->xRoot;
|
---|
1827 | pScreen->yOrigin = pCmd->yRoot;
|
---|
1828 | pScreen->cWidth = pCmd->width;
|
---|
1829 | pScreen->cHeight = pCmd->height;
|
---|
1830 | pScreen->offVRAM = 0; /* Not applicable for screen targets, they use either a separate memory buffer or a host window. */
|
---|
1831 | pScreen->cbPitch = pCmd->width * 4;
|
---|
1832 | pScreen->cBpp = 32;
|
---|
1833 |
|
---|
1834 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
1835 | vmsvga3dDefineScreen(pThis, pThisCC, pScreen);
|
---|
1836 |
|
---|
1837 | if (!pScreen->pHwScreen)
|
---|
1838 | {
|
---|
1839 | /* System memory buffer. */
|
---|
1840 | pScreen->pvScreenBitmap = RTMemAllocZ(pScreen->cHeight * pScreen->cbPitch);
|
---|
1841 | }
|
---|
1842 |
|
---|
1843 | pThis->svga.fGFBRegisters = false;
|
---|
1844 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
1845 | }
|
---|
1846 | }
|
---|
1847 |
|
---|
1848 |
|
---|
1849 | /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET 1125 */
|
---|
1850 | static void vmsvga3dCmdDestroyGBScreenTarget(PVGASTATE pThis, PVGASTATECC pThisCC, SVGA3dCmdDestroyGBScreenTarget const *pCmd)
|
---|
1851 | {
|
---|
1852 | //DEBUG_BREAKPOINT_TEST();
|
---|
1853 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1854 |
|
---|
1855 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1856 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1857 |
|
---|
1858 | /* Update the entry in the pSvgaR3State->pGboOTableScreenTarget. */
|
---|
1859 | SVGAOTableScreenTargetEntry entry;
|
---|
1860 | RT_ZERO(entry);
|
---|
1861 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1862 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1863 | if (RT_SUCCESS(rc))
|
---|
1864 | {
|
---|
1865 | /* Screen objects and screen targets are similar, therefore we will use the same for both. */
|
---|
1866 | /** @todo Generic screen object/target interface. */
|
---|
1867 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1868 | pScreen->fModified = true;
|
---|
1869 | pScreen->fDefined = false;
|
---|
1870 | pScreen->idScreen = pCmd->stid;
|
---|
1871 |
|
---|
1872 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
1873 | vmsvga3dDestroyScreen(pThisCC, pScreen);
|
---|
1874 |
|
---|
1875 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
1876 |
|
---|
1877 | RTMemFree(pScreen->pvScreenBitmap);
|
---|
1878 | pScreen->pvScreenBitmap = NULL;
|
---|
1879 | }
|
---|
1880 | }
|
---|
1881 |
|
---|
1882 |
|
---|
1883 | /* SVGA_3D_CMD_BIND_GB_SCREENTARGET 1126 */
|
---|
1884 | static void vmsvga3dCmdBindGBScreenTarget(PVGASTATECC pThisCC, SVGA3dCmdBindGBScreenTarget const *pCmd)
|
---|
1885 | {
|
---|
1886 | //DEBUG_BREAKPOINT_TEST();
|
---|
1887 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1888 |
|
---|
1889 | /* "Binding a surface to a Screen Target the same as flipping" */
|
---|
1890 |
|
---|
1891 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1892 | ASSERT_GUEST_RETURN_VOID(pCmd->image.face == 0 && pCmd->image.mipmap == 0);
|
---|
1893 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1894 |
|
---|
1895 | /* Assign the surface to the screen target. */
|
---|
1896 | int rc = VINF_SUCCESS;
|
---|
1897 | if (pCmd->image.sid != SVGA_ID_INVALID)
|
---|
1898 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1899 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE);
|
---|
1900 | if (RT_SUCCESS(rc))
|
---|
1901 | {
|
---|
1902 | SVGAOTableScreenTargetEntry entry;
|
---|
1903 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1904 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1905 | if (RT_SUCCESS(rc))
|
---|
1906 | {
|
---|
1907 | entry.image = pCmd->image;
|
---|
1908 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1909 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1910 | if (RT_SUCCESS(rc))
|
---|
1911 | {
|
---|
1912 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1913 | rc = pSvgaR3State->pFuncsGBO->pfnScreenTargetBind(pThisCC, pScreen, pCmd->image.sid);
|
---|
1914 | AssertRC(rc);
|
---|
1915 | }
|
---|
1916 | }
|
---|
1917 | }
|
---|
1918 | }
|
---|
1919 |
|
---|
1920 |
|
---|
1921 | /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET 1127 */
|
---|
1922 | static void vmsvga3dCmdUpdateGBScreenTarget(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBScreenTarget const *pCmd)
|
---|
1923 | {
|
---|
1924 | //DEBUG_BREAKPOINT_TEST();
|
---|
1925 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1926 |
|
---|
1927 | /* Update the screen target from its backing surface. */
|
---|
1928 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1929 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1930 |
|
---|
1931 | /* Get the screen target info. */
|
---|
1932 | SVGAOTableScreenTargetEntry entryScreenTarget;
|
---|
1933 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1934 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entryScreenTarget, sizeof(entryScreenTarget));
|
---|
1935 | if (RT_SUCCESS(rc))
|
---|
1936 | {
|
---|
1937 | ASSERT_GUEST_RETURN_VOID(entryScreenTarget.image.face == 0 && entryScreenTarget.image.mipmap == 0);
|
---|
1938 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1939 |
|
---|
1940 | if (entryScreenTarget.image.sid != SVGA_ID_INVALID)
|
---|
1941 | {
|
---|
1942 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1943 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1944 | entryScreenTarget.image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1945 | if (RT_SUCCESS(rc))
|
---|
1946 | {
|
---|
1947 | /* Copy entrySurface.mobid content to the screen target. */
|
---|
1948 | if (entrySurface.mobid != SVGA_ID_INVALID)
|
---|
1949 | {
|
---|
1950 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1951 | SVGA3dRect targetRect = pCmd->rect;
|
---|
1952 |
|
---|
1953 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1954 | if (pScreen->pHwScreen)
|
---|
1955 | {
|
---|
1956 | /* Copy the screen target surface to the backend's screen. */
|
---|
1957 | pSvgaR3State->pFuncsGBO->pfnScreenTargetUpdate(pThisCC, pScreen, &targetRect);
|
---|
1958 | }
|
---|
1959 | else if (pScreen->pvScreenBitmap)
|
---|
1960 | {
|
---|
1961 | /* Copy the screen target surface to the memory buffer. */
|
---|
1962 | VMSVGA3D_MAPPED_SURFACE map;
|
---|
1963 | rc = vmsvga3dSurfaceMap(pThisCC, &entryScreenTarget.image, NULL, VMSVGA3D_SURFACE_MAP_READ, &map);
|
---|
1964 | if (RT_SUCCESS(rc))
|
---|
1965 | {
|
---|
1966 | uint8_t const *pu8Src = (uint8_t *)map.pvData
|
---|
1967 | + targetRect.x * map.cbPixel
|
---|
1968 | + targetRect.y * map.cbRowPitch;
|
---|
1969 | uint8_t *pu8Dst = (uint8_t *)pScreen->pvScreenBitmap
|
---|
1970 | + targetRect.x * map.cbPixel
|
---|
1971 | + targetRect.y * map.box.w * map.cbPixel;
|
---|
1972 | for (uint32_t y = 0; y < targetRect.h; ++y)
|
---|
1973 | {
|
---|
1974 | memcpy(pu8Dst, pu8Src, targetRect.w * map.cbPixel);
|
---|
1975 |
|
---|
1976 | pu8Src += map.cbRowPitch;
|
---|
1977 | pu8Dst += map.box.w * map.cbPixel;
|
---|
1978 | }
|
---|
1979 |
|
---|
1980 | vmsvga3dSurfaceUnmap(pThisCC, &entryScreenTarget.image, &map, /* fWritten = */ false);
|
---|
1981 |
|
---|
1982 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->rect.x, pCmd->rect.y, pCmd->rect.w, pCmd->rect.h);
|
---|
1983 | }
|
---|
1984 | else
|
---|
1985 | AssertFailed();
|
---|
1986 | }
|
---|
1987 | }
|
---|
1988 | }
|
---|
1989 | }
|
---|
1990 | }
|
---|
1991 | }
|
---|
1992 |
|
---|
1993 |
|
---|
1994 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 1134 */
|
---|
1995 | static void vmsvga3dCmdDefineGBSurface_v2(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface_v2 const *pCmd)
|
---|
1996 | {
|
---|
1997 | //DEBUG_BREAKPOINT_TEST();
|
---|
1998 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1999 |
|
---|
2000 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
2001 | SVGAOTableSurfaceEntry entry;
|
---|
2002 | RT_ZERO(entry);
|
---|
2003 | entry.format = pCmd->format;
|
---|
2004 | entry.surface1Flags = pCmd->surfaceFlags;
|
---|
2005 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
2006 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
2007 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
2008 | entry.size = pCmd->size;
|
---|
2009 | entry.mobid = SVGA_ID_INVALID;
|
---|
2010 | entry.arraySize = pCmd->arraySize;
|
---|
2011 | // entry.mobPitch = 0;
|
---|
2012 | // ...
|
---|
2013 |
|
---|
2014 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2015 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
2016 | if (RT_SUCCESS(rc))
|
---|
2017 | {
|
---|
2018 | /* Create the host surface. */
|
---|
2019 | /** @todo SVGAOTableSurfaceEntry as input parameter? */
|
---|
2020 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
2021 | pCmd->multisampleCount, pCmd->autogenFilter,
|
---|
2022 | pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* fAllocMipLevels = */ false);
|
---|
2023 | }
|
---|
2024 | }
|
---|
2025 |
|
---|
2026 |
|
---|
2027 | /* SVGA_3D_CMD_DEFINE_GB_MOB64 1135 */
|
---|
2028 | static void vmsvga3dCmdDefineGBMob64(PVGASTATECC pThisCC, SVGA3dCmdDefineGBMob64 const *pCmd)
|
---|
2029 | {
|
---|
2030 | //DEBUG_BREAKPOINT_TEST();
|
---|
2031 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2032 |
|
---|
2033 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
2034 |
|
---|
2035 | /* Maybe just update the OTable and create Gbo when the MOB is actually accessed? */
|
---|
2036 | /* Allocate a structure for the MOB. */
|
---|
2037 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTMemAllocZ(sizeof(*pMob));
|
---|
2038 | AssertPtrReturnVoid(pMob);
|
---|
2039 |
|
---|
2040 | int rc = vmsvgaR3MobCreate(pSvgaR3State, pCmd->ptDepth, pCmd->base, pCmd->sizeInBytes, pCmd->mobid, /*fGCPhys64=*/ true, pMob);
|
---|
2041 | if (RT_SUCCESS(rc))
|
---|
2042 | {
|
---|
2043 | return;
|
---|
2044 | }
|
---|
2045 |
|
---|
2046 | RTMemFree(pMob);
|
---|
2047 | }
|
---|
2048 |
|
---|
2049 |
|
---|
2050 | /* SVGA_3D_CMD_DX_DEFINE_CONTEXT 1143 */
|
---|
2051 | static int vmsvga3dCmdDXDefineContext(PVGASTATECC pThisCC, SVGA3dCmdDXDefineContext const *pCmd, uint32_t cbCmd)
|
---|
2052 | {
|
---|
2053 | #ifdef VMSVGA3D_DX
|
---|
2054 | //DEBUG_BREAKPOINT_TEST();
|
---|
2055 | RT_NOREF(cbCmd);
|
---|
2056 |
|
---|
2057 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2058 |
|
---|
2059 | /* Update the entry in the pSvgaR3State->pGboOTable[SVGA_OTABLE_DXCONTEXT]. */
|
---|
2060 | SVGAOTableDXContextEntry entry;
|
---|
2061 | RT_ZERO(entry);
|
---|
2062 | entry.cid = pCmd->cid;
|
---|
2063 | entry.mobid = SVGA_ID_INVALID;
|
---|
2064 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2065 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2066 | if (RT_SUCCESS(rc))
|
---|
2067 | {
|
---|
2068 | /* Create the host context. */
|
---|
2069 | rc = vmsvga3dDXDefineContext(pThisCC, pCmd->cid);
|
---|
2070 | }
|
---|
2071 |
|
---|
2072 | return rc;
|
---|
2073 | #else
|
---|
2074 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2075 | return VERR_NOT_SUPPORTED;
|
---|
2076 | #endif
|
---|
2077 | }
|
---|
2078 |
|
---|
2079 |
|
---|
2080 | /* SVGA_3D_CMD_DX_DESTROY_CONTEXT 1144 */
|
---|
2081 | static int vmsvga3dCmdDXDestroyContext(PVGASTATECC pThisCC, SVGA3dCmdDXDestroyContext const *pCmd, uint32_t cbCmd)
|
---|
2082 | {
|
---|
2083 | #ifdef VMSVGA3D_DX
|
---|
2084 | //DEBUG_BREAKPOINT_TEST();
|
---|
2085 | RT_NOREF(cbCmd);
|
---|
2086 |
|
---|
2087 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2088 |
|
---|
2089 | /* Update the entry in the pSvgaR3State->pGboOTable[SVGA_OTABLE_DXCONTEXT]. */
|
---|
2090 | SVGAOTableDXContextEntry entry;
|
---|
2091 | RT_ZERO(entry);
|
---|
2092 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2093 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2094 |
|
---|
2095 | return vmsvga3dDXDestroyContext(pThisCC, pCmd->cid);
|
---|
2096 | #else
|
---|
2097 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2098 | return VERR_NOT_SUPPORTED;
|
---|
2099 | #endif
|
---|
2100 | }
|
---|
2101 |
|
---|
2102 |
|
---|
2103 | /* SVGA_3D_CMD_DX_BIND_CONTEXT 1145 */
|
---|
2104 | static int vmsvga3dCmdDXBindContext(PVGASTATECC pThisCC, SVGA3dCmdDXBindContext const *pCmd, uint32_t cbCmd)
|
---|
2105 | {
|
---|
2106 | #ifdef VMSVGA3D_DX
|
---|
2107 | //DEBUG_BREAKPOINT_TEST();
|
---|
2108 | RT_NOREF(cbCmd);
|
---|
2109 |
|
---|
2110 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2111 |
|
---|
2112 | /* Assign a mobid to a cid. */
|
---|
2113 | int rc = VINF_SUCCESS;
|
---|
2114 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
2115 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
2116 | pCmd->mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE);
|
---|
2117 | if (RT_SUCCESS(rc))
|
---|
2118 | {
|
---|
2119 | SVGAOTableDXContextEntry entry;
|
---|
2120 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2121 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2122 | if (RT_SUCCESS(rc))
|
---|
2123 | {
|
---|
2124 | SVGADXContextMobFormat *pSvgaDXContext = NULL;
|
---|
2125 | if (pCmd->mobid != entry.mobid && entry.mobid != SVGA_ID_INVALID)
|
---|
2126 | {
|
---|
2127 | /* Unbind notification to the DX backend. Copy the context data to the guest backing memory. */
|
---|
2128 | pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2129 | if (pSvgaDXContext)
|
---|
2130 | {
|
---|
2131 | rc = vmsvga3dDXUnbindContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2132 | if (RT_SUCCESS(rc))
|
---|
2133 | {
|
---|
2134 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entry.mobid);
|
---|
2135 | if (pMob)
|
---|
2136 | {
|
---|
2137 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2138 | }
|
---|
2139 | }
|
---|
2140 |
|
---|
2141 | RTMemFree(pSvgaDXContext);
|
---|
2142 | pSvgaDXContext = NULL;
|
---|
2143 | }
|
---|
2144 | }
|
---|
2145 |
|
---|
2146 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
2147 | {
|
---|
2148 | /* Bind a new context. Copy existing data from the guest backing memory. */
|
---|
2149 | if (pCmd->validContents)
|
---|
2150 | {
|
---|
2151 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
2152 | if (pMob)
|
---|
2153 | {
|
---|
2154 | pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2155 | if (pSvgaDXContext)
|
---|
2156 | {
|
---|
2157 | rc = vmsvgaR3GboRead(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2158 | if (RT_FAILURE(rc))
|
---|
2159 | {
|
---|
2160 | RTMemFree(pSvgaDXContext);
|
---|
2161 | pSvgaDXContext = NULL;
|
---|
2162 | }
|
---|
2163 | }
|
---|
2164 | }
|
---|
2165 | }
|
---|
2166 |
|
---|
2167 | rc = vmsvga3dDXBindContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2168 |
|
---|
2169 | RTMemFree(pSvgaDXContext);
|
---|
2170 | }
|
---|
2171 |
|
---|
2172 | /* Update the object table. */
|
---|
2173 | entry.mobid = pCmd->mobid;
|
---|
2174 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2175 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2176 | }
|
---|
2177 | }
|
---|
2178 |
|
---|
2179 | return rc;
|
---|
2180 | #else
|
---|
2181 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2182 | return VERR_NOT_SUPPORTED;
|
---|
2183 | #endif
|
---|
2184 | }
|
---|
2185 |
|
---|
2186 |
|
---|
2187 | /* SVGA_3D_CMD_DX_READBACK_CONTEXT 1146 */
|
---|
2188 | static int vmsvga3dCmdDXReadbackContext(PVGASTATECC pThisCC, SVGA3dCmdDXReadbackContext const *pCmd, uint32_t cbCmd)
|
---|
2189 | {
|
---|
2190 | #ifdef VMSVGA3D_DX
|
---|
2191 | //DEBUG_BREAKPOINT_TEST();
|
---|
2192 | RT_NOREF(cbCmd);
|
---|
2193 |
|
---|
2194 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2195 |
|
---|
2196 | /* "Request that the device flush the contents back into guest memory." */
|
---|
2197 | SVGAOTableDXContextEntry entry;
|
---|
2198 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2199 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2200 | if (RT_SUCCESS(rc))
|
---|
2201 | {
|
---|
2202 | if (entry.mobid != SVGA_ID_INVALID)
|
---|
2203 | {
|
---|
2204 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entry.mobid);
|
---|
2205 | if (pMob)
|
---|
2206 | {
|
---|
2207 | /* Get the content. */
|
---|
2208 | SVGADXContextMobFormat *pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2209 | if (pSvgaDXContext)
|
---|
2210 | {
|
---|
2211 | rc = vmsvga3dDXReadbackContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2212 | if (RT_SUCCESS(rc))
|
---|
2213 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2214 |
|
---|
2215 | RTMemFree(pSvgaDXContext);
|
---|
2216 | }
|
---|
2217 | else
|
---|
2218 | rc = VERR_NO_MEMORY;
|
---|
2219 | }
|
---|
2220 | }
|
---|
2221 | }
|
---|
2222 |
|
---|
2223 | return rc;
|
---|
2224 | #else
|
---|
2225 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2226 | return VERR_NOT_SUPPORTED;
|
---|
2227 | #endif
|
---|
2228 | }
|
---|
2229 |
|
---|
2230 |
|
---|
2231 | /* SVGA_3D_CMD_DX_INVALIDATE_CONTEXT 1147 */
|
---|
2232 | static int vmsvga3dCmdDXInvalidateContext(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXInvalidateContext const *pCmd, uint32_t cbCmd)
|
---|
2233 | {
|
---|
2234 | #ifdef VMSVGA3D_DX
|
---|
2235 | DEBUG_BREAKPOINT_TEST();
|
---|
2236 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2237 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
2238 | return vmsvga3dDXInvalidateContext(pThisCC, idDXContext);
|
---|
2239 | #else
|
---|
2240 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2241 | return VERR_NOT_SUPPORTED;
|
---|
2242 | #endif
|
---|
2243 | }
|
---|
2244 |
|
---|
2245 |
|
---|
2246 | /* SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER 1148 */
|
---|
2247 | static int vmsvga3dCmdDXSetSingleConstantBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSingleConstantBuffer const *pCmd, uint32_t cbCmd)
|
---|
2248 | {
|
---|
2249 | #ifdef VMSVGA3D_DX
|
---|
2250 | //DEBUG_BREAKPOINT_TEST();
|
---|
2251 | RT_NOREF(cbCmd);
|
---|
2252 | return vmsvga3dDXSetSingleConstantBuffer(pThisCC, idDXContext, pCmd);
|
---|
2253 | #else
|
---|
2254 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2255 | return VERR_NOT_SUPPORTED;
|
---|
2256 | #endif
|
---|
2257 | }
|
---|
2258 |
|
---|
2259 |
|
---|
2260 | /* SVGA_3D_CMD_DX_SET_SHADER_RESOURCES 1149 */
|
---|
2261 | static int vmsvga3dCmdDXSetShaderResources(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShaderResources const *pCmd, uint32_t cbCmd)
|
---|
2262 | {
|
---|
2263 | #ifdef VMSVGA3D_DX
|
---|
2264 | //DEBUG_BREAKPOINT_TEST();
|
---|
2265 | SVGA3dShaderResourceViewId const *paShaderResourceViewId = (SVGA3dShaderResourceViewId *)&pCmd[1];
|
---|
2266 | uint32_t const cShaderResourceViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dShaderResourceViewId);
|
---|
2267 | return vmsvga3dDXSetShaderResources(pThisCC, idDXContext, pCmd, cShaderResourceViewId, paShaderResourceViewId);
|
---|
2268 | #else
|
---|
2269 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2270 | return VERR_NOT_SUPPORTED;
|
---|
2271 | #endif
|
---|
2272 | }
|
---|
2273 |
|
---|
2274 |
|
---|
2275 | /* SVGA_3D_CMD_DX_SET_SHADER 1150 */
|
---|
2276 | static int vmsvga3dCmdDXSetShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShader const *pCmd, uint32_t cbCmd)
|
---|
2277 | {
|
---|
2278 | #ifdef VMSVGA3D_DX
|
---|
2279 | //DEBUG_BREAKPOINT_TEST();
|
---|
2280 | RT_NOREF(cbCmd);
|
---|
2281 | return vmsvga3dDXSetShader(pThisCC, idDXContext, pCmd);
|
---|
2282 | #else
|
---|
2283 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2284 | return VERR_NOT_SUPPORTED;
|
---|
2285 | #endif
|
---|
2286 | }
|
---|
2287 |
|
---|
2288 |
|
---|
2289 | /* SVGA_3D_CMD_DX_SET_SAMPLERS 1151 */
|
---|
2290 | static int vmsvga3dCmdDXSetSamplers(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSamplers const *pCmd, uint32_t cbCmd)
|
---|
2291 | {
|
---|
2292 | #ifdef VMSVGA3D_DX
|
---|
2293 | //DEBUG_BREAKPOINT_TEST();
|
---|
2294 | SVGA3dSamplerId const *paSamplerId = (SVGA3dSamplerId *)&pCmd[1];
|
---|
2295 | uint32_t const cSamplerId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSamplerId);
|
---|
2296 | return vmsvga3dDXSetSamplers(pThisCC, idDXContext, pCmd, cSamplerId, paSamplerId);
|
---|
2297 | #else
|
---|
2298 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2299 | return VERR_NOT_SUPPORTED;
|
---|
2300 | #endif
|
---|
2301 | }
|
---|
2302 |
|
---|
2303 |
|
---|
2304 | /* SVGA_3D_CMD_DX_DRAW 1152 */
|
---|
2305 | static int vmsvga3dCmdDXDraw(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDraw const *pCmd, uint32_t cbCmd)
|
---|
2306 | {
|
---|
2307 | #ifdef VMSVGA3D_DX
|
---|
2308 | //DEBUG_BREAKPOINT_TEST();
|
---|
2309 | RT_NOREF(cbCmd);
|
---|
2310 | return vmsvga3dDXDraw(pThisCC, idDXContext, pCmd);
|
---|
2311 | #else
|
---|
2312 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2313 | return VERR_NOT_SUPPORTED;
|
---|
2314 | #endif
|
---|
2315 | }
|
---|
2316 |
|
---|
2317 |
|
---|
2318 | /* SVGA_3D_CMD_DX_DRAW_INDEXED 1153 */
|
---|
2319 | static int vmsvga3dCmdDXDrawIndexed(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexed const *pCmd, uint32_t cbCmd)
|
---|
2320 | {
|
---|
2321 | #ifdef VMSVGA3D_DX
|
---|
2322 | //DEBUG_BREAKPOINT_TEST();
|
---|
2323 | RT_NOREF(cbCmd);
|
---|
2324 | return vmsvga3dDXDrawIndexed(pThisCC, idDXContext, pCmd);
|
---|
2325 | #else
|
---|
2326 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2327 | return VERR_NOT_SUPPORTED;
|
---|
2328 | #endif
|
---|
2329 | }
|
---|
2330 |
|
---|
2331 |
|
---|
2332 | /* SVGA_3D_CMD_DX_DRAW_INSTANCED 1154 */
|
---|
2333 | static int vmsvga3dCmdDXDrawInstanced(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawInstanced const *pCmd, uint32_t cbCmd)
|
---|
2334 | {
|
---|
2335 | #ifdef VMSVGA3D_DX
|
---|
2336 | //DEBUG_BREAKPOINT_TEST();
|
---|
2337 | RT_NOREF(cbCmd);
|
---|
2338 | return vmsvga3dDXDrawInstanced(pThisCC, idDXContext, pCmd);
|
---|
2339 | #else
|
---|
2340 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2341 | return VERR_NOT_SUPPORTED;
|
---|
2342 | #endif
|
---|
2343 | }
|
---|
2344 |
|
---|
2345 |
|
---|
2346 | /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED 1155 */
|
---|
2347 | static int vmsvga3dCmdDXDrawIndexedInstanced(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexedInstanced const *pCmd, uint32_t cbCmd)
|
---|
2348 | {
|
---|
2349 | #ifdef VMSVGA3D_DX
|
---|
2350 | //DEBUG_BREAKPOINT_TEST();
|
---|
2351 | RT_NOREF(cbCmd);
|
---|
2352 | return vmsvga3dDXDrawIndexedInstanced(pThisCC, idDXContext, pCmd);
|
---|
2353 | #else
|
---|
2354 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2355 | return VERR_NOT_SUPPORTED;
|
---|
2356 | #endif
|
---|
2357 | }
|
---|
2358 |
|
---|
2359 |
|
---|
2360 | /* SVGA_3D_CMD_DX_DRAW_AUTO 1156 */
|
---|
2361 | static int vmsvga3dCmdDXDrawAuto(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawAuto const *pCmd, uint32_t cbCmd)
|
---|
2362 | {
|
---|
2363 | #ifdef VMSVGA3D_DX
|
---|
2364 | DEBUG_BREAKPOINT_TEST();
|
---|
2365 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2366 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
2367 | return vmsvga3dDXDrawAuto(pThisCC, idDXContext);
|
---|
2368 | #else
|
---|
2369 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2370 | return VERR_NOT_SUPPORTED;
|
---|
2371 | #endif
|
---|
2372 | }
|
---|
2373 |
|
---|
2374 |
|
---|
2375 | /* SVGA_3D_CMD_DX_SET_INPUT_LAYOUT 1157 */
|
---|
2376 | static int vmsvga3dCmdDXSetInputLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetInputLayout const *pCmd, uint32_t cbCmd)
|
---|
2377 | {
|
---|
2378 | #ifdef VMSVGA3D_DX
|
---|
2379 | //DEBUG_BREAKPOINT_TEST();
|
---|
2380 | RT_NOREF(cbCmd);
|
---|
2381 | return vmsvga3dDXSetInputLayout(pThisCC, idDXContext, pCmd->elementLayoutId);
|
---|
2382 | #else
|
---|
2383 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2384 | return VERR_NOT_SUPPORTED;
|
---|
2385 | #endif
|
---|
2386 | }
|
---|
2387 |
|
---|
2388 |
|
---|
2389 | /* SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS 1158 */
|
---|
2390 | static int vmsvga3dCmdDXSetVertexBuffers(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetVertexBuffers const *pCmd, uint32_t cbCmd)
|
---|
2391 | {
|
---|
2392 | #ifdef VMSVGA3D_DX
|
---|
2393 | //DEBUG_BREAKPOINT_TEST();
|
---|
2394 | SVGA3dVertexBuffer const *paVertexBuffer = (SVGA3dVertexBuffer *)&pCmd[1];
|
---|
2395 | uint32_t const cVertexBuffer = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dVertexBuffer);
|
---|
2396 | return vmsvga3dDXSetVertexBuffers(pThisCC, idDXContext, pCmd->startBuffer, cVertexBuffer, paVertexBuffer);
|
---|
2397 | #else
|
---|
2398 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2399 | return VERR_NOT_SUPPORTED;
|
---|
2400 | #endif
|
---|
2401 | }
|
---|
2402 |
|
---|
2403 |
|
---|
2404 | /* SVGA_3D_CMD_DX_SET_INDEX_BUFFER 1159 */
|
---|
2405 | static int vmsvga3dCmdDXSetIndexBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetIndexBuffer const *pCmd, uint32_t cbCmd)
|
---|
2406 | {
|
---|
2407 | #ifdef VMSVGA3D_DX
|
---|
2408 | //DEBUG_BREAKPOINT_TEST();
|
---|
2409 | RT_NOREF(cbCmd);
|
---|
2410 | return vmsvga3dDXSetIndexBuffer(pThisCC, idDXContext, pCmd);
|
---|
2411 | #else
|
---|
2412 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2413 | return VERR_NOT_SUPPORTED;
|
---|
2414 | #endif
|
---|
2415 | }
|
---|
2416 |
|
---|
2417 |
|
---|
2418 | /* SVGA_3D_CMD_DX_SET_TOPOLOGY 1160 */
|
---|
2419 | static int vmsvga3dCmdDXSetTopology(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetTopology const *pCmd, uint32_t cbCmd)
|
---|
2420 | {
|
---|
2421 | #ifdef VMSVGA3D_DX
|
---|
2422 | //DEBUG_BREAKPOINT_TEST();
|
---|
2423 | RT_NOREF(cbCmd);
|
---|
2424 | return vmsvga3dDXSetTopology(pThisCC, idDXContext, pCmd->topology);
|
---|
2425 | #else
|
---|
2426 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2427 | return VERR_NOT_SUPPORTED;
|
---|
2428 | #endif
|
---|
2429 | }
|
---|
2430 |
|
---|
2431 |
|
---|
2432 | /* SVGA_3D_CMD_DX_SET_RENDERTARGETS 1161 */
|
---|
2433 | static int vmsvga3dCmdDXSetRenderTargets(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetRenderTargets const *pCmd, uint32_t cbCmd)
|
---|
2434 | {
|
---|
2435 | #ifdef VMSVGA3D_DX
|
---|
2436 | //DEBUG_BREAKPOINT_TEST();
|
---|
2437 | SVGA3dRenderTargetViewId const *paRenderTargetViewId = (SVGA3dRenderTargetViewId *)&pCmd[1];
|
---|
2438 | uint32_t const cRenderTargetViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRenderTargetViewId);
|
---|
2439 | return vmsvga3dDXSetRenderTargets(pThisCC, idDXContext, pCmd->depthStencilViewId, cRenderTargetViewId, paRenderTargetViewId);
|
---|
2440 | #else
|
---|
2441 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2442 | return VERR_NOT_SUPPORTED;
|
---|
2443 | #endif
|
---|
2444 | }
|
---|
2445 |
|
---|
2446 |
|
---|
2447 | /* SVGA_3D_CMD_DX_SET_BLEND_STATE 1162 */
|
---|
2448 | static int vmsvga3dCmdDXSetBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetBlendState const *pCmd, uint32_t cbCmd)
|
---|
2449 | {
|
---|
2450 | #ifdef VMSVGA3D_DX
|
---|
2451 | //DEBUG_BREAKPOINT_TEST();
|
---|
2452 | RT_NOREF(cbCmd);
|
---|
2453 | return vmsvga3dDXSetBlendState(pThisCC, idDXContext, pCmd);
|
---|
2454 | #else
|
---|
2455 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2456 | return VERR_NOT_SUPPORTED;
|
---|
2457 | #endif
|
---|
2458 | }
|
---|
2459 |
|
---|
2460 |
|
---|
2461 | /* SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE 1163 */
|
---|
2462 | static int vmsvga3dCmdDXSetDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
2463 | {
|
---|
2464 | #ifdef VMSVGA3D_DX
|
---|
2465 | //DEBUG_BREAKPOINT_TEST();
|
---|
2466 | RT_NOREF(cbCmd);
|
---|
2467 | return vmsvga3dDXSetDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
2468 | #else
|
---|
2469 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2470 | return VERR_NOT_SUPPORTED;
|
---|
2471 | #endif
|
---|
2472 | }
|
---|
2473 |
|
---|
2474 |
|
---|
2475 | /* SVGA_3D_CMD_DX_SET_RASTERIZER_STATE 1164 */
|
---|
2476 | static int vmsvga3dCmdDXSetRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
2477 | {
|
---|
2478 | #ifdef VMSVGA3D_DX
|
---|
2479 | //DEBUG_BREAKPOINT_TEST();
|
---|
2480 | RT_NOREF(cbCmd);
|
---|
2481 | return vmsvga3dDXSetRasterizerState(pThisCC, idDXContext, pCmd->rasterizerId);
|
---|
2482 | #else
|
---|
2483 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2484 | return VERR_NOT_SUPPORTED;
|
---|
2485 | #endif
|
---|
2486 | }
|
---|
2487 |
|
---|
2488 |
|
---|
2489 | /* SVGA_3D_CMD_DX_DEFINE_QUERY 1165 */
|
---|
2490 | static int vmsvga3dCmdDXDefineQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineQuery const *pCmd, uint32_t cbCmd)
|
---|
2491 | {
|
---|
2492 | #ifdef VMSVGA3D_DX
|
---|
2493 | //DEBUG_BREAKPOINT_TEST();
|
---|
2494 | RT_NOREF(cbCmd);
|
---|
2495 | return vmsvga3dDXDefineQuery(pThisCC, idDXContext, pCmd);
|
---|
2496 | #else
|
---|
2497 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2498 | return VERR_NOT_SUPPORTED;
|
---|
2499 | #endif
|
---|
2500 | }
|
---|
2501 |
|
---|
2502 |
|
---|
2503 | /* SVGA_3D_CMD_DX_DESTROY_QUERY 1166 */
|
---|
2504 | static int vmsvga3dCmdDXDestroyQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyQuery const *pCmd, uint32_t cbCmd)
|
---|
2505 | {
|
---|
2506 | #ifdef VMSVGA3D_DX
|
---|
2507 | //DEBUG_BREAKPOINT_TEST();
|
---|
2508 | RT_NOREF(cbCmd);
|
---|
2509 | return vmsvga3dDXDestroyQuery(pThisCC, idDXContext, pCmd);
|
---|
2510 | #else
|
---|
2511 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2512 | return VERR_NOT_SUPPORTED;
|
---|
2513 | #endif
|
---|
2514 | }
|
---|
2515 |
|
---|
2516 |
|
---|
2517 | /* SVGA_3D_CMD_DX_BIND_QUERY 1167 */
|
---|
2518 | static int vmsvga3dCmdDXBindQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindQuery const *pCmd, uint32_t cbCmd)
|
---|
2519 | {
|
---|
2520 | #ifdef VMSVGA3D_DX
|
---|
2521 | //DEBUG_BREAKPOINT_TEST();
|
---|
2522 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2523 | RT_NOREF(cbCmd);
|
---|
2524 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
2525 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
2526 | return vmsvga3dDXBindQuery(pThisCC, idDXContext, pCmd, pMob);
|
---|
2527 | #else
|
---|
2528 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2529 | return VERR_NOT_SUPPORTED;
|
---|
2530 | #endif
|
---|
2531 | }
|
---|
2532 |
|
---|
2533 |
|
---|
2534 | /* SVGA_3D_CMD_DX_SET_QUERY_OFFSET 1168 */
|
---|
2535 | static int vmsvga3dCmdDXSetQueryOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetQueryOffset const *pCmd, uint32_t cbCmd)
|
---|
2536 | {
|
---|
2537 | #ifdef VMSVGA3D_DX
|
---|
2538 | //DEBUG_BREAKPOINT_TEST();
|
---|
2539 | RT_NOREF(cbCmd);
|
---|
2540 | return vmsvga3dDXSetQueryOffset(pThisCC, idDXContext, pCmd);
|
---|
2541 | #else
|
---|
2542 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2543 | return VERR_NOT_SUPPORTED;
|
---|
2544 | #endif
|
---|
2545 | }
|
---|
2546 |
|
---|
2547 |
|
---|
2548 | /* SVGA_3D_CMD_DX_BEGIN_QUERY 1169 */
|
---|
2549 | static int vmsvga3dCmdDXBeginQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBeginQuery const *pCmd, uint32_t cbCmd)
|
---|
2550 | {
|
---|
2551 | #ifdef VMSVGA3D_DX
|
---|
2552 | //DEBUG_BREAKPOINT_TEST();
|
---|
2553 | RT_NOREF(cbCmd);
|
---|
2554 | return vmsvga3dDXBeginQuery(pThisCC, idDXContext, pCmd);
|
---|
2555 | #else
|
---|
2556 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2557 | return VERR_NOT_SUPPORTED;
|
---|
2558 | #endif
|
---|
2559 | }
|
---|
2560 |
|
---|
2561 |
|
---|
2562 | /* SVGA_3D_CMD_DX_END_QUERY 1170 */
|
---|
2563 | static int vmsvga3dCmdDXEndQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXEndQuery const *pCmd, uint32_t cbCmd)
|
---|
2564 | {
|
---|
2565 | #ifdef VMSVGA3D_DX
|
---|
2566 | //DEBUG_BREAKPOINT_TEST();
|
---|
2567 | RT_NOREF(cbCmd);
|
---|
2568 | return vmsvga3dDXEndQuery(pThisCC, idDXContext, pCmd);
|
---|
2569 | #else
|
---|
2570 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2571 | return VERR_NOT_SUPPORTED;
|
---|
2572 | #endif
|
---|
2573 | }
|
---|
2574 |
|
---|
2575 |
|
---|
2576 | /* SVGA_3D_CMD_DX_READBACK_QUERY 1171 */
|
---|
2577 | static int vmsvga3dCmdDXReadbackQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackQuery const *pCmd, uint32_t cbCmd)
|
---|
2578 | {
|
---|
2579 | #ifdef VMSVGA3D_DX
|
---|
2580 | //DEBUG_BREAKPOINT_TEST();
|
---|
2581 | RT_NOREF(cbCmd);
|
---|
2582 | return vmsvga3dDXReadbackQuery(pThisCC, idDXContext, pCmd);
|
---|
2583 | #else
|
---|
2584 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2585 | return VERR_NOT_SUPPORTED;
|
---|
2586 | #endif
|
---|
2587 | }
|
---|
2588 |
|
---|
2589 |
|
---|
2590 | /* SVGA_3D_CMD_DX_SET_PREDICATION 1172 */
|
---|
2591 | static int vmsvga3dCmdDXSetPredication(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetPredication const *pCmd, uint32_t cbCmd)
|
---|
2592 | {
|
---|
2593 | #ifdef VMSVGA3D_DX
|
---|
2594 | DEBUG_BREAKPOINT_TEST();
|
---|
2595 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2596 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
2597 | return vmsvga3dDXSetPredication(pThisCC, idDXContext);
|
---|
2598 | #else
|
---|
2599 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2600 | return VERR_NOT_SUPPORTED;
|
---|
2601 | #endif
|
---|
2602 | }
|
---|
2603 |
|
---|
2604 |
|
---|
2605 | /* SVGA_3D_CMD_DX_SET_SOTARGETS 1173 */
|
---|
2606 | static int vmsvga3dCmdDXSetSOTargets(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSOTargets const *pCmd, uint32_t cbCmd)
|
---|
2607 | {
|
---|
2608 | #ifdef VMSVGA3D_DX
|
---|
2609 | //DEBUG_BREAKPOINT_TEST();
|
---|
2610 | SVGA3dSoTarget const *paSoTarget = (SVGA3dSoTarget *)&pCmd[1];
|
---|
2611 | uint32_t const cSoTarget = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSoTarget);
|
---|
2612 | return vmsvga3dDXSetSOTargets(pThisCC, idDXContext, cSoTarget, paSoTarget);
|
---|
2613 | #else
|
---|
2614 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2615 | return VERR_NOT_SUPPORTED;
|
---|
2616 | #endif
|
---|
2617 | }
|
---|
2618 |
|
---|
2619 |
|
---|
2620 | /* SVGA_3D_CMD_DX_SET_VIEWPORTS 1174 */
|
---|
2621 | static int vmsvga3dCmdDXSetViewports(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetViewports const *pCmd, uint32_t cbCmd)
|
---|
2622 | {
|
---|
2623 | #ifdef VMSVGA3D_DX
|
---|
2624 | //DEBUG_BREAKPOINT_TEST();
|
---|
2625 | SVGA3dViewport const *paViewport = (SVGA3dViewport *)&pCmd[1];
|
---|
2626 | uint32_t const cViewport = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dViewport);
|
---|
2627 | return vmsvga3dDXSetViewports(pThisCC, idDXContext, cViewport, paViewport);
|
---|
2628 | #else
|
---|
2629 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2630 | return VERR_NOT_SUPPORTED;
|
---|
2631 | #endif
|
---|
2632 | }
|
---|
2633 |
|
---|
2634 |
|
---|
2635 | /* SVGA_3D_CMD_DX_SET_SCISSORRECTS 1175 */
|
---|
2636 | static int vmsvga3dCmdDXSetScissorRects(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetScissorRects const *pCmd, uint32_t cbCmd)
|
---|
2637 | {
|
---|
2638 | #ifdef VMSVGA3D_DX
|
---|
2639 | //DEBUG_BREAKPOINT_TEST();
|
---|
2640 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
2641 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
2642 | return vmsvga3dDXSetScissorRects(pThisCC, idDXContext, cRect, paRect);
|
---|
2643 | #else
|
---|
2644 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2645 | return VERR_NOT_SUPPORTED;
|
---|
2646 | #endif
|
---|
2647 | }
|
---|
2648 |
|
---|
2649 |
|
---|
2650 | /* SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW 1176 */
|
---|
2651 | static int vmsvga3dCmdDXClearRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2652 | {
|
---|
2653 | #ifdef VMSVGA3D_DX
|
---|
2654 | //DEBUG_BREAKPOINT_TEST();
|
---|
2655 | RT_NOREF(cbCmd);
|
---|
2656 | return vmsvga3dDXClearRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2657 | #else
|
---|
2658 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2659 | return VERR_NOT_SUPPORTED;
|
---|
2660 | #endif
|
---|
2661 | }
|
---|
2662 |
|
---|
2663 |
|
---|
2664 | /* SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW 1177 */
|
---|
2665 | static int vmsvga3dCmdDXClearDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
2666 | {
|
---|
2667 | #ifdef VMSVGA3D_DX
|
---|
2668 | //DEBUG_BREAKPOINT_TEST();
|
---|
2669 | RT_NOREF(cbCmd);
|
---|
2670 | return vmsvga3dDXClearDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
2671 | #else
|
---|
2672 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2673 | return VERR_NOT_SUPPORTED;
|
---|
2674 | #endif
|
---|
2675 | }
|
---|
2676 |
|
---|
2677 |
|
---|
2678 | /* SVGA_3D_CMD_DX_PRED_COPY_REGION 1178 */
|
---|
2679 | static int vmsvga3dCmdDXPredCopyRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopyRegion const *pCmd, uint32_t cbCmd)
|
---|
2680 | {
|
---|
2681 | #ifdef VMSVGA3D_DX
|
---|
2682 | //DEBUG_BREAKPOINT_TEST();
|
---|
2683 | RT_NOREF(cbCmd);
|
---|
2684 | return vmsvga3dDXPredCopyRegion(pThisCC, idDXContext, pCmd);
|
---|
2685 | #else
|
---|
2686 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2687 | return VERR_NOT_SUPPORTED;
|
---|
2688 | #endif
|
---|
2689 | }
|
---|
2690 |
|
---|
2691 |
|
---|
2692 | /* SVGA_3D_CMD_DX_PRED_COPY 1179 */
|
---|
2693 | static int vmsvga3dCmdDXPredCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopy const *pCmd, uint32_t cbCmd)
|
---|
2694 | {
|
---|
2695 | #ifdef VMSVGA3D_DX
|
---|
2696 | DEBUG_BREAKPOINT_TEST();
|
---|
2697 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2698 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
2699 | return vmsvga3dDXPredCopy(pThisCC, idDXContext);
|
---|
2700 | #else
|
---|
2701 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2702 | return VERR_NOT_SUPPORTED;
|
---|
2703 | #endif
|
---|
2704 | }
|
---|
2705 |
|
---|
2706 |
|
---|
2707 | /* SVGA_3D_CMD_DX_PRESENTBLT 1180 */
|
---|
2708 | static int vmsvga3dCmdDXPresentBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPresentBlt const *pCmd, uint32_t cbCmd)
|
---|
2709 | {
|
---|
2710 | #ifdef VMSVGA3D_DX
|
---|
2711 | DEBUG_BREAKPOINT_TEST();
|
---|
2712 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2713 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
2714 | return vmsvga3dDXPresentBlt(pThisCC, idDXContext);
|
---|
2715 | #else
|
---|
2716 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2717 | return VERR_NOT_SUPPORTED;
|
---|
2718 | #endif
|
---|
2719 | }
|
---|
2720 |
|
---|
2721 |
|
---|
2722 | /* SVGA_3D_CMD_DX_GENMIPS 1181 */
|
---|
2723 | static int vmsvga3dCmdDXGenMips(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXGenMips const *pCmd, uint32_t cbCmd)
|
---|
2724 | {
|
---|
2725 | #ifdef VMSVGA3D_DX
|
---|
2726 | //DEBUG_BREAKPOINT_TEST();
|
---|
2727 | RT_NOREF(cbCmd);
|
---|
2728 | return vmsvga3dDXGenMips(pThisCC, idDXContext, pCmd);
|
---|
2729 | #else
|
---|
2730 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2731 | return VERR_NOT_SUPPORTED;
|
---|
2732 | #endif
|
---|
2733 | }
|
---|
2734 |
|
---|
2735 |
|
---|
2736 | /* SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE 1182 */
|
---|
2737 | static int vmsvga3dCmdDXUpdateSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXUpdateSubResource const *pCmd, uint32_t cbCmd)
|
---|
2738 | {
|
---|
2739 | #ifdef VMSVGA3D_DX
|
---|
2740 | //DEBUG_BREAKPOINT_TEST();
|
---|
2741 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2742 | RT_NOREF(cbCmd);
|
---|
2743 |
|
---|
2744 | LogFlowFunc(("sid=%u, subResource=%u, box=%d,%d,%d %ux%ux%u\n",
|
---|
2745 | pCmd->sid, pCmd->subResource, pCmd->box.x, pCmd->box.y, pCmd->box.z, pCmd->box.w, pCmd->box.h, pCmd->box.z));
|
---|
2746 |
|
---|
2747 | /* "Inform the device that the guest-contents have been updated." */
|
---|
2748 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2749 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2750 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2751 | if (RT_SUCCESS(rc))
|
---|
2752 | {
|
---|
2753 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
2754 | if (pMob)
|
---|
2755 | {
|
---|
2756 | uint32 const cSubresource = vmsvga3dGetSubresourceCount(pThisCC, pCmd->sid);
|
---|
2757 | ASSERT_GUEST_RETURN(pCmd->subResource < cSubresource, VERR_INVALID_PARAMETER);
|
---|
2758 | /* pCmd->box will be verified by the mapping function. */
|
---|
2759 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2760 |
|
---|
2761 | /** @todo Mapping functions should use subresource index rather than SVGA3dSurfaceImageId? */
|
---|
2762 | SVGA3dSurfaceImageId image;
|
---|
2763 | image.sid = pCmd->sid;
|
---|
2764 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &image.mipmap, &image.face);
|
---|
2765 |
|
---|
2766 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, &pCmd->box, SVGA3D_WRITE_HOST_VRAM);
|
---|
2767 | AssertRC(rc);
|
---|
2768 | }
|
---|
2769 | }
|
---|
2770 |
|
---|
2771 | return rc;
|
---|
2772 | #else
|
---|
2773 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2774 | return VERR_NOT_SUPPORTED;
|
---|
2775 | #endif
|
---|
2776 | }
|
---|
2777 |
|
---|
2778 |
|
---|
2779 | /* SVGA_3D_CMD_DX_READBACK_SUBRESOURCE 1183 */
|
---|
2780 | static int vmsvga3dCmdDXReadbackSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXReadbackSubResource const *pCmd, uint32_t cbCmd)
|
---|
2781 | {
|
---|
2782 | #ifdef VMSVGA3D_DX
|
---|
2783 | //DEBUG_BREAKPOINT_TEST();
|
---|
2784 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2785 | RT_NOREF(cbCmd);
|
---|
2786 |
|
---|
2787 | LogFlowFunc(("sid=%u, subResource=%u\n",
|
---|
2788 | pCmd->sid, pCmd->subResource));
|
---|
2789 |
|
---|
2790 | /* "Request the device to flush the dirty contents into the guest." */
|
---|
2791 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2792 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2793 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2794 | if (RT_SUCCESS(rc))
|
---|
2795 | {
|
---|
2796 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
2797 | if (pMob)
|
---|
2798 | {
|
---|
2799 | uint32 const cSubresource = vmsvga3dGetSubresourceCount(pThisCC, pCmd->sid);
|
---|
2800 | ASSERT_GUEST_RETURN(pCmd->subResource < cSubresource, VERR_INVALID_PARAMETER);
|
---|
2801 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2802 |
|
---|
2803 | /** @todo Mapping functions should use subresource index rather than SVGA3dSurfaceImageId? */
|
---|
2804 | SVGA3dSurfaceImageId image;
|
---|
2805 | image.sid = pCmd->sid;
|
---|
2806 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &image.mipmap, &image.face);
|
---|
2807 |
|
---|
2808 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
2809 | AssertRC(rc);
|
---|
2810 | }
|
---|
2811 | }
|
---|
2812 |
|
---|
2813 | return rc;
|
---|
2814 | #else
|
---|
2815 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2816 | return VERR_NOT_SUPPORTED;
|
---|
2817 | #endif
|
---|
2818 | }
|
---|
2819 |
|
---|
2820 |
|
---|
2821 | /* SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE 1184 */
|
---|
2822 | static int vmsvga3dCmdDXInvalidateSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXInvalidateSubResource const *pCmd, uint32_t cbCmd)
|
---|
2823 | {
|
---|
2824 | #ifdef VMSVGA3D_DX
|
---|
2825 | DEBUG_BREAKPOINT_TEST();
|
---|
2826 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2827 | RT_NOREF(cbCmd);
|
---|
2828 |
|
---|
2829 | LogFlowFunc(("sid=%u, subResource=%u\n",
|
---|
2830 | pCmd->sid, pCmd->subResource));
|
---|
2831 |
|
---|
2832 | /* "Notify the device that the contents can be lost." */
|
---|
2833 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2834 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2835 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2836 | if (RT_SUCCESS(rc))
|
---|
2837 | {
|
---|
2838 | uint32_t iFace;
|
---|
2839 | uint32_t iMipmap;
|
---|
2840 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &iMipmap, &iFace);
|
---|
2841 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->sid, iFace, iMipmap);
|
---|
2842 | }
|
---|
2843 |
|
---|
2844 | return rc;
|
---|
2845 | #else
|
---|
2846 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2847 | return VERR_NOT_SUPPORTED;
|
---|
2848 | #endif
|
---|
2849 | }
|
---|
2850 |
|
---|
2851 |
|
---|
2852 | /* SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW 1185 */
|
---|
2853 | static int vmsvga3dCmdDXDefineShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShaderResourceView const *pCmd, uint32_t cbCmd)
|
---|
2854 | {
|
---|
2855 | #ifdef VMSVGA3D_DX
|
---|
2856 | //DEBUG_BREAKPOINT_TEST();
|
---|
2857 | RT_NOREF(cbCmd);
|
---|
2858 | return vmsvga3dDXDefineShaderResourceView(pThisCC, idDXContext, pCmd);
|
---|
2859 | #else
|
---|
2860 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2861 | return VERR_NOT_SUPPORTED;
|
---|
2862 | #endif
|
---|
2863 | }
|
---|
2864 |
|
---|
2865 |
|
---|
2866 | /* SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW 1186 */
|
---|
2867 | static int vmsvga3dCmdDXDestroyShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShaderResourceView const *pCmd, uint32_t cbCmd)
|
---|
2868 | {
|
---|
2869 | #ifdef VMSVGA3D_DX
|
---|
2870 | //DEBUG_BREAKPOINT_TEST();
|
---|
2871 | RT_NOREF(cbCmd);
|
---|
2872 | return vmsvga3dDXDestroyShaderResourceView(pThisCC, idDXContext, pCmd);
|
---|
2873 | #else
|
---|
2874 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2875 | return VERR_NOT_SUPPORTED;
|
---|
2876 | #endif
|
---|
2877 | }
|
---|
2878 |
|
---|
2879 |
|
---|
2880 | /* SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW 1187 */
|
---|
2881 | static int vmsvga3dCmdDXDefineRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2882 | {
|
---|
2883 | #ifdef VMSVGA3D_DX
|
---|
2884 | //DEBUG_BREAKPOINT_TEST();
|
---|
2885 | RT_NOREF(cbCmd);
|
---|
2886 | return vmsvga3dDXDefineRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2887 | #else
|
---|
2888 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2889 | return VERR_NOT_SUPPORTED;
|
---|
2890 | #endif
|
---|
2891 | }
|
---|
2892 |
|
---|
2893 |
|
---|
2894 | /* SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW 1188 */
|
---|
2895 | static int vmsvga3dCmdDXDestroyRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2896 | {
|
---|
2897 | #ifdef VMSVGA3D_DX
|
---|
2898 | //DEBUG_BREAKPOINT_TEST();
|
---|
2899 | RT_NOREF(cbCmd);
|
---|
2900 | return vmsvga3dDXDestroyRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2901 | #else
|
---|
2902 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2903 | return VERR_NOT_SUPPORTED;
|
---|
2904 | #endif
|
---|
2905 | }
|
---|
2906 |
|
---|
2907 |
|
---|
2908 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW 1189 */
|
---|
2909 | static int vmsvga3dCmdDXDefineDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
2910 | {
|
---|
2911 | #ifdef VMSVGA3D_DX
|
---|
2912 | //DEBUG_BREAKPOINT_TEST();
|
---|
2913 | RT_NOREF(cbCmd);
|
---|
2914 | SVGA3dCmdDXDefineDepthStencilView_v2 cmd;
|
---|
2915 | cmd.depthStencilViewId = pCmd->depthStencilViewId;
|
---|
2916 | cmd.sid = pCmd->sid;
|
---|
2917 | cmd.format = pCmd->format;
|
---|
2918 | cmd.resourceDimension = pCmd->resourceDimension;
|
---|
2919 | cmd.mipSlice = pCmd->mipSlice;
|
---|
2920 | cmd.firstArraySlice = pCmd->firstArraySlice;
|
---|
2921 | cmd.arraySize = pCmd->arraySize;
|
---|
2922 | cmd.flags = 0;
|
---|
2923 | return vmsvga3dDXDefineDepthStencilView(pThisCC, idDXContext, &cmd);
|
---|
2924 | #else
|
---|
2925 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2926 | return VERR_NOT_SUPPORTED;
|
---|
2927 | #endif
|
---|
2928 | }
|
---|
2929 |
|
---|
2930 |
|
---|
2931 | /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW 1190 */
|
---|
2932 | static int vmsvga3dCmdDXDestroyDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
2933 | {
|
---|
2934 | #ifdef VMSVGA3D_DX
|
---|
2935 | //DEBUG_BREAKPOINT_TEST();
|
---|
2936 | RT_NOREF(cbCmd);
|
---|
2937 | return vmsvga3dDXDestroyDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
2938 | #else
|
---|
2939 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2940 | return VERR_NOT_SUPPORTED;
|
---|
2941 | #endif
|
---|
2942 | }
|
---|
2943 |
|
---|
2944 |
|
---|
2945 | /* SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT 1191 */
|
---|
2946 | static int vmsvga3dCmdDXDefineElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineElementLayout const *pCmd, uint32_t cbCmd)
|
---|
2947 | {
|
---|
2948 | #ifdef VMSVGA3D_DX
|
---|
2949 | //DEBUG_BREAKPOINT_TEST();
|
---|
2950 | SVGA3dInputElementDesc const *paDesc = (SVGA3dInputElementDesc *)&pCmd[1];
|
---|
2951 | uint32_t const cDesc = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dInputElementDesc);
|
---|
2952 | return vmsvga3dDXDefineElementLayout(pThisCC, idDXContext, pCmd->elementLayoutId, cDesc, paDesc);
|
---|
2953 | #else
|
---|
2954 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2955 | return VERR_NOT_SUPPORTED;
|
---|
2956 | #endif
|
---|
2957 | }
|
---|
2958 |
|
---|
2959 |
|
---|
2960 | /* SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT 1192 */
|
---|
2961 | static int vmsvga3dCmdDXDestroyElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyElementLayout const *pCmd, uint32_t cbCmd)
|
---|
2962 | {
|
---|
2963 | #ifdef VMSVGA3D_DX
|
---|
2964 | //DEBUG_BREAKPOINT_TEST();
|
---|
2965 | RT_NOREF(cbCmd);
|
---|
2966 | return vmsvga3dDXDestroyElementLayout(pThisCC, idDXContext, pCmd);
|
---|
2967 | #else
|
---|
2968 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2969 | return VERR_NOT_SUPPORTED;
|
---|
2970 | #endif
|
---|
2971 | }
|
---|
2972 |
|
---|
2973 |
|
---|
2974 | /* SVGA_3D_CMD_DX_DEFINE_BLEND_STATE 1193 */
|
---|
2975 | static int vmsvga3dCmdDXDefineBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineBlendState const *pCmd, uint32_t cbCmd)
|
---|
2976 | {
|
---|
2977 | #ifdef VMSVGA3D_DX
|
---|
2978 | //DEBUG_BREAKPOINT_TEST();
|
---|
2979 | RT_NOREF(cbCmd);
|
---|
2980 | return vmsvga3dDXDefineBlendState(pThisCC, idDXContext, pCmd);
|
---|
2981 | #else
|
---|
2982 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2983 | return VERR_NOT_SUPPORTED;
|
---|
2984 | #endif
|
---|
2985 | }
|
---|
2986 |
|
---|
2987 |
|
---|
2988 | /* SVGA_3D_CMD_DX_DESTROY_BLEND_STATE 1194 */
|
---|
2989 | static int vmsvga3dCmdDXDestroyBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyBlendState const *pCmd, uint32_t cbCmd)
|
---|
2990 | {
|
---|
2991 | #ifdef VMSVGA3D_DX
|
---|
2992 | DEBUG_BREAKPOINT_TEST();
|
---|
2993 | RT_NOREF(cbCmd);
|
---|
2994 | return vmsvga3dDXDestroyBlendState(pThisCC, idDXContext, pCmd);
|
---|
2995 | #else
|
---|
2996 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2997 | return VERR_NOT_SUPPORTED;
|
---|
2998 | #endif
|
---|
2999 | }
|
---|
3000 |
|
---|
3001 |
|
---|
3002 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE 1195 */
|
---|
3003 | static int vmsvga3dCmdDXDefineDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
3004 | {
|
---|
3005 | #ifdef VMSVGA3D_DX
|
---|
3006 | //DEBUG_BREAKPOINT_TEST();
|
---|
3007 | RT_NOREF(cbCmd);
|
---|
3008 | return vmsvga3dDXDefineDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
3009 | #else
|
---|
3010 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3011 | return VERR_NOT_SUPPORTED;
|
---|
3012 | #endif
|
---|
3013 | }
|
---|
3014 |
|
---|
3015 |
|
---|
3016 | /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE 1196 */
|
---|
3017 | static int vmsvga3dCmdDXDestroyDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
3018 | {
|
---|
3019 | #ifdef VMSVGA3D_DX
|
---|
3020 | DEBUG_BREAKPOINT_TEST();
|
---|
3021 | RT_NOREF(cbCmd);
|
---|
3022 | return vmsvga3dDXDestroyDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
3023 | #else
|
---|
3024 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3025 | return VERR_NOT_SUPPORTED;
|
---|
3026 | #endif
|
---|
3027 | }
|
---|
3028 |
|
---|
3029 |
|
---|
3030 | /* SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE 1197 */
|
---|
3031 | static int vmsvga3dCmdDXDefineRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
3032 | {
|
---|
3033 | #ifdef VMSVGA3D_DX
|
---|
3034 | //DEBUG_BREAKPOINT_TEST();
|
---|
3035 | RT_NOREF(cbCmd);
|
---|
3036 | return vmsvga3dDXDefineRasterizerState(pThisCC, idDXContext, pCmd);
|
---|
3037 | #else
|
---|
3038 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3039 | return VERR_NOT_SUPPORTED;
|
---|
3040 | #endif
|
---|
3041 | }
|
---|
3042 |
|
---|
3043 |
|
---|
3044 | /* SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE 1198 */
|
---|
3045 | static int vmsvga3dCmdDXDestroyRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
3046 | {
|
---|
3047 | #ifdef VMSVGA3D_DX
|
---|
3048 | DEBUG_BREAKPOINT_TEST();
|
---|
3049 | RT_NOREF(cbCmd);
|
---|
3050 | return vmsvga3dDXDestroyRasterizerState(pThisCC, idDXContext, pCmd);
|
---|
3051 | #else
|
---|
3052 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3053 | return VERR_NOT_SUPPORTED;
|
---|
3054 | #endif
|
---|
3055 | }
|
---|
3056 |
|
---|
3057 |
|
---|
3058 | /* SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE 1199 */
|
---|
3059 | static int vmsvga3dCmdDXDefineSamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineSamplerState const *pCmd, uint32_t cbCmd)
|
---|
3060 | {
|
---|
3061 | #ifdef VMSVGA3D_DX
|
---|
3062 | //DEBUG_BREAKPOINT_TEST();
|
---|
3063 | RT_NOREF(cbCmd);
|
---|
3064 | return vmsvga3dDXDefineSamplerState(pThisCC, idDXContext, pCmd);
|
---|
3065 | #else
|
---|
3066 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3067 | return VERR_NOT_SUPPORTED;
|
---|
3068 | #endif
|
---|
3069 | }
|
---|
3070 |
|
---|
3071 |
|
---|
3072 | /* SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE 1200 */
|
---|
3073 | static int vmsvga3dCmdDXDestroySamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroySamplerState const *pCmd, uint32_t cbCmd)
|
---|
3074 | {
|
---|
3075 | #ifdef VMSVGA3D_DX
|
---|
3076 | DEBUG_BREAKPOINT_TEST();
|
---|
3077 | RT_NOREF(cbCmd);
|
---|
3078 | return vmsvga3dDXDestroySamplerState(pThisCC, idDXContext, pCmd);
|
---|
3079 | #else
|
---|
3080 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3081 | return VERR_NOT_SUPPORTED;
|
---|
3082 | #endif
|
---|
3083 | }
|
---|
3084 |
|
---|
3085 |
|
---|
3086 | /* SVGA_3D_CMD_DX_DEFINE_SHADER 1201 */
|
---|
3087 | static int vmsvga3dCmdDXDefineShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShader const *pCmd, uint32_t cbCmd)
|
---|
3088 | {
|
---|
3089 | #ifdef VMSVGA3D_DX
|
---|
3090 | //DEBUG_BREAKPOINT_TEST();
|
---|
3091 | RT_NOREF(cbCmd);
|
---|
3092 | return vmsvga3dDXDefineShader(pThisCC, idDXContext, pCmd);
|
---|
3093 | #else
|
---|
3094 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3095 | return VERR_NOT_SUPPORTED;
|
---|
3096 | #endif
|
---|
3097 | }
|
---|
3098 |
|
---|
3099 |
|
---|
3100 | /* SVGA_3D_CMD_DX_DESTROY_SHADER 1202 */
|
---|
3101 | static int vmsvga3dCmdDXDestroyShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShader const *pCmd, uint32_t cbCmd)
|
---|
3102 | {
|
---|
3103 | #ifdef VMSVGA3D_DX
|
---|
3104 | //DEBUG_BREAKPOINT_TEST();
|
---|
3105 | RT_NOREF(cbCmd);
|
---|
3106 | return vmsvga3dDXDestroyShader(pThisCC, idDXContext, pCmd);
|
---|
3107 | #else
|
---|
3108 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3109 | return VERR_NOT_SUPPORTED;
|
---|
3110 | #endif
|
---|
3111 | }
|
---|
3112 |
|
---|
3113 |
|
---|
3114 | /* SVGA_3D_CMD_DX_BIND_SHADER 1203 */
|
---|
3115 | static int vmsvga3dCmdDXBindShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindShader const *pCmd, uint32_t cbCmd)
|
---|
3116 | {
|
---|
3117 | #ifdef VMSVGA3D_DX
|
---|
3118 | //DEBUG_BREAKPOINT_TEST();
|
---|
3119 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3120 | RT_NOREF(idDXContext, cbCmd);
|
---|
3121 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
3122 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
3123 | return vmsvga3dDXBindShader(pThisCC, pCmd, pMob);
|
---|
3124 | #else
|
---|
3125 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3126 | return VERR_NOT_SUPPORTED;
|
---|
3127 | #endif
|
---|
3128 | }
|
---|
3129 |
|
---|
3130 |
|
---|
3131 | /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT 1204 */
|
---|
3132 | static int vmsvga3dCmdDXDefineStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3133 | {
|
---|
3134 | #ifdef VMSVGA3D_DX
|
---|
3135 | //DEBUG_BREAKPOINT_TEST();
|
---|
3136 | RT_NOREF(cbCmd);
|
---|
3137 | return vmsvga3dDXDefineStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3138 | #else
|
---|
3139 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3140 | return VERR_NOT_SUPPORTED;
|
---|
3141 | #endif
|
---|
3142 | }
|
---|
3143 |
|
---|
3144 |
|
---|
3145 | /* SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT 1205 */
|
---|
3146 | static int vmsvga3dCmdDXDestroyStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3147 | {
|
---|
3148 | #ifdef VMSVGA3D_DX
|
---|
3149 | //DEBUG_BREAKPOINT_TEST();
|
---|
3150 | RT_NOREF(cbCmd);
|
---|
3151 | return vmsvga3dDXDestroyStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3152 | #else
|
---|
3153 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3154 | return VERR_NOT_SUPPORTED;
|
---|
3155 | #endif
|
---|
3156 | }
|
---|
3157 |
|
---|
3158 |
|
---|
3159 | /* SVGA_3D_CMD_DX_SET_STREAMOUTPUT 1206 */
|
---|
3160 | static int vmsvga3dCmdDXSetStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3161 | {
|
---|
3162 | #ifdef VMSVGA3D_DX
|
---|
3163 | //DEBUG_BREAKPOINT_TEST();
|
---|
3164 | RT_NOREF(cbCmd);
|
---|
3165 | return vmsvga3dDXSetStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3166 | #else
|
---|
3167 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3168 | return VERR_NOT_SUPPORTED;
|
---|
3169 | #endif
|
---|
3170 | }
|
---|
3171 |
|
---|
3172 |
|
---|
3173 | /* SVGA_3D_CMD_DX_SET_COTABLE 1207 */
|
---|
3174 | static int vmsvga3dCmdDXSetCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXSetCOTable const *pCmd, uint32_t cbCmd)
|
---|
3175 | {
|
---|
3176 | #ifdef VMSVGA3D_DX
|
---|
3177 | //DEBUG_BREAKPOINT_TEST();
|
---|
3178 | RT_NOREF(cbCmd);
|
---|
3179 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3180 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
3181 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
3182 | return vmsvga3dDXSetCOTable(pThisCC, pCmd, pMob);
|
---|
3183 | #else
|
---|
3184 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3185 | return VERR_NOT_SUPPORTED;
|
---|
3186 | #endif
|
---|
3187 | }
|
---|
3188 |
|
---|
3189 |
|
---|
3190 | /* SVGA_3D_CMD_DX_READBACK_COTABLE 1208 */
|
---|
3191 | static int vmsvga3dCmdDXReadbackCOTable(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackCOTable const *pCmd, uint32_t cbCmd)
|
---|
3192 | {
|
---|
3193 | #ifdef VMSVGA3D_DX
|
---|
3194 | //DEBUG_BREAKPOINT_TEST();
|
---|
3195 | RT_NOREF(idDXContext, cbCmd);
|
---|
3196 | return vmsvga3dDXReadbackCOTable(pThisCC, pCmd);
|
---|
3197 | #else
|
---|
3198 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3199 | return VERR_NOT_SUPPORTED;
|
---|
3200 | #endif
|
---|
3201 | }
|
---|
3202 |
|
---|
3203 |
|
---|
3204 | /* SVGA_3D_CMD_DX_BUFFER_COPY 1209 */
|
---|
3205 | static int vmsvga3dCmdDXBufferCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBufferCopy const *pCmd, uint32_t cbCmd)
|
---|
3206 | {
|
---|
3207 | #ifdef VMSVGA3D_DX
|
---|
3208 | //DEBUG_BREAKPOINT_TEST();
|
---|
3209 | RT_NOREF(idDXContext, cbCmd);
|
---|
3210 |
|
---|
3211 | int rc;
|
---|
3212 |
|
---|
3213 | /** @todo Backend should o the copy is both buffers have a hardware resource. */
|
---|
3214 | SVGA3dSurfaceImageId imageBufferSrc;
|
---|
3215 | imageBufferSrc.sid = pCmd->src;
|
---|
3216 | imageBufferSrc.face = 0;
|
---|
3217 | imageBufferSrc.mipmap = 0;
|
---|
3218 |
|
---|
3219 | SVGA3dSurfaceImageId imageBufferDest;
|
---|
3220 | imageBufferDest.sid = pCmd->dest;
|
---|
3221 | imageBufferDest.face = 0;
|
---|
3222 | imageBufferDest.mipmap = 0;
|
---|
3223 |
|
---|
3224 | /*
|
---|
3225 | * Map the source buffer.
|
---|
3226 | */
|
---|
3227 | VMSVGA3D_MAPPED_SURFACE mapBufferSrc;
|
---|
3228 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBufferSrc, NULL, VMSVGA3D_SURFACE_MAP_READ, &mapBufferSrc);
|
---|
3229 | if (RT_SUCCESS(rc))
|
---|
3230 | {
|
---|
3231 | /*
|
---|
3232 | * Map the destination buffer.
|
---|
3233 | */
|
---|
3234 | VMSVGA3D_MAPPED_SURFACE mapBufferDest;
|
---|
3235 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBufferDest, NULL, VMSVGA3D_SURFACE_MAP_WRITE, &mapBufferDest);
|
---|
3236 | if (RT_SUCCESS(rc))
|
---|
3237 | {
|
---|
3238 | /*
|
---|
3239 | * Copy the source buffer to the destination.
|
---|
3240 | */
|
---|
3241 | uint8_t const *pu8BufferSrc = (uint8_t *)mapBufferSrc.pvData;
|
---|
3242 | uint32_t const cbBufferSrc = mapBufferSrc.box.w * mapBufferSrc.cbPixel;
|
---|
3243 |
|
---|
3244 | uint8_t *pu8BufferDest = (uint8_t *)mapBufferDest.pvData;
|
---|
3245 | uint32_t const cbBufferDest = mapBufferDest.box.w * mapBufferDest.cbPixel;
|
---|
3246 |
|
---|
3247 | if ( pCmd->srcX < cbBufferSrc
|
---|
3248 | && pCmd->width <= cbBufferSrc- pCmd->srcX
|
---|
3249 | && pCmd->destX < cbBufferDest
|
---|
3250 | && pCmd->width <= cbBufferDest - pCmd->destX)
|
---|
3251 | {
|
---|
3252 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
3253 |
|
---|
3254 | memcpy(&pu8BufferDest[pCmd->destX], &pu8BufferSrc[pCmd->srcX], pCmd->width);
|
---|
3255 | }
|
---|
3256 | else
|
---|
3257 | ASSERT_GUEST_FAILED_STMT(rc = VERR_INVALID_PARAMETER);
|
---|
3258 |
|
---|
3259 | vmsvga3dSurfaceUnmap(pThisCC, &imageBufferDest, &mapBufferDest, true);
|
---|
3260 | }
|
---|
3261 |
|
---|
3262 | vmsvga3dSurfaceUnmap(pThisCC, &imageBufferSrc, &mapBufferSrc, false);
|
---|
3263 | }
|
---|
3264 |
|
---|
3265 | return rc;
|
---|
3266 | #else
|
---|
3267 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3268 | return VERR_NOT_SUPPORTED;
|
---|
3269 | #endif
|
---|
3270 | }
|
---|
3271 |
|
---|
3272 |
|
---|
3273 | /* SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER 1210 */
|
---|
3274 | static int vmsvga3dCmdDXTransferFromBuffer(PVGASTATECC pThisCC, SVGA3dCmdDXTransferFromBuffer const *pCmd, uint32_t cbCmd)
|
---|
3275 | {
|
---|
3276 | #ifdef VMSVGA3D_DX
|
---|
3277 | //DEBUG_BREAKPOINT_TEST();
|
---|
3278 | RT_NOREF(cbCmd);
|
---|
3279 |
|
---|
3280 | /* Plan:
|
---|
3281 | * - map the buffer;
|
---|
3282 | * - map the surface;
|
---|
3283 | * - copy from buffer map to the surface map.
|
---|
3284 | */
|
---|
3285 |
|
---|
3286 | int rc;
|
---|
3287 |
|
---|
3288 | SVGA3dSurfaceImageId imageBuffer;
|
---|
3289 | imageBuffer.sid = pCmd->srcSid;
|
---|
3290 | imageBuffer.face = 0;
|
---|
3291 | imageBuffer.mipmap = 0;
|
---|
3292 |
|
---|
3293 | SVGA3dSurfaceImageId imageSurface;
|
---|
3294 | imageSurface.sid = pCmd->destSid;
|
---|
3295 | rc = vmsvga3dCalcSurfaceMipmapAndFace(pThisCC, pCmd->destSid, pCmd->destSubResource, &imageSurface.mipmap, &imageSurface.face);
|
---|
3296 | AssertRCReturn(rc, rc);
|
---|
3297 |
|
---|
3298 | /*
|
---|
3299 | * Map the buffer.
|
---|
3300 | */
|
---|
3301 | VMSVGA3D_MAPPED_SURFACE mapBuffer;
|
---|
3302 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBuffer, NULL, VMSVGA3D_SURFACE_MAP_READ, &mapBuffer);
|
---|
3303 | if (RT_SUCCESS(rc))
|
---|
3304 | {
|
---|
3305 | /*
|
---|
3306 | * Map the surface.
|
---|
3307 | */
|
---|
3308 | VMSVGA3D_MAPPED_SURFACE mapSurface;
|
---|
3309 | rc = vmsvga3dSurfaceMap(pThisCC, &imageSurface, &pCmd->destBox, VMSVGA3D_SURFACE_MAP_WRITE, &mapSurface);
|
---|
3310 | if (RT_SUCCESS(rc))
|
---|
3311 | {
|
---|
3312 | /*
|
---|
3313 | * Copy the mapped buffer to the surface.
|
---|
3314 | */
|
---|
3315 | uint8_t const *pu8Buffer = (uint8_t *)mapBuffer.pvData;
|
---|
3316 | uint32_t const cbBuffer = mapBuffer.box.w * mapBuffer.cbPixel;
|
---|
3317 |
|
---|
3318 | if (pCmd->srcOffset <= cbBuffer)
|
---|
3319 | {
|
---|
3320 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
3321 | uint8_t const *pu8BufferBegin = pu8Buffer;
|
---|
3322 | uint8_t const *pu8BufferEnd = pu8Buffer + cbBuffer;
|
---|
3323 |
|
---|
3324 | pu8Buffer += pCmd->srcOffset;
|
---|
3325 |
|
---|
3326 | uint8_t *pu8Surface = (uint8_t *)mapSurface.pvData;
|
---|
3327 |
|
---|
3328 | uint32_t const cbWidth = mapSurface.box.w * mapSurface.cbPixel;
|
---|
3329 | for (uint32_t z = 0; z < mapSurface.box.d && RT_SUCCESS(rc); ++z)
|
---|
3330 | {
|
---|
3331 | uint8_t const *pu8BufferRow = pu8Buffer;
|
---|
3332 | uint8_t *pu8SurfaceRow = pu8Surface;
|
---|
3333 | for (uint32_t y = 0; y < mapSurface.box.h; ++y)
|
---|
3334 | {
|
---|
3335 | ASSERT_GUEST_STMT_BREAK( (uintptr_t)pu8BufferRow >= (uintptr_t)pu8BufferBegin
|
---|
3336 | && (uintptr_t)pu8BufferRow < (uintptr_t)pu8BufferEnd
|
---|
3337 | && (uintptr_t)(pu8BufferRow + cbWidth) > (uintptr_t)pu8BufferBegin
|
---|
3338 | && (uintptr_t)(pu8BufferRow + cbWidth) <= (uintptr_t)pu8BufferEnd,
|
---|
3339 | rc = VERR_INVALID_PARAMETER);
|
---|
3340 |
|
---|
3341 | memcpy(pu8SurfaceRow, pu8BufferRow, cbWidth);
|
---|
3342 |
|
---|
3343 | pu8SurfaceRow += mapSurface.cbRowPitch;
|
---|
3344 | pu8BufferRow += pCmd->srcPitch;
|
---|
3345 | }
|
---|
3346 |
|
---|
3347 | pu8Buffer += pCmd->srcSlicePitch;
|
---|
3348 | pu8Surface += mapSurface.cbDepthPitch;
|
---|
3349 | }
|
---|
3350 | }
|
---|
3351 | else
|
---|
3352 | ASSERT_GUEST_FAILED_STMT(rc = VERR_INVALID_PARAMETER);
|
---|
3353 |
|
---|
3354 | vmsvga3dSurfaceUnmap(pThisCC, &imageSurface, &mapSurface, true);
|
---|
3355 | }
|
---|
3356 |
|
---|
3357 | vmsvga3dSurfaceUnmap(pThisCC, &imageBuffer, &mapBuffer, false);
|
---|
3358 | }
|
---|
3359 |
|
---|
3360 | return rc;
|
---|
3361 | #else
|
---|
3362 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3363 | return VERR_NOT_SUPPORTED;
|
---|
3364 | #endif
|
---|
3365 | }
|
---|
3366 |
|
---|
3367 |
|
---|
3368 | /* SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK 1211 */
|
---|
3369 | static int vmsvga3dCmdDXSurfaceCopyAndReadback(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSurfaceCopyAndReadback const *pCmd, uint32_t cbCmd)
|
---|
3370 | {
|
---|
3371 | #ifdef VMSVGA3D_DX
|
---|
3372 | DEBUG_BREAKPOINT_TEST();
|
---|
3373 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3374 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3375 | return vmsvga3dDXSurfaceCopyAndReadback(pThisCC, idDXContext);
|
---|
3376 | #else
|
---|
3377 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3378 | return VERR_NOT_SUPPORTED;
|
---|
3379 | #endif
|
---|
3380 | }
|
---|
3381 |
|
---|
3382 |
|
---|
3383 | /* SVGA_3D_CMD_DX_MOVE_QUERY 1212 */
|
---|
3384 | static int vmsvga3dCmdDXMoveQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXMoveQuery const *pCmd, uint32_t cbCmd)
|
---|
3385 | {
|
---|
3386 | #ifdef VMSVGA3D_DX
|
---|
3387 | DEBUG_BREAKPOINT_TEST();
|
---|
3388 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3389 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3390 | return vmsvga3dDXMoveQuery(pThisCC, idDXContext);
|
---|
3391 | #else
|
---|
3392 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3393 | return VERR_NOT_SUPPORTED;
|
---|
3394 | #endif
|
---|
3395 | }
|
---|
3396 |
|
---|
3397 |
|
---|
3398 | /* SVGA_3D_CMD_DX_BIND_ALL_QUERY 1213 */
|
---|
3399 | static int vmsvga3dCmdDXBindAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindAllQuery const *pCmd, uint32_t cbCmd)
|
---|
3400 | {
|
---|
3401 | #ifdef VMSVGA3D_DX
|
---|
3402 | //DEBUG_BREAKPOINT_TEST();
|
---|
3403 | RT_NOREF(cbCmd);
|
---|
3404 | return vmsvga3dDXBindAllQuery(pThisCC, idDXContext, pCmd);
|
---|
3405 | #else
|
---|
3406 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3407 | return VERR_NOT_SUPPORTED;
|
---|
3408 | #endif
|
---|
3409 | }
|
---|
3410 |
|
---|
3411 |
|
---|
3412 | /* SVGA_3D_CMD_DX_READBACK_ALL_QUERY 1214 */
|
---|
3413 | static int vmsvga3dCmdDXReadbackAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackAllQuery const *pCmd, uint32_t cbCmd)
|
---|
3414 | {
|
---|
3415 | #ifdef VMSVGA3D_DX
|
---|
3416 | //DEBUG_BREAKPOINT_TEST();
|
---|
3417 | RT_NOREF(cbCmd);
|
---|
3418 | return vmsvga3dDXReadbackAllQuery(pThisCC, idDXContext, pCmd);
|
---|
3419 | #else
|
---|
3420 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3421 | return VERR_NOT_SUPPORTED;
|
---|
3422 | #endif
|
---|
3423 | }
|
---|
3424 |
|
---|
3425 |
|
---|
3426 | /* SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER 1215 */
|
---|
3427 | static int vmsvga3dCmdDXPredTransferFromBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredTransferFromBuffer const *pCmd, uint32_t cbCmd)
|
---|
3428 | {
|
---|
3429 | #ifdef VMSVGA3D_DX
|
---|
3430 | //DEBUG_BREAKPOINT_TEST();
|
---|
3431 | RT_NOREF(idDXContext, cbCmd);
|
---|
3432 |
|
---|
3433 | /* This command is executed in a context: "The context is implied from the command buffer header."
|
---|
3434 | * However the device design allows to do the transfer without a context, so re-use context-less command handler.
|
---|
3435 | */
|
---|
3436 | SVGA3dCmdDXTransferFromBuffer cmd;
|
---|
3437 | cmd.srcSid = pCmd->srcSid;
|
---|
3438 | cmd.srcOffset = pCmd->srcOffset;
|
---|
3439 | cmd.srcPitch = pCmd->srcPitch;
|
---|
3440 | cmd.srcSlicePitch = pCmd->srcSlicePitch;
|
---|
3441 | cmd.destSid = pCmd->destSid;
|
---|
3442 | cmd.destSubResource = pCmd->destSubResource;
|
---|
3443 | cmd.destBox = pCmd->destBox;
|
---|
3444 | return vmsvga3dCmdDXTransferFromBuffer(pThisCC, &cmd, sizeof(cmd));
|
---|
3445 | #else
|
---|
3446 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3447 | return VERR_NOT_SUPPORTED;
|
---|
3448 | #endif
|
---|
3449 | }
|
---|
3450 |
|
---|
3451 |
|
---|
3452 | /* SVGA_3D_CMD_DX_MOB_FENCE_64 1216 */
|
---|
3453 | static int vmsvga3dCmdDXMobFence64(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXMobFence64 const *pCmd, uint32_t cbCmd)
|
---|
3454 | {
|
---|
3455 | #ifdef VMSVGA3D_DX
|
---|
3456 | DEBUG_BREAKPOINT_TEST();
|
---|
3457 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3458 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3459 | return vmsvga3dDXMobFence64(pThisCC, idDXContext);
|
---|
3460 | #else
|
---|
3461 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3462 | return VERR_NOT_SUPPORTED;
|
---|
3463 | #endif
|
---|
3464 | }
|
---|
3465 |
|
---|
3466 |
|
---|
3467 | /* SVGA_3D_CMD_DX_BIND_ALL_SHADER 1217 */
|
---|
3468 | static int vmsvga3dCmdDXBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindAllShader const *pCmd, uint32_t cbCmd)
|
---|
3469 | {
|
---|
3470 | #ifdef VMSVGA3D_DX
|
---|
3471 | DEBUG_BREAKPOINT_TEST();
|
---|
3472 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3473 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3474 | return vmsvga3dDXBindAllShader(pThisCC, idDXContext);
|
---|
3475 | #else
|
---|
3476 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3477 | return VERR_NOT_SUPPORTED;
|
---|
3478 | #endif
|
---|
3479 | }
|
---|
3480 |
|
---|
3481 |
|
---|
3482 | /* SVGA_3D_CMD_DX_HINT 1218 */
|
---|
3483 | static int vmsvga3dCmdDXHint(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXHint const *pCmd, uint32_t cbCmd)
|
---|
3484 | {
|
---|
3485 | #ifdef VMSVGA3D_DX
|
---|
3486 | DEBUG_BREAKPOINT_TEST();
|
---|
3487 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3488 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3489 | return vmsvga3dDXHint(pThisCC, idDXContext);
|
---|
3490 | #else
|
---|
3491 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3492 | return VERR_NOT_SUPPORTED;
|
---|
3493 | #endif
|
---|
3494 | }
|
---|
3495 |
|
---|
3496 |
|
---|
3497 | /* SVGA_3D_CMD_DX_BUFFER_UPDATE 1219 */
|
---|
3498 | static int vmsvga3dCmdDXBufferUpdate(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBufferUpdate const *pCmd, uint32_t cbCmd)
|
---|
3499 | {
|
---|
3500 | #ifdef VMSVGA3D_DX
|
---|
3501 | DEBUG_BREAKPOINT_TEST();
|
---|
3502 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3503 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3504 | return vmsvga3dDXBufferUpdate(pThisCC, idDXContext);
|
---|
3505 | #else
|
---|
3506 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3507 | return VERR_NOT_SUPPORTED;
|
---|
3508 | #endif
|
---|
3509 | }
|
---|
3510 |
|
---|
3511 |
|
---|
3512 | /* SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET 1220 */
|
---|
3513 | static int vmsvga3dCmdDXSetVSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetVSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3514 | {
|
---|
3515 | #ifdef VMSVGA3D_DX
|
---|
3516 | DEBUG_BREAKPOINT_TEST();
|
---|
3517 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3518 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3519 | return vmsvga3dDXSetVSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3520 | #else
|
---|
3521 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3522 | return VERR_NOT_SUPPORTED;
|
---|
3523 | #endif
|
---|
3524 | }
|
---|
3525 |
|
---|
3526 |
|
---|
3527 | /* SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET 1221 */
|
---|
3528 | static int vmsvga3dCmdDXSetPSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetPSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3529 | {
|
---|
3530 | #ifdef VMSVGA3D_DX
|
---|
3531 | DEBUG_BREAKPOINT_TEST();
|
---|
3532 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3533 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3534 | return vmsvga3dDXSetPSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3535 | #else
|
---|
3536 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3537 | return VERR_NOT_SUPPORTED;
|
---|
3538 | #endif
|
---|
3539 | }
|
---|
3540 |
|
---|
3541 |
|
---|
3542 | /* SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET 1222 */
|
---|
3543 | static int vmsvga3dCmdDXSetGSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetGSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3544 | {
|
---|
3545 | #ifdef VMSVGA3D_DX
|
---|
3546 | DEBUG_BREAKPOINT_TEST();
|
---|
3547 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3548 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3549 | return vmsvga3dDXSetGSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3550 | #else
|
---|
3551 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3552 | return VERR_NOT_SUPPORTED;
|
---|
3553 | #endif
|
---|
3554 | }
|
---|
3555 |
|
---|
3556 |
|
---|
3557 | /* SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET 1223 */
|
---|
3558 | static int vmsvga3dCmdDXSetHSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetHSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3559 | {
|
---|
3560 | #ifdef VMSVGA3D_DX
|
---|
3561 | DEBUG_BREAKPOINT_TEST();
|
---|
3562 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3563 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3564 | return vmsvga3dDXSetHSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3565 | #else
|
---|
3566 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3567 | return VERR_NOT_SUPPORTED;
|
---|
3568 | #endif
|
---|
3569 | }
|
---|
3570 |
|
---|
3571 |
|
---|
3572 | /* SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET 1224 */
|
---|
3573 | static int vmsvga3dCmdDXSetDSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetDSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3574 | {
|
---|
3575 | #ifdef VMSVGA3D_DX
|
---|
3576 | DEBUG_BREAKPOINT_TEST();
|
---|
3577 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3578 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3579 | return vmsvga3dDXSetDSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3580 | #else
|
---|
3581 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3582 | return VERR_NOT_SUPPORTED;
|
---|
3583 | #endif
|
---|
3584 | }
|
---|
3585 |
|
---|
3586 |
|
---|
3587 | /* SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET 1225 */
|
---|
3588 | static int vmsvga3dCmdDXSetCSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetCSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3589 | {
|
---|
3590 | #ifdef VMSVGA3D_DX
|
---|
3591 | DEBUG_BREAKPOINT_TEST();
|
---|
3592 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3593 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3594 | return vmsvga3dDXSetCSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3595 | #else
|
---|
3596 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3597 | return VERR_NOT_SUPPORTED;
|
---|
3598 | #endif
|
---|
3599 | }
|
---|
3600 |
|
---|
3601 |
|
---|
3602 | /* SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER 1226 */
|
---|
3603 | static int vmsvga3dCmdDXCondBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXCondBindAllShader const *pCmd, uint32_t cbCmd)
|
---|
3604 | {
|
---|
3605 | #ifdef VMSVGA3D_DX
|
---|
3606 | DEBUG_BREAKPOINT_TEST();
|
---|
3607 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3608 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3609 | return vmsvga3dDXCondBindAllShader(pThisCC, idDXContext);
|
---|
3610 | #else
|
---|
3611 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3612 | return VERR_NOT_SUPPORTED;
|
---|
3613 | #endif
|
---|
3614 | }
|
---|
3615 |
|
---|
3616 |
|
---|
3617 | /* SVGA_3D_CMD_SCREEN_COPY 1227 */
|
---|
3618 | static int vmsvga3dCmdScreenCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdScreenCopy const *pCmd, uint32_t cbCmd)
|
---|
3619 | {
|
---|
3620 | #ifdef VMSVGA3D_DX
|
---|
3621 | DEBUG_BREAKPOINT_TEST();
|
---|
3622 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3623 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3624 | return vmsvga3dScreenCopy(pThisCC, idDXContext);
|
---|
3625 | #else
|
---|
3626 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3627 | return VERR_NOT_SUPPORTED;
|
---|
3628 | #endif
|
---|
3629 | }
|
---|
3630 |
|
---|
3631 |
|
---|
3632 | /* SVGA_3D_CMD_GROW_OTABLE 1236 */
|
---|
3633 | static int vmsvga3dCmdGrowOTable(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdGrowOTable const *pCmd, uint32_t cbCmd)
|
---|
3634 | {
|
---|
3635 | #ifdef VMSVGA3D_DX
|
---|
3636 | DEBUG_BREAKPOINT_TEST();
|
---|
3637 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3638 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3639 | return vmsvga3dGrowOTable(pThisCC, idDXContext);
|
---|
3640 | #else
|
---|
3641 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3642 | return VERR_NOT_SUPPORTED;
|
---|
3643 | #endif
|
---|
3644 | }
|
---|
3645 |
|
---|
3646 |
|
---|
3647 | /* SVGA_3D_CMD_DX_GROW_COTABLE 1237 */
|
---|
3648 | static int vmsvga3dCmdDXGrowCOTable(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXGrowCOTable const *pCmd, uint32_t cbCmd)
|
---|
3649 | {
|
---|
3650 | #ifdef VMSVGA3D_DX
|
---|
3651 | DEBUG_BREAKPOINT_TEST();
|
---|
3652 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3653 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3654 | return vmsvga3dDXGrowCOTable(pThisCC, idDXContext);
|
---|
3655 | #else
|
---|
3656 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3657 | return VERR_NOT_SUPPORTED;
|
---|
3658 | #endif
|
---|
3659 | }
|
---|
3660 |
|
---|
3661 |
|
---|
3662 | /* SVGA_3D_CMD_INTRA_SURFACE_COPY 1238 */
|
---|
3663 | static int vmsvga3dCmdIntraSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdIntraSurfaceCopy const *pCmd, uint32_t cbCmd)
|
---|
3664 | {
|
---|
3665 | #ifdef VMSVGA3D_DX
|
---|
3666 | DEBUG_BREAKPOINT_TEST();
|
---|
3667 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3668 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3669 | return vmsvga3dIntraSurfaceCopy(pThisCC, idDXContext);
|
---|
3670 | #else
|
---|
3671 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3672 | return VERR_NOT_SUPPORTED;
|
---|
3673 | #endif
|
---|
3674 | }
|
---|
3675 |
|
---|
3676 |
|
---|
3677 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 1239 */
|
---|
3678 | static int vmsvga3dCmdDefineGBSurface_v3(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDefineGBSurface_v3 const *pCmd, uint32_t cbCmd)
|
---|
3679 | {
|
---|
3680 | #ifdef VMSVGA3D_DX
|
---|
3681 | DEBUG_BREAKPOINT_TEST();
|
---|
3682 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3683 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3684 | return vmsvga3dDefineGBSurface_v3(pThisCC, idDXContext);
|
---|
3685 | #else
|
---|
3686 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3687 | return VERR_NOT_SUPPORTED;
|
---|
3688 | #endif
|
---|
3689 | }
|
---|
3690 |
|
---|
3691 |
|
---|
3692 | /* SVGA_3D_CMD_DX_RESOLVE_COPY 1240 */
|
---|
3693 | static int vmsvga3dCmdDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXResolveCopy const *pCmd, uint32_t cbCmd)
|
---|
3694 | {
|
---|
3695 | #ifdef VMSVGA3D_DX
|
---|
3696 | DEBUG_BREAKPOINT_TEST();
|
---|
3697 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3698 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3699 | return vmsvga3dDXResolveCopy(pThisCC, idDXContext);
|
---|
3700 | #else
|
---|
3701 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3702 | return VERR_NOT_SUPPORTED;
|
---|
3703 | #endif
|
---|
3704 | }
|
---|
3705 |
|
---|
3706 |
|
---|
3707 | /* SVGA_3D_CMD_DX_PRED_RESOLVE_COPY 1241 */
|
---|
3708 | static int vmsvga3dCmdDXPredResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredResolveCopy const *pCmd, uint32_t cbCmd)
|
---|
3709 | {
|
---|
3710 | #ifdef VMSVGA3D_DX
|
---|
3711 | DEBUG_BREAKPOINT_TEST();
|
---|
3712 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3713 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3714 | return vmsvga3dDXPredResolveCopy(pThisCC, idDXContext);
|
---|
3715 | #else
|
---|
3716 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3717 | return VERR_NOT_SUPPORTED;
|
---|
3718 | #endif
|
---|
3719 | }
|
---|
3720 |
|
---|
3721 |
|
---|
3722 | /* SVGA_3D_CMD_DX_PRED_CONVERT_REGION 1242 */
|
---|
3723 | static int vmsvga3dCmdDXPredConvertRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredConvertRegion const *pCmd, uint32_t cbCmd)
|
---|
3724 | {
|
---|
3725 | #ifdef VMSVGA3D_DX
|
---|
3726 | DEBUG_BREAKPOINT_TEST();
|
---|
3727 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3728 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3729 | return vmsvga3dDXPredConvertRegion(pThisCC, idDXContext);
|
---|
3730 | #else
|
---|
3731 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3732 | return VERR_NOT_SUPPORTED;
|
---|
3733 | #endif
|
---|
3734 | }
|
---|
3735 |
|
---|
3736 |
|
---|
3737 | /* SVGA_3D_CMD_DX_PRED_CONVERT 1243 */
|
---|
3738 | static int vmsvga3dCmdDXPredConvert(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredConvert const *pCmd, uint32_t cbCmd)
|
---|
3739 | {
|
---|
3740 | #ifdef VMSVGA3D_DX
|
---|
3741 | DEBUG_BREAKPOINT_TEST();
|
---|
3742 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3743 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3744 | return vmsvga3dDXPredConvert(pThisCC, idDXContext);
|
---|
3745 | #else
|
---|
3746 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3747 | return VERR_NOT_SUPPORTED;
|
---|
3748 | #endif
|
---|
3749 | }
|
---|
3750 |
|
---|
3751 |
|
---|
3752 | /* SVGA_3D_CMD_WHOLE_SURFACE_COPY 1244 */
|
---|
3753 | static int vmsvga3dCmdWholeSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdWholeSurfaceCopy const *pCmd, uint32_t cbCmd)
|
---|
3754 | {
|
---|
3755 | #ifdef VMSVGA3D_DX
|
---|
3756 | DEBUG_BREAKPOINT_TEST();
|
---|
3757 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3758 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3759 | return vmsvga3dWholeSurfaceCopy(pThisCC, idDXContext);
|
---|
3760 | #else
|
---|
3761 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3762 | return VERR_NOT_SUPPORTED;
|
---|
3763 | #endif
|
---|
3764 | }
|
---|
3765 |
|
---|
3766 |
|
---|
3767 | /* SVGA_3D_CMD_DX_DEFINE_UA_VIEW 1245 */
|
---|
3768 | static int vmsvga3dCmdDXDefineUAView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineUAView const *pCmd, uint32_t cbCmd)
|
---|
3769 | {
|
---|
3770 | #ifdef VMSVGA3D_DX
|
---|
3771 | DEBUG_BREAKPOINT_TEST();
|
---|
3772 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3773 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3774 | return vmsvga3dDXDefineUAView(pThisCC, idDXContext);
|
---|
3775 | #else
|
---|
3776 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3777 | return VERR_NOT_SUPPORTED;
|
---|
3778 | #endif
|
---|
3779 | }
|
---|
3780 |
|
---|
3781 |
|
---|
3782 | /* SVGA_3D_CMD_DX_DESTROY_UA_VIEW 1246 */
|
---|
3783 | static int vmsvga3dCmdDXDestroyUAView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyUAView const *pCmd, uint32_t cbCmd)
|
---|
3784 | {
|
---|
3785 | #ifdef VMSVGA3D_DX
|
---|
3786 | DEBUG_BREAKPOINT_TEST();
|
---|
3787 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3788 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3789 | return vmsvga3dDXDestroyUAView(pThisCC, idDXContext);
|
---|
3790 | #else
|
---|
3791 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3792 | return VERR_NOT_SUPPORTED;
|
---|
3793 | #endif
|
---|
3794 | }
|
---|
3795 |
|
---|
3796 |
|
---|
3797 | /* SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT 1247 */
|
---|
3798 | static int vmsvga3dCmdDXClearUAViewUint(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearUAViewUint const *pCmd, uint32_t cbCmd)
|
---|
3799 | {
|
---|
3800 | #ifdef VMSVGA3D_DX
|
---|
3801 | DEBUG_BREAKPOINT_TEST();
|
---|
3802 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3803 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3804 | return vmsvga3dDXClearUAViewUint(pThisCC, idDXContext);
|
---|
3805 | #else
|
---|
3806 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3807 | return VERR_NOT_SUPPORTED;
|
---|
3808 | #endif
|
---|
3809 | }
|
---|
3810 |
|
---|
3811 |
|
---|
3812 | /* SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT 1248 */
|
---|
3813 | static int vmsvga3dCmdDXClearUAViewFloat(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearUAViewFloat const *pCmd, uint32_t cbCmd)
|
---|
3814 | {
|
---|
3815 | #ifdef VMSVGA3D_DX
|
---|
3816 | DEBUG_BREAKPOINT_TEST();
|
---|
3817 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3818 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3819 | return vmsvga3dDXClearUAViewFloat(pThisCC, idDXContext);
|
---|
3820 | #else
|
---|
3821 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3822 | return VERR_NOT_SUPPORTED;
|
---|
3823 | #endif
|
---|
3824 | }
|
---|
3825 |
|
---|
3826 |
|
---|
3827 | /* SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT 1249 */
|
---|
3828 | static int vmsvga3dCmdDXCopyStructureCount(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXCopyStructureCount const *pCmd, uint32_t cbCmd)
|
---|
3829 | {
|
---|
3830 | #ifdef VMSVGA3D_DX
|
---|
3831 | DEBUG_BREAKPOINT_TEST();
|
---|
3832 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3833 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3834 | return vmsvga3dDXCopyStructureCount(pThisCC, idDXContext);
|
---|
3835 | #else
|
---|
3836 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3837 | return VERR_NOT_SUPPORTED;
|
---|
3838 | #endif
|
---|
3839 | }
|
---|
3840 |
|
---|
3841 |
|
---|
3842 | /* SVGA_3D_CMD_DX_SET_UA_VIEWS 1250 */
|
---|
3843 | static int vmsvga3dCmdDXSetUAViews(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetUAViews const *pCmd, uint32_t cbCmd)
|
---|
3844 | {
|
---|
3845 | #ifdef VMSVGA3D_DX
|
---|
3846 | DEBUG_BREAKPOINT_TEST();
|
---|
3847 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3848 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3849 | return vmsvga3dDXSetUAViews(pThisCC, idDXContext);
|
---|
3850 | #else
|
---|
3851 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3852 | return VERR_NOT_SUPPORTED;
|
---|
3853 | #endif
|
---|
3854 | }
|
---|
3855 |
|
---|
3856 |
|
---|
3857 | /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT 1251 */
|
---|
3858 | static int vmsvga3dCmdDXDrawIndexedInstancedIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexedInstancedIndirect const *pCmd, uint32_t cbCmd)
|
---|
3859 | {
|
---|
3860 | #ifdef VMSVGA3D_DX
|
---|
3861 | DEBUG_BREAKPOINT_TEST();
|
---|
3862 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3863 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3864 | return vmsvga3dDXDrawIndexedInstancedIndirect(pThisCC, idDXContext);
|
---|
3865 | #else
|
---|
3866 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3867 | return VERR_NOT_SUPPORTED;
|
---|
3868 | #endif
|
---|
3869 | }
|
---|
3870 |
|
---|
3871 |
|
---|
3872 | /* SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT 1252 */
|
---|
3873 | static int vmsvga3dCmdDXDrawInstancedIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawInstancedIndirect const *pCmd, uint32_t cbCmd)
|
---|
3874 | {
|
---|
3875 | #ifdef VMSVGA3D_DX
|
---|
3876 | DEBUG_BREAKPOINT_TEST();
|
---|
3877 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3878 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3879 | return vmsvga3dDXDrawInstancedIndirect(pThisCC, idDXContext);
|
---|
3880 | #else
|
---|
3881 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3882 | return VERR_NOT_SUPPORTED;
|
---|
3883 | #endif
|
---|
3884 | }
|
---|
3885 |
|
---|
3886 |
|
---|
3887 | /* SVGA_3D_CMD_DX_DISPATCH 1253 */
|
---|
3888 | static int vmsvga3dCmdDXDispatch(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDispatch const *pCmd, uint32_t cbCmd)
|
---|
3889 | {
|
---|
3890 | #ifdef VMSVGA3D_DX
|
---|
3891 | DEBUG_BREAKPOINT_TEST();
|
---|
3892 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3893 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3894 | return vmsvga3dDXDispatch(pThisCC, idDXContext);
|
---|
3895 | #else
|
---|
3896 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3897 | return VERR_NOT_SUPPORTED;
|
---|
3898 | #endif
|
---|
3899 | }
|
---|
3900 |
|
---|
3901 |
|
---|
3902 | /* SVGA_3D_CMD_DX_DISPATCH_INDIRECT 1254 */
|
---|
3903 | static int vmsvga3dCmdDXDispatchIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDispatchIndirect const *pCmd, uint32_t cbCmd)
|
---|
3904 | {
|
---|
3905 | #ifdef VMSVGA3D_DX
|
---|
3906 | DEBUG_BREAKPOINT_TEST();
|
---|
3907 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3908 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3909 | return vmsvga3dDXDispatchIndirect(pThisCC, idDXContext);
|
---|
3910 | #else
|
---|
3911 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3912 | return VERR_NOT_SUPPORTED;
|
---|
3913 | #endif
|
---|
3914 | }
|
---|
3915 |
|
---|
3916 |
|
---|
3917 | /* SVGA_3D_CMD_WRITE_ZERO_SURFACE 1255 */
|
---|
3918 | static int vmsvga3dCmdWriteZeroSurface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdWriteZeroSurface const *pCmd, uint32_t cbCmd)
|
---|
3919 | {
|
---|
3920 | #ifdef VMSVGA3D_DX
|
---|
3921 | DEBUG_BREAKPOINT_TEST();
|
---|
3922 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3923 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3924 | return vmsvga3dWriteZeroSurface(pThisCC, idDXContext);
|
---|
3925 | #else
|
---|
3926 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3927 | return VERR_NOT_SUPPORTED;
|
---|
3928 | #endif
|
---|
3929 | }
|
---|
3930 |
|
---|
3931 |
|
---|
3932 | /* SVGA_3D_CMD_HINT_ZERO_SURFACE 1256 */
|
---|
3933 | static int vmsvga3dCmdHintZeroSurface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdHintZeroSurface const *pCmd, uint32_t cbCmd)
|
---|
3934 | {
|
---|
3935 | #ifdef VMSVGA3D_DX
|
---|
3936 | DEBUG_BREAKPOINT_TEST();
|
---|
3937 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3938 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3939 | return vmsvga3dHintZeroSurface(pThisCC, idDXContext);
|
---|
3940 | #else
|
---|
3941 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3942 | return VERR_NOT_SUPPORTED;
|
---|
3943 | #endif
|
---|
3944 | }
|
---|
3945 |
|
---|
3946 |
|
---|
3947 | /* SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER 1257 */
|
---|
3948 | static int vmsvga3dCmdDXTransferToBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXTransferToBuffer const *pCmd, uint32_t cbCmd)
|
---|
3949 | {
|
---|
3950 | #ifdef VMSVGA3D_DX
|
---|
3951 | DEBUG_BREAKPOINT_TEST();
|
---|
3952 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3953 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3954 | return vmsvga3dDXTransferToBuffer(pThisCC, idDXContext);
|
---|
3955 | #else
|
---|
3956 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3957 | return VERR_NOT_SUPPORTED;
|
---|
3958 | #endif
|
---|
3959 | }
|
---|
3960 |
|
---|
3961 |
|
---|
3962 | /* SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT 1258 */
|
---|
3963 | static int vmsvga3dCmdDXSetStructureCount(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetStructureCount const *pCmd, uint32_t cbCmd)
|
---|
3964 | {
|
---|
3965 | #ifdef VMSVGA3D_DX
|
---|
3966 | DEBUG_BREAKPOINT_TEST();
|
---|
3967 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3968 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3969 | return vmsvga3dDXSetStructureCount(pThisCC, idDXContext);
|
---|
3970 | #else
|
---|
3971 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3972 | return VERR_NOT_SUPPORTED;
|
---|
3973 | #endif
|
---|
3974 | }
|
---|
3975 |
|
---|
3976 |
|
---|
3977 | /* SVGA_3D_CMD_LOGICOPS_BITBLT 1259 */
|
---|
3978 | static int vmsvga3dCmdLogicOpsBitBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsBitBlt const *pCmd, uint32_t cbCmd)
|
---|
3979 | {
|
---|
3980 | #ifdef VMSVGA3D_DX
|
---|
3981 | DEBUG_BREAKPOINT_TEST();
|
---|
3982 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3983 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3984 | return vmsvga3dLogicOpsBitBlt(pThisCC, idDXContext);
|
---|
3985 | #else
|
---|
3986 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3987 | return VERR_NOT_SUPPORTED;
|
---|
3988 | #endif
|
---|
3989 | }
|
---|
3990 |
|
---|
3991 |
|
---|
3992 | /* SVGA_3D_CMD_LOGICOPS_TRANSBLT 1260 */
|
---|
3993 | static int vmsvga3dCmdLogicOpsTransBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsTransBlt const *pCmd, uint32_t cbCmd)
|
---|
3994 | {
|
---|
3995 | #ifdef VMSVGA3D_DX
|
---|
3996 | DEBUG_BREAKPOINT_TEST();
|
---|
3997 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3998 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3999 | return vmsvga3dLogicOpsTransBlt(pThisCC, idDXContext);
|
---|
4000 | #else
|
---|
4001 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4002 | return VERR_NOT_SUPPORTED;
|
---|
4003 | #endif
|
---|
4004 | }
|
---|
4005 |
|
---|
4006 |
|
---|
4007 | /* SVGA_3D_CMD_LOGICOPS_STRETCHBLT 1261 */
|
---|
4008 | static int vmsvga3dCmdLogicOpsStretchBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsStretchBlt const *pCmd, uint32_t cbCmd)
|
---|
4009 | {
|
---|
4010 | #ifdef VMSVGA3D_DX
|
---|
4011 | DEBUG_BREAKPOINT_TEST();
|
---|
4012 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4013 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4014 | return vmsvga3dLogicOpsStretchBlt(pThisCC, idDXContext);
|
---|
4015 | #else
|
---|
4016 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4017 | return VERR_NOT_SUPPORTED;
|
---|
4018 | #endif
|
---|
4019 | }
|
---|
4020 |
|
---|
4021 |
|
---|
4022 | /* SVGA_3D_CMD_LOGICOPS_COLORFILL 1262 */
|
---|
4023 | static int vmsvga3dCmdLogicOpsColorFill(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsColorFill const *pCmd, uint32_t cbCmd)
|
---|
4024 | {
|
---|
4025 | #ifdef VMSVGA3D_DX
|
---|
4026 | DEBUG_BREAKPOINT_TEST();
|
---|
4027 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4028 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4029 | return vmsvga3dLogicOpsColorFill(pThisCC, idDXContext);
|
---|
4030 | #else
|
---|
4031 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4032 | return VERR_NOT_SUPPORTED;
|
---|
4033 | #endif
|
---|
4034 | }
|
---|
4035 |
|
---|
4036 |
|
---|
4037 | /* SVGA_3D_CMD_LOGICOPS_ALPHABLEND 1263 */
|
---|
4038 | static int vmsvga3dCmdLogicOpsAlphaBlend(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsAlphaBlend const *pCmd, uint32_t cbCmd)
|
---|
4039 | {
|
---|
4040 | #ifdef VMSVGA3D_DX
|
---|
4041 | DEBUG_BREAKPOINT_TEST();
|
---|
4042 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4043 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4044 | return vmsvga3dLogicOpsAlphaBlend(pThisCC, idDXContext);
|
---|
4045 | #else
|
---|
4046 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4047 | return VERR_NOT_SUPPORTED;
|
---|
4048 | #endif
|
---|
4049 | }
|
---|
4050 |
|
---|
4051 |
|
---|
4052 | /* SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND 1264 */
|
---|
4053 | static int vmsvga3dCmdLogicOpsClearTypeBlend(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsClearTypeBlend const *pCmd, uint32_t cbCmd)
|
---|
4054 | {
|
---|
4055 | #ifdef VMSVGA3D_DX
|
---|
4056 | DEBUG_BREAKPOINT_TEST();
|
---|
4057 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4058 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4059 | return vmsvga3dLogicOpsClearTypeBlend(pThisCC, idDXContext);
|
---|
4060 | #else
|
---|
4061 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4062 | return VERR_NOT_SUPPORTED;
|
---|
4063 | #endif
|
---|
4064 | }
|
---|
4065 |
|
---|
4066 |
|
---|
4067 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 1267 */
|
---|
4068 | static int vmsvga3dCmdDefineGBSurface_v4(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDefineGBSurface_v4 const *pCmd, uint32_t cbCmd)
|
---|
4069 | {
|
---|
4070 | #ifdef VMSVGA3D_DX
|
---|
4071 | DEBUG_BREAKPOINT_TEST();
|
---|
4072 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4073 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4074 | return vmsvga3dDefineGBSurface_v4(pThisCC, idDXContext);
|
---|
4075 | #else
|
---|
4076 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4077 | return VERR_NOT_SUPPORTED;
|
---|
4078 | #endif
|
---|
4079 | }
|
---|
4080 |
|
---|
4081 |
|
---|
4082 | /* SVGA_3D_CMD_DX_SET_CS_UA_VIEWS 1268 */
|
---|
4083 | static int vmsvga3dCmdDXSetCSUAViews(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetCSUAViews const *pCmd, uint32_t cbCmd)
|
---|
4084 | {
|
---|
4085 | #ifdef VMSVGA3D_DX
|
---|
4086 | DEBUG_BREAKPOINT_TEST();
|
---|
4087 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4088 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4089 | return vmsvga3dDXSetCSUAViews(pThisCC, idDXContext);
|
---|
4090 | #else
|
---|
4091 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4092 | return VERR_NOT_SUPPORTED;
|
---|
4093 | #endif
|
---|
4094 | }
|
---|
4095 |
|
---|
4096 |
|
---|
4097 | /* SVGA_3D_CMD_DX_SET_MIN_LOD 1269 */
|
---|
4098 | static int vmsvga3dCmdDXSetMinLOD(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetMinLOD const *pCmd, uint32_t cbCmd)
|
---|
4099 | {
|
---|
4100 | #ifdef VMSVGA3D_DX
|
---|
4101 | DEBUG_BREAKPOINT_TEST();
|
---|
4102 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4103 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4104 | return vmsvga3dDXSetMinLOD(pThisCC, idDXContext);
|
---|
4105 | #else
|
---|
4106 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4107 | return VERR_NOT_SUPPORTED;
|
---|
4108 | #endif
|
---|
4109 | }
|
---|
4110 |
|
---|
4111 |
|
---|
4112 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2 1272 */
|
---|
4113 | static int vmsvga3dCmdDXDefineDepthStencilView_v2(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilView_v2 const *pCmd, uint32_t cbCmd)
|
---|
4114 | {
|
---|
4115 | #ifdef VMSVGA3D_DX
|
---|
4116 | //DEBUG_BREAKPOINT_TEST();
|
---|
4117 | RT_NOREF(cbCmd);
|
---|
4118 | return vmsvga3dDXDefineDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
4119 | #else
|
---|
4120 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4121 | return VERR_NOT_SUPPORTED;
|
---|
4122 | #endif
|
---|
4123 | }
|
---|
4124 |
|
---|
4125 |
|
---|
4126 | /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB 1273 */
|
---|
4127 | static int vmsvga3dCmdDXDefineStreamOutputWithMob(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineStreamOutputWithMob const *pCmd, uint32_t cbCmd)
|
---|
4128 | {
|
---|
4129 | #ifdef VMSVGA3D_DX
|
---|
4130 | DEBUG_BREAKPOINT_TEST();
|
---|
4131 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4132 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4133 | return vmsvga3dDXDefineStreamOutputWithMob(pThisCC, idDXContext);
|
---|
4134 | #else
|
---|
4135 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4136 | return VERR_NOT_SUPPORTED;
|
---|
4137 | #endif
|
---|
4138 | }
|
---|
4139 |
|
---|
4140 |
|
---|
4141 | /* SVGA_3D_CMD_DX_SET_SHADER_IFACE 1274 */
|
---|
4142 | static int vmsvga3dCmdDXSetShaderIface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShaderIface const *pCmd, uint32_t cbCmd)
|
---|
4143 | {
|
---|
4144 | #ifdef VMSVGA3D_DX
|
---|
4145 | DEBUG_BREAKPOINT_TEST();
|
---|
4146 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4147 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4148 | return vmsvga3dDXSetShaderIface(pThisCC, idDXContext);
|
---|
4149 | #else
|
---|
4150 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4151 | return VERR_NOT_SUPPORTED;
|
---|
4152 | #endif
|
---|
4153 | }
|
---|
4154 |
|
---|
4155 |
|
---|
4156 | /* SVGA_3D_CMD_DX_BIND_STREAMOUTPUT 1275 */
|
---|
4157 | static int vmsvga3dCmdDXBindStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
4158 | {
|
---|
4159 | #ifdef VMSVGA3D_DX
|
---|
4160 | DEBUG_BREAKPOINT_TEST();
|
---|
4161 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4162 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4163 | return vmsvga3dDXBindStreamOutput(pThisCC, idDXContext);
|
---|
4164 | #else
|
---|
4165 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4166 | return VERR_NOT_SUPPORTED;
|
---|
4167 | #endif
|
---|
4168 | }
|
---|
4169 |
|
---|
4170 |
|
---|
4171 | /* SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS 1276 */
|
---|
4172 | static int vmsvga3dCmdSurfaceStretchBltNonMSToMS(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdSurfaceStretchBltNonMSToMS const *pCmd, uint32_t cbCmd)
|
---|
4173 | {
|
---|
4174 | #ifdef VMSVGA3D_DX
|
---|
4175 | DEBUG_BREAKPOINT_TEST();
|
---|
4176 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4177 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4178 | return vmsvga3dSurfaceStretchBltNonMSToMS(pThisCC, idDXContext);
|
---|
4179 | #else
|
---|
4180 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4181 | return VERR_NOT_SUPPORTED;
|
---|
4182 | #endif
|
---|
4183 | }
|
---|
4184 |
|
---|
4185 |
|
---|
4186 | /* SVGA_3D_CMD_DX_BIND_SHADER_IFACE 1277 */
|
---|
4187 | static int vmsvga3dCmdDXBindShaderIface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindShaderIface const *pCmd, uint32_t cbCmd)
|
---|
4188 | {
|
---|
4189 | #ifdef VMSVGA3D_DX
|
---|
4190 | DEBUG_BREAKPOINT_TEST();
|
---|
4191 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4192 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4193 | return vmsvga3dDXBindShaderIface(pThisCC, idDXContext);
|
---|
4194 | #else
|
---|
4195 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4196 | return VERR_NOT_SUPPORTED;
|
---|
4197 | #endif
|
---|
4198 | }
|
---|
4199 |
|
---|
4200 |
|
---|
4201 | /** @def VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK
|
---|
4202 | * Check that the 3D command has at least a_cbMin of payload bytes after the
|
---|
4203 | * header. Will break out of the switch if it doesn't.
|
---|
4204 | */
|
---|
4205 | # define VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(a_cbMin) \
|
---|
4206 | if (1) { \
|
---|
4207 | AssertMsgBreak(cbCmd >= (a_cbMin), ("size=%#x a_cbMin=%#zx\n", cbCmd, (size_t)(a_cbMin))); \
|
---|
4208 | RT_UNTRUSTED_VALIDATED_FENCE(); \
|
---|
4209 | } else do {} while (0)
|
---|
4210 |
|
---|
4211 | # define VMSVGA_3D_CMD_NOTIMPL() \
|
---|
4212 | if (1) { \
|
---|
4213 | AssertMsgFailed(("Not implemented %d %s\n", enmCmdId, vmsvgaR3FifoCmdToString(enmCmdId))); \
|
---|
4214 | } else do {} while (0)
|
---|
4215 |
|
---|
4216 | /** SVGA_3D_CMD_* handler.
|
---|
4217 | * This function parses the command and calls the corresponding command handler.
|
---|
4218 | *
|
---|
4219 | * @param pThis The shared VGA/VMSVGA state.
|
---|
4220 | * @param pThisCC The VGA/VMSVGA state for the current context.
|
---|
4221 | * @param idDXContext VGPU10 DX context of the commands or SVGA3D_INVALID_ID if they are not for a specific context.
|
---|
4222 | * @param enmCmdId SVGA_3D_CMD_* command identifier.
|
---|
4223 | * @param cbCmd Size of the command in bytes.
|
---|
4224 | * @param pvCmd Pointer to the command.
|
---|
4225 | * @returns VBox status code if an error was detected parsing a command.
|
---|
4226 | */
|
---|
4227 | int vmsvgaR3Process3dCmd(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t idDXContext, SVGAFifo3dCmdId enmCmdId, uint32_t cbCmd, void const *pvCmd)
|
---|
4228 | {
|
---|
4229 | if (enmCmdId > SVGA_3D_CMD_MAX)
|
---|
4230 | {
|
---|
4231 | LogRelMax(16, ("VMSVGA: unsupported 3D command %d\n", enmCmdId));
|
---|
4232 | ASSERT_GUEST_FAILED_RETURN(VERR_NOT_IMPLEMENTED);
|
---|
4233 | }
|
---|
4234 |
|
---|
4235 | int rcParse = VINF_SUCCESS;
|
---|
4236 | PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4237 |
|
---|
4238 | switch (enmCmdId)
|
---|
4239 | {
|
---|
4240 | case SVGA_3D_CMD_SURFACE_DEFINE:
|
---|
4241 | {
|
---|
4242 | SVGA3dCmdDefineSurface *pCmd = (SVGA3dCmdDefineSurface *)pvCmd;
|
---|
4243 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4244 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDefine);
|
---|
4245 |
|
---|
4246 | SVGA3dCmdDefineSurface_v2 cmd;
|
---|
4247 | cmd.sid = pCmd->sid;
|
---|
4248 | cmd.surfaceFlags = pCmd->surfaceFlags;
|
---|
4249 | cmd.format = pCmd->format;
|
---|
4250 | memcpy(cmd.face, pCmd->face, sizeof(cmd.face));
|
---|
4251 | cmd.multisampleCount = 0;
|
---|
4252 | cmd.autogenFilter = SVGA3D_TEX_FILTER_NONE;
|
---|
4253 |
|
---|
4254 | uint32_t const cMipLevelSizes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSize);
|
---|
4255 | vmsvga3dCmdDefineSurface(pThisCC, &cmd, cMipLevelSizes, (SVGA3dSize *)(pCmd + 1));
|
---|
4256 | # ifdef DEBUG_GMR_ACCESS
|
---|
4257 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis);
|
---|
4258 | # endif
|
---|
4259 | break;
|
---|
4260 | }
|
---|
4261 |
|
---|
4262 | case SVGA_3D_CMD_SURFACE_DEFINE_V2:
|
---|
4263 | {
|
---|
4264 | SVGA3dCmdDefineSurface_v2 *pCmd = (SVGA3dCmdDefineSurface_v2 *)pvCmd;
|
---|
4265 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4266 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDefineV2);
|
---|
4267 |
|
---|
4268 | uint32_t const cMipLevelSizes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSize);
|
---|
4269 | vmsvga3dCmdDefineSurface(pThisCC, pCmd, cMipLevelSizes, (SVGA3dSize *)(pCmd + 1));
|
---|
4270 | # ifdef DEBUG_GMR_ACCESS
|
---|
4271 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis);
|
---|
4272 | # endif
|
---|
4273 | break;
|
---|
4274 | }
|
---|
4275 |
|
---|
4276 | case SVGA_3D_CMD_SURFACE_DESTROY:
|
---|
4277 | {
|
---|
4278 | SVGA3dCmdDestroySurface *pCmd = (SVGA3dCmdDestroySurface *)pvCmd;
|
---|
4279 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4280 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDestroy);
|
---|
4281 |
|
---|
4282 | vmsvga3dSurfaceDestroy(pThisCC, pCmd->sid);
|
---|
4283 | break;
|
---|
4284 | }
|
---|
4285 |
|
---|
4286 | case SVGA_3D_CMD_SURFACE_COPY:
|
---|
4287 | {
|
---|
4288 | SVGA3dCmdSurfaceCopy *pCmd = (SVGA3dCmdSurfaceCopy *)pvCmd;
|
---|
4289 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4290 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceCopy);
|
---|
4291 |
|
---|
4292 | uint32_t const cCopyBoxes = (cbCmd - sizeof(pCmd)) / sizeof(SVGA3dCopyBox);
|
---|
4293 | vmsvga3dSurfaceCopy(pThisCC, pCmd->dest, pCmd->src, cCopyBoxes, (SVGA3dCopyBox *)(pCmd + 1));
|
---|
4294 | break;
|
---|
4295 | }
|
---|
4296 |
|
---|
4297 | case SVGA_3D_CMD_SURFACE_STRETCHBLT:
|
---|
4298 | {
|
---|
4299 | SVGA3dCmdSurfaceStretchBlt *pCmd = (SVGA3dCmdSurfaceStretchBlt *)pvCmd;
|
---|
4300 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4301 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceStretchBlt);
|
---|
4302 |
|
---|
4303 | vmsvga3dSurfaceStretchBlt(pThis, pThisCC, &pCmd->dest, &pCmd->boxDest,
|
---|
4304 | &pCmd->src, &pCmd->boxSrc, pCmd->mode);
|
---|
4305 | break;
|
---|
4306 | }
|
---|
4307 |
|
---|
4308 | case SVGA_3D_CMD_SURFACE_DMA:
|
---|
4309 | {
|
---|
4310 | SVGA3dCmdSurfaceDMA *pCmd = (SVGA3dCmdSurfaceDMA *)pvCmd;
|
---|
4311 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4312 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDma);
|
---|
4313 |
|
---|
4314 | uint64_t u64NanoTS = 0;
|
---|
4315 | if (LogRelIs3Enabled())
|
---|
4316 | u64NanoTS = RTTimeNanoTS();
|
---|
4317 | uint32_t const cCopyBoxes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dCopyBox);
|
---|
4318 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dSurfaceDmaProf, a);
|
---|
4319 | vmsvga3dSurfaceDMA(pThis, pThisCC, pCmd->guest, pCmd->host, pCmd->transfer,
|
---|
4320 | cCopyBoxes, (SVGA3dCopyBox *)(pCmd + 1));
|
---|
4321 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dSurfaceDmaProf, a);
|
---|
4322 | if (LogRelIs3Enabled())
|
---|
4323 | {
|
---|
4324 | if (cCopyBoxes)
|
---|
4325 | {
|
---|
4326 | SVGA3dCopyBox *pFirstBox = (SVGA3dCopyBox *)(pCmd + 1);
|
---|
4327 | LogRel3(("VMSVGA: SURFACE_DMA: %d us %d boxes %d,%d %dx%d%s\n",
|
---|
4328 | (RTTimeNanoTS() - u64NanoTS) / 1000ULL, cCopyBoxes,
|
---|
4329 | pFirstBox->x, pFirstBox->y, pFirstBox->w, pFirstBox->h,
|
---|
4330 | pCmd->transfer == SVGA3D_READ_HOST_VRAM ? " readback!!!" : ""));
|
---|
4331 | }
|
---|
4332 | }
|
---|
4333 | break;
|
---|
4334 | }
|
---|
4335 |
|
---|
4336 | case SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN:
|
---|
4337 | {
|
---|
4338 | SVGA3dCmdBlitSurfaceToScreen *pCmd = (SVGA3dCmdBlitSurfaceToScreen *)pvCmd;
|
---|
4339 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4340 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceScreen);
|
---|
4341 |
|
---|
4342 | static uint64_t u64FrameStartNanoTS = 0;
|
---|
4343 | static uint64_t u64ElapsedPerSecNano = 0;
|
---|
4344 | static int cFrames = 0;
|
---|
4345 | uint64_t u64NanoTS = 0;
|
---|
4346 | if (LogRelIs3Enabled())
|
---|
4347 | u64NanoTS = RTTimeNanoTS();
|
---|
4348 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4349 | STAM_REL_PROFILE_START(&pSvgaR3State->StatR3Cmd3dBlitSurfaceToScreenProf, a);
|
---|
4350 | vmsvga3dSurfaceBlitToScreen(pThis, pThisCC, pCmd->destScreenId, pCmd->destRect, pCmd->srcImage,
|
---|
4351 | pCmd->srcRect, cRects, (SVGASignedRect *)(pCmd + 1));
|
---|
4352 | STAM_REL_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dBlitSurfaceToScreenProf, a);
|
---|
4353 | if (LogRelIs3Enabled())
|
---|
4354 | {
|
---|
4355 | uint64_t u64ElapsedNano = RTTimeNanoTS() - u64NanoTS;
|
---|
4356 | u64ElapsedPerSecNano += u64ElapsedNano;
|
---|
4357 |
|
---|
4358 | SVGASignedRect *pFirstRect = cRects ? (SVGASignedRect *)(pCmd + 1) : &pCmd->destRect;
|
---|
4359 | LogRel3(("VMSVGA: SURFACE_TO_SCREEN: %d us %d rects %d,%d %dx%d\n",
|
---|
4360 | (u64ElapsedNano) / 1000ULL, cRects,
|
---|
4361 | pFirstRect->left, pFirstRect->top,
|
---|
4362 | pFirstRect->right - pFirstRect->left, pFirstRect->bottom - pFirstRect->top));
|
---|
4363 |
|
---|
4364 | ++cFrames;
|
---|
4365 | if (u64NanoTS - u64FrameStartNanoTS >= UINT64_C(1000000000))
|
---|
4366 | {
|
---|
4367 | LogRel3(("VMSVGA: SURFACE_TO_SCREEN: FPS %d, elapsed %llu us\n",
|
---|
4368 | cFrames, u64ElapsedPerSecNano / 1000ULL));
|
---|
4369 | u64FrameStartNanoTS = u64NanoTS;
|
---|
4370 | cFrames = 0;
|
---|
4371 | u64ElapsedPerSecNano = 0;
|
---|
4372 | }
|
---|
4373 | }
|
---|
4374 | break;
|
---|
4375 | }
|
---|
4376 |
|
---|
4377 | case SVGA_3D_CMD_CONTEXT_DEFINE:
|
---|
4378 | {
|
---|
4379 | SVGA3dCmdDefineContext *pCmd = (SVGA3dCmdDefineContext *)pvCmd;
|
---|
4380 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4381 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dContextDefine);
|
---|
4382 |
|
---|
4383 | vmsvga3dContextDefine(pThisCC, pCmd->cid);
|
---|
4384 | break;
|
---|
4385 | }
|
---|
4386 |
|
---|
4387 | case SVGA_3D_CMD_CONTEXT_DESTROY:
|
---|
4388 | {
|
---|
4389 | SVGA3dCmdDestroyContext *pCmd = (SVGA3dCmdDestroyContext *)pvCmd;
|
---|
4390 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4391 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dContextDestroy);
|
---|
4392 |
|
---|
4393 | vmsvga3dContextDestroy(pThisCC, pCmd->cid);
|
---|
4394 | break;
|
---|
4395 | }
|
---|
4396 |
|
---|
4397 | case SVGA_3D_CMD_SETTRANSFORM:
|
---|
4398 | {
|
---|
4399 | SVGA3dCmdSetTransform *pCmd = (SVGA3dCmdSetTransform *)pvCmd;
|
---|
4400 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4401 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetTransform);
|
---|
4402 |
|
---|
4403 | vmsvga3dSetTransform(pThisCC, pCmd->cid, pCmd->type, pCmd->matrix);
|
---|
4404 | break;
|
---|
4405 | }
|
---|
4406 |
|
---|
4407 | case SVGA_3D_CMD_SETZRANGE:
|
---|
4408 | {
|
---|
4409 | SVGA3dCmdSetZRange *pCmd = (SVGA3dCmdSetZRange *)pvCmd;
|
---|
4410 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4411 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetZRange);
|
---|
4412 |
|
---|
4413 | vmsvga3dSetZRange(pThisCC, pCmd->cid, pCmd->zRange);
|
---|
4414 | break;
|
---|
4415 | }
|
---|
4416 |
|
---|
4417 | case SVGA_3D_CMD_SETRENDERSTATE:
|
---|
4418 | {
|
---|
4419 | SVGA3dCmdSetRenderState *pCmd = (SVGA3dCmdSetRenderState *)pvCmd;
|
---|
4420 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4421 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetRenderState);
|
---|
4422 |
|
---|
4423 | uint32_t const cRenderStates = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRenderState);
|
---|
4424 | vmsvga3dSetRenderState(pThisCC, pCmd->cid, cRenderStates, (SVGA3dRenderState *)(pCmd + 1));
|
---|
4425 | break;
|
---|
4426 | }
|
---|
4427 |
|
---|
4428 | case SVGA_3D_CMD_SETRENDERTARGET:
|
---|
4429 | {
|
---|
4430 | SVGA3dCmdSetRenderTarget *pCmd = (SVGA3dCmdSetRenderTarget *)pvCmd;
|
---|
4431 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4432 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetRenderTarget);
|
---|
4433 |
|
---|
4434 | vmsvga3dSetRenderTarget(pThisCC, pCmd->cid, pCmd->type, pCmd->target);
|
---|
4435 | break;
|
---|
4436 | }
|
---|
4437 |
|
---|
4438 | case SVGA_3D_CMD_SETTEXTURESTATE:
|
---|
4439 | {
|
---|
4440 | SVGA3dCmdSetTextureState *pCmd = (SVGA3dCmdSetTextureState *)pvCmd;
|
---|
4441 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4442 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetTextureState);
|
---|
4443 |
|
---|
4444 | uint32_t const cTextureStates = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dTextureState);
|
---|
4445 | vmsvga3dSetTextureState(pThisCC, pCmd->cid, cTextureStates, (SVGA3dTextureState *)(pCmd + 1));
|
---|
4446 | break;
|
---|
4447 | }
|
---|
4448 |
|
---|
4449 | case SVGA_3D_CMD_SETMATERIAL:
|
---|
4450 | {
|
---|
4451 | SVGA3dCmdSetMaterial *pCmd = (SVGA3dCmdSetMaterial *)pvCmd;
|
---|
4452 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4453 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetMaterial);
|
---|
4454 |
|
---|
4455 | vmsvga3dSetMaterial(pThisCC, pCmd->cid, pCmd->face, &pCmd->material);
|
---|
4456 | break;
|
---|
4457 | }
|
---|
4458 |
|
---|
4459 | case SVGA_3D_CMD_SETLIGHTDATA:
|
---|
4460 | {
|
---|
4461 | SVGA3dCmdSetLightData *pCmd = (SVGA3dCmdSetLightData *)pvCmd;
|
---|
4462 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4463 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetLightData);
|
---|
4464 |
|
---|
4465 | vmsvga3dSetLightData(pThisCC, pCmd->cid, pCmd->index, &pCmd->data);
|
---|
4466 | break;
|
---|
4467 | }
|
---|
4468 |
|
---|
4469 | case SVGA_3D_CMD_SETLIGHTENABLED:
|
---|
4470 | {
|
---|
4471 | SVGA3dCmdSetLightEnabled *pCmd = (SVGA3dCmdSetLightEnabled *)pvCmd;
|
---|
4472 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4473 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetLightEnable);
|
---|
4474 |
|
---|
4475 | vmsvga3dSetLightEnabled(pThisCC, pCmd->cid, pCmd->index, pCmd->enabled);
|
---|
4476 | break;
|
---|
4477 | }
|
---|
4478 |
|
---|
4479 | case SVGA_3D_CMD_SETVIEWPORT:
|
---|
4480 | {
|
---|
4481 | SVGA3dCmdSetViewport *pCmd = (SVGA3dCmdSetViewport *)pvCmd;
|
---|
4482 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4483 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetViewPort);
|
---|
4484 |
|
---|
4485 | vmsvga3dSetViewPort(pThisCC, pCmd->cid, &pCmd->rect);
|
---|
4486 | break;
|
---|
4487 | }
|
---|
4488 |
|
---|
4489 | case SVGA_3D_CMD_SETCLIPPLANE:
|
---|
4490 | {
|
---|
4491 | SVGA3dCmdSetClipPlane *pCmd = (SVGA3dCmdSetClipPlane *)pvCmd;
|
---|
4492 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4493 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetClipPlane);
|
---|
4494 |
|
---|
4495 | vmsvga3dSetClipPlane(pThisCC, pCmd->cid, pCmd->index, pCmd->plane);
|
---|
4496 | break;
|
---|
4497 | }
|
---|
4498 |
|
---|
4499 | case SVGA_3D_CMD_CLEAR:
|
---|
4500 | {
|
---|
4501 | SVGA3dCmdClear *pCmd = (SVGA3dCmdClear *)pvCmd;
|
---|
4502 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4503 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dClear);
|
---|
4504 |
|
---|
4505 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRect);
|
---|
4506 | vmsvga3dCommandClear(pThisCC, pCmd->cid, pCmd->clearFlag, pCmd->color, pCmd->depth, pCmd->stencil, cRects, (SVGA3dRect *)(pCmd + 1));
|
---|
4507 | break;
|
---|
4508 | }
|
---|
4509 |
|
---|
4510 | case SVGA_3D_CMD_PRESENT:
|
---|
4511 | case SVGA_3D_CMD_PRESENT_READBACK: /** @todo SVGA_3D_CMD_PRESENT_READBACK isn't quite the same as present... */
|
---|
4512 | {
|
---|
4513 | SVGA3dCmdPresent *pCmd = (SVGA3dCmdPresent *)pvCmd;
|
---|
4514 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4515 | if (enmCmdId == SVGA_3D_CMD_PRESENT)
|
---|
4516 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dPresent);
|
---|
4517 | else
|
---|
4518 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dPresentReadBack);
|
---|
4519 |
|
---|
4520 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dCopyRect);
|
---|
4521 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dPresentProf, a);
|
---|
4522 | vmsvga3dCommandPresent(pThis, pThisCC, pCmd->sid, cRects, (SVGA3dCopyRect *)(pCmd + 1));
|
---|
4523 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dPresentProf, a);
|
---|
4524 | break;
|
---|
4525 | }
|
---|
4526 |
|
---|
4527 | case SVGA_3D_CMD_SHADER_DEFINE:
|
---|
4528 | {
|
---|
4529 | SVGA3dCmdDefineShader *pCmd = (SVGA3dCmdDefineShader *)pvCmd;
|
---|
4530 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4531 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dShaderDefine);
|
---|
4532 |
|
---|
4533 | uint32_t const cbData = (cbCmd - sizeof(*pCmd));
|
---|
4534 | vmsvga3dShaderDefine(pThisCC, pCmd->cid, pCmd->shid, pCmd->type, cbData, (uint32_t *)(pCmd + 1));
|
---|
4535 | break;
|
---|
4536 | }
|
---|
4537 |
|
---|
4538 | case SVGA_3D_CMD_SHADER_DESTROY:
|
---|
4539 | {
|
---|
4540 | SVGA3dCmdDestroyShader *pCmd = (SVGA3dCmdDestroyShader *)pvCmd;
|
---|
4541 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4542 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dShaderDestroy);
|
---|
4543 |
|
---|
4544 | vmsvga3dShaderDestroy(pThisCC, pCmd->cid, pCmd->shid, pCmd->type);
|
---|
4545 | break;
|
---|
4546 | }
|
---|
4547 |
|
---|
4548 | case SVGA_3D_CMD_SET_SHADER:
|
---|
4549 | {
|
---|
4550 | SVGA3dCmdSetShader *pCmd = (SVGA3dCmdSetShader *)pvCmd;
|
---|
4551 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4552 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetShader);
|
---|
4553 |
|
---|
4554 | vmsvga3dShaderSet(pThisCC, NULL, pCmd->cid, pCmd->type, pCmd->shid);
|
---|
4555 | break;
|
---|
4556 | }
|
---|
4557 |
|
---|
4558 | case SVGA_3D_CMD_SET_SHADER_CONST:
|
---|
4559 | {
|
---|
4560 | SVGA3dCmdSetShaderConst *pCmd = (SVGA3dCmdSetShaderConst *)pvCmd;
|
---|
4561 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4562 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetShaderConst);
|
---|
4563 |
|
---|
4564 | uint32_t const cRegisters = (cbCmd - sizeof(*pCmd)) / sizeof(pCmd->values) + 1;
|
---|
4565 | vmsvga3dShaderSetConst(pThisCC, pCmd->cid, pCmd->reg, pCmd->type, pCmd->ctype, cRegisters, pCmd->values);
|
---|
4566 | break;
|
---|
4567 | }
|
---|
4568 |
|
---|
4569 | case SVGA_3D_CMD_DRAW_PRIMITIVES:
|
---|
4570 | {
|
---|
4571 | SVGA3dCmdDrawPrimitives *pCmd = (SVGA3dCmdDrawPrimitives *)pvCmd;
|
---|
4572 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4573 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dDrawPrimitives);
|
---|
4574 |
|
---|
4575 | ASSERT_GUEST_STMT_BREAK(pCmd->numRanges <= SVGA3D_MAX_DRAW_PRIMITIVE_RANGES, rcParse = VERR_INVALID_PARAMETER);
|
---|
4576 | ASSERT_GUEST_STMT_BREAK(pCmd->numVertexDecls <= SVGA3D_MAX_VERTEX_ARRAYS, rcParse = VERR_INVALID_PARAMETER);
|
---|
4577 | uint32_t const cbRangesAndVertexDecls = pCmd->numVertexDecls * sizeof(SVGA3dVertexDecl)
|
---|
4578 | + pCmd->numRanges * sizeof(SVGA3dPrimitiveRange);
|
---|
4579 | ASSERT_GUEST_STMT_BREAK(cbRangesAndVertexDecls <= cbCmd - sizeof(*pCmd), rcParse = VERR_INVALID_PARAMETER);
|
---|
4580 |
|
---|
4581 | uint32_t const cVertexDivisor = (cbCmd - sizeof(*pCmd) - cbRangesAndVertexDecls) / sizeof(uint32_t);
|
---|
4582 | ASSERT_GUEST_STMT_BREAK(!cVertexDivisor || cVertexDivisor == pCmd->numVertexDecls, rcParse = VERR_INVALID_PARAMETER);
|
---|
4583 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
4584 |
|
---|
4585 | SVGA3dVertexDecl *pVertexDecl = (SVGA3dVertexDecl *)(pCmd + 1);
|
---|
4586 | SVGA3dPrimitiveRange *pNumRange = (SVGA3dPrimitiveRange *)&pVertexDecl[pCmd->numVertexDecls];
|
---|
4587 | SVGA3dVertexDivisor *pVertexDivisor = cVertexDivisor ? (SVGA3dVertexDivisor *)&pNumRange[pCmd->numRanges] : NULL;
|
---|
4588 |
|
---|
4589 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dDrawPrimitivesProf, a);
|
---|
4590 | vmsvga3dDrawPrimitives(pThisCC, pCmd->cid, pCmd->numVertexDecls, pVertexDecl, pCmd->numRanges,
|
---|
4591 | pNumRange, cVertexDivisor, pVertexDivisor);
|
---|
4592 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dDrawPrimitivesProf, a);
|
---|
4593 | break;
|
---|
4594 | }
|
---|
4595 |
|
---|
4596 | case SVGA_3D_CMD_SETSCISSORRECT:
|
---|
4597 | {
|
---|
4598 | SVGA3dCmdSetScissorRect *pCmd = (SVGA3dCmdSetScissorRect *)pvCmd;
|
---|
4599 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4600 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetScissorRect);
|
---|
4601 |
|
---|
4602 | vmsvga3dSetScissorRect(pThisCC, pCmd->cid, &pCmd->rect);
|
---|
4603 | break;
|
---|
4604 | }
|
---|
4605 |
|
---|
4606 | case SVGA_3D_CMD_BEGIN_QUERY:
|
---|
4607 | {
|
---|
4608 | SVGA3dCmdBeginQuery *pCmd = (SVGA3dCmdBeginQuery *)pvCmd;
|
---|
4609 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4610 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dBeginQuery);
|
---|
4611 |
|
---|
4612 | vmsvga3dQueryBegin(pThisCC, pCmd->cid, pCmd->type);
|
---|
4613 | break;
|
---|
4614 | }
|
---|
4615 |
|
---|
4616 | case SVGA_3D_CMD_END_QUERY:
|
---|
4617 | {
|
---|
4618 | SVGA3dCmdEndQuery *pCmd = (SVGA3dCmdEndQuery *)pvCmd;
|
---|
4619 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4620 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dEndQuery);
|
---|
4621 |
|
---|
4622 | vmsvga3dQueryEnd(pThisCC, pCmd->cid, pCmd->type);
|
---|
4623 | break;
|
---|
4624 | }
|
---|
4625 |
|
---|
4626 | case SVGA_3D_CMD_WAIT_FOR_QUERY:
|
---|
4627 | {
|
---|
4628 | SVGA3dCmdWaitForQuery *pCmd = (SVGA3dCmdWaitForQuery *)pvCmd;
|
---|
4629 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4630 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dWaitForQuery);
|
---|
4631 |
|
---|
4632 | vmsvga3dQueryWait(pThisCC, pCmd->cid, pCmd->type, pThis, &pCmd->guestResult);
|
---|
4633 | break;
|
---|
4634 | }
|
---|
4635 |
|
---|
4636 | case SVGA_3D_CMD_GENERATE_MIPMAPS:
|
---|
4637 | {
|
---|
4638 | SVGA3dCmdGenerateMipmaps *pCmd = (SVGA3dCmdGenerateMipmaps *)pvCmd;
|
---|
4639 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4640 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dGenerateMipmaps);
|
---|
4641 |
|
---|
4642 | vmsvga3dGenerateMipmaps(pThisCC, pCmd->sid, pCmd->filter);
|
---|
4643 | break;
|
---|
4644 | }
|
---|
4645 |
|
---|
4646 | case SVGA_3D_CMD_ACTIVATE_SURFACE:
|
---|
4647 | /* context id + surface id? */
|
---|
4648 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dActivateSurface);
|
---|
4649 | break;
|
---|
4650 |
|
---|
4651 | case SVGA_3D_CMD_DEACTIVATE_SURFACE:
|
---|
4652 | /* context id + surface id? */
|
---|
4653 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dDeactivateSurface);
|
---|
4654 | break;
|
---|
4655 |
|
---|
4656 | /*
|
---|
4657 | *
|
---|
4658 | * VPGU10: SVGA_CAP_GBOBJECTS+ commands.
|
---|
4659 | *
|
---|
4660 | */
|
---|
4661 | case SVGA_3D_CMD_SCREEN_DMA:
|
---|
4662 | {
|
---|
4663 | SVGA3dCmdScreenDMA *pCmd = (SVGA3dCmdScreenDMA *)pvCmd;
|
---|
4664 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4665 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4666 | break;
|
---|
4667 | }
|
---|
4668 |
|
---|
4669 | case SVGA_3D_CMD_DEAD1:
|
---|
4670 | case SVGA_3D_CMD_DEAD2:
|
---|
4671 | case SVGA_3D_CMD_DEAD12: /* Old SVGA_3D_CMD_LOGICOPS_BITBLT */
|
---|
4672 | case SVGA_3D_CMD_DEAD13: /* Old SVGA_3D_CMD_LOGICOPS_TRANSBLT */
|
---|
4673 | case SVGA_3D_CMD_DEAD14: /* Old SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
|
---|
4674 | case SVGA_3D_CMD_DEAD15: /* Old SVGA_3D_CMD_LOGICOPS_COLORFILL */
|
---|
4675 | case SVGA_3D_CMD_DEAD16: /* Old SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
|
---|
4676 | case SVGA_3D_CMD_DEAD17: /* Old SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND */
|
---|
4677 | {
|
---|
4678 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
4679 | break;
|
---|
4680 | }
|
---|
4681 |
|
---|
4682 | case SVGA_3D_CMD_SET_OTABLE_BASE:
|
---|
4683 | {
|
---|
4684 | SVGA3dCmdSetOTableBase *pCmd = (SVGA3dCmdSetOTableBase *)pvCmd;
|
---|
4685 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4686 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4687 | break;
|
---|
4688 | }
|
---|
4689 |
|
---|
4690 | case SVGA_3D_CMD_READBACK_OTABLE:
|
---|
4691 | {
|
---|
4692 | SVGA3dCmdReadbackOTable *pCmd = (SVGA3dCmdReadbackOTable *)pvCmd;
|
---|
4693 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4694 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4695 | break;
|
---|
4696 | }
|
---|
4697 |
|
---|
4698 | case SVGA_3D_CMD_DEFINE_GB_MOB:
|
---|
4699 | {
|
---|
4700 | SVGA3dCmdDefineGBMob *pCmd = (SVGA3dCmdDefineGBMob *)pvCmd;
|
---|
4701 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4702 | vmsvga3dCmdDefineGBMob(pThisCC, pCmd);
|
---|
4703 | break;
|
---|
4704 | }
|
---|
4705 |
|
---|
4706 | case SVGA_3D_CMD_DESTROY_GB_MOB:
|
---|
4707 | {
|
---|
4708 | SVGA3dCmdDestroyGBMob *pCmd = (SVGA3dCmdDestroyGBMob *)pvCmd;
|
---|
4709 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4710 | vmsvga3dCmdDestroyGBMob(pThisCC, pCmd);
|
---|
4711 | break;
|
---|
4712 | }
|
---|
4713 |
|
---|
4714 | case SVGA_3D_CMD_DEAD3:
|
---|
4715 | {
|
---|
4716 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
4717 | break;
|
---|
4718 | }
|
---|
4719 |
|
---|
4720 | case SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING:
|
---|
4721 | {
|
---|
4722 | SVGA3dCmdUpdateGBMobMapping *pCmd = (SVGA3dCmdUpdateGBMobMapping *)pvCmd;
|
---|
4723 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4724 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4725 | break;
|
---|
4726 | }
|
---|
4727 |
|
---|
4728 | case SVGA_3D_CMD_DEFINE_GB_SURFACE:
|
---|
4729 | {
|
---|
4730 | SVGA3dCmdDefineGBSurface *pCmd = (SVGA3dCmdDefineGBSurface *)pvCmd;
|
---|
4731 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4732 | vmsvga3dCmdDefineGBSurface(pThisCC, pCmd);
|
---|
4733 | break;
|
---|
4734 | }
|
---|
4735 |
|
---|
4736 | case SVGA_3D_CMD_DESTROY_GB_SURFACE:
|
---|
4737 | {
|
---|
4738 | SVGA3dCmdDestroyGBSurface *pCmd = (SVGA3dCmdDestroyGBSurface *)pvCmd;
|
---|
4739 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4740 | vmsvga3dCmdDestroyGBSurface(pThisCC, pCmd);
|
---|
4741 | break;
|
---|
4742 | }
|
---|
4743 |
|
---|
4744 | case SVGA_3D_CMD_BIND_GB_SURFACE:
|
---|
4745 | {
|
---|
4746 | SVGA3dCmdBindGBSurface *pCmd = (SVGA3dCmdBindGBSurface *)pvCmd;
|
---|
4747 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4748 | vmsvga3dCmdBindGBSurface(pThisCC, pCmd);
|
---|
4749 | break;
|
---|
4750 | }
|
---|
4751 |
|
---|
4752 | case SVGA_3D_CMD_COND_BIND_GB_SURFACE:
|
---|
4753 | {
|
---|
4754 | SVGA3dCmdCondBindGBSurface *pCmd = (SVGA3dCmdCondBindGBSurface *)pvCmd;
|
---|
4755 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4756 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4757 | break;
|
---|
4758 | }
|
---|
4759 |
|
---|
4760 | case SVGA_3D_CMD_UPDATE_GB_IMAGE:
|
---|
4761 | {
|
---|
4762 | SVGA3dCmdUpdateGBImage *pCmd = (SVGA3dCmdUpdateGBImage *)pvCmd;
|
---|
4763 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4764 | vmsvga3dCmdUpdateGBImage(pThisCC, pCmd);
|
---|
4765 | break;
|
---|
4766 | }
|
---|
4767 |
|
---|
4768 | case SVGA_3D_CMD_UPDATE_GB_SURFACE:
|
---|
4769 | {
|
---|
4770 | SVGA3dCmdUpdateGBSurface *pCmd = (SVGA3dCmdUpdateGBSurface *)pvCmd;
|
---|
4771 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4772 | vmsvga3dCmdUpdateGBSurface(pThisCC, pCmd);
|
---|
4773 | break;
|
---|
4774 | }
|
---|
4775 |
|
---|
4776 | case SVGA_3D_CMD_READBACK_GB_IMAGE:
|
---|
4777 | {
|
---|
4778 | SVGA3dCmdReadbackGBImage *pCmd = (SVGA3dCmdReadbackGBImage *)pvCmd;
|
---|
4779 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4780 | vmsvga3dCmdReadbackGBImage(pThisCC, pCmd);
|
---|
4781 | break;
|
---|
4782 | }
|
---|
4783 |
|
---|
4784 | case SVGA_3D_CMD_READBACK_GB_SURFACE:
|
---|
4785 | {
|
---|
4786 | SVGA3dCmdReadbackGBSurface *pCmd = (SVGA3dCmdReadbackGBSurface *)pvCmd;
|
---|
4787 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4788 | vmsvga3dCmdReadbackGBSurface(pThisCC, pCmd);
|
---|
4789 | break;
|
---|
4790 | }
|
---|
4791 |
|
---|
4792 | case SVGA_3D_CMD_INVALIDATE_GB_IMAGE:
|
---|
4793 | {
|
---|
4794 | SVGA3dCmdInvalidateGBImage *pCmd = (SVGA3dCmdInvalidateGBImage *)pvCmd;
|
---|
4795 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4796 | vmsvga3dCmdInvalidateGBImage(pThisCC, pCmd);
|
---|
4797 | break;
|
---|
4798 | }
|
---|
4799 |
|
---|
4800 | case SVGA_3D_CMD_INVALIDATE_GB_SURFACE:
|
---|
4801 | {
|
---|
4802 | SVGA3dCmdInvalidateGBSurface *pCmd = (SVGA3dCmdInvalidateGBSurface *)pvCmd;
|
---|
4803 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4804 | vmsvga3dCmdInvalidateGBSurface(pThisCC, pCmd);
|
---|
4805 | break;
|
---|
4806 | }
|
---|
4807 |
|
---|
4808 | case SVGA_3D_CMD_DEFINE_GB_CONTEXT:
|
---|
4809 | {
|
---|
4810 | SVGA3dCmdDefineGBContext *pCmd = (SVGA3dCmdDefineGBContext *)pvCmd;
|
---|
4811 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4812 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4813 | break;
|
---|
4814 | }
|
---|
4815 |
|
---|
4816 | case SVGA_3D_CMD_DESTROY_GB_CONTEXT:
|
---|
4817 | {
|
---|
4818 | SVGA3dCmdDestroyGBContext *pCmd = (SVGA3dCmdDestroyGBContext *)pvCmd;
|
---|
4819 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4820 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4821 | break;
|
---|
4822 | }
|
---|
4823 |
|
---|
4824 | case SVGA_3D_CMD_BIND_GB_CONTEXT:
|
---|
4825 | {
|
---|
4826 | SVGA3dCmdBindGBContext *pCmd = (SVGA3dCmdBindGBContext *)pvCmd;
|
---|
4827 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4828 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4829 | break;
|
---|
4830 | }
|
---|
4831 |
|
---|
4832 | case SVGA_3D_CMD_READBACK_GB_CONTEXT:
|
---|
4833 | {
|
---|
4834 | SVGA3dCmdReadbackGBContext *pCmd = (SVGA3dCmdReadbackGBContext *)pvCmd;
|
---|
4835 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4836 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4837 | break;
|
---|
4838 | }
|
---|
4839 |
|
---|
4840 | case SVGA_3D_CMD_INVALIDATE_GB_CONTEXT:
|
---|
4841 | {
|
---|
4842 | SVGA3dCmdInvalidateGBContext *pCmd = (SVGA3dCmdInvalidateGBContext *)pvCmd;
|
---|
4843 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4844 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4845 | break;
|
---|
4846 | }
|
---|
4847 |
|
---|
4848 | case SVGA_3D_CMD_DEFINE_GB_SHADER:
|
---|
4849 | {
|
---|
4850 | SVGA3dCmdDefineGBShader *pCmd = (SVGA3dCmdDefineGBShader *)pvCmd;
|
---|
4851 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4852 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4853 | break;
|
---|
4854 | }
|
---|
4855 |
|
---|
4856 | case SVGA_3D_CMD_DESTROY_GB_SHADER:
|
---|
4857 | {
|
---|
4858 | SVGA3dCmdDestroyGBShader *pCmd = (SVGA3dCmdDestroyGBShader *)pvCmd;
|
---|
4859 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4860 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4861 | break;
|
---|
4862 | }
|
---|
4863 |
|
---|
4864 | case SVGA_3D_CMD_BIND_GB_SHADER:
|
---|
4865 | {
|
---|
4866 | SVGA3dCmdBindGBShader *pCmd = (SVGA3dCmdBindGBShader *)pvCmd;
|
---|
4867 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4868 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4869 | break;
|
---|
4870 | }
|
---|
4871 |
|
---|
4872 | case SVGA_3D_CMD_SET_OTABLE_BASE64:
|
---|
4873 | {
|
---|
4874 | SVGA3dCmdSetOTableBase64 *pCmd = (SVGA3dCmdSetOTableBase64 *)pvCmd;
|
---|
4875 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4876 | vmsvga3dCmdSetOTableBase64(pThisCC, pCmd);
|
---|
4877 | break;
|
---|
4878 | }
|
---|
4879 |
|
---|
4880 | case SVGA_3D_CMD_BEGIN_GB_QUERY:
|
---|
4881 | {
|
---|
4882 | SVGA3dCmdBeginGBQuery *pCmd = (SVGA3dCmdBeginGBQuery *)pvCmd;
|
---|
4883 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4884 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4885 | break;
|
---|
4886 | }
|
---|
4887 |
|
---|
4888 | case SVGA_3D_CMD_END_GB_QUERY:
|
---|
4889 | {
|
---|
4890 | SVGA3dCmdEndGBQuery *pCmd = (SVGA3dCmdEndGBQuery *)pvCmd;
|
---|
4891 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4892 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4893 | break;
|
---|
4894 | }
|
---|
4895 |
|
---|
4896 | case SVGA_3D_CMD_WAIT_FOR_GB_QUERY:
|
---|
4897 | {
|
---|
4898 | SVGA3dCmdWaitForGBQuery *pCmd = (SVGA3dCmdWaitForGBQuery *)pvCmd;
|
---|
4899 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4900 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4901 | break;
|
---|
4902 | }
|
---|
4903 |
|
---|
4904 | case SVGA_3D_CMD_NOP:
|
---|
4905 | {
|
---|
4906 | /* Apparently there is nothing to do. */
|
---|
4907 | break;
|
---|
4908 | }
|
---|
4909 |
|
---|
4910 | case SVGA_3D_CMD_ENABLE_GART:
|
---|
4911 | {
|
---|
4912 | SVGA3dCmdEnableGart *pCmd = (SVGA3dCmdEnableGart *)pvCmd;
|
---|
4913 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4914 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4915 | break;
|
---|
4916 | }
|
---|
4917 |
|
---|
4918 | case SVGA_3D_CMD_DISABLE_GART:
|
---|
4919 | {
|
---|
4920 | /* No corresponding SVGA3dCmd structure. */
|
---|
4921 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
4922 | break;
|
---|
4923 | }
|
---|
4924 |
|
---|
4925 | case SVGA_3D_CMD_MAP_MOB_INTO_GART:
|
---|
4926 | {
|
---|
4927 | SVGA3dCmdMapMobIntoGart *pCmd = (SVGA3dCmdMapMobIntoGart *)pvCmd;
|
---|
4928 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4929 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4930 | break;
|
---|
4931 | }
|
---|
4932 |
|
---|
4933 | case SVGA_3D_CMD_UNMAP_GART_RANGE:
|
---|
4934 | {
|
---|
4935 | SVGA3dCmdUnmapGartRange *pCmd = (SVGA3dCmdUnmapGartRange *)pvCmd;
|
---|
4936 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4937 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4938 | break;
|
---|
4939 | }
|
---|
4940 |
|
---|
4941 | case SVGA_3D_CMD_DEFINE_GB_SCREENTARGET:
|
---|
4942 | {
|
---|
4943 | SVGA3dCmdDefineGBScreenTarget *pCmd = (SVGA3dCmdDefineGBScreenTarget *)pvCmd;
|
---|
4944 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4945 | vmsvga3dCmdDefineGBScreenTarget(pThis, pThisCC, pCmd);
|
---|
4946 | break;
|
---|
4947 | }
|
---|
4948 |
|
---|
4949 | case SVGA_3D_CMD_DESTROY_GB_SCREENTARGET:
|
---|
4950 | {
|
---|
4951 | SVGA3dCmdDestroyGBScreenTarget *pCmd = (SVGA3dCmdDestroyGBScreenTarget *)pvCmd;
|
---|
4952 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4953 | vmsvga3dCmdDestroyGBScreenTarget(pThis, pThisCC, pCmd);
|
---|
4954 | break;
|
---|
4955 | }
|
---|
4956 |
|
---|
4957 | case SVGA_3D_CMD_BIND_GB_SCREENTARGET:
|
---|
4958 | {
|
---|
4959 | SVGA3dCmdBindGBScreenTarget *pCmd = (SVGA3dCmdBindGBScreenTarget *)pvCmd;
|
---|
4960 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4961 | vmsvga3dCmdBindGBScreenTarget(pThisCC, pCmd);
|
---|
4962 | break;
|
---|
4963 | }
|
---|
4964 |
|
---|
4965 | case SVGA_3D_CMD_UPDATE_GB_SCREENTARGET:
|
---|
4966 | {
|
---|
4967 | SVGA3dCmdUpdateGBScreenTarget *pCmd = (SVGA3dCmdUpdateGBScreenTarget *)pvCmd;
|
---|
4968 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4969 | vmsvga3dCmdUpdateGBScreenTarget(pThisCC, pCmd);
|
---|
4970 | break;
|
---|
4971 | }
|
---|
4972 |
|
---|
4973 | case SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL:
|
---|
4974 | {
|
---|
4975 | SVGA3dCmdReadbackGBImagePartial *pCmd = (SVGA3dCmdReadbackGBImagePartial *)pvCmd;
|
---|
4976 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4977 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4978 | break;
|
---|
4979 | }
|
---|
4980 |
|
---|
4981 | case SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL:
|
---|
4982 | {
|
---|
4983 | SVGA3dCmdInvalidateGBImagePartial *pCmd = (SVGA3dCmdInvalidateGBImagePartial *)pvCmd;
|
---|
4984 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4985 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4986 | break;
|
---|
4987 | }
|
---|
4988 |
|
---|
4989 | case SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE:
|
---|
4990 | {
|
---|
4991 | SVGA3dCmdSetGBShaderConstInline *pCmd = (SVGA3dCmdSetGBShaderConstInline *)pvCmd;
|
---|
4992 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4993 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4994 | break;
|
---|
4995 | }
|
---|
4996 |
|
---|
4997 | case SVGA_3D_CMD_GB_SCREEN_DMA:
|
---|
4998 | {
|
---|
4999 | SVGA3dCmdGBScreenDMA *pCmd = (SVGA3dCmdGBScreenDMA *)pvCmd;
|
---|
5000 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5001 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5002 | break;
|
---|
5003 | }
|
---|
5004 |
|
---|
5005 | case SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH:
|
---|
5006 | {
|
---|
5007 | SVGA3dCmdBindGBSurfaceWithPitch *pCmd = (SVGA3dCmdBindGBSurfaceWithPitch *)pvCmd;
|
---|
5008 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5009 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5010 | break;
|
---|
5011 | }
|
---|
5012 |
|
---|
5013 | case SVGA_3D_CMD_GB_MOB_FENCE:
|
---|
5014 | {
|
---|
5015 | SVGA3dCmdGBMobFence *pCmd = (SVGA3dCmdGBMobFence *)pvCmd;
|
---|
5016 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5017 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5018 | break;
|
---|
5019 | }
|
---|
5020 |
|
---|
5021 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V2:
|
---|
5022 | {
|
---|
5023 | SVGA3dCmdDefineGBSurface_v2 *pCmd = (SVGA3dCmdDefineGBSurface_v2 *)pvCmd;
|
---|
5024 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5025 | vmsvga3dCmdDefineGBSurface_v2(pThisCC, pCmd);
|
---|
5026 | break;
|
---|
5027 | }
|
---|
5028 |
|
---|
5029 | case SVGA_3D_CMD_DEFINE_GB_MOB64:
|
---|
5030 | {
|
---|
5031 | SVGA3dCmdDefineGBMob64 *pCmd = (SVGA3dCmdDefineGBMob64 *)pvCmd;
|
---|
5032 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5033 | vmsvga3dCmdDefineGBMob64(pThisCC, pCmd);
|
---|
5034 | break;
|
---|
5035 | }
|
---|
5036 |
|
---|
5037 | case SVGA_3D_CMD_REDEFINE_GB_MOB64:
|
---|
5038 | {
|
---|
5039 | SVGA3dCmdRedefineGBMob64 *pCmd = (SVGA3dCmdRedefineGBMob64 *)pvCmd;
|
---|
5040 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5041 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5042 | break;
|
---|
5043 | }
|
---|
5044 |
|
---|
5045 | case SVGA_3D_CMD_NOP_ERROR:
|
---|
5046 | {
|
---|
5047 | /* Apparently there is nothing to do. */
|
---|
5048 | break;
|
---|
5049 | }
|
---|
5050 |
|
---|
5051 | case SVGA_3D_CMD_SET_VERTEX_STREAMS:
|
---|
5052 | {
|
---|
5053 | SVGA3dCmdSetVertexStreams *pCmd = (SVGA3dCmdSetVertexStreams *)pvCmd;
|
---|
5054 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5055 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5056 | break;
|
---|
5057 | }
|
---|
5058 |
|
---|
5059 | case SVGA_3D_CMD_SET_VERTEX_DECLS:
|
---|
5060 | {
|
---|
5061 | SVGA3dCmdSetVertexDecls *pCmd = (SVGA3dCmdSetVertexDecls *)pvCmd;
|
---|
5062 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5063 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5064 | break;
|
---|
5065 | }
|
---|
5066 |
|
---|
5067 | case SVGA_3D_CMD_SET_VERTEX_DIVISORS:
|
---|
5068 | {
|
---|
5069 | SVGA3dCmdSetVertexDivisors *pCmd = (SVGA3dCmdSetVertexDivisors *)pvCmd;
|
---|
5070 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5071 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5072 | break;
|
---|
5073 | }
|
---|
5074 |
|
---|
5075 | case SVGA_3D_CMD_DRAW:
|
---|
5076 | {
|
---|
5077 | /* No corresponding SVGA3dCmd structure. */
|
---|
5078 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5079 | break;
|
---|
5080 | }
|
---|
5081 |
|
---|
5082 | case SVGA_3D_CMD_DRAW_INDEXED:
|
---|
5083 | {
|
---|
5084 | /* No corresponding SVGA3dCmd structure. */
|
---|
5085 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5086 | break;
|
---|
5087 | }
|
---|
5088 |
|
---|
5089 | case SVGA_3D_CMD_DX_DEFINE_CONTEXT:
|
---|
5090 | {
|
---|
5091 | SVGA3dCmdDXDefineContext *pCmd = (SVGA3dCmdDXDefineContext *)pvCmd;
|
---|
5092 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5093 | rcParse = vmsvga3dCmdDXDefineContext(pThisCC, pCmd, cbCmd);
|
---|
5094 | break;
|
---|
5095 | }
|
---|
5096 |
|
---|
5097 | case SVGA_3D_CMD_DX_DESTROY_CONTEXT:
|
---|
5098 | {
|
---|
5099 | SVGA3dCmdDXDestroyContext *pCmd = (SVGA3dCmdDXDestroyContext *)pvCmd;
|
---|
5100 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5101 | rcParse = vmsvga3dCmdDXDestroyContext(pThisCC, pCmd, cbCmd);
|
---|
5102 | break;
|
---|
5103 | }
|
---|
5104 |
|
---|
5105 | case SVGA_3D_CMD_DX_BIND_CONTEXT:
|
---|
5106 | {
|
---|
5107 | SVGA3dCmdDXBindContext *pCmd = (SVGA3dCmdDXBindContext *)pvCmd;
|
---|
5108 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5109 | rcParse = vmsvga3dCmdDXBindContext(pThisCC, pCmd, cbCmd);
|
---|
5110 | break;
|
---|
5111 | }
|
---|
5112 |
|
---|
5113 | case SVGA_3D_CMD_DX_READBACK_CONTEXT:
|
---|
5114 | {
|
---|
5115 | SVGA3dCmdDXReadbackContext *pCmd = (SVGA3dCmdDXReadbackContext *)pvCmd;
|
---|
5116 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5117 | rcParse = vmsvga3dCmdDXReadbackContext(pThisCC, pCmd, cbCmd);
|
---|
5118 | break;
|
---|
5119 | }
|
---|
5120 |
|
---|
5121 | case SVGA_3D_CMD_DX_INVALIDATE_CONTEXT:
|
---|
5122 | {
|
---|
5123 | SVGA3dCmdDXInvalidateContext *pCmd = (SVGA3dCmdDXInvalidateContext *)pvCmd;
|
---|
5124 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5125 | rcParse = vmsvga3dCmdDXInvalidateContext(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5126 | break;
|
---|
5127 | }
|
---|
5128 |
|
---|
5129 | case SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER:
|
---|
5130 | {
|
---|
5131 | SVGA3dCmdDXSetSingleConstantBuffer *pCmd = (SVGA3dCmdDXSetSingleConstantBuffer *)pvCmd;
|
---|
5132 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5133 | rcParse = vmsvga3dCmdDXSetSingleConstantBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5134 | break;
|
---|
5135 | }
|
---|
5136 |
|
---|
5137 | case SVGA_3D_CMD_DX_SET_SHADER_RESOURCES:
|
---|
5138 | {
|
---|
5139 | SVGA3dCmdDXSetShaderResources *pCmd = (SVGA3dCmdDXSetShaderResources *)pvCmd;
|
---|
5140 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5141 | rcParse = vmsvga3dCmdDXSetShaderResources(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5142 | break;
|
---|
5143 | }
|
---|
5144 |
|
---|
5145 | case SVGA_3D_CMD_DX_SET_SHADER:
|
---|
5146 | {
|
---|
5147 | SVGA3dCmdDXSetShader *pCmd = (SVGA3dCmdDXSetShader *)pvCmd;
|
---|
5148 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5149 | rcParse = vmsvga3dCmdDXSetShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5150 | break;
|
---|
5151 | }
|
---|
5152 |
|
---|
5153 | case SVGA_3D_CMD_DX_SET_SAMPLERS:
|
---|
5154 | {
|
---|
5155 | SVGA3dCmdDXSetSamplers *pCmd = (SVGA3dCmdDXSetSamplers *)pvCmd;
|
---|
5156 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5157 | rcParse = vmsvga3dCmdDXSetSamplers(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5158 | break;
|
---|
5159 | }
|
---|
5160 |
|
---|
5161 | case SVGA_3D_CMD_DX_DRAW:
|
---|
5162 | {
|
---|
5163 | SVGA3dCmdDXDraw *pCmd = (SVGA3dCmdDXDraw *)pvCmd;
|
---|
5164 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5165 | rcParse = vmsvga3dCmdDXDraw(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5166 | break;
|
---|
5167 | }
|
---|
5168 |
|
---|
5169 | case SVGA_3D_CMD_DX_DRAW_INDEXED:
|
---|
5170 | {
|
---|
5171 | SVGA3dCmdDXDrawIndexed *pCmd = (SVGA3dCmdDXDrawIndexed *)pvCmd;
|
---|
5172 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5173 | rcParse = vmsvga3dCmdDXDrawIndexed(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5174 | break;
|
---|
5175 | }
|
---|
5176 |
|
---|
5177 | case SVGA_3D_CMD_DX_DRAW_INSTANCED:
|
---|
5178 | {
|
---|
5179 | SVGA3dCmdDXDrawInstanced *pCmd = (SVGA3dCmdDXDrawInstanced *)pvCmd;
|
---|
5180 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5181 | rcParse = vmsvga3dCmdDXDrawInstanced(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5182 | break;
|
---|
5183 | }
|
---|
5184 |
|
---|
5185 | case SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED:
|
---|
5186 | {
|
---|
5187 | SVGA3dCmdDXDrawIndexedInstanced *pCmd = (SVGA3dCmdDXDrawIndexedInstanced *)pvCmd;
|
---|
5188 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5189 | rcParse = vmsvga3dCmdDXDrawIndexedInstanced(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5190 | break;
|
---|
5191 | }
|
---|
5192 |
|
---|
5193 | case SVGA_3D_CMD_DX_DRAW_AUTO:
|
---|
5194 | {
|
---|
5195 | SVGA3dCmdDXDrawAuto *pCmd = (SVGA3dCmdDXDrawAuto *)pvCmd;
|
---|
5196 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5197 | rcParse = vmsvga3dCmdDXDrawAuto(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5198 | break;
|
---|
5199 | }
|
---|
5200 |
|
---|
5201 | case SVGA_3D_CMD_DX_SET_INPUT_LAYOUT:
|
---|
5202 | {
|
---|
5203 | SVGA3dCmdDXSetInputLayout *pCmd = (SVGA3dCmdDXSetInputLayout *)pvCmd;
|
---|
5204 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5205 | rcParse = vmsvga3dCmdDXSetInputLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5206 | break;
|
---|
5207 | }
|
---|
5208 |
|
---|
5209 | case SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS:
|
---|
5210 | {
|
---|
5211 | SVGA3dCmdDXSetVertexBuffers *pCmd = (SVGA3dCmdDXSetVertexBuffers *)pvCmd;
|
---|
5212 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5213 | rcParse = vmsvga3dCmdDXSetVertexBuffers(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5214 | break;
|
---|
5215 | }
|
---|
5216 |
|
---|
5217 | case SVGA_3D_CMD_DX_SET_INDEX_BUFFER:
|
---|
5218 | {
|
---|
5219 | SVGA3dCmdDXSetIndexBuffer *pCmd = (SVGA3dCmdDXSetIndexBuffer *)pvCmd;
|
---|
5220 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5221 | rcParse = vmsvga3dCmdDXSetIndexBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5222 | break;
|
---|
5223 | }
|
---|
5224 |
|
---|
5225 | case SVGA_3D_CMD_DX_SET_TOPOLOGY:
|
---|
5226 | {
|
---|
5227 | SVGA3dCmdDXSetTopology *pCmd = (SVGA3dCmdDXSetTopology *)pvCmd;
|
---|
5228 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5229 | rcParse = vmsvga3dCmdDXSetTopology(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5230 | break;
|
---|
5231 | }
|
---|
5232 |
|
---|
5233 | case SVGA_3D_CMD_DX_SET_RENDERTARGETS:
|
---|
5234 | {
|
---|
5235 | SVGA3dCmdDXSetRenderTargets *pCmd = (SVGA3dCmdDXSetRenderTargets *)pvCmd;
|
---|
5236 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5237 | rcParse = vmsvga3dCmdDXSetRenderTargets(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5238 | break;
|
---|
5239 | }
|
---|
5240 |
|
---|
5241 | case SVGA_3D_CMD_DX_SET_BLEND_STATE:
|
---|
5242 | {
|
---|
5243 | SVGA3dCmdDXSetBlendState *pCmd = (SVGA3dCmdDXSetBlendState *)pvCmd;
|
---|
5244 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5245 | rcParse = vmsvga3dCmdDXSetBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5246 | break;
|
---|
5247 | }
|
---|
5248 |
|
---|
5249 | case SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE:
|
---|
5250 | {
|
---|
5251 | SVGA3dCmdDXSetDepthStencilState *pCmd = (SVGA3dCmdDXSetDepthStencilState *)pvCmd;
|
---|
5252 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5253 | rcParse = vmsvga3dCmdDXSetDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5254 | break;
|
---|
5255 | }
|
---|
5256 |
|
---|
5257 | case SVGA_3D_CMD_DX_SET_RASTERIZER_STATE:
|
---|
5258 | {
|
---|
5259 | SVGA3dCmdDXSetRasterizerState *pCmd = (SVGA3dCmdDXSetRasterizerState *)pvCmd;
|
---|
5260 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5261 | rcParse = vmsvga3dCmdDXSetRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5262 | break;
|
---|
5263 | }
|
---|
5264 |
|
---|
5265 | case SVGA_3D_CMD_DX_DEFINE_QUERY:
|
---|
5266 | {
|
---|
5267 | SVGA3dCmdDXDefineQuery *pCmd = (SVGA3dCmdDXDefineQuery *)pvCmd;
|
---|
5268 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5269 | rcParse = vmsvga3dCmdDXDefineQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5270 | break;
|
---|
5271 | }
|
---|
5272 |
|
---|
5273 | case SVGA_3D_CMD_DX_DESTROY_QUERY:
|
---|
5274 | {
|
---|
5275 | SVGA3dCmdDXDestroyQuery *pCmd = (SVGA3dCmdDXDestroyQuery *)pvCmd;
|
---|
5276 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5277 | rcParse = vmsvga3dCmdDXDestroyQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5278 | break;
|
---|
5279 | }
|
---|
5280 |
|
---|
5281 | case SVGA_3D_CMD_DX_BIND_QUERY:
|
---|
5282 | {
|
---|
5283 | SVGA3dCmdDXBindQuery *pCmd = (SVGA3dCmdDXBindQuery *)pvCmd;
|
---|
5284 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5285 | rcParse = vmsvga3dCmdDXBindQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5286 | break;
|
---|
5287 | }
|
---|
5288 |
|
---|
5289 | case SVGA_3D_CMD_DX_SET_QUERY_OFFSET:
|
---|
5290 | {
|
---|
5291 | SVGA3dCmdDXSetQueryOffset *pCmd = (SVGA3dCmdDXSetQueryOffset *)pvCmd;
|
---|
5292 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5293 | rcParse = vmsvga3dCmdDXSetQueryOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5294 | break;
|
---|
5295 | }
|
---|
5296 |
|
---|
5297 | case SVGA_3D_CMD_DX_BEGIN_QUERY:
|
---|
5298 | {
|
---|
5299 | SVGA3dCmdDXBeginQuery *pCmd = (SVGA3dCmdDXBeginQuery *)pvCmd;
|
---|
5300 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5301 | rcParse = vmsvga3dCmdDXBeginQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5302 | break;
|
---|
5303 | }
|
---|
5304 |
|
---|
5305 | case SVGA_3D_CMD_DX_END_QUERY:
|
---|
5306 | {
|
---|
5307 | SVGA3dCmdDXEndQuery *pCmd = (SVGA3dCmdDXEndQuery *)pvCmd;
|
---|
5308 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5309 | rcParse = vmsvga3dCmdDXEndQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5310 | break;
|
---|
5311 | }
|
---|
5312 |
|
---|
5313 | case SVGA_3D_CMD_DX_READBACK_QUERY:
|
---|
5314 | {
|
---|
5315 | SVGA3dCmdDXReadbackQuery *pCmd = (SVGA3dCmdDXReadbackQuery *)pvCmd;
|
---|
5316 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5317 | rcParse = vmsvga3dCmdDXReadbackQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5318 | break;
|
---|
5319 | }
|
---|
5320 |
|
---|
5321 | case SVGA_3D_CMD_DX_SET_PREDICATION:
|
---|
5322 | {
|
---|
5323 | SVGA3dCmdDXSetPredication *pCmd = (SVGA3dCmdDXSetPredication *)pvCmd;
|
---|
5324 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5325 | rcParse = vmsvga3dCmdDXSetPredication(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5326 | break;
|
---|
5327 | }
|
---|
5328 |
|
---|
5329 | case SVGA_3D_CMD_DX_SET_SOTARGETS:
|
---|
5330 | {
|
---|
5331 | SVGA3dCmdDXSetSOTargets *pCmd = (SVGA3dCmdDXSetSOTargets *)pvCmd;
|
---|
5332 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5333 | rcParse = vmsvga3dCmdDXSetSOTargets(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5334 | break;
|
---|
5335 | }
|
---|
5336 |
|
---|
5337 | case SVGA_3D_CMD_DX_SET_VIEWPORTS:
|
---|
5338 | {
|
---|
5339 | SVGA3dCmdDXSetViewports *pCmd = (SVGA3dCmdDXSetViewports *)pvCmd;
|
---|
5340 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5341 | rcParse = vmsvga3dCmdDXSetViewports(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5342 | break;
|
---|
5343 | }
|
---|
5344 |
|
---|
5345 | case SVGA_3D_CMD_DX_SET_SCISSORRECTS:
|
---|
5346 | {
|
---|
5347 | SVGA3dCmdDXSetScissorRects *pCmd = (SVGA3dCmdDXSetScissorRects *)pvCmd;
|
---|
5348 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5349 | rcParse = vmsvga3dCmdDXSetScissorRects(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5350 | break;
|
---|
5351 | }
|
---|
5352 |
|
---|
5353 | case SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW:
|
---|
5354 | {
|
---|
5355 | SVGA3dCmdDXClearRenderTargetView *pCmd = (SVGA3dCmdDXClearRenderTargetView *)pvCmd;
|
---|
5356 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5357 | rcParse = vmsvga3dCmdDXClearRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5358 | break;
|
---|
5359 | }
|
---|
5360 |
|
---|
5361 | case SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW:
|
---|
5362 | {
|
---|
5363 | SVGA3dCmdDXClearDepthStencilView *pCmd = (SVGA3dCmdDXClearDepthStencilView *)pvCmd;
|
---|
5364 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5365 | rcParse = vmsvga3dCmdDXClearDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5366 | break;
|
---|
5367 | }
|
---|
5368 |
|
---|
5369 | case SVGA_3D_CMD_DX_PRED_COPY_REGION:
|
---|
5370 | {
|
---|
5371 | SVGA3dCmdDXPredCopyRegion *pCmd = (SVGA3dCmdDXPredCopyRegion *)pvCmd;
|
---|
5372 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5373 | rcParse = vmsvga3dCmdDXPredCopyRegion(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5374 | break;
|
---|
5375 | }
|
---|
5376 |
|
---|
5377 | case SVGA_3D_CMD_DX_PRED_COPY:
|
---|
5378 | {
|
---|
5379 | SVGA3dCmdDXPredCopy *pCmd = (SVGA3dCmdDXPredCopy *)pvCmd;
|
---|
5380 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5381 | rcParse = vmsvga3dCmdDXPredCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5382 | break;
|
---|
5383 | }
|
---|
5384 |
|
---|
5385 | case SVGA_3D_CMD_DX_PRESENTBLT:
|
---|
5386 | {
|
---|
5387 | SVGA3dCmdDXPresentBlt *pCmd = (SVGA3dCmdDXPresentBlt *)pvCmd;
|
---|
5388 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5389 | rcParse = vmsvga3dCmdDXPresentBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5390 | break;
|
---|
5391 | }
|
---|
5392 |
|
---|
5393 | case SVGA_3D_CMD_DX_GENMIPS:
|
---|
5394 | {
|
---|
5395 | SVGA3dCmdDXGenMips *pCmd = (SVGA3dCmdDXGenMips *)pvCmd;
|
---|
5396 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5397 | rcParse = vmsvga3dCmdDXGenMips(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5398 | break;
|
---|
5399 | }
|
---|
5400 |
|
---|
5401 | case SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE:
|
---|
5402 | {
|
---|
5403 | SVGA3dCmdDXUpdateSubResource *pCmd = (SVGA3dCmdDXUpdateSubResource *)pvCmd;
|
---|
5404 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5405 | rcParse = vmsvga3dCmdDXUpdateSubResource(pThisCC, pCmd, cbCmd);
|
---|
5406 | break;
|
---|
5407 | }
|
---|
5408 |
|
---|
5409 | case SVGA_3D_CMD_DX_READBACK_SUBRESOURCE:
|
---|
5410 | {
|
---|
5411 | SVGA3dCmdDXReadbackSubResource *pCmd = (SVGA3dCmdDXReadbackSubResource *)pvCmd;
|
---|
5412 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5413 | rcParse = vmsvga3dCmdDXReadbackSubResource(pThisCC, pCmd, cbCmd);
|
---|
5414 | break;
|
---|
5415 | }
|
---|
5416 |
|
---|
5417 | case SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE:
|
---|
5418 | {
|
---|
5419 | SVGA3dCmdDXInvalidateSubResource *pCmd = (SVGA3dCmdDXInvalidateSubResource *)pvCmd;
|
---|
5420 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5421 | rcParse = vmsvga3dCmdDXInvalidateSubResource(pThisCC, pCmd, cbCmd);
|
---|
5422 | break;
|
---|
5423 | }
|
---|
5424 |
|
---|
5425 | case SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW:
|
---|
5426 | {
|
---|
5427 | SVGA3dCmdDXDefineShaderResourceView *pCmd = (SVGA3dCmdDXDefineShaderResourceView *)pvCmd;
|
---|
5428 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5429 | rcParse = vmsvga3dCmdDXDefineShaderResourceView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5430 | break;
|
---|
5431 | }
|
---|
5432 |
|
---|
5433 | case SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW:
|
---|
5434 | {
|
---|
5435 | SVGA3dCmdDXDestroyShaderResourceView *pCmd = (SVGA3dCmdDXDestroyShaderResourceView *)pvCmd;
|
---|
5436 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5437 | rcParse = vmsvga3dCmdDXDestroyShaderResourceView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5438 | break;
|
---|
5439 | }
|
---|
5440 |
|
---|
5441 | case SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW:
|
---|
5442 | {
|
---|
5443 | SVGA3dCmdDXDefineRenderTargetView *pCmd = (SVGA3dCmdDXDefineRenderTargetView *)pvCmd;
|
---|
5444 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5445 | rcParse = vmsvga3dCmdDXDefineRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5446 | break;
|
---|
5447 | }
|
---|
5448 |
|
---|
5449 | case SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW:
|
---|
5450 | {
|
---|
5451 | SVGA3dCmdDXDestroyRenderTargetView *pCmd = (SVGA3dCmdDXDestroyRenderTargetView *)pvCmd;
|
---|
5452 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5453 | rcParse = vmsvga3dCmdDXDestroyRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5454 | break;
|
---|
5455 | }
|
---|
5456 |
|
---|
5457 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW:
|
---|
5458 | {
|
---|
5459 | SVGA3dCmdDXDefineDepthStencilView *pCmd = (SVGA3dCmdDXDefineDepthStencilView *)pvCmd;
|
---|
5460 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5461 | rcParse = vmsvga3dCmdDXDefineDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5462 | break;
|
---|
5463 | }
|
---|
5464 |
|
---|
5465 | case SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW:
|
---|
5466 | {
|
---|
5467 | SVGA3dCmdDXDestroyDepthStencilView *pCmd = (SVGA3dCmdDXDestroyDepthStencilView *)pvCmd;
|
---|
5468 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5469 | rcParse = vmsvga3dCmdDXDestroyDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5470 | break;
|
---|
5471 | }
|
---|
5472 |
|
---|
5473 | case SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT:
|
---|
5474 | {
|
---|
5475 | SVGA3dCmdDXDefineElementLayout *pCmd = (SVGA3dCmdDXDefineElementLayout *)pvCmd;
|
---|
5476 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5477 | rcParse = vmsvga3dCmdDXDefineElementLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5478 | break;
|
---|
5479 | }
|
---|
5480 |
|
---|
5481 | case SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT:
|
---|
5482 | {
|
---|
5483 | SVGA3dCmdDXDestroyElementLayout *pCmd = (SVGA3dCmdDXDestroyElementLayout *)pvCmd;
|
---|
5484 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5485 | rcParse = vmsvga3dCmdDXDestroyElementLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5486 | break;
|
---|
5487 | }
|
---|
5488 |
|
---|
5489 | case SVGA_3D_CMD_DX_DEFINE_BLEND_STATE:
|
---|
5490 | {
|
---|
5491 | SVGA3dCmdDXDefineBlendState *pCmd = (SVGA3dCmdDXDefineBlendState *)pvCmd;
|
---|
5492 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5493 | rcParse = vmsvga3dCmdDXDefineBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5494 | break;
|
---|
5495 | }
|
---|
5496 |
|
---|
5497 | case SVGA_3D_CMD_DX_DESTROY_BLEND_STATE:
|
---|
5498 | {
|
---|
5499 | SVGA3dCmdDXDestroyBlendState *pCmd = (SVGA3dCmdDXDestroyBlendState *)pvCmd;
|
---|
5500 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5501 | rcParse = vmsvga3dCmdDXDestroyBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5502 | break;
|
---|
5503 | }
|
---|
5504 |
|
---|
5505 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE:
|
---|
5506 | {
|
---|
5507 | SVGA3dCmdDXDefineDepthStencilState *pCmd = (SVGA3dCmdDXDefineDepthStencilState *)pvCmd;
|
---|
5508 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5509 | rcParse = vmsvga3dCmdDXDefineDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5510 | break;
|
---|
5511 | }
|
---|
5512 |
|
---|
5513 | case SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE:
|
---|
5514 | {
|
---|
5515 | SVGA3dCmdDXDestroyDepthStencilState *pCmd = (SVGA3dCmdDXDestroyDepthStencilState *)pvCmd;
|
---|
5516 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5517 | rcParse = vmsvga3dCmdDXDestroyDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5518 | break;
|
---|
5519 | }
|
---|
5520 |
|
---|
5521 | case SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE:
|
---|
5522 | {
|
---|
5523 | SVGA3dCmdDXDefineRasterizerState *pCmd = (SVGA3dCmdDXDefineRasterizerState *)pvCmd;
|
---|
5524 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5525 | rcParse = vmsvga3dCmdDXDefineRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5526 | break;
|
---|
5527 | }
|
---|
5528 |
|
---|
5529 | case SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE:
|
---|
5530 | {
|
---|
5531 | SVGA3dCmdDXDestroyRasterizerState *pCmd = (SVGA3dCmdDXDestroyRasterizerState *)pvCmd;
|
---|
5532 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5533 | rcParse = vmsvga3dCmdDXDestroyRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5534 | break;
|
---|
5535 | }
|
---|
5536 |
|
---|
5537 | case SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE:
|
---|
5538 | {
|
---|
5539 | SVGA3dCmdDXDefineSamplerState *pCmd = (SVGA3dCmdDXDefineSamplerState *)pvCmd;
|
---|
5540 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5541 | rcParse = vmsvga3dCmdDXDefineSamplerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5542 | break;
|
---|
5543 | }
|
---|
5544 |
|
---|
5545 | case SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE:
|
---|
5546 | {
|
---|
5547 | SVGA3dCmdDXDestroySamplerState *pCmd = (SVGA3dCmdDXDestroySamplerState *)pvCmd;
|
---|
5548 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5549 | rcParse = vmsvga3dCmdDXDestroySamplerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5550 | break;
|
---|
5551 | }
|
---|
5552 |
|
---|
5553 | case SVGA_3D_CMD_DX_DEFINE_SHADER:
|
---|
5554 | {
|
---|
5555 | SVGA3dCmdDXDefineShader *pCmd = (SVGA3dCmdDXDefineShader *)pvCmd;
|
---|
5556 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5557 | rcParse = vmsvga3dCmdDXDefineShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5558 | break;
|
---|
5559 | }
|
---|
5560 |
|
---|
5561 | case SVGA_3D_CMD_DX_DESTROY_SHADER:
|
---|
5562 | {
|
---|
5563 | SVGA3dCmdDXDestroyShader *pCmd = (SVGA3dCmdDXDestroyShader *)pvCmd;
|
---|
5564 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5565 | rcParse = vmsvga3dCmdDXDestroyShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5566 | break;
|
---|
5567 | }
|
---|
5568 |
|
---|
5569 | case SVGA_3D_CMD_DX_BIND_SHADER:
|
---|
5570 | {
|
---|
5571 | SVGA3dCmdDXBindShader *pCmd = (SVGA3dCmdDXBindShader *)pvCmd;
|
---|
5572 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5573 | rcParse = vmsvga3dCmdDXBindShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5574 | break;
|
---|
5575 | }
|
---|
5576 |
|
---|
5577 | case SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT:
|
---|
5578 | {
|
---|
5579 | SVGA3dCmdDXDefineStreamOutput *pCmd = (SVGA3dCmdDXDefineStreamOutput *)pvCmd;
|
---|
5580 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5581 | rcParse = vmsvga3dCmdDXDefineStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5582 | break;
|
---|
5583 | }
|
---|
5584 |
|
---|
5585 | case SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT:
|
---|
5586 | {
|
---|
5587 | SVGA3dCmdDXDestroyStreamOutput *pCmd = (SVGA3dCmdDXDestroyStreamOutput *)pvCmd;
|
---|
5588 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5589 | rcParse = vmsvga3dCmdDXDestroyStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5590 | break;
|
---|
5591 | }
|
---|
5592 |
|
---|
5593 | case SVGA_3D_CMD_DX_SET_STREAMOUTPUT:
|
---|
5594 | {
|
---|
5595 | SVGA3dCmdDXSetStreamOutput *pCmd = (SVGA3dCmdDXSetStreamOutput *)pvCmd;
|
---|
5596 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5597 | rcParse = vmsvga3dCmdDXSetStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5598 | break;
|
---|
5599 | }
|
---|
5600 |
|
---|
5601 | case SVGA_3D_CMD_DX_SET_COTABLE:
|
---|
5602 | {
|
---|
5603 | SVGA3dCmdDXSetCOTable *pCmd = (SVGA3dCmdDXSetCOTable *)pvCmd;
|
---|
5604 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5605 | rcParse = vmsvga3dCmdDXSetCOTable(pThisCC, pCmd, cbCmd);
|
---|
5606 | break;
|
---|
5607 | }
|
---|
5608 |
|
---|
5609 | case SVGA_3D_CMD_DX_READBACK_COTABLE:
|
---|
5610 | {
|
---|
5611 | SVGA3dCmdDXReadbackCOTable *pCmd = (SVGA3dCmdDXReadbackCOTable *)pvCmd;
|
---|
5612 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5613 | rcParse = vmsvga3dCmdDXReadbackCOTable(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5614 | break;
|
---|
5615 | }
|
---|
5616 |
|
---|
5617 | case SVGA_3D_CMD_DX_BUFFER_COPY:
|
---|
5618 | {
|
---|
5619 | SVGA3dCmdDXBufferCopy *pCmd = (SVGA3dCmdDXBufferCopy *)pvCmd;
|
---|
5620 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5621 | rcParse = vmsvga3dCmdDXBufferCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5622 | break;
|
---|
5623 | }
|
---|
5624 |
|
---|
5625 | case SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER:
|
---|
5626 | {
|
---|
5627 | SVGA3dCmdDXTransferFromBuffer *pCmd = (SVGA3dCmdDXTransferFromBuffer *)pvCmd;
|
---|
5628 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5629 | rcParse = vmsvga3dCmdDXTransferFromBuffer(pThisCC, pCmd, cbCmd);
|
---|
5630 | break;
|
---|
5631 | }
|
---|
5632 |
|
---|
5633 | case SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK:
|
---|
5634 | {
|
---|
5635 | SVGA3dCmdDXSurfaceCopyAndReadback *pCmd = (SVGA3dCmdDXSurfaceCopyAndReadback *)pvCmd;
|
---|
5636 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5637 | rcParse = vmsvga3dCmdDXSurfaceCopyAndReadback(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5638 | break;
|
---|
5639 | }
|
---|
5640 |
|
---|
5641 | case SVGA_3D_CMD_DX_MOVE_QUERY:
|
---|
5642 | {
|
---|
5643 | SVGA3dCmdDXMoveQuery *pCmd = (SVGA3dCmdDXMoveQuery *)pvCmd;
|
---|
5644 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5645 | rcParse = vmsvga3dCmdDXMoveQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5646 | break;
|
---|
5647 | }
|
---|
5648 |
|
---|
5649 | case SVGA_3D_CMD_DX_BIND_ALL_QUERY:
|
---|
5650 | {
|
---|
5651 | SVGA3dCmdDXBindAllQuery *pCmd = (SVGA3dCmdDXBindAllQuery *)pvCmd;
|
---|
5652 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5653 | rcParse = vmsvga3dCmdDXBindAllQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5654 | break;
|
---|
5655 | }
|
---|
5656 |
|
---|
5657 | case SVGA_3D_CMD_DX_READBACK_ALL_QUERY:
|
---|
5658 | {
|
---|
5659 | SVGA3dCmdDXReadbackAllQuery *pCmd = (SVGA3dCmdDXReadbackAllQuery *)pvCmd;
|
---|
5660 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5661 | rcParse = vmsvga3dCmdDXReadbackAllQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5662 | break;
|
---|
5663 | }
|
---|
5664 |
|
---|
5665 | case SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER:
|
---|
5666 | {
|
---|
5667 | SVGA3dCmdDXPredTransferFromBuffer *pCmd = (SVGA3dCmdDXPredTransferFromBuffer *)pvCmd;
|
---|
5668 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5669 | rcParse = vmsvga3dCmdDXPredTransferFromBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5670 | break;
|
---|
5671 | }
|
---|
5672 |
|
---|
5673 | case SVGA_3D_CMD_DX_MOB_FENCE_64:
|
---|
5674 | {
|
---|
5675 | SVGA3dCmdDXMobFence64 *pCmd = (SVGA3dCmdDXMobFence64 *)pvCmd;
|
---|
5676 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5677 | rcParse = vmsvga3dCmdDXMobFence64(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5678 | break;
|
---|
5679 | }
|
---|
5680 |
|
---|
5681 | case SVGA_3D_CMD_DX_BIND_ALL_SHADER:
|
---|
5682 | {
|
---|
5683 | SVGA3dCmdDXBindAllShader *pCmd = (SVGA3dCmdDXBindAllShader *)pvCmd;
|
---|
5684 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5685 | rcParse = vmsvga3dCmdDXBindAllShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5686 | break;
|
---|
5687 | }
|
---|
5688 |
|
---|
5689 | case SVGA_3D_CMD_DX_HINT:
|
---|
5690 | {
|
---|
5691 | SVGA3dCmdDXHint *pCmd = (SVGA3dCmdDXHint *)pvCmd;
|
---|
5692 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5693 | rcParse = vmsvga3dCmdDXHint(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5694 | break;
|
---|
5695 | }
|
---|
5696 |
|
---|
5697 | case SVGA_3D_CMD_DX_BUFFER_UPDATE:
|
---|
5698 | {
|
---|
5699 | SVGA3dCmdDXBufferUpdate *pCmd = (SVGA3dCmdDXBufferUpdate *)pvCmd;
|
---|
5700 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5701 | rcParse = vmsvga3dCmdDXBufferUpdate(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5702 | break;
|
---|
5703 | }
|
---|
5704 |
|
---|
5705 | case SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET:
|
---|
5706 | {
|
---|
5707 | SVGA3dCmdDXSetVSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetVSConstantBufferOffset *)pvCmd;
|
---|
5708 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5709 | rcParse = vmsvga3dCmdDXSetVSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5710 | break;
|
---|
5711 | }
|
---|
5712 |
|
---|
5713 | case SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET:
|
---|
5714 | {
|
---|
5715 | SVGA3dCmdDXSetPSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetPSConstantBufferOffset *)pvCmd;
|
---|
5716 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5717 | rcParse = vmsvga3dCmdDXSetPSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5718 | break;
|
---|
5719 | }
|
---|
5720 |
|
---|
5721 | case SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET:
|
---|
5722 | {
|
---|
5723 | SVGA3dCmdDXSetGSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetGSConstantBufferOffset *)pvCmd;
|
---|
5724 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5725 | rcParse = vmsvga3dCmdDXSetGSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5726 | break;
|
---|
5727 | }
|
---|
5728 |
|
---|
5729 | case SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET:
|
---|
5730 | {
|
---|
5731 | SVGA3dCmdDXSetHSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetHSConstantBufferOffset *)pvCmd;
|
---|
5732 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5733 | rcParse = vmsvga3dCmdDXSetHSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5734 | break;
|
---|
5735 | }
|
---|
5736 |
|
---|
5737 | case SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET:
|
---|
5738 | {
|
---|
5739 | SVGA3dCmdDXSetDSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetDSConstantBufferOffset *)pvCmd;
|
---|
5740 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5741 | rcParse = vmsvga3dCmdDXSetDSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5742 | break;
|
---|
5743 | }
|
---|
5744 |
|
---|
5745 | case SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET:
|
---|
5746 | {
|
---|
5747 | SVGA3dCmdDXSetCSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetCSConstantBufferOffset *)pvCmd;
|
---|
5748 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5749 | rcParse = vmsvga3dCmdDXSetCSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5750 | break;
|
---|
5751 | }
|
---|
5752 |
|
---|
5753 | case SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER:
|
---|
5754 | {
|
---|
5755 | SVGA3dCmdDXCondBindAllShader *pCmd = (SVGA3dCmdDXCondBindAllShader *)pvCmd;
|
---|
5756 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5757 | rcParse = vmsvga3dCmdDXCondBindAllShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5758 | break;
|
---|
5759 | }
|
---|
5760 |
|
---|
5761 | case SVGA_3D_CMD_SCREEN_COPY:
|
---|
5762 | {
|
---|
5763 | SVGA3dCmdScreenCopy *pCmd = (SVGA3dCmdScreenCopy *)pvCmd;
|
---|
5764 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5765 | rcParse = vmsvga3dCmdScreenCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5766 | break;
|
---|
5767 | }
|
---|
5768 |
|
---|
5769 | case SVGA_3D_CMD_RESERVED1:
|
---|
5770 | {
|
---|
5771 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5772 | break;
|
---|
5773 | }
|
---|
5774 |
|
---|
5775 | case SVGA_3D_CMD_RESERVED2:
|
---|
5776 | {
|
---|
5777 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5778 | break;
|
---|
5779 | }
|
---|
5780 |
|
---|
5781 | case SVGA_3D_CMD_RESERVED3:
|
---|
5782 | {
|
---|
5783 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5784 | break;
|
---|
5785 | }
|
---|
5786 |
|
---|
5787 | case SVGA_3D_CMD_RESERVED4:
|
---|
5788 | {
|
---|
5789 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5790 | break;
|
---|
5791 | }
|
---|
5792 |
|
---|
5793 | case SVGA_3D_CMD_RESERVED5:
|
---|
5794 | {
|
---|
5795 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5796 | break;
|
---|
5797 | }
|
---|
5798 |
|
---|
5799 | case SVGA_3D_CMD_RESERVED6:
|
---|
5800 | {
|
---|
5801 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5802 | break;
|
---|
5803 | }
|
---|
5804 |
|
---|
5805 | case SVGA_3D_CMD_RESERVED7:
|
---|
5806 | {
|
---|
5807 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5808 | break;
|
---|
5809 | }
|
---|
5810 |
|
---|
5811 | case SVGA_3D_CMD_RESERVED8:
|
---|
5812 | {
|
---|
5813 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5814 | break;
|
---|
5815 | }
|
---|
5816 |
|
---|
5817 | case SVGA_3D_CMD_GROW_OTABLE:
|
---|
5818 | {
|
---|
5819 | SVGA3dCmdGrowOTable *pCmd = (SVGA3dCmdGrowOTable *)pvCmd;
|
---|
5820 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5821 | rcParse = vmsvga3dCmdGrowOTable(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5822 | break;
|
---|
5823 | }
|
---|
5824 |
|
---|
5825 | case SVGA_3D_CMD_DX_GROW_COTABLE:
|
---|
5826 | {
|
---|
5827 | SVGA3dCmdDXGrowCOTable *pCmd = (SVGA3dCmdDXGrowCOTable *)pvCmd;
|
---|
5828 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5829 | rcParse = vmsvga3dCmdDXGrowCOTable(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5830 | break;
|
---|
5831 | }
|
---|
5832 |
|
---|
5833 | case SVGA_3D_CMD_INTRA_SURFACE_COPY:
|
---|
5834 | {
|
---|
5835 | SVGA3dCmdIntraSurfaceCopy *pCmd = (SVGA3dCmdIntraSurfaceCopy *)pvCmd;
|
---|
5836 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5837 | rcParse = vmsvga3dCmdIntraSurfaceCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5838 | break;
|
---|
5839 | }
|
---|
5840 |
|
---|
5841 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V3:
|
---|
5842 | {
|
---|
5843 | SVGA3dCmdDefineGBSurface_v3 *pCmd = (SVGA3dCmdDefineGBSurface_v3 *)pvCmd;
|
---|
5844 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5845 | rcParse = vmsvga3dCmdDefineGBSurface_v3(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5846 | break;
|
---|
5847 | }
|
---|
5848 |
|
---|
5849 | case SVGA_3D_CMD_DX_RESOLVE_COPY:
|
---|
5850 | {
|
---|
5851 | SVGA3dCmdDXResolveCopy *pCmd = (SVGA3dCmdDXResolveCopy *)pvCmd;
|
---|
5852 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5853 | rcParse = vmsvga3dCmdDXResolveCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5854 | break;
|
---|
5855 | }
|
---|
5856 |
|
---|
5857 | case SVGA_3D_CMD_DX_PRED_RESOLVE_COPY:
|
---|
5858 | {
|
---|
5859 | SVGA3dCmdDXPredResolveCopy *pCmd = (SVGA3dCmdDXPredResolveCopy *)pvCmd;
|
---|
5860 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5861 | rcParse = vmsvga3dCmdDXPredResolveCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5862 | break;
|
---|
5863 | }
|
---|
5864 |
|
---|
5865 | case SVGA_3D_CMD_DX_PRED_CONVERT_REGION:
|
---|
5866 | {
|
---|
5867 | SVGA3dCmdDXPredConvertRegion *pCmd = (SVGA3dCmdDXPredConvertRegion *)pvCmd;
|
---|
5868 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5869 | rcParse = vmsvga3dCmdDXPredConvertRegion(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5870 | break;
|
---|
5871 | }
|
---|
5872 |
|
---|
5873 | case SVGA_3D_CMD_DX_PRED_CONVERT:
|
---|
5874 | {
|
---|
5875 | SVGA3dCmdDXPredConvert *pCmd = (SVGA3dCmdDXPredConvert *)pvCmd;
|
---|
5876 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5877 | rcParse = vmsvga3dCmdDXPredConvert(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5878 | break;
|
---|
5879 | }
|
---|
5880 |
|
---|
5881 | case SVGA_3D_CMD_WHOLE_SURFACE_COPY:
|
---|
5882 | {
|
---|
5883 | SVGA3dCmdWholeSurfaceCopy *pCmd = (SVGA3dCmdWholeSurfaceCopy *)pvCmd;
|
---|
5884 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5885 | rcParse = vmsvga3dCmdWholeSurfaceCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5886 | break;
|
---|
5887 | }
|
---|
5888 |
|
---|
5889 | case SVGA_3D_CMD_DX_DEFINE_UA_VIEW:
|
---|
5890 | {
|
---|
5891 | SVGA3dCmdDXDefineUAView *pCmd = (SVGA3dCmdDXDefineUAView *)pvCmd;
|
---|
5892 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5893 | rcParse = vmsvga3dCmdDXDefineUAView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5894 | break;
|
---|
5895 | }
|
---|
5896 |
|
---|
5897 | case SVGA_3D_CMD_DX_DESTROY_UA_VIEW:
|
---|
5898 | {
|
---|
5899 | SVGA3dCmdDXDestroyUAView *pCmd = (SVGA3dCmdDXDestroyUAView *)pvCmd;
|
---|
5900 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5901 | rcParse = vmsvga3dCmdDXDestroyUAView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5902 | break;
|
---|
5903 | }
|
---|
5904 |
|
---|
5905 | case SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT:
|
---|
5906 | {
|
---|
5907 | SVGA3dCmdDXClearUAViewUint *pCmd = (SVGA3dCmdDXClearUAViewUint *)pvCmd;
|
---|
5908 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5909 | rcParse = vmsvga3dCmdDXClearUAViewUint(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5910 | break;
|
---|
5911 | }
|
---|
5912 |
|
---|
5913 | case SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT:
|
---|
5914 | {
|
---|
5915 | SVGA3dCmdDXClearUAViewFloat *pCmd = (SVGA3dCmdDXClearUAViewFloat *)pvCmd;
|
---|
5916 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5917 | rcParse = vmsvga3dCmdDXClearUAViewFloat(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5918 | break;
|
---|
5919 | }
|
---|
5920 |
|
---|
5921 | case SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT:
|
---|
5922 | {
|
---|
5923 | SVGA3dCmdDXCopyStructureCount *pCmd = (SVGA3dCmdDXCopyStructureCount *)pvCmd;
|
---|
5924 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5925 | rcParse = vmsvga3dCmdDXCopyStructureCount(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5926 | break;
|
---|
5927 | }
|
---|
5928 |
|
---|
5929 | case SVGA_3D_CMD_DX_SET_UA_VIEWS:
|
---|
5930 | {
|
---|
5931 | SVGA3dCmdDXSetUAViews *pCmd = (SVGA3dCmdDXSetUAViews *)pvCmd;
|
---|
5932 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5933 | rcParse = vmsvga3dCmdDXSetUAViews(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5934 | break;
|
---|
5935 | }
|
---|
5936 |
|
---|
5937 | case SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT:
|
---|
5938 | {
|
---|
5939 | SVGA3dCmdDXDrawIndexedInstancedIndirect *pCmd = (SVGA3dCmdDXDrawIndexedInstancedIndirect *)pvCmd;
|
---|
5940 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5941 | rcParse = vmsvga3dCmdDXDrawIndexedInstancedIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5942 | break;
|
---|
5943 | }
|
---|
5944 |
|
---|
5945 | case SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT:
|
---|
5946 | {
|
---|
5947 | SVGA3dCmdDXDrawInstancedIndirect *pCmd = (SVGA3dCmdDXDrawInstancedIndirect *)pvCmd;
|
---|
5948 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5949 | rcParse = vmsvga3dCmdDXDrawInstancedIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5950 | break;
|
---|
5951 | }
|
---|
5952 |
|
---|
5953 | case SVGA_3D_CMD_DX_DISPATCH:
|
---|
5954 | {
|
---|
5955 | SVGA3dCmdDXDispatch *pCmd = (SVGA3dCmdDXDispatch *)pvCmd;
|
---|
5956 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5957 | rcParse = vmsvga3dCmdDXDispatch(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5958 | break;
|
---|
5959 | }
|
---|
5960 |
|
---|
5961 | case SVGA_3D_CMD_DX_DISPATCH_INDIRECT:
|
---|
5962 | {
|
---|
5963 | SVGA3dCmdDXDispatchIndirect *pCmd = (SVGA3dCmdDXDispatchIndirect *)pvCmd;
|
---|
5964 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5965 | rcParse = vmsvga3dCmdDXDispatchIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5966 | break;
|
---|
5967 | }
|
---|
5968 |
|
---|
5969 | case SVGA_3D_CMD_WRITE_ZERO_SURFACE:
|
---|
5970 | {
|
---|
5971 | SVGA3dCmdWriteZeroSurface *pCmd = (SVGA3dCmdWriteZeroSurface *)pvCmd;
|
---|
5972 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5973 | rcParse = vmsvga3dCmdWriteZeroSurface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5974 | break;
|
---|
5975 | }
|
---|
5976 |
|
---|
5977 | case SVGA_3D_CMD_HINT_ZERO_SURFACE:
|
---|
5978 | {
|
---|
5979 | SVGA3dCmdHintZeroSurface *pCmd = (SVGA3dCmdHintZeroSurface *)pvCmd;
|
---|
5980 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5981 | rcParse = vmsvga3dCmdHintZeroSurface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5982 | break;
|
---|
5983 | }
|
---|
5984 |
|
---|
5985 | case SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER:
|
---|
5986 | {
|
---|
5987 | SVGA3dCmdDXTransferToBuffer *pCmd = (SVGA3dCmdDXTransferToBuffer *)pvCmd;
|
---|
5988 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5989 | rcParse = vmsvga3dCmdDXTransferToBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5990 | break;
|
---|
5991 | }
|
---|
5992 |
|
---|
5993 | case SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT:
|
---|
5994 | {
|
---|
5995 | SVGA3dCmdDXSetStructureCount *pCmd = (SVGA3dCmdDXSetStructureCount *)pvCmd;
|
---|
5996 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5997 | rcParse = vmsvga3dCmdDXSetStructureCount(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5998 | break;
|
---|
5999 | }
|
---|
6000 |
|
---|
6001 | case SVGA_3D_CMD_LOGICOPS_BITBLT:
|
---|
6002 | {
|
---|
6003 | SVGA3dCmdLogicOpsBitBlt *pCmd = (SVGA3dCmdLogicOpsBitBlt *)pvCmd;
|
---|
6004 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6005 | rcParse = vmsvga3dCmdLogicOpsBitBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6006 | break;
|
---|
6007 | }
|
---|
6008 |
|
---|
6009 | case SVGA_3D_CMD_LOGICOPS_TRANSBLT:
|
---|
6010 | {
|
---|
6011 | SVGA3dCmdLogicOpsTransBlt *pCmd = (SVGA3dCmdLogicOpsTransBlt *)pvCmd;
|
---|
6012 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6013 | rcParse = vmsvga3dCmdLogicOpsTransBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6014 | break;
|
---|
6015 | }
|
---|
6016 |
|
---|
6017 | case SVGA_3D_CMD_LOGICOPS_STRETCHBLT:
|
---|
6018 | {
|
---|
6019 | SVGA3dCmdLogicOpsStretchBlt *pCmd = (SVGA3dCmdLogicOpsStretchBlt *)pvCmd;
|
---|
6020 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6021 | rcParse = vmsvga3dCmdLogicOpsStretchBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6022 | break;
|
---|
6023 | }
|
---|
6024 |
|
---|
6025 | case SVGA_3D_CMD_LOGICOPS_COLORFILL:
|
---|
6026 | {
|
---|
6027 | SVGA3dCmdLogicOpsColorFill *pCmd = (SVGA3dCmdLogicOpsColorFill *)pvCmd;
|
---|
6028 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6029 | rcParse = vmsvga3dCmdLogicOpsColorFill(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6030 | break;
|
---|
6031 | }
|
---|
6032 |
|
---|
6033 | case SVGA_3D_CMD_LOGICOPS_ALPHABLEND:
|
---|
6034 | {
|
---|
6035 | SVGA3dCmdLogicOpsAlphaBlend *pCmd = (SVGA3dCmdLogicOpsAlphaBlend *)pvCmd;
|
---|
6036 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6037 | rcParse = vmsvga3dCmdLogicOpsAlphaBlend(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6038 | break;
|
---|
6039 | }
|
---|
6040 |
|
---|
6041 | case SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND:
|
---|
6042 | {
|
---|
6043 | SVGA3dCmdLogicOpsClearTypeBlend *pCmd = (SVGA3dCmdLogicOpsClearTypeBlend *)pvCmd;
|
---|
6044 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6045 | rcParse = vmsvga3dCmdLogicOpsClearTypeBlend(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6046 | break;
|
---|
6047 | }
|
---|
6048 |
|
---|
6049 | case SVGA_3D_CMD_RESERVED2_1:
|
---|
6050 | {
|
---|
6051 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6052 | break;
|
---|
6053 | }
|
---|
6054 |
|
---|
6055 | case SVGA_3D_CMD_RESERVED2_2:
|
---|
6056 | {
|
---|
6057 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6058 | break;
|
---|
6059 | }
|
---|
6060 |
|
---|
6061 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V4:
|
---|
6062 | {
|
---|
6063 | SVGA3dCmdDefineGBSurface_v4 *pCmd = (SVGA3dCmdDefineGBSurface_v4 *)pvCmd;
|
---|
6064 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6065 | rcParse = vmsvga3dCmdDefineGBSurface_v4(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6066 | break;
|
---|
6067 | }
|
---|
6068 |
|
---|
6069 | case SVGA_3D_CMD_DX_SET_CS_UA_VIEWS:
|
---|
6070 | {
|
---|
6071 | SVGA3dCmdDXSetCSUAViews *pCmd = (SVGA3dCmdDXSetCSUAViews *)pvCmd;
|
---|
6072 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6073 | rcParse = vmsvga3dCmdDXSetCSUAViews(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6074 | break;
|
---|
6075 | }
|
---|
6076 |
|
---|
6077 | case SVGA_3D_CMD_DX_SET_MIN_LOD:
|
---|
6078 | {
|
---|
6079 | SVGA3dCmdDXSetMinLOD *pCmd = (SVGA3dCmdDXSetMinLOD *)pvCmd;
|
---|
6080 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6081 | rcParse = vmsvga3dCmdDXSetMinLOD(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6082 | break;
|
---|
6083 | }
|
---|
6084 |
|
---|
6085 | case SVGA_3D_CMD_RESERVED2_3:
|
---|
6086 | {
|
---|
6087 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6088 | break;
|
---|
6089 | }
|
---|
6090 |
|
---|
6091 | case SVGA_3D_CMD_RESERVED2_4:
|
---|
6092 | {
|
---|
6093 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6094 | break;
|
---|
6095 | }
|
---|
6096 |
|
---|
6097 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2:
|
---|
6098 | {
|
---|
6099 | SVGA3dCmdDXDefineDepthStencilView_v2 *pCmd = (SVGA3dCmdDXDefineDepthStencilView_v2 *)pvCmd;
|
---|
6100 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6101 | rcParse = vmsvga3dCmdDXDefineDepthStencilView_v2(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6102 | break;
|
---|
6103 | }
|
---|
6104 |
|
---|
6105 | case SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB:
|
---|
6106 | {
|
---|
6107 | SVGA3dCmdDXDefineStreamOutputWithMob *pCmd = (SVGA3dCmdDXDefineStreamOutputWithMob *)pvCmd;
|
---|
6108 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6109 | rcParse = vmsvga3dCmdDXDefineStreamOutputWithMob(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6110 | break;
|
---|
6111 | }
|
---|
6112 |
|
---|
6113 | case SVGA_3D_CMD_DX_SET_SHADER_IFACE:
|
---|
6114 | {
|
---|
6115 | SVGA3dCmdDXSetShaderIface *pCmd = (SVGA3dCmdDXSetShaderIface *)pvCmd;
|
---|
6116 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6117 | rcParse = vmsvga3dCmdDXSetShaderIface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6118 | break;
|
---|
6119 | }
|
---|
6120 |
|
---|
6121 | case SVGA_3D_CMD_DX_BIND_STREAMOUTPUT:
|
---|
6122 | {
|
---|
6123 | SVGA3dCmdDXBindStreamOutput *pCmd = (SVGA3dCmdDXBindStreamOutput *)pvCmd;
|
---|
6124 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6125 | rcParse = vmsvga3dCmdDXBindStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6126 | break;
|
---|
6127 | }
|
---|
6128 |
|
---|
6129 | case SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS:
|
---|
6130 | {
|
---|
6131 | SVGA3dCmdSurfaceStretchBltNonMSToMS *pCmd = (SVGA3dCmdSurfaceStretchBltNonMSToMS *)pvCmd;
|
---|
6132 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6133 | rcParse = vmsvga3dCmdSurfaceStretchBltNonMSToMS(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6134 | break;
|
---|
6135 | }
|
---|
6136 |
|
---|
6137 | case SVGA_3D_CMD_DX_BIND_SHADER_IFACE:
|
---|
6138 | {
|
---|
6139 | SVGA3dCmdDXBindShaderIface *pCmd = (SVGA3dCmdDXBindShaderIface *)pvCmd;
|
---|
6140 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6141 | rcParse = vmsvga3dCmdDXBindShaderIface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6142 | break;
|
---|
6143 | }
|
---|
6144 |
|
---|
6145 | /* Unsupported commands. */
|
---|
6146 | case SVGA_3D_CMD_DEAD4: /* SVGA_3D_CMD_VIDEO_CREATE_DECODER */
|
---|
6147 | case SVGA_3D_CMD_DEAD5: /* SVGA_3D_CMD_VIDEO_DESTROY_DECODER */
|
---|
6148 | case SVGA_3D_CMD_DEAD6: /* SVGA_3D_CMD_VIDEO_CREATE_PROCESSOR */
|
---|
6149 | case SVGA_3D_CMD_DEAD7: /* SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR */
|
---|
6150 | case SVGA_3D_CMD_DEAD8: /* SVGA_3D_CMD_VIDEO_DECODE_START_FRAME */
|
---|
6151 | case SVGA_3D_CMD_DEAD9: /* SVGA_3D_CMD_VIDEO_DECODE_RENDER */
|
---|
6152 | case SVGA_3D_CMD_DEAD10: /* SVGA_3D_CMD_VIDEO_DECODE_END_FRAME */
|
---|
6153 | case SVGA_3D_CMD_DEAD11: /* SVGA_3D_CMD_VIDEO_PROCESS_FRAME */
|
---|
6154 | /* Prevent the compiler warning. */
|
---|
6155 | case SVGA_3D_CMD_LEGACY_BASE:
|
---|
6156 | case SVGA_3D_CMD_MAX:
|
---|
6157 | case SVGA_3D_CMD_FUTURE_MAX:
|
---|
6158 | /* No 'default' case */
|
---|
6159 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatFifoUnkCmds);
|
---|
6160 | ASSERT_GUEST_MSG_FAILED(("enmCmdId=%d\n", enmCmdId));
|
---|
6161 | LogRelMax(16, ("VMSVGA: unsupported 3D command %d\n", enmCmdId));
|
---|
6162 | rcParse = VERR_NOT_IMPLEMENTED;
|
---|
6163 | break;
|
---|
6164 | }
|
---|
6165 |
|
---|
6166 | return VINF_SUCCESS;
|
---|
6167 | // return rcParse;
|
---|
6168 | }
|
---|
6169 | # undef VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK
|
---|
6170 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
6171 |
|
---|
6172 |
|
---|
6173 | /*
|
---|
6174 | *
|
---|
6175 | * Handlers for FIFO commands.
|
---|
6176 | *
|
---|
6177 | * Every handler takes the following parameters:
|
---|
6178 | *
|
---|
6179 | * pThis The shared VGA/VMSVGA state.
|
---|
6180 | * pThisCC The VGA/VMSVGA state for ring-3.
|
---|
6181 | * pCmd The command data.
|
---|
6182 | */
|
---|
6183 |
|
---|
6184 |
|
---|
6185 | /* SVGA_CMD_UPDATE */
|
---|
6186 | void vmsvgaR3CmdUpdate(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdUpdate const *pCmd)
|
---|
6187 | {
|
---|
6188 | RT_NOREF(pThis);
|
---|
6189 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6190 |
|
---|
6191 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdUpdate);
|
---|
6192 | Log(("SVGA_CMD_UPDATE %d,%d %dx%d\n", pCmd->x, pCmd->y, pCmd->width, pCmd->height));
|
---|
6193 |
|
---|
6194 | /** @todo Multiple screens? */
|
---|
6195 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
6196 | if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
|
---|
6197 | return;
|
---|
6198 |
|
---|
6199 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->x, pCmd->y, pCmd->width, pCmd->height);
|
---|
6200 | }
|
---|
6201 |
|
---|
6202 |
|
---|
6203 | /* SVGA_CMD_UPDATE_VERBOSE */
|
---|
6204 | void vmsvgaR3CmdUpdateVerbose(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdUpdateVerbose const *pCmd)
|
---|
6205 | {
|
---|
6206 | RT_NOREF(pThis);
|
---|
6207 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6208 |
|
---|
6209 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdUpdateVerbose);
|
---|
6210 | Log(("SVGA_CMD_UPDATE_VERBOSE %d,%d %dx%d reason %#x\n", pCmd->x, pCmd->y, pCmd->width, pCmd->height, pCmd->reason));
|
---|
6211 |
|
---|
6212 | /** @todo Multiple screens? */
|
---|
6213 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
6214 | if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
|
---|
6215 | return;
|
---|
6216 |
|
---|
6217 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->x, pCmd->y, pCmd->width, pCmd->height);
|
---|
6218 | }
|
---|
6219 |
|
---|
6220 |
|
---|
6221 | /* SVGA_CMD_RECT_FILL */
|
---|
6222 | void vmsvgaR3CmdRectFill(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectFill const *pCmd)
|
---|
6223 | {
|
---|
6224 | RT_NOREF(pThis, pCmd);
|
---|
6225 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6226 |
|
---|
6227 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectFill);
|
---|
6228 | Log(("SVGA_CMD_RECT_FILL %08X @ %d,%d (%dx%d)\n", pCmd->pixel, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height));
|
---|
6229 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_RECT_FILL command ignored.\n"));
|
---|
6230 | }
|
---|
6231 |
|
---|
6232 |
|
---|
6233 | /* SVGA_CMD_RECT_COPY */
|
---|
6234 | void vmsvgaR3CmdRectCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectCopy const *pCmd)
|
---|
6235 | {
|
---|
6236 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6237 |
|
---|
6238 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectCopy);
|
---|
6239 | Log(("SVGA_CMD_RECT_COPY %d,%d -> %d,%d %dx%d\n", pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height));
|
---|
6240 |
|
---|
6241 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
6242 | AssertPtrReturnVoid(pScreen);
|
---|
6243 |
|
---|
6244 | /* Check that arguments aren't complete junk. A precise check is done in vmsvgaR3RectCopy(). */
|
---|
6245 | ASSERT_GUEST_RETURN_VOID(pCmd->srcX < pThis->svga.u32MaxWidth);
|
---|
6246 | ASSERT_GUEST_RETURN_VOID(pCmd->destX < pThis->svga.u32MaxWidth);
|
---|
6247 | ASSERT_GUEST_RETURN_VOID(pCmd->width < pThis->svga.u32MaxWidth);
|
---|
6248 | ASSERT_GUEST_RETURN_VOID(pCmd->srcY < pThis->svga.u32MaxHeight);
|
---|
6249 | ASSERT_GUEST_RETURN_VOID(pCmd->destY < pThis->svga.u32MaxHeight);
|
---|
6250 | ASSERT_GUEST_RETURN_VOID(pCmd->height < pThis->svga.u32MaxHeight);
|
---|
6251 |
|
---|
6252 | vmsvgaR3RectCopy(pThisCC, pScreen, pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY,
|
---|
6253 | pCmd->width, pCmd->height, pThis->vram_size);
|
---|
6254 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height);
|
---|
6255 | }
|
---|
6256 |
|
---|
6257 |
|
---|
6258 | /* SVGA_CMD_RECT_ROP_COPY */
|
---|
6259 | void vmsvgaR3CmdRectRopCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectRopCopy const *pCmd)
|
---|
6260 | {
|
---|
6261 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6262 |
|
---|
6263 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectRopCopy);
|
---|
6264 | Log(("SVGA_CMD_RECT_ROP_COPY %d,%d -> %d,%d %dx%d ROP %#X\n", pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height, pCmd->rop));
|
---|
6265 |
|
---|
6266 | if (pCmd->rop != SVGA_ROP_COPY)
|
---|
6267 | {
|
---|
6268 | /* We only support the plain copy ROP which makes SVGA_CMD_RECT_ROP_COPY exactly the same
|
---|
6269 | * as SVGA_CMD_RECT_COPY. XFree86 4.1.0 and 4.2.0 drivers (driver version 10.4.0 and 10.7.0,
|
---|
6270 | * respectively) issue SVGA_CMD_RECT_ROP_COPY when SVGA_CAP_RECT_COPY is present even when
|
---|
6271 | * SVGA_CAP_RASTER_OP is not. However, the ROP will always be SVGA_ROP_COPY.
|
---|
6272 | */
|
---|
6273 | LogRelMax(4, ("VMSVGA: SVGA_CMD_RECT_ROP_COPY %d,%d -> %d,%d (%dx%d) ROP %X unsupported\n",
|
---|
6274 | pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height, pCmd->rop));
|
---|
6275 | return;
|
---|
6276 | }
|
---|
6277 |
|
---|
6278 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
6279 | AssertPtrReturnVoid(pScreen);
|
---|
6280 |
|
---|
6281 | /* Check that arguments aren't complete junk. A precise check is done in vmsvgaR3RectCopy(). */
|
---|
6282 | ASSERT_GUEST_RETURN_VOID(pCmd->srcX < pThis->svga.u32MaxWidth);
|
---|
6283 | ASSERT_GUEST_RETURN_VOID(pCmd->destX < pThis->svga.u32MaxWidth);
|
---|
6284 | ASSERT_GUEST_RETURN_VOID(pCmd->width < pThis->svga.u32MaxWidth);
|
---|
6285 | ASSERT_GUEST_RETURN_VOID(pCmd->srcY < pThis->svga.u32MaxHeight);
|
---|
6286 | ASSERT_GUEST_RETURN_VOID(pCmd->destY < pThis->svga.u32MaxHeight);
|
---|
6287 | ASSERT_GUEST_RETURN_VOID(pCmd->height < pThis->svga.u32MaxHeight);
|
---|
6288 |
|
---|
6289 | vmsvgaR3RectCopy(pThisCC, pScreen, pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY,
|
---|
6290 | pCmd->width, pCmd->height, pThis->vram_size);
|
---|
6291 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height);
|
---|
6292 | }
|
---|
6293 |
|
---|
6294 |
|
---|
6295 | /* SVGA_CMD_DISPLAY_CURSOR */
|
---|
6296 | void vmsvgaR3CmdDisplayCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDisplayCursor const *pCmd)
|
---|
6297 | {
|
---|
6298 | RT_NOREF(pThis, pCmd);
|
---|
6299 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6300 |
|
---|
6301 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDisplayCursor);
|
---|
6302 | Log(("SVGA_CMD_DISPLAY_CURSOR id=%d state=%d\n", pCmd->id, pCmd->state));
|
---|
6303 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_DISPLAY_CURSOR command ignored.\n"));
|
---|
6304 | }
|
---|
6305 |
|
---|
6306 |
|
---|
6307 | /* SVGA_CMD_MOVE_CURSOR */
|
---|
6308 | void vmsvgaR3CmdMoveCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdMoveCursor const *pCmd)
|
---|
6309 | {
|
---|
6310 | RT_NOREF(pThis, pCmd);
|
---|
6311 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6312 |
|
---|
6313 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdMoveCursor);
|
---|
6314 | Log(("SVGA_CMD_MOVE_CURSOR to %d,%d\n", pCmd->pos.x, pCmd->pos.y));
|
---|
6315 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_MOVE_CURSOR command ignored.\n"));
|
---|
6316 | }
|
---|
6317 |
|
---|
6318 |
|
---|
6319 | /* SVGA_CMD_DEFINE_CURSOR */
|
---|
6320 | void vmsvgaR3CmdDefineCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineCursor const *pCmd)
|
---|
6321 | {
|
---|
6322 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6323 |
|
---|
6324 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineCursor);
|
---|
6325 | Log(("SVGA_CMD_DEFINE_CURSOR id=%d size (%dx%d) hotspot (%d,%d) andMaskDepth=%d xorMaskDepth=%d\n",
|
---|
6326 | pCmd->id, pCmd->width, pCmd->height, pCmd->hotspotX, pCmd->hotspotY, pCmd->andMaskDepth, pCmd->xorMaskDepth));
|
---|
6327 |
|
---|
6328 | ASSERT_GUEST_RETURN_VOID(pCmd->height < 2048 && pCmd->width < 2048);
|
---|
6329 | ASSERT_GUEST_RETURN_VOID(pCmd->andMaskDepth <= 32);
|
---|
6330 | ASSERT_GUEST_RETURN_VOID(pCmd->xorMaskDepth <= 32);
|
---|
6331 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6332 |
|
---|
6333 | uint32_t const cbSrcAndLine = RT_ALIGN_32(pCmd->width * (pCmd->andMaskDepth + (pCmd->andMaskDepth == 15)), 32) / 8;
|
---|
6334 | uint32_t const cbSrcAndMask = cbSrcAndLine * pCmd->height;
|
---|
6335 | uint32_t const cbSrcXorLine = RT_ALIGN_32(pCmd->width * (pCmd->xorMaskDepth + (pCmd->xorMaskDepth == 15)), 32) / 8;
|
---|
6336 |
|
---|
6337 | uint8_t const *pbSrcAndMask = (uint8_t const *)(pCmd + 1);
|
---|
6338 | uint8_t const *pbSrcXorMask = (uint8_t const *)(pCmd + 1) + cbSrcAndMask;
|
---|
6339 |
|
---|
6340 | uint32_t const cx = pCmd->width;
|
---|
6341 | uint32_t const cy = pCmd->height;
|
---|
6342 |
|
---|
6343 | /*
|
---|
6344 | * Convert the input to 1-bit AND mask and a 32-bit BRGA XOR mask.
|
---|
6345 | * The AND data uses 8-bit aligned scanlines.
|
---|
6346 | * The XOR data must be starting on a 32-bit boundrary.
|
---|
6347 | */
|
---|
6348 | uint32_t cbDstAndLine = RT_ALIGN_32(cx, 8) / 8;
|
---|
6349 | uint32_t cbDstAndMask = cbDstAndLine * cy;
|
---|
6350 | uint32_t cbDstXorMask = cx * sizeof(uint32_t) * cy;
|
---|
6351 | uint32_t cbCopy = RT_ALIGN_32(cbDstAndMask, 4) + cbDstXorMask;
|
---|
6352 |
|
---|
6353 | uint8_t *pbCopy = (uint8_t *)RTMemAlloc(cbCopy);
|
---|
6354 | AssertReturnVoid(pbCopy);
|
---|
6355 |
|
---|
6356 | /* Convert the AND mask. */
|
---|
6357 | uint8_t *pbDst = pbCopy;
|
---|
6358 | uint8_t const *pbSrc = pbSrcAndMask;
|
---|
6359 | switch (pCmd->andMaskDepth)
|
---|
6360 | {
|
---|
6361 | case 1:
|
---|
6362 | if (cbSrcAndLine == cbDstAndLine)
|
---|
6363 | memcpy(pbDst, pbSrc, cbSrcAndLine * cy);
|
---|
6364 | else
|
---|
6365 | {
|
---|
6366 | Assert(cbSrcAndLine > cbDstAndLine); /* lines are dword alined in source, but only byte in destination. */
|
---|
6367 | for (uint32_t y = 0; y < cy; y++)
|
---|
6368 | {
|
---|
6369 | memcpy(pbDst, pbSrc, cbDstAndLine);
|
---|
6370 | pbDst += cbDstAndLine;
|
---|
6371 | pbSrc += cbSrcAndLine;
|
---|
6372 | }
|
---|
6373 | }
|
---|
6374 | break;
|
---|
6375 | /* Should take the XOR mask into account for the multi-bit AND mask. */
|
---|
6376 | case 8:
|
---|
6377 | for (uint32_t y = 0; y < cy; y++)
|
---|
6378 | {
|
---|
6379 | for (uint32_t x = 0; x < cx; )
|
---|
6380 | {
|
---|
6381 | uint8_t bDst = 0;
|
---|
6382 | uint8_t fBit = 0x80;
|
---|
6383 | do
|
---|
6384 | {
|
---|
6385 | uintptr_t const idxPal = pbSrc[x] * 3;
|
---|
6386 | if ((( pThis->last_palette[idxPal]
|
---|
6387 | | (pThis->last_palette[idxPal] >> 8)
|
---|
6388 | | (pThis->last_palette[idxPal] >> 16)) & 0xff) > 0xfc)
|
---|
6389 | bDst |= fBit;
|
---|
6390 | fBit >>= 1;
|
---|
6391 | x++;
|
---|
6392 | } while (x < cx && (x & 7));
|
---|
6393 | pbDst[(x - 1) / 8] = bDst;
|
---|
6394 | }
|
---|
6395 | pbDst += cbDstAndLine;
|
---|
6396 | pbSrc += cbSrcAndLine;
|
---|
6397 | }
|
---|
6398 | break;
|
---|
6399 | case 15:
|
---|
6400 | for (uint32_t y = 0; y < cy; y++)
|
---|
6401 | {
|
---|
6402 | for (uint32_t x = 0; x < cx; )
|
---|
6403 | {
|
---|
6404 | uint8_t bDst = 0;
|
---|
6405 | uint8_t fBit = 0x80;
|
---|
6406 | do
|
---|
6407 | {
|
---|
6408 | if ((pbSrc[x * 2] | (pbSrc[x * 2 + 1] & 0x7f)) >= 0xfc)
|
---|
6409 | bDst |= fBit;
|
---|
6410 | fBit >>= 1;
|
---|
6411 | x++;
|
---|
6412 | } while (x < cx && (x & 7));
|
---|
6413 | pbDst[(x - 1) / 8] = bDst;
|
---|
6414 | }
|
---|
6415 | pbDst += cbDstAndLine;
|
---|
6416 | pbSrc += cbSrcAndLine;
|
---|
6417 | }
|
---|
6418 | break;
|
---|
6419 | case 16:
|
---|
6420 | for (uint32_t y = 0; y < cy; y++)
|
---|
6421 | {
|
---|
6422 | for (uint32_t x = 0; x < cx; )
|
---|
6423 | {
|
---|
6424 | uint8_t bDst = 0;
|
---|
6425 | uint8_t fBit = 0x80;
|
---|
6426 | do
|
---|
6427 | {
|
---|
6428 | if ((pbSrc[x * 2] | pbSrc[x * 2 + 1]) >= 0xfc)
|
---|
6429 | bDst |= fBit;
|
---|
6430 | fBit >>= 1;
|
---|
6431 | x++;
|
---|
6432 | } while (x < cx && (x & 7));
|
---|
6433 | pbDst[(x - 1) / 8] = bDst;
|
---|
6434 | }
|
---|
6435 | pbDst += cbDstAndLine;
|
---|
6436 | pbSrc += cbSrcAndLine;
|
---|
6437 | }
|
---|
6438 | break;
|
---|
6439 | case 24:
|
---|
6440 | for (uint32_t y = 0; y < cy; y++)
|
---|
6441 | {
|
---|
6442 | for (uint32_t x = 0; x < cx; )
|
---|
6443 | {
|
---|
6444 | uint8_t bDst = 0;
|
---|
6445 | uint8_t fBit = 0x80;
|
---|
6446 | do
|
---|
6447 | {
|
---|
6448 | if ((pbSrc[x * 3] | pbSrc[x * 3 + 1] | pbSrc[x * 3 + 2]) >= 0xfc)
|
---|
6449 | bDst |= fBit;
|
---|
6450 | fBit >>= 1;
|
---|
6451 | x++;
|
---|
6452 | } while (x < cx && (x & 7));
|
---|
6453 | pbDst[(x - 1) / 8] = bDst;
|
---|
6454 | }
|
---|
6455 | pbDst += cbDstAndLine;
|
---|
6456 | pbSrc += cbSrcAndLine;
|
---|
6457 | }
|
---|
6458 | break;
|
---|
6459 | case 32:
|
---|
6460 | for (uint32_t y = 0; y < cy; y++)
|
---|
6461 | {
|
---|
6462 | for (uint32_t x = 0; x < cx; )
|
---|
6463 | {
|
---|
6464 | uint8_t bDst = 0;
|
---|
6465 | uint8_t fBit = 0x80;
|
---|
6466 | do
|
---|
6467 | {
|
---|
6468 | if ((pbSrc[x * 4] | pbSrc[x * 4 + 1] | pbSrc[x * 4 + 2] | pbSrc[x * 4 + 3]) >= 0xfc)
|
---|
6469 | bDst |= fBit;
|
---|
6470 | fBit >>= 1;
|
---|
6471 | x++;
|
---|
6472 | } while (x < cx && (x & 7));
|
---|
6473 | pbDst[(x - 1) / 8] = bDst;
|
---|
6474 | }
|
---|
6475 | pbDst += cbDstAndLine;
|
---|
6476 | pbSrc += cbSrcAndLine;
|
---|
6477 | }
|
---|
6478 | break;
|
---|
6479 | default:
|
---|
6480 | RTMemFreeZ(pbCopy, cbCopy);
|
---|
6481 | AssertFailedReturnVoid();
|
---|
6482 | }
|
---|
6483 |
|
---|
6484 | /* Convert the XOR mask. */
|
---|
6485 | uint32_t *pu32Dst = (uint32_t *)(pbCopy + RT_ALIGN_32(cbDstAndMask, 4));
|
---|
6486 | pbSrc = pbSrcXorMask;
|
---|
6487 | switch (pCmd->xorMaskDepth)
|
---|
6488 | {
|
---|
6489 | case 1:
|
---|
6490 | for (uint32_t y = 0; y < cy; y++)
|
---|
6491 | {
|
---|
6492 | for (uint32_t x = 0; x < cx; )
|
---|
6493 | {
|
---|
6494 | /* most significant bit is the left most one. */
|
---|
6495 | uint8_t bSrc = pbSrc[x / 8];
|
---|
6496 | do
|
---|
6497 | {
|
---|
6498 | *pu32Dst++ = bSrc & 0x80 ? UINT32_C(0x00ffffff) : 0;
|
---|
6499 | bSrc <<= 1;
|
---|
6500 | x++;
|
---|
6501 | } while ((x & 7) && x < cx);
|
---|
6502 | }
|
---|
6503 | pbSrc += cbSrcXorLine;
|
---|
6504 | }
|
---|
6505 | break;
|
---|
6506 | case 8:
|
---|
6507 | for (uint32_t y = 0; y < cy; y++)
|
---|
6508 | {
|
---|
6509 | for (uint32_t x = 0; x < cx; x++)
|
---|
6510 | {
|
---|
6511 | uint32_t u = pThis->last_palette[pbSrc[x]];
|
---|
6512 | *pu32Dst++ = u;//RT_MAKE_U32_FROM_U8(RT_BYTE1(u), RT_BYTE2(u), RT_BYTE3(u), 0);
|
---|
6513 | }
|
---|
6514 | pbSrc += cbSrcXorLine;
|
---|
6515 | }
|
---|
6516 | break;
|
---|
6517 | case 15: /* Src: RGB-5-5-5 */
|
---|
6518 | for (uint32_t y = 0; y < cy; y++)
|
---|
6519 | {
|
---|
6520 | for (uint32_t x = 0; x < cx; x++)
|
---|
6521 | {
|
---|
6522 | uint32_t const uValue = RT_MAKE_U16(pbSrc[x * 2], pbSrc[x * 2 + 1]);
|
---|
6523 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(( uValue & 0x1f) << 3,
|
---|
6524 | ((uValue >> 5) & 0x1f) << 3,
|
---|
6525 | ((uValue >> 10) & 0x1f) << 3, 0);
|
---|
6526 | }
|
---|
6527 | pbSrc += cbSrcXorLine;
|
---|
6528 | }
|
---|
6529 | break;
|
---|
6530 | case 16: /* Src: RGB-5-6-5 */
|
---|
6531 | for (uint32_t y = 0; y < cy; y++)
|
---|
6532 | {
|
---|
6533 | for (uint32_t x = 0; x < cx; x++)
|
---|
6534 | {
|
---|
6535 | uint32_t const uValue = RT_MAKE_U16(pbSrc[x * 2], pbSrc[x * 2 + 1]);
|
---|
6536 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(( uValue & 0x1f) << 3,
|
---|
6537 | ((uValue >> 5) & 0x3f) << 2,
|
---|
6538 | ((uValue >> 11) & 0x1f) << 3, 0);
|
---|
6539 | }
|
---|
6540 | pbSrc += cbSrcXorLine;
|
---|
6541 | }
|
---|
6542 | break;
|
---|
6543 | case 24:
|
---|
6544 | for (uint32_t y = 0; y < cy; y++)
|
---|
6545 | {
|
---|
6546 | for (uint32_t x = 0; x < cx; x++)
|
---|
6547 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(pbSrc[x*3], pbSrc[x*3 + 1], pbSrc[x*3 + 2], 0);
|
---|
6548 | pbSrc += cbSrcXorLine;
|
---|
6549 | }
|
---|
6550 | break;
|
---|
6551 | case 32:
|
---|
6552 | for (uint32_t y = 0; y < cy; y++)
|
---|
6553 | {
|
---|
6554 | for (uint32_t x = 0; x < cx; x++)
|
---|
6555 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(pbSrc[x*4], pbSrc[x*4 + 1], pbSrc[x*4 + 2], 0);
|
---|
6556 | pbSrc += cbSrcXorLine;
|
---|
6557 | }
|
---|
6558 | break;
|
---|
6559 | default:
|
---|
6560 | RTMemFreeZ(pbCopy, cbCopy);
|
---|
6561 | AssertFailedReturnVoid();
|
---|
6562 | }
|
---|
6563 |
|
---|
6564 | /*
|
---|
6565 | * Pass it to the frontend/whatever.
|
---|
6566 | */
|
---|
6567 | vmsvgaR3InstallNewCursor(pThisCC, pSvgaR3State, false /*fAlpha*/, pCmd->hotspotX, pCmd->hotspotY,
|
---|
6568 | cx, cy, pbCopy, cbCopy);
|
---|
6569 | }
|
---|
6570 |
|
---|
6571 |
|
---|
6572 | /* SVGA_CMD_DEFINE_ALPHA_CURSOR */
|
---|
6573 | void vmsvgaR3CmdDefineAlphaCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineAlphaCursor const *pCmd)
|
---|
6574 | {
|
---|
6575 | RT_NOREF(pThis);
|
---|
6576 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6577 |
|
---|
6578 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineAlphaCursor);
|
---|
6579 | Log(("VMSVGA cmd: SVGA_CMD_DEFINE_ALPHA_CURSOR id=%d size (%dx%d) hotspot (%d,%d)\n", pCmd->id, pCmd->width, pCmd->height, pCmd->hotspotX, pCmd->hotspotY));
|
---|
6580 |
|
---|
6581 | /* Check against a reasonable upper limit to prevent integer overflows in the sanity checks below. */
|
---|
6582 | ASSERT_GUEST_RETURN_VOID(pCmd->height < 2048 && pCmd->width < 2048);
|
---|
6583 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6584 |
|
---|
6585 | /* The mouse pointer interface always expects an AND mask followed by the color data (XOR mask). */
|
---|
6586 | uint32_t cbAndMask = (pCmd->width + 7) / 8 * pCmd->height; /* size of the AND mask */
|
---|
6587 | cbAndMask = ((cbAndMask + 3) & ~3); /* + gap for alignment */
|
---|
6588 | uint32_t cbXorMask = pCmd->width * sizeof(uint32_t) * pCmd->height; /* + size of the XOR mask (32-bit BRGA format) */
|
---|
6589 | uint32_t cbCursorShape = cbAndMask + cbXorMask;
|
---|
6590 |
|
---|
6591 | uint8_t *pCursorCopy = (uint8_t *)RTMemAlloc(cbCursorShape);
|
---|
6592 | AssertPtrReturnVoid(pCursorCopy);
|
---|
6593 |
|
---|
6594 | /* Transparency is defined by the alpha bytes, so make the whole bitmap visible. */
|
---|
6595 | memset(pCursorCopy, 0xff, cbAndMask);
|
---|
6596 | /* Colour data */
|
---|
6597 | memcpy(pCursorCopy + cbAndMask, pCmd + 1, cbXorMask);
|
---|
6598 |
|
---|
6599 | vmsvgaR3InstallNewCursor(pThisCC, pSvgaR3State, true /*fAlpha*/, pCmd->hotspotX, pCmd->hotspotY,
|
---|
6600 | pCmd->width, pCmd->height, pCursorCopy, cbCursorShape);
|
---|
6601 | }
|
---|
6602 |
|
---|
6603 |
|
---|
6604 | /* SVGA_CMD_ESCAPE */
|
---|
6605 | void vmsvgaR3CmdEscape(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdEscape const *pCmd)
|
---|
6606 | {
|
---|
6607 | RT_NOREF(pThis);
|
---|
6608 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6609 |
|
---|
6610 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdEscape);
|
---|
6611 |
|
---|
6612 | if (pCmd->nsid == SVGA_ESCAPE_NSID_VMWARE)
|
---|
6613 | {
|
---|
6614 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(uint32_t));
|
---|
6615 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6616 |
|
---|
6617 | uint32_t const cmd = *(uint32_t *)(pCmd + 1);
|
---|
6618 | Log(("SVGA_CMD_ESCAPE (%#x %#x) VMWARE cmd=%#x\n", pCmd->nsid, pCmd->size, cmd));
|
---|
6619 |
|
---|
6620 | switch (cmd)
|
---|
6621 | {
|
---|
6622 | case SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS:
|
---|
6623 | {
|
---|
6624 | SVGAEscapeVideoSetRegs *pVideoCmd = (SVGAEscapeVideoSetRegs *)(pCmd + 1);
|
---|
6625 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(pVideoCmd->header));
|
---|
6626 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6627 |
|
---|
6628 | uint32_t const cRegs = (pCmd->size - sizeof(pVideoCmd->header)) / sizeof(pVideoCmd->items[0]);
|
---|
6629 |
|
---|
6630 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS: stream %#x\n", pVideoCmd->header.streamId));
|
---|
6631 | for (uint32_t iReg = 0; iReg < cRegs; iReg++)
|
---|
6632 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS: reg %#x val %#x\n", pVideoCmd->items[iReg].registerId, pVideoCmd->items[iReg].value));
|
---|
6633 | RT_NOREF_PV(pVideoCmd);
|
---|
6634 | break;
|
---|
6635 | }
|
---|
6636 |
|
---|
6637 | case SVGA_ESCAPE_VMWARE_VIDEO_FLUSH:
|
---|
6638 | {
|
---|
6639 | SVGAEscapeVideoFlush *pVideoCmd = (SVGAEscapeVideoFlush *)(pCmd + 1);
|
---|
6640 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(*pVideoCmd));
|
---|
6641 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_FLUSH: stream %#x\n", pVideoCmd->streamId));
|
---|
6642 | RT_NOREF_PV(pVideoCmd);
|
---|
6643 | break;
|
---|
6644 | }
|
---|
6645 |
|
---|
6646 | default:
|
---|
6647 | Log(("SVGA_CMD_ESCAPE: Unknown vmware escape: %#x\n", cmd));
|
---|
6648 | break;
|
---|
6649 | }
|
---|
6650 | }
|
---|
6651 | else
|
---|
6652 | Log(("SVGA_CMD_ESCAPE %#x %#x\n", pCmd->nsid, pCmd->size));
|
---|
6653 | }
|
---|
6654 |
|
---|
6655 |
|
---|
6656 | /* SVGA_CMD_DEFINE_SCREEN */
|
---|
6657 | void vmsvgaR3CmdDefineScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineScreen const *pCmd)
|
---|
6658 | {
|
---|
6659 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6660 |
|
---|
6661 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineScreen);
|
---|
6662 | Log(("SVGA_CMD_DEFINE_SCREEN id=%x flags=%x size=(%d,%d) root=(%d,%d) %d:0x%x 0x%x\n",
|
---|
6663 | pCmd->screen.id, pCmd->screen.flags, pCmd->screen.size.width, pCmd->screen.size.height, pCmd->screen.root.x, pCmd->screen.root.y,
|
---|
6664 | pCmd->screen.backingStore.ptr.gmrId, pCmd->screen.backingStore.ptr.offset, pCmd->screen.backingStore.pitch));
|
---|
6665 |
|
---|
6666 | uint32_t const idScreen = pCmd->screen.id;
|
---|
6667 | ASSERT_GUEST_RETURN_VOID(idScreen < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
6668 |
|
---|
6669 | uint32_t const uWidth = pCmd->screen.size.width;
|
---|
6670 | ASSERT_GUEST_RETURN_VOID(uWidth <= pThis->svga.u32MaxWidth);
|
---|
6671 |
|
---|
6672 | uint32_t const uHeight = pCmd->screen.size.height;
|
---|
6673 | ASSERT_GUEST_RETURN_VOID(uHeight <= pThis->svga.u32MaxHeight);
|
---|
6674 |
|
---|
6675 | uint32_t const cbWidth = uWidth * ((32 + 7) / 8); /** @todo 32? */
|
---|
6676 | uint32_t const cbPitch = pCmd->screen.backingStore.pitch ? pCmd->screen.backingStore.pitch : cbWidth;
|
---|
6677 | ASSERT_GUEST_RETURN_VOID(cbWidth <= cbPitch);
|
---|
6678 |
|
---|
6679 | uint32_t const uScreenOffset = pCmd->screen.backingStore.ptr.offset;
|
---|
6680 | ASSERT_GUEST_RETURN_VOID(uScreenOffset < pThis->vram_size);
|
---|
6681 |
|
---|
6682 | uint32_t const cbVram = pThis->vram_size - uScreenOffset;
|
---|
6683 | /* If we have a not zero pitch, then height can't exceed the available VRAM. */
|
---|
6684 | ASSERT_GUEST_RETURN_VOID( (uHeight == 0 && cbPitch == 0)
|
---|
6685 | || (cbPitch > 0 && uHeight <= cbVram / cbPitch));
|
---|
6686 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6687 |
|
---|
6688 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idScreen];
|
---|
6689 | pScreen->fDefined = true;
|
---|
6690 | pScreen->fModified = true;
|
---|
6691 | pScreen->fuScreen = pCmd->screen.flags;
|
---|
6692 | pScreen->idScreen = idScreen;
|
---|
6693 | if (!RT_BOOL(pCmd->screen.flags & (SVGA_SCREEN_DEACTIVATE | SVGA_SCREEN_BLANKING)))
|
---|
6694 | {
|
---|
6695 | /* Not blanked. */
|
---|
6696 | ASSERT_GUEST_RETURN_VOID(uWidth > 0 && uHeight > 0);
|
---|
6697 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6698 |
|
---|
6699 | pScreen->xOrigin = pCmd->screen.root.x;
|
---|
6700 | pScreen->yOrigin = pCmd->screen.root.y;
|
---|
6701 | pScreen->cWidth = uWidth;
|
---|
6702 | pScreen->cHeight = uHeight;
|
---|
6703 | pScreen->offVRAM = uScreenOffset;
|
---|
6704 | pScreen->cbPitch = cbPitch;
|
---|
6705 | pScreen->cBpp = 32;
|
---|
6706 | }
|
---|
6707 | else
|
---|
6708 | {
|
---|
6709 | /* Screen blanked. Keep old values. */
|
---|
6710 | }
|
---|
6711 |
|
---|
6712 | pThis->svga.fGFBRegisters = false;
|
---|
6713 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
6714 |
|
---|
6715 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
6716 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
6717 | vmsvga3dDefineScreen(pThis, pThisCC, pScreen);
|
---|
6718 | #endif
|
---|
6719 | }
|
---|
6720 |
|
---|
6721 |
|
---|
6722 | /* SVGA_CMD_DESTROY_SCREEN */
|
---|
6723 | void vmsvgaR3CmdDestroyScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDestroyScreen const *pCmd)
|
---|
6724 | {
|
---|
6725 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6726 |
|
---|
6727 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDestroyScreen);
|
---|
6728 | Log(("SVGA_CMD_DESTROY_SCREEN id=%x\n", pCmd->screenId));
|
---|
6729 |
|
---|
6730 | uint32_t const idScreen = pCmd->screenId;
|
---|
6731 | ASSERT_GUEST_RETURN_VOID(idScreen < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
6732 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6733 |
|
---|
6734 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idScreen];
|
---|
6735 | pScreen->fModified = true;
|
---|
6736 | pScreen->fDefined = false;
|
---|
6737 | pScreen->idScreen = idScreen;
|
---|
6738 |
|
---|
6739 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
6740 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
6741 | vmsvga3dDestroyScreen(pThisCC, pScreen);
|
---|
6742 | #endif
|
---|
6743 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
6744 | }
|
---|
6745 |
|
---|
6746 |
|
---|
6747 | /* SVGA_CMD_DEFINE_GMRFB */
|
---|
6748 | void vmsvgaR3CmdDefineGMRFB(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineGMRFB const *pCmd)
|
---|
6749 | {
|
---|
6750 | RT_NOREF(pThis);
|
---|
6751 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6752 |
|
---|
6753 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmrFb);
|
---|
6754 | Log(("SVGA_CMD_DEFINE_GMRFB gmr=%x offset=%x bytesPerLine=%x bpp=%d color depth=%d\n",
|
---|
6755 | pCmd->ptr.gmrId, pCmd->ptr.offset, pCmd->bytesPerLine, pCmd->format.bitsPerPixel, pCmd->format.colorDepth));
|
---|
6756 |
|
---|
6757 | pSvgaR3State->GMRFB.ptr = pCmd->ptr;
|
---|
6758 | pSvgaR3State->GMRFB.bytesPerLine = pCmd->bytesPerLine;
|
---|
6759 | pSvgaR3State->GMRFB.format = pCmd->format;
|
---|
6760 | }
|
---|
6761 |
|
---|
6762 |
|
---|
6763 | /* SVGA_CMD_BLIT_GMRFB_TO_SCREEN */
|
---|
6764 | void vmsvgaR3CmdBlitGMRFBToScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdBlitGMRFBToScreen const *pCmd)
|
---|
6765 | {
|
---|
6766 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6767 |
|
---|
6768 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdBlitGmrFbToScreen);
|
---|
6769 | Log(("SVGA_CMD_BLIT_GMRFB_TO_SCREEN src=(%d,%d) dest id=%d (%d,%d)(%d,%d)\n",
|
---|
6770 | pCmd->srcOrigin.x, pCmd->srcOrigin.y, pCmd->destScreenId, pCmd->destRect.left, pCmd->destRect.top, pCmd->destRect.right, pCmd->destRect.bottom));
|
---|
6771 |
|
---|
6772 | ASSERT_GUEST_RETURN_VOID(pCmd->destScreenId < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
6773 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6774 |
|
---|
6775 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, pCmd->destScreenId);
|
---|
6776 | AssertPtrReturnVoid(pScreen);
|
---|
6777 |
|
---|
6778 | /** @todo Support GMRFB.format.s.bitsPerPixel != pThis->svga.uBpp ? */
|
---|
6779 | AssertReturnVoid(pSvgaR3State->GMRFB.format.bitsPerPixel == pScreen->cBpp);
|
---|
6780 |
|
---|
6781 | /* Clip destRect to the screen dimensions. */
|
---|
6782 | SVGASignedRect screenRect;
|
---|
6783 | screenRect.left = 0;
|
---|
6784 | screenRect.top = 0;
|
---|
6785 | screenRect.right = pScreen->cWidth;
|
---|
6786 | screenRect.bottom = pScreen->cHeight;
|
---|
6787 | SVGASignedRect clipRect = pCmd->destRect;
|
---|
6788 | vmsvgaR3ClipRect(&screenRect, &clipRect);
|
---|
6789 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6790 |
|
---|
6791 | uint32_t const width = clipRect.right - clipRect.left;
|
---|
6792 | uint32_t const height = clipRect.bottom - clipRect.top;
|
---|
6793 |
|
---|
6794 | if ( width == 0
|
---|
6795 | || height == 0)
|
---|
6796 | return; /* Nothing to do. */
|
---|
6797 |
|
---|
6798 | int32_t const srcx = pCmd->srcOrigin.x + (clipRect.left - pCmd->destRect.left);
|
---|
6799 | int32_t const srcy = pCmd->srcOrigin.y + (clipRect.top - pCmd->destRect.top);
|
---|
6800 |
|
---|
6801 | /* Copy the defined by GMRFB image to the screen 0 VRAM area.
|
---|
6802 | * Prepare parameters for vmsvgaR3GmrTransfer.
|
---|
6803 | */
|
---|
6804 | AssertReturnVoid(pScreen->offVRAM < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */
|
---|
6805 |
|
---|
6806 | /* Destination: host buffer which describes the screen 0 VRAM.
|
---|
6807 | * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer.
|
---|
6808 | */
|
---|
6809 | uint8_t * const pbHstBuf = (uint8_t *)pThisCC->pbVRam + pScreen->offVRAM;
|
---|
6810 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch :
|
---|
6811 | width * (RT_ALIGN(pScreen->cBpp, 8) / 8);
|
---|
6812 | uint32_t cbHstBuf = cbScanline * pScreen->cHeight;
|
---|
6813 | if (cbHstBuf > pThis->vram_size - pScreen->offVRAM)
|
---|
6814 | cbHstBuf = pThis->vram_size - pScreen->offVRAM; /* Paranoia. */
|
---|
6815 | uint32_t const offHst = (clipRect.left * RT_ALIGN(pScreen->cBpp, 8)) / 8
|
---|
6816 | + cbScanline * clipRect.top;
|
---|
6817 | int32_t const cbHstPitch = cbScanline;
|
---|
6818 |
|
---|
6819 | /* Source: GMRFB. vmsvgaR3GmrTransfer ensures that no memory outside the GMR is read. */
|
---|
6820 | SVGAGuestPtr const gstPtr = pSvgaR3State->GMRFB.ptr;
|
---|
6821 | uint32_t const offGst = (srcx * RT_ALIGN(pSvgaR3State->GMRFB.format.bitsPerPixel, 8)) / 8
|
---|
6822 | + pSvgaR3State->GMRFB.bytesPerLine * srcy;
|
---|
6823 | int32_t const cbGstPitch = pSvgaR3State->GMRFB.bytesPerLine;
|
---|
6824 |
|
---|
6825 | int rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_WRITE_HOST_VRAM,
|
---|
6826 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
6827 | gstPtr, offGst, cbGstPitch,
|
---|
6828 | (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
|
---|
6829 | AssertRC(rc);
|
---|
6830 | vmsvgaR3UpdateScreen(pThisCC, pScreen, clipRect.left, clipRect.top, width, height);
|
---|
6831 | }
|
---|
6832 |
|
---|
6833 |
|
---|
6834 | /* SVGA_CMD_BLIT_SCREEN_TO_GMRFB */
|
---|
6835 | void vmsvgaR3CmdBlitScreenToGMRFB(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdBlitScreenToGMRFB const *pCmd)
|
---|
6836 | {
|
---|
6837 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6838 |
|
---|
6839 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdBlitScreentoGmrFb);
|
---|
6840 | /* Note! This can fetch 3d render results as well!! */
|
---|
6841 | Log(("SVGA_CMD_BLIT_SCREEN_TO_GMRFB dest=(%d,%d) src id=%d (%d,%d)(%d,%d)\n",
|
---|
6842 | pCmd->destOrigin.x, pCmd->destOrigin.y, pCmd->srcScreenId, pCmd->srcRect.left, pCmd->srcRect.top, pCmd->srcRect.right, pCmd->srcRect.bottom));
|
---|
6843 |
|
---|
6844 | ASSERT_GUEST_RETURN_VOID(pCmd->srcScreenId < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
6845 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6846 |
|
---|
6847 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, pCmd->srcScreenId);
|
---|
6848 | AssertPtrReturnVoid(pScreen);
|
---|
6849 |
|
---|
6850 | /** @todo Support GMRFB.format.bitsPerPixel != pThis->svga.uBpp ? */
|
---|
6851 | AssertReturnVoid(pSvgaR3State->GMRFB.format.bitsPerPixel == pScreen->cBpp);
|
---|
6852 |
|
---|
6853 | /* Clip destRect to the screen dimensions. */
|
---|
6854 | SVGASignedRect screenRect;
|
---|
6855 | screenRect.left = 0;
|
---|
6856 | screenRect.top = 0;
|
---|
6857 | screenRect.right = pScreen->cWidth;
|
---|
6858 | screenRect.bottom = pScreen->cHeight;
|
---|
6859 | SVGASignedRect clipRect = pCmd->srcRect;
|
---|
6860 | vmsvgaR3ClipRect(&screenRect, &clipRect);
|
---|
6861 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6862 |
|
---|
6863 | uint32_t const width = clipRect.right - clipRect.left;
|
---|
6864 | uint32_t const height = clipRect.bottom - clipRect.top;
|
---|
6865 |
|
---|
6866 | if ( width == 0
|
---|
6867 | || height == 0)
|
---|
6868 | return; /* Nothing to do. */
|
---|
6869 |
|
---|
6870 | int32_t const dstx = pCmd->destOrigin.x + (clipRect.left - pCmd->srcRect.left);
|
---|
6871 | int32_t const dsty = pCmd->destOrigin.y + (clipRect.top - pCmd->srcRect.top);
|
---|
6872 |
|
---|
6873 | /* Copy the defined by GMRFB image to the screen 0 VRAM area.
|
---|
6874 | * Prepare parameters for vmsvgaR3GmrTransfer.
|
---|
6875 | */
|
---|
6876 | AssertReturnVoid(pScreen->offVRAM < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */
|
---|
6877 |
|
---|
6878 | /* Source: host buffer which describes the screen 0 VRAM.
|
---|
6879 | * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer.
|
---|
6880 | */
|
---|
6881 | uint8_t * const pbHstBuf = (uint8_t *)pThisCC->pbVRam + pScreen->offVRAM;
|
---|
6882 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch :
|
---|
6883 | width * (RT_ALIGN(pScreen->cBpp, 8) / 8);
|
---|
6884 | uint32_t cbHstBuf = cbScanline * pScreen->cHeight;
|
---|
6885 | if (cbHstBuf > pThis->vram_size - pScreen->offVRAM)
|
---|
6886 | cbHstBuf = pThis->vram_size - pScreen->offVRAM; /* Paranoia. */
|
---|
6887 | uint32_t const offHst = (clipRect.left * RT_ALIGN(pScreen->cBpp, 8)) / 8
|
---|
6888 | + cbScanline * clipRect.top;
|
---|
6889 | int32_t const cbHstPitch = cbScanline;
|
---|
6890 |
|
---|
6891 | /* Destination: GMRFB. vmsvgaR3GmrTransfer ensures that no memory outside the GMR is read. */
|
---|
6892 | SVGAGuestPtr const gstPtr = pSvgaR3State->GMRFB.ptr;
|
---|
6893 | uint32_t const offGst = (dstx * RT_ALIGN(pSvgaR3State->GMRFB.format.bitsPerPixel, 8)) / 8
|
---|
6894 | + pSvgaR3State->GMRFB.bytesPerLine * dsty;
|
---|
6895 | int32_t const cbGstPitch = pSvgaR3State->GMRFB.bytesPerLine;
|
---|
6896 |
|
---|
6897 | int rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_READ_HOST_VRAM,
|
---|
6898 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
6899 | gstPtr, offGst, cbGstPitch,
|
---|
6900 | (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
|
---|
6901 | AssertRC(rc);
|
---|
6902 | }
|
---|
6903 |
|
---|
6904 |
|
---|
6905 | /* SVGA_CMD_ANNOTATION_FILL */
|
---|
6906 | void vmsvgaR3CmdAnnotationFill(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdAnnotationFill const *pCmd)
|
---|
6907 | {
|
---|
6908 | RT_NOREF(pThis);
|
---|
6909 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6910 |
|
---|
6911 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdAnnotationFill);
|
---|
6912 | Log(("SVGA_CMD_ANNOTATION_FILL red=%x green=%x blue=%x\n", pCmd->color.r, pCmd->color.g, pCmd->color.b));
|
---|
6913 |
|
---|
6914 | pSvgaR3State->colorAnnotation = pCmd->color;
|
---|
6915 | }
|
---|
6916 |
|
---|
6917 |
|
---|
6918 | /* SVGA_CMD_ANNOTATION_COPY */
|
---|
6919 | void vmsvgaR3CmdAnnotationCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdAnnotationCopy const *pCmd)
|
---|
6920 | {
|
---|
6921 | RT_NOREF(pThis, pCmd);
|
---|
6922 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6923 |
|
---|
6924 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdAnnotationCopy);
|
---|
6925 | Log(("SVGA_CMD_ANNOTATION_COPY srcOrigin %d,%d, srcScreenId %u\n", pCmd->srcOrigin.x, pCmd->srcOrigin.y, pCmd->srcScreenId));
|
---|
6926 |
|
---|
6927 | AssertFailed();
|
---|
6928 | }
|
---|
6929 |
|
---|
6930 |
|
---|
6931 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
6932 | /* SVGA_CMD_DEFINE_GMR2 */
|
---|
6933 | void vmsvgaR3CmdDefineGMR2(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineGMR2 const *pCmd)
|
---|
6934 | {
|
---|
6935 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6936 |
|
---|
6937 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2);
|
---|
6938 | Log(("SVGA_CMD_DEFINE_GMR2 id=%#x %#x pages\n", pCmd->gmrId, pCmd->numPages));
|
---|
6939 |
|
---|
6940 | /* Validate current GMR id. */
|
---|
6941 | ASSERT_GUEST_RETURN_VOID(pCmd->gmrId < pThis->svga.cGMR);
|
---|
6942 | ASSERT_GUEST_RETURN_VOID(pCmd->numPages <= VMSVGA_MAX_GMR_PAGES);
|
---|
6943 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6944 |
|
---|
6945 | if (!pCmd->numPages)
|
---|
6946 | {
|
---|
6947 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2Free);
|
---|
6948 | vmsvgaR3GmrFree(pThisCC, pCmd->gmrId);
|
---|
6949 | }
|
---|
6950 | else
|
---|
6951 | {
|
---|
6952 | PGMR pGMR = &pSvgaR3State->paGMR[pCmd->gmrId];
|
---|
6953 | if (pGMR->cMaxPages)
|
---|
6954 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2Modify);
|
---|
6955 |
|
---|
6956 | /* Not sure if we should always free the descriptor, but for simplicity
|
---|
6957 | we do so if the new size is smaller than the current. */
|
---|
6958 | /** @todo always free the descriptor in SVGA_CMD_DEFINE_GMR2? */
|
---|
6959 | if (pGMR->cbTotal / X86_PAGE_SIZE > pCmd->numPages)
|
---|
6960 | vmsvgaR3GmrFree(pThisCC, pCmd->gmrId);
|
---|
6961 |
|
---|
6962 | pGMR->cMaxPages = pCmd->numPages;
|
---|
6963 | /* The rest is done by the REMAP_GMR2 command. */
|
---|
6964 | }
|
---|
6965 | }
|
---|
6966 |
|
---|
6967 |
|
---|
6968 | /* SVGA_CMD_REMAP_GMR2 */
|
---|
6969 | void vmsvgaR3CmdRemapGMR2(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRemapGMR2 const *pCmd)
|
---|
6970 | {
|
---|
6971 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6972 |
|
---|
6973 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRemapGmr2);
|
---|
6974 | Log(("SVGA_CMD_REMAP_GMR2 id=%#x flags=%#x offset=%#x npages=%#x\n", pCmd->gmrId, pCmd->flags, pCmd->offsetPages, pCmd->numPages));
|
---|
6975 |
|
---|
6976 | /* Validate current GMR id and size. */
|
---|
6977 | ASSERT_GUEST_RETURN_VOID(pCmd->gmrId < pThis->svga.cGMR);
|
---|
6978 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6979 | PGMR pGMR = &pSvgaR3State->paGMR[pCmd->gmrId];
|
---|
6980 | ASSERT_GUEST_RETURN_VOID( (uint64_t)pCmd->offsetPages + pCmd->numPages
|
---|
6981 | <= RT_MIN(pGMR->cMaxPages, RT_MIN(VMSVGA_MAX_GMR_PAGES, UINT32_MAX / X86_PAGE_SIZE)));
|
---|
6982 | ASSERT_GUEST_RETURN_VOID(!pCmd->offsetPages || pGMR->paDesc); /** @todo */
|
---|
6983 |
|
---|
6984 | if (pCmd->numPages == 0)
|
---|
6985 | return;
|
---|
6986 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6987 |
|
---|
6988 | /* Calc new total page count so we can use it instead of cMaxPages for allocations below. */
|
---|
6989 | uint32_t const cNewTotalPages = RT_MAX(pGMR->cbTotal >> X86_PAGE_SHIFT, pCmd->offsetPages + pCmd->numPages);
|
---|
6990 |
|
---|
6991 | /*
|
---|
6992 | * We flatten the existing descriptors into a page array, overwrite the
|
---|
6993 | * pages specified in this command and then recompress the descriptor.
|
---|
6994 | */
|
---|
6995 | /** @todo Optimize the GMR remap algorithm! */
|
---|
6996 |
|
---|
6997 | /* Save the old page descriptors as an array of page frame numbers (address >> X86_PAGE_SHIFT) */
|
---|
6998 | uint64_t *paNewPage64 = NULL;
|
---|
6999 | if (pGMR->paDesc)
|
---|
7000 | {
|
---|
7001 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRemapGmr2Modify);
|
---|
7002 |
|
---|
7003 | paNewPage64 = (uint64_t *)RTMemAllocZ(cNewTotalPages * sizeof(uint64_t));
|
---|
7004 | AssertPtrReturnVoid(paNewPage64);
|
---|
7005 |
|
---|
7006 | uint32_t idxPage = 0;
|
---|
7007 | for (uint32_t i = 0; i < pGMR->numDescriptors; i++)
|
---|
7008 | for (uint32_t j = 0; j < pGMR->paDesc[i].numPages; j++)
|
---|
7009 | paNewPage64[idxPage++] = (pGMR->paDesc[i].GCPhys + j * X86_PAGE_SIZE) >> X86_PAGE_SHIFT;
|
---|
7010 | AssertReturnVoidStmt(idxPage == pGMR->cbTotal >> X86_PAGE_SHIFT, RTMemFree(paNewPage64));
|
---|
7011 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7012 | }
|
---|
7013 |
|
---|
7014 | /* Free the old GMR if present. */
|
---|
7015 | if (pGMR->paDesc)
|
---|
7016 | RTMemFree(pGMR->paDesc);
|
---|
7017 |
|
---|
7018 | /* Allocate the maximum amount possible (everything non-continuous) */
|
---|
7019 | PVMSVGAGMRDESCRIPTOR paDescs;
|
---|
7020 | pGMR->paDesc = paDescs = (PVMSVGAGMRDESCRIPTOR)RTMemAllocZ(cNewTotalPages * sizeof(VMSVGAGMRDESCRIPTOR));
|
---|
7021 | AssertReturnVoidStmt(paDescs, RTMemFree(paNewPage64));
|
---|
7022 |
|
---|
7023 | if (pCmd->flags & SVGA_REMAP_GMR2_VIA_GMR)
|
---|
7024 | {
|
---|
7025 | /** @todo */
|
---|
7026 | AssertFailed();
|
---|
7027 | pGMR->numDescriptors = 0;
|
---|
7028 | }
|
---|
7029 | else
|
---|
7030 | {
|
---|
7031 | uint32_t *paPages32 = (uint32_t *)(pCmd + 1);
|
---|
7032 | uint64_t *paPages64 = (uint64_t *)(pCmd + 1);
|
---|
7033 | bool fGCPhys64 = RT_BOOL(pCmd->flags & SVGA_REMAP_GMR2_PPN64);
|
---|
7034 |
|
---|
7035 | uint32_t cPages;
|
---|
7036 | if (paNewPage64)
|
---|
7037 | {
|
---|
7038 | /* Overwrite the old page array with the new page values. */
|
---|
7039 | if (fGCPhys64)
|
---|
7040 | for (uint32_t i = pCmd->offsetPages; i < pCmd->offsetPages + pCmd->numPages; i++)
|
---|
7041 | paNewPage64[i] = paPages64[i - pCmd->offsetPages];
|
---|
7042 | else
|
---|
7043 | for (uint32_t i = pCmd->offsetPages; i < pCmd->offsetPages + pCmd->numPages; i++)
|
---|
7044 | paNewPage64[i] = paPages32[i - pCmd->offsetPages];
|
---|
7045 |
|
---|
7046 | /* Use the updated page array instead of the command data. */
|
---|
7047 | fGCPhys64 = true;
|
---|
7048 | paPages64 = paNewPage64;
|
---|
7049 | cPages = cNewTotalPages;
|
---|
7050 | }
|
---|
7051 | else
|
---|
7052 | cPages = pCmd->numPages;
|
---|
7053 |
|
---|
7054 | /* The first page. */
|
---|
7055 | /** @todo The 0x00000FFFFFFFFFFF mask limits to 44 bits and should not be
|
---|
7056 | * applied to paNewPage64. */
|
---|
7057 | RTGCPHYS GCPhys;
|
---|
7058 | if (fGCPhys64)
|
---|
7059 | GCPhys = (paPages64[0] << X86_PAGE_SHIFT) & UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
7060 | else
|
---|
7061 | GCPhys = (RTGCPHYS)paPages32[0] << GUEST_PAGE_SHIFT;
|
---|
7062 | paDescs[0].GCPhys = GCPhys;
|
---|
7063 | paDescs[0].numPages = 1;
|
---|
7064 |
|
---|
7065 | /* Subsequent pages. */
|
---|
7066 | uint32_t iDescriptor = 0;
|
---|
7067 | for (uint32_t i = 1; i < cPages; i++)
|
---|
7068 | {
|
---|
7069 | if (pCmd->flags & SVGA_REMAP_GMR2_PPN64)
|
---|
7070 | GCPhys = (paPages64[i] << X86_PAGE_SHIFT) & UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
7071 | else
|
---|
7072 | GCPhys = (RTGCPHYS)paPages32[i] << X86_PAGE_SHIFT;
|
---|
7073 |
|
---|
7074 | /* Continuous physical memory? */
|
---|
7075 | if (GCPhys == paDescs[iDescriptor].GCPhys + paDescs[iDescriptor].numPages * X86_PAGE_SIZE)
|
---|
7076 | {
|
---|
7077 | Assert(paDescs[iDescriptor].numPages);
|
---|
7078 | paDescs[iDescriptor].numPages++;
|
---|
7079 | Log5Func(("Page %x GCPhys=%RGp successor\n", i, GCPhys));
|
---|
7080 | }
|
---|
7081 | else
|
---|
7082 | {
|
---|
7083 | iDescriptor++;
|
---|
7084 | paDescs[iDescriptor].GCPhys = GCPhys;
|
---|
7085 | paDescs[iDescriptor].numPages = 1;
|
---|
7086 | Log5Func(("Page %x GCPhys=%RGp\n", i, paDescs[iDescriptor].GCPhys));
|
---|
7087 | }
|
---|
7088 | }
|
---|
7089 |
|
---|
7090 | pGMR->cbTotal = cNewTotalPages << X86_PAGE_SHIFT;
|
---|
7091 | Log5Func(("Nr of descriptors %x; cbTotal=%#x\n", iDescriptor + 1, cNewTotalPages));
|
---|
7092 | pGMR->numDescriptors = iDescriptor + 1;
|
---|
7093 | }
|
---|
7094 |
|
---|
7095 | if (paNewPage64)
|
---|
7096 | RTMemFree(paNewPage64);
|
---|
7097 | }
|
---|
7098 |
|
---|
7099 |
|
---|
7100 | /**
|
---|
7101 | * Free the specified GMR
|
---|
7102 | *
|
---|
7103 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
7104 | * @param idGMR GMR id
|
---|
7105 | */
|
---|
7106 | void vmsvgaR3GmrFree(PVGASTATECC pThisCC, uint32_t idGMR)
|
---|
7107 | {
|
---|
7108 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
7109 |
|
---|
7110 | /* Free the old descriptor if present. */
|
---|
7111 | PGMR pGMR = &pSVGAState->paGMR[idGMR];
|
---|
7112 | if ( pGMR->numDescriptors
|
---|
7113 | || pGMR->paDesc /* needed till we implement SVGA_REMAP_GMR2_VIA_GMR */)
|
---|
7114 | {
|
---|
7115 | # ifdef DEBUG_GMR_ACCESS
|
---|
7116 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThisCC->pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3DeregisterGmr, 2, pDevIns, idGMR);
|
---|
7117 | # endif
|
---|
7118 |
|
---|
7119 | Assert(pGMR->paDesc);
|
---|
7120 | RTMemFree(pGMR->paDesc);
|
---|
7121 | pGMR->paDesc = NULL;
|
---|
7122 | pGMR->numDescriptors = 0;
|
---|
7123 | pGMR->cbTotal = 0;
|
---|
7124 | pGMR->cMaxPages = 0;
|
---|
7125 | }
|
---|
7126 | Assert(!pGMR->cMaxPages);
|
---|
7127 | Assert(!pGMR->cbTotal);
|
---|
7128 | }
|
---|
7129 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
7130 |
|
---|
7131 |
|
---|
7132 | /**
|
---|
7133 | * Copy between a GMR and a host memory buffer.
|
---|
7134 | *
|
---|
7135 | * @returns VBox status code.
|
---|
7136 | * @param pThis The shared VGA/VMSVGA instance data.
|
---|
7137 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
7138 | * @param enmTransferType Transfer type (read/write)
|
---|
7139 | * @param pbHstBuf Host buffer pointer (valid)
|
---|
7140 | * @param cbHstBuf Size of host buffer (valid)
|
---|
7141 | * @param offHst Host buffer offset of the first scanline
|
---|
7142 | * @param cbHstPitch Destination buffer pitch
|
---|
7143 | * @param gstPtr GMR description
|
---|
7144 | * @param offGst Guest buffer offset of the first scanline
|
---|
7145 | * @param cbGstPitch Guest buffer pitch
|
---|
7146 | * @param cbWidth Width in bytes to copy
|
---|
7147 | * @param cHeight Number of scanllines to copy
|
---|
7148 | */
|
---|
7149 | int vmsvgaR3GmrTransfer(PVGASTATE pThis, PVGASTATECC pThisCC, const SVGA3dTransferType enmTransferType,
|
---|
7150 | uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch,
|
---|
7151 | SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch,
|
---|
7152 | uint32_t cbWidth, uint32_t cHeight)
|
---|
7153 | {
|
---|
7154 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
7155 | PPDMDEVINS pDevIns = pThisCC->pDevIns; /* simpler */
|
---|
7156 | int rc;
|
---|
7157 |
|
---|
7158 | LogFunc(("%s host %p size=%d offset %d pitch=%d; guest gmr=%#x:%#x offset=%d pitch=%d cbWidth=%d cHeight=%d\n",
|
---|
7159 | enmTransferType == SVGA3D_READ_HOST_VRAM ? "WRITE" : "READ", /* GMR op: READ host VRAM means WRITE GMR */
|
---|
7160 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
7161 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cbWidth, cHeight));
|
---|
7162 | AssertReturn(cbWidth && cHeight, VERR_INVALID_PARAMETER);
|
---|
7163 |
|
---|
7164 | PGMR pGMR;
|
---|
7165 | uint32_t cbGmr; /* The GMR size in bytes. */
|
---|
7166 | if (gstPtr.gmrId == SVGA_GMR_FRAMEBUFFER)
|
---|
7167 | {
|
---|
7168 | pGMR = NULL;
|
---|
7169 | cbGmr = pThis->vram_size;
|
---|
7170 | }
|
---|
7171 | else
|
---|
7172 | {
|
---|
7173 | AssertReturn(gstPtr.gmrId < pThis->svga.cGMR, VERR_INVALID_PARAMETER);
|
---|
7174 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7175 | pGMR = &pSVGAState->paGMR[gstPtr.gmrId];
|
---|
7176 | cbGmr = pGMR->cbTotal;
|
---|
7177 | }
|
---|
7178 |
|
---|
7179 | /*
|
---|
7180 | * GMR
|
---|
7181 | */
|
---|
7182 | /* Calculate GMR offset of the data to be copied. */
|
---|
7183 | AssertMsgReturn(gstPtr.offset < cbGmr,
|
---|
7184 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7185 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7186 | VERR_INVALID_PARAMETER);
|
---|
7187 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7188 | AssertMsgReturn(offGst < cbGmr - gstPtr.offset,
|
---|
7189 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7190 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7191 | VERR_INVALID_PARAMETER);
|
---|
7192 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7193 | uint32_t const offGmr = offGst + gstPtr.offset; /* Offset in the GMR, where the first scanline is located. */
|
---|
7194 |
|
---|
7195 | /* Verify that cbWidth is less than scanline and fits into the GMR. */
|
---|
7196 | uint32_t const cbGmrScanline = cbGstPitch > 0 ? cbGstPitch : -cbGstPitch;
|
---|
7197 | AssertMsgReturn(cbGmrScanline != 0,
|
---|
7198 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7199 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7200 | VERR_INVALID_PARAMETER);
|
---|
7201 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7202 | AssertMsgReturn(cbWidth <= cbGmrScanline,
|
---|
7203 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7204 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7205 | VERR_INVALID_PARAMETER);
|
---|
7206 | AssertMsgReturn(cbWidth <= cbGmr - offGmr,
|
---|
7207 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7208 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7209 | VERR_INVALID_PARAMETER);
|
---|
7210 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7211 |
|
---|
7212 | /* How many bytes are available for the data in the GMR. */
|
---|
7213 | uint32_t const cbGmrLeft = cbGstPitch > 0 ? cbGmr - offGmr : offGmr + cbWidth;
|
---|
7214 |
|
---|
7215 | /* How many scanlines would fit into the available data. */
|
---|
7216 | uint32_t cGmrScanlines = cbGmrLeft / cbGmrScanline;
|
---|
7217 | uint32_t const cbGmrLastScanline = cbGmrLeft - cGmrScanlines * cbGmrScanline; /* Slack space. */
|
---|
7218 | if (cbWidth <= cbGmrLastScanline)
|
---|
7219 | ++cGmrScanlines;
|
---|
7220 |
|
---|
7221 | if (cHeight > cGmrScanlines)
|
---|
7222 | cHeight = cGmrScanlines;
|
---|
7223 |
|
---|
7224 | AssertMsgReturn(cHeight > 0,
|
---|
7225 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7226 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7227 | VERR_INVALID_PARAMETER);
|
---|
7228 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7229 |
|
---|
7230 | /*
|
---|
7231 | * Host buffer.
|
---|
7232 | */
|
---|
7233 | AssertMsgReturn(offHst < cbHstBuf,
|
---|
7234 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7235 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7236 | VERR_INVALID_PARAMETER);
|
---|
7237 |
|
---|
7238 | /* Verify that cbWidth is less than scanline and fits into the buffer. */
|
---|
7239 | uint32_t const cbHstScanline = cbHstPitch > 0 ? cbHstPitch : -cbHstPitch;
|
---|
7240 | AssertMsgReturn(cbHstScanline != 0,
|
---|
7241 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7242 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7243 | VERR_INVALID_PARAMETER);
|
---|
7244 | AssertMsgReturn(cbWidth <= cbHstScanline,
|
---|
7245 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7246 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7247 | VERR_INVALID_PARAMETER);
|
---|
7248 | AssertMsgReturn(cbWidth <= cbHstBuf - offHst,
|
---|
7249 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7250 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7251 | VERR_INVALID_PARAMETER);
|
---|
7252 |
|
---|
7253 | /* How many bytes are available for the data in the buffer. */
|
---|
7254 | uint32_t const cbHstLeft = cbHstPitch > 0 ? cbHstBuf - offHst : offHst + cbWidth;
|
---|
7255 |
|
---|
7256 | /* How many scanlines would fit into the available data. */
|
---|
7257 | uint32_t cHstScanlines = cbHstLeft / cbHstScanline;
|
---|
7258 | uint32_t const cbHstLastScanline = cbHstLeft - cHstScanlines * cbHstScanline; /* Slack space. */
|
---|
7259 | if (cbWidth <= cbHstLastScanline)
|
---|
7260 | ++cHstScanlines;
|
---|
7261 |
|
---|
7262 | if (cHeight > cHstScanlines)
|
---|
7263 | cHeight = cHstScanlines;
|
---|
7264 |
|
---|
7265 | AssertMsgReturn(cHeight > 0,
|
---|
7266 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7267 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7268 | VERR_INVALID_PARAMETER);
|
---|
7269 |
|
---|
7270 | uint8_t *pbHst = pbHstBuf + offHst;
|
---|
7271 |
|
---|
7272 | /* Shortcut for the framebuffer. */
|
---|
7273 | if (gstPtr.gmrId == SVGA_GMR_FRAMEBUFFER)
|
---|
7274 | {
|
---|
7275 | uint8_t *pbGst = pThisCC->pbVRam + offGmr;
|
---|
7276 |
|
---|
7277 | uint8_t const *pbSrc;
|
---|
7278 | int32_t cbSrcPitch;
|
---|
7279 | uint8_t *pbDst;
|
---|
7280 | int32_t cbDstPitch;
|
---|
7281 |
|
---|
7282 | if (enmTransferType == SVGA3D_READ_HOST_VRAM)
|
---|
7283 | {
|
---|
7284 | pbSrc = pbHst;
|
---|
7285 | cbSrcPitch = cbHstPitch;
|
---|
7286 | pbDst = pbGst;
|
---|
7287 | cbDstPitch = cbGstPitch;
|
---|
7288 | }
|
---|
7289 | else
|
---|
7290 | {
|
---|
7291 | pbSrc = pbGst;
|
---|
7292 | cbSrcPitch = cbGstPitch;
|
---|
7293 | pbDst = pbHst;
|
---|
7294 | cbDstPitch = cbHstPitch;
|
---|
7295 | }
|
---|
7296 |
|
---|
7297 | if ( cbWidth == (uint32_t)cbGstPitch
|
---|
7298 | && cbGstPitch == cbHstPitch)
|
---|
7299 | {
|
---|
7300 | /* Entire scanlines, positive pitch. */
|
---|
7301 | memcpy(pbDst, pbSrc, cbWidth * cHeight);
|
---|
7302 | }
|
---|
7303 | else
|
---|
7304 | {
|
---|
7305 | for (uint32_t i = 0; i < cHeight; ++i)
|
---|
7306 | {
|
---|
7307 | memcpy(pbDst, pbSrc, cbWidth);
|
---|
7308 |
|
---|
7309 | pbDst += cbDstPitch;
|
---|
7310 | pbSrc += cbSrcPitch;
|
---|
7311 | }
|
---|
7312 | }
|
---|
7313 | return VINF_SUCCESS;
|
---|
7314 | }
|
---|
7315 |
|
---|
7316 | AssertPtrReturn(pGMR, VERR_INVALID_PARAMETER);
|
---|
7317 | AssertReturn(pGMR->numDescriptors > 0, VERR_INVALID_PARAMETER);
|
---|
7318 |
|
---|
7319 | PVMSVGAGMRDESCRIPTOR const paDesc = pGMR->paDesc; /* Local copy of the pointer. */
|
---|
7320 | uint32_t iDesc = 0; /* Index in the descriptor array. */
|
---|
7321 | uint32_t offDesc = 0; /* GMR offset of the current descriptor. */
|
---|
7322 | uint32_t offGmrScanline = offGmr; /* GMR offset of the scanline which is being copied. */
|
---|
7323 | uint8_t *pbHstScanline = pbHst; /* Host address of the scanline which is being copied. */
|
---|
7324 | for (uint32_t i = 0; i < cHeight; ++i)
|
---|
7325 | {
|
---|
7326 | uint32_t cbCurrentWidth = cbWidth;
|
---|
7327 | uint32_t offGmrCurrent = offGmrScanline;
|
---|
7328 | uint8_t *pbCurrentHost = pbHstScanline;
|
---|
7329 |
|
---|
7330 | /* Find the right descriptor */
|
---|
7331 | while (offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE <= offGmrCurrent)
|
---|
7332 | {
|
---|
7333 | offDesc += paDesc[iDesc].numPages * GUEST_PAGE_SIZE;
|
---|
7334 | AssertReturn(offDesc < pGMR->cbTotal, VERR_INTERNAL_ERROR); /* overflow protection */
|
---|
7335 | ++iDesc;
|
---|
7336 | AssertReturn(iDesc < pGMR->numDescriptors, VERR_INTERNAL_ERROR);
|
---|
7337 | }
|
---|
7338 |
|
---|
7339 | while (cbCurrentWidth)
|
---|
7340 | {
|
---|
7341 | uint32_t cbToCopy;
|
---|
7342 |
|
---|
7343 | if (offGmrCurrent + cbCurrentWidth <= offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE)
|
---|
7344 | cbToCopy = cbCurrentWidth;
|
---|
7345 | else
|
---|
7346 | {
|
---|
7347 | cbToCopy = (offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE - offGmrCurrent);
|
---|
7348 | AssertReturn(cbToCopy <= cbCurrentWidth, VERR_INVALID_PARAMETER);
|
---|
7349 | }
|
---|
7350 |
|
---|
7351 | RTGCPHYS const GCPhys = paDesc[iDesc].GCPhys + offGmrCurrent - offDesc;
|
---|
7352 |
|
---|
7353 | Log5Func(("%s phys=%RGp\n", (enmTransferType == SVGA3D_WRITE_HOST_VRAM) ? "READ" : "WRITE", GCPhys));
|
---|
7354 |
|
---|
7355 | /*
|
---|
7356 | * We are deliberately using the non-PCI version of PDMDevHlpPCIPhys[Read|Write] as the
|
---|
7357 | * guest-side VMSVGA driver seems to allocate non-DMA (physical memory) addresses,
|
---|
7358 | * see @bugref{9654#c75}.
|
---|
7359 | */
|
---|
7360 | if (enmTransferType == SVGA3D_WRITE_HOST_VRAM)
|
---|
7361 | rc = PDMDevHlpPhysRead(pDevIns, GCPhys, pbCurrentHost, cbToCopy);
|
---|
7362 | else
|
---|
7363 | rc = PDMDevHlpPhysWrite(pDevIns, GCPhys, pbCurrentHost, cbToCopy);
|
---|
7364 | AssertRCBreak(rc);
|
---|
7365 |
|
---|
7366 | cbCurrentWidth -= cbToCopy;
|
---|
7367 | offGmrCurrent += cbToCopy;
|
---|
7368 | pbCurrentHost += cbToCopy;
|
---|
7369 |
|
---|
7370 | /* Go to the next descriptor if there's anything left. */
|
---|
7371 | if (cbCurrentWidth)
|
---|
7372 | {
|
---|
7373 | offDesc += paDesc[iDesc].numPages * GUEST_PAGE_SIZE;
|
---|
7374 | AssertReturn(offDesc < pGMR->cbTotal, VERR_INTERNAL_ERROR);
|
---|
7375 | ++iDesc;
|
---|
7376 | AssertReturn(iDesc < pGMR->numDescriptors, VERR_INTERNAL_ERROR);
|
---|
7377 | }
|
---|
7378 | }
|
---|
7379 |
|
---|
7380 | offGmrScanline += cbGstPitch;
|
---|
7381 | pbHstScanline += cbHstPitch;
|
---|
7382 | }
|
---|
7383 |
|
---|
7384 | return VINF_SUCCESS;
|
---|
7385 | }
|
---|
7386 |
|
---|
7387 |
|
---|
7388 | /**
|
---|
7389 | * Unsigned coordinates in pBox. Clip to [0; pSizeSrc), [0; pSizeDest).
|
---|
7390 | *
|
---|
7391 | * @param pSizeSrc Source surface dimensions.
|
---|
7392 | * @param pSizeDest Destination surface dimensions.
|
---|
7393 | * @param pBox Coordinates to be clipped.
|
---|
7394 | */
|
---|
7395 | void vmsvgaR3ClipCopyBox(const SVGA3dSize *pSizeSrc, const SVGA3dSize *pSizeDest, SVGA3dCopyBox *pBox)
|
---|
7396 | {
|
---|
7397 | /* Src x, w */
|
---|
7398 | if (pBox->srcx > pSizeSrc->width)
|
---|
7399 | pBox->srcx = pSizeSrc->width;
|
---|
7400 | if (pBox->w > pSizeSrc->width - pBox->srcx)
|
---|
7401 | pBox->w = pSizeSrc->width - pBox->srcx;
|
---|
7402 |
|
---|
7403 | /* Src y, h */
|
---|
7404 | if (pBox->srcy > pSizeSrc->height)
|
---|
7405 | pBox->srcy = pSizeSrc->height;
|
---|
7406 | if (pBox->h > pSizeSrc->height - pBox->srcy)
|
---|
7407 | pBox->h = pSizeSrc->height - pBox->srcy;
|
---|
7408 |
|
---|
7409 | /* Src z, d */
|
---|
7410 | if (pBox->srcz > pSizeSrc->depth)
|
---|
7411 | pBox->srcz = pSizeSrc->depth;
|
---|
7412 | if (pBox->d > pSizeSrc->depth - pBox->srcz)
|
---|
7413 | pBox->d = pSizeSrc->depth - pBox->srcz;
|
---|
7414 |
|
---|
7415 | /* Dest x, w */
|
---|
7416 | if (pBox->x > pSizeDest->width)
|
---|
7417 | pBox->x = pSizeDest->width;
|
---|
7418 | if (pBox->w > pSizeDest->width - pBox->x)
|
---|
7419 | pBox->w = pSizeDest->width - pBox->x;
|
---|
7420 |
|
---|
7421 | /* Dest y, h */
|
---|
7422 | if (pBox->y > pSizeDest->height)
|
---|
7423 | pBox->y = pSizeDest->height;
|
---|
7424 | if (pBox->h > pSizeDest->height - pBox->y)
|
---|
7425 | pBox->h = pSizeDest->height - pBox->y;
|
---|
7426 |
|
---|
7427 | /* Dest z, d */
|
---|
7428 | if (pBox->z > pSizeDest->depth)
|
---|
7429 | pBox->z = pSizeDest->depth;
|
---|
7430 | if (pBox->d > pSizeDest->depth - pBox->z)
|
---|
7431 | pBox->d = pSizeDest->depth - pBox->z;
|
---|
7432 | }
|
---|
7433 |
|
---|
7434 |
|
---|
7435 | /**
|
---|
7436 | * Unsigned coordinates in pBox. Clip to [0; pSize).
|
---|
7437 | *
|
---|
7438 | * @param pSize Source surface dimensions.
|
---|
7439 | * @param pBox Coordinates to be clipped.
|
---|
7440 | */
|
---|
7441 | void vmsvgaR3ClipBox(const SVGA3dSize *pSize, SVGA3dBox *pBox)
|
---|
7442 | {
|
---|
7443 | /* x, w */
|
---|
7444 | if (pBox->x > pSize->width)
|
---|
7445 | pBox->x = pSize->width;
|
---|
7446 | if (pBox->w > pSize->width - pBox->x)
|
---|
7447 | pBox->w = pSize->width - pBox->x;
|
---|
7448 |
|
---|
7449 | /* y, h */
|
---|
7450 | if (pBox->y > pSize->height)
|
---|
7451 | pBox->y = pSize->height;
|
---|
7452 | if (pBox->h > pSize->height - pBox->y)
|
---|
7453 | pBox->h = pSize->height - pBox->y;
|
---|
7454 |
|
---|
7455 | /* z, d */
|
---|
7456 | if (pBox->z > pSize->depth)
|
---|
7457 | pBox->z = pSize->depth;
|
---|
7458 | if (pBox->d > pSize->depth - pBox->z)
|
---|
7459 | pBox->d = pSize->depth - pBox->z;
|
---|
7460 | }
|
---|
7461 |
|
---|
7462 |
|
---|
7463 | /**
|
---|
7464 | * Clip.
|
---|
7465 | *
|
---|
7466 | * @param pBound Bounding rectangle.
|
---|
7467 | * @param pRect Rectangle to be clipped.
|
---|
7468 | */
|
---|
7469 | void vmsvgaR3ClipRect(SVGASignedRect const *pBound, SVGASignedRect *pRect)
|
---|
7470 | {
|
---|
7471 | int32_t left;
|
---|
7472 | int32_t top;
|
---|
7473 | int32_t right;
|
---|
7474 | int32_t bottom;
|
---|
7475 |
|
---|
7476 | /* Right order. */
|
---|
7477 | Assert(pBound->left <= pBound->right && pBound->top <= pBound->bottom);
|
---|
7478 | if (pRect->left < pRect->right)
|
---|
7479 | {
|
---|
7480 | left = pRect->left;
|
---|
7481 | right = pRect->right;
|
---|
7482 | }
|
---|
7483 | else
|
---|
7484 | {
|
---|
7485 | left = pRect->right;
|
---|
7486 | right = pRect->left;
|
---|
7487 | }
|
---|
7488 | if (pRect->top < pRect->bottom)
|
---|
7489 | {
|
---|
7490 | top = pRect->top;
|
---|
7491 | bottom = pRect->bottom;
|
---|
7492 | }
|
---|
7493 | else
|
---|
7494 | {
|
---|
7495 | top = pRect->bottom;
|
---|
7496 | bottom = pRect->top;
|
---|
7497 | }
|
---|
7498 |
|
---|
7499 | if (left < pBound->left)
|
---|
7500 | left = pBound->left;
|
---|
7501 | if (right < pBound->left)
|
---|
7502 | right = pBound->left;
|
---|
7503 |
|
---|
7504 | if (left > pBound->right)
|
---|
7505 | left = pBound->right;
|
---|
7506 | if (right > pBound->right)
|
---|
7507 | right = pBound->right;
|
---|
7508 |
|
---|
7509 | if (top < pBound->top)
|
---|
7510 | top = pBound->top;
|
---|
7511 | if (bottom < pBound->top)
|
---|
7512 | bottom = pBound->top;
|
---|
7513 |
|
---|
7514 | if (top > pBound->bottom)
|
---|
7515 | top = pBound->bottom;
|
---|
7516 | if (bottom > pBound->bottom)
|
---|
7517 | bottom = pBound->bottom;
|
---|
7518 |
|
---|
7519 | pRect->left = left;
|
---|
7520 | pRect->right = right;
|
---|
7521 | pRect->top = top;
|
---|
7522 | pRect->bottom = bottom;
|
---|
7523 | }
|
---|
7524 |
|
---|
7525 |
|
---|
7526 | /**
|
---|
7527 | * Clip.
|
---|
7528 | *
|
---|
7529 | * @param pBound Bounding rectangle.
|
---|
7530 | * @param pRect Rectangle to be clipped.
|
---|
7531 | */
|
---|
7532 | void vmsvgaR3Clip3dRect(SVGA3dRect const *pBound, SVGA3dRect RT_UNTRUSTED_GUEST *pRect)
|
---|
7533 | {
|
---|
7534 | uint32_t const leftBound = pBound->x;
|
---|
7535 | uint32_t const rightBound = pBound->x + pBound->w;
|
---|
7536 | uint32_t const topBound = pBound->y;
|
---|
7537 | uint32_t const bottomBound = pBound->y + pBound->h;
|
---|
7538 |
|
---|
7539 | uint32_t x = pRect->x;
|
---|
7540 | uint32_t y = pRect->y;
|
---|
7541 | uint32_t w = pRect->w;
|
---|
7542 | uint32_t h = pRect->h;
|
---|
7543 |
|
---|
7544 | /* Make sure that right and bottom coordinates can be safely computed. */
|
---|
7545 | if (x > rightBound)
|
---|
7546 | x = rightBound;
|
---|
7547 | if (w > rightBound - x)
|
---|
7548 | w = rightBound - x;
|
---|
7549 | if (y > bottomBound)
|
---|
7550 | y = bottomBound;
|
---|
7551 | if (h > bottomBound - y)
|
---|
7552 | h = bottomBound - y;
|
---|
7553 |
|
---|
7554 | /* Switch from x, y, w, h to left, top, right, bottom. */
|
---|
7555 | uint32_t left = x;
|
---|
7556 | uint32_t right = x + w;
|
---|
7557 | uint32_t top = y;
|
---|
7558 | uint32_t bottom = y + h;
|
---|
7559 |
|
---|
7560 | /* A standard left, right, bottom, top clipping. */
|
---|
7561 | if (left < leftBound)
|
---|
7562 | left = leftBound;
|
---|
7563 | if (right < leftBound)
|
---|
7564 | right = leftBound;
|
---|
7565 |
|
---|
7566 | if (left > rightBound)
|
---|
7567 | left = rightBound;
|
---|
7568 | if (right > rightBound)
|
---|
7569 | right = rightBound;
|
---|
7570 |
|
---|
7571 | if (top < topBound)
|
---|
7572 | top = topBound;
|
---|
7573 | if (bottom < topBound)
|
---|
7574 | bottom = topBound;
|
---|
7575 |
|
---|
7576 | if (top > bottomBound)
|
---|
7577 | top = bottomBound;
|
---|
7578 | if (bottom > bottomBound)
|
---|
7579 | bottom = bottomBound;
|
---|
7580 |
|
---|
7581 | /* Back to x, y, w, h representation. */
|
---|
7582 | pRect->x = left;
|
---|
7583 | pRect->y = top;
|
---|
7584 | pRect->w = right - left;
|
---|
7585 | pRect->h = bottom - top;
|
---|
7586 | }
|
---|
7587 |
|
---|