drivers/gpu/drm/radeon/radeon_object.h
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/radeon/radeon_object.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/radeon/radeon_object.h- Extension
.h- Size
- 6885 bytes
- Lines
- 212
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/radeon_drm.hradeon.h
Detected Declarations
function filesfunction radeon_bo_reservefunction radeon_bo_unreservefunction radeon_bo_gpu_offsetfunction radeon_bo_sizefunction radeon_bo_ngpu_pagesfunction radeon_bo_gpu_page_alignmentfunction radeon_bo_mmap_offsetfunction to_radeon_sa_managerfunction radeon_sa_bo_gpu_addr
Annotated Snippet
#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
*/
static inline unsigned 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.
*/
static inline int 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;
}
static inline void radeon_bo_unreserve(struct radeon_bo *bo)
{
ttm_bo_unreserve(&bo->tbo);
}
/**
* 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.
*/
static inline 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;
}
return (bo->tbo.resource->start << PAGE_SHIFT) + start;
}
static inline unsigned long radeon_bo_size(struct radeon_bo *bo)
{
return bo->tbo.base.size;
}
static inline unsigned radeon_bo_ngpu_pages(struct radeon_bo *bo)
{
return bo->tbo.base.size / RADEON_GPU_PAGE_SIZE;
Annotation
- Immediate include surface: `drm/radeon_drm.h`, `radeon.h`.
- Detected declarations: `function files`, `function radeon_bo_reserve`, `function radeon_bo_unreserve`, `function radeon_bo_gpu_offset`, `function radeon_bo_size`, `function radeon_bo_ngpu_pages`, `function radeon_bo_gpu_page_alignment`, `function radeon_bo_mmap_offset`, `function to_radeon_sa_manager`, `function radeon_sa_bo_gpu_addr`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.