~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/gpu/drm/i915/i915_gem_gtt.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "i915_trace.h"
30
30
#include "intel_drv.h"
31
31
 
 
32
/* XXX kill agp_type! */
 
33
static unsigned int cache_level_to_agp_type(struct drm_device *dev,
 
34
                                            enum i915_cache_level cache_level)
 
35
{
 
36
        switch (cache_level) {
 
37
        case I915_CACHE_LLC_MLC:
 
38
                if (INTEL_INFO(dev)->gen >= 6)
 
39
                        return AGP_USER_CACHED_MEMORY_LLC_MLC;
 
40
                /* Older chipsets do not have this extra level of CPU
 
41
                 * cacheing, so fallthrough and request the PTE simply
 
42
                 * as cached.
 
43
                 */
 
44
        case I915_CACHE_LLC:
 
45
                return AGP_USER_CACHED_MEMORY;
 
46
        default:
 
47
        case I915_CACHE_NONE:
 
48
                return AGP_USER_MEMORY;
 
49
        }
 
50
}
 
51
 
32
52
void i915_gem_restore_gtt_mappings(struct drm_device *dev)
33
53
{
34
54
        struct drm_i915_private *dev_priv = dev->dev_private;
39
59
                              (dev_priv->mm.gtt_end - dev_priv->mm.gtt_start) / PAGE_SIZE);
40
60
 
41
61
        list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
 
62
                unsigned int agp_type =
 
63
                        cache_level_to_agp_type(dev, obj->cache_level);
 
64
 
42
65
                i915_gem_clflush_object(obj);
43
66
 
44
67
                if (dev_priv->mm.gtt->needs_dmar) {
46
69
 
47
70
                        intel_gtt_insert_sg_entries(obj->sg_list,
48
71
                                                    obj->num_sg,
49
 
                                                    obj->gtt_space->start
50
 
                                                        >> PAGE_SHIFT,
51
 
                                                    obj->agp_type);
 
72
                                                    obj->gtt_space->start >> PAGE_SHIFT,
 
73
                                                    agp_type);
52
74
                } else
53
75
                        intel_gtt_insert_pages(obj->gtt_space->start
54
76
                                                   >> PAGE_SHIFT,
55
77
                                               obj->base.size >> PAGE_SHIFT,
56
78
                                               obj->pages,
57
 
                                               obj->agp_type);
 
79
                                               agp_type);
58
80
        }
59
81
 
60
82
        intel_gtt_chipset_flush();
64
86
{
65
87
        struct drm_device *dev = obj->base.dev;
66
88
        struct drm_i915_private *dev_priv = dev->dev_private;
 
89
        unsigned int agp_type = cache_level_to_agp_type(dev, obj->cache_level);
67
90
        int ret;
68
91
 
69
92
        if (dev_priv->mm.gtt->needs_dmar) {
77
100
                intel_gtt_insert_sg_entries(obj->sg_list,
78
101
                                            obj->num_sg,
79
102
                                            obj->gtt_space->start >> PAGE_SHIFT,
80
 
                                            obj->agp_type);
 
103
                                            agp_type);
81
104
        } else
82
105
                intel_gtt_insert_pages(obj->gtt_space->start >> PAGE_SHIFT,
83
106
                                       obj->base.size >> PAGE_SHIFT,
84
107
                                       obj->pages,
85
 
                                       obj->agp_type);
 
108
                                       agp_type);
86
109
 
87
110
        return 0;
88
111
}