ttm_bo_vm.c (247835) | ttm_bo_vm.c (248084) |
---|---|
1/************************************************************************** 2 * 3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including --- 22 unchanged lines hidden (view full) --- 31 * Copyright (c) 2013 The FreeBSD Foundation 32 * All rights reserved. 33 * 34 * Portions of this software were developed by Konstantin Belousov 35 * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation. 36 */ 37 38#include <sys/cdefs.h> | 1/************************************************************************** 2 * 3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including --- 22 unchanged lines hidden (view full) --- 31 * Copyright (c) 2013 The FreeBSD Foundation 32 * All rights reserved. 33 * 34 * Portions of this software were developed by Konstantin Belousov 35 * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation. 36 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/sys/dev/drm2/ttm/ttm_bo_vm.c 247835 2013-03-05 09:49:34Z kib $"); | 39__FBSDID("$FreeBSD: head/sys/dev/drm2/ttm/ttm_bo_vm.c 248084 2013-03-09 02:32:23Z attilio $"); |
40 41#include "opt_vm.h" 42 43#include <dev/drm2/drmP.h> 44#include <dev/drm2/ttm/ttm_module.h> 45#include <dev/drm2/ttm/ttm_bo_driver.h> 46#include <dev/drm2/ttm/ttm_placement.h> 47 --- 65 unchanged lines hidden (view full) --- 113 if (oldm != NULL) { 114 vm_page_lock(oldm); 115 vm_page_remove(oldm); 116 vm_page_unlock(oldm); 117 *mres = NULL; 118 } else 119 oldm = NULL; 120retry: | 40 41#include "opt_vm.h" 42 43#include <dev/drm2/drmP.h> 44#include <dev/drm2/ttm/ttm_module.h> 45#include <dev/drm2/ttm/ttm_bo_driver.h> 46#include <dev/drm2/ttm/ttm_placement.h> 47 --- 65 unchanged lines hidden (view full) --- 113 if (oldm != NULL) { 114 vm_page_lock(oldm); 115 vm_page_remove(oldm); 116 vm_page_unlock(oldm); 117 *mres = NULL; 118 } else 119 oldm = NULL; 120retry: |
121 VM_OBJECT_UNLOCK(vm_obj); | 121 VM_OBJECT_WUNLOCK(vm_obj); |
122 m = NULL; 123 124reserve: 125 mtx_lock(&bo->glob->lru_lock); 126 ret = ttm_bo_reserve_locked(bo, false, false, false, 0); 127 mtx_unlock(&bo->glob->lru_lock); 128 if (unlikely(ret != 0)) { 129 if (ret == -EBUSY) { --- 78 unchanged lines hidden (view full) --- 208 retval = VM_PAGER_ERROR; 209 goto out_io_unlock; 210 } 211 pmap_page_set_memattr(m, 212 (bo->mem.placement & TTM_PL_FLAG_CACHED) ? 213 VM_MEMATTR_WRITE_BACK : ttm_io_prot(bo->mem.placement)); 214 } 215 | 122 m = NULL; 123 124reserve: 125 mtx_lock(&bo->glob->lru_lock); 126 ret = ttm_bo_reserve_locked(bo, false, false, false, 0); 127 mtx_unlock(&bo->glob->lru_lock); 128 if (unlikely(ret != 0)) { 129 if (ret == -EBUSY) { --- 78 unchanged lines hidden (view full) --- 208 retval = VM_PAGER_ERROR; 209 goto out_io_unlock; 210 } 211 pmap_page_set_memattr(m, 212 (bo->mem.placement & TTM_PL_FLAG_CACHED) ? 213 VM_MEMATTR_WRITE_BACK : ttm_io_prot(bo->mem.placement)); 214 } 215 |
216 VM_OBJECT_LOCK(vm_obj); | 216 VM_OBJECT_WLOCK(vm_obj); |
217 if ((m->flags & VPO_BUSY) != 0) { 218 vm_page_sleep(m, "ttmpbs"); 219 ttm_mem_io_unlock(man); 220 ttm_bo_unreserve(bo); 221 goto retry; 222 } 223 m->valid = VM_PAGE_BITS_ALL; 224 *mres = m; --- 11 unchanged lines hidden (view full) --- 236out_io_unlock1: 237 ttm_mem_io_unlock(man); 238out_unlock1: 239 ttm_bo_unreserve(bo); 240 vm_object_pip_wakeup(vm_obj); 241 return (retval); 242 243out_io_unlock: | 217 if ((m->flags & VPO_BUSY) != 0) { 218 vm_page_sleep(m, "ttmpbs"); 219 ttm_mem_io_unlock(man); 220 ttm_bo_unreserve(bo); 221 goto retry; 222 } 223 m->valid = VM_PAGE_BITS_ALL; 224 *mres = m; --- 11 unchanged lines hidden (view full) --- 236out_io_unlock1: 237 ttm_mem_io_unlock(man); 238out_unlock1: 239 ttm_bo_unreserve(bo); 240 vm_object_pip_wakeup(vm_obj); 241 return (retval); 242 243out_io_unlock: |
244 VM_OBJECT_LOCK(vm_obj); | 244 VM_OBJECT_WLOCK(vm_obj); |
245 goto out_io_unlock1; 246 247out_unlock: | 245 goto out_io_unlock1; 246 247out_unlock: |
248 VM_OBJECT_LOCK(vm_obj); | 248 VM_OBJECT_WLOCK(vm_obj); |
249 goto out_unlock1; 250} 251 252static int 253ttm_bo_vm_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, 254 vm_ooffset_t foff, struct ucred *cred, u_short *color) 255{ 256 struct ttm_buffer_object *bo = handle; --- 236 unchanged lines hidden --- | 249 goto out_unlock1; 250} 251 252static int 253ttm_bo_vm_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, 254 vm_ooffset_t foff, struct ucred *cred, u_short *color) 255{ 256 struct ttm_buffer_object *bo = handle; --- 236 unchanged lines hidden --- |