162306a36Sopenharmony_ci/* SPDX-License-Identifier: MIT */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright © 2021 Intel Corporation 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef _I915_DEPS_H_ 762306a36Sopenharmony_ci#define _I915_DEPS_H_ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/types.h> 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_cistruct ttm_operation_ctx; 1262306a36Sopenharmony_cistruct dma_fence; 1362306a36Sopenharmony_cistruct dma_resv; 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/** 1662306a36Sopenharmony_ci * struct i915_deps - Collect dependencies into a single dma-fence 1762306a36Sopenharmony_ci * @single: Storage for pointer if the collection is a single fence. 1862306a36Sopenharmony_ci * @fences: Allocated array of fence pointers if more than a single fence; 1962306a36Sopenharmony_ci * otherwise points to the address of @single. 2062306a36Sopenharmony_ci * @num_deps: Current number of dependency fences. 2162306a36Sopenharmony_ci * @fences_size: Size of the @fences array in number of pointers. 2262306a36Sopenharmony_ci * @gfp: Allocation mode. 2362306a36Sopenharmony_ci */ 2462306a36Sopenharmony_cistruct i915_deps { 2562306a36Sopenharmony_ci struct dma_fence *single; 2662306a36Sopenharmony_ci struct dma_fence **fences; 2762306a36Sopenharmony_ci unsigned int num_deps; 2862306a36Sopenharmony_ci unsigned int fences_size; 2962306a36Sopenharmony_ci gfp_t gfp; 3062306a36Sopenharmony_ci}; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_civoid i915_deps_init(struct i915_deps *deps, gfp_t gfp); 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_civoid i915_deps_fini(struct i915_deps *deps); 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciint i915_deps_add_dependency(struct i915_deps *deps, 3762306a36Sopenharmony_ci struct dma_fence *fence, 3862306a36Sopenharmony_ci const struct ttm_operation_ctx *ctx); 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ciint i915_deps_add_resv(struct i915_deps *deps, struct dma_resv *resv, 4162306a36Sopenharmony_ci const struct ttm_operation_ctx *ctx); 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ciint i915_deps_sync(const struct i915_deps *deps, 4462306a36Sopenharmony_ci const struct ttm_operation_ctx *ctx); 4562306a36Sopenharmony_ci#endif 46