emersion / xdg-desktop-portal-wlr

xdg-desktop-portal backend for wlroots
MIT License
580 stars 54 forks source link

Get Zoom to work #226

Closed David96 closed 1 year ago

David96 commented 2 years ago

Found a workaround: https://github.com/David96/xdg-desktop-portal-wlr/commits/zoom-fix

Hey,

I'm not sure whether what I'm asking for makes sense at all since I can't claim to understand the whole DMABuf with modifiers/modifierless situation. So let me explain quickly my situation:

Since the last release Zoom kind of supports the Screencast API but sadly, nothing arrives at the screens of the participants when running with xdg-desktop-portal-wlr. I was able to confirm that Zoom runs into a ENOSYS when calling gbm_bo_import, probably this one: https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/gbm/backends/dri/gbm_dri.c#L1071 Now I don't quite understand how and why this happens but I think forcing it to modifierless DMABufs would result in a different code path without this error?

I played around a bit with build_modifierlist in pipewire_screencast.c but I'm not sure whether I actually got it to use a modifierless format.

Is there any possibility to add something similar to force_mod_linear, like force_modifierless?

Another reason I think the issue is related to modifiers is that iiuc gnome uses modifierless DMABufs and there Zoom seems to work correctly.

Best regards

columbarius commented 2 years ago

Hi,

DmaBuf trasnport works by negotiating a common format-modifier pair. xdpw shouldn't use a modifier which was not announced by the zoom client. To check this please provide a pw-dump after the screencast was initialized (you may want to remove the info of all unrelated nodes, I need just the Node and the Port information of xdpw and zoom).

Explicit modifiers are always better since we can't give any guarantee that the implicit one will work, but clients have to announce their capabilities correctly.

In the meantime you could use firefox, or a develpment version of chromium, since a current bug was fixed and it will be in the 105 release.

David96 commented 2 years ago

Hey, thanks for your help!

I think this is the relevant part of the dump:

