Mesa (main): venus: add some trace points
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Dec 16 19:36:55 UTC 2021
Module: Mesa
Branch: main
Commit: 108881cbcc9c38f7c447bc401287cc27ae89e7ae
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=108881cbcc9c38f7c447bc401287cc27ae89e7ae
Author: Chia-I Wu <olvaffe at gmail.com>
Date: Mon May 17 10:25:52 2021 -0700
venus: add some trace points
Add trace points for
- vn_AcquireNextImage2KHR and vn_QueuePresentKHR
- vn_AcquireImageANDROID and vn_QueueSignalReleaseImageANDROID
- vn_BeginCommandBuffer and vn_EndCommandBuffer
- vn_*Wait*
- vn_Queue*
- vn_instance_wait_roundtrip
- shmem allocations and cache miss/skip
v2: fix cache miss/skip trace points (Ryan)
Signed-off-by: Chia-I Wu <olvaffe at gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei at chromium.org> (v1)
Reviewed-by: Ryan Neph <ryanneph at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14215>
---
src/virtio/vulkan/vn_android.c | 2 ++
src/virtio/vulkan/vn_command_buffer.c | 2 ++
src/virtio/vulkan/vn_cs.c | 1 +
src/virtio/vulkan/vn_device.c | 1 +
src/virtio/vulkan/vn_instance.c | 3 +++
src/virtio/vulkan/vn_queue.c | 5 +++++
src/virtio/vulkan/vn_renderer.h | 1 +
src/virtio/vulkan/vn_renderer_internal.c | 2 ++
src/virtio/vulkan/vn_renderer_util.c | 1 +
src/virtio/vulkan/vn_wsi.c | 2 ++
10 files changed, 20 insertions(+)
diff --git a/src/virtio/vulkan/vn_android.c b/src/virtio/vulkan/vn_android.c
index 2d847dc2117..6c3412cb22c 100644
--- a/src/virtio/vulkan/vn_android.c
+++ b/src/virtio/vulkan/vn_android.c
@@ -537,6 +537,7 @@ vn_AcquireImageANDROID(VkDevice device,
VkSemaphore semaphore,
VkFence fence)
{
+ VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
VkResult result = VK_SUCCESS;
@@ -626,6 +627,7 @@ vn_QueueSignalReleaseImageANDROID(VkQueue queue,
VkImage image,
int *pNativeFenceFd)
{
+ VN_TRACE_FUNC();
struct vn_queue *que = vn_queue_from_handle(queue);
struct vn_device *dev = que->device;
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
diff --git a/src/virtio/vulkan/vn_command_buffer.c b/src/virtio/vulkan/vn_command_buffer.c
index 5f90343e831..1933eb8da5f 100644
--- a/src/virtio/vulkan/vn_command_buffer.c
+++ b/src/virtio/vulkan/vn_command_buffer.c
@@ -623,6 +623,7 @@ VkResult
vn_BeginCommandBuffer(VkCommandBuffer commandBuffer,
const VkCommandBufferBeginInfo *pBeginInfo)
{
+ VN_TRACE_FUNC();
struct vn_command_buffer *cmd =
vn_command_buffer_from_handle(commandBuffer);
struct vn_instance *instance = cmd->device->instance;
@@ -703,6 +704,7 @@ vn_cmd_submit(struct vn_command_buffer *cmd)
VkResult
vn_EndCommandBuffer(VkCommandBuffer commandBuffer)
{
+ VN_TRACE_FUNC();
struct vn_command_buffer *cmd =
vn_command_buffer_from_handle(commandBuffer);
struct vn_instance *instance = cmd->device->instance;
diff --git a/src/virtio/vulkan/vn_cs.c b/src/virtio/vulkan/vn_cs.c
index 66e93aa74a1..d1c8a9baa6e 100644
--- a/src/virtio/vulkan/vn_cs.c
+++ b/src/virtio/vulkan/vn_cs.c
@@ -184,6 +184,7 @@ vn_cs_encoder_grow_buffer_array(struct vn_cs_encoder *enc)
bool
vn_cs_encoder_reserve_internal(struct vn_cs_encoder *enc, size_t size)
{
+ VN_TRACE_FUNC();
if (unlikely(enc->storage_type == VN_CS_ENCODER_STORAGE_POINTER))
return false;
diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c
index f1d9e0c3a1d..6c41ee97a03 100644
--- a/src/virtio/vulkan/vn_device.c
+++ b/src/virtio/vulkan/vn_device.c
@@ -420,6 +420,7 @@ vn_GetDeviceGroupPeerMemoryFeatures(
VkResult
vn_DeviceWaitIdle(VkDevice device)
{
+ VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
for (uint32_t i = 0; i < dev->queue_count; i++) {
diff --git a/src/virtio/vulkan/vn_instance.c b/src/virtio/vulkan/vn_instance.c
index bf27631cdde..47ed16d9d48 100644
--- a/src/virtio/vulkan/vn_instance.c
+++ b/src/virtio/vulkan/vn_instance.c
@@ -332,6 +332,7 @@ void
vn_instance_wait_roundtrip(struct vn_instance *instance,
uint32_t roundtrip_seqno)
{
+ VN_TRACE_FUNC();
const struct vn_ring *ring = &instance->ring.ring;
const volatile atomic_uint *ptr = ring->shared.extra;
uint32_t iter = 0;
@@ -478,6 +479,7 @@ static struct vn_cs_encoder *
vn_instance_ring_cs_upload_locked(struct vn_instance *instance,
const struct vn_cs_encoder *cs)
{
+ VN_TRACE_FUNC();
assert(cs->storage_type == VN_CS_ENCODER_STORAGE_POINTER &&
cs->buffer_count == 1);
const void *cs_data = cs->buffers[0].base;
@@ -554,6 +556,7 @@ vn_instance_get_reply_shmem_locked(struct vn_instance *instance,
size_t size,
void **out_ptr)
{
+ VN_TRACE_FUNC();
struct vn_renderer_shmem_pool *pool = &instance->reply_shmem_pool;
const struct vn_renderer_shmem *saved_pool_shmem = pool->shmem;
diff --git a/src/virtio/vulkan/vn_queue.c b/src/virtio/vulkan/vn_queue.c
index 062aa43d5e8..2f9930f1cbc 100644
--- a/src/virtio/vulkan/vn_queue.c
+++ b/src/virtio/vulkan/vn_queue.c
@@ -337,6 +337,7 @@ vn_QueueSubmit(VkQueue _queue,
const VkSubmitInfo *pSubmits,
VkFence fence)
{
+ VN_TRACE_FUNC();
struct vn_queue *queue = vn_queue_from_handle(_queue);
struct vn_device *dev = queue->device;
@@ -396,6 +397,7 @@ vn_QueueBindSparse(VkQueue _queue,
const VkBindSparseInfo *pBindInfo,
VkFence fence)
{
+ VN_TRACE_FUNC();
struct vn_queue *queue = vn_queue_from_handle(_queue);
struct vn_device *dev = queue->device;
@@ -421,6 +423,7 @@ vn_QueueBindSparse(VkQueue _queue,
VkResult
vn_QueueWaitIdle(VkQueue _queue)
{
+ VN_TRACE_FUNC();
struct vn_queue *queue = vn_queue_from_handle(_queue);
VkDevice device = vn_device_to_handle(queue->device);
@@ -632,6 +635,7 @@ vn_WaitForFences(VkDevice device,
VkBool32 waitAll,
uint64_t timeout)
{
+ VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
@@ -923,6 +927,7 @@ vn_WaitSemaphores(VkDevice device,
const VkSemaphoreWaitInfo *pWaitInfo,
uint64_t timeout)
{
+ VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
diff --git a/src/virtio/vulkan/vn_renderer.h b/src/virtio/vulkan/vn_renderer.h
index ea3cff5552e..c88d6c0f676 100644
--- a/src/virtio/vulkan/vn_renderer.h
+++ b/src/virtio/vulkan/vn_renderer.h
@@ -277,6 +277,7 @@ vn_renderer_wait(struct vn_renderer *renderer,
static inline struct vn_renderer_shmem *
vn_renderer_shmem_create(struct vn_renderer *renderer, size_t size)
{
+ VN_TRACE_FUNC();
struct vn_renderer_shmem *shmem =
renderer->shmem_ops.create(renderer, size);
if (shmem) {
diff --git a/src/virtio/vulkan/vn_renderer_internal.c b/src/virtio/vulkan/vn_renderer_internal.c
index 4e5027a905b..136126c4848 100644
--- a/src/virtio/vulkan/vn_renderer_internal.c
+++ b/src/virtio/vulkan/vn_renderer_internal.c
@@ -124,6 +124,7 @@ vn_renderer_shmem_cache_get(struct vn_renderer_shmem_cache *cache,
int idx;
struct vn_renderer_shmem_bucket *bucket = choose_bucket(cache, size, &idx);
if (!bucket) {
+ VN_TRACE_SCOPE("shmem cache skip");
simple_mtx_lock(&cache->mutex);
cache->debug.cache_skip_count++;
simple_mtx_unlock(&cache->mutex);
@@ -144,6 +145,7 @@ vn_renderer_shmem_cache_get(struct vn_renderer_shmem_cache *cache,
cache->debug.cache_hit_count++;
} else {
+ VN_TRACE_SCOPE("shmem cache miss");
cache->debug.cache_miss_count++;
}
simple_mtx_unlock(&cache->mutex);
diff --git a/src/virtio/vulkan/vn_renderer_util.c b/src/virtio/vulkan/vn_renderer_util.c
index 656c0c1bcf3..d2654b91f64 100644
--- a/src/virtio/vulkan/vn_renderer_util.c
+++ b/src/virtio/vulkan/vn_renderer_util.c
@@ -68,6 +68,7 @@ vn_renderer_shmem_pool_grow(struct vn_renderer *renderer,
struct vn_renderer_shmem_pool *pool,
size_t size)
{
+ VN_TRACE_FUNC();
/* power-of-two to hit shmem cache */
size_t alloc_size = pool->min_alloc_size;
while (alloc_size < size) {
diff --git a/src/virtio/vulkan/vn_wsi.c b/src/virtio/vulkan/vn_wsi.c
index 113b2d7b888..842154a7fe7 100644
--- a/src/virtio/vulkan/vn_wsi.c
+++ b/src/virtio/vulkan/vn_wsi.c
@@ -181,6 +181,7 @@ vn_DestroySwapchainKHR(VkDevice device,
VkResult
vn_QueuePresentKHR(VkQueue _queue, const VkPresentInfoKHR *pPresentInfo)
{
+ VN_TRACE_FUNC();
struct vn_queue *queue = vn_queue_from_handle(_queue);
VkResult result =
@@ -206,6 +207,7 @@ vn_AcquireNextImage2KHR(VkDevice device,
const VkAcquireNextImageInfoKHR *pAcquireInfo,
uint32_t *pImageIndex)
{
+ VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
VkResult result = wsi_common_acquire_next_image2(
More information about the mesa-commit
mailing list