Commit cec1a9bb authored by Mark Janes's avatar Mark Janes
Browse files

anv: add hooks to call INTEL_MEASURE


Reviewed-by: Lionel Landwerlin's avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
Part-of: <mesa/mesa!7354>
parent 0b6209b9
......@@ -28,6 +28,7 @@
#include <fcntl.h>
#include "anv_private.h"
#include "anv_measure.h"
#include "vk_format_info.h"
#include "vk_util.h"
......@@ -282,6 +283,8 @@ static VkResult anv_create_cmd_buffer(
list_addtail(&cmd_buffer->pool_link, &pool->cmd_buffers);
anv_measure_init(cmd_buffer);
*pCommandBuffer = anv_cmd_buffer_to_handle(cmd_buffer);
return VK_SUCCESS;
......@@ -323,6 +326,8 @@ VkResult anv_AllocateCommandBuffers(
static void
anv_cmd_buffer_destroy(struct anv_cmd_buffer *cmd_buffer)
{
anv_measure_destroy(cmd_buffer);
list_del(&cmd_buffer->pool_link);
anv_cmd_buffer_fini_batch_bo_chain(cmd_buffer);
......@@ -373,6 +378,7 @@ anv_cmd_buffer_reset(struct anv_cmd_buffer *cmd_buffer)
anv_state_stream_init(&cmd_buffer->general_state_stream,
&cmd_buffer->device->general_state_pool, 16384);
anv_measure_reset(cmd_buffer);
return VK_SUCCESS;
}
......
......@@ -32,6 +32,7 @@
#include <xf86drm.h>
#include "anv_private.h"
#include "anv_measure.h"
#include "util/debug.h"
#include "util/build_id.h"
#include "util/disk_cache.h"
......@@ -377,8 +378,8 @@ anv_physical_device_try_create(struct anv_instance *instance,
}
struct anv_physical_device *device =
vk_alloc(&instance->vk.alloc, sizeof(*device), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
vk_zalloc(&instance->vk.alloc, sizeof(*device), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (device == NULL) {
result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
goto fail_fd;
......@@ -604,6 +605,8 @@ anv_physical_device_try_create(struct anv_instance *instance,
device->perf = anv_get_perf(&device->info, fd);
anv_measure_device_init(device);
anv_physical_device_get_supported_extensions(device,
&device->vk.supported_extensions);
......@@ -634,6 +637,7 @@ static void
anv_physical_device_destroy(struct anv_physical_device *device)
{
anv_finish_wsi(device);
anv_measure_device_destroy(device);
free(device->engine_info);
anv_physical_device_free_disk_cache(device);
ralloc_free(device->compiler);
......
......@@ -32,6 +32,7 @@
#include "util/os_file.h"
#include "anv_private.h"
#include "anv_measure.h"
#include "vk_util.h"
#include "genxml/gen7_pack.h"
......@@ -1269,6 +1270,7 @@ VkResult anv_QueueSubmit(
pSubmits[i].pCommandBuffers[j]);
assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY);
assert(!anv_batch_has_error(&cmd_buffer->batch));
anv_measure_submit(cmd_buffer);
/* Fence for this execbuf. NULL for all but the last one */
VkFence execbuf_fence =
......
......@@ -22,6 +22,7 @@
*/
#include "anv_private.h"
#include "anv_measure.h"
#include "wsi_common.h"
#include "vk_format_info.h"
#include "vk_util.h"
......@@ -280,6 +281,7 @@ VkResult anv_AcquireNextImage2KHR(
{
ANV_FROM_HANDLE(anv_device, device, _device);
anv_measure_acquire(device);
return wsi_common_acquire_next_image2(&device->physical->wsi_device,
_device, pAcquireInfo, pImageIndex);
}
......
......@@ -24,6 +24,7 @@
#include <assert.h>
#include "anv_private.h"
#include "anv_measure.h"
/* These are defined in anv_private.h and blorp_genX_exec.h */
#undef __gen_address_type
......@@ -34,7 +35,13 @@
#include "blorp/blorp_genX_exec.h"
static void blorp_measure_start(struct blorp_batch *_batch,
const struct blorp_params *params) { }
const struct blorp_params *params)
{
struct anv_cmd_buffer *cmd_buffer = _batch->driver_batch;
anv_measure_snapshot(cmd_buffer,
params->snapshot_type,
NULL, 0);
}
static void *
blorp_emit_dwords(struct blorp_batch *batch, unsigned n)
......
......@@ -25,6 +25,7 @@
#include <stdbool.h>
#include "anv_private.h"
#include "anv_measure.h"
#include "vk_format_info.h"
#include "vk_util.h"
#include "util/fast_idiv_by_const.h"
......@@ -1767,6 +1768,8 @@ genX(EndCommandBuffer)(
if (anv_batch_has_error(&cmd_buffer->batch))
return cmd_buffer->batch.status;
anv_measure_endcommandbuffer(cmd_buffer);
/* We want every command buffer to start with the PMA fix in a known state,
* so we disable it at the end of the command buffer.
*/
......@@ -3777,6 +3780,14 @@ void genX(CmdDraw)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
const uint32_t count = (vertexCount *
instanceCount *
(pipeline->use_primitive_replication ?
1 : anv_subpass_view_count(cmd_buffer->state.subpass)));
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw", count);
genX(cmd_buffer_flush_state)(cmd_buffer);
if (cmd_buffer->state.conditional_render_enabled)
......@@ -3828,6 +3839,15 @@ void genX(CmdDrawIndexed)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
const uint32_t count = (indexCount *
instanceCount *
(pipeline->use_primitive_replication ?
1 : anv_subpass_view_count(cmd_buffer->state.subpass)));
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw indexed",
count);
genX(cmd_buffer_flush_state)(cmd_buffer);
if (cmd_buffer->state.conditional_render_enabled)
......@@ -3893,6 +3913,11 @@ void genX(CmdDrawIndirectByteCountEXT)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_DRAW,
"draw indirect byte count",
instanceCount);
genX(cmd_buffer_flush_state)(cmd_buffer);
if (vs_prog_data->uses_firstvertex ||
......@@ -4658,6 +4683,13 @@ void genX(CmdDispatchBase)(
if (anv_batch_has_error(&cmd_buffer->batch))
return;
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_COMPUTE,
"compute",
groupCountX * groupCountY * groupCountZ *
prog_data->local_size[0] * prog_data->local_size[1] *
prog_data->local_size[2]);
if (prog_data->uses_num_work_groups) {
struct anv_state state =
anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, 12, 4);
......@@ -4710,6 +4742,11 @@ void genX(CmdDispatchIndirect)(
return;
#endif
anv_measure_snapshot(cmd_buffer,
INTEL_SNAPSHOT_COMPUTE,
"compute indirect",
0);
if (prog_data->uses_num_work_groups) {
cmd_buffer->state.compute.num_workgroups = addr;
......@@ -6085,6 +6122,8 @@ void genX(CmdBeginRenderPass)(
cmd_buffer->state.pass = pass;
cmd_buffer->state.render_area = pRenderPassBegin->renderArea;
anv_measure_beginrenderpass(cmd_buffer);
result = genX(cmd_buffer_setup_attachments)(cmd_buffer, pass,
framebuffer,
pRenderPassBegin);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment