Send feedback packets when image is not blitted

This commit is contained in:
Patrick Nicolas
2024-02-03 17:51:49 +01:00
parent 6f29061ace
commit 1569051da4
+12 -3
View File
@@ -156,18 +156,21 @@ scenes::stream::~stream()
void scenes::stream::push_blit_handle(shard_accumulator * decoder, std::shared_ptr<shard_accumulator::blit_handle> handle) void scenes::stream::push_blit_handle(shard_accumulator * decoder, std::shared_ptr<shard_accumulator::blit_handle> handle)
{ {
std::unique_lock lock(decoder_mutex); std::shared_ptr<shard_accumulator::blit_handle> removed;
if (!application::is_visible()) if (!application::is_visible())
return; return;
{
std::unique_lock lock(decoder_mutex);
for (auto & i: decoders) for (auto & i: decoders)
{ {
if (i.decoder.get() == decoder) if (i.decoder.get() == decoder)
{ {
static_assert(std::tuple_size_v<decltype(i.latest_frames)> == 2); static_assert(std::tuple_size_v<decltype(i.latest_frames)> == 2);
std::swap(removed, i.latest_frames[0]);
std::swap(i.latest_frames[0], i.latest_frames[1]); std::swap(i.latest_frames[0], i.latest_frames[1]);
i.latest_frames[1] = handle; std::swap(i.latest_frames[1], handle);
break; break;
} }
} }
@@ -182,6 +185,12 @@ void scenes::stream::push_blit_handle(shard_accumulator * decoder, std::shared_p
} }
} }
if (removed and not removed->feedback.blitted)
{
send_feedback(removed->feedback);
}
}
std::vector<uint64_t> scenes::stream::accumulator_images::frames() const std::vector<uint64_t> scenes::stream::accumulator_images::frames() const
{ {
std::vector<uint64_t> result; std::vector<uint64_t> result;
@@ -304,7 +313,7 @@ void scenes::stream::render()
{ {
std::unique_lock lock(decoder_mutex); std::unique_lock lock(decoder_mutex);
// Search for the most recent frame available on all decoders. // Search for the most recent frame available on all decoders.
// If no such frame exists, use the most latest frame for each decoder // If no such frame exists, use the latest frame for each decoder
auto common_frame = accumulator_images::common_frame(decoders); auto common_frame = accumulator_images::common_frame(decoders);
// Blit images from the decoders // Blit images from the decoders
// TODO be smarter: group blits per eye, so that the framebuffer can use OP_DONT_CARE instead of OP_LOAD and use the same renderpass if possible // TODO be smarter: group blits per eye, so that the framebuffer can use OP_DONT_CARE instead of OP_LOAD and use the same renderpass if possible