> Why not used shared memory?
Because this is not normal shared memory, this is GPU shared memory. This is hard to port.
Re:First fully sandboxed Linux desktop app
by alexlarsson on Tuesday February 17, 2015 @03:22PM
(#9064709)
Can you not use dma-buf and EXT_image_dma_buf_import?
Maybe, but that's quite not portable, and driver specific, AFAIK.
Re:First fully sandboxed Linux desktop app
by comex on Tuesday February 17, 2015 @03:49PM
(#9064852)
Forgive me for a short rant, but this sort of thing is one reason I think other kernels should look at OS X's virtual memory interface for inspiration. There, you can always share any existing mapped page with another process, regardless of how it was allocated. Usually useful because it reduces the need to redo the way you allocate some (regular) memory just because you want to use it a certain way (sharing), but it works with driver-mapped pages too.
Re:First fully sandboxed Linux desktop app
by alexlarsson on Tuesday February 17, 2015 @03:51PM
(#9064875)
Sharing a normal memory mapping is not necessarily what is required here though. What you want is to share the same GPU-side memory buffer between two processes. It may not even be mappable to cpu side memory.
Re:First fully sandboxed Linux desktop app
by comex on Tuesday February 17, 2015 @04:10PM
(#9065031)
If it's mapped into the CPU address space, then it can be shared. If not, then there is a copy going on and you may as well just do it in the non-sandboxed process, no?
Re:First fully sandboxed Linux desktop app
by alexlarsson on Wednesday February 18, 2015 @02:34AM
(#9067417)
There is no copy. You have a reference to a GPU side buffer, and you want to pass a reference to that buffer to another process, where it will continue to use the GPU to access it.
Why not used shared memory? I believe that's what Chrome uses for its rendering buffers. The renderer is sandboxed and shares buffers with the X11 process.
EDIT, used to use: https://codereview.chromium.org/298443002/
Still, it appears it used this method for a long time, so it seems feasible.
Also, Chrome has multiple video playing paths, including Flash, which is sandboxed, so I don't see the difference. The Flash video has to be decoded in a sandbox. I imagine HTML5 video is sandboxed somehow too.
It is very platform-specific and difficult, and performance is a prime concern, but not impossible.