<div dir="ltr">(Also if the guest created a shareable GL object first (which can be common with guest applications that use regular GL swapchains / compositors that end up emulated as globally visible GL textures on the host, if a Vulkan import of that is created, then the globally visible GL texture gets its backing changed out to be a memory object in the globally visible Vulkan instance, (after saving the contents and syncing it up of course))</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 21, 2020 at 9:11 AM Frank Yang <<a href="mailto:lfy@google.com">lfy@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 17, 2020 at 4:15 AM Elie Tournier <<a href="mailto:tournier.elie@gmail.com" target="_blank">tournier.elie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Apr 01, 2020 at 07:50:37AM -0700, Frank Yang wrote:<br>
> On Wed, Apr 1, 2020 at 4:03 AM Elie Tournier <<a href="mailto:tournier.elie@gmail.com" target="_blank">tournier.elie@gmail.com</a>><br>
> wrote:<br>
> <br>
> > On Tue, Mar 31, 2020 at 04:54:12PM -0700, Gurchetan Singh wrote:<br>
> > > On Mon, Mar 30, 2020 at 10:49 AM Elie Tournier <<a href="mailto:tournier.elie@gmail.com" target="_blank">tournier.elie@gmail.com</a>><br>
> > > wrote:<br>
> > ><br>
> > > > On Fri, Mar 27, 2020 at 05:10:43PM -0700, Gurchetan Singh wrote:<br>
> > > > > On Wed, Mar 25, 2020 at 5:17 AM Elie Tournier <<br>
> > <a href="mailto:tournier.elie@gmail.com" target="_blank">tournier.elie@gmail.com</a>><br>
> > > > > wrote:<br>
> > > > ><br>
> > > > > > Hi all,<br>
> > > > > ><br>
> > > > > > I'm currently working on OpenGL 4.5 support for virgl.<br>
> > > > > > For that, we need to implement ARB_clear_texture and<br>
> > > > ARB_buffer_storage.<br>
> > > > > > The first one is almost finish, and I should submit a MR soon-ish.<br>
> > > > > > The second one, ARB_buffer_storage is trickier to implement.<br>
> > > > > ><br>
> > > > > > So I'm wondering if any of you started something already?<br>
> > > > > > Do you have a design in mind?<br>
> > > > > ><br>
> > > > ><br>
> > > > > Hmm, depends on where you want to implement ARB_buffer_storage:<br>
> > > > I mean, the goal here is to help the project to going further.<br>
> > > > It seems that you started (1) but I guess you are interested by (3).<br>
> > > > Would it make sense to go gradually and do (1) -> (2) -> (3) as<br>
> > > > iiuc, we can reuse bits from the previous iteration?<br>
> > ><br>
> > ><br>
> > > (1) should work pretty easily, since we got dEQP-vk.memory.* working<br>
> > [with<br>
> > > Android Emulator VK impl].<br>
> ><br>
> > Does that mean the QEMU part is already in place?<br>
> ><br>
> <br>
> Hi, not necessarily; I've been the one trying that dEQP-VK.memory* out and<br>
> I only have patches for crosvm so far:<br>
> <br>
> <a href="https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2034029" rel="noreferrer" target="_blank">https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2034029</a><br>
> <a href="https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2035595" rel="noreferrer" target="_blank">https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2035595</a><br>
> <br>
> (which I'll get back to soon, hopefully this week, as I was busy w/ R-CTS<br>
> stuff)<br>
> <br>
> The same mechanism should work for coherent mem in GL though. I need to do<br>
> some experiments for (2) to see if EXT_external_objects works<br>
<br>
Out of curiousity, do you started working on this subject?<br>
If yes, do you have a branch somewhere?<br>
I would be happy to help if needed.<br>
<br></blockquote><div><br></div><div>I haven't started the work to make Vk/GL interoperate in the multiprocess case (will get to it soon), but we can trace the basic idea that the Android Emulator uses in here:</div><div><br></div><div>1. When the guest does vkAllocateMemory that's external and therefore potentially interoperable with GL:</div><div><br></div><div><a href="https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emugl/host/libs/libOpenglRender/vulkan/VkDecoderGlobalState.cpp#2499" target="_blank">https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emugl/host/libs/libOpenglRender/vulkan/VkDecoderGlobalState.cpp#2499</a></div><div><br></div><div>create a canonical memory object in a globally visible instance, and keep a registry of "ColorBuffers" (representing external Vk/GL objects) up to date with the new memory. Then create a GL external object that imports that memory:</div><div><br></div><div><a href="https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emugl/host/libs/libOpenglRender/vulkan/VkCommonOperations.cpp#1330" target="_blank">https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emugl/host/libs/libOpenglRender/vulkan/VkCommonOperations.cpp#1330</a></div><div><a href="https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emugl/host/libs/libOpenglRender/ColorBuffer.cpp#940" target="_blank">https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/android/android-emugl/host/libs/libOpenglRender/ColorBuffer.cpp#940</a><br></div><div><br></div><div>2. That is already what the android emulator uses to support external memory and gl interop in the single process case; to extend to multi process, it should be straightforward to put those behind fd's obtained from other processes, but it has not yet been proven.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thanks and have a nice week-end.<br>
Elie<br>
> <br>
> <br>
> > ><br>
> > > I think the trickiest part of the entire chain is (3) [it sounds like<br>
> > this<br>
> > > your end goal too?].  In particular, the lack of GLES coherent support<br>
> > ...<br>
> > > I think we may need to add some extensions or extend<br>
> > EXT_external_objects.<br>
> > > A good place to start is a feasibility study about such extensions, or<br>
> > > auditing your target drivers (i965?).<br>
> ><br>
> > Yes, my end goal is that all virglrenderer user should be able to expose<br>
> > OpenGL 4.5 on the guest side. But for now, (1) seems to be the best option.<br>
> ><br>
> > I'm not familiar with EXT_external_objects but I'm more in favor of a new<br>
> > extension.<br>
> > And yes, you guess right, I'm on i965/iris drivers so that's what I target<br>
> > for now.<br>
> ><br>
> > I will keep you updated.<br>
> > ><br>
> > ><br>
> > > > Also, are you aware of app that heavily depend on the buffer storage<br>
> > > > extension?<br>
> > > ><br>
> > ><br>
> > > <a href="https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/109" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/109</a><br>
> ><br>
> > ><br>
> > ><br>
> > > > ><br>
> > > > > 1) Single process, host GL drivers (normal QEMU) -- yes, I think<br>
> > > > > RESOURCE_CREATE_BLOB here[1] should do the trick.  A bunch of<br>
> > > > virglrenderer<br>
> > > > > cleanups need to land first though.<br>
> > > > Thanks for the pointer, I will have a look to drm then.<br>
> > > > Do you have that cleanup already? I can help for the review if so.<br>
> > > ><br>
> > ><br>
> > > Chia has wip MR here:<br>
> > ><br>
> > > <a href="https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/364" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/364</a><br>
> ><br>
> > Thanks, I will see if I can help there.<br>
> > ><br>
> > ><br>
> > > ><br>
> > > > > 2) multi-process, host GL drivers (vhost-user gpu) -- trickier, need<br>
> > > > > emulated coherent memory [2] for the general case.<br>
> > > > > 3) multi-process, host GLES drivers (crosvm) -- even trickier and<br>
> > driver<br>
> > > > > specific, since GLES doesn't have GL_MAP_COHERENT_BIT.<br>
> > > > ><br>
> > > > > [1]<br>
> > > > ><br>
> > > ><br>
> > <a href="https://gitlab.freedesktop.org/virgl/drm-misc-next/-/commits/virtio-gpu-next" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/virgl/drm-misc-next/-/commits/virtio-gpu-next</a><br>
> > > > > [2]<br>
> > > ><br>
> > <a href="https://lists.freedesktop.org/archives/dri-devel/2019-April/215731.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/dri-devel/2019-April/215731.html</a><br>
> > > > ><br>
> > > > > Thanks, have a nice day,<br>
> > > > > > Elie<br>
> > > > > > _______________________________________________<br>
> > > > > > virglrenderer-devel mailing list<br>
> > > > > > <a href="mailto:virglrenderer-devel@lists.freedesktop.org" target="_blank">virglrenderer-devel@lists.freedesktop.org</a><br>
> > > > > > <a href="https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel</a><br>
> > > > > ><br>
> > > ><br>
> > _______________________________________________<br>
> > virglrenderer-devel mailing list<br>
> > <a href="mailto:virglrenderer-devel@lists.freedesktop.org" target="_blank">virglrenderer-devel@lists.freedesktop.org</a><br>
> > <a href="https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel</a><br>
> ><br>
</blockquote></div></div>
</blockquote></div>