summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kolb <jkolb@brandeis.edu>2007-10-31 20:14:48 -0400
committerJeremy Kolb <jkolb@brandeis.edu>2007-10-31 20:14:48 -0400
commit9416541fb29666c630f2bcfcc0f3ae0b6c4436d8 (patch)
treee9eb35ec99c6173967202518faea490f593be9cf
parent31847b4b62575739a164e019b33ced0531683403 (diff)
parent61cbcb5dbe487c6d4eba04794cbaa0279ab807b0 (diff)
Merge branch 'master' of git+ssh://git.freedesktop.org/git/mesa/drm
-rw-r--r--linux-core/drm_agpsupport.c8
-rw-r--r--linux-core/drm_bo.c18
-rw-r--r--linux-core/drm_ttm.c2
-rw-r--r--shared-core/drm.h10
4 files changed, 22 insertions, 16 deletions
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index 8c7f570e..7c50f411 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -541,11 +541,15 @@ static int drm_agp_bind_ttm(struct drm_ttm_backend *backend,
container_of(backend, struct drm_agp_ttm_backend, backend);
DRM_AGP_MEM *mem = agp_be->mem;
int ret;
+ int snooped = (bo_mem->flags & DRM_BO_FLAG_CACHED) && !(bo_mem->flags & DRM_BO_FLAG_CACHED_MAPPED);
DRM_DEBUG("drm_agp_bind_ttm\n");
mem->is_flushed = TRUE;
- mem->type = (bo_mem->flags & DRM_BO_FLAG_CACHED) ? AGP_USER_CACHED_MEMORY :
- AGP_USER_MEMORY;
+ mem->type = AGP_USER_MEMORY;
+ /* CACHED MAPPED implies not snooped memory */
+ if (snooped)
+ mem->type = AGP_USER_CACHED_MEMORY;
+
ret = drm_agp_bind_memory(mem, bo_mem->mm_node->start);
if (ret) {
DRM_ERROR("AGP Bind memory failed\n");
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 16203c77..dc96e8aa 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -806,6 +806,9 @@ static int drm_bo_mt_compatible(struct drm_mem_type_manager * man,
}
flag_diff = (mask ^ cur_flags);
+ if (flag_diff & DRM_BO_FLAG_CACHED_MAPPED)
+ cur_flags |= DRM_BO_FLAG_CACHED_MAPPED;
+
if ((flag_diff & DRM_BO_FLAG_CACHED) &&
(!(mask & DRM_BO_FLAG_CACHED) ||
(mask & DRM_BO_FLAG_FORCE_CACHING)))
@@ -1029,7 +1032,7 @@ static int drm_bo_busy(struct drm_buffer_object * bo)
return 0;
}
-static int drm_bo_read_cached(struct drm_buffer_object * bo)
+static int drm_bo_evict_cached(struct drm_buffer_object * bo)
{
int ret = 0;
@@ -1177,15 +1180,11 @@ static int drm_buffer_object_map(struct drm_file *file_priv, uint32_t handle,
goto out;
}
- if ((map_flags & DRM_BO_FLAG_READ) &&
- (bo->mem.flags & DRM_BO_FLAG_READ_CACHED) &&
- (!(bo->mem.flags & DRM_BO_FLAG_CACHED))) {
- drm_bo_read_cached(bo);
- }
+ if (bo->mem.flags & DRM_BO_FLAG_CACHED_MAPPED)
+ drm_bo_evict_cached(bo);
+
break;
- } else if ((map_flags & DRM_BO_FLAG_READ) &&
- (bo->mem.flags & DRM_BO_FLAG_READ_CACHED) &&
- (!(bo->mem.flags & DRM_BO_FLAG_CACHED))) {
+ } else if (bo->mem.flags & DRM_BO_FLAG_CACHED_MAPPED) {
/*
* We are already mapped with different flags.
@@ -1666,7 +1665,6 @@ int drm_buffer_object_create(struct drm_device *dev,
DRM_BO_FLAG_MAPPABLE;
atomic_inc(&bm->count);
ret = drm_bo_new_mask(bo, mask, hint);
-
if (ret)
goto out_err;
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index df9e7e44..fd03f6e8 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -329,7 +329,7 @@ int drm_bind_ttm(struct drm_ttm * ttm, struct drm_bo_mem_reg *bo_mem)
if (ttm->state == ttm_unbound && !(bo_mem->flags & DRM_BO_FLAG_CACHED)) {
drm_set_caching(ttm, DRM_TTM_PAGE_UNCACHED);
- } else if ((bo_mem->flags & DRM_BO_FLAG_CACHED) &&
+ } else if ((bo_mem->flags & DRM_BO_FLAG_CACHED_MAPPED) &&
bo_driver->ttm_cache_flush)
bo_driver->ttm_cache_flush(ttm);
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 3a102735..4059a6fb 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -700,10 +700,14 @@ struct drm_fence_arg {
*/
#define DRM_BO_FLAG_NO_MOVE (1ULL << 8)
-/* Mask: Make sure the buffer is in cached memory when mapped for reading.
+/* Mask: Make sure the buffer is in cached memory when mapped
* Flags: Acknowledge.
+ * Buffers allocated with this flag should not be used for suballocators
+ * This type may have issues on CPUs with over-aggressive caching
+ * http://marc.info/?l=linux-kernel&m=102376926732464&w=2
*/
-#define DRM_BO_FLAG_READ_CACHED (1ULL << 19)
+#define DRM_BO_FLAG_CACHED_MAPPED (1ULL << 19)
+
/* Mask: Force DRM_BO_FLAG_CACHED flag strictly also if it is set.
* Flags: Acknowledge.
@@ -738,7 +742,7 @@ struct drm_fence_arg {
/* Memory flag mask */
#define DRM_BO_MASK_MEM 0x00000000FF000000ULL
-#define DRM_BO_MASK_MEMTYPE 0x00000000FF0000A0ULL
+#define DRM_BO_MASK_MEMTYPE 0x00000000FF0800A0ULL
/* Driver-private flags */
#define DRM_BO_MASK_DRIVER 0xFFFF000000000000ULL