Lines Matching refs:vkms_obj

148 static struct page **_get_pages(struct vkms_gem_object *vkms_obj)  in _get_pages()  argument
150 struct drm_gem_object *gem_obj = &vkms_obj->gem; in _get_pages()
152 if (!vkms_obj->pages) { in _get_pages()
158 if (cmpxchg(&vkms_obj->pages, NULL, pages)) in _get_pages()
162 return vkms_obj->pages; in _get_pages()
167 struct vkms_gem_object *vkms_obj = drm_gem_to_vkms_gem(obj); in vkms_gem_vunmap() local
169 mutex_lock(&vkms_obj->pages_lock); in vkms_gem_vunmap()
170 if (vkms_obj->vmap_count < 1) { in vkms_gem_vunmap()
171 WARN_ON(vkms_obj->vaddr); in vkms_gem_vunmap()
172 WARN_ON(vkms_obj->pages); in vkms_gem_vunmap()
173 mutex_unlock(&vkms_obj->pages_lock); in vkms_gem_vunmap()
177 vkms_obj->vmap_count--; in vkms_gem_vunmap()
179 if (vkms_obj->vmap_count == 0) { in vkms_gem_vunmap()
180 vunmap(vkms_obj->vaddr); in vkms_gem_vunmap()
181 vkms_obj->vaddr = NULL; in vkms_gem_vunmap()
182 drm_gem_put_pages(obj, vkms_obj->pages, false, true); in vkms_gem_vunmap()
183 vkms_obj->pages = NULL; in vkms_gem_vunmap()
186 mutex_unlock(&vkms_obj->pages_lock); in vkms_gem_vunmap()
191 struct vkms_gem_object *vkms_obj = drm_gem_to_vkms_gem(obj); in vkms_gem_vmap() local
194 mutex_lock(&vkms_obj->pages_lock); in vkms_gem_vmap()
196 if (!vkms_obj->vaddr) { in vkms_gem_vmap()
198 struct page **pages = _get_pages(vkms_obj); in vkms_gem_vmap()
205 vkms_obj->vaddr = vmap(pages, n_pages, VM_MAP, PAGE_KERNEL); in vkms_gem_vmap()
206 if (!vkms_obj->vaddr) in vkms_gem_vmap()
210 vkms_obj->vmap_count++; in vkms_gem_vmap()
215 drm_gem_put_pages(obj, vkms_obj->pages, false, true); in vkms_gem_vmap()
216 vkms_obj->pages = NULL; in vkms_gem_vmap()
218 mutex_unlock(&vkms_obj->pages_lock); in vkms_gem_vmap()