drivers/gpu/drm/imagination/pvr_sync.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imagination/pvr_sync.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/imagination/pvr_sync.c- Extension
.c- Size
- 6728 bytes
- Lines
- 290
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
uapi/drm/pvr_drm.hdrm/drm_syncobj.hdrm/gpu_scheduler.hlinux/xarray.hlinux/dma-fence-unwrap.hpvr_device.hpvr_queue.hpvr_sync.h
Detected Declarations
function pvr_check_sync_opfunction pvr_sync_signal_freefunction pvr_sync_signal_array_cleanupfunction pvr_sync_signal_array_addfunction pvr_sync_signal_array_searchfunction xa_for_eachfunction pvr_sync_signal_array_getfunction pvr_sync_signal_array_collect_opsfunction pvr_sync_signal_array_update_fencesfunction pvr_sync_signal_array_push_fencesfunction xa_for_eachfunction pvr_sync_add_dep_to_jobfunction dma_fence_unwrap_for_eachfunction dma_fence_unwrap_for_eachfunction pvr_sync_add_deps_to_job
Annotated Snippet
if (!sig_sync->chain) {
err = -ENOMEM;
goto err_free_sig_sync;
}
}
sig_sync->syncobj = drm_syncobj_find(file, handle);
if (!sig_sync->syncobj) {
err = -EINVAL;
goto err_free_sig_sync;
}
/* Retrieve the current fence attached to that point. It's
* perfectly fine to get a NULL fence here, it just means there's
* no fence attached to that point yet.
*/
if (!drm_syncobj_find_fence(file, handle, point, 0, &cur_fence))
sig_sync->fence = cur_fence;
err = xa_alloc(array, &id, sig_sync, xa_limit_32b, GFP_KERNEL);
if (err)
goto err_free_sig_sync;
return sig_sync;
err_free_sig_sync:
pvr_sync_signal_free(sig_sync);
return ERR_PTR(err);
}
static struct pvr_sync_signal *
pvr_sync_signal_array_search(struct xarray *array, u32 handle, u64 point)
{
struct pvr_sync_signal *sig_sync;
unsigned long i;
xa_for_each(array, i, sig_sync) {
if (handle == sig_sync->handle && point == sig_sync->point)
return sig_sync;
}
return NULL;
}
static struct pvr_sync_signal *
pvr_sync_signal_array_get(struct xarray *array, struct drm_file *file, u32 handle, u64 point)
{
struct pvr_sync_signal *sig_sync;
sig_sync = pvr_sync_signal_array_search(array, handle, point);
if (sig_sync)
return sig_sync;
return pvr_sync_signal_array_add(array, file, handle, point);
}
int
pvr_sync_signal_array_collect_ops(struct xarray *array,
struct drm_file *file,
u32 sync_op_count,
const struct drm_pvr_sync_op *sync_ops)
{
for (u32 i = 0; i < sync_op_count; i++) {
struct pvr_sync_signal *sig_sync;
int ret;
if (!(sync_ops[i].flags & DRM_PVR_SYNC_OP_FLAG_SIGNAL))
continue;
ret = pvr_check_sync_op(&sync_ops[i]);
if (ret)
return ret;
sig_sync = pvr_sync_signal_array_get(array, file,
sync_ops[i].handle,
sync_ops[i].value);
if (IS_ERR(sig_sync))
return PTR_ERR(sig_sync);
}
return 0;
}
int
pvr_sync_signal_array_update_fences(struct xarray *array,
u32 sync_op_count,
const struct drm_pvr_sync_op *sync_ops,
struct dma_fence *finished_fence)
{
for (u32 i = 0; i < sync_op_count; i++) {
Annotation
- Immediate include surface: `uapi/drm/pvr_drm.h`, `drm/drm_syncobj.h`, `drm/gpu_scheduler.h`, `linux/xarray.h`, `linux/dma-fence-unwrap.h`, `pvr_device.h`, `pvr_queue.h`, `pvr_sync.h`.
- Detected declarations: `function pvr_check_sync_op`, `function pvr_sync_signal_free`, `function pvr_sync_signal_array_cleanup`, `function pvr_sync_signal_array_add`, `function pvr_sync_signal_array_search`, `function xa_for_each`, `function pvr_sync_signal_array_get`, `function pvr_sync_signal_array_collect_ops`, `function pvr_sync_signal_array_update_fences`, `function pvr_sync_signal_array_push_fences`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.