summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm/ttm_pool_internal.h
blob: cbb17a2129fee202180943792341ec7fc3cb269e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
/* Copyright (c) 2025 Valve Corporation */

#ifndef _TTM_POOL_INTERNAL_H_
#define _TTM_POOL_INTERNAL_H_

#include <drm/ttm/ttm_allocation.h>
#include <drm/ttm/ttm_pool.h>

static inline bool ttm_pool_uses_dma_alloc(struct ttm_pool *pool)
{
	return pool->alloc_flags & TTM_ALLOCATION_POOL_USE_DMA_ALLOC;
}

static inline bool ttm_pool_uses_dma32(struct ttm_pool *pool)
{
	return pool->alloc_flags & TTM_ALLOCATION_POOL_USE_DMA32;
}

static inline unsigned int ttm_pool_beneficial_order(struct ttm_pool *pool)
{
	return pool->alloc_flags & 0xff;
}

/*
 * Implemented in ttm_pool.c, used by ttm_backup.c. Returns true if a fault
 * should be injected mid-compound to test the reactive split-and-retry
 * fallback in ttm_pool_backup(). Always returns false when
 * CONFIG_FAULT_INJECTION is disabled.
 */
bool ttm_backup_fault_inject_folio(void);

#endif