Snap for 13972532 from d4c765611b to 25Q4-release
Change-Id: I3a44bb3ef202b6b857a63525a67d9e3b2b87f334
This commit is contained in:
commit
d28630a384
9 changed files with 107 additions and 1 deletions
|
|
@ -791,6 +791,7 @@ custom_decodes = {
|
|||
"vkGetMemoryHostAddressInfoGOOGLE" : emit_global_state_wrapped_decoding,
|
||||
"vkGetBlobGOOGLE" : emit_global_state_wrapped_decoding,
|
||||
"vkGetSemaphoreGOOGLE" : emit_global_state_wrapped_decoding,
|
||||
"vkTraceAsyncGOOGLE" : emit_global_state_wrapped_decoding,
|
||||
|
||||
# Descriptor update templates
|
||||
"vkCreateDescriptorUpdateTemplate" : emit_global_state_wrapped_decoding,
|
||||
|
|
|
|||
|
|
@ -239,7 +239,11 @@ specific entries.
|
|||
<proto><type>VkResult</type> <name>vkGetSemaphoreGOOGLE</name></proto>
|
||||
<param><type>VkDevice</type> <name>device</name></param>
|
||||
<param><type>VkSemaphore</type> <name>semaphore</name></param>
|
||||
<param><type>uint64_t</type> <name>syncId</name></param>
|
||||
<param><type>uint64_t</type> <name>syncId</name></param>
|
||||
</command>
|
||||
<command>
|
||||
<proto><type>void</type> <name>vkTraceAsyncGOOGLE</name></proto>
|
||||
<param><type>uint64_t</type> <name>id</name></param>
|
||||
</command>
|
||||
</commands>
|
||||
<extensions comment="Vulkan extension interface definitions">
|
||||
|
|
@ -280,6 +284,7 @@ specific entries.
|
|||
<command name="vkUpdateDescriptorSetWithTemplateSized2GOOGLE"/>
|
||||
<command name="vkQueueSubmitAsync2GOOGLE"/>
|
||||
<command name="vkGetSemaphoreGOOGLE"/>
|
||||
<command name="vkTraceAsyncGOOGLE"/>
|
||||
</require>
|
||||
</extension>
|
||||
</extensions>
|
||||
|
|
|
|||
|
|
@ -30,11 +30,24 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <random>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#ifdef HAVE_PERFETTO
|
||||
#include <perfetto/tracing.h>
|
||||
|
||||
#define GFXSTREAM_TRACE_DEFAULT_CATEGORY "gfxstream.default"
|
||||
|
||||
PERFETTO_DEFINE_CATEGORIES(
|
||||
perfetto::Category(GFXSTREAM_TRACE_DEFAULT_CATEGORY)
|
||||
.SetDescription("Default events")
|
||||
.SetTags("default"));
|
||||
|
||||
#endif // HAVE_PERFETTO
|
||||
|
||||
#include "vk_util.h"
|
||||
|
||||
#if DETECT_OS_LINUX
|
||||
|
|
@ -78,8 +91,34 @@ static T vk_make_orphan_copy(const T& vk_struct) {
|
|||
return copy;
|
||||
}
|
||||
|
||||
|
||||
namespace gfxstream {
|
||||
namespace vk {
|
||||
namespace {
|
||||
|
||||
uint64_t GeneratePseudoUniqueId() {
|
||||
thread_local std::mt19937 generator(std::random_device{}());
|
||||
std::uniform_int_distribution<uint64_t> distribution(0, std::numeric_limits<uint64_t>::max());
|
||||
return distribution(generator);
|
||||
}
|
||||
|
||||
void EmitGuestAndHostTraceMarker(VkEncoder* encoder) {
|
||||
#ifdef HAVE_PERFETTO
|
||||
const uint64_t flowId = GeneratePseudoUniqueId();
|
||||
|
||||
TRACE_EVENT_INSTANT(
|
||||
GFXSTREAM_TRACE_DEFAULT_CATEGORY,
|
||||
"vkTraceAsyncGOOGLE",
|
||||
perfetto::Flow::Global(flowId),
|
||||
"flow id", flowId);
|
||||
|
||||
encoder->vkTraceAsyncGOOGLE(flowId, true /* do lock */);
|
||||
#else
|
||||
(void)encoder;
|
||||
#endif // HAVE_PERFETTO
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#define MAKE_HANDLE_MAPPING_FOREACH(type_name, map_impl, map_to_u64_impl, map_from_u64_impl) \
|
||||
void mapHandles_##type_name(type_name* handles, size_t count) override { \
|
||||
|
|
@ -6219,6 +6258,7 @@ VkResult ResourceTracker::on_vkQueueSubmit(void* context, VkResult input_result,
|
|||
uint32_t submitCount, const VkSubmitInfo* pSubmits,
|
||||
VkFence fence) {
|
||||
MESA_TRACE_SCOPE("on_vkQueueSubmit");
|
||||
EmitGuestAndHostTraceMarker((VkEncoder*)context);
|
||||
|
||||
/* From the Vulkan 1.3.204 spec:
|
||||
*
|
||||
|
|
@ -6256,6 +6296,7 @@ VkResult ResourceTracker::on_vkQueueSubmit2(void* context, VkResult input_result
|
|||
uint32_t submitCount, const VkSubmitInfo2* pSubmits,
|
||||
VkFence fence) {
|
||||
MESA_TRACE_SCOPE("on_vkQueueSubmit2");
|
||||
EmitGuestAndHostTraceMarker((VkEncoder*)context);
|
||||
return on_vkQueueSubmitTemplate<VkSubmitInfo2, VkSemaphoreSubmitInfo>(context, input_result, queue, submitCount,
|
||||
pSubmits, fence);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27705,6 +27705,47 @@ VkResult VkEncoder::vkGetSemaphoreGOOGLE(VkDevice device, VkSemaphore semaphore,
|
|||
return vkGetSemaphoreGOOGLE_VkResult_return;
|
||||
}
|
||||
|
||||
void VkEncoder::vkTraceAsyncGOOGLE(uint64_t id, uint32_t doLock) {
|
||||
(void)doLock;
|
||||
bool queueSubmitWithCommandsEnabled =
|
||||
sFeatureBits & VULKAN_STREAM_FEATURE_QUEUE_SUBMIT_WITH_COMMANDS_BIT;
|
||||
if (!queueSubmitWithCommandsEnabled && doLock) this->lock();
|
||||
auto stream = mImpl->stream();
|
||||
auto pool = mImpl->pool();
|
||||
uint64_t local_id;
|
||||
local_id = id;
|
||||
size_t count = 0;
|
||||
size_t* countPtr = &count;
|
||||
{
|
||||
*countPtr += sizeof(uint64_t);
|
||||
}
|
||||
uint32_t packetSize_vkTraceAsyncGOOGLE =
|
||||
4 + 4 + (queueSubmitWithCommandsEnabled ? 4 : 0) + count;
|
||||
uint8_t* streamPtr = stream->reserve(packetSize_vkTraceAsyncGOOGLE);
|
||||
uint8_t* packetBeginPtr = streamPtr;
|
||||
uint8_t** streamPtrPtr = &streamPtr;
|
||||
uint32_t opcode_vkTraceAsyncGOOGLE = OP_vkTraceAsyncGOOGLE;
|
||||
uint32_t seqno;
|
||||
if (queueSubmitWithCommandsEnabled) seqno = ResourceTracker::nextSeqno();
|
||||
memcpy(streamPtr, &opcode_vkTraceAsyncGOOGLE, sizeof(uint32_t));
|
||||
streamPtr += sizeof(uint32_t);
|
||||
memcpy(streamPtr, &packetSize_vkTraceAsyncGOOGLE, sizeof(uint32_t));
|
||||
streamPtr += sizeof(uint32_t);
|
||||
if (queueSubmitWithCommandsEnabled) {
|
||||
memcpy(streamPtr, &seqno, sizeof(uint32_t));
|
||||
streamPtr += sizeof(uint32_t);
|
||||
}
|
||||
memcpy(*streamPtrPtr, (uint64_t*)&local_id, sizeof(uint64_t));
|
||||
*streamPtrPtr += sizeof(uint64_t);
|
||||
stream->flush();
|
||||
++encodeCount;
|
||||
if (0 == encodeCount % POOL_CLEAR_INTERVAL) {
|
||||
pool->freeAll();
|
||||
stream->clearPool();
|
||||
}
|
||||
if (!queueSubmitWithCommandsEnabled && doLock) this->unlock();
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace vk
|
||||
} // namespace gfxstream
|
||||
|
|
|
|||
|
|
@ -1086,6 +1086,7 @@ class VkEncoder {
|
|||
const VkSubmitInfo2* pSubmits, VkFence fence, uint32_t doLock);
|
||||
VkResult vkGetSemaphoreGOOGLE(VkDevice device, VkSemaphore semaphore, uint64_t syncId,
|
||||
uint32_t doLock);
|
||||
void vkTraceAsyncGOOGLE(uint64_t id, uint32_t doLock);
|
||||
#endif
|
||||
private:
|
||||
class Impl;
|
||||
|
|
|
|||
|
|
@ -5210,4 +5210,11 @@ VkResult gfxstream_vk_GetSemaphoreGOOGLE(VkDevice device, VkSemaphore semaphore,
|
|||
}
|
||||
return vkGetSemaphoreGOOGLE_VkResult_return;
|
||||
}
|
||||
void gfxstream_vk_TraceAsyncGOOGLE(uint64_t id) {
|
||||
MESA_TRACE_SCOPE("vkTraceAsyncGOOGLE");
|
||||
{
|
||||
auto vkEnc = gfxstream::vk::ResourceTracker::getThreadLocalEncoder();
|
||||
vkEnc->vkTraceAsyncGOOGLE(id, true /* do lock */);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18663,6 +18663,11 @@ const char* api_opcode_to_string(const uint32_t opcode) {
|
|||
return "OP_vkCmdSetStencilTestEnableEXT";
|
||||
}
|
||||
#endif
|
||||
#ifdef VK_GOOGLE_gfxstream
|
||||
case OP_vkTraceAsyncGOOGLE: {
|
||||
return "OP_vkTraceAsyncGOOGLE";
|
||||
}
|
||||
#endif
|
||||
#ifdef VK_VERSION_1_3
|
||||
case OP_vkCmdSetStencilTestEnable: {
|
||||
return "OP_vkCmdSetStencilTestEnable";
|
||||
|
|
|
|||
|
|
@ -4170,6 +4170,7 @@ void unmarshal_VkCreateBlobGOOGLE(VulkanStreamGuest* vkStream, VkStructureType r
|
|||
#define OP_vkUpdateDescriptorSetWithTemplateSized2GOOGLE 244782974
|
||||
#define OP_vkQueueSubmitAsync2GOOGLE 292092830
|
||||
#define OP_vkGetSemaphoreGOOGLE 20342
|
||||
#define OP_vkTraceAsyncGOOGLE 286553566
|
||||
#endif
|
||||
#ifdef VK_EXT_image_compression_control_swapchain
|
||||
void marshal_VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT(
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ typedef VkResult (VKAPI_PTR *PFN_vkGetBlobGOOGLE)(VkDevice device, VkDeviceMemor
|
|||
typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplateSized2GOOGLE)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, uint32_t imageInfoCount, uint32_t bufferInfoCount, uint32_t bufferViewCount, uint32_t inlineUniformBlockCount, const uint32_t* pImageInfoEntryIndices, const uint32_t* pBufferInfoEntryIndices, const uint32_t* pBufferViewEntryIndices, const VkDescriptorImageInfo* pImageInfos, const VkDescriptorBufferInfo* pBufferInfos, const VkBufferView* pBufferViews, const uint8_t* pInlineUniformBlockData);
|
||||
typedef void (VKAPI_PTR *PFN_vkQueueSubmitAsync2GOOGLE)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence);
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreGOOGLE)(VkDevice device, VkSemaphore semaphore, uint64_t syncId);
|
||||
typedef void (VKAPI_PTR *PFN_vkTraceAsyncGOOGLE)(uint64_t id);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkMapMemoryIntoAddressSpaceGOOGLE(
|
||||
VkDevice device,
|
||||
|
|
@ -233,6 +234,9 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreGOOGLE(
|
|||
VkSemaphore semaphore,
|
||||
uint64_t syncId);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkTraceAsyncGOOGLE(
|
||||
uint64_t id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue