drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c- Extension
.c- Size
- 8231 bytes
- Lines
- 299
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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
nv31.hcore/client.hcore/gpuobj.hsubdev/fb.hsubdev/timer.hengine/fifo.hnvif/class.h
Detected Declarations
function filesfunction nv31_mpeg_chan_dtorfunction nv31_mpeg_chan_newfunction nv31_mpeg_tilefunction nv31_mpeg_mthd_dmafunction nv31_mpeg_mthdfunction nv31_mpeg_intrfunction nv31_mpeg_initfunction nv31_mpeg_dtorfunction nv31_mpeg_new_function nv31_mpeg_new
Annotated Snippet
if (type == 0x00000020 && mthd == 0x0000) {
nvkm_mask(device, 0x00b308, 0x00000000, 0x00000000);
show &= ~0x01000000;
}
if (type == 0x00000010) {
if (nv31_mpeg_mthd(mpeg, mthd, data))
show &= ~0x01000000;
}
}
nvkm_wr32(device, 0x00b100, stat);
nvkm_wr32(device, 0x00b230, 0x00000001);
if (show) {
nvkm_error(subdev, "ch %d [%s] %08x %08x %08x %08x\n",
mpeg->chan ? mpeg->chan->fifo->id : -1,
mpeg->chan ? mpeg->chan->fifo->name :
"unknown", stat, type, mthd, data);
}
spin_unlock_irqrestore(&mpeg->engine.lock, flags);
}
int
nv31_mpeg_init(struct nvkm_engine *mpeg)
{
struct nvkm_subdev *subdev = &mpeg->subdev;
struct nvkm_device *device = subdev->device;
/* VPE init */
nvkm_wr32(device, 0x00b0e0, 0x00000020); /* nvidia: rd 0x01, wr 0x20 */
nvkm_wr32(device, 0x00b0e8, 0x00000020); /* nvidia: rd 0x01, wr 0x20 */
/* PMPEG init */
nvkm_wr32(device, 0x00b32c, 0x00000000);
nvkm_wr32(device, 0x00b314, 0x00000100);
nvkm_wr32(device, 0x00b220, 0x00000031);
nvkm_wr32(device, 0x00b300, 0x02001ec1);
nvkm_mask(device, 0x00b32c, 0x00000001, 0x00000001);
nvkm_wr32(device, 0x00b100, 0xffffffff);
nvkm_wr32(device, 0x00b140, 0xffffffff);
if (nvkm_msec(device, 2000,
if (!(nvkm_rd32(device, 0x00b200) & 0x00000001))
break;
) < 0) {
nvkm_error(subdev, "timeout %08x\n",
nvkm_rd32(device, 0x00b200));
return -EBUSY;
}
return 0;
}
static void *
nv31_mpeg_dtor(struct nvkm_engine *engine)
{
return nv31_mpeg(engine);
}
static const struct nvkm_engine_func
nv31_mpeg_ = {
.dtor = nv31_mpeg_dtor,
.init = nv31_mpeg_init,
.intr = nv31_mpeg_intr,
.tile = nv31_mpeg_tile,
.fifo.cclass = nv31_mpeg_chan_new,
.sclass = {
{ -1, -1, NV31_MPEG, &nv31_mpeg_object },
{}
}
};
int
nv31_mpeg_new_(const struct nv31_mpeg_func *func, struct nvkm_device *device,
enum nvkm_subdev_type type, int inst, struct nvkm_engine **pmpeg)
{
struct nv31_mpeg *mpeg;
if (!(mpeg = kzalloc_obj(*mpeg)))
return -ENOMEM;
mpeg->func = func;
*pmpeg = &mpeg->engine;
return nvkm_engine_ctor(&nv31_mpeg_, device, type, inst, true, &mpeg->engine);
}
static const struct nv31_mpeg_func
Annotation
- Immediate include surface: `nv31.h`, `core/client.h`, `core/gpuobj.h`, `subdev/fb.h`, `subdev/timer.h`, `engine/fifo.h`, `nvif/class.h`.
- Detected declarations: `function files`, `function nv31_mpeg_chan_dtor`, `function nv31_mpeg_chan_new`, `function nv31_mpeg_tile`, `function nv31_mpeg_mthd_dma`, `function nv31_mpeg_mthd`, `function nv31_mpeg_intr`, `function nv31_mpeg_init`, `function nv31_mpeg_dtor`, `function nv31_mpeg_new_`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.