drivers/gpu/drm/i915/i915_cmd_parser.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/i915_cmd_parser.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/i915_cmd_parser.c- Extension
.c- Size
- 50943 bytes
- Lines
- 1625
- 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/highmem.hdrm/drm_cache.hdrm/drm_print.hgt/intel_engine.hgt/intel_engine_regs.hgt/intel_gpu_commands.hgt/intel_gt_regs.hi915_cmd_parser.hi915_drv.hi915_memcpy.hi915_reg.h
Detected Declarations
struct drm_i915_cmd_descriptorstruct drm_i915_cmd_tablestruct drm_i915_reg_descriptorstruct drm_i915_reg_tablestruct cmd_nodefunction gen7_render_get_cmd_length_maskfunction gen7_bsd_get_cmd_length_maskfunction gen7_blt_get_cmd_length_maskfunction gen9_blt_get_cmd_length_maskfunction validate_cmds_sortedfunction check_sortedfunction validate_regs_sortedfunction cmd_header_keyfunction init_hash_tablefunction fini_hash_tablefunction hash_for_each_safefunction intel_engine_init_cmd_parserfunction intel_engine_cleanup_cmd_parserfunction find_cmd_in_tablefunction hash_for_each_possiblefunction find_cmdfunction __find_regfunction find_regfunction cmd_desc_isfunction check_cmdfunction check_bbstartfunction intel_engine_cmd_parserfunction i915_cmd_parser_get_version
Annotated Snippet
struct drm_i915_cmd_descriptor {
/*
* Flags describing how the command parser processes the command.
*
* CMD_DESC_FIXED: The command has a fixed length if this is set,
* a length mask if not set
* CMD_DESC_SKIP: The command is allowed but does not follow the
* standard length encoding for the opcode range in
* which it falls
* CMD_DESC_REJECT: The command is never allowed
* CMD_DESC_REGISTER: The command should be checked against the
* register whitelist for the appropriate ring
*/
u32 flags;
#define CMD_DESC_FIXED (1<<0)
#define CMD_DESC_SKIP (1<<1)
#define CMD_DESC_REJECT (1<<2)
#define CMD_DESC_REGISTER (1<<3)
#define CMD_DESC_BITMASK (1<<4)
/*
* The command's unique identification bits and the bitmask to get them.
* This isn't strictly the opcode field as defined in the spec and may
* also include type, subtype, and/or subop fields.
*/
struct {
u32 value;
u32 mask;
} cmd;
/*
* The command's length. The command is either fixed length (i.e. does
* not include a length field) or has a length field mask. The flag
* CMD_DESC_FIXED indicates a fixed length. Otherwise, the command has
* a length mask. All command entries in a command table must include
* length information.
*/
union {
u32 fixed;
u32 mask;
} length;
/*
* Describes where to find a register address in the command to check
* against the ring's register whitelist. Only valid if flags has the
* CMD_DESC_REGISTER bit set.
*
* A non-zero step value implies that the command may access multiple
* registers in sequence (e.g. LRI), in that case step gives the
* distance in dwords between individual offset fields.
*/
struct {
u32 offset;
u32 mask;
u32 step;
} reg;
#define MAX_CMD_DESC_BITMASKS 3
/*
* Describes command checks where a particular dword is masked and
* compared against an expected value. If the command does not match
* the expected value, the parser rejects it. Only valid if flags has
* the CMD_DESC_BITMASK bit set. Only entries where mask is non-zero
* are valid.
*
* If the check specifies a non-zero condition_mask then the parser
* only performs the check when the bits specified by condition_mask
* are non-zero.
*/
struct {
u32 offset;
u32 mask;
u32 expected;
u32 condition_offset;
u32 condition_mask;
} bits[MAX_CMD_DESC_BITMASKS];
};
/*
* A table of commands requiring special handling by the command parser.
*
* Each engine has an array of tables. Each table consists of an array of
* command descriptors, which must be sorted with command opcodes in
* ascending order.
*/
struct drm_i915_cmd_table {
const struct drm_i915_cmd_descriptor *table;
int count;
};
Annotation
- Immediate include surface: `linux/highmem.h`, `drm/drm_cache.h`, `drm/drm_print.h`, `gt/intel_engine.h`, `gt/intel_engine_regs.h`, `gt/intel_gpu_commands.h`, `gt/intel_gt_regs.h`, `i915_cmd_parser.h`.
- Detected declarations: `struct drm_i915_cmd_descriptor`, `struct drm_i915_cmd_table`, `struct drm_i915_reg_descriptor`, `struct drm_i915_reg_table`, `struct cmd_node`, `function gen7_render_get_cmd_length_mask`, `function gen7_bsd_get_cmd_length_mask`, `function gen7_blt_get_cmd_length_mask`, `function gen9_blt_get_cmd_length_mask`, `function validate_cmds_sorted`.
- 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.