``` [ { "id": 69, "type": "PipeWire:Interface:Node", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "max-input-ports": 0, "max-output-ports": 1, "change-mask": [ "input-ports", "output-ports", "state", "props", "params" ], "n-input-ports": 0, "n-output-ports": 1, "state": "running", "error": null, "props": { "media.class": "Video/Source", "media.name": "xdpw-stream-MBBPOO", "stream.is-live": true, "node.name": "xdg-desktop-portal-wlr", "node.driver": true, "node.want-driver": true, "client.id": 31, "object.id": 69, "object.serial": 72 }, "params": { "PropInfo": [ ], "Props": [ ] } } }, { "id": 70, "type": "PipeWire:Interface:Port", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "direction": "output", "change-mask": [ "props", "params" ], "props": { "port.id": 0, "port.direction": "out", "port.name": "out_0", "port.alias": "xdg-desktop-portal-wlr:out_0", "node.id": 69, "object.id": 70, "object.serial": 73 }, "params": { "EnumFormat": [ { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": { "default": 72057594037927935, "alt1": 72057594037927935, "alt2": 144115206333774337, "alt3": 144115206333774081, "alt4": 144115206333757697, "alt5": 144115188080056833, "alt6": 144115188080056577, "alt7": 144115188075858433, "alt8": 144115188075858177, "alt9": 0 }, "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "default": { "num": 20, "denom": 1 }, "min": { "num": 1, "denom": 1 }, "max": { "num": 20, "denom": 1 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBx", "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "default": { "num": 20, "denom": 1 }, "min": { "num": 1, "denom": 1 }, "max": { "num": 20, "denom": 1 } } } ], "Meta": [ { "type": "Busy", "size": 8 }, { "type": "Header", "size": 32 } ], "IO": [ { "id": "Buffers", "size": 8 } ], "Format": [ { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": 72057594037927935, "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "num": 20, "denom": 1 } } ], "Buffers": [ { "buffers": { "default": 2, "min": 2, "max": 32 }, "blocks": 1, "align": 16, "dataType": { "default": 8 } } ], "Latency": [ ] } } }, { "id": 71, "type": "PipeWire:Interface:Client", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "change-mask": [ "props" ], "props": { "pipewire.protocol": "protocol-native", "pipewire.sec.pid": 1356, "pipewire.sec.uid": 1000, "pipewire.sec.gid": 1000, "module.id": 2, "object.id": 71, "object.serial": 74, "pipewire.access.portal.app_id": "", "pipewire.access.portal.media_roles": "", "log.level": 0, "cpu.max-align": 32, "default.clock.rate": 48000, "default.clock.quantum": 1024, "default.clock.min-quantum": 32, "default.clock.max-quantum": 2048, "default.clock.quantum-limit": 8192, "default.video.width": 640, "default.video.height": 480, "default.video.rate.num": 25, "default.video.rate.denom": 1, "clock.power-of-two-quantum": true, "link.max-buffers": 64, "mem.warn-mlock": false, "mem.allow-mlock": true, "settings.check-quantum": false, "settings.check-rate": false, "application.name": "zoom", "application.process.binary": "zoom", "application.language": "en_GB.UTF-8", "application.process.id": 1508, "application.process.user": "iuser", "application.process.host": "arch64", "application.process.session-id": 1, "window.x11.display": ":0", "core.version": "0.3.54", "core.name": "pipewire-iuser-1508", "pipewire.access": "portal" } } }, { "id": 72, "type": "PipeWire:Interface:Node", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "max-input-ports": 1, "max-output-ports": 0, "change-mask": [ "input-ports", "output-ports", "state", "props", "params" ], "n-input-ports": 1, "n-output-ports": 0, "state": "running", "error": null, "props": { "media.type": "Video", "media.category": "Capture", "media.role": "Screen", "media.name": "zoom wayland pwstream", "stream.is-live": true, "node.name": "zoom", "node.target": 69, "node.autoconnect": true, "node.want-driver": true, "media.class": "Stream/Input/Video", "client.id": 71, "object.id": 72, "object.serial": 75 }, "params": { "PropInfo": [ ], "Props": [ ] } } }, { "id": 73, "type": "PipeWire:Interface:Port", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "direction": "input", "change-mask": [ "props", "params" ], "props": { "port.id": 0, "port.direction": "in", "port.name": "in_0", "port.alias": "zoom:in_0", "node.id": 72, "object.id": 73, "object.serial": 76 }, "params": { "EnumFormat": [ { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRA", "modifier": { "default": 144115206333774337, "alt1": 144115206333774337, "alt2": 144115206333774081, "alt3": 144115206333757697, "alt4": 144115188080056833, "alt5": 144115188080056577, "alt6": 144115188075858433, "alt7": 144115188075858177, "alt8": 0, "alt9": 72057594037927935 }, "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRA", "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBA", "modifier": { "default": 144115206333774337, "alt1": 144115206333774337, "alt2": 144115206333774081, "alt3": 144115206333757697, "alt4": 144115188080056833, "alt5": 144115188080056577, "alt6": 144115188075858433, "alt7": 144115188075858177, "alt8": 0, "alt9": 72057594037927935 }, "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBA", "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": { "default": 144115206333774337, "alt1": 144115206333774337, "alt2": 144115206333774081, "alt3": 144115206333757697, "alt4": 144115188080056833, "alt5": 144115188080056577, "alt6": 144115188075858433, "alt7": 144115188075858177, "alt8": 0, "alt9": 72057594037927935 }, "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBx", "modifier": { "default": 144115206333774337, "alt1": 144115206333774337, "alt2": 144115206333774081, "alt3": 144115206333757697, "alt4": 144115188080056833, "alt5": 144115188080056577, "alt6": 144115188075858433, "alt7": 144115188075858177, "alt8": 0, "alt9": 72057594037927935 }, "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBx", "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } } ], "Meta": [ { "type": "Busy", "size": 8 }, { "type": "Header", "size": 32 }, { "type": "VideoCrop", "size": 16 } ], "IO": [ { "id": "Buffers", "size": 8 } ], "Format": [ { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": 72057594037927935, "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "num": 20, "denom": 1 } } ], "Buffers": [ { "size": 8294400, "stride": 7680, "buffers": { "default": 8, "min": 1, "max": 32 }, "dataType": { "default": 14 } } ], "Latency": [ ] } } }, { "id": 74, "type": "PipeWire:Interface:Link", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "output-node-id": 69, "output-port-id": 70, "input-node-id": 72, "input-port-id": 73, "change-mask": [ "state", "format", "props" ], "state": "active", "error": null, "format": { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": 72057594037927935, "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "num": 20, "denom": 1 } }, "props": { "link.output.node": 69, "link.output.port": 70, "link.input.node": 72, "link.input.port": 73, "factory.id": 20, "client.id": 33, "object.id": 74, "object.serial": 77 } } }, ] ```

