diff options
author | Chris Forbes <chrisforbes@google.com> | 2017-05-19 14:47:29 -0700 |
---|---|---|
committer | Chris Forbes <chrisforbes@google.com> | 2017-07-31 15:53:19 +0000 |
commit | 8e0c3f5f1c4ffc3a055fe016406bd6a549ebdd00 (patch) | |
tree | dc447634ab64bc8840967bb18309ca1307013c65 | |
parent | 58ba988476d848598e62376f726f69c567d033ad (diff) | |
download | native-8e0c3f5f1c4ffc3a055fe016406bd6a549ebdd00.tar.gz |
vulkan: Translate usage flags before passing to driver
Previously we just cast the 32bit flags and jammed them in the two
gralloc1 slots. Use the helper which does the correct translation.
(Yes, all these gralloc1isms are going away in favor of a single 64bit
flags field, but Vulkan HALs expect us to implement our side of
ANDROID_native_buffer correctly.)
(Cherry-picked from 4744291270cc6 in oc-dev)
Test: boot sailfish, run vulkan demo
Bug: 37686587
Change-Id: I806011986e8140d7f608d281798605bd9ca9a86b
-rw-r--r-- | vulkan/libvulkan/swapchain.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp index ded9549b27..651438d6c8 100644 --- a/vulkan/libvulkan/swapchain.cpp +++ b/vulkan/libvulkan/swapchain.cpp @@ -1093,12 +1093,9 @@ VkResult CreateSwapchainKHR(VkDevice device, image_native_buffer.stride = img.buffer->stride; image_native_buffer.format = img.buffer->format; image_native_buffer.usage = int(img.buffer->usage); - // TODO: Adjust once ANativeWindowBuffer supports gralloc1-style usage. - // For now, this is the same translation Gralloc1On0Adapter does. - image_native_buffer.usage2.consumer = - static_cast<uint64_t>(img.buffer->usage); - image_native_buffer.usage2.producer = - static_cast<uint64_t>(img.buffer->usage); + android_convertGralloc0To1Usage(int(img.buffer->usage), + &image_native_buffer.usage2.producer, + &image_native_buffer.usage2.consumer); result = dispatch.CreateImage(device, &image_create, nullptr, &img.image); |