drivers/gpu/drm/nouveau/nvif/object.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvif/object.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvif/object.c- Extension
.c- Size
- 6854 bytes
- Lines
- 280
- 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
nvif/object.hnvif/client.hnvif/driver.hnvif/ioctl.h
Detected Declarations
function filesfunction nvif_object_sclass_putfunction nvif_object_sclass_getfunction nvif_object_mthdfunction nvif_object_unmap_handlefunction nvif_object_map_handlefunction nvif_object_unmapfunction nvif_object_mapfunction nvif_object_dtorfunction nvif_object_ctor
Annotated Snippet
if (object->map.size) {
client->driver->unmap(client, object->map.ptr,
object->map.size);
object->map.size = 0;
}
object->map.ptr = NULL;
nvif_object_unmap_handle(object);
}
}
int
nvif_object_map(struct nvif_object *object, void *argv, u32 argc)
{
struct nvif_client *client = object->client;
u64 handle, length;
int ret = nvif_object_map_handle(object, argv, argc, &handle, &length);
if (ret >= 0) {
if (ret) {
object->map.ptr = client->driver->map(client,
handle,
length);
if (ret = -ENOMEM, object->map.ptr) {
object->map.size = length;
return 0;
}
} else {
object->map.ptr = (void *)(unsigned long)handle;
return 0;
}
nvif_object_unmap_handle(object);
}
return ret;
}
void
nvif_object_dtor(struct nvif_object *object)
{
struct {
struct nvif_ioctl_v0_hdr ioctl;
struct nvif_ioctl_del del;
} args = {
.ioctl.type = NVIF_IOCTL_V0_DEL,
};
if (!nvif_object_constructed(object))
return;
nvif_object_unmap(object);
nvif_object_ioctl(object, &args, sizeof(args), NULL);
object->client = NULL;
}
int
nvif_object_ctor(struct nvif_object *parent, const char *name, u32 handle,
s32 oclass, void *data, u32 size, struct nvif_object *object)
{
struct {
struct nvif_ioctl_v0_hdr ioctl;
struct nvif_ioctl_new_v0 new;
} *args;
int ret = 0;
object->client = NULL;
object->name = name ? name : "nvifObject";
object->handle = handle;
object->oclass = oclass;
object->map.ptr = NULL;
object->map.size = 0;
if (parent) {
u32 args_size;
if (check_add_overflow(sizeof(*args), size, &args_size)) {
nvif_object_dtor(object);
return -ENOMEM;
}
args = kmalloc(args_size, GFP_KERNEL);
if (!args) {
nvif_object_dtor(object);
return -ENOMEM;
}
object->parent = parent->parent;
args->ioctl.version = 0;
args->ioctl.type = NVIF_IOCTL_V0_NEW;
args->new.version = 0;
args->new.object = nvif_handle(object);
args->new.handle = handle;
Annotation
- Immediate include surface: `nvif/object.h`, `nvif/client.h`, `nvif/driver.h`, `nvif/ioctl.h`.
- Detected declarations: `function files`, `function nvif_object_sclass_put`, `function nvif_object_sclass_get`, `function nvif_object_mthd`, `function nvif_object_unmap_handle`, `function nvif_object_map_handle`, `function nvif_object_unmap`, `function nvif_object_map`, `function nvif_object_dtor`, `function nvif_object_ctor`.
- 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.