diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2010-01-13 16:28:39 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-01-13 21:18:43 -0500 |
commit | effe1105bef07f42366c20eac41b80ff9fcf675e (patch) | |
tree | d4341a955614b8be1732f4ffc37f39016dffa61d /drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |
parent | 7704befbd599e9c9524f640e14658ca8ed9d8717 (diff) |
drm/vmwgfx: Use bo_driver::move_notify to unbind GMRs.
This was previously done explicitly for overlay- and fb buffers.
Now it's done for any buffer leaving the SYSTEM memory region.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_resource.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 125c2f44f98c..e0878077e8aa 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -757,20 +757,29 @@ static size_t vmw_dmabuf_acc_size(struct ttm_bo_global *glob, | |||
757 | return bo_user_size + page_array_size; | 757 | return bo_user_size + page_array_size; |
758 | } | 758 | } |
759 | 759 | ||
760 | void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo) | 760 | void vmw_dmabuf_gmr_unbind(struct ttm_buffer_object *bo) |
761 | { | 761 | { |
762 | struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo); | 762 | struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo); |
763 | struct ttm_bo_global *glob = bo->glob; | 763 | struct ttm_bo_global *glob = bo->glob; |
764 | struct vmw_private *dev_priv = | 764 | struct vmw_private *dev_priv = |
765 | container_of(bo->bdev, struct vmw_private, bdev); | 765 | container_of(bo->bdev, struct vmw_private, bdev); |
766 | 766 | ||
767 | ttm_mem_global_free(glob->mem_glob, bo->acc_size); | ||
768 | if (vmw_bo->gmr_bound) { | 767 | if (vmw_bo->gmr_bound) { |
769 | vmw_gmr_unbind(dev_priv, vmw_bo->gmr_id); | 768 | vmw_gmr_unbind(dev_priv, vmw_bo->gmr_id); |
770 | spin_lock(&glob->lru_lock); | 769 | spin_lock(&glob->lru_lock); |
771 | ida_remove(&dev_priv->gmr_ida, vmw_bo->gmr_id); | 770 | ida_remove(&dev_priv->gmr_ida, vmw_bo->gmr_id); |
772 | spin_unlock(&glob->lru_lock); | 771 | spin_unlock(&glob->lru_lock); |
772 | vmw_bo->gmr_bound = false; | ||
773 | } | 773 | } |
774 | } | ||
775 | |||
776 | void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo) | ||
777 | { | ||
778 | struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo); | ||
779 | struct ttm_bo_global *glob = bo->glob; | ||
780 | |||
781 | vmw_dmabuf_gmr_unbind(bo); | ||
782 | ttm_mem_global_free(glob->mem_glob, bo->acc_size); | ||
774 | kfree(vmw_bo); | 783 | kfree(vmw_bo); |
775 | } | 784 | } |
776 | 785 | ||
@@ -816,18 +825,10 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv, | |||
816 | static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo) | 825 | static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo) |
817 | { | 826 | { |
818 | struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo); | 827 | struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo); |
819 | struct vmw_dma_buffer *vmw_bo = &vmw_user_bo->dma; | ||
820 | struct ttm_bo_global *glob = bo->glob; | 828 | struct ttm_bo_global *glob = bo->glob; |
821 | struct vmw_private *dev_priv = | ||
822 | container_of(bo->bdev, struct vmw_private, bdev); | ||
823 | 829 | ||
830 | vmw_dmabuf_gmr_unbind(bo); | ||
824 | ttm_mem_global_free(glob->mem_glob, bo->acc_size); | 831 | ttm_mem_global_free(glob->mem_glob, bo->acc_size); |
825 | if (vmw_bo->gmr_bound) { | ||
826 | vmw_gmr_unbind(dev_priv, vmw_bo->gmr_id); | ||
827 | spin_lock(&glob->lru_lock); | ||
828 | ida_remove(&dev_priv->gmr_ida, vmw_bo->gmr_id); | ||
829 | spin_unlock(&glob->lru_lock); | ||
830 | } | ||
831 | kfree(vmw_user_bo); | 832 | kfree(vmw_user_bo); |
832 | } | 833 | } |
833 | 834 | ||