linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: quic_dikshita@quicinc.com,
	Vikash Garodia <quic_vgarodia@quicinc.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vedang Nagar <quic_vnagar@quicinc.com>
Subject: Re: [PATCH v3 19/29] media: iris: implement set properties to firmware during streamon
Date: Tue, 24 Sep 2024 16:09:28 +0100	[thread overview]
Message-ID: <38416875-0664-47cf-848c-6a5dbb0110dd@linaro.org> (raw)
In-Reply-To: <20240827-iris_v3-v3-19-c5fdbbe65e70@quicinc.com>

On 27/08/2024 11:05, Dikshita Agarwal via B4 Relay wrote:
> From: Vedang Nagar <quic_vnagar@quicinc.com>
> 
> During stream on, set some mandatory properties
> to firmware to start a session. Set all v4l2 properties set
> by client, to firmware prepared with the dependency graph.
> 
> Signed-off-by: Vedang Nagar <quic_vnagar@quicinc.com>
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---
>   drivers/media/platform/qcom/iris/iris_buffer.c     | 113 ++++++
>   drivers/media/platform/qcom/iris/iris_ctrls.c      |  99 +++++
>   drivers/media/platform/qcom/iris/iris_ctrls.h      |   7 +
>   drivers/media/platform/qcom/iris/iris_hfi_common.h |  76 ++++
>   .../platform/qcom/iris/iris_hfi_gen1_command.c     | 418 +++++++++++++++++++++
>   .../platform/qcom/iris/iris_hfi_gen1_defines.h     |  79 ++++
>   drivers/media/platform/qcom/iris/iris_hfi_gen2.h   |   2 +
>   .../platform/qcom/iris/iris_hfi_gen2_command.c     | 327 ++++++++++++++++
>   .../platform/qcom/iris/iris_hfi_gen2_defines.h     |  20 +
>   .../platform/qcom/iris/iris_hfi_gen2_packet.c      | 112 ++++++
>   .../platform/qcom/iris/iris_hfi_gen2_packet.h      |   7 +
>   .../platform/qcom/iris/iris_hfi_gen2_response.c    |  50 +++
>   .../platform/qcom/iris/iris_platform_common.h      |  11 +
>   .../platform/qcom/iris/iris_platform_sm8250.c      |  19 +
>   .../platform/qcom/iris/iris_platform_sm8550.c      |  31 ++
>   drivers/media/platform/qcom/iris/iris_utils.c      |  22 ++
>   drivers/media/platform/qcom/iris/iris_utils.h      |   3 +
>   drivers/media/platform/qcom/iris/iris_vdec.c       |  11 +
>   drivers/media/platform/qcom/iris/iris_vpu_buffer.c |  22 ++
>   drivers/media/platform/qcom/iris/iris_vpu_buffer.h |   1 +
>   20 files changed, 1430 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_buffer.c b/drivers/media/platform/qcom/iris/iris_buffer.c
> index 652117a19b45..b90b912d73b6 100644
> --- a/drivers/media/platform/qcom/iris/iris_buffer.c
> +++ b/drivers/media/platform/qcom/iris/iris_buffer.c
> @@ -64,6 +64,117 @@ static u32 iris_output_buffer_size_nv12(struct iris_inst *inst)
>   	return ALIGN(y_plane + uv_plane, PIXELS_4K);
>   }
>   
> +/*
> + * QC08C:
> + * Compressed Macro-tile format for NV12.
> + * Contains 4 planes in the following order -
> + * (A) Y_Meta_Plane
> + * (B) Y_UBWC_Plane
> + * (C) UV_Meta_Plane
> + * (D) UV_UBWC_Plane
> + *
> + * Y_Meta_Plane consists of meta information to decode compressed
> + * tile data in Y_UBWC_Plane.
> + * Y_UBWC_Plane consists of Y data in compressed macro-tile format.
> + * UBWC decoder block will use the Y_Meta_Plane data together with
> + * Y_UBWC_Plane data to produce loss-less uncompressed 8 bit Y samples.
> + *
> + * UV_Meta_Plane consists of meta information to decode compressed
> + * tile data in UV_UBWC_Plane.
> + * UV_UBWC_Plane consists of UV data in compressed macro-tile format.
> + * UBWC decoder block will use UV_Meta_Plane data together with
> + * UV_UBWC_Plane data to produce loss-less uncompressed 8 bit 2x2
> + * subsampled color difference samples.
> + *
> + * Each tile in Y_UBWC_Plane/UV_UBWC_Plane is independently decodable
> + * and randomly accessible. There is no dependency between tiles.
> + *
> + * <----- y_meta_stride ---->
> + * <-------- Width ------>
> + * M M M M M M M M M M M M . .      ^           ^
> + * M M M M M M M M M M M M . .      |           |
> + * M M M M M M M M M M M M . .      Height      |
> + * M M M M M M M M M M M M . .      |         y_meta_scanlines
> + * M M M M M M M M M M M M . .      |           |
> + * M M M M M M M M M M M M . .      |           |
> + * M M M M M M M M M M M M . .      |           |
> + * M M M M M M M M M M M M . .      V           |
> + * . . . . . . . . . . . . . .                  |
> + * . . . . . . . . . . . . . .                  |
> + * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
> + * . . . . . . . . . . . . . .                  V
> + * <--Compressed tile y_stride--->
> + * <------- Width ------->
> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  ^           ^
> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  Height      |
> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |        Macro_tile y_scanlines
> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  |           |
> + * Y* Y* Y* Y* Y* Y* Y* Y* . . . .  V           |
> + * . . . . . . . . . . . . . . . .              |
> + * . . . . . . . . . . . . . . . .              |
> + * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
> + * . . . . . . . . . . . . . . . .              V
> + * <----- uv_meta_stride ---->
> + * M M M M M M M M M M M M . .      ^
> + * M M M M M M M M M M M M . .      |
> + * M M M M M M M M M M M M . .      |
> + * M M M M M M M M M M M M . .      uv_meta_scanlines
> + * . . . . . . . . . . . . . .      |
> + * . . . . . . . . . . . . . .      V
> + * . . . . . . . . . . . . . .      -------> Buffer size aligned to 4k
> + * <--Compressed tile uv_stride--->
> + * U* V* U* V* U* V* U* V* . . . .  ^
> + * U* V* U* V* U* V* U* V* . . . .  |
> + * U* V* U* V* U* V* U* V* . . . .  |
> + * U* V* U* V* U* V* U* V* . . . .  uv_scanlines
> + * . . . . . . . . . . . . . . . .  |
> + * . . . . . . . . . . . . . . . .  V
> + * . . . . . . . . . . . . . . . .  -------> Buffer size aligned to 4k
> + *

As a reviewer, really appreicate the time taken to map this out.

Thanks.

> + * y_stride = align(Width, 128)
> + * uv_stride = align(Width, 128)
> + * y_scanlines = align(Height, 32)
> + * uv_scanlines = align(Height/2, 16)
> + * y_plane = align(y_stride * y_scanlines, 4096)
> + * uv_plane = align(uv_stride * uv_scanlines, 4096)
> + * y_meta_stride = align(roundup(Width, Y_TileWidth), 64)
> + * y_meta_scanlines = align(roundup(Height, Y_TileHeight), 16)
> + * y_meta_plane = align(y_meta_stride * y_meta_scanlines, 4096)
> + * uv_meta_stride = align(roundup(Width, UV_TileWidth), 64)
> + * uv_meta_scanlines = align(roundup(Height, UV_TileHeight), 16)
> + * uv_meta_plane = align(uv_meta_stride * uv_meta_scanlines, 4096)
> + *
> + * Total size = align( y_plane + uv_plane +
> + *           y_meta_plane + uv_meta_plane, 4096)
> + */
> +static u32 iris_output_buffer_size_qc08c(struct iris_inst *inst)
> +{
> +	u32 y_plane, uv_plane, y_stride, uv_stride;
> +	u32 uv_meta_stride, uv_meta_plane;
> +	u32 y_meta_stride, y_meta_plane;
> +	struct v4l2_format *f;
> +
> +	f = inst->fmt_dst;
> +	y_meta_stride = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.width, 32), 64);
> +	y_meta_plane = y_meta_stride * ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.height, 8), 16);
> +	y_meta_plane = ALIGN(y_meta_plane, PIXELS_4K);

