The patch still needs some refine, just want to check if it make sense.

>From 104a4800ef8d10fbcc5bd830d0ef0040bd4249e9 Mon 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.

Signed-off-by: Austin Yuan <[email protected]>
---
 drivers/gpu/drm/ttm/ttm_bo.c    |    3 +++
 include/drm/ttm/ttm_bo_driver.h |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 1a3e909..b8b5e8a 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -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);
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 4c4e0f8..ae82473 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -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
-- 
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
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to