![]() |
|
|||
0001 /* SPDX-License-Identifier: MIT 0002 * Copyright 2021 Advanced Micro Devices, Inc. 0003 * 0004 * Permission is hereby granted, free of charge, to any person obtaining a 0005 * copy of this software and associated documentation files (the "Software"), 0006 * to deal in the Software without restriction, including without limitation 0007 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 0008 * and/or sell copies of the Software, and to permit persons to whom the 0009 * Software is furnished to do so, subject to the following conditions: 0010 * 0011 * The above copyright notice and this permission notice shall be included in 0012 * all copies or substantial portions of the Software. 0013 * 0014 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0015 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0016 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 0017 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 0018 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 0019 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 0020 * OTHER DEALINGS IN THE SOFTWARE. 0021 * 0022 */ 0023 0024 #ifndef __AMDGPU_VRAM_MGR_H__ 0025 #define __AMDGPU_VRAM_MGR_H__ 0026 0027 #include <drm/drm_buddy.h> 0028 0029 struct amdgpu_vram_mgr { 0030 struct ttm_resource_manager manager; 0031 struct drm_buddy mm; 0032 /* protects access to buffer objects */ 0033 struct mutex lock; 0034 struct list_head reservations_pending; 0035 struct list_head reserved_pages; 0036 atomic64_t vis_usage; 0037 u64 default_page_size; 0038 }; 0039 0040 struct amdgpu_vram_mgr_resource { 0041 struct ttm_resource base; 0042 struct list_head blocks; 0043 unsigned long flags; 0044 }; 0045 0046 static inline u64 amdgpu_vram_mgr_block_start(struct drm_buddy_block *block) 0047 { 0048 return drm_buddy_block_offset(block); 0049 } 0050 0051 static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block) 0052 { 0053 return (u64)PAGE_SIZE << drm_buddy_block_order(block); 0054 } 0055 0056 static inline struct amdgpu_vram_mgr_resource * 0057 to_amdgpu_vram_mgr_resource(struct ttm_resource *res) 0058 { 0059 return container_of(res, struct amdgpu_vram_mgr_resource, base); 0060 } 0061 0062 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |