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 $");
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)
325 goto out1;
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);
349 if (ret)
350 goto out1;
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 ---
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 $");
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)
325 goto out1;
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);
349 if (ret)
350 goto out1;
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 ---