I am writing a program in which I need to access an X11 window’s pixel data as efficiently as possible, ideally over shared memory, without needing to make XCB calls every time I want to refresh the pixel data. It’s a similar idea as Xvfb
‘s -shmem
option, but I want to access per-window pixel data over shared memory, rather than the entire screen.
I can configure the X server in whatever way helps with this.
I am aware of the XShm and XComposite extensions. From what I can see, they each do only one half of what I need:
- The XComposite extension moves the window pixel data to an offscreen buffer that holds the pixel data.
- The XShm extension allows creating shared memory regions and pixmaps that can be updated from existing windows (but only on demand, and requiring memory copying, as far as I can tell).
Can I somehow combine these two extensions such that I can directly access the window pixel data from my own application, without needing to continuously ask the X server to copy pixel data?