Rev 6131 | Rev 6296 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6131 | Rev 6283 | ||
---|---|---|---|
Line 2784... | Line 2784... | ||
2784 | static int __i915_vma_unbind(struct i915_vma *vma, bool wait) |
2784 | static int __i915_vma_unbind(struct i915_vma *vma, bool wait) |
2785 | { |
2785 | { |
2786 | struct drm_i915_gem_object *obj = vma->obj; |
2786 | struct drm_i915_gem_object *obj = vma->obj; |
2787 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; |
2787 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; |
2788 | int ret; |
2788 | int ret; |
2789 | if(obj == get_fb_obj()) |
- | |
2790 | { |
- | |
2791 | WARN(1,"attempt to unbind fb object\n"); |
- | |
2792 | return 0; |
- | |
2793 | }; |
- | |
Line 2794... | Line 2789... | ||
2794 | 2789 | ||
2795 | if (list_empty(&vma->vma_link)) |
2790 | if (list_empty(&vma->vma_link)) |
Line 2796... | Line 2791... | ||
2796 | return 0; |
2791 | return 0; |
Line 3953... | Line 3948... | ||
3953 | trace_i915_gem_object_create(obj); |
3948 | trace_i915_gem_object_create(obj); |
Line 3954... | Line 3949... | ||
3954 | 3949 | ||
3955 | return obj; |
3950 | return obj; |
Line -... | Line 3951... | ||
- | 3951 | } |
|
- | 3952 | ||
- | 3953 | static bool discard_backing_storage(struct drm_i915_gem_object *obj) |
|
- | 3954 | { |
|
- | 3955 | /* If we are the last user of the backing storage (be it shmemfs |
|
- | 3956 | * pages or stolen etc), we know that the pages are going to be |
|
- | 3957 | * immediately released. In this case, we can then skip copying |
|
- | 3958 | * back the contents from the GPU. |
|
- | 3959 | */ |
|
- | 3960 | ||
- | 3961 | if (obj->madv != I915_MADV_WILLNEED) |
|
- | 3962 | return false; |
|
- | 3963 | ||
- | 3964 | if (obj->base.filp == NULL) |
|
- | 3965 | return true; |
|
- | 3966 | ||
- | 3967 | // printf("filp %p\n", obj->base.filp); |
|
- | 3968 | shmem_file_delete(obj->base.filp); |
|
- | 3969 | return true; |
|
3956 | } |
3970 | } |
3957 | 3971 | ||
3958 | void i915_gem_free_object(struct drm_gem_object *gem_obj) |
3972 | void i915_gem_free_object(struct drm_gem_object *gem_obj) |
3959 | { |
3973 | { |
3960 | struct drm_i915_gem_object *obj = to_intel_bo(gem_obj); |
3974 | struct drm_i915_gem_object *obj = to_intel_bo(gem_obj); |
Line 3995... | Line 4009... | ||
3995 | obj->tiling_mode != I915_TILING_NONE) |
4009 | obj->tiling_mode != I915_TILING_NONE) |
3996 | i915_gem_object_unpin_pages(obj); |
4010 | i915_gem_object_unpin_pages(obj); |
Line 3997... | Line 4011... | ||
3997 | 4011 | ||
3998 | if (WARN_ON(obj->pages_pin_count)) |
4012 | if (WARN_ON(obj->pages_pin_count)) |
- | 4013 | obj->pages_pin_count = 0; |
|
- | 4014 | if (discard_backing_storage(obj)) |
|
3999 | obj->pages_pin_count = 0; |
4015 | obj->madv = I915_MADV_DONTNEED; |
4000 | i915_gem_object_put_pages(obj); |
4016 | i915_gem_object_put_pages(obj); |
Line 4001... | Line 4017... | ||
4001 | // i915_gem_object_free_mmap_offset(obj); |
4017 | // i915_gem_object_free_mmap_offset(obj); |
Line 4002... | Line -... | ||
4002 | - | ||
4003 | BUG_ON(obj->pages); |
4018 | |
4004 | - | ||
4005 | - | ||
4006 | if(obj->base.filp != NULL) |
4019 | BUG_ON(obj->pages); |
4007 | { |
- | |
Line 4008... | Line 4020... | ||
4008 | // printf("filp %p\n", obj->base.filp); |
4020 | |
4009 | shmem_file_delete(obj->base.filp); |
4021 | if (obj->ops->release) |
Line 4010... | Line 4022... | ||
4010 | } |
4022 | obj->ops->release(obj); |