Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.99k stars 169 forks source link

expand a desktop #3390

Open totaam opened 2 years ago

totaam commented 2 years ago

Taking advantage of #3320, make it possible to modify an existing "real" desktop session to add a new virtual output that we then shadow somewhere else, effectively expanding a desktop onto a remote output. Something like:

xpra expand :0,size=1920x1080 

Even better would be if we could do this from the client:

xpra expand ssh://host/0

And have the expanded area match that of the client's display. The client could run in full-screen mode from the start.

The are virtual adapters for most OSes: https://github.com/Xpra-org/xpra/issues/3320#issuecomment-996245905

totaam commented 2 years ago

The commit above adds a work in progress evdi capture codec, which requires these extra files to build on Fedora 34 which provides libevdi in fedora-multimedia, but no libevdi-devel:

$ more /usr/lib64/pkgconfig/evdi.pc 
prefix=/usr
libdir=${prefix}/lib64
includedir=${prefix}/include

Name: evdi
Description: Extensible Virtual Display Interface
Version: 1.10
Libs: -L${libdir} -levdi
Cflags: -I${includedir}

/usr/include/evdi_lib.h can just be copied from the evdi source.

It doesn't capture any pixel data and seems to hang my local X11 session for many seconds! Perhaps looking at what evdipp is doing would help? (their example does work - though not perfectly either..)

The evdi docs aren't very clear on the sequence of events needed to start capturing pixels.

Pre-requisite: modprobe evdi initial_device_count=2 as per Unable to add a VIRTUAL display to Xorg

totaam commented 2 years ago

Difficult to test when the latest release (many months ago) doesn't support the latest kernels.. https://github.com/displaylink-rpm/displaylink-rpm/releases

totaam commented 2 years ago

Using the glue commits above, here is the updated platform support.

totaam commented 2 years ago

Still TODO:

normanr commented 1 year ago

Did you figure out why it hangs the X11 server? When I tried it (over a year ago) I wondered if it might be that something in X11 is trying to callback into the application which is running with an X11 event loop (so causing a deadlock and eventually something times out).

totaam commented 1 year ago

@normanr perhaps, I just tried it now and have some new data points:

I don't have time to look into this further, which is a shame because this looks almost usable and extremely useful.

normanr commented 1 year ago

fwiw, I tried this recently and also discovered that it hung less. The evdipp example app didn't hang at all; only the monitorsim app did, and even then it was for a "shorter" time (15s maybe).

Doing it manually (with xrandr, etc) caused the messy screen, but using the example & monitorsim apps didn't have that issue. The monitorsim app even showed the pointer (even though xpra did not).

Setup: debian testing with Xorg 21.1.7 with evdi 1.12, I had to change evdipp/CMakeLists.txt GIT_TAG to v1.11.0 to get the example apps to run correctly.

normanr commented 1 year ago

fwiw, I did the above testing with xpra shadow. I've now also tried xpra expand, which seems to hang slightly longer/worse (I had to compile & install the evdi codec library for xpra v4.4.5 to get it to work). Oddly hangs seem to be triggered more when the cursor transitions into-or-outof of the virtual screen. I did manage to get the pointer to display by commenting out the call to enable_cursor_events() (which makes evdi compose the cursor into the framebuffer).

normanr commented 10 months ago

So I came across https://github.com/pavlobu/deskreen/discussions/86, and ended up trying https://dri.freedesktop.org/docs/drm/gpu/vkms.html and, although I had to enable and compile the kernel module, once it was loaded X11 detected the display and it just worked flawlessly. No hangs, no weirdness, it just worked. Gnome display settings could position it, and change the display resolution.

update: I spoke too soon. My laptop with Intel graphs worked flawlessly, but my desktop with Nvidia graphics doesn't init the vkms device properly and x11/gnome can't change the display resolution :-(

totaam commented 8 months ago

For Wayland desktops, there's also RecordVirtual: Record a virtual area that will be represented as a virtual monitor.