gfxstream: guest: use MESA_SCOPE_TRACE
- One less dependency on guest/android-emu/ - MESA_SCOPE_TRACE works on Linux guests or via Kumquat too, for better performance analysis Reviewed-by: Aaron Ruby <aruby@blackberry.com> Acked-by: Yonggang Luo <luoyonggang@gmail.com> Acked-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27246>
This commit is contained in:

committed by
Marge Bot

parent
a194a09444
commit
7da4dc42ca
@@ -518,7 +518,7 @@ class VulkanFuncTable(VulkanWrapperGenerator):
|
||||
cgen.stmt("return %s" % api.getRetVarExpr())
|
||||
|
||||
def genGfxstreamEntry(declareResources=True):
|
||||
cgen.stmt("AEMU_SCOPED_TRACE(\"%s\")" % api.name)
|
||||
cgen.stmt("MESA_TRACE_SCOPE(\"%s\")" % api.name)
|
||||
# declare returnVar
|
||||
retTypeName = api.getRetTypeExpr()
|
||||
retVar = api.getRetVarExpr()
|
||||
|
@@ -15,11 +15,12 @@
|
||||
#include "ResourceTracker.h"
|
||||
#include "VkEncoder.h"
|
||||
#include "gfxstream_vk_private.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
VkResult gfxstream_vk_CreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkCommandPool* pCommandPool) {
|
||||
AEMU_SCOPED_TRACE("vkCreateCommandPool");
|
||||
MESA_TRACE_SCOPE("vkCreateCommandPool");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
VkResult result = (VkResult)0;
|
||||
struct gfxstream_vk_command_pool* gfxstream_pCommandPool =
|
||||
@@ -43,7 +44,7 @@ VkResult gfxstream_vk_CreateCommandPool(VkDevice device, const VkCommandPoolCrea
|
||||
|
||||
void gfxstream_vk_DestroyCommandPool(VkDevice device, VkCommandPool commandPool,
|
||||
const VkAllocationCallbacks* pAllocator) {
|
||||
AEMU_SCOPED_TRACE("vkDestroyCommandPool");
|
||||
MESA_TRACE_SCOPE("vkDestroyCommandPool");
|
||||
if (VK_NULL_HANDLE == commandPool) {
|
||||
return;
|
||||
}
|
||||
@@ -61,7 +62,7 @@ void gfxstream_vk_DestroyCommandPool(VkDevice device, VkCommandPool commandPool,
|
||||
|
||||
VkResult gfxstream_vk_ResetCommandPool(VkDevice device, VkCommandPool commandPool,
|
||||
VkCommandPoolResetFlags flags) {
|
||||
AEMU_SCOPED_TRACE("vkResetCommandPool");
|
||||
MESA_TRACE_SCOPE("vkResetCommandPool");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
VK_FROM_HANDLE(gfxstream_vk_command_pool, gfxstream_commandPool, commandPool);
|
||||
VkResult vkResetCommandPool_VkResult_return = (VkResult)0;
|
||||
@@ -121,7 +122,7 @@ void vk_command_buffer_destroyOp(struct vk_command_buffer* commandBuffer) {
|
||||
VkResult gfxstream_vk_AllocateCommandBuffers(VkDevice device,
|
||||
const VkCommandBufferAllocateInfo* pAllocateInfo,
|
||||
VkCommandBuffer* pCommandBuffers) {
|
||||
AEMU_SCOPED_TRACE("vkAllocateCommandBuffers");
|
||||
MESA_TRACE_SCOPE("vkAllocateCommandBuffers");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
VK_FROM_HANDLE(gfxstream_vk_command_pool, gfxstream_commandPool, pAllocateInfo->commandPool);
|
||||
VkResult result = (VkResult)0;
|
||||
@@ -165,7 +166,7 @@ VkResult gfxstream_vk_AllocateCommandBuffers(VkDevice device,
|
||||
void gfxstream_vk_FreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
|
||||
uint32_t commandBufferCount,
|
||||
const VkCommandBuffer* pCommandBuffers) {
|
||||
AEMU_SCOPED_TRACE("vkFreeCommandBuffers");
|
||||
MESA_TRACE_SCOPE("vkFreeCommandBuffers");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
VK_FROM_HANDLE(gfxstream_vk_command_pool, gfxstream_commandPool, commandPool);
|
||||
{
|
||||
@@ -192,7 +193,7 @@ void gfxstream_vk_CmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer,
|
||||
uint32_t counterBufferCount,
|
||||
const VkBuffer* pCounterBuffers,
|
||||
const VkDeviceSize* pCounterBufferOffsets) {
|
||||
AEMU_SCOPED_TRACE("vkCmdBeginTransformFeedbackEXT");
|
||||
MESA_TRACE_SCOPE("vkCmdBeginTransformFeedbackEXT");
|
||||
VK_FROM_HANDLE(gfxstream_vk_command_buffer, gfxstream_commandBuffer, commandBuffer);
|
||||
auto vkEnc = gfxstream::vk::ResourceTracker::getCommandBufferEncoder(
|
||||
gfxstream_commandBuffer->internal_object);
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "VkEncoder.h"
|
||||
#include "gfxstream_vk_entrypoints.h"
|
||||
#include "gfxstream_vk_private.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
#include "vk_alloc.h"
|
||||
#include "vk_device.h"
|
||||
#include "vk_instance.h"
|
||||
@@ -302,7 +303,7 @@ static struct vk_instance_extension_table* get_instance_extensions() {
|
||||
VkResult gfxstream_vk_CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkInstance* pInstance) {
|
||||
AEMU_SCOPED_TRACE("vkCreateInstance");
|
||||
MESA_TRACE_SCOPE("vkCreateInstance");
|
||||
|
||||
struct gfxstream_vk_instance* instance;
|
||||
|
||||
@@ -366,7 +367,7 @@ VkResult gfxstream_vk_CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
|
||||
}
|
||||
|
||||
void gfxstream_vk_DestroyInstance(VkInstance _instance, const VkAllocationCallbacks* pAllocator) {
|
||||
AEMU_SCOPED_TRACE("vkDestroyInstance");
|
||||
MESA_TRACE_SCOPE("vkDestroyInstance");
|
||||
if (VK_NULL_HANDLE == _instance) return;
|
||||
|
||||
VK_FROM_HANDLE(gfxstream_vk_instance, instance, _instance);
|
||||
@@ -388,7 +389,7 @@ void gfxstream_vk_DestroyInstance(VkInstance _instance, const VkAllocationCallba
|
||||
VkResult gfxstream_vk_EnumerateInstanceExtensionProperties(const char* pLayerName,
|
||||
uint32_t* pPropertyCount,
|
||||
VkExtensionProperties* pProperties) {
|
||||
AEMU_SCOPED_TRACE("vkvkEnumerateInstanceExtensionProperties");
|
||||
MESA_TRACE_SCOPE("vkvkEnumerateInstanceExtensionProperties");
|
||||
(void)pLayerName;
|
||||
|
||||
return vk_enumerate_instance_extension_properties(get_instance_extensions(), pPropertyCount,
|
||||
@@ -399,7 +400,7 @@ VkResult gfxstream_vk_EnumerateDeviceExtensionProperties(VkPhysicalDevice physic
|
||||
const char* pLayerName,
|
||||
uint32_t* pPropertyCount,
|
||||
VkExtensionProperties* pProperties) {
|
||||
AEMU_SCOPED_TRACE("vkEnumerateDeviceExtensionProperties");
|
||||
MESA_TRACE_SCOPE("vkEnumerateDeviceExtensionProperties");
|
||||
(void)pLayerName;
|
||||
VK_FROM_HANDLE(vk_physical_device, pdevice, physicalDevice);
|
||||
|
||||
@@ -419,7 +420,7 @@ VkResult gfxstream_vk_EnumerateDeviceExtensionProperties(VkPhysicalDevice physic
|
||||
VkResult gfxstream_vk_CreateDevice(VkPhysicalDevice physicalDevice,
|
||||
const VkDeviceCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) {
|
||||
AEMU_SCOPED_TRACE("vkCreateDevice");
|
||||
MESA_TRACE_SCOPE("vkCreateDevice");
|
||||
VK_FROM_HANDLE(gfxstream_vk_physical_device, gfxstream_physicalDevice, physicalDevice);
|
||||
VkResult result = (VkResult)0;
|
||||
|
||||
@@ -516,7 +517,7 @@ VkResult gfxstream_vk_CreateDevice(VkPhysicalDevice physicalDevice,
|
||||
}
|
||||
|
||||
void gfxstream_vk_DestroyDevice(VkDevice device, const VkAllocationCallbacks* pAllocator) {
|
||||
AEMU_SCOPED_TRACE("vkDestroyDevice");
|
||||
MESA_TRACE_SCOPE("vkDestroyDevice");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
if (VK_NULL_HANDLE == device) return;
|
||||
|
||||
@@ -534,7 +535,7 @@ void gfxstream_vk_DestroyDevice(VkDevice device, const VkAllocationCallbacks* pA
|
||||
|
||||
void gfxstream_vk_GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex,
|
||||
VkQueue* pQueue) {
|
||||
AEMU_SCOPED_TRACE("vkGetDeviceQueue");
|
||||
MESA_TRACE_SCOPE("vkGetDeviceQueue");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
struct gfxstream_vk_queue* gfxstream_queue = (struct gfxstream_vk_queue*)vk_zalloc(
|
||||
&gfxstream_device->vk.alloc, sizeof(struct gfxstream_vk_queue), 8,
|
||||
@@ -566,7 +567,7 @@ void gfxstream_vk_GetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uin
|
||||
|
||||
void gfxstream_vk_GetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo,
|
||||
VkQueue* pQueue) {
|
||||
AEMU_SCOPED_TRACE("vkGetDeviceQueue2");
|
||||
MESA_TRACE_SCOPE("vkGetDeviceQueue2");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
struct gfxstream_vk_queue* gfxstream_queue = (struct gfxstream_vk_queue*)vk_zalloc(
|
||||
&gfxstream_device->vk.alloc, sizeof(struct gfxstream_vk_queue), 8,
|
||||
@@ -637,7 +638,7 @@ PFN_vkVoidFunction gfxstream_vk_GetInstanceProcAddr(VkInstance _instance, const
|
||||
}
|
||||
|
||||
PFN_vkVoidFunction gfxstream_vk_GetDeviceProcAddr(VkDevice _device, const char* pName) {
|
||||
AEMU_SCOPED_TRACE("vkGetDeviceProcAddr");
|
||||
MESA_TRACE_SCOPE("vkGetDeviceProcAddr");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, device, _device);
|
||||
return vk_device_get_proc_addr(&device->vk, pName);
|
||||
}
|
||||
@@ -645,7 +646,7 @@ PFN_vkVoidFunction gfxstream_vk_GetDeviceProcAddr(VkDevice _device, const char*
|
||||
VkResult gfxstream_vk_AllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkDeviceMemory* pMemory) {
|
||||
AEMU_SCOPED_TRACE("vkAllocateMemory");
|
||||
MESA_TRACE_SCOPE("vkAllocateMemory");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
VkResult vkAllocateMemory_VkResult_return = (VkResult)0;
|
||||
/* VkMemoryDedicatedAllocateInfo */
|
||||
@@ -670,7 +671,7 @@ VkResult gfxstream_vk_AllocateMemory(VkDevice device, const VkMemoryAllocateInfo
|
||||
|
||||
VkResult gfxstream_vk_EnumerateInstanceLayerProperties(uint32_t* pPropertyCount,
|
||||
VkLayerProperties* pProperties) {
|
||||
AEMU_SCOPED_TRACE("vkEnumerateInstanceLayerProperties");
|
||||
MESA_TRACE_SCOPE("vkEnumerateInstanceLayerProperties");
|
||||
auto result = SetupInstanceForProcess();
|
||||
if (VK_SUCCESS != result) {
|
||||
return vk_error(NULL, result);
|
||||
@@ -687,7 +688,7 @@ VkResult gfxstream_vk_EnumerateInstanceLayerProperties(uint32_t* pPropertyCount,
|
||||
}
|
||||
|
||||
VkResult gfxstream_vk_EnumerateInstanceVersion(uint32_t* pApiVersion) {
|
||||
AEMU_SCOPED_TRACE("vkEnumerateInstanceVersion");
|
||||
MESA_TRACE_SCOPE("vkEnumerateInstanceVersion");
|
||||
auto result = SetupInstanceForProcess();
|
||||
if (VK_SUCCESS != result) {
|
||||
return vk_error(NULL, result);
|
||||
@@ -737,7 +738,7 @@ void gfxstream_vk_UpdateDescriptorSets(VkDevice device, uint32_t descriptorWrite
|
||||
const VkWriteDescriptorSet* pDescriptorWrites,
|
||||
uint32_t descriptorCopyCount,
|
||||
const VkCopyDescriptorSet* pDescriptorCopies) {
|
||||
AEMU_SCOPED_TRACE("vkUpdateDescriptorSets");
|
||||
MESA_TRACE_SCOPE("vkUpdateDescriptorSets");
|
||||
VK_FROM_HANDLE(gfxstream_vk_device, gfxstream_device, device);
|
||||
{
|
||||
auto vkEnc = gfxstream::vk::ResourceTracker::getThreadLocalEncoder();
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "virtgpu_gfxstream_protocol.h"
|
||||
#include "vulkan/vk_enum_string_helper.h"
|
||||
#include "vulkan/vulkan_core.h"
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#include "vk_format_info.h"
|
||||
#endif
|
||||
@@ -5984,7 +5985,7 @@ void ResourceTracker::flushStagingStreams(void* context, VkQueue queue, uint32_t
|
||||
VkResult ResourceTracker::on_vkQueueSubmit(void* context, VkResult input_result, VkQueue queue,
|
||||
uint32_t submitCount, const VkSubmitInfo* pSubmits,
|
||||
VkFence fence) {
|
||||
AEMU_SCOPED_TRACE("on_vkQueueSubmit");
|
||||
MESA_TRACE_SCOPE("on_vkQueueSubmit");
|
||||
|
||||
/* From the Vulkan 1.3.204 spec:
|
||||
*
|
||||
@@ -6021,7 +6022,7 @@ VkResult ResourceTracker::on_vkQueueSubmit(void* context, VkResult input_result,
|
||||
VkResult ResourceTracker::on_vkQueueSubmit2(void* context, VkResult input_result, VkQueue queue,
|
||||
uint32_t submitCount, const VkSubmitInfo2* pSubmits,
|
||||
VkFence fence) {
|
||||
AEMU_SCOPED_TRACE("on_vkQueueSubmit2");
|
||||
MESA_TRACE_SCOPE("on_vkQueueSubmit2");
|
||||
return on_vkQueueSubmitTemplate<VkSubmitInfo2>(context, input_result, queue, submitCount,
|
||||
pSubmits, fence);
|
||||
}
|
||||
@@ -6181,7 +6182,7 @@ VkResult ResourceTracker::on_vkQueueSubmitTemplate(void* context, VkResult input
|
||||
auto vkEncoder = ResourceTracker::threadingCallbacks.vkEncoderGetFunc(hostConn);
|
||||
auto waitIdleRes = vkEncoder->vkQueueWaitIdle(queue, true /* do lock */);
|
||||
#ifdef VK_USE_PLATFORM_FUCHSIA
|
||||
AEMU_SCOPED_TRACE("on_vkQueueSubmit::SignalSemaphores");
|
||||
MESA_TRACE_SCOPE("on_vkQueueSubmit::SignalSemaphores");
|
||||
(void)externalFenceFdToSignal;
|
||||
for (auto& [event, koid] : post_wait_events) {
|
||||
#ifndef FUCHSIA_NO_TRACE
|
||||
@@ -6286,7 +6287,7 @@ void ResourceTracker::unwrap_vkAcquireImageANDROID_nativeFenceFd(int fd, int* fd
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
(void)fd_out;
|
||||
if (fd != -1) {
|
||||
AEMU_SCOPED_TRACE("waitNativeFenceInAcquire");
|
||||
MESA_TRACE_SCOPE("waitNativeFenceInAcquire");
|
||||
// Implicit Synchronization
|
||||
auto* syncHelper =
|
||||
ResourceTracker::threadingCallbacks.hostConnectionGetFunc()->syncHelper();
|
||||
|
@@ -29,9 +29,9 @@
|
||||
#include "VirtGpu.h"
|
||||
#include "VulkanHandleMapping.h"
|
||||
#include "VulkanHandles.h"
|
||||
#include "aemu/base/Tracing.h"
|
||||
#include "aemu/base/threads/AndroidWorkPool.h"
|
||||
#include "goldfish_vk_transform_guest.h"
|
||||
#include "util/perf/cpu_trace.h"
|
||||
|
||||
using gfxstream::guest::WorkPool;
|
||||
|
||||
|
Reference in New Issue
Block a user