anv: Disable VF statistics for blorp and SOL memcpy
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 16 Mar 2017 21:12:03 +0000 (14:12 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 17 Mar 2017 19:12:50 +0000 (12:12 -0700)
In order to get accurate statistics, we need to disable statistics for
blits, clears, and the surface state memcpy at the top of each secondary
command buffer.  There are two possible approaches to this:

 1) Disable before the blit/memcpy and re-enable afterwards

 2) Move emitting 3DSTATE_VF_STATISTICS from initialization and make it
    part of pipeline state and then just disabale statistics before
    blits and memcpy operations.

Emitting 3DSTATE_VF_STATISTICS should be fairly cheap so it doesn't
really matter which path we take.  We choose the second option as it's
more consistent with the way the rest of the statistics are enabled and
disabled.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/genX_blorp_exec.c
src/intel/vulkan/genX_gpu_memcpy.c
src/intel/vulkan/genX_pipeline.c
src/intel/vulkan/genX_state.c

index 86730e07defa01bf4aadcbbdeca16594faaf1a7c..6b46a1e10ad86e9bdab1e21af47055c0cbf38fa7 100644 (file)
@@ -173,6 +173,11 @@ genX(blorp_exec)(struct blorp_batch *batch,
     */
    genX(cmd_buffer_enable_pma_fix)(cmd_buffer, false);
 
+   /* Disable VF statistics */
+   blorp_emit(batch, GENX(3DSTATE_VF_STATISTICS), vf) {
+      vf.StatisticsEnable = false;
+   }
+
    blorp_exec(batch, params);
 
    cmd_buffer->state.vb_dirty = ~0;
index eb11c2f0874890fa4b4e6878617b5dc852304d35..3cbc7235cfc90b07768aa0b2d29316d3da70a0fd 100644 (file)
@@ -218,6 +218,10 @@ genX(cmd_buffer_gpu_memcpy)(struct anv_cmd_buffer *cmd_buffer,
    }
 #endif
 
+   anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_VF_STATISTICS), vf) {
+      vf.StatisticsEnable = false;
+   }
+
    anv_batch_emit(&cmd_buffer->batch, GENX(3DPRIMITIVE), prim) {
       prim.VertexAccessType         = SEQUENTIAL;
       prim.PrimitiveTopologyType    = _3DPRIM_POINTLIST;
index 9d884a05d162ef533bacfa911d7c3e6b5600e382..cfc7c06fa4cbaac5175f48f130651ad4081f2acc 100644 (file)
@@ -1569,6 +1569,14 @@ emit_3dstate_vf_topology(struct anv_pipeline *pipeline)
 }
 #endif
 
+static void
+emit_3dstate_vf_statistics(struct anv_pipeline *pipeline)
+{
+   anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VF_STATISTICS), vfs) {
+      vfs.StatisticsEnable = true;
+   }
+}
+
 static void
 compute_kill_pixel(struct anv_pipeline *pipeline,
                    const VkPipelineMultisampleStateCreateInfo *ms_info,
@@ -1675,6 +1683,7 @@ genX(graphics_pipeline_create)(
    emit_3dstate_ps_extra(pipeline, subpass);
    emit_3dstate_vf_topology(pipeline);
 #endif
+   emit_3dstate_vf_statistics(pipeline);
 
    *pPipeline = anv_pipeline_to_handle(pipeline);
 
index fd8f8ac9ce03937415ab46f0473d2352a1193d3f..bf1217bbcdcca8abc54d0ca84ae5bc349982a59a 100644 (file)
@@ -52,9 +52,6 @@ genX(init_device_state)(struct anv_device *device)
       ps.PipelineSelection = _3D;
    }
 
-   anv_batch_emit(&batch, GENX(3DSTATE_VF_STATISTICS), vfs)
-      vfs.StatisticsEnable = true;
-
    anv_batch_emit(&batch, GENX(3DSTATE_AA_LINE_PARAMETERS), aa);
 
    anv_batch_emit(&batch, GENX(3DSTATE_DRAWING_RECTANGLE), rect) {