2 * Copyright © 2010 Daniel Vetter
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
29 #include "i915_trace.h"
30 #include "intel_drv.h"
32 void i915_gem_restore_gtt_mappings(struct drm_device
*dev
)
34 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
35 struct drm_i915_gem_object
*obj
;
37 list_for_each_entry(obj
, &dev_priv
->mm
.gtt_list
, gtt_list
) {
38 i915_gem_clflush_object(obj
);
40 if (dev_priv
->mm
.gtt
->needs_dmar
) {
41 BUG_ON(!obj
->sg_list
);
43 intel_gtt_insert_sg_entries(obj
->sg_list
,
49 intel_gtt_insert_pages(obj
->gtt_space
->start
51 obj
->base
.size
>> PAGE_SHIFT
,
56 intel_gtt_chipset_flush();
59 int i915_gem_gtt_bind_object(struct drm_i915_gem_object
*obj
)
61 struct drm_device
*dev
= obj
->base
.dev
;
62 struct drm_i915_private
*dev_priv
= dev
->dev_private
;
65 if (dev_priv
->mm
.gtt
->needs_dmar
) {
66 ret
= intel_gtt_map_memory(obj
->pages
,
67 obj
->base
.size
>> PAGE_SHIFT
,
73 intel_gtt_insert_sg_entries(obj
->sg_list
,
75 obj
->gtt_space
->start
>> PAGE_SHIFT
,
78 intel_gtt_insert_pages(obj
->gtt_space
->start
>> PAGE_SHIFT
,
79 obj
->base
.size
>> PAGE_SHIFT
,
86 void i915_gem_gtt_unbind_object(struct drm_i915_gem_object
*obj
)
88 intel_gtt_clear_range(obj
->gtt_space
->start
>> PAGE_SHIFT
,
89 obj
->base
.size
>> PAGE_SHIFT
);
92 intel_gtt_unmap_memory(obj
->sg_list
, obj
->num_sg
);
This page took 0.042511 seconds and 6 git commands to generate.