Loading vulkan/include/vulkan/vk_android_native_buffer.h +6 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,8 @@ extern "C" { /* * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 11 * * This version of the extension deprecates the last of grallocusage * This version of the extension deprecates the last of grallocusage and * extends VkNativeBufferANDROID to support passing AHardwareBuffer* */ #define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 11 #define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer" Loading Loading @@ -111,6 +112,9 @@ typedef struct { * usage: gralloc usage requested when the buffer was allocated * usage2: gralloc usage requested when the buffer was allocated * usage3: gralloc usage requested when the buffer was allocated * ahb: The AHardwareBuffer* from the actual ANativeWindowBuffer. Caller * maintains ownership of resource. AHardwareBuffer pointer is only valid * for the duration of the function call */ typedef struct { VkStructureType sType; Loading @@ -121,6 +125,7 @@ typedef struct { int usage; /* DEPRECATED in SPEC_VERSION 6 */ VkNativeBufferUsage2ANDROID usage2; /* DEPRECATED in SPEC_VERSION 9 */ uint64_t usage3; /* ADDED in SPEC_VERSION 9 */ AHardwareBuffer* ahb; /* ADDED in SPEC_VERSION 11 */ } VkNativeBufferANDROID; /* Loading vulkan/libvulkan/swapchain.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -1970,6 +1970,8 @@ VkResult CreateSwapchainKHR(VkDevice device, &image_native_buffer.usage2.producer, &image_native_buffer.usage2.consumer); image_native_buffer.usage3 = img.buffer->usage; image_native_buffer.ahb = ANativeWindowBuffer_getHardwareBuffer(img.buffer.get()); image_create.pNext = &image_native_buffer; ATRACE_BEGIN("CreateImage"); Loading Loading @@ -2146,7 +2148,12 @@ VkResult AcquireNextImageKHR(VkDevice device, .stride = buffer->stride, .format = buffer->format, .usage = int(buffer->usage), .usage3 = buffer->usage, .ahb = ANativeWindowBuffer_getHardwareBuffer(buffer), }; android_convertGralloc0To1Usage(int(buffer->usage), &nb.usage2.producer, &nb.usage2.consumer); VkBindImageMemoryInfo bimi = { .sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO, .pNext = &nb, Loading Loading @@ -2692,7 +2699,12 @@ static void InterceptBindImageMemory2( .stride = buffer->stride, .format = buffer->format, .usage = int(buffer->usage), .usage3 = buffer->usage, .ahb = ANativeWindowBuffer_getHardwareBuffer(buffer), }; android_convertGralloc0To1Usage(int(buffer->usage), &native_buffer.usage2.producer, &native_buffer.usage2.consumer); // Reserve enough space to avoid letting re-allocation invalidate the // addresses of the elements inside. out_native_buffers->reserve(bind_info_count); Loading vulkan/nulldrv/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -46,5 +46,8 @@ cc_library_shared { "hwvulkan_headers", "vulkan_headers", ], shared_libs: ["liblog"], shared_libs: [ "liblog", "libnativewindow", ], } vulkan/nulldrv/null_driver.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ * limitations under the License. */ #include <android/hardware_buffer.h> #include <hardware/hwvulkan.h> #include <errno.h> Loading vulkan/nulldrv/null_driver_gen.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ // WARNING: This file is generated. See ../README.md for instructions. #include <android/hardware_buffer.h> #include <algorithm> #include "null_driver_gen.h" Loading Loading
vulkan/include/vulkan/vk_android_native_buffer.h +6 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,8 @@ extern "C" { /* * NOTE ON VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 11 * * This version of the extension deprecates the last of grallocusage * This version of the extension deprecates the last of grallocusage and * extends VkNativeBufferANDROID to support passing AHardwareBuffer* */ #define VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 11 #define VK_ANDROID_NATIVE_BUFFER_EXTENSION_NAME "VK_ANDROID_native_buffer" Loading Loading @@ -111,6 +112,9 @@ typedef struct { * usage: gralloc usage requested when the buffer was allocated * usage2: gralloc usage requested when the buffer was allocated * usage3: gralloc usage requested when the buffer was allocated * ahb: The AHardwareBuffer* from the actual ANativeWindowBuffer. Caller * maintains ownership of resource. AHardwareBuffer pointer is only valid * for the duration of the function call */ typedef struct { VkStructureType sType; Loading @@ -121,6 +125,7 @@ typedef struct { int usage; /* DEPRECATED in SPEC_VERSION 6 */ VkNativeBufferUsage2ANDROID usage2; /* DEPRECATED in SPEC_VERSION 9 */ uint64_t usage3; /* ADDED in SPEC_VERSION 9 */ AHardwareBuffer* ahb; /* ADDED in SPEC_VERSION 11 */ } VkNativeBufferANDROID; /* Loading
vulkan/libvulkan/swapchain.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -1970,6 +1970,8 @@ VkResult CreateSwapchainKHR(VkDevice device, &image_native_buffer.usage2.producer, &image_native_buffer.usage2.consumer); image_native_buffer.usage3 = img.buffer->usage; image_native_buffer.ahb = ANativeWindowBuffer_getHardwareBuffer(img.buffer.get()); image_create.pNext = &image_native_buffer; ATRACE_BEGIN("CreateImage"); Loading Loading @@ -2146,7 +2148,12 @@ VkResult AcquireNextImageKHR(VkDevice device, .stride = buffer->stride, .format = buffer->format, .usage = int(buffer->usage), .usage3 = buffer->usage, .ahb = ANativeWindowBuffer_getHardwareBuffer(buffer), }; android_convertGralloc0To1Usage(int(buffer->usage), &nb.usage2.producer, &nb.usage2.consumer); VkBindImageMemoryInfo bimi = { .sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO, .pNext = &nb, Loading Loading @@ -2692,7 +2699,12 @@ static void InterceptBindImageMemory2( .stride = buffer->stride, .format = buffer->format, .usage = int(buffer->usage), .usage3 = buffer->usage, .ahb = ANativeWindowBuffer_getHardwareBuffer(buffer), }; android_convertGralloc0To1Usage(int(buffer->usage), &native_buffer.usage2.producer, &native_buffer.usage2.consumer); // Reserve enough space to avoid letting re-allocation invalidate the // addresses of the elements inside. out_native_buffers->reserve(bind_info_count); Loading
vulkan/nulldrv/Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -46,5 +46,8 @@ cc_library_shared { "hwvulkan_headers", "vulkan_headers", ], shared_libs: ["liblog"], shared_libs: [ "liblog", "libnativewindow", ], }
vulkan/nulldrv/null_driver.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ * limitations under the License. */ #include <android/hardware_buffer.h> #include <hardware/hwvulkan.h> #include <errno.h> Loading
vulkan/nulldrv/null_driver_gen.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ // WARNING: This file is generated. See ../README.md for instructions. #include <android/hardware_buffer.h> #include <algorithm> #include "null_driver_gen.h" Loading