From patchwork Fri Apr 4 13:53:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lauri Kasanen X-Patchwork-Id: 3938491 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 20EFFBFF02 for ; Fri, 4 Apr 2014 13:52:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1FB572038D for ; Fri, 4 Apr 2014 13:52:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EDC7620397 for ; Fri, 4 Apr 2014 13:52:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 29E836ED87; Fri, 4 Apr 2014 06:52:46 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by gabe.freedesktop.org (Postfix) with ESMTP id 0465F6ED87 for ; Fri, 4 Apr 2014 06:52:44 -0700 (PDT) Received: from Valinor ([84.248.177.169]) by mail.gmx.com (mrgmx003) with ESMTPA (Nemesis) id 0Lvkwm-1X6FK13Oua-017VFi for ; Fri, 04 Apr 2014 15:52:42 +0200 Date: Fri, 4 Apr 2014 16:53:17 +0300 From: Lauri Kasanen To: dri-devel@lists.freedesktop.org Subject: [RFC 2/3] drm/ttm: Add the priority queue to appropriate structs Message-Id: <20140404165317.8a263369.cand@gmx.com> X-Mailer: Sylpheed 3.1.4 (GTK+ 2.18.6; x86_64-unknown-linux-gnu) Mime-Version: 1.0 X-Provags-ID: V03:K0:mLTjmpXKIsIdVkww91Sg2KiG9hrmEGaPp5ZW7bbAuJ4dn0ddBR2 fb4U+1Pzc3DGLwtQ0AwCoZauQtyIBhqdyLeIPuFW1pncb87ZNjpQXsu15pCzfQIH0tPJ0m+ wa4TSfA1qyxQORArwyqu/rHnTBUBKyNIFYfasJnwRU/ZGIK0P6eFJbczZ/s0496B+ZxqEpr 0RH19mr6jbqKmJ9ZG3xOQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Lauri Kasanen --- 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 #include +#include #include #include #include @@ -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 #include #include +#include #include #include #include @@ -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); /**