Sadly I can't use a Browser since my university disabled the web client for some ominous security reasons… (which is quite ironic considering all the RCE bugs that were found in the Zoom client in the past)

Edit:

This is what a pw-dump when using Gnome (Zoom is working there) looks like:

``` [ { "id": 71, "type": "PipeWire:Interface:Node", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "max-input-ports": 0, "max-output-ports": 1, "change-mask": [ "input-ports", "output-ports", "state", "props", "params" ], "n-input-ports": 0, "n-output-ports": 1, "state": "running", "error": null, "props": { "media.name": "meta-screen-cast-src", "stream.is-live": true, "node.name": "gnome-shell", "node.driver": true, "node.want-driver": true, "media.class": "Stream/Output/Video", "client.id": 70, "object.id": 71, "object.serial": 107 }, "params": { "PropInfo": [ ], "Props": [ ] } } }, { "id": 72, "type": "PipeWire:Interface:Port", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "direction": "output", "change-mask": [ "props", "params" ], "props": { "port.id": 0, "port.direction": "out", "port.name": "out_0", "port.alias": "gnome-shell:out_0", "node.id": 71, "object.id": 72, "object.serial": 108 }, "params": { "EnumFormat": [ { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": 72057594037927935, "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "default": { "num": 3934323, "denom": 65536 }, "min": { "num": 1, "denom": 1 }, "max": { "num": 3934323, "denom": 65536 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "default": { "num": 3934323, "denom": 65536 }, "min": { "num": 1, "denom": 1 }, "max": { "num": 3934323, "denom": 65536 } } } ], "Meta": [ { "type": "Busy", "size": 8 }, { "type": "VideoCrop", "size": 16 }, { "type": "Cursor", "size": 589872 } ], "IO": [ { "id": "Buffers", "size": 8 } ], "Format": [ { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": 72057594037927935, "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "num": 3934323, "denom": 65536 } } ], "Buffers": [ { "buffers": { "default": 16, "min": 2, "max": 16 }, "blocks": 1, "size": 8294400, "stride": 7680, "align": 16, "dataType": { "default": 12 } } ], "Latency": [ ] } } }, { "id": 73, "type": "PipeWire:Interface:Client", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "change-mask": [ "props" ], "props": { "pipewire.protocol": "protocol-native", "pipewire.sec.pid": 5671, "pipewire.sec.uid": 1000, "pipewire.sec.gid": 1000, "module.id": 2, "object.id": 73, "object.serial": 109, "pipewire.access.portal.app_id": "", "pipewire.access.portal.media_roles": "", "log.level": 0, "cpu.max-align": 32, "default.clock.rate": 48000, "default.clock.quantum": 1024, "default.clock.min-quantum": 32, "default.clock.max-quantum": 2048, "default.clock.quantum-limit": 8192, "default.video.width": 640, "default.video.height": 480, "default.video.rate.num": 25, "default.video.rate.denom": 1, "clock.power-of-two-quantum": true, "link.max-buffers": 64, "mem.warn-mlock": false, "mem.allow-mlock": true, "settings.check-quantum": false, "settings.check-rate": false, "application.name": "zoom", "application.process.binary": "zoom", "application.language": "en_GB.UTF-8", "application.process.id": 5773, "application.process.user": "iuser", "application.process.host": "arch64", "window.x11.display": ":0", "core.version": "0.3.54", "core.name": "pipewire-iuser-5773", "pipewire.access": "portal" } } }, { "id": 74, "type": "PipeWire:Interface:Node", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "max-input-ports": 1, "max-output-ports": 0, "change-mask": [ "input-ports", "output-ports", "state", "props", "params" ], "n-input-ports": 1, "n-output-ports": 0, "state": "running", "error": null, "props": { "media.type": "Video", "media.category": "Capture", "media.role": "Screen", "media.name": "zoom wayland pwstream", "stream.is-live": true, "node.name": "zoom", "node.target": 71, "node.autoconnect": true, "node.want-driver": true, "media.class": "Stream/Input/Video", "client.id": 73, "object.id": 74, "object.serial": 110 }, "params": { "PropInfo": [ ], "Props": [ ] } } }, { "id": 75, "type": "PipeWire:Interface:Port", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "direction": "input", "change-mask": [ "props", "params" ], "props": { "port.id": 0, "port.direction": "in", "port.name": "in_0", "port.alias": "zoom:in_0", "node.id": 74, "object.id": 75, "object.serial": 111 }, "params": { "EnumFormat": [ { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRA", "modifier": { "default": 144115206333774337, "alt1": 144115206333774337, "alt2": 144115206333774081, "alt3": 144115206333757697, "alt4": 144115188080056833, "alt5": 144115188080056577, "alt6": 144115188075858433, "alt7": 144115188075858177, "alt8": 0, "alt9": 72057594037927935 }, "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRA", "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBA", "modifier": { "default": 144115206333774337, "alt1": 144115206333774337, "alt2": 144115206333774081, "alt3": 144115206333757697, "alt4": 144115188080056833, "alt5": 144115188080056577, "alt6": 144115188075858433, "alt7": 144115188075858177, "alt8": 0, "alt9": 72057594037927935 }, "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBA", "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": { "default": 144115206333774337, "alt1": 144115206333774337, "alt2": 144115206333774081, "alt3": 144115206333757697, "alt4": 144115188080056833, "alt5": 144115188080056577, "alt6": 144115188075858433, "alt7": 144115188075858177, "alt8": 0, "alt9": 72057594037927935 }, "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBx", "modifier": { "default": 144115206333774337, "alt1": 144115206333774337, "alt2": 144115206333774081, "alt3": 144115206333757697, "alt4": 144115188080056833, "alt5": 144115188080056577, "alt6": 144115188075858433, "alt7": 144115188075858177, "alt8": 0, "alt9": 72057594037927935 }, "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } }, { "mediaType": "video", "mediaSubtype": "raw", "format": "RGBx", "size": { "default": { "width": 320, "height": 240 }, "min": { "width": 16, "height": 16 }, "max": { "width": 4294967295, "height": 4294967295 } } } ], "Meta": [ { "type": "Busy", "size": 8 }, { "type": "Header", "size": 32 }, { "type": "VideoCrop", "size": 16 } ], "IO": [ { "id": "Buffers", "size": 8 } ], "Format": [ { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": 72057594037927935, "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "num": 3934323, "denom": 65536 } } ], "Buffers": [ { "size": 8294400, "stride": 7680, "buffers": { "default": 8, "min": 1, "max": 32 }, "dataType": { "default": 14 } } ], "Latency": [ ] } } }, { "id": 76, "type": "PipeWire:Interface:Link", "version": 3, "permissions": [ "r", "w", "x", "m" ], "info": { "output-node-id": 71, "output-port-id": 72, "input-node-id": 74, "input-port-id": 75, "change-mask": [ "state", "format", "props" ], "state": "active", "error": null, "format": { "mediaType": "video", "mediaSubtype": "raw", "format": "BGRx", "modifier": 72057594037927935, "size": { "width": 1920, "height": 1080 }, "framerate": { "num": 0, "denom": 1 }, "maxFramerate": { "num": 3934323, "denom": 65536 } }, "props": { "link.output.node": 71, "link.output.port": 72, "link.input.node": 74, "link.input.port": 75, "factory.id": 20, "client.id": 32, "object.id": 76, "object.serial": 112 } } }, ] ```

