Skip to content

Commit

Permalink
Use the new VAAPI dummy image support for kmsgrab too
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Jan 5, 2024
1 parent 54c36b8 commit d0497ab
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/platform/linux/kmsgrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,8 @@ namespace platf {
alloc_img() override {
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->data = nullptr;
img->pixel_pitch = 4;
Expand All @@ -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<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;
// Empty images are recognized as dummies by the zero sequence number
return 0;
}

capture_e
Expand Down Expand Up @@ -988,12 +982,10 @@ namespace platf {
return -1;
}

sequence = 0;

return 0;
}

std::uint64_t sequence;
std::uint64_t sequence {};
};

} // namespace kms
Expand Down

0 comments on commit d0497ab

Please sign in to comment.