Skip to content

Commit 4ef6039

Browse files
Stanimir Varbanovmchehab
authored andcommitted
media: venus: vdec: Add support for conceal control
Adds support for decoder conceal color control. Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent b52051a commit 4ef6039

File tree

5 files changed

+45
-4
lines changed

5 files changed

+45
-4
lines changed

drivers/media/platform/qcom/venus/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ struct vdec_controls {
174174
u32 level;
175175
u32 display_delay;
176176
u32 display_delay_enable;
177+
u64 conceal_color;
177178
};
178179

179180
struct venc_controls {

drivers/media/platform/qcom/venus/hfi_cmds.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,9 @@ static int pkt_session_set_property_1x(struct hfi_session_set_property_pkt *pkt,
760760
struct hfi_conceal_color *color = prop_data;
761761
u32 *in = pdata;
762762

763-
color->conceal_color = *in;
763+
color->conceal_color = *in & 0xff;
764+
color->conceal_color |= ((*in >> 10) & 0xff) << 8;
765+
color->conceal_color |= ((*in >> 20) & 0xff) << 16;
764766
pkt->shdr.hdr.size += sizeof(u32) + sizeof(*color);
765767
break;
766768
}
@@ -1255,7 +1257,19 @@ pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt,
12551257
cq->frame_quality = in->frame_quality;
12561258
pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cq);
12571259
break;
1258-
} default:
1260+
}
1261+
case HFI_PROPERTY_PARAM_VDEC_CONCEAL_COLOR: {
1262+
struct hfi_conceal_color_v4 *color = prop_data;
1263+
u32 *in = pdata;
1264+
1265+
color->conceal_color_8bit = *in & 0xff;
1266+
color->conceal_color_8bit |= ((*in >> 10) & 0xff) << 8;
1267+
color->conceal_color_8bit |= ((*in >> 20) & 0xff) << 16;
1268+
color->conceal_color_10bit = *in;
1269+
pkt->shdr.hdr.size += sizeof(u32) + sizeof(*color);
1270+
break;
1271+
}
1272+
default:
12591273
return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata);
12601274
}
12611275

drivers/media/platform/qcom/venus/hfi_helper.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,10 +685,20 @@ struct hfi_vc1e_perf_cfg_type {
685685
u32 search_range_y_subsampled[3];
686686
};
687687

688+
/*
689+
* 0 - 7bit -> Luma (def: 16)
690+
* 8 - 15bit -> Chroma (def: 128)
691+
* format is valid up to v4
692+
*/
688693
struct hfi_conceal_color {
689694
u32 conceal_color;
690695
};
691696

697+
struct hfi_conceal_color_v4 {
698+
u32 conceal_color_8bit;
699+
u32 conceal_color_10bit;
700+
};
701+
692702
struct hfi_intra_period {
693703
u32 pframes;
694704
u32 bframes;

drivers/media/platform/qcom/venus/vdec.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ static int vdec_set_properties(struct venus_inst *inst)
620620
{
621621
struct vdec_controls *ctr = &inst->controls.dec;
622622
struct hfi_enable en = { .enable = 1 };
623-
u32 ptype, decode_order;
623+
u32 ptype, decode_order, conceal;
624624
int ret;
625625

626626
if (ctr->post_loop_deb_mode) {
@@ -638,6 +638,15 @@ static int vdec_set_properties(struct venus_inst *inst)
638638
return ret;
639639
}
640640

641+
ptype = HFI_PROPERTY_PARAM_VDEC_CONCEAL_COLOR;
642+
conceal = ctr->conceal_color & 0xffff;
643+
conceal |= ((ctr->conceal_color >> 16) & 0xffff) << 10;
644+
conceal |= ((ctr->conceal_color >> 32) & 0xffff) << 20;
645+
646+
ret = hfi_session_set_property(inst, ptype, &conceal);
647+
if (ret)
648+
return ret;
649+
641650
return 0;
642651
}
643652

drivers/media/platform/qcom/venus/vdec_ctrls.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl)
3636
case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE:
3737
ctr->display_delay_enable = ctrl->val;
3838
break;
39+
case V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR:
40+
ctr->conceal_color = *ctrl->p_new.p_s64;
41+
break;
3942
default:
4043
return -EINVAL;
4144
}
@@ -95,7 +98,7 @@ int vdec_ctrl_init(struct venus_inst *inst)
9598
struct v4l2_ctrl *ctrl;
9699
int ret;
97100

98-
ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 11);
101+
ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 12);
99102
if (ret)
100103
return ret;
101104

@@ -172,6 +175,10 @@ int vdec_ctrl_init(struct venus_inst *inst)
172175
V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE,
173176
0, 1, 1, 0);
174177

178+
v4l2_ctrl_new_std(&inst->ctrl_handler, &vdec_ctrl_ops,
179+
V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR, 0,
180+
0xffffffffffffLL, 1, 0x8000800010LL);
181+
175182
ret = inst->ctrl_handler.error;
176183
if (ret) {
177184
v4l2_ctrl_handler_free(&inst->ctrl_handler);

0 commit comments

Comments
 (0)