I don't really see a lot of differences, maybe my initial guess of it being an issue with modifiers being implemented wrongly by Zoom was wrong.

Btw. I'm pretty sure it's not a bug on your side, I'm just trying to get it to work somehow since Zoom is not exactly known for fixing this kind of stuff quickly...

columbarius commented 2 years ago

The difference of xdpw and gnome should be that gnome allocates implicit modifiers as linear (force_mod_linear should do the same).

If you provide a TRACE log of xdpw, this might help to see how the negotiaion is happening and which allocation codepath we are hitting.

David96 commented 2 years ago

I already tried with and without force_mod_linear. To make things even stranger, now Zoom suddenly calls gbm_bo_import with GBM_BO_IMPORT_FD instead of GBM_BO_IMPORT_FD_MODIFIER therefore the theory of it hitting the ENOSYS of gbm being the issue doesn't seem to hold. I really don't know what changed to cause this behavior.

The trace log can be found here: http://ix.io/449t What I find suspicious is that all pipewire events seem to have a size of 9, I would have expected this property to tell the buffer size which should be slightly bigger.

Edit: ok, I know what changed: it depends on whether I use the Vulkan renderer of Sway or not.

columbarius commented 2 years ago

Please use the gl renderer for now, vulkan doesn't support implicit modifiers at all. Glancing at your log, there is no negotiation happening. Is this xdpw from master, or did you path a force implicit into it?

