Release swapchain earlier

Encoders now have a buffer for next image so that they can encode one
and the compositor write to an other one.
This commit is contained in:
Patrick Nicolas
2024-09-11 23:41:10 +02:00
parent 517b572c75
commit 7e8c479cc5
11 changed files with 311 additions and 253 deletions
+11 -7
View File
@@ -31,20 +31,24 @@ struct encoder_settings;
class video_encoder_va : public VideoEncoderFFMPEG
{
struct in_t
{
av_frame_ptr va_frame;
av_frame_ptr drm_frame;
vk::raii::Image luma = nullptr;
vk::raii::Image chroma = nullptr;
std::vector<vk::raii::DeviceMemory> mem;
};
av_buffer_ptr drm_frame_ctx;
av_frame_ptr va_frame;
av_frame_ptr drm_frame;
std::array<in_t, num_slots> in;
vk::Rect2D rect;
vk::raii::Image luma;
vk::raii::Image chroma;
std::vector<vk::raii::DeviceMemory> mem;
bool synchronization2 = false;
public:
video_encoder_va(wivrn_vk_bundle &, xrt::drivers::wivrn::encoder_settings & settings, float fps);
void PresentImage(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf) override;
void present_image(vk::Image y_cbcr, vk::raii::CommandBuffer & cmd_buf, uint8_t slot) override;
protected:
void PushFrame(bool idr, std::chrono::steady_clock::time_point pts) override;
void push_frame(bool idr, std::chrono::steady_clock::time_point pts, uint8_t slot) override;
};