Commit c7ce107f authored by Michael Tretter's avatar Michael Tretter Committed by Mauro Carvalho Chehab

media: allegro: set num_ref_idx using response of configured channels

The firmware decides how many reference frames shall be used und returns
this information via the config blob. In order to set the number of
reference frames in the PPS, the driver has to read these values from
the config blob after the channel has been created in the firmware.
Signed-off-by: default avatarMichael Tretter <m.tretter@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent c4756d87
......@@ -208,6 +208,9 @@ struct allegro_channel {
struct allegro_buffer config_blob;
unsigned int num_ref_idx_l0;
unsigned int num_ref_idx_l1;
struct v4l2_ctrl *mpeg_video_h264_profile;
struct v4l2_ctrl *mpeg_video_h264_level;
struct v4l2_ctrl *mpeg_video_h264_i_frame_qp;
......@@ -1336,8 +1339,8 @@ static ssize_t allegro_h264_write_pps(struct allegro_channel *channel,
pps->entropy_coding_mode_flag = 0;
pps->bottom_field_pic_order_in_frame_present_flag = 0;
pps->num_slice_groups_minus1 = 0;
pps->num_ref_idx_l0_default_active_minus1 = 2;
pps->num_ref_idx_l1_default_active_minus1 = 2;
pps->num_ref_idx_l0_default_active_minus1 = channel->num_ref_idx_l0 - 1;
pps->num_ref_idx_l1_default_active_minus1 = channel->num_ref_idx_l1 - 1;
pps->weighted_pred_flag = 0;
pps->weighted_bipred_idc = 0;
pps->pic_init_qp_minus26 = 0;
......@@ -1639,6 +1642,9 @@ allegro_handle_create_channel(struct allegro_dev *dev,
if (err)
goto out;
channel->num_ref_idx_l0 = param.num_ref_idx_l0;
channel->num_ref_idx_l1 = param.num_ref_idx_l1;
v4l2_dbg(1, debug, &dev->v4l2_dev,
"channel %d: intermediate buffers: %d x %d bytes\n",
channel->mcu_channel_id,
......
......@@ -173,6 +173,9 @@ ssize_t allegro_decode_config_blob(struct create_channel_param *param,
struct mcu_msg_create_channel_response *msg,
u32 *src)
{
param->num_ref_idx_l0 = msg->num_ref_idx_l0;
param->num_ref_idx_l1 = msg->num_ref_idx_l1;
return 0;
}
......@@ -273,7 +276,8 @@ allegro_dec_create_channel(struct mcu_msg_create_channel_response *msg,
msg->user_id = src[i++];
msg->options = src[i++];
msg->num_core = src[i++];
msg->pps_param = src[i++];
msg->num_ref_idx_l0 = FIELD_GET(GENMASK(7, 4), src[i]);
msg->num_ref_idx_l1 = FIELD_GET(GENMASK(11, 8), src[i++]);
msg->int_buffers_count = src[i++];
msg->int_buffers_size = src[i++];
msg->rec_buffers_count = src[i++];
......
......@@ -55,6 +55,8 @@ struct create_channel_param {
u32 log2_max_frame_num;
u32 temporal_mvp_enable;
u32 dbf_ovr_en;
u32 num_ref_idx_l0;
u32 num_ref_idx_l1;
u32 rdo_cost_mode;
u32 lf;
u32 lf_x_tile;
......@@ -127,7 +129,8 @@ struct mcu_msg_create_channel_response {
u32 user_id;
u32 options;
u32 num_core;
u32 pps_param;
u32 num_ref_idx_l0;
u32 num_ref_idx_l1;
u32 int_buffers_count;
u32 int_buffers_size;
u32 rec_buffers_count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment