summaryrefslogtreecommitdiff
path: root/include/drm/ttm/ttm_tt.h
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2020-09-30 11:38:48 +0300
committerChristian König <christian.koenig@amd.com>2020-10-15 13:50:40 +0300
commit1b4ea4c5980ff3a64607166298269c30a9671d33 (patch)
treec96db402414813d2002866a7533024ec512c655b /include/drm/ttm/ttm_tt.h
parent070c7fa58bce986eb7a504390dd429edcb068f44 (diff)
downloadlinux-1b4ea4c5980ff3a64607166298269c30a9671d33.tar.xz
drm/ttm: set the tt caching state at creation time
All drivers can determine the tt caching state at creation time, no need to do this on the fly during every validation. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com> Link: https://patchwork.freedesktop.org/patch/394253/
Diffstat (limited to 'include/drm/ttm/ttm_tt.h')
-rw-r--r--include/drm/ttm/ttm_tt.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/include/drm/ttm/ttm_tt.h b/include/drm/ttm/ttm_tt.h
index 5d1835d44084..c39c722d5184 100644
--- a/include/drm/ttm/ttm_tt.h
+++ b/include/drm/ttm/ttm_tt.h
@@ -28,6 +28,7 @@
#define _TTM_TT_H_
#include <linux/types.h>
+#include <drm/ttm/ttm_caching.h>
struct ttm_tt;
struct ttm_resource;
@@ -42,12 +43,6 @@ struct ttm_operation_ctx;
#define TTM_PAGE_FLAG_PRIV_POPULATED (1 << 31)
-enum ttm_caching_state {
- tt_uncached,
- tt_wc,
- tt_cached
-};
-
/**
* struct ttm_tt
*
@@ -69,7 +64,7 @@ struct ttm_tt {
unsigned long num_pages;
struct sg_table *sg; /* for SG objects via dma-buf */
struct file *swap_storage;
- enum ttm_caching_state caching_state;
+ enum ttm_caching caching;
};
static inline bool ttm_tt_is_populated(struct ttm_tt *tt)
@@ -121,6 +116,7 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc);
* @ttm: The struct ttm_tt.
* @bo: The buffer object we create the ttm for.
* @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
+ * @caching: the desired caching state of the pages
*
* Create a struct ttm_tt to back data with system memory pages.
* No pages are actually allocated.
@@ -128,11 +124,11 @@ int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc);
* NULL: Out of memory.
*/
int ttm_tt_init(struct ttm_tt *ttm, struct ttm_buffer_object *bo,
- uint32_t page_flags);
+ uint32_t page_flags, enum ttm_caching caching);
int ttm_dma_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo,
- uint32_t page_flags);
+ uint32_t page_flags, enum ttm_caching caching);
int ttm_sg_tt_init(struct ttm_dma_tt *ttm_dma, struct ttm_buffer_object *bo,
- uint32_t page_flags);
+ uint32_t page_flags, enum ttm_caching caching);
/**
* ttm_tt_fini