*----------------------------------------------------------------------
*/
-static INLINE
-void surface_to_surfaceid(struct svga_winsys_context *swc, // IN
- struct pipe_surface *surface, // IN
- SVGA3dSurfaceImageId *id, // OUT
- unsigned flags) // IN
+static INLINE void
+surface_to_surfaceid(struct svga_winsys_context *swc, // IN
+ struct pipe_surface *surface, // IN
+ SVGA3dSurfaceImageId *id, // OUT
+ unsigned flags) // IN
{
- if(surface) {
+ if (surface) {
struct svga_surface *s = svga_surface(surface);
swc->surface_relocation(swc, &id->sid, s->handle, flags);
id->face = s->real_face; /* faces have the same order */
SVGA3dCmdHeader *header;
header = swc->reserve(swc, sizeof *header + cmdSize, nr_relocs);
- if(!header)
+ if (!header)
return NULL;
header->id = cmd;
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_CONTEXT_DEFINE, sizeof *cmd, 0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
swc->commit(swc);
-
+
return PIPE_OK;
}
SVGA3D_DestroyContext(struct svga_winsys_context *swc) // IN
{
SVGA3dCmdDestroyContext *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_CONTEXT_DESTROY, sizeof *cmd, 0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
-
+
cmd->cid = swc->cid;
-
+
swc->commit(swc);
-
+
return PIPE_OK;
}
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SURFACE_DEFINE, sizeof *cmd +
sizeof **mipSizes * numMipSizes, 1);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
swc->surface_relocation(swc, &cmd->sid, sid, SVGA_RELOC_WRITE);
memset(*faces, 0, sizeof **faces * SVGA3D_MAX_SURFACE_FACES);
memset(*mipSizes, 0, sizeof **mipSizes * numMipSizes);
-
+
return PIPE_OK;
}
ret = SVGA3D_BeginDefineSurface(swc,
sid, 0, format, &faces, &mipSizes, 1);
- if(ret != PIPE_OK)
+ if (ret != PIPE_OK)
return ret;
faces[0].numMipLevels = 1;
mipSizes[0].width = width;
mipSizes[0].height = height;
mipSizes[0].depth = 1;
-
+
swc->commit(swc);;
-
+
return PIPE_OK;
}
struct svga_winsys_surface *sid) // IN
{
SVGA3dCmdDestroySurface *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SURFACE_DESTROY, sizeof *cmd, 1);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
-
+
swc->surface_relocation(swc, &cmd->sid, sid, SVGA_RELOC_READ);
swc->commit(swc);;
-
+
return PIPE_OK;
}
uint32 numBoxes, // IN
SVGA3dSurfaceDMAFlags flags) // IN
{
- struct svga_texture *texture = svga_texture(st->base.resource);
+ struct svga_texture *texture = svga_texture(st->base.resource);
SVGA3dCmdSurfaceDMA *cmd;
SVGA3dCmdSurfaceDMASuffix *pSuffix;
uint32 boxesSize = sizeof *boxes * numBoxes;
unsigned region_flags;
unsigned surface_flags;
-
- if(transfer == SVGA3D_WRITE_HOST_VRAM) {
+
+ if (transfer == SVGA3D_WRITE_HOST_VRAM) {
region_flags = SVGA_RELOC_READ;
surface_flags = SVGA_RELOC_WRITE;
}
- else if(transfer == SVGA3D_READ_HOST_VRAM) {
+ else if (transfer == SVGA3D_READ_HOST_VRAM) {
region_flags = SVGA_RELOC_WRITE;
surface_flags = SVGA_RELOC_READ;
}
assert(0);
return PIPE_ERROR_BAD_INPUT;
}
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SURFACE_DMA,
sizeof *cmd + boxesSize + sizeof *pSuffix,
2);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
swc->region_relocation(swc, &cmd->guest.ptr, st->hwbuf, 0, region_flags);
cmd->transfer = transfer;
memcpy(&cmd[1], boxes, boxesSize);
-
+
pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + boxesSize);
pSuffix->suffixSize = sizeof *pSuffix;
pSuffix->maximumOffset = st->hw_nblocksy*st->base.stride;
SVGA3dCmdSurfaceDMASuffix *pSuffix;
unsigned region_flags;
unsigned surface_flags;
-
- if(transfer == SVGA3D_WRITE_HOST_VRAM) {
+
+ if (transfer == SVGA3D_WRITE_HOST_VRAM) {
region_flags = SVGA_RELOC_READ;
surface_flags = SVGA_RELOC_WRITE;
}
- else if(transfer == SVGA3D_READ_HOST_VRAM) {
+ else if (transfer == SVGA3D_READ_HOST_VRAM) {
region_flags = SVGA_RELOC_WRITE;
surface_flags = SVGA_RELOC_READ;
}
assert(0);
return PIPE_ERROR_BAD_INPUT;
}
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SURFACE_DMA,
sizeof *cmd + sizeof *box + sizeof *pSuffix,
2);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
swc->region_relocation(swc, &cmd->guest.ptr, guest, 0, region_flags);
box->srcx = guest_offset;
box->srcy = 0;
box->srcz = 0;
-
+
pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + sizeof *box);
pSuffix->suffixSize = sizeof *pSuffix;
pSuffix->maximumOffset = guest_offset + size;
struct pipe_surface *surface) // IN
{
SVGA3dCmdSetRenderTarget *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SETRENDERTARGET, sizeof *cmd, 1);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SHADER_DEFINE, sizeof *cmd + bytecodeLen,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
SVGA3dShaderType type) // IN
{
SVGA3dCmdDestroyShader *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SHADER_DESTROY, sizeof *cmd,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
const void *value) // IN
{
SVGA3dCmdSetShaderConst *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SET_SHADER_CONST, sizeof *cmd,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
SVGA_3D_CMD_SET_SHADER_CONST,
sizeof *cmd + (numRegs - 1) * sizeof cmd->values,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
uint32 shid) // IN
{
SVGA3dCmdSetShader *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SET_SHADER, sizeof *cmd,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
-
+
cmd->cid = swc->cid;
cmd->type = type;
cmd->shid = shid;
uint32 numRects) // IN
{
SVGA3dCmdClear *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
- SVGA_3D_CMD_CLEAR,
+ SVGA_3D_CMD_CLEAR,
sizeof *cmd + sizeof **rects * numRects,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
enum pipe_error ret;
ret = SVGA3D_BeginClear(swc, flags, color, depth, stencil, &rect, 1);
- if(ret != PIPE_OK)
+ if (ret != PIPE_OK)
return PIPE_ERROR_OUT_OF_MEMORY;
memset(rect, 0, sizeof *rect);
uint32 rangeSize = sizeof **ranges * numRanges;
cmd = SVGA3D_FIFOReserve(swc,
- SVGA_3D_CMD_DRAW_PRIMITIVES,
+ SVGA_3D_CMD_DRAW_PRIMITIVES,
sizeof *cmd + declSize + rangeSize,
numVertexDecls + numRanges);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SURFACE_COPY, sizeof *cmd + boxesSize,
2);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
surface_to_surfaceid(swc, src, &cmd->src, SVGA_RELOC_READ);
SVGA3dStretchBltMode mode) // IN
{
SVGA3dCmdSurfaceStretchBlt *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SURFACE_STRETCHBLT, sizeof *cmd,
2);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
surface_to_surfaceid(swc, src, &cmd->src, SVGA_RELOC_READ);
SVGA3dRect *rect) // IN
{
SVGA3dCmdSetViewport *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SETVIEWPORT, sizeof *cmd,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
*
* SVGA3D_SetScissorRect --
*
- * Set the current context's scissor rectangle. If scissor
- * is enabled then all rendering is clipped to the scissor.
+ * Set the current context's scissor rectangle. If scissoring
+ * is enabled then all rendering is clipped to the scissor bounds.
*
* Results:
* None.
SVGA3dRect *rect) // IN
{
SVGA3dCmdSetScissorRect *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SETSCISSORRECT, sizeof *cmd,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
* SVGA3D_SetClipPlane --
*
* Set one of the current context's clip planes. If the clip
- * plane is enabled then all 3d rendering is clipped to against
+ * plane is enabled then all 3d rendering is clipped against
* the plane.
*
* Results:
uint32 index, const float *plane)
{
SVGA3dCmdSetClipPlane *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SETCLIPPLANE, sizeof *cmd,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
float zMax) // IN
{
SVGA3dCmdSetZRange *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
SVGA_3D_CMD_SETZRANGE, sizeof *cmd,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
uint32 numStates) // IN
{
SVGA3dCmdSetTextureState *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
- SVGA_3D_CMD_SETTEXTURESTATE,
+ SVGA_3D_CMD_SETTEXTURESTATE,
sizeof *cmd + sizeof **states * numStates,
numStates);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
uint32 numStates) // IN
{
SVGA3dCmdSetRenderState *cmd;
-
+
cmd = SVGA3D_FIFOReserve(swc,
- SVGA_3D_CMD_SETRENDERSTATE,
+ SVGA_3D_CMD_SETRENDERSTATE,
sizeof *cmd + sizeof **states * numStates,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
SVGA_3D_CMD_BEGIN_QUERY,
sizeof *cmd,
0);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
cmd->type = type;
swc->commit(swc);
-
+
return PIPE_OK;
}
SVGA3dCmdEndQuery *cmd;
cmd = SVGA3D_FIFOReserve(swc,
- SVGA_3D_CMD_END_QUERY,
+ SVGA_3D_CMD_END_QUERY,
sizeof *cmd,
1);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
SVGA_RELOC_WRITE);
swc->commit(swc);
-
+
return PIPE_OK;
}
SVGA3dCmdWaitForQuery *cmd;
cmd = SVGA3D_FIFOReserve(swc,
- SVGA_3D_CMD_WAIT_FOR_QUERY,
+ SVGA_3D_CMD_WAIT_FOR_QUERY,
sizeof *cmd,
1);
- if(!cmd)
+ if (!cmd)
return PIPE_ERROR_OUT_OF_MEMORY;
cmd->cid = swc->cid;
cmd->type = type;
-
+
swc->region_relocation(swc, &cmd->guestResult, buffer, 0,
SVGA_RELOC_WRITE);
swc->commit(swc);
-
+
return PIPE_OK;
}