DRM/TTM: add NO_EVICTION flag for type manager
Subsystems (3)
PATCH 1/1 DRM/TTM: add NO_EVICTION flag for type manager
The patch still needs some refine, just want to check if it make sense.
Quoted 1 line
From
104a4800ef8d10fbcc5bd830d0ef0040bd4249e9Mon Sep 17 00:00:00 2001
From: Austin Yuan <[email protected]>
Date: Thu, 4 Feb 2010 16:18:28 +0800
Subject: [PATCH] DRM/TTM: add NO_EVICTION flag for type manager
All buffers allocated from this manager will derive this flag, it is convenient for two reasons:
1) TTM_PL_FLAG_NO_EVICT needs root permission, for non-root X, cursor/overlay buffers need NO_EVICT
2) Some small devices (camera, video) want to use TTM, but don't want to burden driver with heavy
swap/relocation stuff because only one or two applications run at one time.
--- drivers/gpu/drm/ttm/ttm_bo.c | 3 +++ include/drm/ttm/ttm_bo_driver.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -0
@@ -400,6 +400,9 @@ static int ttm_bo_handle_move_mem(struct
ttm_buffer_object *bo,
if (bdev->driver->move_notify)
bdev->driver->move_notify(bo, mem);
+ if (new_man->flags & TTM_MEMTYPE_FLAG_NO_EVICT)
+ bo->mem.placement |= TTM_PL_FLAG_NO_EVICT;
+
if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) &&
!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED))
ret = ttm_bo_move_ttm(bo, evict, no_wait, mem);
include/drm/ttm/ttm_bo_driver.h +1 -0
@@ -180,6 +180,7 @@ struct ttm_tt {#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2)/* Fixed memory needs ioremap before kernel access. */ #define TTM_MEMTYPE_FLAG_CMA (1 << 3)/* Can't map aperture */ +#define TTM_MEMTYPE_FLAG_NO_EVICT (1 << 4)/* no buffer eviction */ /** * struct ttm_mem_type_manager
Signature · 9 lines
1.6.0.4 ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com --
Quoted 15 lines · Shengquan
The patch still needs some refine, just want to check if it make sense.
Quoted 1 line
From
104a4800ef8d10fbcc5bd830d0ef0040bd4249e9Mon Sep 17 00:00:00 2001From: Austin Yuan <[email protected]>
Date: Thu, 4 Feb 2010 16:18:28 +0800
Subject: [PATCH] DRM/TTM: addNO_EVICTIONflag for type managerAll buffers allocated from this manager will derive this flag, it is convenient for two reasons:
1)TTM_PL_FLAG_NO_EVICTneeds root permission, for non-root X, cursor/overlay buffers needNO_EVICT
2) Some small devices (camera, video) want to use TTM, but don't want to burden driver with heavy
swap/relocation stuff because only one or two applications run at one time.
Quoted 1 line
Signed-off-by Austin Yuan <[email protected]>
My feeling is NAK, you can do that that by always oring TTM_PL_FLAG_NO_EVICT to the flags you give a BO allocation time. It's not hard.
Cheers,
Jerome
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
Quoted 16 lines · Jerome Glisse
Quoted 15 lines · Shengquan
The patch still needs some refine, just want to check if it make sense.
Quoted 1 line
From
104a4800ef8d10fbcc5bd830d0ef0040bd4249e9Mon Sep 17 00:00:00 2001From: Austin Yuan <[email protected]>
Date: Thu, 4 Feb 2010 16:18:28 +0800
Subject: [PATCH] DRM/TTM: addNO_EVICTIONflag for type managerAll buffers allocated from this manager will derive this flag, it is convenient for two reasons:
1)TTM_PL_FLAG_NO_EVICTneeds root permission, for non-root X, cursor/overlay buffers needNO_EVICT
2) Some small devices (camera, video) want to use TTM, but don't want to burden driver with heavy
swap/relocation stuff because only one or two applications run at one time.
Quoted 4 lines
Quoted 1 line
Signed-off-by Austin Yuan <[email protected]>My feeling is NAK, you can do that that by always oring
TTM_PL_FLAG_NO_EVICTto the flags you give a BO allocation time. It's not hard.
The problem is TTM_PL_FLAG_NO_EVICT needs root permission (checked in ttm_bo_check_placement which is called by ttm_bo_init), and then non-root user hasn't a way to allocate such BO.
Austin
Quoted 4 lines
Cheers,
Jerome
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--