anv: support fd==-1 in ImportSemaphoreFdKHR
If fd==-1 is passed in ImportSemaphoreFdKHR, instead of importing the fd, in creates an already signaled syncobj. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6427>
This commit is contained in:

committed by
Marge Bot

parent
f153151730
commit
b243a74768
@@ -2055,12 +2055,20 @@ VkResult anv_ImportSemaphoreFdKHR(
|
|||||||
|
|
||||||
case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT:
|
case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT:
|
||||||
if (device->physical->has_syncobj) {
|
if (device->physical->has_syncobj) {
|
||||||
|
uint32_t create_flags = 0;
|
||||||
|
|
||||||
|
if (fd == -1)
|
||||||
|
create_flags |= DRM_SYNCOBJ_CREATE_SIGNALED;
|
||||||
|
|
||||||
new_impl = (struct anv_semaphore_impl) {
|
new_impl = (struct anv_semaphore_impl) {
|
||||||
.type = ANV_SEMAPHORE_TYPE_DRM_SYNCOBJ,
|
.type = ANV_SEMAPHORE_TYPE_DRM_SYNCOBJ,
|
||||||
.syncobj = anv_gem_syncobj_create(device, 0),
|
.syncobj = anv_gem_syncobj_create(device, create_flags),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!new_impl.syncobj)
|
if (!new_impl.syncobj)
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
|
if (fd != -1) {
|
||||||
if (anv_gem_syncobj_import_sync_file(device, new_impl.syncobj, fd)) {
|
if (anv_gem_syncobj_import_sync_file(device, new_impl.syncobj, fd)) {
|
||||||
anv_gem_syncobj_destroy(device, new_impl.syncobj);
|
anv_gem_syncobj_destroy(device, new_impl.syncobj);
|
||||||
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
return vk_errorf(device, NULL, VK_ERROR_INVALID_EXTERNAL_HANDLE,
|
||||||
@@ -2071,6 +2079,7 @@ VkResult anv_ImportSemaphoreFdKHR(
|
|||||||
* we must close the FD.
|
* we must close the FD.
|
||||||
*/
|
*/
|
||||||
close(fd);
|
close(fd);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
new_impl = (struct anv_semaphore_impl) {
|
new_impl = (struct anv_semaphore_impl) {
|
||||||
.type = ANV_SEMAPHORE_TYPE_SYNC_FILE,
|
.type = ANV_SEMAPHORE_TYPE_SYNC_FILE,
|
||||||
|
Reference in New Issue
Block a user