1 | /* $Id: DevVGA-SVGA-cmd.cpp 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VMware SVGA device - implementation of VMSVGA commands.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2022 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 <VBox/AssertGuest.h>
|
---|
36 | #include <VBox/log.h>
|
---|
37 | #include <VBox/vmm/pdmdev.h>
|
---|
38 | #include <VBoxVideo.h>
|
---|
39 |
|
---|
40 | /* should go BEFORE any other DevVGA include to make all DevVGA.h config defines be visible */
|
---|
41 | #include "DevVGA.h"
|
---|
42 |
|
---|
43 | /* Should be included after DevVGA.h/DevVGA-SVGA.h to pick all defines. */
|
---|
44 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
45 | # include "DevVGA-SVGA3d.h"
|
---|
46 | #endif
|
---|
47 | #include "DevVGA-SVGA-internal.h"
|
---|
48 |
|
---|
49 | #include <iprt/formats/bmp.h>
|
---|
50 | #include <stdio.h>
|
---|
51 |
|
---|
52 | #if defined(LOG_ENABLED) || defined(VBOX_STRICT)
|
---|
53 | # define SVGA_CASE_ID2STR(idx) case idx: return #idx
|
---|
54 |
|
---|
55 | static const char *vmsvgaFifo3dCmdToString(SVGAFifo3dCmdId enmCmdId)
|
---|
56 | {
|
---|
57 | switch (enmCmdId)
|
---|
58 | {
|
---|
59 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LEGACY_BASE);
|
---|
60 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DEFINE);
|
---|
61 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DESTROY);
|
---|
62 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_COPY);
|
---|
63 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_STRETCHBLT);
|
---|
64 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DMA);
|
---|
65 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CONTEXT_DEFINE);
|
---|
66 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CONTEXT_DESTROY);
|
---|
67 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETTRANSFORM);
|
---|
68 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETZRANGE);
|
---|
69 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETRENDERSTATE);
|
---|
70 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETRENDERTARGET);
|
---|
71 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETTEXTURESTATE);
|
---|
72 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETMATERIAL);
|
---|
73 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETLIGHTDATA);
|
---|
74 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETLIGHTENABLED);
|
---|
75 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETVIEWPORT);
|
---|
76 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETCLIPPLANE);
|
---|
77 | SVGA_CASE_ID2STR(SVGA_3D_CMD_CLEAR);
|
---|
78 | SVGA_CASE_ID2STR(SVGA_3D_CMD_PRESENT);
|
---|
79 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SHADER_DEFINE);
|
---|
80 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SHADER_DESTROY);
|
---|
81 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_SHADER);
|
---|
82 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_SHADER_CONST);
|
---|
83 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW_PRIMITIVES);
|
---|
84 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SETSCISSORRECT);
|
---|
85 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BEGIN_QUERY);
|
---|
86 | SVGA_CASE_ID2STR(SVGA_3D_CMD_END_QUERY);
|
---|
87 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WAIT_FOR_QUERY);
|
---|
88 | SVGA_CASE_ID2STR(SVGA_3D_CMD_PRESENT_READBACK);
|
---|
89 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN);
|
---|
90 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_DEFINE_V2);
|
---|
91 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GENERATE_MIPMAPS);
|
---|
92 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD4); /* SVGA_3D_CMD_VIDEO_CREATE_DECODER */
|
---|
93 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD5); /* SVGA_3D_CMD_VIDEO_DESTROY_DECODER */
|
---|
94 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD6); /* SVGA_3D_CMD_VIDEO_CREATE_PROCESSOR */
|
---|
95 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD7); /* SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR */
|
---|
96 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD8); /* SVGA_3D_CMD_VIDEO_DECODE_START_FRAME */
|
---|
97 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD9); /* SVGA_3D_CMD_VIDEO_DECODE_RENDER */
|
---|
98 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD10); /* SVGA_3D_CMD_VIDEO_DECODE_END_FRAME */
|
---|
99 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD11); /* SVGA_3D_CMD_VIDEO_PROCESS_FRAME */
|
---|
100 | SVGA_CASE_ID2STR(SVGA_3D_CMD_ACTIVATE_SURFACE);
|
---|
101 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEACTIVATE_SURFACE);
|
---|
102 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SCREEN_DMA);
|
---|
103 | SVGA_CASE_ID2STR(SVGA_3D_CMD_VB_DX_CLEAR_RENDERTARGET_VIEW_REGION); /* SVGA_3D_CMD_DEAD1 */
|
---|
104 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD2);
|
---|
105 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD12); /* Old SVGA_3D_CMD_LOGICOPS_BITBLT */
|
---|
106 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD13); /* Old SVGA_3D_CMD_LOGICOPS_TRANSBLT */
|
---|
107 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD14); /* Old SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
|
---|
108 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD15); /* Old SVGA_3D_CMD_LOGICOPS_COLORFILL */
|
---|
109 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD16); /* Old SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
|
---|
110 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD17); /* Old SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND */
|
---|
111 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_OTABLE_BASE);
|
---|
112 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_OTABLE);
|
---|
113 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_MOB);
|
---|
114 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_MOB);
|
---|
115 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEAD3);
|
---|
116 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING);
|
---|
117 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE);
|
---|
118 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SURFACE);
|
---|
119 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SURFACE);
|
---|
120 | SVGA_CASE_ID2STR(SVGA_3D_CMD_COND_BIND_GB_SURFACE);
|
---|
121 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_IMAGE);
|
---|
122 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_SURFACE);
|
---|
123 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_IMAGE);
|
---|
124 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_SURFACE);
|
---|
125 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_IMAGE);
|
---|
126 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_SURFACE);
|
---|
127 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_CONTEXT);
|
---|
128 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_CONTEXT);
|
---|
129 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_CONTEXT);
|
---|
130 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_CONTEXT);
|
---|
131 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_CONTEXT);
|
---|
132 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SHADER);
|
---|
133 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SHADER);
|
---|
134 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SHADER);
|
---|
135 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_OTABLE_BASE64);
|
---|
136 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BEGIN_GB_QUERY);
|
---|
137 | SVGA_CASE_ID2STR(SVGA_3D_CMD_END_GB_QUERY);
|
---|
138 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WAIT_FOR_GB_QUERY);
|
---|
139 | SVGA_CASE_ID2STR(SVGA_3D_CMD_NOP);
|
---|
140 | SVGA_CASE_ID2STR(SVGA_3D_CMD_ENABLE_GART);
|
---|
141 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DISABLE_GART);
|
---|
142 | SVGA_CASE_ID2STR(SVGA_3D_CMD_MAP_MOB_INTO_GART);
|
---|
143 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UNMAP_GART_RANGE);
|
---|
144 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SCREENTARGET);
|
---|
145 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DESTROY_GB_SCREENTARGET);
|
---|
146 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SCREENTARGET);
|
---|
147 | SVGA_CASE_ID2STR(SVGA_3D_CMD_UPDATE_GB_SCREENTARGET);
|
---|
148 | SVGA_CASE_ID2STR(SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL);
|
---|
149 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL);
|
---|
150 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE);
|
---|
151 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GB_SCREEN_DMA);
|
---|
152 | SVGA_CASE_ID2STR(SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH);
|
---|
153 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GB_MOB_FENCE);
|
---|
154 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V2);
|
---|
155 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_MOB64);
|
---|
156 | SVGA_CASE_ID2STR(SVGA_3D_CMD_REDEFINE_GB_MOB64);
|
---|
157 | SVGA_CASE_ID2STR(SVGA_3D_CMD_NOP_ERROR);
|
---|
158 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_STREAMS);
|
---|
159 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_DECLS);
|
---|
160 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SET_VERTEX_DIVISORS);
|
---|
161 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW);
|
---|
162 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DRAW_INDEXED);
|
---|
163 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_CONTEXT);
|
---|
164 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_CONTEXT);
|
---|
165 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_CONTEXT);
|
---|
166 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_CONTEXT);
|
---|
167 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_INVALIDATE_CONTEXT);
|
---|
168 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER);
|
---|
169 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER_RESOURCES);
|
---|
170 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER);
|
---|
171 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SAMPLERS);
|
---|
172 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW);
|
---|
173 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED);
|
---|
174 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INSTANCED);
|
---|
175 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED);
|
---|
176 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_AUTO);
|
---|
177 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_INPUT_LAYOUT);
|
---|
178 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS);
|
---|
179 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_INDEX_BUFFER);
|
---|
180 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_TOPOLOGY);
|
---|
181 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_RENDERTARGETS);
|
---|
182 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_BLEND_STATE);
|
---|
183 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE);
|
---|
184 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_RASTERIZER_STATE);
|
---|
185 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_QUERY);
|
---|
186 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_QUERY);
|
---|
187 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_QUERY);
|
---|
188 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_QUERY_OFFSET);
|
---|
189 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BEGIN_QUERY);
|
---|
190 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_END_QUERY);
|
---|
191 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_QUERY);
|
---|
192 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_PREDICATION);
|
---|
193 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SOTARGETS);
|
---|
194 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VIEWPORTS);
|
---|
195 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SCISSORRECTS);
|
---|
196 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW);
|
---|
197 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW);
|
---|
198 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_COPY_REGION);
|
---|
199 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_COPY);
|
---|
200 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRESENTBLT);
|
---|
201 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_GENMIPS);
|
---|
202 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE);
|
---|
203 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_SUBRESOURCE);
|
---|
204 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE);
|
---|
205 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW);
|
---|
206 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW);
|
---|
207 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW);
|
---|
208 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW);
|
---|
209 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW);
|
---|
210 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW);
|
---|
211 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT);
|
---|
212 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT);
|
---|
213 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_BLEND_STATE);
|
---|
214 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_BLEND_STATE);
|
---|
215 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE);
|
---|
216 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE);
|
---|
217 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE);
|
---|
218 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE);
|
---|
219 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE);
|
---|
220 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE);
|
---|
221 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_SHADER);
|
---|
222 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_SHADER);
|
---|
223 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_SHADER);
|
---|
224 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT);
|
---|
225 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT);
|
---|
226 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_STREAMOUTPUT);
|
---|
227 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_COTABLE);
|
---|
228 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_COTABLE);
|
---|
229 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BUFFER_COPY);
|
---|
230 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER);
|
---|
231 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK);
|
---|
232 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_MOVE_QUERY);
|
---|
233 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_ALL_QUERY);
|
---|
234 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_READBACK_ALL_QUERY);
|
---|
235 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER);
|
---|
236 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_MOB_FENCE_64);
|
---|
237 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_ALL_SHADER);
|
---|
238 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_HINT);
|
---|
239 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BUFFER_UPDATE);
|
---|
240 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET);
|
---|
241 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET);
|
---|
242 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET);
|
---|
243 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET);
|
---|
244 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET);
|
---|
245 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET);
|
---|
246 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER);
|
---|
247 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SCREEN_COPY);
|
---|
248 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED1);
|
---|
249 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2);
|
---|
250 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED3);
|
---|
251 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED4);
|
---|
252 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED5);
|
---|
253 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED6);
|
---|
254 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED7);
|
---|
255 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED8);
|
---|
256 | SVGA_CASE_ID2STR(SVGA_3D_CMD_GROW_OTABLE);
|
---|
257 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_GROW_COTABLE);
|
---|
258 | SVGA_CASE_ID2STR(SVGA_3D_CMD_INTRA_SURFACE_COPY);
|
---|
259 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V3);
|
---|
260 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_RESOLVE_COPY);
|
---|
261 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_RESOLVE_COPY);
|
---|
262 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_CONVERT_REGION);
|
---|
263 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_PRED_CONVERT);
|
---|
264 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WHOLE_SURFACE_COPY);
|
---|
265 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_UA_VIEW);
|
---|
266 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DESTROY_UA_VIEW);
|
---|
267 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT);
|
---|
268 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT);
|
---|
269 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT);
|
---|
270 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_UA_VIEWS);
|
---|
271 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT);
|
---|
272 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT);
|
---|
273 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DISPATCH);
|
---|
274 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DISPATCH_INDIRECT);
|
---|
275 | SVGA_CASE_ID2STR(SVGA_3D_CMD_WRITE_ZERO_SURFACE);
|
---|
276 | SVGA_CASE_ID2STR(SVGA_3D_CMD_HINT_ZERO_SURFACE);
|
---|
277 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER);
|
---|
278 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT);
|
---|
279 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_BITBLT);
|
---|
280 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_TRANSBLT);
|
---|
281 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_STRETCHBLT);
|
---|
282 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_COLORFILL);
|
---|
283 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_ALPHABLEND);
|
---|
284 | SVGA_CASE_ID2STR(SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND);
|
---|
285 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_1);
|
---|
286 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_2);
|
---|
287 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DEFINE_GB_SURFACE_V4);
|
---|
288 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_CS_UA_VIEWS);
|
---|
289 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_MIN_LOD);
|
---|
290 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_3);
|
---|
291 | SVGA_CASE_ID2STR(SVGA_3D_CMD_RESERVED2_4);
|
---|
292 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2);
|
---|
293 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB);
|
---|
294 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_SET_SHADER_IFACE);
|
---|
295 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_STREAMOUTPUT);
|
---|
296 | SVGA_CASE_ID2STR(SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS);
|
---|
297 | SVGA_CASE_ID2STR(SVGA_3D_CMD_DX_BIND_SHADER_IFACE);
|
---|
298 | SVGA_CASE_ID2STR(SVGA_3D_CMD_MAX);
|
---|
299 | SVGA_CASE_ID2STR(SVGA_3D_CMD_FUTURE_MAX);
|
---|
300 | }
|
---|
301 | return "UNKNOWN_3D";
|
---|
302 | }
|
---|
303 |
|
---|
304 | /**
|
---|
305 | * FIFO command name lookup
|
---|
306 | *
|
---|
307 | * @returns FIFO command string or "UNKNOWN"
|
---|
308 | * @param u32Cmd FIFO command
|
---|
309 | */
|
---|
310 | const char *vmsvgaR3FifoCmdToString(uint32_t u32Cmd)
|
---|
311 | {
|
---|
312 | switch (u32Cmd)
|
---|
313 | {
|
---|
314 | SVGA_CASE_ID2STR(SVGA_CMD_INVALID_CMD);
|
---|
315 | SVGA_CASE_ID2STR(SVGA_CMD_UPDATE);
|
---|
316 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_FILL);
|
---|
317 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_COPY);
|
---|
318 | SVGA_CASE_ID2STR(SVGA_CMD_RECT_ROP_COPY);
|
---|
319 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_CURSOR);
|
---|
320 | SVGA_CASE_ID2STR(SVGA_CMD_DISPLAY_CURSOR);
|
---|
321 | SVGA_CASE_ID2STR(SVGA_CMD_MOVE_CURSOR);
|
---|
322 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_ALPHA_CURSOR);
|
---|
323 | SVGA_CASE_ID2STR(SVGA_CMD_UPDATE_VERBOSE);
|
---|
324 | SVGA_CASE_ID2STR(SVGA_CMD_FRONT_ROP_FILL);
|
---|
325 | SVGA_CASE_ID2STR(SVGA_CMD_FENCE);
|
---|
326 | SVGA_CASE_ID2STR(SVGA_CMD_ESCAPE);
|
---|
327 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_SCREEN);
|
---|
328 | SVGA_CASE_ID2STR(SVGA_CMD_DESTROY_SCREEN);
|
---|
329 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_GMRFB);
|
---|
330 | SVGA_CASE_ID2STR(SVGA_CMD_BLIT_GMRFB_TO_SCREEN);
|
---|
331 | SVGA_CASE_ID2STR(SVGA_CMD_BLIT_SCREEN_TO_GMRFB);
|
---|
332 | SVGA_CASE_ID2STR(SVGA_CMD_ANNOTATION_FILL);
|
---|
333 | SVGA_CASE_ID2STR(SVGA_CMD_ANNOTATION_COPY);
|
---|
334 | SVGA_CASE_ID2STR(SVGA_CMD_DEFINE_GMR2);
|
---|
335 | SVGA_CASE_ID2STR(SVGA_CMD_REMAP_GMR2);
|
---|
336 | SVGA_CASE_ID2STR(SVGA_CMD_DEAD);
|
---|
337 | SVGA_CASE_ID2STR(SVGA_CMD_DEAD_2);
|
---|
338 | SVGA_CASE_ID2STR(SVGA_CMD_NOP);
|
---|
339 | SVGA_CASE_ID2STR(SVGA_CMD_NOP_ERROR);
|
---|
340 | SVGA_CASE_ID2STR(SVGA_CMD_MAX);
|
---|
341 | default:
|
---|
342 | if ( u32Cmd >= SVGA_3D_CMD_BASE
|
---|
343 | && u32Cmd < SVGA_3D_CMD_MAX)
|
---|
344 | return vmsvgaFifo3dCmdToString((SVGAFifo3dCmdId)u32Cmd);
|
---|
345 | }
|
---|
346 | return "UNKNOWN";
|
---|
347 | }
|
---|
348 | # undef SVGA_CASE_ID2STR
|
---|
349 | #endif /* LOG_ENABLED || VBOX_STRICT */
|
---|
350 |
|
---|
351 |
|
---|
352 | /*
|
---|
353 | *
|
---|
354 | * Guest-Backed Objects (GBO).
|
---|
355 | *
|
---|
356 | */
|
---|
357 |
|
---|
358 | /**
|
---|
359 | * HC access handler for GBOs which require write protection, i.e. OTables, etc.
|
---|
360 | *
|
---|
361 | * @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
|
---|
362 | * @param pVM VM Handle.
|
---|
363 | * @param pVCpu The cross context CPU structure for the calling EMT.
|
---|
364 | * @param GCPhys The physical address the guest is writing to.
|
---|
365 | * @param pvPhys The HC mapping of that address.
|
---|
366 | * @param pvBuf What the guest is reading/writing.
|
---|
367 | * @param cbBuf How much it's reading/writing.
|
---|
368 | * @param enmAccessType The access type.
|
---|
369 | * @param enmOrigin Who is making the access.
|
---|
370 | * @param uUser The VMM automatically sets this to the address of
|
---|
371 | * the device instance.
|
---|
372 | */
|
---|
373 | DECLCALLBACK(VBOXSTRICTRC)
|
---|
374 | vmsvgaR3GboAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys, void *pvBuf, size_t cbBuf,
|
---|
375 | PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, uint64_t uUser)
|
---|
376 | {
|
---|
377 | RT_NOREF(pVM, pVCpu, pvPhys, enmAccessType);
|
---|
378 |
|
---|
379 | if (RT_LIKELY(enmOrigin == PGMACCESSORIGIN_DEVICE || enmOrigin == PGMACCESSORIGIN_DEBUGGER))
|
---|
380 | return VINF_PGM_HANDLER_DO_DEFAULT;
|
---|
381 |
|
---|
382 | PPDMDEVINS pDevIns = (PPDMDEVINS)uUser;
|
---|
383 | AssertPtrReturn(pDevIns, VERR_INTERNAL_ERROR_4);
|
---|
384 | AssertReturn(pDevIns->u32Version == PDM_DEVINSR3_VERSION, VERR_INTERNAL_ERROR_5);
|
---|
385 | PVGASTATE pThis = PDMDEVINS_2_DATA(pDevIns, PVGASTATE);
|
---|
386 | PVGASTATECC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PVGASTATECC);
|
---|
387 | PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
388 |
|
---|
389 | /*
|
---|
390 | * The guest is not allowed to access the memory.
|
---|
391 | * Set the error condition.
|
---|
392 | */
|
---|
393 | ASMAtomicWriteBool(&pThis->svga.fBadGuest, true);
|
---|
394 |
|
---|
395 | /* Try to find the GBO which the guest is accessing. */
|
---|
396 | char const *pszTarget = NULL;
|
---|
397 | for (uint32_t i = 0; i < RT_ELEMENTS(pSvgaR3State->aGboOTables) && !pszTarget; ++i)
|
---|
398 | {
|
---|
399 | PVMSVGAGBO pGbo = &pSvgaR3State->aGboOTables[i];
|
---|
400 | if (pGbo->cDescriptors)
|
---|
401 | {
|
---|
402 | for (uint32_t j = 0; j < pGbo->cDescriptors; ++j)
|
---|
403 | {
|
---|
404 | if ( GCPhys >= pGbo->paDescriptors[j].GCPhys
|
---|
405 | && GCPhys < pGbo->paDescriptors[j].GCPhys + pGbo->paDescriptors[j].cPages * GUEST_PAGE_SIZE)
|
---|
406 | {
|
---|
407 | switch (i)
|
---|
408 | {
|
---|
409 | case SVGA_OTABLE_MOB: pszTarget = "SVGA_OTABLE_MOB"; break;
|
---|
410 | case SVGA_OTABLE_SURFACE: pszTarget = "SVGA_OTABLE_SURFACE"; break;
|
---|
411 | case SVGA_OTABLE_CONTEXT: pszTarget = "SVGA_OTABLE_CONTEXT"; break;
|
---|
412 | case SVGA_OTABLE_SHADER: pszTarget = "SVGA_OTABLE_SHADER"; break;
|
---|
413 | case SVGA_OTABLE_SCREENTARGET: pszTarget = "SVGA_OTABLE_SCREENTARGET"; break;
|
---|
414 | case SVGA_OTABLE_DXCONTEXT: pszTarget = "SVGA_OTABLE_DXCONTEXT"; break;
|
---|
415 | default: pszTarget = "Unknown OTABLE"; break;
|
---|
416 | }
|
---|
417 | break;
|
---|
418 | }
|
---|
419 | }
|
---|
420 | }
|
---|
421 | }
|
---|
422 |
|
---|
423 | LogRelMax(8, ("VMSVGA: invalid guest access to page %RGp, target %s:\n"
|
---|
424 | "%.*Rhxd\n",
|
---|
425 | GCPhys, pszTarget ? pszTarget : "unknown", RT_MIN(cbBuf, 256), pvBuf));
|
---|
426 |
|
---|
427 | return VINF_PGM_HANDLER_DO_DEFAULT;
|
---|
428 | }
|
---|
429 |
|
---|
430 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
431 |
|
---|
432 | static int vmsvgaR3GboCreate(PVMSVGAR3STATE pSvgaR3State, SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, bool fWriteProtected, PVMSVGAGBO pGbo)
|
---|
433 | {
|
---|
434 | ASSERT_GUEST_RETURN(sizeInBytes <= _128M, VERR_INVALID_PARAMETER); /** @todo Less than SVGA_REG_MOB_MAX_SIZE */
|
---|
435 |
|
---|
436 | /*
|
---|
437 | * The 'baseAddress' is a page number and points to the 'root page' of the GBO.
|
---|
438 | * Content of the root page depends on the ptDepth value:
|
---|
439 | * SVGA3D_MOBFMT_PTDEPTH[64]_0 - the only data page;
|
---|
440 | * SVGA3D_MOBFMT_PTDEPTH[64]_1 - array of page numbers for data pages;
|
---|
441 | * SVGA3D_MOBFMT_PTDEPTH[64]_2 - array of page numbers for SVGA3D_MOBFMT_PTDEPTH[64]_1 pages.
|
---|
442 | * The code below extracts the page addresses of the GBO.
|
---|
443 | */
|
---|
444 |
|
---|
445 | /* Verify and normalize the ptDepth value. */
|
---|
446 | bool fGCPhys64; /* Whether the page table contains 64 bit page numbers. */
|
---|
447 | if (RT_LIKELY( ptDepth == SVGA3D_MOBFMT_PTDEPTH64_0
|
---|
448 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH64_1
|
---|
449 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH64_2))
|
---|
450 | fGCPhys64 = true;
|
---|
451 | else if ( ptDepth == SVGA3D_MOBFMT_PTDEPTH_0
|
---|
452 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH_1
|
---|
453 | || ptDepth == SVGA3D_MOBFMT_PTDEPTH_2)
|
---|
454 | {
|
---|
455 | fGCPhys64 = false;
|
---|
456 | /* Shift ptDepth to the SVGA3D_MOBFMT_PTDEPTH64_x range. */
|
---|
457 | ptDepth = (SVGAMobFormat)(ptDepth + SVGA3D_MOBFMT_PTDEPTH64_0 - SVGA3D_MOBFMT_PTDEPTH_0);
|
---|
458 | }
|
---|
459 | else if (ptDepth == SVGA3D_MOBFMT_RANGE)
|
---|
460 | fGCPhys64 = false; /* Does not matter, there is no page table. */
|
---|
461 | else
|
---|
462 | ASSERT_GUEST_FAILED_RETURN(VERR_INVALID_PARAMETER);
|
---|
463 |
|
---|
464 | uint32_t const cPPNsPerPage = X86_PAGE_SIZE / (fGCPhys64 ? sizeof(PPN64) : sizeof(PPN));
|
---|
465 |
|
---|
466 | pGbo->cbTotal = sizeInBytes;
|
---|
467 | pGbo->cTotalPages = (sizeInBytes + X86_PAGE_SIZE - 1) >> X86_PAGE_SHIFT;
|
---|
468 |
|
---|
469 | /* Allocate the maximum amount possible (everything non-continuous) */
|
---|
470 | PVMSVGAGBODESCRIPTOR paDescriptors = (PVMSVGAGBODESCRIPTOR)RTMemAlloc(pGbo->cTotalPages * sizeof(VMSVGAGBODESCRIPTOR));
|
---|
471 | AssertReturn(paDescriptors, VERR_NO_MEMORY);
|
---|
472 |
|
---|
473 | int rc = VINF_SUCCESS;
|
---|
474 | if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_0)
|
---|
475 | {
|
---|
476 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages == 1,
|
---|
477 | RTMemFree(paDescriptors),
|
---|
478 | VERR_INVALID_PARAMETER);
|
---|
479 |
|
---|
480 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
481 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
482 | paDescriptors[0].GCPhys = GCPhys;
|
---|
483 | paDescriptors[0].cPages = 1;
|
---|
484 | }
|
---|
485 | else if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_1)
|
---|
486 | {
|
---|
487 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages <= cPPNsPerPage,
|
---|
488 | RTMemFree(paDescriptors),
|
---|
489 | VERR_INVALID_PARAMETER);
|
---|
490 |
|
---|
491 | /* Read the root page. */
|
---|
492 | uint8_t au8RootPage[X86_PAGE_SIZE];
|
---|
493 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
494 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhys, &au8RootPage, sizeof(au8RootPage));
|
---|
495 | if (RT_SUCCESS(rc))
|
---|
496 | {
|
---|
497 | PPN64 *paPPN64 = (PPN64 *)&au8RootPage[0];
|
---|
498 | PPN *paPPN32 = (PPN *)&au8RootPage[0];
|
---|
499 | for (uint32_t iPPN = 0; iPPN < pGbo->cTotalPages; ++iPPN)
|
---|
500 | {
|
---|
501 | GCPhys = (RTGCPHYS)(fGCPhys64 ? paPPN64[iPPN] : paPPN32[iPPN]) << X86_PAGE_SHIFT;
|
---|
502 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
503 | paDescriptors[iPPN].GCPhys = GCPhys;
|
---|
504 | paDescriptors[iPPN].cPages = 1;
|
---|
505 | }
|
---|
506 | }
|
---|
507 | }
|
---|
508 | else if (ptDepth == SVGA3D_MOBFMT_PTDEPTH64_2)
|
---|
509 | {
|
---|
510 | ASSERT_GUEST_STMT_RETURN(pGbo->cTotalPages <= cPPNsPerPage * cPPNsPerPage,
|
---|
511 | RTMemFree(paDescriptors),
|
---|
512 | VERR_INVALID_PARAMETER);
|
---|
513 |
|
---|
514 | /* Read the Level2 root page. */
|
---|
515 | uint8_t au8RootPageLevel2[X86_PAGE_SIZE];
|
---|
516 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
517 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhys, &au8RootPageLevel2, sizeof(au8RootPageLevel2));
|
---|
518 | if (RT_SUCCESS(rc))
|
---|
519 | {
|
---|
520 | uint32_t cPagesLeft = pGbo->cTotalPages;
|
---|
521 |
|
---|
522 | PPN64 *paPPN64Level2 = (PPN64 *)&au8RootPageLevel2[0];
|
---|
523 | PPN *paPPN32Level2 = (PPN *)&au8RootPageLevel2[0];
|
---|
524 |
|
---|
525 | uint32_t const cPPNsLevel2 = (pGbo->cTotalPages + cPPNsPerPage - 1) / cPPNsPerPage;
|
---|
526 | for (uint32_t iPPNLevel2 = 0; iPPNLevel2 < cPPNsLevel2; ++iPPNLevel2)
|
---|
527 | {
|
---|
528 | /* Read the Level1 root page. */
|
---|
529 | uint8_t au8RootPage[X86_PAGE_SIZE];
|
---|
530 | RTGCPHYS GCPhysLevel1 = (RTGCPHYS)(fGCPhys64 ? paPPN64Level2[iPPNLevel2] : paPPN32Level2[iPPNLevel2]) << X86_PAGE_SHIFT;
|
---|
531 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
532 | rc = PDMDevHlpPCIPhysRead(pSvgaR3State->pDevIns, GCPhysLevel1, &au8RootPage, sizeof(au8RootPage));
|
---|
533 | if (RT_SUCCESS(rc))
|
---|
534 | {
|
---|
535 | PPN64 *paPPN64 = (PPN64 *)&au8RootPage[0];
|
---|
536 | PPN *paPPN32 = (PPN *)&au8RootPage[0];
|
---|
537 |
|
---|
538 | uint32_t const cPPNs = RT_MIN(cPagesLeft, cPPNsPerPage);
|
---|
539 | for (uint32_t iPPN = 0; iPPN < cPPNs; ++iPPN)
|
---|
540 | {
|
---|
541 | GCPhys = (RTGCPHYS)(fGCPhys64 ? paPPN64[iPPN] : paPPN32[iPPN]) << X86_PAGE_SHIFT;
|
---|
542 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
543 | paDescriptors[iPPN + iPPNLevel2 * cPPNsPerPage].GCPhys = GCPhys;
|
---|
544 | paDescriptors[iPPN + iPPNLevel2 * cPPNsPerPage].cPages = 1;
|
---|
545 | }
|
---|
546 | cPagesLeft -= cPPNs;
|
---|
547 | }
|
---|
548 | }
|
---|
549 | }
|
---|
550 | }
|
---|
551 | else if (ptDepth == SVGA3D_MOBFMT_RANGE)
|
---|
552 | {
|
---|
553 | RTGCPHYS GCPhys = (RTGCPHYS)baseAddress << X86_PAGE_SHIFT;
|
---|
554 | GCPhys &= UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
555 | paDescriptors[0].GCPhys = GCPhys;
|
---|
556 | paDescriptors[0].cPages = pGbo->cTotalPages;
|
---|
557 | }
|
---|
558 | else
|
---|
559 | {
|
---|
560 | AssertFailed();
|
---|
561 | return VERR_INTERNAL_ERROR; /* ptDepth should be already verified. */
|
---|
562 | }
|
---|
563 |
|
---|
564 | /* Compress the descriptors. */
|
---|
565 | if (ptDepth != SVGA3D_MOBFMT_RANGE)
|
---|
566 | {
|
---|
567 | uint32_t iDescriptor = 0;
|
---|
568 | for (uint32_t i = 1; i < pGbo->cTotalPages; ++i)
|
---|
569 | {
|
---|
570 | /* Continuous physical memory? */
|
---|
571 | if (paDescriptors[i].GCPhys == paDescriptors[iDescriptor].GCPhys + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE)
|
---|
572 | {
|
---|
573 | Assert(paDescriptors[iDescriptor].cPages);
|
---|
574 | paDescriptors[iDescriptor].cPages++;
|
---|
575 | Log5Func(("Page %x GCPhys=%RGp successor\n", i, paDescriptors[i].GCPhys));
|
---|
576 | }
|
---|
577 | else
|
---|
578 | {
|
---|
579 | iDescriptor++;
|
---|
580 | paDescriptors[iDescriptor].GCPhys = paDescriptors[i].GCPhys;
|
---|
581 | paDescriptors[iDescriptor].cPages = 1;
|
---|
582 | Log5Func(("Page %x GCPhys=%RGp\n", i, paDescriptors[iDescriptor].GCPhys));
|
---|
583 | }
|
---|
584 | }
|
---|
585 |
|
---|
586 | pGbo->cDescriptors = iDescriptor + 1;
|
---|
587 | Log5Func(("Nr of descriptors %d\n", pGbo->cDescriptors));
|
---|
588 | }
|
---|
589 | else
|
---|
590 | pGbo->cDescriptors = 1;
|
---|
591 |
|
---|
592 | if (RT_LIKELY(pGbo->cDescriptors < pGbo->cTotalPages))
|
---|
593 | {
|
---|
594 | pGbo->paDescriptors = (PVMSVGAGBODESCRIPTOR)RTMemRealloc(paDescriptors, pGbo->cDescriptors * sizeof(VMSVGAGBODESCRIPTOR));
|
---|
595 | AssertReturn(pGbo->paDescriptors, VERR_NO_MEMORY);
|
---|
596 | }
|
---|
597 | else
|
---|
598 | pGbo->paDescriptors = paDescriptors;
|
---|
599 |
|
---|
600 | #if 1 /// @todo PGMHandlerPhysicalRegister asserts deep in PGM code with enmKind of a page being out of range.
|
---|
601 | fWriteProtected = false;
|
---|
602 | #endif
|
---|
603 | if (fWriteProtected)
|
---|
604 | {
|
---|
605 | pGbo->fGboFlags |= VMSVGAGBO_F_WRITE_PROTECTED;
|
---|
606 | for (uint32_t i = 0; i < pGbo->cDescriptors; ++i)
|
---|
607 | {
|
---|
608 | rc = PDMDevHlpPGMHandlerPhysicalRegister(pSvgaR3State->pDevIns,
|
---|
609 | pGbo->paDescriptors[i].GCPhys,
|
---|
610 | pGbo->paDescriptors[i].GCPhys
|
---|
611 | + pGbo->paDescriptors[i].cPages * GUEST_PAGE_SIZE - 1,
|
---|
612 | pSvgaR3State->hGboAccessHandlerType, "VMSVGA GBO");
|
---|
613 | AssertRC(rc);
|
---|
614 | }
|
---|
615 | }
|
---|
616 |
|
---|
617 | return VINF_SUCCESS;
|
---|
618 | }
|
---|
619 |
|
---|
620 |
|
---|
621 | static void vmsvgaR3GboDestroy(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
622 | {
|
---|
623 | if (RT_LIKELY(VMSVGA_IS_GBO_CREATED(pGbo)))
|
---|
624 | {
|
---|
625 | if (pGbo->fGboFlags & VMSVGAGBO_F_WRITE_PROTECTED)
|
---|
626 | {
|
---|
627 | for (uint32_t i = 0; i < pGbo->cDescriptors; ++i)
|
---|
628 | {
|
---|
629 | int rc = PDMDevHlpPGMHandlerPhysicalDeregister(pSvgaR3State->pDevIns, pGbo->paDescriptors[i].GCPhys);
|
---|
630 | AssertRC(rc);
|
---|
631 | }
|
---|
632 | }
|
---|
633 | RTMemFree(pGbo->paDescriptors);
|
---|
634 | RT_ZERO(pGbo);
|
---|
635 | }
|
---|
636 | }
|
---|
637 |
|
---|
638 | /** @todo static void vmsvgaR3GboWriteProtect(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo, bool fWriteProtect) */
|
---|
639 |
|
---|
640 | typedef enum VMSVGAGboTransferDirection
|
---|
641 | {
|
---|
642 | VMSVGAGboTransferDirection_Read,
|
---|
643 | VMSVGAGboTransferDirection_Write,
|
---|
644 | } VMSVGAGboTransferDirection;
|
---|
645 |
|
---|
646 | static int vmsvgaR3GboTransfer(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
647 | uint32_t off, void *pvData, uint32_t cbData,
|
---|
648 | VMSVGAGboTransferDirection enmDirection)
|
---|
649 | {
|
---|
650 | //DEBUG_BREAKPOINT_TEST();
|
---|
651 | int rc = VINF_SUCCESS;
|
---|
652 | uint8_t *pu8CurrentHost = (uint8_t *)pvData;
|
---|
653 |
|
---|
654 | /* Find the right descriptor */
|
---|
655 | PCVMSVGAGBODESCRIPTOR const paDescriptors = pGbo->paDescriptors;
|
---|
656 | uint32_t iDescriptor = 0; /* Index in the descriptor array. */
|
---|
657 | uint32_t offDescriptor = 0; /* GMR offset of the current descriptor. */
|
---|
658 | while (offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE <= off)
|
---|
659 | {
|
---|
660 | offDescriptor += paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE;
|
---|
661 | AssertReturn(offDescriptor < pGbo->cbTotal, VERR_INTERNAL_ERROR); /* overflow protection */
|
---|
662 | ++iDescriptor;
|
---|
663 | AssertReturn(iDescriptor < pGbo->cDescriptors, VERR_INTERNAL_ERROR);
|
---|
664 | }
|
---|
665 |
|
---|
666 | while (cbData)
|
---|
667 | {
|
---|
668 | uint32_t cbToCopy;
|
---|
669 | if (off + cbData <= offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE)
|
---|
670 | cbToCopy = cbData;
|
---|
671 | else
|
---|
672 | {
|
---|
673 | cbToCopy = (offDescriptor + paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE - off);
|
---|
674 | AssertReturn(cbToCopy <= cbData, VERR_INVALID_PARAMETER);
|
---|
675 | }
|
---|
676 |
|
---|
677 | RTGCPHYS const GCPhys = paDescriptors[iDescriptor].GCPhys + off - offDescriptor;
|
---|
678 | Log5Func(("%s phys=%RGp\n", (enmDirection == VMSVGAGboTransferDirection_Read) ? "READ" : "WRITE", GCPhys));
|
---|
679 |
|
---|
680 | /*
|
---|
681 | * We are deliberately using the non-PCI version of PDMDevHlpPCIPhys[Read|Write] as the
|
---|
682 | * guest-side VMSVGA driver seems to allocate non-DMA (regular physical) addresses,
|
---|
683 | * see @bugref{9654#c75}.
|
---|
684 | */
|
---|
685 | if (enmDirection == VMSVGAGboTransferDirection_Read)
|
---|
686 | rc = PDMDevHlpPhysRead(pSvgaR3State->pDevIns, GCPhys, pu8CurrentHost, cbToCopy);
|
---|
687 | else
|
---|
688 | rc = PDMDevHlpPhysWrite(pSvgaR3State->pDevIns, GCPhys, pu8CurrentHost, cbToCopy);
|
---|
689 | AssertRCBreak(rc);
|
---|
690 |
|
---|
691 | cbData -= cbToCopy;
|
---|
692 | off += cbToCopy;
|
---|
693 | pu8CurrentHost += cbToCopy;
|
---|
694 |
|
---|
695 | /* Go to the next descriptor if there's anything left. */
|
---|
696 | if (cbData)
|
---|
697 | {
|
---|
698 | offDescriptor += paDescriptors[iDescriptor].cPages * X86_PAGE_SIZE;
|
---|
699 | AssertReturn(offDescriptor < pGbo->cbTotal, VERR_INTERNAL_ERROR);
|
---|
700 | ++iDescriptor;
|
---|
701 | AssertReturn(iDescriptor < pGbo->cDescriptors, VERR_INTERNAL_ERROR);
|
---|
702 | }
|
---|
703 | }
|
---|
704 | return rc;
|
---|
705 | }
|
---|
706 |
|
---|
707 |
|
---|
708 | static int vmsvgaR3GboWrite(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
709 | uint32_t off, void const *pvData, uint32_t cbData)
|
---|
710 | {
|
---|
711 | return vmsvgaR3GboTransfer(pSvgaR3State, pGbo,
|
---|
712 | off, (void *)pvData, cbData,
|
---|
713 | VMSVGAGboTransferDirection_Write);
|
---|
714 | }
|
---|
715 |
|
---|
716 |
|
---|
717 | static int vmsvgaR3GboRead(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo,
|
---|
718 | uint32_t off, void *pvData, uint32_t cbData)
|
---|
719 | {
|
---|
720 | return vmsvgaR3GboTransfer(pSvgaR3State, pGbo,
|
---|
721 | off, pvData, cbData,
|
---|
722 | VMSVGAGboTransferDirection_Read);
|
---|
723 | }
|
---|
724 |
|
---|
725 |
|
---|
726 | static int vmsvgaR3GboBackingStoreCreate(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo, uint32_t cbValid)
|
---|
727 | {
|
---|
728 | int rc;
|
---|
729 |
|
---|
730 | /* Just reread the data if pvHost has been allocated already. */
|
---|
731 | if (!(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED))
|
---|
732 | pGbo->pvHost = RTMemAllocZ(pGbo->cbTotal);
|
---|
733 |
|
---|
734 | if (pGbo->pvHost)
|
---|
735 | {
|
---|
736 | cbValid = RT_MIN(cbValid, pGbo->cbTotal);
|
---|
737 | rc = vmsvgaR3GboRead(pSvgaR3State, pGbo, 0, pGbo->pvHost, cbValid);
|
---|
738 | }
|
---|
739 | else
|
---|
740 | rc = VERR_NO_MEMORY;
|
---|
741 |
|
---|
742 | if (RT_SUCCESS(rc))
|
---|
743 | pGbo->fGboFlags |= VMSVGAGBO_F_HOST_BACKED;
|
---|
744 | else
|
---|
745 | {
|
---|
746 | RTMemFree(pGbo->pvHost);
|
---|
747 | pGbo->pvHost = NULL;
|
---|
748 | }
|
---|
749 | return rc;
|
---|
750 | }
|
---|
751 |
|
---|
752 |
|
---|
753 | static void vmsvgaR3GboBackingStoreDelete(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
754 | {
|
---|
755 | RT_NOREF(pSvgaR3State);
|
---|
756 | AssertReturnVoid(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED);
|
---|
757 | RTMemFree(pGbo->pvHost);
|
---|
758 | pGbo->pvHost = NULL;
|
---|
759 | pGbo->fGboFlags &= ~VMSVGAGBO_F_HOST_BACKED;
|
---|
760 | }
|
---|
761 |
|
---|
762 |
|
---|
763 | static int vmsvgaR3GboBackingStoreWriteToGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
764 | {
|
---|
765 | AssertReturn(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED, VERR_INVALID_STATE);
|
---|
766 | return vmsvgaR3GboWrite(pSvgaR3State, pGbo, 0, pGbo->pvHost, pGbo->cbTotal);
|
---|
767 | }
|
---|
768 |
|
---|
769 |
|
---|
770 | static int vmsvgaR3GboBackingStoreReadFromGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGbo)
|
---|
771 | {
|
---|
772 | AssertReturn(pGbo->fGboFlags & VMSVGAGBO_F_HOST_BACKED, VERR_INVALID_STATE);
|
---|
773 | return vmsvgaR3GboRead(pSvgaR3State, pGbo, 0, pGbo->pvHost, pGbo->cbTotal);
|
---|
774 | }
|
---|
775 |
|
---|
776 | static int vmsvgaR3GboCopy(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboDst, uint32_t offDst,
|
---|
777 | PVMSVGAGBO pGboSrc, uint32_t offSrc, uint32_t cbCopy)
|
---|
778 | {
|
---|
779 | uint32_t const cbTmpBuf = GUEST_PAGE_SIZE;
|
---|
780 | void *pvTmpBuf = RTMemTmpAlloc(cbTmpBuf);
|
---|
781 | AssertPtrReturn(pvTmpBuf, VERR_NO_MEMORY);
|
---|
782 |
|
---|
783 | int rc = VINF_SUCCESS;
|
---|
784 | while (cbCopy > 0)
|
---|
785 | {
|
---|
786 | uint32_t const cbToCopy = RT_MIN(cbTmpBuf, cbCopy);
|
---|
787 |
|
---|
788 | rc = vmsvgaR3GboRead(pSvgaR3State, pGboSrc, offSrc, pvTmpBuf, cbToCopy);
|
---|
789 | AssertRCBreak(rc);
|
---|
790 |
|
---|
791 | rc = vmsvgaR3GboWrite(pSvgaR3State, pGboDst, offDst, pvTmpBuf, cbToCopy);
|
---|
792 | AssertRCBreak(rc);
|
---|
793 |
|
---|
794 | offSrc += cbToCopy;
|
---|
795 | offDst += cbToCopy;
|
---|
796 | cbCopy -= cbToCopy;
|
---|
797 | }
|
---|
798 |
|
---|
799 | RTMemTmpFree(pvTmpBuf);
|
---|
800 | return rc;
|
---|
801 | }
|
---|
802 |
|
---|
803 |
|
---|
804 | /*
|
---|
805 | *
|
---|
806 | * Object Tables.
|
---|
807 | *
|
---|
808 | */
|
---|
809 |
|
---|
810 | static int vmsvgaR3OTableSetOrGrow(PVMSVGAR3STATE pSvgaR3State, SVGAOTableType type, PPN64 baseAddress,
|
---|
811 | uint32_t sizeInBytes, uint32 validSizeInBytes, SVGAMobFormat ptDepth, bool fGrow)
|
---|
812 | {
|
---|
813 | ASSERT_GUEST_RETURN(type <= RT_ELEMENTS(pSvgaR3State->aGboOTables), VERR_INVALID_PARAMETER);
|
---|
814 | ASSERT_GUEST_RETURN(sizeInBytes >= validSizeInBytes, VERR_INVALID_PARAMETER);
|
---|
815 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
816 |
|
---|
817 | ASSERT_GUEST_RETURN(pSvgaR3State->aGboOTables[type].cbTotal >= validSizeInBytes, VERR_INVALID_PARAMETER);
|
---|
818 |
|
---|
819 | if (sizeInBytes > 0)
|
---|
820 | {
|
---|
821 | /* Create a new guest backed object for the object table. */
|
---|
822 | VMSVGAGBO gbo;
|
---|
823 | int rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, /* fWriteProtected = */ true, &gbo);
|
---|
824 | AssertRCReturn(rc, rc);
|
---|
825 |
|
---|
826 | if (fGrow && validSizeInBytes)
|
---|
827 | {
|
---|
828 | /* Copy data from old gbo to the new one. */
|
---|
829 | rc = vmsvgaR3GboCopy(pSvgaR3State, &gbo, 0, &pSvgaR3State->aGboOTables[type], 0, validSizeInBytes);
|
---|
830 | AssertRCReturnStmt(rc, vmsvgaR3GboDestroy(pSvgaR3State, &gbo), rc);
|
---|
831 | }
|
---|
832 |
|
---|
833 | vmsvgaR3GboDestroy(pSvgaR3State, &pSvgaR3State->aGboOTables[type]);
|
---|
834 | pSvgaR3State->aGboOTables[type] = gbo;
|
---|
835 |
|
---|
836 | }
|
---|
837 | else
|
---|
838 | vmsvgaR3GboDestroy(pSvgaR3State, &pSvgaR3State->aGboOTables[type]);
|
---|
839 |
|
---|
840 | return VINF_SUCCESS;
|
---|
841 | }
|
---|
842 |
|
---|
843 |
|
---|
844 | static int vmsvgaR3OTableVerifyIndex(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
845 | uint32_t idx, uint32_t cbEntry)
|
---|
846 | {
|
---|
847 | RT_NOREF(pSvgaR3State);
|
---|
848 |
|
---|
849 | /* The table must exist and the index must be within the table. */
|
---|
850 | ASSERT_GUEST_RETURN(VMSVGA_IS_GBO_CREATED(pGboOTable), VERR_INVALID_PARAMETER);
|
---|
851 | ASSERT_GUEST_RETURN(idx < pGboOTable->cbTotal / cbEntry, VERR_INVALID_PARAMETER);
|
---|
852 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
853 | return VINF_SUCCESS;
|
---|
854 | }
|
---|
855 |
|
---|
856 |
|
---|
857 | static int vmsvgaR3OTableRead(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
858 | uint32_t idx, uint32_t cbEntry,
|
---|
859 | void *pvData, uint32_t cbData)
|
---|
860 | {
|
---|
861 | AssertReturn(cbData <= cbEntry, VERR_INVALID_PARAMETER);
|
---|
862 |
|
---|
863 | int rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, pGboOTable, idx, cbEntry);
|
---|
864 | if (RT_SUCCESS(rc))
|
---|
865 | {
|
---|
866 | uint32_t const off = idx * cbEntry;
|
---|
867 | rc = vmsvgaR3GboRead(pSvgaR3State, pGboOTable, off, pvData, cbData);
|
---|
868 | }
|
---|
869 | return rc;
|
---|
870 | }
|
---|
871 |
|
---|
872 | static int vmsvgaR3OTableWrite(PVMSVGAR3STATE pSvgaR3State, PVMSVGAGBO pGboOTable,
|
---|
873 | uint32_t idx, uint32_t cbEntry,
|
---|
874 | void const *pvData, uint32_t cbData)
|
---|
875 | {
|
---|
876 | AssertReturn(cbData <= cbEntry, VERR_INVALID_PARAMETER);
|
---|
877 |
|
---|
878 | int rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, pGboOTable, idx, cbEntry);
|
---|
879 | if (RT_SUCCESS(rc))
|
---|
880 | {
|
---|
881 | uint32_t const off = idx * cbEntry;
|
---|
882 | rc = vmsvgaR3GboWrite(pSvgaR3State, pGboOTable, off, pvData, cbData);
|
---|
883 | }
|
---|
884 | return rc;
|
---|
885 | }
|
---|
886 |
|
---|
887 |
|
---|
888 | int vmsvgaR3OTableReadSurface(PVMSVGAR3STATE pSvgaR3State, uint32_t sid, SVGAOTableSurfaceEntry *pEntrySurface)
|
---|
889 | {
|
---|
890 | return vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
891 | sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, pEntrySurface, sizeof(SVGAOTableSurfaceEntry));
|
---|
892 | }
|
---|
893 |
|
---|
894 |
|
---|
895 | /*
|
---|
896 | *
|
---|
897 | * The guest's Memory OBjects (MOB).
|
---|
898 | *
|
---|
899 | */
|
---|
900 |
|
---|
901 | static int vmsvgaR3MobCreate(PVMSVGAR3STATE pSvgaR3State,
|
---|
902 | SVGAMobFormat ptDepth, PPN64 baseAddress, uint32_t sizeInBytes, SVGAMobId mobid,
|
---|
903 | PVMSVGAMOB pMob)
|
---|
904 | {
|
---|
905 | RT_ZERO(*pMob);
|
---|
906 |
|
---|
907 | /* Update the entry in the pSvgaR3State->pGboOTableMob. */
|
---|
908 | SVGAOTableMobEntry entry;
|
---|
909 | entry.ptDepth = ptDepth;
|
---|
910 | entry.sizeInBytes = sizeInBytes;
|
---|
911 | entry.base = baseAddress;
|
---|
912 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
913 | mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
914 | if (RT_SUCCESS(rc))
|
---|
915 | {
|
---|
916 | /* Create the corresponding GBO. */
|
---|
917 | rc = vmsvgaR3GboCreate(pSvgaR3State, ptDepth, baseAddress, sizeInBytes, /* fWriteProtected = */ false, &pMob->Gbo);
|
---|
918 | if (RT_SUCCESS(rc))
|
---|
919 | {
|
---|
920 | /* If a mob with this id already exists, then delete it. */
|
---|
921 | PVMSVGAMOB pOldMob = (PVMSVGAMOB)RTAvlU32Remove(&pSvgaR3State->MOBTree, mobid);
|
---|
922 | if (pOldMob)
|
---|
923 | {
|
---|
924 | /* This should not happen. */
|
---|
925 | ASSERT_GUEST_FAILED();
|
---|
926 | RTListNodeRemove(&pOldMob->nodeLRU);
|
---|
927 | vmsvgaR3GboDestroy(pSvgaR3State, &pOldMob->Gbo);
|
---|
928 | RTMemFree(pOldMob);
|
---|
929 | }
|
---|
930 |
|
---|
931 | /* Add to the tree of known MOBs and the LRU list. */
|
---|
932 | pMob->Core.Key = mobid;
|
---|
933 | if (RTAvlU32Insert(&pSvgaR3State->MOBTree, &pMob->Core))
|
---|
934 | {
|
---|
935 | RTListPrepend(&pSvgaR3State->MOBLRUList, &pMob->nodeLRU);
|
---|
936 | return VINF_SUCCESS;
|
---|
937 | }
|
---|
938 |
|
---|
939 | AssertFailedStmt(rc = VERR_INVALID_STATE);
|
---|
940 | vmsvgaR3GboDestroy(pSvgaR3State, &pMob->Gbo);
|
---|
941 | }
|
---|
942 | }
|
---|
943 |
|
---|
944 | return rc;
|
---|
945 | }
|
---|
946 |
|
---|
947 |
|
---|
948 | static int vmsvgaR3MobDestroy(PVMSVGAR3STATE pSvgaR3State, SVGAMobId mobid)
|
---|
949 | {
|
---|
950 | /* Update the entry in the pSvgaR3State->pGboOTableMob. */
|
---|
951 | SVGAOTableMobEntry entry;
|
---|
952 | RT_ZERO(entry);
|
---|
953 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
954 | mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
955 |
|
---|
956 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTAvlU32Remove(&pSvgaR3State->MOBTree, mobid);
|
---|
957 | if (pMob)
|
---|
958 | {
|
---|
959 | RTListNodeRemove(&pMob->nodeLRU);
|
---|
960 | vmsvgaR3GboDestroy(pSvgaR3State, &pMob->Gbo);
|
---|
961 | RTMemFree(pMob);
|
---|
962 | return VINF_SUCCESS;
|
---|
963 | }
|
---|
964 |
|
---|
965 | return VERR_INVALID_PARAMETER;
|
---|
966 | }
|
---|
967 |
|
---|
968 |
|
---|
969 | PVMSVGAMOB vmsvgaR3MobGet(PVMSVGAR3STATE pSvgaR3State, SVGAMobId RT_UNTRUSTED_GUEST mobid)
|
---|
970 | {
|
---|
971 | if (mobid == SVGA_ID_INVALID)
|
---|
972 | return NULL;
|
---|
973 |
|
---|
974 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTAvlU32Get(&pSvgaR3State->MOBTree, mobid);
|
---|
975 | if (pMob)
|
---|
976 | {
|
---|
977 | /* Move to the head of the LRU list. */
|
---|
978 | RTListNodeRemove(&pMob->nodeLRU);
|
---|
979 | RTListPrepend(&pSvgaR3State->MOBLRUList, &pMob->nodeLRU);
|
---|
980 | }
|
---|
981 | else
|
---|
982 | ASSERT_GUEST_FAILED();
|
---|
983 |
|
---|
984 | return pMob;
|
---|
985 | }
|
---|
986 |
|
---|
987 |
|
---|
988 | int vmsvgaR3MobWrite(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob,
|
---|
989 | uint32_t off, void const *pvData, uint32_t cbData)
|
---|
990 | {
|
---|
991 | return vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, off, pvData, cbData);
|
---|
992 | }
|
---|
993 |
|
---|
994 |
|
---|
995 | int vmsvgaR3MobRead(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob,
|
---|
996 | uint32_t off, void *pvData, uint32_t cbData)
|
---|
997 | {
|
---|
998 | return vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, off, pvData, cbData);
|
---|
999 | }
|
---|
1000 |
|
---|
1001 |
|
---|
1002 | /** Create a host ring-3 pointer to the MOB data.
|
---|
1003 | * Current approach is to allocate a host memory buffer and copy the guest MOB data if necessary.
|
---|
1004 | * @param pSvgaR3State R3 device state.
|
---|
1005 | * @param pMob The MOB.
|
---|
1006 | * @param cbValid How many bytes of the guest backing memory contain valid data.
|
---|
1007 | * @return VBox status.
|
---|
1008 | */
|
---|
1009 | /** @todo uint32_t cbValid -> uint32_t offStart, uint32_t cbData */
|
---|
1010 | int vmsvgaR3MobBackingStoreCreate(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob, uint32_t cbValid)
|
---|
1011 | {
|
---|
1012 | AssertReturn(pMob, VERR_INVALID_PARAMETER);
|
---|
1013 | return vmsvgaR3GboBackingStoreCreate(pSvgaR3State, &pMob->Gbo, cbValid);
|
---|
1014 | }
|
---|
1015 |
|
---|
1016 |
|
---|
1017 | void vmsvgaR3MobBackingStoreDelete(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
1018 | {
|
---|
1019 | if (pMob)
|
---|
1020 | vmsvgaR3GboBackingStoreDelete(pSvgaR3State, &pMob->Gbo);
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 |
|
---|
1024 | int vmsvgaR3MobBackingStoreWriteToGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
1025 | {
|
---|
1026 | if (pMob)
|
---|
1027 | return vmsvgaR3GboBackingStoreWriteToGuest(pSvgaR3State, &pMob->Gbo);
|
---|
1028 | return VERR_INVALID_PARAMETER;
|
---|
1029 | }
|
---|
1030 |
|
---|
1031 |
|
---|
1032 | int vmsvgaR3MobBackingStoreReadFromGuest(PVMSVGAR3STATE pSvgaR3State, PVMSVGAMOB pMob)
|
---|
1033 | {
|
---|
1034 | if (pMob)
|
---|
1035 | return vmsvgaR3GboBackingStoreReadFromGuest(pSvgaR3State, &pMob->Gbo);
|
---|
1036 | return VERR_INVALID_PARAMETER;
|
---|
1037 | }
|
---|
1038 |
|
---|
1039 |
|
---|
1040 | void *vmsvgaR3MobBackingStorePtr(PVMSVGAMOB pMob, uint32_t off)
|
---|
1041 | {
|
---|
1042 | if (pMob && (pMob->Gbo.fGboFlags & VMSVGAGBO_F_HOST_BACKED))
|
---|
1043 | {
|
---|
1044 | if (off <= pMob->Gbo.cbTotal)
|
---|
1045 | return (uint8_t *)pMob->Gbo.pvHost + off;
|
---|
1046 | }
|
---|
1047 | return NULL;
|
---|
1048 | }
|
---|
1049 |
|
---|
1050 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
1051 |
|
---|
1052 | /*
|
---|
1053 | * Screen objects.
|
---|
1054 | */
|
---|
1055 | VMSVGASCREENOBJECT *vmsvgaR3GetScreenObject(PVGASTATECC pThisCC, uint32_t idScreen)
|
---|
1056 | {
|
---|
1057 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
1058 | if ( idScreen < (uint32_t)RT_ELEMENTS(pSVGAState->aScreens)
|
---|
1059 | && pSVGAState
|
---|
1060 | && pSVGAState->aScreens[idScreen].fDefined)
|
---|
1061 | {
|
---|
1062 | return &pSVGAState->aScreens[idScreen];
|
---|
1063 | }
|
---|
1064 | return NULL;
|
---|
1065 | }
|
---|
1066 |
|
---|
1067 | void vmsvgaR3ResetScreens(PVGASTATE pThis, PVGASTATECC pThisCC)
|
---|
1068 | {
|
---|
1069 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
1070 | if (pThis->svga.f3DEnabled)
|
---|
1071 | {
|
---|
1072 | for (uint32_t idScreen = 0; idScreen < (uint32_t)RT_ELEMENTS(pThisCC->svga.pSvgaR3State->aScreens); ++idScreen)
|
---|
1073 | {
|
---|
1074 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, idScreen);
|
---|
1075 | if (pScreen)
|
---|
1076 | vmsvga3dDestroyScreen(pThisCC, pScreen);
|
---|
1077 | }
|
---|
1078 | }
|
---|
1079 | #else
|
---|
1080 | RT_NOREF(pThis, pThisCC);
|
---|
1081 | #endif
|
---|
1082 | }
|
---|
1083 |
|
---|
1084 |
|
---|
1085 | /**
|
---|
1086 | * Copy a rectangle of pixels within guest VRAM.
|
---|
1087 | */
|
---|
1088 | static void vmsvgaR3RectCopy(PVGASTATECC pThisCC, VMSVGASCREENOBJECT const *pScreen, uint32_t srcX, uint32_t srcY,
|
---|
1089 | uint32_t dstX, uint32_t dstY, uint32_t width, uint32_t height, unsigned cbFrameBuffer)
|
---|
1090 | {
|
---|
1091 | if (!width || !height)
|
---|
1092 | return; /* Nothing to do, don't even bother. */
|
---|
1093 |
|
---|
1094 | /*
|
---|
1095 | * The guest VRAM (aka GFB) is considered to be a bitmap in the format
|
---|
1096 | * corresponding to the current display mode.
|
---|
1097 | */
|
---|
1098 | uint32_t const cbPixel = RT_ALIGN(pScreen->cBpp, 8) / 8;
|
---|
1099 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch : width * cbPixel;
|
---|
1100 | uint8_t const *pSrc;
|
---|
1101 | uint8_t *pDst;
|
---|
1102 | unsigned const cbRectWidth = width * cbPixel;
|
---|
1103 | unsigned uMaxOffset;
|
---|
1104 |
|
---|
1105 | uMaxOffset = (RT_MAX(srcY, dstY) + height) * cbScanline + (RT_MAX(srcX, dstX) + width) * cbPixel;
|
---|
1106 | if (uMaxOffset >= cbFrameBuffer)
|
---|
1107 | {
|
---|
1108 | Log(("Max offset (%u) too big for framebuffer (%u bytes), ignoring!\n", uMaxOffset, cbFrameBuffer));
|
---|
1109 | return; /* Just don't listen to a bad guest. */
|
---|
1110 | }
|
---|
1111 |
|
---|
1112 | pSrc = pDst = pThisCC->pbVRam;
|
---|
1113 | pSrc += srcY * cbScanline + srcX * cbPixel;
|
---|
1114 | pDst += dstY * cbScanline + dstX * cbPixel;
|
---|
1115 |
|
---|
1116 | if (srcY >= dstY)
|
---|
1117 | {
|
---|
1118 | /* Source below destination, copy top to bottom. */
|
---|
1119 | for (; height > 0; height--)
|
---|
1120 | {
|
---|
1121 | memmove(pDst, pSrc, cbRectWidth);
|
---|
1122 | pSrc += cbScanline;
|
---|
1123 | pDst += cbScanline;
|
---|
1124 | }
|
---|
1125 | }
|
---|
1126 | else
|
---|
1127 | {
|
---|
1128 | /* Source above destination, copy bottom to top. */
|
---|
1129 | pSrc += cbScanline * (height - 1);
|
---|
1130 | pDst += cbScanline * (height - 1);
|
---|
1131 | for (; height > 0; height--)
|
---|
1132 | {
|
---|
1133 | memmove(pDst, pSrc, cbRectWidth);
|
---|
1134 | pSrc -= cbScanline;
|
---|
1135 | pDst -= cbScanline;
|
---|
1136 | }
|
---|
1137 | }
|
---|
1138 | }
|
---|
1139 |
|
---|
1140 |
|
---|
1141 | /**
|
---|
1142 | * Common worker for changing the pointer shape.
|
---|
1143 | *
|
---|
1144 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
1145 | * @param pSVGAState The VMSVGA ring-3 instance data.
|
---|
1146 | * @param fAlpha Whether there is alpha or not.
|
---|
1147 | * @param xHot Hotspot x coordinate.
|
---|
1148 | * @param yHot Hotspot y coordinate.
|
---|
1149 | * @param cx Width.
|
---|
1150 | * @param cy Height.
|
---|
1151 | * @param pbData Heap copy of the cursor data. Consumed.
|
---|
1152 | * @param cbData The size of the data.
|
---|
1153 | */
|
---|
1154 | static void vmsvgaR3InstallNewCursor(PVGASTATECC pThisCC, PVMSVGAR3STATE pSVGAState, bool fAlpha,
|
---|
1155 | uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, uint8_t *pbData, uint32_t cbData)
|
---|
1156 | {
|
---|
1157 | LogRel2(("vmsvgaR3InstallNewCursor: cx=%d cy=%d xHot=%d yHot=%d fAlpha=%d cbData=%#x\n", cx, cy, xHot, yHot, fAlpha, cbData));
|
---|
1158 | #ifdef LOG_ENABLED
|
---|
1159 | if (LogIs2Enabled())
|
---|
1160 | {
|
---|
1161 | uint32_t cbAndLine = RT_ALIGN(cx, 8) / 8;
|
---|
1162 | if (!fAlpha)
|
---|
1163 | {
|
---|
1164 | Log2(("VMSVGA Cursor AND mask (%d,%d):\n", cx, cy));
|
---|
1165 | for (uint32_t y = 0; y < cy; y++)
|
---|
1166 | {
|
---|
1167 | Log2(("%3u:", y));
|
---|
1168 | uint8_t const *pbLine = &pbData[y * cbAndLine];
|
---|
1169 | for (uint32_t x = 0; x < cx; x += 8)
|
---|
1170 | {
|
---|
1171 | uint8_t b = pbLine[x / 8];
|
---|
1172 | char szByte[12];
|
---|
1173 | szByte[0] = b & 0x80 ? '*' : ' '; /* most significant bit first */
|
---|
1174 | szByte[1] = b & 0x40 ? '*' : ' ';
|
---|
1175 | szByte[2] = b & 0x20 ? '*' : ' ';
|
---|
1176 | szByte[3] = b & 0x10 ? '*' : ' ';
|
---|
1177 | szByte[4] = b & 0x08 ? '*' : ' ';
|
---|
1178 | szByte[5] = b & 0x04 ? '*' : ' ';
|
---|
1179 | szByte[6] = b & 0x02 ? '*' : ' ';
|
---|
1180 | szByte[7] = b & 0x01 ? '*' : ' ';
|
---|
1181 | szByte[8] = '\0';
|
---|
1182 | Log2(("%s", szByte));
|
---|
1183 | }
|
---|
1184 | Log2(("\n"));
|
---|
1185 | }
|
---|
1186 | }
|
---|
1187 |
|
---|
1188 | Log2(("VMSVGA Cursor XOR mask (%d,%d):\n", cx, cy));
|
---|
1189 | uint32_t const *pu32Xor = (uint32_t const *)&pbData[RT_ALIGN_32(cbAndLine * cy, 4)];
|
---|
1190 | for (uint32_t y = 0; y < cy; y++)
|
---|
1191 | {
|
---|
1192 | Log2(("%3u:", y));
|
---|
1193 | uint32_t const *pu32Line = &pu32Xor[y * cx];
|
---|
1194 | for (uint32_t x = 0; x < cx; x++)
|
---|
1195 | Log2((" %08x", pu32Line[x]));
|
---|
1196 | Log2(("\n"));
|
---|
1197 | }
|
---|
1198 | }
|
---|
1199 | #endif
|
---|
1200 |
|
---|
1201 | int rc = pThisCC->pDrv->pfnVBVAMousePointerShape(pThisCC->pDrv, true /*fVisible*/, fAlpha, xHot, yHot, cx, cy, pbData);
|
---|
1202 | AssertRC(rc);
|
---|
1203 |
|
---|
1204 | if (pSVGAState->Cursor.fActive)
|
---|
1205 | RTMemFreeZ(pSVGAState->Cursor.pData, pSVGAState->Cursor.cbData);
|
---|
1206 |
|
---|
1207 | pSVGAState->Cursor.fActive = true;
|
---|
1208 | pSVGAState->Cursor.xHotspot = xHot;
|
---|
1209 | pSVGAState->Cursor.yHotspot = yHot;
|
---|
1210 | pSVGAState->Cursor.width = cx;
|
---|
1211 | pSVGAState->Cursor.height = cy;
|
---|
1212 | pSVGAState->Cursor.cbData = cbData;
|
---|
1213 | pSVGAState->Cursor.pData = pbData;
|
---|
1214 | }
|
---|
1215 |
|
---|
1216 |
|
---|
1217 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
1218 |
|
---|
1219 | /*
|
---|
1220 | * SVGA_3D_CMD_* handlers.
|
---|
1221 | */
|
---|
1222 |
|
---|
1223 |
|
---|
1224 | /** SVGA_3D_CMD_SURFACE_DEFINE 1040, SVGA_3D_CMD_SURFACE_DEFINE_V2 1070
|
---|
1225 | *
|
---|
1226 | * @param pThisCC The VGA/VMSVGA state for the current context.
|
---|
1227 | * @param pCmd The VMSVGA command.
|
---|
1228 | * @param cMipLevelSizes Number of elements in the paMipLevelSizes array.
|
---|
1229 | * @param paMipLevelSizes Arrays of surface sizes for each face and miplevel.
|
---|
1230 | */
|
---|
1231 | static void vmsvga3dCmdDefineSurface(PVGASTATECC pThisCC, SVGA3dCmdDefineSurface_v2 const *pCmd,
|
---|
1232 | uint32_t cMipLevelSizes, SVGA3dSize *paMipLevelSizes)
|
---|
1233 | {
|
---|
1234 | ASSERT_GUEST_RETURN_VOID(pCmd->sid < SVGA3D_MAX_SURFACE_IDS);
|
---|
1235 | ASSERT_GUEST_RETURN_VOID(cMipLevelSizes >= 1);
|
---|
1236 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1237 |
|
---|
1238 | /* Number of faces (cFaces) is specified as the number of the first non-zero elements in the 'face' array.
|
---|
1239 | * Since only plain surfaces (cFaces == 1) and cubemaps (cFaces == 6) are supported
|
---|
1240 | * (see also SVGA3dCmdDefineSurface definition in svga3d_reg.h), we ignore anything else.
|
---|
1241 | */
|
---|
1242 | uint32_t cRemainingMipLevels = cMipLevelSizes;
|
---|
1243 | uint32_t cFaces = 0;
|
---|
1244 | for (uint32_t i = 0; i < SVGA3D_MAX_SURFACE_FACES; ++i)
|
---|
1245 | {
|
---|
1246 | if (pCmd->face[i].numMipLevels == 0)
|
---|
1247 | break;
|
---|
1248 |
|
---|
1249 | /* All SVGA3dSurfaceFace structures must have the same value of numMipLevels field */
|
---|
1250 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels == pCmd->face[0].numMipLevels);
|
---|
1251 |
|
---|
1252 | /* numMipLevels value can't be greater than the number of remaining elements in the paMipLevelSizes array. */
|
---|
1253 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels <= cRemainingMipLevels);
|
---|
1254 | cRemainingMipLevels -= pCmd->face[i].numMipLevels;
|
---|
1255 |
|
---|
1256 | ++cFaces;
|
---|
1257 | }
|
---|
1258 | for (uint32_t i = cFaces; i < SVGA3D_MAX_SURFACE_FACES; ++i)
|
---|
1259 | ASSERT_GUEST_RETURN_VOID(pCmd->face[i].numMipLevels == 0);
|
---|
1260 |
|
---|
1261 | /* cFaces must be 6 for a cubemap and 1 otherwise. */
|
---|
1262 | ASSERT_GUEST_RETURN_VOID(cFaces == (uint32_t)((pCmd->surfaceFlags & SVGA3D_SURFACE_CUBEMAP) ? 6 : 1));
|
---|
1263 |
|
---|
1264 | /* Sum of face[i].numMipLevels must be equal to cMipLevels. */
|
---|
1265 | ASSERT_GUEST_RETURN_VOID(cRemainingMipLevels == 0);
|
---|
1266 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1267 |
|
---|
1268 | /* Verify paMipLevelSizes */
|
---|
1269 | uint32_t cWidth = paMipLevelSizes[0].width;
|
---|
1270 | uint32_t cHeight = paMipLevelSizes[0].height;
|
---|
1271 | uint32_t cDepth = paMipLevelSizes[0].depth;
|
---|
1272 | for (uint32_t i = 1; i < pCmd->face[0].numMipLevels; ++i)
|
---|
1273 | {
|
---|
1274 | cWidth >>= 1;
|
---|
1275 | if (cWidth == 0) cWidth = 1;
|
---|
1276 | cHeight >>= 1;
|
---|
1277 | if (cHeight == 0) cHeight = 1;
|
---|
1278 | cDepth >>= 1;
|
---|
1279 | if (cDepth == 0) cDepth = 1;
|
---|
1280 | for (uint32_t iFace = 0; iFace < cFaces; ++iFace)
|
---|
1281 | {
|
---|
1282 | uint32_t const iMipLevelSize = iFace * pCmd->face[0].numMipLevels + i;
|
---|
1283 | ASSERT_GUEST_RETURN_VOID( cWidth == paMipLevelSizes[iMipLevelSize].width
|
---|
1284 | && cHeight == paMipLevelSizes[iMipLevelSize].height
|
---|
1285 | && cDepth == paMipLevelSizes[iMipLevelSize].depth);
|
---|
1286 | }
|
---|
1287 | }
|
---|
1288 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1289 |
|
---|
1290 | /* Create the surface. */
|
---|
1291 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
1292 | pCmd->multisampleCount, pCmd->autogenFilter,
|
---|
1293 | pCmd->face[0].numMipLevels, &paMipLevelSizes[0], /* arraySize = */ 0, /* fAllocMipLevels = */ true);
|
---|
1294 | }
|
---|
1295 |
|
---|
1296 |
|
---|
1297 | /* SVGA_3D_CMD_SET_OTABLE_BASE 1091 */
|
---|
1298 | static void vmsvga3dCmdSetOTableBase(PVGASTATECC pThisCC, SVGA3dCmdSetOTableBase const *pCmd)
|
---|
1299 | {
|
---|
1300 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1301 | vmsvgaR3OTableSetOrGrow(pSvgaR3State, pCmd->type, pCmd->baseAddress,
|
---|
1302 | pCmd->sizeInBytes, pCmd->validSizeInBytes, pCmd->ptDepth, /*fGrow*/ false);
|
---|
1303 | }
|
---|
1304 |
|
---|
1305 |
|
---|
1306 | /* SVGA_3D_CMD_DEFINE_GB_MOB 1093 */
|
---|
1307 | static void vmsvga3dCmdDefineGBMob(PVGASTATECC pThisCC, SVGA3dCmdDefineGBMob const *pCmd)
|
---|
1308 | {
|
---|
1309 | DEBUG_BREAKPOINT_TEST();
|
---|
1310 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1311 |
|
---|
1312 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
1313 |
|
---|
1314 | /* Maybe just update the OTable and create Gbo when the MOB is actually accessed? */
|
---|
1315 | /* Allocate a structure for the MOB. */
|
---|
1316 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTMemAllocZ(sizeof(*pMob));
|
---|
1317 | AssertPtrReturnVoid(pMob);
|
---|
1318 |
|
---|
1319 | int rc = vmsvgaR3MobCreate(pSvgaR3State, pCmd->ptDepth, pCmd->base, pCmd->sizeInBytes, pCmd->mobid, pMob);
|
---|
1320 | if (RT_SUCCESS(rc))
|
---|
1321 | {
|
---|
1322 | return;
|
---|
1323 | }
|
---|
1324 |
|
---|
1325 | AssertFailed();
|
---|
1326 |
|
---|
1327 | RTMemFree(pMob);
|
---|
1328 | }
|
---|
1329 |
|
---|
1330 |
|
---|
1331 | /* SVGA_3D_CMD_DESTROY_GB_MOB 1094 */
|
---|
1332 | static void vmsvga3dCmdDestroyGBMob(PVGASTATECC pThisCC, SVGA3dCmdDestroyGBMob const *pCmd)
|
---|
1333 | {
|
---|
1334 | //DEBUG_BREAKPOINT_TEST();
|
---|
1335 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1336 |
|
---|
1337 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
1338 |
|
---|
1339 | int rc = vmsvgaR3MobDestroy(pSvgaR3State, pCmd->mobid);
|
---|
1340 | if (RT_SUCCESS(rc))
|
---|
1341 | {
|
---|
1342 | return;
|
---|
1343 | }
|
---|
1344 |
|
---|
1345 | AssertFailed();
|
---|
1346 | }
|
---|
1347 |
|
---|
1348 |
|
---|
1349 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE 1097 */
|
---|
1350 | static void vmsvga3dCmdDefineGBSurface(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface const *pCmd)
|
---|
1351 | {
|
---|
1352 | //DEBUG_BREAKPOINT_TEST();
|
---|
1353 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1354 |
|
---|
1355 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
1356 | SVGAOTableSurfaceEntry entry;
|
---|
1357 | RT_ZERO(entry);
|
---|
1358 | entry.format = pCmd->format;
|
---|
1359 | entry.surface1Flags = pCmd->surfaceFlags;
|
---|
1360 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
1361 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
1362 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
1363 | entry.size = pCmd->size;
|
---|
1364 | entry.mobid = SVGA_ID_INVALID;
|
---|
1365 | // entry.arraySize = 0;
|
---|
1366 | // entry.mobPitch = 0;
|
---|
1367 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1368 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1369 | if (RT_SUCCESS(rc))
|
---|
1370 | {
|
---|
1371 | /* Create the host surface. */
|
---|
1372 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
1373 | pCmd->multisampleCount, pCmd->autogenFilter,
|
---|
1374 | pCmd->numMipLevels, &pCmd->size, /* arraySize = */ 0, /* fAllocMipLevels = */ false);
|
---|
1375 | }
|
---|
1376 | }
|
---|
1377 |
|
---|
1378 |
|
---|
1379 | /* SVGA_3D_CMD_DESTROY_GB_SURFACE 1098 */
|
---|
1380 | static void vmsvga3dCmdDestroyGBSurface(PVGASTATECC pThisCC, SVGA3dCmdDestroyGBSurface const *pCmd)
|
---|
1381 | {
|
---|
1382 | //DEBUG_BREAKPOINT_TEST();
|
---|
1383 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1384 |
|
---|
1385 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
1386 | SVGAOTableSurfaceEntry entry;
|
---|
1387 | RT_ZERO(entry);
|
---|
1388 | entry.mobid = SVGA_ID_INVALID;
|
---|
1389 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1390 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1391 |
|
---|
1392 | vmsvga3dSurfaceDestroy(pThisCC, pCmd->sid);
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 |
|
---|
1396 | /* SVGA_3D_CMD_BIND_GB_SURFACE 1099 */
|
---|
1397 | static void vmsvga3dCmdBindGBSurface(PVGASTATECC pThisCC, SVGA3dCmdBindGBSurface const *pCmd)
|
---|
1398 | {
|
---|
1399 | //DEBUG_BREAKPOINT_TEST();
|
---|
1400 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1401 |
|
---|
1402 | /* Assign the mobid to the surface. */
|
---|
1403 | int rc = VINF_SUCCESS;
|
---|
1404 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
1405 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
1406 | pCmd->mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE);
|
---|
1407 | if (RT_SUCCESS(rc))
|
---|
1408 | {
|
---|
1409 | SVGAOTableSurfaceEntry entry;
|
---|
1410 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1411 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1412 | if (RT_SUCCESS(rc))
|
---|
1413 | {
|
---|
1414 | entry.mobid = pCmd->mobid;
|
---|
1415 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1416 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1417 | if (RT_SUCCESS(rc))
|
---|
1418 | {
|
---|
1419 | /* */
|
---|
1420 | }
|
---|
1421 | }
|
---|
1422 | }
|
---|
1423 | }
|
---|
1424 |
|
---|
1425 |
|
---|
1426 | typedef union
|
---|
1427 | {
|
---|
1428 | float f;
|
---|
1429 | uint32_t u;
|
---|
1430 | } Unsigned2Float;
|
---|
1431 |
|
---|
1432 | float float16ToFloat(uint16_t f16)
|
---|
1433 | {
|
---|
1434 | /* Format specs from Wiki: [15] = sign, [14:10] = exponent, [9:0] = fraction */
|
---|
1435 | uint16_t const f = f16 & 0x3FF;
|
---|
1436 | uint16_t const e = (f16 >> 10) & 0x1F;
|
---|
1437 | uint16_t const s = (f16 >> 15) & 0x1;
|
---|
1438 | Unsigned2Float u2f;
|
---|
1439 |
|
---|
1440 | if (e == 0)
|
---|
1441 | {
|
---|
1442 | if (f == 0)
|
---|
1443 | {
|
---|
1444 | /* zero, -0 */
|
---|
1445 | u2f.u = (s << 31) | (0 << 23) | 0;
|
---|
1446 | return u2f.f;
|
---|
1447 | }
|
---|
1448 |
|
---|
1449 | /* subnormal numbers: (-1)^signbit * 2^-14 * 0.significantbits */
|
---|
1450 | float const k = 1.0f / 16384.0f; /* 2^-14 */
|
---|
1451 | return (s ? -1.0f : 1.0f) * k * (float)f / 1024.0f;
|
---|
1452 | }
|
---|
1453 |
|
---|
1454 | if (e == 31)
|
---|
1455 | {
|
---|
1456 | if (f == 0)
|
---|
1457 | {
|
---|
1458 | /* +-infinity */
|
---|
1459 | u2f.u = (s << 31) | (0xFF << 23) | 0;
|
---|
1460 | return u2f.f;
|
---|
1461 | }
|
---|
1462 |
|
---|
1463 | /* NaN */
|
---|
1464 | u2f.u = (s << 31) | (0xFF << 23) | 1;
|
---|
1465 | return u2f.f;
|
---|
1466 | }
|
---|
1467 |
|
---|
1468 | /* normalized value: (-1)^signbit * 2^(exponent - 15) * 1.significantbits */
|
---|
1469 | /* Build the float, adjusting for exponent bias (float32 bias is 127, float16 is 15)
|
---|
1470 | * and number of bits in the fraction (float32 has 23, float16 has 10). */
|
---|
1471 | u2f.u = (s << 31) | ((e + 127 - 15) << 23) | (f << (23 - 10));
|
---|
1472 | return u2f.f;
|
---|
1473 | }
|
---|
1474 |
|
---|
1475 |
|
---|
1476 | static int vmsvga3dBmpWrite(const char *pszFilename, VMSVGA3D_MAPPED_SURFACE const *pMap)
|
---|
1477 | {
|
---|
1478 | if ( pMap->cbBlock != 4 && pMap->cbBlock != 1
|
---|
1479 | && pMap->format != SVGA3D_R16G16B16A16_FLOAT
|
---|
1480 | && pMap->format != SVGA3D_R32G32B32A32_FLOAT)
|
---|
1481 | return VERR_NOT_SUPPORTED;
|
---|
1482 |
|
---|
1483 | int const w = pMap->cbRow / pMap->cbBlock;
|
---|
1484 | int const h = pMap->cRows;
|
---|
1485 |
|
---|
1486 | const int cbBitmap = pMap->cbRow * pMap->cRows * 4;
|
---|
1487 |
|
---|
1488 | FILE *f = fopen(pszFilename, "wb");
|
---|
1489 | if (!f)
|
---|
1490 | return VERR_FILE_NOT_FOUND;
|
---|
1491 |
|
---|
1492 | {
|
---|
1493 | BMPFILEHDR fileHdr;
|
---|
1494 | RT_ZERO(fileHdr);
|
---|
1495 | fileHdr.uType = BMP_HDR_MAGIC;
|
---|
1496 | fileHdr.cbFileSize = sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR) + cbBitmap;
|
---|
1497 | fileHdr.offBits = sizeof(BMPFILEHDR) + sizeof(BMPWIN3XINFOHDR);
|
---|
1498 |
|
---|
1499 | BMPWIN3XINFOHDR coreHdr;
|
---|
1500 | RT_ZERO(coreHdr);
|
---|
1501 | coreHdr.cbSize = sizeof(coreHdr);
|
---|
1502 | coreHdr.uWidth = w;
|
---|
1503 | coreHdr.uHeight = -h;
|
---|
1504 | coreHdr.cPlanes = 1;
|
---|
1505 | coreHdr.cBits = 32;
|
---|
1506 | coreHdr.cbSizeImage = cbBitmap;
|
---|
1507 |
|
---|
1508 | fwrite(&fileHdr, 1, sizeof(fileHdr), f);
|
---|
1509 | fwrite(&coreHdr, 1, sizeof(coreHdr), f);
|
---|
1510 | }
|
---|
1511 |
|
---|
1512 | if (pMap->format == SVGA3D_R16G16B16A16_FLOAT)
|
---|
1513 | {
|
---|
1514 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1515 | for (int32_t y = 0; y < h; ++y)
|
---|
1516 | {
|
---|
1517 | for (int32_t x = 0; x < w; ++x)
|
---|
1518 | {
|
---|
1519 | uint16_t const *pu16Pixel = (uint16_t *)(s + x * 8);
|
---|
1520 | uint8_t r = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[0]));
|
---|
1521 | uint8_t g = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[1]));
|
---|
1522 | uint8_t b = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[2]));
|
---|
1523 | uint8_t a = (uint8_t)(255.0 * float16ToFloat(pu16Pixel[3]));
|
---|
1524 | uint32_t u32Pixel = b + (g << 8) + (r << 16) + (a << 24);
|
---|
1525 | fwrite(&u32Pixel, 1, 4, f);
|
---|
1526 | }
|
---|
1527 |
|
---|
1528 | s += pMap->cbRowPitch;
|
---|
1529 | }
|
---|
1530 | }
|
---|
1531 | else if (pMap->format == SVGA3D_R32G32B32A32_FLOAT)
|
---|
1532 | {
|
---|
1533 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1534 | for (int32_t y = 0; y < h; ++y)
|
---|
1535 | {
|
---|
1536 | for (int32_t x = 0; x < w; ++x)
|
---|
1537 | {
|
---|
1538 | float const *pPixel = (float *)(s + x * 8);
|
---|
1539 | uint8_t r = (uint8_t)(255.0 * pPixel[0]);
|
---|
1540 | uint8_t g = (uint8_t)(255.0 * pPixel[1]);
|
---|
1541 | uint8_t b = (uint8_t)(255.0 * pPixel[2]);
|
---|
1542 | uint8_t a = (uint8_t)(255.0 * pPixel[3]);
|
---|
1543 | uint32_t u32Pixel = b + (g << 8) + (r << 16) + (a << 24);
|
---|
1544 | fwrite(&u32Pixel, 1, 4, f);
|
---|
1545 | }
|
---|
1546 |
|
---|
1547 | s += pMap->cbRowPitch;
|
---|
1548 | }
|
---|
1549 | }
|
---|
1550 | else if (pMap->cbBlock == 4)
|
---|
1551 | {
|
---|
1552 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1553 | for (uint32_t iRow = 0; iRow < pMap->cRows; ++iRow)
|
---|
1554 | {
|
---|
1555 | fwrite(s, 1, pMap->cbRow, f);
|
---|
1556 |
|
---|
1557 | s += pMap->cbRowPitch;
|
---|
1558 | }
|
---|
1559 | }
|
---|
1560 | else if (pMap->cbBlock == 1)
|
---|
1561 | {
|
---|
1562 | const uint8_t *s = (uint8_t *)pMap->pvData;
|
---|
1563 | for (uint32_t iRow = 0; iRow < pMap->cRows; ++iRow)
|
---|
1564 | {
|
---|
1565 | for (int32_t x = 0; x < w; ++x)
|
---|
1566 | {
|
---|
1567 | uint32_t u32Pixel = s[x];
|
---|
1568 | fwrite(&u32Pixel, 1, 4, f);
|
---|
1569 | }
|
---|
1570 |
|
---|
1571 | s += pMap->cbRowPitch;
|
---|
1572 | }
|
---|
1573 | }
|
---|
1574 |
|
---|
1575 | fclose(f);
|
---|
1576 |
|
---|
1577 | return VINF_SUCCESS;
|
---|
1578 | }
|
---|
1579 |
|
---|
1580 |
|
---|
1581 | void vmsvga3dMapWriteBmpFile(VMSVGA3D_MAPPED_SURFACE const *pMap, char const *pszPrefix)
|
---|
1582 | {
|
---|
1583 | static int idxBitmap = 0;
|
---|
1584 | char *pszFilename = RTStrAPrintf2("bmp\\%s%d.bmp", pszPrefix, idxBitmap++);
|
---|
1585 | int rc = vmsvga3dBmpWrite(pszFilename, pMap);
|
---|
1586 | Log(("WriteBmpFile %s format %d %Rrc\n", pszFilename, pMap->format, rc)); RT_NOREF(rc);
|
---|
1587 | RTStrFree(pszFilename);
|
---|
1588 | }
|
---|
1589 |
|
---|
1590 |
|
---|
1591 | static int vmsvgaR3TransferSurfaceLevel(PVGASTATECC pThisCC,
|
---|
1592 | PVMSVGAMOB pMob,
|
---|
1593 | SVGA3dSurfaceImageId const *pImage,
|
---|
1594 | SVGA3dBox const *pBox,
|
---|
1595 | SVGA3dTransferType enmTransfer)
|
---|
1596 | {
|
---|
1597 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1598 |
|
---|
1599 | VMSVGA3D_SURFACE_MAP enmMapType;
|
---|
1600 | if (enmTransfer == SVGA3D_WRITE_HOST_VRAM)
|
---|
1601 | enmMapType = pBox
|
---|
1602 | ? VMSVGA3D_SURFACE_MAP_WRITE
|
---|
1603 | : VMSVGA3D_SURFACE_MAP_WRITE_DISCARD;
|
---|
1604 | else if (enmTransfer == SVGA3D_READ_HOST_VRAM)
|
---|
1605 | enmMapType = VMSVGA3D_SURFACE_MAP_READ;
|
---|
1606 | else
|
---|
1607 | AssertFailedReturn(VERR_INVALID_PARAMETER);
|
---|
1608 |
|
---|
1609 | VMSVGA3D_MAPPED_SURFACE map;
|
---|
1610 | int rc = vmsvga3dSurfaceMap(pThisCC, pImage, pBox, enmMapType, &map);
|
---|
1611 | if (RT_SUCCESS(rc))
|
---|
1612 | {
|
---|
1613 | /* Copy mapped surface <-> MOB. */
|
---|
1614 | VMSGA3D_BOX_DIMENSIONS dims;
|
---|
1615 | rc = vmsvga3dGetBoxDimensions(pThisCC, pImage, pBox, &dims);
|
---|
1616 | if (RT_SUCCESS(rc))
|
---|
1617 | {
|
---|
1618 | for (uint32_t z = 0; z < map.box.d; ++z)
|
---|
1619 | {
|
---|
1620 | uint8_t *pu8Map = (uint8_t *)map.pvData + z * map.cbDepthPitch;
|
---|
1621 | uint32_t offMob = dims.offSubresource + dims.offBox + z * dims.cbDepthPitch;
|
---|
1622 |
|
---|
1623 | for (uint32_t iRow = 0; iRow < map.cRows; ++iRow)
|
---|
1624 | {
|
---|
1625 | if (enmTransfer == SVGA3D_READ_HOST_VRAM)
|
---|
1626 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, offMob, pu8Map, dims.cbRow);
|
---|
1627 | else
|
---|
1628 | rc = vmsvgaR3GboRead(pSvgaR3State, &pMob->Gbo, offMob, pu8Map, dims.cbRow);
|
---|
1629 | AssertRCBreak(rc);
|
---|
1630 |
|
---|
1631 | pu8Map += map.cbRowPitch;
|
---|
1632 | offMob += dims.cbPitch;
|
---|
1633 | }
|
---|
1634 | }
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | // vmsvga3dMapWriteBmpFile(&map, "Dynamic");
|
---|
1638 |
|
---|
1639 | bool const fWritten = (enmTransfer == SVGA3D_WRITE_HOST_VRAM);
|
---|
1640 | vmsvga3dSurfaceUnmap(pThisCC, pImage, &map, fWritten);
|
---|
1641 | }
|
---|
1642 |
|
---|
1643 | return rc;
|
---|
1644 | }
|
---|
1645 |
|
---|
1646 |
|
---|
1647 | /* SVGA_3D_CMD_UPDATE_GB_IMAGE 1101 */
|
---|
1648 | static void vmsvga3dCmdUpdateGBImage(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBImage const *pCmd)
|
---|
1649 | {
|
---|
1650 | //DEBUG_BREAKPOINT_TEST();
|
---|
1651 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1652 |
|
---|
1653 | LogFlowFunc(("sid=%u @%u,%u,%u %ux%ux%u\n",
|
---|
1654 | pCmd->image.sid, pCmd->box.x, pCmd->box.y, pCmd->box.z, pCmd->box.w, pCmd->box.h, pCmd->box.d));
|
---|
1655 |
|
---|
1656 | /*
|
---|
1657 | SVGA3dSurfaceFormat format;
|
---|
1658 | SVGA3dSurface1Flags surface1Flags;
|
---|
1659 | uint32 numMipLevels;
|
---|
1660 | uint32 multisampleCount;
|
---|
1661 | SVGA3dTextureFilter autogenFilter;
|
---|
1662 | SVGA3dSize size;
|
---|
1663 | SVGAMobId mobid;
|
---|
1664 | uint32 arraySize;
|
---|
1665 | uint32 mobPitch;
|
---|
1666 | SVGA3dSurface2Flags surface2Flags;
|
---|
1667 | uint8 multisamplePattern;
|
---|
1668 | uint8 qualityLevel;
|
---|
1669 | uint16 bufferByteStride;
|
---|
1670 | float minLOD;
|
---|
1671 | */
|
---|
1672 |
|
---|
1673 | /* "update a surface from its backing MOB." */
|
---|
1674 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1675 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1676 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1677 | if (RT_SUCCESS(rc))
|
---|
1678 | {
|
---|
1679 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1680 | if (pMob)
|
---|
1681 | {
|
---|
1682 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &pCmd->image, &pCmd->box, SVGA3D_WRITE_HOST_VRAM);
|
---|
1683 | AssertRC(rc);
|
---|
1684 | }
|
---|
1685 | }
|
---|
1686 | }
|
---|
1687 |
|
---|
1688 |
|
---|
1689 | /* SVGA_3D_CMD_UPDATE_GB_SURFACE 1102 */
|
---|
1690 | static void vmsvga3dCmdUpdateGBSurface(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBSurface const *pCmd)
|
---|
1691 | {
|
---|
1692 | //DEBUG_BREAKPOINT_TEST();
|
---|
1693 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1694 |
|
---|
1695 | LogFlowFunc(("sid=%u\n",
|
---|
1696 | pCmd->sid));
|
---|
1697 |
|
---|
1698 | /* "update a surface from its backing MOB." */
|
---|
1699 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1700 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1701 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1702 | if (RT_SUCCESS(rc))
|
---|
1703 | {
|
---|
1704 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1705 | if (pMob)
|
---|
1706 | {
|
---|
1707 | uint32 const arraySize = vmsvga3dGetArrayElements(pThisCC, pCmd->sid);
|
---|
1708 | for (uint32_t iArray = 0; iArray < arraySize; ++iArray)
|
---|
1709 | {
|
---|
1710 | for (uint32_t iMipmap = 0; iMipmap < entrySurface.numMipLevels; ++iMipmap)
|
---|
1711 | {
|
---|
1712 | SVGA3dSurfaceImageId image;
|
---|
1713 | image.sid = pCmd->sid;
|
---|
1714 | image.face = iArray;
|
---|
1715 | image.mipmap = iMipmap;
|
---|
1716 |
|
---|
1717 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_WRITE_HOST_VRAM);
|
---|
1718 | AssertRCBreak(rc);
|
---|
1719 | }
|
---|
1720 | }
|
---|
1721 | }
|
---|
1722 | }
|
---|
1723 | }
|
---|
1724 |
|
---|
1725 |
|
---|
1726 | /* SVGA_3D_CMD_READBACK_GB_IMAGE 1103 */
|
---|
1727 | static void vmsvga3dCmdReadbackGBImage(PVGASTATECC pThisCC, SVGA3dCmdReadbackGBImage const *pCmd)
|
---|
1728 | {
|
---|
1729 | //DEBUG_BREAKPOINT_TEST();
|
---|
1730 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1731 |
|
---|
1732 | LogFlowFunc(("sid=%u, face=%u, mipmap=%u\n",
|
---|
1733 | pCmd->image.sid, pCmd->image.face, pCmd->image.mipmap));
|
---|
1734 |
|
---|
1735 | /* Read a surface to its backing MOB. */
|
---|
1736 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1737 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1738 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1739 | if (RT_SUCCESS(rc))
|
---|
1740 | {
|
---|
1741 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1742 | if (pMob)
|
---|
1743 | {
|
---|
1744 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &pCmd->image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
1745 | AssertRC(rc);
|
---|
1746 | }
|
---|
1747 | }
|
---|
1748 | }
|
---|
1749 |
|
---|
1750 |
|
---|
1751 | /* SVGA_3D_CMD_READBACK_GB_SURFACE 1104 */
|
---|
1752 | static void vmsvga3dCmdReadbackGBSurface(PVGASTATECC pThisCC, SVGA3dCmdReadbackGBSurface const *pCmd)
|
---|
1753 | {
|
---|
1754 | //DEBUG_BREAKPOINT_TEST();
|
---|
1755 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1756 |
|
---|
1757 | LogFlowFunc(("sid=%u\n",
|
---|
1758 | pCmd->sid));
|
---|
1759 |
|
---|
1760 | /* Read a surface to its backing MOB. */
|
---|
1761 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1762 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1763 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1764 | if (RT_SUCCESS(rc))
|
---|
1765 | {
|
---|
1766 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
1767 | if (pMob)
|
---|
1768 | {
|
---|
1769 | uint32 const arraySize = vmsvga3dGetArrayElements(pThisCC, pCmd->sid);
|
---|
1770 | for (uint32_t iArray = 0; iArray < arraySize; ++iArray)
|
---|
1771 | {
|
---|
1772 | for (uint32_t iMipmap = 0; iMipmap < entrySurface.numMipLevels; ++iMipmap)
|
---|
1773 | {
|
---|
1774 | SVGA3dSurfaceImageId image;
|
---|
1775 | image.sid = pCmd->sid;
|
---|
1776 | image.face = iArray;
|
---|
1777 | image.mipmap = iMipmap;
|
---|
1778 |
|
---|
1779 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
1780 | AssertRCBreak(rc);
|
---|
1781 | }
|
---|
1782 | }
|
---|
1783 | }
|
---|
1784 | }
|
---|
1785 | }
|
---|
1786 |
|
---|
1787 |
|
---|
1788 | /* SVGA_3D_CMD_INVALIDATE_GB_IMAGE 1105 */
|
---|
1789 | static void vmsvga3dCmdInvalidateGBImage(PVGASTATECC pThisCC, SVGA3dCmdInvalidateGBImage const *pCmd)
|
---|
1790 | {
|
---|
1791 | //DEBUG_BREAKPOINT_TEST();
|
---|
1792 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->image.sid, pCmd->image.face, pCmd->image.mipmap);
|
---|
1793 | }
|
---|
1794 |
|
---|
1795 |
|
---|
1796 | /* SVGA_3D_CMD_INVALIDATE_GB_SURFACE 1106 */
|
---|
1797 | static void vmsvga3dCmdInvalidateGBSurface(PVGASTATECC pThisCC, SVGA3dCmdInvalidateGBSurface const *pCmd)
|
---|
1798 | {
|
---|
1799 | //DEBUG_BREAKPOINT_TEST();
|
---|
1800 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->sid, SVGA_ID_INVALID, SVGA_ID_INVALID);
|
---|
1801 | }
|
---|
1802 |
|
---|
1803 |
|
---|
1804 | /* SVGA_3D_CMD_SET_OTABLE_BASE64 1115 */
|
---|
1805 | static void vmsvga3dCmdSetOTableBase64(PVGASTATECC pThisCC, SVGA3dCmdSetOTableBase64 const *pCmd)
|
---|
1806 | {
|
---|
1807 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1808 | vmsvgaR3OTableSetOrGrow(pSvgaR3State, pCmd->type, pCmd->baseAddress,
|
---|
1809 | pCmd->sizeInBytes, pCmd->validSizeInBytes, pCmd->ptDepth, /*fGrow*/ false);
|
---|
1810 | }
|
---|
1811 |
|
---|
1812 |
|
---|
1813 | /* SVGA_3D_CMD_DEFINE_GB_SCREENTARGET 1124 */
|
---|
1814 | static void vmsvga3dCmdDefineGBScreenTarget(PVGASTATE pThis, PVGASTATECC pThisCC, SVGA3dCmdDefineGBScreenTarget const *pCmd)
|
---|
1815 | {
|
---|
1816 | //DEBUG_BREAKPOINT_TEST();
|
---|
1817 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1818 |
|
---|
1819 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1820 | ASSERT_GUEST_RETURN_VOID(pCmd->width > 0 && pCmd->width <= pThis->svga.u32MaxWidth); /* SVGA_REG_SCREENTARGET_MAX_WIDTH */
|
---|
1821 | ASSERT_GUEST_RETURN_VOID(pCmd->height > 0 && pCmd->height <= pThis->svga.u32MaxHeight); /* SVGA_REG_SCREENTARGET_MAX_HEIGHT */
|
---|
1822 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1823 |
|
---|
1824 | /* Update the entry in the pSvgaR3State->pGboOTableScreenTarget. */
|
---|
1825 | SVGAOTableScreenTargetEntry entry;
|
---|
1826 | RT_ZERO(entry);
|
---|
1827 | entry.image.sid = SVGA_ID_INVALID;
|
---|
1828 | // entry.image.face = 0;
|
---|
1829 | // entry.image.mipmap = 0;
|
---|
1830 | entry.width = pCmd->width;
|
---|
1831 | entry.height = pCmd->height;
|
---|
1832 | entry.xRoot = pCmd->xRoot;
|
---|
1833 | entry.yRoot = pCmd->yRoot;
|
---|
1834 | entry.flags = pCmd->flags;
|
---|
1835 | entry.dpi = pCmd->dpi;
|
---|
1836 |
|
---|
1837 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1838 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1839 | if (RT_SUCCESS(rc))
|
---|
1840 | {
|
---|
1841 | /* Screen objects and screen targets are similar, therefore we will use the same for both. */
|
---|
1842 | /** @todo Generic screen object/target interface. */
|
---|
1843 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1844 | pScreen->fDefined = true;
|
---|
1845 | pScreen->fModified = true;
|
---|
1846 | pScreen->fuScreen = SVGA_SCREEN_MUST_BE_SET
|
---|
1847 | | (RT_BOOL(pCmd->flags & SVGA_STFLAG_PRIMARY) ? SVGA_SCREEN_IS_PRIMARY : 0);
|
---|
1848 | pScreen->idScreen = pCmd->stid;
|
---|
1849 |
|
---|
1850 | pScreen->xOrigin = pCmd->xRoot;
|
---|
1851 | pScreen->yOrigin = pCmd->yRoot;
|
---|
1852 | pScreen->cWidth = pCmd->width;
|
---|
1853 | pScreen->cHeight = pCmd->height;
|
---|
1854 | pScreen->offVRAM = 0; /* Not applicable for screen targets, they use either a separate memory buffer or a host window. */
|
---|
1855 | pScreen->cbPitch = pCmd->width * 4;
|
---|
1856 | pScreen->cBpp = 32;
|
---|
1857 |
|
---|
1858 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
1859 | vmsvga3dDefineScreen(pThis, pThisCC, pScreen);
|
---|
1860 |
|
---|
1861 | if (!pScreen->pHwScreen)
|
---|
1862 | {
|
---|
1863 | /* System memory buffer. */
|
---|
1864 | pScreen->pvScreenBitmap = RTMemAllocZ(pScreen->cHeight * pScreen->cbPitch);
|
---|
1865 | }
|
---|
1866 |
|
---|
1867 | pThis->svga.fGFBRegisters = false;
|
---|
1868 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
1869 | }
|
---|
1870 | }
|
---|
1871 |
|
---|
1872 |
|
---|
1873 | /* SVGA_3D_CMD_DESTROY_GB_SCREENTARGET 1125 */
|
---|
1874 | static void vmsvga3dCmdDestroyGBScreenTarget(PVGASTATE pThis, PVGASTATECC pThisCC, SVGA3dCmdDestroyGBScreenTarget const *pCmd)
|
---|
1875 | {
|
---|
1876 | //DEBUG_BREAKPOINT_TEST();
|
---|
1877 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1878 |
|
---|
1879 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1880 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1881 |
|
---|
1882 | /* Update the entry in the pSvgaR3State->pGboOTableScreenTarget. */
|
---|
1883 | SVGAOTableScreenTargetEntry entry;
|
---|
1884 | RT_ZERO(entry);
|
---|
1885 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1886 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1887 | if (RT_SUCCESS(rc))
|
---|
1888 | {
|
---|
1889 | /* Screen objects and screen targets are similar, therefore we will use the same for both. */
|
---|
1890 | /** @todo Generic screen object/target interface. */
|
---|
1891 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1892 | pScreen->fModified = true;
|
---|
1893 | pScreen->fDefined = false;
|
---|
1894 | pScreen->idScreen = pCmd->stid;
|
---|
1895 |
|
---|
1896 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
1897 | vmsvga3dDestroyScreen(pThisCC, pScreen);
|
---|
1898 |
|
---|
1899 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
1900 |
|
---|
1901 | RTMemFree(pScreen->pvScreenBitmap);
|
---|
1902 | pScreen->pvScreenBitmap = NULL;
|
---|
1903 | }
|
---|
1904 | }
|
---|
1905 |
|
---|
1906 |
|
---|
1907 | /* SVGA_3D_CMD_BIND_GB_SCREENTARGET 1126 */
|
---|
1908 | static void vmsvga3dCmdBindGBScreenTarget(PVGASTATECC pThisCC, SVGA3dCmdBindGBScreenTarget const *pCmd)
|
---|
1909 | {
|
---|
1910 | //DEBUG_BREAKPOINT_TEST();
|
---|
1911 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1912 |
|
---|
1913 | /* "Binding a surface to a Screen Target the same as flipping" */
|
---|
1914 |
|
---|
1915 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1916 | ASSERT_GUEST_RETURN_VOID(pCmd->image.face == 0 && pCmd->image.mipmap == 0);
|
---|
1917 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1918 |
|
---|
1919 | /* Assign the surface to the screen target. */
|
---|
1920 | int rc = VINF_SUCCESS;
|
---|
1921 | if (pCmd->image.sid != SVGA_ID_INVALID)
|
---|
1922 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1923 | pCmd->image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE);
|
---|
1924 | if (RT_SUCCESS(rc))
|
---|
1925 | {
|
---|
1926 | SVGAOTableScreenTargetEntry entry;
|
---|
1927 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1928 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1929 | if (RT_SUCCESS(rc))
|
---|
1930 | {
|
---|
1931 | entry.image = pCmd->image;
|
---|
1932 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1933 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
1934 | if (RT_SUCCESS(rc))
|
---|
1935 | {
|
---|
1936 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1937 | rc = pSvgaR3State->pFuncsGBO->pfnScreenTargetBind(pThisCC, pScreen, pCmd->image.sid);
|
---|
1938 | AssertRC(rc);
|
---|
1939 | }
|
---|
1940 | }
|
---|
1941 | }
|
---|
1942 | }
|
---|
1943 |
|
---|
1944 |
|
---|
1945 | /* SVGA_3D_CMD_UPDATE_GB_SCREENTARGET 1127 */
|
---|
1946 | static void vmsvga3dCmdUpdateGBScreenTarget(PVGASTATECC pThisCC, SVGA3dCmdUpdateGBScreenTarget const *pCmd)
|
---|
1947 | {
|
---|
1948 | //DEBUG_BREAKPOINT_TEST();
|
---|
1949 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
1950 |
|
---|
1951 | /* Update the screen target from its backing surface. */
|
---|
1952 | ASSERT_GUEST_RETURN_VOID(pCmd->stid < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
1953 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1954 |
|
---|
1955 | /* Get the screen target info. */
|
---|
1956 | SVGAOTableScreenTargetEntry entryScreenTarget;
|
---|
1957 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SCREENTARGET],
|
---|
1958 | pCmd->stid, SVGA3D_OTABLE_SCREEN_TARGET_ENTRY_SIZE, &entryScreenTarget, sizeof(entryScreenTarget));
|
---|
1959 | if (RT_SUCCESS(rc))
|
---|
1960 | {
|
---|
1961 | ASSERT_GUEST_RETURN_VOID(entryScreenTarget.image.face == 0 && entryScreenTarget.image.mipmap == 0);
|
---|
1962 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1963 |
|
---|
1964 | if (entryScreenTarget.image.sid != SVGA_ID_INVALID)
|
---|
1965 | {
|
---|
1966 | SVGAOTableSurfaceEntry entrySurface;
|
---|
1967 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
1968 | entryScreenTarget.image.sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
1969 | if (RT_SUCCESS(rc))
|
---|
1970 | {
|
---|
1971 | /* Copy entrySurface.mobid content to the screen target. */
|
---|
1972 | if (entrySurface.mobid != SVGA_ID_INVALID)
|
---|
1973 | {
|
---|
1974 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
1975 | SVGA3dRect targetRect = pCmd->rect;
|
---|
1976 |
|
---|
1977 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[pCmd->stid];
|
---|
1978 | if (pScreen->pHwScreen)
|
---|
1979 | {
|
---|
1980 | /* Copy the screen target surface to the backend's screen. */
|
---|
1981 | pSvgaR3State->pFuncsGBO->pfnScreenTargetUpdate(pThisCC, pScreen, &targetRect);
|
---|
1982 | }
|
---|
1983 | else
|
---|
1984 | {
|
---|
1985 | SVGASignedRect r;
|
---|
1986 | r.left = pCmd->rect.x;
|
---|
1987 | r.top = pCmd->rect.y;
|
---|
1988 | r.right = pCmd->rect.x + pCmd->rect.w;
|
---|
1989 | r.bottom = pCmd->rect.y + pCmd->rect.h;
|
---|
1990 | vmsvga3dScreenUpdate(pThisCC, pCmd->stid, r, entryScreenTarget.image, r, 0, NULL);
|
---|
1991 | }
|
---|
1992 | }
|
---|
1993 | }
|
---|
1994 | }
|
---|
1995 | }
|
---|
1996 | }
|
---|
1997 |
|
---|
1998 |
|
---|
1999 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V2 1134 */
|
---|
2000 | static void vmsvga3dCmdDefineGBSurface_v2(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface_v2 const *pCmd)
|
---|
2001 | {
|
---|
2002 | //DEBUG_BREAKPOINT_TEST();
|
---|
2003 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2004 |
|
---|
2005 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
2006 | SVGAOTableSurfaceEntry entry;
|
---|
2007 | RT_ZERO(entry);
|
---|
2008 | entry.format = pCmd->format;
|
---|
2009 | entry.surface1Flags = pCmd->surfaceFlags;
|
---|
2010 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
2011 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
2012 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
2013 | entry.size = pCmd->size;
|
---|
2014 | entry.mobid = SVGA_ID_INVALID;
|
---|
2015 | entry.arraySize = pCmd->arraySize;
|
---|
2016 | // entry.mobPitch = 0;
|
---|
2017 | // entry.mobPitch = 0;
|
---|
2018 | // entry.surface2Flags = 0;
|
---|
2019 | // entry.multisamplePattern = 0;
|
---|
2020 | // entry.qualityLevel = 0;
|
---|
2021 | // entry.bufferByteStride = 0;
|
---|
2022 | // entry.minLOD = 0;
|
---|
2023 |
|
---|
2024 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2025 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
2026 | if (RT_SUCCESS(rc))
|
---|
2027 | {
|
---|
2028 | /* Create the host surface. */
|
---|
2029 | /** @todo SVGAOTableSurfaceEntry as input parameter? */
|
---|
2030 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
2031 | pCmd->multisampleCount, pCmd->autogenFilter,
|
---|
2032 | pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* fAllocMipLevels = */ false);
|
---|
2033 | }
|
---|
2034 | }
|
---|
2035 |
|
---|
2036 |
|
---|
2037 | /* SVGA_3D_CMD_DEFINE_GB_MOB64 1135 */
|
---|
2038 | static void vmsvga3dCmdDefineGBMob64(PVGASTATECC pThisCC, SVGA3dCmdDefineGBMob64 const *pCmd)
|
---|
2039 | {
|
---|
2040 | //DEBUG_BREAKPOINT_TEST();
|
---|
2041 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2042 |
|
---|
2043 | ASSERT_GUEST_RETURN_VOID(pCmd->mobid != SVGA_ID_INVALID); /* The guest should not use this id. */
|
---|
2044 |
|
---|
2045 | /* Maybe just update the OTable and create Gbo when the MOB is actually accessed? */
|
---|
2046 | /* Allocate a structure for the MOB. */
|
---|
2047 | PVMSVGAMOB pMob = (PVMSVGAMOB)RTMemAllocZ(sizeof(*pMob));
|
---|
2048 | AssertPtrReturnVoid(pMob);
|
---|
2049 |
|
---|
2050 | int rc = vmsvgaR3MobCreate(pSvgaR3State, pCmd->ptDepth, pCmd->base, pCmd->sizeInBytes, pCmd->mobid, pMob);
|
---|
2051 | if (RT_SUCCESS(rc))
|
---|
2052 | {
|
---|
2053 | return;
|
---|
2054 | }
|
---|
2055 |
|
---|
2056 | RTMemFree(pMob);
|
---|
2057 | }
|
---|
2058 |
|
---|
2059 |
|
---|
2060 | /* SVGA_3D_CMD_DX_DEFINE_CONTEXT 1143 */
|
---|
2061 | static int vmsvga3dCmdDXDefineContext(PVGASTATECC pThisCC, SVGA3dCmdDXDefineContext const *pCmd, uint32_t cbCmd)
|
---|
2062 | {
|
---|
2063 | #ifdef VMSVGA3D_DX
|
---|
2064 | //DEBUG_BREAKPOINT_TEST();
|
---|
2065 | RT_NOREF(cbCmd);
|
---|
2066 |
|
---|
2067 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2068 |
|
---|
2069 | /* Update the entry in the pSvgaR3State->pGboOTable[SVGA_OTABLE_DXCONTEXT]. */
|
---|
2070 | SVGAOTableDXContextEntry entry;
|
---|
2071 | RT_ZERO(entry);
|
---|
2072 | entry.cid = pCmd->cid;
|
---|
2073 | entry.mobid = SVGA_ID_INVALID;
|
---|
2074 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2075 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2076 | if (RT_SUCCESS(rc))
|
---|
2077 | {
|
---|
2078 | /* Create the host context. */
|
---|
2079 | rc = vmsvga3dDXDefineContext(pThisCC, pCmd->cid);
|
---|
2080 | }
|
---|
2081 |
|
---|
2082 | return rc;
|
---|
2083 | #else
|
---|
2084 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2085 | return VERR_NOT_SUPPORTED;
|
---|
2086 | #endif
|
---|
2087 | }
|
---|
2088 |
|
---|
2089 |
|
---|
2090 | /* SVGA_3D_CMD_DX_DESTROY_CONTEXT 1144 */
|
---|
2091 | static int vmsvga3dCmdDXDestroyContext(PVGASTATECC pThisCC, SVGA3dCmdDXDestroyContext const *pCmd, uint32_t cbCmd)
|
---|
2092 | {
|
---|
2093 | #ifdef VMSVGA3D_DX
|
---|
2094 | //DEBUG_BREAKPOINT_TEST();
|
---|
2095 | RT_NOREF(cbCmd);
|
---|
2096 |
|
---|
2097 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2098 |
|
---|
2099 | /* Update the entry in the pSvgaR3State->pGboOTable[SVGA_OTABLE_DXCONTEXT]. */
|
---|
2100 | SVGAOTableDXContextEntry entry;
|
---|
2101 | RT_ZERO(entry);
|
---|
2102 | vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2103 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2104 |
|
---|
2105 | return vmsvga3dDXDestroyContext(pThisCC, pCmd->cid);
|
---|
2106 | #else
|
---|
2107 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2108 | return VERR_NOT_SUPPORTED;
|
---|
2109 | #endif
|
---|
2110 | }
|
---|
2111 |
|
---|
2112 |
|
---|
2113 | /* SVGA_3D_CMD_DX_BIND_CONTEXT 1145 */
|
---|
2114 | static int vmsvga3dCmdDXBindContext(PVGASTATECC pThisCC, SVGA3dCmdDXBindContext const *pCmd, uint32_t cbCmd)
|
---|
2115 | {
|
---|
2116 | #ifdef VMSVGA3D_DX
|
---|
2117 | //DEBUG_BREAKPOINT_TEST();
|
---|
2118 | RT_NOREF(cbCmd);
|
---|
2119 |
|
---|
2120 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2121 |
|
---|
2122 | /* Assign a mobid to a cid. */
|
---|
2123 | int rc = VINF_SUCCESS;
|
---|
2124 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
2125 | rc = vmsvgaR3OTableVerifyIndex(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_MOB],
|
---|
2126 | pCmd->mobid, SVGA3D_OTABLE_MOB_ENTRY_SIZE);
|
---|
2127 | if (RT_SUCCESS(rc))
|
---|
2128 | {
|
---|
2129 | SVGAOTableDXContextEntry entry;
|
---|
2130 | rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2131 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2132 | if (RT_SUCCESS(rc))
|
---|
2133 | {
|
---|
2134 | SVGADXContextMobFormat *pSvgaDXContext = NULL;
|
---|
2135 | if (pCmd->mobid != entry.mobid && entry.mobid != SVGA_ID_INVALID)
|
---|
2136 | {
|
---|
2137 | /* Unbind notification to the DX backend. Copy the context data to the guest backing memory. */
|
---|
2138 | pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2139 | if (pSvgaDXContext)
|
---|
2140 | {
|
---|
2141 | rc = vmsvga3dDXUnbindContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2142 | if (RT_SUCCESS(rc))
|
---|
2143 | {
|
---|
2144 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entry.mobid);
|
---|
2145 | if (pMob)
|
---|
2146 | {
|
---|
2147 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2148 | }
|
---|
2149 | }
|
---|
2150 |
|
---|
2151 | RTMemFree(pSvgaDXContext);
|
---|
2152 | pSvgaDXContext = NULL;
|
---|
2153 | }
|
---|
2154 | }
|
---|
2155 |
|
---|
2156 | if (pCmd->mobid != SVGA_ID_INVALID)
|
---|
2157 | {
|
---|
2158 | /* Bind a new context. Copy existing data from the guest backing memory. */
|
---|
2159 | if (pCmd->validContents)
|
---|
2160 | {
|
---|
2161 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
2162 | if (pMob)
|
---|
2163 | {
|
---|
2164 | pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2165 | if (pSvgaDXContext)
|
---|
2166 | {
|
---|
2167 | rc = vmsvgaR3GboRead(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2168 | if (RT_FAILURE(rc))
|
---|
2169 | {
|
---|
2170 | RTMemFree(pSvgaDXContext);
|
---|
2171 | pSvgaDXContext = NULL;
|
---|
2172 | }
|
---|
2173 | }
|
---|
2174 | }
|
---|
2175 | }
|
---|
2176 |
|
---|
2177 | rc = vmsvga3dDXBindContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2178 |
|
---|
2179 | RTMemFree(pSvgaDXContext);
|
---|
2180 | }
|
---|
2181 |
|
---|
2182 | /* Update the object table. */
|
---|
2183 | entry.mobid = pCmd->mobid;
|
---|
2184 | rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2185 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2186 | }
|
---|
2187 | }
|
---|
2188 |
|
---|
2189 | return rc;
|
---|
2190 | #else
|
---|
2191 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2192 | return VERR_NOT_SUPPORTED;
|
---|
2193 | #endif
|
---|
2194 | }
|
---|
2195 |
|
---|
2196 |
|
---|
2197 | /* SVGA_3D_CMD_DX_READBACK_CONTEXT 1146 */
|
---|
2198 | static int vmsvga3dCmdDXReadbackContext(PVGASTATECC pThisCC, SVGA3dCmdDXReadbackContext const *pCmd, uint32_t cbCmd)
|
---|
2199 | {
|
---|
2200 | #ifdef VMSVGA3D_DX
|
---|
2201 | //DEBUG_BREAKPOINT_TEST();
|
---|
2202 | RT_NOREF(cbCmd);
|
---|
2203 |
|
---|
2204 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2205 |
|
---|
2206 | /* "Request that the device flush the contents back into guest memory." */
|
---|
2207 | SVGAOTableDXContextEntry entry;
|
---|
2208 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_DXCONTEXT],
|
---|
2209 | pCmd->cid, sizeof(SVGAOTableDXContextEntry), &entry, sizeof(entry));
|
---|
2210 | if (RT_SUCCESS(rc))
|
---|
2211 | {
|
---|
2212 | if (entry.mobid != SVGA_ID_INVALID)
|
---|
2213 | {
|
---|
2214 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entry.mobid);
|
---|
2215 | if (pMob)
|
---|
2216 | {
|
---|
2217 | /* Get the content. */
|
---|
2218 | SVGADXContextMobFormat *pSvgaDXContext = (SVGADXContextMobFormat *)RTMemAlloc(sizeof(SVGADXContextMobFormat));
|
---|
2219 | if (pSvgaDXContext)
|
---|
2220 | {
|
---|
2221 | rc = vmsvga3dDXReadbackContext(pThisCC, pCmd->cid, pSvgaDXContext);
|
---|
2222 | if (RT_SUCCESS(rc))
|
---|
2223 | rc = vmsvgaR3GboWrite(pSvgaR3State, &pMob->Gbo, 0, pSvgaDXContext, sizeof(SVGADXContextMobFormat));
|
---|
2224 |
|
---|
2225 | RTMemFree(pSvgaDXContext);
|
---|
2226 | }
|
---|
2227 | else
|
---|
2228 | rc = VERR_NO_MEMORY;
|
---|
2229 | }
|
---|
2230 | }
|
---|
2231 | }
|
---|
2232 |
|
---|
2233 | return rc;
|
---|
2234 | #else
|
---|
2235 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2236 | return VERR_NOT_SUPPORTED;
|
---|
2237 | #endif
|
---|
2238 | }
|
---|
2239 |
|
---|
2240 |
|
---|
2241 | /* SVGA_3D_CMD_DX_INVALIDATE_CONTEXT 1147 */
|
---|
2242 | static int vmsvga3dCmdDXInvalidateContext(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXInvalidateContext const *pCmd, uint32_t cbCmd)
|
---|
2243 | {
|
---|
2244 | #ifdef VMSVGA3D_DX
|
---|
2245 | DEBUG_BREAKPOINT_TEST();
|
---|
2246 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2247 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
2248 | return vmsvga3dDXInvalidateContext(pThisCC, idDXContext);
|
---|
2249 | #else
|
---|
2250 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2251 | return VERR_NOT_SUPPORTED;
|
---|
2252 | #endif
|
---|
2253 | }
|
---|
2254 |
|
---|
2255 |
|
---|
2256 | /* SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER 1148 */
|
---|
2257 | static int vmsvga3dCmdDXSetSingleConstantBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSingleConstantBuffer const *pCmd, uint32_t cbCmd)
|
---|
2258 | {
|
---|
2259 | #ifdef VMSVGA3D_DX
|
---|
2260 | //DEBUG_BREAKPOINT_TEST();
|
---|
2261 | RT_NOREF(cbCmd);
|
---|
2262 | return vmsvga3dDXSetSingleConstantBuffer(pThisCC, idDXContext, pCmd);
|
---|
2263 | #else
|
---|
2264 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2265 | return VERR_NOT_SUPPORTED;
|
---|
2266 | #endif
|
---|
2267 | }
|
---|
2268 |
|
---|
2269 |
|
---|
2270 | /* SVGA_3D_CMD_DX_SET_SHADER_RESOURCES 1149 */
|
---|
2271 | static int vmsvga3dCmdDXSetShaderResources(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShaderResources const *pCmd, uint32_t cbCmd)
|
---|
2272 | {
|
---|
2273 | #ifdef VMSVGA3D_DX
|
---|
2274 | //DEBUG_BREAKPOINT_TEST();
|
---|
2275 | SVGA3dShaderResourceViewId const *paShaderResourceViewId = (SVGA3dShaderResourceViewId *)&pCmd[1];
|
---|
2276 | uint32_t const cShaderResourceViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dShaderResourceViewId);
|
---|
2277 | return vmsvga3dDXSetShaderResources(pThisCC, idDXContext, pCmd, cShaderResourceViewId, paShaderResourceViewId);
|
---|
2278 | #else
|
---|
2279 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2280 | return VERR_NOT_SUPPORTED;
|
---|
2281 | #endif
|
---|
2282 | }
|
---|
2283 |
|
---|
2284 |
|
---|
2285 | /* SVGA_3D_CMD_DX_SET_SHADER 1150 */
|
---|
2286 | static int vmsvga3dCmdDXSetShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShader const *pCmd, uint32_t cbCmd)
|
---|
2287 | {
|
---|
2288 | #ifdef VMSVGA3D_DX
|
---|
2289 | //DEBUG_BREAKPOINT_TEST();
|
---|
2290 | RT_NOREF(cbCmd);
|
---|
2291 | return vmsvga3dDXSetShader(pThisCC, idDXContext, pCmd);
|
---|
2292 | #else
|
---|
2293 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2294 | return VERR_NOT_SUPPORTED;
|
---|
2295 | #endif
|
---|
2296 | }
|
---|
2297 |
|
---|
2298 |
|
---|
2299 | /* SVGA_3D_CMD_DX_SET_SAMPLERS 1151 */
|
---|
2300 | static int vmsvga3dCmdDXSetSamplers(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSamplers const *pCmd, uint32_t cbCmd)
|
---|
2301 | {
|
---|
2302 | #ifdef VMSVGA3D_DX
|
---|
2303 | //DEBUG_BREAKPOINT_TEST();
|
---|
2304 | SVGA3dSamplerId const *paSamplerId = (SVGA3dSamplerId *)&pCmd[1];
|
---|
2305 | uint32_t const cSamplerId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSamplerId);
|
---|
2306 | return vmsvga3dDXSetSamplers(pThisCC, idDXContext, pCmd, cSamplerId, paSamplerId);
|
---|
2307 | #else
|
---|
2308 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2309 | return VERR_NOT_SUPPORTED;
|
---|
2310 | #endif
|
---|
2311 | }
|
---|
2312 |
|
---|
2313 |
|
---|
2314 | /* SVGA_3D_CMD_DX_DRAW 1152 */
|
---|
2315 | static int vmsvga3dCmdDXDraw(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDraw const *pCmd, uint32_t cbCmd)
|
---|
2316 | {
|
---|
2317 | #ifdef VMSVGA3D_DX
|
---|
2318 | //DEBUG_BREAKPOINT_TEST();
|
---|
2319 | RT_NOREF(cbCmd);
|
---|
2320 | return vmsvga3dDXDraw(pThisCC, idDXContext, pCmd);
|
---|
2321 | #else
|
---|
2322 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2323 | return VERR_NOT_SUPPORTED;
|
---|
2324 | #endif
|
---|
2325 | }
|
---|
2326 |
|
---|
2327 |
|
---|
2328 | /* SVGA_3D_CMD_DX_DRAW_INDEXED 1153 */
|
---|
2329 | static int vmsvga3dCmdDXDrawIndexed(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexed const *pCmd, uint32_t cbCmd)
|
---|
2330 | {
|
---|
2331 | #ifdef VMSVGA3D_DX
|
---|
2332 | //DEBUG_BREAKPOINT_TEST();
|
---|
2333 | RT_NOREF(cbCmd);
|
---|
2334 | return vmsvga3dDXDrawIndexed(pThisCC, idDXContext, pCmd);
|
---|
2335 | #else
|
---|
2336 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2337 | return VERR_NOT_SUPPORTED;
|
---|
2338 | #endif
|
---|
2339 | }
|
---|
2340 |
|
---|
2341 |
|
---|
2342 | /* SVGA_3D_CMD_DX_DRAW_INSTANCED 1154 */
|
---|
2343 | static int vmsvga3dCmdDXDrawInstanced(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawInstanced const *pCmd, uint32_t cbCmd)
|
---|
2344 | {
|
---|
2345 | #ifdef VMSVGA3D_DX
|
---|
2346 | //DEBUG_BREAKPOINT_TEST();
|
---|
2347 | RT_NOREF(cbCmd);
|
---|
2348 | return vmsvga3dDXDrawInstanced(pThisCC, idDXContext, pCmd);
|
---|
2349 | #else
|
---|
2350 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2351 | return VERR_NOT_SUPPORTED;
|
---|
2352 | #endif
|
---|
2353 | }
|
---|
2354 |
|
---|
2355 |
|
---|
2356 | /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED 1155 */
|
---|
2357 | static int vmsvga3dCmdDXDrawIndexedInstanced(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexedInstanced const *pCmd, uint32_t cbCmd)
|
---|
2358 | {
|
---|
2359 | #ifdef VMSVGA3D_DX
|
---|
2360 | //DEBUG_BREAKPOINT_TEST();
|
---|
2361 | RT_NOREF(cbCmd);
|
---|
2362 | return vmsvga3dDXDrawIndexedInstanced(pThisCC, idDXContext, pCmd);
|
---|
2363 | #else
|
---|
2364 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2365 | return VERR_NOT_SUPPORTED;
|
---|
2366 | #endif
|
---|
2367 | }
|
---|
2368 |
|
---|
2369 |
|
---|
2370 | /* SVGA_3D_CMD_DX_DRAW_AUTO 1156 */
|
---|
2371 | static int vmsvga3dCmdDXDrawAuto(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawAuto const *pCmd, uint32_t cbCmd)
|
---|
2372 | {
|
---|
2373 | #ifdef VMSVGA3D_DX
|
---|
2374 | //DEBUG_BREAKPOINT_TEST();
|
---|
2375 | RT_NOREF(pCmd, cbCmd);
|
---|
2376 | return vmsvga3dDXDrawAuto(pThisCC, idDXContext);
|
---|
2377 | #else
|
---|
2378 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2379 | return VERR_NOT_SUPPORTED;
|
---|
2380 | #endif
|
---|
2381 | }
|
---|
2382 |
|
---|
2383 |
|
---|
2384 | /* SVGA_3D_CMD_DX_SET_INPUT_LAYOUT 1157 */
|
---|
2385 | static int vmsvga3dCmdDXSetInputLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetInputLayout const *pCmd, uint32_t cbCmd)
|
---|
2386 | {
|
---|
2387 | #ifdef VMSVGA3D_DX
|
---|
2388 | //DEBUG_BREAKPOINT_TEST();
|
---|
2389 | RT_NOREF(cbCmd);
|
---|
2390 | return vmsvga3dDXSetInputLayout(pThisCC, idDXContext, pCmd->elementLayoutId);
|
---|
2391 | #else
|
---|
2392 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2393 | return VERR_NOT_SUPPORTED;
|
---|
2394 | #endif
|
---|
2395 | }
|
---|
2396 |
|
---|
2397 |
|
---|
2398 | /* SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS 1158 */
|
---|
2399 | static int vmsvga3dCmdDXSetVertexBuffers(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetVertexBuffers const *pCmd, uint32_t cbCmd)
|
---|
2400 | {
|
---|
2401 | #ifdef VMSVGA3D_DX
|
---|
2402 | //DEBUG_BREAKPOINT_TEST();
|
---|
2403 | SVGA3dVertexBuffer const *paVertexBuffer = (SVGA3dVertexBuffer *)&pCmd[1];
|
---|
2404 | uint32_t const cVertexBuffer = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dVertexBuffer);
|
---|
2405 | return vmsvga3dDXSetVertexBuffers(pThisCC, idDXContext, pCmd->startBuffer, cVertexBuffer, paVertexBuffer);
|
---|
2406 | #else
|
---|
2407 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2408 | return VERR_NOT_SUPPORTED;
|
---|
2409 | #endif
|
---|
2410 | }
|
---|
2411 |
|
---|
2412 |
|
---|
2413 | /* SVGA_3D_CMD_DX_SET_INDEX_BUFFER 1159 */
|
---|
2414 | static int vmsvga3dCmdDXSetIndexBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetIndexBuffer const *pCmd, uint32_t cbCmd)
|
---|
2415 | {
|
---|
2416 | #ifdef VMSVGA3D_DX
|
---|
2417 | //DEBUG_BREAKPOINT_TEST();
|
---|
2418 | RT_NOREF(cbCmd);
|
---|
2419 | return vmsvga3dDXSetIndexBuffer(pThisCC, idDXContext, pCmd);
|
---|
2420 | #else
|
---|
2421 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2422 | return VERR_NOT_SUPPORTED;
|
---|
2423 | #endif
|
---|
2424 | }
|
---|
2425 |
|
---|
2426 |
|
---|
2427 | /* SVGA_3D_CMD_DX_SET_TOPOLOGY 1160 */
|
---|
2428 | static int vmsvga3dCmdDXSetTopology(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetTopology const *pCmd, uint32_t cbCmd)
|
---|
2429 | {
|
---|
2430 | #ifdef VMSVGA3D_DX
|
---|
2431 | //DEBUG_BREAKPOINT_TEST();
|
---|
2432 | RT_NOREF(cbCmd);
|
---|
2433 | return vmsvga3dDXSetTopology(pThisCC, idDXContext, pCmd->topology);
|
---|
2434 | #else
|
---|
2435 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2436 | return VERR_NOT_SUPPORTED;
|
---|
2437 | #endif
|
---|
2438 | }
|
---|
2439 |
|
---|
2440 |
|
---|
2441 | /* SVGA_3D_CMD_DX_SET_RENDERTARGETS 1161 */
|
---|
2442 | static int vmsvga3dCmdDXSetRenderTargets(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetRenderTargets const *pCmd, uint32_t cbCmd)
|
---|
2443 | {
|
---|
2444 | #ifdef VMSVGA3D_DX
|
---|
2445 | //DEBUG_BREAKPOINT_TEST();
|
---|
2446 | SVGA3dRenderTargetViewId const *paRenderTargetViewId = (SVGA3dRenderTargetViewId *)&pCmd[1];
|
---|
2447 | uint32_t const cRenderTargetViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRenderTargetViewId);
|
---|
2448 | return vmsvga3dDXSetRenderTargets(pThisCC, idDXContext, pCmd->depthStencilViewId, cRenderTargetViewId, paRenderTargetViewId);
|
---|
2449 | #else
|
---|
2450 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2451 | return VERR_NOT_SUPPORTED;
|
---|
2452 | #endif
|
---|
2453 | }
|
---|
2454 |
|
---|
2455 |
|
---|
2456 | /* SVGA_3D_CMD_DX_SET_BLEND_STATE 1162 */
|
---|
2457 | static int vmsvga3dCmdDXSetBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetBlendState const *pCmd, uint32_t cbCmd)
|
---|
2458 | {
|
---|
2459 | #ifdef VMSVGA3D_DX
|
---|
2460 | //DEBUG_BREAKPOINT_TEST();
|
---|
2461 | RT_NOREF(cbCmd);
|
---|
2462 | return vmsvga3dDXSetBlendState(pThisCC, idDXContext, pCmd);
|
---|
2463 | #else
|
---|
2464 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2465 | return VERR_NOT_SUPPORTED;
|
---|
2466 | #endif
|
---|
2467 | }
|
---|
2468 |
|
---|
2469 |
|
---|
2470 | /* SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE 1163 */
|
---|
2471 | static int vmsvga3dCmdDXSetDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
2472 | {
|
---|
2473 | #ifdef VMSVGA3D_DX
|
---|
2474 | //DEBUG_BREAKPOINT_TEST();
|
---|
2475 | RT_NOREF(cbCmd);
|
---|
2476 | return vmsvga3dDXSetDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
2477 | #else
|
---|
2478 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2479 | return VERR_NOT_SUPPORTED;
|
---|
2480 | #endif
|
---|
2481 | }
|
---|
2482 |
|
---|
2483 |
|
---|
2484 | /* SVGA_3D_CMD_DX_SET_RASTERIZER_STATE 1164 */
|
---|
2485 | static int vmsvga3dCmdDXSetRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
2486 | {
|
---|
2487 | #ifdef VMSVGA3D_DX
|
---|
2488 | //DEBUG_BREAKPOINT_TEST();
|
---|
2489 | RT_NOREF(cbCmd);
|
---|
2490 | return vmsvga3dDXSetRasterizerState(pThisCC, idDXContext, pCmd->rasterizerId);
|
---|
2491 | #else
|
---|
2492 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2493 | return VERR_NOT_SUPPORTED;
|
---|
2494 | #endif
|
---|
2495 | }
|
---|
2496 |
|
---|
2497 |
|
---|
2498 | /* SVGA_3D_CMD_DX_DEFINE_QUERY 1165 */
|
---|
2499 | static int vmsvga3dCmdDXDefineQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineQuery const *pCmd, uint32_t cbCmd)
|
---|
2500 | {
|
---|
2501 | #ifdef VMSVGA3D_DX
|
---|
2502 | //DEBUG_BREAKPOINT_TEST();
|
---|
2503 | RT_NOREF(cbCmd);
|
---|
2504 | return vmsvga3dDXDefineQuery(pThisCC, idDXContext, pCmd);
|
---|
2505 | #else
|
---|
2506 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2507 | return VERR_NOT_SUPPORTED;
|
---|
2508 | #endif
|
---|
2509 | }
|
---|
2510 |
|
---|
2511 |
|
---|
2512 | /* SVGA_3D_CMD_DX_DESTROY_QUERY 1166 */
|
---|
2513 | static int vmsvga3dCmdDXDestroyQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyQuery const *pCmd, uint32_t cbCmd)
|
---|
2514 | {
|
---|
2515 | #ifdef VMSVGA3D_DX
|
---|
2516 | //DEBUG_BREAKPOINT_TEST();
|
---|
2517 | RT_NOREF(cbCmd);
|
---|
2518 | return vmsvga3dDXDestroyQuery(pThisCC, idDXContext, pCmd);
|
---|
2519 | #else
|
---|
2520 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2521 | return VERR_NOT_SUPPORTED;
|
---|
2522 | #endif
|
---|
2523 | }
|
---|
2524 |
|
---|
2525 |
|
---|
2526 | /* SVGA_3D_CMD_DX_BIND_QUERY 1167 */
|
---|
2527 | static int vmsvga3dCmdDXBindQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindQuery const *pCmd, uint32_t cbCmd)
|
---|
2528 | {
|
---|
2529 | #ifdef VMSVGA3D_DX
|
---|
2530 | //DEBUG_BREAKPOINT_TEST();
|
---|
2531 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2532 | RT_NOREF(cbCmd);
|
---|
2533 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
2534 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
2535 | return vmsvga3dDXBindQuery(pThisCC, idDXContext, pCmd, pMob);
|
---|
2536 | #else
|
---|
2537 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2538 | return VERR_NOT_SUPPORTED;
|
---|
2539 | #endif
|
---|
2540 | }
|
---|
2541 |
|
---|
2542 |
|
---|
2543 | /* SVGA_3D_CMD_DX_SET_QUERY_OFFSET 1168 */
|
---|
2544 | static int vmsvga3dCmdDXSetQueryOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetQueryOffset const *pCmd, uint32_t cbCmd)
|
---|
2545 | {
|
---|
2546 | #ifdef VMSVGA3D_DX
|
---|
2547 | //DEBUG_BREAKPOINT_TEST();
|
---|
2548 | RT_NOREF(cbCmd);
|
---|
2549 | return vmsvga3dDXSetQueryOffset(pThisCC, idDXContext, pCmd);
|
---|
2550 | #else
|
---|
2551 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2552 | return VERR_NOT_SUPPORTED;
|
---|
2553 | #endif
|
---|
2554 | }
|
---|
2555 |
|
---|
2556 |
|
---|
2557 | /* SVGA_3D_CMD_DX_BEGIN_QUERY 1169 */
|
---|
2558 | static int vmsvga3dCmdDXBeginQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBeginQuery const *pCmd, uint32_t cbCmd)
|
---|
2559 | {
|
---|
2560 | #ifdef VMSVGA3D_DX
|
---|
2561 | //DEBUG_BREAKPOINT_TEST();
|
---|
2562 | RT_NOREF(cbCmd);
|
---|
2563 | return vmsvga3dDXBeginQuery(pThisCC, idDXContext, pCmd);
|
---|
2564 | #else
|
---|
2565 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2566 | return VERR_NOT_SUPPORTED;
|
---|
2567 | #endif
|
---|
2568 | }
|
---|
2569 |
|
---|
2570 |
|
---|
2571 | /* SVGA_3D_CMD_DX_END_QUERY 1170 */
|
---|
2572 | static int vmsvga3dCmdDXEndQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXEndQuery const *pCmd, uint32_t cbCmd)
|
---|
2573 | {
|
---|
2574 | #ifdef VMSVGA3D_DX
|
---|
2575 | //DEBUG_BREAKPOINT_TEST();
|
---|
2576 | RT_NOREF(cbCmd);
|
---|
2577 | return vmsvga3dDXEndQuery(pThisCC, idDXContext, pCmd);
|
---|
2578 | #else
|
---|
2579 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2580 | return VERR_NOT_SUPPORTED;
|
---|
2581 | #endif
|
---|
2582 | }
|
---|
2583 |
|
---|
2584 |
|
---|
2585 | /* SVGA_3D_CMD_DX_READBACK_QUERY 1171 */
|
---|
2586 | static int vmsvga3dCmdDXReadbackQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackQuery const *pCmd, uint32_t cbCmd)
|
---|
2587 | {
|
---|
2588 | #ifdef VMSVGA3D_DX
|
---|
2589 | //DEBUG_BREAKPOINT_TEST();
|
---|
2590 | RT_NOREF(cbCmd);
|
---|
2591 | return vmsvga3dDXReadbackQuery(pThisCC, idDXContext, pCmd);
|
---|
2592 | #else
|
---|
2593 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2594 | return VERR_NOT_SUPPORTED;
|
---|
2595 | #endif
|
---|
2596 | }
|
---|
2597 |
|
---|
2598 |
|
---|
2599 | /* SVGA_3D_CMD_DX_SET_PREDICATION 1172 */
|
---|
2600 | static int vmsvga3dCmdDXSetPredication(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetPredication const *pCmd, uint32_t cbCmd)
|
---|
2601 | {
|
---|
2602 | #ifdef VMSVGA3D_DX
|
---|
2603 | //DEBUG_BREAKPOINT_TEST();
|
---|
2604 | RT_NOREF(cbCmd);
|
---|
2605 | return vmsvga3dDXSetPredication(pThisCC, idDXContext, pCmd);
|
---|
2606 | #else
|
---|
2607 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2608 | return VERR_NOT_SUPPORTED;
|
---|
2609 | #endif
|
---|
2610 | }
|
---|
2611 |
|
---|
2612 |
|
---|
2613 | /* SVGA_3D_CMD_DX_SET_SOTARGETS 1173 */
|
---|
2614 | static int vmsvga3dCmdDXSetSOTargets(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetSOTargets const *pCmd, uint32_t cbCmd)
|
---|
2615 | {
|
---|
2616 | #ifdef VMSVGA3D_DX
|
---|
2617 | //DEBUG_BREAKPOINT_TEST();
|
---|
2618 | SVGA3dSoTarget const *paSoTarget = (SVGA3dSoTarget *)&pCmd[1];
|
---|
2619 | uint32_t const cSoTarget = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSoTarget);
|
---|
2620 | return vmsvga3dDXSetSOTargets(pThisCC, idDXContext, cSoTarget, paSoTarget);
|
---|
2621 | #else
|
---|
2622 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2623 | return VERR_NOT_SUPPORTED;
|
---|
2624 | #endif
|
---|
2625 | }
|
---|
2626 |
|
---|
2627 |
|
---|
2628 | /* SVGA_3D_CMD_DX_SET_VIEWPORTS 1174 */
|
---|
2629 | static int vmsvga3dCmdDXSetViewports(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetViewports const *pCmd, uint32_t cbCmd)
|
---|
2630 | {
|
---|
2631 | #ifdef VMSVGA3D_DX
|
---|
2632 | //DEBUG_BREAKPOINT_TEST();
|
---|
2633 | SVGA3dViewport const *paViewport = (SVGA3dViewport *)&pCmd[1];
|
---|
2634 | uint32_t const cViewport = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dViewport);
|
---|
2635 | return vmsvga3dDXSetViewports(pThisCC, idDXContext, cViewport, paViewport);
|
---|
2636 | #else
|
---|
2637 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2638 | return VERR_NOT_SUPPORTED;
|
---|
2639 | #endif
|
---|
2640 | }
|
---|
2641 |
|
---|
2642 |
|
---|
2643 | /* SVGA_3D_CMD_DX_SET_SCISSORRECTS 1175 */
|
---|
2644 | static int vmsvga3dCmdDXSetScissorRects(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetScissorRects const *pCmd, uint32_t cbCmd)
|
---|
2645 | {
|
---|
2646 | #ifdef VMSVGA3D_DX
|
---|
2647 | //DEBUG_BREAKPOINT_TEST();
|
---|
2648 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
2649 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
2650 | return vmsvga3dDXSetScissorRects(pThisCC, idDXContext, cRect, paRect);
|
---|
2651 | #else
|
---|
2652 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2653 | return VERR_NOT_SUPPORTED;
|
---|
2654 | #endif
|
---|
2655 | }
|
---|
2656 |
|
---|
2657 |
|
---|
2658 | /* SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW 1176 */
|
---|
2659 | static int vmsvga3dCmdDXClearRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2660 | {
|
---|
2661 | #ifdef VMSVGA3D_DX
|
---|
2662 | //DEBUG_BREAKPOINT_TEST();
|
---|
2663 | RT_NOREF(cbCmd);
|
---|
2664 | return vmsvga3dDXClearRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2665 | #else
|
---|
2666 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2667 | return VERR_NOT_SUPPORTED;
|
---|
2668 | #endif
|
---|
2669 | }
|
---|
2670 |
|
---|
2671 |
|
---|
2672 | /* SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW 1177 */
|
---|
2673 | static int vmsvga3dCmdDXClearDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
2674 | {
|
---|
2675 | #ifdef VMSVGA3D_DX
|
---|
2676 | //DEBUG_BREAKPOINT_TEST();
|
---|
2677 | RT_NOREF(cbCmd);
|
---|
2678 | return vmsvga3dDXClearDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
2679 | #else
|
---|
2680 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2681 | return VERR_NOT_SUPPORTED;
|
---|
2682 | #endif
|
---|
2683 | }
|
---|
2684 |
|
---|
2685 |
|
---|
2686 | /* SVGA_3D_CMD_DX_PRED_COPY_REGION 1178 */
|
---|
2687 | static int vmsvga3dCmdDXPredCopyRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopyRegion const *pCmd, uint32_t cbCmd)
|
---|
2688 | {
|
---|
2689 | #ifdef VMSVGA3D_DX
|
---|
2690 | //DEBUG_BREAKPOINT_TEST();
|
---|
2691 | RT_NOREF(cbCmd);
|
---|
2692 | return vmsvga3dDXPredCopyRegion(pThisCC, idDXContext, pCmd);
|
---|
2693 | #else
|
---|
2694 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2695 | return VERR_NOT_SUPPORTED;
|
---|
2696 | #endif
|
---|
2697 | }
|
---|
2698 |
|
---|
2699 |
|
---|
2700 | /* SVGA_3D_CMD_DX_PRED_COPY 1179 */
|
---|
2701 | static int vmsvga3dCmdDXPredCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredCopy const *pCmd, uint32_t cbCmd)
|
---|
2702 | {
|
---|
2703 | #ifdef VMSVGA3D_DX
|
---|
2704 | //DEBUG_BREAKPOINT_TEST();
|
---|
2705 | RT_NOREF(cbCmd);
|
---|
2706 | return vmsvga3dDXPredCopy(pThisCC, idDXContext, pCmd);
|
---|
2707 | #else
|
---|
2708 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2709 | return VERR_NOT_SUPPORTED;
|
---|
2710 | #endif
|
---|
2711 | }
|
---|
2712 |
|
---|
2713 |
|
---|
2714 | /* SVGA_3D_CMD_DX_PRESENTBLT 1180 */
|
---|
2715 | static int vmsvga3dCmdDXPresentBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPresentBlt const *pCmd, uint32_t cbCmd)
|
---|
2716 | {
|
---|
2717 | #ifdef VMSVGA3D_DX
|
---|
2718 | //DEBUG_BREAKPOINT_TEST();
|
---|
2719 | RT_NOREF(cbCmd);
|
---|
2720 | return vmsvga3dDXPresentBlt(pThisCC, idDXContext, pCmd);
|
---|
2721 | #else
|
---|
2722 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2723 | return VERR_NOT_SUPPORTED;
|
---|
2724 | #endif
|
---|
2725 | }
|
---|
2726 |
|
---|
2727 |
|
---|
2728 | /* SVGA_3D_CMD_DX_GENMIPS 1181 */
|
---|
2729 | static int vmsvga3dCmdDXGenMips(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXGenMips const *pCmd, uint32_t cbCmd)
|
---|
2730 | {
|
---|
2731 | #ifdef VMSVGA3D_DX
|
---|
2732 | //DEBUG_BREAKPOINT_TEST();
|
---|
2733 | RT_NOREF(cbCmd);
|
---|
2734 | return vmsvga3dDXGenMips(pThisCC, idDXContext, pCmd);
|
---|
2735 | #else
|
---|
2736 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2737 | return VERR_NOT_SUPPORTED;
|
---|
2738 | #endif
|
---|
2739 | }
|
---|
2740 |
|
---|
2741 |
|
---|
2742 | /* SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE 1182 */
|
---|
2743 | static int vmsvga3dCmdDXUpdateSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXUpdateSubResource const *pCmd, uint32_t cbCmd)
|
---|
2744 | {
|
---|
2745 | #ifdef VMSVGA3D_DX
|
---|
2746 | //DEBUG_BREAKPOINT_TEST();
|
---|
2747 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2748 | RT_NOREF(cbCmd);
|
---|
2749 |
|
---|
2750 | LogFlowFunc(("sid=%u, subResource=%u, box=%d,%d,%d %ux%ux%u\n",
|
---|
2751 | pCmd->sid, pCmd->subResource, pCmd->box.x, pCmd->box.y, pCmd->box.z, pCmd->box.w, pCmd->box.h, pCmd->box.z));
|
---|
2752 |
|
---|
2753 | /* "Inform the device that the guest-contents have been updated." */
|
---|
2754 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2755 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2756 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2757 | if (RT_SUCCESS(rc))
|
---|
2758 | {
|
---|
2759 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
2760 | if (pMob)
|
---|
2761 | {
|
---|
2762 | uint32 const cSubresource = vmsvga3dGetSubresourceCount(pThisCC, pCmd->sid);
|
---|
2763 | ASSERT_GUEST_RETURN(pCmd->subResource < cSubresource, VERR_INVALID_PARAMETER);
|
---|
2764 | /* pCmd->box will be verified by the mapping function. */
|
---|
2765 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2766 |
|
---|
2767 | /** @todo Mapping functions should use subresource index rather than SVGA3dSurfaceImageId? */
|
---|
2768 | SVGA3dSurfaceImageId image;
|
---|
2769 | image.sid = pCmd->sid;
|
---|
2770 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &image.mipmap, &image.face);
|
---|
2771 |
|
---|
2772 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, &pCmd->box, SVGA3D_WRITE_HOST_VRAM);
|
---|
2773 | AssertRC(rc);
|
---|
2774 | }
|
---|
2775 | }
|
---|
2776 |
|
---|
2777 | return rc;
|
---|
2778 | #else
|
---|
2779 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2780 | return VERR_NOT_SUPPORTED;
|
---|
2781 | #endif
|
---|
2782 | }
|
---|
2783 |
|
---|
2784 |
|
---|
2785 | /* SVGA_3D_CMD_DX_READBACK_SUBRESOURCE 1183 */
|
---|
2786 | static int vmsvga3dCmdDXReadbackSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXReadbackSubResource const *pCmd, uint32_t cbCmd)
|
---|
2787 | {
|
---|
2788 | #ifdef VMSVGA3D_DX
|
---|
2789 | //DEBUG_BREAKPOINT_TEST();
|
---|
2790 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2791 | RT_NOREF(cbCmd);
|
---|
2792 |
|
---|
2793 | LogFlowFunc(("sid=%u, subResource=%u\n",
|
---|
2794 | pCmd->sid, pCmd->subResource));
|
---|
2795 |
|
---|
2796 | /* "Request the device to flush the dirty contents into the guest." */
|
---|
2797 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2798 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2799 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2800 | if (RT_SUCCESS(rc))
|
---|
2801 | {
|
---|
2802 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, entrySurface.mobid);
|
---|
2803 | if (pMob)
|
---|
2804 | {
|
---|
2805 | uint32 const cSubresource = vmsvga3dGetSubresourceCount(pThisCC, pCmd->sid);
|
---|
2806 | ASSERT_GUEST_RETURN(pCmd->subResource < cSubresource, VERR_INVALID_PARAMETER);
|
---|
2807 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
2808 |
|
---|
2809 | /** @todo Mapping functions should use subresource index rather than SVGA3dSurfaceImageId? */
|
---|
2810 | SVGA3dSurfaceImageId image;
|
---|
2811 | image.sid = pCmd->sid;
|
---|
2812 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &image.mipmap, &image.face);
|
---|
2813 |
|
---|
2814 | rc = vmsvgaR3TransferSurfaceLevel(pThisCC, pMob, &image, /* all pBox = */ NULL, SVGA3D_READ_HOST_VRAM);
|
---|
2815 | AssertRC(rc);
|
---|
2816 | }
|
---|
2817 | }
|
---|
2818 |
|
---|
2819 | return rc;
|
---|
2820 | #else
|
---|
2821 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2822 | return VERR_NOT_SUPPORTED;
|
---|
2823 | #endif
|
---|
2824 | }
|
---|
2825 |
|
---|
2826 |
|
---|
2827 | /* SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE 1184 */
|
---|
2828 | static int vmsvga3dCmdDXInvalidateSubResource(PVGASTATECC pThisCC, SVGA3dCmdDXInvalidateSubResource const *pCmd, uint32_t cbCmd)
|
---|
2829 | {
|
---|
2830 | #ifdef VMSVGA3D_DX
|
---|
2831 | DEBUG_BREAKPOINT_TEST();
|
---|
2832 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
2833 | RT_NOREF(cbCmd);
|
---|
2834 |
|
---|
2835 | LogFlowFunc(("sid=%u, subResource=%u\n",
|
---|
2836 | pCmd->sid, pCmd->subResource));
|
---|
2837 |
|
---|
2838 | /* "Notify the device that the contents can be lost." */
|
---|
2839 | SVGAOTableSurfaceEntry entrySurface;
|
---|
2840 | int rc = vmsvgaR3OTableRead(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
2841 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entrySurface, sizeof(entrySurface));
|
---|
2842 | if (RT_SUCCESS(rc))
|
---|
2843 | {
|
---|
2844 | uint32_t iFace;
|
---|
2845 | uint32_t iMipmap;
|
---|
2846 | vmsvga3dCalcMipmapAndFace(entrySurface.numMipLevels, pCmd->subResource, &iMipmap, &iFace);
|
---|
2847 | vmsvga3dSurfaceInvalidate(pThisCC, pCmd->sid, iFace, iMipmap);
|
---|
2848 | }
|
---|
2849 |
|
---|
2850 | return rc;
|
---|
2851 | #else
|
---|
2852 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
2853 | return VERR_NOT_SUPPORTED;
|
---|
2854 | #endif
|
---|
2855 | }
|
---|
2856 |
|
---|
2857 |
|
---|
2858 | /* SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW 1185 */
|
---|
2859 | static int vmsvga3dCmdDXDefineShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShaderResourceView const *pCmd, uint32_t cbCmd)
|
---|
2860 | {
|
---|
2861 | #ifdef VMSVGA3D_DX
|
---|
2862 | //DEBUG_BREAKPOINT_TEST();
|
---|
2863 | RT_NOREF(cbCmd);
|
---|
2864 | return vmsvga3dDXDefineShaderResourceView(pThisCC, idDXContext, pCmd);
|
---|
2865 | #else
|
---|
2866 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2867 | return VERR_NOT_SUPPORTED;
|
---|
2868 | #endif
|
---|
2869 | }
|
---|
2870 |
|
---|
2871 |
|
---|
2872 | /* SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW 1186 */
|
---|
2873 | static int vmsvga3dCmdDXDestroyShaderResourceView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShaderResourceView const *pCmd, uint32_t cbCmd)
|
---|
2874 | {
|
---|
2875 | #ifdef VMSVGA3D_DX
|
---|
2876 | //DEBUG_BREAKPOINT_TEST();
|
---|
2877 | RT_NOREF(cbCmd);
|
---|
2878 | return vmsvga3dDXDestroyShaderResourceView(pThisCC, idDXContext, pCmd);
|
---|
2879 | #else
|
---|
2880 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2881 | return VERR_NOT_SUPPORTED;
|
---|
2882 | #endif
|
---|
2883 | }
|
---|
2884 |
|
---|
2885 |
|
---|
2886 | /* SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW 1187 */
|
---|
2887 | static int vmsvga3dCmdDXDefineRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2888 | {
|
---|
2889 | #ifdef VMSVGA3D_DX
|
---|
2890 | //DEBUG_BREAKPOINT_TEST();
|
---|
2891 | RT_NOREF(cbCmd);
|
---|
2892 | return vmsvga3dDXDefineRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2893 | #else
|
---|
2894 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2895 | return VERR_NOT_SUPPORTED;
|
---|
2896 | #endif
|
---|
2897 | }
|
---|
2898 |
|
---|
2899 |
|
---|
2900 | /* SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW 1188 */
|
---|
2901 | static int vmsvga3dCmdDXDestroyRenderTargetView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRenderTargetView const *pCmd, uint32_t cbCmd)
|
---|
2902 | {
|
---|
2903 | #ifdef VMSVGA3D_DX
|
---|
2904 | //DEBUG_BREAKPOINT_TEST();
|
---|
2905 | RT_NOREF(cbCmd);
|
---|
2906 | return vmsvga3dDXDestroyRenderTargetView(pThisCC, idDXContext, pCmd);
|
---|
2907 | #else
|
---|
2908 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2909 | return VERR_NOT_SUPPORTED;
|
---|
2910 | #endif
|
---|
2911 | }
|
---|
2912 |
|
---|
2913 |
|
---|
2914 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW 1189 */
|
---|
2915 | static int vmsvga3dCmdDXDefineDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
2916 | {
|
---|
2917 | #ifdef VMSVGA3D_DX
|
---|
2918 | //DEBUG_BREAKPOINT_TEST();
|
---|
2919 | RT_NOREF(cbCmd);
|
---|
2920 | SVGA3dCmdDXDefineDepthStencilView_v2 cmd;
|
---|
2921 | cmd.depthStencilViewId = pCmd->depthStencilViewId;
|
---|
2922 | cmd.sid = pCmd->sid;
|
---|
2923 | cmd.format = pCmd->format;
|
---|
2924 | cmd.resourceDimension = pCmd->resourceDimension;
|
---|
2925 | cmd.mipSlice = pCmd->mipSlice;
|
---|
2926 | cmd.firstArraySlice = pCmd->firstArraySlice;
|
---|
2927 | cmd.arraySize = pCmd->arraySize;
|
---|
2928 | cmd.flags = 0;
|
---|
2929 | return vmsvga3dDXDefineDepthStencilView(pThisCC, idDXContext, &cmd);
|
---|
2930 | #else
|
---|
2931 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2932 | return VERR_NOT_SUPPORTED;
|
---|
2933 | #endif
|
---|
2934 | }
|
---|
2935 |
|
---|
2936 |
|
---|
2937 | /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW 1190 */
|
---|
2938 | static int vmsvga3dCmdDXDestroyDepthStencilView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilView const *pCmd, uint32_t cbCmd)
|
---|
2939 | {
|
---|
2940 | #ifdef VMSVGA3D_DX
|
---|
2941 | //DEBUG_BREAKPOINT_TEST();
|
---|
2942 | RT_NOREF(cbCmd);
|
---|
2943 | return vmsvga3dDXDestroyDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
2944 | #else
|
---|
2945 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2946 | return VERR_NOT_SUPPORTED;
|
---|
2947 | #endif
|
---|
2948 | }
|
---|
2949 |
|
---|
2950 |
|
---|
2951 | /* SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT 1191 */
|
---|
2952 | static int vmsvga3dCmdDXDefineElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineElementLayout const *pCmd, uint32_t cbCmd)
|
---|
2953 | {
|
---|
2954 | #ifdef VMSVGA3D_DX
|
---|
2955 | //DEBUG_BREAKPOINT_TEST();
|
---|
2956 | SVGA3dInputElementDesc const *paDesc = (SVGA3dInputElementDesc *)&pCmd[1];
|
---|
2957 | uint32_t const cDesc = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dInputElementDesc);
|
---|
2958 | return vmsvga3dDXDefineElementLayout(pThisCC, idDXContext, pCmd->elementLayoutId, cDesc, paDesc);
|
---|
2959 | #else
|
---|
2960 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2961 | return VERR_NOT_SUPPORTED;
|
---|
2962 | #endif
|
---|
2963 | }
|
---|
2964 |
|
---|
2965 |
|
---|
2966 | /* SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT 1192 */
|
---|
2967 | static int vmsvga3dCmdDXDestroyElementLayout(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyElementLayout const *pCmd, uint32_t cbCmd)
|
---|
2968 | {
|
---|
2969 | #ifdef VMSVGA3D_DX
|
---|
2970 | //DEBUG_BREAKPOINT_TEST();
|
---|
2971 | RT_NOREF(cbCmd);
|
---|
2972 | return vmsvga3dDXDestroyElementLayout(pThisCC, idDXContext, pCmd);
|
---|
2973 | #else
|
---|
2974 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2975 | return VERR_NOT_SUPPORTED;
|
---|
2976 | #endif
|
---|
2977 | }
|
---|
2978 |
|
---|
2979 |
|
---|
2980 | /* SVGA_3D_CMD_DX_DEFINE_BLEND_STATE 1193 */
|
---|
2981 | static int vmsvga3dCmdDXDefineBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineBlendState const *pCmd, uint32_t cbCmd)
|
---|
2982 | {
|
---|
2983 | #ifdef VMSVGA3D_DX
|
---|
2984 | //DEBUG_BREAKPOINT_TEST();
|
---|
2985 | RT_NOREF(cbCmd);
|
---|
2986 | return vmsvga3dDXDefineBlendState(pThisCC, idDXContext, pCmd);
|
---|
2987 | #else
|
---|
2988 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
2989 | return VERR_NOT_SUPPORTED;
|
---|
2990 | #endif
|
---|
2991 | }
|
---|
2992 |
|
---|
2993 |
|
---|
2994 | /* SVGA_3D_CMD_DX_DESTROY_BLEND_STATE 1194 */
|
---|
2995 | static int vmsvga3dCmdDXDestroyBlendState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyBlendState const *pCmd, uint32_t cbCmd)
|
---|
2996 | {
|
---|
2997 | #ifdef VMSVGA3D_DX
|
---|
2998 | //DEBUG_BREAKPOINT_TEST();
|
---|
2999 | RT_NOREF(cbCmd);
|
---|
3000 | return vmsvga3dDXDestroyBlendState(pThisCC, idDXContext, pCmd);
|
---|
3001 | #else
|
---|
3002 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3003 | return VERR_NOT_SUPPORTED;
|
---|
3004 | #endif
|
---|
3005 | }
|
---|
3006 |
|
---|
3007 |
|
---|
3008 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE 1195 */
|
---|
3009 | static int vmsvga3dCmdDXDefineDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
3010 | {
|
---|
3011 | #ifdef VMSVGA3D_DX
|
---|
3012 | //DEBUG_BREAKPOINT_TEST();
|
---|
3013 | RT_NOREF(cbCmd);
|
---|
3014 | return vmsvga3dDXDefineDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
3015 | #else
|
---|
3016 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3017 | return VERR_NOT_SUPPORTED;
|
---|
3018 | #endif
|
---|
3019 | }
|
---|
3020 |
|
---|
3021 |
|
---|
3022 | /* SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE 1196 */
|
---|
3023 | static int vmsvga3dCmdDXDestroyDepthStencilState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyDepthStencilState const *pCmd, uint32_t cbCmd)
|
---|
3024 | {
|
---|
3025 | #ifdef VMSVGA3D_DX
|
---|
3026 | //DEBUG_BREAKPOINT_TEST();
|
---|
3027 | RT_NOREF(cbCmd);
|
---|
3028 | return vmsvga3dDXDestroyDepthStencilState(pThisCC, idDXContext, pCmd);
|
---|
3029 | #else
|
---|
3030 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3031 | return VERR_NOT_SUPPORTED;
|
---|
3032 | #endif
|
---|
3033 | }
|
---|
3034 |
|
---|
3035 |
|
---|
3036 | /* SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE 1197 */
|
---|
3037 | static int vmsvga3dCmdDXDefineRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
3038 | {
|
---|
3039 | #ifdef VMSVGA3D_DX
|
---|
3040 | //DEBUG_BREAKPOINT_TEST();
|
---|
3041 | RT_NOREF(cbCmd);
|
---|
3042 | return vmsvga3dDXDefineRasterizerState(pThisCC, idDXContext, pCmd);
|
---|
3043 | #else
|
---|
3044 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3045 | return VERR_NOT_SUPPORTED;
|
---|
3046 | #endif
|
---|
3047 | }
|
---|
3048 |
|
---|
3049 |
|
---|
3050 | /* SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE 1198 */
|
---|
3051 | static int vmsvga3dCmdDXDestroyRasterizerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyRasterizerState const *pCmd, uint32_t cbCmd)
|
---|
3052 | {
|
---|
3053 | #ifdef VMSVGA3D_DX
|
---|
3054 | //DEBUG_BREAKPOINT_TEST();
|
---|
3055 | RT_NOREF(cbCmd);
|
---|
3056 | return vmsvga3dDXDestroyRasterizerState(pThisCC, idDXContext, pCmd);
|
---|
3057 | #else
|
---|
3058 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3059 | return VERR_NOT_SUPPORTED;
|
---|
3060 | #endif
|
---|
3061 | }
|
---|
3062 |
|
---|
3063 |
|
---|
3064 | /* SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE 1199 */
|
---|
3065 | static int vmsvga3dCmdDXDefineSamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineSamplerState const *pCmd, uint32_t cbCmd)
|
---|
3066 | {
|
---|
3067 | #ifdef VMSVGA3D_DX
|
---|
3068 | //DEBUG_BREAKPOINT_TEST();
|
---|
3069 | RT_NOREF(cbCmd);
|
---|
3070 | return vmsvga3dDXDefineSamplerState(pThisCC, idDXContext, pCmd);
|
---|
3071 | #else
|
---|
3072 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3073 | return VERR_NOT_SUPPORTED;
|
---|
3074 | #endif
|
---|
3075 | }
|
---|
3076 |
|
---|
3077 |
|
---|
3078 | /* SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE 1200 */
|
---|
3079 | static int vmsvga3dCmdDXDestroySamplerState(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroySamplerState const *pCmd, uint32_t cbCmd)
|
---|
3080 | {
|
---|
3081 | #ifdef VMSVGA3D_DX
|
---|
3082 | //DEBUG_BREAKPOINT_TEST();
|
---|
3083 | RT_NOREF(cbCmd);
|
---|
3084 | return vmsvga3dDXDestroySamplerState(pThisCC, idDXContext, pCmd);
|
---|
3085 | #else
|
---|
3086 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3087 | return VERR_NOT_SUPPORTED;
|
---|
3088 | #endif
|
---|
3089 | }
|
---|
3090 |
|
---|
3091 |
|
---|
3092 | /* SVGA_3D_CMD_DX_DEFINE_SHADER 1201 */
|
---|
3093 | static int vmsvga3dCmdDXDefineShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineShader const *pCmd, uint32_t cbCmd)
|
---|
3094 | {
|
---|
3095 | #ifdef VMSVGA3D_DX
|
---|
3096 | //DEBUG_BREAKPOINT_TEST();
|
---|
3097 | RT_NOREF(cbCmd);
|
---|
3098 | return vmsvga3dDXDefineShader(pThisCC, idDXContext, pCmd);
|
---|
3099 | #else
|
---|
3100 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3101 | return VERR_NOT_SUPPORTED;
|
---|
3102 | #endif
|
---|
3103 | }
|
---|
3104 |
|
---|
3105 |
|
---|
3106 | /* SVGA_3D_CMD_DX_DESTROY_SHADER 1202 */
|
---|
3107 | static int vmsvga3dCmdDXDestroyShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyShader const *pCmd, uint32_t cbCmd)
|
---|
3108 | {
|
---|
3109 | #ifdef VMSVGA3D_DX
|
---|
3110 | //DEBUG_BREAKPOINT_TEST();
|
---|
3111 | RT_NOREF(cbCmd);
|
---|
3112 | return vmsvga3dDXDestroyShader(pThisCC, idDXContext, pCmd);
|
---|
3113 | #else
|
---|
3114 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3115 | return VERR_NOT_SUPPORTED;
|
---|
3116 | #endif
|
---|
3117 | }
|
---|
3118 |
|
---|
3119 |
|
---|
3120 | /* SVGA_3D_CMD_DX_BIND_SHADER 1203 */
|
---|
3121 | static int vmsvga3dCmdDXBindShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindShader const *pCmd, uint32_t cbCmd)
|
---|
3122 | {
|
---|
3123 | #ifdef VMSVGA3D_DX
|
---|
3124 | //DEBUG_BREAKPOINT_TEST();
|
---|
3125 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3126 | RT_NOREF(idDXContext, cbCmd);
|
---|
3127 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
3128 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
3129 | return vmsvga3dDXBindShader(pThisCC, pCmd, pMob);
|
---|
3130 | #else
|
---|
3131 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3132 | return VERR_NOT_SUPPORTED;
|
---|
3133 | #endif
|
---|
3134 | }
|
---|
3135 |
|
---|
3136 |
|
---|
3137 | /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT 1204 */
|
---|
3138 | static int vmsvga3dCmdDXDefineStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3139 | {
|
---|
3140 | #ifdef VMSVGA3D_DX
|
---|
3141 | //DEBUG_BREAKPOINT_TEST();
|
---|
3142 | RT_NOREF(cbCmd);
|
---|
3143 | return vmsvga3dDXDefineStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3144 | #else
|
---|
3145 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3146 | return VERR_NOT_SUPPORTED;
|
---|
3147 | #endif
|
---|
3148 | }
|
---|
3149 |
|
---|
3150 |
|
---|
3151 | /* SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT 1205 */
|
---|
3152 | static int vmsvga3dCmdDXDestroyStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3153 | {
|
---|
3154 | #ifdef VMSVGA3D_DX
|
---|
3155 | //DEBUG_BREAKPOINT_TEST();
|
---|
3156 | RT_NOREF(cbCmd);
|
---|
3157 | return vmsvga3dDXDestroyStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3158 | #else
|
---|
3159 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3160 | return VERR_NOT_SUPPORTED;
|
---|
3161 | #endif
|
---|
3162 | }
|
---|
3163 |
|
---|
3164 |
|
---|
3165 | /* SVGA_3D_CMD_DX_SET_STREAMOUTPUT 1206 */
|
---|
3166 | static int vmsvga3dCmdDXSetStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
3167 | {
|
---|
3168 | #ifdef VMSVGA3D_DX
|
---|
3169 | //DEBUG_BREAKPOINT_TEST();
|
---|
3170 | RT_NOREF(cbCmd);
|
---|
3171 | return vmsvga3dDXSetStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
3172 | #else
|
---|
3173 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3174 | return VERR_NOT_SUPPORTED;
|
---|
3175 | #endif
|
---|
3176 | }
|
---|
3177 |
|
---|
3178 |
|
---|
3179 | /* SVGA_3D_CMD_DX_SET_COTABLE 1207 */
|
---|
3180 | static int vmsvga3dCmdDXSetCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXSetCOTable const *pCmd, uint32_t cbCmd)
|
---|
3181 | {
|
---|
3182 | #ifdef VMSVGA3D_DX
|
---|
3183 | //DEBUG_BREAKPOINT_TEST();
|
---|
3184 | RT_NOREF(cbCmd);
|
---|
3185 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3186 | /* This returns NULL if mob does not exist. If the guest sends a wrong mob id, the current mob will be unbound. */
|
---|
3187 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
|
---|
3188 | return vmsvga3dDXSetCOTable(pThisCC, pCmd, pMob);
|
---|
3189 | #else
|
---|
3190 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3191 | return VERR_NOT_SUPPORTED;
|
---|
3192 | #endif
|
---|
3193 | }
|
---|
3194 |
|
---|
3195 |
|
---|
3196 | /* SVGA_3D_CMD_DX_READBACK_COTABLE 1208 */
|
---|
3197 | static int vmsvga3dCmdDXReadbackCOTable(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackCOTable const *pCmd, uint32_t cbCmd)
|
---|
3198 | {
|
---|
3199 | #ifdef VMSVGA3D_DX
|
---|
3200 | //DEBUG_BREAKPOINT_TEST();
|
---|
3201 | RT_NOREF(idDXContext, cbCmd);
|
---|
3202 | return vmsvga3dDXReadbackCOTable(pThisCC, pCmd);
|
---|
3203 | #else
|
---|
3204 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3205 | return VERR_NOT_SUPPORTED;
|
---|
3206 | #endif
|
---|
3207 | }
|
---|
3208 |
|
---|
3209 |
|
---|
3210 | /* SVGA_3D_CMD_DX_BUFFER_COPY 1209 */
|
---|
3211 | static int vmsvga3dCmdDXBufferCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBufferCopy const *pCmd, uint32_t cbCmd)
|
---|
3212 | {
|
---|
3213 | #ifdef VMSVGA3D_DX
|
---|
3214 | //DEBUG_BREAKPOINT_TEST();
|
---|
3215 | RT_NOREF(idDXContext, cbCmd);
|
---|
3216 |
|
---|
3217 | int rc;
|
---|
3218 |
|
---|
3219 | /** @todo Backend should o the copy is both buffers have a hardware resource. */
|
---|
3220 | SVGA3dSurfaceImageId imageBufferSrc;
|
---|
3221 | imageBufferSrc.sid = pCmd->src;
|
---|
3222 | imageBufferSrc.face = 0;
|
---|
3223 | imageBufferSrc.mipmap = 0;
|
---|
3224 |
|
---|
3225 | SVGA3dSurfaceImageId imageBufferDest;
|
---|
3226 | imageBufferDest.sid = pCmd->dest;
|
---|
3227 | imageBufferDest.face = 0;
|
---|
3228 | imageBufferDest.mipmap = 0;
|
---|
3229 |
|
---|
3230 | /*
|
---|
3231 | * Map the source buffer.
|
---|
3232 | */
|
---|
3233 | VMSVGA3D_MAPPED_SURFACE mapBufferSrc;
|
---|
3234 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBufferSrc, NULL, VMSVGA3D_SURFACE_MAP_READ, &mapBufferSrc);
|
---|
3235 | if (RT_SUCCESS(rc))
|
---|
3236 | {
|
---|
3237 | /*
|
---|
3238 | * Map the destination buffer.
|
---|
3239 | */
|
---|
3240 | VMSVGA3D_MAPPED_SURFACE mapBufferDest;
|
---|
3241 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBufferDest, NULL, VMSVGA3D_SURFACE_MAP_WRITE, &mapBufferDest);
|
---|
3242 | if (RT_SUCCESS(rc))
|
---|
3243 | {
|
---|
3244 | /*
|
---|
3245 | * Copy the source buffer to the destination.
|
---|
3246 | */
|
---|
3247 | uint8_t const *pu8BufferSrc = (uint8_t *)mapBufferSrc.pvData;
|
---|
3248 | uint32_t const cbBufferSrc = mapBufferSrc.cbRow;
|
---|
3249 |
|
---|
3250 | uint8_t *pu8BufferDest = (uint8_t *)mapBufferDest.pvData;
|
---|
3251 | uint32_t const cbBufferDest = mapBufferDest.cbRow;
|
---|
3252 |
|
---|
3253 | if ( pCmd->srcX < cbBufferSrc
|
---|
3254 | && pCmd->width <= cbBufferSrc- pCmd->srcX
|
---|
3255 | && pCmd->destX < cbBufferDest
|
---|
3256 | && pCmd->width <= cbBufferDest - pCmd->destX)
|
---|
3257 | {
|
---|
3258 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
3259 |
|
---|
3260 | memcpy(&pu8BufferDest[pCmd->destX], &pu8BufferSrc[pCmd->srcX], pCmd->width);
|
---|
3261 | }
|
---|
3262 | else
|
---|
3263 | ASSERT_GUEST_FAILED_STMT(rc = VERR_INVALID_PARAMETER);
|
---|
3264 |
|
---|
3265 | vmsvga3dSurfaceUnmap(pThisCC, &imageBufferDest, &mapBufferDest, true);
|
---|
3266 | }
|
---|
3267 |
|
---|
3268 | vmsvga3dSurfaceUnmap(pThisCC, &imageBufferSrc, &mapBufferSrc, false);
|
---|
3269 | }
|
---|
3270 |
|
---|
3271 | return rc;
|
---|
3272 | #else
|
---|
3273 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3274 | return VERR_NOT_SUPPORTED;
|
---|
3275 | #endif
|
---|
3276 | }
|
---|
3277 |
|
---|
3278 |
|
---|
3279 | /* SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER 1210 */
|
---|
3280 | static int vmsvga3dCmdDXTransferFromBuffer(PVGASTATECC pThisCC, SVGA3dCmdDXTransferFromBuffer const *pCmd, uint32_t cbCmd)
|
---|
3281 | {
|
---|
3282 | #ifdef VMSVGA3D_DX
|
---|
3283 | //DEBUG_BREAKPOINT_TEST();
|
---|
3284 | RT_NOREF(cbCmd);
|
---|
3285 |
|
---|
3286 | /* Plan:
|
---|
3287 | * - map the buffer;
|
---|
3288 | * - map the surface;
|
---|
3289 | * - copy from buffer map to the surface map.
|
---|
3290 | */
|
---|
3291 |
|
---|
3292 | int rc;
|
---|
3293 |
|
---|
3294 | SVGA3dSurfaceImageId imageBuffer;
|
---|
3295 | imageBuffer.sid = pCmd->srcSid;
|
---|
3296 | imageBuffer.face = 0;
|
---|
3297 | imageBuffer.mipmap = 0;
|
---|
3298 |
|
---|
3299 | SVGA3dSurfaceImageId imageSurface;
|
---|
3300 | imageSurface.sid = pCmd->destSid;
|
---|
3301 | rc = vmsvga3dCalcSurfaceMipmapAndFace(pThisCC, pCmd->destSid, pCmd->destSubResource, &imageSurface.mipmap, &imageSurface.face);
|
---|
3302 | AssertRCReturn(rc, rc);
|
---|
3303 |
|
---|
3304 | /*
|
---|
3305 | * Map the buffer.
|
---|
3306 | */
|
---|
3307 | VMSVGA3D_MAPPED_SURFACE mapBuffer;
|
---|
3308 | rc = vmsvga3dSurfaceMap(pThisCC, &imageBuffer, NULL, VMSVGA3D_SURFACE_MAP_READ, &mapBuffer);
|
---|
3309 | if (RT_SUCCESS(rc))
|
---|
3310 | {
|
---|
3311 | /*
|
---|
3312 | * Map the surface.
|
---|
3313 | */
|
---|
3314 | VMSVGA3D_MAPPED_SURFACE mapSurface;
|
---|
3315 | rc = vmsvga3dSurfaceMap(pThisCC, &imageSurface, &pCmd->destBox, VMSVGA3D_SURFACE_MAP_WRITE, &mapSurface);
|
---|
3316 | if (RT_SUCCESS(rc))
|
---|
3317 | {
|
---|
3318 | /*
|
---|
3319 | * Copy the mapped buffer to the surface. "Raw byte wise transfer"
|
---|
3320 | */
|
---|
3321 | uint8_t const *pu8Buffer = (uint8_t *)mapBuffer.pvData;
|
---|
3322 | uint32_t const cbBuffer = mapBuffer.cbRow;
|
---|
3323 |
|
---|
3324 | if (pCmd->srcOffset <= cbBuffer)
|
---|
3325 | {
|
---|
3326 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
3327 | uint8_t const *pu8BufferBegin = pu8Buffer;
|
---|
3328 | uint8_t const *pu8BufferEnd = pu8Buffer + cbBuffer;
|
---|
3329 |
|
---|
3330 | pu8Buffer += pCmd->srcOffset;
|
---|
3331 |
|
---|
3332 | uint8_t *pu8Surface = (uint8_t *)mapSurface.pvData;
|
---|
3333 |
|
---|
3334 | uint32_t const cbRowCopy = RT_MIN(pCmd->srcPitch, mapSurface.cbRow);
|
---|
3335 | for (uint32_t z = 0; z < mapSurface.box.d && RT_SUCCESS(rc); ++z)
|
---|
3336 | {
|
---|
3337 | uint8_t const *pu8BufferRow = pu8Buffer;
|
---|
3338 | uint8_t *pu8SurfaceRow = pu8Surface;
|
---|
3339 | for (uint32_t iRow = 0; iRow < mapSurface.cRows; ++iRow)
|
---|
3340 | {
|
---|
3341 | ASSERT_GUEST_STMT_BREAK( (uintptr_t)pu8BufferRow >= (uintptr_t)pu8BufferBegin
|
---|
3342 | && (uintptr_t)pu8BufferRow < (uintptr_t)pu8BufferEnd
|
---|
3343 | && (uintptr_t)pu8BufferRow < (uintptr_t)(pu8BufferRow + cbRowCopy)
|
---|
3344 | && (uintptr_t)(pu8BufferRow + cbRowCopy) > (uintptr_t)pu8BufferBegin
|
---|
3345 | && (uintptr_t)(pu8BufferRow + cbRowCopy) <= (uintptr_t)pu8BufferEnd,
|
---|
3346 | rc = VERR_INVALID_PARAMETER);
|
---|
3347 |
|
---|
3348 | memcpy(pu8SurfaceRow, pu8BufferRow, cbRowCopy);
|
---|
3349 |
|
---|
3350 | pu8SurfaceRow += mapSurface.cbRowPitch;
|
---|
3351 | pu8BufferRow += pCmd->srcPitch;
|
---|
3352 | }
|
---|
3353 |
|
---|
3354 | pu8Buffer += pCmd->srcSlicePitch;
|
---|
3355 | pu8Surface += mapSurface.cbDepthPitch;
|
---|
3356 | }
|
---|
3357 | }
|
---|
3358 | else
|
---|
3359 | ASSERT_GUEST_FAILED_STMT(rc = VERR_INVALID_PARAMETER);
|
---|
3360 |
|
---|
3361 | vmsvga3dSurfaceUnmap(pThisCC, &imageSurface, &mapSurface, true);
|
---|
3362 | }
|
---|
3363 |
|
---|
3364 | vmsvga3dSurfaceUnmap(pThisCC, &imageBuffer, &mapBuffer, false);
|
---|
3365 | }
|
---|
3366 |
|
---|
3367 | return rc;
|
---|
3368 | #else
|
---|
3369 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3370 | return VERR_NOT_SUPPORTED;
|
---|
3371 | #endif
|
---|
3372 | }
|
---|
3373 |
|
---|
3374 |
|
---|
3375 | /* SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK 1211 */
|
---|
3376 | static int vmsvga3dCmdDXSurfaceCopyAndReadback(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSurfaceCopyAndReadback const *pCmd, uint32_t cbCmd)
|
---|
3377 | {
|
---|
3378 | #ifdef VMSVGA3D_DX
|
---|
3379 | DEBUG_BREAKPOINT_TEST();
|
---|
3380 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3381 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3382 | return vmsvga3dDXSurfaceCopyAndReadback(pThisCC, idDXContext);
|
---|
3383 | #else
|
---|
3384 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3385 | return VERR_NOT_SUPPORTED;
|
---|
3386 | #endif
|
---|
3387 | }
|
---|
3388 |
|
---|
3389 |
|
---|
3390 | /* SVGA_3D_CMD_DX_MOVE_QUERY 1212 */
|
---|
3391 | static int vmsvga3dCmdDXMoveQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXMoveQuery const *pCmd, uint32_t cbCmd)
|
---|
3392 | {
|
---|
3393 | #ifdef VMSVGA3D_DX
|
---|
3394 | DEBUG_BREAKPOINT_TEST();
|
---|
3395 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3396 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3397 | return vmsvga3dDXMoveQuery(pThisCC, idDXContext);
|
---|
3398 | #else
|
---|
3399 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3400 | return VERR_NOT_SUPPORTED;
|
---|
3401 | #endif
|
---|
3402 | }
|
---|
3403 |
|
---|
3404 |
|
---|
3405 | /* SVGA_3D_CMD_DX_BIND_ALL_QUERY 1213 */
|
---|
3406 | static int vmsvga3dCmdDXBindAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindAllQuery const *pCmd, uint32_t cbCmd)
|
---|
3407 | {
|
---|
3408 | #ifdef VMSVGA3D_DX
|
---|
3409 | //DEBUG_BREAKPOINT_TEST();
|
---|
3410 | RT_NOREF(cbCmd);
|
---|
3411 | return vmsvga3dDXBindAllQuery(pThisCC, idDXContext, pCmd);
|
---|
3412 | #else
|
---|
3413 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3414 | return VERR_NOT_SUPPORTED;
|
---|
3415 | #endif
|
---|
3416 | }
|
---|
3417 |
|
---|
3418 |
|
---|
3419 | /* SVGA_3D_CMD_DX_READBACK_ALL_QUERY 1214 */
|
---|
3420 | static int vmsvga3dCmdDXReadbackAllQuery(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXReadbackAllQuery const *pCmd, uint32_t cbCmd)
|
---|
3421 | {
|
---|
3422 | #ifdef VMSVGA3D_DX
|
---|
3423 | //DEBUG_BREAKPOINT_TEST();
|
---|
3424 | RT_NOREF(cbCmd);
|
---|
3425 | return vmsvga3dDXReadbackAllQuery(pThisCC, idDXContext, pCmd);
|
---|
3426 | #else
|
---|
3427 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3428 | return VERR_NOT_SUPPORTED;
|
---|
3429 | #endif
|
---|
3430 | }
|
---|
3431 |
|
---|
3432 |
|
---|
3433 | /* SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER 1215 */
|
---|
3434 | static int vmsvga3dCmdDXPredTransferFromBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredTransferFromBuffer const *pCmd, uint32_t cbCmd)
|
---|
3435 | {
|
---|
3436 | #ifdef VMSVGA3D_DX
|
---|
3437 | //DEBUG_BREAKPOINT_TEST();
|
---|
3438 | RT_NOREF(idDXContext, cbCmd);
|
---|
3439 |
|
---|
3440 | /* This command is executed in a context: "The context is implied from the command buffer header."
|
---|
3441 | * However the device design allows to do the transfer without a context, so re-use context-less command handler.
|
---|
3442 | */
|
---|
3443 | SVGA3dCmdDXTransferFromBuffer cmd;
|
---|
3444 | cmd.srcSid = pCmd->srcSid;
|
---|
3445 | cmd.srcOffset = pCmd->srcOffset;
|
---|
3446 | cmd.srcPitch = pCmd->srcPitch;
|
---|
3447 | cmd.srcSlicePitch = pCmd->srcSlicePitch;
|
---|
3448 | cmd.destSid = pCmd->destSid;
|
---|
3449 | cmd.destSubResource = pCmd->destSubResource;
|
---|
3450 | cmd.destBox = pCmd->destBox;
|
---|
3451 | return vmsvga3dCmdDXTransferFromBuffer(pThisCC, &cmd, sizeof(cmd));
|
---|
3452 | #else
|
---|
3453 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3454 | return VERR_NOT_SUPPORTED;
|
---|
3455 | #endif
|
---|
3456 | }
|
---|
3457 |
|
---|
3458 |
|
---|
3459 | /* SVGA_3D_CMD_DX_MOB_FENCE_64 1216 */
|
---|
3460 | static int vmsvga3dCmdDXMobFence64(PVGASTATECC pThisCC, SVGA3dCmdDXMobFence64 const *pCmd, uint32_t cbCmd)
|
---|
3461 | {
|
---|
3462 | #ifdef VMSVGA3D_DX
|
---|
3463 | //DEBUG_BREAKPOINT_TEST();
|
---|
3464 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3465 | RT_NOREF(cbCmd);
|
---|
3466 |
|
---|
3467 | PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobId);
|
---|
3468 | ASSERT_GUEST_RETURN(pMob, VERR_INVALID_PARAMETER);
|
---|
3469 |
|
---|
3470 | int rc = vmsvgaR3MobWrite(pSvgaR3State, pMob, pCmd->mobOffset, &pCmd->value, sizeof(pCmd->value));
|
---|
3471 | ASSERT_GUEST_RETURN(RT_SUCCESS(rc), rc);
|
---|
3472 |
|
---|
3473 | return VINF_SUCCESS;
|
---|
3474 | #else
|
---|
3475 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3476 | return VERR_NOT_SUPPORTED;
|
---|
3477 | #endif
|
---|
3478 | }
|
---|
3479 |
|
---|
3480 |
|
---|
3481 | /* SVGA_3D_CMD_DX_BIND_ALL_SHADER 1217 */
|
---|
3482 | static int vmsvga3dCmdDXBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindAllShader const *pCmd, uint32_t cbCmd)
|
---|
3483 | {
|
---|
3484 | #ifdef VMSVGA3D_DX
|
---|
3485 | DEBUG_BREAKPOINT_TEST();
|
---|
3486 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3487 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3488 | return vmsvga3dDXBindAllShader(pThisCC, idDXContext);
|
---|
3489 | #else
|
---|
3490 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3491 | return VERR_NOT_SUPPORTED;
|
---|
3492 | #endif
|
---|
3493 | }
|
---|
3494 |
|
---|
3495 |
|
---|
3496 | /* SVGA_3D_CMD_DX_HINT 1218 */
|
---|
3497 | static int vmsvga3dCmdDXHint(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXHint const *pCmd, uint32_t cbCmd)
|
---|
3498 | {
|
---|
3499 | #ifdef VMSVGA3D_DX
|
---|
3500 | DEBUG_BREAKPOINT_TEST();
|
---|
3501 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3502 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3503 | return vmsvga3dDXHint(pThisCC, idDXContext);
|
---|
3504 | #else
|
---|
3505 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3506 | return VERR_NOT_SUPPORTED;
|
---|
3507 | #endif
|
---|
3508 | }
|
---|
3509 |
|
---|
3510 |
|
---|
3511 | /* SVGA_3D_CMD_DX_BUFFER_UPDATE 1219 */
|
---|
3512 | static int vmsvga3dCmdDXBufferUpdate(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBufferUpdate const *pCmd, uint32_t cbCmd)
|
---|
3513 | {
|
---|
3514 | #ifdef VMSVGA3D_DX
|
---|
3515 | DEBUG_BREAKPOINT_TEST();
|
---|
3516 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3517 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3518 | return vmsvga3dDXBufferUpdate(pThisCC, idDXContext);
|
---|
3519 | #else
|
---|
3520 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3521 | return VERR_NOT_SUPPORTED;
|
---|
3522 | #endif
|
---|
3523 | }
|
---|
3524 |
|
---|
3525 |
|
---|
3526 | /* SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET 1220 */
|
---|
3527 | static int vmsvga3dCmdDXSetVSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetVSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3528 | {
|
---|
3529 | #ifdef VMSVGA3D_DX
|
---|
3530 | DEBUG_BREAKPOINT_TEST();
|
---|
3531 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3532 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3533 | return vmsvga3dDXSetVSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3534 | #else
|
---|
3535 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3536 | return VERR_NOT_SUPPORTED;
|
---|
3537 | #endif
|
---|
3538 | }
|
---|
3539 |
|
---|
3540 |
|
---|
3541 | /* SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET 1221 */
|
---|
3542 | static int vmsvga3dCmdDXSetPSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetPSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3543 | {
|
---|
3544 | #ifdef VMSVGA3D_DX
|
---|
3545 | DEBUG_BREAKPOINT_TEST();
|
---|
3546 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3547 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3548 | return vmsvga3dDXSetPSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3549 | #else
|
---|
3550 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3551 | return VERR_NOT_SUPPORTED;
|
---|
3552 | #endif
|
---|
3553 | }
|
---|
3554 |
|
---|
3555 |
|
---|
3556 | /* SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET 1222 */
|
---|
3557 | static int vmsvga3dCmdDXSetGSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetGSConstantBufferOffset 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 vmsvga3dDXSetGSConstantBufferOffset(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_SET_HS_CONSTANT_BUFFER_OFFSET 1223 */
|
---|
3572 | static int vmsvga3dCmdDXSetHSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetHSConstantBufferOffset 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 vmsvga3dDXSetHSConstantBufferOffset(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_SET_DS_CONSTANT_BUFFER_OFFSET 1224 */
|
---|
3587 | static int vmsvga3dCmdDXSetDSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetDSConstantBufferOffset 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 vmsvga3dDXSetDSConstantBufferOffset(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_CS_CONSTANT_BUFFER_OFFSET 1225 */
|
---|
3602 | static int vmsvga3dCmdDXSetCSConstantBufferOffset(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetCSConstantBufferOffset const *pCmd, uint32_t cbCmd)
|
---|
3603 | {
|
---|
3604 | #ifdef VMSVGA3D_DX
|
---|
3605 | DEBUG_BREAKPOINT_TEST();
|
---|
3606 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3607 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3608 | return vmsvga3dDXSetCSConstantBufferOffset(pThisCC, idDXContext);
|
---|
3609 | #else
|
---|
3610 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3611 | return VERR_NOT_SUPPORTED;
|
---|
3612 | #endif
|
---|
3613 | }
|
---|
3614 |
|
---|
3615 |
|
---|
3616 | /* SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER 1226 */
|
---|
3617 | static int vmsvga3dCmdDXCondBindAllShader(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXCondBindAllShader const *pCmd, uint32_t cbCmd)
|
---|
3618 | {
|
---|
3619 | #ifdef VMSVGA3D_DX
|
---|
3620 | DEBUG_BREAKPOINT_TEST();
|
---|
3621 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3622 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3623 | return vmsvga3dDXCondBindAllShader(pThisCC, idDXContext);
|
---|
3624 | #else
|
---|
3625 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3626 | return VERR_NOT_SUPPORTED;
|
---|
3627 | #endif
|
---|
3628 | }
|
---|
3629 |
|
---|
3630 |
|
---|
3631 | /* SVGA_3D_CMD_SCREEN_COPY 1227 */
|
---|
3632 | static int vmsvga3dCmdScreenCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdScreenCopy const *pCmd, uint32_t cbCmd)
|
---|
3633 | {
|
---|
3634 | #ifdef VMSVGA3D_DX
|
---|
3635 | DEBUG_BREAKPOINT_TEST();
|
---|
3636 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3637 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3638 | return vmsvga3dScreenCopy(pThisCC, idDXContext);
|
---|
3639 | #else
|
---|
3640 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3641 | return VERR_NOT_SUPPORTED;
|
---|
3642 | #endif
|
---|
3643 | }
|
---|
3644 |
|
---|
3645 |
|
---|
3646 | /* SVGA_3D_CMD_GROW_OTABLE 1236 */
|
---|
3647 | static int vmsvga3dCmdGrowOTable(PVGASTATECC pThisCC, SVGA3dCmdGrowOTable const *pCmd, uint32_t cbCmd)
|
---|
3648 | {
|
---|
3649 | #ifdef VMSVGA3D_DX
|
---|
3650 | //DEBUG_BREAKPOINT_TEST();
|
---|
3651 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3652 | RT_NOREF(cbCmd);
|
---|
3653 | return vmsvgaR3OTableSetOrGrow(pSvgaR3State, pCmd->type, pCmd->baseAddress,
|
---|
3654 | pCmd->sizeInBytes, pCmd->validSizeInBytes, pCmd->ptDepth, /*fGrow*/ true);
|
---|
3655 | #else
|
---|
3656 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3657 | return VERR_NOT_SUPPORTED;
|
---|
3658 | #endif
|
---|
3659 | }
|
---|
3660 |
|
---|
3661 |
|
---|
3662 | /* SVGA_3D_CMD_DX_GROW_COTABLE 1237 */
|
---|
3663 | static int vmsvga3dCmdDXGrowCOTable(PVGASTATECC pThisCC, SVGA3dCmdDXGrowCOTable const *pCmd, uint32_t cbCmd)
|
---|
3664 | {
|
---|
3665 | #ifdef VMSVGA3D_DX
|
---|
3666 | //DEBUG_BREAKPOINT_TEST();
|
---|
3667 | RT_NOREF(cbCmd);
|
---|
3668 | return vmsvga3dDXGrowCOTable(pThisCC, pCmd);
|
---|
3669 | #else
|
---|
3670 | RT_NOREF(pThisCC, pCmd, cbCmd);
|
---|
3671 | return VERR_NOT_SUPPORTED;
|
---|
3672 | #endif
|
---|
3673 | }
|
---|
3674 |
|
---|
3675 |
|
---|
3676 | /* SVGA_3D_CMD_INTRA_SURFACE_COPY 1238 */
|
---|
3677 | static int vmsvga3dCmdIntraSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdIntraSurfaceCopy const *pCmd, uint32_t cbCmd)
|
---|
3678 | {
|
---|
3679 | #ifdef VMSVGA3D_DX
|
---|
3680 | DEBUG_BREAKPOINT_TEST();
|
---|
3681 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3682 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3683 | return vmsvga3dIntraSurfaceCopy(pThisCC, idDXContext);
|
---|
3684 | #else
|
---|
3685 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3686 | return VERR_NOT_SUPPORTED;
|
---|
3687 | #endif
|
---|
3688 | }
|
---|
3689 |
|
---|
3690 |
|
---|
3691 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V3 1239 */
|
---|
3692 | static int vmsvga3dCmdDefineGBSurface_v3(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface_v3 const *pCmd)
|
---|
3693 | {
|
---|
3694 | #ifdef VMSVGA3D_DX
|
---|
3695 | DEBUG_BREAKPOINT_TEST();
|
---|
3696 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3697 |
|
---|
3698 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
3699 | SVGAOTableSurfaceEntry entry;
|
---|
3700 | RT_ZERO(entry);
|
---|
3701 | entry.format = pCmd->format;
|
---|
3702 | entry.surface1Flags = (uint32_t)(pCmd->surfaceFlags);
|
---|
3703 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
3704 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
3705 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
3706 | entry.size = pCmd->size;
|
---|
3707 | entry.mobid = SVGA_ID_INVALID;
|
---|
3708 | entry.arraySize = pCmd->arraySize;
|
---|
3709 | // entry.mobPitch = 0;
|
---|
3710 | // entry.mobPitch = 0;
|
---|
3711 | entry.surface2Flags = (uint32_t)(pCmd->surfaceFlags >> UINT64_C(32));
|
---|
3712 | // entry.multisamplePattern = 0;
|
---|
3713 | // entry.qualityLevel = 0;
|
---|
3714 | // entry.bufferByteStride = 0;
|
---|
3715 | // entry.minLOD = 0;
|
---|
3716 |
|
---|
3717 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
3718 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
3719 | if (RT_SUCCESS(rc))
|
---|
3720 | {
|
---|
3721 | /* Create the host surface. */
|
---|
3722 | /** @todo SVGAOTableSurfaceEntry as input parameter? */
|
---|
3723 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
3724 | pCmd->multisampleCount, pCmd->autogenFilter,
|
---|
3725 | pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* fAllocMipLevels = */ false);
|
---|
3726 | }
|
---|
3727 | return rc;
|
---|
3728 | #else
|
---|
3729 | RT_NOREF(pThisCC, pCmd);
|
---|
3730 | return VERR_NOT_SUPPORTED;
|
---|
3731 | #endif
|
---|
3732 | }
|
---|
3733 |
|
---|
3734 |
|
---|
3735 | /* SVGA_3D_CMD_DX_RESOLVE_COPY 1240 */
|
---|
3736 | static int vmsvga3dCmdDXResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXResolveCopy const *pCmd, uint32_t cbCmd)
|
---|
3737 | {
|
---|
3738 | #ifdef VMSVGA3D_DX
|
---|
3739 | DEBUG_BREAKPOINT_TEST();
|
---|
3740 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3741 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3742 | return vmsvga3dDXResolveCopy(pThisCC, idDXContext);
|
---|
3743 | #else
|
---|
3744 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3745 | return VERR_NOT_SUPPORTED;
|
---|
3746 | #endif
|
---|
3747 | }
|
---|
3748 |
|
---|
3749 |
|
---|
3750 | /* SVGA_3D_CMD_DX_PRED_RESOLVE_COPY 1241 */
|
---|
3751 | static int vmsvga3dCmdDXPredResolveCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredResolveCopy const *pCmd, uint32_t cbCmd)
|
---|
3752 | {
|
---|
3753 | #ifdef VMSVGA3D_DX
|
---|
3754 | DEBUG_BREAKPOINT_TEST();
|
---|
3755 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3756 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3757 | return vmsvga3dDXPredResolveCopy(pThisCC, idDXContext);
|
---|
3758 | #else
|
---|
3759 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3760 | return VERR_NOT_SUPPORTED;
|
---|
3761 | #endif
|
---|
3762 | }
|
---|
3763 |
|
---|
3764 |
|
---|
3765 | /* SVGA_3D_CMD_DX_PRED_CONVERT_REGION 1242 */
|
---|
3766 | static int vmsvga3dCmdDXPredConvertRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredConvertRegion const *pCmd, uint32_t cbCmd)
|
---|
3767 | {
|
---|
3768 | #ifdef VMSVGA3D_DX
|
---|
3769 | DEBUG_BREAKPOINT_TEST();
|
---|
3770 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3771 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3772 | return vmsvga3dDXPredConvertRegion(pThisCC, idDXContext);
|
---|
3773 | #else
|
---|
3774 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3775 | return VERR_NOT_SUPPORTED;
|
---|
3776 | #endif
|
---|
3777 | }
|
---|
3778 |
|
---|
3779 |
|
---|
3780 | /* SVGA_3D_CMD_DX_PRED_CONVERT 1243 */
|
---|
3781 | static int vmsvga3dCmdDXPredConvert(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXPredConvert const *pCmd, uint32_t cbCmd)
|
---|
3782 | {
|
---|
3783 | #ifdef VMSVGA3D_DX
|
---|
3784 | DEBUG_BREAKPOINT_TEST();
|
---|
3785 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3786 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3787 | return vmsvga3dDXPredConvert(pThisCC, idDXContext);
|
---|
3788 | #else
|
---|
3789 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3790 | return VERR_NOT_SUPPORTED;
|
---|
3791 | #endif
|
---|
3792 | }
|
---|
3793 |
|
---|
3794 |
|
---|
3795 | /* SVGA_3D_CMD_WHOLE_SURFACE_COPY 1244 */
|
---|
3796 | static int vmsvga3dCmdWholeSurfaceCopy(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdWholeSurfaceCopy const *pCmd, uint32_t cbCmd)
|
---|
3797 | {
|
---|
3798 | #ifdef VMSVGA3D_DX
|
---|
3799 | DEBUG_BREAKPOINT_TEST();
|
---|
3800 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3801 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3802 | return vmsvga3dWholeSurfaceCopy(pThisCC, idDXContext);
|
---|
3803 | #else
|
---|
3804 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3805 | return VERR_NOT_SUPPORTED;
|
---|
3806 | #endif
|
---|
3807 | }
|
---|
3808 |
|
---|
3809 |
|
---|
3810 | /* SVGA_3D_CMD_DX_DEFINE_UA_VIEW 1245 */
|
---|
3811 | static int vmsvga3dCmdDXDefineUAView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineUAView const *pCmd, uint32_t cbCmd)
|
---|
3812 | {
|
---|
3813 | #ifdef VMSVGA3D_DX
|
---|
3814 | //DEBUG_BREAKPOINT_TEST();
|
---|
3815 | RT_NOREF(cbCmd);
|
---|
3816 | return vmsvga3dDXDefineUAView(pThisCC, idDXContext, pCmd);
|
---|
3817 | #else
|
---|
3818 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3819 | return VERR_NOT_SUPPORTED;
|
---|
3820 | #endif
|
---|
3821 | }
|
---|
3822 |
|
---|
3823 |
|
---|
3824 | /* SVGA_3D_CMD_DX_DESTROY_UA_VIEW 1246 */
|
---|
3825 | static int vmsvga3dCmdDXDestroyUAView(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDestroyUAView const *pCmd, uint32_t cbCmd)
|
---|
3826 | {
|
---|
3827 | #ifdef VMSVGA3D_DX
|
---|
3828 | //DEBUG_BREAKPOINT_TEST();
|
---|
3829 | RT_NOREF(cbCmd);
|
---|
3830 | return vmsvga3dDXDestroyUAView(pThisCC, idDXContext, pCmd);
|
---|
3831 | #else
|
---|
3832 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3833 | return VERR_NOT_SUPPORTED;
|
---|
3834 | #endif
|
---|
3835 | }
|
---|
3836 |
|
---|
3837 |
|
---|
3838 | /* SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT 1247 */
|
---|
3839 | static int vmsvga3dCmdDXClearUAViewUint(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearUAViewUint const *pCmd, uint32_t cbCmd)
|
---|
3840 | {
|
---|
3841 | #ifdef VMSVGA3D_DX
|
---|
3842 | DEBUG_BREAKPOINT_TEST();
|
---|
3843 | RT_NOREF(cbCmd);
|
---|
3844 | return vmsvga3dDXClearUAViewUint(pThisCC, idDXContext, pCmd);
|
---|
3845 | #else
|
---|
3846 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3847 | return VERR_NOT_SUPPORTED;
|
---|
3848 | #endif
|
---|
3849 | }
|
---|
3850 |
|
---|
3851 |
|
---|
3852 | /* SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT 1248 */
|
---|
3853 | static int vmsvga3dCmdDXClearUAViewFloat(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXClearUAViewFloat const *pCmd, uint32_t cbCmd)
|
---|
3854 | {
|
---|
3855 | #ifdef VMSVGA3D_DX
|
---|
3856 | DEBUG_BREAKPOINT_TEST();
|
---|
3857 | RT_NOREF(cbCmd);
|
---|
3858 | return vmsvga3dDXClearUAViewFloat(pThisCC, idDXContext, pCmd);
|
---|
3859 | #else
|
---|
3860 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3861 | return VERR_NOT_SUPPORTED;
|
---|
3862 | #endif
|
---|
3863 | }
|
---|
3864 |
|
---|
3865 |
|
---|
3866 | /* SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT 1249 */
|
---|
3867 | static int vmsvga3dCmdDXCopyStructureCount(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXCopyStructureCount const *pCmd, uint32_t cbCmd)
|
---|
3868 | {
|
---|
3869 | #ifdef VMSVGA3D_DX
|
---|
3870 | //DEBUG_BREAKPOINT_TEST();
|
---|
3871 | RT_NOREF(cbCmd);
|
---|
3872 | return vmsvga3dDXCopyStructureCount(pThisCC, idDXContext, pCmd);
|
---|
3873 | #else
|
---|
3874 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3875 | return VERR_NOT_SUPPORTED;
|
---|
3876 | #endif
|
---|
3877 | }
|
---|
3878 |
|
---|
3879 |
|
---|
3880 | /* SVGA_3D_CMD_DX_SET_UA_VIEWS 1250 */
|
---|
3881 | static int vmsvga3dCmdDXSetUAViews(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetUAViews const *pCmd, uint32_t cbCmd)
|
---|
3882 | {
|
---|
3883 | #ifdef VMSVGA3D_DX
|
---|
3884 | //DEBUG_BREAKPOINT_TEST();
|
---|
3885 | SVGA3dUAViewId const *paUAViewId = (SVGA3dUAViewId *)&pCmd[1];
|
---|
3886 | uint32_t const cUAViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dUAViewId);
|
---|
3887 | return vmsvga3dDXSetUAViews(pThisCC, idDXContext, pCmd, cUAViewId, paUAViewId);
|
---|
3888 | #else
|
---|
3889 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3890 | return VERR_NOT_SUPPORTED;
|
---|
3891 | #endif
|
---|
3892 | }
|
---|
3893 |
|
---|
3894 |
|
---|
3895 | /* SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT 1251 */
|
---|
3896 | static int vmsvga3dCmdDXDrawIndexedInstancedIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawIndexedInstancedIndirect const *pCmd, uint32_t cbCmd)
|
---|
3897 | {
|
---|
3898 | #ifdef VMSVGA3D_DX
|
---|
3899 | //DEBUG_BREAKPOINT_TEST();
|
---|
3900 | RT_NOREF(cbCmd);
|
---|
3901 | return vmsvga3dDXDrawIndexedInstancedIndirect(pThisCC, idDXContext, pCmd);
|
---|
3902 | #else
|
---|
3903 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3904 | return VERR_NOT_SUPPORTED;
|
---|
3905 | #endif
|
---|
3906 | }
|
---|
3907 |
|
---|
3908 |
|
---|
3909 | /* SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT 1252 */
|
---|
3910 | static int vmsvga3dCmdDXDrawInstancedIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDrawInstancedIndirect const *pCmd, uint32_t cbCmd)
|
---|
3911 | {
|
---|
3912 | #ifdef VMSVGA3D_DX
|
---|
3913 | //DEBUG_BREAKPOINT_TEST();
|
---|
3914 | RT_NOREF(cbCmd);
|
---|
3915 | return vmsvga3dDXDrawInstancedIndirect(pThisCC, idDXContext, pCmd);
|
---|
3916 | #else
|
---|
3917 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3918 | return VERR_NOT_SUPPORTED;
|
---|
3919 | #endif
|
---|
3920 | }
|
---|
3921 |
|
---|
3922 |
|
---|
3923 | /* SVGA_3D_CMD_DX_DISPATCH 1253 */
|
---|
3924 | static int vmsvga3dCmdDXDispatch(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDispatch const *pCmd, uint32_t cbCmd)
|
---|
3925 | {
|
---|
3926 | #ifdef VMSVGA3D_DX
|
---|
3927 | //DEBUG_BREAKPOINT_TEST();
|
---|
3928 | RT_NOREF(cbCmd);
|
---|
3929 | return vmsvga3dDXDispatch(pThisCC, idDXContext, pCmd);
|
---|
3930 | #else
|
---|
3931 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3932 | return VERR_NOT_SUPPORTED;
|
---|
3933 | #endif
|
---|
3934 | }
|
---|
3935 |
|
---|
3936 |
|
---|
3937 | /* SVGA_3D_CMD_DX_DISPATCH_INDIRECT 1254 */
|
---|
3938 | static int vmsvga3dCmdDXDispatchIndirect(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDispatchIndirect const *pCmd, uint32_t cbCmd)
|
---|
3939 | {
|
---|
3940 | #ifdef VMSVGA3D_DX
|
---|
3941 | DEBUG_BREAKPOINT_TEST();
|
---|
3942 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3943 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3944 | return vmsvga3dDXDispatchIndirect(pThisCC, idDXContext);
|
---|
3945 | #else
|
---|
3946 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3947 | return VERR_NOT_SUPPORTED;
|
---|
3948 | #endif
|
---|
3949 | }
|
---|
3950 |
|
---|
3951 |
|
---|
3952 | /* SVGA_3D_CMD_WRITE_ZERO_SURFACE 1255 */
|
---|
3953 | static int vmsvga3dCmdWriteZeroSurface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdWriteZeroSurface const *pCmd, uint32_t cbCmd)
|
---|
3954 | {
|
---|
3955 | #ifdef VMSVGA3D_DX
|
---|
3956 | DEBUG_BREAKPOINT_TEST();
|
---|
3957 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3958 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3959 | return vmsvga3dWriteZeroSurface(pThisCC, idDXContext);
|
---|
3960 | #else
|
---|
3961 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3962 | return VERR_NOT_SUPPORTED;
|
---|
3963 | #endif
|
---|
3964 | }
|
---|
3965 |
|
---|
3966 |
|
---|
3967 | /* SVGA_3D_CMD_HINT_ZERO_SURFACE 1256 */
|
---|
3968 | static int vmsvga3dCmdHintZeroSurface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdHintZeroSurface const *pCmd, uint32_t cbCmd)
|
---|
3969 | {
|
---|
3970 | #ifdef VMSVGA3D_DX
|
---|
3971 | DEBUG_BREAKPOINT_TEST();
|
---|
3972 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3973 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3974 | return vmsvga3dHintZeroSurface(pThisCC, idDXContext);
|
---|
3975 | #else
|
---|
3976 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3977 | return VERR_NOT_SUPPORTED;
|
---|
3978 | #endif
|
---|
3979 | }
|
---|
3980 |
|
---|
3981 |
|
---|
3982 | /* SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER 1257 */
|
---|
3983 | static int vmsvga3dCmdDXTransferToBuffer(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXTransferToBuffer const *pCmd, uint32_t cbCmd)
|
---|
3984 | {
|
---|
3985 | #ifdef VMSVGA3D_DX
|
---|
3986 | DEBUG_BREAKPOINT_TEST();
|
---|
3987 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
3988 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
3989 | return vmsvga3dDXTransferToBuffer(pThisCC, idDXContext);
|
---|
3990 | #else
|
---|
3991 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
3992 | return VERR_NOT_SUPPORTED;
|
---|
3993 | #endif
|
---|
3994 | }
|
---|
3995 |
|
---|
3996 |
|
---|
3997 | /* SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT 1258 */
|
---|
3998 | static int vmsvga3dCmdDXSetStructureCount(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetStructureCount const *pCmd, uint32_t cbCmd)
|
---|
3999 | {
|
---|
4000 | #ifdef VMSVGA3D_DX
|
---|
4001 | //DEBUG_BREAKPOINT_TEST();
|
---|
4002 | RT_NOREF(cbCmd);
|
---|
4003 | return vmsvga3dDXSetStructureCount(pThisCC, idDXContext, pCmd);
|
---|
4004 | #else
|
---|
4005 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4006 | return VERR_NOT_SUPPORTED;
|
---|
4007 | #endif
|
---|
4008 | }
|
---|
4009 |
|
---|
4010 |
|
---|
4011 | /* SVGA_3D_CMD_LOGICOPS_BITBLT 1259 */
|
---|
4012 | static int vmsvga3dCmdLogicOpsBitBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsBitBlt const *pCmd, uint32_t cbCmd)
|
---|
4013 | {
|
---|
4014 | #ifdef VMSVGA3D_DX
|
---|
4015 | DEBUG_BREAKPOINT_TEST();
|
---|
4016 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4017 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4018 | return vmsvga3dLogicOpsBitBlt(pThisCC, idDXContext);
|
---|
4019 | #else
|
---|
4020 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4021 | return VERR_NOT_SUPPORTED;
|
---|
4022 | #endif
|
---|
4023 | }
|
---|
4024 |
|
---|
4025 |
|
---|
4026 | /* SVGA_3D_CMD_LOGICOPS_TRANSBLT 1260 */
|
---|
4027 | static int vmsvga3dCmdLogicOpsTransBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsTransBlt const *pCmd, uint32_t cbCmd)
|
---|
4028 | {
|
---|
4029 | #ifdef VMSVGA3D_DX
|
---|
4030 | DEBUG_BREAKPOINT_TEST();
|
---|
4031 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4032 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4033 | return vmsvga3dLogicOpsTransBlt(pThisCC, idDXContext);
|
---|
4034 | #else
|
---|
4035 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4036 | return VERR_NOT_SUPPORTED;
|
---|
4037 | #endif
|
---|
4038 | }
|
---|
4039 |
|
---|
4040 |
|
---|
4041 | /* SVGA_3D_CMD_LOGICOPS_STRETCHBLT 1261 */
|
---|
4042 | static int vmsvga3dCmdLogicOpsStretchBlt(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsStretchBlt const *pCmd, uint32_t cbCmd)
|
---|
4043 | {
|
---|
4044 | #ifdef VMSVGA3D_DX
|
---|
4045 | DEBUG_BREAKPOINT_TEST();
|
---|
4046 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4047 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4048 | return vmsvga3dLogicOpsStretchBlt(pThisCC, idDXContext);
|
---|
4049 | #else
|
---|
4050 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4051 | return VERR_NOT_SUPPORTED;
|
---|
4052 | #endif
|
---|
4053 | }
|
---|
4054 |
|
---|
4055 |
|
---|
4056 | /* SVGA_3D_CMD_LOGICOPS_COLORFILL 1262 */
|
---|
4057 | static int vmsvga3dCmdLogicOpsColorFill(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsColorFill const *pCmd, uint32_t cbCmd)
|
---|
4058 | {
|
---|
4059 | #ifdef VMSVGA3D_DX
|
---|
4060 | DEBUG_BREAKPOINT_TEST();
|
---|
4061 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4062 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4063 | return vmsvga3dLogicOpsColorFill(pThisCC, idDXContext);
|
---|
4064 | #else
|
---|
4065 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4066 | return VERR_NOT_SUPPORTED;
|
---|
4067 | #endif
|
---|
4068 | }
|
---|
4069 |
|
---|
4070 |
|
---|
4071 | /* SVGA_3D_CMD_LOGICOPS_ALPHABLEND 1263 */
|
---|
4072 | static int vmsvga3dCmdLogicOpsAlphaBlend(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsAlphaBlend const *pCmd, uint32_t cbCmd)
|
---|
4073 | {
|
---|
4074 | #ifdef VMSVGA3D_DX
|
---|
4075 | DEBUG_BREAKPOINT_TEST();
|
---|
4076 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4077 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4078 | return vmsvga3dLogicOpsAlphaBlend(pThisCC, idDXContext);
|
---|
4079 | #else
|
---|
4080 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4081 | return VERR_NOT_SUPPORTED;
|
---|
4082 | #endif
|
---|
4083 | }
|
---|
4084 |
|
---|
4085 |
|
---|
4086 | /* SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND 1264 */
|
---|
4087 | static int vmsvga3dCmdLogicOpsClearTypeBlend(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdLogicOpsClearTypeBlend const *pCmd, uint32_t cbCmd)
|
---|
4088 | {
|
---|
4089 | #ifdef VMSVGA3D_DX
|
---|
4090 | DEBUG_BREAKPOINT_TEST();
|
---|
4091 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4092 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4093 | return vmsvga3dLogicOpsClearTypeBlend(pThisCC, idDXContext);
|
---|
4094 | #else
|
---|
4095 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4096 | return VERR_NOT_SUPPORTED;
|
---|
4097 | #endif
|
---|
4098 | }
|
---|
4099 |
|
---|
4100 |
|
---|
4101 | /* SVGA_3D_CMD_DEFINE_GB_SURFACE_V4 1267 */
|
---|
4102 | static int vmsvga3dCmdDefineGBSurface_v4(PVGASTATECC pThisCC, SVGA3dCmdDefineGBSurface_v4 const *pCmd)
|
---|
4103 | {
|
---|
4104 | #ifdef VMSVGA3D_DX
|
---|
4105 | //DEBUG_BREAKPOINT_TEST();
|
---|
4106 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4107 |
|
---|
4108 | /* Update the entry in the pSvgaR3State->pGboOTableSurface. */
|
---|
4109 | SVGAOTableSurfaceEntry entry;
|
---|
4110 | RT_ZERO(entry);
|
---|
4111 | entry.format = pCmd->format;
|
---|
4112 | entry.surface1Flags = (uint32_t)(pCmd->surfaceFlags);
|
---|
4113 | entry.numMipLevels = pCmd->numMipLevels;
|
---|
4114 | entry.multisampleCount = pCmd->multisampleCount;
|
---|
4115 | entry.autogenFilter = pCmd->autogenFilter;
|
---|
4116 | entry.size = pCmd->size;
|
---|
4117 | entry.mobid = SVGA_ID_INVALID;
|
---|
4118 | entry.arraySize = pCmd->arraySize;
|
---|
4119 | // entry.mobPitch = 0;
|
---|
4120 | // entry.mobPitch = 0;
|
---|
4121 | entry.surface2Flags = (uint32_t)(pCmd->surfaceFlags >> UINT64_C(32));
|
---|
4122 | // entry.multisamplePattern = 0;
|
---|
4123 | // entry.qualityLevel = 0;
|
---|
4124 | entry.bufferByteStride = pCmd->bufferByteStride;
|
---|
4125 | // entry.minLOD = 0;
|
---|
4126 |
|
---|
4127 | int rc = vmsvgaR3OTableWrite(pSvgaR3State, &pSvgaR3State->aGboOTables[SVGA_OTABLE_SURFACE],
|
---|
4128 | pCmd->sid, SVGA3D_OTABLE_SURFACE_ENTRY_SIZE, &entry, sizeof(entry));
|
---|
4129 | if (RT_SUCCESS(rc))
|
---|
4130 | {
|
---|
4131 | /* Create the host surface. */
|
---|
4132 | /** @todo SVGAOTableSurfaceEntry as input parameter? */
|
---|
4133 | vmsvga3dSurfaceDefine(pThisCC, pCmd->sid, pCmd->surfaceFlags, pCmd->format,
|
---|
4134 | pCmd->multisampleCount, pCmd->autogenFilter,
|
---|
4135 | pCmd->numMipLevels, &pCmd->size, pCmd->arraySize, /* fAllocMipLevels = */ false);
|
---|
4136 | }
|
---|
4137 | return rc;
|
---|
4138 | #else
|
---|
4139 | RT_NOREF(pThisCC, pCmd);
|
---|
4140 | return VERR_NOT_SUPPORTED;
|
---|
4141 | #endif
|
---|
4142 | }
|
---|
4143 |
|
---|
4144 |
|
---|
4145 | /* SVGA_3D_CMD_DX_SET_CS_UA_VIEWS 1268 */
|
---|
4146 | static int vmsvga3dCmdDXSetCSUAViews(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetCSUAViews const *pCmd, uint32_t cbCmd)
|
---|
4147 | {
|
---|
4148 | #ifdef VMSVGA3D_DX
|
---|
4149 | //DEBUG_BREAKPOINT_TEST();
|
---|
4150 | SVGA3dUAViewId const *paUAViewId = (SVGA3dUAViewId *)&pCmd[1];
|
---|
4151 | uint32_t const cUAViewId = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dUAViewId);
|
---|
4152 | return vmsvga3dDXSetCSUAViews(pThisCC, idDXContext, pCmd, cUAViewId, paUAViewId);
|
---|
4153 | #else
|
---|
4154 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4155 | return VERR_NOT_SUPPORTED;
|
---|
4156 | #endif
|
---|
4157 | }
|
---|
4158 |
|
---|
4159 |
|
---|
4160 | /* SVGA_3D_CMD_DX_SET_MIN_LOD 1269 */
|
---|
4161 | static int vmsvga3dCmdDXSetMinLOD(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetMinLOD const *pCmd, uint32_t cbCmd)
|
---|
4162 | {
|
---|
4163 | #ifdef VMSVGA3D_DX
|
---|
4164 | DEBUG_BREAKPOINT_TEST();
|
---|
4165 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4166 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4167 | return vmsvga3dDXSetMinLOD(pThisCC, idDXContext);
|
---|
4168 | #else
|
---|
4169 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4170 | return VERR_NOT_SUPPORTED;
|
---|
4171 | #endif
|
---|
4172 | }
|
---|
4173 |
|
---|
4174 |
|
---|
4175 | /* SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2 1272 */
|
---|
4176 | static int vmsvga3dCmdDXDefineDepthStencilView_v2(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineDepthStencilView_v2 const *pCmd, uint32_t cbCmd)
|
---|
4177 | {
|
---|
4178 | #ifdef VMSVGA3D_DX
|
---|
4179 | //DEBUG_BREAKPOINT_TEST();
|
---|
4180 | RT_NOREF(cbCmd);
|
---|
4181 | return vmsvga3dDXDefineDepthStencilView(pThisCC, idDXContext, pCmd);
|
---|
4182 | #else
|
---|
4183 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4184 | return VERR_NOT_SUPPORTED;
|
---|
4185 | #endif
|
---|
4186 | }
|
---|
4187 |
|
---|
4188 |
|
---|
4189 | /* SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB 1273 */
|
---|
4190 | static int vmsvga3dCmdDXDefineStreamOutputWithMob(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXDefineStreamOutputWithMob const *pCmd, uint32_t cbCmd)
|
---|
4191 | {
|
---|
4192 | #ifdef VMSVGA3D_DX
|
---|
4193 | //DEBUG_BREAKPOINT_TEST();
|
---|
4194 | RT_NOREF(cbCmd);
|
---|
4195 | return vmsvga3dDXDefineStreamOutputWithMob(pThisCC, idDXContext, pCmd);
|
---|
4196 | #else
|
---|
4197 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4198 | return VERR_NOT_SUPPORTED;
|
---|
4199 | #endif
|
---|
4200 | }
|
---|
4201 |
|
---|
4202 |
|
---|
4203 | /* SVGA_3D_CMD_DX_SET_SHADER_IFACE 1274 */
|
---|
4204 | static int vmsvga3dCmdDXSetShaderIface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXSetShaderIface const *pCmd, uint32_t cbCmd)
|
---|
4205 | {
|
---|
4206 | #ifdef VMSVGA3D_DX
|
---|
4207 | DEBUG_BREAKPOINT_TEST();
|
---|
4208 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4209 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4210 | return vmsvga3dDXSetShaderIface(pThisCC, idDXContext);
|
---|
4211 | #else
|
---|
4212 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4213 | return VERR_NOT_SUPPORTED;
|
---|
4214 | #endif
|
---|
4215 | }
|
---|
4216 |
|
---|
4217 |
|
---|
4218 | /* SVGA_3D_CMD_DX_BIND_STREAMOUTPUT 1275 */
|
---|
4219 | static int vmsvga3dCmdDXBindStreamOutput(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindStreamOutput const *pCmd, uint32_t cbCmd)
|
---|
4220 | {
|
---|
4221 | #ifdef VMSVGA3D_DX
|
---|
4222 | //DEBUG_BREAKPOINT_TEST();
|
---|
4223 | RT_NOREF(cbCmd);
|
---|
4224 | return vmsvga3dDXBindStreamOutput(pThisCC, idDXContext, pCmd);
|
---|
4225 | #else
|
---|
4226 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4227 | return VERR_NOT_SUPPORTED;
|
---|
4228 | #endif
|
---|
4229 | }
|
---|
4230 |
|
---|
4231 |
|
---|
4232 | /* SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS 1276 */
|
---|
4233 | static int vmsvga3dCmdSurfaceStretchBltNonMSToMS(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdSurfaceStretchBltNonMSToMS const *pCmd, uint32_t cbCmd)
|
---|
4234 | {
|
---|
4235 | #ifdef VMSVGA3D_DX
|
---|
4236 | DEBUG_BREAKPOINT_TEST();
|
---|
4237 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4238 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4239 | return vmsvga3dSurfaceStretchBltNonMSToMS(pThisCC, idDXContext);
|
---|
4240 | #else
|
---|
4241 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4242 | return VERR_NOT_SUPPORTED;
|
---|
4243 | #endif
|
---|
4244 | }
|
---|
4245 |
|
---|
4246 |
|
---|
4247 | /* SVGA_3D_CMD_DX_BIND_SHADER_IFACE 1277 */
|
---|
4248 | static int vmsvga3dCmdDXBindShaderIface(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdDXBindShaderIface const *pCmd, uint32_t cbCmd)
|
---|
4249 | {
|
---|
4250 | #ifdef VMSVGA3D_DX
|
---|
4251 | DEBUG_BREAKPOINT_TEST();
|
---|
4252 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4253 | RT_NOREF(pSvgaR3State, pCmd, cbCmd);
|
---|
4254 | return vmsvga3dDXBindShaderIface(pThisCC, idDXContext);
|
---|
4255 | #else
|
---|
4256 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4257 | return VERR_NOT_SUPPORTED;
|
---|
4258 | #endif
|
---|
4259 | }
|
---|
4260 |
|
---|
4261 |
|
---|
4262 | /* SVGA_3D_CMD_VB_DX_CLEAR_RENDERTARGET_VIEW_REGION 1083 */
|
---|
4263 | static int vmsvga3dCmdVBDXClearRenderTargetViewRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdVBDXClearRenderTargetViewRegion *pCmd, uint32_t cbCmd)
|
---|
4264 | {
|
---|
4265 | #ifdef VMSVGA3D_DX
|
---|
4266 | //DEBUG_BREAKPOINT_TEST();
|
---|
4267 | SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
|
---|
4268 | uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4269 | return vmsvga3dVBDXClearRenderTargetViewRegion(pThisCC, idDXContext, pCmd, cRect, paRect);
|
---|
4270 | #else
|
---|
4271 | RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
4272 | return VERR_NOT_SUPPORTED;
|
---|
4273 | #endif
|
---|
4274 | }
|
---|
4275 |
|
---|
4276 |
|
---|
4277 | /** @def VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK
|
---|
4278 | * Check that the 3D command has at least a_cbMin of payload bytes after the
|
---|
4279 | * header. Will break out of the switch if it doesn't.
|
---|
4280 | */
|
---|
4281 | # define VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(a_cbMin) \
|
---|
4282 | if (1) { \
|
---|
4283 | AssertMsgBreak(cbCmd >= (a_cbMin), ("size=%#x a_cbMin=%#zx\n", cbCmd, (size_t)(a_cbMin))); \
|
---|
4284 | RT_UNTRUSTED_VALIDATED_FENCE(); \
|
---|
4285 | } else do {} while (0)
|
---|
4286 |
|
---|
4287 | # define VMSVGA_3D_CMD_NOTIMPL() \
|
---|
4288 | if (1) { \
|
---|
4289 | AssertMsgFailed(("Not implemented %d %s\n", enmCmdId, vmsvgaR3FifoCmdToString(enmCmdId))); \
|
---|
4290 | } else do {} while (0)
|
---|
4291 |
|
---|
4292 | /** SVGA_3D_CMD_* handler.
|
---|
4293 | * This function parses the command and calls the corresponding command handler.
|
---|
4294 | *
|
---|
4295 | * @param pThis The shared VGA/VMSVGA state.
|
---|
4296 | * @param pThisCC The VGA/VMSVGA state for the current context.
|
---|
4297 | * @param idDXContext VGPU10 DX context of the commands or SVGA3D_INVALID_ID if they are not for a specific context.
|
---|
4298 | * @param enmCmdId SVGA_3D_CMD_* command identifier.
|
---|
4299 | * @param cbCmd Size of the command in bytes.
|
---|
4300 | * @param pvCmd Pointer to the command.
|
---|
4301 | * @returns VBox status code if an error was detected parsing a command.
|
---|
4302 | */
|
---|
4303 | int vmsvgaR3Process3dCmd(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t idDXContext, SVGAFifo3dCmdId enmCmdId, uint32_t cbCmd, void const *pvCmd)
|
---|
4304 | {
|
---|
4305 | if (enmCmdId > SVGA_3D_CMD_MAX)
|
---|
4306 | {
|
---|
4307 | LogRelMax(16, ("VMSVGA: unsupported 3D command %d\n", enmCmdId));
|
---|
4308 | ASSERT_GUEST_FAILED_RETURN(VERR_NOT_IMPLEMENTED);
|
---|
4309 | }
|
---|
4310 |
|
---|
4311 | int rcParse = VINF_SUCCESS;
|
---|
4312 | PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
4313 |
|
---|
4314 | switch (enmCmdId)
|
---|
4315 | {
|
---|
4316 | case SVGA_3D_CMD_SURFACE_DEFINE:
|
---|
4317 | {
|
---|
4318 | SVGA3dCmdDefineSurface *pCmd = (SVGA3dCmdDefineSurface *)pvCmd;
|
---|
4319 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4320 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDefine);
|
---|
4321 |
|
---|
4322 | SVGA3dCmdDefineSurface_v2 cmd;
|
---|
4323 | cmd.sid = pCmd->sid;
|
---|
4324 | cmd.surfaceFlags = pCmd->surfaceFlags;
|
---|
4325 | cmd.format = pCmd->format;
|
---|
4326 | memcpy(cmd.face, pCmd->face, sizeof(cmd.face));
|
---|
4327 | cmd.multisampleCount = 0;
|
---|
4328 | cmd.autogenFilter = SVGA3D_TEX_FILTER_NONE;
|
---|
4329 |
|
---|
4330 | uint32_t const cMipLevelSizes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSize);
|
---|
4331 | vmsvga3dCmdDefineSurface(pThisCC, &cmd, cMipLevelSizes, (SVGA3dSize *)(pCmd + 1));
|
---|
4332 | # ifdef DEBUG_GMR_ACCESS
|
---|
4333 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis);
|
---|
4334 | # endif
|
---|
4335 | break;
|
---|
4336 | }
|
---|
4337 |
|
---|
4338 | case SVGA_3D_CMD_SURFACE_DEFINE_V2:
|
---|
4339 | {
|
---|
4340 | SVGA3dCmdDefineSurface_v2 *pCmd = (SVGA3dCmdDefineSurface_v2 *)pvCmd;
|
---|
4341 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4342 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDefineV2);
|
---|
4343 |
|
---|
4344 | uint32_t const cMipLevelSizes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dSize);
|
---|
4345 | vmsvga3dCmdDefineSurface(pThisCC, pCmd, cMipLevelSizes, (SVGA3dSize *)(pCmd + 1));
|
---|
4346 | # ifdef DEBUG_GMR_ACCESS
|
---|
4347 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3ResetGmrHandlers, 1, pThis);
|
---|
4348 | # endif
|
---|
4349 | break;
|
---|
4350 | }
|
---|
4351 |
|
---|
4352 | case SVGA_3D_CMD_SURFACE_DESTROY:
|
---|
4353 | {
|
---|
4354 | SVGA3dCmdDestroySurface *pCmd = (SVGA3dCmdDestroySurface *)pvCmd;
|
---|
4355 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4356 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDestroy);
|
---|
4357 |
|
---|
4358 | vmsvga3dSurfaceDestroy(pThisCC, pCmd->sid);
|
---|
4359 | break;
|
---|
4360 | }
|
---|
4361 |
|
---|
4362 | case SVGA_3D_CMD_SURFACE_COPY:
|
---|
4363 | {
|
---|
4364 | SVGA3dCmdSurfaceCopy *pCmd = (SVGA3dCmdSurfaceCopy *)pvCmd;
|
---|
4365 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4366 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceCopy);
|
---|
4367 |
|
---|
4368 | uint32_t const cCopyBoxes = (cbCmd - sizeof(pCmd)) / sizeof(SVGA3dCopyBox);
|
---|
4369 | vmsvga3dSurfaceCopy(pThisCC, pCmd->dest, pCmd->src, cCopyBoxes, (SVGA3dCopyBox *)(pCmd + 1));
|
---|
4370 | break;
|
---|
4371 | }
|
---|
4372 |
|
---|
4373 | case SVGA_3D_CMD_SURFACE_STRETCHBLT:
|
---|
4374 | {
|
---|
4375 | SVGA3dCmdSurfaceStretchBlt *pCmd = (SVGA3dCmdSurfaceStretchBlt *)pvCmd;
|
---|
4376 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4377 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceStretchBlt);
|
---|
4378 |
|
---|
4379 | vmsvga3dSurfaceStretchBlt(pThis, pThisCC, &pCmd->dest, &pCmd->boxDest,
|
---|
4380 | &pCmd->src, &pCmd->boxSrc, pCmd->mode);
|
---|
4381 | break;
|
---|
4382 | }
|
---|
4383 |
|
---|
4384 | case SVGA_3D_CMD_SURFACE_DMA:
|
---|
4385 | {
|
---|
4386 | SVGA3dCmdSurfaceDMA *pCmd = (SVGA3dCmdSurfaceDMA *)pvCmd;
|
---|
4387 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4388 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceDma);
|
---|
4389 |
|
---|
4390 | uint64_t u64NanoTS = 0;
|
---|
4391 | if (LogRelIs3Enabled())
|
---|
4392 | u64NanoTS = RTTimeNanoTS();
|
---|
4393 | uint32_t const cCopyBoxes = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dCopyBox);
|
---|
4394 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dSurfaceDmaProf, a);
|
---|
4395 | vmsvga3dSurfaceDMA(pThis, pThisCC, pCmd->guest, pCmd->host, pCmd->transfer,
|
---|
4396 | cCopyBoxes, (SVGA3dCopyBox *)(pCmd + 1));
|
---|
4397 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dSurfaceDmaProf, a);
|
---|
4398 | if (LogRelIs3Enabled())
|
---|
4399 | {
|
---|
4400 | if (cCopyBoxes)
|
---|
4401 | {
|
---|
4402 | SVGA3dCopyBox *pFirstBox = (SVGA3dCopyBox *)(pCmd + 1);
|
---|
4403 | LogRel3(("VMSVGA: SURFACE_DMA: %d us %d boxes %d,%d %dx%d%s\n",
|
---|
4404 | (RTTimeNanoTS() - u64NanoTS) / 1000ULL, cCopyBoxes,
|
---|
4405 | pFirstBox->x, pFirstBox->y, pFirstBox->w, pFirstBox->h,
|
---|
4406 | pCmd->transfer == SVGA3D_READ_HOST_VRAM ? " readback!!!" : ""));
|
---|
4407 | }
|
---|
4408 | }
|
---|
4409 | break;
|
---|
4410 | }
|
---|
4411 |
|
---|
4412 | case SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN:
|
---|
4413 | {
|
---|
4414 | SVGA3dCmdBlitSurfaceToScreen *pCmd = (SVGA3dCmdBlitSurfaceToScreen *)pvCmd;
|
---|
4415 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4416 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSurfaceScreen);
|
---|
4417 |
|
---|
4418 | static uint64_t u64FrameStartNanoTS = 0;
|
---|
4419 | static uint64_t u64ElapsedPerSecNano = 0;
|
---|
4420 | static int cFrames = 0;
|
---|
4421 | uint64_t u64NanoTS = 0;
|
---|
4422 | if (LogRelIs3Enabled())
|
---|
4423 | u64NanoTS = RTTimeNanoTS();
|
---|
4424 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
|
---|
4425 | STAM_REL_PROFILE_START(&pSvgaR3State->StatR3Cmd3dBlitSurfaceToScreenProf, a);
|
---|
4426 | vmsvga3dSurfaceBlitToScreen(pThis, pThisCC, pCmd->destScreenId, pCmd->destRect, pCmd->srcImage,
|
---|
4427 | pCmd->srcRect, cRects, (SVGASignedRect *)(pCmd + 1));
|
---|
4428 | STAM_REL_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dBlitSurfaceToScreenProf, a);
|
---|
4429 | if (LogRelIs3Enabled())
|
---|
4430 | {
|
---|
4431 | uint64_t u64ElapsedNano = RTTimeNanoTS() - u64NanoTS;
|
---|
4432 | u64ElapsedPerSecNano += u64ElapsedNano;
|
---|
4433 |
|
---|
4434 | SVGASignedRect *pFirstRect = cRects ? (SVGASignedRect *)(pCmd + 1) : &pCmd->destRect;
|
---|
4435 | LogRel3(("VMSVGA: SURFACE_TO_SCREEN: %d us %d rects %d,%d %dx%d\n",
|
---|
4436 | (u64ElapsedNano) / 1000ULL, cRects,
|
---|
4437 | pFirstRect->left, pFirstRect->top,
|
---|
4438 | pFirstRect->right - pFirstRect->left, pFirstRect->bottom - pFirstRect->top));
|
---|
4439 |
|
---|
4440 | ++cFrames;
|
---|
4441 | if (u64NanoTS - u64FrameStartNanoTS >= UINT64_C(1000000000))
|
---|
4442 | {
|
---|
4443 | LogRel3(("VMSVGA: SURFACE_TO_SCREEN: FPS %d, elapsed %llu us\n",
|
---|
4444 | cFrames, u64ElapsedPerSecNano / 1000ULL));
|
---|
4445 | u64FrameStartNanoTS = u64NanoTS;
|
---|
4446 | cFrames = 0;
|
---|
4447 | u64ElapsedPerSecNano = 0;
|
---|
4448 | }
|
---|
4449 | }
|
---|
4450 | break;
|
---|
4451 | }
|
---|
4452 |
|
---|
4453 | case SVGA_3D_CMD_CONTEXT_DEFINE:
|
---|
4454 | {
|
---|
4455 | SVGA3dCmdDefineContext *pCmd = (SVGA3dCmdDefineContext *)pvCmd;
|
---|
4456 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4457 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dContextDefine);
|
---|
4458 |
|
---|
4459 | vmsvga3dContextDefine(pThisCC, pCmd->cid);
|
---|
4460 | break;
|
---|
4461 | }
|
---|
4462 |
|
---|
4463 | case SVGA_3D_CMD_CONTEXT_DESTROY:
|
---|
4464 | {
|
---|
4465 | SVGA3dCmdDestroyContext *pCmd = (SVGA3dCmdDestroyContext *)pvCmd;
|
---|
4466 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4467 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dContextDestroy);
|
---|
4468 |
|
---|
4469 | vmsvga3dContextDestroy(pThisCC, pCmd->cid);
|
---|
4470 | break;
|
---|
4471 | }
|
---|
4472 |
|
---|
4473 | case SVGA_3D_CMD_SETTRANSFORM:
|
---|
4474 | {
|
---|
4475 | SVGA3dCmdSetTransform *pCmd = (SVGA3dCmdSetTransform *)pvCmd;
|
---|
4476 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4477 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetTransform);
|
---|
4478 |
|
---|
4479 | vmsvga3dSetTransform(pThisCC, pCmd->cid, pCmd->type, pCmd->matrix);
|
---|
4480 | break;
|
---|
4481 | }
|
---|
4482 |
|
---|
4483 | case SVGA_3D_CMD_SETZRANGE:
|
---|
4484 | {
|
---|
4485 | SVGA3dCmdSetZRange *pCmd = (SVGA3dCmdSetZRange *)pvCmd;
|
---|
4486 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4487 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetZRange);
|
---|
4488 |
|
---|
4489 | vmsvga3dSetZRange(pThisCC, pCmd->cid, pCmd->zRange);
|
---|
4490 | break;
|
---|
4491 | }
|
---|
4492 |
|
---|
4493 | case SVGA_3D_CMD_SETRENDERSTATE:
|
---|
4494 | {
|
---|
4495 | SVGA3dCmdSetRenderState *pCmd = (SVGA3dCmdSetRenderState *)pvCmd;
|
---|
4496 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4497 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetRenderState);
|
---|
4498 |
|
---|
4499 | uint32_t const cRenderStates = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRenderState);
|
---|
4500 | vmsvga3dSetRenderState(pThisCC, pCmd->cid, cRenderStates, (SVGA3dRenderState *)(pCmd + 1));
|
---|
4501 | break;
|
---|
4502 | }
|
---|
4503 |
|
---|
4504 | case SVGA_3D_CMD_SETRENDERTARGET:
|
---|
4505 | {
|
---|
4506 | SVGA3dCmdSetRenderTarget *pCmd = (SVGA3dCmdSetRenderTarget *)pvCmd;
|
---|
4507 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4508 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetRenderTarget);
|
---|
4509 |
|
---|
4510 | vmsvga3dSetRenderTarget(pThisCC, pCmd->cid, pCmd->type, pCmd->target);
|
---|
4511 | break;
|
---|
4512 | }
|
---|
4513 |
|
---|
4514 | case SVGA_3D_CMD_SETTEXTURESTATE:
|
---|
4515 | {
|
---|
4516 | SVGA3dCmdSetTextureState *pCmd = (SVGA3dCmdSetTextureState *)pvCmd;
|
---|
4517 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4518 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetTextureState);
|
---|
4519 |
|
---|
4520 | uint32_t const cTextureStates = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dTextureState);
|
---|
4521 | vmsvga3dSetTextureState(pThisCC, pCmd->cid, cTextureStates, (SVGA3dTextureState *)(pCmd + 1));
|
---|
4522 | break;
|
---|
4523 | }
|
---|
4524 |
|
---|
4525 | case SVGA_3D_CMD_SETMATERIAL:
|
---|
4526 | {
|
---|
4527 | SVGA3dCmdSetMaterial *pCmd = (SVGA3dCmdSetMaterial *)pvCmd;
|
---|
4528 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4529 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetMaterial);
|
---|
4530 |
|
---|
4531 | vmsvga3dSetMaterial(pThisCC, pCmd->cid, pCmd->face, &pCmd->material);
|
---|
4532 | break;
|
---|
4533 | }
|
---|
4534 |
|
---|
4535 | case SVGA_3D_CMD_SETLIGHTDATA:
|
---|
4536 | {
|
---|
4537 | SVGA3dCmdSetLightData *pCmd = (SVGA3dCmdSetLightData *)pvCmd;
|
---|
4538 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4539 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetLightData);
|
---|
4540 |
|
---|
4541 | vmsvga3dSetLightData(pThisCC, pCmd->cid, pCmd->index, &pCmd->data);
|
---|
4542 | break;
|
---|
4543 | }
|
---|
4544 |
|
---|
4545 | case SVGA_3D_CMD_SETLIGHTENABLED:
|
---|
4546 | {
|
---|
4547 | SVGA3dCmdSetLightEnabled *pCmd = (SVGA3dCmdSetLightEnabled *)pvCmd;
|
---|
4548 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4549 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetLightEnable);
|
---|
4550 |
|
---|
4551 | vmsvga3dSetLightEnabled(pThisCC, pCmd->cid, pCmd->index, pCmd->enabled);
|
---|
4552 | break;
|
---|
4553 | }
|
---|
4554 |
|
---|
4555 | case SVGA_3D_CMD_SETVIEWPORT:
|
---|
4556 | {
|
---|
4557 | SVGA3dCmdSetViewport *pCmd = (SVGA3dCmdSetViewport *)pvCmd;
|
---|
4558 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4559 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetViewPort);
|
---|
4560 |
|
---|
4561 | vmsvga3dSetViewPort(pThisCC, pCmd->cid, &pCmd->rect);
|
---|
4562 | break;
|
---|
4563 | }
|
---|
4564 |
|
---|
4565 | case SVGA_3D_CMD_SETCLIPPLANE:
|
---|
4566 | {
|
---|
4567 | SVGA3dCmdSetClipPlane *pCmd = (SVGA3dCmdSetClipPlane *)pvCmd;
|
---|
4568 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4569 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetClipPlane);
|
---|
4570 |
|
---|
4571 | vmsvga3dSetClipPlane(pThisCC, pCmd->cid, pCmd->index, pCmd->plane);
|
---|
4572 | break;
|
---|
4573 | }
|
---|
4574 |
|
---|
4575 | case SVGA_3D_CMD_CLEAR:
|
---|
4576 | {
|
---|
4577 | SVGA3dCmdClear *pCmd = (SVGA3dCmdClear *)pvCmd;
|
---|
4578 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4579 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dClear);
|
---|
4580 |
|
---|
4581 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dRect);
|
---|
4582 | vmsvga3dCommandClear(pThisCC, pCmd->cid, pCmd->clearFlag, pCmd->color, pCmd->depth, pCmd->stencil, cRects, (SVGA3dRect *)(pCmd + 1));
|
---|
4583 | break;
|
---|
4584 | }
|
---|
4585 |
|
---|
4586 | case SVGA_3D_CMD_PRESENT:
|
---|
4587 | case SVGA_3D_CMD_PRESENT_READBACK: /** @todo SVGA_3D_CMD_PRESENT_READBACK isn't quite the same as present... */
|
---|
4588 | {
|
---|
4589 | SVGA3dCmdPresent *pCmd = (SVGA3dCmdPresent *)pvCmd;
|
---|
4590 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4591 | if (enmCmdId == SVGA_3D_CMD_PRESENT)
|
---|
4592 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dPresent);
|
---|
4593 | else
|
---|
4594 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dPresentReadBack);
|
---|
4595 |
|
---|
4596 | uint32_t const cRects = (cbCmd - sizeof(*pCmd)) / sizeof(SVGA3dCopyRect);
|
---|
4597 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dPresentProf, a);
|
---|
4598 | vmsvga3dCommandPresent(pThis, pThisCC, pCmd->sid, cRects, (SVGA3dCopyRect *)(pCmd + 1));
|
---|
4599 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dPresentProf, a);
|
---|
4600 | break;
|
---|
4601 | }
|
---|
4602 |
|
---|
4603 | case SVGA_3D_CMD_SHADER_DEFINE:
|
---|
4604 | {
|
---|
4605 | SVGA3dCmdDefineShader *pCmd = (SVGA3dCmdDefineShader *)pvCmd;
|
---|
4606 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4607 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dShaderDefine);
|
---|
4608 |
|
---|
4609 | uint32_t const cbData = (cbCmd - sizeof(*pCmd));
|
---|
4610 | vmsvga3dShaderDefine(pThisCC, pCmd->cid, pCmd->shid, pCmd->type, cbData, (uint32_t *)(pCmd + 1));
|
---|
4611 | break;
|
---|
4612 | }
|
---|
4613 |
|
---|
4614 | case SVGA_3D_CMD_SHADER_DESTROY:
|
---|
4615 | {
|
---|
4616 | SVGA3dCmdDestroyShader *pCmd = (SVGA3dCmdDestroyShader *)pvCmd;
|
---|
4617 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4618 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dShaderDestroy);
|
---|
4619 |
|
---|
4620 | vmsvga3dShaderDestroy(pThisCC, pCmd->cid, pCmd->shid, pCmd->type);
|
---|
4621 | break;
|
---|
4622 | }
|
---|
4623 |
|
---|
4624 | case SVGA_3D_CMD_SET_SHADER:
|
---|
4625 | {
|
---|
4626 | SVGA3dCmdSetShader *pCmd = (SVGA3dCmdSetShader *)pvCmd;
|
---|
4627 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4628 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetShader);
|
---|
4629 |
|
---|
4630 | vmsvga3dShaderSet(pThisCC, NULL, pCmd->cid, pCmd->type, pCmd->shid);
|
---|
4631 | break;
|
---|
4632 | }
|
---|
4633 |
|
---|
4634 | case SVGA_3D_CMD_SET_SHADER_CONST:
|
---|
4635 | {
|
---|
4636 | SVGA3dCmdSetShaderConst *pCmd = (SVGA3dCmdSetShaderConst *)pvCmd;
|
---|
4637 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4638 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetShaderConst);
|
---|
4639 |
|
---|
4640 | uint32_t const cRegisters = (cbCmd - sizeof(*pCmd)) / sizeof(pCmd->values) + 1;
|
---|
4641 | vmsvga3dShaderSetConst(pThisCC, pCmd->cid, pCmd->reg, pCmd->type, pCmd->ctype, cRegisters, pCmd->values);
|
---|
4642 | break;
|
---|
4643 | }
|
---|
4644 |
|
---|
4645 | case SVGA_3D_CMD_DRAW_PRIMITIVES:
|
---|
4646 | {
|
---|
4647 | SVGA3dCmdDrawPrimitives *pCmd = (SVGA3dCmdDrawPrimitives *)pvCmd;
|
---|
4648 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4649 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dDrawPrimitives);
|
---|
4650 |
|
---|
4651 | ASSERT_GUEST_STMT_BREAK(pCmd->numRanges <= SVGA3D_MAX_DRAW_PRIMITIVE_RANGES, rcParse = VERR_INVALID_PARAMETER);
|
---|
4652 | ASSERT_GUEST_STMT_BREAK(pCmd->numVertexDecls <= SVGA3D_MAX_VERTEX_ARRAYS, rcParse = VERR_INVALID_PARAMETER);
|
---|
4653 | uint32_t const cbRangesAndVertexDecls = pCmd->numVertexDecls * sizeof(SVGA3dVertexDecl)
|
---|
4654 | + pCmd->numRanges * sizeof(SVGA3dPrimitiveRange);
|
---|
4655 | ASSERT_GUEST_STMT_BREAK(cbRangesAndVertexDecls <= cbCmd - sizeof(*pCmd), rcParse = VERR_INVALID_PARAMETER);
|
---|
4656 |
|
---|
4657 | uint32_t const cVertexDivisor = (cbCmd - sizeof(*pCmd) - cbRangesAndVertexDecls) / sizeof(uint32_t);
|
---|
4658 | ASSERT_GUEST_STMT_BREAK(!cVertexDivisor || cVertexDivisor == pCmd->numVertexDecls, rcParse = VERR_INVALID_PARAMETER);
|
---|
4659 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
4660 |
|
---|
4661 | SVGA3dVertexDecl *pVertexDecl = (SVGA3dVertexDecl *)(pCmd + 1);
|
---|
4662 | SVGA3dPrimitiveRange *pNumRange = (SVGA3dPrimitiveRange *)&pVertexDecl[pCmd->numVertexDecls];
|
---|
4663 | SVGA3dVertexDivisor *pVertexDivisor = cVertexDivisor ? (SVGA3dVertexDivisor *)&pNumRange[pCmd->numRanges] : NULL;
|
---|
4664 |
|
---|
4665 | STAM_PROFILE_START(&pSvgaR3State->StatR3Cmd3dDrawPrimitivesProf, a);
|
---|
4666 | vmsvga3dDrawPrimitives(pThisCC, pCmd->cid, pCmd->numVertexDecls, pVertexDecl, pCmd->numRanges,
|
---|
4667 | pNumRange, cVertexDivisor, pVertexDivisor);
|
---|
4668 | STAM_PROFILE_STOP(&pSvgaR3State->StatR3Cmd3dDrawPrimitivesProf, a);
|
---|
4669 | break;
|
---|
4670 | }
|
---|
4671 |
|
---|
4672 | case SVGA_3D_CMD_SETSCISSORRECT:
|
---|
4673 | {
|
---|
4674 | SVGA3dCmdSetScissorRect *pCmd = (SVGA3dCmdSetScissorRect *)pvCmd;
|
---|
4675 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4676 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dSetScissorRect);
|
---|
4677 |
|
---|
4678 | vmsvga3dSetScissorRect(pThisCC, pCmd->cid, &pCmd->rect);
|
---|
4679 | break;
|
---|
4680 | }
|
---|
4681 |
|
---|
4682 | case SVGA_3D_CMD_BEGIN_QUERY:
|
---|
4683 | {
|
---|
4684 | SVGA3dCmdBeginQuery *pCmd = (SVGA3dCmdBeginQuery *)pvCmd;
|
---|
4685 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4686 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dBeginQuery);
|
---|
4687 |
|
---|
4688 | vmsvga3dQueryBegin(pThisCC, pCmd->cid, pCmd->type);
|
---|
4689 | break;
|
---|
4690 | }
|
---|
4691 |
|
---|
4692 | case SVGA_3D_CMD_END_QUERY:
|
---|
4693 | {
|
---|
4694 | SVGA3dCmdEndQuery *pCmd = (SVGA3dCmdEndQuery *)pvCmd;
|
---|
4695 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4696 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dEndQuery);
|
---|
4697 |
|
---|
4698 | vmsvga3dQueryEnd(pThisCC, pCmd->cid, pCmd->type);
|
---|
4699 | break;
|
---|
4700 | }
|
---|
4701 |
|
---|
4702 | case SVGA_3D_CMD_WAIT_FOR_QUERY:
|
---|
4703 | {
|
---|
4704 | SVGA3dCmdWaitForQuery *pCmd = (SVGA3dCmdWaitForQuery *)pvCmd;
|
---|
4705 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4706 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dWaitForQuery);
|
---|
4707 |
|
---|
4708 | vmsvga3dQueryWait(pThisCC, pCmd->cid, pCmd->type, pThis, &pCmd->guestResult);
|
---|
4709 | break;
|
---|
4710 | }
|
---|
4711 |
|
---|
4712 | case SVGA_3D_CMD_GENERATE_MIPMAPS:
|
---|
4713 | {
|
---|
4714 | SVGA3dCmdGenerateMipmaps *pCmd = (SVGA3dCmdGenerateMipmaps *)pvCmd;
|
---|
4715 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4716 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dGenerateMipmaps);
|
---|
4717 |
|
---|
4718 | vmsvga3dGenerateMipmaps(pThisCC, pCmd->sid, pCmd->filter);
|
---|
4719 | break;
|
---|
4720 | }
|
---|
4721 |
|
---|
4722 | case SVGA_3D_CMD_ACTIVATE_SURFACE:
|
---|
4723 | /* context id + surface id? */
|
---|
4724 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dActivateSurface);
|
---|
4725 | break;
|
---|
4726 |
|
---|
4727 | case SVGA_3D_CMD_DEACTIVATE_SURFACE:
|
---|
4728 | /* context id + surface id? */
|
---|
4729 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3Cmd3dDeactivateSurface);
|
---|
4730 | break;
|
---|
4731 |
|
---|
4732 | /*
|
---|
4733 | *
|
---|
4734 | * VPGU10: SVGA_CAP_GBOBJECTS+ commands.
|
---|
4735 | *
|
---|
4736 | */
|
---|
4737 | case SVGA_3D_CMD_SCREEN_DMA:
|
---|
4738 | {
|
---|
4739 | SVGA3dCmdScreenDMA *pCmd = (SVGA3dCmdScreenDMA *)pvCmd;
|
---|
4740 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4741 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4742 | break;
|
---|
4743 | }
|
---|
4744 |
|
---|
4745 | /* case SVGA_3D_CMD_DEAD1: New SVGA_3D_CMD_VB_DX_CLEAR_RENDERTARGET_VIEW_REGION */
|
---|
4746 | case SVGA_3D_CMD_DEAD2:
|
---|
4747 | case SVGA_3D_CMD_DEAD12: /* Old SVGA_3D_CMD_LOGICOPS_BITBLT */
|
---|
4748 | case SVGA_3D_CMD_DEAD13: /* Old SVGA_3D_CMD_LOGICOPS_TRANSBLT */
|
---|
4749 | case SVGA_3D_CMD_DEAD14: /* Old SVGA_3D_CMD_LOGICOPS_STRETCHBLT */
|
---|
4750 | case SVGA_3D_CMD_DEAD15: /* Old SVGA_3D_CMD_LOGICOPS_COLORFILL */
|
---|
4751 | case SVGA_3D_CMD_DEAD16: /* Old SVGA_3D_CMD_LOGICOPS_ALPHABLEND */
|
---|
4752 | case SVGA_3D_CMD_DEAD17: /* Old SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND */
|
---|
4753 | {
|
---|
4754 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
4755 | break;
|
---|
4756 | }
|
---|
4757 |
|
---|
4758 | case SVGA_3D_CMD_SET_OTABLE_BASE:
|
---|
4759 | {
|
---|
4760 | SVGA3dCmdSetOTableBase *pCmd = (SVGA3dCmdSetOTableBase *)pvCmd;
|
---|
4761 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4762 | vmsvga3dCmdSetOTableBase(pThisCC, pCmd);
|
---|
4763 | break;
|
---|
4764 | }
|
---|
4765 |
|
---|
4766 | case SVGA_3D_CMD_READBACK_OTABLE:
|
---|
4767 | {
|
---|
4768 | SVGA3dCmdReadbackOTable *pCmd = (SVGA3dCmdReadbackOTable *)pvCmd;
|
---|
4769 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4770 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4771 | break;
|
---|
4772 | }
|
---|
4773 |
|
---|
4774 | case SVGA_3D_CMD_DEFINE_GB_MOB:
|
---|
4775 | {
|
---|
4776 | SVGA3dCmdDefineGBMob *pCmd = (SVGA3dCmdDefineGBMob *)pvCmd;
|
---|
4777 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4778 | vmsvga3dCmdDefineGBMob(pThisCC, pCmd);
|
---|
4779 | break;
|
---|
4780 | }
|
---|
4781 |
|
---|
4782 | case SVGA_3D_CMD_DESTROY_GB_MOB:
|
---|
4783 | {
|
---|
4784 | SVGA3dCmdDestroyGBMob *pCmd = (SVGA3dCmdDestroyGBMob *)pvCmd;
|
---|
4785 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4786 | vmsvga3dCmdDestroyGBMob(pThisCC, pCmd);
|
---|
4787 | break;
|
---|
4788 | }
|
---|
4789 |
|
---|
4790 | case SVGA_3D_CMD_DEAD3:
|
---|
4791 | {
|
---|
4792 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
4793 | break;
|
---|
4794 | }
|
---|
4795 |
|
---|
4796 | case SVGA_3D_CMD_UPDATE_GB_MOB_MAPPING:
|
---|
4797 | {
|
---|
4798 | SVGA3dCmdUpdateGBMobMapping *pCmd = (SVGA3dCmdUpdateGBMobMapping *)pvCmd;
|
---|
4799 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4800 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4801 | break;
|
---|
4802 | }
|
---|
4803 |
|
---|
4804 | case SVGA_3D_CMD_DEFINE_GB_SURFACE:
|
---|
4805 | {
|
---|
4806 | SVGA3dCmdDefineGBSurface *pCmd = (SVGA3dCmdDefineGBSurface *)pvCmd;
|
---|
4807 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4808 | vmsvga3dCmdDefineGBSurface(pThisCC, pCmd);
|
---|
4809 | break;
|
---|
4810 | }
|
---|
4811 |
|
---|
4812 | case SVGA_3D_CMD_DESTROY_GB_SURFACE:
|
---|
4813 | {
|
---|
4814 | SVGA3dCmdDestroyGBSurface *pCmd = (SVGA3dCmdDestroyGBSurface *)pvCmd;
|
---|
4815 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4816 | vmsvga3dCmdDestroyGBSurface(pThisCC, pCmd);
|
---|
4817 | break;
|
---|
4818 | }
|
---|
4819 |
|
---|
4820 | case SVGA_3D_CMD_BIND_GB_SURFACE:
|
---|
4821 | {
|
---|
4822 | SVGA3dCmdBindGBSurface *pCmd = (SVGA3dCmdBindGBSurface *)pvCmd;
|
---|
4823 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4824 | vmsvga3dCmdBindGBSurface(pThisCC, pCmd);
|
---|
4825 | break;
|
---|
4826 | }
|
---|
4827 |
|
---|
4828 | case SVGA_3D_CMD_COND_BIND_GB_SURFACE:
|
---|
4829 | {
|
---|
4830 | SVGA3dCmdCondBindGBSurface *pCmd = (SVGA3dCmdCondBindGBSurface *)pvCmd;
|
---|
4831 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4832 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4833 | break;
|
---|
4834 | }
|
---|
4835 |
|
---|
4836 | case SVGA_3D_CMD_UPDATE_GB_IMAGE:
|
---|
4837 | {
|
---|
4838 | SVGA3dCmdUpdateGBImage *pCmd = (SVGA3dCmdUpdateGBImage *)pvCmd;
|
---|
4839 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4840 | vmsvga3dCmdUpdateGBImage(pThisCC, pCmd);
|
---|
4841 | break;
|
---|
4842 | }
|
---|
4843 |
|
---|
4844 | case SVGA_3D_CMD_UPDATE_GB_SURFACE:
|
---|
4845 | {
|
---|
4846 | SVGA3dCmdUpdateGBSurface *pCmd = (SVGA3dCmdUpdateGBSurface *)pvCmd;
|
---|
4847 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4848 | vmsvga3dCmdUpdateGBSurface(pThisCC, pCmd);
|
---|
4849 | break;
|
---|
4850 | }
|
---|
4851 |
|
---|
4852 | case SVGA_3D_CMD_READBACK_GB_IMAGE:
|
---|
4853 | {
|
---|
4854 | SVGA3dCmdReadbackGBImage *pCmd = (SVGA3dCmdReadbackGBImage *)pvCmd;
|
---|
4855 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4856 | vmsvga3dCmdReadbackGBImage(pThisCC, pCmd);
|
---|
4857 | break;
|
---|
4858 | }
|
---|
4859 |
|
---|
4860 | case SVGA_3D_CMD_READBACK_GB_SURFACE:
|
---|
4861 | {
|
---|
4862 | SVGA3dCmdReadbackGBSurface *pCmd = (SVGA3dCmdReadbackGBSurface *)pvCmd;
|
---|
4863 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4864 | vmsvga3dCmdReadbackGBSurface(pThisCC, pCmd);
|
---|
4865 | break;
|
---|
4866 | }
|
---|
4867 |
|
---|
4868 | case SVGA_3D_CMD_INVALIDATE_GB_IMAGE:
|
---|
4869 | {
|
---|
4870 | SVGA3dCmdInvalidateGBImage *pCmd = (SVGA3dCmdInvalidateGBImage *)pvCmd;
|
---|
4871 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4872 | vmsvga3dCmdInvalidateGBImage(pThisCC, pCmd);
|
---|
4873 | break;
|
---|
4874 | }
|
---|
4875 |
|
---|
4876 | case SVGA_3D_CMD_INVALIDATE_GB_SURFACE:
|
---|
4877 | {
|
---|
4878 | SVGA3dCmdInvalidateGBSurface *pCmd = (SVGA3dCmdInvalidateGBSurface *)pvCmd;
|
---|
4879 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4880 | vmsvga3dCmdInvalidateGBSurface(pThisCC, pCmd);
|
---|
4881 | break;
|
---|
4882 | }
|
---|
4883 |
|
---|
4884 | case SVGA_3D_CMD_DEFINE_GB_CONTEXT:
|
---|
4885 | {
|
---|
4886 | SVGA3dCmdDefineGBContext *pCmd = (SVGA3dCmdDefineGBContext *)pvCmd;
|
---|
4887 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4888 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4889 | break;
|
---|
4890 | }
|
---|
4891 |
|
---|
4892 | case SVGA_3D_CMD_DESTROY_GB_CONTEXT:
|
---|
4893 | {
|
---|
4894 | SVGA3dCmdDestroyGBContext *pCmd = (SVGA3dCmdDestroyGBContext *)pvCmd;
|
---|
4895 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4896 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4897 | break;
|
---|
4898 | }
|
---|
4899 |
|
---|
4900 | case SVGA_3D_CMD_BIND_GB_CONTEXT:
|
---|
4901 | {
|
---|
4902 | SVGA3dCmdBindGBContext *pCmd = (SVGA3dCmdBindGBContext *)pvCmd;
|
---|
4903 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4904 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4905 | break;
|
---|
4906 | }
|
---|
4907 |
|
---|
4908 | case SVGA_3D_CMD_READBACK_GB_CONTEXT:
|
---|
4909 | {
|
---|
4910 | SVGA3dCmdReadbackGBContext *pCmd = (SVGA3dCmdReadbackGBContext *)pvCmd;
|
---|
4911 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4912 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4913 | break;
|
---|
4914 | }
|
---|
4915 |
|
---|
4916 | case SVGA_3D_CMD_INVALIDATE_GB_CONTEXT:
|
---|
4917 | {
|
---|
4918 | SVGA3dCmdInvalidateGBContext *pCmd = (SVGA3dCmdInvalidateGBContext *)pvCmd;
|
---|
4919 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4920 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4921 | break;
|
---|
4922 | }
|
---|
4923 |
|
---|
4924 | case SVGA_3D_CMD_DEFINE_GB_SHADER:
|
---|
4925 | {
|
---|
4926 | SVGA3dCmdDefineGBShader *pCmd = (SVGA3dCmdDefineGBShader *)pvCmd;
|
---|
4927 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4928 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4929 | break;
|
---|
4930 | }
|
---|
4931 |
|
---|
4932 | case SVGA_3D_CMD_DESTROY_GB_SHADER:
|
---|
4933 | {
|
---|
4934 | SVGA3dCmdDestroyGBShader *pCmd = (SVGA3dCmdDestroyGBShader *)pvCmd;
|
---|
4935 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4936 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4937 | break;
|
---|
4938 | }
|
---|
4939 |
|
---|
4940 | case SVGA_3D_CMD_BIND_GB_SHADER:
|
---|
4941 | {
|
---|
4942 | SVGA3dCmdBindGBShader *pCmd = (SVGA3dCmdBindGBShader *)pvCmd;
|
---|
4943 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4944 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4945 | break;
|
---|
4946 | }
|
---|
4947 |
|
---|
4948 | case SVGA_3D_CMD_SET_OTABLE_BASE64:
|
---|
4949 | {
|
---|
4950 | SVGA3dCmdSetOTableBase64 *pCmd = (SVGA3dCmdSetOTableBase64 *)pvCmd;
|
---|
4951 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4952 | vmsvga3dCmdSetOTableBase64(pThisCC, pCmd);
|
---|
4953 | break;
|
---|
4954 | }
|
---|
4955 |
|
---|
4956 | case SVGA_3D_CMD_BEGIN_GB_QUERY:
|
---|
4957 | {
|
---|
4958 | SVGA3dCmdBeginGBQuery *pCmd = (SVGA3dCmdBeginGBQuery *)pvCmd;
|
---|
4959 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4960 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4961 | break;
|
---|
4962 | }
|
---|
4963 |
|
---|
4964 | case SVGA_3D_CMD_END_GB_QUERY:
|
---|
4965 | {
|
---|
4966 | SVGA3dCmdEndGBQuery *pCmd = (SVGA3dCmdEndGBQuery *)pvCmd;
|
---|
4967 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4968 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4969 | break;
|
---|
4970 | }
|
---|
4971 |
|
---|
4972 | case SVGA_3D_CMD_WAIT_FOR_GB_QUERY:
|
---|
4973 | {
|
---|
4974 | SVGA3dCmdWaitForGBQuery *pCmd = (SVGA3dCmdWaitForGBQuery *)pvCmd;
|
---|
4975 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4976 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4977 | break;
|
---|
4978 | }
|
---|
4979 |
|
---|
4980 | case SVGA_3D_CMD_NOP:
|
---|
4981 | {
|
---|
4982 | /* Apparently there is nothing to do. */
|
---|
4983 | break;
|
---|
4984 | }
|
---|
4985 |
|
---|
4986 | case SVGA_3D_CMD_ENABLE_GART:
|
---|
4987 | {
|
---|
4988 | SVGA3dCmdEnableGart *pCmd = (SVGA3dCmdEnableGart *)pvCmd;
|
---|
4989 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
4990 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
4991 | break;
|
---|
4992 | }
|
---|
4993 |
|
---|
4994 | case SVGA_3D_CMD_DISABLE_GART:
|
---|
4995 | {
|
---|
4996 | /* No corresponding SVGA3dCmd structure. */
|
---|
4997 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
4998 | break;
|
---|
4999 | }
|
---|
5000 |
|
---|
5001 | case SVGA_3D_CMD_MAP_MOB_INTO_GART:
|
---|
5002 | {
|
---|
5003 | SVGA3dCmdMapMobIntoGart *pCmd = (SVGA3dCmdMapMobIntoGart *)pvCmd;
|
---|
5004 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5005 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5006 | break;
|
---|
5007 | }
|
---|
5008 |
|
---|
5009 | case SVGA_3D_CMD_UNMAP_GART_RANGE:
|
---|
5010 | {
|
---|
5011 | SVGA3dCmdUnmapGartRange *pCmd = (SVGA3dCmdUnmapGartRange *)pvCmd;
|
---|
5012 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5013 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5014 | break;
|
---|
5015 | }
|
---|
5016 |
|
---|
5017 | case SVGA_3D_CMD_DEFINE_GB_SCREENTARGET:
|
---|
5018 | {
|
---|
5019 | SVGA3dCmdDefineGBScreenTarget *pCmd = (SVGA3dCmdDefineGBScreenTarget *)pvCmd;
|
---|
5020 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5021 | vmsvga3dCmdDefineGBScreenTarget(pThis, pThisCC, pCmd);
|
---|
5022 | break;
|
---|
5023 | }
|
---|
5024 |
|
---|
5025 | case SVGA_3D_CMD_DESTROY_GB_SCREENTARGET:
|
---|
5026 | {
|
---|
5027 | SVGA3dCmdDestroyGBScreenTarget *pCmd = (SVGA3dCmdDestroyGBScreenTarget *)pvCmd;
|
---|
5028 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5029 | vmsvga3dCmdDestroyGBScreenTarget(pThis, pThisCC, pCmd);
|
---|
5030 | break;
|
---|
5031 | }
|
---|
5032 |
|
---|
5033 | case SVGA_3D_CMD_BIND_GB_SCREENTARGET:
|
---|
5034 | {
|
---|
5035 | SVGA3dCmdBindGBScreenTarget *pCmd = (SVGA3dCmdBindGBScreenTarget *)pvCmd;
|
---|
5036 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5037 | vmsvga3dCmdBindGBScreenTarget(pThisCC, pCmd);
|
---|
5038 | break;
|
---|
5039 | }
|
---|
5040 |
|
---|
5041 | case SVGA_3D_CMD_UPDATE_GB_SCREENTARGET:
|
---|
5042 | {
|
---|
5043 | SVGA3dCmdUpdateGBScreenTarget *pCmd = (SVGA3dCmdUpdateGBScreenTarget *)pvCmd;
|
---|
5044 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5045 | vmsvga3dCmdUpdateGBScreenTarget(pThisCC, pCmd);
|
---|
5046 | break;
|
---|
5047 | }
|
---|
5048 |
|
---|
5049 | case SVGA_3D_CMD_READBACK_GB_IMAGE_PARTIAL:
|
---|
5050 | {
|
---|
5051 | SVGA3dCmdReadbackGBImagePartial *pCmd = (SVGA3dCmdReadbackGBImagePartial *)pvCmd;
|
---|
5052 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5053 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5054 | break;
|
---|
5055 | }
|
---|
5056 |
|
---|
5057 | case SVGA_3D_CMD_INVALIDATE_GB_IMAGE_PARTIAL:
|
---|
5058 | {
|
---|
5059 | SVGA3dCmdInvalidateGBImagePartial *pCmd = (SVGA3dCmdInvalidateGBImagePartial *)pvCmd;
|
---|
5060 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5061 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5062 | break;
|
---|
5063 | }
|
---|
5064 |
|
---|
5065 | case SVGA_3D_CMD_SET_GB_SHADERCONSTS_INLINE:
|
---|
5066 | {
|
---|
5067 | SVGA3dCmdSetGBShaderConstInline *pCmd = (SVGA3dCmdSetGBShaderConstInline *)pvCmd;
|
---|
5068 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5069 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5070 | break;
|
---|
5071 | }
|
---|
5072 |
|
---|
5073 | case SVGA_3D_CMD_GB_SCREEN_DMA:
|
---|
5074 | {
|
---|
5075 | SVGA3dCmdGBScreenDMA *pCmd = (SVGA3dCmdGBScreenDMA *)pvCmd;
|
---|
5076 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5077 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5078 | break;
|
---|
5079 | }
|
---|
5080 |
|
---|
5081 | case SVGA_3D_CMD_BIND_GB_SURFACE_WITH_PITCH:
|
---|
5082 | {
|
---|
5083 | SVGA3dCmdBindGBSurfaceWithPitch *pCmd = (SVGA3dCmdBindGBSurfaceWithPitch *)pvCmd;
|
---|
5084 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5085 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5086 | break;
|
---|
5087 | }
|
---|
5088 |
|
---|
5089 | case SVGA_3D_CMD_GB_MOB_FENCE:
|
---|
5090 | {
|
---|
5091 | SVGA3dCmdGBMobFence *pCmd = (SVGA3dCmdGBMobFence *)pvCmd;
|
---|
5092 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5093 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5094 | break;
|
---|
5095 | }
|
---|
5096 |
|
---|
5097 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V2:
|
---|
5098 | {
|
---|
5099 | SVGA3dCmdDefineGBSurface_v2 *pCmd = (SVGA3dCmdDefineGBSurface_v2 *)pvCmd;
|
---|
5100 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5101 | vmsvga3dCmdDefineGBSurface_v2(pThisCC, pCmd);
|
---|
5102 | break;
|
---|
5103 | }
|
---|
5104 |
|
---|
5105 | case SVGA_3D_CMD_DEFINE_GB_MOB64:
|
---|
5106 | {
|
---|
5107 | SVGA3dCmdDefineGBMob64 *pCmd = (SVGA3dCmdDefineGBMob64 *)pvCmd;
|
---|
5108 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5109 | vmsvga3dCmdDefineGBMob64(pThisCC, pCmd);
|
---|
5110 | break;
|
---|
5111 | }
|
---|
5112 |
|
---|
5113 | case SVGA_3D_CMD_REDEFINE_GB_MOB64:
|
---|
5114 | {
|
---|
5115 | SVGA3dCmdRedefineGBMob64 *pCmd = (SVGA3dCmdRedefineGBMob64 *)pvCmd;
|
---|
5116 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5117 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5118 | break;
|
---|
5119 | }
|
---|
5120 |
|
---|
5121 | case SVGA_3D_CMD_NOP_ERROR:
|
---|
5122 | {
|
---|
5123 | /* Apparently there is nothing to do. */
|
---|
5124 | break;
|
---|
5125 | }
|
---|
5126 |
|
---|
5127 | case SVGA_3D_CMD_SET_VERTEX_STREAMS:
|
---|
5128 | {
|
---|
5129 | SVGA3dCmdSetVertexStreams *pCmd = (SVGA3dCmdSetVertexStreams *)pvCmd;
|
---|
5130 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5131 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5132 | break;
|
---|
5133 | }
|
---|
5134 |
|
---|
5135 | case SVGA_3D_CMD_SET_VERTEX_DECLS:
|
---|
5136 | {
|
---|
5137 | SVGA3dCmdSetVertexDecls *pCmd = (SVGA3dCmdSetVertexDecls *)pvCmd;
|
---|
5138 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5139 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5140 | break;
|
---|
5141 | }
|
---|
5142 |
|
---|
5143 | case SVGA_3D_CMD_SET_VERTEX_DIVISORS:
|
---|
5144 | {
|
---|
5145 | SVGA3dCmdSetVertexDivisors *pCmd = (SVGA3dCmdSetVertexDivisors *)pvCmd;
|
---|
5146 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5147 | VMSVGA_3D_CMD_NOTIMPL(); RT_NOREF(pCmd);
|
---|
5148 | break;
|
---|
5149 | }
|
---|
5150 |
|
---|
5151 | case SVGA_3D_CMD_DRAW:
|
---|
5152 | {
|
---|
5153 | /* No corresponding SVGA3dCmd structure. */
|
---|
5154 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5155 | break;
|
---|
5156 | }
|
---|
5157 |
|
---|
5158 | case SVGA_3D_CMD_DRAW_INDEXED:
|
---|
5159 | {
|
---|
5160 | /* No corresponding SVGA3dCmd structure. */
|
---|
5161 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5162 | break;
|
---|
5163 | }
|
---|
5164 |
|
---|
5165 | case SVGA_3D_CMD_DX_DEFINE_CONTEXT:
|
---|
5166 | {
|
---|
5167 | SVGA3dCmdDXDefineContext *pCmd = (SVGA3dCmdDXDefineContext *)pvCmd;
|
---|
5168 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5169 | rcParse = vmsvga3dCmdDXDefineContext(pThisCC, pCmd, cbCmd);
|
---|
5170 | break;
|
---|
5171 | }
|
---|
5172 |
|
---|
5173 | case SVGA_3D_CMD_DX_DESTROY_CONTEXT:
|
---|
5174 | {
|
---|
5175 | SVGA3dCmdDXDestroyContext *pCmd = (SVGA3dCmdDXDestroyContext *)pvCmd;
|
---|
5176 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5177 | rcParse = vmsvga3dCmdDXDestroyContext(pThisCC, pCmd, cbCmd);
|
---|
5178 | break;
|
---|
5179 | }
|
---|
5180 |
|
---|
5181 | case SVGA_3D_CMD_DX_BIND_CONTEXT:
|
---|
5182 | {
|
---|
5183 | SVGA3dCmdDXBindContext *pCmd = (SVGA3dCmdDXBindContext *)pvCmd;
|
---|
5184 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5185 | rcParse = vmsvga3dCmdDXBindContext(pThisCC, pCmd, cbCmd);
|
---|
5186 | break;
|
---|
5187 | }
|
---|
5188 |
|
---|
5189 | case SVGA_3D_CMD_DX_READBACK_CONTEXT:
|
---|
5190 | {
|
---|
5191 | SVGA3dCmdDXReadbackContext *pCmd = (SVGA3dCmdDXReadbackContext *)pvCmd;
|
---|
5192 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5193 | rcParse = vmsvga3dCmdDXReadbackContext(pThisCC, pCmd, cbCmd);
|
---|
5194 | break;
|
---|
5195 | }
|
---|
5196 |
|
---|
5197 | case SVGA_3D_CMD_DX_INVALIDATE_CONTEXT:
|
---|
5198 | {
|
---|
5199 | SVGA3dCmdDXInvalidateContext *pCmd = (SVGA3dCmdDXInvalidateContext *)pvCmd;
|
---|
5200 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5201 | rcParse = vmsvga3dCmdDXInvalidateContext(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5202 | break;
|
---|
5203 | }
|
---|
5204 |
|
---|
5205 | case SVGA_3D_CMD_DX_SET_SINGLE_CONSTANT_BUFFER:
|
---|
5206 | {
|
---|
5207 | SVGA3dCmdDXSetSingleConstantBuffer *pCmd = (SVGA3dCmdDXSetSingleConstantBuffer *)pvCmd;
|
---|
5208 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5209 | rcParse = vmsvga3dCmdDXSetSingleConstantBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5210 | break;
|
---|
5211 | }
|
---|
5212 |
|
---|
5213 | case SVGA_3D_CMD_DX_SET_SHADER_RESOURCES:
|
---|
5214 | {
|
---|
5215 | SVGA3dCmdDXSetShaderResources *pCmd = (SVGA3dCmdDXSetShaderResources *)pvCmd;
|
---|
5216 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5217 | rcParse = vmsvga3dCmdDXSetShaderResources(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5218 | break;
|
---|
5219 | }
|
---|
5220 |
|
---|
5221 | case SVGA_3D_CMD_DX_SET_SHADER:
|
---|
5222 | {
|
---|
5223 | SVGA3dCmdDXSetShader *pCmd = (SVGA3dCmdDXSetShader *)pvCmd;
|
---|
5224 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5225 | rcParse = vmsvga3dCmdDXSetShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5226 | break;
|
---|
5227 | }
|
---|
5228 |
|
---|
5229 | case SVGA_3D_CMD_DX_SET_SAMPLERS:
|
---|
5230 | {
|
---|
5231 | SVGA3dCmdDXSetSamplers *pCmd = (SVGA3dCmdDXSetSamplers *)pvCmd;
|
---|
5232 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5233 | rcParse = vmsvga3dCmdDXSetSamplers(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5234 | break;
|
---|
5235 | }
|
---|
5236 |
|
---|
5237 | case SVGA_3D_CMD_DX_DRAW:
|
---|
5238 | {
|
---|
5239 | SVGA3dCmdDXDraw *pCmd = (SVGA3dCmdDXDraw *)pvCmd;
|
---|
5240 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5241 | rcParse = vmsvga3dCmdDXDraw(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5242 | break;
|
---|
5243 | }
|
---|
5244 |
|
---|
5245 | case SVGA_3D_CMD_DX_DRAW_INDEXED:
|
---|
5246 | {
|
---|
5247 | SVGA3dCmdDXDrawIndexed *pCmd = (SVGA3dCmdDXDrawIndexed *)pvCmd;
|
---|
5248 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5249 | rcParse = vmsvga3dCmdDXDrawIndexed(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5250 | break;
|
---|
5251 | }
|
---|
5252 |
|
---|
5253 | case SVGA_3D_CMD_DX_DRAW_INSTANCED:
|
---|
5254 | {
|
---|
5255 | SVGA3dCmdDXDrawInstanced *pCmd = (SVGA3dCmdDXDrawInstanced *)pvCmd;
|
---|
5256 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5257 | rcParse = vmsvga3dCmdDXDrawInstanced(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5258 | break;
|
---|
5259 | }
|
---|
5260 |
|
---|
5261 | case SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED:
|
---|
5262 | {
|
---|
5263 | SVGA3dCmdDXDrawIndexedInstanced *pCmd = (SVGA3dCmdDXDrawIndexedInstanced *)pvCmd;
|
---|
5264 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5265 | rcParse = vmsvga3dCmdDXDrawIndexedInstanced(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5266 | break;
|
---|
5267 | }
|
---|
5268 |
|
---|
5269 | case SVGA_3D_CMD_DX_DRAW_AUTO:
|
---|
5270 | {
|
---|
5271 | SVGA3dCmdDXDrawAuto *pCmd = (SVGA3dCmdDXDrawAuto *)pvCmd;
|
---|
5272 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5273 | rcParse = vmsvga3dCmdDXDrawAuto(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5274 | break;
|
---|
5275 | }
|
---|
5276 |
|
---|
5277 | case SVGA_3D_CMD_DX_SET_INPUT_LAYOUT:
|
---|
5278 | {
|
---|
5279 | SVGA3dCmdDXSetInputLayout *pCmd = (SVGA3dCmdDXSetInputLayout *)pvCmd;
|
---|
5280 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5281 | rcParse = vmsvga3dCmdDXSetInputLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5282 | break;
|
---|
5283 | }
|
---|
5284 |
|
---|
5285 | case SVGA_3D_CMD_DX_SET_VERTEX_BUFFERS:
|
---|
5286 | {
|
---|
5287 | SVGA3dCmdDXSetVertexBuffers *pCmd = (SVGA3dCmdDXSetVertexBuffers *)pvCmd;
|
---|
5288 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5289 | rcParse = vmsvga3dCmdDXSetVertexBuffers(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5290 | break;
|
---|
5291 | }
|
---|
5292 |
|
---|
5293 | case SVGA_3D_CMD_DX_SET_INDEX_BUFFER:
|
---|
5294 | {
|
---|
5295 | SVGA3dCmdDXSetIndexBuffer *pCmd = (SVGA3dCmdDXSetIndexBuffer *)pvCmd;
|
---|
5296 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5297 | rcParse = vmsvga3dCmdDXSetIndexBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5298 | break;
|
---|
5299 | }
|
---|
5300 |
|
---|
5301 | case SVGA_3D_CMD_DX_SET_TOPOLOGY:
|
---|
5302 | {
|
---|
5303 | SVGA3dCmdDXSetTopology *pCmd = (SVGA3dCmdDXSetTopology *)pvCmd;
|
---|
5304 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5305 | rcParse = vmsvga3dCmdDXSetTopology(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5306 | break;
|
---|
5307 | }
|
---|
5308 |
|
---|
5309 | case SVGA_3D_CMD_DX_SET_RENDERTARGETS:
|
---|
5310 | {
|
---|
5311 | SVGA3dCmdDXSetRenderTargets *pCmd = (SVGA3dCmdDXSetRenderTargets *)pvCmd;
|
---|
5312 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5313 | rcParse = vmsvga3dCmdDXSetRenderTargets(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5314 | break;
|
---|
5315 | }
|
---|
5316 |
|
---|
5317 | case SVGA_3D_CMD_DX_SET_BLEND_STATE:
|
---|
5318 | {
|
---|
5319 | SVGA3dCmdDXSetBlendState *pCmd = (SVGA3dCmdDXSetBlendState *)pvCmd;
|
---|
5320 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5321 | rcParse = vmsvga3dCmdDXSetBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5322 | break;
|
---|
5323 | }
|
---|
5324 |
|
---|
5325 | case SVGA_3D_CMD_DX_SET_DEPTHSTENCIL_STATE:
|
---|
5326 | {
|
---|
5327 | SVGA3dCmdDXSetDepthStencilState *pCmd = (SVGA3dCmdDXSetDepthStencilState *)pvCmd;
|
---|
5328 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5329 | rcParse = vmsvga3dCmdDXSetDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5330 | break;
|
---|
5331 | }
|
---|
5332 |
|
---|
5333 | case SVGA_3D_CMD_DX_SET_RASTERIZER_STATE:
|
---|
5334 | {
|
---|
5335 | SVGA3dCmdDXSetRasterizerState *pCmd = (SVGA3dCmdDXSetRasterizerState *)pvCmd;
|
---|
5336 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5337 | rcParse = vmsvga3dCmdDXSetRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5338 | break;
|
---|
5339 | }
|
---|
5340 |
|
---|
5341 | case SVGA_3D_CMD_DX_DEFINE_QUERY:
|
---|
5342 | {
|
---|
5343 | SVGA3dCmdDXDefineQuery *pCmd = (SVGA3dCmdDXDefineQuery *)pvCmd;
|
---|
5344 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5345 | rcParse = vmsvga3dCmdDXDefineQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5346 | break;
|
---|
5347 | }
|
---|
5348 |
|
---|
5349 | case SVGA_3D_CMD_DX_DESTROY_QUERY:
|
---|
5350 | {
|
---|
5351 | SVGA3dCmdDXDestroyQuery *pCmd = (SVGA3dCmdDXDestroyQuery *)pvCmd;
|
---|
5352 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5353 | rcParse = vmsvga3dCmdDXDestroyQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5354 | break;
|
---|
5355 | }
|
---|
5356 |
|
---|
5357 | case SVGA_3D_CMD_DX_BIND_QUERY:
|
---|
5358 | {
|
---|
5359 | SVGA3dCmdDXBindQuery *pCmd = (SVGA3dCmdDXBindQuery *)pvCmd;
|
---|
5360 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5361 | rcParse = vmsvga3dCmdDXBindQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5362 | break;
|
---|
5363 | }
|
---|
5364 |
|
---|
5365 | case SVGA_3D_CMD_DX_SET_QUERY_OFFSET:
|
---|
5366 | {
|
---|
5367 | SVGA3dCmdDXSetQueryOffset *pCmd = (SVGA3dCmdDXSetQueryOffset *)pvCmd;
|
---|
5368 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5369 | rcParse = vmsvga3dCmdDXSetQueryOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5370 | break;
|
---|
5371 | }
|
---|
5372 |
|
---|
5373 | case SVGA_3D_CMD_DX_BEGIN_QUERY:
|
---|
5374 | {
|
---|
5375 | SVGA3dCmdDXBeginQuery *pCmd = (SVGA3dCmdDXBeginQuery *)pvCmd;
|
---|
5376 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5377 | rcParse = vmsvga3dCmdDXBeginQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5378 | break;
|
---|
5379 | }
|
---|
5380 |
|
---|
5381 | case SVGA_3D_CMD_DX_END_QUERY:
|
---|
5382 | {
|
---|
5383 | SVGA3dCmdDXEndQuery *pCmd = (SVGA3dCmdDXEndQuery *)pvCmd;
|
---|
5384 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5385 | rcParse = vmsvga3dCmdDXEndQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5386 | break;
|
---|
5387 | }
|
---|
5388 |
|
---|
5389 | case SVGA_3D_CMD_DX_READBACK_QUERY:
|
---|
5390 | {
|
---|
5391 | SVGA3dCmdDXReadbackQuery *pCmd = (SVGA3dCmdDXReadbackQuery *)pvCmd;
|
---|
5392 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5393 | rcParse = vmsvga3dCmdDXReadbackQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5394 | break;
|
---|
5395 | }
|
---|
5396 |
|
---|
5397 | case SVGA_3D_CMD_DX_SET_PREDICATION:
|
---|
5398 | {
|
---|
5399 | SVGA3dCmdDXSetPredication *pCmd = (SVGA3dCmdDXSetPredication *)pvCmd;
|
---|
5400 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5401 | rcParse = vmsvga3dCmdDXSetPredication(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5402 | break;
|
---|
5403 | }
|
---|
5404 |
|
---|
5405 | case SVGA_3D_CMD_DX_SET_SOTARGETS:
|
---|
5406 | {
|
---|
5407 | SVGA3dCmdDXSetSOTargets *pCmd = (SVGA3dCmdDXSetSOTargets *)pvCmd;
|
---|
5408 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5409 | rcParse = vmsvga3dCmdDXSetSOTargets(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5410 | break;
|
---|
5411 | }
|
---|
5412 |
|
---|
5413 | case SVGA_3D_CMD_DX_SET_VIEWPORTS:
|
---|
5414 | {
|
---|
5415 | SVGA3dCmdDXSetViewports *pCmd = (SVGA3dCmdDXSetViewports *)pvCmd;
|
---|
5416 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5417 | rcParse = vmsvga3dCmdDXSetViewports(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5418 | break;
|
---|
5419 | }
|
---|
5420 |
|
---|
5421 | case SVGA_3D_CMD_DX_SET_SCISSORRECTS:
|
---|
5422 | {
|
---|
5423 | SVGA3dCmdDXSetScissorRects *pCmd = (SVGA3dCmdDXSetScissorRects *)pvCmd;
|
---|
5424 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5425 | rcParse = vmsvga3dCmdDXSetScissorRects(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5426 | break;
|
---|
5427 | }
|
---|
5428 |
|
---|
5429 | case SVGA_3D_CMD_DX_CLEAR_RENDERTARGET_VIEW:
|
---|
5430 | {
|
---|
5431 | SVGA3dCmdDXClearRenderTargetView *pCmd = (SVGA3dCmdDXClearRenderTargetView *)pvCmd;
|
---|
5432 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5433 | rcParse = vmsvga3dCmdDXClearRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5434 | break;
|
---|
5435 | }
|
---|
5436 |
|
---|
5437 | case SVGA_3D_CMD_DX_CLEAR_DEPTHSTENCIL_VIEW:
|
---|
5438 | {
|
---|
5439 | SVGA3dCmdDXClearDepthStencilView *pCmd = (SVGA3dCmdDXClearDepthStencilView *)pvCmd;
|
---|
5440 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5441 | rcParse = vmsvga3dCmdDXClearDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5442 | break;
|
---|
5443 | }
|
---|
5444 |
|
---|
5445 | case SVGA_3D_CMD_DX_PRED_COPY_REGION:
|
---|
5446 | {
|
---|
5447 | SVGA3dCmdDXPredCopyRegion *pCmd = (SVGA3dCmdDXPredCopyRegion *)pvCmd;
|
---|
5448 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5449 | rcParse = vmsvga3dCmdDXPredCopyRegion(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5450 | break;
|
---|
5451 | }
|
---|
5452 |
|
---|
5453 | case SVGA_3D_CMD_DX_PRED_COPY:
|
---|
5454 | {
|
---|
5455 | SVGA3dCmdDXPredCopy *pCmd = (SVGA3dCmdDXPredCopy *)pvCmd;
|
---|
5456 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5457 | rcParse = vmsvga3dCmdDXPredCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5458 | break;
|
---|
5459 | }
|
---|
5460 |
|
---|
5461 | case SVGA_3D_CMD_DX_PRESENTBLT:
|
---|
5462 | {
|
---|
5463 | SVGA3dCmdDXPresentBlt *pCmd = (SVGA3dCmdDXPresentBlt *)pvCmd;
|
---|
5464 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5465 | rcParse = vmsvga3dCmdDXPresentBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5466 | break;
|
---|
5467 | }
|
---|
5468 |
|
---|
5469 | case SVGA_3D_CMD_DX_GENMIPS:
|
---|
5470 | {
|
---|
5471 | SVGA3dCmdDXGenMips *pCmd = (SVGA3dCmdDXGenMips *)pvCmd;
|
---|
5472 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5473 | rcParse = vmsvga3dCmdDXGenMips(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5474 | break;
|
---|
5475 | }
|
---|
5476 |
|
---|
5477 | case SVGA_3D_CMD_DX_UPDATE_SUBRESOURCE:
|
---|
5478 | {
|
---|
5479 | SVGA3dCmdDXUpdateSubResource *pCmd = (SVGA3dCmdDXUpdateSubResource *)pvCmd;
|
---|
5480 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5481 | rcParse = vmsvga3dCmdDXUpdateSubResource(pThisCC, pCmd, cbCmd);
|
---|
5482 | break;
|
---|
5483 | }
|
---|
5484 |
|
---|
5485 | case SVGA_3D_CMD_DX_READBACK_SUBRESOURCE:
|
---|
5486 | {
|
---|
5487 | SVGA3dCmdDXReadbackSubResource *pCmd = (SVGA3dCmdDXReadbackSubResource *)pvCmd;
|
---|
5488 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5489 | rcParse = vmsvga3dCmdDXReadbackSubResource(pThisCC, pCmd, cbCmd);
|
---|
5490 | break;
|
---|
5491 | }
|
---|
5492 |
|
---|
5493 | case SVGA_3D_CMD_DX_INVALIDATE_SUBRESOURCE:
|
---|
5494 | {
|
---|
5495 | SVGA3dCmdDXInvalidateSubResource *pCmd = (SVGA3dCmdDXInvalidateSubResource *)pvCmd;
|
---|
5496 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5497 | rcParse = vmsvga3dCmdDXInvalidateSubResource(pThisCC, pCmd, cbCmd);
|
---|
5498 | break;
|
---|
5499 | }
|
---|
5500 |
|
---|
5501 | case SVGA_3D_CMD_DX_DEFINE_SHADERRESOURCE_VIEW:
|
---|
5502 | {
|
---|
5503 | SVGA3dCmdDXDefineShaderResourceView *pCmd = (SVGA3dCmdDXDefineShaderResourceView *)pvCmd;
|
---|
5504 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5505 | rcParse = vmsvga3dCmdDXDefineShaderResourceView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5506 | break;
|
---|
5507 | }
|
---|
5508 |
|
---|
5509 | case SVGA_3D_CMD_DX_DESTROY_SHADERRESOURCE_VIEW:
|
---|
5510 | {
|
---|
5511 | SVGA3dCmdDXDestroyShaderResourceView *pCmd = (SVGA3dCmdDXDestroyShaderResourceView *)pvCmd;
|
---|
5512 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5513 | rcParse = vmsvga3dCmdDXDestroyShaderResourceView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5514 | break;
|
---|
5515 | }
|
---|
5516 |
|
---|
5517 | case SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW:
|
---|
5518 | {
|
---|
5519 | SVGA3dCmdDXDefineRenderTargetView *pCmd = (SVGA3dCmdDXDefineRenderTargetView *)pvCmd;
|
---|
5520 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5521 | rcParse = vmsvga3dCmdDXDefineRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5522 | break;
|
---|
5523 | }
|
---|
5524 |
|
---|
5525 | case SVGA_3D_CMD_DX_DESTROY_RENDERTARGET_VIEW:
|
---|
5526 | {
|
---|
5527 | SVGA3dCmdDXDestroyRenderTargetView *pCmd = (SVGA3dCmdDXDestroyRenderTargetView *)pvCmd;
|
---|
5528 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5529 | rcParse = vmsvga3dCmdDXDestroyRenderTargetView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5530 | break;
|
---|
5531 | }
|
---|
5532 |
|
---|
5533 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW:
|
---|
5534 | {
|
---|
5535 | SVGA3dCmdDXDefineDepthStencilView *pCmd = (SVGA3dCmdDXDefineDepthStencilView *)pvCmd;
|
---|
5536 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5537 | rcParse = vmsvga3dCmdDXDefineDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5538 | break;
|
---|
5539 | }
|
---|
5540 |
|
---|
5541 | case SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_VIEW:
|
---|
5542 | {
|
---|
5543 | SVGA3dCmdDXDestroyDepthStencilView *pCmd = (SVGA3dCmdDXDestroyDepthStencilView *)pvCmd;
|
---|
5544 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5545 | rcParse = vmsvga3dCmdDXDestroyDepthStencilView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5546 | break;
|
---|
5547 | }
|
---|
5548 |
|
---|
5549 | case SVGA_3D_CMD_DX_DEFINE_ELEMENTLAYOUT:
|
---|
5550 | {
|
---|
5551 | SVGA3dCmdDXDefineElementLayout *pCmd = (SVGA3dCmdDXDefineElementLayout *)pvCmd;
|
---|
5552 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5553 | rcParse = vmsvga3dCmdDXDefineElementLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5554 | break;
|
---|
5555 | }
|
---|
5556 |
|
---|
5557 | case SVGA_3D_CMD_DX_DESTROY_ELEMENTLAYOUT:
|
---|
5558 | {
|
---|
5559 | SVGA3dCmdDXDestroyElementLayout *pCmd = (SVGA3dCmdDXDestroyElementLayout *)pvCmd;
|
---|
5560 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5561 | rcParse = vmsvga3dCmdDXDestroyElementLayout(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5562 | break;
|
---|
5563 | }
|
---|
5564 |
|
---|
5565 | case SVGA_3D_CMD_DX_DEFINE_BLEND_STATE:
|
---|
5566 | {
|
---|
5567 | SVGA3dCmdDXDefineBlendState *pCmd = (SVGA3dCmdDXDefineBlendState *)pvCmd;
|
---|
5568 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5569 | rcParse = vmsvga3dCmdDXDefineBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5570 | break;
|
---|
5571 | }
|
---|
5572 |
|
---|
5573 | case SVGA_3D_CMD_DX_DESTROY_BLEND_STATE:
|
---|
5574 | {
|
---|
5575 | SVGA3dCmdDXDestroyBlendState *pCmd = (SVGA3dCmdDXDestroyBlendState *)pvCmd;
|
---|
5576 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5577 | rcParse = vmsvga3dCmdDXDestroyBlendState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5578 | break;
|
---|
5579 | }
|
---|
5580 |
|
---|
5581 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_STATE:
|
---|
5582 | {
|
---|
5583 | SVGA3dCmdDXDefineDepthStencilState *pCmd = (SVGA3dCmdDXDefineDepthStencilState *)pvCmd;
|
---|
5584 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5585 | rcParse = vmsvga3dCmdDXDefineDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5586 | break;
|
---|
5587 | }
|
---|
5588 |
|
---|
5589 | case SVGA_3D_CMD_DX_DESTROY_DEPTHSTENCIL_STATE:
|
---|
5590 | {
|
---|
5591 | SVGA3dCmdDXDestroyDepthStencilState *pCmd = (SVGA3dCmdDXDestroyDepthStencilState *)pvCmd;
|
---|
5592 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5593 | rcParse = vmsvga3dCmdDXDestroyDepthStencilState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5594 | break;
|
---|
5595 | }
|
---|
5596 |
|
---|
5597 | case SVGA_3D_CMD_DX_DEFINE_RASTERIZER_STATE:
|
---|
5598 | {
|
---|
5599 | SVGA3dCmdDXDefineRasterizerState *pCmd = (SVGA3dCmdDXDefineRasterizerState *)pvCmd;
|
---|
5600 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5601 | rcParse = vmsvga3dCmdDXDefineRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5602 | break;
|
---|
5603 | }
|
---|
5604 |
|
---|
5605 | case SVGA_3D_CMD_DX_DESTROY_RASTERIZER_STATE:
|
---|
5606 | {
|
---|
5607 | SVGA3dCmdDXDestroyRasterizerState *pCmd = (SVGA3dCmdDXDestroyRasterizerState *)pvCmd;
|
---|
5608 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5609 | rcParse = vmsvga3dCmdDXDestroyRasterizerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5610 | break;
|
---|
5611 | }
|
---|
5612 |
|
---|
5613 | case SVGA_3D_CMD_DX_DEFINE_SAMPLER_STATE:
|
---|
5614 | {
|
---|
5615 | SVGA3dCmdDXDefineSamplerState *pCmd = (SVGA3dCmdDXDefineSamplerState *)pvCmd;
|
---|
5616 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5617 | rcParse = vmsvga3dCmdDXDefineSamplerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5618 | break;
|
---|
5619 | }
|
---|
5620 |
|
---|
5621 | case SVGA_3D_CMD_DX_DESTROY_SAMPLER_STATE:
|
---|
5622 | {
|
---|
5623 | SVGA3dCmdDXDestroySamplerState *pCmd = (SVGA3dCmdDXDestroySamplerState *)pvCmd;
|
---|
5624 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5625 | rcParse = vmsvga3dCmdDXDestroySamplerState(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5626 | break;
|
---|
5627 | }
|
---|
5628 |
|
---|
5629 | case SVGA_3D_CMD_DX_DEFINE_SHADER:
|
---|
5630 | {
|
---|
5631 | SVGA3dCmdDXDefineShader *pCmd = (SVGA3dCmdDXDefineShader *)pvCmd;
|
---|
5632 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5633 | rcParse = vmsvga3dCmdDXDefineShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5634 | break;
|
---|
5635 | }
|
---|
5636 |
|
---|
5637 | case SVGA_3D_CMD_DX_DESTROY_SHADER:
|
---|
5638 | {
|
---|
5639 | SVGA3dCmdDXDestroyShader *pCmd = (SVGA3dCmdDXDestroyShader *)pvCmd;
|
---|
5640 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5641 | rcParse = vmsvga3dCmdDXDestroyShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5642 | break;
|
---|
5643 | }
|
---|
5644 |
|
---|
5645 | case SVGA_3D_CMD_DX_BIND_SHADER:
|
---|
5646 | {
|
---|
5647 | SVGA3dCmdDXBindShader *pCmd = (SVGA3dCmdDXBindShader *)pvCmd;
|
---|
5648 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5649 | rcParse = vmsvga3dCmdDXBindShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5650 | break;
|
---|
5651 | }
|
---|
5652 |
|
---|
5653 | case SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT:
|
---|
5654 | {
|
---|
5655 | SVGA3dCmdDXDefineStreamOutput *pCmd = (SVGA3dCmdDXDefineStreamOutput *)pvCmd;
|
---|
5656 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5657 | rcParse = vmsvga3dCmdDXDefineStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5658 | break;
|
---|
5659 | }
|
---|
5660 |
|
---|
5661 | case SVGA_3D_CMD_DX_DESTROY_STREAMOUTPUT:
|
---|
5662 | {
|
---|
5663 | SVGA3dCmdDXDestroyStreamOutput *pCmd = (SVGA3dCmdDXDestroyStreamOutput *)pvCmd;
|
---|
5664 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5665 | rcParse = vmsvga3dCmdDXDestroyStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5666 | break;
|
---|
5667 | }
|
---|
5668 |
|
---|
5669 | case SVGA_3D_CMD_DX_SET_STREAMOUTPUT:
|
---|
5670 | {
|
---|
5671 | SVGA3dCmdDXSetStreamOutput *pCmd = (SVGA3dCmdDXSetStreamOutput *)pvCmd;
|
---|
5672 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5673 | rcParse = vmsvga3dCmdDXSetStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5674 | break;
|
---|
5675 | }
|
---|
5676 |
|
---|
5677 | case SVGA_3D_CMD_DX_SET_COTABLE:
|
---|
5678 | {
|
---|
5679 | SVGA3dCmdDXSetCOTable *pCmd = (SVGA3dCmdDXSetCOTable *)pvCmd;
|
---|
5680 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5681 | rcParse = vmsvga3dCmdDXSetCOTable(pThisCC, pCmd, cbCmd);
|
---|
5682 | break;
|
---|
5683 | }
|
---|
5684 |
|
---|
5685 | case SVGA_3D_CMD_DX_READBACK_COTABLE:
|
---|
5686 | {
|
---|
5687 | SVGA3dCmdDXReadbackCOTable *pCmd = (SVGA3dCmdDXReadbackCOTable *)pvCmd;
|
---|
5688 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5689 | rcParse = vmsvga3dCmdDXReadbackCOTable(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5690 | break;
|
---|
5691 | }
|
---|
5692 |
|
---|
5693 | case SVGA_3D_CMD_DX_BUFFER_COPY:
|
---|
5694 | {
|
---|
5695 | SVGA3dCmdDXBufferCopy *pCmd = (SVGA3dCmdDXBufferCopy *)pvCmd;
|
---|
5696 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5697 | rcParse = vmsvga3dCmdDXBufferCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5698 | break;
|
---|
5699 | }
|
---|
5700 |
|
---|
5701 | case SVGA_3D_CMD_DX_TRANSFER_FROM_BUFFER:
|
---|
5702 | {
|
---|
5703 | SVGA3dCmdDXTransferFromBuffer *pCmd = (SVGA3dCmdDXTransferFromBuffer *)pvCmd;
|
---|
5704 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5705 | rcParse = vmsvga3dCmdDXTransferFromBuffer(pThisCC, pCmd, cbCmd);
|
---|
5706 | break;
|
---|
5707 | }
|
---|
5708 |
|
---|
5709 | case SVGA_3D_CMD_DX_SURFACE_COPY_AND_READBACK:
|
---|
5710 | {
|
---|
5711 | SVGA3dCmdDXSurfaceCopyAndReadback *pCmd = (SVGA3dCmdDXSurfaceCopyAndReadback *)pvCmd;
|
---|
5712 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5713 | rcParse = vmsvga3dCmdDXSurfaceCopyAndReadback(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5714 | break;
|
---|
5715 | }
|
---|
5716 |
|
---|
5717 | case SVGA_3D_CMD_DX_MOVE_QUERY:
|
---|
5718 | {
|
---|
5719 | SVGA3dCmdDXMoveQuery *pCmd = (SVGA3dCmdDXMoveQuery *)pvCmd;
|
---|
5720 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5721 | rcParse = vmsvga3dCmdDXMoveQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5722 | break;
|
---|
5723 | }
|
---|
5724 |
|
---|
5725 | case SVGA_3D_CMD_DX_BIND_ALL_QUERY:
|
---|
5726 | {
|
---|
5727 | SVGA3dCmdDXBindAllQuery *pCmd = (SVGA3dCmdDXBindAllQuery *)pvCmd;
|
---|
5728 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5729 | rcParse = vmsvga3dCmdDXBindAllQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5730 | break;
|
---|
5731 | }
|
---|
5732 |
|
---|
5733 | case SVGA_3D_CMD_DX_READBACK_ALL_QUERY:
|
---|
5734 | {
|
---|
5735 | SVGA3dCmdDXReadbackAllQuery *pCmd = (SVGA3dCmdDXReadbackAllQuery *)pvCmd;
|
---|
5736 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5737 | rcParse = vmsvga3dCmdDXReadbackAllQuery(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5738 | break;
|
---|
5739 | }
|
---|
5740 |
|
---|
5741 | case SVGA_3D_CMD_DX_PRED_TRANSFER_FROM_BUFFER:
|
---|
5742 | {
|
---|
5743 | SVGA3dCmdDXPredTransferFromBuffer *pCmd = (SVGA3dCmdDXPredTransferFromBuffer *)pvCmd;
|
---|
5744 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5745 | rcParse = vmsvga3dCmdDXPredTransferFromBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5746 | break;
|
---|
5747 | }
|
---|
5748 |
|
---|
5749 | case SVGA_3D_CMD_DX_MOB_FENCE_64:
|
---|
5750 | {
|
---|
5751 | SVGA3dCmdDXMobFence64 *pCmd = (SVGA3dCmdDXMobFence64 *)pvCmd;
|
---|
5752 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5753 | rcParse = vmsvga3dCmdDXMobFence64(pThisCC, pCmd, cbCmd);
|
---|
5754 | break;
|
---|
5755 | }
|
---|
5756 |
|
---|
5757 | case SVGA_3D_CMD_DX_BIND_ALL_SHADER:
|
---|
5758 | {
|
---|
5759 | SVGA3dCmdDXBindAllShader *pCmd = (SVGA3dCmdDXBindAllShader *)pvCmd;
|
---|
5760 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5761 | rcParse = vmsvga3dCmdDXBindAllShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5762 | break;
|
---|
5763 | }
|
---|
5764 |
|
---|
5765 | case SVGA_3D_CMD_DX_HINT:
|
---|
5766 | {
|
---|
5767 | SVGA3dCmdDXHint *pCmd = (SVGA3dCmdDXHint *)pvCmd;
|
---|
5768 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5769 | rcParse = vmsvga3dCmdDXHint(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5770 | break;
|
---|
5771 | }
|
---|
5772 |
|
---|
5773 | case SVGA_3D_CMD_DX_BUFFER_UPDATE:
|
---|
5774 | {
|
---|
5775 | SVGA3dCmdDXBufferUpdate *pCmd = (SVGA3dCmdDXBufferUpdate *)pvCmd;
|
---|
5776 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5777 | rcParse = vmsvga3dCmdDXBufferUpdate(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5778 | break;
|
---|
5779 | }
|
---|
5780 |
|
---|
5781 | case SVGA_3D_CMD_DX_SET_VS_CONSTANT_BUFFER_OFFSET:
|
---|
5782 | {
|
---|
5783 | SVGA3dCmdDXSetVSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetVSConstantBufferOffset *)pvCmd;
|
---|
5784 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5785 | rcParse = vmsvga3dCmdDXSetVSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5786 | break;
|
---|
5787 | }
|
---|
5788 |
|
---|
5789 | case SVGA_3D_CMD_DX_SET_PS_CONSTANT_BUFFER_OFFSET:
|
---|
5790 | {
|
---|
5791 | SVGA3dCmdDXSetPSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetPSConstantBufferOffset *)pvCmd;
|
---|
5792 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5793 | rcParse = vmsvga3dCmdDXSetPSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5794 | break;
|
---|
5795 | }
|
---|
5796 |
|
---|
5797 | case SVGA_3D_CMD_DX_SET_GS_CONSTANT_BUFFER_OFFSET:
|
---|
5798 | {
|
---|
5799 | SVGA3dCmdDXSetGSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetGSConstantBufferOffset *)pvCmd;
|
---|
5800 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5801 | rcParse = vmsvga3dCmdDXSetGSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5802 | break;
|
---|
5803 | }
|
---|
5804 |
|
---|
5805 | case SVGA_3D_CMD_DX_SET_HS_CONSTANT_BUFFER_OFFSET:
|
---|
5806 | {
|
---|
5807 | SVGA3dCmdDXSetHSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetHSConstantBufferOffset *)pvCmd;
|
---|
5808 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5809 | rcParse = vmsvga3dCmdDXSetHSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5810 | break;
|
---|
5811 | }
|
---|
5812 |
|
---|
5813 | case SVGA_3D_CMD_DX_SET_DS_CONSTANT_BUFFER_OFFSET:
|
---|
5814 | {
|
---|
5815 | SVGA3dCmdDXSetDSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetDSConstantBufferOffset *)pvCmd;
|
---|
5816 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5817 | rcParse = vmsvga3dCmdDXSetDSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5818 | break;
|
---|
5819 | }
|
---|
5820 |
|
---|
5821 | case SVGA_3D_CMD_DX_SET_CS_CONSTANT_BUFFER_OFFSET:
|
---|
5822 | {
|
---|
5823 | SVGA3dCmdDXSetCSConstantBufferOffset *pCmd = (SVGA3dCmdDXSetCSConstantBufferOffset *)pvCmd;
|
---|
5824 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5825 | rcParse = vmsvga3dCmdDXSetCSConstantBufferOffset(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5826 | break;
|
---|
5827 | }
|
---|
5828 |
|
---|
5829 | case SVGA_3D_CMD_DX_COND_BIND_ALL_SHADER:
|
---|
5830 | {
|
---|
5831 | SVGA3dCmdDXCondBindAllShader *pCmd = (SVGA3dCmdDXCondBindAllShader *)pvCmd;
|
---|
5832 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5833 | rcParse = vmsvga3dCmdDXCondBindAllShader(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5834 | break;
|
---|
5835 | }
|
---|
5836 |
|
---|
5837 | case SVGA_3D_CMD_SCREEN_COPY:
|
---|
5838 | {
|
---|
5839 | SVGA3dCmdScreenCopy *pCmd = (SVGA3dCmdScreenCopy *)pvCmd;
|
---|
5840 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5841 | rcParse = vmsvga3dCmdScreenCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5842 | break;
|
---|
5843 | }
|
---|
5844 |
|
---|
5845 | case SVGA_3D_CMD_RESERVED1:
|
---|
5846 | {
|
---|
5847 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5848 | break;
|
---|
5849 | }
|
---|
5850 |
|
---|
5851 | case SVGA_3D_CMD_RESERVED2:
|
---|
5852 | {
|
---|
5853 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5854 | break;
|
---|
5855 | }
|
---|
5856 |
|
---|
5857 | case SVGA_3D_CMD_RESERVED3:
|
---|
5858 | {
|
---|
5859 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5860 | break;
|
---|
5861 | }
|
---|
5862 |
|
---|
5863 | case SVGA_3D_CMD_RESERVED4:
|
---|
5864 | {
|
---|
5865 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5866 | break;
|
---|
5867 | }
|
---|
5868 |
|
---|
5869 | case SVGA_3D_CMD_RESERVED5:
|
---|
5870 | {
|
---|
5871 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5872 | break;
|
---|
5873 | }
|
---|
5874 |
|
---|
5875 | case SVGA_3D_CMD_RESERVED6:
|
---|
5876 | {
|
---|
5877 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5878 | break;
|
---|
5879 | }
|
---|
5880 |
|
---|
5881 | case SVGA_3D_CMD_RESERVED7:
|
---|
5882 | {
|
---|
5883 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5884 | break;
|
---|
5885 | }
|
---|
5886 |
|
---|
5887 | case SVGA_3D_CMD_RESERVED8:
|
---|
5888 | {
|
---|
5889 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
5890 | break;
|
---|
5891 | }
|
---|
5892 |
|
---|
5893 | case SVGA_3D_CMD_GROW_OTABLE:
|
---|
5894 | {
|
---|
5895 | SVGA3dCmdGrowOTable *pCmd = (SVGA3dCmdGrowOTable *)pvCmd;
|
---|
5896 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5897 | rcParse = vmsvga3dCmdGrowOTable(pThisCC, pCmd, cbCmd);
|
---|
5898 | break;
|
---|
5899 | }
|
---|
5900 |
|
---|
5901 | case SVGA_3D_CMD_DX_GROW_COTABLE:
|
---|
5902 | {
|
---|
5903 | SVGA3dCmdDXGrowCOTable *pCmd = (SVGA3dCmdDXGrowCOTable *)pvCmd;
|
---|
5904 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5905 | rcParse = vmsvga3dCmdDXGrowCOTable(pThisCC, pCmd, cbCmd);
|
---|
5906 | break;
|
---|
5907 | }
|
---|
5908 |
|
---|
5909 | case SVGA_3D_CMD_INTRA_SURFACE_COPY:
|
---|
5910 | {
|
---|
5911 | SVGA3dCmdIntraSurfaceCopy *pCmd = (SVGA3dCmdIntraSurfaceCopy *)pvCmd;
|
---|
5912 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5913 | rcParse = vmsvga3dCmdIntraSurfaceCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5914 | break;
|
---|
5915 | }
|
---|
5916 |
|
---|
5917 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V3:
|
---|
5918 | {
|
---|
5919 | SVGA3dCmdDefineGBSurface_v3 *pCmd = (SVGA3dCmdDefineGBSurface_v3 *)pvCmd;
|
---|
5920 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5921 | rcParse = vmsvga3dCmdDefineGBSurface_v3(pThisCC, pCmd);
|
---|
5922 | break;
|
---|
5923 | }
|
---|
5924 |
|
---|
5925 | case SVGA_3D_CMD_DX_RESOLVE_COPY:
|
---|
5926 | {
|
---|
5927 | SVGA3dCmdDXResolveCopy *pCmd = (SVGA3dCmdDXResolveCopy *)pvCmd;
|
---|
5928 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5929 | rcParse = vmsvga3dCmdDXResolveCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5930 | break;
|
---|
5931 | }
|
---|
5932 |
|
---|
5933 | case SVGA_3D_CMD_DX_PRED_RESOLVE_COPY:
|
---|
5934 | {
|
---|
5935 | SVGA3dCmdDXPredResolveCopy *pCmd = (SVGA3dCmdDXPredResolveCopy *)pvCmd;
|
---|
5936 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5937 | rcParse = vmsvga3dCmdDXPredResolveCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5938 | break;
|
---|
5939 | }
|
---|
5940 |
|
---|
5941 | case SVGA_3D_CMD_DX_PRED_CONVERT_REGION:
|
---|
5942 | {
|
---|
5943 | SVGA3dCmdDXPredConvertRegion *pCmd = (SVGA3dCmdDXPredConvertRegion *)pvCmd;
|
---|
5944 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5945 | rcParse = vmsvga3dCmdDXPredConvertRegion(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5946 | break;
|
---|
5947 | }
|
---|
5948 |
|
---|
5949 | case SVGA_3D_CMD_DX_PRED_CONVERT:
|
---|
5950 | {
|
---|
5951 | SVGA3dCmdDXPredConvert *pCmd = (SVGA3dCmdDXPredConvert *)pvCmd;
|
---|
5952 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5953 | rcParse = vmsvga3dCmdDXPredConvert(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5954 | break;
|
---|
5955 | }
|
---|
5956 |
|
---|
5957 | case SVGA_3D_CMD_WHOLE_SURFACE_COPY:
|
---|
5958 | {
|
---|
5959 | SVGA3dCmdWholeSurfaceCopy *pCmd = (SVGA3dCmdWholeSurfaceCopy *)pvCmd;
|
---|
5960 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5961 | rcParse = vmsvga3dCmdWholeSurfaceCopy(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5962 | break;
|
---|
5963 | }
|
---|
5964 |
|
---|
5965 | case SVGA_3D_CMD_DX_DEFINE_UA_VIEW:
|
---|
5966 | {
|
---|
5967 | SVGA3dCmdDXDefineUAView *pCmd = (SVGA3dCmdDXDefineUAView *)pvCmd;
|
---|
5968 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5969 | rcParse = vmsvga3dCmdDXDefineUAView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5970 | break;
|
---|
5971 | }
|
---|
5972 |
|
---|
5973 | case SVGA_3D_CMD_DX_DESTROY_UA_VIEW:
|
---|
5974 | {
|
---|
5975 | SVGA3dCmdDXDestroyUAView *pCmd = (SVGA3dCmdDXDestroyUAView *)pvCmd;
|
---|
5976 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5977 | rcParse = vmsvga3dCmdDXDestroyUAView(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5978 | break;
|
---|
5979 | }
|
---|
5980 |
|
---|
5981 | case SVGA_3D_CMD_DX_CLEAR_UA_VIEW_UINT:
|
---|
5982 | {
|
---|
5983 | SVGA3dCmdDXClearUAViewUint *pCmd = (SVGA3dCmdDXClearUAViewUint *)pvCmd;
|
---|
5984 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5985 | rcParse = vmsvga3dCmdDXClearUAViewUint(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5986 | break;
|
---|
5987 | }
|
---|
5988 |
|
---|
5989 | case SVGA_3D_CMD_DX_CLEAR_UA_VIEW_FLOAT:
|
---|
5990 | {
|
---|
5991 | SVGA3dCmdDXClearUAViewFloat *pCmd = (SVGA3dCmdDXClearUAViewFloat *)pvCmd;
|
---|
5992 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
5993 | rcParse = vmsvga3dCmdDXClearUAViewFloat(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
5994 | break;
|
---|
5995 | }
|
---|
5996 |
|
---|
5997 | case SVGA_3D_CMD_DX_COPY_STRUCTURE_COUNT:
|
---|
5998 | {
|
---|
5999 | SVGA3dCmdDXCopyStructureCount *pCmd = (SVGA3dCmdDXCopyStructureCount *)pvCmd;
|
---|
6000 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6001 | rcParse = vmsvga3dCmdDXCopyStructureCount(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6002 | break;
|
---|
6003 | }
|
---|
6004 |
|
---|
6005 | case SVGA_3D_CMD_DX_SET_UA_VIEWS:
|
---|
6006 | {
|
---|
6007 | SVGA3dCmdDXSetUAViews *pCmd = (SVGA3dCmdDXSetUAViews *)pvCmd;
|
---|
6008 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6009 | rcParse = vmsvga3dCmdDXSetUAViews(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6010 | break;
|
---|
6011 | }
|
---|
6012 |
|
---|
6013 | case SVGA_3D_CMD_DX_DRAW_INDEXED_INSTANCED_INDIRECT:
|
---|
6014 | {
|
---|
6015 | SVGA3dCmdDXDrawIndexedInstancedIndirect *pCmd = (SVGA3dCmdDXDrawIndexedInstancedIndirect *)pvCmd;
|
---|
6016 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6017 | rcParse = vmsvga3dCmdDXDrawIndexedInstancedIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6018 | break;
|
---|
6019 | }
|
---|
6020 |
|
---|
6021 | case SVGA_3D_CMD_DX_DRAW_INSTANCED_INDIRECT:
|
---|
6022 | {
|
---|
6023 | SVGA3dCmdDXDrawInstancedIndirect *pCmd = (SVGA3dCmdDXDrawInstancedIndirect *)pvCmd;
|
---|
6024 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6025 | rcParse = vmsvga3dCmdDXDrawInstancedIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6026 | break;
|
---|
6027 | }
|
---|
6028 |
|
---|
6029 | case SVGA_3D_CMD_DX_DISPATCH:
|
---|
6030 | {
|
---|
6031 | SVGA3dCmdDXDispatch *pCmd = (SVGA3dCmdDXDispatch *)pvCmd;
|
---|
6032 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6033 | rcParse = vmsvga3dCmdDXDispatch(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6034 | break;
|
---|
6035 | }
|
---|
6036 |
|
---|
6037 | case SVGA_3D_CMD_DX_DISPATCH_INDIRECT:
|
---|
6038 | {
|
---|
6039 | SVGA3dCmdDXDispatchIndirect *pCmd = (SVGA3dCmdDXDispatchIndirect *)pvCmd;
|
---|
6040 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6041 | rcParse = vmsvga3dCmdDXDispatchIndirect(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6042 | break;
|
---|
6043 | }
|
---|
6044 |
|
---|
6045 | case SVGA_3D_CMD_WRITE_ZERO_SURFACE:
|
---|
6046 | {
|
---|
6047 | SVGA3dCmdWriteZeroSurface *pCmd = (SVGA3dCmdWriteZeroSurface *)pvCmd;
|
---|
6048 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6049 | rcParse = vmsvga3dCmdWriteZeroSurface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6050 | break;
|
---|
6051 | }
|
---|
6052 |
|
---|
6053 | case SVGA_3D_CMD_HINT_ZERO_SURFACE:
|
---|
6054 | {
|
---|
6055 | SVGA3dCmdHintZeroSurface *pCmd = (SVGA3dCmdHintZeroSurface *)pvCmd;
|
---|
6056 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6057 | rcParse = vmsvga3dCmdHintZeroSurface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6058 | break;
|
---|
6059 | }
|
---|
6060 |
|
---|
6061 | case SVGA_3D_CMD_DX_TRANSFER_TO_BUFFER:
|
---|
6062 | {
|
---|
6063 | SVGA3dCmdDXTransferToBuffer *pCmd = (SVGA3dCmdDXTransferToBuffer *)pvCmd;
|
---|
6064 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6065 | rcParse = vmsvga3dCmdDXTransferToBuffer(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6066 | break;
|
---|
6067 | }
|
---|
6068 |
|
---|
6069 | case SVGA_3D_CMD_DX_SET_STRUCTURE_COUNT:
|
---|
6070 | {
|
---|
6071 | SVGA3dCmdDXSetStructureCount *pCmd = (SVGA3dCmdDXSetStructureCount *)pvCmd;
|
---|
6072 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6073 | rcParse = vmsvga3dCmdDXSetStructureCount(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6074 | break;
|
---|
6075 | }
|
---|
6076 |
|
---|
6077 | case SVGA_3D_CMD_LOGICOPS_BITBLT:
|
---|
6078 | {
|
---|
6079 | SVGA3dCmdLogicOpsBitBlt *pCmd = (SVGA3dCmdLogicOpsBitBlt *)pvCmd;
|
---|
6080 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6081 | rcParse = vmsvga3dCmdLogicOpsBitBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6082 | break;
|
---|
6083 | }
|
---|
6084 |
|
---|
6085 | case SVGA_3D_CMD_LOGICOPS_TRANSBLT:
|
---|
6086 | {
|
---|
6087 | SVGA3dCmdLogicOpsTransBlt *pCmd = (SVGA3dCmdLogicOpsTransBlt *)pvCmd;
|
---|
6088 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6089 | rcParse = vmsvga3dCmdLogicOpsTransBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6090 | break;
|
---|
6091 | }
|
---|
6092 |
|
---|
6093 | case SVGA_3D_CMD_LOGICOPS_STRETCHBLT:
|
---|
6094 | {
|
---|
6095 | SVGA3dCmdLogicOpsStretchBlt *pCmd = (SVGA3dCmdLogicOpsStretchBlt *)pvCmd;
|
---|
6096 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6097 | rcParse = vmsvga3dCmdLogicOpsStretchBlt(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6098 | break;
|
---|
6099 | }
|
---|
6100 |
|
---|
6101 | case SVGA_3D_CMD_LOGICOPS_COLORFILL:
|
---|
6102 | {
|
---|
6103 | SVGA3dCmdLogicOpsColorFill *pCmd = (SVGA3dCmdLogicOpsColorFill *)pvCmd;
|
---|
6104 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6105 | rcParse = vmsvga3dCmdLogicOpsColorFill(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6106 | break;
|
---|
6107 | }
|
---|
6108 |
|
---|
6109 | case SVGA_3D_CMD_LOGICOPS_ALPHABLEND:
|
---|
6110 | {
|
---|
6111 | SVGA3dCmdLogicOpsAlphaBlend *pCmd = (SVGA3dCmdLogicOpsAlphaBlend *)pvCmd;
|
---|
6112 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6113 | rcParse = vmsvga3dCmdLogicOpsAlphaBlend(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6114 | break;
|
---|
6115 | }
|
---|
6116 |
|
---|
6117 | case SVGA_3D_CMD_LOGICOPS_CLEARTYPEBLEND:
|
---|
6118 | {
|
---|
6119 | SVGA3dCmdLogicOpsClearTypeBlend *pCmd = (SVGA3dCmdLogicOpsClearTypeBlend *)pvCmd;
|
---|
6120 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6121 | rcParse = vmsvga3dCmdLogicOpsClearTypeBlend(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6122 | break;
|
---|
6123 | }
|
---|
6124 |
|
---|
6125 | case SVGA_3D_CMD_RESERVED2_1:
|
---|
6126 | {
|
---|
6127 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6128 | break;
|
---|
6129 | }
|
---|
6130 |
|
---|
6131 | case SVGA_3D_CMD_RESERVED2_2:
|
---|
6132 | {
|
---|
6133 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6134 | break;
|
---|
6135 | }
|
---|
6136 |
|
---|
6137 | case SVGA_3D_CMD_DEFINE_GB_SURFACE_V4:
|
---|
6138 | {
|
---|
6139 | SVGA3dCmdDefineGBSurface_v4 *pCmd = (SVGA3dCmdDefineGBSurface_v4 *)pvCmd;
|
---|
6140 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6141 | rcParse = vmsvga3dCmdDefineGBSurface_v4(pThisCC, pCmd);
|
---|
6142 | break;
|
---|
6143 | }
|
---|
6144 |
|
---|
6145 | case SVGA_3D_CMD_DX_SET_CS_UA_VIEWS:
|
---|
6146 | {
|
---|
6147 | SVGA3dCmdDXSetCSUAViews *pCmd = (SVGA3dCmdDXSetCSUAViews *)pvCmd;
|
---|
6148 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6149 | rcParse = vmsvga3dCmdDXSetCSUAViews(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6150 | break;
|
---|
6151 | }
|
---|
6152 |
|
---|
6153 | case SVGA_3D_CMD_DX_SET_MIN_LOD:
|
---|
6154 | {
|
---|
6155 | SVGA3dCmdDXSetMinLOD *pCmd = (SVGA3dCmdDXSetMinLOD *)pvCmd;
|
---|
6156 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6157 | rcParse = vmsvga3dCmdDXSetMinLOD(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6158 | break;
|
---|
6159 | }
|
---|
6160 |
|
---|
6161 | case SVGA_3D_CMD_RESERVED2_3:
|
---|
6162 | {
|
---|
6163 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6164 | break;
|
---|
6165 | }
|
---|
6166 |
|
---|
6167 | case SVGA_3D_CMD_RESERVED2_4:
|
---|
6168 | {
|
---|
6169 | VMSVGA_3D_CMD_NOTIMPL();
|
---|
6170 | break;
|
---|
6171 | }
|
---|
6172 |
|
---|
6173 | case SVGA_3D_CMD_DX_DEFINE_DEPTHSTENCIL_VIEW_V2:
|
---|
6174 | {
|
---|
6175 | SVGA3dCmdDXDefineDepthStencilView_v2 *pCmd = (SVGA3dCmdDXDefineDepthStencilView_v2 *)pvCmd;
|
---|
6176 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6177 | rcParse = vmsvga3dCmdDXDefineDepthStencilView_v2(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6178 | break;
|
---|
6179 | }
|
---|
6180 |
|
---|
6181 | case SVGA_3D_CMD_DX_DEFINE_STREAMOUTPUT_WITH_MOB:
|
---|
6182 | {
|
---|
6183 | SVGA3dCmdDXDefineStreamOutputWithMob *pCmd = (SVGA3dCmdDXDefineStreamOutputWithMob *)pvCmd;
|
---|
6184 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6185 | rcParse = vmsvga3dCmdDXDefineStreamOutputWithMob(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6186 | break;
|
---|
6187 | }
|
---|
6188 |
|
---|
6189 | case SVGA_3D_CMD_DX_SET_SHADER_IFACE:
|
---|
6190 | {
|
---|
6191 | SVGA3dCmdDXSetShaderIface *pCmd = (SVGA3dCmdDXSetShaderIface *)pvCmd;
|
---|
6192 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6193 | rcParse = vmsvga3dCmdDXSetShaderIface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6194 | break;
|
---|
6195 | }
|
---|
6196 |
|
---|
6197 | case SVGA_3D_CMD_DX_BIND_STREAMOUTPUT:
|
---|
6198 | {
|
---|
6199 | SVGA3dCmdDXBindStreamOutput *pCmd = (SVGA3dCmdDXBindStreamOutput *)pvCmd;
|
---|
6200 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6201 | rcParse = vmsvga3dCmdDXBindStreamOutput(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6202 | break;
|
---|
6203 | }
|
---|
6204 |
|
---|
6205 | case SVGA_3D_CMD_SURFACE_STRETCHBLT_NON_MS_TO_MS:
|
---|
6206 | {
|
---|
6207 | SVGA3dCmdSurfaceStretchBltNonMSToMS *pCmd = (SVGA3dCmdSurfaceStretchBltNonMSToMS *)pvCmd;
|
---|
6208 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6209 | rcParse = vmsvga3dCmdSurfaceStretchBltNonMSToMS(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6210 | break;
|
---|
6211 | }
|
---|
6212 |
|
---|
6213 | case SVGA_3D_CMD_DX_BIND_SHADER_IFACE:
|
---|
6214 | {
|
---|
6215 | SVGA3dCmdDXBindShaderIface *pCmd = (SVGA3dCmdDXBindShaderIface *)pvCmd;
|
---|
6216 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6217 | rcParse = vmsvga3dCmdDXBindShaderIface(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6218 | break;
|
---|
6219 | }
|
---|
6220 |
|
---|
6221 | case SVGA_3D_CMD_VB_DX_CLEAR_RENDERTARGET_VIEW_REGION:
|
---|
6222 | {
|
---|
6223 | SVGA3dCmdVBDXClearRenderTargetViewRegion *pCmd = (SVGA3dCmdVBDXClearRenderTargetViewRegion *)pvCmd;
|
---|
6224 | VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
|
---|
6225 | rcParse = vmsvga3dCmdVBDXClearRenderTargetViewRegion(pThisCC, idDXContext, pCmd, cbCmd);
|
---|
6226 | break;
|
---|
6227 | }
|
---|
6228 |
|
---|
6229 | /* Unsupported commands. */
|
---|
6230 | case SVGA_3D_CMD_DEAD4: /* SVGA_3D_CMD_VIDEO_CREATE_DECODER */
|
---|
6231 | case SVGA_3D_CMD_DEAD5: /* SVGA_3D_CMD_VIDEO_DESTROY_DECODER */
|
---|
6232 | case SVGA_3D_CMD_DEAD6: /* SVGA_3D_CMD_VIDEO_CREATE_PROCESSOR */
|
---|
6233 | case SVGA_3D_CMD_DEAD7: /* SVGA_3D_CMD_VIDEO_DESTROY_PROCESSOR */
|
---|
6234 | case SVGA_3D_CMD_DEAD8: /* SVGA_3D_CMD_VIDEO_DECODE_START_FRAME */
|
---|
6235 | case SVGA_3D_CMD_DEAD9: /* SVGA_3D_CMD_VIDEO_DECODE_RENDER */
|
---|
6236 | case SVGA_3D_CMD_DEAD10: /* SVGA_3D_CMD_VIDEO_DECODE_END_FRAME */
|
---|
6237 | case SVGA_3D_CMD_DEAD11: /* SVGA_3D_CMD_VIDEO_PROCESS_FRAME */
|
---|
6238 | /* Prevent the compiler warning. */
|
---|
6239 | case SVGA_3D_CMD_LEGACY_BASE:
|
---|
6240 | case SVGA_3D_CMD_MAX:
|
---|
6241 | case SVGA_3D_CMD_FUTURE_MAX:
|
---|
6242 | /* No 'default' case */
|
---|
6243 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatFifoUnkCmds);
|
---|
6244 | ASSERT_GUEST_MSG_FAILED(("enmCmdId=%d\n", enmCmdId));
|
---|
6245 | LogRelMax(16, ("VMSVGA: unsupported 3D command %d\n", enmCmdId));
|
---|
6246 | rcParse = VERR_NOT_IMPLEMENTED;
|
---|
6247 | break;
|
---|
6248 | }
|
---|
6249 |
|
---|
6250 | return VINF_SUCCESS;
|
---|
6251 | // return rcParse;
|
---|
6252 | }
|
---|
6253 | # undef VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK
|
---|
6254 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
6255 |
|
---|
6256 |
|
---|
6257 | /*
|
---|
6258 | *
|
---|
6259 | * Handlers for FIFO commands.
|
---|
6260 | *
|
---|
6261 | * Every handler takes the following parameters:
|
---|
6262 | *
|
---|
6263 | * pThis The shared VGA/VMSVGA state.
|
---|
6264 | * pThisCC The VGA/VMSVGA state for ring-3.
|
---|
6265 | * pCmd The command data.
|
---|
6266 | */
|
---|
6267 |
|
---|
6268 |
|
---|
6269 | /* SVGA_CMD_UPDATE */
|
---|
6270 | void vmsvgaR3CmdUpdate(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdUpdate const *pCmd)
|
---|
6271 | {
|
---|
6272 | RT_NOREF(pThis);
|
---|
6273 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6274 |
|
---|
6275 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdUpdate);
|
---|
6276 | Log(("SVGA_CMD_UPDATE %d,%d %dx%d\n", pCmd->x, pCmd->y, pCmd->width, pCmd->height));
|
---|
6277 |
|
---|
6278 | /** @todo Multiple screens? */
|
---|
6279 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
6280 | if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
|
---|
6281 | return;
|
---|
6282 |
|
---|
6283 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->x, pCmd->y, pCmd->width, pCmd->height);
|
---|
6284 | }
|
---|
6285 |
|
---|
6286 |
|
---|
6287 | /* SVGA_CMD_UPDATE_VERBOSE */
|
---|
6288 | void vmsvgaR3CmdUpdateVerbose(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdUpdateVerbose const *pCmd)
|
---|
6289 | {
|
---|
6290 | RT_NOREF(pThis);
|
---|
6291 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6292 |
|
---|
6293 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdUpdateVerbose);
|
---|
6294 | Log(("SVGA_CMD_UPDATE_VERBOSE %d,%d %dx%d reason %#x\n", pCmd->x, pCmd->y, pCmd->width, pCmd->height, pCmd->reason));
|
---|
6295 |
|
---|
6296 | /** @todo Multiple screens? */
|
---|
6297 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
6298 | if (!pScreen) /* Can happen if screen is not defined (aScreens[idScreen].fDefined == false) yet. */
|
---|
6299 | return;
|
---|
6300 |
|
---|
6301 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->x, pCmd->y, pCmd->width, pCmd->height);
|
---|
6302 | }
|
---|
6303 |
|
---|
6304 |
|
---|
6305 | /* SVGA_CMD_RECT_FILL */
|
---|
6306 | void vmsvgaR3CmdRectFill(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectFill const *pCmd)
|
---|
6307 | {
|
---|
6308 | RT_NOREF(pThis, pCmd);
|
---|
6309 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6310 |
|
---|
6311 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectFill);
|
---|
6312 | Log(("SVGA_CMD_RECT_FILL %08X @ %d,%d (%dx%d)\n", pCmd->pixel, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height));
|
---|
6313 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_RECT_FILL command ignored.\n"));
|
---|
6314 | }
|
---|
6315 |
|
---|
6316 |
|
---|
6317 | /* SVGA_CMD_RECT_COPY */
|
---|
6318 | void vmsvgaR3CmdRectCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectCopy const *pCmd)
|
---|
6319 | {
|
---|
6320 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6321 |
|
---|
6322 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectCopy);
|
---|
6323 | Log(("SVGA_CMD_RECT_COPY %d,%d -> %d,%d %dx%d\n", pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height));
|
---|
6324 |
|
---|
6325 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
6326 | AssertPtrReturnVoid(pScreen);
|
---|
6327 |
|
---|
6328 | /* Check that arguments aren't complete junk. A precise check is done in vmsvgaR3RectCopy(). */
|
---|
6329 | ASSERT_GUEST_RETURN_VOID(pCmd->srcX < pThis->svga.u32MaxWidth);
|
---|
6330 | ASSERT_GUEST_RETURN_VOID(pCmd->destX < pThis->svga.u32MaxWidth);
|
---|
6331 | ASSERT_GUEST_RETURN_VOID(pCmd->width < pThis->svga.u32MaxWidth);
|
---|
6332 | ASSERT_GUEST_RETURN_VOID(pCmd->srcY < pThis->svga.u32MaxHeight);
|
---|
6333 | ASSERT_GUEST_RETURN_VOID(pCmd->destY < pThis->svga.u32MaxHeight);
|
---|
6334 | ASSERT_GUEST_RETURN_VOID(pCmd->height < pThis->svga.u32MaxHeight);
|
---|
6335 |
|
---|
6336 | vmsvgaR3RectCopy(pThisCC, pScreen, pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY,
|
---|
6337 | pCmd->width, pCmd->height, pThis->vram_size);
|
---|
6338 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height);
|
---|
6339 | }
|
---|
6340 |
|
---|
6341 |
|
---|
6342 | /* SVGA_CMD_RECT_ROP_COPY */
|
---|
6343 | void vmsvgaR3CmdRectRopCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRectRopCopy const *pCmd)
|
---|
6344 | {
|
---|
6345 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6346 |
|
---|
6347 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRectRopCopy);
|
---|
6348 | 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));
|
---|
6349 |
|
---|
6350 | if (pCmd->rop != SVGA_ROP_COPY)
|
---|
6351 | {
|
---|
6352 | /* We only support the plain copy ROP which makes SVGA_CMD_RECT_ROP_COPY exactly the same
|
---|
6353 | * as SVGA_CMD_RECT_COPY. XFree86 4.1.0 and 4.2.0 drivers (driver version 10.4.0 and 10.7.0,
|
---|
6354 | * respectively) issue SVGA_CMD_RECT_ROP_COPY when SVGA_CAP_RECT_COPY is present even when
|
---|
6355 | * SVGA_CAP_RASTER_OP is not. However, the ROP will always be SVGA_ROP_COPY.
|
---|
6356 | */
|
---|
6357 | LogRelMax(4, ("VMSVGA: SVGA_CMD_RECT_ROP_COPY %d,%d -> %d,%d (%dx%d) ROP %X unsupported\n",
|
---|
6358 | pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height, pCmd->rop));
|
---|
6359 | return;
|
---|
6360 | }
|
---|
6361 |
|
---|
6362 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, 0);
|
---|
6363 | AssertPtrReturnVoid(pScreen);
|
---|
6364 |
|
---|
6365 | /* Check that arguments aren't complete junk. A precise check is done in vmsvgaR3RectCopy(). */
|
---|
6366 | ASSERT_GUEST_RETURN_VOID(pCmd->srcX < pThis->svga.u32MaxWidth);
|
---|
6367 | ASSERT_GUEST_RETURN_VOID(pCmd->destX < pThis->svga.u32MaxWidth);
|
---|
6368 | ASSERT_GUEST_RETURN_VOID(pCmd->width < pThis->svga.u32MaxWidth);
|
---|
6369 | ASSERT_GUEST_RETURN_VOID(pCmd->srcY < pThis->svga.u32MaxHeight);
|
---|
6370 | ASSERT_GUEST_RETURN_VOID(pCmd->destY < pThis->svga.u32MaxHeight);
|
---|
6371 | ASSERT_GUEST_RETURN_VOID(pCmd->height < pThis->svga.u32MaxHeight);
|
---|
6372 |
|
---|
6373 | vmsvgaR3RectCopy(pThisCC, pScreen, pCmd->srcX, pCmd->srcY, pCmd->destX, pCmd->destY,
|
---|
6374 | pCmd->width, pCmd->height, pThis->vram_size);
|
---|
6375 | vmsvgaR3UpdateScreen(pThisCC, pScreen, pCmd->destX, pCmd->destY, pCmd->width, pCmd->height);
|
---|
6376 | }
|
---|
6377 |
|
---|
6378 |
|
---|
6379 | /* SVGA_CMD_DISPLAY_CURSOR */
|
---|
6380 | void vmsvgaR3CmdDisplayCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDisplayCursor const *pCmd)
|
---|
6381 | {
|
---|
6382 | RT_NOREF(pThis, pCmd);
|
---|
6383 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6384 |
|
---|
6385 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDisplayCursor);
|
---|
6386 | Log(("SVGA_CMD_DISPLAY_CURSOR id=%d state=%d\n", pCmd->id, pCmd->state));
|
---|
6387 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_DISPLAY_CURSOR command ignored.\n"));
|
---|
6388 | }
|
---|
6389 |
|
---|
6390 |
|
---|
6391 | /* SVGA_CMD_MOVE_CURSOR */
|
---|
6392 | void vmsvgaR3CmdMoveCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdMoveCursor const *pCmd)
|
---|
6393 | {
|
---|
6394 | RT_NOREF(pThis, pCmd);
|
---|
6395 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6396 |
|
---|
6397 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdMoveCursor);
|
---|
6398 | Log(("SVGA_CMD_MOVE_CURSOR to %d,%d\n", pCmd->pos.x, pCmd->pos.y));
|
---|
6399 | LogRelMax(4, ("VMSVGA: Unsupported SVGA_CMD_MOVE_CURSOR command ignored.\n"));
|
---|
6400 | }
|
---|
6401 |
|
---|
6402 |
|
---|
6403 | /* SVGA_CMD_DEFINE_CURSOR */
|
---|
6404 | void vmsvgaR3CmdDefineCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineCursor const *pCmd)
|
---|
6405 | {
|
---|
6406 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6407 |
|
---|
6408 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineCursor);
|
---|
6409 | Log(("SVGA_CMD_DEFINE_CURSOR id=%d size (%dx%d) hotspot (%d,%d) andMaskDepth=%d xorMaskDepth=%d\n",
|
---|
6410 | pCmd->id, pCmd->width, pCmd->height, pCmd->hotspotX, pCmd->hotspotY, pCmd->andMaskDepth, pCmd->xorMaskDepth));
|
---|
6411 |
|
---|
6412 | ASSERT_GUEST_RETURN_VOID(pCmd->height < 2048 && pCmd->width < 2048);
|
---|
6413 | ASSERT_GUEST_RETURN_VOID(pCmd->andMaskDepth <= 32);
|
---|
6414 | ASSERT_GUEST_RETURN_VOID(pCmd->xorMaskDepth <= 32);
|
---|
6415 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6416 |
|
---|
6417 | uint32_t const cbSrcAndLine = RT_ALIGN_32(pCmd->width * (pCmd->andMaskDepth + (pCmd->andMaskDepth == 15)), 32) / 8;
|
---|
6418 | uint32_t const cbSrcAndMask = cbSrcAndLine * pCmd->height;
|
---|
6419 | uint32_t const cbSrcXorLine = RT_ALIGN_32(pCmd->width * (pCmd->xorMaskDepth + (pCmd->xorMaskDepth == 15)), 32) / 8;
|
---|
6420 |
|
---|
6421 | uint8_t const *pbSrcAndMask = (uint8_t const *)(pCmd + 1);
|
---|
6422 | uint8_t const *pbSrcXorMask = (uint8_t const *)(pCmd + 1) + cbSrcAndMask;
|
---|
6423 |
|
---|
6424 | uint32_t const cx = pCmd->width;
|
---|
6425 | uint32_t const cy = pCmd->height;
|
---|
6426 |
|
---|
6427 | /*
|
---|
6428 | * Convert the input to 1-bit AND mask and a 32-bit BRGA XOR mask.
|
---|
6429 | * The AND data uses 8-bit aligned scanlines.
|
---|
6430 | * The XOR data must be starting on a 32-bit boundrary.
|
---|
6431 | */
|
---|
6432 | uint32_t cbDstAndLine = RT_ALIGN_32(cx, 8) / 8;
|
---|
6433 | uint32_t cbDstAndMask = cbDstAndLine * cy;
|
---|
6434 | uint32_t cbDstXorMask = cx * sizeof(uint32_t) * cy;
|
---|
6435 | uint32_t cbCopy = RT_ALIGN_32(cbDstAndMask, 4) + cbDstXorMask;
|
---|
6436 |
|
---|
6437 | uint8_t *pbCopy = (uint8_t *)RTMemAlloc(cbCopy);
|
---|
6438 | AssertReturnVoid(pbCopy);
|
---|
6439 |
|
---|
6440 | /* Convert the AND mask. */
|
---|
6441 | uint8_t *pbDst = pbCopy;
|
---|
6442 | uint8_t const *pbSrc = pbSrcAndMask;
|
---|
6443 | switch (pCmd->andMaskDepth)
|
---|
6444 | {
|
---|
6445 | case 1:
|
---|
6446 | if (cbSrcAndLine == cbDstAndLine)
|
---|
6447 | memcpy(pbDst, pbSrc, cbSrcAndLine * cy);
|
---|
6448 | else
|
---|
6449 | {
|
---|
6450 | Assert(cbSrcAndLine > cbDstAndLine); /* lines are dword alined in source, but only byte in destination. */
|
---|
6451 | for (uint32_t y = 0; y < cy; y++)
|
---|
6452 | {
|
---|
6453 | memcpy(pbDst, pbSrc, cbDstAndLine);
|
---|
6454 | pbDst += cbDstAndLine;
|
---|
6455 | pbSrc += cbSrcAndLine;
|
---|
6456 | }
|
---|
6457 | }
|
---|
6458 | break;
|
---|
6459 | /* Should take the XOR mask into account for the multi-bit AND mask. */
|
---|
6460 | case 8:
|
---|
6461 | for (uint32_t y = 0; y < cy; y++)
|
---|
6462 | {
|
---|
6463 | for (uint32_t x = 0; x < cx; )
|
---|
6464 | {
|
---|
6465 | uint8_t bDst = 0;
|
---|
6466 | uint8_t fBit = 0x80;
|
---|
6467 | do
|
---|
6468 | {
|
---|
6469 | uintptr_t const idxPal = pbSrc[x] * 3;
|
---|
6470 | if ((( pThis->last_palette[idxPal]
|
---|
6471 | | (pThis->last_palette[idxPal] >> 8)
|
---|
6472 | | (pThis->last_palette[idxPal] >> 16)) & 0xff) > 0xfc)
|
---|
6473 | bDst |= fBit;
|
---|
6474 | fBit >>= 1;
|
---|
6475 | x++;
|
---|
6476 | } while (x < cx && (x & 7));
|
---|
6477 | pbDst[(x - 1) / 8] = bDst;
|
---|
6478 | }
|
---|
6479 | pbDst += cbDstAndLine;
|
---|
6480 | pbSrc += cbSrcAndLine;
|
---|
6481 | }
|
---|
6482 | break;
|
---|
6483 | case 15:
|
---|
6484 | for (uint32_t y = 0; y < cy; y++)
|
---|
6485 | {
|
---|
6486 | for (uint32_t x = 0; x < cx; )
|
---|
6487 | {
|
---|
6488 | uint8_t bDst = 0;
|
---|
6489 | uint8_t fBit = 0x80;
|
---|
6490 | do
|
---|
6491 | {
|
---|
6492 | if ((pbSrc[x * 2] | (pbSrc[x * 2 + 1] & 0x7f)) >= 0xfc)
|
---|
6493 | bDst |= fBit;
|
---|
6494 | fBit >>= 1;
|
---|
6495 | x++;
|
---|
6496 | } while (x < cx && (x & 7));
|
---|
6497 | pbDst[(x - 1) / 8] = bDst;
|
---|
6498 | }
|
---|
6499 | pbDst += cbDstAndLine;
|
---|
6500 | pbSrc += cbSrcAndLine;
|
---|
6501 | }
|
---|
6502 | break;
|
---|
6503 | case 16:
|
---|
6504 | for (uint32_t y = 0; y < cy; y++)
|
---|
6505 | {
|
---|
6506 | for (uint32_t x = 0; x < cx; )
|
---|
6507 | {
|
---|
6508 | uint8_t bDst = 0;
|
---|
6509 | uint8_t fBit = 0x80;
|
---|
6510 | do
|
---|
6511 | {
|
---|
6512 | if ((pbSrc[x * 2] | pbSrc[x * 2 + 1]) >= 0xfc)
|
---|
6513 | bDst |= fBit;
|
---|
6514 | fBit >>= 1;
|
---|
6515 | x++;
|
---|
6516 | } while (x < cx && (x & 7));
|
---|
6517 | pbDst[(x - 1) / 8] = bDst;
|
---|
6518 | }
|
---|
6519 | pbDst += cbDstAndLine;
|
---|
6520 | pbSrc += cbSrcAndLine;
|
---|
6521 | }
|
---|
6522 | break;
|
---|
6523 | case 24:
|
---|
6524 | for (uint32_t y = 0; y < cy; y++)
|
---|
6525 | {
|
---|
6526 | for (uint32_t x = 0; x < cx; )
|
---|
6527 | {
|
---|
6528 | uint8_t bDst = 0;
|
---|
6529 | uint8_t fBit = 0x80;
|
---|
6530 | do
|
---|
6531 | {
|
---|
6532 | if ((pbSrc[x * 3] | pbSrc[x * 3 + 1] | pbSrc[x * 3 + 2]) >= 0xfc)
|
---|
6533 | bDst |= fBit;
|
---|
6534 | fBit >>= 1;
|
---|
6535 | x++;
|
---|
6536 | } while (x < cx && (x & 7));
|
---|
6537 | pbDst[(x - 1) / 8] = bDst;
|
---|
6538 | }
|
---|
6539 | pbDst += cbDstAndLine;
|
---|
6540 | pbSrc += cbSrcAndLine;
|
---|
6541 | }
|
---|
6542 | break;
|
---|
6543 | case 32:
|
---|
6544 | for (uint32_t y = 0; y < cy; y++)
|
---|
6545 | {
|
---|
6546 | for (uint32_t x = 0; x < cx; )
|
---|
6547 | {
|
---|
6548 | uint8_t bDst = 0;
|
---|
6549 | uint8_t fBit = 0x80;
|
---|
6550 | do
|
---|
6551 | {
|
---|
6552 | if ((pbSrc[x * 4] | pbSrc[x * 4 + 1] | pbSrc[x * 4 + 2] | pbSrc[x * 4 + 3]) >= 0xfc)
|
---|
6553 | bDst |= fBit;
|
---|
6554 | fBit >>= 1;
|
---|
6555 | x++;
|
---|
6556 | } while (x < cx && (x & 7));
|
---|
6557 | pbDst[(x - 1) / 8] = bDst;
|
---|
6558 | }
|
---|
6559 | pbDst += cbDstAndLine;
|
---|
6560 | pbSrc += cbSrcAndLine;
|
---|
6561 | }
|
---|
6562 | break;
|
---|
6563 | default:
|
---|
6564 | RTMemFreeZ(pbCopy, cbCopy);
|
---|
6565 | AssertFailedReturnVoid();
|
---|
6566 | }
|
---|
6567 |
|
---|
6568 | /* Convert the XOR mask. */
|
---|
6569 | uint32_t *pu32Dst = (uint32_t *)(pbCopy + RT_ALIGN_32(cbDstAndMask, 4));
|
---|
6570 | pbSrc = pbSrcXorMask;
|
---|
6571 | switch (pCmd->xorMaskDepth)
|
---|
6572 | {
|
---|
6573 | case 1:
|
---|
6574 | for (uint32_t y = 0; y < cy; y++)
|
---|
6575 | {
|
---|
6576 | for (uint32_t x = 0; x < cx; )
|
---|
6577 | {
|
---|
6578 | /* most significant bit is the left most one. */
|
---|
6579 | uint8_t bSrc = pbSrc[x / 8];
|
---|
6580 | do
|
---|
6581 | {
|
---|
6582 | *pu32Dst++ = bSrc & 0x80 ? UINT32_C(0x00ffffff) : 0;
|
---|
6583 | bSrc <<= 1;
|
---|
6584 | x++;
|
---|
6585 | } while ((x & 7) && x < cx);
|
---|
6586 | }
|
---|
6587 | pbSrc += cbSrcXorLine;
|
---|
6588 | }
|
---|
6589 | break;
|
---|
6590 | case 8:
|
---|
6591 | for (uint32_t y = 0; y < cy; y++)
|
---|
6592 | {
|
---|
6593 | for (uint32_t x = 0; x < cx; x++)
|
---|
6594 | {
|
---|
6595 | uint32_t u = pThis->last_palette[pbSrc[x]];
|
---|
6596 | *pu32Dst++ = u;//RT_MAKE_U32_FROM_U8(RT_BYTE1(u), RT_BYTE2(u), RT_BYTE3(u), 0);
|
---|
6597 | }
|
---|
6598 | pbSrc += cbSrcXorLine;
|
---|
6599 | }
|
---|
6600 | break;
|
---|
6601 | case 15: /* Src: RGB-5-5-5 */
|
---|
6602 | for (uint32_t y = 0; y < cy; y++)
|
---|
6603 | {
|
---|
6604 | for (uint32_t x = 0; x < cx; x++)
|
---|
6605 | {
|
---|
6606 | uint32_t const uValue = RT_MAKE_U16(pbSrc[x * 2], pbSrc[x * 2 + 1]);
|
---|
6607 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(( uValue & 0x1f) << 3,
|
---|
6608 | ((uValue >> 5) & 0x1f) << 3,
|
---|
6609 | ((uValue >> 10) & 0x1f) << 3, 0);
|
---|
6610 | }
|
---|
6611 | pbSrc += cbSrcXorLine;
|
---|
6612 | }
|
---|
6613 | break;
|
---|
6614 | case 16: /* Src: RGB-5-6-5 */
|
---|
6615 | for (uint32_t y = 0; y < cy; y++)
|
---|
6616 | {
|
---|
6617 | for (uint32_t x = 0; x < cx; x++)
|
---|
6618 | {
|
---|
6619 | uint32_t const uValue = RT_MAKE_U16(pbSrc[x * 2], pbSrc[x * 2 + 1]);
|
---|
6620 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(( uValue & 0x1f) << 3,
|
---|
6621 | ((uValue >> 5) & 0x3f) << 2,
|
---|
6622 | ((uValue >> 11) & 0x1f) << 3, 0);
|
---|
6623 | }
|
---|
6624 | pbSrc += cbSrcXorLine;
|
---|
6625 | }
|
---|
6626 | break;
|
---|
6627 | case 24:
|
---|
6628 | for (uint32_t y = 0; y < cy; y++)
|
---|
6629 | {
|
---|
6630 | for (uint32_t x = 0; x < cx; x++)
|
---|
6631 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(pbSrc[x*3], pbSrc[x*3 + 1], pbSrc[x*3 + 2], 0);
|
---|
6632 | pbSrc += cbSrcXorLine;
|
---|
6633 | }
|
---|
6634 | break;
|
---|
6635 | case 32:
|
---|
6636 | for (uint32_t y = 0; y < cy; y++)
|
---|
6637 | {
|
---|
6638 | for (uint32_t x = 0; x < cx; x++)
|
---|
6639 | *pu32Dst++ = RT_MAKE_U32_FROM_U8(pbSrc[x*4], pbSrc[x*4 + 1], pbSrc[x*4 + 2], 0);
|
---|
6640 | pbSrc += cbSrcXorLine;
|
---|
6641 | }
|
---|
6642 | break;
|
---|
6643 | default:
|
---|
6644 | RTMemFreeZ(pbCopy, cbCopy);
|
---|
6645 | AssertFailedReturnVoid();
|
---|
6646 | }
|
---|
6647 |
|
---|
6648 | /*
|
---|
6649 | * Pass it to the frontend/whatever.
|
---|
6650 | */
|
---|
6651 | vmsvgaR3InstallNewCursor(pThisCC, pSvgaR3State, false /*fAlpha*/, pCmd->hotspotX, pCmd->hotspotY,
|
---|
6652 | cx, cy, pbCopy, cbCopy);
|
---|
6653 | }
|
---|
6654 |
|
---|
6655 |
|
---|
6656 | /* SVGA_CMD_DEFINE_ALPHA_CURSOR */
|
---|
6657 | void vmsvgaR3CmdDefineAlphaCursor(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineAlphaCursor const *pCmd)
|
---|
6658 | {
|
---|
6659 | RT_NOREF(pThis);
|
---|
6660 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6661 |
|
---|
6662 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineAlphaCursor);
|
---|
6663 | 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));
|
---|
6664 |
|
---|
6665 | /* Check against a reasonable upper limit to prevent integer overflows in the sanity checks below. */
|
---|
6666 | ASSERT_GUEST_RETURN_VOID(pCmd->height < 2048 && pCmd->width < 2048);
|
---|
6667 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6668 |
|
---|
6669 | /* The mouse pointer interface always expects an AND mask followed by the color data (XOR mask). */
|
---|
6670 | uint32_t cbAndMask = (pCmd->width + 7) / 8 * pCmd->height; /* size of the AND mask */
|
---|
6671 | cbAndMask = ((cbAndMask + 3) & ~3); /* + gap for alignment */
|
---|
6672 | uint32_t cbXorMask = pCmd->width * sizeof(uint32_t) * pCmd->height; /* + size of the XOR mask (32-bit BRGA format) */
|
---|
6673 | uint32_t cbCursorShape = cbAndMask + cbXorMask;
|
---|
6674 |
|
---|
6675 | uint8_t *pCursorCopy = (uint8_t *)RTMemAlloc(cbCursorShape);
|
---|
6676 | AssertPtrReturnVoid(pCursorCopy);
|
---|
6677 |
|
---|
6678 | /* Transparency is defined by the alpha bytes, so make the whole bitmap visible. */
|
---|
6679 | memset(pCursorCopy, 0xff, cbAndMask);
|
---|
6680 | /* Colour data */
|
---|
6681 | memcpy(pCursorCopy + cbAndMask, pCmd + 1, cbXorMask);
|
---|
6682 |
|
---|
6683 | vmsvgaR3InstallNewCursor(pThisCC, pSvgaR3State, true /*fAlpha*/, pCmd->hotspotX, pCmd->hotspotY,
|
---|
6684 | pCmd->width, pCmd->height, pCursorCopy, cbCursorShape);
|
---|
6685 | }
|
---|
6686 |
|
---|
6687 |
|
---|
6688 | /* SVGA_CMD_ESCAPE */
|
---|
6689 | void vmsvgaR3CmdEscape(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdEscape const *pCmd)
|
---|
6690 | {
|
---|
6691 | RT_NOREF(pThis);
|
---|
6692 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6693 |
|
---|
6694 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdEscape);
|
---|
6695 |
|
---|
6696 | if (pCmd->nsid == SVGA_ESCAPE_NSID_VMWARE)
|
---|
6697 | {
|
---|
6698 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(uint32_t));
|
---|
6699 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6700 |
|
---|
6701 | uint32_t const cmd = *(uint32_t *)(pCmd + 1);
|
---|
6702 | Log(("SVGA_CMD_ESCAPE (%#x %#x) VMWARE cmd=%#x\n", pCmd->nsid, pCmd->size, cmd));
|
---|
6703 |
|
---|
6704 | switch (cmd)
|
---|
6705 | {
|
---|
6706 | case SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS:
|
---|
6707 | {
|
---|
6708 | SVGAEscapeVideoSetRegs *pVideoCmd = (SVGAEscapeVideoSetRegs *)(pCmd + 1);
|
---|
6709 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(pVideoCmd->header));
|
---|
6710 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6711 |
|
---|
6712 | uint32_t const cRegs = (pCmd->size - sizeof(pVideoCmd->header)) / sizeof(pVideoCmd->items[0]);
|
---|
6713 |
|
---|
6714 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS: stream %#x\n", pVideoCmd->header.streamId));
|
---|
6715 | for (uint32_t iReg = 0; iReg < cRegs; iReg++)
|
---|
6716 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS: reg %#x val %#x\n", pVideoCmd->items[iReg].registerId, pVideoCmd->items[iReg].value));
|
---|
6717 | RT_NOREF_PV(pVideoCmd);
|
---|
6718 | break;
|
---|
6719 | }
|
---|
6720 |
|
---|
6721 | case SVGA_ESCAPE_VMWARE_VIDEO_FLUSH:
|
---|
6722 | {
|
---|
6723 | SVGAEscapeVideoFlush *pVideoCmd = (SVGAEscapeVideoFlush *)(pCmd + 1);
|
---|
6724 | ASSERT_GUEST_RETURN_VOID(pCmd->size >= sizeof(*pVideoCmd));
|
---|
6725 | Log(("SVGA_ESCAPE_VMWARE_VIDEO_FLUSH: stream %#x\n", pVideoCmd->streamId));
|
---|
6726 | RT_NOREF_PV(pVideoCmd);
|
---|
6727 | break;
|
---|
6728 | }
|
---|
6729 |
|
---|
6730 | default:
|
---|
6731 | Log(("SVGA_CMD_ESCAPE: Unknown vmware escape: %#x\n", cmd));
|
---|
6732 | break;
|
---|
6733 | }
|
---|
6734 | }
|
---|
6735 | else
|
---|
6736 | Log(("SVGA_CMD_ESCAPE %#x %#x\n", pCmd->nsid, pCmd->size));
|
---|
6737 | }
|
---|
6738 |
|
---|
6739 |
|
---|
6740 | /* SVGA_CMD_DEFINE_SCREEN */
|
---|
6741 | void vmsvgaR3CmdDefineScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineScreen const *pCmd)
|
---|
6742 | {
|
---|
6743 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6744 |
|
---|
6745 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineScreen);
|
---|
6746 | Log(("SVGA_CMD_DEFINE_SCREEN id=%x flags=%x size=(%d,%d) root=(%d,%d) %d:0x%x 0x%x\n",
|
---|
6747 | pCmd->screen.id, pCmd->screen.flags, pCmd->screen.size.width, pCmd->screen.size.height, pCmd->screen.root.x, pCmd->screen.root.y,
|
---|
6748 | pCmd->screen.backingStore.ptr.gmrId, pCmd->screen.backingStore.ptr.offset, pCmd->screen.backingStore.pitch));
|
---|
6749 |
|
---|
6750 | uint32_t const idScreen = pCmd->screen.id;
|
---|
6751 | ASSERT_GUEST_RETURN_VOID(idScreen < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
6752 |
|
---|
6753 | uint32_t const uWidth = pCmd->screen.size.width;
|
---|
6754 | ASSERT_GUEST_RETURN_VOID(uWidth <= pThis->svga.u32MaxWidth);
|
---|
6755 |
|
---|
6756 | uint32_t const uHeight = pCmd->screen.size.height;
|
---|
6757 | ASSERT_GUEST_RETURN_VOID(uHeight <= pThis->svga.u32MaxHeight);
|
---|
6758 |
|
---|
6759 | uint32_t const cbWidth = uWidth * ((32 + 7) / 8); /** @todo 32? */
|
---|
6760 | uint32_t const cbPitch = pCmd->screen.backingStore.pitch ? pCmd->screen.backingStore.pitch : cbWidth;
|
---|
6761 | ASSERT_GUEST_RETURN_VOID(cbWidth <= cbPitch);
|
---|
6762 |
|
---|
6763 | uint32_t const uScreenOffset = pCmd->screen.backingStore.ptr.offset;
|
---|
6764 | ASSERT_GUEST_RETURN_VOID(uScreenOffset < pThis->vram_size);
|
---|
6765 |
|
---|
6766 | uint32_t const cbVram = pThis->vram_size - uScreenOffset;
|
---|
6767 | /* If we have a not zero pitch, then height can't exceed the available VRAM. */
|
---|
6768 | ASSERT_GUEST_RETURN_VOID( (uHeight == 0 && cbPitch == 0)
|
---|
6769 | || (cbPitch > 0 && uHeight <= cbVram / cbPitch));
|
---|
6770 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6771 |
|
---|
6772 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idScreen];
|
---|
6773 | pScreen->fDefined = true;
|
---|
6774 | pScreen->fModified = true;
|
---|
6775 | pScreen->fuScreen = pCmd->screen.flags;
|
---|
6776 | pScreen->idScreen = idScreen;
|
---|
6777 | if (!RT_BOOL(pCmd->screen.flags & (SVGA_SCREEN_DEACTIVATE | SVGA_SCREEN_BLANKING)))
|
---|
6778 | {
|
---|
6779 | /* Not blanked. */
|
---|
6780 | ASSERT_GUEST_RETURN_VOID(uWidth > 0 && uHeight > 0);
|
---|
6781 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6782 |
|
---|
6783 | pScreen->xOrigin = pCmd->screen.root.x;
|
---|
6784 | pScreen->yOrigin = pCmd->screen.root.y;
|
---|
6785 | pScreen->cWidth = uWidth;
|
---|
6786 | pScreen->cHeight = uHeight;
|
---|
6787 | pScreen->offVRAM = uScreenOffset;
|
---|
6788 | pScreen->cbPitch = cbPitch;
|
---|
6789 | pScreen->cBpp = 32;
|
---|
6790 | }
|
---|
6791 | else
|
---|
6792 | {
|
---|
6793 | /* Screen blanked. Keep old values. */
|
---|
6794 | }
|
---|
6795 |
|
---|
6796 | pThis->svga.fGFBRegisters = false;
|
---|
6797 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
6798 |
|
---|
6799 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
6800 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
6801 | vmsvga3dDefineScreen(pThis, pThisCC, pScreen);
|
---|
6802 | #endif
|
---|
6803 | }
|
---|
6804 |
|
---|
6805 |
|
---|
6806 | /* SVGA_CMD_DESTROY_SCREEN */
|
---|
6807 | void vmsvgaR3CmdDestroyScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDestroyScreen const *pCmd)
|
---|
6808 | {
|
---|
6809 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6810 |
|
---|
6811 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDestroyScreen);
|
---|
6812 | Log(("SVGA_CMD_DESTROY_SCREEN id=%x\n", pCmd->screenId));
|
---|
6813 |
|
---|
6814 | uint32_t const idScreen = pCmd->screenId;
|
---|
6815 | ASSERT_GUEST_RETURN_VOID(idScreen < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
6816 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6817 |
|
---|
6818 | VMSVGASCREENOBJECT *pScreen = &pSvgaR3State->aScreens[idScreen];
|
---|
6819 | pScreen->fModified = true;
|
---|
6820 | pScreen->fDefined = false;
|
---|
6821 | pScreen->idScreen = idScreen;
|
---|
6822 |
|
---|
6823 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
6824 | if (RT_LIKELY(pThis->svga.f3DEnabled))
|
---|
6825 | vmsvga3dDestroyScreen(pThisCC, pScreen);
|
---|
6826 | #endif
|
---|
6827 | vmsvgaR3ChangeMode(pThis, pThisCC);
|
---|
6828 | }
|
---|
6829 |
|
---|
6830 |
|
---|
6831 | /* SVGA_CMD_DEFINE_GMRFB */
|
---|
6832 | void vmsvgaR3CmdDefineGMRFB(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineGMRFB const *pCmd)
|
---|
6833 | {
|
---|
6834 | RT_NOREF(pThis);
|
---|
6835 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6836 |
|
---|
6837 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmrFb);
|
---|
6838 | Log(("SVGA_CMD_DEFINE_GMRFB gmr=%x offset=%x bytesPerLine=%x bpp=%d color depth=%d\n",
|
---|
6839 | pCmd->ptr.gmrId, pCmd->ptr.offset, pCmd->bytesPerLine, pCmd->format.bitsPerPixel, pCmd->format.colorDepth));
|
---|
6840 |
|
---|
6841 | pSvgaR3State->GMRFB.ptr = pCmd->ptr;
|
---|
6842 | pSvgaR3State->GMRFB.bytesPerLine = pCmd->bytesPerLine;
|
---|
6843 | pSvgaR3State->GMRFB.format = pCmd->format;
|
---|
6844 | }
|
---|
6845 |
|
---|
6846 |
|
---|
6847 | /* SVGA_CMD_BLIT_GMRFB_TO_SCREEN */
|
---|
6848 | void vmsvgaR3CmdBlitGMRFBToScreen(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdBlitGMRFBToScreen const *pCmd)
|
---|
6849 | {
|
---|
6850 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6851 |
|
---|
6852 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdBlitGmrFbToScreen);
|
---|
6853 | Log(("SVGA_CMD_BLIT_GMRFB_TO_SCREEN src=(%d,%d) dest id=%d (%d,%d)(%d,%d)\n",
|
---|
6854 | pCmd->srcOrigin.x, pCmd->srcOrigin.y, pCmd->destScreenId, pCmd->destRect.left, pCmd->destRect.top, pCmd->destRect.right, pCmd->destRect.bottom));
|
---|
6855 |
|
---|
6856 | ASSERT_GUEST_RETURN_VOID(pCmd->destScreenId < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
6857 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6858 |
|
---|
6859 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, pCmd->destScreenId);
|
---|
6860 | AssertPtrReturnVoid(pScreen);
|
---|
6861 |
|
---|
6862 | /** @todo Support GMRFB.format.s.bitsPerPixel != pThis->svga.uBpp ? */
|
---|
6863 | AssertReturnVoid(pSvgaR3State->GMRFB.format.bitsPerPixel == pScreen->cBpp);
|
---|
6864 |
|
---|
6865 | /* Clip destRect to the screen dimensions. */
|
---|
6866 | SVGASignedRect screenRect;
|
---|
6867 | screenRect.left = 0;
|
---|
6868 | screenRect.top = 0;
|
---|
6869 | screenRect.right = pScreen->cWidth;
|
---|
6870 | screenRect.bottom = pScreen->cHeight;
|
---|
6871 | SVGASignedRect clipRect = pCmd->destRect;
|
---|
6872 | vmsvgaR3ClipRect(&screenRect, &clipRect);
|
---|
6873 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6874 |
|
---|
6875 | uint32_t const width = clipRect.right - clipRect.left;
|
---|
6876 | uint32_t const height = clipRect.bottom - clipRect.top;
|
---|
6877 |
|
---|
6878 | if ( width == 0
|
---|
6879 | || height == 0)
|
---|
6880 | return; /* Nothing to do. */
|
---|
6881 |
|
---|
6882 | int32_t const srcx = pCmd->srcOrigin.x + (clipRect.left - pCmd->destRect.left);
|
---|
6883 | int32_t const srcy = pCmd->srcOrigin.y + (clipRect.top - pCmd->destRect.top);
|
---|
6884 |
|
---|
6885 | /* Copy the defined by GMRFB image to the screen 0 VRAM area.
|
---|
6886 | * Prepare parameters for vmsvgaR3GmrTransfer.
|
---|
6887 | */
|
---|
6888 | AssertReturnVoid(pScreen->offVRAM < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */
|
---|
6889 |
|
---|
6890 | /* Destination: host buffer which describes the screen 0 VRAM.
|
---|
6891 | * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer.
|
---|
6892 | */
|
---|
6893 | uint8_t * const pbHstBuf = (uint8_t *)pThisCC->pbVRam + pScreen->offVRAM;
|
---|
6894 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch :
|
---|
6895 | width * (RT_ALIGN(pScreen->cBpp, 8) / 8);
|
---|
6896 | uint32_t cbHstBuf = cbScanline * pScreen->cHeight;
|
---|
6897 | if (cbHstBuf > pThis->vram_size - pScreen->offVRAM)
|
---|
6898 | cbHstBuf = pThis->vram_size - pScreen->offVRAM; /* Paranoia. */
|
---|
6899 | uint32_t const offHst = (clipRect.left * RT_ALIGN(pScreen->cBpp, 8)) / 8
|
---|
6900 | + cbScanline * clipRect.top;
|
---|
6901 | int32_t const cbHstPitch = cbScanline;
|
---|
6902 |
|
---|
6903 | /* Source: GMRFB. vmsvgaR3GmrTransfer ensures that no memory outside the GMR is read. */
|
---|
6904 | SVGAGuestPtr const gstPtr = pSvgaR3State->GMRFB.ptr;
|
---|
6905 | uint32_t const offGst = (srcx * RT_ALIGN(pSvgaR3State->GMRFB.format.bitsPerPixel, 8)) / 8
|
---|
6906 | + pSvgaR3State->GMRFB.bytesPerLine * srcy;
|
---|
6907 | int32_t const cbGstPitch = pSvgaR3State->GMRFB.bytesPerLine;
|
---|
6908 |
|
---|
6909 | int rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_WRITE_HOST_VRAM,
|
---|
6910 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
6911 | gstPtr, offGst, cbGstPitch,
|
---|
6912 | (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
|
---|
6913 | AssertRC(rc);
|
---|
6914 | vmsvgaR3UpdateScreen(pThisCC, pScreen, clipRect.left, clipRect.top, width, height);
|
---|
6915 | }
|
---|
6916 |
|
---|
6917 |
|
---|
6918 | /* SVGA_CMD_BLIT_SCREEN_TO_GMRFB */
|
---|
6919 | void vmsvgaR3CmdBlitScreenToGMRFB(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdBlitScreenToGMRFB const *pCmd)
|
---|
6920 | {
|
---|
6921 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6922 |
|
---|
6923 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdBlitScreentoGmrFb);
|
---|
6924 | /* Note! This can fetch 3d render results as well!! */
|
---|
6925 | Log(("SVGA_CMD_BLIT_SCREEN_TO_GMRFB dest=(%d,%d) src id=%d (%d,%d)(%d,%d)\n",
|
---|
6926 | pCmd->destOrigin.x, pCmd->destOrigin.y, pCmd->srcScreenId, pCmd->srcRect.left, pCmd->srcRect.top, pCmd->srcRect.right, pCmd->srcRect.bottom));
|
---|
6927 |
|
---|
6928 | ASSERT_GUEST_RETURN_VOID(pCmd->srcScreenId < RT_ELEMENTS(pSvgaR3State->aScreens));
|
---|
6929 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6930 |
|
---|
6931 | VMSVGASCREENOBJECT *pScreen = vmsvgaR3GetScreenObject(pThisCC, pCmd->srcScreenId);
|
---|
6932 | AssertPtrReturnVoid(pScreen);
|
---|
6933 |
|
---|
6934 | /** @todo Support GMRFB.format.bitsPerPixel != pThis->svga.uBpp ? */
|
---|
6935 | AssertReturnVoid(pSvgaR3State->GMRFB.format.bitsPerPixel == pScreen->cBpp);
|
---|
6936 |
|
---|
6937 | /* Clip destRect to the screen dimensions. */
|
---|
6938 | SVGASignedRect screenRect;
|
---|
6939 | screenRect.left = 0;
|
---|
6940 | screenRect.top = 0;
|
---|
6941 | screenRect.right = pScreen->cWidth;
|
---|
6942 | screenRect.bottom = pScreen->cHeight;
|
---|
6943 | SVGASignedRect clipRect = pCmd->srcRect;
|
---|
6944 | vmsvgaR3ClipRect(&screenRect, &clipRect);
|
---|
6945 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
6946 |
|
---|
6947 | uint32_t const width = clipRect.right - clipRect.left;
|
---|
6948 | uint32_t const height = clipRect.bottom - clipRect.top;
|
---|
6949 |
|
---|
6950 | if ( width == 0
|
---|
6951 | || height == 0)
|
---|
6952 | return; /* Nothing to do. */
|
---|
6953 |
|
---|
6954 | int32_t const dstx = pCmd->destOrigin.x + (clipRect.left - pCmd->srcRect.left);
|
---|
6955 | int32_t const dsty = pCmd->destOrigin.y + (clipRect.top - pCmd->srcRect.top);
|
---|
6956 |
|
---|
6957 | /* Copy the defined by GMRFB image to the screen 0 VRAM area.
|
---|
6958 | * Prepare parameters for vmsvgaR3GmrTransfer.
|
---|
6959 | */
|
---|
6960 | AssertReturnVoid(pScreen->offVRAM < pThis->vram_size); /* Paranoia. Ensured by SVGA_CMD_DEFINE_SCREEN. */
|
---|
6961 |
|
---|
6962 | /* Source: host buffer which describes the screen 0 VRAM.
|
---|
6963 | * Important are pbHstBuf and cbHstBuf. offHst and cbHstPitch are verified by vmsvgaR3GmrTransfer.
|
---|
6964 | */
|
---|
6965 | uint8_t * const pbHstBuf = (uint8_t *)pThisCC->pbVRam + pScreen->offVRAM;
|
---|
6966 | uint32_t const cbScanline = pScreen->cbPitch ? pScreen->cbPitch :
|
---|
6967 | width * (RT_ALIGN(pScreen->cBpp, 8) / 8);
|
---|
6968 | uint32_t cbHstBuf = cbScanline * pScreen->cHeight;
|
---|
6969 | if (cbHstBuf > pThis->vram_size - pScreen->offVRAM)
|
---|
6970 | cbHstBuf = pThis->vram_size - pScreen->offVRAM; /* Paranoia. */
|
---|
6971 | uint32_t const offHst = (clipRect.left * RT_ALIGN(pScreen->cBpp, 8)) / 8
|
---|
6972 | + cbScanline * clipRect.top;
|
---|
6973 | int32_t const cbHstPitch = cbScanline;
|
---|
6974 |
|
---|
6975 | /* Destination: GMRFB. vmsvgaR3GmrTransfer ensures that no memory outside the GMR is read. */
|
---|
6976 | SVGAGuestPtr const gstPtr = pSvgaR3State->GMRFB.ptr;
|
---|
6977 | uint32_t const offGst = (dstx * RT_ALIGN(pSvgaR3State->GMRFB.format.bitsPerPixel, 8)) / 8
|
---|
6978 | + pSvgaR3State->GMRFB.bytesPerLine * dsty;
|
---|
6979 | int32_t const cbGstPitch = pSvgaR3State->GMRFB.bytesPerLine;
|
---|
6980 |
|
---|
6981 | int rc = vmsvgaR3GmrTransfer(pThis, pThisCC, SVGA3D_READ_HOST_VRAM,
|
---|
6982 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
6983 | gstPtr, offGst, cbGstPitch,
|
---|
6984 | (width * RT_ALIGN(pScreen->cBpp, 8)) / 8, height);
|
---|
6985 | AssertRC(rc);
|
---|
6986 | }
|
---|
6987 |
|
---|
6988 |
|
---|
6989 | /* SVGA_CMD_ANNOTATION_FILL */
|
---|
6990 | void vmsvgaR3CmdAnnotationFill(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdAnnotationFill const *pCmd)
|
---|
6991 | {
|
---|
6992 | RT_NOREF(pThis);
|
---|
6993 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
6994 |
|
---|
6995 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdAnnotationFill);
|
---|
6996 | Log(("SVGA_CMD_ANNOTATION_FILL red=%x green=%x blue=%x\n", pCmd->color.r, pCmd->color.g, pCmd->color.b));
|
---|
6997 |
|
---|
6998 | pSvgaR3State->colorAnnotation = pCmd->color;
|
---|
6999 | }
|
---|
7000 |
|
---|
7001 |
|
---|
7002 | /* SVGA_CMD_ANNOTATION_COPY */
|
---|
7003 | void vmsvgaR3CmdAnnotationCopy(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdAnnotationCopy const *pCmd)
|
---|
7004 | {
|
---|
7005 | RT_NOREF(pThis, pCmd);
|
---|
7006 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7007 |
|
---|
7008 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdAnnotationCopy);
|
---|
7009 | Log(("SVGA_CMD_ANNOTATION_COPY srcOrigin %d,%d, srcScreenId %u\n", pCmd->srcOrigin.x, pCmd->srcOrigin.y, pCmd->srcScreenId));
|
---|
7010 |
|
---|
7011 | AssertFailed();
|
---|
7012 | }
|
---|
7013 |
|
---|
7014 |
|
---|
7015 | #ifdef VBOX_WITH_VMSVGA3D
|
---|
7016 | /* SVGA_CMD_DEFINE_GMR2 */
|
---|
7017 | void vmsvgaR3CmdDefineGMR2(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdDefineGMR2 const *pCmd)
|
---|
7018 | {
|
---|
7019 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7020 |
|
---|
7021 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2);
|
---|
7022 | Log(("SVGA_CMD_DEFINE_GMR2 id=%#x %#x pages\n", pCmd->gmrId, pCmd->numPages));
|
---|
7023 |
|
---|
7024 | /* Validate current GMR id. */
|
---|
7025 | ASSERT_GUEST_RETURN_VOID(pCmd->gmrId < pThis->svga.cGMR);
|
---|
7026 | ASSERT_GUEST_RETURN_VOID(pCmd->numPages <= VMSVGA_MAX_GMR_PAGES);
|
---|
7027 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7028 |
|
---|
7029 | if (!pCmd->numPages)
|
---|
7030 | {
|
---|
7031 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2Free);
|
---|
7032 | vmsvgaR3GmrFree(pThisCC, pCmd->gmrId);
|
---|
7033 | }
|
---|
7034 | else
|
---|
7035 | {
|
---|
7036 | PGMR pGMR = &pSvgaR3State->paGMR[pCmd->gmrId];
|
---|
7037 | if (pGMR->cMaxPages)
|
---|
7038 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdDefineGmr2Modify);
|
---|
7039 |
|
---|
7040 | /* Not sure if we should always free the descriptor, but for simplicity
|
---|
7041 | we do so if the new size is smaller than the current. */
|
---|
7042 | /** @todo always free the descriptor in SVGA_CMD_DEFINE_GMR2? */
|
---|
7043 | if (pGMR->cbTotal / X86_PAGE_SIZE > pCmd->numPages)
|
---|
7044 | vmsvgaR3GmrFree(pThisCC, pCmd->gmrId);
|
---|
7045 |
|
---|
7046 | pGMR->cMaxPages = pCmd->numPages;
|
---|
7047 | /* The rest is done by the REMAP_GMR2 command. */
|
---|
7048 | }
|
---|
7049 | }
|
---|
7050 |
|
---|
7051 |
|
---|
7052 | /* SVGA_CMD_REMAP_GMR2 */
|
---|
7053 | void vmsvgaR3CmdRemapGMR2(PVGASTATE pThis, PVGASTATECC pThisCC, SVGAFifoCmdRemapGMR2 const *pCmd)
|
---|
7054 | {
|
---|
7055 | PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
|
---|
7056 |
|
---|
7057 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRemapGmr2);
|
---|
7058 | Log(("SVGA_CMD_REMAP_GMR2 id=%#x flags=%#x offset=%#x npages=%#x\n", pCmd->gmrId, pCmd->flags, pCmd->offsetPages, pCmd->numPages));
|
---|
7059 |
|
---|
7060 | /* Validate current GMR id and size. */
|
---|
7061 | ASSERT_GUEST_RETURN_VOID(pCmd->gmrId < pThis->svga.cGMR);
|
---|
7062 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7063 | PGMR pGMR = &pSvgaR3State->paGMR[pCmd->gmrId];
|
---|
7064 | ASSERT_GUEST_RETURN_VOID( (uint64_t)pCmd->offsetPages + pCmd->numPages
|
---|
7065 | <= RT_MIN(pGMR->cMaxPages, RT_MIN(VMSVGA_MAX_GMR_PAGES, UINT32_MAX / X86_PAGE_SIZE)));
|
---|
7066 | ASSERT_GUEST_RETURN_VOID(!pCmd->offsetPages || pGMR->paDesc); /** @todo */
|
---|
7067 |
|
---|
7068 | if (pCmd->numPages == 0)
|
---|
7069 | return;
|
---|
7070 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7071 |
|
---|
7072 | /* Calc new total page count so we can use it instead of cMaxPages for allocations below. */
|
---|
7073 | uint32_t const cNewTotalPages = RT_MAX(pGMR->cbTotal >> X86_PAGE_SHIFT, pCmd->offsetPages + pCmd->numPages);
|
---|
7074 |
|
---|
7075 | /*
|
---|
7076 | * We flatten the existing descriptors into a page array, overwrite the
|
---|
7077 | * pages specified in this command and then recompress the descriptor.
|
---|
7078 | */
|
---|
7079 | /** @todo Optimize the GMR remap algorithm! */
|
---|
7080 |
|
---|
7081 | /* Save the old page descriptors as an array of page frame numbers (address >> X86_PAGE_SHIFT) */
|
---|
7082 | uint64_t *paNewPage64 = NULL;
|
---|
7083 | if (pGMR->paDesc)
|
---|
7084 | {
|
---|
7085 | STAM_REL_COUNTER_INC(&pSvgaR3State->StatR3CmdRemapGmr2Modify);
|
---|
7086 |
|
---|
7087 | paNewPage64 = (uint64_t *)RTMemAllocZ(cNewTotalPages * sizeof(uint64_t));
|
---|
7088 | AssertPtrReturnVoid(paNewPage64);
|
---|
7089 |
|
---|
7090 | uint32_t idxPage = 0;
|
---|
7091 | for (uint32_t i = 0; i < pGMR->numDescriptors; i++)
|
---|
7092 | for (uint32_t j = 0; j < pGMR->paDesc[i].numPages; j++)
|
---|
7093 | paNewPage64[idxPage++] = (pGMR->paDesc[i].GCPhys + j * X86_PAGE_SIZE) >> X86_PAGE_SHIFT;
|
---|
7094 | AssertReturnVoidStmt(idxPage == pGMR->cbTotal >> X86_PAGE_SHIFT, RTMemFree(paNewPage64));
|
---|
7095 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7096 | }
|
---|
7097 |
|
---|
7098 | /* Free the old GMR if present. */
|
---|
7099 | if (pGMR->paDesc)
|
---|
7100 | RTMemFree(pGMR->paDesc);
|
---|
7101 |
|
---|
7102 | /* Allocate the maximum amount possible (everything non-continuous) */
|
---|
7103 | PVMSVGAGMRDESCRIPTOR paDescs;
|
---|
7104 | pGMR->paDesc = paDescs = (PVMSVGAGMRDESCRIPTOR)RTMemAllocZ(cNewTotalPages * sizeof(VMSVGAGMRDESCRIPTOR));
|
---|
7105 | AssertReturnVoidStmt(paDescs, RTMemFree(paNewPage64));
|
---|
7106 |
|
---|
7107 | if (pCmd->flags & SVGA_REMAP_GMR2_VIA_GMR)
|
---|
7108 | {
|
---|
7109 | /** @todo */
|
---|
7110 | AssertFailed();
|
---|
7111 | pGMR->numDescriptors = 0;
|
---|
7112 | }
|
---|
7113 | else
|
---|
7114 | {
|
---|
7115 | uint32_t *paPages32 = (uint32_t *)(pCmd + 1);
|
---|
7116 | uint64_t *paPages64 = (uint64_t *)(pCmd + 1);
|
---|
7117 | bool fGCPhys64 = RT_BOOL(pCmd->flags & SVGA_REMAP_GMR2_PPN64);
|
---|
7118 |
|
---|
7119 | uint32_t cPages;
|
---|
7120 | if (paNewPage64)
|
---|
7121 | {
|
---|
7122 | /* Overwrite the old page array with the new page values. */
|
---|
7123 | if (fGCPhys64)
|
---|
7124 | for (uint32_t i = pCmd->offsetPages; i < pCmd->offsetPages + pCmd->numPages; i++)
|
---|
7125 | paNewPage64[i] = paPages64[i - pCmd->offsetPages];
|
---|
7126 | else
|
---|
7127 | for (uint32_t i = pCmd->offsetPages; i < pCmd->offsetPages + pCmd->numPages; i++)
|
---|
7128 | paNewPage64[i] = paPages32[i - pCmd->offsetPages];
|
---|
7129 |
|
---|
7130 | /* Use the updated page array instead of the command data. */
|
---|
7131 | fGCPhys64 = true;
|
---|
7132 | paPages64 = paNewPage64;
|
---|
7133 | cPages = cNewTotalPages;
|
---|
7134 | }
|
---|
7135 | else
|
---|
7136 | cPages = pCmd->numPages;
|
---|
7137 |
|
---|
7138 | /* The first page. */
|
---|
7139 | /** @todo The 0x00000FFFFFFFFFFF mask limits to 44 bits and should not be
|
---|
7140 | * applied to paNewPage64. */
|
---|
7141 | RTGCPHYS GCPhys;
|
---|
7142 | if (fGCPhys64)
|
---|
7143 | GCPhys = (paPages64[0] << X86_PAGE_SHIFT) & UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
7144 | else
|
---|
7145 | GCPhys = (RTGCPHYS)paPages32[0] << GUEST_PAGE_SHIFT;
|
---|
7146 | paDescs[0].GCPhys = GCPhys;
|
---|
7147 | paDescs[0].numPages = 1;
|
---|
7148 |
|
---|
7149 | /* Subsequent pages. */
|
---|
7150 | uint32_t iDescriptor = 0;
|
---|
7151 | for (uint32_t i = 1; i < cPages; i++)
|
---|
7152 | {
|
---|
7153 | if (pCmd->flags & SVGA_REMAP_GMR2_PPN64)
|
---|
7154 | GCPhys = (paPages64[i] << X86_PAGE_SHIFT) & UINT64_C(0x00000FFFFFFFFFFF); /* Seeing rubbish in the top bits with certain linux guests. */
|
---|
7155 | else
|
---|
7156 | GCPhys = (RTGCPHYS)paPages32[i] << X86_PAGE_SHIFT;
|
---|
7157 |
|
---|
7158 | /* Continuous physical memory? */
|
---|
7159 | if (GCPhys == paDescs[iDescriptor].GCPhys + paDescs[iDescriptor].numPages * X86_PAGE_SIZE)
|
---|
7160 | {
|
---|
7161 | Assert(paDescs[iDescriptor].numPages);
|
---|
7162 | paDescs[iDescriptor].numPages++;
|
---|
7163 | Log5Func(("Page %x GCPhys=%RGp successor\n", i, GCPhys));
|
---|
7164 | }
|
---|
7165 | else
|
---|
7166 | {
|
---|
7167 | iDescriptor++;
|
---|
7168 | paDescs[iDescriptor].GCPhys = GCPhys;
|
---|
7169 | paDescs[iDescriptor].numPages = 1;
|
---|
7170 | Log5Func(("Page %x GCPhys=%RGp\n", i, paDescs[iDescriptor].GCPhys));
|
---|
7171 | }
|
---|
7172 | }
|
---|
7173 |
|
---|
7174 | pGMR->cbTotal = cNewTotalPages << X86_PAGE_SHIFT;
|
---|
7175 | Log5Func(("Nr of descriptors %x; cbTotal=%#x\n", iDescriptor + 1, cNewTotalPages));
|
---|
7176 | pGMR->numDescriptors = iDescriptor + 1;
|
---|
7177 | }
|
---|
7178 |
|
---|
7179 | if (paNewPage64)
|
---|
7180 | RTMemFree(paNewPage64);
|
---|
7181 | }
|
---|
7182 |
|
---|
7183 |
|
---|
7184 | /**
|
---|
7185 | * Free the specified GMR
|
---|
7186 | *
|
---|
7187 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
7188 | * @param idGMR GMR id
|
---|
7189 | */
|
---|
7190 | void vmsvgaR3GmrFree(PVGASTATECC pThisCC, uint32_t idGMR)
|
---|
7191 | {
|
---|
7192 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
7193 |
|
---|
7194 | /* Free the old descriptor if present. */
|
---|
7195 | PGMR pGMR = &pSVGAState->paGMR[idGMR];
|
---|
7196 | if ( pGMR->numDescriptors
|
---|
7197 | || pGMR->paDesc /* needed till we implement SVGA_REMAP_GMR2_VIA_GMR */)
|
---|
7198 | {
|
---|
7199 | # ifdef DEBUG_GMR_ACCESS
|
---|
7200 | VMR3ReqCallWaitU(PDMDevHlpGetUVM(pThisCC->pDevIns), VMCPUID_ANY, (PFNRT)vmsvgaR3DeregisterGmr, 2, pDevIns, idGMR);
|
---|
7201 | # endif
|
---|
7202 |
|
---|
7203 | Assert(pGMR->paDesc);
|
---|
7204 | RTMemFree(pGMR->paDesc);
|
---|
7205 | pGMR->paDesc = NULL;
|
---|
7206 | pGMR->numDescriptors = 0;
|
---|
7207 | pGMR->cbTotal = 0;
|
---|
7208 | pGMR->cMaxPages = 0;
|
---|
7209 | }
|
---|
7210 | Assert(!pGMR->cMaxPages);
|
---|
7211 | Assert(!pGMR->cbTotal);
|
---|
7212 | }
|
---|
7213 | #endif /* VBOX_WITH_VMSVGA3D */
|
---|
7214 |
|
---|
7215 |
|
---|
7216 | /**
|
---|
7217 | * Copy between a GMR and a host memory buffer.
|
---|
7218 | *
|
---|
7219 | * @returns VBox status code.
|
---|
7220 | * @param pThis The shared VGA/VMSVGA instance data.
|
---|
7221 | * @param pThisCC The VGA/VMSVGA state for ring-3.
|
---|
7222 | * @param enmTransferType Transfer type (read/write)
|
---|
7223 | * @param pbHstBuf Host buffer pointer (valid)
|
---|
7224 | * @param cbHstBuf Size of host buffer (valid)
|
---|
7225 | * @param offHst Host buffer offset of the first scanline
|
---|
7226 | * @param cbHstPitch Destination buffer pitch
|
---|
7227 | * @param gstPtr GMR description
|
---|
7228 | * @param offGst Guest buffer offset of the first scanline
|
---|
7229 | * @param cbGstPitch Guest buffer pitch
|
---|
7230 | * @param cbWidth Width in bytes to copy
|
---|
7231 | * @param cHeight Number of scanllines to copy
|
---|
7232 | */
|
---|
7233 | int vmsvgaR3GmrTransfer(PVGASTATE pThis, PVGASTATECC pThisCC, const SVGA3dTransferType enmTransferType,
|
---|
7234 | uint8_t *pbHstBuf, uint32_t cbHstBuf, uint32_t offHst, int32_t cbHstPitch,
|
---|
7235 | SVGAGuestPtr gstPtr, uint32_t offGst, int32_t cbGstPitch,
|
---|
7236 | uint32_t cbWidth, uint32_t cHeight)
|
---|
7237 | {
|
---|
7238 | PVMSVGAR3STATE pSVGAState = pThisCC->svga.pSvgaR3State;
|
---|
7239 | PPDMDEVINS pDevIns = pThisCC->pDevIns; /* simpler */
|
---|
7240 | int rc;
|
---|
7241 |
|
---|
7242 | LogFunc(("%s host %p size=%d offset %d pitch=%d; guest gmr=%#x:%#x offset=%d pitch=%d cbWidth=%d cHeight=%d\n",
|
---|
7243 | enmTransferType == SVGA3D_READ_HOST_VRAM ? "WRITE" : "READ", /* GMR op: READ host VRAM means WRITE GMR */
|
---|
7244 | pbHstBuf, cbHstBuf, offHst, cbHstPitch,
|
---|
7245 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cbWidth, cHeight));
|
---|
7246 | AssertReturn(cbWidth && cHeight, VERR_INVALID_PARAMETER);
|
---|
7247 |
|
---|
7248 | PGMR pGMR;
|
---|
7249 | uint32_t cbGmr; /* The GMR size in bytes. */
|
---|
7250 | if (gstPtr.gmrId == SVGA_GMR_FRAMEBUFFER)
|
---|
7251 | {
|
---|
7252 | pGMR = NULL;
|
---|
7253 | cbGmr = pThis->vram_size;
|
---|
7254 | }
|
---|
7255 | else
|
---|
7256 | {
|
---|
7257 | AssertReturn(gstPtr.gmrId < pThis->svga.cGMR, VERR_INVALID_PARAMETER);
|
---|
7258 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7259 | pGMR = &pSVGAState->paGMR[gstPtr.gmrId];
|
---|
7260 | cbGmr = pGMR->cbTotal;
|
---|
7261 | }
|
---|
7262 |
|
---|
7263 | /*
|
---|
7264 | * GMR
|
---|
7265 | */
|
---|
7266 | /* Calculate GMR offset of the data to be copied. */
|
---|
7267 | AssertMsgReturn(gstPtr.offset < cbGmr,
|
---|
7268 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7269 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7270 | VERR_INVALID_PARAMETER);
|
---|
7271 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7272 | AssertMsgReturn(offGst < cbGmr - gstPtr.offset,
|
---|
7273 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7274 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7275 | VERR_INVALID_PARAMETER);
|
---|
7276 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7277 | uint32_t const offGmr = offGst + gstPtr.offset; /* Offset in the GMR, where the first scanline is located. */
|
---|
7278 |
|
---|
7279 | /* Verify that cbWidth is less than scanline and fits into the GMR. */
|
---|
7280 | uint32_t const cbGmrScanline = cbGstPitch > 0 ? cbGstPitch : -cbGstPitch;
|
---|
7281 | AssertMsgReturn(cbGmrScanline != 0,
|
---|
7282 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7283 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7284 | VERR_INVALID_PARAMETER);
|
---|
7285 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7286 | AssertMsgReturn(cbWidth <= cbGmrScanline,
|
---|
7287 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7288 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7289 | VERR_INVALID_PARAMETER);
|
---|
7290 | AssertMsgReturn(cbWidth <= cbGmr - offGmr,
|
---|
7291 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7292 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7293 | VERR_INVALID_PARAMETER);
|
---|
7294 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7295 |
|
---|
7296 | /* How many bytes are available for the data in the GMR. */
|
---|
7297 | uint32_t const cbGmrLeft = cbGstPitch > 0 ? cbGmr - offGmr : offGmr + cbWidth;
|
---|
7298 |
|
---|
7299 | /* How many scanlines would fit into the available data. */
|
---|
7300 | uint32_t cGmrScanlines = cbGmrLeft / cbGmrScanline;
|
---|
7301 | uint32_t const cbGmrLastScanline = cbGmrLeft - cGmrScanlines * cbGmrScanline; /* Slack space. */
|
---|
7302 | if (cbWidth <= cbGmrLastScanline)
|
---|
7303 | ++cGmrScanlines;
|
---|
7304 |
|
---|
7305 | if (cHeight > cGmrScanlines)
|
---|
7306 | cHeight = cGmrScanlines;
|
---|
7307 |
|
---|
7308 | AssertMsgReturn(cHeight > 0,
|
---|
7309 | ("gmr=%#x:%#x offGst=%#x cbGstPitch=%#x cHeight=%#x cbWidth=%#x cbGmr=%#x\n",
|
---|
7310 | gstPtr.gmrId, gstPtr.offset, offGst, cbGstPitch, cHeight, cbWidth, cbGmr),
|
---|
7311 | VERR_INVALID_PARAMETER);
|
---|
7312 | RT_UNTRUSTED_VALIDATED_FENCE();
|
---|
7313 |
|
---|
7314 | /*
|
---|
7315 | * Host buffer.
|
---|
7316 | */
|
---|
7317 | AssertMsgReturn(offHst < cbHstBuf,
|
---|
7318 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7319 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7320 | VERR_INVALID_PARAMETER);
|
---|
7321 |
|
---|
7322 | /* Verify that cbWidth is less than scanline and fits into the buffer. */
|
---|
7323 | uint32_t const cbHstScanline = cbHstPitch > 0 ? cbHstPitch : -cbHstPitch;
|
---|
7324 | AssertMsgReturn(cbHstScanline != 0,
|
---|
7325 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7326 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7327 | VERR_INVALID_PARAMETER);
|
---|
7328 | AssertMsgReturn(cbWidth <= cbHstScanline,
|
---|
7329 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7330 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7331 | VERR_INVALID_PARAMETER);
|
---|
7332 | AssertMsgReturn(cbWidth <= cbHstBuf - offHst,
|
---|
7333 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7334 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7335 | VERR_INVALID_PARAMETER);
|
---|
7336 |
|
---|
7337 | /* How many bytes are available for the data in the buffer. */
|
---|
7338 | uint32_t const cbHstLeft = cbHstPitch > 0 ? cbHstBuf - offHst : offHst + cbWidth;
|
---|
7339 |
|
---|
7340 | /* How many scanlines would fit into the available data. */
|
---|
7341 | uint32_t cHstScanlines = cbHstLeft / cbHstScanline;
|
---|
7342 | uint32_t const cbHstLastScanline = cbHstLeft - cHstScanlines * cbHstScanline; /* Slack space. */
|
---|
7343 | if (cbWidth <= cbHstLastScanline)
|
---|
7344 | ++cHstScanlines;
|
---|
7345 |
|
---|
7346 | if (cHeight > cHstScanlines)
|
---|
7347 | cHeight = cHstScanlines;
|
---|
7348 |
|
---|
7349 | AssertMsgReturn(cHeight > 0,
|
---|
7350 | ("buffer=%p size %d offHst=%d cbHstPitch=%d cHeight=%d cbWidth=%d\n",
|
---|
7351 | pbHstBuf, cbHstBuf, offHst, cbHstPitch, cHeight, cbWidth),
|
---|
7352 | VERR_INVALID_PARAMETER);
|
---|
7353 |
|
---|
7354 | uint8_t *pbHst = pbHstBuf + offHst;
|
---|
7355 |
|
---|
7356 | /* Shortcut for the framebuffer. */
|
---|
7357 | if (gstPtr.gmrId == SVGA_GMR_FRAMEBUFFER)
|
---|
7358 | {
|
---|
7359 | uint8_t *pbGst = pThisCC->pbVRam + offGmr;
|
---|
7360 |
|
---|
7361 | uint8_t const *pbSrc;
|
---|
7362 | int32_t cbSrcPitch;
|
---|
7363 | uint8_t *pbDst;
|
---|
7364 | int32_t cbDstPitch;
|
---|
7365 |
|
---|
7366 | if (enmTransferType == SVGA3D_READ_HOST_VRAM)
|
---|
7367 | {
|
---|
7368 | pbSrc = pbHst;
|
---|
7369 | cbSrcPitch = cbHstPitch;
|
---|
7370 | pbDst = pbGst;
|
---|
7371 | cbDstPitch = cbGstPitch;
|
---|
7372 | }
|
---|
7373 | else
|
---|
7374 | {
|
---|
7375 | pbSrc = pbGst;
|
---|
7376 | cbSrcPitch = cbGstPitch;
|
---|
7377 | pbDst = pbHst;
|
---|
7378 | cbDstPitch = cbHstPitch;
|
---|
7379 | }
|
---|
7380 |
|
---|
7381 | if ( cbWidth == (uint32_t)cbGstPitch
|
---|
7382 | && cbGstPitch == cbHstPitch)
|
---|
7383 | {
|
---|
7384 | /* Entire scanlines, positive pitch. */
|
---|
7385 | memcpy(pbDst, pbSrc, cbWidth * cHeight);
|
---|
7386 | }
|
---|
7387 | else
|
---|
7388 | {
|
---|
7389 | for (uint32_t i = 0; i < cHeight; ++i)
|
---|
7390 | {
|
---|
7391 | memcpy(pbDst, pbSrc, cbWidth);
|
---|
7392 |
|
---|
7393 | pbDst += cbDstPitch;
|
---|
7394 | pbSrc += cbSrcPitch;
|
---|
7395 | }
|
---|
7396 | }
|
---|
7397 | return VINF_SUCCESS;
|
---|
7398 | }
|
---|
7399 |
|
---|
7400 | AssertPtrReturn(pGMR, VERR_INVALID_PARAMETER);
|
---|
7401 | AssertReturn(pGMR->numDescriptors > 0, VERR_INVALID_PARAMETER);
|
---|
7402 |
|
---|
7403 | PVMSVGAGMRDESCRIPTOR const paDesc = pGMR->paDesc; /* Local copy of the pointer. */
|
---|
7404 | uint32_t iDesc = 0; /* Index in the descriptor array. */
|
---|
7405 | uint32_t offDesc = 0; /* GMR offset of the current descriptor. */
|
---|
7406 | uint32_t offGmrScanline = offGmr; /* GMR offset of the scanline which is being copied. */
|
---|
7407 | uint8_t *pbHstScanline = pbHst; /* Host address of the scanline which is being copied. */
|
---|
7408 | for (uint32_t i = 0; i < cHeight; ++i)
|
---|
7409 | {
|
---|
7410 | uint32_t cbCurrentWidth = cbWidth;
|
---|
7411 | uint32_t offGmrCurrent = offGmrScanline;
|
---|
7412 | uint8_t *pbCurrentHost = pbHstScanline;
|
---|
7413 |
|
---|
7414 | /* Find the right descriptor */
|
---|
7415 | while (offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE <= offGmrCurrent)
|
---|
7416 | {
|
---|
7417 | offDesc += paDesc[iDesc].numPages * GUEST_PAGE_SIZE;
|
---|
7418 | AssertReturn(offDesc < pGMR->cbTotal, VERR_INTERNAL_ERROR); /* overflow protection */
|
---|
7419 | ++iDesc;
|
---|
7420 | AssertReturn(iDesc < pGMR->numDescriptors, VERR_INTERNAL_ERROR);
|
---|
7421 | }
|
---|
7422 |
|
---|
7423 | while (cbCurrentWidth)
|
---|
7424 | {
|
---|
7425 | uint32_t cbToCopy;
|
---|
7426 |
|
---|
7427 | if (offGmrCurrent + cbCurrentWidth <= offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE)
|
---|
7428 | cbToCopy = cbCurrentWidth;
|
---|
7429 | else
|
---|
7430 | {
|
---|
7431 | cbToCopy = (offDesc + paDesc[iDesc].numPages * GUEST_PAGE_SIZE - offGmrCurrent);
|
---|
7432 | AssertReturn(cbToCopy <= cbCurrentWidth, VERR_INVALID_PARAMETER);
|
---|
7433 | }
|
---|
7434 |
|
---|
7435 | RTGCPHYS const GCPhys = paDesc[iDesc].GCPhys + offGmrCurrent - offDesc;
|
---|
7436 |
|
---|
7437 | Log5Func(("%s phys=%RGp\n", (enmTransferType == SVGA3D_WRITE_HOST_VRAM) ? "READ" : "WRITE", GCPhys));
|
---|
7438 |
|
---|
7439 | /*
|
---|
7440 | * We are deliberately using the non-PCI version of PDMDevHlpPCIPhys[Read|Write] as the
|
---|
7441 | * guest-side VMSVGA driver seems to allocate non-DMA (physical memory) addresses,
|
---|
7442 | * see @bugref{9654#c75}.
|
---|
7443 | */
|
---|
7444 | if (enmTransferType == SVGA3D_WRITE_HOST_VRAM)
|
---|
7445 | rc = PDMDevHlpPhysRead(pDevIns, GCPhys, pbCurrentHost, cbToCopy);
|
---|
7446 | else
|
---|
7447 | rc = PDMDevHlpPhysWrite(pDevIns, GCPhys, pbCurrentHost, cbToCopy);
|
---|
7448 | AssertRCBreak(rc);
|
---|
7449 |
|
---|
7450 | cbCurrentWidth -= cbToCopy;
|
---|
7451 | offGmrCurrent += cbToCopy;
|
---|
7452 | pbCurrentHost += cbToCopy;
|
---|
7453 |
|
---|
7454 | /* Go to the next descriptor if there's anything left. */
|
---|
7455 | if (cbCurrentWidth)
|
---|
7456 | {
|
---|
7457 | offDesc += paDesc[iDesc].numPages * GUEST_PAGE_SIZE;
|
---|
7458 | AssertReturn(offDesc < pGMR->cbTotal, VERR_INTERNAL_ERROR);
|
---|
7459 | ++iDesc;
|
---|
7460 | AssertReturn(iDesc < pGMR->numDescriptors, VERR_INTERNAL_ERROR);
|
---|
7461 | }
|
---|
7462 | }
|
---|
7463 |
|
---|
7464 | offGmrScanline += cbGstPitch;
|
---|
7465 | pbHstScanline += cbHstPitch;
|
---|
7466 | }
|
---|
7467 |
|
---|
7468 | return VINF_SUCCESS;
|
---|
7469 | }
|
---|
7470 |
|
---|
7471 |
|
---|
7472 | /**
|
---|
7473 | * Unsigned coordinates in pBox. Clip to [0; pSizeSrc), [0; pSizeDest).
|
---|
7474 | *
|
---|
7475 | * @param pSizeSrc Source surface dimensions.
|
---|
7476 | * @param pSizeDest Destination surface dimensions.
|
---|
7477 | * @param pBox Coordinates to be clipped.
|
---|
7478 | */
|
---|
7479 | void vmsvgaR3ClipCopyBox(const SVGA3dSize *pSizeSrc, const SVGA3dSize *pSizeDest, SVGA3dCopyBox *pBox)
|
---|
7480 | {
|
---|
7481 | /* Src x, w */
|
---|
7482 | if (pBox->srcx > pSizeSrc->width)
|
---|
7483 | pBox->srcx = pSizeSrc->width;
|
---|
7484 | if (pBox->w > pSizeSrc->width - pBox->srcx)
|
---|
7485 | pBox->w = pSizeSrc->width - pBox->srcx;
|
---|
7486 |
|
---|
7487 | /* Src y, h */
|
---|
7488 | if (pBox->srcy > pSizeSrc->height)
|
---|
7489 | pBox->srcy = pSizeSrc->height;
|
---|
7490 | if (pBox->h > pSizeSrc->height - pBox->srcy)
|
---|
7491 | pBox->h = pSizeSrc->height - pBox->srcy;
|
---|
7492 |
|
---|
7493 | /* Src z, d */
|
---|
7494 | if (pBox->srcz > pSizeSrc->depth)
|
---|
7495 | pBox->srcz = pSizeSrc->depth;
|
---|
7496 | if (pBox->d > pSizeSrc->depth - pBox->srcz)
|
---|
7497 | pBox->d = pSizeSrc->depth - pBox->srcz;
|
---|
7498 |
|
---|
7499 | /* Dest x, w */
|
---|
7500 | if (pBox->x > pSizeDest->width)
|
---|
7501 | pBox->x = pSizeDest->width;
|
---|
7502 | if (pBox->w > pSizeDest->width - pBox->x)
|
---|
7503 | pBox->w = pSizeDest->width - pBox->x;
|
---|
7504 |
|
---|
7505 | /* Dest y, h */
|
---|
7506 | if (pBox->y > pSizeDest->height)
|
---|
7507 | pBox->y = pSizeDest->height;
|
---|
7508 | if (pBox->h > pSizeDest->height - pBox->y)
|
---|
7509 | pBox->h = pSizeDest->height - pBox->y;
|
---|
7510 |
|
---|
7511 | /* Dest z, d */
|
---|
7512 | if (pBox->z > pSizeDest->depth)
|
---|
7513 | pBox->z = pSizeDest->depth;
|
---|
7514 | if (pBox->d > pSizeDest->depth - pBox->z)
|
---|
7515 | pBox->d = pSizeDest->depth - pBox->z;
|
---|
7516 | }
|
---|
7517 |
|
---|
7518 |
|
---|
7519 | /**
|
---|
7520 | * Unsigned coordinates in pBox. Clip to [0; pSize).
|
---|
7521 | *
|
---|
7522 | * @param pSize Source surface dimensions.
|
---|
7523 | * @param pBox Coordinates to be clipped.
|
---|
7524 | */
|
---|
7525 | void vmsvgaR3ClipBox(const SVGA3dSize *pSize, SVGA3dBox *pBox)
|
---|
7526 | {
|
---|
7527 | /* x, w */
|
---|
7528 | if (pBox->x > pSize->width)
|
---|
7529 | pBox->x = pSize->width;
|
---|
7530 | if (pBox->w > pSize->width - pBox->x)
|
---|
7531 | pBox->w = pSize->width - pBox->x;
|
---|
7532 |
|
---|
7533 | /* y, h */
|
---|
7534 | if (pBox->y > pSize->height)
|
---|
7535 | pBox->y = pSize->height;
|
---|
7536 | if (pBox->h > pSize->height - pBox->y)
|
---|
7537 | pBox->h = pSize->height - pBox->y;
|
---|
7538 |
|
---|
7539 | /* z, d */
|
---|
7540 | if (pBox->z > pSize->depth)
|
---|
7541 | pBox->z = pSize->depth;
|
---|
7542 | if (pBox->d > pSize->depth - pBox->z)
|
---|
7543 | pBox->d = pSize->depth - pBox->z;
|
---|
7544 | }
|
---|
7545 |
|
---|
7546 |
|
---|
7547 | /**
|
---|
7548 | * Clip.
|
---|
7549 | *
|
---|
7550 | * @param pBound Bounding rectangle.
|
---|
7551 | * @param pRect Rectangle to be clipped.
|
---|
7552 | */
|
---|
7553 | void vmsvgaR3ClipRect(SVGASignedRect const *pBound, SVGASignedRect *pRect)
|
---|
7554 | {
|
---|
7555 | int32_t left;
|
---|
7556 | int32_t top;
|
---|
7557 | int32_t right;
|
---|
7558 | int32_t bottom;
|
---|
7559 |
|
---|
7560 | /* Right order. */
|
---|
7561 | Assert(pBound->left <= pBound->right && pBound->top <= pBound->bottom);
|
---|
7562 | if (pRect->left < pRect->right)
|
---|
7563 | {
|
---|
7564 | left = pRect->left;
|
---|
7565 | right = pRect->right;
|
---|
7566 | }
|
---|
7567 | else
|
---|
7568 | {
|
---|
7569 | left = pRect->right;
|
---|
7570 | right = pRect->left;
|
---|
7571 | }
|
---|
7572 | if (pRect->top < pRect->bottom)
|
---|
7573 | {
|
---|
7574 | top = pRect->top;
|
---|
7575 | bottom = pRect->bottom;
|
---|
7576 | }
|
---|
7577 | else
|
---|
7578 | {
|
---|
7579 | top = pRect->bottom;
|
---|
7580 | bottom = pRect->top;
|
---|
7581 | }
|
---|
7582 |
|
---|
7583 | if (left < pBound->left)
|
---|
7584 | left = pBound->left;
|
---|
7585 | if (right < pBound->left)
|
---|
7586 | right = pBound->left;
|
---|
7587 |
|
---|
7588 | if (left > pBound->right)
|
---|
7589 | left = pBound->right;
|
---|
7590 | if (right > pBound->right)
|
---|
7591 | right = pBound->right;
|
---|
7592 |
|
---|
7593 | if (top < pBound->top)
|
---|
7594 | top = pBound->top;
|
---|
7595 | if (bottom < pBound->top)
|
---|
7596 | bottom = pBound->top;
|
---|
7597 |
|
---|
7598 | if (top > pBound->bottom)
|
---|
7599 | top = pBound->bottom;
|
---|
7600 | if (bottom > pBound->bottom)
|
---|
7601 | bottom = pBound->bottom;
|
---|
7602 |
|
---|
7603 | pRect->left = left;
|
---|
7604 | pRect->right = right;
|
---|
7605 | pRect->top = top;
|
---|
7606 | pRect->bottom = bottom;
|
---|
7607 | }
|
---|
7608 |
|
---|
7609 |
|
---|
7610 | /**
|
---|
7611 | * Clip.
|
---|
7612 | *
|
---|
7613 | * @param pBound Bounding rectangle.
|
---|
7614 | * @param pRect Rectangle to be clipped.
|
---|
7615 | */
|
---|
7616 | void vmsvgaR3Clip3dRect(SVGA3dRect const *pBound, SVGA3dRect RT_UNTRUSTED_GUEST *pRect)
|
---|
7617 | {
|
---|
7618 | uint32_t const leftBound = pBound->x;
|
---|
7619 | uint32_t const rightBound = pBound->x + pBound->w;
|
---|
7620 | uint32_t const topBound = pBound->y;
|
---|
7621 | uint32_t const bottomBound = pBound->y + pBound->h;
|
---|
7622 |
|
---|
7623 | uint32_t x = pRect->x;
|
---|
7624 | uint32_t y = pRect->y;
|
---|
7625 | uint32_t w = pRect->w;
|
---|
7626 | uint32_t h = pRect->h;
|
---|
7627 |
|
---|
7628 | /* Make sure that right and bottom coordinates can be safely computed. */
|
---|
7629 | if (x > rightBound)
|
---|
7630 | x = rightBound;
|
---|
7631 | if (w > rightBound - x)
|
---|
7632 | w = rightBound - x;
|
---|
7633 | if (y > bottomBound)
|
---|
7634 | y = bottomBound;
|
---|
7635 | if (h > bottomBound - y)
|
---|
7636 | h = bottomBound - y;
|
---|
7637 |
|
---|
7638 | /* Switch from x, y, w, h to left, top, right, bottom. */
|
---|
7639 | uint32_t left = x;
|
---|
7640 | uint32_t right = x + w;
|
---|
7641 | uint32_t top = y;
|
---|
7642 | uint32_t bottom = y + h;
|
---|
7643 |
|
---|
7644 | /* A standard left, right, bottom, top clipping. */
|
---|
7645 | if (left < leftBound)
|
---|
7646 | left = leftBound;
|
---|
7647 | if (right < leftBound)
|
---|
7648 | right = leftBound;
|
---|
7649 |
|
---|
7650 | if (left > rightBound)
|
---|
7651 | left = rightBound;
|
---|
7652 | if (right > rightBound)
|
---|
7653 | right = rightBound;
|
---|
7654 |
|
---|
7655 | if (top < topBound)
|
---|
7656 | top = topBound;
|
---|
7657 | if (bottom < topBound)
|
---|
7658 | bottom = topBound;
|
---|
7659 |
|
---|
7660 | if (top > bottomBound)
|
---|
7661 | top = bottomBound;
|
---|
7662 | if (bottom > bottomBound)
|
---|
7663 | bottom = bottomBound;
|
---|
7664 |
|
---|
7665 | /* Back to x, y, w, h representation. */
|
---|
7666 | pRect->x = left;
|
---|
7667 | pRect->y = top;
|
---|
7668 | pRect->w = right - left;
|
---|
7669 | pRect->h = bottom - top;
|
---|
7670 | }
|
---|
7671 |
|
---|