<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 28, 2017 at 9:21 PM, Xu, Randy <span dir="ltr"><<a href="mailto:randy.xu@intel.com" target="_blank">randy.xu@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div bgcolor="white" lang="EN-US">
<div class="gmail-m_6500039380561152992WordSection1">
<p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)">Hi, Tapani<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)">According to
</span><a href="https://source.android.com/devices/graphics/implement-vulkan.html" target="_blank">https://source.android.com/<wbr>devices/graphics/implement-<wbr>vulkan.html</a><br>
<span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)">"Window System Integration (WSI) extensions are exported by the loader and primarily implemented in it rather than the driver.". Also, Google provides the stubhal.c in frameworks/native/vulkan/<wbr>libvulkan,
 the VK_ANDROID_native_buffer functions are implemented there as a sample.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)">The reason I guess is that VK_ANDROID_native_buffer implementation needs to access Gralloc HAL data structure, but mesa driver should have no dependency to Android
 HAL, which is required by HAL Binderization.</span></p></div></div></blockquote><div><br></div><div>I don't know enough of the details of how gralloc works on IA.  I would have assumed that the fd is just a prime buffer which should be easy enough for us to handle.  That said, if it's more complicated and requires bits that don't have a stable API somewhere, maybe it's best left out-of-tree.  I have no real opinion there.<br></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"><div bgcolor="white" lang="EN-US"><div class="gmail-m_6500039380561152992WordSection1"><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)">This patch doesn’t expose VK_ANDROID_native_buffer extension in driver (as the function is not implemented here), but avoid screening it when create device.</span></p></div></div></blockquote><div><br></div><div>Actually, it does.  It will cause the driver to advertise the extension even if it isn't loaded through the HAL.<br></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"><div bgcolor="white" lang="EN-US"><div class="gmail-m_6500039380561152992WordSection1"><p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)"><u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)">Randy<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:"calibri",sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p>
<div>
<div style="border-width:1pt medium medium;border-style:solid none none;border-color:rgb(225,225,225) -moz-use-text-color -moz-use-text-color;padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11pt;font-family:"calibri",sans-serif;color:windowtext">From:</span></b><span style="font-size:11pt;font-family:"calibri",sans-serif;color:windowtext"> Palli, Tapani
<br>
<b>Sent:</b> Wednesday, March 1, 2017 1:03 PM<br>
<b>To:</b> Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>>; Xu, Randy <<a href="mailto:randy.xu@intel.com" target="_blank">randy.xu@intel.com</a>><span class="gmail-"><br>
<b>Cc:</b> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<b>Subject:</b> Re: [Mesa-dev] [PATCH] Vulkan: Add VK_ANDROID_native_buffer to device extension list<u></u><u></u></span></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On 03/01/2017 06:17 AM, Jason Ekstrand wrote:<u></u><u></u></p>
</div><div><div class="gmail-h5">
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<p class="MsoNormal">On Tue, Feb 28, 2017 at 7:52 PM, Randy Xu <<a href="mailto:randy.xu@intel.com" target="_blank">randy.xu@intel.com</a>> wrote:<u></u><u></u></p>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">The VK_ANDROID_native_buffer is implemented in Android Vulkan HAL,<br>
not driver, but must be claimed in device extension list. Otherwise,<br>
this extension will be screened off in framework and driver.<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt">This seems rather odd.  Can't the Vulkan HAL just hook into vkEnumerateDeviceExtensionProp<wbr>erties and add it to the list there?  It seems a bit odd to advertise an extension but not actually provide any of the
 functionality.<u></u><u></u></p>
</div>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><br>
This was my question as well. I proposed Randy to include functionality, at the moment it would be along these lines:<br>
<br>
<a href="https://github.com/android-ia/external-mesa/commit/8b6b2fc4de933c03feba33e5b57c20262e7983cc" target="_blank">https://github.com/android-ia/<wbr>external-mesa/commit/<wbr>8b6b2fc4de933c03feba33e5b57c20<wbr>262e7983cc</a><br>
<br>
I don't have a strong preference where functionality exists but it seems like ideally the whole thing would exist in one single component. If the extension list cannot be modified in HAL then this becomes harder to achieve in HAL.<br></p></div></div></div></div></blockquote><div><br><div>I don't see anything non-trivial in that commit.  Am I missing the part where we actually import the ANativeImage?<br><br></div>In
 any case, if the interactions with gralloc aren't too bad, I'm 
