From e3692456711ff7ca6773188b7b3c0a963613e79d Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 28 Jun 2019 15:37:40 -0700 Subject: [PATCH] [flutter_runner] use external image create info DX-939 #progress MA-394 #progress This informs the vulkan driver that we're creating an image that will be backed by external memory. The driver driver can decide to use different memory requirements based on the if memory for the image can be exported or not. No change in behavior. Existing tests (modular_tests, scenic_tests, etc.) are sufficient and regressions will be prevented by running these tests on aemu. Test: fx shell run fuchsia-pkg://fuchsia.com/basemgr#meta/basemgr.cmx --base_shell=fuchsia-pkg://fuchsia.com/spinning_cube# Change-Id: I489318c2e31f752f76c80a81245e203861d44d94 Ported from Topaz tree. --- .../shell/platform/fuchsia/flutter/vulkan_surface.cc | 7 ++++++- .../shell/platform/fuchsia/flutter/vulkan_surface.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.cc index eb82eb987d..842de3f9e0 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.cc @@ -36,9 +36,14 @@ bool CreateVulkanImage(vulkan::VulkanProvider& vulkan_provider, // garnet/public/lib/escher/util/image_utils.cc) or else the different vulkan // devices may interpret the bytes differently. // TODO(SCN-1369): Use API to coordinate this with scenic. + out_vulkan_image->vk_external_image_create_info = { + .sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, + .pNext = nullptr, + .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA, + }; out_vulkan_image->vk_image_create_info = { .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, - .pNext = nullptr, + .pNext = &out_vulkan_image->vk_external_image_create_info, .flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, .imageType = VK_IMAGE_TYPE_2D, .format = VK_FORMAT_B8G8R8A8_UNORM, diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.h b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.h index 245385c082..2da9f459ff 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.h +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface.h @@ -29,6 +29,7 @@ struct VulkanImage { VulkanImage(VulkanImage&&) = default; VulkanImage& operator=(VulkanImage&&) = default; + VkExternalMemoryImageCreateInfo vk_external_image_create_info; VkImageCreateInfo vk_image_create_info; VkMemoryRequirements vk_memory_requirements; vulkan::VulkanHandle vk_image;