David96 commented 2 years ago

This is from master, without any added patches. Wouldn't surprise me if Zoom just skips any format negotiation and simply doesn't work if it doesn't like the chosen format...

columbarius commented 2 years ago

Ok, sadly pw-dump doesn't print the flags attached to EnumFormat params, so please look for the id of the zoom Port in pw-dump and send the output of

pw-cli enum-params <port id> 3 

Btw. are you using an Nvidia GPU? KDE folks noticed that implicit modifiers had some issues there.

columbarius commented 2 years ago

In the meantime you can try this patch: shm_only_clients.txt

David96 commented 2 years ago

Oh maybe I should have mentioned: Zoom crashes when using SHM buffers (after xdg-desktop-portal shows a lot of pipewire out of buffers errors)...

The output of enum-params:

``` Object: size 248, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3) Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000 Id 2 (Spa:Enum:MediaType:video) Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000 Id 1 (Spa:Enum:MediaSubtype:raw) Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000 Id 12 (Spa:Enum:VideoFormat:BGRA) Prop: key Spa:Pod:Object:Param:Format:Video:modifier (131074), flags 00000008 Choice: type Spa:Enum:Choice:Enum, flags 00000000 96 8 Long 144115206333774337 Long 144115206333774337 Long 144115206333774081 Long 144115206333757697 Long 144115188080056833 Long 144115188080056577 Long 144115188075858433 Long 144115188075858177 Long 0 Long 72057594037927935 Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000 Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8 Rectangle 320x240 Rectangle 16x16 Rectangle -1x-1 Object: size 136, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3) Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000 Id 2 (Spa:Enum:MediaType:video) Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000 Id 1 (Spa:Enum:MediaSubtype:raw) Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000 Id 12 (Spa:Enum:VideoFormat:BGRA) Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000 Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8 Rectangle 320x240 Rectangle 16x16 Rectangle -1x-1 Object: size 248, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3) Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000 Id 2 (Spa:Enum:MediaType:video) Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000 Id 1 (Spa:Enum:MediaSubtype:raw) Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000 Id 11 (Spa:Enum:VideoFormat:RGBA) Prop: key Spa:Pod:Object:Param:Format:Video:modifier (131074), flags 00000008 Choice: type Spa:Enum:Choice:Enum, flags 00000000 96 8 Long 144115206333774337 Long 144115206333774337 Long 144115206333774081 Long 144115206333757697 Long 144115188080056833 Long 144115188080056577 Long 144115188075858433 Long 144115188075858177 Long 0 Long 72057594037927935 Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000 Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8 Rectangle 320x240 Rectangle 16x16 Rectangle -1x-1 Object: size 136, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3) Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000 Id 2 (Spa:Enum:MediaType:video) Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000 Id 1 (Spa:Enum:MediaSubtype:raw) Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000 Id 11 (Spa:Enum:VideoFormat:RGBA) Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000 Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8 Rectangle 320x240 Rectangle 16x16 Rectangle -1x-1 Object: size 248, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3) Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000 Id 2 (Spa:Enum:MediaType:video) Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000 Id 1 (Spa:Enum:MediaSubtype:raw) Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000 Id 8 (Spa:Enum:VideoFormat:BGRx) Prop: key Spa:Pod:Object:Param:Format:Video:modifier (131074), flags 00000008 Choice: type Spa:Enum:Choice:Enum, flags 00000000 96 8 Long 144115206333774337 Long 144115206333774337 Long 144115206333774081 Long 144115206333757697 Long 144115188080056833 Long 144115188080056577 Long 144115188075858433 Long 144115188075858177 Long 0 Long 72057594037927935 Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000 Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8 Rectangle 320x240 Rectangle 16x16 Rectangle -1x-1 Object: size 136, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3) Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000 Id 2 (Spa:Enum:MediaType:video) Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000 Id 1 (Spa:Enum:MediaSubtype:raw) Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000 Id 8 (Spa:Enum:VideoFormat:BGRx) Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000 Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8 Rectangle 320x240 Rectangle 16x16 Rectangle -1x-1 Object: size 248, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3) Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000 Id 2 (Spa:Enum:MediaType:video) Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000 Id 1 (Spa:Enum:MediaSubtype:raw) Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000 Id 7 (Spa:Enum:VideoFormat:RGBx) Prop: key Spa:Pod:Object:Param:Format:Video:modifier (131074), flags 00000008 Choice: type Spa:Enum:Choice:Enum, flags 00000000 96 8 Long 144115206333774337 Long 144115206333774337 Long 144115206333774081 Long 144115206333757697 Long 144115188080056833 Long 144115188080056577 Long 144115188075858433 Long 144115188075858177 Long 0 Long 72057594037927935 Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000 Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8 Rectangle 320x240 Rectangle 16x16 Rectangle -1x-1 Object: size 136, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3) Prop: key Spa:Pod:Object:Param:Format:mediaType (1), flags 00000000 Id 2 (Spa:Enum:MediaType:video) Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000 Id 1 (Spa:Enum:MediaSubtype:raw) Prop: key Spa:Pod:Object:Param:Format:Video:format (131073), flags 00000000 Id 7 (Spa:Enum:VideoFormat:RGBx) Prop: key Spa:Pod:Object:Param:Format:Video:size (131075), flags 00000000 Choice: type Spa:Enum:Choice:Range, flags 00000000 40 8 Rectangle 320x240 Rectangle 16x16 Rectangle -1x-1 ```

