Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate host latency for kms/x11 grab #2273

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/platform/linux/kmsgrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@
}

inline capture_e
refresh(file_t *file, egl::surface_descriptor_t *sd) {
refresh(file_t *file, egl::surface_descriptor_t *sd, std::optional<std::chrono::steady_clock::time_point> &frame_timestamp) {
// Check for a change in HDR metadata
if (connector_id) {
auto connector_props = card.connector_props(*connector_id);
Expand All @@ -1080,6 +1080,7 @@
}

plane_t plane = drmModeGetPlane(card.fd.el, plane_id);
frame_timestamp = std::chrono::steady_clock::now();

Check warning on line 1083 in src/platform/linux/kmsgrab.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/linux/kmsgrab.cpp#L1083

Added line #L1083 was not covered by tests

auto fb = card.fb(plane.get());
if (!fb) {
Expand Down Expand Up @@ -1303,7 +1304,8 @@

egl::surface_descriptor_t sd;

auto status = refresh(fb_fd, &sd);
std::optional<std::chrono::steady_clock::time_point> frame_timestamp;

Check warning on line 1307 in src/platform/linux/kmsgrab.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/linux/kmsgrab.cpp#L1307

Added line #L1307 was not covered by tests
auto status = refresh(fb_fd, &sd, frame_timestamp);
if (status != capture_e::ok) {
return status;
}
Expand All @@ -1330,6 +1332,8 @@

gl::ctx.GetTextureSubImage(rgb->tex[0], 0, img_offset_x, img_offset_y, 0, width, height, 1, GL_BGRA, GL_UNSIGNED_BYTE, img_out->height * img_out->row_pitch, img_out->data);

img_out->frame_timestamp = frame_timestamp;

Check warning on line 1335 in src/platform/linux/kmsgrab.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/linux/kmsgrab.cpp#L1335

Added line #L1335 was not covered by tests

if (cursor && captured_cursor.visible) {
blend_cursor(*img_out);
}
Expand Down Expand Up @@ -1456,7 +1460,7 @@
auto img = (egl::img_descriptor_t *) img_out.get();
img->reset();

auto status = refresh(fb_fd, &img->sd);
auto status = refresh(fb_fd, &img->sd, img->frame_timestamp);
if (status != capture_e::ok) {
return status;
}
Expand Down
1 change: 1 addition & 0 deletions src/platform/linux/x11grab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
auto img = (x11_img_t *) img_out.get();

XImage *x_img { x11::GetImage(xdisplay.get(), xwindow, offset_x, offset_y, width, height, AllPlanes, ZPixmap) };
img->frame_timestamp = std::chrono::steady_clock::now();

Check warning on line 538 in src/platform/linux/x11grab.cpp

View check run for this annotation

Codecov / codecov/patch

src/platform/linux/x11grab.cpp#L538

Added line #L538 was not covered by tests

img->width = x_img->width;
img->height = x_img->height;
Expand Down
Loading