Deleted Added
full compact
ttm_bo_util.c (254025) ttm_bo_util.c (254866)
1/**************************************************************************
2 *
3 * Copyright (c) 2007-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

--- 15 unchanged lines hidden (view full) ---

24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#include <sys/cdefs.h>
1/**************************************************************************
2 *
3 * Copyright (c) 2007-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

--- 15 unchanged lines hidden (view full) ---

24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/drm2/ttm/ttm_bo_util.c 254025 2013-08-07 06:21:20Z jeff $");
32__FBSDID("$FreeBSD: head/sys/dev/drm2/ttm/ttm_bo_util.c 254866 2013-08-25 14:55:08Z dumbbell $");
33
34#include <dev/drm2/drmP.h>
35#include <dev/drm2/ttm/ttm_bo_driver.h>
36#include <dev/drm2/ttm/ttm_placement.h>
37#include <sys/sf_buf.h>
38
39void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
40{

--- 275 unchanged lines hidden (view full) ---

316
317 if (old_iomap == NULL && new_iomap == NULL)
318 goto out2;
319 if (old_iomap == NULL && ttm == NULL)
320 goto out2;
321
322 if (ttm->state == tt_unpopulated) {
323 ret = ttm->bdev->driver->ttm_tt_populate(ttm);
33
34#include <dev/drm2/drmP.h>
35#include <dev/drm2/ttm/ttm_bo_driver.h>
36#include <dev/drm2/ttm/ttm_placement.h>
37#include <sys/sf_buf.h>
38
39void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
40{

--- 275 unchanged lines hidden (view full) ---

316
317 if (old_iomap == NULL && new_iomap == NULL)
318 goto out2;
319 if (old_iomap == NULL && ttm == NULL)
320 goto out2;
321
322 if (ttm->state == tt_unpopulated) {
323 ret = ttm->bdev->driver->ttm_tt_populate(ttm);
324 if (ret)
324 if (ret) {
325 /* if we fail here don't nuke the mm node
326 * as the bo still owns it */
327 old_copy.mm_node = NULL;
325 goto out1;
328 goto out1;
329 }
326 }
327
328 add = 0;
329 dir = 1;
330
331 if ((old_mem->mem_type == new_mem->mem_type) &&
332 (new_mem->start < old_mem->start + old_mem->size)) {
333 dir = -1;

--- 7 unchanged lines hidden (view full) ---

341 ret = ttm_copy_ttm_io_page(ttm, new_iomap, page,
342 prot);
343 } else if (new_iomap == NULL) {
344 vm_memattr_t prot = ttm_io_prot(new_mem->placement);
345 ret = ttm_copy_io_ttm_page(ttm, old_iomap, page,
346 prot);
347 } else
348 ret = ttm_copy_io_page(new_iomap, old_iomap, page);
330 }
331
332 add = 0;
333 dir = 1;
334
335 if ((old_mem->mem_type == new_mem->mem_type) &&
336 (new_mem->start < old_mem->start + old_mem->size)) {
337 dir = -1;

--- 7 unchanged lines hidden (view full) ---

345 ret = ttm_copy_ttm_io_page(ttm, new_iomap, page,
346 prot);
347 } else if (new_iomap == NULL) {
348 vm_memattr_t prot = ttm_io_prot(new_mem->placement);
349 ret = ttm_copy_io_ttm_page(ttm, old_iomap, page,
350 prot);
351 } else
352 ret = ttm_copy_io_page(new_iomap, old_iomap, page);
349 if (ret)
353 if (ret) {
354 /* failing here, means keep old copy as-is */
355 old_copy.mm_node = NULL;
350 goto out1;
356 goto out1;
357 }
351 }
352 mb();
353out2:
354 old_copy = *old_mem;
355 *old_mem = *new_mem;
356 new_mem->mm_node = NULL;
357
358 if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (ttm != NULL)) {

--- 300 unchanged lines hidden ---
358 }
359 mb();
360out2:
361 old_copy = *old_mem;
362 *old_mem = *new_mem;
363 new_mem->mm_node = NULL;
364
365 if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (ttm != NULL)) {

--- 300 unchanged lines hidden ---