I'm using AMD Vega 10 graphics, so no Nvidia here. And on Gnome Zoom works, so basically what I'm trying to do is figuring out what difference makes Zoom work on one and not the other.

columbarius commented 2 years ago

Oh maybe I should have mentioned: Zoom crashes when using SHM buffers (after xdg-desktop-portal shows a lot of pipewire out of buffers errors)...

I can reproduce that.

    Prop: key Spa:Pod:Object:Param:Format:Video:modifier (131074), flags 00000008

This is wrong. The flag should be 18 (hex value): (1<<4) is DONT_FIXATE and (1<<3) MANDATORY. The DONT_FIXATE flag is missing.

I'm scared of what they do to have the shm transport crash... anyway to debug this further source code would be nice (probably a quick fix) ... sigh

I remember that there was some version with portal support, which worked, maybe you can test different versions.

David96 commented 2 years ago

Is there maybe some quick and dirty way to work around this issue?

columbarius commented 2 years ago

Try going back to this commit https://github.com/emersion/xdg-desktop-portal-wlr/commit/5799adeb57c8ccefaa21d483b9a027095c893b6d. It's before explicit modifiers are implemented.

columbarius commented 2 years ago

If you want to go the "hacky" way: Use obs and v4l2-loopback.

David96 commented 2 years ago

Sadly going back to before the explicit modifiers still doesn't work :/

The obs & v4l2-loopback was what I was doing the whole time, I was just very excited to be finally able to use the "right" way of screensharing :sweat_smile:

Anyway, thanks a lot for your help! Not sure whether this issue should stay opened for others to see?

David96 commented 2 years ago

Whoop whoop, I figured it out :facepalm:

The solution really is as stupid as it gets: Gnome sets the VideoCrop Metadata when sharing the whole screen. I bet you can guess where this is going…

