core/syncobjtimeline: import release fence at correct timeline point

SyncTimeline::moveInto imports the provided fence to the syncobj by
calling drmSyncobjImportSyncFile. However, that function assumes the
syncobj a binary syncobj, meaning the fence will be imported at timeline
point 0, not at the intended timeline point.

Since there is no timeline equivalent of drmSyncobjImportSyncFile, to
achieve the correct behavior we create a temporary binary syncobj,
import the fence into that, and then use drmSyncobjTransfer to transfer
the fence to the desired timeline point on the destination syncobj.

Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
This commit is contained in:
Erik Kurzinger 2024-04-16 14:44:50 -07:00
parent 26afbfb6fa
commit 9ca7b9b1cf

View file

@ -110,6 +110,10 @@ void SyncTimeline::signal(uint64_t timelinePoint)
void SyncTimeline::moveInto(uint64_t timelinePoint, const FileDescriptor &fd)
{
drmSyncobjImportSyncFile(m_drmFd, m_handle, fd.get());
uint32_t tempHandle = 0;
drmSyncobjCreate(m_drmFd, 0, &tempHandle);
drmSyncobjImportSyncFile(m_drmFd, tempHandle, fd.get());
drmSyncobjTransfer(m_drmFd, m_handle, timelinePoint, tempHandle, 0, 0);
drmSyncobjDestroy(m_drmFd, tempHandle);
}
}