/* * 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 __RADEON_OBJECT_H__ #define __RADEON_OBJECT_H__
#include <drm/radeon_drm.h> #include"radeon.h"
/** * radeon_mem_type_to_domain - return domain corresponding to mem_type * @mem_type: ttm memory type * * Returns corresponding domain of the ttm mem_type
*/ staticinlineunsigned radeon_mem_type_to_domain(u32 mem_type)
{ switch (mem_type) { case TTM_PL_VRAM: return RADEON_GEM_DOMAIN_VRAM; case TTM_PL_TT: return RADEON_GEM_DOMAIN_GTT; case TTM_PL_SYSTEM: return RADEON_GEM_DOMAIN_CPU; default: break;
} return 0;
}
/** * radeon_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 radeon_bo_reserve(struct radeon_bo *bo, bool no_intr)
{ int r;
r = ttm_bo_reserve(&bo->tbo, !no_intr, false, NULL); if (unlikely(r != 0)) { if (r != -ERESTARTSYS)
dev_err(bo->rdev->dev, "%p reserve failed\n", bo); return r;
} return 0;
}
/** * radeon_bo_gpu_offset - return GPU offset of bo * @bo: radeon object for which we query the offset * * Returns current GPU offset of the object. * * Note: object should either be pinned or reserved when calling this * function, it might be useful to add check for this for debugging.
*/ staticinline u64 radeon_bo_gpu_offset(struct radeon_bo *bo)
{ struct radeon_device *rdev;
u64 start = 0;
rdev = radeon_get_rdev(bo->tbo.bdev);
switch (bo->tbo.resource->mem_type) { case TTM_PL_TT:
start = rdev->mc.gtt_start; break; case TTM_PL_VRAM:
start = rdev->mc.vram_start; break;
}
/** * radeon_bo_mmap_offset - return mmap offset of bo * @bo: radeon object for which we query the offset * * Returns mmap offset of the object.
*/ staticinline u64 radeon_bo_mmap_offset(struct radeon_bo *bo)
{ return drm_vma_node_offset_addr(&bo->tbo.base.vma_node);
}
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.