Xpra: Ticket #961: transparency support is broken with pixmap backing

Tested with opengl=no and various encodings as part of the testing for #937 and associated changes (in particular the new test code in r10409), the client still claims to support alpha and tells the server (with added debug):

HAS_ALPHA=True, properties={'encoding.transparency': False, 'encodings.rgb_formats': ('RGB', 'RGBX', 'RGBA'), \
    'encoding.full_csc_modes': {
        'h264': ('ARGB', 'BGRA', 'BGRX', 'GBRP', 'RGB', 'XRGB', 'YUV420P'), 'h265': ('GBRP', 'RGB', 'YUV420P'), \
        'vp9': ('YUV420P',), \
        'vp8': ('YUV420P',)}, 'encoding.csc_modes': ('BGRX', 'GBRP', 'RGB', 'YUV420P', 'BGRA', 'ARGB', 'XRGB') \
    }, supports_transparency=True

But the standard test scripts come up without transparency..

Sun, 23 Aug 2015 10:08:05 GMT - Antoine Martin: status, description changed

Bisected down:

So, the problem is from r8551 which synchronizes _NET_WM_BYPASS_COMPOSITOR. It looks innocuous... but it does call realize().

init_window(metadata) comes before setup_window(), and so it may realize the window before we have had a chance to set the colormap.

Sun, 23 Aug 2015 12:02:21 GMT - Antoine Martin:

In theory, something like this should fix it (delaying metadata init until after setup_window):

--- xpra/client/client_window_base.py	(revision 10395)
+++ xpra/client/client_window_base.py	(working copy)
@@ -49,6 +49,7 @@
+        self.update_metadata(metadata)
     def __repr__(self):
         return "ClientWindow(%s)" % self._id
@@ -68,7 +69,6 @@
         self._window_workspace = WORKSPACE_UNSET        #will get set in set_metadata if present
         self._desktop_workspace = self.get_desktop_workspace()
         workspacelog("init_window(..) workspace=%s, current workspace=%s", self._window_workspace, self._desktop_workspace)
-        self.update_metadata(metadata)
     def get_desktop_workspace(self):

But it doesn't... no idea why. Neither does turning off "bypass-compositor" syncing.. so another change must have the same effect. I even tried to turn off most of the handlers that call realize(), still no luck!

Sun, 23 Aug 2015 14:33:18 GMT - Antoine Martin: status changed; resolution set

Bisecting again, but connecting to a 0.14.x server, so that the "bypass-compositor" code doesn't fire and we can find the second transparency bug:

So the second bug is caused by r9977: which is now partially reverted in r10419. That fixes transparency when connecting to older servers. We now also skip unpremultiply if there is no alpha (which would do absolutely nothing useful), as is the case with csc modules giving us RGBX or with mmap giving us raw BGRX.

For newer servers, you also need r10420 which applies the patch from comment:2. The potential for regressions from this one is high...

And since I was re-ordering initialization code, I took it a step further and cleaned up the mess that was the realize() override and delayed properties (many attributes are in fact plain X11 properties that can only be set once the window is realized): see r10421. Again, the potential for regressions is higher than normal.

Sat, 23 Jan 2021 05:10:57 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/961