Avoid driver-specific AGP user-populated types, since we don't know what AGP
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Wed, 18 Oct 2006 14:54:17 +0000 (16:54 +0200)
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Wed, 18 Oct 2006 14:54:17 +0000 (16:54 +0200)
driver we're on.
Avoid global cache flushes before inserting pages.
In general, they are never mapped, and not accessed through the kernel map, so
a cache flush should not be necessary. The exception is pages that are bound
cached. We might need a cache flush for those.

linux-core/drmP.h
linux-core/drm_agpsupport.c
linux-core/i915_buffer.c

index fab3608..d78ea7c 100644 (file)
@@ -1295,10 +1295,7 @@ extern int drm_agp_free_memory(DRM_AGP_MEM * handle);
 extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
 extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
 extern drm_ttm_backend_t *drm_agp_init_ttm(struct drm_device *dev,
-                                          drm_ttm_backend_t *backend,
-                                          unsigned alloc_type,
-                                          unsigned cached_type,
-                                          unsigned uncached_type);
+                                          drm_ttm_backend_t *backend);
                                /* Stub support (drm_stub.h) */
 extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
                     struct drm_driver *driver);
index ffbe04f..a5f1f9e 100644 (file)
@@ -558,6 +558,12 @@ int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
  * AGP ttm backend interface.
  */
 
+#ifndef AGP_USER_TYPES
+#define AGP_USER_TYPES (1 << 16)
+#define AGP_USER_MEMORY (AGP_USER_TYPES)
+#define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
+#endif
+
 static int drm_agp_needs_unbind_cache_adjust(drm_ttm_backend_t *backend) {
        return ((backend->flags & DRM_BE_FLAG_BOUND_CACHED) ? 0 : 1);
 }
@@ -604,7 +610,7 @@ static int drm_agp_bind_ttm(drm_ttm_backend_t *backend,
        DRM_DEBUG("drm_agp_bind_ttm\n");
        DRM_MASK_VAL(backend->flags, DRM_BE_FLAG_BOUND_CACHED,
                     (cached) ? DRM_BE_FLAG_BOUND_CACHED : 0);
-       mem->is_flushed = FALSE;
+       mem->is_flushed = TRUE;
        mem->type = (cached) ? agp_priv->cached_type : agp_priv->uncached_type;
        ret = drm_agp_bind_memory(mem, offset);
        if (ret) {
@@ -662,10 +668,8 @@ static void drm_agp_destroy_ttm(drm_ttm_backend_t *backend) {
        
 
 drm_ttm_backend_t *drm_agp_init_ttm(struct drm_device *dev,
-                                   drm_ttm_backend_t *backend,
-                                   unsigned alloc_type,
-                                   unsigned cached_type,
-                                   unsigned uncached_type) {
+                                   drm_ttm_backend_t *backend)
+{
 
         drm_ttm_backend_t *agp_be;
        drm_agp_ttm_priv *agp_priv;
@@ -684,9 +688,9 @@ drm_ttm_backend_t *drm_agp_init_ttm(struct drm_device *dev,
        }
        
        agp_priv->mem = NULL;
-       agp_priv->alloc_type = alloc_type;
-       agp_priv->cached_type = cached_type;
-       agp_priv->uncached_type = uncached_type;
+       agp_priv->alloc_type = AGP_USER_MEMORY;
+       agp_priv->cached_type = AGP_USER_CACHED_MEMORY;
+       agp_priv->uncached_type = AGP_USER_MEMORY;
        agp_priv->bridge = dev->agp->bridge;
        agp_priv->populated = FALSE;
        agp_be->aperture_base = dev->agp->agp_info.aper_base;
index 729ba4b..c3e5446 100644 (file)
 #include "i915_drm.h"
 #include "i915_drv.h"
 
-#define INTEL_AGP_MEM_USER 3
-#define INTEL_AGP_MEM_UCACHED 4
 
 drm_ttm_backend_t *i915_create_ttm_backend_entry(drm_device_t * dev)
 {
-       return drm_agp_init_ttm(dev, NULL, INTEL_AGP_MEM_USER,
-                               INTEL_AGP_MEM_UCACHED, INTEL_AGP_MEM_USER);
+       return drm_agp_init_ttm(dev, NULL);
 }
 
 int i915_fence_types(uint32_t buffer_flags, uint32_t * class, uint32_t * type)