Apparently, if this property is not set, Zoom just shares nothing. Adding SPA_META_VideoCrop to the buffer and setting the size of the screen fixes screensharing :facepalm:

columbarius commented 2 years ago

Nice!

... sigh

columbarius commented 2 years ago

Feel free to use https://github.com/emersion/xdg-desktop-portal-wlr/pull/156 with cropmode=pipewire

st3r4g commented 2 years ago

Feel free to use #156 with cropmode=pipewire

I confirm that it works (Zoom Flatpak) with the PR applied and the following config:

[screencast]
chooser_type = none
cropmode = pipewire
region = 0,0:1920x1080

Is there any performance loss compared to David96's workaround?

fernandogrd commented 1 year ago

I've tried both solutions and it works on my external display. But on my laptop display the image looks like bellow.

OBS works just fine with both displays. Configuration, I've tried different combinations, but nothing changed.

[screencast]
chooser_type = none
region = 0,0:2256x1504
cropmode = pipewire

xdg-desktop-portal-wlr -r -l DEBUG logs:

2022/08/16 18:16:27 [INFO] - dbus: create session method invoked
2022/08/16 18:16:27 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_169/zoomcast10
2022/08/16 18:16:27 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_169/zoomcast4
2022/08/16 18:16:27 [INFO] - dbus: app_id: us.zoom.Zoom
2022/08/16 18:16:27 [INFO] - dbus: select sources method invoked
2022/08/16 18:16:27 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_169/zoomcast11
2022/08/16 18:16:27 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_169/zoomcast4
2022/08/16 18:16:27 [INFO] - dbus: app_id: us.zoom.Zoom
2022/08/16 18:16:27 [INFO] - dbus: option types:3
2022/08/16 18:16:27 [INFO] - dbus: option multiple: 0
2022/08/16 18:16:27 [INFO] - dbus: option cursor_mode:2
2022/08/16 18:16:27 [DEBUG] - dbus: select sources: found matching session /org/freedesktop/portal/desktop/session/1_169/zoomcast4
2022/08/16 18:16:27 [INFO] - wlroots: capturable output: Unknown model: 0x095F: id: 41 name: eDP-1
2022/08/16 18:16:27 [INFO] - xdpw: screencast instance 0x55645dba96e0 has 1 references
2022/08/16 18:16:27 [INFO] - xdpw: 1 active screencast instances
2022/08/16 18:16:27 [INFO] - wlroots: output: eDP-1
2022/08/16 18:16:27 [INFO] - dbus: start method invoked
2022/08/16 18:16:27 [INFO] - dbus: request_handle: /org/freedesktop/portal/desktop/request/1_169/zoomcast12
2022/08/16 18:16:27 [INFO] - dbus: session_handle: /org/freedesktop/portal/desktop/session/1_169/zoomcast4
2022/08/16 18:16:27 [INFO] - dbus: app_id: us.zoom.Zoom
2022/08/16 18:16:27 [INFO] - dbus: parent_window: 
2022/08/16 18:16:27 [DEBUG] - dbus: start: found matching session /org/freedesktop/portal/desktop/session/1_169/zoomcast4
2022/08/16 18:16:27 [INFO] - wlroots: num_modififiers 7
2022/08/16 18:16:27 [INFO] - pipewire: stream state changed to "connecting"
2022/08/16 18:16:27 [INFO] - pipewire: node id is -1
2022/08/16 18:16:27 [INFO] - pipewire: stream state changed to "paused"
2022/08/16 18:16:27 [INFO] - pipewire: node id is 63
2022/08/16 18:16:27 [DEBUG] - dbus: start: returning node 63
2022/08/16 18:16:27 [DEBUG] - pipewire: Format negotiated:
2022/08/16 18:16:27 [DEBUG] - pipewire: buffer_type: 1 (8)
2022/08/16 18:16:27 [DEBUG] - pipewire: format: 8
2022/08/16 18:16:27 [DEBUG] - pipewire: modifier: 72057594037927935
2022/08/16 18:16:27 [DEBUG] - pipewire: size: (2256, 1504)
2022/08/16 18:16:27 [DEBUG] - pipewire: max_framerate: (59 / 1)
2022/08/16 18:16:27 [DEBUG] - pipewire: add buffer event handle
2022/08/16 18:16:27 [DEBUG] - pipewire: add buffer event handle
2022/08/16 18:16:27 [INFO] - pipewire: stream state changed to "streaming"
2022/08/16 18:16:27 [INFO] - pipewire: node id is 63
2022/08/16 18:16:32 [DEBUG] - fps_limit: average FPS in the last 5.14 seconds: 18.09
2022/08/16 18:16:36 [INFO] - pipewire: stream state changed to "paused"
2022/08/16 18:16:36 [INFO] - pipewire: node id is 63
2022/08/16 18:16:36 [INFO] - dbus: session closed
2022/08/16 18:16:36 [DEBUG] - dbus: destroying session 0x55645dba6cc0
2022/08/16 18:16:36 [DEBUG] - xdpw: screencast instance 0x55645dba96e0 now has 0 references
2022/08/16 18:16:36 [DEBUG] - xdpw: destroying cast instance
2022/08/16 18:16:36 [DEBUG] - pipewire: destroying stream
2022/08/16 18:16:36 [DEBUG] - pipewire: remove buffer event handle
2022/08/16 18:16:36 [DEBUG] - pipewire: remove buffer event handle
2022/08/16 18:16:36 [INFO] - pipewire: stream state changed to "unconnected"
2022/08/16 18:16:36 [INFO] - pipewire: node id is -1

