Skip to content

Improve performance of wayland screenshot #227

@nik-rev

Description

@nik-rev

Wayland screenshot is captured in src/linux/wayland_capture:

   let res = org_gnome_shell_screenshot(conn, x, y, width, height)
        .or_else(|e| {
            log::debug!("org_gnome_shell_screenshot failed {}", e);

            org_freedesktop_portal_screenshot(conn, x, y, width, height)
        })
        .or_else(|e| {
            log::debug!("org_freedesktop_portal_screenshot failed {}", e);
            wlroots_screenshot(x, y, width, height)
        });

I inserted these statements after each step:

println!("{:?}", now.elapsed());
  • A: gnome_shell
  • B: org_freedesktop_portal
  • C: wlroots

Currently, xcap will try A, if it fails try B, if it fails try C
These are the results for the screenshot capture time:

A: 7.63007ms
B: 1.453836723s
C: 1.453845008s

Step B takes an extremely long time which completely blocks Step C

I think what xcap should do instead is use some heuristics to determine which of A, B or C to use. Such as reading env variable

If heuristics does not work, then changing the order from A -> B -> C to C -> B -> A will help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions