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) {
TRACE_EVENT("gpu", "BufferManager::CoalesceBuffers");
std::shared_ptr<FenceCycle> newBufferCycle{};
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

View File

@ -3,6 +3,7 @@
#pragma once
#include <common/trace.h>
#include <common/linear_allocator.h>
#include <common/segment_table.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 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()]};
if (lookupBuffer != nullptr)
if (auto view{lookupBuffer->TryGetView(guestMapping)}; view)

View File

@ -112,6 +112,8 @@ namespace skyline::gpu::interconnect {
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) {
TRACE_EVENT("gpu", "Fermi2D::Blit");
// TODO: When we support MSAA perform a resolve operation rather than blit when the `resolve` flag is set.
auto srcGuestTexture{GetGuestTexture(srcSurface)};
auto dstGuestTexture{GetGuestTexture(dstSurface)};
@ -129,6 +131,7 @@ namespace skyline::gpu::interconnect {
float centredSrcRectX{sampleOrigin == SampleModeOrigin::Corner ? srcRectX - 0.5f : srcRectX};
float centredSrcRectY{sampleOrigin == SampleModeOrigin::Corner ? srcRectY - 0.5f : srcRectY};
executor.AddCheckpoint("Before blit");
gpu.helperShaders.blitHelperShader.Blit(
gpu,
{

View File

@ -31,6 +31,8 @@ namespace skyline::gpu::interconnect::kepler_compute {
if (ctx.gpu.traits.quirks.brokenComputeShaders)
return;
TRACE_EVENT("gpu", "KeplerCompute::Dispatch");
StateUpdateBuilder builder{*ctx.executor.allocator};
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,
bool indexed, engine::DrawTopology topology, bool estimateIndexBufferSize, u32 drawFirstIndex, u32 drawElementCount,
vk::PipelineStageFlags &srcStageMask, vk::PipelineStageFlags &dstStageMask) {
TRACE_EVENT("gpu", "ActiveState::Update");
if (topology != directState.inputAssembly.GetPrimitiveTopology()) {
directState.inputAssembly.SetPrimitiveTopology(topology);
pipeline.MarkDirty(false);

View File

@ -40,6 +40,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
}
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 srcCpuBuf{data.cast<u8>()};

View File

@ -132,6 +132,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
if (scissor.extent.width == 0 || scissor.extent.height == 0)
return;
TRACE_EVENT("gpu", "Maxwell3D::Clear");
auto needsAttachmentClearCmd{[&](auto &view) {
return scissor.offset.x != 0 || scissor.offset.y != 0 ||
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) {
TRACE_EVENT("gpu", "Draw", "indexed", indexed, "count", count, "instanceCount", instanceCount);
StateUpdateBuilder builder{*ctx.executor.allocator};
vk::PipelineStageFlags srcStageMask{}, dstStageMask{};

View File

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

View File

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