Message ID | 20211129182633.480021-6-jernej.skrabec@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: hantro: add Allwinner H6 support | expand |
Hi Jernej, W dniu 29.11.2021 o 19:26, Jernej Skrabec pisze: > 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 <jernej.skrabec@gmail.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> > --- > drivers/staging/media/hantro/hantro.h | 2 ++ > drivers/staging/media/hantro/hantro_drv.c | 9 ++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h > index 83ed25d9657b..06d0f3597694 100644 > --- a/drivers/staging/media/hantro/hantro.h > +++ b/drivers/staging/media/hantro/hantro.h > @@ -75,6 +75,7 @@ struct hantro_irq { > * @num_regs: number of register range names in the array > * @double_buffer: core needs double buffering > * @legacy_regs: core uses legacy register set > + * @late_postproc: postproc must be set up at the end of the job > */ > struct hantro_variant { > unsigned int enc_offset; > @@ -98,6 +99,7 @@ struct hantro_variant { > int num_regs; > unsigned int double_buffer : 1; > unsigned int legacy_regs : 1; > + unsigned int late_postproc : 1; > }; > > /** > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c > index 770f4ce71d29..33bf78be145b 100644 > --- a/drivers/staging/media/hantro/hantro_drv.c > +++ b/drivers/staging/media/hantro/hantro_drv.c > @@ -130,7 +130,7 @@ void hantro_start_prepare_run(struct hantro_ctx *ctx) > v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req, > &ctx->ctrl_handler); > > - if (!ctx->is_encoder) { > + if (!ctx->is_encoder && !ctx->dev->variant->late_postproc) { > if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) > hantro_postproc_enable(ctx); > else > @@ -142,6 +142,13 @@ void hantro_end_prepare_run(struct hantro_ctx *ctx) > { > struct vb2_v4l2_buffer *src_buf; > > + if (!ctx->is_encoder && ctx->dev->variant->late_postproc) { > + if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) > + hantro_postproc_enable(ctx); > + else > + hantro_postproc_disable(ctx); > + } > + > src_buf = hantro_get_src_buf(ctx); > v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req, > &ctx->ctrl_handler); >
On Mon, Nov 29, 2021 at 07:26:29PM +0100, Jernej Skrabec wrote: > 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 <jernej.skrabec@gmail.com> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Thanks! > --- > drivers/staging/media/hantro/hantro.h | 2 ++ > drivers/staging/media/hantro/hantro_drv.c | 9 ++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h > index 83ed25d9657b..06d0f3597694 100644 > --- a/drivers/staging/media/hantro/hantro.h > +++ b/drivers/staging/media/hantro/hantro.h > @@ -75,6 +75,7 @@ struct hantro_irq { > * @num_regs: number of register range names in the array > * @double_buffer: core needs double buffering > * @legacy_regs: core uses legacy register set > + * @late_postproc: postproc must be set up at the end of the job > */ > struct hantro_variant { > unsigned int enc_offset; > @@ -98,6 +99,7 @@ struct hantro_variant { > int num_regs; > unsigned int double_buffer : 1; > unsigned int legacy_regs : 1; > + unsigned int late_postproc : 1; > }; > > /** > diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c > index 770f4ce71d29..33bf78be145b 100644 > --- a/drivers/staging/media/hantro/hantro_drv.c > +++ b/drivers/staging/media/hantro/hantro_drv.c > @@ -130,7 +130,7 @@ void hantro_start_prepare_run(struct hantro_ctx *ctx) > v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req, > &ctx->ctrl_handler); > > - if (!ctx->is_encoder) { > + if (!ctx->is_encoder && !ctx->dev->variant->late_postproc) { > if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) > hantro_postproc_enable(ctx); > else > @@ -142,6 +142,13 @@ void hantro_end_prepare_run(struct hantro_ctx *ctx) > { > struct vb2_v4l2_buffer *src_buf; > > + if (!ctx->is_encoder && ctx->dev->variant->late_postproc) { > + if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) > + hantro_postproc_enable(ctx); > + else > + hantro_postproc_disable(ctx); > + } > + > src_buf = hantro_get_src_buf(ctx); > v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req, > &ctx->ctrl_handler); > -- > 2.34.1 >
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index 83ed25d9657b..06d0f3597694 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -75,6 +75,7 @@ struct hantro_irq { * @num_regs: number of register range names in the array * @double_buffer: core needs double buffering * @legacy_regs: core uses legacy register set + * @late_postproc: postproc must be set up at the end of the job */ struct hantro_variant { unsigned int enc_offset; @@ -98,6 +99,7 @@ struct hantro_variant { int num_regs; unsigned int double_buffer : 1; unsigned int legacy_regs : 1; + unsigned int late_postproc : 1; }; /** diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index 770f4ce71d29..33bf78be145b 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -130,7 +130,7 @@ void hantro_start_prepare_run(struct hantro_ctx *ctx) v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req, &ctx->ctrl_handler); - if (!ctx->is_encoder) { + if (!ctx->is_encoder && !ctx->dev->variant->late_postproc) { if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) hantro_postproc_enable(ctx); else @@ -142,6 +142,13 @@ void hantro_end_prepare_run(struct hantro_ctx *ctx) { struct vb2_v4l2_buffer *src_buf; + if (!ctx->is_encoder && ctx->dev->variant->late_postproc) { + if (hantro_needs_postproc(ctx, ctx->vpu_dst_fmt)) + hantro_postproc_enable(ctx); + else + hantro_postproc_disable(ctx); + } + src_buf = hantro_get_src_buf(ctx); v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req, &ctx->ctrl_handler);
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 <jernej.skrabec@gmail.com> --- drivers/staging/media/hantro/hantro.h | 2 ++ drivers/staging/media/hantro/hantro_drv.c | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-)