Add more perfetto tracepoints

This commit is contained in:
Billy Laws 2023-02-04 21:00:10 +00:00
parent c15b89975b
commit 4a3a40aa40
9 changed files with 20 additions and 0 deletions

View File

@ -53,6 +53,7 @@ namespace skyline::gpu {
} }
BufferManager::LockedBuffer BufferManager::CoalesceBuffers(span<u8> range, const LockedBuffers &srcBuffers, ContextTag tag) { BufferManager::LockedBuffer BufferManager::CoalesceBuffers(span<u8> range, const LockedBuffers &srcBuffers, ContextTag tag) {
TRACE_EVENT("gpu", "BufferManager::CoalesceBuffers");
std::shared_ptr<FenceCycle> newBufferCycle{}; std::shared_ptr<FenceCycle> newBufferCycle{};
for (auto &srcBuffer : srcBuffers) { for (auto &srcBuffer : srcBuffers) {
// Since new direct buffers will share the underlying backing of source buffers we don't need to wait for the GPU if they're dirty, for non direct buffers we do though as otherwise we won't be able to migrate their contents to the new backing // Since new direct buffers will share the underlying backing of source buffers we don't need to wait for the GPU if they're dirty, for non direct buffers we do though as otherwise we won't be able to migrate their contents to the new backing

View File

@ -3,6 +3,7 @@
#pragma once #pragma once
#include <common/trace.h>
#include <common/linear_allocator.h> #include <common/linear_allocator.h>
#include <common/segment_table.h> #include <common/segment_table.h>
#include <common/spin_lock.h> #include <common/spin_lock.h>
@ -99,6 +100,7 @@ namespace skyline::gpu {
BufferView FindOrCreateImpl(GuestBuffer guestMapping, ContextTag tag, const std::function<void(std::shared_ptr<Buffer>, ContextLock<Buffer> &&)> &attachBuffer); BufferView FindOrCreateImpl(GuestBuffer guestMapping, ContextTag tag, const std::function<void(std::shared_ptr<Buffer>, ContextLock<Buffer> &&)> &attachBuffer);
BufferView FindOrCreate(GuestBuffer guestMapping, ContextTag tag = {}, const std::function<void(std::shared_ptr<Buffer>, ContextLock<Buffer> &&)> &attachBuffer = {}) { BufferView FindOrCreate(GuestBuffer guestMapping, ContextTag tag = {}, const std::function<void(std::shared_ptr<Buffer>, ContextLock<Buffer> &&)> &attachBuffer = {}) {
TRACE_EVENT("gpu", "BufferManager::FindOrCreate");
auto lookupBuffer{bufferTable[guestMapping.begin().base()]}; auto lookupBuffer{bufferTable[guestMapping.begin().base()]};
if (lookupBuffer != nullptr) if (lookupBuffer != nullptr)
if (auto view{lookupBuffer->TryGetView(guestMapping)}; view) if (auto view{lookupBuffer->TryGetView(guestMapping)}; view)

View File

@ -112,6 +112,8 @@ namespace skyline::gpu::interconnect {
executor{channelCtx.executor} {} executor{channelCtx.executor} {}
void Fermi2D::Blit(const Surface &srcSurface, const Surface &dstSurface, float srcRectX, float srcRectY, u32 dstRectWidth, u32 dstRectHeight, u32 dstRectX, u32 dstRectY, float duDx, float dvDy, SampleModeOrigin sampleOrigin, bool resolve, SampleModeFilter filter) { void Fermi2D::Blit(const Surface &srcSurface, const Surface &dstSurface, float srcRectX, float srcRectY, u32 dstRectWidth, u32 dstRectHeight, u32 dstRectX, u32 dstRectY, float duDx, float dvDy, SampleModeOrigin sampleOrigin, bool resolve, SampleModeFilter filter) {
TRACE_EVENT("gpu", "Fermi2D::Blit");
// TODO: When we support MSAA perform a resolve operation rather than blit when the `resolve` flag is set. // TODO: When we support MSAA perform a resolve operation rather than blit when the `resolve` flag is set.
auto srcGuestTexture{GetGuestTexture(srcSurface)}; auto srcGuestTexture{GetGuestTexture(srcSurface)};
auto dstGuestTexture{GetGuestTexture(dstSurface)}; auto dstGuestTexture{GetGuestTexture(dstSurface)};
@ -129,6 +131,7 @@ namespace skyline::gpu::interconnect {
float centredSrcRectX{sampleOrigin == SampleModeOrigin::Corner ? srcRectX - 0.5f : srcRectX}; float centredSrcRectX{sampleOrigin == SampleModeOrigin::Corner ? srcRectX - 0.5f : srcRectX};
float centredSrcRectY{sampleOrigin == SampleModeOrigin::Corner ? srcRectY - 0.5f : srcRectY}; float centredSrcRectY{sampleOrigin == SampleModeOrigin::Corner ? srcRectY - 0.5f : srcRectY};
executor.AddCheckpoint("Before blit");
gpu.helperShaders.blitHelperShader.Blit( gpu.helperShaders.blitHelperShader.Blit(
gpu, gpu,
{ {

View File

@ -31,6 +31,8 @@ namespace skyline::gpu::interconnect::kepler_compute {
if (ctx.gpu.traits.quirks.brokenComputeShaders) if (ctx.gpu.traits.quirks.brokenComputeShaders)
return; return;
TRACE_EVENT("gpu", "KeplerCompute::Dispatch");
StateUpdateBuilder builder{*ctx.executor.allocator}; StateUpdateBuilder builder{*ctx.executor.allocator};
constantBuffers.Update(ctx, qmd); constantBuffers.Update(ctx, qmd);

View File

@ -435,6 +435,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
void ActiveState::Update(InterconnectContext &ctx, Textures &textures, ConstantBufferSet &constantBuffers, StateUpdateBuilder &builder, void ActiveState::Update(InterconnectContext &ctx, Textures &textures, ConstantBufferSet &constantBuffers, StateUpdateBuilder &builder,
bool indexed, engine::DrawTopology topology, bool estimateIndexBufferSize, u32 drawFirstIndex, u32 drawElementCount, bool indexed, engine::DrawTopology topology, bool estimateIndexBufferSize, u32 drawFirstIndex, u32 drawElementCount,
vk::PipelineStageFlags &srcStageMask, vk::PipelineStageFlags &dstStageMask) { vk::PipelineStageFlags &srcStageMask, vk::PipelineStageFlags &dstStageMask) {
TRACE_EVENT("gpu", "ActiveState::Update");
if (topology != directState.inputAssembly.GetPrimitiveTopology()) { if (topology != directState.inputAssembly.GetPrimitiveTopology()) {
directState.inputAssembly.SetPrimitiveTopology(topology); directState.inputAssembly.SetPrimitiveTopology(topology);
pipeline.MarkDirty(false); pipeline.MarkDirty(false);

View File

@ -40,6 +40,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
} }
void ConstantBuffers::Load(InterconnectContext &ctx, span<u32> data, u32 offset) { void ConstantBuffers::Load(InterconnectContext &ctx, span<u32> data, u32 offset) {
TRACE_EVENT("gpu", "ConstantBuffers::Load");
auto &view{*selectorState.UpdateGet(ctx, data.size_bytes()).view}; auto &view{*selectorState.UpdateGet(ctx, data.size_bytes()).view};
auto srcCpuBuf{data.cast<u8>()}; auto srcCpuBuf{data.cast<u8>()};

View File

@ -132,6 +132,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
if (scissor.extent.width == 0 || scissor.extent.height == 0) if (scissor.extent.width == 0 || scissor.extent.height == 0)
return; return;
TRACE_EVENT("gpu", "Maxwell3D::Clear");
auto needsAttachmentClearCmd{[&](auto &view) { auto needsAttachmentClearCmd{[&](auto &view) {
return scissor.offset.x != 0 || scissor.offset.y != 0 || return scissor.offset.x != 0 || scissor.offset.y != 0 ||
scissor.extent != vk::Extent2D{view->texture->dimensions} || scissor.extent != vk::Extent2D{view->texture->dimensions} ||
@ -215,6 +217,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
} }
void Maxwell3D::Draw(engine::DrawTopology topology, bool transformFeedbackEnable, bool indexed, u32 count, u32 first, u32 instanceCount, u32 vertexOffset, u32 firstInstance) { void Maxwell3D::Draw(engine::DrawTopology topology, bool transformFeedbackEnable, bool indexed, u32 count, u32 first, u32 instanceCount, u32 vertexOffset, u32 firstInstance) {
TRACE_EVENT("gpu", "Draw", "indexed", indexed, "count", count, "instanceCount", instanceCount);
StateUpdateBuilder builder{*ctx.executor.allocator}; StateUpdateBuilder builder{*ctx.executor.allocator};
vk::PipelineStageFlags srcStageMask{}, dstStageMask{}; vk::PipelineStageFlags srcStageMask{}, dstStageMask{};

View File

@ -385,6 +385,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
ctSelect{engine.ctSelect} {} ctSelect{engine.ctSelect} {}
void PipelineState::Flush(InterconnectContext &ctx, Textures &textures, ConstantBufferSet &constantBuffers, StateUpdateBuilder &builder) { void PipelineState::Flush(InterconnectContext &ctx, Textures &textures, ConstantBufferSet &constantBuffers, StateUpdateBuilder &builder) {
TRACE_EVENT("gpu", "PipelineState::Flush");
packedState.dynamicStateActive = ctx.gpu.traits.supportsExtendedDynamicState; packedState.dynamicStateActive = ctx.gpu.traits.supportsExtendedDynamicState;
packedState.ctSelect = ctSelect; packedState.ctSelect = ctSelect;

View File

@ -1,12 +1,15 @@
// SPDX-License-Identifier: MPL-2.0 // SPDX-License-Identifier: MPL-2.0
// Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/) // Copyright © 2021 Skyline Team and Contributors (https://github.com/skyline-emu/)
#include <common/trace.h>
#include "texture_manager.h" #include "texture_manager.h"
namespace skyline::gpu { namespace skyline::gpu {
TextureManager::TextureManager(GPU &gpu) : gpu(gpu) {} TextureManager::TextureManager(GPU &gpu) : gpu(gpu) {}
std::shared_ptr<TextureView> TextureManager::FindOrCreate(const GuestTexture &guestTexture, ContextTag tag) { std::shared_ptr<TextureView> TextureManager::FindOrCreate(const GuestTexture &guestTexture, ContextTag tag) {
TRACE_EVENT("gpu", "TextureManager::FindOrCreate");
auto guestMapping{guestTexture.mappings.front()}; auto guestMapping{guestTexture.mappings.front()};
/* /*