[RFC 2/3] drm/ttm: Add the priority queue to appropriate structs
Lauri Kasanen
cand at gmx.com
Fri Apr 4 06:53:17 PDT 2014
Signed-off-by: Lauri Kasanen <cand at gmx.com>
---
drivers/gpu/drm/ast/ast_ttm.c | 1 +
drivers/gpu/drm/bochs/bochs_mm.c | 1 +
drivers/gpu/drm/cirrus/cirrus_ttm.c | 1 +
drivers/gpu/drm/mgag200/mgag200_ttm.c | 1 +
drivers/gpu/drm/nouveau/nouveau_ttm.c | 2 +-
drivers/gpu/drm/qxl/qxl_ttm.c | 2 +-
drivers/gpu/drm/radeon/radeon_ttm.c | 1 +
drivers/gpu/drm/ttm/ttm_bo.c | 2 ++
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +-
include/drm/ttm/ttm_bo_api.h | 2 ++
include/drm/ttm/ttm_bo_driver.h | 7 +++++++
11 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index 61f9e39..311f37f 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -263,6 +263,7 @@ int ast_mm_init(struct ast_private *ast)
dev->anon_inode->i_mapping,
DRM_FILE_PAGE_OFFSET,
true,
+ false,
0);
if (ret) {
DRM_ERROR("Error initialising bo driver; %d\n", ret);
diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index 9dfd24a..c4aba61 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -229,6 +229,7 @@ int bochs_mm_init(struct bochs_device *bochs)
bochs->dev->anon_inode->i_mapping,
DRM_FILE_PAGE_OFFSET,
true,
+ false,
0);
if (ret) {
DRM_ERROR("Error initialising bo driver; %d\n", ret);
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c
index 74e8e21..895d20e 100644
--- a/drivers/gpu/drm/cirrus/cirrus_ttm.c
+++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c
@@ -263,6 +263,7 @@ int cirrus_mm_init(struct cirrus_device *cirrus)
dev->anon_inode->i_mapping,
DRM_FILE_PAGE_OFFSET,
true,
+ false,
0);
if (ret) {
DRM_ERROR("Error initialising bo driver; %d\n", ret);
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c
index 6844b24..591f68e 100644
--- a/drivers/gpu/drm/mgag200/mgag200_ttm.c
+++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c
@@ -263,6 +263,7 @@ int mgag200_mm_init(struct mga_device *mdev)
dev->anon_inode->i_mapping,
DRM_FILE_PAGE_OFFSET,
true,
+ false,
0);
if (ret) {
DRM_ERROR("Error initialising bo driver; %d\n", ret);
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c
index 3fef97c..4b032b4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ttm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c
@@ -384,7 +384,7 @@ nouveau_ttm_init(struct nouveau_drm *drm)
&nouveau_bo_driver,
dev->anon_inode->i_mapping,
DRM_FILE_PAGE_OFFSET,
- bits <= 32 ? true : false, 0);
+ bits <= 32 ? true : false, false, 0);
if (ret) {
NV_ERROR(drm, "error initialising bo driver, %d\n", ret);
return ret;
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index 8401a00..88f12e7 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -495,7 +495,7 @@ int qxl_ttm_init(struct qxl_device *qdev)
qdev->mman.bo_global_ref.ref.object,
&qxl_bo_driver,
qdev->ddev->anon_inode->i_mapping,
- DRM_FILE_PAGE_OFFSET, 0, 0);
+ DRM_FILE_PAGE_OFFSET, 0, false, 0);
if (r) {
DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
return r;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 1aef339..dd96ed5 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -711,6 +711,7 @@ int radeon_ttm_init(struct radeon_device *rdev)
rdev->ddev->anon_inode->i_mapping,
DRM_FILE_PAGE_OFFSET,
rdev->need_dma32,
+ false,
512 * 1024);
if (r) {
DRM_ERROR("failed initializing buffer object driver(%d).\n", r);
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index caf7cd3..621151c 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1454,6 +1454,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
struct address_space *mapping,
uint64_t file_page_offset,
bool need_dma32,
+ bool use_pqueue,
uint32_t alloc_threshold)
{
int ret = -EINVAL;
@@ -1477,6 +1478,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev,
bdev->dev_mapping = mapping;
bdev->glob = glob;
bdev->need_dma32 = need_dma32;
+ bdev->use_pqueue = use_pqueue;
bdev->alloc_threshold = alloc_threshold;
bdev->val_seq = 0;
spin_lock_init(&bdev->fence_lock);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 59a50dd..12cdca4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -725,7 +725,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
&vmw_bo_driver,
dev->anon_inode->i_mapping,
VMWGFX_FILE_PAGE_OFFSET,
- false, 0);
+ false, false, 0);
if (unlikely(ret != 0)) {
DRM_ERROR("Failed initializing TTM buffer object driver.\n");
goto out_err1;
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index ee127ec..2d767c8 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -33,6 +33,7 @@
#include <drm/drm_hashtab.h>
#include <drm/drm_vma_manager.h>
+#include <ttm/ttm_priority.h>
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/wait.h>
@@ -225,6 +226,7 @@ struct ttm_buffer_object {
struct list_head ddestroy;
struct list_head swap;
struct list_head io_reserve_lru;
+ struct ttm_pqueue_entry pqueue;
/**
* Members protected by struct buffer_object_device::fence_lock
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 4924c487..b83871f 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -34,6 +34,7 @@
#include <ttm/ttm_memory.h>
#include <ttm/ttm_module.h>
#include <ttm/ttm_placement.h>
+#include <ttm/ttm_priority.h>
#include <drm/drm_mm.h>
#include <drm/drm_global.h>
#include <drm/drm_vma_manager.h>
@@ -257,6 +258,7 @@ struct ttm_mem_type_manager_func {
* @io_reserve_fastpath: Only use bdev::driver::io_mem_reserve to obtain
* static information. bdev::driver::io_mem_free is never used.
* @lru: The lru list for this memory type.
+ * @pqueue: The priority queue for this memory type. Only lru or pqueue is used.
*
* This structure is used to identify and manage memory types for a device.
* It's set up by the ttm_bo_driver::init_mem_type method.
@@ -295,6 +297,7 @@ struct ttm_mem_type_manager {
*/
struct list_head lru;
+ struct ttm_pqueue pqueue;
};
/**
@@ -527,6 +530,7 @@ struct ttm_bo_global {
* @dev_mapping: A pointer to the struct address_space representing the
* device address space.
* @wq: Work queue structure for the delayed delete workqueue.
+ * @use_pqueue: Whether to use a priority queue for VRAM bos instead of lru.
* @alloc_threshold: If non-zero, use this as the threshold for two-ended
* allocation.
*
@@ -567,6 +571,7 @@ struct ttm_bo_device {
struct delayed_work wq;
bool need_dma32;
+ bool use_pqueue;
uint32_t alloc_threshold;
};
@@ -754,6 +759,7 @@ extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
* @file_page_offset: Offset into the device address space that is available
* for buffer data. This ensures compatibility with other users of the
* address space.
+ * @use_pqueue: Whether to use a priority queue for VRAM bos instead of lru.
* @alloc_threshold: If non-zero, use this as the threshold for two-ended
* allocation.
*
@@ -767,6 +773,7 @@ extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
struct address_space *mapping,
uint64_t file_page_offset,
bool need_dma32,
+ bool use_pqueue,
uint32_t alloc_threshold);
/**
--
1.8.3.1
More information about the dri-devel
mailing list