Skip to content

Commit

Permalink
Capturing the visible framebuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkae committed Oct 17, 2023
1 parent e32d07e commit 6e1de44
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/platforms/eglstream-kms/server/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,15 @@ class DisplayBuffer

if (next_swap) // This is the KMS route
{
visible_fb = std::move(next_swap);
visible_fb = std::move(scheduled_fb);
scheduled_fb = nullptr;

scheduled_fb = std::move(next_swap);
next_swap = nullptr;
auto const predicted_render_time = 50ms; // Predicted worst case render time for the next frame...

output->queue_atomic_flip(*visible_fb, event_handler->drm_event_data());
output->queue_atomic_flip(*scheduled_fb, event_handler->drm_event_data());

auto const min_frame_interval = 1000ms / output->max_refresh_rate();
if (predicted_render_time < min_frame_interval)
recommend_sleep = min_frame_interval - predicted_render_time;
Expand Down Expand Up @@ -337,6 +341,7 @@ class DisplayBuffer

/// Used only for the KMS case
std::shared_ptr<mg::FBHandle const> next_swap{nullptr};
std::shared_ptr<mg::FBHandle const> scheduled_fb{nullptr};
std::shared_ptr<mg::FBHandle const> visible_fb{nullptr};
std::chrono::milliseconds recommend_sleep{0};
};
Expand Down

0 comments on commit 6e1de44

Please sign in to comment.