Use the new VAAPI dummy image support for kmsgrab too

This commit is contained in:
Cameron Gutman 2024-01-04 00:21:46 -06:00
parent ebe01ce20b
commit 0dff8b16fd

View File

@ -874,6 +874,8 @@ namespace platf {
alloc_img() override { alloc_img() override {
auto img = std::make_shared<egl::img_descriptor_t>(); auto img = std::make_shared<egl::img_descriptor_t>();
img->width = width;
img->height = height;
img->serial = std::numeric_limits<decltype(img->serial)>::max(); img->serial = std::numeric_limits<decltype(img->serial)>::max();
img->data = nullptr; img->data = nullptr;
img->pixel_pitch = 4; img->pixel_pitch = 4;
@ -886,16 +888,8 @@ namespace platf {
int int
dummy_img(platf::img_t *img) override { dummy_img(platf::img_t *img) override {
// TODO: stop cheating and give black image // Empty images are recognized as dummies by the zero sequence number
if (!img) { return 0;
return -1;
};
auto pull_dummy_img_callback = [&img](std::shared_ptr<platf::img_t> &img_out) -> bool {
img_out = img->shared_from_this();
return true;
};
std::shared_ptr<platf::img_t> img_out;
return snapshot(pull_dummy_img_callback, img_out, 1s, false) != platf::capture_e::ok;
} }
capture_e capture_e
@ -988,12 +982,10 @@ namespace platf {
return -1; return -1;
} }
sequence = 0;
return 0; return 0;
} }
std::uint64_t sequence; std::uint64_t sequence {};
}; };
} // namespace kms } // namespace kms