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.88k stars 163 forks source link

ms windows shadow server improvements #389

Open totaam opened 11 years ago

totaam commented 11 years ago

The current shadow server for win32 sort of works but we need to improve:

totaam commented 11 years ago

Screenscraping may be the only feasible way to get 3D apps to work: Since the hardware-accelerated 3D rendering commands typically bypass the GDI layer, most screen scrapers (WinVNC, LiveMeeting, GoToMeeting, etc.) cannot pick up the 3D rendering area of Windows applications, or they will not detect when the 3D area has been updated.

(from DRC @virtualgl-users)

totaam commented 9 years ago

Some fixes:

totaam commented 9 years ago

Generic Window API links:

Window Event Hooks:

Example code:

totaam commented 9 years ago

r10002 uses Pillow's ImageGrab module to capture the screen on win32, which is already much faster.

It is still quite slow: timeit clocks it at about 100ms for 1080p on a mid-range system, which is a lot better than GTK, but has room for improvement:

Some links:

totaam commented 9 years ago

The code in r10002 only captured one screen, this is fixed in r10026, see #637#comment:11 for details. Will backport.

r10028 should help speed things up a bit by re-using the same bitmap and context objects until the display settings change. But this is still not good enough: it takes about 100ms for copying 4 megapixels (2 x 1080p screens). About 65% of this time is spent in BitBlt, and the rest is in GetBitmapBits. The BitBlt performance with Aero enabled is just poor. Disabling aero is a temporary workaround.

We want to stay on the GPU if we can (#365), especially if we're going to use the GPU for encoding (ie: nvenc) - the difference is in the order of a factor 100!

More info:

This will have to do for now. (nvenc needs fixing first anyway... see #389)

totaam commented 8 years ago

r11482 added a basic systray for the shadow server which only shows: "about", "exit" and "close menu".

totaam commented 8 years ago

2015-12-27 08:11:04: antoine uploaded file namedpipes.patch (12.7 KiB)

work in progress named pipes support

totaam commented 8 years ago

Moving the named pipes to #1150.

totaam commented 8 years ago

Keyboard issues in #1099.

Stumbled upon this info python-win32: Global Window Messages: What you probably want is a WH_CBT hook so that you can catch WM_ACTIVATE and WM_DEACTIVATE. There is some code that does something similar in pyAA apparently.

totaam commented 8 years ago

See my original question to python-win32 mailing list: https://mail.python.org/pipermail/python-win32/2009-September/009584.html And Win32 WH_CBT Hook - close window before it is created, WH_CBT hook, using SetWindowsHookEx to monitor windows events, KeyboardHookProc in DLL doesn't do anything when called from python

This is going to take some effort and will require Windows 8 or later and probably building things with MSVC 2013 (not the "free" express version..) for the newer API: IDXGIOutputDuplication: The IDXGIOutputDuplication interface accesses and manipulates the duplicated desktop image.

Printing may be possible using redmon: The RedMon port monitor redirects a special printer port to a program

totaam commented 8 years ago

For sound see: wasapisink

r12394 will use directsoundsrc by default for win32 shadow servers

totaam commented 8 years ago

2016-05-22 12:20:35: antoine commented


  • r12647 should fix sound shadowing on win32 (untested - virtualbox is having a fit)
  • r12707 (skip warnings)
totaam commented 8 years ago

2016-06-17 10:16:22: antoine commented


totaam commented 8 years ago

2016-06-17 14:28:41: antoine commented


r12850 disables composition on vista and later, r12852 + r12853 + r12854 improve error handling - which fires a lot more with vista onwards when the UAC prompt shows up.

totaam commented 7 years ago

A good solution for solving shadow performance issues is #1317 (requires an nvidia card...)

totaam commented 7 years ago

If we go down the directx route, with mingw #678 these may be helpful / needed:

So, by injecting the DLL into every process, we could get individual windows as surfaces.

If we are willing to require windows 8 or later, the solution is likely to be the Desktop Duplication API:

Some links on the logon stuff, which we need for running as a service:

For audio:

totaam commented 7 years ago

Added basic NVIDIA Capture SDK support using basic "copy to system memory" API. Screen capturing + downloading to system RAM at 4K takes less than 30ms, so we should be able to do 30fps at 4K (given enough bandwidth / fast encoder).

Much more can be done with this API:

totaam commented 7 years ago

Minor updates in r15727 + r15730. Helped uncover a core imagewrapper bug: r15728.

The NVFBC progress should now be tracked here: #1317.

totaam commented 7 years ago

Some scripts that could be useful - and not just for shadow servers:

Now for making a service:

totaam commented 6 years ago

Moving the system service to #1527.

Python3 #1568 is making progress, this may help.

totaam commented 6 years ago

For capturing the screen with directx, a good example is found in the gstreamer source: winscreencap.

See also multi-monitor handling as windows: #1805

totaam commented 5 years ago

NVFBC is now deprecated on windows-10: #1317#comment:11.

DDA example: nvEncDXGIOutputDuplicationSample

totaam commented 4 years ago

Links:

See also:

totaam commented 1 year ago

Windows 10 Screen capture example code looks simple enough. Using Windows.Graphics.Capture from a Cython C / C++ context will be harder.