Compare commits
2 commits
dacfe6d6f0
...
d2b6196c20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2b6196c20 | ||
|
|
278d5c5a34 |
29 changed files with 124 additions and 332 deletions
|
|
@ -151,7 +151,7 @@ Result OpusDecoder::DecodeInterleavedForMultiStream(u32* out_data_size, u64* out
|
|||
auto* header_p{reinterpret_cast<const OpusPacketHeader*>(input_data.data())};
|
||||
OpusPacketHeader header{ReverseHeader(*header_p)};
|
||||
|
||||
LOG_TRACE(Service_Audio, "header size {:#X} input data size 0x{:X} in_data size 0x{:X}",
|
||||
LOG_TRACE(Service_Audio, "header size {:#X} input data size {:#X} in_data size {:#X}",
|
||||
header.size, input_data.size_bytes(), in_data.size_bytes());
|
||||
|
||||
R_UNLESS(in_data.size_bytes() >= header.size &&
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ Result InfoUpdater::UpdateMixes(MixContext& mix_context, const u32 mix_buffer_co
|
|||
if (mix_count < 0 || mix_count > 0x100) {
|
||||
LOG_ERROR(
|
||||
Service_Audio,
|
||||
"Invalid mix count from dirty parameter: count={}, magic=0x{:X}, expected_size={}",
|
||||
"Invalid mix count from dirty parameter: count={}, magic={:#X}, expected_size={}",
|
||||
mix_count, in_dirty_params->magic, in_header->mix_size);
|
||||
return Service::Audio::ResultInvalidUpdateInfo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ constexpr bool IsValidArbitrationType(Svc::ArbitrationType type) {
|
|||
// Wait for an address (via Address Arbiter)
|
||||
Result WaitForAddress(Core::System& system, u64 address, ArbitrationType arb_type, s32 value,
|
||||
s64 timeout_ns) {
|
||||
LOG_TRACE(Kernel_SVC, "called, address={:#X}, arb_type=0x{:X}, value=0x{:X}, timeout_ns={}",
|
||||
LOG_TRACE(Kernel_SVC, "called, address={:#X}, arb_type={:#X}, value={:#X}, timeout_ns={}",
|
||||
address, arb_type, value, timeout_ns);
|
||||
|
||||
// Validate input.
|
||||
|
|
@ -74,7 +74,7 @@ Result WaitForAddress(Core::System& system, u64 address, ArbitrationType arb_typ
|
|||
// Signals to an address (via Address Arbiter)
|
||||
Result SignalToAddress(Core::System& system, u64 address, SignalType signal_type, s32 value,
|
||||
s32 count) {
|
||||
LOG_TRACE(Kernel_SVC, "called, address={:#X}, signal_type=0x{:X}, value=0x{:X}, count=0x{:X}",
|
||||
LOG_TRACE(Kernel_SVC, "called, address={:#X}, signal_type={:#X}, value={:#X}, count={:#X}",
|
||||
address, signal_type, value, count);
|
||||
|
||||
// Validate input.
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ constexpr bool IsValidUnmapFromOwnerCodeMemoryPermission(MemoryPermission perm)
|
|||
} // namespace
|
||||
|
||||
Result CreateCodeMemory(Core::System& system, Handle* out, u64 address, uint64_t size) {
|
||||
LOG_TRACE(Kernel_SVC, "called, address={:#X}, size=0x{:X}", address, size);
|
||||
LOG_TRACE(Kernel_SVC, "called, address={:#X}, size={:#X}", address, size);
|
||||
|
||||
// Get kernel instance.
|
||||
auto& kernel = system.Kernel();
|
||||
|
|
@ -73,7 +73,7 @@ Result ControlCodeMemory(Core::System& system, Handle code_memory_handle,
|
|||
MemoryPermission perm) {
|
||||
|
||||
LOG_TRACE(Kernel_SVC,
|
||||
"called, code_memory_handle={:#X}, operation=0x{:X}, address=0x{:X}, size=0x{:X}, "
|
||||
"called, code_memory_handle={:#X}, operation={:#X}, address={:#X}, size={:#X}, "
|
||||
"permission={:#X}",
|
||||
code_memory_handle, operation, address, size, perm);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Kernel::Svc {
|
|||
/// Gets system/memory information for the current process
|
||||
Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle handle,
|
||||
u64 info_sub_id) {
|
||||
LOG_TRACE(Kernel_SVC, "called info_id={:#X}, info_sub_id=0x{:X}, handle=0x{:08X}",
|
||||
LOG_TRACE(Kernel_SVC, "called info_id={:#X}, info_sub_id={:#X}, handle=0x{:08X}",
|
||||
info_id_type, info_sub_id, handle);
|
||||
|
||||
u32 info_id = static_cast<u32>(info_id_type);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ Result SetMemoryAttribute(Core::System& system, u64 address, u64 size, u32 mask,
|
|||
|
||||
/// Maps a memory range into a different range.
|
||||
Result MapMemory(Core::System& system, u64 dst_addr, u64 src_addr, u64 size) {
|
||||
LOG_TRACE(Kernel_SVC, "called, dst_addr={:#X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
|
||||
LOG_TRACE(Kernel_SVC, "called, dst_addr={:#X}, src_addr={:#X}, size={:#X}", dst_addr,
|
||||
src_addr, size);
|
||||
|
||||
auto& page_table{GetCurrentProcess(system.Kernel()).GetPageTable()};
|
||||
|
|
@ -148,7 +148,7 @@ Result MapMemory(Core::System& system, u64 dst_addr, u64 src_addr, u64 size) {
|
|||
|
||||
/// Unmaps a region that was previously mapped with svcMapMemory
|
||||
Result UnmapMemory(Core::System& system, u64 dst_addr, u64 src_addr, u64 size) {
|
||||
LOG_TRACE(Kernel_SVC, "called, dst_addr={:#X}, src_addr=0x{:X}, size=0x{:X}", dst_addr,
|
||||
LOG_TRACE(Kernel_SVC, "called, dst_addr={:#X}, src_addr={:#X}, size={:#X}", dst_addr,
|
||||
src_addr, size);
|
||||
|
||||
auto& page_table{GetCurrentProcess(system.Kernel()).GetPageTable()};
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ constexpr bool IsValidProcessMemoryPermission(Svc::MemoryPermission perm) {
|
|||
Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, u64 address,
|
||||
u64 size, Svc::MemoryPermission perm) {
|
||||
LOG_TRACE(Kernel_SVC,
|
||||
"called, process_handle={:#X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}",
|
||||
"called, process_handle={:#X}, addr={:#X}, size={:#X}, permissions=0x{:08X}",
|
||||
process_handle, address, size, perm);
|
||||
|
||||
// Validate the address/size.
|
||||
|
|
@ -62,7 +62,7 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, u
|
|||
Result MapProcessMemory(Core::System& system, u64 dst_address, Handle process_handle,
|
||||
u64 src_address, u64 size) {
|
||||
LOG_TRACE(Kernel_SVC,
|
||||
"called, dst_address={:#X}, process_handle=0x{:X}, src_address=0x{:X}, size=0x{:X}",
|
||||
"called, dst_address={:#X}, process_handle={:#X}, src_address={:#X}, size={:#X}",
|
||||
dst_address, process_handle, src_address, size);
|
||||
|
||||
// Validate the address/size.
|
||||
|
|
@ -103,7 +103,7 @@ Result MapProcessMemory(Core::System& system, u64 dst_address, Handle process_ha
|
|||
Result UnmapProcessMemory(Core::System& system, u64 dst_address, Handle process_handle,
|
||||
u64 src_address, u64 size) {
|
||||
LOG_TRACE(Kernel_SVC,
|
||||
"called, dst_address={:#X}, process_handle=0x{:X}, src_address=0x{:X}, size=0x{:X}",
|
||||
"called, dst_address={:#X}, process_handle={:#X}, src_address={:#X}, size={:#X}",
|
||||
dst_address, process_handle, src_address, size);
|
||||
|
||||
// Validate the address/size.
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ constexpr bool IsValidSharedMemoryPermission(MemoryPermission perm) {
|
|||
Result MapSharedMemory(Core::System& system, Handle shmem_handle, u64 address, u64 size,
|
||||
Svc::MemoryPermission map_perm) {
|
||||
LOG_TRACE(Kernel_SVC,
|
||||
"called, shared_memory_handle={:#X}, addr=0x{:X}, size=0x{:X}, permissions=0x{:08X}",
|
||||
"called, shared_memory_handle={:#X}, addr={:#X}, size={:#X}, permissions=0x{:08X}",
|
||||
shmem_handle, address, size, map_perm);
|
||||
|
||||
// Validate the address/size.
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ void DynarmicCallbacks64::CallSVC(u32 swi) {
|
|||
LOG_CRITICAL(Service_JIT, "plugin panicked!");
|
||||
parent.jit->HaltExecution();
|
||||
} else {
|
||||
LOG_CRITICAL(Service_JIT, "plugin issued syscall at unknown address 0x{:x}", pc);
|
||||
LOG_CRITICAL(Service_JIT, "plugin issued syscall at unknown address {:#x}", pc);
|
||||
parent.jit->HaltExecution();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ NvResult nvhost_as_gpu::UnmapBuffer(IoctlUnmapBuffer& params) {
|
|||
|
||||
mapping_map.erase(params.offset);
|
||||
} catch (const std::out_of_range&) {
|
||||
LOG_WARNING(Service_NVDRV, "Couldn't find region to unmap at 0x{:X}", params.offset);
|
||||
LOG_WARNING(Service_NVDRV, "Couldn't find region to unmap at {:#X}", params.offset);
|
||||
}
|
||||
|
||||
return NvResult::Success;
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ void BSD::GetSockOpt(HLERequestContext& ctx) {
|
|||
|
||||
std::vector<u8> optval(ctx.GetWriteBufferSize());
|
||||
|
||||
LOG_DEBUG(Service, "called. fd={} level={} optname=0x{:x} len=0x{:x}", fd, level, optname,
|
||||
LOG_DEBUG(Service, "called. fd={} level={} optname={:#x} len={:#x}", fd, level, optname,
|
||||
optval.size());
|
||||
|
||||
const Errno err = GetSockOptImpl(fd, level, optname, optval);
|
||||
|
|
@ -330,7 +330,7 @@ void BSD::SetSockOpt(HLERequestContext& ctx) {
|
|||
const OptName optname = static_cast<OptName>(rp.Pop<u32>());
|
||||
const auto optval = ctx.ReadBuffer();
|
||||
|
||||
LOG_DEBUG(Service, "called. fd={} level={} optname=0x{:x} optlen={}", fd, level,
|
||||
LOG_DEBUG(Service, "called. fd={} level={} optname={:#x} optlen={}", fd, level,
|
||||
static_cast<u32>(optname), optval.size());
|
||||
|
||||
BuildErrnoResponse(ctx, SetSockOptImpl(fd, level, optname, optval));
|
||||
|
|
@ -353,7 +353,7 @@ void BSD::Recv(HLERequestContext& ctx) {
|
|||
const s32 fd = rp.Pop<s32>();
|
||||
const u32 flags = rp.Pop<u32>();
|
||||
|
||||
LOG_DEBUG(Service, "called. fd={} flags=0x{:x} len={}", fd, flags, ctx.GetWriteBufferSize());
|
||||
LOG_DEBUG(Service, "called. fd={} flags={:#x} len={}", fd, flags, ctx.GetWriteBufferSize());
|
||||
|
||||
ExecuteWork(ctx, RecvWork{
|
||||
.fd = fd,
|
||||
|
|
@ -368,7 +368,7 @@ void BSD::RecvFrom(HLERequestContext& ctx) {
|
|||
const s32 fd = rp.Pop<s32>();
|
||||
const u32 flags = rp.Pop<u32>();
|
||||
|
||||
LOG_DEBUG(Service, "called. fd={} flags=0x{:x} len={} addrlen={}", fd, flags,
|
||||
LOG_DEBUG(Service, "called. fd={} flags={:#x} len={} addrlen={}", fd, flags,
|
||||
ctx.GetWriteBufferSize(0), ctx.GetWriteBufferSize(1));
|
||||
|
||||
ExecuteWork(ctx, RecvFromWork{
|
||||
|
|
@ -385,7 +385,7 @@ void BSD::Send(HLERequestContext& ctx) {
|
|||
const s32 fd = rp.Pop<s32>();
|
||||
const u32 flags = rp.Pop<u32>();
|
||||
|
||||
LOG_DEBUG(Service, "called. fd={} flags=0x{:x} len={}", fd, flags, ctx.GetReadBufferSize());
|
||||
LOG_DEBUG(Service, "called. fd={} flags={:#x} len={}", fd, flags, ctx.GetReadBufferSize());
|
||||
|
||||
ExecuteWork(ctx, SendWork{
|
||||
.fd = fd,
|
||||
|
|
|
|||
|
|
@ -495,13 +495,13 @@ short TranslatePollEvents(PollEvents events) {
|
|||
// Unlike poll on other OSes, WSAPoll will complain if any other flags are set on input.
|
||||
if (result & ~allowed_events) {
|
||||
LOG_DEBUG(Network,
|
||||
"Removing WSAPoll input events 0x{:x} because Windows doesn't support them",
|
||||
"Removing WSAPoll input events {:#x} because Windows doesn't support them",
|
||||
result & ~allowed_events);
|
||||
}
|
||||
result &= allowed_events;
|
||||
#endif
|
||||
|
||||
UNIMPLEMENTED_IF_MSG((u16)events != 0, "Unhandled guest events=0x{:x}", (u16)events);
|
||||
UNIMPLEMENTED_IF_MSG((u16)events != 0, "Unhandled guest events={:#x}", (u16)events);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -525,7 +525,7 @@ PollEvents TranslatePollRevents(short revents) {
|
|||
translate(POLLRDBAND, PollEvents::RdBand);
|
||||
translate(POLLWRBAND, PollEvents::WrBand);
|
||||
|
||||
UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents=0x{:x}", revents);
|
||||
UNIMPLEMENTED_IF_MSG(revents != 0, "Unhandled host revents={:#x}", revents);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ void TranslatorVisitor::STL(u64 insn) {
|
|||
if (offset.IsImmediate()) {
|
||||
// TODO: Support storing out of bounds at runtime
|
||||
if (offset.U32() >= env.LocalMemorySize()) {
|
||||
LOG_WARNING(Shader, "Storing local memory at 0x{:x} with a size of 0x{:x}, dropping",
|
||||
LOG_WARNING(Shader, "Storing local memory at {:#x} with a size of {:#x}, dropping",
|
||||
offset.U32(), env.LocalMemorySize());
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ void CDmaPusher::ProcessEntries(std::stop_token stop_token) {
|
|||
void CDmaPusher::ExecuteCommand(u32 method, u32 arg) {
|
||||
switch (current_class) {
|
||||
case ChClassId::Control:
|
||||
LOG_TRACE(Service_NVDRV, "Class {} method {:#X} arg 0x{:X}",
|
||||
LOG_TRACE(Service_NVDRV, "Class {} method {:#X} arg {:#X}",
|
||||
static_cast<u32>(current_class), method, arg);
|
||||
host_processor->ProcessMethod(static_cast<Host1x::Control::Method>(method), arg);
|
||||
break;
|
||||
|
|
@ -118,7 +118,7 @@ void CDmaPusher::ExecuteCommand(u32 method, u32 arg) {
|
|||
break;
|
||||
}
|
||||
case ThiMethod::SetMethod1:
|
||||
LOG_TRACE(Service_NVDRV, "Class {} method {:#X} arg 0x{:X}",
|
||||
LOG_TRACE(Service_NVDRV, "Class {} method {:#X} arg {:#X}",
|
||||
static_cast<u32>(current_class), static_cast<u32>(thi_regs.method_0), arg);
|
||||
ProcessMethod(thi_regs.method_0, arg);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void Fermi2D::ConsumeSinkImpl() {
|
|||
|
||||
void Fermi2D::Blit() {
|
||||
MICROPROFILE_SCOPE(GPU_BlitEngine);
|
||||
LOG_DEBUG(HW_GPU, "called. source address=0x{:x}, destination address=0x{:x}",
|
||||
LOG_DEBUG(HW_GPU, "called. source address={:#x}, destination address={:#x}",
|
||||
regs.src.Address(), regs.dst.Address());
|
||||
|
||||
UNIMPLEMENTED_IF_MSG(regs.operation != Operation::SrcCopy, "Operation is not copy");
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ void MaxwellDMA::CallMultiMethod(u32 method, const u32* base_start, u32 amount,
|
|||
|
||||
void MaxwellDMA::Launch() {
|
||||
MICROPROFILE_SCOPE(GPU_DMAEngine);
|
||||
LOG_TRACE(Render_OpenGL, "DMA copy 0x{:x} -> 0x{:x}", static_cast<GPUVAddr>(regs.offset_in),
|
||||
LOG_TRACE(Render_OpenGL, "DMA copy {:#x} -> {:#x}", static_cast<GPUVAddr>(regs.offset_in),
|
||||
static_cast<GPUVAddr>(regs.offset_out));
|
||||
|
||||
// TODO(Subv): Perform more research and implement all features of this engine.
|
||||
|
|
|
|||
6
src/video_core/host1x/codecs/decoder.cpp
Executable file → Normal file
6
src/video_core/host1x/codecs/decoder.cpp
Executable file → Normal file
|
|
@ -35,13 +35,17 @@ void Decoder::Decode() {
|
|||
// Receive output frames from decoder.
|
||||
auto frame = decode_api.ReceiveFrame();
|
||||
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsInterlaced()) {
|
||||
auto [luma_top, luma_bottom, chroma_top, chroma_bottom] = GetInterlacedOffsets();
|
||||
auto frame_copy = frame;
|
||||
|
||||
if (!frame.get()) {
|
||||
LOG_ERROR(HW_GPU,
|
||||
"Nvdec {} failed to decode interlaced frame for top {:#X} bottom 0x{:X}", id,
|
||||
"Nvdec {} failed to decode interlaced frame for top {:#X} bottom {:#X}", id,
|
||||
luma_top, luma_bottom);
|
||||
}
|
||||
|
||||
|
|
|
|||
0
src/video_core/host1x/codecs/decoder.h
Executable file → Normal file
0
src/video_core/host1x/codecs/decoder.h
Executable file → Normal file
|
|
@ -23,28 +23,45 @@ namespace {
|
|||
constexpr AVPixelFormat PreferredGpuFormat = AV_PIX_FMT_NV12;
|
||||
constexpr AVPixelFormat PreferredCpuFormat = AV_PIX_FMT_YUV420P;
|
||||
constexpr std::array PreferredGpuDecoders = {
|
||||
#if defined(_WIN32)
|
||||
AV_HWDEVICE_TYPE_CUDA,
|
||||
#ifdef _WIN32
|
||||
AV_HWDEVICE_TYPE_D3D11VA,
|
||||
AV_HWDEVICE_TYPE_DXVA2,
|
||||
#elif defined(__FreeBSD__)
|
||||
AV_HWDEVICE_TYPE_VDPAU,
|
||||
#elif defined(__unix__)
|
||||
AV_HWDEVICE_TYPE_CUDA,
|
||||
AV_HWDEVICE_TYPE_VAAPI,
|
||||
AV_HWDEVICE_TYPE_VDPAU,
|
||||
#endif
|
||||
// last resort for Linux Flatpak (w/ NVIDIA)
|
||||
AV_HWDEVICE_TYPE_VULKAN,
|
||||
};
|
||||
|
||||
AVPixelFormat GetGpuFormat(AVCodecContext* codec_context, const AVPixelFormat* pix_fmts) {
|
||||
const auto desc = av_pix_fmt_desc_get(codec_context->pix_fmt);
|
||||
if (desc && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
|
||||
for (int i = 0;; i++) {
|
||||
const AVCodecHWConfig* config = avcodec_get_hw_config(codec_context->codec, i);
|
||||
if (!config) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (const auto type : PreferredGpuDecoders) {
|
||||
if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && config->device_type == type) {
|
||||
codec_context->pix_fmt = config->pix_fmt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const AVPixelFormat* p = pix_fmts; *p != AV_PIX_FMT_NONE; ++p) {
|
||||
if (*p == codec_context->pix_fmt) {
|
||||
return codec_context->pix_fmt;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO(HW_GPU, "Could not find compatible GPU AV format, falling back to CPU");
|
||||
LOG_INFO(HW_GPU, "Could not find supported GPU pixel format, falling back to CPU decoder");
|
||||
av_buffer_unref(&codec_context->hw_device_ctx);
|
||||
|
||||
codec_context->pix_fmt = PreferredCpuFormat;
|
||||
return codec_context->pix_fmt;
|
||||
}
|
||||
|
|
@ -55,7 +72,7 @@ std::string AVError(int errnum) {
|
|||
return errbuf;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
}
|
||||
|
||||
Packet::Packet(std::span<const u8> data) {
|
||||
m_packet = av_packet_alloc();
|
||||
|
|
@ -78,15 +95,15 @@ Frame::~Frame() {
|
|||
Decoder::Decoder(Tegra::Host1x::NvdecCommon::VideoCodec codec) {
|
||||
const AVCodecID av_codec = [&] {
|
||||
switch (codec) {
|
||||
case Tegra::Host1x::NvdecCommon::VideoCodec::H264:
|
||||
return AV_CODEC_ID_H264;
|
||||
case Tegra::Host1x::NvdecCommon::VideoCodec::VP8:
|
||||
return AV_CODEC_ID_VP8;
|
||||
case Tegra::Host1x::NvdecCommon::VideoCodec::VP9:
|
||||
return AV_CODEC_ID_VP9;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unknown codec {}", codec);
|
||||
return AV_CODEC_ID_NONE;
|
||||
case Tegra::Host1x::NvdecCommon::VideoCodec::H264:
|
||||
return AV_CODEC_ID_H264;
|
||||
case Tegra::Host1x::NvdecCommon::VideoCodec::VP8:
|
||||
return AV_CODEC_ID_VP8;
|
||||
case Tegra::Host1x::NvdecCommon::VideoCodec::VP9:
|
||||
return AV_CODEC_ID_VP9;
|
||||
default:
|
||||
UNIMPLEMENTED_MSG("Unknown codec {}", codec);
|
||||
return AV_CODEC_ID_NONE;
|
||||
}
|
||||
}();
|
||||
|
||||
|
|
@ -97,12 +114,11 @@ bool Decoder::SupportsDecodingOnDevice(AVPixelFormat* out_pix_fmt, AVHWDeviceTyp
|
|||
for (int i = 0;; i++) {
|
||||
const AVCodecHWConfig* config = avcodec_get_hw_config(m_codec, i);
|
||||
if (!config) {
|
||||
LOG_DEBUG(HW_GPU, "{} decoder does not support device type {}", m_codec->name,
|
||||
av_hwdevice_get_type_name(type));
|
||||
LOG_DEBUG(HW_GPU, "{} decoder does not support device type {}", m_codec->name, av_hwdevice_get_type_name(type));
|
||||
break;
|
||||
}
|
||||
if ((config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX) != 0 &&
|
||||
config->device_type == type) {
|
||||
|
||||
if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX && config->device_type == type) {
|
||||
LOG_INFO(HW_GPU, "Using {} GPU decoder", av_hwdevice_get_type_name(type));
|
||||
*out_pix_fmt = config->pix_fmt;
|
||||
return true;
|
||||
|
|
@ -130,8 +146,7 @@ HardwareContext::~HardwareContext() {
|
|||
av_buffer_unref(&m_gpu_decoder);
|
||||
}
|
||||
|
||||
bool HardwareContext::InitializeForDecoder(DecoderContext& decoder_context,
|
||||
const Decoder& decoder) {
|
||||
bool HardwareContext::InitializeForDecoder(DecoderContext& decoder_context, const Decoder& decoder) {
|
||||
const auto supported_types = GetSupportedDeviceTypes();
|
||||
for (const auto type : PreferredGpuDecoders) {
|
||||
AVPixelFormat hw_pix_fmt;
|
||||
|
|
@ -151,17 +166,14 @@ bool HardwareContext::InitializeForDecoder(DecoderContext& decoder_context,
|
|||
}
|
||||
}
|
||||
|
||||
LOG_INFO(HW_GPU, "Hardware decoding is disabled due to implementation issues, using CPU.");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HardwareContext::InitializeWithType(AVHWDeviceType type) {
|
||||
av_buffer_unref(&m_gpu_decoder);
|
||||
|
||||
if (const int ret = av_hwdevice_ctx_create(&m_gpu_decoder, type, nullptr, nullptr, 0);
|
||||
ret < 0) {
|
||||
LOG_DEBUG(HW_GPU, "av_hwdevice_ctx_create({}) failed: {}", av_hwdevice_get_type_name(type),
|
||||
AVError(ret));
|
||||
if (const int ret = av_hwdevice_ctx_create(&m_gpu_decoder, type, nullptr, nullptr, 0); ret < 0) {
|
||||
LOG_DEBUG(HW_GPU, "av_hwdevice_ctx_create({}) failed: {}", av_hwdevice_get_type_name(type), AVError(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -198,8 +210,7 @@ DecoderContext::~DecoderContext() {
|
|||
avcodec_free_context(&m_codec_context);
|
||||
}
|
||||
|
||||
void DecoderContext::InitializeHardwareDecoder(const HardwareContext& context,
|
||||
AVPixelFormat hw_pix_fmt) {
|
||||
void DecoderContext::InitializeHardwareDecoder(const HardwareContext& context, AVPixelFormat hw_pix_fmt) {
|
||||
m_codec_context->hw_device_ctx = av_buffer_ref(context.GetBufferRef());
|
||||
m_codec_context->get_format = GetGpuFormat;
|
||||
m_codec_context->pix_fmt = hw_pix_fmt;
|
||||
|
|
@ -212,192 +223,14 @@ bool DecoderContext::OpenContext(const Decoder& decoder) {
|
|||
}
|
||||
|
||||
if (!m_codec_context->hw_device_ctx) {
|
||||
LOG_INFO(HW_GPU, "Using FFmpeg software decoding");
|
||||
LOG_INFO(HW_GPU, "Using FFmpeg CPU decoder");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Nasty but allows linux builds to pass.
|
||||
// Requires double checks when FFMPEG gets updated.
|
||||
// Hopefully a future FFMPEG update will all and expose a solution in the public API.
|
||||
namespace {
|
||||
|
||||
typedef struct FFCodecDefault {
|
||||
const char* key;
|
||||
const char* value;
|
||||
} FFCodecDefault;
|
||||
|
||||
typedef struct FFCodec {
|
||||
/**
|
||||
* The public AVCodec. See codec.h for it.
|
||||
*/
|
||||
AVCodec p;
|
||||
|
||||
/**
|
||||
* Internal codec capabilities FF_CODEC_CAP_*.
|
||||
*/
|
||||
unsigned caps_internal : 29;
|
||||
|
||||
/**
|
||||
* This field determines the type of the codec (decoder/encoder)
|
||||
* and also the exact callback cb implemented by the codec.
|
||||
* cb_type uses enum FFCodecType values.
|
||||
*/
|
||||
unsigned cb_type : 3;
|
||||
|
||||
int priv_data_size;
|
||||
/**
|
||||
* @name Frame-level threading support functions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* Copy necessary context variables from a previous thread context to the current one.
|
||||
* If not defined, the next thread will start automatically; otherwise, the codec
|
||||
* must call ff_thread_finish_setup().
|
||||
*
|
||||
* dst and src will (rarely) point to the same context, in which case memcpy should be skipped.
|
||||
*/
|
||||
int (*update_thread_context)(struct AVCodecContext* dst, const struct AVCodecContext* src);
|
||||
|
||||
/**
|
||||
* Copy variables back to the user-facing context
|
||||
*/
|
||||
int (*update_thread_context_for_user)(struct AVCodecContext* dst,
|
||||
const struct AVCodecContext* src);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Private codec-specific defaults.
|
||||
*/
|
||||
const FFCodecDefault* defaults;
|
||||
|
||||
/**
|
||||
* Initialize codec static data, called from av_codec_iterate().
|
||||
*
|
||||
* This is not intended for time consuming operations as it is
|
||||
* run for every codec regardless of that codec being used.
|
||||
*/
|
||||
void (*init_static_data)(struct FFCodec* codec);
|
||||
|
||||
int (*init)(struct AVCodecContext*);
|
||||
|
||||
union {
|
||||
/**
|
||||
* Decode to an AVFrame.
|
||||
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_DECODE.
|
||||
*
|
||||
* @param avctx codec context
|
||||
* @param[out] frame AVFrame for output
|
||||
* @param[out] got_frame_ptr decoder sets to 0 or 1 to indicate that
|
||||
* a non-empty frame was returned in frame.
|
||||
* @param[in] avpkt AVPacket containing the data to be decoded
|
||||
* @return amount of bytes read from the packet on success,
|
||||
* negative error code on failure
|
||||
*/
|
||||
int (*decode)(struct AVCodecContext* avctx, struct AVFrame* frame, int* got_frame_ptr,
|
||||
struct AVPacket* avpkt);
|
||||
/**
|
||||
* Decode subtitle data to an AVSubtitle.
|
||||
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_DECODE_SUB.
|
||||
*
|
||||
* Apart from that this is like the decode callback.
|
||||
*/
|
||||
int (*decode_sub)(struct AVCodecContext* avctx, struct AVSubtitle* sub, int* got_frame_ptr,
|
||||
const struct AVPacket* avpkt);
|
||||
/**
|
||||
* Decode API with decoupled packet/frame dataflow.
|
||||
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_FRAME.
|
||||
*
|
||||
* This function is called to get one output frame. It should call
|
||||
* ff_decode_get_packet() to obtain input data.
|
||||
*/
|
||||
int (*receive_frame)(struct AVCodecContext* avctx, struct AVFrame* frame);
|
||||
/**
|
||||
* Encode data to an AVPacket.
|
||||
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_ENCODE
|
||||
*
|
||||
* @param avctx codec context
|
||||
* @param[out] avpkt output AVPacket
|
||||
* @param[in] frame AVFrame containing the input to be encoded
|
||||
* @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a
|
||||
* non-empty packet was returned in avpkt.
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
int (*encode)(struct AVCodecContext* avctx, struct AVPacket* avpkt,
|
||||
const struct AVFrame* frame, int* got_packet_ptr);
|
||||
/**
|
||||
* Encode subtitles to a raw buffer.
|
||||
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_ENCODE_SUB.
|
||||
*/
|
||||
int (*encode_sub)(struct AVCodecContext* avctx, uint8_t* buf, int buf_size,
|
||||
const struct AVSubtitle* sub);
|
||||
/**
|
||||
* Encode API with decoupled frame/packet dataflow.
|
||||
* cb is in this state if cb_type is FF_CODEC_CB_TYPE_RECEIVE_PACKET.
|
||||
*
|
||||
* This function is called to get one output packet.
|
||||
* It should call ff_encode_get_frame() to obtain input data.
|
||||
*/
|
||||
int (*receive_packet)(struct AVCodecContext* avctx, struct AVPacket* avpkt);
|
||||
} cb;
|
||||
|
||||
int (*close)(struct AVCodecContext*);
|
||||
|
||||
/**
|
||||
* Flush buffers.
|
||||
* Will be called when seeking
|
||||
*/
|
||||
void (*flush)(struct AVCodecContext*);
|
||||
|
||||
/**
|
||||
* Decoding only, a comma-separated list of bitstream filters to apply to
|
||||
* packets before decoding.
|
||||
*/
|
||||
const char* bsfs;
|
||||
|
||||
/**
|
||||
* Array of pointers to hardware configurations supported by the codec,
|
||||
* or NULL if no hardware supported. The array is terminated by a NULL
|
||||
* pointer.
|
||||
*
|
||||
* The user can only access this field via avcodec_get_hw_config().
|
||||
*/
|
||||
const struct AVCodecHWConfigInternal* const* hw_configs;
|
||||
|
||||
/**
|
||||
* List of supported codec_tags, terminated by FF_CODEC_TAGS_END.
|
||||
*/
|
||||
const uint32_t* codec_tags;
|
||||
} FFCodec;
|
||||
|
||||
static av_always_inline const FFCodec* ffcodec(const AVCodec* codec) {
|
||||
return (const FFCodec*)codec;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool DecoderContext::SendPacket(const Packet& packet) {
|
||||
m_temp_frame = std::make_shared<Frame>();
|
||||
m_got_frame = 0;
|
||||
|
||||
// Android can randomly crash when calling decode directly, so skip.
|
||||
// TODO update ffmpeg and hope that fixes it.
|
||||
#ifndef ANDROID
|
||||
if (!m_codec_context->hw_device_ctx && m_codec_context->codec_id == AV_CODEC_ID_H264) {
|
||||
m_decode_order = true;
|
||||
auto* codec{ffcodec(m_decoder.GetCodec())};
|
||||
if (const int ret = codec->cb.decode(m_codec_context, m_temp_frame->GetFrame(),
|
||||
&m_got_frame, packet.GetPacket());
|
||||
ret < 0) {
|
||||
LOG_DEBUG(Service_NVDRV, "avcodec_send_packet error {}", AVError(ret));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (const int ret = avcodec_send_packet(m_codec_context, packet.GetPacket()); ret < 0) {
|
||||
if (const int ret = avcodec_send_packet(m_codec_context, packet.GetPacket()); ret < 0 && ret != AVERROR_EOF && ret != AVERROR(EAGAIN)) {
|
||||
LOG_ERROR(HW_GPU, "avcodec_send_packet error: {}", AVError(ret));
|
||||
return false;
|
||||
}
|
||||
|
|
@ -406,69 +239,31 @@ bool DecoderContext::SendPacket(const Packet& packet) {
|
|||
}
|
||||
|
||||
std::shared_ptr<Frame> DecoderContext::ReceiveFrame() {
|
||||
// Android can randomly crash when calling decode directly, so skip.
|
||||
// TODO update ffmpeg and hope that fixes it.
|
||||
#ifndef ANDROID
|
||||
if (!m_codec_context->hw_device_ctx && m_codec_context->codec_id == AV_CODEC_ID_H264) {
|
||||
m_decode_order = true;
|
||||
auto* codec{ffcodec(m_decoder.GetCodec())};
|
||||
int ret{0};
|
||||
|
||||
if (m_got_frame == 0) {
|
||||
Packet packet{{}};
|
||||
auto* pkt = packet.GetPacket();
|
||||
pkt->data = nullptr;
|
||||
pkt->size = 0;
|
||||
ret = codec->cb.decode(m_codec_context, m_temp_frame->GetFrame(), &m_got_frame, pkt);
|
||||
m_codec_context->has_b_frames = 0;
|
||||
auto ReceiveImpl = [&](AVFrame* frame) -> int {
|
||||
const int ret = avcodec_receive_frame(m_codec_context, frame);
|
||||
if (ret < 0 && ret != AVERROR_EOF && ret != AVERROR(EAGAIN)) {
|
||||
LOG_ERROR(HW_GPU, "avcodec_receive_frame error: {}", AVError(ret));
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
if (m_got_frame == 0 || ret < 0) {
|
||||
LOG_ERROR(Service_NVDRV, "Failed to receive a frame! error {}", ret);
|
||||
return {};
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
||||
const auto ReceiveImpl = [&](AVFrame* frame) {
|
||||
if (const int ret = avcodec_receive_frame(m_codec_context, frame); ret < 0) {
|
||||
LOG_ERROR(HW_GPU, "avcodec_receive_frame error: {}", AVError(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
if (m_codec_context->hw_device_ctx) {
|
||||
// If we have a hardware context, make a separate frame here to receive the
|
||||
// hardware result before sending it to the output.
|
||||
Frame intermediate_frame;
|
||||
|
||||
if (!ReceiveImpl(intermediate_frame.GetFrame())) {
|
||||
return {};
|
||||
}
|
||||
|
||||
m_temp_frame->SetFormat(PreferredGpuFormat);
|
||||
if (const int ret = av_hwframe_transfer_data(m_temp_frame->GetFrame(),
|
||||
intermediate_frame.GetFrame(), 0);
|
||||
ret < 0) {
|
||||
LOG_ERROR(HW_GPU, "av_hwframe_transfer_data error: {}", AVError(ret));
|
||||
return {};
|
||||
}
|
||||
} else {
|
||||
// Otherwise, decode the frame as normal.
|
||||
if (!ReceiveImpl(m_temp_frame->GetFrame())) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
std::shared_ptr<Frame> intermediate_frame = std::make_shared<Frame>();
|
||||
if (ReceiveImpl(intermediate_frame->GetFrame()) < 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
#if defined(FF_API_INTERLACED_FRAME) || LIBAVUTIL_VERSION_MAJOR >= 59
|
||||
m_temp_frame->GetFrame()->interlaced_frame =
|
||||
(m_temp_frame->GetFrame()->flags & AV_FRAME_FLAG_INTERLACED) != 0;
|
||||
#endif
|
||||
return std::move(m_temp_frame);
|
||||
m_final_frame = std::make_shared<Frame>();
|
||||
if (m_codec_context->hw_device_ctx) {
|
||||
m_final_frame->SetFormat(PreferredGpuFormat);
|
||||
if (const int ret = av_hwframe_transfer_data(m_final_frame->GetFrame(), intermediate_frame->GetFrame(), 0); ret < 0) {
|
||||
LOG_ERROR(HW_GPU, "av_hwframe_transfer_data error: {}", AVError(ret));
|
||||
return {};
|
||||
}
|
||||
} else {
|
||||
m_final_frame = std::move(intermediate_frame);
|
||||
}
|
||||
|
||||
return std::move(m_final_frame);
|
||||
}
|
||||
|
||||
void DecodeApi::Reset() {
|
||||
|
|
@ -507,4 +302,4 @@ std::shared_ptr<Frame> DecodeApi::ReceiveFrame() {
|
|||
return m_decoder_context->ReceiveFrame();
|
||||
}
|
||||
|
||||
} // namespace FFmpeg
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavutil/opt.h>
|
||||
#ifndef ANDROID
|
||||
#include <libavcodec/codec.h>
|
||||
#endif
|
||||
#include <libavutil/opt.h>
|
||||
#include <libavutil/pixdesc.h>
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
@ -106,7 +105,11 @@ public:
|
|||
}
|
||||
|
||||
bool IsInterlaced() const {
|
||||
return m_frame->interlaced_frame != 0;
|
||||
#if defined(FF_API_INTERLACED_FRAME) || LIBAVUTIL_VERSION_MAJOR >= 59
|
||||
return m_frame->flags & AV_FRAME_FLAG_INTERLACED;
|
||||
#else
|
||||
return m_frame->interlaced_frame;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsHardwareDecoded() const {
|
||||
|
|
@ -188,8 +191,7 @@ public:
|
|||
private:
|
||||
const Decoder& m_decoder;
|
||||
AVCodecContext* m_codec_context{};
|
||||
s32 m_got_frame{};
|
||||
std::shared_ptr<Frame> m_temp_frame{};
|
||||
std::shared_ptr<Frame> m_final_frame{};
|
||||
bool m_decode_order{};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,10 +34,6 @@ void Nvdec::ProcessMethod(u32 method, u32 argument) {
|
|||
CreateDecoder(static_cast<NvdecCommon::VideoCodec>(argument));
|
||||
break;
|
||||
case NVDEC_REG_INDEX(execute): {
|
||||
if (wait_needed) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(32));
|
||||
wait_needed = false;
|
||||
}
|
||||
Execute();
|
||||
} break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@ public:
|
|||
return syncpoint;
|
||||
}
|
||||
|
||||
void SetWait() {
|
||||
wait_needed = true;
|
||||
}
|
||||
|
||||
private:
|
||||
/// Create the decoder when the codec id is set
|
||||
void CreateDecoder(NvdecCommon::VideoCodec codec);
|
||||
|
|
@ -45,7 +41,6 @@ private:
|
|||
|
||||
NvdecCommon::NvdecRegisters regs{};
|
||||
std::unique_ptr<Decoder> decoder;
|
||||
bool wait_needed{false};
|
||||
};
|
||||
|
||||
} // namespace Host1x
|
||||
|
|
|
|||
|
|
@ -1003,8 +1003,8 @@ void Vic::WriteY8__V8U8_N420(const OutputSurfaceConfig& output_surface_config) {
|
|||
HW_GPU,
|
||||
"Writing Y8__V8U8_N420 swizzled frame\n"
|
||||
"\tinput surface {}x{} stride {} size {:#X}\n"
|
||||
"\toutput luma {}x{} stride {} size {:#X} block height {} swizzled size 0x{:X}\n",
|
||||
"\toutput chroma {}x{} stride {} size {:#X} block height {} swizzled size 0x{:X}",
|
||||
"\toutput luma {}x{} stride {} size {:#X} block height {} swizzled size {:#X}\n",
|
||||
"\toutput chroma {}x{} stride {} size {:#X} block height {} swizzled size {:#X}",
|
||||
surface_width, surface_height, surface_stride * BytesPerPixel,
|
||||
surface_stride * surface_height * BytesPerPixel, out_luma_width, out_luma_height,
|
||||
out_luma_stride, out_luma_size, block_height, out_luma_swizzle_size, out_chroma_width,
|
||||
|
|
@ -1045,8 +1045,8 @@ void Vic::WriteY8__V8U8_N420(const OutputSurfaceConfig& output_surface_config) {
|
|||
HW_GPU,
|
||||
"Writing Y8__V8U8_N420 swizzled frame\n"
|
||||
"\tinput surface {}x{} stride {} size {:#X}\n"
|
||||
"\toutput luma {}x{} stride {} size {:#X} block height {} swizzled size 0x{:X}\n",
|
||||
"\toutput chroma {}x{} stride {} size {:#X} block height {} swizzled size 0x{:X}",
|
||||
"\toutput luma {}x{} stride {} size {:#X} block height {} swizzled size {:#X}\n",
|
||||
"\toutput chroma {}x{} stride {} size {:#X} block height {} swizzled size {:#X}",
|
||||
surface_width, surface_height, surface_stride * BytesPerPixel,
|
||||
surface_stride * surface_height * BytesPerPixel, out_luma_width, out_luma_height,
|
||||
out_luma_stride, out_luma_size, out_chroma_width, out_chroma_height, out_chroma_stride,
|
||||
|
|
@ -1216,7 +1216,7 @@ void Vic::WriteABGR(const OutputSurfaceConfig& output_surface_config) {
|
|||
HW_GPU,
|
||||
"Writing ABGR swizzled frame\n"
|
||||
"\tinput surface {}x{} stride {} size {:#X}\n"
|
||||
"\toutput surface {}x{} stride {} size {:#X} block height {} swizzled size 0x{:X}",
|
||||
"\toutput surface {}x{} stride {} size {:#X} block height {} swizzled size {:#X}",
|
||||
surface_width, surface_height, surface_stride * BytesPerPixel,
|
||||
surface_stride * surface_height * BytesPerPixel, out_luma_width, out_luma_height,
|
||||
out_luma_stride, out_luma_size, block_height, out_swizzle_size);
|
||||
|
|
|
|||
|
|
@ -569,7 +569,7 @@ bool MacroJITx64Impl::Compile_NextInstruction() {
|
|||
|
||||
static void WarnInvalidParameter(uintptr_t parameter, uintptr_t max_parameter) {
|
||||
LOG_CRITICAL(HW_GPU,
|
||||
"Macro JIT: invalid parameter access 0x{:x} (0x{:x} is the last parameter)",
|
||||
"Macro JIT: invalid parameter access {:#x} ({:#x} is the last parameter)",
|
||||
parameter, max_parameter - sizeof(u32));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ Buffer::Buffer(BufferCacheRuntime& runtime, DAddr cpu_addr_, u64 size_bytes_)
|
|||
: VideoCommon::BufferBase(cpu_addr_, size_bytes_) {
|
||||
buffer.Create();
|
||||
if (runtime.device.HasDebuggingToolAttached()) {
|
||||
const std::string name = fmt::format("Buffer 0x{:x}", CpuAddr());
|
||||
const std::string name = fmt::format("Buffer {:#x}", CpuAddr());
|
||||
glObjectLabel(GL_BUFFER, buffer.handle, static_cast<GLsizei>(name.size()), name.data());
|
||||
}
|
||||
glNamedBufferData(buffer.handle, SizeBytes(), nullptr, GL_DYNAMIC_DRAW);
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ OGLTexture MakeImage(const VideoCommon::ImageInfo& info, GLenum gl_internal_form
|
|||
ASSERT(false);
|
||||
break;
|
||||
default:
|
||||
ASSERT_MSG(false, "Invalid target=0x{:x}", target);
|
||||
ASSERT_MSG(false, "Invalid target={:#x}", target);
|
||||
break;
|
||||
}
|
||||
return texture;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ Buffer::Buffer(BufferCacheRuntime& runtime, DAddr cpu_addr_, u64 size_bytes_)
|
|||
: VideoCommon::BufferBase(cpu_addr_, size_bytes_), device{&runtime.device},
|
||||
buffer{CreateBuffer(*device, runtime.memory_allocator, SizeBytes())}, tracker{SizeBytes()} {
|
||||
if (runtime.device.HasDebuggingToolAttached()) {
|
||||
buffer.SetObjectNameEXT(fmt::format("Buffer 0x{:x}", CpuAddr()).c_str());
|
||||
buffer.SetObjectNameEXT(fmt::format("Buffer {:#x}", CpuAddr()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,15 +40,15 @@ std::string Name(const ImageBase& image) {
|
|||
}
|
||||
switch (image.info.type) {
|
||||
case ImageType::e1D:
|
||||
return fmt::format("Image 1D 0x{:x} {}{}", gpu_addr, width, resource);
|
||||
return fmt::format("Image 1D {:#x} {}{}", gpu_addr, width, resource);
|
||||
case ImageType::e2D:
|
||||
return fmt::format("Image 2D 0x{:x} {}x{}{}", gpu_addr, width, height, resource);
|
||||
return fmt::format("Image 2D {:#x} {}x{}{}", gpu_addr, width, height, resource);
|
||||
case ImageType::e3D:
|
||||
return fmt::format("Image 2D 0x{:x} {}x{}x{}{}", gpu_addr, width, height, depth, resource);
|
||||
return fmt::format("Image 2D {:#x} {}x{}x{}{}", gpu_addr, width, height, depth, resource);
|
||||
case ImageType::Linear:
|
||||
return fmt::format("Image Linear 0x{:x} {}x{}", gpu_addr, width, height);
|
||||
return fmt::format("Image Linear {:#x} {}x{}", gpu_addr, width, height);
|
||||
case ImageType::Buffer:
|
||||
return fmt::format("Buffer 0x{:x} {}", image.gpu_addr, image.info.size.width);
|
||||
return fmt::format("Buffer {:#x} {}", image.gpu_addr, image.info.size.width);
|
||||
}
|
||||
return "Invalid";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1373,7 +1373,7 @@ ImageId TextureCache<P>::InsertImage(const ImageInfo& info, GPUVAddr gpu_addr,
|
|||
cpu_addr = std::optional<DAddr>(fake_addr);
|
||||
}
|
||||
}
|
||||
ASSERT_MSG(cpu_addr, "Tried to insert an image to an invalid gpu_addr=0x{:x}", gpu_addr);
|
||||
ASSERT_MSG(cpu_addr, "Tried to insert an image to an invalid gpu_addr={:#x}", gpu_addr);
|
||||
const ImageId image_id = JoinImages(info, gpu_addr, *cpu_addr);
|
||||
const Image& image = slot_images[image_id];
|
||||
// Using "image.gpu_addr" instead of "gpu_addr" is important because it might be different
|
||||
|
|
@ -2047,13 +2047,13 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
|
|||
selected_page_table) {
|
||||
const auto page_it = selected_page_table.find(page);
|
||||
if (page_it == selected_page_table.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS);
|
||||
ASSERT_MSG(false, "Unregistering unregistered page={:#x}", page << YUZU_PAGEBITS);
|
||||
return;
|
||||
}
|
||||
std::vector<ImageId>& image_ids = page_it->second;
|
||||
const auto vector_it = std::ranges::find(image_ids, image_id);
|
||||
if (vector_it == image_ids.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered image in page=0x{:x}",
|
||||
ASSERT_MSG(false, "Unregistering unregistered image in page={:#x}",
|
||||
page << YUZU_PAGEBITS);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2067,13 +2067,13 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
|
|||
ForEachCPUPage(image.cpu_addr, image.guest_size_bytes, [this, map_id](u64 page) {
|
||||
const auto page_it = page_table.find(page);
|
||||
if (page_it == page_table.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS);
|
||||
ASSERT_MSG(false, "Unregistering unregistered page={:#x}", page << YUZU_PAGEBITS);
|
||||
return;
|
||||
}
|
||||
std::vector<ImageMapId>& image_map_ids = page_it->second;
|
||||
const auto vector_it = std::ranges::find(image_map_ids, map_id);
|
||||
if (vector_it == image_map_ids.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered image in page=0x{:x}",
|
||||
ASSERT_MSG(false, "Unregistering unregistered image in page={:#x}",
|
||||
page << YUZU_PAGEBITS);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2095,7 +2095,7 @@ void TextureCache<P>::UnregisterImage(ImageId image_id) {
|
|||
ForEachCPUPage(cpu_addr, size, [this, image_id](u64 page) {
|
||||
const auto page_it = page_table.find(page);
|
||||
if (page_it == page_table.end()) {
|
||||
ASSERT_MSG(false, "Unregistering unregistered page=0x{:x}", page << YUZU_PAGEBITS);
|
||||
ASSERT_MSG(false, "Unregistering unregistered page={:#x}", page << YUZU_PAGEBITS);
|
||||
return;
|
||||
}
|
||||
std::vector<ImageMapId>& image_map_ids = page_it->second;
|
||||
|
|
@ -2183,7 +2183,7 @@ void TextureCache<P>::DeleteImage(ImageId image_id, bool immediate_delete) {
|
|||
const GPUVAddr gpu_addr = image.gpu_addr;
|
||||
const auto alloc_it = image_allocs_table.find(gpu_addr);
|
||||
if (alloc_it == image_allocs_table.end()) {
|
||||
ASSERT_MSG(false, "Trying to delete an image alloc that does not exist in address 0x{:x}",
|
||||
ASSERT_MSG(false, "Trying to delete an image alloc that does not exist in address {:#x}",
|
||||
gpu_addr);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue