/* * Copyright 2015 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #include <linux/kthread.h> #include <linux/module.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/wait.h> #include <drm/gpu_scheduler.h> static struct kmem_cache *sched_fence_slab; static int __init drm_sched_fence_slab_init(void) { … } static void __exit drm_sched_fence_slab_fini(void) { … } static void drm_sched_fence_set_parent(struct drm_sched_fence *s_fence, struct dma_fence *fence) { … } void drm_sched_fence_scheduled(struct drm_sched_fence *fence, struct dma_fence *parent) { … } void drm_sched_fence_finished(struct drm_sched_fence *fence, int result) { … } static const char *drm_sched_fence_get_driver_name(struct dma_fence *fence) { … } static const char *drm_sched_fence_get_timeline_name(struct dma_fence *f) { … } static void drm_sched_fence_free_rcu(struct rcu_head *rcu) { … } /** * drm_sched_fence_free - free up an uninitialized fence * * @fence: fence to free * * Free up the fence memory. Should only be used if drm_sched_fence_init() * has not been called yet. */ void drm_sched_fence_free(struct drm_sched_fence *fence) { … } /** * drm_sched_fence_release_scheduled - callback that fence can be freed * * @f: fence * * This function is called when the reference count becomes zero. * It just RCU schedules freeing up the fence. */ static void drm_sched_fence_release_scheduled(struct dma_fence *f) { … } /** * drm_sched_fence_release_finished - drop extra reference * * @f: fence * * Drop the extra reference from the scheduled fence to the base fence. */ static void drm_sched_fence_release_finished(struct dma_fence *f) { … } static void drm_sched_fence_set_deadline_finished(struct dma_fence *f, ktime_t deadline) { … } static const struct dma_fence_ops drm_sched_fence_ops_scheduled = …; static const struct dma_fence_ops drm_sched_fence_ops_finished = …; struct drm_sched_fence *to_drm_sched_fence(struct dma_fence *f) { … } EXPORT_SYMBOL(…); struct drm_sched_fence *drm_sched_fence_alloc(struct drm_sched_entity *entity, void *owner) { … } void drm_sched_fence_init(struct drm_sched_fence *fence, struct drm_sched_entity *entity) { … } module_init(…) …; module_exit(drm_sched_fence_slab_fini); MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;