drivers/gpu/drm/imagination/pvr_stream_defs.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/imagination/pvr_stream_defs.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/imagination/pvr_stream_defs.c
Extension
.c
Size
15778 bytes
Lines
352
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

// SPDX-License-Identifier: GPL-2.0-only OR MIT
/* Copyright (c) 2023 Imagination Technologies Ltd. */

#include "pvr_device_info.h"
#include "pvr_rogue_fwif_client.h"
#include "pvr_rogue_fwif_stream.h"
#include "pvr_stream.h"
#include "pvr_stream_defs.h"

#include <linux/stddef.h>
#include <uapi/drm/pvr_drm.h>

#define PVR_STREAM_DEF_SET(owner, member, _size, _array_size, _feature) \
	{ .offset = offsetof(struct owner, member), \
	  .size = (_size),  \
	  .array_size = (_array_size), \
	  .feature = (_feature) }

#define PVR_STREAM_DEF(owner, member, member_size)  \
	PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ ## member_size, 0, PVR_FEATURE_NONE)

#define PVR_STREAM_DEF_FEATURE(owner, member, member_size, feature) \
	PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ ## member_size, 0, feature)

#define PVR_STREAM_DEF_NOT_FEATURE(owner, member, member_size, feature)       \
	PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ ## member_size, 0, \
			   (feature) | PVR_FEATURE_NOT)

#define PVR_STREAM_DEF_ARRAY(owner, member)                                       \
	PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ARRAY,                  \
			   sizeof(((struct owner *)0)->member), PVR_FEATURE_NONE)

#define PVR_STREAM_DEF_ARRAY_FEATURE(owner, member, feature)            \
	PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ARRAY,         \
			   sizeof(((struct owner *)0)->member), feature)

#define PVR_STREAM_DEF_ARRAY_NOT_FEATURE(owner, member, feature)                             \
	PVR_STREAM_DEF_SET(owner, member, PVR_STREAM_SIZE_ARRAY,                             \
			   sizeof(((struct owner *)0)->member), (feature) | PVR_FEATURE_NOT)

/*
 * When adding new parameters to the stream definition, the new parameters must go after the
 * existing parameters, to preserve order. As parameters are naturally aligned, care must be taken
 * with respect to implicit padding in the stream; padding should be minimised as much as possible.
 */
static const struct pvr_stream_def rogue_fwif_cmd_geom_stream[] = {
	PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.vdm_ctrl_stream_base, 64),
	PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.tpu_border_colour_table, 64),
	PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_geom, regs.vdm_draw_indirect0, 64,
			       PVR_FEATURE_VDM_DRAWINDIRECT),
	PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_geom, regs.vdm_draw_indirect1, 32,
			       PVR_FEATURE_VDM_DRAWINDIRECT),
	PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.ppp_ctrl, 32),
	PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.te_psg, 32),
	PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.vdm_context_resume_task0_size, 32),
	PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_geom, regs.vdm_context_resume_task3_size, 32,
			       PVR_FEATURE_VDM_OBJECT_LEVEL_LLS),
	PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.view_idx, 32),
	PVR_STREAM_DEF_FEATURE(rogue_fwif_cmd_geom, regs.pds_coeff_free_prog, 32,
			       PVR_FEATURE_TESSELLATION),
};

static const struct pvr_stream_def rogue_fwif_cmd_geom_stream_brn49927[] = {
	PVR_STREAM_DEF(rogue_fwif_cmd_geom, regs.tpu, 32),
};

static const struct pvr_stream_ext_def cmd_geom_ext_streams_0[] = {
	{
		.stream = rogue_fwif_cmd_geom_stream_brn49927,
		.stream_len = ARRAY_SIZE(rogue_fwif_cmd_geom_stream_brn49927),
		.header_mask = PVR_STREAM_EXTHDR_GEOM0_BRN49927,
		.quirk = 49927,
	},
};

static const struct pvr_stream_ext_header cmd_geom_ext_headers[] = {
	{
		.ext_streams = cmd_geom_ext_streams_0,
		.ext_streams_num = ARRAY_SIZE(cmd_geom_ext_streams_0),
		.valid_mask = PVR_STREAM_EXTHDR_GEOM0_VALID,
	},
};

const struct pvr_stream_cmd_defs pvr_cmd_geom_stream = {
	.type = PVR_STREAM_TYPE_GEOM,

	.main_stream = rogue_fwif_cmd_geom_stream,
	.main_stream_len = ARRAY_SIZE(rogue_fwif_cmd_geom_stream),

	.ext_nr_headers = ARRAY_SIZE(cmd_geom_ext_headers),

Annotation

Implementation Notes