1 /**********************************************************
2 * Copyright 2008-2009 VMware, Inc. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 **********************************************************/
29 * Command construction utility for the SVGA3D protocol used by
30 * the VMware SVGA device, based on the svgautil library.
37 #include "svga_types.h"
39 #include "svga3d_reg.h"
41 #include "pipe/p_defines.h"
46 struct svga_winsys_context
;
47 struct svga_winsys_buffer
;
48 struct svga_winsys_surface
;
49 struct svga_winsys_gb_shader
;
53 * SVGA Device Interoperability
57 SVGA3D_FIFOReserve(struct svga_winsys_context
*swc
, uint32 cmd
, uint32 cmdSize
, uint32 nr_relocs
);
60 SVGA_FIFOCommitAll(struct svga_winsys_context
*swc
);
68 SVGA3D_DefineContext(struct svga_winsys_context
*swc
);
71 SVGA3D_DestroyContext(struct svga_winsys_context
*swc
);
79 SVGA3D_BeginDefineSurface(struct svga_winsys_context
*swc
,
80 struct svga_winsys_surface
*sid
,
81 SVGA3dSurfaceFlags flags
,
82 SVGA3dSurfaceFormat format
,
83 SVGA3dSurfaceFace
**faces
,
84 SVGA3dSize
**mipSizes
,
87 SVGA3D_DefineSurface2D(struct svga_winsys_context
*swc
,
88 struct svga_winsys_surface
*sid
,
91 SVGA3dSurfaceFormat format
);
93 SVGA3D_DestroySurface(struct svga_winsys_context
*swc
,
94 struct svga_winsys_surface
*sid
);
102 SVGA3D_SurfaceDMA(struct svga_winsys_context
*swc
,
103 struct svga_transfer
*st
,
104 SVGA3dTransferType transfer
,
105 const SVGA3dCopyBox
*boxes
,
107 SVGA3dSurfaceDMAFlags flags
);
110 SVGA3D_BufferDMA(struct svga_winsys_context
*swc
,
111 struct svga_winsys_buffer
*guest
,
112 struct svga_winsys_surface
*host
,
113 SVGA3dTransferType transfer
,
117 SVGA3dSurfaceDMAFlags flags
);
125 SVGA3D_BeginClear(struct svga_winsys_context
*swc
,
126 SVGA3dClearFlag flags
,
127 uint32 color
, float depth
, uint32 stencil
,
128 SVGA3dRect
**rects
, uint32 numRects
);
131 SVGA3D_ClearRect(struct svga_winsys_context
*swc
,
132 SVGA3dClearFlag flags
, uint32 color
, float depth
,
133 uint32 stencil
, uint32 x
, uint32 y
, uint32 w
, uint32 h
);
136 SVGA3D_BeginDrawPrimitives(struct svga_winsys_context
*swc
,
137 SVGA3dVertexDecl
**decls
,
138 uint32 numVertexDecls
,
139 SVGA3dPrimitiveRange
**ranges
,
147 SVGA3D_BeginSurfaceCopy(struct svga_winsys_context
*swc
,
148 struct pipe_surface
*src
,
149 struct pipe_surface
*dest
,
150 SVGA3dCopyBox
**boxes
, uint32 numBoxes
);
154 SVGA3D_SurfaceStretchBlt(struct svga_winsys_context
*swc
,
155 struct pipe_surface
*src
,
156 struct pipe_surface
*dest
,
157 SVGA3dBox
*boxSrc
, SVGA3dBox
*boxDest
,
158 SVGA3dStretchBltMode mode
);
161 * Shared FFP/Shader Render State
165 SVGA3D_SetRenderTarget(struct svga_winsys_context
*swc
,
166 SVGA3dRenderTargetType type
,
167 struct pipe_surface
*surface
);
170 SVGA3D_SetZRange(struct svga_winsys_context
*swc
,
171 float zMin
, float zMax
);
174 SVGA3D_SetViewport(struct svga_winsys_context
*swc
,
178 SVGA3D_SetScissorRect(struct svga_winsys_context
*swc
,
182 SVGA3D_SetClipPlane(struct svga_winsys_context
*swc
,
183 uint32 index
, const float *plane
);
186 SVGA3D_BeginSetTextureState(struct svga_winsys_context
*swc
,
187 SVGA3dTextureState
**states
,
191 SVGA3D_BeginSetRenderState(struct svga_winsys_context
*swc
,
192 SVGA3dRenderState
**states
,
201 SVGA3D_DefineShader(struct svga_winsys_context
*swc
,
202 uint32 shid
, SVGA3dShaderType type
,
203 const uint32
*bytecode
, uint32 bytecodeLen
);
206 SVGA3D_DestroyShader(struct svga_winsys_context
*swc
,
207 uint32 shid
, SVGA3dShaderType type
);
210 SVGA3D_SetShaderConst(struct svga_winsys_context
*swc
,
211 uint32 reg
, SVGA3dShaderType type
,
212 SVGA3dShaderConstType ctype
, const void *value
);
215 SVGA3D_SetShaderConsts(struct svga_winsys_context
*swc
,
218 SVGA3dShaderType type
,
219 SVGA3dShaderConstType ctype
,
223 SVGA3D_SetShader(struct svga_winsys_context
*swc
,
224 SVGA3dShaderType type
, uint32 shid
);
228 * Guest-backed surface functions
232 SVGA3D_DefineGBShader(struct svga_winsys_context
*swc
,
233 struct svga_winsys_gb_shader
*gbshader
,
234 SVGA3dShaderType type
,
238 SVGA3D_BindGBShader(struct svga_winsys_context
*swc
,
239 struct svga_winsys_gb_shader
*gbshader
);
242 SVGA3D_SetGBShader(struct svga_winsys_context
*swc
,
243 SVGA3dShaderType type
,
244 struct svga_winsys_gb_shader
*gbshader
);
247 SVGA3D_DestroyGBShader(struct svga_winsys_context
*swc
,
248 struct svga_winsys_gb_shader
*gbshader
);
251 SVGA3D_BindGBSurface(struct svga_winsys_context
*swc
,
252 struct svga_winsys_surface
*surface
);
255 SVGA3D_DefineGBContext(struct svga_winsys_context
*swc
);
258 SVGA3D_DestroyGBContext(struct svga_winsys_context
*swc
);
261 SVGA3D_BindGBContext(struct svga_winsys_context
*swc
);
264 SVGA3D_InvalidateGBContext(struct svga_winsys_context
*swc
);
267 SVGA3D_UpdateGBImage(struct svga_winsys_context
*swc
,
268 struct svga_winsys_surface
*surface
,
269 const SVGA3dBox
*box
,
270 unsigned face
, unsigned mipLevel
);
273 SVGA3D_UpdateGBSurface(struct svga_winsys_context
*swc
,
274 struct svga_winsys_surface
*surface
);
278 SVGA3D_ReadbackGBImage(struct svga_winsys_context
*swc
,
279 struct svga_winsys_surface
*surface
,
280 unsigned face
, unsigned mipLevel
);
284 SVGA3D_ReadbackGBSurface(struct svga_winsys_context
*swc
,
285 struct svga_winsys_surface
*surface
);
289 SVGA3D_ReadbackGBImagePartial(struct svga_winsys_context
*swc
,
290 struct svga_winsys_surface
*surface
,
291 unsigned face
, unsigned mipLevel
,
292 const SVGA3dBox
*box
,
297 SVGA3D_InvalidateGBImagePartial(struct svga_winsys_context
*swc
,
298 struct svga_winsys_surface
*surface
,
299 unsigned face
, unsigned mipLevel
,
300 const SVGA3dBox
*box
,
305 SVGA3D_SetGBShaderConstsInline(struct svga_winsys_context
*swc
,
308 SVGA3dShaderType shaderType
,
309 SVGA3dShaderConstType constType
,
317 SVGA3D_BeginQuery(struct svga_winsys_context
*swc
,
318 SVGA3dQueryType type
);
321 SVGA3D_EndQuery(struct svga_winsys_context
*swc
,
322 SVGA3dQueryType type
,
323 struct svga_winsys_buffer
*buffer
);
326 SVGA3D_WaitForQuery(struct svga_winsys_context
*swc
,
327 SVGA3dQueryType type
,
328 struct svga_winsys_buffer
*buffer
);
330 #endif /* __SVGA3D_H__ */