[Mesa-dev] [PATCH 08/23] anv/android: Disable surface and swapchain extensions

Jason Ekstrand jason at jlekstrand.net
Sat Sep 2 16:57:15 UTC 2017


On Sat, Sep 2, 2017 at 1:17 AM, Chad Versace <chadversary at chromium.org>
wrote:

> Android's Vulkan loader implements VK_KHR_surface and VK_KHR_swapchain,
> and applications cannot access the driver's implementation. Moreoever,
> if the driver exposes the those extension strings, then tests
> dEQP-VK.api.info.instance.extensions and dEQP-VK.api.info.device fail
> due to the duplicated strings.
> ---
>  src/intel/vulkan/anv_extensions.py | 25 +++++++++++++++++++------
>  1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_extensions.py b/src/intel/vulkan/anv_
> extensions.py
> index 0df3648746e..6cd0c3692b6 100644
> --- a/src/intel/vulkan/anv_extensions.py
> +++ b/src/intel/vulkan/anv_extensions.py
> @@ -44,6 +44,11 @@ class Extension:
>          else:
>              self.enable = enable;
>
> +# On Android, disable all surface and swapchain extensions. Android's
> Vulkan
> +# loader implements VK_KHR_surface and VK_KHR_swapchain, and applications
> +# cannot access the driver's implementation. Moreoever, if the driver
> exposes
> +# the those extension strings, then tests dEQP-VK.api.info.instance.
> extensions
> +# and dEQP-VK.api.info.device fail due to the duplicated strings.
>  EXTENSIONS = [
>      Extension('VK_KHR_dedicated_allocation',              1, True),
>      Extension('VK_KHR_descriptor_update_template',        1, True),
> @@ -60,7 +65,7 @@ EXTENSIONS = [
>      Extension('VK_KHR_external_semaphore_fd',             1, True),
>      Extension('VK_KHR_get_memory_requirements2',          1, True),
>      Extension('VK_KHR_get_physical_device_properties2',   1, True),
> -    Extension('VK_KHR_get_surface_capabilities2',         1, True),
> +    Extension('VK_KHR_get_surface_capabilities2',         1, '!ANDROID'),
>      Extension('VK_KHR_incremental_present',               1, True),
>      Extension('VK_KHR_maintenance1',                      1, True),
>      Extension('VK_KHR_push_descriptor',                   1, True),
> @@ -68,12 +73,12 @@ EXTENSIONS = [
>      Extension('VK_KHR_sampler_mirror_clamp_to_edge',      1, True),
>      Extension('VK_KHR_shader_draw_parameters',            1, True),
>      Extension('VK_KHR_storage_buffer_storage_class',      1, True),
> -    Extension('VK_KHR_surface',                          25, True),
> -    Extension('VK_KHR_swapchain',                        68, True),
> +    Extension('VK_KHR_surface',                          25, '!ANDROID'),
> +    Extension('VK_KHR_swapchain',                        68, '!ANDROID'),
>

Another option here (goes with the stuff below) would be to predicate these
on XCB || Xlib || Wayland.  Same with get_surface_capabilities2 above.  For
that matter, if we made the XML parser a bit smarter so that it understood
extension dependencies, we could just adjust VK_KHR_surface and the other
two would follow... (That's far more work than I expect you to do.)


>      Extension('VK_KHR_variable_pointers',                 1, True),
> -    Extension('VK_KHR_wayland_surface',                   6,
> 'VK_USE_PLATFORM_WAYLAND_KHR'),
> -    Extension('VK_KHR_xcb_surface',                       6,
> 'VK_USE_PLATFORM_XCB_KHR'),
> -    Extension('VK_KHR_xlib_surface',                      6,
> 'VK_USE_PLATFORM_XLIB_KHR'),
> +    Extension('VK_KHR_wayland_surface',                   6,
> 'VK_USE_PLATFORM_WAYLAND_KHR && !ANDROID'),
> +    Extension('VK_KHR_xcb_surface',                       6,
> 'VK_USE_PLATFORM_XCB_KHR && !ANDROID'),
> +    Extension('VK_KHR_xlib_surface',                      6,
> 'VK_USE_PLATFORM_XLIB_KHR && !ANDROID'),
>

You shouldn't be enabling XCB, Xlib or Wayland on Android builds anyway...


>      Extension('VK_KHX_multiview',                         1, True),
>  ]
>
> @@ -162,6 +167,14 @@ _TEMPLATE = Template(COPYRIGHT + """
>  #endif
>  %endfor
>
> +/* And ANDROID too */
> +#ifdef ANDROID
> +#   undef ANDROID
> +#   define ANDROID true
> +#else
> +#   define ANDROID false
> +#endif
> +
>  bool
>  anv_instance_extension_supported(const char *name)
>  {
> --
> 2.13.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170902/aca54084/attachment-0001.html>


More information about the mesa-dev mailing list