summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_winsys.h
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2016-08-19 08:49:17 -0600
committerBrian Paul <[email protected]>2016-08-26 06:19:51 -0600
commit2e1cfcc431471c68ba79c9323716bed7da79c909 (patch)
tree79fbbe6fb5da05d1f6596eb4944bc94ab832ff6f /src/gallium/drivers/svga/svga_winsys.h
parent479199180871432030d3eebc2822bd7cb3dc6fd6 (diff)
svga: add guest statistic gathering interface
With this patch, guest statistic gathering interface is added to svga winsys interface that can be used to gather svga driver statistic. The winsys module can then share the statistic info with the VMX host via the mksstats interface. The statistic enums used in the svga driver are defined in svga_stats_count and svga_stats_time in svga_winsys.h Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_winsys.h')
-rw-r--r--src/gallium/drivers/svga/svga_winsys.h153
1 files changed, 153 insertions, 0 deletions
diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h
index 90e4f81da8d..5eb73087470 100644
--- a/src/gallium/drivers/svga/svga_winsys.h
+++ b/src/gallium/drivers/svga/svga_winsys.h
@@ -43,6 +43,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_defines.h"
+#include "svga_mksstats.h"
struct svga_winsys_screen;
struct svga_winsys_buffer;
@@ -88,6 +89,139 @@ struct winsys_handle;
#define SVGA_HINT_FLAG_CAN_PRE_FLUSH (1 << 0) /* Can preemptively flush */
+/**
+ * SVGA mks statistics info
+ */
+struct svga_winsys_stats_timeframe {
+ void *counterTime;
+ uint64 startTime;
+ uint64 adjustedStartTime;
+ struct svga_winsys_stats_timeframe *enclosing;
+};
+
+enum svga_stats_count {
+ SVGA_STATS_COUNT_BLENDSTATE,
+ SVGA_STATS_COUNT_DEPTHSTENCILSTATE,
+ SVGA_STATS_COUNT_RASTERIZERSTATE,
+ SVGA_STATS_COUNT_SAMPLER,
+ SVGA_STATS_COUNT_SAMPLERVIEW,
+ SVGA_STATS_COUNT_SURFACEWRITEFLUSH,
+ SVGA_STATS_COUNT_TEXREADBACK,
+ SVGA_STATS_COUNT_VERTEXELEMENT,
+ SVGA_STATS_COUNT_MAX
+};
+
+enum svga_stats_time {
+ SVGA_STATS_TIME_BUFFERSFLUSH,
+ SVGA_STATS_TIME_BUFFERTRANSFERMAP,
+ SVGA_STATS_TIME_BUFFERTRANSFERUNMAP,
+ SVGA_STATS_TIME_CONTEXTFINISH,
+ SVGA_STATS_TIME_CONTEXTFLUSH,
+ SVGA_STATS_TIME_CREATEBACKEDSURFACEVIEW,
+ SVGA_STATS_TIME_CREATEBUFFER,
+ SVGA_STATS_TIME_CREATECONTEXT,
+ SVGA_STATS_TIME_CREATEFS,
+ SVGA_STATS_TIME_CREATEGS,
+ SVGA_STATS_TIME_CREATESURFACE,
+ SVGA_STATS_TIME_CREATESURFACEVIEW,
+ SVGA_STATS_TIME_CREATETEXTURE,
+ SVGA_STATS_TIME_CREATEVS,
+ SVGA_STATS_TIME_DEFINESHADER,
+ SVGA_STATS_TIME_DESTROYSURFACE,
+ SVGA_STATS_TIME_DRAWVBO,
+ SVGA_STATS_TIME_DRAWARRAYS,
+ SVGA_STATS_TIME_DRAWELEMENTS,
+ SVGA_STATS_TIME_EMITFS,
+ SVGA_STATS_TIME_EMITGS,
+ SVGA_STATS_TIME_EMITVS,
+ SVGA_STATS_TIME_FENCEFINISH,
+ SVGA_STATS_TIME_GENERATEINDICES,
+ SVGA_STATS_TIME_HWTNLDRAWARRAYS,
+ SVGA_STATS_TIME_HWTNLDRAWELEMENTS,
+ SVGA_STATS_TIME_HWTNLFLUSH,
+ SVGA_STATS_TIME_HWTNLPRIM,
+ SVGA_STATS_TIME_PROPAGATESURFACE,
+ SVGA_STATS_TIME_SETSAMPLERVIEWS,
+ SVGA_STATS_TIME_SURFACEFLUSH,
+ SVGA_STATS_TIME_SWTNLDRAWVBO,
+ SVGA_STATS_TIME_SWTNLUPDATEDRAW,
+ SVGA_STATS_TIME_SWTNLUPDATEVDECL,
+ SVGA_STATS_TIME_TEXTRANSFERMAP,
+ SVGA_STATS_TIME_TEXTRANSFERUNMAP,
+ SVGA_STATS_TIME_TGSIVGPU10TRANSLATE,
+ SVGA_STATS_TIME_TGSIVGPU9TRANSLATE,
+ SVGA_STATS_TIME_UPDATESTATE,
+ SVGA_STATS_TIME_VALIDATESURFACEVIEW,
+ SVGA_STATS_TIME_VBUFDRAWARRAYS,
+ SVGA_STATS_TIME_VBUFDRAWELEMENTS,
+ SVGA_STATS_TIME_VBUFRENDERALLOCVERT,
+ SVGA_STATS_TIME_VBUFRENDERMAPVERT,
+ SVGA_STATS_TIME_VBUFRENDERUNMAPVERT,
+ SVGA_STATS_TIME_VBUFSUBMITSTATE,
+ SVGA_STATS_TIME_MAX
+};
+
+#define SVGA_STATS_PREFIX "GuestGL_"
+
+#define SVGA_STATS_COUNT_NAMES \
+ SVGA_STATS_PREFIX "BlendState", \
+ SVGA_STATS_PREFIX "DepthStencilState", \
+ SVGA_STATS_PREFIX "RasterizerState", \
+ SVGA_STATS_PREFIX "Sampler", \
+ SVGA_STATS_PREFIX "SamplerView", \
+ SVGA_STATS_PREFIX "TextureReadback", \
+ SVGA_STATS_PREFIX "SurfaceWriteFlush", \
+ SVGA_STATS_PREFIX "VertexElement" \
+
+#define SVGA_STATS_TIME_NAMES \
+ SVGA_STATS_PREFIX "BuffersFlush", \
+ SVGA_STATS_PREFIX "BufferTransferMap", \
+ SVGA_STATS_PREFIX "BufferTransferUnmap", \
+ SVGA_STATS_PREFIX "ContextFinish", \
+ SVGA_STATS_PREFIX "ContextFlush", \
+ SVGA_STATS_PREFIX "CreateBackedSurfaceView", \
+ SVGA_STATS_PREFIX "CreateBuffer", \
+ SVGA_STATS_PREFIX "CreateContext", \
+ SVGA_STATS_PREFIX "CreateFS", \
+ SVGA_STATS_PREFIX "CreateGS", \
+ SVGA_STATS_PREFIX "CreateSurface", \
+ SVGA_STATS_PREFIX "CreateSurfaceView", \
+ SVGA_STATS_PREFIX "CreateTexture", \
+ SVGA_STATS_PREFIX "CreateVS", \
+ SVGA_STATS_PREFIX "DefineShader", \
+ SVGA_STATS_PREFIX "DestroySurface", \
+ SVGA_STATS_PREFIX "DrawVBO", \
+ SVGA_STATS_PREFIX "DrawArrays", \
+ SVGA_STATS_PREFIX "DrawElements", \
+ SVGA_STATS_PREFIX "EmitFS", \
+ SVGA_STATS_PREFIX "EmitGS", \
+ SVGA_STATS_PREFIX "EmitVS", \
+ SVGA_STATS_PREFIX "FenceFinish", \
+ SVGA_STATS_PREFIX "GenerateIndices", \
+ SVGA_STATS_PREFIX "HWtnlDrawArrays", \
+ SVGA_STATS_PREFIX "HWtnlDrawElements", \
+ SVGA_STATS_PREFIX "HWtnlFlush", \
+ SVGA_STATS_PREFIX "HWtnlPrim", \
+ SVGA_STATS_PREFIX "PropagateSurface", \
+ SVGA_STATS_PREFIX "SetSamplerViews", \
+ SVGA_STATS_PREFIX "SurfaceFlush", \
+ SVGA_STATS_PREFIX "SwtnlDrawVBO", \
+ SVGA_STATS_PREFIX "SwtnlUpdateDraw", \
+ SVGA_STATS_PREFIX "SwtnlUpdateVDecl", \
+ SVGA_STATS_PREFIX "TextureTransferMap", \
+ SVGA_STATS_PREFIX "TextureTransferUnmap", \
+ SVGA_STATS_PREFIX "TGSIVGPU10Translate", \
+ SVGA_STATS_PREFIX "TGSIVGPU9Translate", \
+ SVGA_STATS_PREFIX "UpdateState", \
+ SVGA_STATS_PREFIX "ValidateSurfaceView", \
+ SVGA_STATS_PREFIX "VbufDrawArrays", \
+ SVGA_STATS_PREFIX "VbufDrawElements", \
+ SVGA_STATS_PREFIX "VbufRenderAllocVertices", \
+ SVGA_STATS_PREFIX "VbufRenderMapVertices", \
+ SVGA_STATS_PREFIX "VbufRenderUnmapVertices", \
+ SVGA_STATS_PREFIX "VbufSubmitState"
+
+
/** Opaque surface handle */
struct svga_winsys_surface;
@@ -547,6 +681,25 @@ struct svga_winsys_screen
SVGA3dQueryState *queryState,
void *result, uint32 resultLen);
+ /**
+ * Increment a statistic counter
+ */
+ void
+ (*stats_inc)(enum svga_stats_count);
+
+ /**
+ * Push a time frame onto the stack
+ */
+ void
+ (*stats_time_push)(enum svga_stats_time, struct svga_winsys_stats_timeframe *);
+
+ /**
+ * Pop a time frame.
+ */
+ void
+ (*stats_time_pop)();
+
+
/** Have VGPU v10 hardware? */
boolean have_vgpu10;