Launching Orca stops discord screen sharing on macOS #15

Closed
opened 2023-07-06 08:13:17 +00:00 by MartinFouilleul · 4 comments
Collaborator

MBP 16' 2019 - Intel Core i9
macOS Catalina - 10.15.4

MBP 16' 2019 - Intel Core i9 macOS Catalina - 10.15.4
MartinFouilleul self-assigned this 2023-07-06 08:13:27 +00:00
Author
Collaborator

So, this is weird...
The screen sharing disconnect happens when we set the metal layer's device property:

surface->device = MTLCreateSystemDefaultDevice();
[surface->device retain];
surface->mtlLayer = [CAMetalLayer layer];
[surface->mtlLayer retain];
[surface->interface.layer.caLayer addSublayer: (CALayer*)surface->mtlLayer];

surface->mtlLayer.device = surface->device;

If I don't call MTLCreateSystemDefaultDevice() and set the layer's device to layer.preferredDevice instead, it doesn't hang the screen sharing... even though this is the same value that's returned by MTLCreateSystemDefaultDevice().

To note, this Apple sample showing how to create a metal layer sets the layer's device property to the return value of MTLCreateSystemDefaultDevice(), and it does hang Discord's screen sharing.

So, this is weird... The screen sharing disconnect happens when we set the metal layer's `device` property: ``` surface->device = MTLCreateSystemDefaultDevice(); [surface->device retain]; surface->mtlLayer = [CAMetalLayer layer]; [surface->mtlLayer retain]; [surface->interface.layer.caLayer addSublayer: (CALayer*)surface->mtlLayer]; surface->mtlLayer.device = surface->device; ``` If I don't call `MTLCreateSystemDefaultDevice()` and set the layer's device to `layer.preferredDevice` instead, it doesn't hang the screen sharing... even though this is the same value that's returned by `MTLCreateSystemDefaultDevice()`. To note, this [Apple sample](https://developer.apple.com/documentation/metal/onscreen_presentation/creating_a_custom_metal_view?language=objc) showing how to create a metal layer sets the layer's device property to the return value of `MTLCreateSystemDefaultDevice()`, and it does hang Discord's screen sharing.
Author
Collaborator

I'll just use layer.preferredDevice for now, so that we can use screen sharing.

We'll probably need to reopen this when we'll want more control over which GPU is used.

Closed by 301020ee9a

I'll just use `layer.preferredDevice` for now, so that we can use screen sharing. We'll probably need to reopen this when we'll want more control over which GPU is used. Closed by 301020ee9a
Author
Collaborator

This "fix" appears to break XCode's GPU Frame Capture...

This "fix" appears to break XCode's GPU Frame Capture...
Author
Collaborator

Milepost commit a65b0cc1bb seems to fix both the discord issue and the XCode frame capture issue. Instead of calling MTLCreateSystemDefaultDevice(), we query the list of all available GPUs and iterate to find the discrete one, and otherwise fallback on the first one.

Milepost commit a65b0cc1bb seems to fix both the discord issue and the XCode frame capture issue. Instead of calling `MTLCreateSystemDefaultDevice()`, we query the list of all available GPUs and iterate to find the discrete one, and otherwise fallback on the first one.
Sign in to join this conversation.
No Label
macOS
windows
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hmn/orca#15
No description provided.