image

David96 commented 1 year ago

Have you tried setting force_mod_linear?

fernandogrd commented 1 year ago

Have you tried setting force_mod_linear?

Yep, this is one of combinations I've tried but the behavior is the same.

columbarius commented 1 year ago

Hmm... this looks like a stride mismatch. Chromium 104 has the same issue for me (Will be fixed in 105). It's interesting, that this works for your external monitor but not your internal one. Are you sure the crop region is correct for your internal display (and the used resolution from the compositor)? Btw. you only have on GPU right?

If it works in OBS, I'm sorry but I can't know what's causing the issue inside Zoom.

fernandogrd commented 1 year ago

Yep, you're right, I had a smaller resolution still in config file when I took the screenshot by mistake, but the behavior is the same when using the display resolution. One thing I realized is that I was using a 1.5 scale, but it seems the behavior is the same with 1.0 scale:

interface: 'zxdg_output_manager_v1',                     version:  3, name:  8
    xdg_output_v1
        output: 42
        name: 'DP-1'
        description: 'Dell Inc. DELL U2717D 67YGV67BBUNL (DP-1 via DP)'
        logical_x: 2256, logical_y: 0
        logical_width: 2560, logical_height: 1440
    xdg_output_v1
        output: 41
        name: 'eDP-1'
        description: 'Unknown 0x095F 0x00000000 (eDP-1)'
        logical_x: 0, logical_y: 0
        logical_width: 2256, logical_height: 1504

Correct, only one gpu, which is a Intel Xe:

❯ lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics] (rev 01)

Thanks for answering, I guess we can't expect much from zoom :)

fernandogrd commented 1 year ago

Ok, I was setting force_mod_linear = true instead of force_mod_linear = 1 :facepalm: Setting force_mod_linear correctly solves the issue for me!

Edit.: To be clearer, both methods work for me with force_mod_linear = 1 in the config.

columbarius commented 1 year ago

Fantastic! Since the issue is now elaborated and known, I would close this and pin it. If sth. new happens please reopen it again. I'll try to reach out to other portal developers to write some documentation on what PipeWire features are seen as mandatory and which should be optional.

mijoharas commented 1 year ago

I had the same stride issue which I was also able to fix with force_mod_linear. Zoom still seems to only update at about 5 fps or something which is maddening, and there is a mini "display" which shows only the top left section of the screen, and it seems to not handle the orientation of a vertical monitor correctly... but it works! I'll dig further into the docs and find some workarounds for anything I can, but would like to thank everyone in this issue for the help.

fernandogrd commented 1 year ago

FYI: while the workarounds worked for me, I stopped using the app because it started crashing and having other issues, it turns out the zoom web app got a lot better (on chrome), so I'm using that instead.