Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How easy is it to support VK_KHR_external_memory to some degree? #316

Open
741g opened this issue Oct 29, 2018 · 7 comments
Open

How easy is it to support VK_KHR_external_memory to some degree? #316

741g opened this issue Oct 29, 2018 · 7 comments

Comments

@741g
Copy link

741g commented Oct 29, 2018

Hi, we're interested in running Vulkan for the Android Emulator and to a large degree the simplest way to do it so far is to pass through guest instances/devices 1:1. However, that is an issue if we want to run gralloc or otherwise do any buffer/img sharing between guest processes which is vital for Android UI rendering in Vulkan. VK_KHR_external_memory however might be the way to go here to enable the same kind of sharing on the host. Is there any plan to add it and if not, how hard is it to add? We may not require cross process sharing, even sharing across instances/devices incompletely would be a great help.

@billhollings
Copy link
Contributor

Can you clarify what you want to do?

As I understand it...you want to run an Android emulator on iOS...and share memory between Vulkan Instances and Devices?

What is causing the need to share memory that way across Vulkan components...and what types of memory do you want to share (a la VK_KHR_external_memory_capabilities)?

@741g
Copy link
Author

741g commented Oct 29, 2018

This is the Android Emulator that comes with Android Studio and runs on macOS.

Yes, the need for sharing memory across instances and devices is to implement that same capability in the guest.

At the very least, image memory needs to be sharable.

@billhollings
Copy link
Contributor

Support would be limited...as Metal does not support general inter-process memory sharing.

There is some support for texture sharing via IOSurfaces...so we could explore adding support for that at least.

@741g
Copy link
Author

741g commented Oct 31, 2018

Texture sharing with IOSurfaces definitely has potential. This would be quite useful as it would allow interop with GL too. With Metal though, is it possible to do all of the operations on IOSurfaces without leaving the GPU?

@zakk4223
Copy link

Just a quick note regarding implementation. 'global' IOSurfaces were deprecated a while back (I think in 10.11 on the macOS side). I think they still work, but you never know for how much longer.

It seems the only officially supported way to have processes share an IOSurface is to pass them through an XPC service or a mach port. Setting up that level of IPC between two arbitrary processes has gotten a bit more difficult with recent changes and may in fact require you to register a service with launchd and use it to facilitate the communication. It's a bit simpler if all the processes that need to talk to each other are part of the same app bundle and are launched via xpc services.

@billhollings
Copy link
Contributor

@zakk4223 Good point about the evolution of IOSurface exposure. Thanks for your input.

@741g
Copy link
Author

741g commented Nov 1, 2018

Yup. Cross process sharing isn't something required by Android emulator, but same process cross instance sharing would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants