mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 17:48:10 +02:00
nvk: clean up existing nvk_android frontend
1. No need custom nvk_AcquireImageANDROID to wait for the HWC release fence, since nvk is able to properly import the sync file. 2. Document the nvk_QueueSignalReleaseImageANDROID behavior. 3. Drop redundant header and includes. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36386>
This commit is contained in:
parent
07f5b53dd7
commit
1e0c3529e7
2 changed files with 9 additions and 76 deletions
|
|
@ -8,47 +8,11 @@
|
|||
|
||||
#include "nvk_private.h"
|
||||
|
||||
#include "nvk_android.h"
|
||||
#include "nvk_entrypoints.h"
|
||||
#include "vk_android.h"
|
||||
|
||||
#include "util/libsync.h"
|
||||
#include "util/os_file.h"
|
||||
#include "vk_device.h"
|
||||
#include "vk_fence.h"
|
||||
#include "vk_queue.h"
|
||||
#include "vk_semaphore.h"
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
nvk_AcquireImageANDROID(VkDevice _device,
|
||||
VkImage image,
|
||||
int nativeFenceFd,
|
||||
VkSemaphore semaphore,
|
||||
VkFence fence)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_device, vk_device, _device);
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
if(nativeFenceFd >= 0)
|
||||
{
|
||||
sync_wait(nativeFenceFd, -1);
|
||||
close(nativeFenceFd);
|
||||
}
|
||||
|
||||
if(fence != VK_NULL_HANDLE)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_fence, vk_fence, fence);
|
||||
result = vk_sync_signal(vk_device, &vk_fence->permanent, 0);
|
||||
}
|
||||
|
||||
if(result == VK_SUCCESS && semaphore != VK_NULL_HANDLE)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_semaphore, vk_semaphore, semaphore);
|
||||
result = vk_sync_signal(vk_device, &vk_semaphore->permanent, 0);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
nvk_QueueSignalReleaseImageANDROID(VkQueue _queue,
|
||||
|
|
@ -60,6 +24,15 @@ nvk_QueueSignalReleaseImageANDROID(VkQueue _queue,
|
|||
VK_FROM_HANDLE(vk_queue, queue, _queue);
|
||||
struct vk_device *device = queue->base.device;
|
||||
|
||||
/* This is to workaround nouveau not supporting native_fence_fd cap. On
|
||||
* Android, the platform SurfaceFlinger RenderEngine has required
|
||||
* EGL_ANDROID_native_fence_sync to import the sync file presented along
|
||||
* with the wsi image when the sync fd is not -1.
|
||||
*
|
||||
* Can drop this if EGL is provided by layering (ANGLE or Zink) on top of
|
||||
* Vulkan SYNC_FD and AHB support, or SurfaceFlinger RenderEngine backend
|
||||
* is configured to use skiavk so that NVK is used for client composition.
|
||||
*/
|
||||
device->dispatch_table.QueueWaitIdle(_queue);
|
||||
|
||||
*pNativeFenceFd = -1;
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2024 Mauro Rossi <issor.oruam@gmail.com>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NVK_ANDROID_H
|
||||
#define NVK_ANDROID_H
|
||||
|
||||
#include "util/detect_os.h"
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
extern VkFormat
|
||||
vk_format_from_android(unsigned android_format, unsigned android_usage);
|
||||
#else
|
||||
static inline VkFormat
|
||||
vk_format_from_android(unsigned android_format, unsigned android_usage)
|
||||
{
|
||||
return VK_FORMAT_UNDEFINED;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NVK_ANDROID_H */
|
||||
Loading…
Add table
Reference in a new issue