/** * sync_file_create() - creates a sync file * @fence: fence to add to the sync_fence * * Creates a sync_file containg @fence. This function acquires and additional * reference of @fence for the newly-created &sync_file, if it succeeds. The * sync_file can be released with fput(sync_file->file). Returns the * sync_file or NULL in case of error.
*/ struct sync_file *sync_file_create(struct dma_fence *fence)
{ struct sync_file *sync_file;
sync_file = sync_file_alloc(); if (!sync_file) return NULL;
/** * sync_file_get_fence - get the fence related to the sync_file fd * @fd: sync_file fd to get the fence from * * Ensures @fd references a valid sync_file and returns a fence that * represents all fence in the sync_file. On error NULL is returned.
*/ struct dma_fence *sync_file_get_fence(int fd)
{ struct sync_file *sync_file; struct dma_fence *fence;
sync_file = sync_file_fdget(fd); if (!sync_file) return NULL;
/** * sync_file_get_name - get the name of the sync_file * @sync_file: sync_file to get the fence from * @buf: destination buffer to copy sync_file name into * @len: available size of destination buffer. * * Each sync_file may have a name assigned either by the user (when merging * sync_files together) or created from the fence it contains. In the latter * case construction of the name is deferred until use, and so requires * sync_file_get_name(). * * Returns: a string representing the name.
*/ char *sync_file_get_name(struct sync_file *sync_file, char *buf, int len)
{ if (sync_file->user_name[0]) {
strscpy(buf, sync_file->user_name, len);
} else { struct dma_fence *fence = sync_file->fence; constchar __rcu *timeline; constchar __rcu *driver;
/** * sync_file_merge() - merge two sync_files * @name: name of new fence * @a: sync_file a * @b: sync_file b * * Creates a new sync_file which contains copies of all the fences in both * @a and @b. @a and @b remain valid, independent sync_file. Returns the * new merged sync_file or NULL in case of error.
*/ staticstruct sync_file *sync_file_merge(constchar *name, struct sync_file *a, struct sync_file *b)
{ struct sync_file *sync_file; struct dma_fence *fence;
sync_file = sync_file_alloc(); if (!sync_file) return NULL;
/* * Passing num_fences = 0 means that userspace doesn't want to * retrieve any sync_fence_info. If num_fences = 0 we skip filling * sync_fence_info and return the actual number of fences on * info->num_fences.
*/ if (!info.num_fences) {
info.status = dma_fence_get_status(sync_file->fence); goto no_fences;
} else {
info.status = 1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.