This is a smattering of roundings, alignments and magic numbers.

Please add some comments to explain what all of those transformations 
with hard-coded numbers do.

> +
> +	y_stride = ALIGN(f->fmt.pix_mp.width, 128);
> +	y_plane = ALIGN(y_stride * ALIGN(f->fmt.pix_mp.height, 32), PIXELS_4K);
> +
> +	uv_meta_stride = ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.width / 2, 16), 64);
> +	uv_meta_plane = uv_meta_stride * ALIGN(DIV_ROUND_UP(f->fmt.pix_mp.height / 2, 8), 16);
> +	uv_meta_plane = ALIGN(uv_meta_plane, PIXELS_4K);
> +
> +	uv_stride = ALIGN(f->fmt.pix_mp.width, 128);
> +	uv_plane = ALIGN(uv_stride * ALIGN(f->fmt.pix_mp.height / 2, 32), PIXELS_4K);
> +
> +	return ALIGN(y_meta_plane + y_plane + uv_meta_plane + uv_plane, PIXELS_4K);
> +}
> +
>   static u32 iris_input_buffer_size(struct iris_inst *inst)
>   {
>   	u32 base_res_mbs = NUM_MBS_4K;
> @@ -97,6 +208,8 @@ int iris_get_buffer_size(struct iris_inst *inst,
>   		return iris_input_buffer_size(inst);
>   	case BUF_OUTPUT:
>   		return iris_output_buffer_size_nv12(inst);
> +	case BUF_DPB:
> +		return iris_output_buffer_size_qc08c(inst);
>   	default:
>   		return 0;
>   	}
> diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.c b/drivers/media/platform/qcom/iris/iris_ctrls.c
> index 868306d68a87..64b2f19c2b03 100644
> --- a/drivers/media/platform/qcom/iris/iris_ctrls.c
> +++ b/drivers/media/platform/qcom/iris/iris_ctrls.c
> @@ -3,6 +3,8 @@
>    * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
>    */
>   
> +#include <linux/types.h>
> +
>   #include "iris_ctrls.h"
>   #include "iris_instance.h"
>   
> @@ -192,3 +194,100 @@ int iris_session_init_caps(struct iris_core *core)
>   
>   	return 0;
>   }
> +
> +static u32 iris_get_port_info(struct iris_inst *inst,
> +			      enum platform_inst_fw_cap_type cap_id)
> +{
> +	if (inst->fw_cap[cap_id].flags & CAP_FLAG_INPUT_PORT)
> +		return HFI_PORT_BITSTREAM;
> +	else if (inst->fw_cap[cap_id].flags & CAP_FLAG_OUTPUT_PORT)
> +		return HFI_PORT_RAW;
> +
> +	return HFI_PORT_NONE;
> +}
> +
> +int iris_set_u32_enum(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> +	const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> +	u32 hfi_value = inst->fw_cap[cap_id].value;
> +	u32 hfi_id = inst->fw_cap[cap_id].hfi_id;
> +
> +	return hfi_ops->session_set_property(inst, hfi_id,
> +					     HFI_HOST_FLAGS_NONE,
> +					     iris_get_port_info(inst, cap_id),
> +					     HFI_PAYLOAD_U32_ENUM,
> +					     &hfi_value, sizeof(u32));
> +}
> +
> +int iris_set_u32(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> +	const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> +	u32 hfi_value = inst->fw_cap[cap_id].value;
> +	u32 hfi_id = inst->fw_cap[cap_id].hfi_id;
> +
> +	return hfi_ops->session_set_property(inst, hfi_id,
> +					     HFI_HOST_FLAGS_NONE,
> +					     iris_get_port_info(inst, cap_id),
> +					     HFI_PAYLOAD_U32,
> +					     &hfi_value, sizeof(u32));
> +}
> +
> +int iris_set_stage(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> +	const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> +	struct v4l2_format *inp_f;
> +	u32 work_mode = STAGE_2;
> +	u32 width, height;
> +	u32 hfi_id;
> +
> +	hfi_id = inst->fw_cap[cap_id].hfi_id;
> +
> +	inp_f = inst->fmt_src;
> +	height = inp_f->fmt.pix_mp.height;
> +	width = inp_f->fmt.pix_mp.width;
> +	if (iris_res_is_less_than(width, height, 1280, 720))
> +		work_mode = STAGE_1;
> +
> +	return hfi_ops->session_set_property(inst, hfi_id,
> +					     HFI_HOST_FLAGS_NONE,
> +					     iris_get_port_info(inst, cap_id),
> +					     HFI_PAYLOAD_U32,
> +					     &work_mode, sizeof(u32));
> +}
> +
> +int iris_set_pipe(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> +	const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> +	u32 work_route, hfi_id;
> +
> +	work_route = inst->fw_cap[PIPE].value;
> +	hfi_id = inst->fw_cap[cap_id].hfi_id;
> +
> +	return hfi_ops->session_set_property(inst, hfi_id,
> +					     HFI_HOST_FLAGS_NONE,
> +					     iris_get_port_info(inst, cap_id),
> +					     HFI_PAYLOAD_U32,
> +					     &work_route, sizeof(u32));
> +}
> +
> +int iris_set_properties(struct iris_inst *inst, u32 plane)
> +{
> +	const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> +	struct platform_inst_fw_cap *cap;
> +	int ret, i;
> +
> +	ret = hfi_ops->session_set_config_params(inst, plane);
> +	if (ret)
> +		return ret;
> +
> +	for (i = 1; i < INST_FW_CAP_MAX; i++) {
> +		cap = &inst->fw_cap[i];
> +		if (!iris_valid_cap_id(cap->cap_id))
> +			continue;
> +
> +		if (cap->cap_id && cap->set)
> +			cap->set(inst, i);
> +	}
> +
> +	return ret;
> +}
> diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.h b/drivers/media/platform/qcom/iris/iris_ctrls.h
> index 46e1da847aa8..ece28623070b 100644
> --- a/drivers/media/platform/qcom/iris/iris_ctrls.h
> +++ b/drivers/media/platform/qcom/iris/iris_ctrls.h
> @@ -6,10 +6,17 @@
>   #ifndef _IRIS_CTRLS_H_
>   #define _IRIS_CTRLS_H_
>   
> +#include "iris_platform_common.h"
> +
>   struct iris_core;
>   struct iris_inst;
>   
>   int iris_ctrls_init(struct iris_inst *inst);
>   int iris_session_init_caps(struct iris_core *core);
> +int iris_set_u32_enum(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
> +int iris_set_stage(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
> +int iris_set_pipe(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
> +int iris_set_u32(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
> +int iris_set_properties(struct iris_inst *inst, u32 plane);
>   
>   #endif
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_common.h b/drivers/media/platform/qcom/iris/iris_hfi_common.h
> index 4ac97692d072..fa409a9b3f04 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_common.h
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_common.h
> @@ -43,11 +43,75 @@ enum hfi_packet_host_flags {
>   	HFI_HOST_FLAGS_GET_PROPERTY		= 0x00000008,
>   };
>   
> +enum hfi_color_primaries {
> +	HFI_PRIMARIES_RESERVED		= 0,
> +	HFI_PRIMARIES_BT709		= 1,
> +	HFI_PRIMARIES_UNSPECIFIED	= 2,
> +	HFI_PRIMARIES_BT470_SYSTEM_M	= 4,
> +	HFI_PRIMARIES_BT470_SYSTEM_BG	= 5,
> +	HFI_PRIMARIES_BT601_525		= 6,
> +	HFI_PRIMARIES_SMPTE_ST240M	= 7,
> +	HFI_PRIMARIES_GENERIC_FILM	= 8,
> +	HFI_PRIMARIES_BT2020		= 9,
> +	HFI_PRIMARIES_SMPTE_ST428_1	= 10,
> +	HFI_PRIMARIES_SMPTE_RP431_2	= 11,
> +	HFI_PRIMARIES_SMPTE_EG431_1	= 12,
> +	HFI_PRIMARIES_SMPTE_EBU_TECH	= 22,
> +};
> +
> +enum hfi_transfer_characteristics {
> +	HFI_TRANSFER_RESERVED		= 0,
> +	HFI_TRANSFER_BT709		= 1,
> +	HFI_TRANSFER_UNSPECIFIED	= 2,
> +	HFI_TRANSFER_BT470_SYSTEM_M	= 4,
> +	HFI_TRANSFER_BT470_SYSTEM_BG	= 5,
> +	HFI_TRANSFER_BT601_525_OR_625	= 6,
> +	HFI_TRANSFER_SMPTE_ST240M	= 7,
> +	HFI_TRANSFER_LINEAR		= 8,
> +	HFI_TRANSFER_LOG_100_1		= 9,
> +	HFI_TRANSFER_LOG_SQRT		= 10,
> +	HFI_TRANSFER_XVYCC		= 11,
> +	HFI_TRANSFER_BT1361_0		= 12,
> +	HFI_TRANSFER_SRGB_SYCC		= 13,
> +	HFI_TRANSFER_BT2020_14		= 14,
> +	HFI_TRANSFER_BT2020_15		= 15,
> +	HFI_TRANSFER_SMPTE_ST2084_PQ	= 16,
> +	HFI_TRANSFER_SMPTE_ST428_1	= 17,
> +	HFI_TRANSFER_BT2100_2_HLG	= 18,
> +};
> +
> +enum hfi_matrix_coefficients {
> +	HFI_MATRIX_COEFF_SRGB_SMPTE_ST428_1		= 0,
> +	HFI_MATRIX_COEFF_BT709				= 1,
> +	HFI_MATRIX_COEFF_UNSPECIFIED			= 2,
> +	HFI_MATRIX_COEFF_RESERVED			= 3,
> +	HFI_MATRIX_COEFF_FCC_TITLE_47			= 4,
> +	HFI_MATRIX_COEFF_BT470_SYS_BG_OR_BT601_625	= 5,
> +	HFI_MATRIX_COEFF_BT601_525_BT1358_525_OR_625	= 6,
> +	HFI_MATRIX_COEFF_SMPTE_ST240			= 7,
> +	HFI_MATRIX_COEFF_YCGCO				= 8,
> +	HFI_MATRIX_COEFF_BT2020_NON_CONSTANT		= 9,
> +	HFI_MATRIX_COEFF_BT2020_CONSTANT		= 10,
> +	HFI_MATRIX_COEFF_SMPTE_ST2085			= 11,
> +	HFI_MATRIX_COEFF_SMPTE_CHROM_DERV_NON_CONSTANT	= 12,
> +	HFI_MATRIX_COEFF_SMPTE_CHROM_DERV_CONSTANT	= 13,
> +	HFI_MATRIX_COEFF_BT2100				= 14,
> +};
> +
> +struct iris_hfi_prop_type_handle {
> +	u32 type;
> +	int (*handle)(struct iris_inst *inst);
> +};
> +
>   struct iris_hfi_command_ops {
>   	int (*sys_init)(struct iris_core *core);
>   	int (*sys_image_version)(struct iris_core *core);
>   	int (*sys_interframe_powercollapse)(struct iris_core *core);
>   	int (*sys_pc_prep)(struct iris_core *core);
> +	int (*session_set_config_params)(struct iris_inst *inst, u32 plane);
> +	int (*session_set_property)(struct iris_inst *inst,
> +				    u32 packet_type, u32 flag, u32 plane, u32 payload_type,
> +				    void *payload, u32 payload_size);
>   	int (*session_open)(struct iris_inst *inst);
>   	int (*session_start)(struct iris_inst *inst, u32 plane);
>   	int (*session_stop)(struct iris_inst *inst, u32 plane);
> @@ -58,6 +122,18 @@ struct iris_hfi_response_ops {
>   	void (*hfi_response_handler)(struct iris_core *core);
>   };
>   
> +struct hfi_subscription_params {
> +	u32	bitstream_resolution;
> +	u32	crop_offsets[2];
> +	u32	bit_depth;
> +	u32	coded_frames;
> +	u32	fw_min_count;
> +	u32	pic_order_cnt;
> +	u32	color_info;
> +	u32	profile;
> +	u32	level;
> +};
> +
>   int iris_hfi_core_init(struct iris_core *core);
>   int iris_hfi_pm_suspend(struct iris_core *core);
>   int iris_hfi_pm_resume(struct iris_core *core);
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> index a2e29f03bfee..65f561ec76ab 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> @@ -6,6 +6,7 @@
>   #include "iris_hfi_gen1.h"
>   #include "iris_hfi_gen1_defines.h"
>   #include "iris_instance.h"
> +#include "iris_vpu_buffer.h"
>   
>   static int iris_hfi_gen1_sys_init(struct iris_core *core)
>   {
> @@ -182,12 +183,429 @@ static int iris_hfi_gen1_session_stop(struct iris_inst *inst, u32 plane)
>   	return ret;
>   }
>   
> +static int
> +iris_hfi_gen1_packet_session_set_property(struct hfi_session_set_property_pkt *packet,
> +					  struct iris_inst *inst, u32 ptype, void *pdata)
> +{
> +	void *prop_data;
> +
> +	prop_data = &packet->data[1];
> +
> +	packet->shdr.hdr.size = sizeof(*packet);
> +	packet->shdr.hdr.pkt_type = HFI_CMD_SESSION_SET_PROPERTY;
> +	packet->shdr.session_id = inst->session_id;
> +	packet->num_properties = 1;
> +	packet->data[0] = ptype;
> +
> +	switch (ptype) {
> +	case HFI_PROPERTY_PARAM_FRAME_SIZE: {
> +		struct hfi_framesize *in = pdata, *fsize = prop_data;
> +
> +		fsize->buffer_type = in->buffer_type;
> +		fsize->height = in->height;
> +		fsize->width = in->width;
> +		packet->shdr.hdr.size += sizeof(u32) + sizeof(*fsize);

You do this thing with sizeof(u32) all through this function. What's it 
for - some kind of packet overhead I suppose.

Please define this type of repeated offsetting to a #define or similar 
which is commented.

Again for comprehensibility sake.

> +		break;
> +	}
> +	case HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE: {
> +		struct hfi_videocores_usage_type *in = pdata, *cu = prop_data;
> +
> +		cu->video_core_enable_mask = in->video_core_enable_mask;
> +		packet->shdr.hdr.size += sizeof(u32) + sizeof(*cu);
> +		break;
> +	}
> +	case HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT: {
> +		struct hfi_uncompressed_format_select *in = pdata;
> +		struct hfi_uncompressed_format_select *hfi = prop_data;
> +
> +		hfi->buffer_type = in->buffer_type;
> +		hfi->format = in->format;
> +		packet->shdr.hdr.size += sizeof(u32) + sizeof(*hfi);
> +		break;
> +	}
> +	case HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO: {
> +		struct hfi_uncompressed_plane_actual_constraints_info *info = prop_data;
> +
> +		info->buffer_type = HFI_BUFFER_OUTPUT2;
> +		info->num_planes = 2;
> +		info->plane_format[0].stride_multiples = 128;
> +		info->plane_format[0].max_stride = 8192;
> +		info->plane_format[0].min_plane_buffer_height_multiple = 32;
> +		info->plane_format[0].buffer_alignment = 256;
> +		if (info->num_planes > 1) {
> +			info->plane_format[1].stride_multiples = 128;
> +			info->plane_format[1].max_stride = 8192;
> +			info->plane_format[1].min_plane_buffer_height_multiple = 16;
> +			info->plane_format[1].buffer_alignment = 256;
> +		}
> +
> +		packet->shdr.hdr.size += sizeof(u32) + sizeof(*info);

Alot of magic numbers and fixed stride sizes. As a reviewer its pretty 
difficult to discern if these are correct.

I feel they probably are but it makes me hesitating adding a Review-by 
without more information.

A comment or a macro with a name that describes that stride/alignement 
multiple / whatever.

---
bod

  reply	other threads:[~2024-09-24 15:09 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 10:05 [PATCH v3 00/29] Qualcomm iris video decoder driver Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 01/29] dt-bindings: media: Add sm8550 dt schema Dikshita Agarwal via B4 Relay
2024-08-27 10:42   ` Krzysztof Kozlowski
2024-09-05  5:41     ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 02/29] media: MAINTAINERS: Add Qualcomm Iris video accelerator driver Dikshita Agarwal via B4 Relay
2024-08-27 10:42   ` Krzysztof Kozlowski
2024-09-05  5:47     ` Dikshita Agarwal
2024-09-05 10:10       ` Dmitry Baryshkov
2024-09-05 11:02         ` Dikshita Agarwal
2024-09-05 11:02           ` Dmitry Baryshkov
2024-09-05 11:14             ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 03/29] media: iris: add platform driver for iris video device Dikshita Agarwal via B4 Relay
2024-08-27 14:08   ` Bryan O'Donoghue
2024-08-29  9:13     ` Dmitry Baryshkov
2024-08-29  9:36       ` Bryan O'Donoghue
2024-09-05  6:12       ` Dikshita Agarwal
2024-09-05  6:15         ` Dikshita Agarwal
2024-09-05 10:11           ` Dmitry Baryshkov
2024-09-05 10:59             ` Dikshita Agarwal
2024-09-05 11:07               ` Dmitry Baryshkov
2024-09-05 11:13                 ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 04/29] media: iris: initialize power resources Dikshita Agarwal via B4 Relay
2024-08-27 10:51   ` Krzysztof Kozlowski
2024-09-05 11:53     ` Dikshita Agarwal
2024-09-05 11:57       ` Krzysztof Kozlowski
2024-09-06 11:21         ` Vikash Garodia
2024-09-06 12:04           ` Krzysztof Kozlowski
2024-09-06 19:47             ` Vikash Garodia
2024-09-07  9:07               ` Krzysztof Kozlowski
2024-08-27 10:05 ` [PATCH v3 05/29] media: iris: implement iris v4l2 file ops Dikshita Agarwal via B4 Relay
2024-09-06 19:05   ` Markus Elfring
2024-09-07  8:52   ` Markus Elfring
2024-08-27 10:05 ` [PATCH v3 06/29] media: iris: introduce iris core state management with shared queues Dikshita Agarwal via B4 Relay
2024-08-28  2:38   ` kernel test robot
2024-08-27 10:05 ` [PATCH v3 07/29] media: iris: implement video firmware load/unload Dikshita Agarwal via B4 Relay
2024-08-27 23:13   ` kernel test robot
2024-08-31 13:18   ` Bryan O'Donoghue
2024-09-02  0:04     ` Dmitry Baryshkov
2024-09-05  6:17       ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 08/29] media: iris: implement boot sequence of the firmware Dikshita Agarwal via B4 Relay
2024-09-05 12:34   ` Bryan O'Donoghue
2024-09-06 11:27     ` Vikash Garodia
2024-08-27 10:05 ` [PATCH v3 09/29] media: iris: introduce Host firmware interface with necessary hooks Dikshita Agarwal via B4 Relay
2024-09-05 12:36   ` Bryan O'Donoghue
2024-09-24  9:13     ` Dikshita Agarwal
2024-09-05 13:10   ` Bryan O'Donoghue
2024-09-06 13:31     ` Vikash Garodia
2024-08-27 10:05 ` [PATCH v3 10/29] media: iris: implement power management Dikshita Agarwal via B4 Relay
2024-09-05 13:23   ` Bryan O'Donoghue
2024-09-05 13:46     ` Krzysztof Kozlowski
2024-09-24  8:38       ` Dikshita Agarwal
2024-09-24  8:36     ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 11/29] media: iris: implement reqbuf ioctl with vb2_queue_setup Dikshita Agarwal via B4 Relay
2024-09-06 12:50   ` Bryan O'Donoghue
2024-09-06 13:05     ` Bryan O'Donoghue
2024-09-26 10:47     ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 12/29] media: iris: implement s_fmt, g_fmt and try_fmt ioctls Dikshita Agarwal via B4 Relay
2024-09-24 14:41   ` Bryan O'Donoghue
2024-09-26 10:49     ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 13/29] media: iris: implement g_selection ioctl Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 14/29] media: iris: implement enum_fmt and enum_frameintervals ioctls Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 15/29] media: iris: implement subscribe_event and unsubscribe_event ioctls Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 16/29] media: iris: implement iris v4l2_ctrl_ops and prepare capabilities Dikshita Agarwal via B4 Relay
2024-08-29  9:33   ` Dmitry Baryshkov
2024-10-01 13:01     ` Vedang Nagar
2024-10-06 16:46       ` Dmitry Baryshkov
2024-08-27 10:05 ` [PATCH v3 17/29] media: iris: implement query_cap, query_ctrl and query_menu ioctls Dikshita Agarwal via B4 Relay
2024-09-24 14:49   ` Bryan O'Donoghue
2024-09-26 10:50     ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 18/29] media: iris: implement vb2 streaming ops Dikshita Agarwal via B4 Relay
2024-08-28  0:26   ` kernel test robot
2024-08-27 10:05 ` [PATCH v3 19/29] media: iris: implement set properties to firmware during streamon Dikshita Agarwal via B4 Relay
2024-09-24 15:09   ` Bryan O'Donoghue [this message]
2024-08-27 10:05 ` [PATCH v3 20/29] media: iris: subscribe parameters and properties to firmware for hfi_gen2 Dikshita Agarwal via B4 Relay
2024-09-24 15:16   ` Bryan O'Donoghue
2024-09-26 10:55     ` Dikshita Agarwal
2024-08-27 10:05 ` [PATCH v3 21/29] media: iris: allocate, initialize and queue internal buffers Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 22/29] media: iris: implement vb2 ops for buf_queue and firmware response Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 23/29] media: iris: add support for dynamic resolution change Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 24/29] media: iris: handle streamoff/on from client in " Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 25/29] media: iris: add support for drain sequence Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 26/29] media: iris: add check whether the video session is supported or not Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 27/29] media: iris: implement power scaling for vpu2 and vpu3 Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 28/29] media: iris: add allow checks for v4l2 ioctls Dikshita Agarwal via B4 Relay
2024-08-27 10:05 ` [PATCH v3 29/29] media: iris: add check to allow sub states transitions Dikshita Agarwal via B4 Relay
2024-08-27 13:41 ` [PATCH v3 00/29] Qualcomm iris video decoder driver neil.armstrong
2024-09-24  9:13   ` Dikshita Agarwal
2024-10-01 13:28     ` Neil Armstrong
2024-08-31 15:18 ` Bryan O'Donoghue
2024-09-02  0:02   ` Dmitry Baryshkov
2024-09-06 14:19     ` Nicolas Dufresne
2024-09-06 19:26       ` Vikash Garodia
2024-09-06 16:28     ` Abhinav Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=38416875-0664-47cf-848c-6a5dbb0110dd@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_dikshita@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=quic_vnagar@quicinc.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).