Skip to content

Commit 3c5b218

Browse files
jernejskmchehab
authored andcommitted
media: hantro: move postproc enablement for old cores
Older G2 cores, like that in Allwinner H6, seem to have issue with latching postproc register values if this is first thing done in job. Moving that to the end solves the issue. Signed-off-by: Jernej Skrabec <[email protected]> Reviewed-by: Andrzej Pietrasiewicz <[email protected]> Reviewed-by: Ezequiel Garcia <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 6a7c321 commit 3c5b218

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

drivers/staging/media/hantro/hantro.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct hantro_irq {
7575
* @num_regs: number of register range names in the array
7676
* @double_buffer: core needs double buffering
7777
* @legacy_regs: core uses legacy register set
78+
* @late_postproc: postproc must be set up at the end of the job
7879
*/
7980
struct hantro_variant {
8081
unsigned int enc_offset;
@@ -98,6 +99,7 @@ struct hantro_variant {
9899
int num_regs;
99100
unsigned int double_buffer : 1;
100101
unsigned int legacy_regs : 1;
102+
unsigned int late_postproc : 1;
101103
};
102104

103105
/**

drivers/staging/media/hantro/hantro_drv.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void hantro_start_prepare_run(struct hantro_ctx *ctx)
130130
v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req,
131131
&ctx->ctrl_handler);
132132

133-
if (!ctx->is_encoder) {
133+
if (!ctx->is_encoder && !ctx->dev->variant->late_postproc) {
134134
if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt))
135135
hantro_postproc_enable(ctx);
136136
else
@@ -142,6 +142,13 @@ void hantro_end_prepare_run(struct hantro_ctx *ctx)
142142
{
143143
struct vb2_v4l2_buffer *src_buf;
144144

145+
if (!ctx->is_encoder && ctx->dev->variant->late_postproc) {
146+
if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt))
147+
hantro_postproc_enable(ctx);
148+
else
149+
hantro_postproc_disable(ctx);
150+
}
151+
145152
src_buf = hantro_get_src_buf(ctx);
146153
v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req,
147154
&ctx->ctrl_handler);

0 commit comments

Comments
 (0)