brintos

brintos / linux-shallow public Read only

0
0
Text · 1.9 KiB · 8a7650b Raw
68 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2019 Intel Corporation4 */5 6#ifndef __I915_GEM_REGION_H__7#define __I915_GEM_REGION_H__8 9#include <linux/types.h>10 11struct intel_memory_region;12struct drm_i915_gem_object;13struct sg_table;14 15struct i915_gem_apply_to_region;16 17#define I915_BO_INVALID_OFFSET ((resource_size_t)-1)18 19/**20 * struct i915_gem_apply_to_region_ops - ops to use when iterating over all21 * region objects.22 */23struct i915_gem_apply_to_region_ops {24	/**25	 * @process_obj: Process the current object26	 *27	 * Note that if this function is part of a ww transaction, and28	 * if returns -EDEADLK for one of the objects, it may be29	 * rerun for that same object in the same pass.30	 */31	int (*process_obj)(struct i915_gem_apply_to_region *apply,32			   struct drm_i915_gem_object *obj);33};34 35/**36 * struct i915_gem_apply_to_region - Argument to the struct37 * i915_gem_apply_to_region_ops functions.38 * @ops: The ops for the operation.39 * @ww: Locking context used for the transaction.40 * @interruptible: Whether to perform object locking interruptible.41 *42 * This structure is intended to be embedded in a private struct if needed43 */44struct i915_gem_apply_to_region {45	const struct i915_gem_apply_to_region_ops *ops;46	struct i915_gem_ww_ctx *ww;47	u32 interruptible:1;48};49 50void i915_gem_object_init_memory_region(struct drm_i915_gem_object *obj,51					struct intel_memory_region *mem);52void i915_gem_object_release_memory_region(struct drm_i915_gem_object *obj);53 54struct drm_i915_gem_object *55i915_gem_object_create_region(struct intel_memory_region *mem,56			      resource_size_t size,57			      resource_size_t page_size,58			      unsigned int flags);59struct drm_i915_gem_object *60i915_gem_object_create_region_at(struct intel_memory_region *mem,61				 resource_size_t offset,62				 resource_size_t size,63				 unsigned int flags);64 65int i915_gem_process_region(struct intel_memory_region *mr,66			    struct i915_gem_apply_to_region *apply);67#endif68