mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
c56ce95653
Just evict unpinned objects to system. For pinned LMEM objects, make a backup system object and blit the contents to that. Backup is performed in three steps, 1: Opportunistically evict evictable objects using the gpu blitter. 2: After gt idle, evict evictable objects using the gpu blitter. This will be modified in an upcoming patch to backup pinned objects that are not used by the blitter itself. 3: Backup remaining pinned objects using memcpy. Also move uC suspend to after 2) to make sure we have a functional GuC during 2) if using GuC submission. v2: - Major refactor to make sure gem_exec_suspend@hang-SX subtests work, and suspend / resume works with a slightly modified GuC submission enabling patch series. v3: - Fix a potential use-after-free (Matthew Auld) - Use i915_gem_object_create_shmem() instead of i915_gem_object_create_region (Matthew Auld) - Minor simplifications (Matthew Auld) - Fix up kerneldoc for i195_ttm_restore_region(). - Final lmem_suspend() call moved to i915_gem_backup_suspend from i915_gem_suspend_late, since the latter gets called at driver unload and we don't unnecessarily want to run it at that time. v4: - Interface change of ttm- & lmem suspend / resume functions to use flags rather than bools. (Matthew Auld) - Completely drop the i915_gem_backup_suspend change (Matthew Auld) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210922062527.865433-5-thomas.hellstrom@linux.intel.com
63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2021 Intel Corporation
|
|
*/
|
|
#ifndef _I915_GEM_TTM_H_
|
|
#define _I915_GEM_TTM_H_
|
|
|
|
#include "gem/i915_gem_object_types.h"
|
|
|
|
/**
|
|
* i915_gem_to_ttm - Convert a struct drm_i915_gem_object to a
|
|
* struct ttm_buffer_object.
|
|
* @obj: Pointer to the gem object.
|
|
*
|
|
* Return: Pointer to the embedded struct ttm_buffer_object.
|
|
*/
|
|
static inline struct ttm_buffer_object *
|
|
i915_gem_to_ttm(struct drm_i915_gem_object *obj)
|
|
{
|
|
return &obj->__do_not_access;
|
|
}
|
|
|
|
/*
|
|
* i915 ttm gem object destructor. Internal use only.
|
|
*/
|
|
void i915_ttm_bo_destroy(struct ttm_buffer_object *bo);
|
|
|
|
/**
|
|
* i915_ttm_to_gem - Convert a struct ttm_buffer_object to an embedding
|
|
* struct drm_i915_gem_object.
|
|
*
|
|
* Return: Pointer to the embedding struct ttm_buffer_object, or NULL
|
|
* if the object was not an i915 ttm object.
|
|
*/
|
|
static inline struct drm_i915_gem_object *
|
|
i915_ttm_to_gem(struct ttm_buffer_object *bo)
|
|
{
|
|
if (GEM_WARN_ON(bo->destroy != i915_ttm_bo_destroy))
|
|
return NULL;
|
|
|
|
return container_of(bo, struct drm_i915_gem_object, __do_not_access);
|
|
}
|
|
|
|
int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
|
|
struct drm_i915_gem_object *obj,
|
|
resource_size_t size,
|
|
resource_size_t page_size,
|
|
unsigned int flags);
|
|
|
|
int i915_gem_obj_copy_ttm(struct drm_i915_gem_object *dst,
|
|
struct drm_i915_gem_object *src,
|
|
bool allow_accel, bool intr);
|
|
|
|
/* Internal I915 TTM declarations and definitions below. */
|
|
|
|
#define I915_PL_LMEM0 TTM_PL_PRIV
|
|
#define I915_PL_SYSTEM TTM_PL_SYSTEM
|
|
#define I915_PL_STOLEN TTM_PL_VRAM
|
|
#define I915_PL_GGTT TTM_PL_TT
|
|
|
|
struct ttm_placement *i915_ttm_sys_placement(void);
|
|
|
|
#endif
|