From a38efdb05a71687d09175b8409e0ce4e3baeeac3 Mon Sep 17 00:00:00 2001 From: milescoviello Date: Mon, 26 Oct 2026 21:10:00 +0000 Subject: [PATCH] test(libSceVideodec2): cover the compute memory query and compute queue allocation Co-Authored-By: Claude Opus 5.5 --- core/libs/tests/GuestVideodec2.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/libs/tests/GuestVideodec2.cpp b/core/libs/tests/GuestVideodec2.cpp index f6caa14b4b..6ce019fea9 100644 --- a/core/libs/tests/GuestVideodec2.cpp +++ b/core/libs/tests/GuestVideodec2.cpp @@ -753,8 +753,24 @@ void testConcurrentOwnership() { } +void testComputeQueues() { + SceVideodec2::ComputeMemoryInfo memory{sizeof(SceVideodec2::ComputeMemoryInfo), 0, nullptr}; + checkThrows([] { sceVideodec2QueryComputeMemoryInfo_nid_postfix(nullptr); }); + check(sceVideodec2QueryComputeMemoryInfo_nid_postfix(&memory) == 0 && memory.cpuGpuMemorySize == (1u << 20u), "the compute work memory is not 1 MiB"); + const SceVideodec2::ComputeConfigInfo config{sizeof(SceVideodec2::ComputeConfigInfo), 0, 0, false}; + std::uint64_t first = 0; + std::uint64_t second = 0; + checkThrows([&] { sceVideodec2AllocateComputeQueue_nid_postfix(nullptr, &memory, &first); }); + checkThrows([&] { sceVideodec2AllocateComputeQueue_nid_postfix(&config, nullptr, &first); }); + checkThrows([&] { sceVideodec2AllocateComputeQueue_nid_postfix(&config, &memory, nullptr); }); + check(first == 0, "a rejected allocation wrote a queue"); + check(sceVideodec2AllocateComputeQueue_nid_postfix(&config, &memory, &first) == 0 && first != 0, "the first compute queue was not allocated"); + check(sceVideodec2AllocateComputeQueue_nid_postfix(&config, &memory, &second) == 0 && second != 0 && second != first, "a second compute queue repeats the first"); +} + int main() { try { + testComputeQueues(); testFailures(); testDecode(false); testDecode(true);