14a49301eSmrg/**********************************************************
24a49301eSmrg * Copyright 2008-2009 VMware, Inc.  All rights reserved.
34a49301eSmrg *
44a49301eSmrg * Permission is hereby granted, free of charge, to any person
54a49301eSmrg * obtaining a copy of this software and associated documentation
64a49301eSmrg * files (the "Software"), to deal in the Software without
74a49301eSmrg * restriction, including without limitation the rights to use, copy,
84a49301eSmrg * modify, merge, publish, distribute, sublicense, and/or sell copies
94a49301eSmrg * of the Software, and to permit persons to whom the Software is
104a49301eSmrg * furnished to do so, subject to the following conditions:
114a49301eSmrg *
124a49301eSmrg * The above copyright notice and this permission notice shall be
134a49301eSmrg * included in all copies or substantial portions of the Software.
144a49301eSmrg *
154a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
164a49301eSmrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
174a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
184a49301eSmrg * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
194a49301eSmrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
204a49301eSmrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
214a49301eSmrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
224a49301eSmrg * SOFTWARE.
234a49301eSmrg *
244a49301eSmrg **********************************************************/
254a49301eSmrg
264a49301eSmrg/**
274a49301eSmrg * @file
284a49301eSmrg * VMware SVGA specific winsys interface.
2901e04c3fSmrg *
304a49301eSmrg * @author Jose Fonseca <jfonseca@vmware.com>
3101e04c3fSmrg *
324a49301eSmrg * Documentation taken from the VMware SVGA DDK.
334a49301eSmrg */
344a49301eSmrg
354a49301eSmrg#ifndef SVGA_WINSYS_H_
364a49301eSmrg#define SVGA_WINSYS_H_
374a49301eSmrg
384a49301eSmrg#include "svga_types.h"
3901e04c3fSmrg#include "svga3d_types.h"
404a49301eSmrg#include "svga_reg.h"
414a49301eSmrg#include "svga3d_reg.h"
424a49301eSmrg
434a49301eSmrg#include "pipe/p_compiler.h"
444a49301eSmrg#include "pipe/p_defines.h"
454a49301eSmrg
4601e04c3fSmrg#include "svga_mksstats.h"
474a49301eSmrg
484a49301eSmrgstruct svga_winsys_screen;
494a49301eSmrgstruct svga_winsys_buffer;
504a49301eSmrgstruct pipe_screen;
514a49301eSmrgstruct pipe_context;
5201e04c3fSmrgstruct pipe_debug_callback;
534a49301eSmrgstruct pipe_fence_handle;
543464ebd5Sriastradhstruct pipe_resource;
554a49301eSmrgstruct svga_region;
563464ebd5Sriastradhstruct winsys_handle;
574a49301eSmrg
584a49301eSmrg
593464ebd5Sriastradh#define SVGA_BUFFER_USAGE_PINNED  (1 << 0)
603464ebd5Sriastradh#define SVGA_BUFFER_USAGE_WRAPPED (1 << 1)
61af69d88dSmrg#define SVGA_BUFFER_USAGE_SHADER  (1 << 2)
623464ebd5Sriastradh
63af69d88dSmrg/**
64af69d88dSmrg * Relocation flags to help with dirty tracking
65af69d88dSmrg * SVGA_RELOC_WRITE -   The command will cause a GPU write to this
66af69d88dSmrg *                      resource.
67af69d88dSmrg * SVGA_RELOC_READ -    The command will cause a GPU read from this
68af69d88dSmrg *                      resource.
69af69d88dSmrg * SVGA_RELOC_INTERNAL  The command will only transfer data internally
70af69d88dSmrg *                      within the resource, and optionally clear
71af69d88dSmrg *                      dirty bits
72af69d88dSmrg * SVGA_RELOC_DMA -     Only set for resource buffer DMA uploads for winsys
73af69d88dSmrg *                      implementations that want to track the amount
74af69d88dSmrg *                      of such data referenced in the command stream.
75af69d88dSmrg */
76af69d88dSmrg#define SVGA_RELOC_WRITE          (1 << 0)
77af69d88dSmrg#define SVGA_RELOC_READ           (1 << 1)
78af69d88dSmrg#define SVGA_RELOC_INTERNAL       (1 << 2)
79af69d88dSmrg#define SVGA_RELOC_DMA            (1 << 3)
803464ebd5Sriastradh
81af69d88dSmrg#define SVGA_FENCE_FLAG_EXEC      (1 << 0)
82af69d88dSmrg#define SVGA_FENCE_FLAG_QUERY     (1 << 1)
834a49301eSmrg
847ec681f3Smrg#define SVGA_SURFACE_USAGE_SHARED   (1 << 0)
857ec681f3Smrg#define SVGA_SURFACE_USAGE_SCANOUT  (1 << 1)
867ec681f3Smrg#define SVGA_SURFACE_USAGE_COHERENT (1 << 2)
8701e04c3fSmrg
8801e04c3fSmrg#define SVGA_QUERY_FLAG_SET        (1 << 0)
8901e04c3fSmrg#define SVGA_QUERY_FLAG_REF        (1 << 1)
9001e04c3fSmrg
9101e04c3fSmrg#define SVGA_HINT_FLAG_CAN_PRE_FLUSH   (1 << 0)  /* Can preemptively flush */
9201e04c3fSmrg#define SVGA_HINT_FLAG_EXPORT_FENCE_FD (1 << 1)  /* Export a Fence FD */
9301e04c3fSmrg
9401e04c3fSmrg/**
9501e04c3fSmrg * SVGA mks statistics info
9601e04c3fSmrg */
9701e04c3fSmrgstruct svga_winsys_stats_timeframe {
9801e04c3fSmrg   void *counterTime;
9901e04c3fSmrg   uint64 startTime;
10001e04c3fSmrg   uint64 adjustedStartTime;
10101e04c3fSmrg   struct svga_winsys_stats_timeframe *enclosing;
1027ec681f3Smrg
1037ec681f3Smrg   struct svga_winsys_screen *sws;
1047ec681f3Smrg   int32 slot;
10501e04c3fSmrg};
10601e04c3fSmrg
10701e04c3fSmrgenum svga_stats_count {
10801e04c3fSmrg   SVGA_STATS_COUNT_BLENDSTATE,
10901e04c3fSmrg   SVGA_STATS_COUNT_BLITBLITTERCOPY,
11001e04c3fSmrg   SVGA_STATS_COUNT_DEPTHSTENCILSTATE,
11101e04c3fSmrg   SVGA_STATS_COUNT_RASTERIZERSTATE,
11201e04c3fSmrg   SVGA_STATS_COUNT_SAMPLER,
11301e04c3fSmrg   SVGA_STATS_COUNT_SAMPLERVIEW,
11401e04c3fSmrg   SVGA_STATS_COUNT_SURFACEWRITEFLUSH,
11501e04c3fSmrg   SVGA_STATS_COUNT_TEXREADBACK,
11601e04c3fSmrg   SVGA_STATS_COUNT_VERTEXELEMENT,
11701e04c3fSmrg   SVGA_STATS_COUNT_MAX
11801e04c3fSmrg};
11901e04c3fSmrg
12001e04c3fSmrgenum svga_stats_time {
12101e04c3fSmrg   SVGA_STATS_TIME_BLIT,
12201e04c3fSmrg   SVGA_STATS_TIME_BLITBLITTER,
12301e04c3fSmrg   SVGA_STATS_TIME_BLITFALLBACK,
12401e04c3fSmrg   SVGA_STATS_TIME_BUFFERSFLUSH,
12501e04c3fSmrg   SVGA_STATS_TIME_BUFFERTRANSFERMAP,
12601e04c3fSmrg   SVGA_STATS_TIME_BUFFERTRANSFERUNMAP,
12701e04c3fSmrg   SVGA_STATS_TIME_CONTEXTFINISH,
12801e04c3fSmrg   SVGA_STATS_TIME_CONTEXTFLUSH,
12901e04c3fSmrg   SVGA_STATS_TIME_COPYREGION,
13001e04c3fSmrg   SVGA_STATS_TIME_COPYREGIONFALLBACK,
13101e04c3fSmrg   SVGA_STATS_TIME_CREATEBACKEDSURFACEVIEW,
13201e04c3fSmrg   SVGA_STATS_TIME_CREATEBUFFER,
13301e04c3fSmrg   SVGA_STATS_TIME_CREATECONTEXT,
13401e04c3fSmrg   SVGA_STATS_TIME_CREATEFS,
13501e04c3fSmrg   SVGA_STATS_TIME_CREATEGS,
13601e04c3fSmrg   SVGA_STATS_TIME_CREATESURFACE,
13701e04c3fSmrg   SVGA_STATS_TIME_CREATESURFACEVIEW,
1387ec681f3Smrg   SVGA_STATS_TIME_CREATETCS,
1397ec681f3Smrg   SVGA_STATS_TIME_CREATETES,
14001e04c3fSmrg   SVGA_STATS_TIME_CREATETEXTURE,
14101e04c3fSmrg   SVGA_STATS_TIME_CREATEVS,
14201e04c3fSmrg   SVGA_STATS_TIME_DEFINESHADER,
14301e04c3fSmrg   SVGA_STATS_TIME_DESTROYSURFACE,
14401e04c3fSmrg   SVGA_STATS_TIME_DRAWVBO,
14501e04c3fSmrg   SVGA_STATS_TIME_DRAWARRAYS,
14601e04c3fSmrg   SVGA_STATS_TIME_DRAWELEMENTS,
14701e04c3fSmrg   SVGA_STATS_TIME_EMITFS,
14801e04c3fSmrg   SVGA_STATS_TIME_EMITGS,
1497ec681f3Smrg   SVGA_STATS_TIME_EMITTCS,
1507ec681f3Smrg   SVGA_STATS_TIME_EMITTES,
15101e04c3fSmrg   SVGA_STATS_TIME_EMITVS,
15201e04c3fSmrg   SVGA_STATS_TIME_EMULATESURFACEVIEW,
15301e04c3fSmrg   SVGA_STATS_TIME_FENCEFINISH,
15401e04c3fSmrg   SVGA_STATS_TIME_GENERATEINDICES,
15501e04c3fSmrg   SVGA_STATS_TIME_HWTNLDRAWARRAYS,
15601e04c3fSmrg   SVGA_STATS_TIME_HWTNLDRAWELEMENTS,
15701e04c3fSmrg   SVGA_STATS_TIME_HWTNLFLUSH,
15801e04c3fSmrg   SVGA_STATS_TIME_HWTNLPRIM,
15901e04c3fSmrg   SVGA_STATS_TIME_PROPAGATESURFACE,
16001e04c3fSmrg   SVGA_STATS_TIME_SETSAMPLERVIEWS,
16101e04c3fSmrg   SVGA_STATS_TIME_SURFACEFLUSH,
16201e04c3fSmrg   SVGA_STATS_TIME_SWTNLDRAWVBO,
16301e04c3fSmrg   SVGA_STATS_TIME_SWTNLUPDATEDRAW,
16401e04c3fSmrg   SVGA_STATS_TIME_SWTNLUPDATEVDECL,
16501e04c3fSmrg   SVGA_STATS_TIME_TEXTRANSFERMAP,
16601e04c3fSmrg   SVGA_STATS_TIME_TEXTRANSFERUNMAP,
16701e04c3fSmrg   SVGA_STATS_TIME_TGSIVGPU10TRANSLATE,
16801e04c3fSmrg   SVGA_STATS_TIME_TGSIVGPU9TRANSLATE,
16901e04c3fSmrg   SVGA_STATS_TIME_UPDATESTATE,
17001e04c3fSmrg   SVGA_STATS_TIME_VALIDATESURFACEVIEW,
17101e04c3fSmrg   SVGA_STATS_TIME_VBUFDRAWARRAYS,
17201e04c3fSmrg   SVGA_STATS_TIME_VBUFDRAWELEMENTS,
17301e04c3fSmrg   SVGA_STATS_TIME_VBUFRENDERALLOCVERT,
17401e04c3fSmrg   SVGA_STATS_TIME_VBUFRENDERMAPVERT,
17501e04c3fSmrg   SVGA_STATS_TIME_VBUFRENDERUNMAPVERT,
17601e04c3fSmrg   SVGA_STATS_TIME_VBUFSUBMITSTATE,
17701e04c3fSmrg   SVGA_STATS_TIME_MAX
17801e04c3fSmrg};
17901e04c3fSmrg
18001e04c3fSmrg#define SVGA_STATS_PREFIX "GuestGL_"
18101e04c3fSmrg
18201e04c3fSmrg#define SVGA_STATS_COUNT_NAMES                \
18301e04c3fSmrg   SVGA_STATS_PREFIX "BlendState",            \
18401e04c3fSmrg   SVGA_STATS_PREFIX "BlitBlitterCopy",       \
18501e04c3fSmrg   SVGA_STATS_PREFIX "DepthStencilState",     \
18601e04c3fSmrg   SVGA_STATS_PREFIX "RasterizerState",       \
18701e04c3fSmrg   SVGA_STATS_PREFIX "Sampler",               \
18801e04c3fSmrg   SVGA_STATS_PREFIX "SamplerView",           \
18901e04c3fSmrg   SVGA_STATS_PREFIX "SurfaceWriteFlush",     \
19001e04c3fSmrg   SVGA_STATS_PREFIX "TextureReadback",       \
19101e04c3fSmrg   SVGA_STATS_PREFIX "VertexElement"          \
19201e04c3fSmrg
19301e04c3fSmrg#define SVGA_STATS_TIME_NAMES                       \
19401e04c3fSmrg   SVGA_STATS_PREFIX "Blit",                        \
19501e04c3fSmrg   SVGA_STATS_PREFIX "BlitBlitter",                 \
19601e04c3fSmrg   SVGA_STATS_PREFIX "BlitFallback",                \
19701e04c3fSmrg   SVGA_STATS_PREFIX "BuffersFlush",                \
19801e04c3fSmrg   SVGA_STATS_PREFIX "BufferTransferMap",           \
19901e04c3fSmrg   SVGA_STATS_PREFIX "BufferTransferUnmap",         \
20001e04c3fSmrg   SVGA_STATS_PREFIX "ContextFinish",               \
20101e04c3fSmrg   SVGA_STATS_PREFIX "ContextFlush",                \
20201e04c3fSmrg   SVGA_STATS_PREFIX "CopyRegion",                  \
20301e04c3fSmrg   SVGA_STATS_PREFIX "CopyRegionFallback",          \
20401e04c3fSmrg   SVGA_STATS_PREFIX "CreateBackedSurfaceView",     \
20501e04c3fSmrg   SVGA_STATS_PREFIX "CreateBuffer",                \
20601e04c3fSmrg   SVGA_STATS_PREFIX "CreateContext",               \
20701e04c3fSmrg   SVGA_STATS_PREFIX "CreateFS",                    \
20801e04c3fSmrg   SVGA_STATS_PREFIX "CreateGS",                    \
20901e04c3fSmrg   SVGA_STATS_PREFIX "CreateSurface",               \
21001e04c3fSmrg   SVGA_STATS_PREFIX "CreateSurfaceView",           \
2117ec681f3Smrg   SVGA_STATS_PREFIX "CreateTCS",                   \
2127ec681f3Smrg   SVGA_STATS_PREFIX "CreateTES",                   \
21301e04c3fSmrg   SVGA_STATS_PREFIX "CreateTexture",               \
21401e04c3fSmrg   SVGA_STATS_PREFIX "CreateVS",                    \
21501e04c3fSmrg   SVGA_STATS_PREFIX "DefineShader",                \
21601e04c3fSmrg   SVGA_STATS_PREFIX "DestroySurface",              \
21701e04c3fSmrg   SVGA_STATS_PREFIX "DrawVBO",                     \
21801e04c3fSmrg   SVGA_STATS_PREFIX "DrawArrays",                  \
21901e04c3fSmrg   SVGA_STATS_PREFIX "DrawElements",                \
22001e04c3fSmrg   SVGA_STATS_PREFIX "EmitFS",                      \
22101e04c3fSmrg   SVGA_STATS_PREFIX "EmitGS",                      \
2227ec681f3Smrg   SVGA_STATS_PREFIX "EmitTCS",                     \
2237ec681f3Smrg   SVGA_STATS_PREFIX "EmitTES",                     \
22401e04c3fSmrg   SVGA_STATS_PREFIX "EmitVS",                      \
22501e04c3fSmrg   SVGA_STATS_PREFIX "EmulateSurfaceView",          \
22601e04c3fSmrg   SVGA_STATS_PREFIX "FenceFinish",                 \
22701e04c3fSmrg   SVGA_STATS_PREFIX "GenerateIndices",             \
22801e04c3fSmrg   SVGA_STATS_PREFIX "HWtnlDrawArrays",             \
22901e04c3fSmrg   SVGA_STATS_PREFIX "HWtnlDrawElements",           \
23001e04c3fSmrg   SVGA_STATS_PREFIX "HWtnlFlush",                  \
23101e04c3fSmrg   SVGA_STATS_PREFIX "HWtnlPrim",                   \
23201e04c3fSmrg   SVGA_STATS_PREFIX "PropagateSurface",            \
23301e04c3fSmrg   SVGA_STATS_PREFIX "SetSamplerViews",             \
23401e04c3fSmrg   SVGA_STATS_PREFIX "SurfaceFlush",                \
23501e04c3fSmrg   SVGA_STATS_PREFIX "SwtnlDrawVBO",                \
23601e04c3fSmrg   SVGA_STATS_PREFIX "SwtnlUpdateDraw",             \
23701e04c3fSmrg   SVGA_STATS_PREFIX "SwtnlUpdateVDecl",            \
23801e04c3fSmrg   SVGA_STATS_PREFIX "TextureTransferMap",          \
23901e04c3fSmrg   SVGA_STATS_PREFIX "TextureTransferUnmap",        \
24001e04c3fSmrg   SVGA_STATS_PREFIX "TGSIVGPU10Translate",         \
24101e04c3fSmrg   SVGA_STATS_PREFIX "TGSIVGPU9Translate",          \
24201e04c3fSmrg   SVGA_STATS_PREFIX "UpdateState",                 \
24301e04c3fSmrg   SVGA_STATS_PREFIX "ValidateSurfaceView",         \
24401e04c3fSmrg   SVGA_STATS_PREFIX "VbufDrawArrays",              \
24501e04c3fSmrg   SVGA_STATS_PREFIX "VbufDrawElements",            \
24601e04c3fSmrg   SVGA_STATS_PREFIX "VbufRenderAllocVertices",     \
24701e04c3fSmrg   SVGA_STATS_PREFIX "VbufRenderMapVertices",       \
24801e04c3fSmrg   SVGA_STATS_PREFIX "VbufRenderUnmapVertices",     \
24901e04c3fSmrg   SVGA_STATS_PREFIX "VbufSubmitState"
25001e04c3fSmrg
2514a49301eSmrg
2524a49301eSmrg/** Opaque surface handle */
2534a49301eSmrgstruct svga_winsys_surface;
2544a49301eSmrg
255af69d88dSmrg/** Opaque guest-backed objects */
256af69d88dSmrgstruct svga_winsys_gb_shader;
25701e04c3fSmrgstruct svga_winsys_gb_query;
2584a49301eSmrg
2594a49301eSmrg
2604a49301eSmrg/**
2614a49301eSmrg * SVGA per-context winsys interface.
2624a49301eSmrg */
2634a49301eSmrgstruct svga_winsys_context
2644a49301eSmrg{
2654a49301eSmrg   void
2664a49301eSmrg   (*destroy)(struct svga_winsys_context *swc);
2674a49301eSmrg
26801e04c3fSmrg   void *
26901e04c3fSmrg   (*reserve)(struct svga_winsys_context *swc,
27001e04c3fSmrg              uint32_t nr_bytes, uint32_t nr_relocs );
27101e04c3fSmrg
27201e04c3fSmrg   /**
27301e04c3fSmrg    * Returns current size of command buffer, in bytes.
27401e04c3fSmrg    */
27501e04c3fSmrg   unsigned
27601e04c3fSmrg   (*get_command_buffer_size)(struct svga_winsys_context *swc);
27701e04c3fSmrg
2784a49301eSmrg   /**
2794a49301eSmrg    * Emit a relocation for a host surface.
28001e04c3fSmrg    *
2813464ebd5Sriastradh    * @param flags bitmask of SVGA_RELOC_* flags
28201e04c3fSmrg    *
2834a49301eSmrg    * NOTE: Order of this call does matter. It should be the same order
2844a49301eSmrg    * as relocations appear in the command buffer.
2854a49301eSmrg    */
2864a49301eSmrg   void
28701e04c3fSmrg   (*surface_relocation)(struct svga_winsys_context *swc,
28801e04c3fSmrg                         uint32 *sid,
289af69d88dSmrg                         uint32 *mobid,
29001e04c3fSmrg                         struct svga_winsys_surface *surface,
29101e04c3fSmrg                         unsigned flags);
29201e04c3fSmrg
2934a49301eSmrg   /**
2944a49301eSmrg    * Emit a relocation for a guest memory region.
29501e04c3fSmrg    *
2963464ebd5Sriastradh    * @param flags bitmask of SVGA_RELOC_* flags
29701e04c3fSmrg    *
2984a49301eSmrg    * NOTE: Order of this call does matter. It should be the same order
2994a49301eSmrg    * as relocations appear in the command buffer.
3004a49301eSmrg    */
3014a49301eSmrg   void
30201e04c3fSmrg   (*region_relocation)(struct svga_winsys_context *swc,
30301e04c3fSmrg                        struct SVGAGuestPtr *ptr,
30401e04c3fSmrg                        struct svga_winsys_buffer *buffer,
30501e04c3fSmrg                        uint32 offset,
3064a49301eSmrg                        unsigned flags);
3074a49301eSmrg
308af69d88dSmrg   /**
309af69d88dSmrg    * Emit a relocation for a guest-backed shader object.
31001e04c3fSmrg    *
311af69d88dSmrg    * NOTE: Order of this call does matter. It should be the same order
312af69d88dSmrg    * as relocations appear in the command buffer.
313af69d88dSmrg    */
314af69d88dSmrg   void
31501e04c3fSmrg   (*shader_relocation)(struct svga_winsys_context *swc,
31601e04c3fSmrg                        uint32 *shid,
31701e04c3fSmrg                        uint32 *mobid,
31801e04c3fSmrg                        uint32 *offset,
31901e04c3fSmrg                        struct svga_winsys_gb_shader *shader,
32001e04c3fSmrg                        unsigned flags);
321af69d88dSmrg
322af69d88dSmrg   /**
323af69d88dSmrg    * Emit a relocation for a guest-backed context.
32401e04c3fSmrg    *
325af69d88dSmrg    * NOTE: Order of this call does matter. It should be the same order
326af69d88dSmrg    * as relocations appear in the command buffer.
327af69d88dSmrg    */
328af69d88dSmrg   void
329af69d88dSmrg   (*context_relocation)(struct svga_winsys_context *swc, uint32 *cid);
330af69d88dSmrg
331af69d88dSmrg   /**
332af69d88dSmrg    * Emit a relocation for a guest Memory OBject.
333af69d88dSmrg    *
334af69d88dSmrg    * @param flags bitmask of SVGA_RELOC_* flags
335af69d88dSmrg    * @param offset_into_mob Buffer starts at this offset into the MOB.
336af69d88dSmrg    *
337af69d88dSmrg    * Note that not all commands accept an offset into the MOB and
338af69d88dSmrg    * those commands can't use suballocated buffer pools. To trap
339af69d88dSmrg    * errors from improper buffer pool usage, set the offset_into_mob
340af69d88dSmrg    * pointer to NULL.
341af69d88dSmrg    */
342af69d88dSmrg   void
343af69d88dSmrg   (*mob_relocation)(struct svga_winsys_context *swc,
34401e04c3fSmrg                     SVGAMobId *id,
34501e04c3fSmrg                     uint32 *offset_into_mob,
34601e04c3fSmrg                     struct svga_winsys_buffer *buffer,
34701e04c3fSmrg                     uint32 offset,
34801e04c3fSmrg                     unsigned flags);
34901e04c3fSmrg
35001e04c3fSmrg   /**
35101e04c3fSmrg    * Emit a relocation for a guest-backed query object.
35201e04c3fSmrg    *
35301e04c3fSmrg    * NOTE: Order of this call does matter. It should be the same order
35401e04c3fSmrg    * as relocations appear in the command buffer.
35501e04c3fSmrg    */
35601e04c3fSmrg   void
35701e04c3fSmrg   (*query_relocation)(struct svga_winsys_context *swc,
35801e04c3fSmrg                       SVGAMobId *id,
35901e04c3fSmrg                       struct svga_winsys_gb_query *query);
36001e04c3fSmrg
36101e04c3fSmrg   /**
36201e04c3fSmrg    * Bind queries to context.
36301e04c3fSmrg    * \param flags  exactly one of SVGA_QUERY_FLAG_SET/REF
36401e04c3fSmrg    */
36501e04c3fSmrg   enum pipe_error
36601e04c3fSmrg   (*query_bind)(struct svga_winsys_context *sws,
36701e04c3fSmrg                 struct svga_winsys_gb_query *query,
36801e04c3fSmrg                 unsigned flags);
369af69d88dSmrg
3704a49301eSmrg   void
3714a49301eSmrg   (*commit)(struct svga_winsys_context *swc);
37201e04c3fSmrg
3734a49301eSmrg   enum pipe_error
37401e04c3fSmrg   (*flush)(struct svga_winsys_context *swc,
37501e04c3fSmrg            struct pipe_fence_handle **pfence);
3764a49301eSmrg
37701e04c3fSmrg   /**
3784a49301eSmrg    * Context ID used to fill in the commands
37901e04c3fSmrg    *
3804a49301eSmrg    * Context IDs are arbitrary small non-negative integers,
3814a49301eSmrg    * global to the entire SVGA device.
3824a49301eSmrg    */
3834a49301eSmrg   uint32 cid;
384af69d88dSmrg
38501e04c3fSmrg   /**
38601e04c3fSmrg    * Flags to hint the current context state
38701e04c3fSmrg    */
38801e04c3fSmrg   uint32 hints;
38901e04c3fSmrg
39001e04c3fSmrg   /**
39101e04c3fSmrg    * File descriptor for imported fence
39201e04c3fSmrg    */
39301e04c3fSmrg   int32 imported_fence_fd;
39401e04c3fSmrg
395af69d88dSmrg   /**
396af69d88dSmrg    ** BEGIN new functions for guest-backed surfaces.
397af69d88dSmrg    **/
398af69d88dSmrg
399af69d88dSmrg   boolean have_gb_objects;
4007ec681f3Smrg   boolean force_coherent;
401af69d88dSmrg
402af69d88dSmrg   /**
403af69d88dSmrg    * Map a guest-backed surface.
4047ec681f3Smrg    * \param swc The winsys context
4057ec681f3Smrg    * \param surface The surface to map
4067ec681f3Smrg    * \param flags  bitmask of PIPE_MAP_x flags
4077ec681f3Smrg    * \param retry Whether to flush and retry the map
4087ec681f3Smrg    * \param rebind Whether to issue an immediate rebind and flush.
409af69d88dSmrg    *
410af69d88dSmrg    * The surface_map() member is allowed to fail due to a
411af69d88dSmrg    * shortage of command buffer space, if the
4127ec681f3Smrg    * PIPE_MAP_DISCARD_WHOLE_RESOURCE bit is set in flags.
413af69d88dSmrg    * In that case, the caller must flush the current command
414af69d88dSmrg    * buffer and reissue the map.
415af69d88dSmrg    */
416af69d88dSmrg   void *
417af69d88dSmrg   (*surface_map)(struct svga_winsys_context *swc,
418af69d88dSmrg                  struct svga_winsys_surface *surface,
4197ec681f3Smrg                  unsigned flags, boolean *retry,
4207ec681f3Smrg                  boolean *rebind);
421af69d88dSmrg
422af69d88dSmrg   /**
423af69d88dSmrg    * Unmap a guest-backed surface.
424af69d88dSmrg    * \param rebind  returns a flag indicating whether the caller should
425af69d88dSmrg    *                issue a SVGA3D_BindGBSurface() call.
426af69d88dSmrg    */
427af69d88dSmrg   void
428af69d88dSmrg   (*surface_unmap)(struct svga_winsys_context *swc,
429af69d88dSmrg                    struct svga_winsys_surface *surface,
430af69d88dSmrg                    boolean *rebind);
431af69d88dSmrg
43201e04c3fSmrg   /**
43301e04c3fSmrg    * Create and define a DX GB shader that resides in the device COTable.
43401e04c3fSmrg    * Caller of this function will issue the DXDefineShader command.
43501e04c3fSmrg    */
43601e04c3fSmrg   struct svga_winsys_gb_shader *
43701e04c3fSmrg   (*shader_create)(struct svga_winsys_context *swc,
43801e04c3fSmrg                    uint32 shaderId,
43901e04c3fSmrg                    SVGA3dShaderType shaderType,
44001e04c3fSmrg                    const uint32 *bytecode,
4417ec681f3Smrg                    uint32 bytecodeLen,
4427ec681f3Smrg                    const SVGA3dDXShaderSignatureHeader *sgnInfo,
4437ec681f3Smrg                    uint32 sgnLen);
44401e04c3fSmrg
44501e04c3fSmrg   /**
44601e04c3fSmrg    * Destroy a DX GB shader.
44701e04c3fSmrg    * This function will issue the DXDestroyShader command.
44801e04c3fSmrg    */
44901e04c3fSmrg   void
45001e04c3fSmrg   (*shader_destroy)(struct svga_winsys_context *swc,
45101e04c3fSmrg                     struct svga_winsys_gb_shader *shader);
45201e04c3fSmrg
45301e04c3fSmrg   /**
45401e04c3fSmrg    * Rebind a DX GB resource to a context.
45501e04c3fSmrg    * This is called to reference a DX GB resource in the command stream in
45601e04c3fSmrg    * order to page in the associated resource in case the memory has been
45701e04c3fSmrg    * paged out, and to fence it if necessary after command submission.
45801e04c3fSmrg    */
45901e04c3fSmrg   enum pipe_error
46001e04c3fSmrg   (*resource_rebind)(struct svga_winsys_context *swc,
46101e04c3fSmrg                      struct svga_winsys_surface *surface,
46201e04c3fSmrg                      struct svga_winsys_gb_shader *shader,
46301e04c3fSmrg                      unsigned flags);
46401e04c3fSmrg
4657ec681f3Smrg   /** To report perf/conformance/etc issues to the gallium frontend */
46601e04c3fSmrg   struct pipe_debug_callback *debug_callback;
46701e04c3fSmrg
46801e04c3fSmrg   /** The more recent command issued to command buffer */
46901e04c3fSmrg   SVGAFifo3dCmdId last_command;
47001e04c3fSmrg
47101e04c3fSmrg   /** For HUD queries */
47201e04c3fSmrg   uint64_t num_commands;
4737ec681f3Smrg   uint64_t num_command_buffers;
47401e04c3fSmrg   uint64_t num_draw_commands;
4757ec681f3Smrg   uint64_t num_shader_reloc;
4767ec681f3Smrg   uint64_t num_surf_reloc;
4777ec681f3Smrg
4787ec681f3Smrg   /* Whether we are in retry processing */
4797ec681f3Smrg   unsigned int in_retry;
4804a49301eSmrg};
4814a49301eSmrg
4824a49301eSmrg
4834a49301eSmrg/**
4844a49301eSmrg * SVGA per-screen winsys interface.
4854a49301eSmrg */
4864a49301eSmrgstruct svga_winsys_screen
4874a49301eSmrg{
4884a49301eSmrg   void
4894a49301eSmrg   (*destroy)(struct svga_winsys_screen *sws);
49001e04c3fSmrg
4913464ebd5Sriastradh   SVGA3dHardwareVersion
4923464ebd5Sriastradh   (*get_hw_version)(struct svga_winsys_screen *sws);
4933464ebd5Sriastradh
4944a49301eSmrg   boolean
4954a49301eSmrg   (*get_cap)(struct svga_winsys_screen *sws,
4964a49301eSmrg              SVGA3dDevCapIndex index,
4974a49301eSmrg              SVGA3dDevCapResult *result);
49801e04c3fSmrg
4994a49301eSmrg   /**
5004a49301eSmrg    * Create a new context.
5014a49301eSmrg    *
5024a49301eSmrg    * Context objects encapsulate all render state, and shader
5034a49301eSmrg    * objects are per-context.
5044a49301eSmrg    *
5054a49301eSmrg    * Surfaces are not per-context. The same surface can be shared
5064a49301eSmrg    * between multiple contexts, and surface operations can occur
5074a49301eSmrg    * without a context.
5084a49301eSmrg    */
5094a49301eSmrg   struct svga_winsys_context *
5104a49301eSmrg   (*context_create)(struct svga_winsys_screen *sws);
51101e04c3fSmrg
5124a49301eSmrg   /**
513af69d88dSmrg    * This creates a "surface" object in the SVGA3D device.
514af69d88dSmrg    *
515af69d88dSmrg    * \param sws Pointer to an svga_winsys_context
516af69d88dSmrg    * \param flags Device surface create flags
517af69d88dSmrg    * \param format Format Device surface format
518af69d88dSmrg    * \param usage Winsys usage: bitmask of SVGA_SURFACE_USAGE_x flags
519af69d88dSmrg    * \param size Surface size given in device format
52001e04c3fSmrg    * \param numLayers Number of layers of the surface (or cube faces)
521af69d88dSmrg    * \param numMipLevels Number of mipmap levels for each face
522af69d88dSmrg    *
523af69d88dSmrg    * Returns the surface ID (sid). Surfaces are generic
5244a49301eSmrg    * containers for host VRAM objects like textures, vertex
5254a49301eSmrg    * buffers, and depth/stencil buffers.
5264a49301eSmrg    *
5274a49301eSmrg    * Surfaces are hierarchial:
5284a49301eSmrg    *
5294a49301eSmrg    * - Surface may have multiple faces (for cube maps)
5304a49301eSmrg    *
5314a49301eSmrg    * - Each face has a list of mipmap levels
5324a49301eSmrg    *
5334a49301eSmrg    * - Each mipmap image may have multiple volume
53401e04c3fSmrg    *   slices for 3D image, or multiple 2D slices for texture array.
5354a49301eSmrg    *
5364a49301eSmrg    * - Each slice is a 2D array of 'blocks'
5374a49301eSmrg    *
5384a49301eSmrg    * - Each block may be one or more pixels.
5394a49301eSmrg    *   (Usually 1, more for DXT or YUV formats.)
5404a49301eSmrg    *
5414a49301eSmrg    * Surfaces are generic host VRAM objects. The SVGA3D device
5424a49301eSmrg    * may optimize surfaces according to the format they were
5434a49301eSmrg    * created with, but this format does not limit the ways in
5444a49301eSmrg    * which the surface may be used. For example, a depth surface
5454a49301eSmrg    * can be used as a texture, or a floating point image may
5464a49301eSmrg    * be used as a vertex buffer. Some surface usages may be
5474a49301eSmrg    * lower performance, due to software emulation, but any
5484a49301eSmrg    * usage should work with any surface.
5494a49301eSmrg    */
5504a49301eSmrg   struct svga_winsys_surface *
5514a49301eSmrg   (*surface_create)(struct svga_winsys_screen *sws,
55201e04c3fSmrg                     SVGA3dSurfaceAllFlags flags,
5534a49301eSmrg                     SVGA3dSurfaceFormat format,
554af69d88dSmrg                     unsigned usage,
5554a49301eSmrg                     SVGA3dSize size,
55601e04c3fSmrg                     uint32 numLayers,
55701e04c3fSmrg                     uint32 numMipLevels,
55801e04c3fSmrg                     unsigned sampleCount);
5594a49301eSmrg
5603464ebd5Sriastradh   /**
5613464ebd5Sriastradh    * Creates a surface from a winsys handle.
5623464ebd5Sriastradh    * Used to implement pipe_screen::resource_from_handle.
5633464ebd5Sriastradh    */
5643464ebd5Sriastradh   struct svga_winsys_surface *
5653464ebd5Sriastradh   (*surface_from_handle)(struct svga_winsys_screen *sws,
5663464ebd5Sriastradh                          struct winsys_handle *whandle,
5673464ebd5Sriastradh                          SVGA3dSurfaceFormat *format);
5683464ebd5Sriastradh
5693464ebd5Sriastradh   /**
5703464ebd5Sriastradh    * Get a winsys_handle from a surface.
5713464ebd5Sriastradh    * Used to implement pipe_screen::resource_get_handle.
5723464ebd5Sriastradh    */
5733464ebd5Sriastradh   boolean
5743464ebd5Sriastradh   (*surface_get_handle)(struct svga_winsys_screen *sws,
5753464ebd5Sriastradh                         struct svga_winsys_surface *surface,
5763464ebd5Sriastradh                         unsigned stride,
5773464ebd5Sriastradh                         struct winsys_handle *whandle);
5783464ebd5Sriastradh
5794a49301eSmrg   /**
5804a49301eSmrg    * Whether this surface is sitting in a validate list
5814a49301eSmrg    */
5824a49301eSmrg   boolean
5834a49301eSmrg   (*surface_is_flushed)(struct svga_winsys_screen *sws,
5844a49301eSmrg                         struct svga_winsys_surface *surface);
5854a49301eSmrg
5864a49301eSmrg   /**
5874a49301eSmrg    * Reference a SVGA3D surface object. This allows sharing of a
5884a49301eSmrg    * surface between different objects.
5894a49301eSmrg    */
59001e04c3fSmrg   void
5914a49301eSmrg   (*surface_reference)(struct svga_winsys_screen *sws,
59201e04c3fSmrg                        struct svga_winsys_surface **pdst,
59301e04c3fSmrg                        struct svga_winsys_surface *src);
5944a49301eSmrg
595af69d88dSmrg   /**
596af69d88dSmrg    * Check if a resource (texture, buffer) of the given size
597af69d88dSmrg    * and format can be created.
598af69d88dSmrg    * \Return TRUE if OK, FALSE if too large.
599af69d88dSmrg    */
600af69d88dSmrg   boolean
601af69d88dSmrg   (*surface_can_create)(struct svga_winsys_screen *sws,
602af69d88dSmrg                         SVGA3dSurfaceFormat format,
603af69d88dSmrg                         SVGA3dSize size,
60401e04c3fSmrg                         uint32 numLayers,
60501e04c3fSmrg                         uint32 numMipLevels,
60601e04c3fSmrg                         uint32 numSamples);
607af69d88dSmrg
6087ec681f3Smrg   void
6097ec681f3Smrg   (*surface_init)(struct svga_winsys_screen *sws,
6107ec681f3Smrg                   struct svga_winsys_surface *surface,
6117ec681f3Smrg                   unsigned surf_size, SVGA3dSurfaceAllFlags flags);
6127ec681f3Smrg
6134a49301eSmrg   /**
6144a49301eSmrg    * Buffer management. Buffer attributes are mostly fixed over its lifetime.
6154a49301eSmrg    *
6163464ebd5Sriastradh    * @param usage bitmask of SVGA_BUFFER_USAGE_* flags.
6174a49301eSmrg    *
6184a49301eSmrg    * alignment indicates the client's alignment requirements, eg for
6194a49301eSmrg    * SSE instructions.
6204a49301eSmrg    */
6214a49301eSmrg   struct svga_winsys_buffer *
62201e04c3fSmrg   (*buffer_create)( struct svga_winsys_screen *sws,
62301e04c3fSmrg                     unsigned alignment,
62401e04c3fSmrg                     unsigned usage,
62501e04c3fSmrg                     unsigned size );
6264a49301eSmrg
62701e04c3fSmrg   /**
6284a49301eSmrg    * Map the entire data store of a buffer object into the client's address.
6297ec681f3Smrg    * usage is a bitmask of PIPE_MAP_*
6304a49301eSmrg    */
6314a49301eSmrg   void *
63201e04c3fSmrg   (*buffer_map)( struct svga_winsys_screen *sws,
63301e04c3fSmrg                  struct svga_winsys_buffer *buf,
63401e04c3fSmrg                  unsigned usage );
63501e04c3fSmrg
63601e04c3fSmrg   void
63701e04c3fSmrg   (*buffer_unmap)( struct svga_winsys_screen *sws,
6384a49301eSmrg                    struct svga_winsys_buffer *buf );
6394a49301eSmrg
64001e04c3fSmrg   void
6414a49301eSmrg   (*buffer_destroy)( struct svga_winsys_screen *sws,
64201e04c3fSmrg                      struct svga_winsys_buffer *buf );
6434a49301eSmrg
6444a49301eSmrg
6454a49301eSmrg   /**
6464a49301eSmrg    * Reference a fence object.
6474a49301eSmrg    */
6484a49301eSmrg   void
6494a49301eSmrg   (*fence_reference)( struct svga_winsys_screen *sws,
6504a49301eSmrg                       struct pipe_fence_handle **pdst,
6514a49301eSmrg                       struct pipe_fence_handle *src );
6524a49301eSmrg
6534a49301eSmrg   /**
6544a49301eSmrg    * Checks whether the fence has been signalled.
6554a49301eSmrg    * \param flags  driver-specific meaning
6564a49301eSmrg    * \return zero on success.
6574a49301eSmrg    */
6584a49301eSmrg   int (*fence_signalled)( struct svga_winsys_screen *sws,
6594a49301eSmrg                           struct pipe_fence_handle *fence,
6604a49301eSmrg                           unsigned flag );
6614a49301eSmrg
6624a49301eSmrg   /**
6634a49301eSmrg    * Wait for the fence to finish.
66401e04c3fSmrg    * \param timeout in nanoseconds (may be PIPE_TIMEOUT_INFINITE).
66501e04c3fSmrg    *                0 to return immediately, if the API suports it.
6664a49301eSmrg    * \param flags  driver-specific meaning
6674a49301eSmrg    * \return zero on success.
6684a49301eSmrg    */
6694a49301eSmrg   int (*fence_finish)( struct svga_winsys_screen *sws,
6704a49301eSmrg                        struct pipe_fence_handle *fence,
67101e04c3fSmrg                        uint64_t timeout,
6724a49301eSmrg                        unsigned flag );
6734a49301eSmrg
67401e04c3fSmrg   /**
67501e04c3fSmrg    * Get the file descriptor associated with the fence
67601e04c3fSmrg    * \param duplicate duplicate the fd before returning it
67701e04c3fSmrg    * \return zero on success.
67801e04c3fSmrg    */
67901e04c3fSmrg   int (*fence_get_fd)( struct svga_winsys_screen *sws,
68001e04c3fSmrg                        struct pipe_fence_handle *fence,
68101e04c3fSmrg                        boolean duplicate );
68201e04c3fSmrg
68301e04c3fSmrg   /**
68401e04c3fSmrg    * Create a fence using the given file descriptor
68501e04c3fSmrg    * \return zero on success.
68601e04c3fSmrg    */
68701e04c3fSmrg   void (*fence_create_fd)( struct svga_winsys_screen *sws,
68801e04c3fSmrg                            struct pipe_fence_handle **fence,
68901e04c3fSmrg                            int32_t fd );
69001e04c3fSmrg
69101e04c3fSmrg   /**
69201e04c3fSmrg    * Accumulates fence FD from other devices into the current context
69301e04c3fSmrg    * \param context_fd FD the context will be waiting on
69401e04c3fSmrg    * \return zero on success
69501e04c3fSmrg    */
69601e04c3fSmrg   int (*fence_server_sync)( struct svga_winsys_screen *sws,
69701e04c3fSmrg                             int32_t *context_fd,
69801e04c3fSmrg                             struct pipe_fence_handle *fence );
699af69d88dSmrg
700af69d88dSmrg   /**
701af69d88dSmrg    ** BEGIN new functions for guest-backed surfaces.
702af69d88dSmrg    **/
703af69d88dSmrg
704af69d88dSmrg   /** Are guest-backed objects enabled? */
705af69d88dSmrg   bool have_gb_objects;
706af69d88dSmrg
707af69d88dSmrg   /** Can we do DMA with guest-backed objects enabled? */
708af69d88dSmrg   bool have_gb_dma;
709af69d88dSmrg
7107ec681f3Smrg   /** Do we support coherent surface memory? */
7117ec681f3Smrg   bool have_coherent;
712af69d88dSmrg   /**
713af69d88dSmrg    * Create and define a GB shader.
714af69d88dSmrg    */
715af69d88dSmrg   struct svga_winsys_gb_shader *
716af69d88dSmrg   (*shader_create)(struct svga_winsys_screen *sws,
71701e04c3fSmrg                    SVGA3dShaderType shaderType,
71801e04c3fSmrg                    const uint32 *bytecode,
71901e04c3fSmrg                    uint32 bytecodeLen);
720af69d88dSmrg
721af69d88dSmrg   /**
722af69d88dSmrg    * Destroy a GB shader. It's safe to call this function even
723af69d88dSmrg    * if the shader is referenced in a context's command stream.
724af69d88dSmrg    */
725af69d88dSmrg   void
726af69d88dSmrg   (*shader_destroy)(struct svga_winsys_screen *sws,
72701e04c3fSmrg                     struct svga_winsys_gb_shader *shader);
72801e04c3fSmrg
72901e04c3fSmrg   /**
73001e04c3fSmrg    * Create and define a GB query.
73101e04c3fSmrg    */
73201e04c3fSmrg   struct svga_winsys_gb_query *
73301e04c3fSmrg   (*query_create)(struct svga_winsys_screen *sws, uint32 len);
73401e04c3fSmrg
73501e04c3fSmrg   /**
73601e04c3fSmrg    * Destroy a GB query.
73701e04c3fSmrg    */
73801e04c3fSmrg   void
73901e04c3fSmrg   (*query_destroy)(struct svga_winsys_screen *sws,
74001e04c3fSmrg                    struct svga_winsys_gb_query *query);
74101e04c3fSmrg
74201e04c3fSmrg   /**
74301e04c3fSmrg    * Initialize the query state of the query that resides in the slot
74401e04c3fSmrg    * specified in offset
74501e04c3fSmrg    * \return zero on success.
74601e04c3fSmrg    */
74701e04c3fSmrg   int
74801e04c3fSmrg   (*query_init)(struct svga_winsys_screen *sws,
74901e04c3fSmrg                       struct svga_winsys_gb_query *query,
75001e04c3fSmrg                       unsigned offset,
75101e04c3fSmrg                       SVGA3dQueryState queryState);
75201e04c3fSmrg
75301e04c3fSmrg   /**
75401e04c3fSmrg    * Inquire for the query state and result of the query that resides
75501e04c3fSmrg    * in the slot specified in offset
75601e04c3fSmrg    */
75701e04c3fSmrg   void
75801e04c3fSmrg   (*query_get_result)(struct svga_winsys_screen *sws,
75901e04c3fSmrg                       struct svga_winsys_gb_query *query,
76001e04c3fSmrg                       unsigned offset,
76101e04c3fSmrg                       SVGA3dQueryState *queryState,
76201e04c3fSmrg                       void *result, uint32 resultLen);
76301e04c3fSmrg
76401e04c3fSmrg   /**
76501e04c3fSmrg    * Increment a statistic counter
76601e04c3fSmrg    */
76701e04c3fSmrg   void
7687ec681f3Smrg   (*stats_inc)(struct svga_winsys_screen *, enum svga_stats_count);
76901e04c3fSmrg
77001e04c3fSmrg   /**
77101e04c3fSmrg    * Push a time frame onto the stack
77201e04c3fSmrg    */
77301e04c3fSmrg   void
7747ec681f3Smrg   (*stats_time_push)(struct svga_winsys_screen *, enum svga_stats_time, struct svga_winsys_stats_timeframe *);
77501e04c3fSmrg
77601e04c3fSmrg   /**
77701e04c3fSmrg    * Pop a time frame.
77801e04c3fSmrg    */
77901e04c3fSmrg   void
7807ec681f3Smrg   (*stats_time_pop)(struct svga_winsys_screen *);
78101e04c3fSmrg
7829f464c52Smaya   /**
7839f464c52Smaya    * Send a host log message
7849f464c52Smaya    */
7859f464c52Smaya   void
7869f464c52Smaya   (*host_log)(struct svga_winsys_screen *sws, const char *message);
78701e04c3fSmrg
78801e04c3fSmrg   /** Have VGPU v10 hardware? */
78901e04c3fSmrg   boolean have_vgpu10;
79001e04c3fSmrg
79101e04c3fSmrg   /** Have SM4_1 hardware? */
79201e04c3fSmrg   boolean have_sm4_1;
79301e04c3fSmrg
7947ec681f3Smrg   /** Have SM5 hardware? */
7957ec681f3Smrg   boolean have_sm5;
7967ec681f3Smrg
7977ec681f3Smrg   /** To rebind resources at the beginning of a new command buffer */
79801e04c3fSmrg   boolean need_to_rebind_resources;
799af69d88dSmrg
80001e04c3fSmrg   boolean have_generate_mipmap_cmd;
80101e04c3fSmrg   boolean have_set_predication_cmd;
80201e04c3fSmrg   boolean have_transfer_from_buffer_cmd;
80301e04c3fSmrg   boolean have_fence_fd;
80401e04c3fSmrg   boolean have_intra_surface_copy;
8057ec681f3Smrg   boolean have_constant_buffer_offset_cmd;
8064a49301eSmrg};
8074a49301eSmrg
8084a49301eSmrg
8094a49301eSmrgstruct svga_winsys_screen *
8104a49301eSmrgsvga_winsys_screen(struct pipe_screen *screen);
8114a49301eSmrg
8123464ebd5Sriastradhstruct svga_winsys_context *
8133464ebd5Sriastradhsvga_winsys_context(struct pipe_context *context);
8143464ebd5Sriastradh
8153464ebd5Sriastradhstruct pipe_resource *
8164a49301eSmrgsvga_screen_buffer_wrap_surface(struct pipe_screen *screen,
81701e04c3fSmrg                                enum SVGA3dSurfaceFormat format,
81801e04c3fSmrg                                struct svga_winsys_surface *srf);
8194a49301eSmrg
8204a49301eSmrgstruct svga_winsys_surface *
8213464ebd5Sriastradhsvga_screen_buffer_get_winsys_surface(struct pipe_resource *buffer);
8224a49301eSmrg
8234a49301eSmrg#endif /* SVGA_WINSYS_H_ */
824