<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:"\@SimSun";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle22
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hi, Tapani<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">According to
</span><a href="https://source.android.com/devices/graphics/implement-vulkan.html" target="_blank">https://source.android.com/devices/graphics/implement-vulkan.html</a><br>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">"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/libvulkan,
 the VK_ANDROID_native_buffer functions are implemented there as a sample.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Randy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">From:</span></b><span style="font-size:11.0pt;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 <jason@jlekstrand.net>; Xu, Randy <randy.xu@intel.com><br>
<b>Cc:</b> mesa-dev@lists.freedesktop.org<br>
<b>Subject:</b> Re: [Mesa-dev] [PATCH] Vulkan: Add VK_ANDROID_native_buffer to device extension list<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 03/01/2017 06:17 AM, Jason Ekstrand wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<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:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;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.<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">This seems rather odd.  Can't the Vulkan HAL just hook into vkEnumerateDeviceExtensionProperties and add it to the list there?  It seems a bit odd to advertise an extension but not actually provide any of the
 functionality.<o:p></o:p></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">https://github.com/android-ia/external-mesa/commit/8b6b2fc4de933c03feba33e5b57c20262e7983cc</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>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">Test: Pass Vulkan dEQP-VK.wsi.android.swapchain.* on Android platform<br>
<br>
Signed-off-by: Randy Xu <<a href="mailto:randy.xu@intel.com">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=\"/system/lib/$(MESA_DRI_MODULE_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.c b/src/intel/vulkan/anv_device.c<br>
index 0db96f2..478d753 100644<br>
--- a/src/intel/vulkan/anv_device.c<br>
+++ b/src/intel/vulkan/anv_device.c<br>
@@ -258,6 +258,15 @@ static const VkExtensionProperties device_extensions[] = {<br>
       .extensionName = VK_KHR_MAINTENANCE1_EXTENSION_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/devices/graphics/implement-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",<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">In the other places, we use the EXTENSION_NAME #define<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">+      .specVersion = 1,<br>
+   },<br>
+#endif<br>
    {<br>
       .extensionName = VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME,<br>
       .specVersion = 1,<br>
<span class="hoenzb"><span style="color:#888888">--</span></span><span style="color:#888888"><br>
<span class="hoenzb">2.7.4</span><br>
<br>
<span class="hoenzb">_______________________________________________</span><br>
<span class="hoenzb">mesa-dev mailing list</span><br>
<span class="hoenzb"><a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a></span><br>
<span class="hoenzb"><a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a></span></span><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal"><br>
<br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>mesa-dev mailing list<o:p></o:p></pre>
<pre><a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><o:p></o:p></pre>
<pre><a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><o:p></o:p></pre>
</blockquote>
<p><o:p> </o:p></p>
</div>
</body>
</html>