drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c
Extension
.c
Size
4028 bytes
Lines
148
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.

Dependency Surface

Detected Declarations

Annotated Snippet

#include "priv.h"

#include <core/memory.h>

void
nvkm_ltc_tags_clear(struct nvkm_device *device, u32 first, u32 count)
{
	struct nvkm_ltc *ltc = device->ltc;
	const u32 limit = first + count - 1;

	BUG_ON((first > limit) || (limit >= ltc->num_tags));

	mutex_lock(&ltc->mutex);
	ltc->func->cbc_clear(ltc, first, limit);
	ltc->func->cbc_wait(ltc);
	mutex_unlock(&ltc->mutex);
}

int
nvkm_ltc_zbc_color_get(struct nvkm_ltc *ltc, int index, const u32 color[4])
{
	memcpy(ltc->zbc_color[index], color, sizeof(ltc->zbc_color[index]));
	ltc->func->zbc_clear_color(ltc, index, color);
	return index;
}

int
nvkm_ltc_zbc_depth_get(struct nvkm_ltc *ltc, int index, const u32 depth)
{
	ltc->zbc_depth[index] = depth;
	ltc->func->zbc_clear_depth(ltc, index, depth);
	return index;
}

int
nvkm_ltc_zbc_stencil_get(struct nvkm_ltc *ltc, int index, const u32 stencil)
{
	ltc->zbc_stencil[index] = stencil;
	ltc->func->zbc_clear_stencil(ltc, index, stencil);
	return index;
}

void
nvkm_ltc_invalidate(struct nvkm_ltc *ltc)
{
	if (ltc->func->invalidate)
		ltc->func->invalidate(ltc);
}

void
nvkm_ltc_flush(struct nvkm_ltc *ltc)
{
	if (ltc->func->flush)
		ltc->func->flush(ltc);
}

static void
nvkm_ltc_intr(struct nvkm_subdev *subdev)
{
	struct nvkm_ltc *ltc = nvkm_ltc(subdev);
	ltc->func->intr(ltc);
}

static int
nvkm_ltc_oneinit(struct nvkm_subdev *subdev)
{
	struct nvkm_ltc *ltc = nvkm_ltc(subdev);
	return ltc->func->oneinit(ltc);
}

static int
nvkm_ltc_init(struct nvkm_subdev *subdev)
{
	struct nvkm_ltc *ltc = nvkm_ltc(subdev);
	int i;

	for (i = ltc->zbc_color_min; i <= ltc->zbc_color_max; i++)
		ltc->func->zbc_clear_color(ltc, i, ltc->zbc_color[i]);

	for (i = ltc->zbc_depth_min; i <= ltc->zbc_depth_max; i++) {
		ltc->func->zbc_clear_depth(ltc, i, ltc->zbc_depth[i]);
		if (ltc->func->zbc_clear_stencil)
			ltc->func->zbc_clear_stencil(ltc, i, ltc->zbc_stencil[i]);
	}

	ltc->func->init(ltc);
	return 0;
}

static void *

Annotation

Implementation Notes