diff options
author | Ben Widawsky <ben@bwidawsk.net> | 2013-07-31 19:59:59 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-08-05 13:04:10 -0400 |
commit | 40d74980d3ada5ad76e333dfcc87645f3f7e9820 (patch) | |
tree | f482f00f5b580f2cfff7e7399dbb821ae3a9d69e | |
parent | c37e22046148971a35a89931aa1f951bb99d5514 (diff) |
drm/i915: Use ggtt_vm to save some typing
Just some small cleanups, and a rename of vm->ggtt_vm requested by
Daniel.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_stolen.c | 10 |
2 files changed, 13 insertions, 16 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 90a276e35909..f38cc696be7f 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -643,7 +643,8 @@ void i915_gem_setup_global_gtt(struct drm_device *dev, | |||
643 | * aperture. One page should be enough to keep any prefetching inside | 643 | * aperture. One page should be enough to keep any prefetching inside |
644 | * of the aperture. | 644 | * of the aperture. |
645 | */ | 645 | */ |
646 | drm_i915_private_t *dev_priv = dev->dev_private; | 646 | struct drm_i915_private *dev_priv = dev->dev_private; |
647 | struct i915_address_space *ggtt_vm = &dev_priv->gtt.base; | ||
647 | struct drm_mm_node *entry; | 648 | struct drm_mm_node *entry; |
648 | struct drm_i915_gem_object *obj; | 649 | struct drm_i915_gem_object *obj; |
649 | unsigned long hole_start, hole_end; | 650 | unsigned long hole_start, hole_end; |
@@ -651,19 +652,19 @@ void i915_gem_setup_global_gtt(struct drm_device *dev, | |||
651 | BUG_ON(mappable_end > end); | 652 | BUG_ON(mappable_end > end); |
652 | 653 | ||
653 | /* Subtract the guard page ... */ | 654 | /* Subtract the guard page ... */ |
654 | drm_mm_init(&dev_priv->gtt.base.mm, start, end - start - PAGE_SIZE); | 655 | drm_mm_init(&ggtt_vm->mm, start, end - start - PAGE_SIZE); |
655 | if (!HAS_LLC(dev)) | 656 | if (!HAS_LLC(dev)) |
656 | dev_priv->gtt.base.mm.color_adjust = i915_gtt_color_adjust; | 657 | dev_priv->gtt.base.mm.color_adjust = i915_gtt_color_adjust; |
657 | 658 | ||
658 | /* Mark any preallocated objects as occupied */ | 659 | /* Mark any preallocated objects as occupied */ |
659 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { | 660 | list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { |
660 | struct i915_vma *vma = i915_gem_obj_to_vma(obj, &dev_priv->gtt.base); | 661 | struct i915_vma *vma = i915_gem_obj_to_vma(obj, ggtt_vm); |
661 | int ret; | 662 | int ret; |
662 | DRM_DEBUG_KMS("reserving preallocated space: %lx + %zx\n", | 663 | DRM_DEBUG_KMS("reserving preallocated space: %lx + %zx\n", |
663 | i915_gem_obj_ggtt_offset(obj), obj->base.size); | 664 | i915_gem_obj_ggtt_offset(obj), obj->base.size); |
664 | 665 | ||
665 | WARN_ON(i915_gem_obj_ggtt_bound(obj)); | 666 | WARN_ON(i915_gem_obj_ggtt_bound(obj)); |
666 | ret = drm_mm_reserve_node(&dev_priv->gtt.base.mm, &vma->node); | 667 | ret = drm_mm_reserve_node(&ggtt_vm->mm, &vma->node); |
667 | if (ret) | 668 | if (ret) |
668 | DRM_DEBUG_KMS("Reservation failed\n"); | 669 | DRM_DEBUG_KMS("Reservation failed\n"); |
669 | obj->has_global_gtt_mapping = 1; | 670 | obj->has_global_gtt_mapping = 1; |
@@ -674,19 +675,15 @@ void i915_gem_setup_global_gtt(struct drm_device *dev, | |||
674 | dev_priv->gtt.base.total = end - start; | 675 | dev_priv->gtt.base.total = end - start; |
675 | 676 | ||
676 | /* Clear any non-preallocated blocks */ | 677 | /* Clear any non-preallocated blocks */ |
677 | drm_mm_for_each_hole(entry, &dev_priv->gtt.base.mm, | 678 | drm_mm_for_each_hole(entry, &ggtt_vm->mm, hole_start, hole_end) { |
678 | hole_start, hole_end) { | ||
679 | const unsigned long count = (hole_end - hole_start) / PAGE_SIZE; | 679 | const unsigned long count = (hole_end - hole_start) / PAGE_SIZE; |
680 | DRM_DEBUG_KMS("clearing unused GTT space: [%lx, %lx]\n", | 680 | DRM_DEBUG_KMS("clearing unused GTT space: [%lx, %lx]\n", |
681 | hole_start, hole_end); | 681 | hole_start, hole_end); |
682 | dev_priv->gtt.base.clear_range(&dev_priv->gtt.base, | 682 | ggtt_vm->clear_range(ggtt_vm, hole_start / PAGE_SIZE, count); |
683 | hole_start / PAGE_SIZE, | ||
684 | count); | ||
685 | } | 683 | } |
686 | 684 | ||
687 | /* And finally clear the reserved guard page */ | 685 | /* And finally clear the reserved guard page */ |
688 | dev_priv->gtt.base.clear_range(&dev_priv->gtt.base, | 686 | ggtt_vm->clear_range(ggtt_vm, end / PAGE_SIZE - 1, 1); |
689 | end / PAGE_SIZE - 1, 1); | ||
690 | } | 687 | } |
691 | 688 | ||
692 | static bool | 689 | static bool |
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 4bbde2ae1819..934840860c6d 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -333,7 +333,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, | |||
333 | u32 size) | 333 | u32 size) |
334 | { | 334 | { |
335 | struct drm_i915_private *dev_priv = dev->dev_private; | 335 | struct drm_i915_private *dev_priv = dev->dev_private; |
336 | struct i915_address_space *vm = &dev_priv->gtt.base; | 336 | struct i915_address_space *ggtt = &dev_priv->gtt.base; |
337 | struct drm_i915_gem_object *obj; | 337 | struct drm_i915_gem_object *obj; |
338 | struct drm_mm_node *stolen; | 338 | struct drm_mm_node *stolen; |
339 | struct i915_vma *vma; | 339 | struct i915_vma *vma; |
@@ -376,7 +376,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, | |||
376 | if (gtt_offset == I915_GTT_OFFSET_NONE) | 376 | if (gtt_offset == I915_GTT_OFFSET_NONE) |
377 | return obj; | 377 | return obj; |
378 | 378 | ||
379 | vma = i915_gem_vma_create(obj, &dev_priv->gtt.base); | 379 | vma = i915_gem_vma_create(obj, ggtt); |
380 | if (IS_ERR(vma)) { | 380 | if (IS_ERR(vma)) { |
381 | ret = PTR_ERR(vma); | 381 | ret = PTR_ERR(vma); |
382 | goto err_out; | 382 | goto err_out; |
@@ -389,8 +389,8 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, | |||
389 | */ | 389 | */ |
390 | vma->node.start = gtt_offset; | 390 | vma->node.start = gtt_offset; |
391 | vma->node.size = size; | 391 | vma->node.size = size; |
392 | if (drm_mm_initialized(&dev_priv->gtt.base.mm)) { | 392 | if (drm_mm_initialized(&ggtt->mm)) { |
393 | ret = drm_mm_reserve_node(&dev_priv->gtt.base.mm, &vma->node); | 393 | ret = drm_mm_reserve_node(&ggtt->mm, &vma->node); |
394 | if (ret) { | 394 | if (ret) { |
395 | DRM_DEBUG_KMS("failed to allocate stolen GTT space\n"); | 395 | DRM_DEBUG_KMS("failed to allocate stolen GTT space\n"); |
396 | i915_gem_vma_destroy(vma); | 396 | i915_gem_vma_destroy(vma); |
@@ -401,7 +401,7 @@ i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, | |||
401 | obj->has_global_gtt_mapping = 1; | 401 | obj->has_global_gtt_mapping = 1; |
402 | 402 | ||
403 | list_add_tail(&obj->global_list, &dev_priv->mm.bound_list); | 403 | list_add_tail(&obj->global_list, &dev_priv->mm.bound_list); |
404 | list_add_tail(&obj->mm_list, &vm->inactive_list); | 404 | list_add_tail(&obj->mm_list, &ggtt->inactive_list); |
405 | 405 | ||
406 | return obj; | 406 | return obj; |
407 | 407 | ||