reasonably happy to have support in the upstream mesa repo.  Someone 
other than me will have to be responsible for keeping it building but 
that's no different from the current state of things. <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 bgcolor="white" lang="EN-US"><div class="gmail-m_6500039380561152992WordSection1"><div><div class="gmail-h5"><p class="MsoNormal">
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Test: Pass Vulkan dEQP-VK.wsi.android.swapchain.<wbr>* on Android platform<br>
<br>
Signed-off-by: Randy Xu <<a href="mailto:randy.xu@intel.com" target="_blank">randy.xu@intel.com</a>><br>
---<br>
 <a href="http://Android.common.mk" target="_blank">Android.common.mk</a>             | 3 +++<br>
 src/intel/vulkan/anv_device.c | 9 +++++++++<br>
 2 files changed, 12 insertions(+)<br>
<br>
diff --git a/<a href="http://Android.common.mk" target="_blank">Android.common.mk</a> b/<a href="http://Android.common.mk" target="_blank">Android.common.mk</a><br>
index 611162a..f49189b 100644<br>
--- a/<a href="http://Android.common.mk" target="_blank">Android.common.mk</a><br>
+++ b/<a href="http://Android.common.mk" target="_blank">Android.common.mk</a><br>
@@ -116,6 +116,9 @@ else<br>
   LOCAL_CFLAGS += -DDEFAULT_DRIVER_DIR=\"/<wbr>system/lib/$(MESA_DRI_MODULE_<wbr>REL_PATH)\"<br>
 endif<br>
<br>
+# Enable VK_ANDROID_native_buffer<br>
+LOCAL_CFLAGS += -DVK_USE_PLATFORM_ANDROID_KHR<br>
+<br>
 # uncomment to keep the debug symbols<br>
 #LOCAL_STRIP_MODULE := false<br>
<br>
diff --git a/src/intel/vulkan/anv_device.<wbr>c b/src/intel/vulkan/anv_device.<wbr>c<br>
index 0db96f2..478d753 100644<br>
--- a/src/intel/vulkan/anv_device.<wbr>c<br>
+++ b/src/intel/vulkan/anv_device.<wbr>c<br>
@@ -258,6 +258,15 @@ static const VkExtensionProperties device_extensions[] = {<br>
       .extensionName = VK_KHR_MAINTENANCE1_EXTENSION_<wbr>NAME,<br>
       .specVersion = 1,<br>
    },<br>
+#ifdef VK_USE_PLATFORM_ANDROID_KHR<br>
+   {<br>
+      // Refer <a href="https://source.android.com/devices/graphics/implement-vulkan.html" target="_blank">
https://source.android.com/<wbr>devices/graphics/implement-<wbr>vulkan.html</a><br>
+      // "Window System Integration (WSI) extensions are exported by the loader<br>
+      //  and primarily implemented in it rather than the driver."<br>
+      .extensionName = "VK_ANDROID_native_buffer",<u></u><u></u></p>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">In the other places, we use the EXTENSION_NAME #define<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<blockquote style="border-width:medium medium medium 1pt;border-style:none none none solid;border-color:-moz-use-text-color -moz-use-text-color -moz-use-text-color rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">+      .specVersion = 1,<br>
+   },<br>
+#endif<br>
    {<br>
       .extensionName = VK_KHR_SHADER_DRAW_PARAMETERS_<wbr>EXTENSION_NAME,<br>
       .specVersion = 1,<br>
<span class="gmail-m_6500039380561152992hoenzb"><span style="color:rgb(136,136,136)">--</span></span><span style="color:rgb(136,136,136)"><br>
<span class="gmail-m_6500039380561152992hoenzb">2.7.4</span><br>
<br>
<span class="gmail-m_6500039380561152992hoenzb">______________________________<wbr>_________________</span><br>
<span class="gmail-m_6500039380561152992hoenzb">mesa-dev mailing list</span><br>
<span class="gmail-m_6500039380561152992hoenzb"><a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a></span><br>
<span class="gmail-m_6500039380561152992hoenzb"><a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a></span></span><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<p class="MsoNormal"><br>
<br>
<br>
<u></u><u></u></p>
<pre>______________________________<wbr>_________________<u></u><u></u></pre>
<pre>mesa-dev mailing list<u></u><u></u></pre>
<pre><a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><u></u><u></u></pre>
<pre><a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><u></u><u></u></pre>
</blockquote>
<p><u></u> <u></u></p>
</div></div></div>
</div>

</blockquote></div><br></div></div>