mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-14 19:05:26 +00:00
a/vk: Use the defines to manually unref android buffers
The import does not consume them Co-authored-by: Rylie Pavlik <rylie.pavlik@collabora.com>
This commit is contained in:
parent
c763a1cb86
commit
8919463008
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2019-2022, Collabora, Ltd.
|
// Copyright 2019-2023, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
/*!
|
/*!
|
||||||
* @file
|
* @file
|
||||||
|
@ -21,8 +21,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "util/u_misc.h"
|
|
||||||
#include "util/u_debug.h"
|
#include "util/u_debug.h"
|
||||||
|
#include "util/u_handles.h"
|
||||||
|
#include "util/u_misc.h"
|
||||||
|
|
||||||
#include "vk/vk_helpers.h"
|
#include "vk/vk_helpers.h"
|
||||||
|
|
||||||
|
@ -1193,8 +1194,15 @@ vk_create_image_from_native(struct vk_bundle *vk,
|
||||||
out_mem, // out_mem
|
out_mem, // out_mem
|
||||||
NULL); // out_size
|
NULL); // out_size
|
||||||
|
|
||||||
|
#if defined(XRT_GRAPHICS_BUFFER_HANDLE_CONSUMED_BY_VULKAN_IMPORT)
|
||||||
// We have consumed this fd now, make sure it's not freed again.
|
// We have consumed this fd now, make sure it's not freed again.
|
||||||
image_native->handle = XRT_GRAPHICS_BUFFER_HANDLE_INVALID;
|
image_native->handle = XRT_GRAPHICS_BUFFER_HANDLE_INVALID;
|
||||||
|
#elif defined(XRT_GRAPHICS_BUFFER_HANDLE_REFERENCE_ADDED_BY_VULKAN_IMPORT)
|
||||||
|
// Some platforms need an explicit unref (Android)
|
||||||
|
u_graphics_buffer_unref(&image_native->handle);
|
||||||
|
#else
|
||||||
|
#error "Need port!"
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret != VK_SUCCESS) {
|
if (ret != VK_SUCCESS) {
|
||||||
vk->vkDestroyImage(vk->device, image, NULL);
|
vk->vkDestroyImage(vk->device, image, NULL);
|
||||||
|
|
Loading…
Reference in a new issue