drivers/gpu/drm/nouveau/nouveau_ttm.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nouveau_ttm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nouveau_ttm.c- Extension
.c- Size
- 10029 bytes
- Lines
- 366
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/limits.hdrm/ttm/ttm_range_manager.hdrm/drm_cache.hnouveau_drv.hnouveau_gem.hnouveau_mem.hnouveau_ttm.hcore/tegra.h
Detected Declarations
function Copyrightfunction nouveau_manager_intersectsfunction nouveau_manager_compatiblefunction nouveau_vram_manager_newfunction nouveau_gart_manager_newfunction nv04_gart_manager_newfunction nouveau_ttm_init_hostfunction nouveau_ttm_init_vramfunction nouveau_ttm_fini_vramfunction nouveau_ttm_init_gttfunction nouveau_ttm_fini_gttfunction nouveau_ttm_initfunction nouveau_ttm_fini
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0 OR MIT
/*
* Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA,
* Copyright (c) 2009 VMware, Inc., Palo Alto, CA., USA,
*
* 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, sub license,
* 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 (including the
* next paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
*/
#include <linux/limits.h>
#include <drm/ttm/ttm_range_manager.h>
#include <drm/drm_cache.h>
#include "nouveau_drv.h"
#include "nouveau_gem.h"
#include "nouveau_mem.h"
#include "nouveau_ttm.h"
#include <core/tegra.h>
static void
nouveau_manager_del(struct ttm_resource_manager *man,
struct ttm_resource *reg)
{
nouveau_mem_del(man, reg);
}
static bool
nouveau_manager_intersects(struct ttm_resource_manager *man,
struct ttm_resource *res,
const struct ttm_place *place,
size_t size)
{
return nouveau_mem_intersects(res, place, size);
}
static bool
nouveau_manager_compatible(struct ttm_resource_manager *man,
struct ttm_resource *res,
const struct ttm_place *place,
size_t size)
{
return nouveau_mem_compatible(res, place, size);
}
static int
nouveau_vram_manager_new(struct ttm_resource_manager *man,
struct ttm_buffer_object *bo,
const struct ttm_place *place,
struct ttm_resource **res)
{
struct nouveau_bo *nvbo = nouveau_bo(bo);
struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
int ret;
if (drm->client.device.info.ram_size == 0)
return -ENOMEM;
ret = nouveau_mem_new(drm, nvbo->kind, nvbo->comp, res);
if (ret)
return ret;
ttm_resource_init(bo, place, *res);
ret = nouveau_mem_vram(*res, nvbo->contig, nvbo->page);
if (ret) {
nouveau_mem_del(man, *res);
return ret;
}
return 0;
}
Annotation
- Immediate include surface: `linux/limits.h`, `drm/ttm/ttm_range_manager.h`, `drm/drm_cache.h`, `nouveau_drv.h`, `nouveau_gem.h`, `nouveau_mem.h`, `nouveau_ttm.h`, `core/tegra.h`.
- Detected declarations: `function Copyright`, `function nouveau_manager_intersects`, `function nouveau_manager_compatible`, `function nouveau_vram_manager_new`, `function nouveau_gart_manager_new`, `function nv04_gart_manager_new`, `function nouveau_ttm_init_host`, `function nouveau_ttm_init_vram`, `function nouveau_ttm_fini_vram`, `function nouveau_ttm_init_gtt`.
- 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.