Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. /**********************************************************
  2.  * Copyright 2008-2009 VMware, Inc.  All rights reserved.
  3.  *
  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:
  11.  *
  12.  * The above copyright notice and this permission notice shall be
  13.  * included in all copies or substantial portions of the Software.
  14.  *
  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
  22.  * SOFTWARE.
  23.  *
  24.  **********************************************************/
  25.  
  26. /*
  27.  * svga_cmd.h --
  28.  *
  29.  *      Command construction utility for the SVGA3D protocol used by
  30.  *      the VMware SVGA device, based on the svgautil library.
  31.  */
  32.  
  33. #ifndef __SVGA3D_H__
  34. #define __SVGA3D_H__
  35.  
  36.  
  37. #include "svga_types.h"
  38. #include "svga_reg.h"
  39. #include "svga3d_reg.h"
  40.  
  41. #include "pipe/p_defines.h"
  42.  
  43.  
  44. struct pipe_surface;
  45. struct svga_transfer;
  46. struct svga_winsys_context;
  47. struct svga_winsys_buffer;
  48. struct svga_winsys_surface;
  49. struct svga_winsys_gb_shader;
  50.  
  51.  
  52. /*
  53.  * SVGA Device Interoperability
  54.  */
  55.  
  56. void *
  57. SVGA3D_FIFOReserve(struct svga_winsys_context *swc, uint32 cmd, uint32 cmdSize, uint32 nr_relocs);
  58.  
  59. void
  60. SVGA_FIFOCommitAll(struct svga_winsys_context *swc);
  61.  
  62.  
  63. /*
  64.  * Context Management
  65.  */
  66.  
  67. enum pipe_error
  68. SVGA3D_DefineContext(struct svga_winsys_context *swc);
  69.  
  70. enum pipe_error
  71. SVGA3D_DestroyContext(struct svga_winsys_context *swc);
  72.  
  73.  
  74. /*
  75.  * Surface Management
  76.  */
  77.  
  78. enum pipe_error
  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,
  85.                           uint32 numMipSizes);
  86. enum pipe_error
  87. SVGA3D_DefineSurface2D(struct svga_winsys_context *swc,
  88.                        struct svga_winsys_surface *sid,
  89.                        uint32 width,
  90.                        uint32 height,
  91.                        SVGA3dSurfaceFormat format);
  92. enum pipe_error
  93. SVGA3D_DestroySurface(struct svga_winsys_context *swc,
  94.                       struct svga_winsys_surface *sid);
  95.  
  96.  
  97. /*
  98.  * Surface Operations
  99.  */
  100.  
  101. enum pipe_error
  102. SVGA3D_SurfaceDMA(struct svga_winsys_context *swc,
  103.                   struct svga_transfer *st,
  104.                   SVGA3dTransferType transfer,
  105.                   const SVGA3dCopyBox *boxes,
  106.                   uint32 numBoxes,
  107.                   SVGA3dSurfaceDMAFlags flags);
  108.  
  109. enum pipe_error
  110. SVGA3D_BufferDMA(struct svga_winsys_context *swc,
  111.                  struct svga_winsys_buffer *guest,
  112.                  struct svga_winsys_surface *host,
  113.                  SVGA3dTransferType transfer,
  114.                  uint32 size,
  115.                  uint32 guest_offset,
  116.                  uint32 host_offset,
  117.                  SVGA3dSurfaceDMAFlags flags);
  118.  
  119. /*
  120.  * Drawing Operations
  121.  */
  122.  
  123.  
  124. enum pipe_error
  125. SVGA3D_BeginClear(struct svga_winsys_context *swc,
  126.                   SVGA3dClearFlag flags,
  127.                   uint32 color, float depth, uint32 stencil,
  128.                   SVGA3dRect **rects, uint32 numRects);
  129.  
  130. enum pipe_error
  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);
  134.  
  135. enum pipe_error
  136. SVGA3D_BeginDrawPrimitives(struct svga_winsys_context *swc,
  137.                            SVGA3dVertexDecl **decls,
  138.                            uint32 numVertexDecls,
  139.                            SVGA3dPrimitiveRange **ranges,
  140.                            uint32 numRanges);
  141.  
  142. /*
  143.  * Blits
  144.  */
  145.  
  146. enum pipe_error
  147. SVGA3D_BeginSurfaceCopy(struct svga_winsys_context *swc,
  148.                         struct pipe_surface *src,
  149.                         struct pipe_surface *dest,
  150.                         SVGA3dCopyBox **boxes, uint32 numBoxes);
  151.  
  152.  
  153. enum pipe_error
  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);
  159.  
  160. /*
  161.  * Shared FFP/Shader Render State
  162.  */
  163.  
  164. enum pipe_error
  165. SVGA3D_SetRenderTarget(struct svga_winsys_context *swc,
  166.                        SVGA3dRenderTargetType type,
  167.                        struct pipe_surface *surface);
  168.  
  169. enum pipe_error
  170. SVGA3D_SetZRange(struct svga_winsys_context *swc,
  171.                  float zMin, float zMax);
  172.  
  173. enum pipe_error
  174. SVGA3D_SetViewport(struct svga_winsys_context *swc,
  175.                    SVGA3dRect *rect);
  176.  
  177. enum pipe_error
  178. SVGA3D_SetScissorRect(struct svga_winsys_context *swc,
  179.                       SVGA3dRect *rect);
  180.  
  181. enum pipe_error
  182. SVGA3D_SetClipPlane(struct svga_winsys_context *swc,
  183.                     uint32 index, const float *plane);
  184.  
  185. enum pipe_error
  186. SVGA3D_BeginSetTextureState(struct svga_winsys_context *swc,
  187.                             SVGA3dTextureState **states,
  188.                             uint32 numStates);
  189.  
  190. enum pipe_error
  191. SVGA3D_BeginSetRenderState(struct svga_winsys_context *swc,
  192.                            SVGA3dRenderState **states,
  193.                            uint32 numStates);
  194.  
  195.  
  196. /*
  197.  * Shaders
  198.  */
  199.  
  200. enum pipe_error
  201. SVGA3D_DefineShader(struct svga_winsys_context *swc,
  202.                     uint32 shid, SVGA3dShaderType type,
  203.                     const uint32 *bytecode, uint32 bytecodeLen);
  204.  
  205. enum pipe_error
  206. SVGA3D_DestroyShader(struct svga_winsys_context *swc,
  207.                      uint32 shid, SVGA3dShaderType type);
  208.  
  209. enum pipe_error
  210. SVGA3D_SetShaderConst(struct svga_winsys_context *swc,
  211.                       uint32 reg, SVGA3dShaderType type,
  212.                       SVGA3dShaderConstType ctype, const void *value);
  213.  
  214. enum pipe_error
  215. SVGA3D_SetShaderConsts(struct svga_winsys_context *swc,
  216.                        uint32 reg,
  217.                        uint32 numRegs,
  218.                        SVGA3dShaderType type,
  219.                        SVGA3dShaderConstType ctype,
  220.                        const void *values);
  221.  
  222. enum pipe_error
  223. SVGA3D_SetShader(struct svga_winsys_context *swc,
  224.                  SVGA3dShaderType type, uint32 shid);
  225.  
  226.  
  227. /*
  228.  * Guest-backed surface functions
  229.  */
  230.  
  231. enum pipe_error
  232. SVGA3D_DefineGBShader(struct svga_winsys_context *swc,
  233.                       struct svga_winsys_gb_shader *gbshader,
  234.                       SVGA3dShaderType type,
  235.                       uint32 sizeInBytes);
  236.  
  237. enum pipe_error
  238. SVGA3D_BindGBShader(struct svga_winsys_context *swc,
  239.                     struct svga_winsys_gb_shader *gbshader);
  240.  
  241. enum pipe_error
  242. SVGA3D_SetGBShader(struct svga_winsys_context *swc,
  243.                    SVGA3dShaderType type,
  244.                    struct svga_winsys_gb_shader *gbshader);
  245.  
  246. enum pipe_error
  247. SVGA3D_DestroyGBShader(struct svga_winsys_context *swc,
  248.                        struct svga_winsys_gb_shader *gbshader);
  249.  
  250. enum pipe_error
  251. SVGA3D_BindGBSurface(struct svga_winsys_context *swc,
  252.                      struct svga_winsys_surface *surface);
  253.  
  254. enum pipe_error
  255. SVGA3D_DefineGBContext(struct svga_winsys_context *swc);
  256.  
  257. enum pipe_error
  258. SVGA3D_DestroyGBContext(struct svga_winsys_context *swc);
  259.  
  260. enum pipe_error
  261. SVGA3D_BindGBContext(struct svga_winsys_context *swc);
  262.  
  263. enum pipe_error
  264. SVGA3D_InvalidateGBContext(struct svga_winsys_context *swc);
  265.  
  266. enum pipe_error
  267. SVGA3D_UpdateGBImage(struct svga_winsys_context *swc,
  268.                      struct svga_winsys_surface *surface,
  269.                      const SVGA3dBox *box,
  270.                      unsigned face, unsigned mipLevel);
  271.  
  272. enum pipe_error
  273. SVGA3D_UpdateGBSurface(struct svga_winsys_context *swc,
  274.                        struct svga_winsys_surface *surface);
  275.  
  276.  
  277. enum pipe_error
  278. SVGA3D_ReadbackGBImage(struct svga_winsys_context *swc,
  279.                        struct svga_winsys_surface *surface,
  280.                        unsigned face, unsigned mipLevel);
  281.  
  282.  
  283. enum pipe_error
  284. SVGA3D_ReadbackGBSurface(struct svga_winsys_context *swc,
  285.                          struct svga_winsys_surface *surface);
  286.  
  287.  
  288. enum pipe_error
  289. SVGA3D_ReadbackGBImagePartial(struct svga_winsys_context *swc,
  290.                               struct svga_winsys_surface *surface,
  291.                               unsigned face, unsigned mipLevel,
  292.                               const SVGA3dBox *box,
  293.                               bool invertBox);
  294.  
  295.  
  296. enum pipe_error
  297. SVGA3D_InvalidateGBImagePartial(struct svga_winsys_context *swc,
  298.                                 struct svga_winsys_surface *surface,
  299.                                 unsigned face, unsigned mipLevel,
  300.                                 const SVGA3dBox *box,
  301.                                 bool invertBox);
  302.  
  303.  
  304. enum pipe_error
  305. SVGA3D_SetGBShaderConstsInline(struct svga_winsys_context *swc,
  306.                                unsigned regStart,
  307.                                unsigned numRegs,
  308.                                SVGA3dShaderType shaderType,
  309.                                SVGA3dShaderConstType constType,
  310.                                const void *values);
  311.  
  312. /*
  313.  * Queries
  314.  */
  315.  
  316. enum pipe_error
  317. SVGA3D_BeginQuery(struct svga_winsys_context *swc,
  318.                   SVGA3dQueryType type);
  319.  
  320. enum pipe_error
  321. SVGA3D_EndQuery(struct svga_winsys_context *swc,
  322.                 SVGA3dQueryType type,
  323.                 struct svga_winsys_buffer *buffer);
  324.  
  325. enum pipe_error
  326. SVGA3D_WaitForQuery(struct svga_winsys_context *swc,
  327.                     SVGA3dQueryType type,
  328.                     struct svga_winsys_buffer *buffer);
  329.  
  330. #endif /* __SVGA3D_H__ */
  331.