Deleted Added
full compact
i915_gem_gtt.c (267548) i915_gem_gtt.c (271705)
1/*
2 * Copyright �� 2010 Daniel Vetter
3 *
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 unchanged lines hidden (view full) ---

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
21 * IN THE SOFTWARE.
22 *
23 */
24
25#include <sys/cdefs.h>
1/*
2 * Copyright �� 2010 Daniel Vetter
3 *
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 unchanged lines hidden (view full) ---

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
21 * IN THE SOFTWARE.
22 *
23 */
24
25#include <sys/cdefs.h>
26__FBSDID("$FreeBSD: head/sys/dev/drm2/i915/i915_gem_gtt.c 267548 2014-06-16 18:15:27Z attilio $");
26__FBSDID("$FreeBSD: head/sys/dev/drm2/i915/i915_gem_gtt.c 271705 2014-09-17 08:28:50Z dumbbell $");
27
28#include <dev/drm2/drmP.h>
29#include <dev/drm2/drm.h>
30#include <dev/drm2/i915/i915_drm.h>
31#include <dev/drm2/i915/i915_drv.h>
32#include <dev/drm2/i915/intel_drv.h>
33#include <sys/sched.h>
34#include <sys/sf_buf.h>

--- 251 unchanged lines hidden (view full) ---

286int
287i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj)
288{
289 unsigned int agp_type;
290
291 agp_type = cache_level_to_agp_type(obj->base.dev, obj->cache_level);
292 intel_gtt_insert_pages(obj->gtt_space->start >> PAGE_SHIFT,
293 obj->base.size >> PAGE_SHIFT, obj->pages, agp_type);
27
28#include <dev/drm2/drmP.h>
29#include <dev/drm2/drm.h>
30#include <dev/drm2/i915/i915_drm.h>
31#include <dev/drm2/i915/i915_drv.h>
32#include <dev/drm2/i915/intel_drv.h>
33#include <sys/sched.h>
34#include <sys/sf_buf.h>

--- 251 unchanged lines hidden (view full) ---

286int
287i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj)
288{
289 unsigned int agp_type;
290
291 agp_type = cache_level_to_agp_type(obj->base.dev, obj->cache_level);
292 intel_gtt_insert_pages(obj->gtt_space->start >> PAGE_SHIFT,
293 obj->base.size >> PAGE_SHIFT, obj->pages, agp_type);
294
295 obj->has_global_gtt_mapping = 1;
296
294 return (0);
295}
296
297void
298i915_gem_gtt_rebind_object(struct drm_i915_gem_object *obj,
299 enum i915_cache_level cache_level)
300{
301 struct drm_device *dev;
302 struct drm_i915_private *dev_priv;
303 unsigned int agp_type;
304
305 dev = obj->base.dev;
306 dev_priv = dev->dev_private;
307 agp_type = cache_level_to_agp_type(dev, cache_level);
308
309 intel_gtt_insert_pages(obj->gtt_space->start >> PAGE_SHIFT,
310 obj->base.size >> PAGE_SHIFT, obj->pages, agp_type);
297 return (0);
298}
299
300void
301i915_gem_gtt_rebind_object(struct drm_i915_gem_object *obj,
302 enum i915_cache_level cache_level)
303{
304 struct drm_device *dev;
305 struct drm_i915_private *dev_priv;
306 unsigned int agp_type;
307
308 dev = obj->base.dev;
309 dev_priv = dev->dev_private;
310 agp_type = cache_level_to_agp_type(dev, cache_level);
311
312 intel_gtt_insert_pages(obj->gtt_space->start >> PAGE_SHIFT,
313 obj->base.size >> PAGE_SHIFT, obj->pages, agp_type);
314
315 obj->has_global_gtt_mapping = 0;
311}
312
313void
314i915_gem_gtt_unbind_object(struct drm_i915_gem_object *obj)
315{
316 struct drm_device *dev = obj->base.dev;
317 struct drm_i915_private *dev_priv = dev->dev_private;
318 bool interruptible;
319
320 dev = obj->base.dev;
321 dev_priv = dev->dev_private;
322
323 interruptible = do_idling(dev_priv);
324
325 intel_gtt_clear_range(obj->gtt_space->start >> PAGE_SHIFT,
326 obj->base.size >> PAGE_SHIFT);
327
328 undo_idling(dev_priv, interruptible);
329}
316}
317
318void
319i915_gem_gtt_unbind_object(struct drm_i915_gem_object *obj)
320{
321 struct drm_device *dev = obj->base.dev;
322 struct drm_i915_private *dev_priv = dev->dev_private;
323 bool interruptible;
324
325 dev = obj->base.dev;
326 dev_priv = dev->dev_private;
327
328 interruptible = do_idling(dev_priv);
329
330 intel_gtt_clear_range(obj->gtt_space->start >> PAGE_SHIFT,
331 obj->base.size >> PAGE_SHIFT);
332
333 undo_idling(dev_priv, interruptible);
334}