drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c
Extension
.c
Size
41833 bytes
Lines
1407
Domain
Driver Families
Bucket
drivers/media
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

switch (plane) {
		case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
			return HFI_PORT_BITSTREAM;
		case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
			return HFI_PORT_RAW;
		default:
			return HFI_PORT_NONE;
		}
	} else {
		switch (plane) {
		case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
			return HFI_PORT_RAW;
		case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
			return HFI_PORT_BITSTREAM;
		default:
			return HFI_PORT_NONE;
		}
	}
}

static u32 iris_hfi_gen2_get_port_from_buf_type(struct iris_inst *inst,
						enum iris_buffer_type buffer_type)
{
	if (inst->domain == DECODER) {
		switch (buffer_type) {
		case BUF_INPUT:
		case BUF_BIN:
		case BUF_COMV:
		case BUF_NON_COMV:
		case BUF_LINE:
		case BUF_PARTIAL:
			return HFI_PORT_BITSTREAM;
		case BUF_OUTPUT:
		case BUF_DPB:
			return HFI_PORT_RAW;
		case BUF_PERSIST:
		default:
			return HFI_PORT_NONE;
		}
	} else {
		switch (buffer_type) {
		case BUF_INPUT:
		case BUF_VPSS:
			return HFI_PORT_RAW;
		case BUF_OUTPUT:
		case BUF_BIN:
		case BUF_COMV:
		case BUF_NON_COMV:
		case BUF_LINE:
		case BUF_SCRATCH_2:
			return HFI_PORT_BITSTREAM;
		case BUF_ARP:
		default:
			return HFI_PORT_NONE;
		}
	}
}

static int iris_hfi_gen2_session_set_property(struct iris_inst *inst, u32 packet_type, u32 flag,
					      u32 plane, u32 payload_type, void *payload,
					      u32 payload_size)
{
	struct iris_inst_hfi_gen2 *inst_hfi_gen2 = to_iris_inst_hfi_gen2(inst);

	iris_hfi_gen2_packet_session_property(inst,
					      packet_type,
					      flag,
					      plane,
					      payload_type,
					      payload,
					      payload_size);

	return iris_hfi_queue_cmd_write(inst->core, inst_hfi_gen2->packet,
					inst_hfi_gen2->packet->size);
}

static int iris_hfi_gen2_set_raw_resolution(struct iris_inst *inst, u32 plane)
{
	u32 resolution = inst->enc_raw_width << 16 | inst->enc_raw_height;
	u32 port = iris_hfi_gen2_get_port(inst, plane);

	return iris_hfi_gen2_session_set_property(inst,
						  HFI_PROP_RAW_RESOLUTION,
						  HFI_HOST_FLAGS_NONE,
						  port,
						  HFI_PAYLOAD_32_PACKED,
						  &resolution,
						  sizeof(u32));
}

Annotation

Implementation Notes