media: hantro: postproc: Configure output regs to support 10bit
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>
Mon, 29 Aug 2022 16:21:56 +0000 (18:21 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 24 Sep 2022 07:00:00 +0000 (09:00 +0200)
Move output format setting in postproc and make sure that
8/10bit configuration is correctly set.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/verisilicon/hantro_g2_hevc_dec.c
drivers/media/platform/verisilicon/hantro_postproc.c

index a917079..a9d4ac8 100644 (file)
@@ -167,8 +167,6 @@ static void set_params(struct hantro_ctx *ctx)
        hantro_reg_write(vpu, &g2_bit_depth_y_minus8, sps->bit_depth_luma_minus8);
        hantro_reg_write(vpu, &g2_bit_depth_c_minus8, sps->bit_depth_chroma_minus8);
 
-       hantro_reg_write(vpu, &g2_output_8_bits, 0);
-
        hantro_reg_write(vpu, &g2_hdr_skip_length, compute_header_skip_length(ctx));
 
        min_log2_cb_size = sps->log2_min_luma_coding_block_size_minus3 + 3;
index a0928c5..09d8cf9 100644 (file)
@@ -114,6 +114,7 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
        struct hantro_dev *vpu = ctx->dev;
        struct vb2_v4l2_buffer *dst_buf;
        int down_scale = down_scale_factor(ctx);
+       int out_depth;
        size_t chroma_offset;
        dma_addr_t dst_dma;
 
@@ -132,8 +133,9 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
                hantro_write_addr(vpu, G2_RS_OUT_LUMA_ADDR, dst_dma);
                hantro_write_addr(vpu, G2_RS_OUT_CHROMA_ADDR, dst_dma + chroma_offset);
        }
+
+       out_depth = hantro_get_format_depth(ctx->dst_fmt.pixelformat);
        if (ctx->dev->variant->legacy_regs) {
-               int out_depth = hantro_get_format_depth(ctx->dst_fmt.pixelformat);
                u8 pp_shift = 0;
 
                if (out_depth > 8)
@@ -141,6 +143,9 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx)
 
                hantro_reg_write(ctx->dev, &g2_rs_out_bit_depth, out_depth);
                hantro_reg_write(ctx->dev, &g2_pp_pix_shift, pp_shift);
+       } else {
+               hantro_reg_write(vpu, &g2_output_8_bits, out_depth > 8 ? 0 : 1);
+               hantro_reg_write(vpu, &g2_output_format, out_depth > 8 ? 1 : 0);
        }
        hantro_reg_write(vpu, &g2_out_rs_e, 1);
 }