/* * Copyright 2008 Advanced Micro Devices, Inc. * Copyright 2008 Red Hat Inc. * Copyright 2009 Jerome Glisse. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Dave Airlie * Alex Deucher * Jerome Glisse
*/ #ifndef __AMDGPU_OBJECT_H__ #define __AMDGPU_OBJECT_H__
/* * For GPUs with spatial partitioning, xcp partition number, -1 means * any partition. For other ASICs without spatial partition, always 0 * for memory accounting.
*/
int8_t xcp_id;
};
/** * amdgpu_mem_type_to_domain - return domain corresponding to mem_type * @mem_type: ttm memory type * * Returns corresponding domain of the ttm mem_type
*/ staticinlineunsigned amdgpu_mem_type_to_domain(u32 mem_type)
{ switch (mem_type) { case TTM_PL_VRAM: return AMDGPU_GEM_DOMAIN_VRAM; case TTM_PL_TT: return AMDGPU_GEM_DOMAIN_GTT; case TTM_PL_SYSTEM: return AMDGPU_GEM_DOMAIN_CPU; case AMDGPU_PL_GDS: return AMDGPU_GEM_DOMAIN_GDS; case AMDGPU_PL_GWS: return AMDGPU_GEM_DOMAIN_GWS; case AMDGPU_PL_OA: return AMDGPU_GEM_DOMAIN_OA; case AMDGPU_PL_DOORBELL: return AMDGPU_GEM_DOMAIN_DOORBELL; default: break;
} return 0;
}
/** * amdgpu_bo_reserve - reserve bo * @bo: bo structure * @no_intr: don't return -ERESTARTSYS on pending signal * * Returns: * -ERESTARTSYS: A wait for the buffer to become unreserved was interrupted by * a signal. Release all buffer reservations and return to user-space.
*/ staticinlineint amdgpu_bo_reserve(struct amdgpu_bo *bo, bool no_intr)
{ struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); int r;
r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL); if (unlikely(r != 0)) { if (r != -ERESTARTSYS)
dev_err(adev->dev, "%p reserve failed\n", bo); return r;
} return 0;
}
/** * amdgpu_bo_mmap_offset - return mmap offset of bo * @bo: amdgpu object for which we query the offset * * Returns mmap offset of the object.
*/ staticinline u64 amdgpu_bo_mmap_offset(struct amdgpu_bo *bo)
{ return drm_vma_node_offset_addr(&bo->tbo.base.vma_node);
}
/** * amdgpu_bo_explicit_sync - return whether the bo is explicitly synced
*/ staticinlinebool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo)
{ return bo->flags & AMDGPU_GEM_CREATE_EXPLICIT_SYNC;
}
/** * amdgpu_bo_encrypted - test if the BO is encrypted * @bo: pointer to a buffer object * * Return true if the buffer object is encrypted, false otherwise.
*/ staticinlinebool amdgpu_bo_encrypted(struct amdgpu_bo *bo)
{ return bo->flags & AMDGPU_GEM_CREATE_ENCRYPTED;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.