-
Notifications
You must be signed in to change notification settings - Fork 60
syncobj::fd_to_handle with import_sync_file = true is wrong #224
Copy link
Copy link
Open
Description
DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE imports a fence fd into an existing syncobj handle which needs to be passed into handle. But the current function always passes handle: 0 on line 73 so it cannot work:
Lines 67 to 88 in b65efbc
| pub fn fd_to_handle( | |
| fd: BorrowedFd<'_>, | |
| syncobj_fd: BorrowedFd<'_>, | |
| import_sync_file: bool, | |
| ) -> io::Result<drm_syncobj_handle> { | |
| let mut args = drm_syncobj_handle { | |
| handle: 0, | |
| flags: if import_sync_file { | |
| DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE | |
| } else { | |
| 0 | |
| }, | |
| fd: syncobj_fd.as_raw_fd(), | |
| pad: 0, | |
| }; | |
| unsafe { | |
| ioctl::syncobj::fd_to_handle(fd, &mut args)?; | |
| } | |
| Ok(args) | |
| } |
The API should have a separate function like:
pub fn syncobj_import_sync_file(
fd: BorrowedFd<'_>,
handle: u32,
sync_file: BorrowedFd<'_>,
) -> io::Result<drm_syncobj_handle> {
let mut args = drm_syncobj_handle {
handle,
flags: DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_IMPORT_SYNC_FILE,
fd: sync_file.as_raw_fd(),
pad: 0,
};
unsafe {
ioctl::syncobj::fd_to_handle(fd, &mut args)?;
}
Ok(args)
}(idk if the return value is any useful here)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels