ttm_bo_vm.c (254138) | ttm_bo_vm.c (254141) |
---|---|
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 254138 2013-08-09 11:11:11Z attilio $"); | 39__FBSDID("$FreeBSD: head/sys/dev/drm2/ttm/ttm_bo_vm.c 254141 2013-08-09 11:28:55Z 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 48#include <vm/vm.h> 49#include <vm/vm_page.h> | 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 48#include <vm/vm.h> 49#include <vm/vm_page.h> |
50#include <vm/vm_pageout.h> |
|
50 51#define TTM_BO_VM_NUM_PREFAULT 16 52 53RB_GENERATE(ttm_bo_device_buffer_objects, ttm_buffer_object, vm_rb, 54 ttm_bo_cmp_rb_tree_items); 55 56int 57ttm_bo_cmp_rb_tree_items(struct ttm_buffer_object *a, --- 158 unchanged lines hidden (view full) --- 216 vm_page_lock(m); 217 VM_OBJECT_WUNLOCK(vm_obj); 218 vm_page_busy_sleep(m, "ttmpbs"); 219 VM_OBJECT_WLOCK(vm_obj); 220 ttm_mem_io_unlock(man); 221 ttm_bo_unreserve(bo); 222 goto retry; 223 } | 51 52#define TTM_BO_VM_NUM_PREFAULT 16 53 54RB_GENERATE(ttm_bo_device_buffer_objects, ttm_buffer_object, vm_rb, 55 ttm_bo_cmp_rb_tree_items); 56 57int 58ttm_bo_cmp_rb_tree_items(struct ttm_buffer_object *a, --- 158 unchanged lines hidden (view full) --- 217 vm_page_lock(m); 218 VM_OBJECT_WUNLOCK(vm_obj); 219 vm_page_busy_sleep(m, "ttmpbs"); 220 VM_OBJECT_WLOCK(vm_obj); 221 ttm_mem_io_unlock(man); 222 ttm_bo_unreserve(bo); 223 goto retry; 224 } |
224 m->valid = VM_PAGE_BITS_ALL; 225 *mres = m; | |
226 m1 = vm_page_lookup(vm_obj, OFF_TO_IDX(offset)); 227 if (m1 == NULL) { | 225 m1 = vm_page_lookup(vm_obj, OFF_TO_IDX(offset)); 226 if (m1 == NULL) { |
228 vm_page_insert(m, vm_obj, OFF_TO_IDX(offset)); | 227 if (vm_page_insert(m, vm_obj, OFF_TO_IDX(offset))) { 228 VM_OBJECT_WUNLOCK(vm_obj); 229 VM_WAIT; 230 VM_OBJECT_WLOCK(vm_obj); 231 ttm_mem_io_unlock(man); 232 ttm_bo_unreserve(bo); 233 goto retry; 234 } |
229 } else { 230 KASSERT(m == m1, 231 ("inconsistent insert bo %p m %p m1 %p offset %jx", 232 bo, m, m1, (uintmax_t)offset)); 233 } | 235 } else { 236 KASSERT(m == m1, 237 ("inconsistent insert bo %p m %p m1 %p offset %jx", 238 bo, m, m1, (uintmax_t)offset)); 239 } |
240 m->valid = VM_PAGE_BITS_ALL; 241 *mres = m; |
|
234 vm_page_xbusy(m); 235 236 if (oldm != NULL) { 237 vm_page_lock(oldm); 238 vm_page_free(oldm); 239 vm_page_unlock(oldm); 240 } 241 --- 260 unchanged lines hidden --- | 242 vm_page_xbusy(m); 243 244 if (oldm != NULL) { 245 vm_page_lock(oldm); 246 vm_page_free(oldm); 247 vm_page_unlock(oldm); 248 } 249 --- 260 unchanged lines hidden --- |