From d0497ab094cd97f91bd68cb37d9e4fd563513b3d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 4 Jan 2024 00:21:46 -0600 Subject: [PATCH] Use the new VAAPI dummy image support for kmsgrab too --- src/platform/linux/kmsgrab.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/platform/linux/kmsgrab.cpp b/src/platform/linux/kmsgrab.cpp index 4e5d8af89be..8b9780ae068 100644 --- a/src/platform/linux/kmsgrab.cpp +++ b/src/platform/linux/kmsgrab.cpp @@ -874,6 +874,8 @@ namespace platf { alloc_img() override { auto img = std::make_shared(); + img->width = width; + img->height = height; img->serial = std::numeric_limitsserial)>::max(); img->data = nullptr; img->pixel_pitch = 4; @@ -886,16 +888,8 @@ namespace platf { int dummy_img(platf::img_t *img) override { - // TODO: stop cheating and give black image - if (!img) { - return -1; - }; - auto pull_dummy_img_callback = [&img](std::shared_ptr &img_out) -> bool { - img_out = img->shared_from_this(); - return true; - }; - std::shared_ptr img_out; - return snapshot(pull_dummy_img_callback, img_out, 1s, false) != platf::capture_e::ok; + // Empty images are recognized as dummies by the zero sequence number + return 0; } capture_e @@ -988,12 +982,10 @@ namespace platf { return -1; } - sequence = 0; - return 0; } - std::uint64_t sequence; + std::uint64_t sequence {}; }; } // namespace kms