Commit 4ef6039f authored by Stanimir Varbanov's avatar Stanimir Varbanov Committed by Mauro Carvalho Chehab

media: venus: vdec: Add support for conceal control

Adds support for decoder conceal color control.
Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent b52051a4
...@@ -174,6 +174,7 @@ struct vdec_controls { ...@@ -174,6 +174,7 @@ struct vdec_controls {
u32 level; u32 level;
u32 display_delay; u32 display_delay;
u32 display_delay_enable; u32 display_delay_enable;
u64 conceal_color;
}; };
struct venc_controls { struct venc_controls {
......
...@@ -760,7 +760,9 @@ static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt, ...@@ -760,7 +760,9 @@ static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt,
struct hfi_conceal_color *color = prop_data; struct hfi_conceal_color *color = prop_data;
u32 *in = pdata; u32 *in = pdata;
color->conceal_color = *in; color->conceal_color = *in & 0xff;
color->conceal_color |= ((*in >> 10) & 0xff) << 8;
color->conceal_color |= ((*in >> 20) & 0xff) << 16;
pkt->shdr.hdr.size += sizeof(u32) + sizeof(*color); pkt->shdr.hdr.size += sizeof(u32) + sizeof(*color);
break; break;
} }
...@@ -1255,7 +1257,19 @@ pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt, ...@@ -1255,7 +1257,19 @@ pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt,
cq->frame_quality = in->frame_quality; cq->frame_quality = in->frame_quality;
pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cq); pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cq);
break; break;
} default: }
case HFI_PROPERTY_PARAM_VDEC_CONCEAL_COLOR: {
struct hfi_conceal_color_v4 *color = prop_data;
u32 *in = pdata;
color->conceal_color_8bit = *in & 0xff;
color->conceal_color_8bit |= ((*in >> 10) & 0xff) << 8;
color->conceal_color_8bit |= ((*in >> 20) & 0xff) << 16;
color->conceal_color_10bit = *in;
pkt->shdr.hdr.size += sizeof(u32) + sizeof(*color);
break;
}
default:
return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata); return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata);
} }
......
...@@ -685,10 +685,20 @@ struct hfi_vc1e_perf_cfg_type { ...@@ -685,10 +685,20 @@ struct hfi_vc1e_perf_cfg_type {
u32 search_range_y_subsampled[3]; u32 search_range_y_subsampled[3];
}; };
/*
* 0 - 7bit -> Luma (def: 16)
* 8 - 15bit -> Chroma (def: 128)
* format is valid up to v4
*/
struct hfi_conceal_color { struct hfi_conceal_color {
u32 conceal_color; u32 conceal_color;
}; };
struct hfi_conceal_color_v4 {
u32 conceal_color_8bit;
u32 conceal_color_10bit;
};
struct hfi_intra_period { struct hfi_intra_period {
u32 pframes; u32 pframes;
u32 bframes; u32 bframes;
......
...@@ -620,7 +620,7 @@ static int vdec_set_properties(struct venus_inst *inst) ...@@ -620,7 +620,7 @@ static int vdec_set_properties(struct venus_inst *inst)
{ {
struct vdec_controls *ctr = &inst->controls.dec; struct vdec_controls *ctr = &inst->controls.dec;
struct hfi_enable en = { .enable = 1 }; struct hfi_enable en = { .enable = 1 };
u32 ptype, decode_order; u32 ptype, decode_order, conceal;
int ret; int ret;
if (ctr->post_loop_deb_mode) { if (ctr->post_loop_deb_mode) {
...@@ -638,6 +638,15 @@ static int vdec_set_properties(struct venus_inst *inst) ...@@ -638,6 +638,15 @@ static int vdec_set_properties(struct venus_inst *inst)
return ret; return ret;
} }
ptype = HFI_PROPERTY_PARAM_VDEC_CONCEAL_COLOR;
conceal = ctr->conceal_color & 0xffff;
conceal |= ((ctr->conceal_color >> 16) & 0xffff) << 10;
conceal |= ((ctr->conceal_color >> 32) & 0xffff) << 20;
ret = hfi_session_set_property(inst, ptype, &conceal);
if (ret)
return ret;
return 0; return 0;
} }
......
...@@ -36,6 +36,9 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -36,6 +36,9 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE: case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE:
ctr->display_delay_enable = ctrl->val; ctr->display_delay_enable = ctrl->val;
break; break;
case V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR:
ctr->conceal_color = *ctrl->p_new.p_s64;
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -95,7 +98,7 @@ int vdec_ctrl_init(struct venus_inst *inst) ...@@ -95,7 +98,7 @@ int vdec_ctrl_init(struct venus_inst *inst)
struct v4l2_ctrl *ctrl; struct v4l2_ctrl *ctrl;
int ret; int ret;
ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 11); ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 12);
if (ret) if (ret)
return ret; return ret;
...@@ -172,6 +175,10 @@ int vdec_ctrl_init(struct venus_inst *inst) ...@@ -172,6 +175,10 @@ int vdec_ctrl_init(struct venus_inst *inst)
V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE, V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE,
0, 1, 1, 0); 0, 1, 1, 0);
v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops,
V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR, 0,
0xffffffffffffLL, 1, 0x8000800010LL);
ret = inst->ctrl_handler.error; ret = inst->ctrl_handler.error;
if (ret) { if (ret) {
v4l2_ctrl_handler_free(&inst->ctrl_handler); v4l2_ctrl_handler_free(&inst->ctrl_handler);
......
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