1 | /* $Id: DevVGA-SVGA-cmd.cpp 104853 2024-06-05 14:18:51Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMware SVGA device - implementation of VMSVGA commands.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef IN_RING3
|
---|
29 | # error "DevVGA-SVGA-cmd.cpp is only for ring-3 code"
|
---|
30 | #endif
|
---|
31 |
|
---|
32 |
|
---|
33 | #define LOG_GROUP LOG_GROUP_DEV_VMSVGA
|
---|
34 | #include <iprt/mem.h>
|
---|
35 | #include <iprt/path.h>
|
---|
36 | #include <VBox/AssertGuest.h>
|
---|
37 | #include <VBox/log.h>
|
---|
38 | #include <VBox/vmm/pdmdev.h>
|
---|
39 | #include <VBoxVideo.h>
|
---|
40 |
|
---|
41 | /* should go BEFORE any other DevVGA include to make all DevVGA.h config defines be visible */
|
---|
42 | #include "DevVGA.h"
|
---|
43 |
|
---|
44 | /* Should be included after DevVGA.h/DevVGA-SVGA.h to pick all defines. */
|
---|
45 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
46 | # include "DevVGA-SVGA3d.h"
|
---|
47 | #endif
|
---|
48 | #include "DevVGA-SVGA-internal.h"
|
---|
49 |
|
---|
50 | #include <iprt/formats/bmp.h>
|
---|
51 | #include <stdio.h>
|
---|
52 |
|
---|
53 | #if defined(LOG_ENABLED) || defined(VBOX_STRICT)
|
---|
54 | # define SVGA_CASE_ID2STR(idx) case idx: return #idx
|
---|
55 |
|
---|
56 | static const char *vmsvgaFifo3dCmdToString(SVGAFifo3dCmdId enmCmdId)
|
---|
57 | {
|
---|
58 | switch (enmCmdId)
|
---|
59 | {
|
---|
60 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LEGACY_BASE);
|
---|
61 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DEFINE);
|
---|
62 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DESTROY);
|
---|
63 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_COPY);
|
---|
64 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_STRETCHBLT);
|
---|
65 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DMA);
|
---|
66 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CONTEXT_DEFINE);
|
---|
67 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CONTEXT_DESTROY);
|
---|
68 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETTRANSFORM);
|
---|
69 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETZRANGE);
|
---|
70 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETRENDERSTATE);
|
---|
71 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETRENDERTARGET);
|
---|
72 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETTEXTURESTATE);
|
---|
73 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETMATERIAL);
|
---|
74 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETLIGHTDATA);
|
---|
75 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETLIGHTENABLED);
|
---|
76 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETVIEWPORT);
|
---|
77 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETCLIPPLANE);
|
---|
78 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CLEAR);
|
---|
79 | SVGA_CASE_ID2STR(SVGA_3D_CMD_PRESENT);
|
---|
80 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SHADER_DEFINE);
|
---|
81 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SHADER_DESTROY);
|
---|
82 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_SHADER);
|
---|
83 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_SHADER_CONST);
|
---|
84 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW_PRIMITIVES);
|
---|
85 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETSCISSORRECT);
|
---|
86 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BEGIN_QUERY);
|
---|
87 | SVGA_CASE_ID2STR(SVGA_3D_CMD_END_QUERY);
|
---|
88 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WAIT_FOR_QUERY);
|
---|
89 | SVGA_CASE_ID2STR(SVGA_3D_CMD_PRESENT_READBACK);
|
---|
90 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN);
|
---|
91 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DEFINE_V2);
|
---|
92 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GENERATE_MIPMAPS);
|
---|
93 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD4); /* SVGA_3D_CMD_VIDEO_CREATE_DECODER */
|
---|
94 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD5); /* SVGA_3D_CMD_VIDEO_DESTROY_DECODER */
|
---|
95 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD6); /* SVGA_3D_CMD_VIDEO_CREATE_PROCESSOR */
|
---|
96 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD7); /* SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR */
|
---|
97 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD8); /* SVGA_3D_CMD_VIDEO_DECODE_START_FRAME */
|
---|
98 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD9); /* SVGA_3D_CMD_VIDEO_DECODE_RENDER */
|
---|
99 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD10); /* SVGA_3D_CMD_VIDEO_DECODE_END_FRAME */
|
---|
100 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD11); /* SVGA_3D_CMD_VIDEO_PROCESS_FRAME */
|
---|
101 | SVGA_CASE_ID2STR(SVGA_3D_CMD_ACTIVATE_SURFACE);
|
---|
102 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEACTIVATE_SURFACE);
|
---|
103 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SCREEN_DMA);
|
---|
104 | SVGA_CASE_ID2STR(SVGA_3D_CMD_VB_DX_CLEAR_RENDERTARGET_VIEW_REGION); /* SVGA_3D_CMD_DEAD1 */
|
---|
105 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD2);
|
---|
106 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD12); /* Old SVGA_3D_CMD_LOGICOPS_BITBLT */
|
---|
107 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD13); /* Old SVGA_3D_CMD_LOGICOPS_TRANSBLT */
|
---|
108 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD14); /* Old SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
|
---|
109 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD15); /* Old SVGA_3D_CMD_LOGICOPS_COLORFILL */
|
---|
110 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD16); /* Old SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
|
---|
111 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD17); /* Old SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND */
|
---|
112 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_OTABLE_BASE);
|
---|
113 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_OTABLE);
|
---|
114 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_MOB);
|
---|
115 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_MOB);
|
---|
116 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD3);
|
---|
117 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING);
|
---|
118 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE);
|
---|
119 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SURFACE);
|
---|
120 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SURFACE);
|
---|
121 | SVGA_CASE_ID2STR(SVGA_3D_CMD_COND_BIND_GB_SURFACE);
|
---|
122 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_IMAGE);
|
---|
123 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_SURFACE);
|
---|
124 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_IMAGE);
|
---|
125 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_SURFACE);
|
---|
126 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_IMAGE);
|
---|
127 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_SURFACE);
|
---|
128 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_CONTEXT);
|
---|
129 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_CONTEXT);
|
---|
130 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_CONTEXT);
|
---|
131 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_CONTEXT);
|
---|
132 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_CONTEXT);
|
---|
133 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SHADER);
|
---|
134 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SHADER);
|
---|
135 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SHADER);
|
---|
136 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_OTABLE_BASE64);
|
---|
137 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BEGIN_GB_QUERY);
|
---|
138 | SVGA_CASE_ID2STR(SVGA_3D_CMD_END_GB_QUERY);
|
---|
139 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WAIT_FOR_GB_QUERY);
|
---|
140 | SVGA_CASE_ID2STR(SVGA_3D_CMD_NOP);
|
---|
141 | SVGA_CASE_ID2STR(SVGA_3D_CMD_ENABLE_GART);
|
---|
142 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DISABLE_GART);
|
---|
143 | SVGA_CASE_ID2STR(SVGA_3D_CMD_MAP_MOB_INTO_GART);
|
---|
144 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UNMAP_GART_RANGE);
|
---|
145 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SCREENTARGET);
|
---|
146 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SCREENTARGET);
|
---|
147 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SCREENTARGET);
|
---|
148 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_SCREENTARGET);
|
---|
149 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL);
|
---|
150 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL);
|
---|
151 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE);
|
---|
152 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GB_SCREEN_DMA);
|
---|
153 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH);
|
---|
154 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GB_MOB_FENCE);
|
---|
155 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V2);
|
---|
156 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_MOB64);
|
---|
157 | SVGA_CASE_ID2STR(SVGA_3D_CMD_REDEFINE_GB_MOB64);
|
---|
158 | SVGA_CASE_ID2STR(SVGA_3D_CMD_NOP_ERROR);
|
---|
159 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_STREAMS);
|
---|
160 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_DECLS);
|
---|
161 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_DIVISORS);
|
---|
162 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW);
|
---|
163 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW_INDEXED);
|
---|
164 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_CONTEXT);
|
---|
165 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_CONTEXT);
|
---|
166 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_CONTEXT);
|
---|
167 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_CONTEXT);
|
---|
168 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_INVALIDATE_CONTEXT);
|
---|
169 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER);
|
---|
170 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER_RESOURCES);
|
---|
171 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER);
|
---|
172 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SAMPLERS);
|
---|
173 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW);
|
---|
174 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED);
|
---|
175 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INSTANCED);
|
---|
176 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED);
|
---|
177 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_AUTO);
|
---|
178 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_INPUT_LAYOUT);
|
---|
179 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS);
|
---|
180 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_INDEX_BUFFER);
|
---|
181 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_TOPOLOGY);
|
---|
182 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_RENDERTARGETS);
|
---|
183 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_BLEND_STATE);
|
---|
184 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE);
|
---|
185 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_RASTERIZER_STATE);
|
---|
186 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_QUERY);
|
---|
187 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_QUERY);
|
---|
188 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_QUERY);
|
---|
189 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_QUERY_OFFSET);
|
---|
190 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BEGIN_QUERY);
|
---|
191 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_END_QUERY);
|
---|
192 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_QUERY);
|
---|
193 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_PREDICATION);
|
---|
194 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SOTARGETS);
|
---|
195 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VIEWPORTS);
|
---|
196 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SCISSORRECTS);
|
---|
197 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW);
|
---|
198 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW);
|
---|
199 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_COPY_REGION);
|
---|
200 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_COPY);
|
---|
201 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRESENTBLT);
|
---|
202 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_GENMIPS);
|
---|
203 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE);
|
---|
204 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_SUBRESOURCE);
|
---|
205 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE);
|
---|
206 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW);
|
---|
207 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW);
|
---|
208 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW);
|
---|
209 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW);
|
---|
210 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW);
|
---|
211 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW);
|
---|
212 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT);
|
---|
213 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT);
|
---|
214 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_BLEND_STATE);
|
---|
215 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_BLEND_STATE);
|
---|
216 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE);
|
---|
217 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE);
|
---|
218 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE);
|
---|
219 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE);
|
---|
220 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE);
|
---|
221 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE);
|
---|
222 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SHADER);
|
---|
223 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SHADER);
|
---|
224 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_SHADER);
|
---|
225 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT);
|
---|
226 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT);
|
---|
227 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_STREAMOUTPUT);
|
---|
228 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_COTABLE);
|
---|
229 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_COTABLE);
|
---|
230 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BUFFER_COPY);
|
---|
231 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER);
|
---|
232 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK);
|
---|
233 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_MOVE_QUERY);
|
---|
234 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_ALL_QUERY);
|
---|
235 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_ALL_QUERY);
|
---|
236 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER);
|
---|
237 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_MOB_FENCE_64);
|
---|
238 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_ALL_SHADER);
|
---|
239 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_HINT);
|
---|
240 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BUFFER_UPDATE);
|
---|
241 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET);
|
---|
242 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET);
|
---|
243 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET);
|
---|
244 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET);
|
---|
245 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET);
|
---|
246 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET);
|
---|
247 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER);
|
---|
248 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SCREEN_COPY);
|
---|
249 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED1);
|
---|
250 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2);
|
---|
251 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED3);
|
---|
252 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED4);
|
---|
253 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED5);
|
---|
254 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED6);
|
---|
255 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED7);
|
---|
256 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED8);
|
---|
257 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GROW_OTABLE);
|
---|
258 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_GROW_COTABLE);
|
---|
259 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INTRA_SURFACE_COPY);
|
---|
260 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V3);
|
---|
261 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_RESOLVE_COPY);
|
---|
262 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_RESOLVE_COPY);
|
---|
263 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_CONVERT_REGION);
|
---|
264 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_CONVERT);
|
---|
265 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WHOLE_SURFACE_COPY);
|
---|
266 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_UA_VIEW);
|
---|
267 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_UA_VIEW);
|
---|
268 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT);
|
---|
269 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT);
|
---|
270 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT);
|
---|
271 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_UA_VIEWS);
|
---|
272 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT);
|
---|
273 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT);
|
---|
274 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DISPATCH);
|
---|
275 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DISPATCH_INDIRECT);
|
---|
276 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WRITE_ZERO_SURFACE);
|
---|
277 | SVGA_CASE_ID2STR(SVGA_3D_CMD_HINT_ZERO_SURFACE);
|
---|
278 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER);
|
---|
279 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT);
|
---|
280 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_BITBLT);
|
---|
281 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_TRANSBLT);
|
---|
282 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_STRETCHBLT);
|
---|
283 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_COLORFILL);
|
---|
284 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_ALPHABLEND);
|
---|
285 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND);
|
---|
286 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_1);
|
---|
287 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_2);
|
---|
288 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V4);
|
---|
289 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_CS_UA_VIEWS);
|
---|
290 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_MIN_LOD);
|
---|
291 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_3);
|
---|
292 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_4);
|
---|
293 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2);
|
---|
294 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB);
|
---|
295 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER_IFACE);
|
---|
296 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_STREAMOUTPUT);
|
---|
297 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS);
|
---|
298 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_SHADER_IFACE);
|
---|
299 | SVGA_CASE_ID2STR(SVGA_3D_CMD_MAX);
|
---|
300 | SVGA_CASE_ID2STR(SVGA_3D_CMD_FUTURE_MAX);
|
---|
301 |
|
---|
302 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR);
|
---|
303 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER_OUTPUT_VIEW);
|
---|
304 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER);
|
---|
305 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_DECODER_BEGIN_FRAME);
|
---|
306 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_DECODER_SUBMIT_BUFFERS);
|
---|
307 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_DECODER_END_FRAME);
|
---|
308 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_INPUT_VIEW);
|
---|
309 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_OUTPUT_VIEW);
|
---|
310 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_BLT);
|
---|
311 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER);
|
---|
312 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER_OUTPUT_VIEW);
|
---|
313 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR);
|
---|
314 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_INPUT_VIEW);
|
---|
315 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_OUTPUT_VIEW);
|
---|
316 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_TARGET_RECT);
|
---|
317 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_BACKGROUND_COLOR);
|
---|
318 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_COLOR_SPACE);
|
---|
319 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_ALPHA_FILL_MODE);
|
---|
320 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_CONSTRICTION);
|
---|
321 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_STEREO_MODE);
|
---|
322 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FRAME_FORMAT);
|
---|
323 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_COLOR_SPACE);
|
---|
324 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_OUTPUT_RATE);
|
---|
325 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_SOURCE_RECT);
|
---|
326 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_DEST_RECT);
|
---|
327 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ALPHA);
|
---|
328 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PALETTE);
|
---|
329 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PIXEL_ASPECT_RATIO);
|
---|
330 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_LUMA_KEY);
|
---|
331 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_STEREO_FORMAT);
|
---|
332 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_AUTO_PROCESSING_MODE);
|
---|
333 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FILTER);
|
---|
334 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ROTATION);
|
---|
335 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_GET_VIDEO_CAPABILITY);
|
---|
336 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_RTV);
|
---|
337 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_UAV);
|
---|
338 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_VDOV);
|
---|
339 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_VPIV);
|
---|
340 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_VPOV);
|
---|
341 | SVGA_CASE_ID2STR(VBSVGA_3D_CMD_MAX);
|
---|
342 | #ifndef DEBUG_sunlover
|
---|
343 | default: break; /* Compiler warning. */
|
---|
344 | #endif
|
---|
345 | }
|
---|
346 | return "UNKNOWN_3D";
|
---|
347 | }
|
---|
348 |
|
---|
349 | /**
|
---|
350 | * FIFO command name lookup
|
---|
351 | *
|
---|
352 | * @returns FIFO command string or "UNKNOWN"
|
---|
353 | * @param u32Cmd FIFO command
|
---|
354 | */
|
---|
355 | const char *vmsvgaR3FifoCmdToString(uint32_t u32Cmd)
|
---|
356 | {
|
---|
357 | switch (u32Cmd)
|
---|
358 | {
|
---|
359 | SVGA_CASE_ID2STR(SVGA_CMD_INVALID_CMD);
|
---|
360 | SVGA_CASE_ID2STR(SVGA_CMD_UPDATE);
|
---|
361 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_FILL);
|
---|
362 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_COPY);
|
---|
363 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_ROP_COPY);
|
---|
364 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_CURSOR);
|
---|
365 | SVGA_CASE_ID2STR(SVGA_CMD_DISPLAY_CURSOR);
|
---|
366 | SVGA_CASE_ID2STR(SVGA_CMD_MOVE_CURSOR);
|
---|
367 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_ALPHA_CURSOR);
|
---|
368 | SVGA_CASE_ID2STR(SVGA_CMD_UPDATE_VERBOSE);
|
---|
369 | SVGA_CASE_ID2STR(SVGA_CMD_FRONT_ROP_FILL);
|
---|
370 | SVGA_CASE_ID2STR(SVGA_CMD_FENCE);
|
---|
371 | SVGA_CASE_ID2STR(SVGA_CMD_ESCAPE);
|
---|
372 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_SCREEN);
|
---|
373 | SVGA_CASE_ID2STR(SVGA_CMD_DESTROY_SCREEN);
|
---|
374 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_GMRFB);
|
---|
375 | SVGA_CASE_ID2STR(SVGA_CMD_BLIT_GMRFB_TO_SCREEN);
|
---|
376 | SVGA_CASE_ID2STR(SVGA_CMD_BLIT_SCREEN_TO_GMRFB);
|
---|
377 | SVGA_CASE_ID2STR(SVGA_CMD_ANNOTATION_FILL);
|
---|
378 | SVGA_CASE_ID2STR(SVGA_CMD_ANNOTATION_COPY);
|
---|
379 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_GMR2);
|
---|
380 | SVGA_CASE_ID2STR(SVGA_CMD_REMAP_GMR2);
|
---|
381 | SVGA_CASE_ID2STR(SVGA_CMD_DEAD);
|
---|
382 | SVGA_CASE_ID2STR(SVGA_CMD_DEAD_2);
|
---|
383 | SVGA_CASE_ID2STR(SVGA_CMD_NOP);
|
---|
384 | SVGA_CASE_ID2STR(SVGA_CMD_NOP_ERROR);
|
---|
385 | SVGA_CASE_ID2STR(SVGA_CMD_MAX);
|
---|
386 | default:
|
---|
387 | if ( (u32Cmd >= SVGA_3D_CMD_BASE && u32Cmd < SVGA_3D_CMD_MAX)
|
---|
388 | || (u32Cmd >= VBSVGA_3D_CMD_BASE && u32Cmd < VBSVGA_3D_CMD_MAX))
|
---|
389 | return vmsvgaFifo3dCmdToString((SVGAFifo3dCmdId)u32Cmd);
|
---|
390 | }
|
---|
391 | return "UNKNOWN";
|
---|
392 | }
|
---|
393 | # undef SVGA_CASE_ID2STR
|
---|
394 | #endif /* LOG_ENABLED || VBOX_STRICT */
|
---|
395 |
|
---|
396 |
|
---|
397 | /*
|
---|
398 | *
|
---|
399 | * Guest-Backed Objects (GBO).
|
---|
400 | *
|
---|
401 | */
|
---|
402 |
|
---|
403 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
404 |
|
---|
405 | static int vmsvgaR3GboCreate(PVMSVGAR3STATE pSvgaR3State, SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, PVMSVGAGBO pGbo)
|
---|
406 | {
|
---|
407 | ASSERT_GUEST_RETURN(sizeInBytes <= _128M, VERR_INVALID_PARAMETER); /** @todo Less than SVGA_REG_MOB_MAX_SIZE */
|
---|
408 |
|
---|
409 | /*
|
---|
410 | * The 'baseAddress' is a page number and points to the 'root page' of the GBO.
|
---|
411 | * Content of the root page depends on the ptDepth value:
|
---|
412 | * SVGA3D_MOBFMT_PTDEPTH[64]_0 - the only data page;
|
---|
413 | * SVGA3D_MOBFMT_PTDEPTH[64]_1 - array of page numbers for data pages;
|
---|
414 | * SVGA3D_MOBFMT_PTDEPTH[64]_2 - array of page numbers for SVGA3D_MOBFMT_PTDEPTH[64]_1 pages.
|
---|
415 | * The code below extracts the page addresses of the GBO.
|
---|
416 | */
|
---|
417 |
|
---|
418 | /* Verify and normalize the ptDepth value. */
|
---|
419 | bool fGCPhys64; /* Whether the page table contains 64 bit page numbers. */
|
---|
420 | if (RT_LIKELY( ptDepth == SVGA3D_MOBFMT_PTDEPTH64_0
|
---|
421 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH64_1
|
---|
422 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH64_2))
|
---|
423 | fGCPhys64 = true;
|
---|
424 | else if ( ptDepth == SVGA3D_MOBFMT_PTDEPTH_0
|
---|
425 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH_1
|
---|
426 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH_2)
|
---|
427 | {
|
---|
428 | fGCPhys64 = false;
|
---|
429 | /* Shift ptDepth to the SVGA3D_MOBFMT_PTDEPTH64_x range. */
|
---|
430 | ptDepth = (SVGAMobFormat)(ptDepth + SVGA3D_MOBFMT_PTDEPTH64_0 - SVGA3D_MOBFMT_PTDEPTH_0);
|
---|
431 | }
|
---|
432 | else if (ptDepth == SVGA3D_MOBFMT_RANGE)
|
---|
433 | fGCPhys64 = false; /* Does not matter, there is no page table. */
|
---|
434 | else
|
---|
435 | ASSERT_GUEST_FAILED_RETURN(VERR_INVALID_PARAMETER);
|
---|
436 |
|
---|
437 | uint32_t const cPPNsPerPage = X86_PAGE_SIZE / (fGCPhys64 ? sizeof(PPN64) : sizeof(PPN));
|
---|
438 |
|
---|
439 | pGbo->cbTotal = sizeInBytes;
|
---|
440 | pGbo->cTotalPages = (sizeInBytes + X86_PAGE_SIZE - 1) >> X86_PAGE_SHIFT;
|
---|
441 |
|
---|
442 | /* Allocate the maximum amount possible (everything non-continuous) */
|
---|
443 | PVMSVGAGBODESCRIPTOR paDescriptors = (PVMSVGAGBODESCRIPTOR)RTMemAlloc(pGbo->cTotalPages * sizeof(VMSVGAGBODESCRIPTOR));
|
---|
444 | AssertReturn(paDescriptors, VERR_NO_MEMORY);
|
---|
445 |
|
---|
446 | int rc = VINF_SUCCESS;
|
---|
447 | if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_0)
|
---|
448 | {
|
---|
449 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages == 1,
|
---|
450 | RTMemFree(paDescriptors),
|
---|
451 | VERR_INVALID_PARAMETER);
|
---|
452 |
|
---|
453 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
454 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
455 | paDescriptors[0].GCPhys = GCPhys;
|
---|
456 | paDescriptors[0].cPages = 1;
|
---|
457 | }
|
---|
458 | else if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_1)
|
---|
459 | {
|
---|
460 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages <= cPPNsPerPage,
|
---|
461 | RTMemFree(paDescriptors),
|
---|
462 | VERR_INVALID_PARAMETER);
|
---|
463 |
|
---|
464 | /* Read the root page. */
|
---|
465 | uint8_t au8RootPage[X86_PAGE_SIZE];
|
---|
466 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
467 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhys, &au8RootPage, sizeof(au8RootPage));
|
---|
468 | if (RT_SUCCESS(rc))
|
---|
469 | {
|
---|
470 | PPN64 *paPPN64 = (PPN64 *)&au8RootPage[0];
|
---|
471 | PPN *paPPN32 = (PPN *)&au8RootPage[0];
|
---|
472 | for (uint32_t iPPN = 0; iPPN < pGbo->cTotalPages; ++iPPN)
|
---|
473 | {
|
---|
474 | GCPhys = (RTGCPHYS)(fGCPhys64 ? paPPN64[iPPN] : paPPN32[iPPN]) << X86_PAGE_SHIFT;
|
---|
475 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
476 | paDescriptors[iPPN].GCPhys = GCPhys;
|
---|
477 | paDescriptors[iPPN].cPages = 1;
|
---|
478 | }
|
---|
479 | }
|
---|
480 | }
|
---|
481 | else if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_2)
|
---|
482 | {
|
---|
483 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages <= cPPNsPerPage * cPPNsPerPage,
|
---|
484 | RTMemFree(paDescriptors),
|
---|
485 | VERR_INVALID_PARAMETER);
|
---|
486 |
|
---|
487 | /* Read the Level2 root page. */
|
---|
488 | uint8_t au8RootPageLevel2[X86_PAGE_SIZE];
|
---|
489 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
490 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhys, &au8RootPageLevel2, sizeof(au8RootPageLevel2));
|
---|
491 | if (RT_SUCCESS(rc))
|
---|
492 | {
|
---|
493 | uint32_t cPagesLeft = pGbo->cTotalPages;
|
---|
494 |
|
---|
495 | PPN64 *paPPN64Level2 = (PPN64 *)&au8RootPageLevel2[0];
|
---|
496 | PPN *paPPN32Level2 = (PPN *)&au8RootPageLevel2[0];
|
---|
497 |
|
---|
498 | uint32_t const cPPNsLevel2 = (pGbo->cTotalPages + cPPNsPerPage - 1) / cPPNsPerPage;
|
---|
499 | for (uint32_t iPPNLevel2 = 0; iPPNLevel2 < cPPNsLevel2; ++iPPNLevel2)
|
---|
500 | {
|
---|
501 | /* Read the Level1 root page. */
|
---|
502 | uint8_t au8RootPage[X86_PAGE_SIZE];
|
---|
503 | RTGCPHYS GCPhysLevel1 = (RTGCPHYS)(fGCPhys64 ? paPPN64Level2[iPPNLevel2] : paPPN32Level2[iPPNLevel2]) << X86_PAGE_SHIFT;
|
---|
504 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
505 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhysLevel1, &au8RootPage, sizeof(au8RootPage));
|
---|
506 | if (RT_SUCCESS(rc))
|
---|
507 | {
|
---|
508 | PPN64 *paPPN64 = (PPN64 *)&au8RootPage[0];
|
---|
509 | PPN *paPPN32 = (PPN *)&au8RootPage[0];
|
---|
510 |
|
---|
511 | uint32_t const cPPNs = RT_MIN(cPagesLeft, cPPNsPerPage);
|
---|
512 | for (uint32_t iPPN = 0; iPPN < cPPNs; ++iPPN)
|
---|
513 | {
|
---|
514 | GCPhys = (RTGCPHYS)(fGCPhys64 ? paPPN64[iPPN] : paPPN32[iPPN]) << X86_PAGE_SHIFT;
|
---|
515 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
516 | paDescriptors[iPPN + iPPNLevel2 * cPPNsPerPage].GCPhys = GCPhys;
|
---|
517 | paDescriptors[iPPN + iPPNLevel2 * cPPNsPerPage].cPages = 1;
|
---|
518 | }
|
---|
519 | cPagesLeft -= cPPNs;
|
---|
520 | }
|
---|
521 | }
|
---|
522 | }
|
---|
523 | }
|
---|
524 | else if (ptDepth == SVGA3D_MOBFMT_RANGE)
|
---|
525 | {
|
---|
526 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
527 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
528 | paDescriptors[0].GCPhys = GCPhys;
|
---|
529 | paDescriptors[0].cPages = pGbo->cTotalPages;
|
---|
530 | }
|
---|
531 | else
|
---|
532 | {
|
---|
533 | AssertFailed();
|
---|
534 | return VERR_INTERNAL_ERROR; /* ptDepth should be already verified. */
|
---|
535 | }
|
---|
536 |
|
---|
537 | /* Compress the descriptors. */
|
---|
538 | if (ptDepth != SVGA3D_MOBFMT_RANGE)
|
---|
539 | {
|
---|
540 | uint32_t iDescriptor = 0;
|
---|
541 | for (uint32_t i = 1; i < pGbo->cTotalPages; ++i)
|
---|
542 | {
|
---|
543 | /* Continuous physical memory? */
|
---|
544 | if (paDescriptors[i].GCPhys == paDescriptors[iDescriptor].GCPhys + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE)
|
---|
545 | {
|
---|
546 | Assert(paDescriptors[iDescriptor].cPages);
|
---|
547 | paDescriptors[iDescriptor].cPages++;
|
---|
548 | Log5Func(("Page %x GCPhys=%RGp successor\n", i, paDescriptors[i].GCPhys));
|
---|
549 | }
|
---|
550 | else
|
---|
551 | {
|
---|
552 | iDescriptor++;
|
---|
553 | paDescriptors[iDescriptor].GCPhys = paDescriptors[i].GCPhys;
|
---|
554 | paDescriptors[iDescriptor].cPages = 1;
|
---|
555 | Log5Func(("Page %x GCPhys=%RGp\n", i, paDescriptors[iDescriptor].GCPhys));
|
---|
556 | }
|
---|
557 | }
|
---|
558 |
|
---|
559 | pGbo->cDescriptors = iDescriptor + 1;
|
---|
560 | Log5Func(("Nr of descriptors %d\n", pGbo->cDescriptors));
|
---|
561 | }
|
---|
562 | else
|
---|
563 | pGbo->cDescriptors = 1;
|
---|
564 |
|
---|
565 | if (RT_LIKELY(pGbo->cDescriptors < pGbo->cTotalPages))
|
---|
566 | {
|
---|
567 | pGbo->paDescriptors = (PVMSVGAGBODESCRIPTOR)RTMemRealloc(paDescriptors, pGbo->cDescriptors * sizeof(VMSVGAGBODESCRIPTOR));
|
---|
568 | AssertReturn(pGbo->paDescriptors, VERR_NO_MEMORY);
|
---|
569 | }
|
---|
570 | else
|
---|
571 | pGbo->paDescriptors = paDescriptors;
|
---|
572 |
|
---|
573 | pGbo->fGboFlags = 0;
|
---|
574 | pGbo->pvHost = NULL;
|
---|
575 |
|
---|
576 | return VINF_SUCCESS;
|
---|
577 | }
|
---|
578 |
|
---|
579 |
|
---|
580 | static void vmsvgaR3GboDestroy(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
581 | {
|
---|
582 | RT_NOREF(pSvgaR3State);
|
---|
583 |
|
---|
584 | if (RT_LIKELY(VMSVGA_IS_GBO_CREATED(pGbo)))
|
---|
585 | {
|
---|
586 | RTMemFree(pGbo->pvHost);
|
---|
587 | RTMemFree(pGbo->paDescriptors);
|
---|
588 | RT_ZERO(*pGbo);
|
---|
589 | }
|
---|
590 | }
|
---|
591 |
|
---|
592 | /** @todo static void vmsvgaR3GboWriteProtect(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo, bool fWriteProtect) */
|
---|
593 |
|
---|
594 | typedef enum VMSVGAGboTransferDirection
|
---|
595 | {
|
---|
596 | VMSVGAGboTransferDirection_Read,
|
---|
597 | VMSVGAGboTransferDirection_Write,
|
---|
598 | } VMSVGAGboTransferDirection;
|
---|
599 |
|
---|
600 | static int vmsvgaR3GboTransfer(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
601 | uint32_t off, void *pvData, uint32_t cbData,
|
---|
602 | VMSVGAGboTransferDirection enmDirection)
|
---|
603 | {
|
---|
604 | //DEBUG_BREAKPOINT_TEST();
|
---|
605 | int rc = VINF_SUCCESS;
|
---|
606 | uint8_t *pu8CurrentHost = (uint8_t *)pvData;
|
---|
607 |
|
---|
608 | /* Find the right descriptor */
|
---|
609 | PCVMSVGAGBODESCRIPTOR const paDescriptors = pGbo->paDescriptors;
|
---|
610 | uint32_t iDescriptor = 0; /* Index in the descriptor array. */
|
---|
611 | uint32_t offDescriptor = 0; /* GMR offset of the current descriptor. */
|
---|
612 | while (offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE <= off)
|
---|
613 | {
|
---|
614 | offDescriptor += paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE;
|
---|
615 | AssertReturn(offDescriptor < pGbo->cbTotal, VERR_INTERNAL_ERROR); /* overflow protection */
|
---|
616 | ++iDescriptor;
|
---|
617 | AssertReturn(iDescriptor < pGbo->cDescriptors, VERR_INTERNAL_ERROR);
|
---|
618 | }
|
---|
619 |
|
---|
620 | while (cbData)
|
---|
621 | {
|
---|
622 | uint32_t cbToCopy;
|
---|
623 | if (off + cbData <= offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE)
|
---|
624 | cbToCopy = cbData;
|
---|
625 | else
|
---|
626 | {
|
---|
627 | cbToCopy = (offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE - off);
|
---|
628 | AssertReturn(cbToCopy <= cbData, VERR_INVALID_PARAMETER);
|
---|
629 | }
|
---|
630 |
|
---|
631 | RTGCPHYS const GCPhys = paDescriptors[iDescriptor].GCPhys + off - offDescriptor;
|
---|
632 | Log5Func(("%s phys=%RGp\n", (enmDirection == VMSVGAGboTransferDirection_Read) ? "READ" : "WRITE", GCPhys));
|
---|
633 |
|
---|
634 | /*
|
---|
635 | * We are deliberately using the non-PCI version of PDMDevHlpPCIPhys[Read|Write] as the
|
---|
636 | * guest-side VMSVGA driver seems to allocate non-DMA (regular physical) addresses,
|
---|
637 | * see @bugref{9654#c75}.
|
---|
638 | */
|
---|
639 | if (enmDirection == VMSVGAGboTransferDirection_Read)
|
---|
640 | rc = PDMDevHlpPhysRead(pSvgaR3State->pDevIns, GCPhys, pu8CurrentHost, cbToCopy);
|
---|
641 | else
|
---|
642 | rc = PDMDevHlpPhysWrite(pSvgaR3State->pDevIns, GCPhys, pu8CurrentHost, cbToCopy);
|
---|
643 | AssertRCBreak(rc);
|
---|
644 |
|
---|
645 | cbData -= cbToCopy;
|
---|
646 | off += cbToCopy;
|
---|
647 | pu8CurrentHost += cbToCopy;
|
---|
648 |
|
---|
649 | /* Go to the next descriptor if there's anything left. */
|
---|
650 | if (cbData)
|
---|
651 | {
|
---|
652 | offDescriptor += paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE;
|
---|
653 | AssertReturn(offDescriptor < pGbo->cbTotal, VERR_INTERNAL_ERROR);
|
---|
654 | ++iDescriptor;
|
---|
655 | AssertReturn(iDescriptor < pGbo->cDescriptors, VERR_INTERNAL_ERROR);
|
---|
656 | }
|
---|
657 | }
|
---|
658 | return rc;
|
---|
659 | }
|
---|
660 |
|
---|
661 |
|
---|
662 | static int vmsvgaR3GboWrite(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
663 | uint32_t off, void const *pvData, uint32_t cbData)
|
---|
664 | {
|
---|
665 | return vmsvgaR3GboTransfer(pSvgaR3State, pGbo,
|
---|
666 | off, (void *)pvData, cbData,
|
---|
667 | VMSVGAGboTransferDirection_Write);
|
---|
668 | }
|
---|
669 |
|
---|
670 |
|
---|
671 | static int vmsvgaR3GboRead(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
672 | uint32_t off, void *pvData, uint32_t cbData)
|
---|
673 | {
|
---|
674 | return vmsvgaR3GboTransfer(pSvgaR3State, pGbo,
|
---|
675 | off, pvData, cbData,
|
---|
676 | VMSVGAGboTransferDirection_Read);
|
---|
677 | }
|
---|
678 |
|
---|
679 |
|
---|
680 | static int vmsvgaR3GboBackingStoreCreate(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo, uint32_t cbValid)
|
---|
681 | {
|
---|
682 | int rc;
|
---|
683 |
|
---|
684 | /* Just reread the data if pvHost has been allocated already. */
|
---|
685 | if (!(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED))
|
---|
686 | pGbo->pvHost = RTMemAllocZ(pGbo->cbTotal);
|
---|
687 |
|
---|
688 | if (pGbo->pvHost)
|
---|
689 | {
|
---|
690 | cbValid = RT_MIN(cbValid, pGbo->cbTotal);
|
---|
691 | rc = vmsvgaR3GboRead(pSvgaR3State, pGbo, 0, pGbo->pvHost, cbValid);
|
---|
692 | }
|
---|
693 | else
|
---|
694 | rc = VERR_NO_MEMORY;
|
---|
695 |
|
---|
696 | if (RT_SUCCESS(rc))
|
---|
697 | pGbo->fGboFlags |= VMSVGAGBO_F_HOST_BACKED;
|
---|
698 | else
|
---|
699 | {
|
---|
700 | RTMemFree(pGbo->pvHost);
|
---|
701 | pGbo->pvHost = NULL;
|
---|
702 | }
|
---|
703 | return rc;
|
---|
704 | }
|
---|
705 |
|
---|
706 |
|
---|
707 | static void vmsvgaR3GboBackingStoreDelete(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
708 | {
|
---|
709 | RT_NOREF(pSvgaR3State);
|
---|
710 | AssertReturnVoid(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED);
|
---|
711 | RTMemFree(pGbo->pvHost);
|
---|
712 | pGbo->pvHost = NULL;
|
---|
713 | pGbo->fGboFlags &= ~VMSVGAGBO_F_HOST_BACKED;
|
---|
714 | }
|
---|
715 |
|
---|
716 |
|
---|
717 | static int vmsvgaR3GboBackingStoreWriteToGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
718 | {
|
---|
719 | AssertReturn(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED, VERR_INVALID_STATE);
|
---|
720 | return vmsvgaR3GboWrite(pSvgaR3State, pGbo, 0, pGbo->pvHost, pGbo->cbTotal);
|
---|
721 | }
|
---|
722 |
|
---|
723 |
|
---|
724 | static int vmsvgaR3GboBackingStoreReadFromGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
725 | {
|
---|
726 | AssertReturn(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED, VERR_INVALID_STATE);
|
---|
727 | return vmsvgaR3GboRead(pSvgaR3State, pGbo, 0, pGbo->pvHost, pGbo->cbTotal);
|
---|
728 | }
|
---|
729 |
|
---|
730 | static int vmsvgaR3GboCopy(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboDst, uint32_t offDst,
|
---|
731 | PVMSVGAGBO pGboSrc, uint32_t offSrc, uint32_t cbCopy)
|
---|
732 | {
|
---|
733 | uint32_t const cbTmpBuf = GUEST_PAGE_SIZE;
|
---|
734 | void *pvTmpBuf = RTMemTmpAlloc(cbTmpBuf);
|
---|
735 | AssertPtrReturn(pvTmpBuf, VERR_NO_MEMORY);
|
---|
736 |
|
---|
737 | int rc = VINF_SUCCESS;
|
---|
738 | while (cbCopy > 0)
|
---|
739 | {
|
---|
740 | uint32_t const cbToCopy = RT_MIN(cbTmpBuf, cbCopy);
|
---|
741 |
|
---|
742 | rc = vmsvgaR3GboRead(pSvgaR3State, pGboSrc, offSrc, pvTmpBuf, cbToCopy);
|
---|
743 | AssertRCBreak(rc);
|
---|
744 |
|
---|
745 | rc = vmsvgaR3GboWrite(pSvgaR3State, pGboDst, offDst, pvTmpBuf, cbToCopy);
|
---|
746 | AssertRCBreak(rc);
|
---|
747 |
|
---|
748 | offSrc += cbToCopy;
|
---|
749 | offDst += cbToCopy;
|
---|
750 | cbCopy -= cbToCopy;
|
---|
751 | }
|
---|
752 |
|
---|
753 | RTMemTmpFree(pvTmpBuf);
|
---|
754 | return rc;
|
---|
755 | }
|
---|
756 |
|
---|
757 |
|
---|
758 | /*
|
---|
759 | *
|
---|
760 | * Object Tables.
|
---|
761 | *
|
---|
762 | */
|
---|
763 |
|
---|
764 | static int vmsvgaR3OTableSetOrGrow(PVMSVGAR3STATE pSvgaR3State, SVGAOTableType type, PPN64 baseAddress,
|
---|
765 | uint32_t sizeInBytes, uint32 validSizeInBytes, SVGAMobFormat ptDepth, bool fGrow)
|
---|
766 | {
|
---|
767 | ASSERT_GUEST_RETURN(type < RT_ELEMENTS(pSvgaR3State->aGboOTables), VERR_INVALID_PARAMETER);
|
---|
768 | ASSERT_GUEST_RETURN(sizeInBytes >= validSizeInBytes, VERR_INVALID_PARAMETER);
|
---|
769 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
770 |
|
---|
771 | ASSERT_GUEST_RETURN(pSvgaR3State->aGboOTables[type].cbTotal >= validSizeInBytes, VERR_INVALID_PARAMETER);
|
---|
772 |
|
---|
773 | if (sizeInBytes > 0)
|
---|
774 | {
|
---|
775 | /* Create a new guest backed object for the object table. */
|
---|
776 | VMSVGAGBO gbo;
|
---|
777 | int rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, &gbo);
|
---|
778 | AssertRCReturn(rc, rc);
|
---|
779 |
|
---|
780 | /* If the guest sets a new OTable (fGrow == false), then it has already copied the valid data to the new GBO. */
|
---|
781 | if (fGrow && validSizeInBytes)
|
---|
782 | {
|
---|
783 | /* Copy data from old gbo to the new one. */
|
---|
784 | rc = vmsvgaR3GboCopy(pSvgaR3State, &gbo, 0, &pSvgaR3State->aGboOTables[type], 0, validSizeInBytes);
|
---|
785 | AssertRCReturnStmt(rc, vmsvgaR3GboDestroy(pSvgaR3State, &gbo), rc);
|
---|
786 | }
|
---|
787 |
|
---|
788 | vmsvgaR3GboDestroy(pSvgaR3State, &pSvgaR3State->aGboOTables[type]);
|
---|
789 | pSvgaR3State->aGboOTables[type] = gbo;
|
---|
790 |
|
---|
791 | }
|
---|
792 | else
|
---|
793 | vmsvgaR3GboDestroy(pSvgaR3State, &pSvgaR3State->aGboOTables[type]);
|
---|
794 |
|
---|
795 | return VINF_SUCCESS;
|
---|
796 | }
|
---|
797 |
|
---|
798 |
|
---|
799 | static int vmsvgaR3OTableVerifyIndex(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
800 | uint32_t idx, uint32_t cbEntry)
|
---|
801 | {
|
---|
802 | RT_NOREF(pSvgaR3State);
|
---|
803 |
|
---|
804 | /* The table must exist and the index must be within the table. */
|
---|
805 | ASSERT_GUEST_RETURN(VMSVGA_IS_GBO_CREATED(pGboOTable), VERR_INVALID_PARAMETER);
|
---|
806 | ASSERT_GUEST_RETURN(idx < pGboOTable->cbTotal / cbEntry, VERR_INVALID_PARAMETER);
|
---|
807 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
808 | return VINF_SUCCESS;
|
---|
809 | }
|
---|
810 |
|
---|
811 |
|
---|
812 | static int vmsvgaR3OTableRead(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
813 | uint32_t idx, uint32_t cbEntry,
|
---|
814 | void *pvData, uint32_t cbData)
|
---|
815 | {
|
---|
816 | AssertReturn(cbData <= cbEntry, VERR_INVALID_PARAMETER);
|
---|
817 |
|
---|
818 | int rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, pGboOTable, idx, cbEntry);
|
---|
819 | if (RT_SUCCESS(rc))
|
---|
820 | {
|
---|
821 | uint32_t const off = idx * cbEntry;
|
---|
822 | rc = vmsvgaR3GboRead(pSvgaR3State, pGboOTable, off, pvData, cbData);
|
---|
823 | }
|
---|
824 | return rc;
|
---|
825 | }
|
---|
826 |
|
---|
827 | static int vmsvgaR3OTableWrite(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
828 | uint32_t idx, uint32_t cbEntry,
|
---|
829 | void const *pvData, uint32_t cbData)
|
---|
830 | {
|
---|
831 | AssertReturn(cbData <= cbEntry, VERR_INVALID_PARAMETER);
|
---|
832 |
|
---|
833 | int rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, pGboOTable, idx, cbEntry);
|
---|
834 | if (RT_SUCCESS(rc))
|
---|
835 | {
|
---|
836 | uint32_t const off = idx * cbEntry;
|
---|
837 | rc = vmsvgaR3GboWrite(pSvgaR3State, pGboOTable, off, pvData, cbData);
|
---|
838 | }
|
---|
839 | return rc;
|
---|
840 | }
|
---|
841 |
|
---|
842 |
|
---|
843 | int vmsvgaR3OTableReadSurface(PVMSVGAR3STATE pSvgaR3State, uint32_t sid, SVGAOTableSurfaceEntry *pEntrySurface)
|
---|
844 | {
|
---|
845 | return vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
846 | sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, pEntrySurface, sizeof(SVGAOTableSurfaceEntry));
|
---|
847 | }
|
---|
848 |
|
---|
849 |
|
---|
850 | /*
|
---|
851 | *
|
---|
852 | * The guest's Memory OBjects (MOB).
|
---|
853 | *
|
---|
854 | */
|
---|
855 |
|
---|
856 | static int vmsvgaR3MobCreate(PVMSVGAR3STATE pSvgaR3State,
|
---|
857 | SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, SVGAMobId mobid,
|
---|
858 | PVMSVGAMOB pMob)
|
---|
859 | {
|
---|
860 | RT_ZERO(*pMob);
|
---|
861 |
|
---|
862 | /* Update the entry in the pSvgaR3State->pGboOTableMob. */
|
---|
863 | SVGAOTableMobEntry entry;
|
---|
864 | entry.ptDepth = ptDepth;
|
---|
865 | entry.sizeInBytes = sizeInBytes;
|
---|
866 | entry.base = baseAddress;
|
---|
867 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
868 | mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
869 | if (RT_SUCCESS(rc))
|
---|
870 | {
|
---|
871 | /* Create the corresponding GBO. */
|
---|
872 | rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, &pMob->Gbo);
|
---|
873 | if (RT_SUCCESS(rc))
|
---|
874 | {
|
---|
875 | /* If a mob with this id already exists, then delete it. */
|
---|
876 | PVMSVGAMOB pOldMob = (PVMSVGAMOB)RTAvlU32Remove(&pSvgaR3State->MOBTree, mobid);
|
---|
877 | if (pOldMob)
|
---|
878 | {
|
---|
879 | /* This should not happen. */
|
---|
880 | ASSERT_GUEST_FAILED();
|
---|
881 | RTListNodeRemove(&pOldMob->nodeLRU);
|
---|
882 | vmsvgaR3GboDestroy(pSvgaR3State, &pOldMob->Gbo);
|
---|
883 | RTMemFree(pOldMob);
|
---|
884 | }
|
---|
885 |
|
---|
886 | /* Add to the tree of known MOBs and the LRU list. */
|
---|
887 | pMob->Core.Key = mobid;
|
---|
888 | if (RTAvlU32Insert(&pSvgaR3State->MOBTree, &pMob->Core))
|
---|
889 | {
|
---|
890 | RTListPrepend(&pSvgaR3State->MOBLRUList, &pMob->nodeLRU);
|
---|
891 | return VINF_SUCCESS;
|
---|
892 | }
|
---|
893 |
|
---|
894 | AssertFailedStmt(rc = VERR_INVALID_STATE);
|
---|
895 | vmsvgaR3GboDestroy(pSvgaR3State, &pMob->Gbo);
|
---|
896 | }
|
---|
897 | }
|
---|
898 |
|
---|
899 | return rc;
|
---|
900 | }
|
---|
901 |
|
---|
902 |
|
---|
903 | static void vmsvgaR3MobFree(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
904 | {
|
---|
905 | vmsvgaR3GboDestroy(pSvgaR3State, &pMob->Gbo);
|
---|
906 | RTMemFree(pMob);
|
---|
907 | }
|
---|
908 |
|
---|
909 |
|
---|
910 | static int vmsvgaR3MobDestroy(PVMSVGAR3STATE pSvgaR3State, SVGAMobId mobid)
|
---|
911 | {
|
---|
912 | /* Update the entry in the pSvgaR3State->pGboOTableMob. */
|
---|
913 | SVGAOTableMobEntry entry;
|
---|
914 | RT_ZERO(entry);
|
---|
915 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
916 | mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
917 |
|
---|
918 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTAvlU32Remove(&pSvgaR3State->MOBTree, mobid);
|
---|
919 | if (pMob)
|
---|
920 | {
|
---|
921 | RTListNodeRemove(&pMob->nodeLRU);
|
---|
922 | vmsvgaR3MobFree(pSvgaR3State, pMob);
|
---|
923 | return VINF_SUCCESS;
|
---|
924 | }
|
---|
925 |
|
---|
926 | return VERR_INVALID_PARAMETER;
|
---|
927 | }
|
---|
928 |
|
---|
929 |
|
---|
930 | PVMSVGAMOB vmsvgaR3MobGet(PVMSVGAR3STATE pSvgaR3State, SVGAMobId RT_UNTRUSTED_GUEST mobid)
|
---|
931 | {
|
---|
932 | if (mobid == SVGA_ID_INVALID)
|
---|
933 | return NULL;
|
---|
934 |
|
---|
935 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTAvlU32Get(&pSvgaR3State->MOBTree, mobid);
|
---|
936 | if (pMob)
|
---|
937 | {
|
---|
938 | /* Move to the head of the LRU list. */
|
---|
939 | RTListNodeRemove(&pMob->nodeLRU);
|
---|
940 | RTListPrepend(&pSvgaR3State->MOBLRUList, &pMob->nodeLRU);
|
---|
941 | }
|
---|
942 | else
|
---|
943 | ASSERT_GUEST_FAILED();
|
---|
944 |
|
---|
945 | return pMob;
|
---|
946 | }
|
---|
947 |
|
---|
948 |
|
---|
949 | int vmsvgaR3MobWrite(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob,
|
---|
950 | uint32_t off, void const *pvData, uint32_t cbData)
|
---|
951 | {
|
---|
952 | return vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, off, pvData, cbData);
|
---|
953 | }
|
---|
954 |
|
---|
955 |
|
---|
956 | int vmsvgaR3MobRead(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob,
|
---|
957 | uint32_t off, void *pvData, uint32_t cbData)
|
---|
958 | {
|
---|
959 | return vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, off, pvData, cbData);
|
---|
960 | }
|
---|
961 |
|
---|
962 |
|
---|
963 | /** Create a host ring-3 pointer to the MOB data.
|
---|
964 | * Current approach is to allocate a host memory buffer and copy the guest MOB data if necessary.
|
---|
965 | * @param pSvgaR3State R3 device state.
|
---|
966 | * @param pMob The MOB.
|
---|
967 | * @param cbValid How many bytes of the guest backing memory contain valid data.
|
---|
968 | * @return VBox status.
|
---|
969 | */
|
---|
970 | /** @todo uint32_t cbValid -> uint32_t offStart, uint32_t cbData */
|
---|
971 | int vmsvgaR3MobBackingStoreCreate(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob, uint32_t cbValid)
|
---|
972 | {
|
---|
973 | AssertReturn(pMob, VERR_INVALID_PARAMETER);
|
---|
974 | return vmsvgaR3GboBackingStoreCreate(pSvgaR3State, &pMob->Gbo, cbValid);
|
---|
975 | }
|
---|
976 |
|
---|
977 |
|
---|
978 | void vmsvgaR3MobBackingStoreDelete(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
979 | {
|
---|
980 | if (pMob)
|
---|
981 | vmsvgaR3GboBackingStoreDelete(pSvgaR3State, &pMob->Gbo);
|
---|
982 | }
|
---|
983 |
|
---|
984 |
|
---|
985 | int vmsvgaR3MobBackingStoreWriteToGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
986 | {
|
---|
987 | if (pMob)
|
---|
988 | return vmsvgaR3GboBackingStoreWriteToGuest(pSvgaR3State, &pMob->Gbo);
|
---|
989 | return VERR_INVALID_PARAMETER;
|
---|
990 | }
|
---|
991 |
|
---|
992 |
|
---|
993 | int vmsvgaR3MobBackingStoreReadFromGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
994 | {
|
---|
995 | if (pMob)
|
---|
996 | return vmsvgaR3GboBackingStoreReadFromGuest(pSvgaR3State, &pMob->Gbo);
|
---|
997 | return VERR_INVALID_PARAMETER;
|
---|
998 | }
|
---|
999 |
|
---|
1000 |
|
---|
1001 | void *vmsvgaR3MobBackingStorePtr(PVMSVGAMOB pMob, uint32_t off)
|
---|
1002 | {
|
---|
1003 | if (pMob && (pMob->Gbo.fGboFlags & VMSVGAGBO_F_HOST_BACKED))
|
---|
1004 | {
|
---|
1005 | if (off <= pMob->Gbo.cbTotal)
|
---|
1006 | return (uint8_t *)pMob->Gbo.pvHost + off;
|
---|
1007 | }
|
---|
1008 | return NULL;
|
---|
1009 | }
|
---|
1010 |
|
---|
1011 |
|
---|
1012 | static DECLCALLBACK(int) vmsvgaR3MobFreeCb(PAVLU32NODECORE pNode, void *pvUser)
|
---|
1013 | {
|
---|
1014 | PVMSVGAMOB pMob = (PVMSVGAMOB)pNode;
|
---|
1015 | PVMSVGAR3STATE pSvgaR3State = (PVMSVGAR3STATE)pvUser;
|
---|
1016 | vmsvgaR3MobFree(pSvgaR3State, pMob);
|
---|
1017 | return 0;
|
---|
1018 | }
|
---|
1019 |
|
---|
1020 |
|
---|
1021 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
1022 |
|
---|
1023 |
|
---|
1024 |
|
---|
1025 | void vmsvgaR3ResetSvgaState(PVGASTATE pThis, PVGASTATECC pThisCC)
|
---|
1026 | {
|
---|
1027 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
1028 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1029 | RT_NOREF(pThis);
|
---|
1030 |
|
---|
1031 | RTAvlU32Destroy(&pSvgaR3State->MOBTree, vmsvgaR3MobFreeCb, pSvgaR3State);
|
---|
1032 | RTListInit(&pSvgaR3State->MOBLRUList);
|
---|
1033 |
|
---|
1034 | for (unsigned i = 0; i < RT_ELEMENTS(pSvgaR3State->aGboOTables); ++i)
|
---|
1035 | vmsvgaR3GboDestroy(pSvgaR3State, &pSvgaR3State->aGboOTables[i]);
|
---|
1036 | #else
|
---|
1037 | RT_NOREF(pThis, pThisCC);
|
---|
1038 | #endif
|
---|
1039 | }
|
---|
1040 |
|
---|
1041 |
|
---|
1042 | void vmsvgaR3TerminateSvgaState(PVGASTATE pThis, PVGASTATECC pThisCC)
|
---|
1043 | {
|
---|
1044 | vmsvgaR3ResetSvgaState(pThis, pThisCC);
|
---|
1045 | }
|
---|
1046 |
|
---|
1047 |
|
---|
1048 | /*
|
---|
1049 | * Screen objects.
|
---|
1050 | */
|
---|
1051 | VMSVGASCREENOBJECT *vmsvgaR3GetScreenObject(PVGASTATECC pThisCC, uint32_t idScreen)
|
---|
1052 | {
|
---|
1053 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
1054 | if ( idScreen < (uint32_t)RT_ELEMENTS(pSVGAState->aScreens)
|
---|
1055 | && pSVGAState
|
---|
1056 | && pSVGAState->aScreens[idScreen].fDefined)
|
---|
1057 | {
|
---|
1058 | Assert(pSVGAState->aScreens[idScreen].idScreen == idScreen);
|
---|
1059 | return &pSVGAState->aScreens[idScreen];
|
---|
1060 | }
|
---|
1061 | return NULL;
|
---|
1062 | }
|
---|
1063 |
|
---|
1064 |
|
---|
1065 | int vmsvgaR3DestroyScreen(PVGASTATE pThis, PVGASTATECC pThisCC, VMSVGASCREENOBJECT *pScreen)
|
---|
1066 | {
|
---|
1067 | pScreen->fModified = true;
|
---|
1068 | pScreen->fDefined = false;
|
---|
1069 |
|
---|
1070 | /* Notify frontend that the screen is about to be deleted. */
|
---|
1071 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
1072 |
|
---|
1073 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
1074 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
1075 | vmsvga3dDestroyScreen(pThisCC, pScreen);
|
---|
1076 | #endif
|
---|
1077 |
|
---|
1078 | RTMemFree(pScreen->pvScreenBitmap);
|
---|
1079 | pScreen->pvScreenBitmap = NULL;
|
---|
1080 |
|
---|
1081 | return VINF_SUCCESS;
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 |
|
---|
1085 | void vmsvgaR3ResetScreens(PVGASTATE pThis, PVGASTATECC pThisCC)
|
---|
1086 | {
|
---|
1087 | for (uint32_t idScreen = 0; idScreen < (uint32_t)RT_ELEMENTS(pThisCC->svga.pSvgaR3State->aScreens); ++idScreen)
|
---|
1088 | {
|
---|
1089 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, idScreen);
|
---|
1090 | if (pScreen)
|
---|
1091 | vmsvgaR3DestroyScreen(pThis, pThisCC, pScreen);
|
---|
1092 | }
|
---|
1093 | }
|
---|
1094 |
|
---|
1095 |
|
---|
1096 | /**
|
---|
1097 | * Copy a rectangle of pixels within guest VRAM.
|
---|
1098 | */
|
---|
1099 | static void vmsvgaR3RectCopy(PVGASTATECC pThisCC, VMSVGASCREENOBJECT const *pScreen, uint32_t srcX, uint32_t srcY,
|
---|
1100 | uint32_t dstX, uint32_t dstY, uint32_t width, uint32_t height, unsigned cbFrameBuffer)
|
---|
1101 | {
|
---|
1102 | if (!width || !height)
|
---|
1103 | return; /* Nothing to do, don't even bother. */
|
---|
1104 |
|
---|
1105 | /*
|
---|
1106 | * The guest VRAM (aka GFB) is considered to be a bitmap in the format
|
---|
1107 | * corresponding to the current display mode.
|
---|
1108 | */
|
---|
1109 | uint32_t const cbPixel = RT_ALIGN(pScreen->cBpp, 8) / 8;
|
---|
1110 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch : width * cbPixel;
|
---|
1111 | uint8_t const *pSrc;
|
---|
1112 | uint8_t *pDst;
|
---|
1113 | unsigned const cbRectWidth = width * cbPixel;
|
---|
1114 | unsigned uMaxOffset;
|
---|
1115 |
|
---|
1116 | uMaxOffset = (RT_MAX(srcY, dstY) + height) * cbScanline + (RT_MAX(srcX, dstX) + width) * cbPixel;
|
---|
1117 | if (uMaxOffset >= cbFrameBuffer)
|
---|
1118 | {
|
---|
1119 | Log(("Max offset (%u) too big for framebuffer (%u bytes), ignoring!\n", uMaxOffset, cbFrameBuffer));
|
---|
1120 | return; /* Just don't listen to a bad guest. */
|
---|
1121 | }
|
---|
1122 |
|
---|
1123 | pSrc = pDst = pThisCC->pbVRam;
|
---|
1124 | pSrc += srcY * cbScanline + srcX * cbPixel;
|
---|
1125 | pDst += dstY * cbScanline + dstX * cbPixel;
|
---|
1126 |
|
---|
1127 | if (srcY >= dstY)
|
---|
1128 | {
|
---|
1129 | /* Source below destination, copy top to bottom. */
|
---|
1130 | for (; height > 0; height--)
|
---|
1131 | {
|
---|
1132 | memmove(pDst, pSrc, cbRectWidth);
|
---|
1133 | pSrc += cbScanline;
|
---|
1134 | pDst += cbScanline;
|
---|
1135 | }
|
---|
1136 | }
|
---|
1137 | else
|
---|
1138 | {
|
---|
1139 | /* Source above destination, copy bottom to top. */
|
---|
1140 | pSrc += cbScanline * (height - 1);
|
---|
1141 | pDst += cbScanline * (height - 1);
|
---|
1142 | for (; height > 0; height--)
|
---|
1143 | {
|
---|
1144 | memmove(pDst, pSrc, cbRectWidth);
|
---|
1145 | pSrc -= cbScanline;
|
---|
1146 | pDst -= cbScanline;
|
---|
1147 | }
|
---|
1148 | }
|
---|
1149 | }
|
---|
1150 |
|
---|
1151 |
|
---|
1152 | /**
|
---|
1153 | * Common worker for changing the pointer shape.
|
---|
1154 | *
|
---|
1155 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
1156 | * @param pSVGAState The VMSVGA ring-3 instance data.
|
---|
1157 | * @param fAlpha Whether there is alpha or not.
|
---|
1158 | * @param xHot Hotspot x coordinate.
|
---|
1159 | * @param yHot Hotspot y coordinate.
|
---|
1160 | * @param cx Width.
|
---|
1161 | * @param cy Height.
|
---|
1162 | * @param pbData Heap copy of the cursor data. Consumed.
|
---|
1163 | * @param cbData The size of the data.
|
---|
1164 | */
|
---|
1165 | static void vmsvgaR3InstallNewCursor(PVGASTATECC pThisCC, PVMSVGAR3STATE pSVGAState, bool fAlpha,
|
---|
1166 | uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, uint8_t *pbData, uint32_t cbData)
|
---|
1167 | {
|
---|
1168 | LogRel2(("vmsvgaR3InstallNewCursor: cx=%d cy=%d xHot=%d yHot=%d fAlpha=%d cbData=%#x\n", cx, cy, xHot, yHot, fAlpha, cbData));
|
---|
1169 | #ifdef LOG_ENABLED
|
---|
1170 | if (LogIs2Enabled())
|
---|
1171 | {
|
---|
1172 | uint32_t cbAndLine = RT_ALIGN(cx, 8) / 8;
|
---|
1173 | if (!fAlpha)
|
---|
1174 | {
|
---|
1175 | Log2(("VMSVGA Cursor AND mask (%d,%d):\n", cx, cy));
|
---|
1176 | for (uint32_t y = 0; y < cy; y++)
|
---|
1177 | {
|
---|
1178 | Log2(("%3u:", y));
|
---|
1179 | uint8_t const *pbLine = &pbData[y * cbAndLine];
|
---|
1180 | for (uint32_t x = 0; x < cx; x += 8)
|
---|
1181 | {
|
---|
1182 | uint8_t b = pbLine[x / 8];
|
---|
1183 | char szByte[12];
|
---|
1184 | szByte[0] = b & 0x80 ? '*' : ' '; /* most significant bit first */
|
---|
1185 | szByte[1] = b & 0x40 ? '*' : ' ';
|
---|
1186 | szByte[2] = b & 0x20 ? '*' : ' ';
|
---|
1187 | szByte[3] = b & 0x10 ? '*' : ' ';
|
---|
1188 | szByte[4] = b & 0x08 ? '*' : ' ';
|
---|
1189 | szByte[5] = b & 0x04 ? '*' : ' ';
|
---|
1190 | szByte[6] = b & 0x02 ? '*' : ' ';
|
---|
1191 | szByte[7] = b & 0x01 ? '*' : ' ';
|
---|
1192 | szByte[8] = '\0';
|
---|
1193 | Log2(("%s", szByte));
|
---|
1194 | }
|
---|
1195 | Log2(("\n"));
|
---|
1196 | }
|
---|
1197 | }
|
---|
1198 |
|
---|
1199 | Log2(("VMSVGA Cursor XOR mask (%d,%d):\n", cx, cy));
|
---|
1200 | uint32_t const *pu32Xor = (uint32_t const *)&pbData[RT_ALIGN_32(cbAndLine * cy, 4)];
|
---|
1201 | for (uint32_t y = 0; y < cy; y++)
|
---|
1202 | {
|
---|
1203 | Log2(("%3u:", y));
|
---|
1204 | uint32_t const *pu32Line = &pu32Xor[y * cx];
|
---|
1205 | for (uint32_t x = 0; x < cx; x++)
|
---|
1206 | Log2((" %08x", pu32Line[x]));
|
---|
1207 | Log2(("\n"));
|
---|
1208 | }
|
---|
1209 | }
|
---|
1210 | #endif
|
---|
1211 |
|
---|
1212 | int rc = pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, true /*fVisible*/, fAlpha, xHot, yHot, cx, cy, pbData);
|
---|
1213 | AssertRC(rc);
|
---|
1214 |
|
---|
1215 | if (pSVGAState->Cursor.fActive)
|
---|
1216 | RTMemFreeZ(pSVGAState->Cursor.pData, pSVGAState->Cursor.cbData);
|
---|
1217 |
|
---|
1218 | pSVGAState->Cursor.fActive = true;
|
---|
1219 | pSVGAState->Cursor.xHotspot = xHot;
|
---|
1220 | pSVGAState->Cursor.yHotspot = yHot;
|
---|
1221 | pSVGAState->Cursor.width = cx;
|
---|
1222 | pSVGAState->Cursor.height = cy;
|
---|
1223 | pSVGAState->Cursor.cbData = cbData;
|
---|
1224 | pSVGAState->Cursor.pData = pbData;
|
---|
1225 | }
|
---|
1226 |
|
---|
1227 |
|
---|
1228 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
1229 |
|
---|
1230 | /*
|
---|
1231 | * SVGA_3D_CMD_* handlers.
|
---|
1232 | */
|
---|
1233 |
|
---|
1234 |
|
---|
1235 | /** SVGA_3D_CMD_SURFACE_DEFINE 1040, SVGA_3D_CMD_SURFACE_DEFINE_V2 1070
|
---|
1236 | *
|
---|
1237 | * @param pThisCC The VGA/VMSVGA state for the current context.
|
---|
1238 | * @param pCmd The VMSVGA command.
|
---|
1239 | * @param cMipLevelSizes Number of elements in the paMipLevelSizes array.
|
---|
1240 | * @param paMipLevelSizes Arrays of surface sizes for each face and miplevel.
|
---|
1241 | */
|
---|
1242 | static void vmsvga3dCmdDefineSurface(PVGASTATECC pThisCC, SVGA3dCmdDefineSurface_v2 const *pCmd,
|
---|
1243 | uint32_t cMipLevelSizes, SVGA3dSize *paMipLevelSizes)
|
---|
1244 | {
|
---|
1245 | ASSERT_GUEST_RETURN_VOID(pCmd->sid < SVGA3D_MAX_SURFACE_IDS);
|
---|
1246 | ASSERT_GUEST_RETURN_VOID(cMipLevelSizes >= 1);
|
---|
1247 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1248 |
|
---|
1249 | /* Number of faces (cFaces) is specified as the number of the first non-zero elements in the 'face' array.
|
---|
1250 | * Since only plain surfaces (cFaces == 1) and cubemaps (cFaces == 6) are supported
|
---|
1251 | * (see also SVGA3dCmdDefineSurface definition in svga3d_reg.h), we ignore anything else.
|
---|
1252 | */
|
---|
1253 | uint32_t cRemainingMipLevels = cMipLevelSizes;
|
---|
1254 | uint32_t cFaces = 0;
|
---|
1255 | for (uint32_t i = 0; i < SVGA3D_MAX_SURFACE_FACES; ++i)
|
---|
1256 | {
|
---|
1257 | if (pCmd->face[i].numMipLevels == 0)
|
---|
1258 | break;
|
---|
1259 |
|
---|
1260 | /* All SVGA3dSurfaceFace structures must have the same value of numMipLevels field */
|
---|
1261 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels == pCmd->face[0].numMipLevels);
|
---|
1262 |
|
---|
1263 | /* numMipLevels value can't be greater than the number of remaining elements in the paMipLevelSizes array. */
|
---|
1264 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels <= cRemainingMipLevels);
|
---|
1265 | cRemainingMipLevels -= pCmd->face[i].numMipLevels;
|
---|
1266 |
|
---|
1267 | ++cFaces;
|
---|
1268 | }
|
---|
1269 | for (uint32_t i = cFaces; i < SVGA3D_MAX_SURFACE_FACES; ++i)
|
---|
1270 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels == 0);
|
---|
1271 |
|
---|
1272 | /* cFaces must be 6 for a cubemap and 1 otherwise. */
|
---|
1273 | ASSERT_GUEST_RETURN_VOID(cFaces == (uint32_t)((pCmd->surfaceFlags & SVGA3D_SURFACE_CUBEMAP) ? 6 : 1));
|
---|
1274 |
|
---|
1275 | /* Sum of face[i].numMipLevels must be equal to cMipLevels. */
|
---|
1276 | ASSERT_GUEST_RETURN_VOID(cRemainingMipLevels == 0);
|
---|
1277 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1278 |
|
---|
1279 | /* Verify paMipLevelSizes */
|
---|
1280 | uint32_t cWidth = paMipLevelSizes[0].width;
|
---|
1281 | uint32_t cHeight = paMipLevelSizes[0].height;
|
---|
1282 | uint32_t cDepth = paMipLevelSizes[0].depth;
|
---|
1283 | for (uint32_t i = 1; i < pCmd->face[0].numMipLevels; ++i)
|
---|
1284 | {
|
---|
1285 | cWidth >>= 1;
|
---|
1286 | if (cWidth == 0) cWidth = 1;
|
---|
1287 | cHeight >>= 1;
|
---|
1288 | if (cHeight == 0) cHeight = 1;
|
---|
1289 | cDepth >>= 1;
|
---|
1290 | if (cDepth == 0) cDepth = 1;
|
---|
1291 | for (uint32_t iFace = 0; iFace < cFaces; ++iFace)
|
---|
1292 | {
|
---|
1293 | uint32_t const iMipLevelSize = iFace * pCmd->face[0].numMipLevels + i;
|
---|
1294 | ASSERT_GUEST_RETURN_VOID( cWidth == paMipLevelSizes[iMipLevelSize].width
|
---|
1295 | && cHeight == paMipLevelSizes[iMipLevelSize].height
|
---|
1296 | && cDepth == paMipLevelSizes[iMipLevelSize].depth);
|
---|
1297 | }
|
---|
1298 | }
|
---|
1299 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1300 |
|
---|
1301 | /* Create the surface. */
|
---|
1302 | SVGA3dMSPattern const multisamplePattern = pCmd->multisampleCount > 1 ? SVGA3D_MS_PATTERN_STANDARD : SVGA3D_MS_PATTERN_NONE;
|
---|
1303 | SVGA3dMSQualityLevel const qualityLevel = pCmd->multisampleCount > 1 ? SVGA3D_MS_QUALITY_FULL : SVGA3D_MS_QUALITY_NONE;
|
---|
1304 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
1305 | pCmd->multisampleCount, multisamplePattern, qualityLevel, pCmd->autogenFilter,
|
---|
1306 | pCmd->face[0].numMipLevels, &paMipLevelSizes[0], /* arraySize = */ 0, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ true);
|
---|
1307 | }
|
---|
1308 |
|
---|
1309 |
|
---|
1310 | /* SVGA_3D_CMD_SET_OTABLE_BASE 1091 */
|
---|
1311 | static void vmsvga3dCmdSetOTableBase(PVGASTATECC pThisCC, SVGA3dCmdSetOTableBase const *pCmd)
|
---|
1312 | {
|
---|
1313 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1314 | vmsvgaR3OTableSetOrGrow(pSvgaR3State, pCmd->type, pCmd->baseAddress,
|
---|
1315 | pCmd->sizeInBytes, pCmd->validSizeInBytes, pCmd->ptDepth, /*fGrow*/ false);
|
---|
1316 | }
|
---|
1317 |
|
---|
1318 |
|
---|
1319 | /* SVGA_3D_CMD_DEFINE_GB_MOB 1093 */
|
---|
1320 | static void vmsvga3dCmdDefineGBMob(PVGASTATECC pThisCC, SVGA3dCmdDefineGBMob const *pCmd)
|
---|
1321 | {
|
---|
1322 | DEBUG_BREAKPOINT_TEST();
|
---|
1323 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1324 |
|
---|
1325 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
1326 |
|
---|
1327 | /* Maybe just update the OTable and create Gbo when the MOB is actually accessed? */
|
---|
1328 | /* Allocate a structure for the MOB. */
|
---|
1329 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTMemAllocZ(sizeof(*pMob));
|
---|
1330 | AssertPtrReturnVoid(pMob);
|
---|
1331 |
|
---|
1332 | int rc = vmsvgaR3MobCreate(pSvgaR3State, pCmd->ptDepth, pCmd->base, pCmd->sizeInBytes, pCmd->mobid, pMob);
|
---|
1333 | if (RT_SUCCESS(rc))
|
---|
1334 | {
|
---|
1335 | return;
|
---|
1336 | }
|
---|
1337 |
|
---|
1338 | AssertFailed();
|
---|
1339 |
|
---|
1340 | RTMemFree(pMob);
|
---|
1341 | }
|
---|
1342 |
|
---|
1343 |
|
---|
1344 | /* SVGA_3D_CMD_DESTROY_GB_MOB 1094 */
|
---|
1345 | static void vmsvga3dCmdDestroyGBMob(PVGASTATECC pThisCC, SVGA3dCmdDestroyGBMob const *pCmd)
|
---|
1346 | {
|
---|
1347 | //DEBUG_BREAKPOINT_TEST();
|
---|
1348 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1349 |
|
---|
1350 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
1351 |
|
---|
1352 | int rc = vmsvgaR3MobDestroy(pSvgaR3State, pCmd->mobid);
|
---|
1353 | if (RT_SUCCESS(rc))
|
---|
1354 | {
|
---|
1355 | return;
|
---|
1356 | }
|
---|
1357 |
|
---|
1358 | AssertFailed();
|
---|
1359 | }
|
---|
1360 |
|
---|
1361 |
|
---|
1362 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE 1097 */
|
---|
1363 | static void vmsvga3dCmdDefineGBSurface(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface const *pCmd)
|
---|
1364 | {
|
---|
1365 | //DEBUG_BREAKPOINT_TEST();
|
---|
1366 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1367 |
|
---|
1368 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
1369 | SVGAOTableSurfaceEntry entry;
|
---|
1370 | RT_ZERO(entry);
|
---|
1371 | entry.format = pCmd->format;
|
---|
1372 | entry.surface1Flags = pCmd->surfaceFlags;
|
---|
1373 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
1374 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
1375 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
1376 | entry.size = pCmd->size;
|
---|
1377 | entry.mobid = SVGA_ID_INVALID;
|
---|
1378 | // entry.arraySize = 0;
|
---|
1379 | // entry.mobPitch = 0;
|
---|
1380 | // entry.surface2Flags = 0;
|
---|
1381 | // entry.multisamplePattern = 0;
|
---|
1382 | // entry.qualityLevel = 0;
|
---|
1383 | // entry.bufferByteStride = 0;
|
---|
1384 | // entry.minLOD = 0;
|
---|
1385 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1386 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1387 | if (RT_SUCCESS(rc))
|
---|
1388 | {
|
---|
1389 | /* Create the host surface. */
|
---|
1390 | SVGA3dMSPattern const multisamplePattern = pCmd->multisampleCount > 1 ? SVGA3D_MS_PATTERN_STANDARD : SVGA3D_MS_PATTERN_NONE;
|
---|
1391 | SVGA3dMSQualityLevel const qualityLevel = pCmd->multisampleCount > 1 ? SVGA3D_MS_QUALITY_FULL : SVGA3D_MS_QUALITY_NONE;
|
---|
1392 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
1393 | pCmd->multisampleCount, multisamplePattern, qualityLevel, pCmd->autogenFilter,
|
---|
1394 | pCmd->numMipLevels, &pCmd->size, /* arraySize = */ 0, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ false);
|
---|
1395 | }
|
---|
1396 | }
|
---|
1397 |
|
---|
1398 |
|
---|
1399 | /* SVGA_3D_CMD_DESTROY_GB_SURFACE 1098 */
|
---|
1400 | static void vmsvga3dCmdDestroyGBSurface(PVGASTATECC pThisCC, SVGA3dCmdDestroyGBSurface const *pCmd)
|
---|
1401 | {
|
---|
1402 | //DEBUG_BREAKPOINT_TEST();
|
---|
1403 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1404 |
|
---|
1405 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
1406 | SVGAOTableSurfaceEntry entry;
|
---|
1407 | RT_ZERO(entry);
|
---|
1408 | entry.mobid = SVGA_ID_INVALID;
|
---|
1409 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1410 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1411 |
|
---|
1412 | vmsvga3dSurfaceDestroy(pThisCC, pCmd->sid);
|
---|
1413 | }
|
---|
1414 |
|
---|
1415 |
|
---|
1416 | /* SVGA_3D_CMD_BIND_GB_SURFACE 1099 */
|
---|
1417 | static void vmsvga3dCmdBindGBSurface(PVGASTATECC pThisCC, SVGA3dCmdBindGBSurface const *pCmd)
|
---|
1418 | {
|
---|
1419 | //DEBUG_BREAKPOINT_TEST();
|
---|
1420 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1421 |
|
---|
1422 | /* Assign the mobid to the surface. */
|
---|
1423 | int rc = VINF_SUCCESS;
|
---|
1424 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
1425 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
1426 | pCmd->mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE);
|
---|
1427 | if (RT_SUCCESS(rc))
|
---|
1428 | {
|
---|
1429 | SVGAOTableSurfaceEntry entry;
|
---|
1430 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1431 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1432 | if (RT_SUCCESS(rc))
|
---|
1433 | {
|
---|
1434 | entry.mobid = pCmd->mobid;
|
---|
1435 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1436 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1437 | if (RT_SUCCESS(rc))
|
---|
1438 | {
|
---|
1439 | /* */
|
---|
1440 | }
|
---|
1441 | }
|
---|
1442 | }
|
---|
1443 | }
|
---|
1444 |
|
---|
1445 |
|
---|
1446 | typedef union
|
---|
1447 | {
|
---|
1448 | float f;
|
---|
1449 | uint32_t u;
|
---|
1450 | } Unsigned2Float;
|
---|
1451 |
|
---|
1452 | float float16ToFloat(uint16_t f16)
|
---|
1453 | {
|
---|
1454 | /* Format specs from Wiki: [15] = sign, [14:10] = exponent, [9:0] = fraction */
|
---|
1455 | uint16_t const f = f16 & 0x3FF;
|
---|
1456 | uint16_t const e = (f16 >> 10) & 0x1F;
|
---|
1457 | uint16_t const s = (f16 >> 15) & 0x1;
|
---|
1458 | Unsigned2Float u2f;
|
---|
1459 |
|
---|
1460 | if (e == 0)
|
---|
1461 | {
|
---|
1462 | if (f == 0)
|
---|
1463 | {
|
---|
1464 | /* zero, -0 */
|
---|
1465 | u2f.u = (s << 31) | (0 << 23) | 0;
|
---|
1466 | return u2f.f;
|
---|
1467 | }
|
---|
1468 |
|
---|
1469 | /* subnormal numbers: (-1)^signbit * 2^-14 * 0.significantbits */
|
---|
1470 | float const k = 1.0f / 16384.0f; /* 2^-14 */
|
---|
1471 | return (s ? -1.0f : 1.0f) * k * (float)f / 1024.0f;
|
---|
1472 | }
|
---|
1473 |
|
---|
1474 | if (e == 31)
|
---|
1475 | {
|
---|
1476 | if (f == 0)
|
---|
1477 | {
|
---|
1478 | /* +-infinity */
|
---|
1479 | u2f.u = (s << 31) | (0xFF << 23) | 0;
|
---|
1480 | return u2f.f;
|
---|
1481 | }
|
---|
1482 |
|
---|
1483 | /* NaN */
|
---|
1484 | u2f.u = (s << 31) | (0xFF << 23) | 1;
|
---|
1485 | return u2f.f;
|
---|
1486 | }
|
---|
1487 |
|
---|
1488 | /* normalized value: (-1)^signbit * 2^(exponent - 15) * 1.significantbits */
|
---|
1489 | /* Build the float, adjusting for exponent bias (float32 bias is 127, float16 is 15)
|
---|
1490 | * and number of bits in the fraction (float32 has 23, float16 has 10). */
|
---|
1491 | u2f.u = (s << 31) | ((e + 127 - 15) << 23) | (f << (23 - 10));
|
---|
1492 | return u2f.f;
|
---|
1493 | }
|
---|
1494 |
|
---|
1495 |
|
---|
1496 | static int vmsvga3dBmpWrite(const char *pszFilename, VMSVGA3D_MAPPED_SURFACE const *pMap)
|
---|
1497 | {
|
---|
1498 | if ( pMap->cbBlock != 4 && pMap->cbBlock != 2 && pMap->cbBlock != 1
|
---|
1499 | && pMap->format != SVGA3D_R16G16B16A16_FLOAT
|
---|
1500 | && pMap->format != SVGA3D_R32G32B32A32_FLOAT)
|
---|
1501 | return VERR_NOT_SUPPORTED;
|
---|
1502 |
|
---|
1503 | int const w = pMap->cbRow / pMap->cbBlock;
|
---|
1504 | int const h = pMap->cRows;
|
---|
1505 |
|
---|
1506 | int const cbBitmap = pMap->cbRow * pMap->cRows;
|
---|
1507 | int const cBits = ( pMap->format == SVGA3D_R16G16B16A16_FLOAT
|
---|
1508 | || pMap->format == SVGA3D_R32G32B32A32_FLOAT)
|
---|
1509 | ? 32
|
---|
1510 | : pMap->cbBlock * 8;
|
---|
1511 |
|
---|
1512 | FILE *f = fopen(pszFilename, "wb");
|
---|
1513 | if (!f)
|
---|
1514 | return VERR_FILE_NOT_FOUND;
|
---|
1515 |
|
---|
1516 | /* Always write 32 bit bitmap which can be displayed. */
|
---|
1517 | #ifdef RT_OS_WINDOWS
|
---|
1518 | if (cBits == 32)
|
---|
1519 | {
|
---|
1520 | BMPFILEHDR fileHdr;
|
---|
1521 | RT_ZERO(fileHdr);
|
---|
1522 | fileHdr.uType = BMP_HDR_MAGIC;
|
---|
1523 | fileHdr.cbFileSize = sizeof(fileHdr) + sizeof(BITMAPV4HEADER) + cbBitmap;
|
---|
1524 | fileHdr.offBits = sizeof(fileHdr) + sizeof(BITMAPV4HEADER);
|
---|
1525 |
|
---|
1526 | BITMAPV4HEADER hdrV4;
|
---|
1527 | RT_ZERO(hdrV4);
|
---|
1528 | hdrV4.bV4Size = sizeof(hdrV4);
|
---|
1529 | hdrV4.bV4Width = w;
|
---|
1530 | hdrV4.bV4Height = -h;
|
---|
1531 | hdrV4.bV4Planes = 1;
|
---|
1532 | hdrV4.bV4BitCount = 32;
|
---|
1533 | hdrV4.bV4V4Compression = BI_BITFIELDS;
|
---|
1534 | hdrV4.bV4SizeImage = cbBitmap;
|
---|
1535 | hdrV4.bV4XPelsPerMeter = 2835;
|
---|
1536 | hdrV4.bV4YPelsPerMeter = 2835;
|
---|
1537 | // hdrV4.bV4ClrUsed = 0;
|
---|
1538 | // hdrV4.bV4ClrImportant = 0;
|
---|
1539 | hdrV4.bV4RedMask = 0x00ff0000;
|
---|
1540 | hdrV4.bV4GreenMask = 0x0000ff00;
|
---|
1541 | hdrV4.bV4BlueMask = 0x000000ff;
|
---|
1542 | hdrV4.bV4AlphaMask = 0xff000000;
|
---|
1543 | hdrV4.bV4CSType = LCS_WINDOWS_COLOR_SPACE;
|
---|
1544 | // hdrV4.bV4Endpoints = {0};
|
---|
1545 | // hdrV4.bV4GammaRed = 0;
|
---|
1546 | // hdrV4.bV4GammaGreen = 0;
|
---|
1547 | // hdrV4.bV4GammaBlue = 0;
|
---|
1548 |
|
---|
1549 | fwrite(&fileHdr, 1, sizeof(fileHdr), f);
|
---|
1550 | fwrite(&hdrV4, 1, sizeof(hdrV4), f);
|
---|
1551 | }
|
---|
1552 | else
|
---|
1553 | #else
|
---|
1554 | RT_NOREF(cBits);
|
---|
1555 | #endif
|
---|
1556 | {
|
---|
1557 | BMPFILEHDR fileHdr;
|
---|
1558 | RT_ZERO(fileHdr);
|
---|
1559 | fileHdr.uType = BMP_HDR_MAGIC;
|
---|
1560 | fileHdr.cbFileSize = sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR) + cbBitmap;
|
---|
1561 | fileHdr.offBits = sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR);
|
---|
1562 |
|
---|
1563 | BMPWIN3XINFOHDR coreHdr;
|
---|
1564 | RT_ZERO(coreHdr);
|
---|
1565 | coreHdr.cbSize = sizeof(coreHdr);
|
---|
1566 | coreHdr.uWidth = w;
|
---|
1567 | coreHdr.uHeight = -h;
|
---|
1568 | coreHdr.cPlanes = 1;
|
---|
1569 | coreHdr.cBits = 32;
|
---|
1570 | coreHdr.cbSizeImage = cbBitmap;
|
---|
1571 |
|
---|
1572 | fwrite(&fileHdr, 1, sizeof(fileHdr), f);
|
---|
1573 | fwrite(&coreHdr, 1, sizeof(coreHdr), f);
|
---|
1574 | }
|
---|
1575 |
|
---|
1576 | if (pMap->format == SVGA3D_R16G16B16A16_FLOAT)
|
---|
1577 | {
|
---|
1578 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1579 | for (int32_t y = 0; y < h; ++y)
|
---|
1580 | {
|
---|
1581 | for (int32_t x = 0; x < w; ++x)
|
---|
1582 | {
|
---|
1583 | uint16_t const *pu16Pixel = (uint16_t *)(s + x * 8);
|
---|
1584 | uint8_t r = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[0]));
|
---|
1585 | uint8_t g = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[1]));
|
---|
1586 | uint8_t b = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[2]));
|
---|
1587 | uint8_t a = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[3]));
|
---|
1588 | uint32_t u32Pixel = b + (g << 8) + (r << 16) + (a << 24);
|
---|
1589 | fwrite(&u32Pixel, 1, 4, f);
|
---|
1590 | }
|
---|
1591 |
|
---|
1592 | s += pMap->cbRowPitch;
|
---|
1593 | }
|
---|
1594 | }
|
---|
1595 | else if (pMap->format == SVGA3D_R32G32B32A32_FLOAT)
|
---|
1596 | {
|
---|
1597 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1598 | for (int32_t y = 0; y < h; ++y)
|
---|
1599 | {
|
---|
1600 | for (int32_t x = 0; x < w; ++x)
|
---|
1601 | {
|
---|
1602 | float const *pPixel = (float *)(s + x * 8);
|
---|
1603 | uint8_t r = (uint8_t)(255.0 * pPixel[0]);
|
---|
1604 | uint8_t g = (uint8_t)(255.0 * pPixel[1]);
|
---|
1605 | uint8_t b = (uint8_t)(255.0 * pPixel[2]);
|
---|
1606 | uint8_t a = (uint8_t)(255.0 * pPixel[3]);
|
---|
1607 | uint32_t u32Pixel = b + (g << 8) + (r << 16) + (a << 24);
|
---|
1608 | fwrite(&u32Pixel, 1, 4, f);
|
---|
1609 | }
|
---|
1610 |
|
---|
1611 | s += pMap->cbRowPitch;
|
---|
1612 | }
|
---|
1613 | }
|
---|
1614 | else if (pMap->cbBlock == 4)
|
---|
1615 | {
|
---|
1616 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1617 | for (uint32_t iRow = 0; iRow < pMap->cRows; ++iRow)
|
---|
1618 | {
|
---|
1619 | fwrite(s, 1, pMap->cbRow, f);
|
---|
1620 |
|
---|
1621 | s += pMap->cbRowPitch;
|
---|
1622 | }
|
---|
1623 | }
|
---|
1624 | else if (pMap->cbBlock == 2)
|
---|
1625 | {
|
---|
1626 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1627 | for (uint32_t iRow = 0; iRow < pMap->cRows; ++iRow)
|
---|
1628 | {
|
---|
1629 | for (int32_t x = 0; x < w; ++x)
|
---|
1630 | {
|
---|
1631 | uint16_t const *pPixel = (uint16_t *)(s + x * sizeof(uint16_t));
|
---|
1632 | uint32_t u32Pixel = *pPixel;
|
---|
1633 | fwrite(&u32Pixel, 1, 4, f);
|
---|
1634 | }
|
---|
1635 |
|
---|
1636 | s += pMap->cbRowPitch;
|
---|
1637 | }
|
---|
1638 | }
|
---|
1639 | else if (pMap->cbBlock == 1)
|
---|
1640 | {
|
---|
1641 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1642 | for (uint32_t iRow = 0; iRow < pMap->cRows; ++iRow)
|
---|
1643 | {
|
---|
1644 | for (int32_t x = 0; x < w; ++x)
|
---|
1645 | {
|
---|
1646 | uint32_t u32Pixel = s[x];
|
---|
1647 | fwrite(&u32Pixel, 1, 4, f);
|
---|
1648 | }
|
---|
1649 |
|
---|
1650 | s += pMap->cbRowPitch;
|
---|
1651 | }
|
---|
1652 | }
|
---|
1653 |
|
---|
1654 | fclose(f);
|
---|
1655 |
|
---|
1656 | return VINF_SUCCESS;
|
---|
1657 | }
|
---|
1658 |
|
---|
1659 |
|
---|
1660 | void vmsvga3dMapWriteBmpFile(VMSVGA3D_MAPPED_SURFACE const *pMap, char const *pszPrefix)
|
---|
1661 | {
|
---|
1662 | static int idxBitmap = 0;
|
---|
1663 | char *pszFilename = RTStrAPrintf2("bmp" RTPATH_SLASH_STR "%s%d.bmp", pszPrefix, idxBitmap++);
|
---|
1664 | int rc = vmsvga3dBmpWrite(pszFilename, pMap);
|
---|
1665 | Log(("WriteBmpFile %s format %d %Rrc\n", pszFilename, pMap->format, rc)); RT_NOREF(rc);
|
---|
1666 | RTStrFree(pszFilename);
|
---|
1667 | }
|
---|
1668 |
|
---|
1669 |
|
---|
1670 | static int vmsvgaR3TransferSurfaceLevel(PVGASTATECC pThisCC,
|
---|
1671 | PVMSVGAMOB pMob,
|
---|
1672 | SVGA3dSurfaceImageId const *pImage,
|
---|
1673 | SVGA3dBox const *pBox,
|
---|
1674 | SVGA3dTransferType enmTransfer)
|
---|
1675 | {
|
---|
1676 | if (vmsvga3dIsMultisampleSurface(pThisCC, pImage->sid))
|
---|
1677 | {
|
---|
1678 | /* Multisample surfaces can't be accessed. Skip. */
|
---|
1679 | return VINF_SUCCESS;
|
---|
1680 | }
|
---|
1681 |
|
---|
1682 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1683 |
|
---|
1684 | VMSVGA3D_SURFACE_MAP enmMapType;
|
---|
1685 | if (enmTransfer == SVGA3D_WRITE_HOST_VRAM)
|
---|
1686 | enmMapType = pBox
|
---|
1687 | ? VMSVGA3D_SURFACE_MAP_WRITE
|
---|
1688 | : VMSVGA3D_SURFACE_MAP_WRITE_DISCARD;
|
---|
1689 | else if (enmTransfer == SVGA3D_READ_HOST_VRAM)
|
---|
1690 | enmMapType = VMSVGA3D_SURFACE_MAP_READ;
|
---|
1691 | else
|
---|
1692 | AssertFailedReturn(VERR_INVALID_PARAMETER);
|
---|
1693 |
|
---|
1694 | VMSVGA3D_MAPPED_SURFACE map;
|
---|
1695 | int rc = vmsvga3dSurfaceMap(pThisCC, pImage, pBox, enmMapType, &map);
|
---|
1696 | if (RT_SUCCESS(rc))
|
---|
1697 | {
|
---|
1698 | /* Copy mapped surface <-> MOB. */
|
---|
1699 | VMSGA3D_BOX_DIMENSIONS dims;
|
---|
1700 | rc = vmsvga3dGetBoxDimensions(pThisCC, pImage, pBox, &dims);
|
---|
1701 | if (RT_SUCCESS(rc))
|
---|
1702 | {
|
---|
1703 | for (uint32_t z = 0; z < map.box.d; ++z)
|
---|
1704 | {
|
---|
1705 | uint8_t *pu8Map = (uint8_t *)map.pvData + z * map.cbDepthPitch;
|
---|
1706 | uint32_t offMob = dims.offSubresource + dims.offBox + z * dims.cbDepthPitch;
|
---|
1707 |
|
---|
1708 | for (uint32_t iRow = 0; iRow < map.cRows; ++iRow)
|
---|
1709 | {
|
---|
1710 | if (enmTransfer == SVGA3D_READ_HOST_VRAM)
|
---|
1711 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, offMob, pu8Map, dims.cbRow);
|
---|
1712 | else
|
---|
1713 | rc = vmsvgaR3GboRead(pSvgaR3State, &pMob->Gbo, offMob, pu8Map, dims.cbRow);
|
---|
1714 | AssertRCBreak(rc);
|
---|
1715 |
|
---|
1716 | pu8Map += map.cbRowPitch;
|
---|
1717 | offMob += dims.cbPitch;
|
---|
1718 | }
|
---|
1719 | }
|
---|
1720 | }
|
---|
1721 |
|
---|
1722 | // vmsvga3dMapWriteBmpFile(&map, "Dynamic");
|
---|
1723 |
|
---|
1724 | bool const fWritten = (enmTransfer == SVGA3D_WRITE_HOST_VRAM);
|
---|
1725 | vmsvga3dSurfaceUnmap(pThisCC, pImage, &map, fWritten);
|
---|
1726 | }
|
---|
1727 |
|
---|
1728 | return rc;
|
---|
1729 | }
|
---|
1730 |
|
---|
1731 |
|
---|
1732 | /* SVGA_3D_CMD_UPDATE_GB_IMAGE 1101 */
|
---|
1733 | static void vmsvga3dCmdUpdateGBImage(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBImage const *pCmd)
|
---|
1734 | {
|
---|
1735 | //DEBUG_BREAKPOINT_TEST();
|
---|
1736 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1737 |
|
---|
1738 | LogFlowFunc(("sid=%u @%u,%u,%u %ux%ux%u\n",
|
---|
1739 | pCmd->image.sid, pCmd->box.x, pCmd->box.y, pCmd->box.z, pCmd->box.w, pCmd->box.h, pCmd->box.d));
|
---|
1740 |
|
---|
1741 | /*
|
---|
1742 | SVGA3dSurfaceFormat format;
|
---|
1743 | SVGA3dSurface1Flags surface1Flags;
|
---|
1744 | uint32 numMipLevels;
|
---|
1745 | uint32 multisampleCount;
|
---|
1746 | SVGA3dTextureFilter autogenFilter;
|
---|
1747 | SVGA3dSize size;
|
---|
1748 | SVGAMobId mobid;
|
---|
1749 | uint32 arraySize;
|
---|
1750 | uint32 mobPitch;
|
---|
1751 | SVGA3dSurface2Flags surface2Flags;
|
---|
1752 | uint8 multisamplePattern;
|
---|
1753 | uint8 qualityLevel;
|
---|
1754 | uint16 bufferByteStride;
|
---|
1755 | float minLOD;
|
---|
1756 | */
|
---|
1757 |
|
---|
1758 | /* "update a surface from its backing MOB." */
|
---|
1759 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1760 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1761 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1762 | if (RT_SUCCESS(rc))
|
---|
1763 | {
|
---|
1764 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1765 | if (pMob)
|
---|
1766 | {
|
---|
1767 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &pCmd->image, &pCmd->box, SVGA3D_WRITE_HOST_VRAM);
|
---|
1768 | AssertRC(rc);
|
---|
1769 | }
|
---|
1770 | }
|
---|
1771 | }
|
---|
1772 |
|
---|
1773 |
|
---|
1774 | /* SVGA_3D_CMD_UPDATE_GB_SURFACE 1102 */
|
---|
1775 | static void vmsvga3dCmdUpdateGBSurface(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBSurface const *pCmd)
|
---|
1776 | {
|
---|
1777 | //DEBUG_BREAKPOINT_TEST();
|
---|
1778 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1779 |
|
---|
1780 | LogFlowFunc(("sid=%u\n",
|
---|
1781 | pCmd->sid));
|
---|
1782 |
|
---|
1783 | /* "update a surface from its backing MOB." */
|
---|
1784 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1785 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1786 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1787 | if (RT_SUCCESS(rc))
|
---|
1788 | {
|
---|
1789 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1790 | if (pMob)
|
---|
1791 | {
|
---|
1792 | uint32 const arraySize = vmsvga3dGetArrayElements(pThisCC, pCmd->sid);
|
---|
1793 | for (uint32_t iArray = 0; iArray < arraySize; ++iArray)
|
---|
1794 | {
|
---|
1795 | for (uint32_t iMipmap = 0; iMipmap < entrySurface.numMipLevels; ++iMipmap)
|
---|
1796 | {
|
---|
1797 | SVGA3dSurfaceImageId image;
|
---|
1798 | image.sid = pCmd->sid;
|
---|
1799 | image.face = iArray;
|
---|
1800 | image.mipmap = iMipmap;
|
---|
1801 |
|
---|
1802 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_WRITE_HOST_VRAM);
|
---|
1803 | AssertRCBreak(rc);
|
---|
1804 | }
|
---|
1805 | }
|
---|
1806 | }
|
---|
1807 | }
|
---|
1808 | }
|
---|
1809 |
|
---|
1810 |
|
---|
1811 | /* SVGA_3D_CMD_READBACK_GB_IMAGE 1103 */
|
---|
1812 | static void vmsvga3dCmdReadbackGBImage(PVGASTATECC pThisCC, SVGA3dCmdReadbackGBImage const *pCmd)
|
---|
1813 | {
|
---|
1814 | //DEBUG_BREAKPOINT_TEST();
|
---|
1815 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1816 |
|
---|
1817 | LogFlowFunc(("sid=%u, face=%u, mipmap=%u\n",
|
---|
1818 | pCmd->image.sid, pCmd->image.face, pCmd->image.mipmap));
|
---|
1819 |
|
---|
1820 | /* Read a surface to its backing MOB. */
|
---|
1821 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1822 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1823 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1824 | if (RT_SUCCESS(rc))
|
---|
1825 | {
|
---|
1826 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1827 | if (pMob)
|
---|
1828 | {
|
---|
1829 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &pCmd->image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
1830 | AssertRC(rc);
|
---|
1831 | }
|
---|
1832 | }
|
---|
1833 | }
|
---|
1834 |
|
---|
1835 |
|
---|
1836 | /* SVGA_3D_CMD_READBACK_GB_SURFACE 1104 */
|
---|
1837 | static void vmsvga3dCmdReadbackGBSurface(PVGASTATECC pThisCC, SVGA3dCmdReadbackGBSurface const *pCmd)
|
---|
1838 | {
|
---|
1839 | //DEBUG_BREAKPOINT_TEST();
|
---|
1840 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1841 |
|
---|
1842 | LogFlowFunc(("sid=%u\n",
|
---|
1843 | pCmd->sid));
|
---|
1844 |
|
---|
1845 | /* Read a surface to its backing MOB. */
|
---|
1846 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1847 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1848 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1849 | if (RT_SUCCESS(rc))
|
---|
1850 | {
|
---|
1851 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1852 | if (pMob)
|
---|
1853 | {
|
---|
1854 | uint32 const arraySize = vmsvga3dGetArrayElements(pThisCC, pCmd->sid);
|
---|
1855 | for (uint32_t iArray = 0; iArray < arraySize; ++iArray)
|
---|
1856 | {
|
---|
1857 | for (uint32_t iMipmap = 0; iMipmap < entrySurface.numMipLevels; ++iMipmap)
|
---|
1858 | {
|
---|
1859 | SVGA3dSurfaceImageId image;
|
---|
1860 | image.sid = pCmd->sid;
|
---|
1861 | image.face = iArray;
|
---|
1862 | image.mipmap = iMipmap;
|
---|
1863 |
|
---|
1864 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
1865 | AssertRCBreak(rc);
|
---|
1866 | }
|
---|
1867 | }
|
---|
1868 | }
|
---|
1869 | }
|
---|
1870 | }
|
---|
1871 |
|
---|
1872 |
|
---|
1873 | /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE 1105 */
|
---|
1874 | static void vmsvga3dCmdInvalidateGBImage(PVGASTATECC pThisCC, SVGA3dCmdInvalidateGBImage const *pCmd)
|
---|
1875 | {
|
---|
1876 | //DEBUG_BREAKPOINT_TEST();
|
---|
1877 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->image.sid, pCmd->image.face, pCmd->image.mipmap);
|
---|
1878 | }
|
---|
1879 |
|
---|
1880 |
|
---|
1881 | /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE 1106 */
|
---|
1882 | static void vmsvga3dCmdInvalidateGBSurface(PVGASTATECC pThisCC, SVGA3dCmdInvalidateGBSurface const *pCmd)
|
---|
1883 | {
|
---|
1884 | //DEBUG_BREAKPOINT_TEST();
|
---|
1885 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->sid, SVGA_ID_INVALID, SVGA_ID_INVALID);
|
---|
1886 | }
|
---|
1887 |
|
---|
1888 |
|
---|
1889 | /* SVGA_3D_CMD_SET_OTABLE_BASE64 1115 */
|
---|
1890 | static void vmsvga3dCmdSetOTableBase64(PVGASTATECC pThisCC, SVGA3dCmdSetOTableBase64 const *pCmd)
|
---|
1891 | {
|
---|
1892 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1893 | vmsvgaR3OTableSetOrGrow(pSvgaR3State, pCmd->type, pCmd->baseAddress,
|
---|
1894 | pCmd->sizeInBytes, pCmd->validSizeInBytes, pCmd->ptDepth, /*fGrow*/ false);
|
---|
1895 | }
|
---|
1896 |
|
---|
1897 |
|
---|
1898 | /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET 1124 */
|
---|
1899 | static void vmsvga3dCmdDefineGBScreenTarget(PVGASTATE pThis, PVGASTATECC pThisCC, SVGA3dCmdDefineGBScreenTarget const *pCmd)
|
---|
1900 | {
|
---|
1901 | //DEBUG_BREAKPOINT_TEST();
|
---|
1902 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1903 |
|
---|
1904 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1905 | ASSERT_GUEST_RETURN_VOID(pCmd->width > 0 && pCmd->width <= pThis->svga.u32MaxWidth); /* SVGA_REG_SCREENTARGET_MAX_WIDTH */
|
---|
1906 | ASSERT_GUEST_RETURN_VOID(pCmd->height > 0 && pCmd->height <= pThis->svga.u32MaxHeight); /* SVGA_REG_SCREENTARGET_MAX_HEIGHT */
|
---|
1907 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1908 |
|
---|
1909 | /* Update the entry in the pSvgaR3State->pGboOTableScreenTarget. */
|
---|
1910 | SVGAOTableScreenTargetEntry entry;
|
---|
1911 | RT_ZERO(entry);
|
---|
1912 | entry.image.sid = SVGA_ID_INVALID;
|
---|
1913 | // entry.image.face = 0;
|
---|
1914 | // entry.image.mipmap = 0;
|
---|
1915 | entry.width = pCmd->width;
|
---|
1916 | entry.height = pCmd->height;
|
---|
1917 | entry.xRoot = pCmd->xRoot;
|
---|
1918 | entry.yRoot = pCmd->yRoot;
|
---|
1919 | entry.flags = pCmd->flags;
|
---|
1920 | entry.dpi = pCmd->dpi;
|
---|
1921 |
|
---|
1922 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1923 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1924 | if (RT_SUCCESS(rc))
|
---|
1925 | {
|
---|
1926 | /* Screen objects and screen targets are similar, therefore we will use the same for both. */
|
---|
1927 | /** @todo Generic screen object/target interface. */
|
---|
1928 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1929 | Assert(pScreen->idScreen == pCmd->stid);
|
---|
1930 | pScreen->fDefined = true;
|
---|
1931 | pScreen->fModified = true;
|
---|
1932 | pScreen->fuScreen = SVGA_SCREEN_MUST_BE_SET
|
---|
1933 | | (RT_BOOL(pCmd->flags & SVGA_STFLAG_PRIMARY) ? SVGA_SCREEN_IS_PRIMARY : 0);
|
---|
1934 |
|
---|
1935 | pScreen->xOrigin = pCmd->xRoot;
|
---|
1936 | pScreen->yOrigin = pCmd->yRoot;
|
---|
1937 | pScreen->cWidth = pCmd->width;
|
---|
1938 | pScreen->cHeight = pCmd->height;
|
---|
1939 | pScreen->offVRAM = 0; /* Not applicable for screen targets, they use either a separate memory buffer or a host window. */
|
---|
1940 | pScreen->cbPitch = pCmd->width * 4;
|
---|
1941 | pScreen->cBpp = 32;
|
---|
1942 |
|
---|
1943 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
1944 | vmsvga3dDefineScreen(pThis, pThisCC, pScreen);
|
---|
1945 |
|
---|
1946 | if (!pScreen->pHwScreen)
|
---|
1947 | {
|
---|
1948 | /* System memory buffer. */
|
---|
1949 | pScreen->pvScreenBitmap = RTMemAllocZ(pScreen->cHeight * pScreen->cbPitch);
|
---|
1950 | }
|
---|
1951 |
|
---|
1952 | pThis->svga.fGFBRegisters = false;
|
---|
1953 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
1954 | }
|
---|
1955 | }
|
---|
1956 |
|
---|
1957 |
|
---|
1958 | /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET 1125 */
|
---|
1959 | static void vmsvga3dCmdDestroyGBScreenTarget(PVGASTATE pThis, PVGASTATECC pThisCC, SVGA3dCmdDestroyGBScreenTarget const *pCmd)
|
---|
1960 | {
|
---|
1961 | //DEBUG_BREAKPOINT_TEST();
|
---|
1962 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1963 |
|
---|
1964 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1965 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1966 |
|
---|
1967 | /* Update the entry in the pSvgaR3State->pGboOTableScreenTarget. */
|
---|
1968 | SVGAOTableScreenTargetEntry entry;
|
---|
1969 | RT_ZERO(entry);
|
---|
1970 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1971 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1972 | if (RT_SUCCESS(rc))
|
---|
1973 | {
|
---|
1974 | /* Screen objects and screen targets are similar, therefore we will use the same for both. */
|
---|
1975 | /** @todo Generic screen object/target interface. */
|
---|
1976 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1977 | vmsvgaR3DestroyScreen(pThis, pThisCC, pScreen);
|
---|
1978 | }
|
---|
1979 | }
|
---|
1980 |
|
---|
1981 |
|
---|
1982 | /* SVGA_3D_CMD_BIND_GB_SCREENTARGET 1126 */
|
---|
1983 | static void vmsvga3dCmdBindGBScreenTarget(PVGASTATECC pThisCC, SVGA3dCmdBindGBScreenTarget const *pCmd)
|
---|
1984 | {
|
---|
1985 | //DEBUG_BREAKPOINT_TEST();
|
---|
1986 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1987 |
|
---|
1988 | /* "Binding a surface to a Screen Target the same as flipping" */
|
---|
1989 |
|
---|
1990 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1991 | ASSERT_GUEST_RETURN_VOID(pCmd->image.face == 0 && pCmd->image.mipmap == 0);
|
---|
1992 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1993 |
|
---|
1994 | /* Assign the surface to the screen target. */
|
---|
1995 | int rc = VINF_SUCCESS;
|
---|
1996 | if (pCmd->image.sid != SVGA_ID_INVALID)
|
---|
1997 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1998 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE);
|
---|
1999 | if (RT_SUCCESS(rc))
|
---|
2000 | {
|
---|
2001 | SVGAOTableScreenTargetEntry entry;
|
---|
2002 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
2003 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
2004 | if (RT_SUCCESS(rc))
|
---|
2005 | {
|
---|
2006 | entry.image = pCmd->image;
|
---|
2007 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
2008 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
2009 | if (RT_SUCCESS(rc))
|
---|
2010 | {
|
---|
2011 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
2012 | rc = pSvgaR3State->pFuncsGBO->pfnScreenTargetBind(pThisCC, pScreen, pCmd->image.sid);
|
---|
2013 | AssertRC(rc);
|
---|
2014 | }
|
---|
2015 | }
|
---|
2016 | }
|
---|
2017 | }
|
---|
2018 |
|
---|
2019 |
|
---|
2020 | /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET 1127 */
|
---|
2021 | static void vmsvga3dCmdUpdateGBScreenTarget(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBScreenTarget const *pCmd)
|
---|
2022 | {
|
---|
2023 | //DEBUG_BREAKPOINT_TEST();
|
---|
2024 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2025 |
|
---|
2026 | /* Update the screen target from its backing surface. */
|
---|
2027 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
2028 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2029 |
|
---|
2030 | /* Get the screen target info. */
|
---|
2031 | SVGAOTableScreenTargetEntry entryScreenTarget;
|
---|
2032 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
2033 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entryScreenTarget, sizeof(entryScreenTarget));
|
---|
2034 | if (RT_SUCCESS(rc))
|
---|
2035 | {
|
---|
2036 | ASSERT_GUEST_RETURN_VOID(entryScreenTarget.image.face == 0 && entryScreenTarget.image.mipmap == 0);
|
---|
2037 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2038 |
|
---|
2039 | if (entryScreenTarget.image.sid != SVGA_ID_INVALID)
|
---|
2040 | {
|
---|
2041 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2042 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2043 | entryScreenTarget.image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2044 | if (RT_SUCCESS(rc))
|
---|
2045 | {
|
---|
2046 | /* Copy entrySurface.mobid content to the screen target. */
|
---|
2047 | if (entrySurface.mobid != SVGA_ID_INVALID)
|
---|
2048 | {
|
---|
2049 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2050 | SVGA3dRect targetRect = pCmd->rect;
|
---|
2051 |
|
---|
2052 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
2053 | if (pScreen->pHwScreen)
|
---|
2054 | {
|
---|
2055 | /* Copy the screen target surface to the backend's screen. */
|
---|
2056 | pSvgaR3State->pFuncsGBO->pfnScreenTargetUpdate(pThisCC, pScreen, &targetRect);
|
---|
2057 | }
|
---|
2058 | else
|
---|
2059 | {
|
---|
2060 | SVGASignedRect r;
|
---|
2061 | r.left = pCmd->rect.x;
|
---|
2062 | r.top = pCmd->rect.y;
|
---|
2063 | r.right = pCmd->rect.x + pCmd->rect.w;
|
---|
2064 | r.bottom = pCmd->rect.y + pCmd->rect.h;
|
---|
2065 | vmsvga3dScreenUpdate(pThisCC, pCmd->stid, r, entryScreenTarget.image, r, 0, NULL);
|
---|
2066 | }
|
---|
2067 | }
|
---|
2068 | }
|
---|
2069 | }
|
---|
2070 | }
|
---|
2071 | }
|
---|
2072 |
|
---|
2073 |
|
---|
2074 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 1134 */
|
---|
2075 | static void vmsvga3dCmdDefineGBSurface_v2(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface_v2 const *pCmd)
|
---|
2076 | {
|
---|
2077 | //DEBUG_BREAKPOINT_TEST();
|
---|
2078 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2079 |
|
---|
2080 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
2081 | SVGAOTableSurfaceEntry entry;
|
---|
2082 | RT_ZERO(entry);
|
---|
2083 | entry.format = pCmd->format;
|
---|
2084 | entry.surface1Flags = pCmd->surfaceFlags;
|
---|
2085 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
2086 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
2087 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
2088 | entry.size = pCmd->size;
|
---|
2089 | entry.mobid = SVGA_ID_INVALID;
|
---|
2090 | entry.arraySize = pCmd->arraySize;
|
---|
2091 | // entry.mobPitch = 0;
|
---|
2092 | // entry.surface2Flags = 0;
|
---|
2093 | // entry.multisamplePattern = 0;
|
---|
2094 | // entry.qualityLevel = 0;
|
---|
2095 | // entry.bufferByteStride = 0;
|
---|
2096 | // entry.minLOD = 0;
|
---|
2097 |
|
---|
2098 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2099 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
2100 | if (RT_SUCCESS(rc))
|
---|
2101 | {
|
---|
2102 | /* Create the host surface. */
|
---|
2103 | SVGA3dMSPattern const multisamplePattern = pCmd->multisampleCount > 1 ? SVGA3D_MS_PATTERN_STANDARD : SVGA3D_MS_PATTERN_NONE;
|
---|
2104 | SVGA3dMSQualityLevel const qualityLevel = pCmd->multisampleCount > 1 ? SVGA3D_MS_QUALITY_FULL : SVGA3D_MS_QUALITY_NONE;
|
---|
2105 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
2106 | pCmd->multisampleCount, multisamplePattern, qualityLevel, pCmd->autogenFilter,
|
---|
2107 | pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ false);
|
---|
2108 | }
|
---|
2109 | }
|
---|
2110 |
|
---|
2111 |
|
---|
2112 | /* SVGA_3D_CMD_DEFINE_GB_MOB64 1135 */
|
---|
2113 | static void vmsvga3dCmdDefineGBMob64(PVGASTATECC pThisCC, SVGA3dCmdDefineGBMob64 const *pCmd)
|
---|
2114 | {
|
---|
2115 | //DEBUG_BREAKPOINT_TEST();
|
---|
2116 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2117 |
|
---|
2118 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
2119 |
|
---|
2120 | /* Maybe just update the OTable and create Gbo when the MOB is actually accessed? */
|
---|
2121 | /* Allocate a structure for the MOB. */
|
---|
2122 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTMemAllocZ(sizeof(*pMob));
|
---|
2123 | AssertPtrReturnVoid(pMob);
|
---|
2124 |
|
---|
2125 | int rc = vmsvgaR3MobCreate(pSvgaR3State, pCmd->ptDepth, pCmd->base, pCmd->sizeInBytes, pCmd->mobid, pMob);
|
---|
2126 | if (RT_SUCCESS(rc))
|
---|
2127 | {
|
---|
2128 | return;
|
---|
2129 | }
|
---|
2130 |
|
---|
2131 | RTMemFree(pMob);
|
---|
2132 | }
|
---|
2133 |
|
---|
2134 |
|
---|
2135 | /* SVGA_3D_CMD_DX_DEFINE_CONTEXT 1143 */
|
---|
2136 | static int vmsvga3dCmdDXDefineContext(PVGASTATECC pThisCC, SVGA3dCmdDXDefineContext const *pCmd, uint32_t cbCmd)
|
---|
2137 | {
|
---|
2138 | #ifdef VMSVGA3D_DX
|
---|
2139 | //DEBUG_BREAKPOINT_TEST();
|
---|
2140 | RT_NOREF(cbCmd);
|
---|
2141 |
|
---|
2142 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2143 |
|
---|
2144 | /* Update the entry in the pSvgaR3State->pGboOTable[SVGA_OTABLE_DXCONTEXT]. */
|
---|
2145 | SVGAOTableDXContextEntry entry;
|
---|
2146 | RT_ZERO(entry);
|
---|
2147 | entry.cid = pCmd->cid;
|
---|
2148 | entry.mobid = SVGA_ID_INVALID;
|
---|
2149 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2150 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2151 | if (RT_SUCCESS(rc))
|
---|
2152 | {
|
---|
2153 | /* Create the host context. */
|
---|
2154 | rc = vmsvga3dDXDefineContext(pThisCC, pCmd->cid);
|
---|
2155 | }
|
---|
2156 |
|
---|
2157 | return rc;
|
---|
2158 | #else
|
---|
2159 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2160 | return VERR_NOT_SUPPORTED;
|
---|
2161 | #endif
|
---|
2162 | }
|
---|
2163 |
|
---|
2164 |
|
---|
2165 | /* SVGA_3D_CMD_DX_DESTROY_CONTEXT 1144 */
|
---|
2166 | static int vmsvga3dCmdDXDestroyContext(PVGASTATECC pThisCC, SVGA3dCmdDXDestroyContext const *pCmd, uint32_t cbCmd)
|
---|
2167 | {
|
---|
2168 | #ifdef VMSVGA3D_DX
|
---|
2169 | //DEBUG_BREAKPOINT_TEST();
|
---|
2170 | RT_NOREF(cbCmd);
|
---|
2171 |
|
---|
2172 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2173 |
|
---|
2174 | /* Update the entry in the pSvgaR3State->pGboOTable[SVGA_OTABLE_DXCONTEXT]. */
|
---|
2175 | SVGAOTableDXContextEntry entry;
|
---|
2176 | RT_ZERO(entry);
|
---|
2177 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2178 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2179 |
|
---|
2180 | return vmsvga3dDXDestroyContext(pThisCC, pCmd->cid);
|
---|
2181 | #else
|
---|
2182 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2183 | return VERR_NOT_SUPPORTED;
|
---|
2184 | #endif
|
---|
2185 | }
|
---|
2186 |
|
---|
2187 |
|
---|
2188 | /* SVGA_3D_CMD_DX_BIND_CONTEXT 1145 */
|
---|
2189 | static int vmsvga3dCmdDXBindContext(PVGASTATECC pThisCC, SVGA3dCmdDXBindContext const *pCmd, uint32_t cbCmd)
|
---|
2190 | {
|
---|
2191 | #ifdef VMSVGA3D_DX
|
---|
2192 | //DEBUG_BREAKPOINT_TEST();
|
---|
2193 | RT_NOREF(cbCmd);
|
---|
2194 |
|
---|
2195 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2196 |
|
---|
2197 | /* Assign a mobid to a cid. */
|
---|
2198 | int rc = VINF_SUCCESS;
|
---|
2199 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
2200 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
2201 | pCmd->mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE);
|
---|
2202 | if (RT_SUCCESS(rc))
|
---|
2203 | {
|
---|
2204 | SVGAOTableDXContextEntry entry;
|
---|
2205 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2206 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2207 | if (RT_SUCCESS(rc))
|
---|
2208 | {
|
---|
2209 | SVGADXContextMobFormat *pSvgaDXContext = NULL;
|
---|
2210 | if (pCmd->mobid != entry.mobid && entry.mobid != SVGA_ID_INVALID)
|
---|
2211 | {
|
---|
2212 | /* Unbind notification to the DX backend. Copy the context data to the guest backing memory. */
|
---|
2213 | pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2214 | if (pSvgaDXContext)
|
---|
2215 | {
|
---|
2216 | rc = vmsvga3dDXUnbindContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2217 | if (RT_SUCCESS(rc))
|
---|
2218 | {
|
---|
2219 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entry.mobid);
|
---|
2220 | if (pMob)
|
---|
2221 | {
|
---|
2222 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2223 | }
|
---|
2224 | }
|
---|
2225 |
|
---|
2226 | RTMemFree(pSvgaDXContext);
|
---|
2227 | pSvgaDXContext = NULL;
|
---|
2228 | }
|
---|
2229 | }
|
---|
2230 |
|
---|
2231 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
2232 | {
|
---|
2233 | /* Bind a new context. Copy existing data from the guest backing memory. */
|
---|
2234 | if (pCmd->validContents)
|
---|
2235 | {
|
---|
2236 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
2237 | if (pMob)
|
---|
2238 | {
|
---|
2239 | pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2240 | if (pSvgaDXContext)
|
---|
2241 | {
|
---|
2242 | rc = vmsvgaR3GboRead(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2243 | if (RT_FAILURE(rc))
|
---|
2244 | {
|
---|
2245 | RTMemFree(pSvgaDXContext);
|
---|
2246 | pSvgaDXContext = NULL;
|
---|
2247 | }
|
---|
2248 | }
|
---|
2249 | }
|
---|
2250 | }
|
---|
2251 |
|
---|
2252 | rc = vmsvga3dDXBindContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2253 |
|
---|
2254 | RTMemFree(pSvgaDXContext);
|
---|
2255 | }
|
---|
2256 |
|
---|
2257 | /* Update the object table. */
|
---|
2258 | entry.mobid = pCmd->mobid;
|
---|
2259 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2260 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2261 | }
|
---|
2262 | }
|
---|
2263 |
|
---|
2264 | return rc;
|
---|
2265 | #else
|
---|
2266 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2267 | return VERR_NOT_SUPPORTED;
|
---|
2268 | #endif
|
---|
2269 | }
|
---|
2270 |
|
---|
2271 |
|
---|
2272 | /* SVGA_3D_CMD_DX_READBACK_CONTEXT 1146 */
|
---|
2273 | static int vmsvga3dCmdDXReadbackContext(PVGASTATECC pThisCC, SVGA3dCmdDXReadbackContext const *pCmd, uint32_t cbCmd)
|
---|
2274 | {
|
---|
2275 | #ifdef VMSVGA3D_DX
|
---|
2276 | //DEBUG_BREAKPOINT_TEST();
|
---|
2277 | RT_NOREF(cbCmd);
|
---|
2278 |
|
---|
2279 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2280 |
|
---|
2281 | /* "Request that the device flush the contents back into guest memory." */
|
---|
2282 | SVGAOTableDXContextEntry entry;
|
---|
2283 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2284 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2285 | if (RT_SUCCESS(rc))
|
---|
2286 | {
|
---|
2287 | if (entry.mobid != SVGA_ID_INVALID)
|
---|
2288 | {
|
---|
2289 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entry.mobid);
|
---|
2290 | if (pMob)
|
---|
2291 | {
|
---|
2292 | /* Get the content. */
|
---|
2293 | SVGADXContextMobFormat *pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2294 | if (pSvgaDXContext)
|
---|
2295 | {
|
---|
2296 | rc = vmsvga3dDXReadbackContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2297 | if (RT_SUCCESS(rc))
|
---|
2298 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2299 |
|
---|
2300 | RTMemFree(pSvgaDXContext);
|
---|
2301 | }
|
---|
2302 | else
|
---|
2303 | rc = VERR_NO_MEMORY;
|
---|
2304 | }
|
---|
2305 | }
|
---|
2306 | }
|
---|
2307 |
|
---|
2308 | return rc;
|
---|
2309 | #else
|
---|
2310 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2311 | return VERR_NOT_SUPPORTED;
|
---|
2312 | #endif
|
---|
2313 | }
|
---|
2314 |
|
---|
2315 |
|
---|
2316 | /* SVGA_3D_CMD_DX_INVALIDATE_CONTEXT 1147 */
|
---|
2317 | static int vmsvga3dCmdDXInvalidateContext(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXInvalidateContext const *pCmd, uint32_t cbCmd)
|
---|
2318 | {
|
---|
2319 | #ifdef VMSVGA3D_DX
|
---|
2320 | DEBUG_BREAKPOINT_TEST();
|
---|
2321 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2322 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
2323 | return vmsvga3dDXInvalidateContext(pThisCC, idDXContext);
|
---|
2324 | #else
|
---|
2325 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2326 | return VERR_NOT_SUPPORTED;
|
---|
2327 | #endif
|
---|
2328 | }
|
---|
2329 |
|
---|
2330 |
|
---|
2331 | /* SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER 1148 */
|
---|
2332 | static int vmsvga3dCmdDXSetSingleConstantBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSingleConstantBuffer const *pCmd, uint32_t cbCmd)
|
---|
2333 | {
|
---|
2334 | #ifdef VMSVGA3D_DX
|
---|
2335 | //DEBUG_BREAKPOINT_TEST();
|
---|
2336 | RT_NOREF(cbCmd);
|
---|
2337 | return vmsvga3dDXSetSingleConstantBuffer(pThisCC, idDXContext, pCmd);
|
---|
2338 | #else
|
---|
2339 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2340 | return VERR_NOT_SUPPORTED;
|
---|
2341 | #endif
|
---|
2342 | }
|
---|
2343 |
|
---|
2344 |
|
---|
2345 | /* SVGA_3D_CMD_DX_SET_SHADER_RESOURCES 1149 */
|
---|
2346 | static int vmsvga3dCmdDXSetShaderResources(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShaderResources const *pCmd, uint32_t cbCmd)
|
---|
2347 | {
|
---|
2348 | #ifdef VMSVGA3D_DX
|
---|
2349 | //DEBUG_BREAKPOINT_TEST();
|
---|
2350 | SVGA3dShaderResourceViewId const *paShaderResourceViewId = (SVGA3dShaderResourceViewId *)&pCmd[1];
|
---|
2351 | uint32_t const cShaderResourceViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dShaderResourceViewId);
|
---|
2352 | return vmsvga3dDXSetShaderResources(pThisCC, idDXContext, pCmd, cShaderResourceViewId, paShaderResourceViewId);
|
---|
2353 | #else
|
---|
2354 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2355 | return VERR_NOT_SUPPORTED;
|
---|
2356 | #endif
|
---|
2357 | }
|
---|
2358 |
|
---|
2359 |
|
---|
2360 | /* SVGA_3D_CMD_DX_SET_SHADER 1150 */
|
---|
2361 | static int vmsvga3dCmdDXSetShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShader const *pCmd, uint32_t cbCmd)
|
---|
2362 | {
|
---|
2363 | #ifdef VMSVGA3D_DX
|
---|
2364 | //DEBUG_BREAKPOINT_TEST();
|
---|
2365 | RT_NOREF(cbCmd);
|
---|
2366 | return vmsvga3dDXSetShader(pThisCC, idDXContext, pCmd);
|
---|
2367 | #else
|
---|
2368 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2369 | return VERR_NOT_SUPPORTED;
|
---|
2370 | #endif
|
---|
2371 | }
|
---|
2372 |
|
---|
2373 |
|
---|
2374 | /* SVGA_3D_CMD_DX_SET_SAMPLERS 1151 */
|
---|
2375 | static int vmsvga3dCmdDXSetSamplers(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSamplers const *pCmd, uint32_t cbCmd)
|
---|
2376 | {
|
---|
2377 | #ifdef VMSVGA3D_DX
|
---|
2378 | //DEBUG_BREAKPOINT_TEST();
|
---|
2379 | SVGA3dSamplerId const *paSamplerId = (SVGA3dSamplerId *)&pCmd[1];
|
---|
2380 | uint32_t const cSamplerId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSamplerId);
|
---|
2381 | return vmsvga3dDXSetSamplers(pThisCC, idDXContext, pCmd, cSamplerId, paSamplerId);
|
---|
2382 | #else
|
---|
2383 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2384 | return VERR_NOT_SUPPORTED;
|
---|
2385 | #endif
|
---|
2386 | }
|
---|
2387 |
|
---|
2388 |
|
---|
2389 | /* SVGA_3D_CMD_DX_DRAW 1152 */
|
---|
2390 | static int vmsvga3dCmdDXDraw(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDraw const *pCmd, uint32_t cbCmd)
|
---|
2391 | {
|
---|
2392 | #ifdef VMSVGA3D_DX
|
---|
2393 | //DEBUG_BREAKPOINT_TEST();
|
---|
2394 | RT_NOREF(cbCmd);
|
---|
2395 | return vmsvga3dDXDraw(pThisCC, idDXContext, pCmd);
|
---|
2396 | #else
|
---|
2397 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2398 | return VERR_NOT_SUPPORTED;
|
---|
2399 | #endif
|
---|
2400 | }
|
---|
2401 |
|
---|
2402 |
|
---|
2403 | /* SVGA_3D_CMD_DX_DRAW_INDEXED 1153 */
|
---|
2404 | static int vmsvga3dCmdDXDrawIndexed(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexed const *pCmd, uint32_t cbCmd)
|
---|
2405 | {
|
---|
2406 | #ifdef VMSVGA3D_DX
|
---|
2407 | //DEBUG_BREAKPOINT_TEST();
|
---|
2408 | RT_NOREF(cbCmd);
|
---|
2409 | return vmsvga3dDXDrawIndexed(pThisCC, idDXContext, pCmd);
|
---|
2410 | #else
|
---|
2411 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2412 | return VERR_NOT_SUPPORTED;
|
---|
2413 | #endif
|
---|
2414 | }
|
---|
2415 |
|
---|
2416 |
|
---|
2417 | /* SVGA_3D_CMD_DX_DRAW_INSTANCED 1154 */
|
---|
2418 | static int vmsvga3dCmdDXDrawInstanced(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawInstanced const *pCmd, uint32_t cbCmd)
|
---|
2419 | {
|
---|
2420 | #ifdef VMSVGA3D_DX
|
---|
2421 | //DEBUG_BREAKPOINT_TEST();
|
---|
2422 | RT_NOREF(cbCmd);
|
---|
2423 | return vmsvga3dDXDrawInstanced(pThisCC, idDXContext, pCmd);
|
---|
2424 | #else
|
---|
2425 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2426 | return VERR_NOT_SUPPORTED;
|
---|
2427 | #endif
|
---|
2428 | }
|
---|
2429 |
|
---|
2430 |
|
---|
2431 | /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED 1155 */
|
---|
2432 | static int vmsvga3dCmdDXDrawIndexedInstanced(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexedInstanced const *pCmd, uint32_t cbCmd)
|
---|
2433 | {
|
---|
2434 | #ifdef VMSVGA3D_DX
|
---|
2435 | //DEBUG_BREAKPOINT_TEST();
|
---|
2436 | RT_NOREF(cbCmd);
|
---|
2437 | return vmsvga3dDXDrawIndexedInstanced(pThisCC, idDXContext, pCmd);
|
---|
2438 | #else
|
---|
2439 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2440 | return VERR_NOT_SUPPORTED;
|
---|
2441 | #endif
|
---|
2442 | }
|
---|
2443 |
|
---|
2444 |
|
---|
2445 | /* SVGA_3D_CMD_DX_DRAW_AUTO 1156 */
|
---|
2446 | static int vmsvga3dCmdDXDrawAuto(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawAuto const *pCmd, uint32_t cbCmd)
|
---|
2447 | {
|
---|
2448 | #ifdef VMSVGA3D_DX
|
---|
2449 | //DEBUG_BREAKPOINT_TEST();
|
---|
2450 | RT_NOREF(pCmd, cbCmd);
|
---|
2451 | return vmsvga3dDXDrawAuto(pThisCC, idDXContext);
|
---|
2452 | #else
|
---|
2453 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2454 | return VERR_NOT_SUPPORTED;
|
---|
2455 | #endif
|
---|
2456 | }
|
---|
2457 |
|
---|
2458 |
|
---|
2459 | /* SVGA_3D_CMD_DX_SET_INPUT_LAYOUT 1157 */
|
---|
2460 | static int vmsvga3dCmdDXSetInputLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetInputLayout const *pCmd, uint32_t cbCmd)
|
---|
2461 | {
|
---|
2462 | #ifdef VMSVGA3D_DX
|
---|
2463 | //DEBUG_BREAKPOINT_TEST();
|
---|
2464 | RT_NOREF(cbCmd);
|
---|
2465 | return vmsvga3dDXSetInputLayout(pThisCC, idDXContext, pCmd->elementLayoutId);
|
---|
2466 | #else
|
---|
2467 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2468 | return VERR_NOT_SUPPORTED;
|
---|
2469 | #endif
|
---|
2470 | }
|
---|
2471 |
|
---|
2472 |
|
---|
2473 | /* SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS 1158 */
|
---|
2474 | static int vmsvga3dCmdDXSetVertexBuffers(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetVertexBuffers const *pCmd, uint32_t cbCmd)
|
---|
2475 | {
|
---|
2476 | #ifdef VMSVGA3D_DX
|
---|
2477 | //DEBUG_BREAKPOINT_TEST();
|
---|
2478 | SVGA3dVertexBuffer const *paVertexBuffer = (SVGA3dVertexBuffer *)&pCmd[1];
|
---|
2479 | uint32_t const cVertexBuffer = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dVertexBuffer);
|
---|
2480 | return vmsvga3dDXSetVertexBuffers(pThisCC, idDXContext, pCmd->startBuffer, cVertexBuffer, paVertexBuffer);
|
---|
2481 | #else
|
---|
2482 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2483 | return VERR_NOT_SUPPORTED;
|
---|
2484 | #endif
|
---|
2485 | }
|
---|
2486 |
|
---|
2487 |
|
---|
2488 | /* SVGA_3D_CMD_DX_SET_INDEX_BUFFER 1159 */
|
---|
2489 | static int vmsvga3dCmdDXSetIndexBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetIndexBuffer const *pCmd, uint32_t cbCmd)
|
---|
2490 | {
|
---|
2491 | #ifdef VMSVGA3D_DX
|
---|
2492 | //DEBUG_BREAKPOINT_TEST();
|
---|
2493 | RT_NOREF(cbCmd);
|
---|
2494 | return vmsvga3dDXSetIndexBuffer(pThisCC, idDXContext, pCmd);
|
---|
2495 | #else
|
---|
2496 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2497 | return VERR_NOT_SUPPORTED;
|
---|
2498 | #endif
|
---|
2499 | }
|
---|
2500 |
|
---|
2501 |
|
---|
2502 | /* SVGA_3D_CMD_DX_SET_TOPOLOGY 1160 */
|
---|
2503 | static int vmsvga3dCmdDXSetTopology(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetTopology const *pCmd, uint32_t cbCmd)
|
---|
2504 | {
|
---|
2505 | #ifdef VMSVGA3D_DX
|
---|
2506 | //DEBUG_BREAKPOINT_TEST();
|
---|
2507 | RT_NOREF(cbCmd);
|
---|
2508 | return vmsvga3dDXSetTopology(pThisCC, idDXContext, pCmd->topology);
|
---|
2509 | #else
|
---|
2510 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2511 | return VERR_NOT_SUPPORTED;
|
---|
2512 | #endif
|
---|
2513 | }
|
---|
2514 |
|
---|
2515 |
|
---|
2516 | /* SVGA_3D_CMD_DX_SET_RENDERTARGETS 1161 */
|
---|
2517 | static int vmsvga3dCmdDXSetRenderTargets(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetRenderTargets const *pCmd, uint32_t cbCmd)
|
---|
2518 | {
|
---|
2519 | #ifdef VMSVGA3D_DX
|
---|
2520 | //DEBUG_BREAKPOINT_TEST();
|
---|
2521 | SVGA3dRenderTargetViewId const *paRenderTargetViewId = (SVGA3dRenderTargetViewId *)&pCmd[1];
|
---|
2522 | uint32_t const cRenderTargetViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRenderTargetViewId);
|
---|
2523 | return vmsvga3dDXSetRenderTargets(pThisCC, idDXContext, pCmd->depthStencilViewId, cRenderTargetViewId, paRenderTargetViewId);
|
---|
2524 | #else
|
---|
2525 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2526 | return VERR_NOT_SUPPORTED;
|
---|
2527 | #endif
|
---|
2528 | }
|
---|
2529 |
|
---|
2530 |
|
---|
2531 | /* SVGA_3D_CMD_DX_SET_BLEND_STATE 1162 */
|
---|
2532 | static int vmsvga3dCmdDXSetBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetBlendState const *pCmd, uint32_t cbCmd)
|
---|
2533 | {
|
---|
2534 | #ifdef VMSVGA3D_DX
|
---|
2535 | //DEBUG_BREAKPOINT_TEST();
|
---|
2536 | RT_NOREF(cbCmd);
|
---|
2537 | return vmsvga3dDXSetBlendState(pThisCC, idDXContext, pCmd);
|
---|
2538 | #else
|
---|
2539 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2540 | return VERR_NOT_SUPPORTED;
|
---|
2541 | #endif
|
---|
2542 | }
|
---|
2543 |
|
---|
2544 |
|
---|
2545 | /* SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE 1163 */
|
---|
2546 | static int vmsvga3dCmdDXSetDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
2547 | {
|
---|
2548 | #ifdef VMSVGA3D_DX
|
---|
2549 | //DEBUG_BREAKPOINT_TEST();
|
---|
2550 | RT_NOREF(cbCmd);
|
---|
2551 | return vmsvga3dDXSetDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
2552 | #else
|
---|
2553 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2554 | return VERR_NOT_SUPPORTED;
|
---|
2555 | #endif
|
---|
2556 | }
|
---|
2557 |
|
---|
2558 |
|
---|
2559 | /* SVGA_3D_CMD_DX_SET_RASTERIZER_STATE 1164 */
|
---|
2560 | static int vmsvga3dCmdDXSetRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
2561 | {
|
---|
2562 | #ifdef VMSVGA3D_DX
|
---|
2563 | //DEBUG_BREAKPOINT_TEST();
|
---|
2564 | RT_NOREF(cbCmd);
|
---|
2565 | return vmsvga3dDXSetRasterizerState(pThisCC, idDXContext, pCmd->rasterizerId);
|
---|
2566 | #else
|
---|
2567 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2568 | return VERR_NOT_SUPPORTED;
|
---|
2569 | #endif
|
---|
2570 | }
|
---|
2571 |
|
---|
2572 |
|
---|
2573 | /* SVGA_3D_CMD_DX_DEFINE_QUERY 1165 */
|
---|
2574 | static int vmsvga3dCmdDXDefineQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineQuery const *pCmd, uint32_t cbCmd)
|
---|
2575 | {
|
---|
2576 | #ifdef VMSVGA3D_DX
|
---|
2577 | //DEBUG_BREAKPOINT_TEST();
|
---|
2578 | RT_NOREF(cbCmd);
|
---|
2579 | return vmsvga3dDXDefineQuery(pThisCC, idDXContext, pCmd);
|
---|
2580 | #else
|
---|
2581 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2582 | return VERR_NOT_SUPPORTED;
|
---|
2583 | #endif
|
---|
2584 | }
|
---|
2585 |
|
---|
2586 |
|
---|
2587 | /* SVGA_3D_CMD_DX_DESTROY_QUERY 1166 */
|
---|
2588 | static int vmsvga3dCmdDXDestroyQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyQuery const *pCmd, uint32_t cbCmd)
|
---|
2589 | {
|
---|
2590 | #ifdef VMSVGA3D_DX
|
---|
2591 | //DEBUG_BREAKPOINT_TEST();
|
---|
2592 | RT_NOREF(cbCmd);
|
---|
2593 | return vmsvga3dDXDestroyQuery(pThisCC, idDXContext, pCmd);
|
---|
2594 | #else
|
---|
2595 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2596 | return VERR_NOT_SUPPORTED;
|
---|
2597 | #endif
|
---|
2598 | }
|
---|
2599 |
|
---|
2600 |
|
---|
2601 | /* SVGA_3D_CMD_DX_BIND_QUERY 1167 */
|
---|
2602 | static int vmsvga3dCmdDXBindQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindQuery const *pCmd, uint32_t cbCmd)
|
---|
2603 | {
|
---|
2604 | #ifdef VMSVGA3D_DX
|
---|
2605 | //DEBUG_BREAKPOINT_TEST();
|
---|
2606 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2607 | RT_NOREF(cbCmd);
|
---|
2608 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
2609 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
2610 | return vmsvga3dDXBindQuery(pThisCC, idDXContext, pCmd, pMob);
|
---|
2611 | #else
|
---|
2612 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2613 | return VERR_NOT_SUPPORTED;
|
---|
2614 | #endif
|
---|
2615 | }
|
---|
2616 |
|
---|
2617 |
|
---|
2618 | /* SVGA_3D_CMD_DX_SET_QUERY_OFFSET 1168 */
|
---|
2619 | static int vmsvga3dCmdDXSetQueryOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetQueryOffset const *pCmd, uint32_t cbCmd)
|
---|
2620 | {
|
---|
2621 | #ifdef VMSVGA3D_DX
|
---|
2622 | //DEBUG_BREAKPOINT_TEST();
|
---|
2623 | RT_NOREF(cbCmd);
|
---|
2624 | return vmsvga3dDXSetQueryOffset(pThisCC, idDXContext, pCmd);
|
---|
2625 | #else
|
---|
2626 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2627 | return VERR_NOT_SUPPORTED;
|
---|
2628 | #endif
|
---|
2629 | }
|
---|
2630 |
|
---|
2631 |
|
---|
2632 | /* SVGA_3D_CMD_DX_BEGIN_QUERY 1169 */
|
---|
2633 | static int vmsvga3dCmdDXBeginQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBeginQuery const *pCmd, uint32_t cbCmd)
|
---|
2634 | {
|
---|
2635 | #ifdef VMSVGA3D_DX
|
---|
2636 | //DEBUG_BREAKPOINT_TEST();
|
---|
2637 | RT_NOREF(cbCmd);
|
---|
2638 | return vmsvga3dDXBeginQuery(pThisCC, idDXContext, pCmd);
|
---|
2639 | #else
|
---|
2640 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2641 | return VERR_NOT_SUPPORTED;
|
---|
2642 | #endif
|
---|
2643 | }
|
---|
2644 |
|
---|
2645 |
|
---|
2646 | /* SVGA_3D_CMD_DX_END_QUERY 1170 */
|
---|
2647 | static int vmsvga3dCmdDXEndQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXEndQuery const *pCmd, uint32_t cbCmd)
|
---|
2648 | {
|
---|
2649 | #ifdef VMSVGA3D_DX
|
---|
2650 | //DEBUG_BREAKPOINT_TEST();
|
---|
2651 | RT_NOREF(cbCmd);
|
---|
2652 | return vmsvga3dDXEndQuery(pThisCC, idDXContext, pCmd);
|
---|
2653 | #else
|
---|
2654 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2655 | return VERR_NOT_SUPPORTED;
|
---|
2656 | #endif
|
---|
2657 | }
|
---|
2658 |
|
---|
2659 |
|
---|
2660 | /* SVGA_3D_CMD_DX_READBACK_QUERY 1171 */
|
---|
2661 | static int vmsvga3dCmdDXReadbackQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackQuery const *pCmd, uint32_t cbCmd)
|
---|
2662 | {
|
---|
2663 | #ifdef VMSVGA3D_DX
|
---|
2664 | //DEBUG_BREAKPOINT_TEST();
|
---|
2665 | RT_NOREF(cbCmd);
|
---|
2666 | return vmsvga3dDXReadbackQuery(pThisCC, idDXContext, pCmd);
|
---|
2667 | #else
|
---|
2668 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2669 | return VERR_NOT_SUPPORTED;
|
---|
2670 | #endif
|
---|
2671 | }
|
---|
2672 |
|
---|
2673 |
|
---|
2674 | /* SVGA_3D_CMD_DX_SET_PREDICATION 1172 */
|
---|
2675 | static int vmsvga3dCmdDXSetPredication(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetPredication const *pCmd, uint32_t cbCmd)
|
---|
2676 | {
|
---|
2677 | #ifdef VMSVGA3D_DX
|
---|
2678 | //DEBUG_BREAKPOINT_TEST();
|
---|
2679 | RT_NOREF(cbCmd);
|
---|
2680 | return vmsvga3dDXSetPredication(pThisCC, idDXContext, pCmd);
|
---|
2681 | #else
|
---|
2682 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2683 | return VERR_NOT_SUPPORTED;
|
---|
2684 | #endif
|
---|
2685 | }
|
---|
2686 |
|
---|
2687 |
|
---|
2688 | /* SVGA_3D_CMD_DX_SET_SOTARGETS 1173 */
|
---|
2689 | static int vmsvga3dCmdDXSetSOTargets(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSOTargets const *pCmd, uint32_t cbCmd)
|
---|
2690 | {
|
---|
2691 | #ifdef VMSVGA3D_DX
|
---|
2692 | //DEBUG_BREAKPOINT_TEST();
|
---|
2693 | SVGA3dSoTarget const *paSoTarget = (SVGA3dSoTarget *)&pCmd[1];
|
---|
2694 | uint32_t const cSoTarget = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSoTarget);
|
---|
2695 | return vmsvga3dDXSetSOTargets(pThisCC, idDXContext, cSoTarget, paSoTarget);
|
---|
2696 | #else
|
---|
2697 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2698 | return VERR_NOT_SUPPORTED;
|
---|
2699 | #endif
|
---|
2700 | }
|
---|
2701 |
|
---|
2702 |
|
---|
2703 | /* SVGA_3D_CMD_DX_SET_VIEWPORTS 1174 */
|
---|
2704 | static int vmsvga3dCmdDXSetViewports(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetViewports const *pCmd, uint32_t cbCmd)
|
---|
2705 | {
|
---|
2706 | #ifdef VMSVGA3D_DX
|
---|
2707 | //DEBUG_BREAKPOINT_TEST();
|
---|
2708 | SVGA3dViewport const *paViewport = (SVGA3dViewport *)&pCmd[1];
|
---|
2709 | uint32_t const cViewport = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dViewport);
|
---|
2710 | return vmsvga3dDXSetViewports(pThisCC, idDXContext, cViewport, paViewport);
|
---|
2711 | #else
|
---|
2712 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2713 | return VERR_NOT_SUPPORTED;
|
---|
2714 | #endif
|
---|
2715 | }
|
---|
2716 |
|
---|
2717 |
|
---|
2718 | /* SVGA_3D_CMD_DX_SET_SCISSORRECTS 1175 */
|
---|
2719 | static int vmsvga3dCmdDXSetScissorRects(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetScissorRects const *pCmd, uint32_t cbCmd)
|
---|
2720 | {
|
---|
2721 | #ifdef VMSVGA3D_DX
|
---|
2722 | //DEBUG_BREAKPOINT_TEST();
|
---|
2723 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
2724 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
2725 | return vmsvga3dDXSetScissorRects(pThisCC, idDXContext, cRect, paRect);
|
---|
2726 | #else
|
---|
2727 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2728 | return VERR_NOT_SUPPORTED;
|
---|
2729 | #endif
|
---|
2730 | }
|
---|
2731 |
|
---|
2732 |
|
---|
2733 | /* SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW 1176 */
|
---|
2734 | static int vmsvga3dCmdDXClearRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2735 | {
|
---|
2736 | #ifdef VMSVGA3D_DX
|
---|
2737 | //DEBUG_BREAKPOINT_TEST();
|
---|
2738 | RT_NOREF(cbCmd);
|
---|
2739 | return vmsvga3dDXClearRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2740 | #else
|
---|
2741 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2742 | return VERR_NOT_SUPPORTED;
|
---|
2743 | #endif
|
---|
2744 | }
|
---|
2745 |
|
---|
2746 |
|
---|
2747 | /* SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW 1177 */
|
---|
2748 | static int vmsvga3dCmdDXClearDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
2749 | {
|
---|
2750 | #ifdef VMSVGA3D_DX
|
---|
2751 | //DEBUG_BREAKPOINT_TEST();
|
---|
2752 | RT_NOREF(cbCmd);
|
---|
2753 | return vmsvga3dDXClearDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
2754 | #else
|
---|
2755 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2756 | return VERR_NOT_SUPPORTED;
|
---|
2757 | #endif
|
---|
2758 | }
|
---|
2759 |
|
---|
2760 |
|
---|
2761 | /* SVGA_3D_CMD_DX_PRED_COPY_REGION 1178 */
|
---|
2762 | static int vmsvga3dCmdDXPredCopyRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopyRegion const *pCmd, uint32_t cbCmd)
|
---|
2763 | {
|
---|
2764 | #ifdef VMSVGA3D_DX
|
---|
2765 | //DEBUG_BREAKPOINT_TEST();
|
---|
2766 | RT_NOREF(cbCmd);
|
---|
2767 | return vmsvga3dDXPredCopyRegion(pThisCC, idDXContext, pCmd);
|
---|
2768 | #else
|
---|
2769 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2770 | return VERR_NOT_SUPPORTED;
|
---|
2771 | #endif
|
---|
2772 | }
|
---|
2773 |
|
---|
2774 |
|
---|
2775 | /* SVGA_3D_CMD_DX_PRED_COPY 1179 */
|
---|
2776 | static int vmsvga3dCmdDXPredCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopy const *pCmd, uint32_t cbCmd)
|
---|
2777 | {
|
---|
2778 | #ifdef VMSVGA3D_DX
|
---|
2779 | //DEBUG_BREAKPOINT_TEST();
|
---|
2780 | RT_NOREF(cbCmd);
|
---|
2781 | return vmsvga3dDXPredCopy(pThisCC, idDXContext, pCmd);
|
---|
2782 | #else
|
---|
2783 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2784 | return VERR_NOT_SUPPORTED;
|
---|
2785 | #endif
|
---|
2786 | }
|
---|
2787 |
|
---|
2788 |
|
---|
2789 | /* SVGA_3D_CMD_DX_PRESENTBLT 1180 */
|
---|
2790 | static int vmsvga3dCmdDXPresentBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPresentBlt const *pCmd, uint32_t cbCmd)
|
---|
2791 | {
|
---|
2792 | #ifdef VMSVGA3D_DX
|
---|
2793 | //DEBUG_BREAKPOINT_TEST();
|
---|
2794 | RT_NOREF(cbCmd);
|
---|
2795 | return vmsvga3dDXPresentBlt(pThisCC, idDXContext, pCmd);
|
---|
2796 | #else
|
---|
2797 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2798 | return VERR_NOT_SUPPORTED;
|
---|
2799 | #endif
|
---|
2800 | }
|
---|
2801 |
|
---|
2802 |
|
---|
2803 | /* SVGA_3D_CMD_DX_GENMIPS 1181 */
|
---|
2804 | static int vmsvga3dCmdDXGenMips(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXGenMips const *pCmd, uint32_t cbCmd)
|
---|
2805 | {
|
---|
2806 | #ifdef VMSVGA3D_DX
|
---|
2807 | //DEBUG_BREAKPOINT_TEST();
|
---|
2808 | RT_NOREF(cbCmd);
|
---|
2809 | return vmsvga3dDXGenMips(pThisCC, idDXContext, pCmd);
|
---|
2810 | #else
|
---|
2811 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2812 | return VERR_NOT_SUPPORTED;
|
---|
2813 | #endif
|
---|
2814 | }
|
---|
2815 |
|
---|
2816 |
|
---|
2817 | /* SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE 1182 */
|
---|
2818 | static int vmsvga3dCmdDXUpdateSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXUpdateSubResource const *pCmd, uint32_t cbCmd)
|
---|
2819 | {
|
---|
2820 | #ifdef VMSVGA3D_DX
|
---|
2821 | //DEBUG_BREAKPOINT_TEST();
|
---|
2822 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2823 | RT_NOREF(cbCmd);
|
---|
2824 |
|
---|
2825 | LogFlowFunc(("sid=%u, subResource=%u, box=%d,%d,%d %ux%ux%u\n",
|
---|
2826 | pCmd->sid, pCmd->subResource, pCmd->box.x, pCmd->box.y, pCmd->box.z, pCmd->box.w, pCmd->box.h, pCmd->box.d));
|
---|
2827 |
|
---|
2828 | /* "Inform the device that the guest-contents have been updated." */
|
---|
2829 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2830 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2831 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2832 | if (RT_SUCCESS(rc))
|
---|
2833 | {
|
---|
2834 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
2835 | if (pMob)
|
---|
2836 | {
|
---|
2837 | uint32 const cSubresource = vmsvga3dGetSubresourceCount(pThisCC, pCmd->sid);
|
---|
2838 | ASSERT_GUEST_RETURN(pCmd->subResource < cSubresource, VERR_INVALID_PARAMETER);
|
---|
2839 | /* pCmd->box will be verified by the mapping function. */
|
---|
2840 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2841 |
|
---|
2842 | /** @todo Mapping functions should use subresource index rather than SVGA3dSurfaceImageId? */
|
---|
2843 | SVGA3dSurfaceImageId image;
|
---|
2844 | image.sid = pCmd->sid;
|
---|
2845 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &image.mipmap, &image.face);
|
---|
2846 |
|
---|
2847 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, &pCmd->box, SVGA3D_WRITE_HOST_VRAM);
|
---|
2848 | AssertRC(rc);
|
---|
2849 | }
|
---|
2850 | }
|
---|
2851 |
|
---|
2852 | return rc;
|
---|
2853 | #else
|
---|
2854 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2855 | return VERR_NOT_SUPPORTED;
|
---|
2856 | #endif
|
---|
2857 | }
|
---|
2858 |
|
---|
2859 |
|
---|
2860 | /* SVGA_3D_CMD_DX_READBACK_SUBRESOURCE 1183 */
|
---|
2861 | static int vmsvga3dCmdDXReadbackSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXReadbackSubResource const *pCmd, uint32_t cbCmd)
|
---|
2862 | {
|
---|
2863 | #ifdef VMSVGA3D_DX
|
---|
2864 | //DEBUG_BREAKPOINT_TEST();
|
---|
2865 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2866 | RT_NOREF(cbCmd);
|
---|
2867 |
|
---|
2868 | LogFlowFunc(("sid=%u, subResource=%u\n",
|
---|
2869 | pCmd->sid, pCmd->subResource));
|
---|
2870 |
|
---|
2871 | /* "Request the device to flush the dirty contents into the guest." */
|
---|
2872 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2873 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2874 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2875 | if (RT_SUCCESS(rc))
|
---|
2876 | {
|
---|
2877 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
2878 | if (pMob)
|
---|
2879 | {
|
---|
2880 | uint32 const cSubresource = vmsvga3dGetSubresourceCount(pThisCC, pCmd->sid);
|
---|
2881 | ASSERT_GUEST_RETURN(pCmd->subResource < cSubresource, VERR_INVALID_PARAMETER);
|
---|
2882 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2883 |
|
---|
2884 | /** @todo Mapping functions should use subresource index rather than SVGA3dSurfaceImageId? */
|
---|
2885 | SVGA3dSurfaceImageId image;
|
---|
2886 | image.sid = pCmd->sid;
|
---|
2887 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &image.mipmap, &image.face);
|
---|
2888 |
|
---|
2889 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
2890 | AssertRC(rc);
|
---|
2891 | }
|
---|
2892 | }
|
---|
2893 |
|
---|
2894 | return rc;
|
---|
2895 | #else
|
---|
2896 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2897 | return VERR_NOT_SUPPORTED;
|
---|
2898 | #endif
|
---|
2899 | }
|
---|
2900 |
|
---|
2901 |
|
---|
2902 | /* SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE 1184 */
|
---|
2903 | static int vmsvga3dCmdDXInvalidateSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXInvalidateSubResource const *pCmd, uint32_t cbCmd)
|
---|
2904 | {
|
---|
2905 | #ifdef VMSVGA3D_DX
|
---|
2906 | DEBUG_BREAKPOINT_TEST();
|
---|
2907 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2908 | RT_NOREF(cbCmd);
|
---|
2909 |
|
---|
2910 | LogFlowFunc(("sid=%u, subResource=%u\n",
|
---|
2911 | pCmd->sid, pCmd->subResource));
|
---|
2912 |
|
---|
2913 | /* "Notify the device that the contents can be lost." */
|
---|
2914 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2915 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2916 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2917 | if (RT_SUCCESS(rc))
|
---|
2918 | {
|
---|
2919 | uint32_t iFace;
|
---|
2920 | uint32_t iMipmap;
|
---|
2921 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &iMipmap, &iFace);
|
---|
2922 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->sid, iFace, iMipmap);
|
---|
2923 | }
|
---|
2924 |
|
---|
2925 | return rc;
|
---|
2926 | #else
|
---|
2927 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2928 | return VERR_NOT_SUPPORTED;
|
---|
2929 | #endif
|
---|
2930 | }
|
---|
2931 |
|
---|
2932 |
|
---|
2933 | /* SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW 1185 */
|
---|
2934 | static int vmsvga3dCmdDXDefineShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShaderResourceView const *pCmd, uint32_t cbCmd)
|
---|
2935 | {
|
---|
2936 | #ifdef VMSVGA3D_DX
|
---|
2937 | //DEBUG_BREAKPOINT_TEST();
|
---|
2938 | RT_NOREF(cbCmd);
|
---|
2939 | return vmsvga3dDXDefineShaderResourceView(pThisCC, idDXContext, pCmd);
|
---|
2940 | #else
|
---|
2941 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2942 | return VERR_NOT_SUPPORTED;
|
---|
2943 | #endif
|
---|
2944 | }
|
---|
2945 |
|
---|
2946 |
|
---|
2947 | /* SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW 1186 */
|
---|
2948 | static int vmsvga3dCmdDXDestroyShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShaderResourceView const *pCmd, uint32_t cbCmd)
|
---|
2949 | {
|
---|
2950 | #ifdef VMSVGA3D_DX
|
---|
2951 | //DEBUG_BREAKPOINT_TEST();
|
---|
2952 | RT_NOREF(cbCmd);
|
---|
2953 | return vmsvga3dDXDestroyShaderResourceView(pThisCC, idDXContext, pCmd);
|
---|
2954 | #else
|
---|
2955 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2956 | return VERR_NOT_SUPPORTED;
|
---|
2957 | #endif
|
---|
2958 | }
|
---|
2959 |
|
---|
2960 |
|
---|
2961 | /* SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW 1187 */
|
---|
2962 | static int vmsvga3dCmdDXDefineRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2963 | {
|
---|
2964 | #ifdef VMSVGA3D_DX
|
---|
2965 | //DEBUG_BREAKPOINT_TEST();
|
---|
2966 | RT_NOREF(cbCmd);
|
---|
2967 | return vmsvga3dDXDefineRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2968 | #else
|
---|
2969 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2970 | return VERR_NOT_SUPPORTED;
|
---|
2971 | #endif
|
---|
2972 | }
|
---|
2973 |
|
---|
2974 |
|
---|
2975 | /* SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW 1188 */
|
---|
2976 | static int vmsvga3dCmdDXDestroyRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2977 | {
|
---|
2978 | #ifdef VMSVGA3D_DX
|
---|
2979 | //DEBUG_BREAKPOINT_TEST();
|
---|
2980 | RT_NOREF(cbCmd);
|
---|
2981 | return vmsvga3dDXDestroyRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2982 | #else
|
---|
2983 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2984 | return VERR_NOT_SUPPORTED;
|
---|
2985 | #endif
|
---|
2986 | }
|
---|
2987 |
|
---|
2988 |
|
---|
2989 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW 1189 */
|
---|
2990 | static int vmsvga3dCmdDXDefineDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
2991 | {
|
---|
2992 | #ifdef VMSVGA3D_DX
|
---|
2993 | //DEBUG_BREAKPOINT_TEST();
|
---|
2994 | RT_NOREF(cbCmd);
|
---|
2995 | SVGA3dCmdDXDefineDepthStencilView_v2 cmd;
|
---|
2996 | cmd.depthStencilViewId = pCmd->depthStencilViewId;
|
---|
2997 | cmd.sid = pCmd->sid;
|
---|
2998 | cmd.format = pCmd->format;
|
---|
2999 | cmd.resourceDimension = pCmd->resourceDimension;
|
---|
3000 | cmd.mipSlice = pCmd->mipSlice;
|
---|
3001 | cmd.firstArraySlice = pCmd->firstArraySlice;
|
---|
3002 | cmd.arraySize = pCmd->arraySize;
|
---|
3003 | cmd.flags = 0;
|
---|
3004 | return vmsvga3dDXDefineDepthStencilView(pThisCC, idDXContext, &cmd);
|
---|
3005 | #else
|
---|
3006 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3007 | return VERR_NOT_SUPPORTED;
|
---|
3008 | #endif
|
---|
3009 | }
|
---|
3010 |
|
---|
3011 |
|
---|
3012 | /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW 1190 */
|
---|
3013 | static int vmsvga3dCmdDXDestroyDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
3014 | {
|
---|
3015 | #ifdef VMSVGA3D_DX
|
---|
3016 | //DEBUG_BREAKPOINT_TEST();
|
---|
3017 | RT_NOREF(cbCmd);
|
---|
3018 | return vmsvga3dDXDestroyDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
3019 | #else
|
---|
3020 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3021 | return VERR_NOT_SUPPORTED;
|
---|
3022 | #endif
|
---|
3023 | }
|
---|
3024 |
|
---|
3025 |
|
---|
3026 | /* SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT 1191 */
|
---|
3027 | static int vmsvga3dCmdDXDefineElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineElementLayout const *pCmd, uint32_t cbCmd)
|
---|
3028 | {
|
---|
3029 | #ifdef VMSVGA3D_DX
|
---|
3030 | //DEBUG_BREAKPOINT_TEST();
|
---|
3031 | SVGA3dInputElementDesc const *paDesc = (SVGA3dInputElementDesc *)&pCmd[1];
|
---|
3032 | uint32_t const cDesc = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dInputElementDesc);
|
---|
3033 | return vmsvga3dDXDefineElementLayout(pThisCC, idDXContext, pCmd->elementLayoutId, cDesc, paDesc);
|
---|
3034 | #else
|
---|
3035 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3036 | return VERR_NOT_SUPPORTED;
|
---|
3037 | #endif
|
---|
3038 | }
|
---|
3039 |
|
---|
3040 |
|
---|
3041 | /* SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT 1192 */
|
---|
3042 | static int vmsvga3dCmdDXDestroyElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyElementLayout const *pCmd, uint32_t cbCmd)
|
---|
3043 | {
|
---|
3044 | #ifdef VMSVGA3D_DX
|
---|
3045 | //DEBUG_BREAKPOINT_TEST();
|
---|
3046 | RT_NOREF(cbCmd);
|
---|
3047 | return vmsvga3dDXDestroyElementLayout(pThisCC, idDXContext, pCmd);
|
---|
3048 | #else
|
---|
3049 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3050 | return VERR_NOT_SUPPORTED;
|
---|
3051 | #endif
|
---|
3052 | }
|
---|
3053 |
|
---|
3054 |
|
---|
3055 | /* SVGA_3D_CMD_DX_DEFINE_BLEND_STATE 1193 */
|
---|
3056 | static int vmsvga3dCmdDXDefineBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineBlendState const *pCmd, uint32_t cbCmd)
|
---|
3057 | {
|
---|
3058 | #ifdef VMSVGA3D_DX
|
---|
3059 | //DEBUG_BREAKPOINT_TEST();
|
---|
3060 | RT_NOREF(cbCmd);
|
---|
3061 | return vmsvga3dDXDefineBlendState(pThisCC, idDXContext, pCmd);
|
---|
3062 | #else
|
---|
3063 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3064 | return VERR_NOT_SUPPORTED;
|
---|
3065 | #endif
|
---|
3066 | }
|
---|
3067 |
|
---|
3068 |
|
---|
3069 | /* SVGA_3D_CMD_DX_DESTROY_BLEND_STATE 1194 */
|
---|
3070 | static int vmsvga3dCmdDXDestroyBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyBlendState const *pCmd, uint32_t cbCmd)
|
---|
3071 | {
|
---|
3072 | #ifdef VMSVGA3D_DX
|
---|
3073 | //DEBUG_BREAKPOINT_TEST();
|
---|
3074 | RT_NOREF(cbCmd);
|
---|
3075 | return vmsvga3dDXDestroyBlendState(pThisCC, idDXContext, pCmd);
|
---|
3076 | #else
|
---|
3077 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3078 | return VERR_NOT_SUPPORTED;
|
---|
3079 | #endif
|
---|
3080 | }
|
---|
3081 |
|
---|
3082 |
|
---|
3083 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE 1195 */
|
---|
3084 | static int vmsvga3dCmdDXDefineDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
3085 | {
|
---|
3086 | #ifdef VMSVGA3D_DX
|
---|
3087 | //DEBUG_BREAKPOINT_TEST();
|
---|
3088 | RT_NOREF(cbCmd);
|
---|
3089 | return vmsvga3dDXDefineDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
3090 | #else
|
---|
3091 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3092 | return VERR_NOT_SUPPORTED;
|
---|
3093 | #endif
|
---|
3094 | }
|
---|
3095 |
|
---|
3096 |
|
---|
3097 | /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE 1196 */
|
---|
3098 | static int vmsvga3dCmdDXDestroyDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
3099 | {
|
---|
3100 | #ifdef VMSVGA3D_DX
|
---|
3101 | //DEBUG_BREAKPOINT_TEST();
|
---|
3102 | RT_NOREF(cbCmd);
|
---|
3103 | return vmsvga3dDXDestroyDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
3104 | #else
|
---|
3105 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3106 | return VERR_NOT_SUPPORTED;
|
---|
3107 | #endif
|
---|
3108 | }
|
---|
3109 |
|
---|
3110 |
|
---|
3111 | /* SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE 1197 */
|
---|
3112 | static int vmsvga3dCmdDXDefineRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
3113 | {
|
---|
3114 | #ifdef VMSVGA3D_DX
|
---|
3115 | //DEBUG_BREAKPOINT_TEST();
|
---|
3116 | RT_NOREF(cbCmd);
|
---|
3117 | return vmsvga3dDXDefineRasterizerState(pThisCC, idDXContext, pCmd);
|
---|
3118 | #else
|
---|
3119 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3120 | return VERR_NOT_SUPPORTED;
|
---|
3121 | #endif
|
---|
3122 | }
|
---|
3123 |
|
---|
3124 |
|
---|
3125 | /* SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE 1198 */
|
---|
3126 | static int vmsvga3dCmdDXDestroyRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
3127 | {
|
---|
3128 | #ifdef VMSVGA3D_DX
|
---|
3129 | //DEBUG_BREAKPOINT_TEST();
|
---|
3130 | RT_NOREF(cbCmd);
|
---|
3131 | return vmsvga3dDXDestroyRasterizerState(pThisCC, idDXContext, pCmd);
|
---|
3132 | #else
|
---|
3133 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3134 | return VERR_NOT_SUPPORTED;
|
---|
3135 | #endif
|
---|
3136 | }
|
---|
3137 |
|
---|
3138 |
|
---|
3139 | /* SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE 1199 */
|
---|
3140 | static int vmsvga3dCmdDXDefineSamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineSamplerState const *pCmd, uint32_t cbCmd)
|
---|
3141 | {
|
---|
3142 | #ifdef VMSVGA3D_DX
|
---|
3143 | //DEBUG_BREAKPOINT_TEST();
|
---|
3144 | RT_NOREF(cbCmd);
|
---|
3145 | return vmsvga3dDXDefineSamplerState(pThisCC, idDXContext, pCmd);
|
---|
3146 | #else
|
---|
3147 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3148 | return VERR_NOT_SUPPORTED;
|
---|
3149 | #endif
|
---|
3150 | }
|
---|
3151 |
|
---|
3152 |
|
---|
3153 | /* SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE 1200 */
|
---|
3154 | static int vmsvga3dCmdDXDestroySamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroySamplerState const *pCmd, uint32_t cbCmd)
|
---|
3155 | {
|
---|
3156 | #ifdef VMSVGA3D_DX
|
---|
3157 | //DEBUG_BREAKPOINT_TEST();
|
---|
3158 | RT_NOREF(cbCmd);
|
---|
3159 | return vmsvga3dDXDestroySamplerState(pThisCC, idDXContext, pCmd);
|
---|
3160 | #else
|
---|
3161 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3162 | return VERR_NOT_SUPPORTED;
|
---|
3163 | #endif
|
---|
3164 | }
|
---|
3165 |
|
---|
3166 |
|
---|
3167 | /* SVGA_3D_CMD_DX_DEFINE_SHADER 1201 */
|
---|
3168 | static int vmsvga3dCmdDXDefineShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShader const *pCmd, uint32_t cbCmd)
|
---|
3169 | {
|
---|
3170 | #ifdef VMSVGA3D_DX
|
---|
3171 | //DEBUG_BREAKPOINT_TEST();
|
---|
3172 | RT_NOREF(cbCmd);
|
---|
3173 | return vmsvga3dDXDefineShader(pThisCC, idDXContext, pCmd);
|
---|
3174 | #else
|
---|
3175 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3176 | return VERR_NOT_SUPPORTED;
|
---|
3177 | #endif
|
---|
3178 | }
|
---|
3179 |
|
---|
3180 |
|
---|
3181 | /* SVGA_3D_CMD_DX_DESTROY_SHADER 1202 */
|
---|
3182 | static int vmsvga3dCmdDXDestroyShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShader const *pCmd, uint32_t cbCmd)
|
---|
3183 | {
|
---|
3184 | #ifdef VMSVGA3D_DX
|
---|
3185 | //DEBUG_BREAKPOINT_TEST();
|
---|
3186 | RT_NOREF(cbCmd);
|
---|
3187 | return vmsvga3dDXDestroyShader(pThisCC, idDXContext, pCmd);
|
---|
3188 | #else
|
---|
3189 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3190 | return VERR_NOT_SUPPORTED;
|
---|
3191 | #endif
|
---|
3192 | }
|
---|
3193 |
|
---|
3194 |
|
---|
3195 | /* SVGA_3D_CMD_DX_BIND_SHADER 1203 */
|
---|
3196 | static int vmsvga3dCmdDXBindShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindShader const *pCmd, uint32_t cbCmd)
|
---|
3197 | {
|
---|
3198 | #ifdef VMSVGA3D_DX
|
---|
3199 | //DEBUG_BREAKPOINT_TEST();
|
---|
3200 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3201 | RT_NOREF(idDXContext, cbCmd);
|
---|
3202 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
3203 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
3204 | return vmsvga3dDXBindShader(pThisCC, pCmd, pMob);
|
---|
3205 | #else
|
---|
3206 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3207 | return VERR_NOT_SUPPORTED;
|
---|
3208 | #endif
|
---|
3209 | }
|
---|
3210 |
|
---|
3211 |
|
---|
3212 | /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT 1204 */
|
---|
3213 | static int vmsvga3dCmdDXDefineStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3214 | {
|
---|
3215 | #ifdef VMSVGA3D_DX
|
---|
3216 | //DEBUG_BREAKPOINT_TEST();
|
---|
3217 | RT_NOREF(cbCmd);
|
---|
3218 | return vmsvga3dDXDefineStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3219 | #else
|
---|
3220 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3221 | return VERR_NOT_SUPPORTED;
|
---|
3222 | #endif
|
---|
3223 | }
|
---|
3224 |
|
---|
3225 |
|
---|
3226 | /* SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT 1205 */
|
---|
3227 | static int vmsvga3dCmdDXDestroyStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3228 | {
|
---|
3229 | #ifdef VMSVGA3D_DX
|
---|
3230 | //DEBUG_BREAKPOINT_TEST();
|
---|
3231 | RT_NOREF(cbCmd);
|
---|
3232 | return vmsvga3dDXDestroyStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3233 | #else
|
---|
3234 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3235 | return VERR_NOT_SUPPORTED;
|
---|
3236 | #endif
|
---|
3237 | }
|
---|
3238 |
|
---|
3239 |
|
---|
3240 | /* SVGA_3D_CMD_DX_SET_STREAMOUTPUT 1206 */
|
---|
3241 | static int vmsvga3dCmdDXSetStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3242 | {
|
---|
3243 | #ifdef VMSVGA3D_DX
|
---|
3244 | //DEBUG_BREAKPOINT_TEST();
|
---|
3245 | RT_NOREF(cbCmd);
|
---|
3246 | return vmsvga3dDXSetStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3247 | #else
|
---|
3248 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3249 | return VERR_NOT_SUPPORTED;
|
---|
3250 | #endif
|
---|
3251 | }
|
---|
3252 |
|
---|
3253 |
|
---|
3254 | /* SVGA_3D_CMD_DX_SET_COTABLE 1207 */
|
---|
3255 | static int vmsvga3dCmdDXSetCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXSetCOTable const *pCmd, uint32_t cbCmd)
|
---|
3256 | {
|
---|
3257 | #ifdef VMSVGA3D_DX
|
---|
3258 | //DEBUG_BREAKPOINT_TEST();
|
---|
3259 | RT_NOREF(cbCmd);
|
---|
3260 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3261 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
3262 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
3263 | return vmsvga3dDXSetCOTable(pThisCC, pCmd, pMob);
|
---|
3264 | #else
|
---|
3265 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3266 | return VERR_NOT_SUPPORTED;
|
---|
3267 | #endif
|
---|
3268 | }
|
---|
3269 |
|
---|
3270 |
|
---|
3271 | /* SVGA_3D_CMD_DX_READBACK_COTABLE 1208 */
|
---|
3272 | static int vmsvga3dCmdDXReadbackCOTable(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackCOTable const *pCmd, uint32_t cbCmd)
|
---|
3273 | {
|
---|
3274 | #ifdef VMSVGA3D_DX
|
---|
3275 | //DEBUG_BREAKPOINT_TEST();
|
---|
3276 | RT_NOREF(idDXContext, cbCmd);
|
---|
3277 | return vmsvga3dDXReadbackCOTable(pThisCC, pCmd);
|
---|
3278 | #else
|
---|
3279 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3280 | return VERR_NOT_SUPPORTED;
|
---|
3281 | #endif
|
---|
3282 | }
|
---|
3283 |
|
---|
3284 |
|
---|
3285 | /* SVGA_3D_CMD_DX_BUFFER_COPY 1209 */
|
---|
3286 | static int vmsvga3dCmdDXBufferCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBufferCopy const *pCmd, uint32_t cbCmd)
|
---|
3287 | {
|
---|
3288 | #ifdef VMSVGA3D_DX
|
---|
3289 | //DEBUG_BREAKPOINT_TEST();
|
---|
3290 | RT_NOREF(idDXContext, cbCmd);
|
---|
3291 |
|
---|
3292 | int rc;
|
---|
3293 |
|
---|
3294 | /** @todo Backend should o the copy is both buffers have a hardware resource. */
|
---|
3295 | SVGA3dSurfaceImageId imageBufferSrc;
|
---|
3296 | imageBufferSrc.sid = pCmd->src;
|
---|
3297 | imageBufferSrc.face = 0;
|
---|
3298 | imageBufferSrc.mipmap = 0;
|
---|
3299 |
|
---|
3300 | SVGA3dSurfaceImageId imageBufferDest;
|
---|
3301 | imageBufferDest.sid = pCmd->dest;
|
---|
3302 | imageBufferDest.face = 0;
|
---|
3303 | imageBufferDest.mipmap = 0;
|
---|
3304 |
|
---|
3305 | /*
|
---|
3306 | * Map the source buffer.
|
---|
3307 | */
|
---|
3308 | VMSVGA3D_MAPPED_SURFACE mapBufferSrc;
|
---|
3309 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBufferSrc, NULL, VMSVGA3D_SURFACE_MAP_READ, &mapBufferSrc);
|
---|
3310 | if (RT_SUCCESS(rc))
|
---|
3311 | {
|
---|
3312 | /*
|
---|
3313 | * Map the destination buffer.
|
---|
3314 | */
|
---|
3315 | VMSVGA3D_MAPPED_SURFACE mapBufferDest;
|
---|
3316 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBufferDest, NULL, VMSVGA3D_SURFACE_MAP_WRITE, &mapBufferDest);
|
---|
3317 | if (RT_SUCCESS(rc))
|
---|
3318 | {
|
---|
3319 | /*
|
---|
3320 | * Copy the source buffer to the destination.
|
---|
3321 | */
|
---|
3322 | uint8_t const *pu8BufferSrc = (uint8_t *)mapBufferSrc.pvData;
|
---|
3323 | uint32_t const cbBufferSrc = mapBufferSrc.cbRow;
|
---|
3324 |
|
---|
3325 | uint8_t *pu8BufferDest = (uint8_t *)mapBufferDest.pvData;
|
---|
3326 | uint32_t const cbBufferDest = mapBufferDest.cbRow;
|
---|
3327 |
|
---|
3328 | if ( pCmd->srcX < cbBufferSrc
|
---|
3329 | && pCmd->width <= cbBufferSrc- pCmd->srcX
|
---|
3330 | && pCmd->destX < cbBufferDest
|
---|
3331 | && pCmd->width <= cbBufferDest - pCmd->destX)
|
---|
3332 | {
|
---|
3333 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
3334 |
|
---|
3335 | memcpy(&pu8BufferDest[pCmd->destX], &pu8BufferSrc[pCmd->srcX], pCmd->width);
|
---|
3336 | }
|
---|
3337 | else
|
---|
3338 | ASSERT_GUEST_FAILED_STMT(rc = VERR_INVALID_PARAMETER);
|
---|
3339 |
|
---|
3340 | vmsvga3dSurfaceUnmap(pThisCC, &imageBufferDest, &mapBufferDest, true);
|
---|
3341 | }
|
---|
3342 |
|
---|
3343 | vmsvga3dSurfaceUnmap(pThisCC, &imageBufferSrc, &mapBufferSrc, false);
|
---|
3344 | }
|
---|
3345 |
|
---|
3346 | return rc;
|
---|
3347 | #else
|
---|
3348 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3349 | return VERR_NOT_SUPPORTED;
|
---|
3350 | #endif
|
---|
3351 | }
|
---|
3352 |
|
---|
3353 |
|
---|
3354 | /* SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER 1210 */
|
---|
3355 | static int vmsvga3dCmdDXTransferFromBuffer(PVGASTATECC pThisCC, SVGA3dCmdDXTransferFromBuffer const *pCmd, uint32_t cbCmd)
|
---|
3356 | {
|
---|
3357 | #ifdef VMSVGA3D_DX
|
---|
3358 | //DEBUG_BREAKPOINT_TEST();
|
---|
3359 | RT_NOREF(cbCmd);
|
---|
3360 |
|
---|
3361 | /* Plan:
|
---|
3362 | * - map the buffer;
|
---|
3363 | * - map the surface;
|
---|
3364 | * - copy from buffer map to the surface map.
|
---|
3365 | */
|
---|
3366 |
|
---|
3367 | int rc;
|
---|
3368 |
|
---|
3369 | SVGA3dSurfaceImageId imageBuffer;
|
---|
3370 | imageBuffer.sid = pCmd->srcSid;
|
---|
3371 | imageBuffer.face = 0;
|
---|
3372 | imageBuffer.mipmap = 0;
|
---|
3373 |
|
---|
3374 | SVGA3dSurfaceImageId imageSurface;
|
---|
3375 | imageSurface.sid = pCmd->destSid;
|
---|
3376 | rc = vmsvga3dCalcSurfaceMipmapAndFace(pThisCC, pCmd->destSid, pCmd->destSubResource, &imageSurface.mipmap, &imageSurface.face);
|
---|
3377 | AssertRCReturn(rc, rc);
|
---|
3378 |
|
---|
3379 | /*
|
---|
3380 | * Map the buffer.
|
---|
3381 | */
|
---|
3382 | VMSVGA3D_MAPPED_SURFACE mapBuffer;
|
---|
3383 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBuffer, NULL, VMSVGA3D_SURFACE_MAP_READ, &mapBuffer);
|
---|
3384 | if (RT_SUCCESS(rc))
|
---|
3385 | {
|
---|
3386 | /*
|
---|
3387 | * Map the surface.
|
---|
3388 | */
|
---|
3389 | VMSVGA3D_MAPPED_SURFACE mapSurface;
|
---|
3390 | rc = vmsvga3dSurfaceMap(pThisCC, &imageSurface, &pCmd->destBox, VMSVGA3D_SURFACE_MAP_WRITE, &mapSurface);
|
---|
3391 | if (RT_SUCCESS(rc))
|
---|
3392 | {
|
---|
3393 | /*
|
---|
3394 | * Copy the mapped buffer to the surface. "Raw byte wise transfer"
|
---|
3395 | */
|
---|
3396 | uint8_t const *pu8Buffer = (uint8_t *)mapBuffer.pvData;
|
---|
3397 | uint32_t const cbBuffer = mapBuffer.cbRow;
|
---|
3398 |
|
---|
3399 | if (pCmd->srcOffset <= cbBuffer)
|
---|
3400 | {
|
---|
3401 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
3402 | uint8_t const *pu8BufferBegin = pu8Buffer;
|
---|
3403 | uint8_t const *pu8BufferEnd = pu8Buffer + cbBuffer;
|
---|
3404 |
|
---|
3405 | pu8Buffer += pCmd->srcOffset;
|
---|
3406 |
|
---|
3407 | uint8_t *pu8Surface = (uint8_t *)mapSurface.pvData;
|
---|
3408 |
|
---|
3409 | uint32_t const cbRowCopy = RT_MIN(pCmd->srcPitch, mapSurface.cbRow);
|
---|
3410 | for (uint32_t z = 0; z < mapSurface.box.d && RT_SUCCESS(rc); ++z)
|
---|
3411 | {
|
---|
3412 | uint8_t const *pu8BufferRow = pu8Buffer;
|
---|
3413 | uint8_t *pu8SurfaceRow = pu8Surface;
|
---|
3414 | for (uint32_t iRow = 0; iRow < mapSurface.cRows; ++iRow)
|
---|
3415 | {
|
---|
3416 | ASSERT_GUEST_STMT_BREAK( (uintptr_t)pu8BufferRow >= (uintptr_t)pu8BufferBegin
|
---|
3417 | && (uintptr_t)pu8BufferRow < (uintptr_t)pu8BufferEnd
|
---|
3418 | && (uintptr_t)pu8BufferRow < (uintptr_t)(pu8BufferRow + cbRowCopy)
|
---|
3419 | && (uintptr_t)(pu8BufferRow + cbRowCopy) > (uintptr_t)pu8BufferBegin
|
---|
3420 | && (uintptr_t)(pu8BufferRow + cbRowCopy) <= (uintptr_t)pu8BufferEnd,
|
---|
3421 | rc = VERR_INVALID_PARAMETER);
|
---|
3422 |
|
---|
3423 | memcpy(pu8SurfaceRow, pu8BufferRow, cbRowCopy);
|
---|
3424 |
|
---|
3425 | pu8SurfaceRow += mapSurface.cbRowPitch;
|
---|
3426 | pu8BufferRow += pCmd->srcPitch;
|
---|
3427 | }
|
---|
3428 |
|
---|
3429 | pu8Buffer += pCmd->srcSlicePitch;
|
---|
3430 | pu8Surface += mapSurface.cbDepthPitch;
|
---|
3431 | }
|
---|
3432 | }
|
---|
3433 | else
|
---|
3434 | ASSERT_GUEST_FAILED_STMT(rc = VERR_INVALID_PARAMETER);
|
---|
3435 |
|
---|
3436 | vmsvga3dSurfaceUnmap(pThisCC, &imageSurface, &mapSurface, true);
|
---|
3437 | }
|
---|
3438 |
|
---|
3439 | vmsvga3dSurfaceUnmap(pThisCC, &imageBuffer, &mapBuffer, false);
|
---|
3440 | }
|
---|
3441 |
|
---|
3442 | return rc;
|
---|
3443 | #else
|
---|
3444 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3445 | return VERR_NOT_SUPPORTED;
|
---|
3446 | #endif
|
---|
3447 | }
|
---|
3448 |
|
---|
3449 |
|
---|
3450 | /* SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK 1211 */
|
---|
3451 | static int vmsvga3dCmdDXSurfaceCopyAndReadback(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSurfaceCopyAndReadback const *pCmd, uint32_t cbCmd)
|
---|
3452 | {
|
---|
3453 | #ifdef VMSVGA3D_DX
|
---|
3454 | DEBUG_BREAKPOINT_TEST();
|
---|
3455 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3456 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3457 | return vmsvga3dDXSurfaceCopyAndReadback(pThisCC, idDXContext);
|
---|
3458 | #else
|
---|
3459 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3460 | return VERR_NOT_SUPPORTED;
|
---|
3461 | #endif
|
---|
3462 | }
|
---|
3463 |
|
---|
3464 |
|
---|
3465 | /* SVGA_3D_CMD_DX_MOVE_QUERY 1212 */
|
---|
3466 | static int vmsvga3dCmdDXMoveQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXMoveQuery const *pCmd, uint32_t cbCmd)
|
---|
3467 | {
|
---|
3468 | #ifdef VMSVGA3D_DX
|
---|
3469 | DEBUG_BREAKPOINT_TEST();
|
---|
3470 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3471 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3472 | return vmsvga3dDXMoveQuery(pThisCC, idDXContext);
|
---|
3473 | #else
|
---|
3474 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3475 | return VERR_NOT_SUPPORTED;
|
---|
3476 | #endif
|
---|
3477 | }
|
---|
3478 |
|
---|
3479 |
|
---|
3480 | /* SVGA_3D_CMD_DX_BIND_ALL_QUERY 1213 */
|
---|
3481 | static int vmsvga3dCmdDXBindAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindAllQuery const *pCmd, uint32_t cbCmd)
|
---|
3482 | {
|
---|
3483 | #ifdef VMSVGA3D_DX
|
---|
3484 | //DEBUG_BREAKPOINT_TEST();
|
---|
3485 | RT_NOREF(cbCmd);
|
---|
3486 | return vmsvga3dDXBindAllQuery(pThisCC, idDXContext, pCmd);
|
---|
3487 | #else
|
---|
3488 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3489 | return VERR_NOT_SUPPORTED;
|
---|
3490 | #endif
|
---|
3491 | }
|
---|
3492 |
|
---|
3493 |
|
---|
3494 | /* SVGA_3D_CMD_DX_READBACK_ALL_QUERY 1214 */
|
---|
3495 | static int vmsvga3dCmdDXReadbackAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackAllQuery const *pCmd, uint32_t cbCmd)
|
---|
3496 | {
|
---|
3497 | #ifdef VMSVGA3D_DX
|
---|
3498 | //DEBUG_BREAKPOINT_TEST();
|
---|
3499 | RT_NOREF(cbCmd);
|
---|
3500 | return vmsvga3dDXReadbackAllQuery(pThisCC, idDXContext, pCmd);
|
---|
3501 | #else
|
---|
3502 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3503 | return VERR_NOT_SUPPORTED;
|
---|
3504 | #endif
|
---|
3505 | }
|
---|
3506 |
|
---|
3507 |
|
---|
3508 | /* SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER 1215 */
|
---|
3509 | static int vmsvga3dCmdDXPredTransferFromBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredTransferFromBuffer const *pCmd, uint32_t cbCmd)
|
---|
3510 | {
|
---|
3511 | #ifdef VMSVGA3D_DX
|
---|
3512 | //DEBUG_BREAKPOINT_TEST();
|
---|
3513 | RT_NOREF(idDXContext, cbCmd);
|
---|
3514 |
|
---|
3515 | /* This command is executed in a context: "The context is implied from the command buffer header."
|
---|
3516 | * However the device design allows to do the transfer without a context, so re-use context-less command handler.
|
---|
3517 | */
|
---|
3518 | SVGA3dCmdDXTransferFromBuffer cmd;
|
---|
3519 | cmd.srcSid = pCmd->srcSid;
|
---|
3520 | cmd.srcOffset = pCmd->srcOffset;
|
---|
3521 | cmd.srcPitch = pCmd->srcPitch;
|
---|
3522 | cmd.srcSlicePitch = pCmd->srcSlicePitch;
|
---|
3523 | cmd.destSid = pCmd->destSid;
|
---|
3524 | cmd.destSubResource = pCmd->destSubResource;
|
---|
3525 | cmd.destBox = pCmd->destBox;
|
---|
3526 | return vmsvga3dCmdDXTransferFromBuffer(pThisCC, &cmd, sizeof(cmd));
|
---|
3527 | #else
|
---|
3528 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3529 | return VERR_NOT_SUPPORTED;
|
---|
3530 | #endif
|
---|
3531 | }
|
---|
3532 |
|
---|
3533 |
|
---|
3534 | /* SVGA_3D_CMD_DX_MOB_FENCE_64 1216 */
|
---|
3535 | static int vmsvga3dCmdDXMobFence64(PVGASTATECC pThisCC, SVGA3dCmdDXMobFence64 const *pCmd, uint32_t cbCmd)
|
---|
3536 | {
|
---|
3537 | #ifdef VMSVGA3D_DX
|
---|
3538 | //DEBUG_BREAKPOINT_TEST();
|
---|
3539 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3540 | RT_NOREF(cbCmd);
|
---|
3541 |
|
---|
3542 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobId);
|
---|
3543 | ASSERT_GUEST_RETURN(pMob, VERR_INVALID_PARAMETER);
|
---|
3544 |
|
---|
3545 | int rc = vmsvgaR3MobWrite(pSvgaR3State, pMob, pCmd->mobOffset, &pCmd->value, sizeof(pCmd->value));
|
---|
3546 | ASSERT_GUEST_RETURN(RT_SUCCESS(rc), rc);
|
---|
3547 |
|
---|
3548 | return VINF_SUCCESS;
|
---|
3549 | #else
|
---|
3550 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3551 | return VERR_NOT_SUPPORTED;
|
---|
3552 | #endif
|
---|
3553 | }
|
---|
3554 |
|
---|
3555 |
|
---|
3556 | /* SVGA_3D_CMD_DX_BIND_ALL_SHADER 1217 */
|
---|
3557 | static int vmsvga3dCmdDXBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindAllShader const *pCmd, uint32_t cbCmd)
|
---|
3558 | {
|
---|
3559 | #ifdef VMSVGA3D_DX
|
---|
3560 | DEBUG_BREAKPOINT_TEST();
|
---|
3561 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3562 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3563 | return vmsvga3dDXBindAllShader(pThisCC, idDXContext);
|
---|
3564 | #else
|
---|
3565 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3566 | return VERR_NOT_SUPPORTED;
|
---|
3567 | #endif
|
---|
3568 | }
|
---|
3569 |
|
---|
3570 |
|
---|
3571 | /* SVGA_3D_CMD_DX_HINT 1218 */
|
---|
3572 | static int vmsvga3dCmdDXHint(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXHint const *pCmd, uint32_t cbCmd)
|
---|
3573 | {
|
---|
3574 | #ifdef VMSVGA3D_DX
|
---|
3575 | DEBUG_BREAKPOINT_TEST();
|
---|
3576 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3577 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3578 | return vmsvga3dDXHint(pThisCC, idDXContext);
|
---|
3579 | #else
|
---|
3580 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3581 | return VERR_NOT_SUPPORTED;
|
---|
3582 | #endif
|
---|
3583 | }
|
---|
3584 |
|
---|
3585 |
|
---|
3586 | /* SVGA_3D_CMD_DX_BUFFER_UPDATE 1219 */
|
---|
3587 | static int vmsvga3dCmdDXBufferUpdate(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBufferUpdate const *pCmd, uint32_t cbCmd)
|
---|
3588 | {
|
---|
3589 | #ifdef VMSVGA3D_DX
|
---|
3590 | DEBUG_BREAKPOINT_TEST();
|
---|
3591 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3592 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3593 | return vmsvga3dDXBufferUpdate(pThisCC, idDXContext);
|
---|
3594 | #else
|
---|
3595 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3596 | return VERR_NOT_SUPPORTED;
|
---|
3597 | #endif
|
---|
3598 | }
|
---|
3599 |
|
---|
3600 |
|
---|
3601 | /* SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET 1220 */
|
---|
3602 | static int vmsvga3dCmdDXSetVSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetVSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3603 | {
|
---|
3604 | #ifdef VMSVGA3D_DX
|
---|
3605 | //DEBUG_BREAKPOINT_TEST();
|
---|
3606 | RT_NOREF(cbCmd);
|
---|
3607 | return vmsvga3dDXSetConstantBufferOffset(pThisCC, idDXContext, pCmd, SVGA3D_SHADERTYPE_VS);
|
---|
3608 | #else
|
---|
3609 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3610 | return VERR_NOT_SUPPORTED;
|
---|
3611 | #endif
|
---|
3612 | }
|
---|
3613 |
|
---|
3614 |
|
---|
3615 | /* SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET 1221 */
|
---|
3616 | static int vmsvga3dCmdDXSetPSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetPSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3617 | {
|
---|
3618 | #ifdef VMSVGA3D_DX
|
---|
3619 | //DEBUG_BREAKPOINT_TEST();
|
---|
3620 | RT_NOREF(cbCmd);
|
---|
3621 | return vmsvga3dDXSetConstantBufferOffset(pThisCC, idDXContext, pCmd, SVGA3D_SHADERTYPE_PS);
|
---|
3622 | #else
|
---|
3623 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3624 | return VERR_NOT_SUPPORTED;
|
---|
3625 | #endif
|
---|
3626 | }
|
---|
3627 |
|
---|
3628 |
|
---|
3629 | /* SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET 1222 */
|
---|
3630 | static int vmsvga3dCmdDXSetGSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetGSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3631 | {
|
---|
3632 | #ifdef VMSVGA3D_DX
|
---|
3633 | //DEBUG_BREAKPOINT_TEST();
|
---|
3634 | RT_NOREF(cbCmd);
|
---|
3635 | return vmsvga3dDXSetConstantBufferOffset(pThisCC, idDXContext, pCmd, SVGA3D_SHADERTYPE_GS);
|
---|
3636 | #else
|
---|
3637 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3638 | return VERR_NOT_SUPPORTED;
|
---|
3639 | #endif
|
---|
3640 | }
|
---|
3641 |
|
---|
3642 |
|
---|
3643 | /* SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET 1223 */
|
---|
3644 | static int vmsvga3dCmdDXSetHSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetHSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3645 | {
|
---|
3646 | #ifdef VMSVGA3D_DX
|
---|
3647 | //DEBUG_BREAKPOINT_TEST();
|
---|
3648 | RT_NOREF(cbCmd);
|
---|
3649 | return vmsvga3dDXSetConstantBufferOffset(pThisCC, idDXContext, pCmd, SVGA3D_SHADERTYPE_HS);
|
---|
3650 | #else
|
---|
3651 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3652 | return VERR_NOT_SUPPORTED;
|
---|
3653 | #endif
|
---|
3654 | }
|
---|
3655 |
|
---|
3656 |
|
---|
3657 | /* SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET 1224 */
|
---|
3658 | static int vmsvga3dCmdDXSetDSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetDSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3659 | {
|
---|
3660 | #ifdef VMSVGA3D_DX
|
---|
3661 | //DEBUG_BREAKPOINT_TEST();
|
---|
3662 | RT_NOREF(cbCmd);
|
---|
3663 | return vmsvga3dDXSetConstantBufferOffset(pThisCC, idDXContext, pCmd, SVGA3D_SHADERTYPE_DS);
|
---|
3664 | #else
|
---|
3665 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3666 | return VERR_NOT_SUPPORTED;
|
---|
3667 | #endif
|
---|
3668 | }
|
---|
3669 |
|
---|
3670 |
|
---|
3671 | /* SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET 1225 */
|
---|
3672 | static int vmsvga3dCmdDXSetCSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetCSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3673 | {
|
---|
3674 | #ifdef VMSVGA3D_DX
|
---|
3675 | //DEBUG_BREAKPOINT_TEST();
|
---|
3676 | RT_NOREF(cbCmd);
|
---|
3677 | return vmsvga3dDXSetConstantBufferOffset(pThisCC, idDXContext, pCmd, SVGA3D_SHADERTYPE_CS);
|
---|
3678 | #else
|
---|
3679 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3680 | return VERR_NOT_SUPPORTED;
|
---|
3681 | #endif
|
---|
3682 | }
|
---|
3683 |
|
---|
3684 |
|
---|
3685 | /* SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER 1226 */
|
---|
3686 | static int vmsvga3dCmdDXCondBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXCondBindAllShader const *pCmd, uint32_t cbCmd)
|
---|
3687 | {
|
---|
3688 | #ifdef VMSVGA3D_DX
|
---|
3689 | DEBUG_BREAKPOINT_TEST();
|
---|
3690 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3691 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3692 | return vmsvga3dDXCondBindAllShader(pThisCC, idDXContext);
|
---|
3693 | #else
|
---|
3694 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3695 | return VERR_NOT_SUPPORTED;
|
---|
3696 | #endif
|
---|
3697 | }
|
---|
3698 |
|
---|
3699 |
|
---|
3700 | /* SVGA_3D_CMD_SCREEN_COPY 1227 */
|
---|
3701 | static int vmsvga3dCmdScreenCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdScreenCopy const *pCmd, uint32_t cbCmd)
|
---|
3702 | {
|
---|
3703 | #ifdef VMSVGA3D_DX
|
---|
3704 | DEBUG_BREAKPOINT_TEST();
|
---|
3705 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3706 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3707 | return vmsvga3dScreenCopy(pThisCC, idDXContext);
|
---|
3708 | #else
|
---|
3709 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3710 | return VERR_NOT_SUPPORTED;
|
---|
3711 | #endif
|
---|
3712 | }
|
---|
3713 |
|
---|
3714 |
|
---|
3715 | /* SVGA_3D_CMD_GROW_OTABLE 1236 */
|
---|
3716 | static int vmsvga3dCmdGrowOTable(PVGASTATECC pThisCC, SVGA3dCmdGrowOTable const *pCmd, uint32_t cbCmd)
|
---|
3717 | {
|
---|
3718 | #ifdef VMSVGA3D_DX
|
---|
3719 | //DEBUG_BREAKPOINT_TEST();
|
---|
3720 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3721 | RT_NOREF(cbCmd);
|
---|
3722 | return vmsvgaR3OTableSetOrGrow(pSvgaR3State, pCmd->type, pCmd->baseAddress,
|
---|
3723 | pCmd->sizeInBytes, pCmd->validSizeInBytes, pCmd->ptDepth, /*fGrow*/ true);
|
---|
3724 | #else
|
---|
3725 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3726 | return VERR_NOT_SUPPORTED;
|
---|
3727 | #endif
|
---|
3728 | }
|
---|
3729 |
|
---|
3730 |
|
---|
3731 | /* SVGA_3D_CMD_DX_GROW_COTABLE 1237 */
|
---|
3732 | static int vmsvga3dCmdDXGrowCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXGrowCOTable const *pCmd, uint32_t cbCmd)
|
---|
3733 | {
|
---|
3734 | #ifdef VMSVGA3D_DX
|
---|
3735 | //DEBUG_BREAKPOINT_TEST();
|
---|
3736 | RT_NOREF(cbCmd);
|
---|
3737 | return vmsvga3dDXGrowCOTable(pThisCC, pCmd);
|
---|
3738 | #else
|
---|
3739 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3740 | return VERR_NOT_SUPPORTED;
|
---|
3741 | #endif
|
---|
3742 | }
|
---|
3743 |
|
---|
3744 |
|
---|
3745 | /* SVGA_3D_CMD_INTRA_SURFACE_COPY 1238 */
|
---|
3746 | static int vmsvga3dCmdIntraSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdIntraSurfaceCopy const *pCmd, uint32_t cbCmd)
|
---|
3747 | {
|
---|
3748 | #ifdef VMSVGA3D_DX
|
---|
3749 | //DEBUG_BREAKPOINT_TEST();
|
---|
3750 | RT_NOREF(cbCmd);
|
---|
3751 | return vmsvga3dIntraSurfaceCopy(pThisCC, idDXContext, pCmd);
|
---|
3752 | #else
|
---|
3753 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3754 | return VERR_NOT_SUPPORTED;
|
---|
3755 | #endif
|
---|
3756 | }
|
---|
3757 |
|
---|
3758 |
|
---|
3759 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 1239 */
|
---|
3760 | static int vmsvga3dCmdDefineGBSurface_v3(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface_v3 const *pCmd)
|
---|
3761 | {
|
---|
3762 | #ifdef VMSVGA3D_DX
|
---|
3763 | //DEBUG_BREAKPOINT_TEST();
|
---|
3764 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3765 |
|
---|
3766 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
3767 | SVGAOTableSurfaceEntry entry;
|
---|
3768 | RT_ZERO(entry);
|
---|
3769 | entry.format = pCmd->format;
|
---|
3770 | entry.surface1Flags = (uint32_t)(pCmd->surfaceFlags);
|
---|
3771 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
3772 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
3773 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
3774 | entry.size = pCmd->size;
|
---|
3775 | entry.mobid = SVGA_ID_INVALID;
|
---|
3776 | entry.arraySize = pCmd->arraySize;
|
---|
3777 | // entry.mobPitch = 0;
|
---|
3778 | entry.surface2Flags = (uint32_t)(pCmd->surfaceFlags >> UINT64_C(32));
|
---|
3779 | entry.multisamplePattern = pCmd->multisamplePattern;
|
---|
3780 | entry.qualityLevel = pCmd->qualityLevel;
|
---|
3781 | // entry.bufferByteStride = 0;
|
---|
3782 | // entry.minLOD = 0;
|
---|
3783 |
|
---|
3784 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
3785 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
3786 | if (RT_SUCCESS(rc))
|
---|
3787 | {
|
---|
3788 | /* Create the host surface. */
|
---|
3789 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
3790 | pCmd->multisampleCount, pCmd->multisamplePattern, pCmd->qualityLevel, pCmd->autogenFilter,
|
---|
3791 | pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* bufferByteStride = */ 0, /* fAllocMipLevels = */ false);
|
---|
3792 | }
|
---|
3793 | return rc;
|
---|
3794 | #else
|
---|
3795 | RT_NOREF(pThisCC, pCmd);
|
---|
3796 | return VERR_NOT_SUPPORTED;
|
---|
3797 | #endif
|
---|
3798 | }
|
---|
3799 |
|
---|
3800 |
|
---|
3801 | /* SVGA_3D_CMD_DX_RESOLVE_COPY 1240 */
|
---|
3802 | static int vmsvga3dCmdDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXResolveCopy const *pCmd, uint32_t cbCmd)
|
---|
3803 | {
|
---|
3804 | #ifdef VMSVGA3D_DX
|
---|
3805 | //DEBUG_BREAKPOINT_TEST();
|
---|
3806 | RT_NOREF(cbCmd);
|
---|
3807 | return vmsvga3dDXResolveCopy(pThisCC, idDXContext, pCmd);
|
---|
3808 | #else
|
---|
3809 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3810 | return VERR_NOT_SUPPORTED;
|
---|
3811 | #endif
|
---|
3812 | }
|
---|
3813 |
|
---|
3814 |
|
---|
3815 | /* SVGA_3D_CMD_DX_PRED_RESOLVE_COPY 1241 */
|
---|
3816 | static int vmsvga3dCmdDXPredResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredResolveCopy const *pCmd, uint32_t cbCmd)
|
---|
3817 | {
|
---|
3818 | #ifdef VMSVGA3D_DX
|
---|
3819 | DEBUG_BREAKPOINT_TEST();
|
---|
3820 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3821 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3822 | return vmsvga3dDXPredResolveCopy(pThisCC, idDXContext);
|
---|
3823 | #else
|
---|
3824 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3825 | return VERR_NOT_SUPPORTED;
|
---|
3826 | #endif
|
---|
3827 | }
|
---|
3828 |
|
---|
3829 |
|
---|
3830 | /* SVGA_3D_CMD_DX_PRED_CONVERT_REGION 1242 */
|
---|
3831 | static int vmsvga3dCmdDXPredConvertRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredConvertRegion const *pCmd, uint32_t cbCmd)
|
---|
3832 | {
|
---|
3833 | #ifdef VMSVGA3D_DX
|
---|
3834 | DEBUG_BREAKPOINT_TEST();
|
---|
3835 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3836 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3837 | return vmsvga3dDXPredConvertRegion(pThisCC, idDXContext);
|
---|
3838 | #else
|
---|
3839 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3840 | return VERR_NOT_SUPPORTED;
|
---|
3841 | #endif
|
---|
3842 | }
|
---|
3843 |
|
---|
3844 |
|
---|
3845 | /* SVGA_3D_CMD_DX_PRED_CONVERT 1243 */
|
---|
3846 | static int vmsvga3dCmdDXPredConvert(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredConvert const *pCmd, uint32_t cbCmd)
|
---|
3847 | {
|
---|
3848 | #ifdef VMSVGA3D_DX
|
---|
3849 | DEBUG_BREAKPOINT_TEST();
|
---|
3850 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3851 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3852 | return vmsvga3dDXPredConvert(pThisCC, idDXContext);
|
---|
3853 | #else
|
---|
3854 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3855 | return VERR_NOT_SUPPORTED;
|
---|
3856 | #endif
|
---|
3857 | }
|
---|
3858 |
|
---|
3859 |
|
---|
3860 | /* SVGA_3D_CMD_WHOLE_SURFACE_COPY 1244 */
|
---|
3861 | static int vmsvga3dCmdWholeSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdWholeSurfaceCopy const *pCmd, uint32_t cbCmd)
|
---|
3862 | {
|
---|
3863 | #ifdef VMSVGA3D_DX
|
---|
3864 | DEBUG_BREAKPOINT_TEST();
|
---|
3865 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3866 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3867 | return vmsvga3dWholeSurfaceCopy(pThisCC, idDXContext);
|
---|
3868 | #else
|
---|
3869 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3870 | return VERR_NOT_SUPPORTED;
|
---|
3871 | #endif
|
---|
3872 | }
|
---|
3873 |
|
---|
3874 |
|
---|
3875 | /* SVGA_3D_CMD_DX_DEFINE_UA_VIEW 1245 */
|
---|
3876 | static int vmsvga3dCmdDXDefineUAView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineUAView const *pCmd, uint32_t cbCmd)
|
---|
3877 | {
|
---|
3878 | #ifdef VMSVGA3D_DX
|
---|
3879 | //DEBUG_BREAKPOINT_TEST();
|
---|
3880 | RT_NOREF(cbCmd);
|
---|
3881 | return vmsvga3dDXDefineUAView(pThisCC, idDXContext, pCmd);
|
---|
3882 | #else
|
---|
3883 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3884 | return VERR_NOT_SUPPORTED;
|
---|
3885 | #endif
|
---|
3886 | }
|
---|
3887 |
|
---|
3888 |
|
---|
3889 | /* SVGA_3D_CMD_DX_DESTROY_UA_VIEW 1246 */
|
---|
3890 | static int vmsvga3dCmdDXDestroyUAView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyUAView const *pCmd, uint32_t cbCmd)
|
---|
3891 | {
|
---|
3892 | #ifdef VMSVGA3D_DX
|
---|
3893 | //DEBUG_BREAKPOINT_TEST();
|
---|
3894 | RT_NOREF(cbCmd);
|
---|
3895 | return vmsvga3dDXDestroyUAView(pThisCC, idDXContext, pCmd);
|
---|
3896 | #else
|
---|
3897 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3898 | return VERR_NOT_SUPPORTED;
|
---|
3899 | #endif
|
---|
3900 | }
|
---|
3901 |
|
---|
3902 |
|
---|
3903 | /* SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT 1247 */
|
---|
3904 | static int vmsvga3dCmdDXClearUAViewUint(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearUAViewUint const *pCmd, uint32_t cbCmd)
|
---|
3905 | {
|
---|
3906 | #ifdef VMSVGA3D_DX
|
---|
3907 | DEBUG_BREAKPOINT_TEST();
|
---|
3908 | RT_NOREF(cbCmd);
|
---|
3909 | return vmsvga3dDXClearUAViewUint(pThisCC, idDXContext, pCmd);
|
---|
3910 | #else
|
---|
3911 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3912 | return VERR_NOT_SUPPORTED;
|
---|
3913 | #endif
|
---|
3914 | }
|
---|
3915 |
|
---|
3916 |
|
---|
3917 | /* SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT 1248 */
|
---|
3918 | static int vmsvga3dCmdDXClearUAViewFloat(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearUAViewFloat const *pCmd, uint32_t cbCmd)
|
---|
3919 | {
|
---|
3920 | #ifdef VMSVGA3D_DX
|
---|
3921 | DEBUG_BREAKPOINT_TEST();
|
---|
3922 | RT_NOREF(cbCmd);
|
---|
3923 | return vmsvga3dDXClearUAViewFloat(pThisCC, idDXContext, pCmd);
|
---|
3924 | #else
|
---|
3925 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3926 | return VERR_NOT_SUPPORTED;
|
---|
3927 | #endif
|
---|
3928 | }
|
---|
3929 |
|
---|
3930 |
|
---|
3931 | /* SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT 1249 */
|
---|
3932 | static int vmsvga3dCmdDXCopyStructureCount(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXCopyStructureCount const *pCmd, uint32_t cbCmd)
|
---|
3933 | {
|
---|
3934 | #ifdef VMSVGA3D_DX
|
---|
3935 | //DEBUG_BREAKPOINT_TEST();
|
---|
3936 | RT_NOREF(cbCmd);
|
---|
3937 | return vmsvga3dDXCopyStructureCount(pThisCC, idDXContext, pCmd);
|
---|
3938 | #else
|
---|
3939 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3940 | return VERR_NOT_SUPPORTED;
|
---|
3941 | #endif
|
---|
3942 | }
|
---|
3943 |
|
---|
3944 |
|
---|
3945 | /* SVGA_3D_CMD_DX_SET_UA_VIEWS 1250 */
|
---|
3946 | static int vmsvga3dCmdDXSetUAViews(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetUAViews const *pCmd, uint32_t cbCmd)
|
---|
3947 | {
|
---|
3948 | #ifdef VMSVGA3D_DX
|
---|
3949 | //DEBUG_BREAKPOINT_TEST();
|
---|
3950 | SVGA3dUAViewId const *paUAViewId = (SVGA3dUAViewId *)&pCmd[1];
|
---|
3951 | uint32_t const cUAViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dUAViewId);
|
---|
3952 | return vmsvga3dDXSetUAViews(pThisCC, idDXContext, pCmd, cUAViewId, paUAViewId);
|
---|
3953 | #else
|
---|
3954 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3955 | return VERR_NOT_SUPPORTED;
|
---|
3956 | #endif
|
---|
3957 | }
|
---|
3958 |
|
---|
3959 |
|
---|
3960 | /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT 1251 */
|
---|
3961 | static int vmsvga3dCmdDXDrawIndexedInstancedIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexedInstancedIndirect const *pCmd, uint32_t cbCmd)
|
---|
3962 | {
|
---|
3963 | #ifdef VMSVGA3D_DX
|
---|
3964 | //DEBUG_BREAKPOINT_TEST();
|
---|
3965 | RT_NOREF(cbCmd);
|
---|
3966 | return vmsvga3dDXDrawIndexedInstancedIndirect(pThisCC, idDXContext, pCmd);
|
---|
3967 | #else
|
---|
3968 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3969 | return VERR_NOT_SUPPORTED;
|
---|
3970 | #endif
|
---|
3971 | }
|
---|
3972 |
|
---|
3973 |
|
---|
3974 | /* SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT 1252 */
|
---|
3975 | static int vmsvga3dCmdDXDrawInstancedIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawInstancedIndirect const *pCmd, uint32_t cbCmd)
|
---|
3976 | {
|
---|
3977 | #ifdef VMSVGA3D_DX
|
---|
3978 | //DEBUG_BREAKPOINT_TEST();
|
---|
3979 | RT_NOREF(cbCmd);
|
---|
3980 | return vmsvga3dDXDrawInstancedIndirect(pThisCC, idDXContext, pCmd);
|
---|
3981 | #else
|
---|
3982 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3983 | return VERR_NOT_SUPPORTED;
|
---|
3984 | #endif
|
---|
3985 | }
|
---|
3986 |
|
---|
3987 |
|
---|
3988 | /* SVGA_3D_CMD_DX_DISPATCH 1253 */
|
---|
3989 | static int vmsvga3dCmdDXDispatch(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDispatch const *pCmd, uint32_t cbCmd)
|
---|
3990 | {
|
---|
3991 | #ifdef VMSVGA3D_DX
|
---|
3992 | //DEBUG_BREAKPOINT_TEST();
|
---|
3993 | RT_NOREF(cbCmd);
|
---|
3994 | return vmsvga3dDXDispatch(pThisCC, idDXContext, pCmd);
|
---|
3995 | #else
|
---|
3996 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3997 | return VERR_NOT_SUPPORTED;
|
---|
3998 | #endif
|
---|
3999 | }
|
---|
4000 |
|
---|
4001 |
|
---|
4002 | /* SVGA_3D_CMD_DX_DISPATCH_INDIRECT 1254 */
|
---|
4003 | static int vmsvga3dCmdDXDispatchIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDispatchIndirect const *pCmd, uint32_t cbCmd)
|
---|
4004 | {
|
---|
4005 | #ifdef VMSVGA3D_DX
|
---|
4006 | DEBUG_BREAKPOINT_TEST();
|
---|
4007 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4008 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4009 | return vmsvga3dDXDispatchIndirect(pThisCC, idDXContext);
|
---|
4010 | #else
|
---|
4011 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4012 | return VERR_NOT_SUPPORTED;
|
---|
4013 | #endif
|
---|
4014 | }
|
---|
4015 |
|
---|
4016 |
|
---|
4017 | /* SVGA_3D_CMD_WRITE_ZERO_SURFACE 1255 */
|
---|
4018 | static int vmsvga3dCmdWriteZeroSurface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdWriteZeroSurface const *pCmd, uint32_t cbCmd)
|
---|
4019 | {
|
---|
4020 | #ifdef VMSVGA3D_DX
|
---|
4021 | DEBUG_BREAKPOINT_TEST();
|
---|
4022 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4023 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4024 | return vmsvga3dWriteZeroSurface(pThisCC, idDXContext);
|
---|
4025 | #else
|
---|
4026 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4027 | return VERR_NOT_SUPPORTED;
|
---|
4028 | #endif
|
---|
4029 | }
|
---|
4030 |
|
---|
4031 |
|
---|
4032 | /* SVGA_3D_CMD_HINT_ZERO_SURFACE 1256 */
|
---|
4033 | static int vmsvga3dCmdHintZeroSurface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdHintZeroSurface const *pCmd, uint32_t cbCmd)
|
---|
4034 | {
|
---|
4035 | #ifdef VMSVGA3D_DX
|
---|
4036 | DEBUG_BREAKPOINT_TEST();
|
---|
4037 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4038 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4039 | return vmsvga3dHintZeroSurface(pThisCC, idDXContext);
|
---|
4040 | #else
|
---|
4041 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4042 | return VERR_NOT_SUPPORTED;
|
---|
4043 | #endif
|
---|
4044 | }
|
---|
4045 |
|
---|
4046 |
|
---|
4047 | /* SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER 1257 */
|
---|
4048 | static int vmsvga3dCmdDXTransferToBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXTransferToBuffer const *pCmd, uint32_t cbCmd)
|
---|
4049 | {
|
---|
4050 | #ifdef VMSVGA3D_DX
|
---|
4051 | DEBUG_BREAKPOINT_TEST();
|
---|
4052 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4053 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4054 | return vmsvga3dDXTransferToBuffer(pThisCC, idDXContext);
|
---|
4055 | #else
|
---|
4056 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4057 | return VERR_NOT_SUPPORTED;
|
---|
4058 | #endif
|
---|
4059 | }
|
---|
4060 |
|
---|
4061 |
|
---|
4062 | /* SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT 1258 */
|
---|
4063 | static int vmsvga3dCmdDXSetStructureCount(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetStructureCount const *pCmd, uint32_t cbCmd)
|
---|
4064 | {
|
---|
4065 | #ifdef VMSVGA3D_DX
|
---|
4066 | //DEBUG_BREAKPOINT_TEST();
|
---|
4067 | RT_NOREF(cbCmd);
|
---|
4068 | return vmsvga3dDXSetStructureCount(pThisCC, idDXContext, pCmd);
|
---|
4069 | #else
|
---|
4070 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4071 | return VERR_NOT_SUPPORTED;
|
---|
4072 | #endif
|
---|
4073 | }
|
---|
4074 |
|
---|
4075 |
|
---|
4076 | /* SVGA_3D_CMD_LOGICOPS_BITBLT 1259 */
|
---|
4077 | static int vmsvga3dCmdLogicOpsBitBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsBitBlt const *pCmd, uint32_t cbCmd)
|
---|
4078 | {
|
---|
4079 | #ifdef VMSVGA3D_DX
|
---|
4080 | DEBUG_BREAKPOINT_TEST();
|
---|
4081 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4082 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4083 | return vmsvga3dLogicOpsBitBlt(pThisCC, idDXContext);
|
---|
4084 | #else
|
---|
4085 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4086 | return VERR_NOT_SUPPORTED;
|
---|
4087 | #endif
|
---|
4088 | }
|
---|
4089 |
|
---|
4090 |
|
---|
4091 | /* SVGA_3D_CMD_LOGICOPS_TRANSBLT 1260 */
|
---|
4092 | static int vmsvga3dCmdLogicOpsTransBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsTransBlt const *pCmd, uint32_t cbCmd)
|
---|
4093 | {
|
---|
4094 | #ifdef VMSVGA3D_DX
|
---|
4095 | DEBUG_BREAKPOINT_TEST();
|
---|
4096 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4097 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4098 | return vmsvga3dLogicOpsTransBlt(pThisCC, idDXContext);
|
---|
4099 | #else
|
---|
4100 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4101 | return VERR_NOT_SUPPORTED;
|
---|
4102 | #endif
|
---|
4103 | }
|
---|
4104 |
|
---|
4105 |
|
---|
4106 | /* SVGA_3D_CMD_LOGICOPS_STRETCHBLT 1261 */
|
---|
4107 | static int vmsvga3dCmdLogicOpsStretchBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsStretchBlt const *pCmd, uint32_t cbCmd)
|
---|
4108 | {
|
---|
4109 | #ifdef VMSVGA3D_DX
|
---|
4110 | DEBUG_BREAKPOINT_TEST();
|
---|
4111 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4112 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4113 | return vmsvga3dLogicOpsStretchBlt(pThisCC, idDXContext);
|
---|
4114 | #else
|
---|
4115 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4116 | return VERR_NOT_SUPPORTED;
|
---|
4117 | #endif
|
---|
4118 | }
|
---|
4119 |
|
---|
4120 |
|
---|
4121 | /* SVGA_3D_CMD_LOGICOPS_COLORFILL 1262 */
|
---|
4122 | static int vmsvga3dCmdLogicOpsColorFill(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsColorFill const *pCmd, uint32_t cbCmd)
|
---|
4123 | {
|
---|
4124 | #ifdef VMSVGA3D_DX
|
---|
4125 | DEBUG_BREAKPOINT_TEST();
|
---|
4126 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4127 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4128 | return vmsvga3dLogicOpsColorFill(pThisCC, idDXContext);
|
---|
4129 | #else
|
---|
4130 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4131 | return VERR_NOT_SUPPORTED;
|
---|
4132 | #endif
|
---|
4133 | }
|
---|
4134 |
|
---|
4135 |
|
---|
4136 | /* SVGA_3D_CMD_LOGICOPS_ALPHABLEND 1263 */
|
---|
4137 | static int vmsvga3dCmdLogicOpsAlphaBlend(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsAlphaBlend const *pCmd, uint32_t cbCmd)
|
---|
4138 | {
|
---|
4139 | #ifdef VMSVGA3D_DX
|
---|
4140 | DEBUG_BREAKPOINT_TEST();
|
---|
4141 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4142 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4143 | return vmsvga3dLogicOpsAlphaBlend(pThisCC, idDXContext);
|
---|
4144 | #else
|
---|
4145 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4146 | return VERR_NOT_SUPPORTED;
|
---|
4147 | #endif
|
---|
4148 | }
|
---|
4149 |
|
---|
4150 |
|
---|
4151 | /* SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND 1264 */
|
---|
4152 | static int vmsvga3dCmdLogicOpsClearTypeBlend(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsClearTypeBlend const *pCmd, uint32_t cbCmd)
|
---|
4153 | {
|
---|
4154 | #ifdef VMSVGA3D_DX
|
---|
4155 | DEBUG_BREAKPOINT_TEST();
|
---|
4156 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4157 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4158 | return vmsvga3dLogicOpsClearTypeBlend(pThisCC, idDXContext);
|
---|
4159 | #else
|
---|
4160 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4161 | return VERR_NOT_SUPPORTED;
|
---|
4162 | #endif
|
---|
4163 | }
|
---|
4164 |
|
---|
4165 |
|
---|
4166 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 1267 */
|
---|
4167 | static int vmsvga3dCmdDefineGBSurface_v4(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface_v4 const *pCmd)
|
---|
4168 | {
|
---|
4169 | #ifdef VMSVGA3D_DX
|
---|
4170 | //DEBUG_BREAKPOINT_TEST();
|
---|
4171 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4172 |
|
---|
4173 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
4174 | SVGAOTableSurfaceEntry entry;
|
---|
4175 | RT_ZERO(entry);
|
---|
4176 | entry.format = pCmd->format;
|
---|
4177 | entry.surface1Flags = (uint32_t)(pCmd->surfaceFlags);
|
---|
4178 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
4179 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
4180 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
4181 | entry.size = pCmd->size;
|
---|
4182 | entry.mobid = SVGA_ID_INVALID;
|
---|
4183 | entry.arraySize = pCmd->arraySize;
|
---|
4184 | // entry.mobPitch = 0;
|
---|
4185 | entry.surface2Flags = (uint32_t)(pCmd->surfaceFlags >> UINT64_C(32));
|
---|
4186 | entry.multisamplePattern = pCmd->multisamplePattern;
|
---|
4187 | entry.qualityLevel = pCmd->qualityLevel;
|
---|
4188 | entry.bufferByteStride = pCmd->bufferByteStride;
|
---|
4189 | // entry.minLOD = 0;
|
---|
4190 |
|
---|
4191 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
4192 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
4193 | if (RT_SUCCESS(rc))
|
---|
4194 | {
|
---|
4195 | /* Create the host surface. */
|
---|
4196 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
4197 | pCmd->multisampleCount, pCmd->multisamplePattern, pCmd->qualityLevel, pCmd->autogenFilter,
|
---|
4198 | pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, pCmd->bufferByteStride, /* fAllocMipLevels = */ false);
|
---|
4199 | }
|
---|
4200 | return rc;
|
---|
4201 | #else
|
---|
4202 | RT_NOREF(pThisCC, pCmd);
|
---|
4203 | return VERR_NOT_SUPPORTED;
|
---|
4204 | #endif
|
---|
4205 | }
|
---|
4206 |
|
---|
4207 |
|
---|
4208 | /* SVGA_3D_CMD_DX_SET_CS_UA_VIEWS 1268 */
|
---|
4209 | static int vmsvga3dCmdDXSetCSUAViews(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetCSUAViews const *pCmd, uint32_t cbCmd)
|
---|
4210 | {
|
---|
4211 | #ifdef VMSVGA3D_DX
|
---|
4212 | //DEBUG_BREAKPOINT_TEST();
|
---|
4213 | SVGA3dUAViewId const *paUAViewId = (SVGA3dUAViewId *)&pCmd[1];
|
---|
4214 | uint32_t const cUAViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dUAViewId);
|
---|
4215 | return vmsvga3dDXSetCSUAViews(pThisCC, idDXContext, pCmd, cUAViewId, paUAViewId);
|
---|
4216 | #else
|
---|
4217 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4218 | return VERR_NOT_SUPPORTED;
|
---|
4219 | #endif
|
---|
4220 | }
|
---|
4221 |
|
---|
4222 |
|
---|
4223 | /* SVGA_3D_CMD_DX_SET_MIN_LOD 1269 */
|
---|
4224 | static int vmsvga3dCmdDXSetMinLOD(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetMinLOD const *pCmd, uint32_t cbCmd)
|
---|
4225 | {
|
---|
4226 | #ifdef VMSVGA3D_DX
|
---|
4227 | DEBUG_BREAKPOINT_TEST();
|
---|
4228 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4229 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4230 | return vmsvga3dDXSetMinLOD(pThisCC, idDXContext);
|
---|
4231 | #else
|
---|
4232 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4233 | return VERR_NOT_SUPPORTED;
|
---|
4234 | #endif
|
---|
4235 | }
|
---|
4236 |
|
---|
4237 |
|
---|
4238 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2 1272 */
|
---|
4239 | static int vmsvga3dCmdDXDefineDepthStencilView_v2(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilView_v2 const *pCmd, uint32_t cbCmd)
|
---|
4240 | {
|
---|
4241 | #ifdef VMSVGA3D_DX
|
---|
4242 | //DEBUG_BREAKPOINT_TEST();
|
---|
4243 | RT_NOREF(cbCmd);
|
---|
4244 | return vmsvga3dDXDefineDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
4245 | #else
|
---|
4246 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4247 | return VERR_NOT_SUPPORTED;
|
---|
4248 | #endif
|
---|
4249 | }
|
---|
4250 |
|
---|
4251 |
|
---|
4252 | /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB 1273 */
|
---|
4253 | static int vmsvga3dCmdDXDefineStreamOutputWithMob(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineStreamOutputWithMob const *pCmd, uint32_t cbCmd)
|
---|
4254 | {
|
---|
4255 | #ifdef VMSVGA3D_DX
|
---|
4256 | //DEBUG_BREAKPOINT_TEST();
|
---|
4257 | RT_NOREF(cbCmd);
|
---|
4258 | return vmsvga3dDXDefineStreamOutputWithMob(pThisCC, idDXContext, pCmd);
|
---|
4259 | #else
|
---|
4260 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4261 | return VERR_NOT_SUPPORTED;
|
---|
4262 | #endif
|
---|
4263 | }
|
---|
4264 |
|
---|
4265 |
|
---|
4266 | /* SVGA_3D_CMD_DX_SET_SHADER_IFACE 1274 */
|
---|
4267 | static int vmsvga3dCmdDXSetShaderIface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShaderIface const *pCmd, uint32_t cbCmd)
|
---|
4268 | {
|
---|
4269 | #ifdef VMSVGA3D_DX
|
---|
4270 | DEBUG_BREAKPOINT_TEST();
|
---|
4271 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4272 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4273 | return vmsvga3dDXSetShaderIface(pThisCC, idDXContext);
|
---|
4274 | #else
|
---|
4275 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4276 | return VERR_NOT_SUPPORTED;
|
---|
4277 | #endif
|
---|
4278 | }
|
---|
4279 |
|
---|
4280 |
|
---|
4281 | /* SVGA_3D_CMD_DX_BIND_STREAMOUTPUT 1275 */
|
---|
4282 | static int vmsvga3dCmdDXBindStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
4283 | {
|
---|
4284 | #ifdef VMSVGA3D_DX
|
---|
4285 | //DEBUG_BREAKPOINT_TEST();
|
---|
4286 | RT_NOREF(cbCmd);
|
---|
4287 | return vmsvga3dDXBindStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
4288 | #else
|
---|
4289 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4290 | return VERR_NOT_SUPPORTED;
|
---|
4291 | #endif
|
---|
4292 | }
|
---|
4293 |
|
---|
4294 |
|
---|
4295 | /* SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS 1276 */
|
---|
4296 | static int vmsvga3dCmdSurfaceStretchBltNonMSToMS(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdSurfaceStretchBltNonMSToMS const *pCmd, uint32_t cbCmd)
|
---|
4297 | {
|
---|
4298 | #ifdef VMSVGA3D_DX
|
---|
4299 | DEBUG_BREAKPOINT_TEST();
|
---|
4300 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4301 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4302 | return vmsvga3dSurfaceStretchBltNonMSToMS(pThisCC, idDXContext);
|
---|
4303 | #else
|
---|
4304 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4305 | return VERR_NOT_SUPPORTED;
|
---|
4306 | #endif
|
---|
4307 | }
|
---|
4308 |
|
---|
4309 |
|
---|
4310 | /* SVGA_3D_CMD_DX_BIND_SHADER_IFACE 1277 */
|
---|
4311 | static int vmsvga3dCmdDXBindShaderIface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindShaderIface const *pCmd, uint32_t cbCmd)
|
---|
4312 | {
|
---|
4313 | #ifdef VMSVGA3D_DX
|
---|
4314 | DEBUG_BREAKPOINT_TEST();
|
---|
4315 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4316 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4317 | return vmsvga3dDXBindShaderIface(pThisCC, idDXContext);
|
---|
4318 | #else
|
---|
4319 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4320 | return VERR_NOT_SUPPORTED;
|
---|
4321 | #endif
|
---|
4322 | }
|
---|
4323 |
|
---|
4324 |
|
---|
4325 | /* SVGA_3D_CMD_VB_DX_CLEAR_RENDERTARGET_VIEW_REGION 1083 */
|
---|
4326 | static int vmsvga3dCmdVBDXClearRenderTargetViewRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdVBDXClearRenderTargetViewRegion *pCmd, uint32_t cbCmd)
|
---|
4327 | {
|
---|
4328 | #ifdef VMSVGA3D_DX
|
---|
4329 | //DEBUG_BREAKPOINT_TEST();
|
---|
4330 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
4331 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4332 | return vmsvga3dVBDXClearRenderTargetViewRegion(pThisCC, idDXContext, pCmd, cRect, paRect);
|
---|
4333 | #else
|
---|
4334 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4335 | return VERR_NOT_SUPPORTED;
|
---|
4336 | #endif
|
---|
4337 | }
|
---|
4338 |
|
---|
4339 |
|
---|
4340 | /* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR VBSVGA_3D_CMD_BASE + 0 */
|
---|
4341 | static int vmsvga3dVBCmdDXDefineVideoProcessor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessor *pCmd, uint32_t cbCmd)
|
---|
4342 | {
|
---|
4343 | #ifdef VMSVGA3D_DX
|
---|
4344 | //DEBUG_BREAKPOINT_TEST();
|
---|
4345 | RT_NOREF(cbCmd);
|
---|
4346 | return vmsvga3dVBDXDefineVideoProcessor(pThisCC, idDXContext, pCmd);
|
---|
4347 | #else
|
---|
4348 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4349 | return VERR_NOT_SUPPORTED;
|
---|
4350 | #endif
|
---|
4351 | }
|
---|
4352 |
|
---|
4353 |
|
---|
4354 | /* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER_OUTPUT_VIEW VBSVGA_3D_CMD_BASE + 1 */
|
---|
4355 | static int vmsvga3dVBCmdDXDefineVideoDecoderOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoDecoderOutputView *pCmd, uint32_t cbCmd)
|
---|
4356 | {
|
---|
4357 | #ifdef VMSVGA3D_DX
|
---|
4358 | //DEBUG_BREAKPOINT_TEST();
|
---|
4359 | RT_NOREF(cbCmd);
|
---|
4360 | return vmsvga3dVBDXDefineVideoDecoderOutputView(pThisCC, idDXContext, pCmd);
|
---|
4361 | #else
|
---|
4362 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4363 | return VERR_NOT_SUPPORTED;
|
---|
4364 | #endif
|
---|
4365 | }
|
---|
4366 |
|
---|
4367 |
|
---|
4368 | /* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER VBSVGA_3D_CMD_BASE + 2 */
|
---|
4369 | static int vmsvga3dVBCmdDXDefineVideoDecoder(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoDecoder *pCmd, uint32_t cbCmd)
|
---|
4370 | {
|
---|
4371 | #ifdef VMSVGA3D_DX
|
---|
4372 | //DEBUG_BREAKPOINT_TEST();
|
---|
4373 | RT_NOREF(cbCmd);
|
---|
4374 | return vmsvga3dVBDXDefineVideoDecoder(pThisCC, idDXContext, pCmd);
|
---|
4375 | #else
|
---|
4376 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4377 | return VERR_NOT_SUPPORTED;
|
---|
4378 | #endif
|
---|
4379 | }
|
---|
4380 |
|
---|
4381 |
|
---|
4382 | /* VBSVGA_3D_CMD_DX_VIDEO_DECODER_BEGIN_FRAME VBSVGA_3D_CMD_BASE + 3 */
|
---|
4383 | static int vmsvga3dVBCmdDXVideoDecoderBeginFrame(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderBeginFrame *pCmd, uint32_t cbCmd)
|
---|
4384 | {
|
---|
4385 | #ifdef VMSVGA3D_DX
|
---|
4386 | //DEBUG_BREAKPOINT_TEST();
|
---|
4387 | RT_NOREF(cbCmd);
|
---|
4388 | return vmsvga3dVBDXVideoDecoderBeginFrame(pThisCC, idDXContext, pCmd);
|
---|
4389 | #else
|
---|
4390 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4391 | return VERR_NOT_SUPPORTED;
|
---|
4392 | #endif
|
---|
4393 | }
|
---|
4394 |
|
---|
4395 |
|
---|
4396 | /* VBSVGA_3D_CMD_DX_VIDEO_DECODER_SUBMIT_BUFFERS VBSVGA_3D_CMD_BASE + 4 */
|
---|
4397 | static int vmsvga3dVBCmdDXVideoDecoderSubmitBuffers(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderSubmitBuffers *pCmd, uint32_t cbCmd)
|
---|
4398 | {
|
---|
4399 | #ifdef VMSVGA3D_DX
|
---|
4400 | //DEBUG_BREAKPOINT_TEST();
|
---|
4401 | VBSVGA3dVideoDecoderBufferDesc const *paBufferDesc = (VBSVGA3dVideoDecoderBufferDesc *)&pCmd[1];
|
---|
4402 | uint32_t const cBuffer = (cbCmd - sizeof(*pCmd)) / sizeof(VBSVGA3dVideoDecoderBufferDesc);
|
---|
4403 | return vmsvga3dVBDXVideoDecoderSubmitBuffers(pThisCC, idDXContext, pCmd, cBuffer, paBufferDesc);
|
---|
4404 | #else
|
---|
4405 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4406 | return VERR_NOT_SUPPORTED;
|
---|
4407 | #endif
|
---|
4408 | }
|
---|
4409 |
|
---|
4410 |
|
---|
4411 | /* VBSVGA_3D_CMD_DX_VIDEO_DECODER_END_FRAME VBSVGA_3D_CMD_BASE + 5 */
|
---|
4412 | static int vmsvga3dVBCmdDXVideoDecoderEndFrame(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderEndFrame *pCmd, uint32_t cbCmd)
|
---|
4413 | {
|
---|
4414 | #ifdef VMSVGA3D_DX
|
---|
4415 | //DEBUG_BREAKPOINT_TEST();
|
---|
4416 | RT_NOREF(cbCmd);
|
---|
4417 | return vmsvga3dVBDXVideoDecoderEndFrame(pThisCC, idDXContext, pCmd);
|
---|
4418 | #else
|
---|
4419 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4420 | return VERR_NOT_SUPPORTED;
|
---|
4421 | #endif
|
---|
4422 | }
|
---|
4423 |
|
---|
4424 |
|
---|
4425 | /* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_INPUT_VIEW VBSVGA_3D_CMD_BASE + 6 */
|
---|
4426 | static int vmsvga3dVBCmdDXDefineVideoProcessorInputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessorInputView *pCmd, uint32_t cbCmd)
|
---|
4427 | {
|
---|
4428 | #ifdef VMSVGA3D_DX
|
---|
4429 | //DEBUG_BREAKPOINT_TEST();
|
---|
4430 | RT_NOREF(cbCmd);
|
---|
4431 | return vmsvga3dVBDXDefineVideoProcessorInputView(pThisCC, idDXContext, pCmd);
|
---|
4432 | #else
|
---|
4433 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4434 | return VERR_NOT_SUPPORTED;
|
---|
4435 | #endif
|
---|
4436 | }
|
---|
4437 |
|
---|
4438 |
|
---|
4439 | /* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_OUTPUT_VIEW VBSVGA_3D_CMD_BASE + 7 */
|
---|
4440 | static int vmsvga3dVBCmdDXDefineVideoProcessorOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessorOutputView *pCmd, uint32_t cbCmd)
|
---|
4441 | {
|
---|
4442 | #ifdef VMSVGA3D_DX
|
---|
4443 | //DEBUG_BREAKPOINT_TEST();
|
---|
4444 | RT_NOREF(cbCmd);
|
---|
4445 | return vmsvga3dVBDXDefineVideoProcessorOutputView(pThisCC, idDXContext, pCmd);
|
---|
4446 | #else
|
---|
4447 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4448 | return VERR_NOT_SUPPORTED;
|
---|
4449 | #endif
|
---|
4450 | }
|
---|
4451 |
|
---|
4452 |
|
---|
4453 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_BLT VBSVGA_3D_CMD_BASE + 8 */
|
---|
4454 | static int vmsvga3dVBCmdDXVideoProcessorBlt(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorBlt *pCmd, uint32_t cbCmd)
|
---|
4455 | {
|
---|
4456 | #ifdef VMSVGA3D_DX
|
---|
4457 | //DEBUG_BREAKPOINT_TEST();
|
---|
4458 | return vmsvga3dVBDXVideoProcessorBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4459 | #else
|
---|
4460 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4461 | return VERR_NOT_SUPPORTED;
|
---|
4462 | #endif
|
---|
4463 | }
|
---|
4464 |
|
---|
4465 |
|
---|
4466 | /* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER VBSVGA_3D_CMD_BASE + 9 */
|
---|
4467 | static int vmsvga3dVBCmdDXDestroyVideoDecoder(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoDecoder *pCmd, uint32_t cbCmd)
|
---|
4468 | {
|
---|
4469 | #ifdef VMSVGA3D_DX
|
---|
4470 | //DEBUG_BREAKPOINT_TEST();
|
---|
4471 | RT_NOREF(cbCmd);
|
---|
4472 | return vmsvga3dVBDXDestroyVideoDecoder(pThisCC, idDXContext, pCmd);
|
---|
4473 | #else
|
---|
4474 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4475 | return VERR_NOT_SUPPORTED;
|
---|
4476 | #endif
|
---|
4477 | }
|
---|
4478 |
|
---|
4479 |
|
---|
4480 | /* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER_OUTPUT_VIEW VBSVGA_3D_CMD_BASE + 10 */
|
---|
4481 | static int vmsvga3dVBCmdDXDestroyVideoDecoderOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoDecoderOutputView *pCmd, uint32_t cbCmd)
|
---|
4482 | {
|
---|
4483 | #ifdef VMSVGA3D_DX
|
---|
4484 | //DEBUG_BREAKPOINT_TEST();
|
---|
4485 | RT_NOREF(cbCmd);
|
---|
4486 | return vmsvga3dVBDXDestroyVideoDecoderOutputView(pThisCC, idDXContext, pCmd);
|
---|
4487 | #else
|
---|
4488 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4489 | return VERR_NOT_SUPPORTED;
|
---|
4490 | #endif
|
---|
4491 | }
|
---|
4492 |
|
---|
4493 |
|
---|
4494 | /* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR VBSVGA_3D_CMD_BASE + 11 */
|
---|
4495 | static int vmsvga3dVBCmdDXDestroyVideoProcessor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessor *pCmd, uint32_t cbCmd)
|
---|
4496 | {
|
---|
4497 | #ifdef VMSVGA3D_DX
|
---|
4498 | //DEBUG_BREAKPOINT_TEST();
|
---|
4499 | RT_NOREF(cbCmd);
|
---|
4500 | return vmsvga3dVBDXDestroyVideoProcessor(pThisCC, idDXContext, pCmd);
|
---|
4501 | #else
|
---|
4502 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4503 | return VERR_NOT_SUPPORTED;
|
---|
4504 | #endif
|
---|
4505 | }
|
---|
4506 |
|
---|
4507 |
|
---|
4508 | /* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_INPUT_VIEW VBSVGA_3D_CMD_BASE + 12 */
|
---|
4509 | static int vmsvga3dVBCmdDXDestroyVideoProcessorInputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessorInputView *pCmd, uint32_t cbCmd)
|
---|
4510 | {
|
---|
4511 | #ifdef VMSVGA3D_DX
|
---|
4512 | //DEBUG_BREAKPOINT_TEST();
|
---|
4513 | RT_NOREF(cbCmd);
|
---|
4514 | return vmsvga3dVBDXDestroyVideoProcessorInputView(pThisCC, idDXContext, pCmd);
|
---|
4515 | #else
|
---|
4516 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4517 | return VERR_NOT_SUPPORTED;
|
---|
4518 | #endif
|
---|
4519 | }
|
---|
4520 |
|
---|
4521 |
|
---|
4522 | /* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_OUTPUT_VIEW VBSVGA_3D_CMD_BASE + 13 */
|
---|
4523 | static int vmsvga3dVBCmdDXDestroyVideoProcessorOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessorOutputView *pCmd, uint32_t cbCmd)
|
---|
4524 | {
|
---|
4525 | #ifdef VMSVGA3D_DX
|
---|
4526 | //DEBUG_BREAKPOINT_TEST();
|
---|
4527 | RT_NOREF(cbCmd);
|
---|
4528 | return vmsvga3dVBDXDestroyVideoProcessorOutputView(pThisCC, idDXContext, pCmd);
|
---|
4529 | #else
|
---|
4530 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4531 | return VERR_NOT_SUPPORTED;
|
---|
4532 | #endif
|
---|
4533 | }
|
---|
4534 |
|
---|
4535 |
|
---|
4536 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_TARGET_RECT VBSVGA_3D_CMD_BASE + 14 */
|
---|
4537 | static int vmsvga3dVBCmdDXVideoProcessorSetOutputTargetRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputTargetRect const *pCmd, uint32_t cbCmd)
|
---|
4538 | {
|
---|
4539 | #ifdef VMSVGA3D_DX
|
---|
4540 | //DEBUG_BREAKPOINT_TEST();
|
---|
4541 | RT_NOREF(cbCmd);
|
---|
4542 | return vmsvga3dVBDXVideoProcessorSetOutputTargetRect(pThisCC, idDXContext, pCmd);
|
---|
4543 | #else
|
---|
4544 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4545 | return VERR_NOT_SUPPORTED;
|
---|
4546 | #endif
|
---|
4547 | }
|
---|
4548 |
|
---|
4549 |
|
---|
4550 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_BACKGROUND_COLOR VBSVGA_3D_CMD_BASE + 15 */
|
---|
4551 | static int vmsvga3dVBCmdDXVideoProcessorSetOutputBackgroundColor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputBackgroundColor const *pCmd, uint32_t cbCmd)
|
---|
4552 | {
|
---|
4553 | #ifdef VMSVGA3D_DX
|
---|
4554 | //DEBUG_BREAKPOINT_TEST();
|
---|
4555 | RT_NOREF(cbCmd);
|
---|
4556 | return vmsvga3dVBDXVideoProcessorSetOutputBackgroundColor(pThisCC, idDXContext, pCmd);
|
---|
4557 | #else
|
---|
4558 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4559 | return VERR_NOT_SUPPORTED;
|
---|
4560 | #endif
|
---|
4561 | }
|
---|
4562 |
|
---|
4563 |
|
---|
4564 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_COLOR_SPACE VBSVGA_3D_CMD_BASE + 16 */
|
---|
4565 | static int vmsvga3dVBCmdDXVideoProcessorSetOutputColorSpace(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputColorSpace const *pCmd, uint32_t cbCmd)
|
---|
4566 | {
|
---|
4567 | #ifdef VMSVGA3D_DX
|
---|
4568 | //DEBUG_BREAKPOINT_TEST();
|
---|
4569 | RT_NOREF(cbCmd);
|
---|
4570 | return vmsvga3dVBDXVideoProcessorSetOutputColorSpace(pThisCC, idDXContext, pCmd);
|
---|
4571 | #else
|
---|
4572 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4573 | return VERR_NOT_SUPPORTED;
|
---|
4574 | #endif
|
---|
4575 | }
|
---|
4576 |
|
---|
4577 |
|
---|
4578 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_ALPHA_FILL_MODE VBSVGA_3D_CMD_BASE + 17 */
|
---|
4579 | static int vmsvga3dVBCmdDXVideoProcessorSetOutputAlphaFillMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputAlphaFillMode const *pCmd, uint32_t cbCmd)
|
---|
4580 | {
|
---|
4581 | #ifdef VMSVGA3D_DX
|
---|
4582 | //DEBUG_BREAKPOINT_TEST();
|
---|
4583 | RT_NOREF(cbCmd);
|
---|
4584 | return vmsvga3dVBDXVideoProcessorSetOutputAlphaFillMode(pThisCC, idDXContext, pCmd);
|
---|
4585 | #else
|
---|
4586 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4587 | return VERR_NOT_SUPPORTED;
|
---|
4588 | #endif
|
---|
4589 | }
|
---|
4590 |
|
---|
4591 |
|
---|
4592 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_CONSTRICTION VBSVGA_3D_CMD_BASE + 18 */
|
---|
4593 | static int vmsvga3dVBCmdDXVideoProcessorSetOutputConstriction(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputConstriction const *pCmd, uint32_t cbCmd)
|
---|
4594 | {
|
---|
4595 | #ifdef VMSVGA3D_DX
|
---|
4596 | //DEBUG_BREAKPOINT_TEST();
|
---|
4597 | RT_NOREF(cbCmd);
|
---|
4598 | return vmsvga3dVBDXVideoProcessorSetOutputConstriction(pThisCC, idDXContext, pCmd);
|
---|
4599 | #else
|
---|
4600 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4601 | return VERR_NOT_SUPPORTED;
|
---|
4602 | #endif
|
---|
4603 | }
|
---|
4604 |
|
---|
4605 |
|
---|
4606 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_STEREO_MODE VBSVGA_3D_CMD_BASE + 19 */
|
---|
4607 | static int vmsvga3dVBCmdDXVideoProcessorSetOutputStereoMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputStereoMode const *pCmd, uint32_t cbCmd)
|
---|
4608 | {
|
---|
4609 | #ifdef VMSVGA3D_DX
|
---|
4610 | //DEBUG_BREAKPOINT_TEST();
|
---|
4611 | RT_NOREF(cbCmd);
|
---|
4612 | return vmsvga3dVBDXVideoProcessorSetOutputStereoMode(pThisCC, idDXContext, pCmd);
|
---|
4613 | #else
|
---|
4614 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4615 | return VERR_NOT_SUPPORTED;
|
---|
4616 | #endif
|
---|
4617 | }
|
---|
4618 |
|
---|
4619 |
|
---|
4620 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FRAME_FORMAT VBSVGA_3D_CMD_BASE + 20 */
|
---|
4621 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamFrameFormat(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamFrameFormat const *pCmd, uint32_t cbCmd)
|
---|
4622 | {
|
---|
4623 | #ifdef VMSVGA3D_DX
|
---|
4624 | //DEBUG_BREAKPOINT_TEST();
|
---|
4625 | RT_NOREF(cbCmd);
|
---|
4626 | return vmsvga3dVBDXVideoProcessorSetStreamFrameFormat(pThisCC, idDXContext, pCmd);
|
---|
4627 | #else
|
---|
4628 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4629 | return VERR_NOT_SUPPORTED;
|
---|
4630 | #endif
|
---|
4631 | }
|
---|
4632 |
|
---|
4633 |
|
---|
4634 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_COLOR_SPACE VBSVGA_3D_CMD_BASE + 21 */
|
---|
4635 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamColorSpace(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamColorSpace const *pCmd, uint32_t cbCmd)
|
---|
4636 | {
|
---|
4637 | #ifdef VMSVGA3D_DX
|
---|
4638 | //DEBUG_BREAKPOINT_TEST();
|
---|
4639 | RT_NOREF(cbCmd);
|
---|
4640 | return vmsvga3dVBDXVideoProcessorSetStreamColorSpace(pThisCC, idDXContext, pCmd);
|
---|
4641 | #else
|
---|
4642 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4643 | return VERR_NOT_SUPPORTED;
|
---|
4644 | #endif
|
---|
4645 | }
|
---|
4646 |
|
---|
4647 |
|
---|
4648 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_OUTPUT_RATE VBSVGA_3D_CMD_BASE + 22 */
|
---|
4649 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamOutputRate(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamOutputRate const *pCmd, uint32_t cbCmd)
|
---|
4650 | {
|
---|
4651 | #ifdef VMSVGA3D_DX
|
---|
4652 | //DEBUG_BREAKPOINT_TEST();
|
---|
4653 | RT_NOREF(cbCmd);
|
---|
4654 | return vmsvga3dVBDXVideoProcessorSetStreamOutputRate(pThisCC, idDXContext, pCmd);
|
---|
4655 | #else
|
---|
4656 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4657 | return VERR_NOT_SUPPORTED;
|
---|
4658 | #endif
|
---|
4659 | }
|
---|
4660 |
|
---|
4661 |
|
---|
4662 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_SOURCE_RECT VBSVGA_3D_CMD_BASE + 23 */
|
---|
4663 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamSourceRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamSourceRect const *pCmd, uint32_t cbCmd)
|
---|
4664 | {
|
---|
4665 | #ifdef VMSVGA3D_DX
|
---|
4666 | //DEBUG_BREAKPOINT_TEST();
|
---|
4667 | RT_NOREF(cbCmd);
|
---|
4668 | return vmsvga3dVBDXVideoProcessorSetStreamSourceRect(pThisCC, idDXContext, pCmd);
|
---|
4669 | #else
|
---|
4670 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4671 | return VERR_NOT_SUPPORTED;
|
---|
4672 | #endif
|
---|
4673 | }
|
---|
4674 |
|
---|
4675 |
|
---|
4676 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_DEST_RECT VBSVGA_3D_CMD_BASE + 24 */
|
---|
4677 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamDestRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamDestRect const *pCmd, uint32_t cbCmd)
|
---|
4678 | {
|
---|
4679 | #ifdef VMSVGA3D_DX
|
---|
4680 | //DEBUG_BREAKPOINT_TEST();
|
---|
4681 | RT_NOREF(cbCmd);
|
---|
4682 | return vmsvga3dVBDXVideoProcessorSetStreamDestRect(pThisCC, idDXContext, pCmd);
|
---|
4683 | #else
|
---|
4684 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4685 | return VERR_NOT_SUPPORTED;
|
---|
4686 | #endif
|
---|
4687 | }
|
---|
4688 |
|
---|
4689 |
|
---|
4690 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ALPHA VBSVGA_3D_CMD_BASE + 25 */
|
---|
4691 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamAlpha(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamAlpha const *pCmd, uint32_t cbCmd)
|
---|
4692 | {
|
---|
4693 | #ifdef VMSVGA3D_DX
|
---|
4694 | //DEBUG_BREAKPOINT_TEST();
|
---|
4695 | RT_NOREF(cbCmd);
|
---|
4696 | return vmsvga3dVBDXVideoProcessorSetStreamAlpha(pThisCC, idDXContext, pCmd);
|
---|
4697 | #else
|
---|
4698 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4699 | return VERR_NOT_SUPPORTED;
|
---|
4700 | #endif
|
---|
4701 | }
|
---|
4702 |
|
---|
4703 |
|
---|
4704 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PALETTE VBSVGA_3D_CMD_BASE + 26, */
|
---|
4705 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamPalette(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamPalette const *pCmd, uint32_t cbCmd)
|
---|
4706 | {
|
---|
4707 | #ifdef VMSVGA3D_DX
|
---|
4708 | //DEBUG_BREAKPOINT_TEST();
|
---|
4709 | uint32_t const *paEntries = (uint32_t *)&pCmd[1];
|
---|
4710 | uint32_t const cEntries = (cbCmd - sizeof(*pCmd)) / sizeof(uint32_t);
|
---|
4711 | return vmsvga3dVBDXVideoProcessorSetStreamPalette(pThisCC, idDXContext, pCmd, cEntries, paEntries);
|
---|
4712 | #else
|
---|
4713 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4714 | return VERR_NOT_SUPPORTED;
|
---|
4715 | #endif
|
---|
4716 | }
|
---|
4717 |
|
---|
4718 |
|
---|
4719 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PIXEL_ASPECT_RATIO VBSVGA_3D_CMD_BASE + 27 */
|
---|
4720 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamPixelAspectRatio(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamPixelAspectRatio const *pCmd, uint32_t cbCmd)
|
---|
4721 | {
|
---|
4722 | #ifdef VMSVGA3D_DX
|
---|
4723 | //DEBUG_BREAKPOINT_TEST();
|
---|
4724 | RT_NOREF(cbCmd);
|
---|
4725 | return vmsvga3dVBDXVideoProcessorSetStreamPixelAspectRatio(pThisCC, idDXContext, pCmd);
|
---|
4726 | #else
|
---|
4727 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4728 | return VERR_NOT_SUPPORTED;
|
---|
4729 | #endif
|
---|
4730 | }
|
---|
4731 |
|
---|
4732 |
|
---|
4733 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_LUMA_KEY VBSVGA_3D_CMD_BASE + 28 */
|
---|
4734 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamLumaKey(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamLumaKey const *pCmd, uint32_t cbCmd)
|
---|
4735 | {
|
---|
4736 | #ifdef VMSVGA3D_DX
|
---|
4737 | //DEBUG_BREAKPOINT_TEST();
|
---|
4738 | RT_NOREF(cbCmd);
|
---|
4739 | return vmsvga3dVBDXVideoProcessorSetStreamLumaKey(pThisCC, idDXContext, pCmd);
|
---|
4740 | #else
|
---|
4741 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4742 | return VERR_NOT_SUPPORTED;
|
---|
4743 | #endif
|
---|
4744 | }
|
---|
4745 |
|
---|
4746 |
|
---|
4747 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_STEREO_FORMAT VBSVGA_3D_CMD_BASE + 29 */
|
---|
4748 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamStereoFormat(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamStereoFormat const *pCmd, uint32_t cbCmd)
|
---|
4749 | {
|
---|
4750 | #ifdef VMSVGA3D_DX
|
---|
4751 | //DEBUG_BREAKPOINT_TEST();
|
---|
4752 | RT_NOREF(cbCmd);
|
---|
4753 | return vmsvga3dVBDXVideoProcessorSetStreamStereoFormat(pThisCC, idDXContext, pCmd);
|
---|
4754 | #else
|
---|
4755 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4756 | return VERR_NOT_SUPPORTED;
|
---|
4757 | #endif
|
---|
4758 | }
|
---|
4759 |
|
---|
4760 |
|
---|
4761 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_AUTO_PROCESSING_MODE VBSVGA_3D_CMD_BASE + 30 */
|
---|
4762 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamAutoProcessingMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamAutoProcessingMode const *pCmd, uint32_t cbCmd)
|
---|
4763 | {
|
---|
4764 | #ifdef VMSVGA3D_DX
|
---|
4765 | //DEBUG_BREAKPOINT_TEST();
|
---|
4766 | RT_NOREF(cbCmd);
|
---|
4767 | return vmsvga3dVBDXVideoProcessorSetStreamAutoProcessingMode(pThisCC, idDXContext, pCmd);
|
---|
4768 | #else
|
---|
4769 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4770 | return VERR_NOT_SUPPORTED;
|
---|
4771 | #endif
|
---|
4772 | }
|
---|
4773 |
|
---|
4774 |
|
---|
4775 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FILTER VBSVGA_3D_CMD_BASE + 31 */
|
---|
4776 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamFilter(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamFilter const *pCmd, uint32_t cbCmd)
|
---|
4777 | {
|
---|
4778 | #ifdef VMSVGA3D_DX
|
---|
4779 | //DEBUG_BREAKPOINT_TEST();
|
---|
4780 | RT_NOREF(cbCmd);
|
---|
4781 | return vmsvga3dVBDXVideoProcessorSetStreamFilter(pThisCC, idDXContext, pCmd);
|
---|
4782 | #else
|
---|
4783 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4784 | return VERR_NOT_SUPPORTED;
|
---|
4785 | #endif
|
---|
4786 | }
|
---|
4787 |
|
---|
4788 |
|
---|
4789 | /* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ROTATION VBSVGA_3D_CMD_BASE + 32 */
|
---|
4790 | static int vmsvga3dVBCmdDXVideoProcessorSetStreamRotation(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamRotation const *pCmd, uint32_t cbCmd)
|
---|
4791 | {
|
---|
4792 | #ifdef VMSVGA3D_DX
|
---|
4793 | //DEBUG_BREAKPOINT_TEST();
|
---|
4794 | RT_NOREF(cbCmd);
|
---|
4795 | return vmsvga3dVBDXVideoProcessorSetStreamRotation(pThisCC, idDXContext, pCmd);
|
---|
4796 | #else
|
---|
4797 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4798 | return VERR_NOT_SUPPORTED;
|
---|
4799 | #endif
|
---|
4800 | }
|
---|
4801 |
|
---|
4802 |
|
---|
4803 | /* VBSVGA_3D_CMD_DX_GET_VIDEO_CAPABILITY VBSVGA_3D_CMD_BASE + 33 */
|
---|
4804 | static int vmsvga3dVBCmdDXGetVideoCapability(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXGetVideoCapability const *pCmd, uint32_t cbCmd)
|
---|
4805 | {
|
---|
4806 | #ifdef VMSVGA3D_DX
|
---|
4807 | //DEBUG_BREAKPOINT_TEST();
|
---|
4808 | RT_NOREF(cbCmd);
|
---|
4809 | return vmsvga3dVBDXGetVideoCapability(pThisCC, idDXContext, pCmd);
|
---|
4810 | #else
|
---|
4811 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4812 | return VERR_NOT_SUPPORTED;
|
---|
4813 | #endif
|
---|
4814 | }
|
---|
4815 |
|
---|
4816 |
|
---|
4817 | /* VBSVGA_3D_CMD_DX_CLEAR_RTV VBSVGA_3D_CMD_BASE + 34 */
|
---|
4818 | static int vmsvga3dVBCmdDXClearRTV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
|
---|
4819 | {
|
---|
4820 | #ifdef VMSVGA3D_DX
|
---|
4821 | //DEBUG_BREAKPOINT_TEST();
|
---|
4822 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
4823 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4824 | return vmsvga3dVBDXClearRTV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
|
---|
4825 | #else
|
---|
4826 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4827 | return VERR_NOT_SUPPORTED;
|
---|
4828 | #endif
|
---|
4829 | }
|
---|
4830 |
|
---|
4831 |
|
---|
4832 | /* VBSVGA_3D_CMD_DX_CLEAR_UAV VBSVGA_3D_CMD_BASE + 35 */
|
---|
4833 | static int vmsvga3dVBCmdDXClearUAV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
|
---|
4834 | {
|
---|
4835 | #ifdef VMSVGA3D_DX
|
---|
4836 | //DEBUG_BREAKPOINT_TEST();
|
---|
4837 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
4838 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4839 | return vmsvga3dVBDXClearUAV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
|
---|
4840 | #else
|
---|
4841 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4842 | return VERR_NOT_SUPPORTED;
|
---|
4843 | #endif
|
---|
4844 | }
|
---|
4845 |
|
---|
4846 |
|
---|
4847 | /* VBSVGA_3D_CMD_DX_CLEAR_VDOV VBSVGA_3D_CMD_BASE + 36 */
|
---|
4848 | static int vmsvga3dVBCmdDXClearVDOV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
|
---|
4849 | {
|
---|
4850 | #ifdef VMSVGA3D_DX
|
---|
4851 | //DEBUG_BREAKPOINT_TEST();
|
---|
4852 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
4853 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4854 | return vmsvga3dVBDXClearVDOV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
|
---|
4855 | #else
|
---|
4856 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4857 | return VERR_NOT_SUPPORTED;
|
---|
4858 | #endif
|
---|
4859 | }
|
---|
4860 |
|
---|
4861 |
|
---|
4862 | /* VBSVGA_3D_CMD_DX_CLEAR_VPIV VBSVGA_3D_CMD_BASE + 37 */
|
---|
4863 | static int vmsvga3dVBCmdDXClearVPIV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
|
---|
4864 | {
|
---|
4865 | #ifdef VMSVGA3D_DX
|
---|
4866 | //DEBUG_BREAKPOINT_TEST();
|
---|
4867 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
4868 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4869 | return vmsvga3dVBDXClearVPIV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
|
---|
4870 | #else
|
---|
4871 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4872 | return VERR_NOT_SUPPORTED;
|
---|
4873 | #endif
|
---|
4874 | }
|
---|
4875 |
|
---|
4876 |
|
---|
4877 | /* VBSVGA_3D_CMD_DX_CLEAR_VPOV VBSVGA_3D_CMD_BASE + 38 */
|
---|
4878 | static int vmsvga3dVBCmdDXClearVPOV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
|
---|
4879 | {
|
---|
4880 | #ifdef VMSVGA3D_DX
|
---|
4881 | //DEBUG_BREAKPOINT_TEST();
|
---|
4882 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
4883 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4884 | return vmsvga3dVBDXClearVPOV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
|
---|
4885 | #else
|
---|
4886 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4887 | return VERR_NOT_SUPPORTED;
|
---|
4888 | #endif
|
---|
4889 | }
|
---|
4890 |
|
---|
4891 |
|
---|
4892 | /** @def VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK
|
---|
4893 | * Check that the 3D command has at least a_cbMin of payload bytes after the
|
---|
4894 | * header. Will break out of the switch if it doesn't.
|
---|
4895 | */
|
---|
4896 | # define VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(a_cbMin) \
|
---|
4897 | if (1) { \
|
---|
4898 | AssertMsgBreak(cbCmd >= (a_cbMin), ("size=%#x a_cbMin=%#zx\n", cbCmd, (size_t)(a_cbMin))); \
|
---|
4899 | RT_UNTRUSTED_VALIDATED_FENCE(); \
|
---|
4900 | } else do {} while (0)
|
---|
4901 |
|
---|
4902 | # define VMSVGA_3D_CMD_NOTIMPL() \
|
---|
4903 | if (1) { \
|
---|
4904 | AssertMsgFailed(("Not implemented %d %s\n", enmCmdId, vmsvgaR3FifoCmdToString(enmCmdId))); \
|
---|
4905 | } else do {} while (0)
|
---|
4906 |
|
---|
4907 | /** SVGA_3D_CMD_* handler.
|
---|
4908 | * This function parses the command and calls the corresponding command handler.
|
---|
4909 | *
|
---|
4910 | * @param pThis The shared VGA/VMSVGA state.
|
---|
4911 | * @param pThisCC The VGA/VMSVGA state for the current context.
|
---|
4912 | * @param idDXContext VGPU10 DX context of the commands or SVGA3D_INVALID_ID if they are not for a specific context.
|
---|
4913 | * @param enmCmdId SVGA_3D_CMD_* command identifier.
|
---|
4914 | * @param cbCmd Size of the command in bytes.
|
---|
4915 | * @param pvCmd Pointer to the command.
|
---|
4916 | * @returns VBox status code if an error was detected parsing a command.
|
---|
4917 | */
|
---|
4918 | int vmsvgaR3Process3dCmd(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t idDXContext, SVGAFifo3dCmdId enmCmdId, uint32_t cbCmd, void const *pvCmd)
|
---|
4919 | {
|
---|
4920 | int rcParse = VINF_SUCCESS;
|
---|
4921 | PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4922 |
|
---|
4923 | switch (enmCmdId)
|
---|
4924 | {
|
---|
4925 | case SVGA_3D_CMD_SURFACE_DEFINE:
|
---|
4926 | {
|
---|
4927 | SVGA3dCmdDefineSurface *pCmd = (SVGA3dCmdDefineSurface *)pvCmd;
|
---|
4928 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4929 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDefine);
|
---|
4930 |
|
---|
4931 | SVGA3dCmdDefineSurface_v2 cmd;
|
---|
4932 | cmd.sid = pCmd->sid;
|
---|
4933 | cmd.surfaceFlags = pCmd->surfaceFlags;
|
---|
4934 | cmd.format = pCmd->format;
|
---|
4935 | memcpy(cmd.face, pCmd->face, sizeof(cmd.face));
|
---|
4936 | cmd.multisampleCount = 0;
|
---|
4937 | cmd.autogenFilter = SVGA3D_TEX_FILTER_NONE;
|
---|
4938 |
|
---|
4939 | uint32_t const cMipLevelSizes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSize);
|
---|
4940 | vmsvga3dCmdDefineSurface(pThisCC, &cmd, cMipLevelSizes, (SVGA3dSize *)(pCmd + 1));
|
---|
4941 | # ifdef DEBUG_GMR_ACCESS
|
---|
4942 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis);
|
---|
4943 | # endif
|
---|
4944 | break;
|
---|
4945 | }
|
---|
4946 |
|
---|
4947 | case SVGA_3D_CMD_SURFACE_DEFINE_V2:
|
---|
4948 | {
|
---|
4949 | SVGA3dCmdDefineSurface_v2 *pCmd = (SVGA3dCmdDefineSurface_v2 *)pvCmd;
|
---|
4950 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4951 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDefineV2);
|
---|
4952 |
|
---|
4953 | uint32_t const cMipLevelSizes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSize);
|
---|
4954 | vmsvga3dCmdDefineSurface(pThisCC, pCmd, cMipLevelSizes, (SVGA3dSize *)(pCmd + 1));
|
---|
4955 | # ifdef DEBUG_GMR_ACCESS
|
---|
4956 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis);
|
---|
4957 | # endif
|
---|
4958 | break;
|
---|
4959 | }
|
---|
4960 |
|
---|
4961 | case SVGA_3D_CMD_SURFACE_DESTROY:
|
---|
4962 | {
|
---|
4963 | SVGA3dCmdDestroySurface *pCmd = (SVGA3dCmdDestroySurface *)pvCmd;
|
---|
4964 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4965 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDestroy);
|
---|
4966 |
|
---|
4967 | vmsvga3dSurfaceDestroy(pThisCC, pCmd->sid);
|
---|
4968 | break;
|
---|
4969 | }
|
---|
4970 |
|
---|
4971 | case SVGA_3D_CMD_SURFACE_COPY:
|
---|
4972 | {
|
---|
4973 | SVGA3dCmdSurfaceCopy *pCmd = (SVGA3dCmdSurfaceCopy *)pvCmd;
|
---|
4974 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4975 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceCopy);
|
---|
4976 |
|
---|
4977 | uint32_t const cCopyBoxes = (cbCmd - sizeof(pCmd)) / sizeof(SVGA3dCopyBox);
|
---|
4978 | vmsvga3dSurfaceCopy(pThisCC, pCmd->dest, pCmd->src, cCopyBoxes, (SVGA3dCopyBox *)(pCmd + 1));
|
---|
4979 | break;
|
---|
4980 | }
|
---|
4981 |
|
---|
4982 | case SVGA_3D_CMD_SURFACE_STRETCHBLT:
|
---|
4983 | {
|
---|
4984 | SVGA3dCmdSurfaceStretchBlt *pCmd = (SVGA3dCmdSurfaceStretchBlt *)pvCmd;
|
---|
4985 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4986 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceStretchBlt);
|
---|
4987 |
|
---|
4988 | vmsvga3dSurfaceStretchBlt(pThis, pThisCC, &pCmd->dest, &pCmd->boxDest,
|
---|
4989 | &pCmd->src, &pCmd->boxSrc, pCmd->mode);
|
---|
4990 | break;
|
---|
4991 | }
|
---|
4992 |
|
---|
4993 | case SVGA_3D_CMD_SURFACE_DMA:
|
---|
4994 | {
|
---|
4995 | SVGA3dCmdSurfaceDMA *pCmd = (SVGA3dCmdSurfaceDMA *)pvCmd;
|
---|
4996 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4997 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDma);
|
---|
4998 |
|
---|
4999 | uint64_t u64NanoTS = 0;
|
---|
5000 | if (LogRelIs3Enabled())
|
---|
5001 | u64NanoTS = RTTimeNanoTS();
|
---|
5002 | uint32_t const cCopyBoxes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dCopyBox);
|
---|
5003 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dSurfaceDmaProf, a);
|
---|
5004 | vmsvga3dSurfaceDMA(pThis, pThisCC, pCmd->guest, pCmd->host, pCmd->transfer,
|
---|
5005 | cCopyBoxes, (SVGA3dCopyBox *)(pCmd + 1));
|
---|
5006 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dSurfaceDmaProf, a);
|
---|
5007 | if (LogRelIs3Enabled())
|
---|
5008 | {
|
---|
5009 | if (cCopyBoxes)
|
---|
5010 | {
|
---|
5011 | SVGA3dCopyBox *pFirstBox = (SVGA3dCopyBox *)(pCmd + 1);
|
---|
5012 | LogRel3(("VMSVGA: SURFACE_DMA: %d us %d boxes %d,%d %dx%d%s\n",
|
---|
5013 | (RTTimeNanoTS() - u64NanoTS) / 1000ULL, cCopyBoxes,
|
---|
5014 | pFirstBox->x, pFirstBox->y, pFirstBox->w, pFirstBox->h,
|
---|
5015 | pCmd->transfer == SVGA3D_READ_HOST_VRAM ? " readback!!!" : ""));
|
---|
5016 | }
|
---|
5017 | }
|
---|
5018 | break;
|
---|
5019 | }
|
---|
5020 |
|
---|
5021 | case SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN:
|
---|
5022 | {
|
---|
5023 | SVGA3dCmdBlitSurfaceToScreen *pCmd = (SVGA3dCmdBlitSurfaceToScreen *)pvCmd;
|
---|
5024 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5025 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceScreen);
|
---|
5026 |
|
---|
5027 | static uint64_t u64FrameStartNanoTS = 0;
|
---|
5028 | static uint64_t u64ElapsedPerSecNano = 0;
|
---|
5029 | static int cFrames = 0;
|
---|
5030 | uint64_t u64NanoTS = 0;
|
---|
5031 | if (LogRelIs3Enabled())
|
---|
5032 | u64NanoTS = RTTimeNanoTS();
|
---|
5033 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
5034 | STAM_REL_PROFILE_START(&pSvgaR3State->StatR3Cmd3dBlitSurfaceToScreenProf, a);
|
---|
5035 | vmsvga3dSurfaceBlitToScreen(pThis, pThisCC, pCmd->destScreenId, pCmd->destRect, pCmd->srcImage,
|
---|
5036 | pCmd->srcRect, cRects, (SVGASignedRect *)(pCmd + 1));
|
---|
5037 | STAM_REL_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dBlitSurfaceToScreenProf, a);
|
---|
5038 | if (LogRelIs3Enabled())
|
---|
5039 | {
|
---|
5040 | uint64_t u64ElapsedNano = RTTimeNanoTS() - u64NanoTS;
|
---|
5041 | u64ElapsedPerSecNano += u64ElapsedNano;
|
---|
5042 |
|
---|
5043 | SVGASignedRect *pFirstRect = cRects ? (SVGASignedRect *)(pCmd + 1) : &pCmd->destRect;
|
---|
5044 | LogRel3(("VMSVGA: SURFACE_TO_SCREEN: %d us %d rects %d,%d %dx%d\n",
|
---|
5045 | (u64ElapsedNano) / 1000ULL, cRects,
|
---|
5046 | pFirstRect->left, pFirstRect->top,
|
---|
5047 | pFirstRect->right - pFirstRect->left, pFirstRect->bottom - pFirstRect->top));
|
---|
5048 |
|
---|
5049 | ++cFrames;
|
---|
5050 | if (u64NanoTS - u64FrameStartNanoTS >= UINT64_C(1000000000))
|
---|
5051 | {
|
---|
5052 | LogRel3(("VMSVGA: SURFACE_TO_SCREEN: FPS %d, elapsed %llu us\n",
|
---|
5053 | cFrames, u64ElapsedPerSecNano / 1000ULL));
|
---|
5054 | u64FrameStartNanoTS = u64NanoTS;
|
---|
5055 | cFrames = 0;
|
---|
5056 | u64ElapsedPerSecNano = 0;
|
---|
5057 | }
|
---|
5058 | }
|
---|
5059 | break;
|
---|
5060 | }
|
---|
5061 |
|
---|
5062 | case SVGA_3D_CMD_CONTEXT_DEFINE:
|
---|
5063 | {
|
---|
5064 | SVGA3dCmdDefineContext *pCmd = (SVGA3dCmdDefineContext *)pvCmd;
|
---|
5065 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5066 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dContextDefine);
|
---|
5067 |
|
---|
5068 | vmsvga3dContextDefine(pThisCC, pCmd->cid);
|
---|
5069 | break;
|
---|
5070 | }
|
---|
5071 |
|
---|
5072 | case SVGA_3D_CMD_CONTEXT_DESTROY:
|
---|
5073 | {
|
---|
5074 | SVGA3dCmdDestroyContext *pCmd = (SVGA3dCmdDestroyContext *)pvCmd;
|
---|
5075 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5076 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dContextDestroy);
|
---|
5077 |
|
---|
5078 | vmsvga3dContextDestroy(pThisCC, pCmd->cid);
|
---|
5079 | break;
|
---|
5080 | }
|
---|
5081 |
|
---|
5082 | case SVGA_3D_CMD_SETTRANSFORM:
|
---|
5083 | {
|
---|
5084 | SVGA3dCmdSetTransform *pCmd = (SVGA3dCmdSetTransform *)pvCmd;
|
---|
5085 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5086 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetTransform);
|
---|
5087 |
|
---|
5088 | vmsvga3dSetTransform(pThisCC, pCmd->cid, pCmd->type, pCmd->matrix);
|
---|
5089 | break;
|
---|
5090 | }
|
---|
5091 |
|
---|
5092 | case SVGA_3D_CMD_SETZRANGE:
|
---|
5093 | {
|
---|
5094 | SVGA3dCmdSetZRange *pCmd = (SVGA3dCmdSetZRange *)pvCmd;
|
---|
5095 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5096 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetZRange);
|
---|
5097 |
|
---|
5098 | vmsvga3dSetZRange(pThisCC, pCmd->cid, pCmd->zRange);
|
---|
5099 | break;
|
---|
5100 | }
|
---|
5101 |
|
---|
5102 | case SVGA_3D_CMD_SETRENDERSTATE:
|
---|
5103 | {
|
---|
5104 | SVGA3dCmdSetRenderState *pCmd = (SVGA3dCmdSetRenderState *)pvCmd;
|
---|
5105 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5106 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetRenderState);
|
---|
5107 |
|
---|
5108 | uint32_t const cRenderStates = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRenderState);
|
---|
5109 | vmsvga3dSetRenderState(pThisCC, pCmd->cid, cRenderStates, (SVGA3dRenderState *)(pCmd + 1));
|
---|
5110 | break;
|
---|
5111 | }
|
---|
5112 |
|
---|
5113 | case SVGA_3D_CMD_SETRENDERTARGET:
|
---|
5114 | {
|
---|
5115 | SVGA3dCmdSetRenderTarget *pCmd = (SVGA3dCmdSetRenderTarget *)pvCmd;
|
---|
5116 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5117 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetRenderTarget);
|
---|
5118 |
|
---|
5119 | vmsvga3dSetRenderTarget(pThisCC, pCmd->cid, pCmd->type, pCmd->target);
|
---|
5120 | break;
|
---|
5121 | }
|
---|
5122 |
|
---|
5123 | case SVGA_3D_CMD_SETTEXTURESTATE:
|
---|
5124 | {
|
---|
5125 | SVGA3dCmdSetTextureState *pCmd = (SVGA3dCmdSetTextureState *)pvCmd;
|
---|
5126 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5127 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetTextureState);
|
---|
5128 |
|
---|
5129 | uint32_t const cTextureStates = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dTextureState);
|
---|
5130 | vmsvga3dSetTextureState(pThisCC, pCmd->cid, cTextureStates, (SVGA3dTextureState *)(pCmd + 1));
|
---|
5131 | break;
|
---|
5132 | }
|
---|
5133 |
|
---|
5134 | case SVGA_3D_CMD_SETMATERIAL:
|
---|
5135 | {
|
---|
5136 | SVGA3dCmdSetMaterial *pCmd = (SVGA3dCmdSetMaterial *)pvCmd;
|
---|
5137 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5138 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetMaterial);
|
---|
5139 |
|
---|
5140 | vmsvga3dSetMaterial(pThisCC, pCmd->cid, pCmd->face, &pCmd->material);
|
---|
5141 | break;
|
---|
5142 | }
|
---|
5143 |
|
---|
5144 | case SVGA_3D_CMD_SETLIGHTDATA:
|
---|
5145 | {
|
---|
5146 | SVGA3dCmdSetLightData *pCmd = (SVGA3dCmdSetLightData *)pvCmd;
|
---|
5147 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5148 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetLightData);
|
---|
5149 |
|
---|
5150 | vmsvga3dSetLightData(pThisCC, pCmd->cid, pCmd->index, &pCmd->data);
|
---|
5151 | break;
|
---|
5152 | }
|
---|
5153 |
|
---|
5154 | case SVGA_3D_CMD_SETLIGHTENABLED:
|
---|
5155 | {
|
---|
5156 | SVGA3dCmdSetLightEnabled *pCmd = (SVGA3dCmdSetLightEnabled *)pvCmd;
|
---|
5157 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5158 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetLightEnable);
|
---|
5159 |
|
---|
5160 | vmsvga3dSetLightEnabled(pThisCC, pCmd->cid, pCmd->index, pCmd->enabled);
|
---|
5161 | break;
|
---|
5162 | }
|
---|
5163 |
|
---|
5164 | case SVGA_3D_CMD_SETVIEWPORT:
|
---|
5165 | {
|
---|
5166 | SVGA3dCmdSetViewport *pCmd = (SVGA3dCmdSetViewport *)pvCmd;
|
---|
5167 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5168 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetViewPort);
|
---|
5169 |
|
---|
5170 | vmsvga3dSetViewPort(pThisCC, pCmd->cid, &pCmd->rect);
|
---|
5171 | break;
|
---|
5172 | }
|
---|
5173 |
|
---|
5174 | case SVGA_3D_CMD_SETCLIPPLANE:
|
---|
5175 | {
|
---|
5176 | SVGA3dCmdSetClipPlane *pCmd = (SVGA3dCmdSetClipPlane *)pvCmd;
|
---|
5177 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5178 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetClipPlane);
|
---|
5179 |
|
---|
5180 | vmsvga3dSetClipPlane(pThisCC, pCmd->cid, pCmd->index, pCmd->plane);
|
---|
5181 | break;
|
---|
5182 | }
|
---|
5183 |
|
---|
5184 | case SVGA_3D_CMD_CLEAR:
|
---|
5185 | {
|
---|
5186 | SVGA3dCmdClear *pCmd = (SVGA3dCmdClear *)pvCmd;
|
---|
5187 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5188 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dClear);
|
---|
5189 |
|
---|
5190 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRect);
|
---|
5191 | vmsvga3dCommandClear(pThisCC, pCmd->cid, pCmd->clearFlag, pCmd->color, pCmd->depth, pCmd->stencil, cRects, (SVGA3dRect *)(pCmd + 1));
|
---|
5192 | break;
|
---|
5193 | }
|
---|
5194 |
|
---|
5195 | case SVGA_3D_CMD_PRESENT:
|
---|
5196 | case SVGA_3D_CMD_PRESENT_READBACK: /** @todo SVGA_3D_CMD_PRESENT_READBACK isn't quite the same as present... */
|
---|
5197 | {
|
---|
5198 | SVGA3dCmdPresent *pCmd = (SVGA3dCmdPresent *)pvCmd;
|
---|
5199 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5200 | if (enmCmdId == SVGA_3D_CMD_PRESENT)
|
---|
5201 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dPresent);
|
---|
5202 | else
|
---|
5203 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dPresentReadBack);
|
---|
5204 |
|
---|
5205 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dCopyRect);
|
---|
5206 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dPresentProf, a);
|
---|
5207 | vmsvga3dCommandPresent(pThis, pThisCC, pCmd->sid, cRects, (SVGA3dCopyRect *)(pCmd + 1));
|
---|
5208 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dPresentProf, a);
|
---|
5209 | break;
|
---|
5210 | }
|
---|
5211 |
|
---|
5212 | case SVGA_3D_CMD_SHADER_DEFINE:
|
---|
5213 | {
|
---|
5214 | SVGA3dCmdDefineShader *pCmd = (SVGA3dCmdDefineShader *)pvCmd;
|
---|
5215 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5216 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dShaderDefine);
|
---|
5217 |
|
---|
5218 | uint32_t const cbData = (cbCmd - sizeof(*pCmd));
|
---|
5219 | vmsvga3dShaderDefine(pThisCC, pCmd->cid, pCmd->shid, pCmd->type, cbData, (uint32_t *)(pCmd + 1));
|
---|
5220 | break;
|
---|
5221 | }
|
---|
5222 |
|
---|
5223 | case SVGA_3D_CMD_SHADER_DESTROY:
|
---|
5224 | {
|
---|
5225 | SVGA3dCmdDestroyShader *pCmd = (SVGA3dCmdDestroyShader *)pvCmd;
|
---|
5226 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5227 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dShaderDestroy);
|
---|
5228 |
|
---|
5229 | vmsvga3dShaderDestroy(pThisCC, pCmd->cid, pCmd->shid, pCmd->type);
|
---|
5230 | break;
|
---|
5231 | }
|
---|
5232 |
|
---|
5233 | case SVGA_3D_CMD_SET_SHADER:
|
---|
5234 | {
|
---|
5235 | SVGA3dCmdSetShader *pCmd = (SVGA3dCmdSetShader *)pvCmd;
|
---|
5236 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5237 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetShader);
|
---|
5238 |
|
---|
5239 | vmsvga3dShaderSet(pThisCC, NULL, pCmd->cid, pCmd->type, pCmd->shid);
|
---|
5240 | break;
|
---|
5241 | }
|
---|
5242 |
|
---|
5243 | case SVGA_3D_CMD_SET_SHADER_CONST:
|
---|
5244 | {
|
---|
5245 | SVGA3dCmdSetShaderConst *pCmd = (SVGA3dCmdSetShaderConst *)pvCmd;
|
---|
5246 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5247 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetShaderConst);
|
---|
5248 |
|
---|
5249 | uint32_t const cRegisters = (cbCmd - sizeof(*pCmd)) / sizeof(pCmd->values) + 1;
|
---|
5250 | vmsvga3dShaderSetConst(pThisCC, pCmd->cid, pCmd->reg, pCmd->type, pCmd->ctype, cRegisters, pCmd->values);
|
---|
5251 | break;
|
---|
5252 | }
|
---|
5253 |
|
---|
5254 | case SVGA_3D_CMD_DRAW_PRIMITIVES:
|
---|
5255 | {
|
---|
5256 | SVGA3dCmdDrawPrimitives *pCmd = (SVGA3dCmdDrawPrimitives *)pvCmd;
|
---|
5257 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5258 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dDrawPrimitives);
|
---|
5259 |
|
---|
5260 | ASSERT_GUEST_STMT_BREAK(pCmd->numRanges <= SVGA3D_MAX_DRAW_PRIMITIVE_RANGES, rcParse = VERR_INVALID_PARAMETER);
|
---|
5261 | ASSERT_GUEST_STMT_BREAK(pCmd->numVertexDecls <= SVGA3D_MAX_VERTEX_ARRAYS, rcParse = VERR_INVALID_PARAMETER);
|
---|
5262 | uint32_t const cbRangesAndVertexDecls = pCmd->numVertexDecls * sizeof(SVGA3dVertexDecl)
|
---|
5263 | + pCmd->numRanges * sizeof(SVGA3dPrimitiveRange);
|
---|
5264 | ASSERT_GUEST_STMT_BREAK(cbRangesAndVertexDecls <= cbCmd - sizeof(*pCmd), rcParse = VERR_INVALID_PARAMETER);
|
---|
5265 |
|
---|
5266 | uint32_t const cVertexDivisor = (cbCmd - sizeof(*pCmd) - cbRangesAndVertexDecls) / sizeof(uint32_t);
|
---|
5267 | ASSERT_GUEST_STMT_BREAK(!cVertexDivisor || cVertexDivisor == pCmd->numVertexDecls, rcParse = VERR_INVALID_PARAMETER);
|
---|
5268 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
5269 |
|
---|
5270 | SVGA3dVertexDecl *pVertexDecl = (SVGA3dVertexDecl *)(pCmd + 1);
|
---|
5271 | SVGA3dPrimitiveRange *pNumRange = (SVGA3dPrimitiveRange *)&pVertexDecl[pCmd->numVertexDecls];
|
---|
5272 | SVGA3dVertexDivisor *pVertexDivisor = cVertexDivisor ? (SVGA3dVertexDivisor *)&pNumRange[pCmd->numRanges] : NULL;
|
---|
5273 |
|
---|
5274 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dDrawPrimitivesProf, a);
|
---|
5275 | vmsvga3dDrawPrimitives(pThisCC, pCmd->cid, pCmd->numVertexDecls, pVertexDecl, pCmd->numRanges,
|
---|
5276 | pNumRange, cVertexDivisor, pVertexDivisor);
|
---|
5277 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dDrawPrimitivesProf, a);
|
---|
5278 | break;
|
---|
5279 | }
|
---|
5280 |
|
---|
5281 | case SVGA_3D_CMD_SETSCISSORRECT:
|
---|
5282 | {
|
---|
5283 | SVGA3dCmdSetScissorRect *pCmd = (SVGA3dCmdSetScissorRect *)pvCmd;
|
---|
5284 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5285 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetScissorRect);
|
---|
5286 |
|
---|
5287 | vmsvga3dSetScissorRect(pThisCC, pCmd->cid, &pCmd->rect);
|
---|
5288 | break;
|
---|
5289 | }
|
---|
5290 |
|
---|
5291 | case SVGA_3D_CMD_BEGIN_QUERY:
|
---|
5292 | {
|
---|
5293 | SVGA3dCmdBeginQuery *pCmd = (SVGA3dCmdBeginQuery *)pvCmd;
|
---|
5294 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5295 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dBeginQuery);
|
---|
5296 |
|
---|
5297 | vmsvga3dQueryBegin(pThisCC, pCmd->cid, pCmd->type);
|
---|
5298 | break;
|
---|
5299 | }
|
---|
5300 |
|
---|
5301 | case SVGA_3D_CMD_END_QUERY:
|
---|
5302 | {
|
---|
5303 | SVGA3dCmdEndQuery *pCmd = (SVGA3dCmdEndQuery *)pvCmd;
|
---|
5304 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5305 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dEndQuery);
|
---|
5306 |
|
---|
5307 | vmsvga3dQueryEnd(pThisCC, pCmd->cid, pCmd->type);
|
---|
5308 | break;
|
---|
5309 | }
|
---|
5310 |
|
---|
5311 | case SVGA_3D_CMD_WAIT_FOR_QUERY:
|
---|
5312 | {
|
---|
5313 | SVGA3dCmdWaitForQuery *pCmd = (SVGA3dCmdWaitForQuery *)pvCmd;
|
---|
5314 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5315 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dWaitForQuery);
|
---|
5316 |
|
---|
5317 | vmsvga3dQueryWait(pThisCC, pCmd->cid, pCmd->type, pThis, &pCmd->guestResult);
|
---|
5318 | break;
|
---|
5319 | }
|
---|
5320 |
|
---|
5321 | case SVGA_3D_CMD_GENERATE_MIPMAPS:
|
---|
5322 | {
|
---|
5323 | SVGA3dCmdGenerateMipmaps *pCmd = (SVGA3dCmdGenerateMipmaps *)pvCmd;
|
---|
5324 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5325 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dGenerateMipmaps);
|
---|
5326 |
|
---|
5327 | vmsvga3dGenerateMipmaps(pThisCC, pCmd->sid, pCmd->filter);
|
---|
5328 | break;
|
---|
5329 | }
|
---|
5330 |
|
---|
5331 | case SVGA_3D_CMD_ACTIVATE_SURFACE:
|
---|
5332 | /* context id + surface id? */
|
---|
5333 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dActivateSurface);
|
---|
5334 | break;
|
---|
5335 |
|
---|
5336 | case SVGA_3D_CMD_DEACTIVATE_SURFACE:
|
---|
5337 | /* context id + surface id? */
|
---|
5338 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dDeactivateSurface);
|
---|
5339 | break;
|
---|
5340 |
|
---|
5341 | /*
|
---|
5342 | *
|
---|
5343 | * VPGU10: SVGA_CAP_GBOBJECTS+ commands.
|
---|
5344 | *
|
---|
5345 | */
|
---|
5346 | case SVGA_3D_CMD_SCREEN_DMA:
|
---|
5347 | {
|
---|
5348 | SVGA3dCmdScreenDMA *pCmd = (SVGA3dCmdScreenDMA *)pvCmd;
|
---|
5349 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5350 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5351 | break;
|
---|
5352 | }
|
---|
5353 |
|
---|
5354 | /* case SVGA_3D_CMD_DEAD1: New SVGA_3D_CMD_VB_DX_CLEAR_RENDERTARGET_VIEW_REGION */
|
---|
5355 | case SVGA_3D_CMD_DEAD2:
|
---|
5356 | case SVGA_3D_CMD_DEAD12: /* Old SVGA_3D_CMD_LOGICOPS_BITBLT */
|
---|
5357 | case SVGA_3D_CMD_DEAD13: /* Old SVGA_3D_CMD_LOGICOPS_TRANSBLT */
|
---|
5358 | case SVGA_3D_CMD_DEAD14: /* Old SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
|
---|
5359 | case SVGA_3D_CMD_DEAD15: /* Old SVGA_3D_CMD_LOGICOPS_COLORFILL */
|
---|
5360 | case SVGA_3D_CMD_DEAD16: /* Old SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
|
---|
5361 | case SVGA_3D_CMD_DEAD17: /* Old SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND */
|
---|
5362 | {
|
---|
5363 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5364 | break;
|
---|
5365 | }
|
---|
5366 |
|
---|
5367 | case SVGA_3D_CMD_SET_OTABLE_BASE:
|
---|
5368 | {
|
---|
5369 | SVGA3dCmdSetOTableBase *pCmd = (SVGA3dCmdSetOTableBase *)pvCmd;
|
---|
5370 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5371 | vmsvga3dCmdSetOTableBase(pThisCC, pCmd);
|
---|
5372 | break;
|
---|
5373 | }
|
---|
5374 |
|
---|
5375 | case SVGA_3D_CMD_READBACK_OTABLE:
|
---|
5376 | {
|
---|
5377 | SVGA3dCmdReadbackOTable *pCmd = (SVGA3dCmdReadbackOTable *)pvCmd;
|
---|
5378 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5379 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5380 | break;
|
---|
5381 | }
|
---|
5382 |
|
---|
5383 | case SVGA_3D_CMD_DEFINE_GB_MOB:
|
---|
5384 | {
|
---|
5385 | SVGA3dCmdDefineGBMob *pCmd = (SVGA3dCmdDefineGBMob *)pvCmd;
|
---|
5386 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5387 | vmsvga3dCmdDefineGBMob(pThisCC, pCmd);
|
---|
5388 | break;
|
---|
5389 | }
|
---|
5390 |
|
---|
5391 | case SVGA_3D_CMD_DESTROY_GB_MOB:
|
---|
5392 | {
|
---|
5393 | SVGA3dCmdDestroyGBMob *pCmd = (SVGA3dCmdDestroyGBMob *)pvCmd;
|
---|
5394 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5395 | vmsvga3dCmdDestroyGBMob(pThisCC, pCmd);
|
---|
5396 | break;
|
---|
5397 | }
|
---|
5398 |
|
---|
5399 | case SVGA_3D_CMD_DEAD3:
|
---|
5400 | {
|
---|
5401 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5402 | break;
|
---|
5403 | }
|
---|
5404 |
|
---|
5405 | case SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING:
|
---|
5406 | {
|
---|
5407 | SVGA3dCmdUpdateGBMobMapping *pCmd = (SVGA3dCmdUpdateGBMobMapping *)pvCmd;
|
---|
5408 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5409 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5410 | break;
|
---|
5411 | }
|
---|
5412 |
|
---|
5413 | case SVGA_3D_CMD_DEFINE_GB_SURFACE:
|
---|
5414 | {
|
---|
5415 | SVGA3dCmdDefineGBSurface *pCmd = (SVGA3dCmdDefineGBSurface *)pvCmd;
|
---|
5416 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5417 | vmsvga3dCmdDefineGBSurface(pThisCC, pCmd);
|
---|
5418 | break;
|
---|
5419 | }
|
---|
5420 |
|
---|
5421 | case SVGA_3D_CMD_DESTROY_GB_SURFACE:
|
---|
5422 | {
|
---|
5423 | SVGA3dCmdDestroyGBSurface *pCmd = (SVGA3dCmdDestroyGBSurface *)pvCmd;
|
---|
5424 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5425 | vmsvga3dCmdDestroyGBSurface(pThisCC, pCmd);
|
---|
5426 | break;
|
---|
5427 | }
|
---|
5428 |
|
---|
5429 | case SVGA_3D_CMD_BIND_GB_SURFACE:
|
---|
5430 | {
|
---|
5431 | SVGA3dCmdBindGBSurface *pCmd = (SVGA3dCmdBindGBSurface *)pvCmd;
|
---|
5432 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5433 | vmsvga3dCmdBindGBSurface(pThisCC, pCmd);
|
---|
5434 | break;
|
---|
5435 | }
|
---|
5436 |
|
---|
5437 | case SVGA_3D_CMD_COND_BIND_GB_SURFACE:
|
---|
5438 | {
|
---|
5439 | SVGA3dCmdCondBindGBSurface *pCmd = (SVGA3dCmdCondBindGBSurface *)pvCmd;
|
---|
5440 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5441 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5442 | break;
|
---|
5443 | }
|
---|
5444 |
|
---|
5445 | case SVGA_3D_CMD_UPDATE_GB_IMAGE:
|
---|
5446 | {
|
---|
5447 | SVGA3dCmdUpdateGBImage *pCmd = (SVGA3dCmdUpdateGBImage *)pvCmd;
|
---|
5448 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5449 | vmsvga3dCmdUpdateGBImage(pThisCC, pCmd);
|
---|
5450 | break;
|
---|
5451 | }
|
---|
5452 |
|
---|
5453 | case SVGA_3D_CMD_UPDATE_GB_SURFACE:
|
---|
5454 | {
|
---|
5455 | SVGA3dCmdUpdateGBSurface *pCmd = (SVGA3dCmdUpdateGBSurface *)pvCmd;
|
---|
5456 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5457 | vmsvga3dCmdUpdateGBSurface(pThisCC, pCmd);
|
---|
5458 | break;
|
---|
5459 | }
|
---|
5460 |
|
---|
5461 | case SVGA_3D_CMD_READBACK_GB_IMAGE:
|
---|
5462 | {
|
---|
5463 | SVGA3dCmdReadbackGBImage *pCmd = (SVGA3dCmdReadbackGBImage *)pvCmd;
|
---|
5464 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5465 | vmsvga3dCmdReadbackGBImage(pThisCC, pCmd);
|
---|
5466 | break;
|
---|
5467 | }
|
---|
5468 |
|
---|
5469 | case SVGA_3D_CMD_READBACK_GB_SURFACE:
|
---|
5470 | {
|
---|
5471 | SVGA3dCmdReadbackGBSurface *pCmd = (SVGA3dCmdReadbackGBSurface *)pvCmd;
|
---|
5472 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5473 | vmsvga3dCmdReadbackGBSurface(pThisCC, pCmd);
|
---|
5474 | break;
|
---|
5475 | }
|
---|
5476 |
|
---|
5477 | case SVGA_3D_CMD_INVALIDATE_GB_IMAGE:
|
---|
5478 | {
|
---|
5479 | SVGA3dCmdInvalidateGBImage *pCmd = (SVGA3dCmdInvalidateGBImage *)pvCmd;
|
---|
5480 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5481 | vmsvga3dCmdInvalidateGBImage(pThisCC, pCmd);
|
---|
5482 | break;
|
---|
5483 | }
|
---|
5484 |
|
---|
5485 | case SVGA_3D_CMD_INVALIDATE_GB_SURFACE:
|
---|
5486 | {
|
---|
5487 | SVGA3dCmdInvalidateGBSurface *pCmd = (SVGA3dCmdInvalidateGBSurface *)pvCmd;
|
---|
5488 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5489 | vmsvga3dCmdInvalidateGBSurface(pThisCC, pCmd);
|
---|
5490 | break;
|
---|
5491 | }
|
---|
5492 |
|
---|
5493 | case SVGA_3D_CMD_DEFINE_GB_CONTEXT:
|
---|
5494 | {
|
---|
5495 | SVGA3dCmdDefineGBContext *pCmd = (SVGA3dCmdDefineGBContext *)pvCmd;
|
---|
5496 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5497 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5498 | break;
|
---|
5499 | }
|
---|
5500 |
|
---|
5501 | case SVGA_3D_CMD_DESTROY_GB_CONTEXT:
|
---|
5502 | {
|
---|
5503 | SVGA3dCmdDestroyGBContext *pCmd = (SVGA3dCmdDestroyGBContext *)pvCmd;
|
---|
5504 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5505 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5506 | break;
|
---|
5507 | }
|
---|
5508 |
|
---|
5509 | case SVGA_3D_CMD_BIND_GB_CONTEXT:
|
---|
5510 | {
|
---|
5511 | SVGA3dCmdBindGBContext *pCmd = (SVGA3dCmdBindGBContext *)pvCmd;
|
---|
5512 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5513 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5514 | break;
|
---|
5515 | }
|
---|
5516 |
|
---|
5517 | case SVGA_3D_CMD_READBACK_GB_CONTEXT:
|
---|
5518 | {
|
---|
5519 | SVGA3dCmdReadbackGBContext *pCmd = (SVGA3dCmdReadbackGBContext *)pvCmd;
|
---|
5520 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5521 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5522 | break;
|
---|
5523 | }
|
---|
5524 |
|
---|
5525 | case SVGA_3D_CMD_INVALIDATE_GB_CONTEXT:
|
---|
5526 | {
|
---|
5527 | SVGA3dCmdInvalidateGBContext *pCmd = (SVGA3dCmdInvalidateGBContext *)pvCmd;
|
---|
5528 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5529 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5530 | break;
|
---|
5531 | }
|
---|
5532 |
|
---|
5533 | case SVGA_3D_CMD_DEFINE_GB_SHADER:
|
---|
5534 | {
|
---|
5535 | SVGA3dCmdDefineGBShader *pCmd = (SVGA3dCmdDefineGBShader *)pvCmd;
|
---|
5536 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5537 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5538 | break;
|
---|
5539 | }
|
---|
5540 |
|
---|
5541 | case SVGA_3D_CMD_DESTROY_GB_SHADER:
|
---|
5542 | {
|
---|
5543 | SVGA3dCmdDestroyGBShader *pCmd = (SVGA3dCmdDestroyGBShader *)pvCmd;
|
---|
5544 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5545 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5546 | break;
|
---|
5547 | }
|
---|
5548 |
|
---|
5549 | case SVGA_3D_CMD_BIND_GB_SHADER:
|
---|
5550 | {
|
---|
5551 | SVGA3dCmdBindGBShader *pCmd = (SVGA3dCmdBindGBShader *)pvCmd;
|
---|
5552 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5553 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5554 | break;
|
---|
5555 | }
|
---|
5556 |
|
---|
5557 | case SVGA_3D_CMD_SET_OTABLE_BASE64:
|
---|
5558 | {
|
---|
5559 | SVGA3dCmdSetOTableBase64 *pCmd = (SVGA3dCmdSetOTableBase64 *)pvCmd;
|
---|
5560 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5561 | vmsvga3dCmdSetOTableBase64(pThisCC, pCmd);
|
---|
5562 | break;
|
---|
5563 | }
|
---|
5564 |
|
---|
5565 | case SVGA_3D_CMD_BEGIN_GB_QUERY:
|
---|
5566 | {
|
---|
5567 | SVGA3dCmdBeginGBQuery *pCmd = (SVGA3dCmdBeginGBQuery *)pvCmd;
|
---|
5568 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5569 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5570 | break;
|
---|
5571 | }
|
---|
5572 |
|
---|
5573 | case SVGA_3D_CMD_END_GB_QUERY:
|
---|
5574 | {
|
---|
5575 | SVGA3dCmdEndGBQuery *pCmd = (SVGA3dCmdEndGBQuery *)pvCmd;
|
---|
5576 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5577 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5578 | break;
|
---|
5579 | }
|
---|
5580 |
|
---|
5581 | case SVGA_3D_CMD_WAIT_FOR_GB_QUERY:
|
---|
5582 | {
|
---|
5583 | SVGA3dCmdWaitForGBQuery *pCmd = (SVGA3dCmdWaitForGBQuery *)pvCmd;
|
---|
5584 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5585 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5586 | break;
|
---|
5587 | }
|
---|
5588 |
|
---|
5589 | case SVGA_3D_CMD_NOP:
|
---|
5590 | {
|
---|
5591 | /* Apparently there is nothing to do. */
|
---|
5592 | break;
|
---|
5593 | }
|
---|
5594 |
|
---|
5595 | case SVGA_3D_CMD_ENABLE_GART:
|
---|
5596 | {
|
---|
5597 | SVGA3dCmdEnableGart *pCmd = (SVGA3dCmdEnableGart *)pvCmd;
|
---|
5598 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5599 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5600 | break;
|
---|
5601 | }
|
---|
5602 |
|
---|
5603 | case SVGA_3D_CMD_DISABLE_GART:
|
---|
5604 | {
|
---|
5605 | /* No corresponding SVGA3dCmd structure. */
|
---|
5606 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5607 | break;
|
---|
5608 | }
|
---|
5609 |
|
---|
5610 | case SVGA_3D_CMD_MAP_MOB_INTO_GART:
|
---|
5611 | {
|
---|
5612 | SVGA3dCmdMapMobIntoGart *pCmd = (SVGA3dCmdMapMobIntoGart *)pvCmd;
|
---|
5613 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5614 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5615 | break;
|
---|
5616 | }
|
---|
5617 |
|
---|
5618 | case SVGA_3D_CMD_UNMAP_GART_RANGE:
|
---|
5619 | {
|
---|
5620 | SVGA3dCmdUnmapGartRange *pCmd = (SVGA3dCmdUnmapGartRange *)pvCmd;
|
---|
5621 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5622 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5623 | break;
|
---|
5624 | }
|
---|
5625 |
|
---|
5626 | case SVGA_3D_CMD_DEFINE_GB_SCREENTARGET:
|
---|
5627 | {
|
---|
5628 | SVGA3dCmdDefineGBScreenTarget *pCmd = (SVGA3dCmdDefineGBScreenTarget *)pvCmd;
|
---|
5629 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5630 | vmsvga3dCmdDefineGBScreenTarget(pThis, pThisCC, pCmd);
|
---|
5631 | break;
|
---|
5632 | }
|
---|
5633 |
|
---|
5634 | case SVGA_3D_CMD_DESTROY_GB_SCREENTARGET:
|
---|
5635 | {
|
---|
5636 | SVGA3dCmdDestroyGBScreenTarget *pCmd = (SVGA3dCmdDestroyGBScreenTarget *)pvCmd;
|
---|
5637 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5638 | vmsvga3dCmdDestroyGBScreenTarget(pThis, pThisCC, pCmd);
|
---|
5639 | break;
|
---|
5640 | }
|
---|
5641 |
|
---|
5642 | case SVGA_3D_CMD_BIND_GB_SCREENTARGET:
|
---|
5643 | {
|
---|
5644 | SVGA3dCmdBindGBScreenTarget *pCmd = (SVGA3dCmdBindGBScreenTarget *)pvCmd;
|
---|
5645 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5646 | vmsvga3dCmdBindGBScreenTarget(pThisCC, pCmd);
|
---|
5647 | break;
|
---|
5648 | }
|
---|
5649 |
|
---|
5650 | case SVGA_3D_CMD_UPDATE_GB_SCREENTARGET:
|
---|
5651 | {
|
---|
5652 | SVGA3dCmdUpdateGBScreenTarget *pCmd = (SVGA3dCmdUpdateGBScreenTarget *)pvCmd;
|
---|
5653 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5654 | vmsvga3dCmdUpdateGBScreenTarget(pThisCC, pCmd);
|
---|
5655 | break;
|
---|
5656 | }
|
---|
5657 |
|
---|
5658 | case SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL:
|
---|
5659 | {
|
---|
5660 | SVGA3dCmdReadbackGBImagePartial *pCmd = (SVGA3dCmdReadbackGBImagePartial *)pvCmd;
|
---|
5661 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5662 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5663 | break;
|
---|
5664 | }
|
---|
5665 |
|
---|
5666 | case SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL:
|
---|
5667 | {
|
---|
5668 | SVGA3dCmdInvalidateGBImagePartial *pCmd = (SVGA3dCmdInvalidateGBImagePartial *)pvCmd;
|
---|
5669 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5670 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5671 | break;
|
---|
5672 | }
|
---|
5673 |
|
---|
5674 | case SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE:
|
---|
5675 | {
|
---|
5676 | SVGA3dCmdSetGBShaderConstInline *pCmd = (SVGA3dCmdSetGBShaderConstInline *)pvCmd;
|
---|
5677 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5678 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5679 | break;
|
---|
5680 | }
|
---|
5681 |
|
---|
5682 | case SVGA_3D_CMD_GB_SCREEN_DMA:
|
---|
5683 | {
|
---|
5684 | SVGA3dCmdGBScreenDMA *pCmd = (SVGA3dCmdGBScreenDMA *)pvCmd;
|
---|
5685 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5686 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5687 | break;
|
---|
5688 | }
|
---|
5689 |
|
---|
5690 | case SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH:
|
---|
5691 | {
|
---|
5692 | SVGA3dCmdBindGBSurfaceWithPitch *pCmd = (SVGA3dCmdBindGBSurfaceWithPitch *)pvCmd;
|
---|
5693 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5694 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5695 | break;
|
---|
5696 | }
|
---|
5697 |
|
---|
5698 | case SVGA_3D_CMD_GB_MOB_FENCE:
|
---|
5699 | {
|
---|
5700 | SVGA3dCmdGBMobFence *pCmd = (SVGA3dCmdGBMobFence *)pvCmd;
|
---|
5701 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5702 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5703 | break;
|
---|
5704 | }
|
---|
5705 |
|
---|
5706 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V2:
|
---|
5707 | {
|
---|
5708 | SVGA3dCmdDefineGBSurface_v2 *pCmd = (SVGA3dCmdDefineGBSurface_v2 *)pvCmd;
|
---|
5709 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5710 | vmsvga3dCmdDefineGBSurface_v2(pThisCC, pCmd);
|
---|
5711 | break;
|
---|
5712 | }
|
---|
5713 |
|
---|
5714 | case SVGA_3D_CMD_DEFINE_GB_MOB64:
|
---|
5715 | {
|
---|
5716 | SVGA3dCmdDefineGBMob64 *pCmd = (SVGA3dCmdDefineGBMob64 *)pvCmd;
|
---|
5717 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5718 | vmsvga3dCmdDefineGBMob64(pThisCC, pCmd);
|
---|
5719 | break;
|
---|
5720 | }
|
---|
5721 |
|
---|
5722 | case SVGA_3D_CMD_REDEFINE_GB_MOB64:
|
---|
5723 | {
|
---|
5724 | SVGA3dCmdRedefineGBMob64 *pCmd = (SVGA3dCmdRedefineGBMob64 *)pvCmd;
|
---|
5725 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5726 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5727 | break;
|
---|
5728 | }
|
---|
5729 |
|
---|
5730 | case SVGA_3D_CMD_NOP_ERROR:
|
---|
5731 | {
|
---|
5732 | /* Apparently there is nothing to do. */
|
---|
5733 | break;
|
---|
5734 | }
|
---|
5735 |
|
---|
5736 | case SVGA_3D_CMD_SET_VERTEX_STREAMS:
|
---|
5737 | {
|
---|
5738 | SVGA3dCmdSetVertexStreams *pCmd = (SVGA3dCmdSetVertexStreams *)pvCmd;
|
---|
5739 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5740 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5741 | break;
|
---|
5742 | }
|
---|
5743 |
|
---|
5744 | case SVGA_3D_CMD_SET_VERTEX_DECLS:
|
---|
5745 | {
|
---|
5746 | SVGA3dCmdSetVertexDecls *pCmd = (SVGA3dCmdSetVertexDecls *)pvCmd;
|
---|
5747 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5748 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5749 | break;
|
---|
5750 | }
|
---|
5751 |
|
---|
5752 | case SVGA_3D_CMD_SET_VERTEX_DIVISORS:
|
---|
5753 | {
|
---|
5754 | SVGA3dCmdSetVertexDivisors *pCmd = (SVGA3dCmdSetVertexDivisors *)pvCmd;
|
---|
5755 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5756 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5757 | break;
|
---|
5758 | }
|
---|
5759 |
|
---|
5760 | case SVGA_3D_CMD_DRAW:
|
---|
5761 | {
|
---|
5762 | /* No corresponding SVGA3dCmd structure. */
|
---|
5763 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5764 | break;
|
---|
5765 | }
|
---|
5766 |
|
---|
5767 | case SVGA_3D_CMD_DRAW_INDEXED:
|
---|
5768 | {
|
---|
5769 | /* No corresponding SVGA3dCmd structure. */
|
---|
5770 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5771 | break;
|
---|
5772 | }
|
---|
5773 |
|
---|
5774 | case SVGA_3D_CMD_DX_DEFINE_CONTEXT:
|
---|
5775 | {
|
---|
5776 | SVGA3dCmdDXDefineContext *pCmd = (SVGA3dCmdDXDefineContext *)pvCmd;
|
---|
5777 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5778 | rcParse = vmsvga3dCmdDXDefineContext(pThisCC, pCmd, cbCmd);
|
---|
5779 | break;
|
---|
5780 | }
|
---|
5781 |
|
---|
5782 | case SVGA_3D_CMD_DX_DESTROY_CONTEXT:
|
---|
5783 | {
|
---|
5784 | SVGA3dCmdDXDestroyContext *pCmd = (SVGA3dCmdDXDestroyContext *)pvCmd;
|
---|
5785 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5786 | rcParse = vmsvga3dCmdDXDestroyContext(pThisCC, pCmd, cbCmd);
|
---|
5787 | break;
|
---|
5788 | }
|
---|
5789 |
|
---|
5790 | case SVGA_3D_CMD_DX_BIND_CONTEXT:
|
---|
5791 | {
|
---|
5792 | SVGA3dCmdDXBindContext *pCmd = (SVGA3dCmdDXBindContext *)pvCmd;
|
---|
5793 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5794 | rcParse = vmsvga3dCmdDXBindContext(pThisCC, pCmd, cbCmd);
|
---|
5795 | break;
|
---|
5796 | }
|
---|
5797 |
|
---|
5798 | case SVGA_3D_CMD_DX_READBACK_CONTEXT:
|
---|
5799 | {
|
---|
5800 | SVGA3dCmdDXReadbackContext *pCmd = (SVGA3dCmdDXReadbackContext *)pvCmd;
|
---|
5801 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5802 | rcParse = vmsvga3dCmdDXReadbackContext(pThisCC, pCmd, cbCmd);
|
---|
5803 | break;
|
---|
5804 | }
|
---|
5805 |
|
---|
5806 | case SVGA_3D_CMD_DX_INVALIDATE_CONTEXT:
|
---|
5807 | {
|
---|
5808 | SVGA3dCmdDXInvalidateContext *pCmd = (SVGA3dCmdDXInvalidateContext *)pvCmd;
|
---|
5809 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5810 | rcParse = vmsvga3dCmdDXInvalidateContext(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5811 | break;
|
---|
5812 | }
|
---|
5813 |
|
---|
5814 | case SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER:
|
---|
5815 | {
|
---|
5816 | SVGA3dCmdDXSetSingleConstantBuffer *pCmd = (SVGA3dCmdDXSetSingleConstantBuffer *)pvCmd;
|
---|
5817 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5818 | rcParse = vmsvga3dCmdDXSetSingleConstantBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5819 | break;
|
---|
5820 | }
|
---|
5821 |
|
---|
5822 | case SVGA_3D_CMD_DX_SET_SHADER_RESOURCES:
|
---|
5823 | {
|
---|
5824 | SVGA3dCmdDXSetShaderResources *pCmd = (SVGA3dCmdDXSetShaderResources *)pvCmd;
|
---|
5825 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5826 | rcParse = vmsvga3dCmdDXSetShaderResources(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5827 | break;
|
---|
5828 | }
|
---|
5829 |
|
---|
5830 | case SVGA_3D_CMD_DX_SET_SHADER:
|
---|
5831 | {
|
---|
5832 | SVGA3dCmdDXSetShader *pCmd = (SVGA3dCmdDXSetShader *)pvCmd;
|
---|
5833 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5834 | rcParse = vmsvga3dCmdDXSetShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5835 | break;
|
---|
5836 | }
|
---|
5837 |
|
---|
5838 | case SVGA_3D_CMD_DX_SET_SAMPLERS:
|
---|
5839 | {
|
---|
5840 | SVGA3dCmdDXSetSamplers *pCmd = (SVGA3dCmdDXSetSamplers *)pvCmd;
|
---|
5841 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5842 | rcParse = vmsvga3dCmdDXSetSamplers(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5843 | break;
|
---|
5844 | }
|
---|
5845 |
|
---|
5846 | case SVGA_3D_CMD_DX_DRAW:
|
---|
5847 | {
|
---|
5848 | SVGA3dCmdDXDraw *pCmd = (SVGA3dCmdDXDraw *)pvCmd;
|
---|
5849 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5850 | rcParse = vmsvga3dCmdDXDraw(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5851 | break;
|
---|
5852 | }
|
---|
5853 |
|
---|
5854 | case SVGA_3D_CMD_DX_DRAW_INDEXED:
|
---|
5855 | {
|
---|
5856 | SVGA3dCmdDXDrawIndexed *pCmd = (SVGA3dCmdDXDrawIndexed *)pvCmd;
|
---|
5857 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5858 | rcParse = vmsvga3dCmdDXDrawIndexed(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5859 | break;
|
---|
5860 | }
|
---|
5861 |
|
---|
5862 | case SVGA_3D_CMD_DX_DRAW_INSTANCED:
|
---|
5863 | {
|
---|
5864 | SVGA3dCmdDXDrawInstanced *pCmd = (SVGA3dCmdDXDrawInstanced *)pvCmd;
|
---|
5865 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5866 | rcParse = vmsvga3dCmdDXDrawInstanced(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5867 | break;
|
---|
5868 | }
|
---|
5869 |
|
---|
5870 | case SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED:
|
---|
5871 | {
|
---|
5872 | SVGA3dCmdDXDrawIndexedInstanced *pCmd = (SVGA3dCmdDXDrawIndexedInstanced *)pvCmd;
|
---|
5873 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5874 | rcParse = vmsvga3dCmdDXDrawIndexedInstanced(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5875 | break;
|
---|
5876 | }
|
---|
5877 |
|
---|
5878 | case SVGA_3D_CMD_DX_DRAW_AUTO:
|
---|
5879 | {
|
---|
5880 | SVGA3dCmdDXDrawAuto *pCmd = (SVGA3dCmdDXDrawAuto *)pvCmd;
|
---|
5881 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5882 | rcParse = vmsvga3dCmdDXDrawAuto(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5883 | break;
|
---|
5884 | }
|
---|
5885 |
|
---|
5886 | case SVGA_3D_CMD_DX_SET_INPUT_LAYOUT:
|
---|
5887 | {
|
---|
5888 | SVGA3dCmdDXSetInputLayout *pCmd = (SVGA3dCmdDXSetInputLayout *)pvCmd;
|
---|
5889 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5890 | rcParse = vmsvga3dCmdDXSetInputLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5891 | break;
|
---|
5892 | }
|
---|
5893 |
|
---|
5894 | case SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS:
|
---|
5895 | {
|
---|
5896 | SVGA3dCmdDXSetVertexBuffers *pCmd = (SVGA3dCmdDXSetVertexBuffers *)pvCmd;
|
---|
5897 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5898 | rcParse = vmsvga3dCmdDXSetVertexBuffers(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5899 | break;
|
---|
5900 | }
|
---|
5901 |
|
---|
5902 | case SVGA_3D_CMD_DX_SET_INDEX_BUFFER:
|
---|
5903 | {
|
---|
5904 | SVGA3dCmdDXSetIndexBuffer *pCmd = (SVGA3dCmdDXSetIndexBuffer *)pvCmd;
|
---|
5905 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5906 | rcParse = vmsvga3dCmdDXSetIndexBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5907 | break;
|
---|
5908 | }
|
---|
5909 |
|
---|
5910 | case SVGA_3D_CMD_DX_SET_TOPOLOGY:
|
---|
5911 | {
|
---|
5912 | SVGA3dCmdDXSetTopology *pCmd = (SVGA3dCmdDXSetTopology *)pvCmd;
|
---|
5913 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5914 | rcParse = vmsvga3dCmdDXSetTopology(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5915 | break;
|
---|
5916 | }
|
---|
5917 |
|
---|
5918 | case SVGA_3D_CMD_DX_SET_RENDERTARGETS:
|
---|
5919 | {
|
---|
5920 | SVGA3dCmdDXSetRenderTargets *pCmd = (SVGA3dCmdDXSetRenderTargets *)pvCmd;
|
---|
5921 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5922 | rcParse = vmsvga3dCmdDXSetRenderTargets(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5923 | break;
|
---|
5924 | }
|
---|
5925 |
|
---|
5926 | case SVGA_3D_CMD_DX_SET_BLEND_STATE:
|
---|
5927 | {
|
---|
5928 | SVGA3dCmdDXSetBlendState *pCmd = (SVGA3dCmdDXSetBlendState *)pvCmd;
|
---|
5929 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5930 | rcParse = vmsvga3dCmdDXSetBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5931 | break;
|
---|
5932 | }
|
---|
5933 |
|
---|
5934 | case SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE:
|
---|
5935 | {
|
---|
5936 | SVGA3dCmdDXSetDepthStencilState *pCmd = (SVGA3dCmdDXSetDepthStencilState *)pvCmd;
|
---|
5937 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5938 | rcParse = vmsvga3dCmdDXSetDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5939 | break;
|
---|
5940 | }
|
---|
5941 |
|
---|
5942 | case SVGA_3D_CMD_DX_SET_RASTERIZER_STATE:
|
---|
5943 | {
|
---|
5944 | SVGA3dCmdDXSetRasterizerState *pCmd = (SVGA3dCmdDXSetRasterizerState *)pvCmd;
|
---|
5945 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5946 | rcParse = vmsvga3dCmdDXSetRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5947 | break;
|
---|
5948 | }
|
---|
5949 |
|
---|
5950 | case SVGA_3D_CMD_DX_DEFINE_QUERY:
|
---|
5951 | {
|
---|
5952 | SVGA3dCmdDXDefineQuery *pCmd = (SVGA3dCmdDXDefineQuery *)pvCmd;
|
---|
5953 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5954 | rcParse = vmsvga3dCmdDXDefineQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5955 | break;
|
---|
5956 | }
|
---|
5957 |
|
---|
5958 | case SVGA_3D_CMD_DX_DESTROY_QUERY:
|
---|
5959 | {
|
---|
5960 | SVGA3dCmdDXDestroyQuery *pCmd = (SVGA3dCmdDXDestroyQuery *)pvCmd;
|
---|
5961 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5962 | rcParse = vmsvga3dCmdDXDestroyQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5963 | break;
|
---|
5964 | }
|
---|
5965 |
|
---|
5966 | case SVGA_3D_CMD_DX_BIND_QUERY:
|
---|
5967 | {
|
---|
5968 | SVGA3dCmdDXBindQuery *pCmd = (SVGA3dCmdDXBindQuery *)pvCmd;
|
---|
5969 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5970 | rcParse = vmsvga3dCmdDXBindQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5971 | break;
|
---|
5972 | }
|
---|
5973 |
|
---|
5974 | case SVGA_3D_CMD_DX_SET_QUERY_OFFSET:
|
---|
5975 | {
|
---|
5976 | SVGA3dCmdDXSetQueryOffset *pCmd = (SVGA3dCmdDXSetQueryOffset *)pvCmd;
|
---|
5977 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5978 | rcParse = vmsvga3dCmdDXSetQueryOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5979 | break;
|
---|
5980 | }
|
---|
5981 |
|
---|
5982 | case SVGA_3D_CMD_DX_BEGIN_QUERY:
|
---|
5983 | {
|
---|
5984 | SVGA3dCmdDXBeginQuery *pCmd = (SVGA3dCmdDXBeginQuery *)pvCmd;
|
---|
5985 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5986 | rcParse = vmsvga3dCmdDXBeginQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5987 | break;
|
---|
5988 | }
|
---|
5989 |
|
---|
5990 | case SVGA_3D_CMD_DX_END_QUERY:
|
---|
5991 | {
|
---|
5992 | SVGA3dCmdDXEndQuery *pCmd = (SVGA3dCmdDXEndQuery *)pvCmd;
|
---|
5993 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5994 | rcParse = vmsvga3dCmdDXEndQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5995 | break;
|
---|
5996 | }
|
---|
5997 |
|
---|
5998 | case SVGA_3D_CMD_DX_READBACK_QUERY:
|
---|
5999 | {
|
---|
6000 | SVGA3dCmdDXReadbackQuery *pCmd = (SVGA3dCmdDXReadbackQuery *)pvCmd;
|
---|
6001 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6002 | rcParse = vmsvga3dCmdDXReadbackQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6003 | break;
|
---|
6004 | }
|
---|
6005 |
|
---|
6006 | case SVGA_3D_CMD_DX_SET_PREDICATION:
|
---|
6007 | {
|
---|
6008 | SVGA3dCmdDXSetPredication *pCmd = (SVGA3dCmdDXSetPredication *)pvCmd;
|
---|
6009 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6010 | rcParse = vmsvga3dCmdDXSetPredication(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6011 | break;
|
---|
6012 | }
|
---|
6013 |
|
---|
6014 | case SVGA_3D_CMD_DX_SET_SOTARGETS:
|
---|
6015 | {
|
---|
6016 | SVGA3dCmdDXSetSOTargets *pCmd = (SVGA3dCmdDXSetSOTargets *)pvCmd;
|
---|
6017 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6018 | rcParse = vmsvga3dCmdDXSetSOTargets(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6019 | break;
|
---|
6020 | }
|
---|
6021 |
|
---|
6022 | case SVGA_3D_CMD_DX_SET_VIEWPORTS:
|
---|
6023 | {
|
---|
6024 | SVGA3dCmdDXSetViewports *pCmd = (SVGA3dCmdDXSetViewports *)pvCmd;
|
---|
6025 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6026 | rcParse = vmsvga3dCmdDXSetViewports(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6027 | break;
|
---|
6028 | }
|
---|
6029 |
|
---|
6030 | case SVGA_3D_CMD_DX_SET_SCISSORRECTS:
|
---|
6031 | {
|
---|
6032 | SVGA3dCmdDXSetScissorRects *pCmd = (SVGA3dCmdDXSetScissorRects *)pvCmd;
|
---|
6033 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6034 | rcParse = vmsvga3dCmdDXSetScissorRects(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6035 | break;
|
---|
6036 | }
|
---|
6037 |
|
---|
6038 | case SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW:
|
---|
6039 | {
|
---|
6040 | SVGA3dCmdDXClearRenderTargetView *pCmd = (SVGA3dCmdDXClearRenderTargetView *)pvCmd;
|
---|
6041 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6042 | rcParse = vmsvga3dCmdDXClearRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6043 | break;
|
---|
6044 | }
|
---|
6045 |
|
---|
6046 | case SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW:
|
---|
6047 | {
|
---|
6048 | SVGA3dCmdDXClearDepthStencilView *pCmd = (SVGA3dCmdDXClearDepthStencilView *)pvCmd;
|
---|
6049 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6050 | rcParse = vmsvga3dCmdDXClearDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6051 | break;
|
---|
6052 | }
|
---|
6053 |
|
---|
6054 | case SVGA_3D_CMD_DX_PRED_COPY_REGION:
|
---|
6055 | {
|
---|
6056 | SVGA3dCmdDXPredCopyRegion *pCmd = (SVGA3dCmdDXPredCopyRegion *)pvCmd;
|
---|
6057 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6058 | rcParse = vmsvga3dCmdDXPredCopyRegion(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6059 | break;
|
---|
6060 | }
|
---|
6061 |
|
---|
6062 | case SVGA_3D_CMD_DX_PRED_COPY:
|
---|
6063 | {
|
---|
6064 | SVGA3dCmdDXPredCopy *pCmd = (SVGA3dCmdDXPredCopy *)pvCmd;
|
---|
6065 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6066 | rcParse = vmsvga3dCmdDXPredCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6067 | break;
|
---|
6068 | }
|
---|
6069 |
|
---|
6070 | case SVGA_3D_CMD_DX_PRESENTBLT:
|
---|
6071 | {
|
---|
6072 | SVGA3dCmdDXPresentBlt *pCmd = (SVGA3dCmdDXPresentBlt *)pvCmd;
|
---|
6073 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6074 | rcParse = vmsvga3dCmdDXPresentBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6075 | break;
|
---|
6076 | }
|
---|
6077 |
|
---|
6078 | case SVGA_3D_CMD_DX_GENMIPS:
|
---|
6079 | {
|
---|
6080 | SVGA3dCmdDXGenMips *pCmd = (SVGA3dCmdDXGenMips *)pvCmd;
|
---|
6081 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6082 | rcParse = vmsvga3dCmdDXGenMips(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6083 | break;
|
---|
6084 | }
|
---|
6085 |
|
---|
6086 | case SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE:
|
---|
6087 | {
|
---|
6088 | SVGA3dCmdDXUpdateSubResource *pCmd = (SVGA3dCmdDXUpdateSubResource *)pvCmd;
|
---|
6089 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6090 | rcParse = vmsvga3dCmdDXUpdateSubResource(pThisCC, pCmd, cbCmd);
|
---|
6091 | break;
|
---|
6092 | }
|
---|
6093 |
|
---|
6094 | case SVGA_3D_CMD_DX_READBACK_SUBRESOURCE:
|
---|
6095 | {
|
---|
6096 | SVGA3dCmdDXReadbackSubResource *pCmd = (SVGA3dCmdDXReadbackSubResource *)pvCmd;
|
---|
6097 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6098 | rcParse = vmsvga3dCmdDXReadbackSubResource(pThisCC, pCmd, cbCmd);
|
---|
6099 | break;
|
---|
6100 | }
|
---|
6101 |
|
---|
6102 | case SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE:
|
---|
6103 | {
|
---|
6104 | SVGA3dCmdDXInvalidateSubResource *pCmd = (SVGA3dCmdDXInvalidateSubResource *)pvCmd;
|
---|
6105 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6106 | rcParse = vmsvga3dCmdDXInvalidateSubResource(pThisCC, pCmd, cbCmd);
|
---|
6107 | break;
|
---|
6108 | }
|
---|
6109 |
|
---|
6110 | case SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW:
|
---|
6111 | {
|
---|
6112 | SVGA3dCmdDXDefineShaderResourceView *pCmd = (SVGA3dCmdDXDefineShaderResourceView *)pvCmd;
|
---|
6113 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6114 | rcParse = vmsvga3dCmdDXDefineShaderResourceView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6115 | break;
|
---|
6116 | }
|
---|
6117 |
|
---|
6118 | case SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW:
|
---|
6119 | {
|
---|
6120 | SVGA3dCmdDXDestroyShaderResourceView *pCmd = (SVGA3dCmdDXDestroyShaderResourceView *)pvCmd;
|
---|
6121 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6122 | rcParse = vmsvga3dCmdDXDestroyShaderResourceView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6123 | break;
|
---|
6124 | }
|
---|
6125 |
|
---|
6126 | case SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW:
|
---|
6127 | {
|
---|
6128 | SVGA3dCmdDXDefineRenderTargetView *pCmd = (SVGA3dCmdDXDefineRenderTargetView *)pvCmd;
|
---|
6129 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6130 | rcParse = vmsvga3dCmdDXDefineRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6131 | break;
|
---|
6132 | }
|
---|
6133 |
|
---|
6134 | case SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW:
|
---|
6135 | {
|
---|
6136 | SVGA3dCmdDXDestroyRenderTargetView *pCmd = (SVGA3dCmdDXDestroyRenderTargetView *)pvCmd;
|
---|
6137 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6138 | rcParse = vmsvga3dCmdDXDestroyRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6139 | break;
|
---|
6140 | }
|
---|
6141 |
|
---|
6142 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW:
|
---|
6143 | {
|
---|
6144 | SVGA3dCmdDXDefineDepthStencilView *pCmd = (SVGA3dCmdDXDefineDepthStencilView *)pvCmd;
|
---|
6145 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6146 | rcParse = vmsvga3dCmdDXDefineDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6147 | break;
|
---|
6148 | }
|
---|
6149 |
|
---|
6150 | case SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW:
|
---|
6151 | {
|
---|
6152 | SVGA3dCmdDXDestroyDepthStencilView *pCmd = (SVGA3dCmdDXDestroyDepthStencilView *)pvCmd;
|
---|
6153 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6154 | rcParse = vmsvga3dCmdDXDestroyDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6155 | break;
|
---|
6156 | }
|
---|
6157 |
|
---|
6158 | case SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT:
|
---|
6159 | {
|
---|
6160 | SVGA3dCmdDXDefineElementLayout *pCmd = (SVGA3dCmdDXDefineElementLayout *)pvCmd;
|
---|
6161 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6162 | rcParse = vmsvga3dCmdDXDefineElementLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6163 | break;
|
---|
6164 | }
|
---|
6165 |
|
---|
6166 | case SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT:
|
---|
6167 | {
|
---|
6168 | SVGA3dCmdDXDestroyElementLayout *pCmd = (SVGA3dCmdDXDestroyElementLayout *)pvCmd;
|
---|
6169 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6170 | rcParse = vmsvga3dCmdDXDestroyElementLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6171 | break;
|
---|
6172 | }
|
---|
6173 |
|
---|
6174 | case SVGA_3D_CMD_DX_DEFINE_BLEND_STATE:
|
---|
6175 | {
|
---|
6176 | SVGA3dCmdDXDefineBlendState *pCmd = (SVGA3dCmdDXDefineBlendState *)pvCmd;
|
---|
6177 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6178 | rcParse = vmsvga3dCmdDXDefineBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6179 | break;
|
---|
6180 | }
|
---|
6181 |
|
---|
6182 | case SVGA_3D_CMD_DX_DESTROY_BLEND_STATE:
|
---|
6183 | {
|
---|
6184 | SVGA3dCmdDXDestroyBlendState *pCmd = (SVGA3dCmdDXDestroyBlendState *)pvCmd;
|
---|
6185 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6186 | rcParse = vmsvga3dCmdDXDestroyBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6187 | break;
|
---|
6188 | }
|
---|
6189 |
|
---|
6190 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE:
|
---|
6191 | {
|
---|
6192 | SVGA3dCmdDXDefineDepthStencilState *pCmd = (SVGA3dCmdDXDefineDepthStencilState *)pvCmd;
|
---|
6193 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6194 | rcParse = vmsvga3dCmdDXDefineDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6195 | break;
|
---|
6196 | }
|
---|
6197 |
|
---|
6198 | case SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE:
|
---|
6199 | {
|
---|
6200 | SVGA3dCmdDXDestroyDepthStencilState *pCmd = (SVGA3dCmdDXDestroyDepthStencilState *)pvCmd;
|
---|
6201 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6202 | rcParse = vmsvga3dCmdDXDestroyDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6203 | break;
|
---|
6204 | }
|
---|
6205 |
|
---|
6206 | case SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE:
|
---|
6207 | {
|
---|
6208 | SVGA3dCmdDXDefineRasterizerState *pCmd = (SVGA3dCmdDXDefineRasterizerState *)pvCmd;
|
---|
6209 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6210 | rcParse = vmsvga3dCmdDXDefineRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6211 | break;
|
---|
6212 | }
|
---|
6213 |
|
---|
6214 | case SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE:
|
---|
6215 | {
|
---|
6216 | SVGA3dCmdDXDestroyRasterizerState *pCmd = (SVGA3dCmdDXDestroyRasterizerState *)pvCmd;
|
---|
6217 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6218 | rcParse = vmsvga3dCmdDXDestroyRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6219 | break;
|
---|
6220 | }
|
---|
6221 |
|
---|
6222 | case SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE:
|
---|
6223 | {
|
---|
6224 | SVGA3dCmdDXDefineSamplerState *pCmd = (SVGA3dCmdDXDefineSamplerState *)pvCmd;
|
---|
6225 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6226 | rcParse = vmsvga3dCmdDXDefineSamplerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6227 | break;
|
---|
6228 | }
|
---|
6229 |
|
---|
6230 | case SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE:
|
---|
6231 | {
|
---|
6232 | SVGA3dCmdDXDestroySamplerState *pCmd = (SVGA3dCmdDXDestroySamplerState *)pvCmd;
|
---|
6233 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6234 | rcParse = vmsvga3dCmdDXDestroySamplerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6235 | break;
|
---|
6236 | }
|
---|
6237 |
|
---|
6238 | case SVGA_3D_CMD_DX_DEFINE_SHADER:
|
---|
6239 | {
|
---|
6240 | SVGA3dCmdDXDefineShader *pCmd = (SVGA3dCmdDXDefineShader *)pvCmd;
|
---|
6241 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6242 | rcParse = vmsvga3dCmdDXDefineShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6243 | break;
|
---|
6244 | }
|
---|
6245 |
|
---|
6246 | case SVGA_3D_CMD_DX_DESTROY_SHADER:
|
---|
6247 | {
|
---|
6248 | SVGA3dCmdDXDestroyShader *pCmd = (SVGA3dCmdDXDestroyShader *)pvCmd;
|
---|
6249 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6250 | rcParse = vmsvga3dCmdDXDestroyShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6251 | break;
|
---|
6252 | }
|
---|
6253 |
|
---|
6254 | case SVGA_3D_CMD_DX_BIND_SHADER:
|
---|
6255 | {
|
---|
6256 | SVGA3dCmdDXBindShader *pCmd = (SVGA3dCmdDXBindShader *)pvCmd;
|
---|
6257 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6258 | rcParse = vmsvga3dCmdDXBindShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6259 | break;
|
---|
6260 | }
|
---|
6261 |
|
---|
6262 | case SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT:
|
---|
6263 | {
|
---|
6264 | SVGA3dCmdDXDefineStreamOutput *pCmd = (SVGA3dCmdDXDefineStreamOutput *)pvCmd;
|
---|
6265 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6266 | rcParse = vmsvga3dCmdDXDefineStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6267 | break;
|
---|
6268 | }
|
---|
6269 |
|
---|
6270 | case SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT:
|
---|
6271 | {
|
---|
6272 | SVGA3dCmdDXDestroyStreamOutput *pCmd = (SVGA3dCmdDXDestroyStreamOutput *)pvCmd;
|
---|
6273 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6274 | rcParse = vmsvga3dCmdDXDestroyStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6275 | break;
|
---|
6276 | }
|
---|
6277 |
|
---|
6278 | case SVGA_3D_CMD_DX_SET_STREAMOUTPUT:
|
---|
6279 | {
|
---|
6280 | SVGA3dCmdDXSetStreamOutput *pCmd = (SVGA3dCmdDXSetStreamOutput *)pvCmd;
|
---|
6281 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6282 | rcParse = vmsvga3dCmdDXSetStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6283 | break;
|
---|
6284 | }
|
---|
6285 |
|
---|
6286 | case SVGA_3D_CMD_DX_SET_COTABLE:
|
---|
6287 | {
|
---|
6288 | SVGA3dCmdDXSetCOTable *pCmd = (SVGA3dCmdDXSetCOTable *)pvCmd;
|
---|
6289 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6290 | rcParse = vmsvga3dCmdDXSetCOTable(pThisCC, pCmd, cbCmd);
|
---|
6291 | break;
|
---|
6292 | }
|
---|
6293 |
|
---|
6294 | case SVGA_3D_CMD_DX_READBACK_COTABLE:
|
---|
6295 | {
|
---|
6296 | SVGA3dCmdDXReadbackCOTable *pCmd = (SVGA3dCmdDXReadbackCOTable *)pvCmd;
|
---|
6297 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6298 | rcParse = vmsvga3dCmdDXReadbackCOTable(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6299 | break;
|
---|
6300 | }
|
---|
6301 |
|
---|
6302 | case SVGA_3D_CMD_DX_BUFFER_COPY:
|
---|
6303 | {
|
---|
6304 | SVGA3dCmdDXBufferCopy *pCmd = (SVGA3dCmdDXBufferCopy *)pvCmd;
|
---|
6305 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6306 | rcParse = vmsvga3dCmdDXBufferCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6307 | break;
|
---|
6308 | }
|
---|
6309 |
|
---|
6310 | case SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER:
|
---|
6311 | {
|
---|
6312 | SVGA3dCmdDXTransferFromBuffer *pCmd = (SVGA3dCmdDXTransferFromBuffer *)pvCmd;
|
---|
6313 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6314 | rcParse = vmsvga3dCmdDXTransferFromBuffer(pThisCC, pCmd, cbCmd);
|
---|
6315 | break;
|
---|
6316 | }
|
---|
6317 |
|
---|
6318 | case SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK:
|
---|
6319 | {
|
---|
6320 | SVGA3dCmdDXSurfaceCopyAndReadback *pCmd = (SVGA3dCmdDXSurfaceCopyAndReadback *)pvCmd;
|
---|
6321 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6322 | rcParse = vmsvga3dCmdDXSurfaceCopyAndReadback(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6323 | break;
|
---|
6324 | }
|
---|
6325 |
|
---|
6326 | case SVGA_3D_CMD_DX_MOVE_QUERY:
|
---|
6327 | {
|
---|
6328 | SVGA3dCmdDXMoveQuery *pCmd = (SVGA3dCmdDXMoveQuery *)pvCmd;
|
---|
6329 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6330 | rcParse = vmsvga3dCmdDXMoveQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6331 | break;
|
---|
6332 | }
|
---|
6333 |
|
---|
6334 | case SVGA_3D_CMD_DX_BIND_ALL_QUERY:
|
---|
6335 | {
|
---|
6336 | SVGA3dCmdDXBindAllQuery *pCmd = (SVGA3dCmdDXBindAllQuery *)pvCmd;
|
---|
6337 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6338 | rcParse = vmsvga3dCmdDXBindAllQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6339 | break;
|
---|
6340 | }
|
---|
6341 |
|
---|
6342 | case SVGA_3D_CMD_DX_READBACK_ALL_QUERY:
|
---|
6343 | {
|
---|
6344 | SVGA3dCmdDXReadbackAllQuery *pCmd = (SVGA3dCmdDXReadbackAllQuery *)pvCmd;
|
---|
6345 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6346 | rcParse = vmsvga3dCmdDXReadbackAllQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6347 | break;
|
---|
6348 | }
|
---|
6349 |
|
---|
6350 | case SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER:
|
---|
6351 | {
|
---|
6352 | SVGA3dCmdDXPredTransferFromBuffer *pCmd = (SVGA3dCmdDXPredTransferFromBuffer *)pvCmd;
|
---|
6353 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6354 | rcParse = vmsvga3dCmdDXPredTransferFromBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6355 | break;
|
---|
6356 | }
|
---|
6357 |
|
---|
6358 | case SVGA_3D_CMD_DX_MOB_FENCE_64:
|
---|
6359 | {
|
---|
6360 | SVGA3dCmdDXMobFence64 *pCmd = (SVGA3dCmdDXMobFence64 *)pvCmd;
|
---|
6361 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6362 | rcParse = vmsvga3dCmdDXMobFence64(pThisCC, pCmd, cbCmd);
|
---|
6363 | break;
|
---|
6364 | }
|
---|
6365 |
|
---|
6366 | case SVGA_3D_CMD_DX_BIND_ALL_SHADER:
|
---|
6367 | {
|
---|
6368 | SVGA3dCmdDXBindAllShader *pCmd = (SVGA3dCmdDXBindAllShader *)pvCmd;
|
---|
6369 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6370 | rcParse = vmsvga3dCmdDXBindAllShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6371 | break;
|
---|
6372 | }
|
---|
6373 |
|
---|
6374 | case SVGA_3D_CMD_DX_HINT:
|
---|
6375 | {
|
---|
6376 | SVGA3dCmdDXHint *pCmd = (SVGA3dCmdDXHint *)pvCmd;
|
---|
6377 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6378 | rcParse = vmsvga3dCmdDXHint(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6379 | break;
|
---|
6380 | }
|
---|
6381 |
|
---|
6382 | case SVGA_3D_CMD_DX_BUFFER_UPDATE:
|
---|
6383 | {
|
---|
6384 | SVGA3dCmdDXBufferUpdate *pCmd = (SVGA3dCmdDXBufferUpdate *)pvCmd;
|
---|
6385 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6386 | rcParse = vmsvga3dCmdDXBufferUpdate(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6387 | break;
|
---|
6388 | }
|
---|
6389 |
|
---|
6390 | case SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET:
|
---|
6391 | {
|
---|
6392 | SVGA3dCmdDXSetVSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetVSConstantBufferOffset *)pvCmd;
|
---|
6393 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6394 | rcParse = vmsvga3dCmdDXSetVSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6395 | break;
|
---|
6396 | }
|
---|
6397 |
|
---|
6398 | case SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET:
|
---|
6399 | {
|
---|
6400 | SVGA3dCmdDXSetPSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetPSConstantBufferOffset *)pvCmd;
|
---|
6401 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6402 | rcParse = vmsvga3dCmdDXSetPSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6403 | break;
|
---|
6404 | }
|
---|
6405 |
|
---|
6406 | case SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET:
|
---|
6407 | {
|
---|
6408 | SVGA3dCmdDXSetGSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetGSConstantBufferOffset *)pvCmd;
|
---|
6409 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6410 | rcParse = vmsvga3dCmdDXSetGSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6411 | break;
|
---|
6412 | }
|
---|
6413 |
|
---|
6414 | case SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET:
|
---|
6415 | {
|
---|
6416 | SVGA3dCmdDXSetHSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetHSConstantBufferOffset *)pvCmd;
|
---|
6417 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6418 | rcParse = vmsvga3dCmdDXSetHSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6419 | break;
|
---|
6420 | }
|
---|
6421 |
|
---|
6422 | case SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET:
|
---|
6423 | {
|
---|
6424 | SVGA3dCmdDXSetDSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetDSConstantBufferOffset *)pvCmd;
|
---|
6425 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6426 | rcParse = vmsvga3dCmdDXSetDSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6427 | break;
|
---|
6428 | }
|
---|
6429 |
|
---|
6430 | case SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET:
|
---|
6431 | {
|
---|
6432 | SVGA3dCmdDXSetCSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetCSConstantBufferOffset *)pvCmd;
|
---|
6433 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6434 | rcParse = vmsvga3dCmdDXSetCSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6435 | break;
|
---|
6436 | }
|
---|
6437 |
|
---|
6438 | case SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER:
|
---|
6439 | {
|
---|
6440 | SVGA3dCmdDXCondBindAllShader *pCmd = (SVGA3dCmdDXCondBindAllShader *)pvCmd;
|
---|
6441 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6442 | rcParse = vmsvga3dCmdDXCondBindAllShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6443 | break;
|
---|
6444 | }
|
---|
6445 |
|
---|
6446 | case SVGA_3D_CMD_SCREEN_COPY:
|
---|
6447 | {
|
---|
6448 | SVGA3dCmdScreenCopy *pCmd = (SVGA3dCmdScreenCopy *)pvCmd;
|
---|
6449 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6450 | rcParse = vmsvga3dCmdScreenCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6451 | break;
|
---|
6452 | }
|
---|
6453 |
|
---|
6454 | case SVGA_3D_CMD_RESERVED1:
|
---|
6455 | {
|
---|
6456 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6457 | break;
|
---|
6458 | }
|
---|
6459 |
|
---|
6460 | case SVGA_3D_CMD_RESERVED2:
|
---|
6461 | {
|
---|
6462 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6463 | break;
|
---|
6464 | }
|
---|
6465 |
|
---|
6466 | case SVGA_3D_CMD_RESERVED3:
|
---|
6467 | {
|
---|
6468 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6469 | break;
|
---|
6470 | }
|
---|
6471 |
|
---|
6472 | case SVGA_3D_CMD_RESERVED4:
|
---|
6473 | {
|
---|
6474 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6475 | break;
|
---|
6476 | }
|
---|
6477 |
|
---|
6478 | case SVGA_3D_CMD_RESERVED5:
|
---|
6479 | {
|
---|
6480 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6481 | break;
|
---|
6482 | }
|
---|
6483 |
|
---|
6484 | case SVGA_3D_CMD_RESERVED6:
|
---|
6485 | {
|
---|
6486 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6487 | break;
|
---|
6488 | }
|
---|
6489 |
|
---|
6490 | case SVGA_3D_CMD_RESERVED7:
|
---|
6491 | {
|
---|
6492 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6493 | break;
|
---|
6494 | }
|
---|
6495 |
|
---|
6496 | case SVGA_3D_CMD_RESERVED8:
|
---|
6497 | {
|
---|
6498 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6499 | break;
|
---|
6500 | }
|
---|
6501 |
|
---|
6502 | case SVGA_3D_CMD_GROW_OTABLE:
|
---|
6503 | {
|
---|
6504 | SVGA3dCmdGrowOTable *pCmd = (SVGA3dCmdGrowOTable *)pvCmd;
|
---|
6505 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6506 | rcParse = vmsvga3dCmdGrowOTable(pThisCC, pCmd, cbCmd);
|
---|
6507 | break;
|
---|
6508 | }
|
---|
6509 |
|
---|
6510 | case SVGA_3D_CMD_DX_GROW_COTABLE:
|
---|
6511 | {
|
---|
6512 | SVGA3dCmdDXGrowCOTable *pCmd = (SVGA3dCmdDXGrowCOTable *)pvCmd;
|
---|
6513 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6514 | rcParse = vmsvga3dCmdDXGrowCOTable(pThisCC, pCmd, cbCmd);
|
---|
6515 | break;
|
---|
6516 | }
|
---|
6517 |
|
---|
6518 | case SVGA_3D_CMD_INTRA_SURFACE_COPY:
|
---|
6519 | {
|
---|
6520 | SVGA3dCmdIntraSurfaceCopy *pCmd = (SVGA3dCmdIntraSurfaceCopy *)pvCmd;
|
---|
6521 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6522 | rcParse = vmsvga3dCmdIntraSurfaceCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6523 | break;
|
---|
6524 | }
|
---|
6525 |
|
---|
6526 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V3:
|
---|
6527 | {
|
---|
6528 | SVGA3dCmdDefineGBSurface_v3 *pCmd = (SVGA3dCmdDefineGBSurface_v3 *)pvCmd;
|
---|
6529 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6530 | rcParse = vmsvga3dCmdDefineGBSurface_v3(pThisCC, pCmd);
|
---|
6531 | break;
|
---|
6532 | }
|
---|
6533 |
|
---|
6534 | case SVGA_3D_CMD_DX_RESOLVE_COPY:
|
---|
6535 | {
|
---|
6536 | SVGA3dCmdDXResolveCopy *pCmd = (SVGA3dCmdDXResolveCopy *)pvCmd;
|
---|
6537 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6538 | rcParse = vmsvga3dCmdDXResolveCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6539 | break;
|
---|
6540 | }
|
---|
6541 |
|
---|
6542 | case SVGA_3D_CMD_DX_PRED_RESOLVE_COPY:
|
---|
6543 | {
|
---|
6544 | SVGA3dCmdDXPredResolveCopy *pCmd = (SVGA3dCmdDXPredResolveCopy *)pvCmd;
|
---|
6545 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6546 | rcParse = vmsvga3dCmdDXPredResolveCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6547 | break;
|
---|
6548 | }
|
---|
6549 |
|
---|
6550 | case SVGA_3D_CMD_DX_PRED_CONVERT_REGION:
|
---|
6551 | {
|
---|
6552 | SVGA3dCmdDXPredConvertRegion *pCmd = (SVGA3dCmdDXPredConvertRegion *)pvCmd;
|
---|
6553 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6554 | rcParse = vmsvga3dCmdDXPredConvertRegion(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6555 | break;
|
---|
6556 | }
|
---|
6557 |
|
---|
6558 | case SVGA_3D_CMD_DX_PRED_CONVERT:
|
---|
6559 | {
|
---|
6560 | SVGA3dCmdDXPredConvert *pCmd = (SVGA3dCmdDXPredConvert *)pvCmd;
|
---|
6561 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6562 | rcParse = vmsvga3dCmdDXPredConvert(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6563 | break;
|
---|
6564 | }
|
---|
6565 |
|
---|
6566 | case SVGA_3D_CMD_WHOLE_SURFACE_COPY:
|
---|
6567 | {
|
---|
6568 | SVGA3dCmdWholeSurfaceCopy *pCmd = (SVGA3dCmdWholeSurfaceCopy *)pvCmd;
|
---|
6569 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6570 | rcParse = vmsvga3dCmdWholeSurfaceCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6571 | break;
|
---|
6572 | }
|
---|
6573 |
|
---|
6574 | case SVGA_3D_CMD_DX_DEFINE_UA_VIEW:
|
---|
6575 | {
|
---|
6576 | SVGA3dCmdDXDefineUAView *pCmd = (SVGA3dCmdDXDefineUAView *)pvCmd;
|
---|
6577 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6578 | rcParse = vmsvga3dCmdDXDefineUAView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6579 | break;
|
---|
6580 | }
|
---|
6581 |
|
---|
6582 | case SVGA_3D_CMD_DX_DESTROY_UA_VIEW:
|
---|
6583 | {
|
---|
6584 | SVGA3dCmdDXDestroyUAView *pCmd = (SVGA3dCmdDXDestroyUAView *)pvCmd;
|
---|
6585 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6586 | rcParse = vmsvga3dCmdDXDestroyUAView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6587 | break;
|
---|
6588 | }
|
---|
6589 |
|
---|
6590 | case SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT:
|
---|
6591 | {
|
---|
6592 | SVGA3dCmdDXClearUAViewUint *pCmd = (SVGA3dCmdDXClearUAViewUint *)pvCmd;
|
---|
6593 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6594 | rcParse = vmsvga3dCmdDXClearUAViewUint(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6595 | break;
|
---|
6596 | }
|
---|
6597 |
|
---|
6598 | case SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT:
|
---|
6599 | {
|
---|
6600 | SVGA3dCmdDXClearUAViewFloat *pCmd = (SVGA3dCmdDXClearUAViewFloat *)pvCmd;
|
---|
6601 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6602 | rcParse = vmsvga3dCmdDXClearUAViewFloat(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6603 | break;
|
---|
6604 | }
|
---|
6605 |
|
---|
6606 | case SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT:
|
---|
6607 | {
|
---|
6608 | SVGA3dCmdDXCopyStructureCount *pCmd = (SVGA3dCmdDXCopyStructureCount *)pvCmd;
|
---|
6609 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6610 | rcParse = vmsvga3dCmdDXCopyStructureCount(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6611 | break;
|
---|
6612 | }
|
---|
6613 |
|
---|
6614 | case SVGA_3D_CMD_DX_SET_UA_VIEWS:
|
---|
6615 | {
|
---|
6616 | SVGA3dCmdDXSetUAViews *pCmd = (SVGA3dCmdDXSetUAViews *)pvCmd;
|
---|
6617 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6618 | rcParse = vmsvga3dCmdDXSetUAViews(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6619 | break;
|
---|
6620 | }
|
---|
6621 |
|
---|
6622 | case SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT:
|
---|
6623 | {
|
---|
6624 | SVGA3dCmdDXDrawIndexedInstancedIndirect *pCmd = (SVGA3dCmdDXDrawIndexedInstancedIndirect *)pvCmd;
|
---|
6625 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6626 | rcParse = vmsvga3dCmdDXDrawIndexedInstancedIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6627 | break;
|
---|
6628 | }
|
---|
6629 |
|
---|
6630 | case SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT:
|
---|
6631 | {
|
---|
6632 | SVGA3dCmdDXDrawInstancedIndirect *pCmd = (SVGA3dCmdDXDrawInstancedIndirect *)pvCmd;
|
---|
6633 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6634 | rcParse = vmsvga3dCmdDXDrawInstancedIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6635 | break;
|
---|
6636 | }
|
---|
6637 |
|
---|
6638 | case SVGA_3D_CMD_DX_DISPATCH:
|
---|
6639 | {
|
---|
6640 | SVGA3dCmdDXDispatch *pCmd = (SVGA3dCmdDXDispatch *)pvCmd;
|
---|
6641 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6642 | rcParse = vmsvga3dCmdDXDispatch(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6643 | break;
|
---|
6644 | }
|
---|
6645 |
|
---|
6646 | case SVGA_3D_CMD_DX_DISPATCH_INDIRECT:
|
---|
6647 | {
|
---|
6648 | SVGA3dCmdDXDispatchIndirect *pCmd = (SVGA3dCmdDXDispatchIndirect *)pvCmd;
|
---|
6649 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6650 | rcParse = vmsvga3dCmdDXDispatchIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6651 | break;
|
---|
6652 | }
|
---|
6653 |
|
---|
6654 | case SVGA_3D_CMD_WRITE_ZERO_SURFACE:
|
---|
6655 | {
|
---|
6656 | SVGA3dCmdWriteZeroSurface *pCmd = (SVGA3dCmdWriteZeroSurface *)pvCmd;
|
---|
6657 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6658 | rcParse = vmsvga3dCmdWriteZeroSurface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6659 | break;
|
---|
6660 | }
|
---|
6661 |
|
---|
6662 | case SVGA_3D_CMD_HINT_ZERO_SURFACE:
|
---|
6663 | {
|
---|
6664 | SVGA3dCmdHintZeroSurface *pCmd = (SVGA3dCmdHintZeroSurface *)pvCmd;
|
---|
6665 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6666 | rcParse = vmsvga3dCmdHintZeroSurface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6667 | break;
|
---|
6668 | }
|
---|
6669 |
|
---|
6670 | case SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER:
|
---|
6671 | {
|
---|
6672 | SVGA3dCmdDXTransferToBuffer *pCmd = (SVGA3dCmdDXTransferToBuffer *)pvCmd;
|
---|
6673 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6674 | rcParse = vmsvga3dCmdDXTransferToBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6675 | break;
|
---|
6676 | }
|
---|
6677 |
|
---|
6678 | case SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT:
|
---|
6679 | {
|
---|
6680 | SVGA3dCmdDXSetStructureCount *pCmd = (SVGA3dCmdDXSetStructureCount *)pvCmd;
|
---|
6681 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6682 | rcParse = vmsvga3dCmdDXSetStructureCount(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6683 | break;
|
---|
6684 | }
|
---|
6685 |
|
---|
6686 | case SVGA_3D_CMD_LOGICOPS_BITBLT:
|
---|
6687 | {
|
---|
6688 | SVGA3dCmdLogicOpsBitBlt *pCmd = (SVGA3dCmdLogicOpsBitBlt *)pvCmd;
|
---|
6689 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6690 | rcParse = vmsvga3dCmdLogicOpsBitBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6691 | break;
|
---|
6692 | }
|
---|
6693 |
|
---|
6694 | case SVGA_3D_CMD_LOGICOPS_TRANSBLT:
|
---|
6695 | {
|
---|
6696 | SVGA3dCmdLogicOpsTransBlt *pCmd = (SVGA3dCmdLogicOpsTransBlt *)pvCmd;
|
---|
6697 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6698 | rcParse = vmsvga3dCmdLogicOpsTransBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6699 | break;
|
---|
6700 | }
|
---|
6701 |
|
---|
6702 | case SVGA_3D_CMD_LOGICOPS_STRETCHBLT:
|
---|
6703 | {
|
---|
6704 | SVGA3dCmdLogicOpsStretchBlt *pCmd = (SVGA3dCmdLogicOpsStretchBlt *)pvCmd;
|
---|
6705 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6706 | rcParse = vmsvga3dCmdLogicOpsStretchBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6707 | break;
|
---|
6708 | }
|
---|
6709 |
|
---|
6710 | case SVGA_3D_CMD_LOGICOPS_COLORFILL:
|
---|
6711 | {
|
---|
6712 | SVGA3dCmdLogicOpsColorFill *pCmd = (SVGA3dCmdLogicOpsColorFill *)pvCmd;
|
---|
6713 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6714 | rcParse = vmsvga3dCmdLogicOpsColorFill(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6715 | break;
|
---|
6716 | }
|
---|
6717 |
|
---|
6718 | case SVGA_3D_CMD_LOGICOPS_ALPHABLEND:
|
---|
6719 | {
|
---|
6720 | SVGA3dCmdLogicOpsAlphaBlend *pCmd = (SVGA3dCmdLogicOpsAlphaBlend *)pvCmd;
|
---|
6721 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6722 | rcParse = vmsvga3dCmdLogicOpsAlphaBlend(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6723 | break;
|
---|
6724 | }
|
---|
6725 |
|
---|
6726 | case SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND:
|
---|
6727 | {
|
---|
6728 | SVGA3dCmdLogicOpsClearTypeBlend *pCmd = (SVGA3dCmdLogicOpsClearTypeBlend *)pvCmd;
|
---|
6729 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6730 | rcParse = vmsvga3dCmdLogicOpsClearTypeBlend(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6731 | break;
|
---|
6732 | }
|
---|
6733 |
|
---|
6734 | case SVGA_3D_CMD_RESERVED2_1:
|
---|
6735 | {
|
---|
6736 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6737 | break;
|
---|
6738 | }
|
---|
6739 |
|
---|
6740 | case SVGA_3D_CMD_RESERVED2_2:
|
---|
6741 | {
|
---|
6742 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6743 | break;
|
---|
6744 | }
|
---|
6745 |
|
---|
6746 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V4:
|
---|
6747 | {
|
---|
6748 | SVGA3dCmdDefineGBSurface_v4 *pCmd = (SVGA3dCmdDefineGBSurface_v4 *)pvCmd;
|
---|
6749 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6750 | rcParse = vmsvga3dCmdDefineGBSurface_v4(pThisCC, pCmd);
|
---|
6751 | break;
|
---|
6752 | }
|
---|
6753 |
|
---|
6754 | case SVGA_3D_CMD_DX_SET_CS_UA_VIEWS:
|
---|
6755 | {
|
---|
6756 | SVGA3dCmdDXSetCSUAViews *pCmd = (SVGA3dCmdDXSetCSUAViews *)pvCmd;
|
---|
6757 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6758 | rcParse = vmsvga3dCmdDXSetCSUAViews(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6759 | break;
|
---|
6760 | }
|
---|
6761 |
|
---|
6762 | case SVGA_3D_CMD_DX_SET_MIN_LOD:
|
---|
6763 | {
|
---|
6764 | SVGA3dCmdDXSetMinLOD *pCmd = (SVGA3dCmdDXSetMinLOD *)pvCmd;
|
---|
6765 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6766 | rcParse = vmsvga3dCmdDXSetMinLOD(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6767 | break;
|
---|
6768 | }
|
---|
6769 |
|
---|
6770 | case SVGA_3D_CMD_RESERVED2_3:
|
---|
6771 | {
|
---|
6772 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6773 | break;
|
---|
6774 | }
|
---|
6775 |
|
---|
6776 | case SVGA_3D_CMD_RESERVED2_4:
|
---|
6777 | {
|
---|
6778 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6779 | break;
|
---|
6780 | }
|
---|
6781 |
|
---|
6782 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2:
|
---|
6783 | {
|
---|
6784 | SVGA3dCmdDXDefineDepthStencilView_v2 *pCmd = (SVGA3dCmdDXDefineDepthStencilView_v2 *)pvCmd;
|
---|
6785 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6786 | rcParse = vmsvga3dCmdDXDefineDepthStencilView_v2(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6787 | break;
|
---|
6788 | }
|
---|
6789 |
|
---|
6790 | case SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB:
|
---|
6791 | {
|
---|
6792 | SVGA3dCmdDXDefineStreamOutputWithMob *pCmd = (SVGA3dCmdDXDefineStreamOutputWithMob *)pvCmd;
|
---|
6793 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6794 | rcParse = vmsvga3dCmdDXDefineStreamOutputWithMob(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6795 | break;
|
---|
6796 | }
|
---|
6797 |
|
---|
6798 | case SVGA_3D_CMD_DX_SET_SHADER_IFACE:
|
---|
6799 | {
|
---|
6800 | SVGA3dCmdDXSetShaderIface *pCmd = (SVGA3dCmdDXSetShaderIface *)pvCmd;
|
---|
6801 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6802 | rcParse = vmsvga3dCmdDXSetShaderIface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6803 | break;
|
---|
6804 | }
|
---|
6805 |
|
---|
6806 | case SVGA_3D_CMD_DX_BIND_STREAMOUTPUT:
|
---|
6807 | {
|
---|
6808 | SVGA3dCmdDXBindStreamOutput *pCmd = (SVGA3dCmdDXBindStreamOutput *)pvCmd;
|
---|
6809 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6810 | rcParse = vmsvga3dCmdDXBindStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6811 | break;
|
---|
6812 | }
|
---|
6813 |
|
---|
6814 | case SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS:
|
---|
6815 | {
|
---|
6816 | SVGA3dCmdSurfaceStretchBltNonMSToMS *pCmd = (SVGA3dCmdSurfaceStretchBltNonMSToMS *)pvCmd;
|
---|
6817 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6818 | rcParse = vmsvga3dCmdSurfaceStretchBltNonMSToMS(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6819 | break;
|
---|
6820 | }
|
---|
6821 |
|
---|
6822 | case SVGA_3D_CMD_DX_BIND_SHADER_IFACE:
|
---|
6823 | {
|
---|
6824 | SVGA3dCmdDXBindShaderIface *pCmd = (SVGA3dCmdDXBindShaderIface *)pvCmd;
|
---|
6825 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6826 | rcParse = vmsvga3dCmdDXBindShaderIface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6827 | break;
|
---|
6828 | }
|
---|
6829 |
|
---|
6830 | case SVGA_3D_CMD_VB_DX_CLEAR_RENDERTARGET_VIEW_REGION:
|
---|
6831 | {
|
---|
6832 | SVGA3dCmdVBDXClearRenderTargetViewRegion *pCmd = (SVGA3dCmdVBDXClearRenderTargetViewRegion *)pvCmd;
|
---|
6833 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6834 | rcParse = vmsvga3dCmdVBDXClearRenderTargetViewRegion(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6835 | break;
|
---|
6836 | }
|
---|
6837 |
|
---|
6838 | case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR:
|
---|
6839 | {
|
---|
6840 | VBSVGA3dCmdDXDefineVideoProcessor *pCmd = (VBSVGA3dCmdDXDefineVideoProcessor *)pvCmd;
|
---|
6841 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6842 | rcParse = vmsvga3dVBCmdDXDefineVideoProcessor(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6843 | break;
|
---|
6844 | }
|
---|
6845 |
|
---|
6846 | case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER_OUTPUT_VIEW:
|
---|
6847 | {
|
---|
6848 | VBSVGA3dCmdDXDefineVideoDecoderOutputView *pCmd = (VBSVGA3dCmdDXDefineVideoDecoderOutputView *)pvCmd;
|
---|
6849 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6850 | rcParse = vmsvga3dVBCmdDXDefineVideoDecoderOutputView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6851 | break;
|
---|
6852 | }
|
---|
6853 |
|
---|
6854 | case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER:
|
---|
6855 | {
|
---|
6856 | VBSVGA3dCmdDXDefineVideoDecoder *pCmd = (VBSVGA3dCmdDXDefineVideoDecoder *)pvCmd;
|
---|
6857 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6858 | rcParse = vmsvga3dVBCmdDXDefineVideoDecoder(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6859 | break;
|
---|
6860 | }
|
---|
6861 |
|
---|
6862 | case VBSVGA_3D_CMD_DX_VIDEO_DECODER_BEGIN_FRAME:
|
---|
6863 | {
|
---|
6864 | VBSVGA3dCmdDXVideoDecoderBeginFrame *pCmd = (VBSVGA3dCmdDXVideoDecoderBeginFrame *)pvCmd;
|
---|
6865 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6866 | rcParse = vmsvga3dVBCmdDXVideoDecoderBeginFrame(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6867 | break;
|
---|
6868 | }
|
---|
6869 |
|
---|
6870 | case VBSVGA_3D_CMD_DX_VIDEO_DECODER_SUBMIT_BUFFERS:
|
---|
6871 | {
|
---|
6872 | VBSVGA3dCmdDXVideoDecoderSubmitBuffers *pCmd = (VBSVGA3dCmdDXVideoDecoderSubmitBuffers *)pvCmd;
|
---|
6873 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6874 | rcParse = vmsvga3dVBCmdDXVideoDecoderSubmitBuffers(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6875 | break;
|
---|
6876 | }
|
---|
6877 |
|
---|
6878 | case VBSVGA_3D_CMD_DX_VIDEO_DECODER_END_FRAME:
|
---|
6879 | {
|
---|
6880 | VBSVGA3dCmdDXVideoDecoderEndFrame *pCmd = (VBSVGA3dCmdDXVideoDecoderEndFrame *)pvCmd;
|
---|
6881 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6882 | rcParse = vmsvga3dVBCmdDXVideoDecoderEndFrame(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6883 | break;
|
---|
6884 | }
|
---|
6885 |
|
---|
6886 | case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_INPUT_VIEW:
|
---|
6887 | {
|
---|
6888 | VBSVGA3dCmdDXDefineVideoProcessorInputView *pCmd = (VBSVGA3dCmdDXDefineVideoProcessorInputView *)pvCmd;
|
---|
6889 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6890 | rcParse = vmsvga3dVBCmdDXDefineVideoProcessorInputView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6891 | break;
|
---|
6892 | }
|
---|
6893 |
|
---|
6894 | case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_OUTPUT_VIEW:
|
---|
6895 | {
|
---|
6896 | VBSVGA3dCmdDXDefineVideoProcessorOutputView *pCmd = (VBSVGA3dCmdDXDefineVideoProcessorOutputView *)pvCmd;
|
---|
6897 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6898 | rcParse = vmsvga3dVBCmdDXDefineVideoProcessorOutputView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6899 | break;
|
---|
6900 | }
|
---|
6901 |
|
---|
6902 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_BLT:
|
---|
6903 | {
|
---|
6904 | VBSVGA3dCmdDXVideoProcessorBlt *pCmd = (VBSVGA3dCmdDXVideoProcessorBlt *)pvCmd;
|
---|
6905 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6906 | rcParse = vmsvga3dVBCmdDXVideoProcessorBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6907 | break;
|
---|
6908 | }
|
---|
6909 |
|
---|
6910 | case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER:
|
---|
6911 | {
|
---|
6912 | VBSVGA3dCmdDXDestroyVideoDecoder *pCmd = (VBSVGA3dCmdDXDestroyVideoDecoder *)pvCmd;
|
---|
6913 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6914 | rcParse = vmsvga3dVBCmdDXDestroyVideoDecoder(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6915 | break;
|
---|
6916 | }
|
---|
6917 |
|
---|
6918 | case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER_OUTPUT_VIEW:
|
---|
6919 | {
|
---|
6920 | VBSVGA3dCmdDXDestroyVideoDecoderOutputView *pCmd = (VBSVGA3dCmdDXDestroyVideoDecoderOutputView *)pvCmd;
|
---|
6921 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6922 | rcParse = vmsvga3dVBCmdDXDestroyVideoDecoderOutputView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6923 | break;
|
---|
6924 | }
|
---|
6925 |
|
---|
6926 | case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR:
|
---|
6927 | {
|
---|
6928 | VBSVGA3dCmdDXDestroyVideoProcessor *pCmd = (VBSVGA3dCmdDXDestroyVideoProcessor *)pvCmd;
|
---|
6929 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6930 | rcParse = vmsvga3dVBCmdDXDestroyVideoProcessor(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6931 | break;
|
---|
6932 | }
|
---|
6933 |
|
---|
6934 | case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_INPUT_VIEW:
|
---|
6935 | {
|
---|
6936 | VBSVGA3dCmdDXDestroyVideoProcessorInputView *pCmd = (VBSVGA3dCmdDXDestroyVideoProcessorInputView *)pvCmd;
|
---|
6937 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6938 | rcParse = vmsvga3dVBCmdDXDestroyVideoProcessorInputView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6939 | break;
|
---|
6940 | }
|
---|
6941 |
|
---|
6942 | case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_OUTPUT_VIEW:
|
---|
6943 | {
|
---|
6944 | VBSVGA3dCmdDXDestroyVideoProcessorOutputView *pCmd = (VBSVGA3dCmdDXDestroyVideoProcessorOutputView *)pvCmd;
|
---|
6945 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6946 | rcParse = vmsvga3dVBCmdDXDestroyVideoProcessorOutputView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6947 | break;
|
---|
6948 | }
|
---|
6949 |
|
---|
6950 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_TARGET_RECT:
|
---|
6951 | {
|
---|
6952 | VBSVGA3dCmdDXVideoProcessorSetOutputTargetRect *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputTargetRect *)pvCmd;
|
---|
6953 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6954 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputTargetRect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6955 | break;
|
---|
6956 | }
|
---|
6957 |
|
---|
6958 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_BACKGROUND_COLOR:
|
---|
6959 | {
|
---|
6960 | VBSVGA3dCmdDXVideoProcessorSetOutputBackgroundColor *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputBackgroundColor *)pvCmd;
|
---|
6961 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6962 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputBackgroundColor(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6963 | break;
|
---|
6964 | }
|
---|
6965 |
|
---|
6966 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_COLOR_SPACE:
|
---|
6967 | {
|
---|
6968 | VBSVGA3dCmdDXVideoProcessorSetOutputColorSpace *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputColorSpace *)pvCmd;
|
---|
6969 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6970 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputColorSpace(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6971 | break;
|
---|
6972 | }
|
---|
6973 |
|
---|
6974 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_ALPHA_FILL_MODE:
|
---|
6975 | {
|
---|
6976 | VBSVGA3dCmdDXVideoProcessorSetOutputAlphaFillMode *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputAlphaFillMode *)pvCmd;
|
---|
6977 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6978 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputAlphaFillMode(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6979 | break;
|
---|
6980 | }
|
---|
6981 |
|
---|
6982 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_CONSTRICTION:
|
---|
6983 | {
|
---|
6984 | VBSVGA3dCmdDXVideoProcessorSetOutputConstriction *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputConstriction *)pvCmd;
|
---|
6985 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6986 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputConstriction(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6987 | break;
|
---|
6988 | }
|
---|
6989 |
|
---|
6990 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_STEREO_MODE:
|
---|
6991 | {
|
---|
6992 | VBSVGA3dCmdDXVideoProcessorSetOutputStereoMode *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputStereoMode *)pvCmd;
|
---|
6993 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6994 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputStereoMode(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6995 | break;
|
---|
6996 | }
|
---|
6997 |
|
---|
6998 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FRAME_FORMAT:
|
---|
6999 | {
|
---|
7000 | VBSVGA3dCmdDXVideoProcessorSetStreamFrameFormat *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamFrameFormat *)pvCmd;
|
---|
7001 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7002 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamFrameFormat(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7003 | break;
|
---|
7004 | }
|
---|
7005 |
|
---|
7006 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_COLOR_SPACE:
|
---|
7007 | {
|
---|
7008 | VBSVGA3dCmdDXVideoProcessorSetStreamColorSpace *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamColorSpace *)pvCmd;
|
---|
7009 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7010 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamColorSpace(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7011 | break;
|
---|
7012 | }
|
---|
7013 |
|
---|
7014 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_OUTPUT_RATE:
|
---|
7015 | {
|
---|
7016 | VBSVGA3dCmdDXVideoProcessorSetStreamOutputRate *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamOutputRate *)pvCmd;
|
---|
7017 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7018 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamOutputRate(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7019 | break;
|
---|
7020 | }
|
---|
7021 |
|
---|
7022 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_SOURCE_RECT:
|
---|
7023 | {
|
---|
7024 | VBSVGA3dCmdDXVideoProcessorSetStreamSourceRect *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamSourceRect *)pvCmd;
|
---|
7025 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7026 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamSourceRect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7027 | break;
|
---|
7028 | }
|
---|
7029 |
|
---|
7030 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_DEST_RECT:
|
---|
7031 | {
|
---|
7032 | VBSVGA3dCmdDXVideoProcessorSetStreamDestRect *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamDestRect *)pvCmd;
|
---|
7033 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7034 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamDestRect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7035 | break;
|
---|
7036 | }
|
---|
7037 |
|
---|
7038 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ALPHA:
|
---|
7039 | {
|
---|
7040 | VBSVGA3dCmdDXVideoProcessorSetStreamAlpha *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamAlpha *)pvCmd;
|
---|
7041 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7042 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamAlpha(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7043 | break;
|
---|
7044 | }
|
---|
7045 |
|
---|
7046 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PALETTE:
|
---|
7047 | {
|
---|
7048 | VBSVGA3dCmdDXVideoProcessorSetStreamPalette *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamPalette *)pvCmd;
|
---|
7049 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7050 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamPalette(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7051 | break;
|
---|
7052 | }
|
---|
7053 |
|
---|
7054 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PIXEL_ASPECT_RATIO:
|
---|
7055 | {
|
---|
7056 | VBSVGA3dCmdDXVideoProcessorSetStreamPixelAspectRatio *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamPixelAspectRatio *)pvCmd;
|
---|
7057 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7058 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamPixelAspectRatio(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7059 | break;
|
---|
7060 | }
|
---|
7061 |
|
---|
7062 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_LUMA_KEY:
|
---|
7063 | {
|
---|
7064 | VBSVGA3dCmdDXVideoProcessorSetStreamLumaKey *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamLumaKey *)pvCmd;
|
---|
7065 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7066 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamLumaKey(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7067 | break;
|
---|
7068 | }
|
---|
7069 |
|
---|
7070 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_STEREO_FORMAT:
|
---|
7071 | {
|
---|
7072 | VBSVGA3dCmdDXVideoProcessorSetStreamStereoFormat *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamStereoFormat *)pvCmd;
|
---|
7073 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7074 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamStereoFormat(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7075 | break;
|
---|
7076 | }
|
---|
7077 |
|
---|
7078 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_AUTO_PROCESSING_MODE:
|
---|
7079 | {
|
---|
7080 | VBSVGA3dCmdDXVideoProcessorSetStreamAutoProcessingMode *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamAutoProcessingMode *)pvCmd;
|
---|
7081 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7082 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamAutoProcessingMode(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7083 | break;
|
---|
7084 | }
|
---|
7085 |
|
---|
7086 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FILTER:
|
---|
7087 | {
|
---|
7088 | VBSVGA3dCmdDXVideoProcessorSetStreamFilter *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamFilter *)pvCmd;
|
---|
7089 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7090 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamFilter(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7091 | break;
|
---|
7092 | }
|
---|
7093 |
|
---|
7094 | case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ROTATION:
|
---|
7095 | {
|
---|
7096 | VBSVGA3dCmdDXVideoProcessorSetStreamRotation *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamRotation *)pvCmd;
|
---|
7097 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7098 | rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamRotation(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7099 | break;
|
---|
7100 | }
|
---|
7101 |
|
---|
7102 | case VBSVGA_3D_CMD_DX_GET_VIDEO_CAPABILITY:
|
---|
7103 | {
|
---|
7104 | VBSVGA3dCmdDXGetVideoCapability *pCmd = (VBSVGA3dCmdDXGetVideoCapability *)pvCmd;
|
---|
7105 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7106 | rcParse = vmsvga3dVBCmdDXGetVideoCapability(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7107 | break;
|
---|
7108 | }
|
---|
7109 |
|
---|
7110 | case VBSVGA_3D_CMD_DX_CLEAR_RTV:
|
---|
7111 | {
|
---|
7112 | VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
|
---|
7113 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7114 | rcParse = vmsvga3dVBCmdDXClearRTV(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7115 | break;
|
---|
7116 | }
|
---|
7117 |
|
---|
7118 | case VBSVGA_3D_CMD_DX_CLEAR_UAV:
|
---|
7119 | {
|
---|
7120 | VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
|
---|
7121 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7122 | rcParse = vmsvga3dVBCmdDXClearUAV(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7123 | break;
|
---|
7124 | }
|
---|
7125 |
|
---|
7126 | case VBSVGA_3D_CMD_DX_CLEAR_VDOV:
|
---|
7127 | {
|
---|
7128 | VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
|
---|
7129 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7130 | rcParse = vmsvga3dVBCmdDXClearVDOV(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7131 | break;
|
---|
7132 | }
|
---|
7133 |
|
---|
7134 | case VBSVGA_3D_CMD_DX_CLEAR_VPIV:
|
---|
7135 | {
|
---|
7136 | VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
|
---|
7137 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7138 | rcParse = vmsvga3dVBCmdDXClearVPIV(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7139 | break;
|
---|
7140 | }
|
---|
7141 |
|
---|
7142 | case VBSVGA_3D_CMD_DX_CLEAR_VPOV:
|
---|
7143 | {
|
---|
7144 | VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
|
---|
7145 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
7146 | rcParse = vmsvga3dVBCmdDXClearVPOV(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
7147 | break;
|
---|
7148 | }
|
---|
7149 |
|
---|
7150 | /* Unsupported commands. */
|
---|
7151 | case SVGA_3D_CMD_DEAD4: /* SVGA_3D_CMD_VIDEO_CREATE_DECODER */
|
---|
7152 | case SVGA_3D_CMD_DEAD5: /* SVGA_3D_CMD_VIDEO_DESTROY_DECODER */
|
---|
7153 | case SVGA_3D_CMD_DEAD6: /* SVGA_3D_CMD_VIDEO_CREATE_PROCESSOR */
|
---|
7154 | case SVGA_3D_CMD_DEAD7: /* SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR */
|
---|
7155 | case SVGA_3D_CMD_DEAD8: /* SVGA_3D_CMD_VIDEO_DECODE_START_FRAME */
|
---|
7156 | case SVGA_3D_CMD_DEAD9: /* SVGA_3D_CMD_VIDEO_DECODE_RENDER */
|
---|
7157 | case SVGA_3D_CMD_DEAD10: /* SVGA_3D_CMD_VIDEO_DECODE_END_FRAME */
|
---|
7158 | case SVGA_3D_CMD_DEAD11: /* SVGA_3D_CMD_VIDEO_PROCESS_FRAME */
|
---|
7159 | /* Prevent the compiler warning. */
|
---|
7160 | case SVGA_3D_CMD_LEGACY_BASE:
|
---|
7161 | case SVGA_3D_CMD_MAX:
|
---|
7162 | case SVGA_3D_CMD_FUTURE_MAX:
|
---|
7163 | case VBSVGA_3D_CMD_MAX:
|
---|
7164 | #ifndef DEBUG_sunlover
|
---|
7165 | default: /* Compiler warning. */
|
---|
7166 | #else
|
---|
7167 | /* No 'default' case */
|
---|
7168 | #endif
|
---|
7169 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatFifoUnkCmds);
|
---|
7170 | ASSERT_GUEST_MSG_FAILED(("enmCmdId=%d\n", enmCmdId));
|
---|
7171 | LogRelMax(16, ("VMSVGA: unsupported 3D command %d\n", enmCmdId));
|
---|
7172 | rcParse = VERR_NOT_IMPLEMENTED;
|
---|
7173 | break;
|
---|
7174 | }
|
---|
7175 |
|
---|
7176 | if (RT_FAILURE(rcParse))
|
---|
7177 | LogRelMax(16, ("VMSVGA: command %d: %Rrc\n", enmCmdId, rcParse));
|
---|
7178 | return VINF_SUCCESS;
|
---|
7179 | }
|
---|
7180 | # undef VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK
|
---|
7181 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
7182 |
|
---|
7183 |
|
---|
7184 | /*
|
---|
7185 | *
|
---|
7186 | * Handlers for FIFO commands.
|
---|
7187 | *
|
---|
7188 | * Every handler takes the following parameters:
|
---|
7189 | *
|
---|
7190 | * pThis The shared VGA/VMSVGA state.
|
---|
7191 | * pThisCC The VGA/VMSVGA state for ring-3.
|
---|
7192 | * pCmd The command data.
|
---|
7193 | */
|
---|
7194 |
|
---|
7195 |
|
---|
7196 | /* SVGA_CMD_UPDATE */
|
---|
7197 | void vmsvgaR3CmdUpdate(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdUpdate const *pCmd)
|
---|
7198 | {
|
---|
7199 | RT_NOREF(pThis);
|
---|
7200 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7201 |
|
---|
7202 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdUpdate);
|
---|
7203 | Log(("SVGA_CMD_UPDATE %d,%d %dx%d\n", pCmd->x, pCmd->y, pCmd->width, pCmd->height));
|
---|
7204 |
|
---|
7205 | /** @todo Multiple screens? */
|
---|
7206 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
7207 | if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
|
---|
7208 | return;
|
---|
7209 |
|
---|
7210 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->x, pCmd->y, pCmd->width, pCmd->height);
|
---|
7211 | }
|
---|
7212 |
|
---|
7213 |
|
---|
7214 | /* SVGA_CMD_UPDATE_VERBOSE */
|
---|
7215 | void vmsvgaR3CmdUpdateVerbose(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdUpdateVerbose const *pCmd)
|
---|
7216 | {
|
---|
7217 | RT_NOREF(pThis);
|
---|
7218 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7219 |
|
---|
7220 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdUpdateVerbose);
|
---|
7221 | Log(("SVGA_CMD_UPDATE_VERBOSE %d,%d %dx%d reason %#x\n", pCmd->x, pCmd->y, pCmd->width, pCmd->height, pCmd->reason));
|
---|
7222 |
|
---|
7223 | /** @todo Multiple screens? */
|
---|
7224 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
7225 | if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
|
---|
7226 | return;
|
---|
7227 |
|
---|
7228 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->x, pCmd->y, pCmd->width, pCmd->height);
|
---|
7229 | }
|
---|
7230 |
|
---|
7231 |
|
---|
7232 | /* SVGA_CMD_RECT_FILL */
|
---|
7233 | void vmsvgaR3CmdRectFill(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectFill const *pCmd)
|
---|
7234 | {
|
---|
7235 | RT_NOREF(pThis, pCmd);
|
---|
7236 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7237 |
|
---|
7238 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectFill);
|
---|
7239 | Log(("SVGA_CMD_RECT_FILL %08X @ %d,%d (%dx%d)\n", pCmd->pixel, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height));
|
---|
7240 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_RECT_FILL command ignored.\n"));
|
---|
7241 | }
|
---|
7242 |
|
---|
7243 |
|
---|
7244 | /* SVGA_CMD_RECT_COPY */
|
---|
7245 | void vmsvgaR3CmdRectCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectCopy const *pCmd)
|
---|
7246 | {
|
---|
7247 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7248 |
|
---|
7249 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectCopy);
|
---|
7250 | Log(("SVGA_CMD_RECT_COPY %d,%d -> %d,%d %dx%d\n", pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height));
|
---|
7251 |
|
---|
7252 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
7253 | AssertPtrReturnVoid(pScreen);
|
---|
7254 |
|
---|
7255 | /* Check that arguments aren't complete junk. A precise check is done in vmsvgaR3RectCopy(). */
|
---|
7256 | ASSERT_GUEST_RETURN_VOID(pCmd->srcX < pThis->svga.u32MaxWidth);
|
---|
7257 | ASSERT_GUEST_RETURN_VOID(pCmd->destX < pThis->svga.u32MaxWidth);
|
---|
7258 | ASSERT_GUEST_RETURN_VOID(pCmd->width < pThis->svga.u32MaxWidth);
|
---|
7259 | ASSERT_GUEST_RETURN_VOID(pCmd->srcY < pThis->svga.u32MaxHeight);
|
---|
7260 | ASSERT_GUEST_RETURN_VOID(pCmd->destY < pThis->svga.u32MaxHeight);
|
---|
7261 | ASSERT_GUEST_RETURN_VOID(pCmd->height < pThis->svga.u32MaxHeight);
|
---|
7262 |
|
---|
7263 | vmsvgaR3RectCopy(pThisCC, pScreen, pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY,
|
---|
7264 | pCmd->width, pCmd->height, pThis->vram_size);
|
---|
7265 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height);
|
---|
7266 | }
|
---|
7267 |
|
---|
7268 |
|
---|
7269 | /* SVGA_CMD_RECT_ROP_COPY */
|
---|
7270 | void vmsvgaR3CmdRectRopCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectRopCopy const *pCmd)
|
---|
7271 | {
|
---|
7272 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7273 |
|
---|
7274 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectRopCopy);
|
---|
7275 | 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));
|
---|
7276 |
|
---|
7277 | if (pCmd->rop != SVGA_ROP_COPY)
|
---|
7278 | {
|
---|
7279 | /* We only support the plain copy ROP which makes SVGA_CMD_RECT_ROP_COPY exactly the same
|
---|
7280 | * as SVGA_CMD_RECT_COPY. XFree86 4.1.0 and 4.2.0 drivers (driver version 10.4.0 and 10.7.0,
|
---|
7281 | * respectively) issue SVGA_CMD_RECT_ROP_COPY when SVGA_CAP_RECT_COPY is present even when
|
---|
7282 | * SVGA_CAP_RASTER_OP is not. However, the ROP will always be SVGA_ROP_COPY.
|
---|
7283 | */
|
---|
7284 | LogRelMax(4, ("VMSVGA: SVGA_CMD_RECT_ROP_COPY %d,%d -> %d,%d (%dx%d) ROP %X unsupported\n",
|
---|
7285 | pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height, pCmd->rop));
|
---|
7286 | return;
|
---|
7287 | }
|
---|
7288 |
|
---|
7289 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
7290 | AssertPtrReturnVoid(pScreen);
|
---|
7291 |
|
---|
7292 | /* Check that arguments aren't complete junk. A precise check is done in vmsvgaR3RectCopy(). */
|
---|
7293 | ASSERT_GUEST_RETURN_VOID(pCmd->srcX < pThis->svga.u32MaxWidth);
|
---|
7294 | ASSERT_GUEST_RETURN_VOID(pCmd->destX < pThis->svga.u32MaxWidth);
|
---|
7295 | ASSERT_GUEST_RETURN_VOID(pCmd->width < pThis->svga.u32MaxWidth);
|
---|
7296 | ASSERT_GUEST_RETURN_VOID(pCmd->srcY < pThis->svga.u32MaxHeight);
|
---|
7297 | ASSERT_GUEST_RETURN_VOID(pCmd->destY < pThis->svga.u32MaxHeight);
|
---|
7298 | ASSERT_GUEST_RETURN_VOID(pCmd->height < pThis->svga.u32MaxHeight);
|
---|
7299 |
|
---|
7300 | vmsvgaR3RectCopy(pThisCC, pScreen, pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY,
|
---|
7301 | pCmd->width, pCmd->height, pThis->vram_size);
|
---|
7302 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height);
|
---|
7303 | }
|
---|
7304 |
|
---|
7305 |
|
---|
7306 | /* SVGA_CMD_DISPLAY_CURSOR */
|
---|
7307 | void vmsvgaR3CmdDisplayCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDisplayCursor const *pCmd)
|
---|
7308 | {
|
---|
7309 | RT_NOREF(pThis, pCmd);
|
---|
7310 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7311 |
|
---|
7312 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDisplayCursor);
|
---|
7313 | Log(("SVGA_CMD_DISPLAY_CURSOR id=%d state=%d\n", pCmd->id, pCmd->state));
|
---|
7314 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_DISPLAY_CURSOR command ignored.\n"));
|
---|
7315 | }
|
---|
7316 |
|
---|
7317 |
|
---|
7318 | /* SVGA_CMD_MOVE_CURSOR */
|
---|
7319 | void vmsvgaR3CmdMoveCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdMoveCursor const *pCmd)
|
---|
7320 | {
|
---|
7321 | RT_NOREF(pThis, pCmd);
|
---|
7322 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7323 |
|
---|
7324 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdMoveCursor);
|
---|
7325 | Log(("SVGA_CMD_MOVE_CURSOR to %d,%d\n", pCmd->pos.x, pCmd->pos.y));
|
---|
7326 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_MOVE_CURSOR command ignored.\n"));
|
---|
7327 | }
|
---|
7328 |
|
---|
7329 |
|
---|
7330 | /* SVGA_CMD_DEFINE_CURSOR */
|
---|
7331 | void vmsvgaR3CmdDefineCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineCursor const *pCmd)
|
---|
7332 | {
|
---|
7333 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7334 |
|
---|
7335 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineCursor);
|
---|
7336 | Log(("SVGA_CMD_DEFINE_CURSOR id=%d size (%dx%d) hotspot (%d,%d) andMaskDepth=%d xorMaskDepth=%d\n",
|
---|
7337 | pCmd->id, pCmd->width, pCmd->height, pCmd->hotspotX, pCmd->hotspotY, pCmd->andMaskDepth, pCmd->xorMaskDepth));
|
---|
7338 |
|
---|
7339 | ASSERT_GUEST_RETURN_VOID(pCmd->height < 2048 && pCmd->width < 2048);
|
---|
7340 | ASSERT_GUEST_RETURN_VOID(pCmd->andMaskDepth <= 32);
|
---|
7341 | ASSERT_GUEST_RETURN_VOID(pCmd->xorMaskDepth <= 32);
|
---|
7342 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7343 |
|
---|
7344 | uint32_t const cbSrcAndLine = RT_ALIGN_32(pCmd->width * (pCmd->andMaskDepth + (pCmd->andMaskDepth == 15)), 32) / 8;
|
---|
7345 | uint32_t const cbSrcAndMask = cbSrcAndLine * pCmd->height;
|
---|
7346 | uint32_t const cbSrcXorLine = RT_ALIGN_32(pCmd->width * (pCmd->xorMaskDepth + (pCmd->xorMaskDepth == 15)), 32) / 8;
|
---|
7347 |
|
---|
7348 | uint8_t const *pbSrcAndMask = (uint8_t const *)(pCmd + 1);
|
---|
7349 | uint8_t const *pbSrcXorMask = (uint8_t const *)(pCmd + 1) + cbSrcAndMask;
|
---|
7350 |
|
---|
7351 | uint32_t const cx = pCmd->width;
|
---|
7352 | uint32_t const cy = pCmd->height;
|
---|
7353 |
|
---|
7354 | /*
|
---|
7355 | * Convert the input to 1-bit AND mask and a 32-bit BRGA XOR mask.
|
---|
7356 | * The AND data uses 8-bit aligned scanlines.
|
---|
7357 | * The XOR data must be starting on a 32-bit boundrary.
|
---|
7358 | */
|
---|
7359 | uint32_t cbDstAndLine = RT_ALIGN_32(cx, 8) / 8;
|
---|
7360 | uint32_t cbDstAndMask = cbDstAndLine * cy;
|
---|
7361 | uint32_t cbDstXorMask = cx * sizeof(uint32_t) * cy;
|
---|
7362 | uint32_t cbCopy = RT_ALIGN_32(cbDstAndMask, 4) + cbDstXorMask;
|
---|
7363 |
|
---|
7364 | uint8_t *pbCopy = (uint8_t *)RTMemAlloc(cbCopy);
|
---|
7365 | AssertReturnVoid(pbCopy);
|
---|
7366 |
|
---|
7367 | /* Convert the AND mask. */
|
---|
7368 | uint8_t *pbDst = pbCopy;
|
---|
7369 | uint8_t const *pbSrc = pbSrcAndMask;
|
---|
7370 | switch (pCmd->andMaskDepth)
|
---|
7371 | {
|
---|
7372 | case 1:
|
---|
7373 | if (cbSrcAndLine == cbDstAndLine)
|
---|
7374 | memcpy(pbDst, pbSrc, cbSrcAndLine * cy);
|
---|
7375 | else
|
---|
7376 | {
|
---|
7377 | Assert(cbSrcAndLine > cbDstAndLine); /* lines are dword alined in source, but only byte in destination. */
|
---|
7378 | for (uint32_t y = 0; y < cy; y++)
|
---|
7379 | {
|
---|
7380 | memcpy(pbDst, pbSrc, cbDstAndLine);
|
---|
7381 | pbDst += cbDstAndLine;
|
---|
7382 | pbSrc += cbSrcAndLine;
|
---|
7383 | }
|
---|
7384 | }
|
---|
7385 | break;
|
---|
7386 | /* Should take the XOR mask into account for the multi-bit AND mask. */
|
---|
7387 | case 8:
|
---|
7388 | for (uint32_t y = 0; y < cy; y++)
|
---|
7389 | {
|
---|
7390 | for (uint32_t x = 0; x < cx; )
|
---|
7391 | {
|
---|
7392 | uint8_t bDst = 0;
|
---|
7393 | uint8_t fBit = 0x80;
|
---|
7394 | do
|
---|
7395 | {
|
---|
7396 | uintptr_t const idxPal = pbSrc[x] * 3;
|
---|
7397 | if ((( pThis->last_palette[idxPal]
|
---|
7398 | | (pThis->last_palette[idxPal] >> 8)
|
---|
7399 | | (pThis->last_palette[idxPal] >> 16)) & 0xff) > 0xfc)
|
---|
7400 | bDst |= fBit;
|
---|
7401 | fBit >>= 1;
|
---|
7402 | x++;
|
---|
7403 | } while (x < cx && (x & 7));
|
---|
7404 | pbDst[(x - 1) / 8] = bDst;
|
---|
7405 | }
|
---|
7406 | pbDst += cbDstAndLine;
|
---|
7407 | pbSrc += cbSrcAndLine;
|
---|
7408 | }
|
---|
7409 | break;
|
---|
7410 | case 15:
|
---|
7411 | for (uint32_t y = 0; y < cy; y++)
|
---|
7412 | {
|
---|
7413 | for (uint32_t x = 0; x < cx; )
|
---|
7414 | {
|
---|
7415 | uint8_t bDst = 0;
|
---|
7416 | uint8_t fBit = 0x80;
|
---|
7417 | do
|
---|
7418 | {
|
---|
7419 | if ((pbSrc[x * 2] | (pbSrc[x * 2 + 1] & 0x7f)) >= 0xfc)
|
---|
7420 | bDst |= fBit;
|
---|
7421 | fBit >>= 1;
|
---|
7422 | x++;
|
---|
7423 | } while (x < cx && (x & 7));
|
---|
7424 | pbDst[(x - 1) / 8] = bDst;
|
---|
7425 | }
|
---|
7426 | pbDst += cbDstAndLine;
|
---|
7427 | pbSrc += cbSrcAndLine;
|
---|
7428 | }
|
---|
7429 | break;
|
---|
7430 | case 16:
|
---|
7431 | for (uint32_t y = 0; y < cy; y++)
|
---|
7432 | {
|
---|
7433 | for (uint32_t x = 0; x < cx; )
|
---|
7434 | {
|
---|
7435 | uint8_t bDst = 0;
|
---|
7436 | uint8_t fBit = 0x80;
|
---|
7437 | do
|
---|
7438 | {
|
---|
7439 | if ((pbSrc[x * 2] | pbSrc[x * 2 + 1]) >= 0xfc)
|
---|
7440 | bDst |= fBit;
|
---|
7441 | fBit >>= 1;
|
---|
7442 | x++;
|
---|
7443 | } while (x < cx && (x & 7));
|
---|
7444 | pbDst[(x - 1) / 8] = bDst;
|
---|
7445 | }
|
---|
7446 | pbDst += cbDstAndLine;
|
---|
7447 | pbSrc += cbSrcAndLine;
|
---|
7448 | }
|
---|
7449 | break;
|
---|
7450 | case 24:
|
---|
7451 | for (uint32_t y = 0; y < cy; y++)
|
---|
7452 | {
|
---|
7453 | for (uint32_t x = 0; x < cx; )
|
---|
7454 | {
|
---|
7455 | uint8_t bDst = 0;
|
---|
7456 | uint8_t fBit = 0x80;
|
---|
7457 | do
|
---|
7458 | {
|
---|
7459 | if ((pbSrc[x * 3] | pbSrc[x * 3 + 1] | pbSrc[x * 3 + 2]) >= 0xfc)
|
---|
7460 | bDst |= fBit;
|
---|
7461 | fBit >>= 1;
|
---|
7462 | x++;
|
---|
7463 | } while (x < cx && (x & 7));
|
---|
7464 | pbDst[(x - 1) / 8] = bDst;
|
---|
7465 | }
|
---|
7466 | pbDst += cbDstAndLine;
|
---|
7467 | pbSrc += cbSrcAndLine;
|
---|
7468 | }
|
---|
7469 | break;
|
---|
7470 | case 32:
|
---|
7471 | for (uint32_t y = 0; y < cy; y++)
|
---|
7472 | {
|
---|
7473 | for (uint32_t x = 0; x < cx; )
|
---|
7474 | {
|
---|
7475 | uint8_t bDst = 0;
|
---|
7476 | uint8_t fBit = 0x80;
|
---|
7477 | do
|
---|
7478 | {
|
---|
7479 | if ((pbSrc[x * 4] | pbSrc[x * 4 + 1] | pbSrc[x * 4 + 2] | pbSrc[x * 4 + 3]) >= 0xfc)
|
---|
7480 | bDst |= fBit;
|
---|
7481 | fBit >>= 1;
|
---|
7482 | x++;
|
---|
7483 | } while (x < cx && (x & 7));
|
---|
7484 | pbDst[(x - 1) / 8] = bDst;
|
---|
7485 | }
|
---|
7486 | pbDst += cbDstAndLine;
|
---|
7487 | pbSrc += cbSrcAndLine;
|
---|
7488 | }
|
---|
7489 | break;
|
---|
7490 | default:
|
---|
7491 | RTMemFreeZ(pbCopy, cbCopy);
|
---|
7492 | AssertFailedReturnVoid();
|
---|
7493 | }
|
---|
7494 |
|
---|
7495 | /* Convert the XOR mask. */
|
---|
7496 | uint32_t *pu32Dst = (uint32_t *)(pbCopy + RT_ALIGN_32(cbDstAndMask, 4));
|
---|
7497 | pbSrc = pbSrcXorMask;
|
---|
7498 | switch (pCmd->xorMaskDepth)
|
---|
7499 | {
|
---|
7500 | case 1:
|
---|
7501 | for (uint32_t y = 0; y < cy; y++)
|
---|
7502 | {
|
---|
7503 | for (uint32_t x = 0; x < cx; )
|
---|
7504 | {
|
---|
7505 | /* most significant bit is the left most one. */
|
---|
7506 | uint8_t bSrc = pbSrc[x / 8];
|
---|
7507 | do
|
---|
7508 | {
|
---|
7509 | *pu32Dst++ = bSrc & 0x80 ? UINT32_C(0x00ffffff) : 0;
|
---|
7510 | bSrc <<= 1;
|
---|
7511 | x++;
|
---|
7512 | } while ((x & 7) && x < cx);
|
---|
7513 | }
|
---|
7514 | pbSrc += cbSrcXorLine;
|
---|
7515 | }
|
---|
7516 | break;
|
---|
7517 | case 8:
|
---|
7518 | for (uint32_t y = 0; y < cy; y++)
|
---|
7519 | {
|
---|
7520 | for (uint32_t x = 0; x < cx; x++)
|
---|
7521 | {
|
---|
7522 | uint32_t u = pThis->last_palette[pbSrc[x]];
|
---|
7523 | *pu32Dst++ = u;//RT_MAKE_U32_FROM_U8(RT_BYTE1(u), RT_BYTE2(u), RT_BYTE3(u), 0);
|
---|
7524 | }
|
---|
7525 | pbSrc += cbSrcXorLine;
|
---|
7526 | }
|
---|
7527 | break;
|
---|
7528 | case 15: /* Src: RGB-5-5-5 */
|
---|
7529 | for (uint32_t y = 0; y < cy; y++)
|
---|
7530 | {
|
---|
7531 | for (uint32_t x = 0; x < cx; x++)
|
---|
7532 | {
|
---|
7533 | uint32_t const uValue = RT_MAKE_U16(pbSrc[x * 2], pbSrc[x * 2 + 1]);
|
---|
7534 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(( uValue & 0x1f) << 3,
|
---|
7535 | ((uValue >> 5) & 0x1f) << 3,
|
---|
7536 | ((uValue >> 10) & 0x1f) << 3, 0);
|
---|
7537 | }
|
---|
7538 | pbSrc += cbSrcXorLine;
|
---|
7539 | }
|
---|
7540 | break;
|
---|
7541 | case 16: /* Src: RGB-5-6-5 */
|
---|
7542 | for (uint32_t y = 0; y < cy; y++)
|
---|
7543 | {
|
---|
7544 | for (uint32_t x = 0; x < cx; x++)
|
---|
7545 | {
|
---|
7546 | uint32_t const uValue = RT_MAKE_U16(pbSrc[x * 2], pbSrc[x * 2 + 1]);
|
---|
7547 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(( uValue & 0x1f) << 3,
|
---|
7548 | ((uValue >> 5) & 0x3f) << 2,
|
---|
7549 | ((uValue >> 11) & 0x1f) << 3, 0);
|
---|
7550 | }
|
---|
7551 | pbSrc += cbSrcXorLine;
|
---|
7552 | }
|
---|
7553 | break;
|
---|
7554 | case 24:
|
---|
7555 | for (uint32_t y = 0; y < cy; y++)
|
---|
7556 | {
|
---|
7557 | for (uint32_t x = 0; x < cx; x++)
|
---|
7558 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(pbSrc[x*3], pbSrc[x*3 + 1], pbSrc[x*3 + 2], 0);
|
---|
7559 | pbSrc += cbSrcXorLine;
|
---|
7560 | }
|
---|
7561 | break;
|
---|
7562 | case 32:
|
---|
7563 | for (uint32_t y = 0; y < cy; y++)
|
---|
7564 | {
|
---|
7565 | for (uint32_t x = 0; x < cx; x++)
|
---|
7566 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(pbSrc[x*4], pbSrc[x*4 + 1], pbSrc[x*4 + 2], 0);
|
---|
7567 | pbSrc += cbSrcXorLine;
|
---|
7568 | }
|
---|
7569 | break;
|
---|
7570 | default:
|
---|
7571 | RTMemFreeZ(pbCopy, cbCopy);
|
---|
7572 | AssertFailedReturnVoid();
|
---|
7573 | }
|
---|
7574 |
|
---|
7575 | /*
|
---|
7576 | * Pass it to the frontend/whatever.
|
---|
7577 | */
|
---|
7578 | vmsvgaR3InstallNewCursor(pThisCC, pSvgaR3State, false /*fAlpha*/, pCmd->hotspotX, pCmd->hotspotY,
|
---|
7579 | cx, cy, pbCopy, cbCopy);
|
---|
7580 | }
|
---|
7581 |
|
---|
7582 |
|
---|
7583 | /* SVGA_CMD_DEFINE_ALPHA_CURSOR */
|
---|
7584 | void vmsvgaR3CmdDefineAlphaCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineAlphaCursor const *pCmd)
|
---|
7585 | {
|
---|
7586 | RT_NOREF(pThis);
|
---|
7587 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7588 |
|
---|
7589 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineAlphaCursor);
|
---|
7590 | 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));
|
---|
7591 |
|
---|
7592 | /* Check against a reasonable upper limit to prevent integer overflows in the sanity checks below. */
|
---|
7593 | ASSERT_GUEST_RETURN_VOID(pCmd->height < 2048 && pCmd->width < 2048);
|
---|
7594 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7595 |
|
---|
7596 | /* The mouse pointer interface always expects an AND mask followed by the color data (XOR mask). */
|
---|
7597 | uint32_t cbAndMask = (pCmd->width + 7) / 8 * pCmd->height; /* size of the AND mask */
|
---|
7598 | cbAndMask = ((cbAndMask + 3) & ~3); /* + gap for alignment */
|
---|
7599 | uint32_t cbXorMask = pCmd->width * sizeof(uint32_t) * pCmd->height; /* + size of the XOR mask (32-bit BRGA format) */
|
---|
7600 | uint32_t cbCursorShape = cbAndMask + cbXorMask;
|
---|
7601 |
|
---|
7602 | uint8_t *pCursorCopy = (uint8_t *)RTMemAlloc(cbCursorShape);
|
---|
7603 | AssertPtrReturnVoid(pCursorCopy);
|
---|
7604 |
|
---|
7605 | /* Transparency is defined by the alpha bytes, so make the whole bitmap visible. */
|
---|
7606 | memset(pCursorCopy, 0xff, cbAndMask);
|
---|
7607 | /* Colour data */
|
---|
7608 | memcpy(pCursorCopy + cbAndMask, pCmd + 1, cbXorMask);
|
---|
7609 |
|
---|
7610 | vmsvgaR3InstallNewCursor(pThisCC, pSvgaR3State, true /*fAlpha*/, pCmd->hotspotX, pCmd->hotspotY,
|
---|
7611 | pCmd->width, pCmd->height, pCursorCopy, cbCursorShape);
|
---|
7612 | }
|
---|
7613 |
|
---|
7614 |
|
---|
7615 | /* SVGA_CMD_ESCAPE */
|
---|
7616 | void vmsvgaR3CmdEscape(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdEscape const *pCmd)
|
---|
7617 | {
|
---|
7618 | RT_NOREF(pThis);
|
---|
7619 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7620 |
|
---|
7621 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdEscape);
|
---|
7622 |
|
---|
7623 | if (pCmd->nsid == SVGA_ESCAPE_NSID_VMWARE)
|
---|
7624 | {
|
---|
7625 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(uint32_t));
|
---|
7626 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7627 |
|
---|
7628 | uint32_t const cmd = *(uint32_t *)(pCmd + 1);
|
---|
7629 | Log(("SVGA_CMD_ESCAPE (%#x %#x) VMWARE cmd=%#x\n", pCmd->nsid, pCmd->size, cmd));
|
---|
7630 |
|
---|
7631 | switch (cmd)
|
---|
7632 | {
|
---|
7633 | case SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS:
|
---|
7634 | {
|
---|
7635 | SVGAEscapeVideoSetRegs *pVideoCmd = (SVGAEscapeVideoSetRegs *)(pCmd + 1);
|
---|
7636 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(pVideoCmd->header));
|
---|
7637 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7638 |
|
---|
7639 | uint32_t const cRegs = (pCmd->size - sizeof(pVideoCmd->header)) / sizeof(pVideoCmd->items[0]);
|
---|
7640 |
|
---|
7641 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS: stream %#x\n", pVideoCmd->header.streamId));
|
---|
7642 | for (uint32_t iReg = 0; iReg < cRegs; iReg++)
|
---|
7643 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS: reg %#x val %#x\n", pVideoCmd->items[iReg].registerId, pVideoCmd->items[iReg].value));
|
---|
7644 | RT_NOREF_PV(pVideoCmd);
|
---|
7645 | break;
|
---|
7646 | }
|
---|
7647 |
|
---|
7648 | case SVGA_ESCAPE_VMWARE_VIDEO_FLUSH:
|
---|
7649 | {
|
---|
7650 | SVGAEscapeVideoFlush *pVideoCmd = (SVGAEscapeVideoFlush *)(pCmd + 1);
|
---|
7651 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(*pVideoCmd));
|
---|
7652 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_FLUSH: stream %#x\n", pVideoCmd->streamId));
|
---|
7653 | RT_NOREF_PV(pVideoCmd);
|
---|
7654 | break;
|
---|
7655 | }
|
---|
7656 |
|
---|
7657 | default:
|
---|
7658 | Log(("SVGA_CMD_ESCAPE: Unknown vmware escape: %#x\n", cmd));
|
---|
7659 | break;
|
---|
7660 | }
|
---|
7661 | }
|
---|
7662 | else
|
---|
7663 | Log(("SVGA_CMD_ESCAPE %#x %#x\n", pCmd->nsid, pCmd->size));
|
---|
7664 | }
|
---|
7665 |
|
---|
7666 |
|
---|
7667 | /* SVGA_CMD_DEFINE_SCREEN */
|
---|
7668 | void vmsvgaR3CmdDefineScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineScreen const *pCmd)
|
---|
7669 | {
|
---|
7670 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7671 |
|
---|
7672 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineScreen);
|
---|
7673 | Log(("SVGA_CMD_DEFINE_SCREEN id=%x flags=%x size=(%d,%d) root=(%d,%d) %d:0x%x 0x%x\n",
|
---|
7674 | pCmd->screen.id, pCmd->screen.flags, pCmd->screen.size.width, pCmd->screen.size.height, pCmd->screen.root.x, pCmd->screen.root.y,
|
---|
7675 | pCmd->screen.backingStore.ptr.gmrId, pCmd->screen.backingStore.ptr.offset, pCmd->screen.backingStore.pitch));
|
---|
7676 |
|
---|
7677 | uint32_t const idScreen = pCmd->screen.id;
|
---|
7678 | ASSERT_GUEST_RETURN_VOID(idScreen < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
7679 |
|
---|
7680 | uint32_t const uWidth = pCmd->screen.size.width;
|
---|
7681 | ASSERT_GUEST_RETURN_VOID(uWidth <= pThis->svga.u32MaxWidth);
|
---|
7682 |
|
---|
7683 | uint32_t const uHeight = pCmd->screen.size.height;
|
---|
7684 | ASSERT_GUEST_RETURN_VOID(uHeight <= pThis->svga.u32MaxHeight);
|
---|
7685 |
|
---|
7686 | uint32_t const cbWidth = uWidth * ((32 + 7) / 8); /** @todo 32? */
|
---|
7687 | uint32_t const cbPitch = pCmd->screen.backingStore.pitch ? pCmd->screen.backingStore.pitch : cbWidth;
|
---|
7688 | ASSERT_GUEST_RETURN_VOID(cbWidth <= cbPitch);
|
---|
7689 |
|
---|
7690 | uint32_t const uScreenOffset = pCmd->screen.backingStore.ptr.offset;
|
---|
7691 | ASSERT_GUEST_RETURN_VOID(uScreenOffset < pThis->vram_size);
|
---|
7692 |
|
---|
7693 | uint32_t const cbVram = pThis->vram_size - uScreenOffset;
|
---|
7694 | /* If we have a not zero pitch, then height can't exceed the available VRAM. */
|
---|
7695 | ASSERT_GUEST_RETURN_VOID( (uHeight == 0 && cbPitch == 0)
|
---|
7696 | || (cbPitch > 0 && uHeight <= cbVram / cbPitch));
|
---|
7697 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7698 |
|
---|
7699 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idScreen];
|
---|
7700 | Assert(pScreen->idScreen == idScreen);
|
---|
7701 | pScreen->fDefined = true;
|
---|
7702 | pScreen->fModified = true;
|
---|
7703 | pScreen->fuScreen = pCmd->screen.flags;
|
---|
7704 | if (!RT_BOOL(pCmd->screen.flags & (SVGA_SCREEN_DEACTIVATE | SVGA_SCREEN_BLANKING)))
|
---|
7705 | {
|
---|
7706 | /* Not blanked. */
|
---|
7707 | ASSERT_GUEST_RETURN_VOID(uWidth > 0 && uHeight > 0);
|
---|
7708 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7709 |
|
---|
7710 | pScreen->xOrigin = pCmd->screen.root.x;
|
---|
7711 | pScreen->yOrigin = pCmd->screen.root.y;
|
---|
7712 | pScreen->cWidth = uWidth;
|
---|
7713 | pScreen->cHeight = uHeight;
|
---|
7714 | pScreen->offVRAM = uScreenOffset;
|
---|
7715 | pScreen->cbPitch = cbPitch;
|
---|
7716 | pScreen->cBpp = 32;
|
---|
7717 | }
|
---|
7718 | else
|
---|
7719 | {
|
---|
7720 | /* Screen blanked. Keep old values. */
|
---|
7721 | }
|
---|
7722 |
|
---|
7723 | pThis->svga.fGFBRegisters = false;
|
---|
7724 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
7725 |
|
---|
7726 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
7727 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
7728 | vmsvga3dDefineScreen(pThis, pThisCC, pScreen);
|
---|
7729 | #endif
|
---|
7730 | }
|
---|
7731 |
|
---|
7732 |
|
---|
7733 | /* SVGA_CMD_DESTROY_SCREEN */
|
---|
7734 | void vmsvgaR3CmdDestroyScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDestroyScreen const *pCmd)
|
---|
7735 | {
|
---|
7736 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7737 |
|
---|
7738 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDestroyScreen);
|
---|
7739 | Log(("SVGA_CMD_DESTROY_SCREEN id=%x\n", pCmd->screenId));
|
---|
7740 |
|
---|
7741 | uint32_t const idScreen = pCmd->screenId;
|
---|
7742 | ASSERT_GUEST_RETURN_VOID(idScreen < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
7743 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7744 |
|
---|
7745 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idScreen];
|
---|
7746 | Assert(pScreen->idScreen == idScreen);
|
---|
7747 | vmsvgaR3DestroyScreen(pThis, pThisCC, pScreen);
|
---|
7748 | }
|
---|
7749 |
|
---|
7750 |
|
---|
7751 | /* SVGA_CMD_DEFINE_GMRFB */
|
---|
7752 | void vmsvgaR3CmdDefineGMRFB(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineGMRFB const *pCmd)
|
---|
7753 | {
|
---|
7754 | RT_NOREF(pThis);
|
---|
7755 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7756 |
|
---|
7757 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmrFb);
|
---|
7758 | Log(("SVGA_CMD_DEFINE_GMRFB gmr=0x%x offset=0x%x bytesPerLine=0x%x(%d) bpp=%d color depth=%d\n",
|
---|
7759 | pCmd->ptr.gmrId, pCmd->ptr.offset, pCmd->bytesPerLine, pCmd->bytesPerLine, pCmd->format.bitsPerPixel, pCmd->format.colorDepth));
|
---|
7760 |
|
---|
7761 | pSvgaR3State->GMRFB.ptr = pCmd->ptr;
|
---|
7762 | pSvgaR3State->GMRFB.bytesPerLine = pCmd->bytesPerLine;
|
---|
7763 | pSvgaR3State->GMRFB.format = pCmd->format;
|
---|
7764 | }
|
---|
7765 |
|
---|
7766 |
|
---|
7767 | /* SVGA_CMD_BLIT_GMRFB_TO_SCREEN */
|
---|
7768 | void vmsvgaR3CmdBlitGMRFBToScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdBlitGMRFBToScreen const *pCmd)
|
---|
7769 | {
|
---|
7770 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7771 |
|
---|
7772 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdBlitGmrFbToScreen);
|
---|
7773 | Log(("SVGA_CMD_BLIT_GMRFB_TO_SCREEN src=(%d,%d) dest id=%d (%d,%d)(%d,%d)\n",
|
---|
7774 | pCmd->srcOrigin.x, pCmd->srcOrigin.y, pCmd->destScreenId, pCmd->destRect.left, pCmd->destRect.top, pCmd->destRect.right, pCmd->destRect.bottom));
|
---|
7775 |
|
---|
7776 | ASSERT_GUEST_RETURN_VOID(pCmd->destScreenId < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
7777 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7778 |
|
---|
7779 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, pCmd->destScreenId);
|
---|
7780 | AssertPtrReturnVoid(pScreen);
|
---|
7781 |
|
---|
7782 | Log(("SVGA_CMD_BLIT_GMRFB_TO_SCREEN screen(%d): x=%d y=%d w=%d h=%d offVRAM=0x%x cbPitch=0x%x(%d)\n",
|
---|
7783 | pScreen->idScreen,
|
---|
7784 | pScreen->xOrigin, pScreen->yOrigin, pScreen->cWidth, pScreen->cHeight,
|
---|
7785 | pScreen->offVRAM, pScreen->cbPitch, pScreen->cbPitch));
|
---|
7786 |
|
---|
7787 | /** @todo Support GMRFB.format.s.bitsPerPixel != pThis->svga.uBpp ? */
|
---|
7788 | AssertReturnVoid(pSvgaR3State->GMRFB.format.bitsPerPixel == pScreen->cBpp);
|
---|
7789 |
|
---|
7790 | /* Clip destRect to the screen dimensions. */
|
---|
7791 | SVGASignedRect screenRect;
|
---|
7792 | screenRect.left = 0;
|
---|
7793 | screenRect.top = 0;
|
---|
7794 | screenRect.right = pScreen->cWidth;
|
---|
7795 | screenRect.bottom = pScreen->cHeight;
|
---|
7796 | SVGASignedRect clipRect = pCmd->destRect;
|
---|
7797 | vmsvgaR3ClipRect(&screenRect, &clipRect);
|
---|
7798 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7799 |
|
---|
7800 | uint32_t const width = clipRect.right - clipRect.left;
|
---|
7801 | uint32_t const height = clipRect.bottom - clipRect.top;
|
---|
7802 |
|
---|
7803 | if ( width == 0
|
---|
7804 | || height == 0)
|
---|
7805 | return; /* Nothing to do. */
|
---|
7806 |
|
---|
7807 | int32_t const srcx = pCmd->srcOrigin.x + (clipRect.left - pCmd->destRect.left);
|
---|
7808 | int32_t const srcy = pCmd->srcOrigin.y + (clipRect.top - pCmd->destRect.top);
|
---|
7809 |
|
---|
7810 | /* Copy the defined by GMRFB image to the screen 0 VRAM area.
|
---|
7811 | * Prepare parameters for vmsvgaR3GmrTransfer.
|
---|
7812 | */
|
---|
7813 | AssertReturnVoid(pScreen->offVRAM < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */
|
---|
7814 |
|
---|
7815 | /* Destination: host buffer which describes the screen 0 VRAM.
|
---|
7816 | * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer.
|
---|
7817 | */
|
---|
7818 | uint8_t * const pbHstBuf = (uint8_t *)pThisCC->pbVRam + pScreen->offVRAM;
|
---|
7819 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch :
|
---|
7820 | width * (RT_ALIGN(pScreen->cBpp, 8) / 8);
|
---|
7821 | uint32_t cbHstBuf = cbScanline * pScreen->cHeight;
|
---|
7822 | if (cbHstBuf > pThis->vram_size - pScreen->offVRAM)
|
---|
7823 | cbHstBuf = pThis->vram_size - pScreen->offVRAM; /* Paranoia. */
|
---|
7824 | uint32_t const offHst = (clipRect.left * RT_ALIGN(pScreen->cBpp, 8)) / 8
|
---|
7825 | + cbScanline * clipRect.top;
|
---|
7826 | int32_t const cbHstPitch = cbScanline;
|
---|
7827 |
|
---|
7828 | /* Source: GMRFB. vmsvgaR3GmrTransfer ensures that no memory outside the GMR is read. */
|
---|
7829 | SVGAGuestPtr const gstPtr = pSvgaR3State->GMRFB.ptr;
|
---|
7830 | uint32_t const offGst = (srcx * RT_ALIGN(pSvgaR3State->GMRFB.format.bitsPerPixel, 8)) / 8
|
---|
7831 | + pSvgaR3State->GMRFB.bytesPerLine * srcy;
|
---|
7832 | int32_t const cbGstPitch = pSvgaR3State->GMRFB.bytesPerLine;
|
---|
7833 |
|
---|
7834 | int rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_WRITE_HOST_VRAM,
|
---|
7835 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
7836 | gstPtr, offGst, cbGstPitch,
|
---|
7837 | (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
|
---|
7838 | AssertRC(rc);
|
---|
7839 | vmsvgaR3UpdateScreen(pThisCC, pScreen, clipRect.left, clipRect.top, width, height);
|
---|
7840 | }
|
---|
7841 |
|
---|
7842 |
|
---|
7843 | /* SVGA_CMD_BLIT_SCREEN_TO_GMRFB */
|
---|
7844 | void vmsvgaR3CmdBlitScreenToGMRFB(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdBlitScreenToGMRFB const *pCmd)
|
---|
7845 | {
|
---|
7846 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7847 |
|
---|
7848 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdBlitScreentoGmrFb);
|
---|
7849 | /* Note! This can fetch 3d render results as well!! */
|
---|
7850 | Log(("SVGA_CMD_BLIT_SCREEN_TO_GMRFB dest=(%d,%d) src id=%d (%d,%d)(%d,%d)\n",
|
---|
7851 | pCmd->destOrigin.x, pCmd->destOrigin.y, pCmd->srcScreenId, pCmd->srcRect.left, pCmd->srcRect.top, pCmd->srcRect.right, pCmd->srcRect.bottom));
|
---|
7852 |
|
---|
7853 | ASSERT_GUEST_RETURN_VOID(pCmd->srcScreenId < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
7854 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7855 |
|
---|
7856 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, pCmd->srcScreenId);
|
---|
7857 | AssertPtrReturnVoid(pScreen);
|
---|
7858 |
|
---|
7859 | /** @todo Support GMRFB.format.bitsPerPixel != pThis->svga.uBpp ? */
|
---|
7860 | AssertReturnVoid(pSvgaR3State->GMRFB.format.bitsPerPixel == pScreen->cBpp);
|
---|
7861 |
|
---|
7862 | /* Clip destRect to the screen dimensions. */
|
---|
7863 | SVGASignedRect screenRect;
|
---|
7864 | screenRect.left = 0;
|
---|
7865 | screenRect.top = 0;
|
---|
7866 | screenRect.right = pScreen->cWidth;
|
---|
7867 | screenRect.bottom = pScreen->cHeight;
|
---|
7868 | SVGASignedRect clipRect = pCmd->srcRect;
|
---|
7869 | vmsvgaR3ClipRect(&screenRect, &clipRect);
|
---|
7870 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7871 |
|
---|
7872 | uint32_t const width = clipRect.right - clipRect.left;
|
---|
7873 | uint32_t const height = clipRect.bottom - clipRect.top;
|
---|
7874 |
|
---|
7875 | if ( width == 0
|
---|
7876 | || height == 0)
|
---|
7877 | return; /* Nothing to do. */
|
---|
7878 |
|
---|
7879 | int32_t const dstx = pCmd->destOrigin.x + (clipRect.left - pCmd->srcRect.left);
|
---|
7880 | int32_t const dsty = pCmd->destOrigin.y + (clipRect.top - pCmd->srcRect.top);
|
---|
7881 |
|
---|
7882 | /* Copy the defined by GMRFB image to the screen 0 VRAM area.
|
---|
7883 | * Prepare parameters for vmsvgaR3GmrTransfer.
|
---|
7884 | */
|
---|
7885 | AssertReturnVoid(pScreen->offVRAM < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */
|
---|
7886 |
|
---|
7887 | /* Source: host buffer which describes the screen 0 VRAM.
|
---|
7888 | * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer.
|
---|
7889 | */
|
---|
7890 | uint8_t * const pbHstBuf = (uint8_t *)pThisCC->pbVRam + pScreen->offVRAM;
|
---|
7891 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch :
|
---|
7892 | width * (RT_ALIGN(pScreen->cBpp, 8) / 8);
|
---|
7893 | uint32_t cbHstBuf = cbScanline * pScreen->cHeight;
|
---|
7894 | if (cbHstBuf > pThis->vram_size - pScreen->offVRAM)
|
---|
7895 | cbHstBuf = pThis->vram_size - pScreen->offVRAM; /* Paranoia. */
|
---|
7896 | uint32_t const offHst = (clipRect.left * RT_ALIGN(pScreen->cBpp, 8)) / 8
|
---|
7897 | + cbScanline * clipRect.top;
|
---|
7898 | int32_t const cbHstPitch = cbScanline;
|
---|
7899 |
|
---|
7900 | /* Destination: GMRFB. vmsvgaR3GmrTransfer ensures that no memory outside the GMR is read. */
|
---|
7901 | SVGAGuestPtr const gstPtr = pSvgaR3State->GMRFB.ptr;
|
---|
7902 | uint32_t const offGst = (dstx * RT_ALIGN(pSvgaR3State->GMRFB.format.bitsPerPixel, 8)) / 8
|
---|
7903 | + pSvgaR3State->GMRFB.bytesPerLine * dsty;
|
---|
7904 | int32_t const cbGstPitch = pSvgaR3State->GMRFB.bytesPerLine;
|
---|
7905 |
|
---|
7906 | int rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_READ_HOST_VRAM,
|
---|
7907 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
7908 | gstPtr, offGst, cbGstPitch,
|
---|
7909 | (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
|
---|
7910 | AssertRC(rc);
|
---|
7911 | }
|
---|
7912 |
|
---|
7913 |
|
---|
7914 | /* SVGA_CMD_ANNOTATION_FILL */
|
---|
7915 | void vmsvgaR3CmdAnnotationFill(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdAnnotationFill const *pCmd)
|
---|
7916 | {
|
---|
7917 | RT_NOREF(pThis);
|
---|
7918 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7919 |
|
---|
7920 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdAnnotationFill);
|
---|
7921 | Log(("SVGA_CMD_ANNOTATION_FILL red=%x green=%x blue=%x\n", pCmd->color.r, pCmd->color.g, pCmd->color.b));
|
---|
7922 |
|
---|
7923 | pSvgaR3State->colorAnnotation = pCmd->color;
|
---|
7924 | }
|
---|
7925 |
|
---|
7926 |
|
---|
7927 | /* SVGA_CMD_ANNOTATION_COPY */
|
---|
7928 | void vmsvgaR3CmdAnnotationCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdAnnotationCopy const *pCmd)
|
---|
7929 | {
|
---|
7930 | RT_NOREF(pThis, pCmd);
|
---|
7931 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7932 |
|
---|
7933 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdAnnotationCopy);
|
---|
7934 | Log(("SVGA_CMD_ANNOTATION_COPY srcOrigin %d,%d, srcScreenId %u\n", pCmd->srcOrigin.x, pCmd->srcOrigin.y, pCmd->srcScreenId));
|
---|
7935 |
|
---|
7936 | AssertFailed();
|
---|
7937 | }
|
---|
7938 |
|
---|
7939 |
|
---|
7940 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
7941 | /* SVGA_CMD_DEFINE_GMR2 */
|
---|
7942 | void vmsvgaR3CmdDefineGMR2(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineGMR2 const *pCmd)
|
---|
7943 | {
|
---|
7944 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7945 |
|
---|
7946 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2);
|
---|
7947 | Log(("SVGA_CMD_DEFINE_GMR2 id=%#x %#x pages\n", pCmd->gmrId, pCmd->numPages));
|
---|
7948 |
|
---|
7949 | /* Validate current GMR id. */
|
---|
7950 | ASSERT_GUEST_RETURN_VOID(pCmd->gmrId < pThis->svga.cGMR);
|
---|
7951 | ASSERT_GUEST_RETURN_VOID(pCmd->numPages <= VMSVGA_MAX_GMR_PAGES);
|
---|
7952 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7953 |
|
---|
7954 | if (!pCmd->numPages)
|
---|
7955 | {
|
---|
7956 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2Free);
|
---|
7957 | vmsvgaR3GmrFree(pThisCC, pCmd->gmrId);
|
---|
7958 | }
|
---|
7959 | else
|
---|
7960 | {
|
---|
7961 | PGMR pGMR = &pSvgaR3State->paGMR[pCmd->gmrId];
|
---|
7962 | if (pGMR->cMaxPages)
|
---|
7963 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2Modify);
|
---|
7964 |
|
---|
7965 | /* Not sure if we should always free the descriptor, but for simplicity
|
---|
7966 | we do so if the new size is smaller than the current. */
|
---|
7967 | /** @todo always free the descriptor in SVGA_CMD_DEFINE_GMR2? */
|
---|
7968 | if (pGMR->cbTotal / X86_PAGE_SIZE > pCmd->numPages)
|
---|
7969 | vmsvgaR3GmrFree(pThisCC, pCmd->gmrId);
|
---|
7970 |
|
---|
7971 | pGMR->cMaxPages = pCmd->numPages;
|
---|
7972 | /* The rest is done by the REMAP_GMR2 command. */
|
---|
7973 | }
|
---|
7974 | }
|
---|
7975 |
|
---|
7976 |
|
---|
7977 | /* SVGA_CMD_REMAP_GMR2 */
|
---|
7978 | void vmsvgaR3CmdRemapGMR2(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRemapGMR2 const *pCmd)
|
---|
7979 | {
|
---|
7980 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7981 |
|
---|
7982 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRemapGmr2);
|
---|
7983 | Log(("SVGA_CMD_REMAP_GMR2 id=%#x flags=%#x offset=%#x npages=%#x\n", pCmd->gmrId, pCmd->flags, pCmd->offsetPages, pCmd->numPages));
|
---|
7984 |
|
---|
7985 | /* Validate current GMR id and size. */
|
---|
7986 | ASSERT_GUEST_RETURN_VOID(pCmd->gmrId < pThis->svga.cGMR);
|
---|
7987 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7988 | PGMR pGMR = &pSvgaR3State->paGMR[pCmd->gmrId];
|
---|
7989 | ASSERT_GUEST_RETURN_VOID( (uint64_t)pCmd->offsetPages + pCmd->numPages
|
---|
7990 | <= RT_MIN(pGMR->cMaxPages, RT_MIN(VMSVGA_MAX_GMR_PAGES, UINT32_MAX / X86_PAGE_SIZE)));
|
---|
7991 | ASSERT_GUEST_RETURN_VOID(!pCmd->offsetPages || pGMR->paDesc); /** @todo */
|
---|
7992 |
|
---|
7993 | if (pCmd->numPages == 0)
|
---|
7994 | return;
|
---|
7995 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7996 |
|
---|
7997 | /* Calc new total page count so we can use it instead of cMaxPages for allocations below. */
|
---|
7998 | uint32_t const cNewTotalPages = RT_MAX(pGMR->cbTotal >> X86_PAGE_SHIFT, pCmd->offsetPages + pCmd->numPages);
|
---|
7999 |
|
---|
8000 | /*
|
---|
8001 | * We flatten the existing descriptors into a page array, overwrite the
|
---|
8002 | * pages specified in this command and then recompress the descriptor.
|
---|
8003 | */
|
---|
8004 | /** @todo Optimize the GMR remap algorithm! */
|
---|
8005 |
|
---|
8006 | /* Save the old page descriptors as an array of page frame numbers (address >> X86_PAGE_SHIFT) */
|
---|
8007 | uint64_t *paNewPage64 = NULL;
|
---|
8008 | if (pGMR->paDesc)
|
---|
8009 | {
|
---|
8010 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRemapGmr2Modify);
|
---|
8011 |
|
---|
8012 | paNewPage64 = (uint64_t *)RTMemAllocZ(cNewTotalPages * sizeof(uint64_t));
|
---|
8013 | AssertPtrReturnVoid(paNewPage64);
|
---|
8014 |
|
---|
8015 | uint32_t idxPage = 0;
|
---|
8016 | for (uint32_t i = 0; i < pGMR->numDescriptors; i++)
|
---|
8017 | for (uint32_t j = 0; j < pGMR->paDesc[i].numPages; j++)
|
---|
8018 | paNewPage64[idxPage++] = (pGMR->paDesc[i].GCPhys + j * X86_PAGE_SIZE) >> X86_PAGE_SHIFT;
|
---|
8019 | AssertReturnVoidStmt(idxPage == pGMR->cbTotal >> X86_PAGE_SHIFT, RTMemFree(paNewPage64));
|
---|
8020 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
8021 | }
|
---|
8022 |
|
---|
8023 | /* Free the old GMR if present. */
|
---|
8024 | if (pGMR->paDesc)
|
---|
8025 | RTMemFree(pGMR->paDesc);
|
---|
8026 |
|
---|
8027 | /* Allocate the maximum amount possible (everything non-continuous) */
|
---|
8028 | PVMSVGAGMRDESCRIPTOR paDescs;
|
---|
8029 | pGMR->paDesc = paDescs = (PVMSVGAGMRDESCRIPTOR)RTMemAllocZ(cNewTotalPages * sizeof(VMSVGAGMRDESCRIPTOR));
|
---|
8030 | AssertReturnVoidStmt(paDescs, RTMemFree(paNewPage64));
|
---|
8031 |
|
---|
8032 | if (pCmd->flags & SVGA_REMAP_GMR2_VIA_GMR)
|
---|
8033 | {
|
---|
8034 | /** @todo */
|
---|
8035 | AssertFailed();
|
---|
8036 | pGMR->numDescriptors = 0;
|
---|
8037 | }
|
---|
8038 | else
|
---|
8039 | {
|
---|
8040 | uint32_t *paPages32 = (uint32_t *)(pCmd + 1);
|
---|
8041 | uint64_t *paPages64 = (uint64_t *)(pCmd + 1);
|
---|
8042 | bool fGCPhys64 = RT_BOOL(pCmd->flags & SVGA_REMAP_GMR2_PPN64);
|
---|
8043 |
|
---|
8044 | uint32_t cPages;
|
---|
8045 | if (paNewPage64)
|
---|
8046 | {
|
---|
8047 | /* Overwrite the old page array with the new page values. */
|
---|
8048 | if (fGCPhys64)
|
---|
8049 | for (uint32_t i = pCmd->offsetPages; i < pCmd->offsetPages + pCmd->numPages; i++)
|
---|
8050 | paNewPage64[i] = paPages64[i - pCmd->offsetPages];
|
---|
8051 | else
|
---|
8052 | for (uint32_t i = pCmd->offsetPages; i < pCmd->offsetPages + pCmd->numPages; i++)
|
---|
8053 | paNewPage64[i] = paPages32[i - pCmd->offsetPages];
|
---|
8054 |
|
---|
8055 | /* Use the updated page array instead of the command data. */
|
---|
8056 | fGCPhys64 = true;
|
---|
8057 | paPages64 = paNewPage64;
|
---|
8058 | cPages = cNewTotalPages;
|
---|
8059 | }
|
---|
8060 | else
|
---|
8061 | cPages = pCmd->numPages;
|
---|
8062 |
|
---|
8063 | /* The first page. */
|
---|
8064 | /** @todo The 0x00000FFFFFFFFFFF mask limits to 44 bits and should not be
|
---|
8065 | * applied to paNewPage64. */
|
---|
8066 | RTGCPHYS GCPhys;
|
---|
8067 | if (fGCPhys64)
|
---|
8068 | GCPhys = (paPages64[0] << X86_PAGE_SHIFT) & UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
8069 | else
|
---|
8070 | GCPhys = (RTGCPHYS)paPages32[0] << GUEST_PAGE_SHIFT;
|
---|
8071 | paDescs[0].GCPhys = GCPhys;
|
---|
8072 | paDescs[0].numPages = 1;
|
---|
8073 |
|
---|
8074 | /* Subsequent pages. */
|
---|
8075 | uint32_t iDescriptor = 0;
|
---|
8076 | for (uint32_t i = 1; i < cPages; i++)
|
---|
8077 | {
|
---|
8078 | if (pCmd->flags & SVGA_REMAP_GMR2_PPN64)
|
---|
8079 | GCPhys = (paPages64[i] << X86_PAGE_SHIFT) & UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
8080 | else
|
---|
8081 | GCPhys = (RTGCPHYS)paPages32[i] << X86_PAGE_SHIFT;
|
---|
8082 |
|
---|
8083 | /* Continuous physical memory? */
|
---|
8084 | if (GCPhys == paDescs[iDescriptor].GCPhys + paDescs[iDescriptor].numPages * X86_PAGE_SIZE)
|
---|
8085 | {
|
---|
8086 | Assert(paDescs[iDescriptor].numPages);
|
---|
8087 | paDescs[iDescriptor].numPages++;
|
---|
8088 | Log5Func(("Page %x GCPhys=%RGp successor\n", i, GCPhys));
|
---|
8089 | }
|
---|
8090 | else
|
---|
8091 | {
|
---|
8092 | iDescriptor++;
|
---|
8093 | paDescs[iDescriptor].GCPhys = GCPhys;
|
---|
8094 | paDescs[iDescriptor].numPages = 1;
|
---|
8095 | Log5Func(("Page %x GCPhys=%RGp\n", i, paDescs[iDescriptor].GCPhys));
|
---|
8096 | }
|
---|
8097 | }
|
---|
8098 |
|
---|
8099 | pGMR->cbTotal = cNewTotalPages << X86_PAGE_SHIFT;
|
---|
8100 | Log5Func(("Nr of descriptors %x; cbTotal=%#x\n", iDescriptor + 1, cNewTotalPages));
|
---|
8101 | pGMR->numDescriptors = iDescriptor + 1;
|
---|
8102 | }
|
---|
8103 |
|
---|
8104 | if (paNewPage64)
|
---|
8105 | RTMemFree(paNewPage64);
|
---|
8106 | }
|
---|
8107 |
|
---|
8108 |
|
---|
8109 | /**
|
---|
8110 | * Free the specified GMR
|
---|
8111 | *
|
---|
8112 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
8113 | * @param idGMR GMR id
|
---|
8114 | */
|
---|
8115 | void vmsvgaR3GmrFree(PVGASTATECC pThisCC, uint32_t idGMR)
|
---|
8116 | {
|
---|
8117 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
8118 |
|
---|
8119 | /* Free the old descriptor if present. */
|
---|
8120 | PGMR pGMR = &pSVGAState->paGMR[idGMR];
|
---|
8121 | if ( pGMR->numDescriptors
|
---|
8122 | || pGMR->paDesc /* needed till we implement SVGA_REMAP_GMR2_VIA_GMR */)
|
---|
8123 | {
|
---|
8124 | # ifdef DEBUG_GMR_ACCESS
|
---|
8125 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThisCC->pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3DeregisterGmr, 2, pDevIns, idGMR);
|
---|
8126 | # endif
|
---|
8127 |
|
---|
8128 | Assert(pGMR->paDesc);
|
---|
8129 | RTMemFree(pGMR->paDesc);
|
---|
8130 | pGMR->paDesc = NULL;
|
---|
8131 | pGMR->numDescriptors = 0;
|
---|
8132 | pGMR->cbTotal = 0;
|
---|
8133 | pGMR->cMaxPages = 0;
|
---|
8134 | }
|
---|
8135 | Assert(!pGMR->cMaxPages);
|
---|
8136 | Assert(!pGMR->cbTotal);
|
---|
8137 | }
|
---|
8138 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
8139 |
|
---|
8140 |
|
---|
8141 | /**
|
---|
8142 | * Copy between a GMR and a host memory buffer.
|
---|
8143 | *
|
---|
8144 | * @returns VBox status code.
|
---|
8145 | * @param pThis The shared VGA/VMSVGA instance data.
|
---|
8146 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
8147 | * @param enmTransferType Transfer type (read/write)
|
---|
8148 | * @param pbHstBuf Host buffer pointer (valid)
|
---|
8149 | * @param cbHstBuf Size of host buffer (valid)
|
---|
8150 | * @param offHst Host buffer offset of the first scanline
|
---|
8151 | * @param cbHstPitch Destination buffer pitch
|
---|
8152 | * @param gstPtr GMR description
|
---|
8153 | * @param offGst Guest buffer offset of the first scanline
|
---|
8154 | * @param cbGstPitch Guest buffer pitch
|
---|
8155 | * @param cbWidth Width in bytes to copy
|
---|
8156 | * @param cHeight Number of scanllines to copy
|
---|
8157 | */
|
---|
8158 | int vmsvgaR3GmrTransfer(PVGASTATE pThis, PVGASTATECC pThisCC, const SVGA3dTransferType enmTransferType,
|
---|
8159 | uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch,
|
---|
8160 | SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch,
|
---|
8161 | uint32_t cbWidth, uint32_t cHeight)
|
---|
8162 | {
|
---|
8163 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
8164 | PPDMDEVINS pDevIns = pThisCC->pDevIns; /* simpler */
|
---|
8165 | int rc;
|
---|
8166 |
|
---|
8167 | LogFunc(("%s host %p size=%d offset %d pitch=%d; guest gmr=%#x:%#x offset=%d pitch=%d cbWidth=%d cHeight=%d\n",
|
---|
8168 | enmTransferType == SVGA3D_READ_HOST_VRAM ? "WRITE" : "READ", /* GMR op: READ host VRAM means WRITE GMR */
|
---|
8169 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
8170 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cbWidth, cHeight));
|
---|
8171 | AssertReturn(cbWidth && cHeight, VERR_INVALID_PARAMETER);
|
---|
8172 |
|
---|
8173 | PGMR pGMR;
|
---|
8174 | uint32_t cbGmr; /* The GMR size in bytes. */
|
---|
8175 | if (gstPtr.gmrId == SVGA_GMR_FRAMEBUFFER)
|
---|
8176 | {
|
---|
8177 | pGMR = NULL;
|
---|
8178 | cbGmr = pThis->vram_size;
|
---|
8179 | }
|
---|
8180 | else
|
---|
8181 | {
|
---|
8182 | AssertReturn(gstPtr.gmrId < pThis->svga.cGMR, VERR_INVALID_PARAMETER);
|
---|
8183 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
8184 | pGMR = &pSVGAState->paGMR[gstPtr.gmrId];
|
---|
8185 | cbGmr = pGMR->cbTotal;
|
---|
8186 | }
|
---|
8187 |
|
---|
8188 | /*
|
---|
8189 | * GMR
|
---|
8190 | */
|
---|
8191 | /* Calculate GMR offset of the data to be copied. */
|
---|
8192 | AssertMsgReturn(gstPtr.offset < cbGmr,
|
---|
8193 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
8194 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
8195 | VERR_INVALID_PARAMETER);
|
---|
8196 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
8197 | AssertMsgReturn(offGst < cbGmr - gstPtr.offset,
|
---|
8198 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
8199 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
8200 | VERR_INVALID_PARAMETER);
|
---|
8201 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
8202 | uint32_t const offGmr = offGst + gstPtr.offset; /* Offset in the GMR, where the first scanline is located. */
|
---|
8203 |
|
---|
8204 | /* Verify that cbWidth is less than scanline and fits into the GMR. */
|
---|
8205 | uint32_t const cbGmrScanline = cbGstPitch > 0 ? cbGstPitch : -cbGstPitch;
|
---|
8206 | AssertMsgReturn(cbGmrScanline != 0,
|
---|
8207 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
8208 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
8209 | VERR_INVALID_PARAMETER);
|
---|
8210 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
8211 | AssertMsgReturn(cbWidth <= cbGmrScanline,
|
---|
8212 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
8213 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
8214 | VERR_INVALID_PARAMETER);
|
---|
8215 | AssertMsgReturn(cbWidth <= cbGmr - offGmr,
|
---|
8216 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
8217 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
8218 | VERR_INVALID_PARAMETER);
|
---|
8219 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
8220 |
|
---|
8221 | /* How many bytes are available for the data in the GMR. */
|
---|
8222 | uint32_t const cbGmrLeft = cbGstPitch > 0 ? cbGmr - offGmr : offGmr + cbWidth;
|
---|
8223 |
|
---|
8224 | /* How many scanlines would fit into the available data. */
|
---|
8225 | uint32_t cGmrScanlines = cbGmrLeft / cbGmrScanline;
|
---|
8226 | uint32_t const cbGmrLastScanline = cbGmrLeft - cGmrScanlines * cbGmrScanline; /* Slack space. */
|
---|
8227 | if (cbWidth <= cbGmrLastScanline)
|
---|
8228 | ++cGmrScanlines;
|
---|
8229 |
|
---|
8230 | if (cHeight > cGmrScanlines)
|
---|
8231 | cHeight = cGmrScanlines;
|
---|
8232 |
|
---|
8233 | AssertMsgReturn(cHeight > 0,
|
---|
8234 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
8235 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
8236 | VERR_INVALID_PARAMETER);
|
---|
8237 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
8238 |
|
---|
8239 | /*
|
---|
8240 | * Host buffer.
|
---|
8241 | */
|
---|
8242 | AssertMsgReturn(offHst < cbHstBuf,
|
---|
8243 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
8244 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
8245 | VERR_INVALID_PARAMETER);
|
---|
8246 |
|
---|
8247 | /* Verify that cbWidth is less than scanline and fits into the buffer. */
|
---|
8248 | uint32_t const cbHstScanline = cbHstPitch > 0 ? cbHstPitch : -cbHstPitch;
|
---|
8249 | AssertMsgReturn(cbHstScanline != 0,
|
---|
8250 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
8251 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
8252 | VERR_INVALID_PARAMETER);
|
---|
8253 | AssertMsgReturn(cbWidth <= cbHstScanline,
|
---|
8254 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
8255 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
8256 | VERR_INVALID_PARAMETER);
|
---|
8257 | AssertMsgReturn(cbWidth <= cbHstBuf - offHst,
|
---|
8258 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
8259 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
8260 | VERR_INVALID_PARAMETER);
|
---|
8261 |
|
---|
8262 | /* How many bytes are available for the data in the buffer. */
|
---|
8263 | uint32_t const cbHstLeft = cbHstPitch > 0 ? cbHstBuf - offHst : offHst + cbWidth;
|
---|
8264 |
|
---|
8265 | /* How many scanlines would fit into the available data. */
|
---|
8266 | uint32_t cHstScanlines = cbHstLeft / cbHstScanline;
|
---|
8267 | uint32_t const cbHstLastScanline = cbHstLeft - cHstScanlines * cbHstScanline; /* Slack space. */
|
---|
8268 | if (cbWidth <= cbHstLastScanline)
|
---|
8269 | ++cHstScanlines;
|
---|
8270 |
|
---|
8271 | if (cHeight > cHstScanlines)
|
---|
8272 | cHeight = cHstScanlines;
|
---|
8273 |
|
---|
8274 | AssertMsgReturn(cHeight > 0,
|
---|
8275 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
8276 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
8277 | VERR_INVALID_PARAMETER);
|
---|
8278 |
|
---|
8279 | uint8_t *pbHst = pbHstBuf + offHst;
|
---|
8280 |
|
---|
8281 | /* Shortcut for the framebuffer. */
|
---|
8282 | if (gstPtr.gmrId == SVGA_GMR_FRAMEBUFFER)
|
---|
8283 | {
|
---|
8284 | uint8_t *pbGst = pThisCC->pbVRam + offGmr;
|
---|
8285 |
|
---|
8286 | uint8_t const *pbSrc;
|
---|
8287 | int32_t cbSrcPitch;
|
---|
8288 | uint8_t *pbDst;
|
---|
8289 | int32_t cbDstPitch;
|
---|
8290 |
|
---|
8291 | if (enmTransferType == SVGA3D_READ_HOST_VRAM)
|
---|
8292 | {
|
---|
8293 | pbSrc = pbHst;
|
---|
8294 | cbSrcPitch = cbHstPitch;
|
---|
8295 | pbDst = pbGst;
|
---|
8296 | cbDstPitch = cbGstPitch;
|
---|
8297 | }
|
---|
8298 | else
|
---|
8299 | {
|
---|
8300 | pbSrc = pbGst;
|
---|
8301 | cbSrcPitch = cbGstPitch;
|
---|
8302 | pbDst = pbHst;
|
---|
8303 | cbDstPitch = cbHstPitch;
|
---|
8304 | }
|
---|
8305 |
|
---|
8306 | if ( cbWidth == (uint32_t)cbGstPitch
|
---|
8307 | && cbGstPitch == cbHstPitch)
|
---|
8308 | {
|
---|
8309 | /* Entire scanlines, positive pitch. */
|
---|
8310 | memcpy(pbDst, pbSrc, cbWidth * cHeight);
|
---|
8311 | }
|
---|
8312 | else
|
---|
8313 | {
|
---|
8314 | for (uint32_t i = 0; i < cHeight; ++i)
|
---|
8315 | {
|
---|
8316 | memcpy(pbDst, pbSrc, cbWidth);
|
---|
8317 |
|
---|
8318 | pbDst += cbDstPitch;
|
---|
8319 | pbSrc += cbSrcPitch;
|
---|
8320 | }
|
---|
8321 | }
|
---|
8322 | return VINF_SUCCESS;
|
---|
8323 | }
|
---|
8324 |
|
---|
8325 | AssertPtrReturn(pGMR, VERR_INVALID_PARAMETER);
|
---|
8326 | AssertReturn(pGMR->numDescriptors > 0, VERR_INVALID_PARAMETER);
|
---|
8327 |
|
---|
8328 | PVMSVGAGMRDESCRIPTOR const paDesc = pGMR->paDesc; /* Local copy of the pointer. */
|
---|
8329 | uint32_t iDesc = 0; /* Index in the descriptor array. */
|
---|
8330 | uint32_t offDesc = 0; /* GMR offset of the current descriptor. */
|
---|
8331 | uint32_t offGmrScanline = offGmr; /* GMR offset of the scanline which is being copied. */
|
---|
8332 | uint8_t *pbHstScanline = pbHst; /* Host address of the scanline which is being copied. */
|
---|
8333 | for (uint32_t i = 0; i < cHeight; ++i)
|
---|
8334 | {
|
---|
8335 | uint32_t cbCurrentWidth = cbWidth;
|
---|
8336 | uint32_t offGmrCurrent = offGmrScanline;
|
---|
8337 | uint8_t *pbCurrentHost = pbHstScanline;
|
---|
8338 |
|
---|
8339 | /* Find the right descriptor */
|
---|
8340 | while (offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE <= offGmrCurrent)
|
---|
8341 | {
|
---|
8342 | offDesc += paDesc[iDesc].numPages * GUEST_PAGE_SIZE;
|
---|
8343 | AssertReturn(offDesc < pGMR->cbTotal, VERR_INTERNAL_ERROR); /* overflow protection */
|
---|
8344 | ++iDesc;
|
---|
8345 | AssertReturn(iDesc < pGMR->numDescriptors, VERR_INTERNAL_ERROR);
|
---|
8346 | }
|
---|
8347 |
|
---|
8348 | while (cbCurrentWidth)
|
---|
8349 | {
|
---|
8350 | uint32_t cbToCopy;
|
---|
8351 |
|
---|
8352 | if (offGmrCurrent + cbCurrentWidth <= offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE)
|
---|
8353 | cbToCopy = cbCurrentWidth;
|
---|
8354 | else
|
---|
8355 | {
|
---|
8356 | cbToCopy = (offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE - offGmrCurrent);
|
---|
8357 | AssertReturn(cbToCopy <= cbCurrentWidth, VERR_INVALID_PARAMETER);
|
---|
8358 | }
|
---|
8359 |
|
---|
8360 | RTGCPHYS const GCPhys = paDesc[iDesc].GCPhys + offGmrCurrent - offDesc;
|
---|
8361 |
|
---|
8362 | Log5Func(("%s phys=%RGp\n", (enmTransferType == SVGA3D_WRITE_HOST_VRAM) ? "READ" : "WRITE", GCPhys));
|
---|
8363 |
|
---|
8364 | /*
|
---|
8365 | * We are deliberately using the non-PCI version of PDMDevHlpPCIPhys[Read|Write] as the
|
---|
8366 | * guest-side VMSVGA driver seems to allocate non-DMA (physical memory) addresses,
|
---|
8367 | * see @bugref{9654#c75}.
|
---|
8368 | */
|
---|
8369 | if (enmTransferType == SVGA3D_WRITE_HOST_VRAM)
|
---|
8370 | rc = PDMDevHlpPhysRead(pDevIns, GCPhys, pbCurrentHost, cbToCopy);
|
---|
8371 | else
|
---|
8372 | rc = PDMDevHlpPhysWrite(pDevIns, GCPhys, pbCurrentHost, cbToCopy);
|
---|
8373 | AssertRCBreak(rc);
|
---|
8374 |
|
---|
8375 | cbCurrentWidth -= cbToCopy;
|
---|
8376 | offGmrCurrent += cbToCopy;
|
---|
8377 | pbCurrentHost += cbToCopy;
|
---|
8378 |
|
---|
8379 | /* Go to the next descriptor if there's anything left. */
|
---|
8380 | if (cbCurrentWidth)
|
---|
8381 | {
|
---|
8382 | offDesc += paDesc[iDesc].numPages * GUEST_PAGE_SIZE;
|
---|
8383 | AssertReturn(offDesc < pGMR->cbTotal, VERR_INTERNAL_ERROR);
|
---|
8384 | ++iDesc;
|
---|
8385 | AssertReturn(iDesc < pGMR->numDescriptors, VERR_INTERNAL_ERROR);
|
---|
8386 | }
|
---|
8387 | }
|
---|
8388 |
|
---|
8389 | offGmrScanline += cbGstPitch;
|
---|
8390 | pbHstScanline += cbHstPitch;
|
---|
8391 | }
|
---|
8392 |
|
---|
8393 | return VINF_SUCCESS;
|
---|
8394 | }
|
---|
8395 |
|
---|
8396 |
|
---|
8397 | /**
|
---|
8398 | * Unsigned coordinates in pBox. Clip to [0; pSizeSrc), [0; pSizeDest).
|
---|
8399 | *
|
---|
8400 | * @param pSizeSrc Source surface dimensions.
|
---|
8401 | * @param pSizeDest Destination surface dimensions.
|
---|
8402 | * @param pBox Coordinates to be clipped.
|
---|
8403 | */
|
---|
8404 | void vmsvgaR3ClipCopyBox(const SVGA3dSize *pSizeSrc, const SVGA3dSize *pSizeDest, SVGA3dCopyBox *pBox)
|
---|
8405 | {
|
---|
8406 | /* Src x, w */
|
---|
8407 | if (pBox->srcx > pSizeSrc->width)
|
---|
8408 | pBox->srcx = pSizeSrc->width;
|
---|
8409 | if (pBox->w > pSizeSrc->width - pBox->srcx)
|
---|
8410 | pBox->w = pSizeSrc->width - pBox->srcx;
|
---|
8411 |
|
---|
8412 | /* Src y, h */
|
---|
8413 | if (pBox->srcy > pSizeSrc->height)
|
---|
8414 | pBox->srcy = pSizeSrc->height;
|
---|
8415 | if (pBox->h > pSizeSrc->height - pBox->srcy)
|
---|
8416 | pBox->h = pSizeSrc->height - pBox->srcy;
|
---|
8417 |
|
---|
8418 | /* Src z, d */
|
---|
8419 | if (pBox->srcz > pSizeSrc->depth)
|
---|
8420 | pBox->srcz = pSizeSrc->depth;
|
---|
8421 | if (pBox->d > pSizeSrc->depth - pBox->srcz)
|
---|
8422 | pBox->d = pSizeSrc->depth - pBox->srcz;
|
---|
8423 |
|
---|
8424 | /* Dest x, w */
|
---|
8425 | if (pBox->x > pSizeDest->width)
|
---|
8426 | pBox->x = pSizeDest->width;
|
---|
8427 | if (pBox->w > pSizeDest->width - pBox->x)
|
---|
8428 | pBox->w = pSizeDest->width - pBox->x;
|
---|
8429 |
|
---|
8430 | /* Dest y, h */
|
---|
8431 | if (pBox->y > pSizeDest->height)
|
---|
8432 | pBox->y = pSizeDest->height;
|
---|
8433 | if (pBox->h > pSizeDest->height - pBox->y)
|
---|
8434 | pBox->h = pSizeDest->height - pBox->y;
|
---|
8435 |
|
---|
8436 | /* Dest z, d */
|
---|
8437 | if (pBox->z > pSizeDest->depth)
|
---|
8438 | pBox->z = pSizeDest->depth;
|
---|
8439 | if (pBox->d > pSizeDest->depth - pBox->z)
|
---|
8440 | pBox->d = pSizeDest->depth - pBox->z;
|
---|
8441 | }
|
---|
8442 |
|
---|
8443 |
|
---|
8444 | /**
|
---|
8445 | * Unsigned coordinates in pBox. Clip to [0; pSize).
|
---|
8446 | *
|
---|
8447 | * @param pSize Source surface dimensions.
|
---|
8448 | * @param pBox Coordinates to be clipped.
|
---|
8449 | */
|
---|
8450 | void vmsvgaR3ClipBox(const SVGA3dSize *pSize, SVGA3dBox *pBox)
|
---|
8451 | {
|
---|
8452 | /* x, w */
|
---|
8453 | if (pBox->x > pSize->width)
|
---|
8454 | pBox->x = pSize->width;
|
---|
8455 | if (pBox->w > pSize->width - pBox->x)
|
---|
8456 | pBox->w = pSize->width - pBox->x;
|
---|
8457 |
|
---|
8458 | /* y, h */
|
---|
8459 | if (pBox->y > pSize->height)
|
---|
8460 | pBox->y = pSize->height;
|
---|
8461 | if (pBox->h > pSize->height - pBox->y)
|
---|
8462 | pBox->h = pSize->height - pBox->y;
|
---|
8463 |
|
---|
8464 | /* z, d */
|
---|
8465 | if (pBox->z > pSize->depth)
|
---|
8466 | pBox->z = pSize->depth;
|
---|
8467 | if (pBox->d > pSize->depth - pBox->z)
|
---|
8468 | pBox->d = pSize->depth - pBox->z;
|
---|
8469 | }
|
---|
8470 |
|
---|
8471 |
|
---|
8472 | /**
|
---|
8473 | * Clip.
|
---|
8474 | *
|
---|
8475 | * @param pBound Bounding rectangle.
|
---|
8476 | * @param pRect Rectangle to be clipped.
|
---|
8477 | */
|
---|
8478 | void vmsvgaR3ClipRect(SVGASignedRect const *pBound, SVGASignedRect *pRect)
|
---|
8479 | {
|
---|
8480 | int32_t left;
|
---|
8481 | int32_t top;
|
---|
8482 | int32_t right;
|
---|
8483 | int32_t bottom;
|
---|
8484 |
|
---|
8485 | /* Right order. */
|
---|
8486 | Assert(pBound->left <= pBound->right && pBound->top <= pBound->bottom);
|
---|
8487 | if (pRect->left < pRect->right)
|
---|
8488 | {
|
---|
8489 | left = pRect->left;
|
---|
8490 | right = pRect->right;
|
---|
8491 | }
|
---|
8492 | else
|
---|
8493 | {
|
---|
8494 | left = pRect->right;
|
---|
8495 | right = pRect->left;
|
---|
8496 | }
|
---|
8497 | if (pRect->top < pRect->bottom)
|
---|
8498 | {
|
---|
8499 | top = pRect->top;
|
---|
8500 | bottom = pRect->bottom;
|
---|
8501 | }
|
---|
8502 | else
|
---|
8503 | {
|
---|
8504 | top = pRect->bottom;
|
---|
8505 | bottom = pRect->top;
|
---|
8506 | }
|
---|
8507 |
|
---|
8508 | if (left < pBound->left)
|
---|
8509 | left = pBound->left;
|
---|
8510 | if (right < pBound->left)
|
---|
8511 | right = pBound->left;
|
---|
8512 |
|
---|
8513 | if (left > pBound->right)
|
---|
8514 | left = pBound->right;
|
---|
8515 | if (right > pBound->right)
|
---|
8516 | right = pBound->right;
|
---|
8517 |
|
---|
8518 | if (top < pBound->top)
|
---|
8519 | top = pBound->top;
|
---|
8520 | if (bottom < pBound->top)
|
---|
8521 | bottom = pBound->top;
|
---|
8522 |
|
---|
8523 | if (top > pBound->bottom)
|
---|
8524 | top = pBound->bottom;
|
---|
8525 | if (bottom > pBound->bottom)
|
---|
8526 | bottom = pBound->bottom;
|
---|
8527 |
|
---|
8528 | pRect->left = left;
|
---|
8529 | pRect->right = right;
|
---|
8530 | pRect->top = top;
|
---|
8531 | pRect->bottom = bottom;
|
---|
8532 | }
|
---|
8533 |
|
---|
8534 |
|
---|
8535 | /**
|
---|
8536 | * Clip.
|
---|
8537 | *
|
---|
8538 | * @param pBound Bounding rectangle.
|
---|
8539 | * @param pRect Rectangle to be clipped.
|
---|
8540 | */
|
---|
8541 | void vmsvgaR3Clip3dRect(SVGA3dRect const *pBound, SVGA3dRect RT_UNTRUSTED_GUEST *pRect)
|
---|
8542 | {
|
---|
8543 | uint32_t const leftBound = pBound->x;
|
---|
8544 | uint32_t const rightBound = pBound->x + pBound->w;
|
---|
8545 | uint32_t const topBound = pBound->y;
|
---|
8546 | uint32_t const bottomBound = pBound->y + pBound->h;
|
---|
8547 |
|
---|
8548 | uint32_t x = pRect->x;
|
---|
8549 | uint32_t y = pRect->y;
|
---|
8550 | uint32_t w = pRect->w;
|
---|
8551 | uint32_t h = pRect->h;
|
---|
8552 |
|
---|
8553 | /* Make sure that right and bottom coordinates can be safely computed. */
|
---|
8554 | if (x > rightBound)
|
---|
8555 | x = rightBound;
|
---|
8556 | if (w > rightBound - x)
|
---|
8557 | w = rightBound - x;
|
---|
8558 | if (y > bottomBound)
|
---|
8559 | y = bottomBound;
|
---|
8560 | if (h > bottomBound - y)
|
---|
8561 | h = bottomBound - y;
|
---|
8562 |
|
---|
8563 | /* Switch from x, y, w, h to left, top, right, bottom. */
|
---|
8564 | uint32_t left = x;
|
---|
8565 | uint32_t right = x + w;
|
---|
8566 | uint32_t top = y;
|
---|
8567 | uint32_t bottom = y + h;
|
---|
8568 |
|
---|
8569 | /* A standard left, right, bottom, top clipping. */
|
---|
8570 | if (left < leftBound)
|
---|
8571 | left = leftBound;
|
---|
8572 | if (right < leftBound)
|
---|
8573 | right = leftBound;
|
---|
8574 |
|
---|
8575 | if (left > rightBound)
|
---|
8576 | left = rightBound;
|
---|
8577 | if (right > rightBound)
|
---|
8578 | right = rightBound;
|
---|
8579 |
|
---|
8580 | if (top < topBound)
|
---|
8581 | top = topBound;
|
---|
8582 | if (bottom < topBound)
|
---|
8583 | bottom = topBound;
|
---|
8584 |
|
---|
8585 | if (top > bottomBound)
|
---|
8586 | top = bottomBound;
|
---|
8587 | if (bottom > bottomBound)
|
---|
8588 | bottom = bottomBound;
|
---|
8589 |
|
---|
8590 | /* Back to x, y, w, h representation. */
|
---|
8591 | pRect->x = left;
|
---|
8592 | pRect->y = top;
|
---|
8593 | pRect->w = right - left;
|
---|
8594 | pRect->h = bottom - top;
|
---|
8595 | }
|
---|
8596 |
|
---|