Lines Matching refs:ctx
42 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_init() local
54 ctx->dev = cfg->dev; in hal_jpege_vepu1_init()
56 jpege_bits_init(&ctx->bits); in hal_jpege_vepu1_init()
57 mpp_assert(ctx->bits); in hal_jpege_vepu1_init()
59 ctx->cfg = cfg->cfg; in hal_jpege_vepu1_init()
60 ctx->reg_size = sizeof(RK_U32) * VEPU_JPEGE_VEPU1_NUM_REGS; in hal_jpege_vepu1_init()
61 ctx->regs = mpp_calloc_size(void, ctx->reg_size + EXTRA_INFO_SIZE); in hal_jpege_vepu1_init()
62 if (NULL == ctx->regs) { in hal_jpege_vepu1_init()
67 ctx->regs_out = mpp_calloc_size(void, ctx->reg_size + EXTRA_INFO_SIZE); in hal_jpege_vepu1_init()
68 if (NULL == ctx->regs_out) { in hal_jpege_vepu1_init()
73 hal_jpege_rc_init(&ctx->hal_rc); in hal_jpege_vepu1_init()
80 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_deinit() local
84 if (ctx->bits) { in hal_jpege_vepu1_deinit()
85 jpege_bits_deinit(ctx->bits); in hal_jpege_vepu1_deinit()
86 ctx->bits = NULL; in hal_jpege_vepu1_deinit()
89 if (ctx->dev) { in hal_jpege_vepu1_deinit()
90 mpp_dev_deinit(ctx->dev); in hal_jpege_vepu1_deinit()
91 ctx->dev = NULL; in hal_jpege_vepu1_deinit()
94 MPP_FREE(ctx->regs); in hal_jpege_vepu1_deinit()
95 MPP_FREE(ctx->regs_out); in hal_jpege_vepu1_deinit()
102 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_get_task() local
106 memcpy(&ctx->syntax, syntax, sizeof(ctx->syntax)); in hal_jpege_vepu1_get_task()
108 ctx->hal_start_pos = mpp_packet_get_length(task->packet); in hal_jpege_vepu1_get_task()
111 ctx->mcu_y = 0; in hal_jpege_vepu1_get_task()
112 ctx->mcu_h = syntax->mcu_ver_cnt; in hal_jpege_vepu1_get_task()
113 ctx->sw_bit = 0; in hal_jpege_vepu1_get_task()
114 ctx->part_bytepos = 0; in hal_jpege_vepu1_get_task()
115 ctx->part_x_fill = 0; in hal_jpege_vepu1_get_task()
116 ctx->part_y_fill = 0; in hal_jpege_vepu1_get_task()
120 if (ctx->cfg->jpeg.update) { in hal_jpege_vepu1_get_task()
121 hal_jpege_rc_update(&ctx->hal_rc, syntax); in hal_jpege_vepu1_get_task()
122 ctx->cfg->jpeg.update = 0; in hal_jpege_vepu1_get_task()
174 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_gen_regs() local
177 JpegeSyntax *syntax = &ctx->syntax; in hal_jpege_vepu1_gen_regs()
184 JpegeBits bits = ctx->bits; in hal_jpege_vepu1_gen_regs()
185 RK_U32 *regs = (RK_U32 *)ctx->regs; in hal_jpege_vepu1_gen_regs()
213 hor_stride = get_vepu_pixel_stride(&ctx->stride_cfg, width, in hal_jpege_vepu1_gen_regs()
227 ctx->part_x_fill = x_fill; in hal_jpege_vepu1_gen_regs()
228 ctx->part_y_fill = y_fill; in hal_jpege_vepu1_gen_regs()
234 hal_jpege_rc_update(&ctx->hal_rc, syntax); in hal_jpege_vepu1_gen_regs()
241 write_jpeg_header(bits, syntax, &ctx->hal_rc); in hal_jpege_vepu1_gen_regs()
250 ctx->base = buf; in hal_jpege_vepu1_gen_regs()
251 ctx->size = size; in hal_jpege_vepu1_gen_regs()
252 ctx->sw_bit = bitpos; in hal_jpege_vepu1_gen_regs()
253 ctx->part_bytepos = bytepos; in hal_jpege_vepu1_gen_regs()
277 mpp_dev_set_reg_offset(ctx->dev, 5, bytepos); in hal_jpege_vepu1_gen_regs()
363 regs[i + 64] = ctx->hal_rc.qtables[0][qp_reorder_table[i * 4 + 0]] << 24 | in hal_jpege_vepu1_gen_regs()
364 ctx->hal_rc.qtables[0][qp_reorder_table[i * 4 + 1]] << 16 | in hal_jpege_vepu1_gen_regs()
365 ctx->hal_rc.qtables[0][qp_reorder_table[i * 4 + 2]] << 8 | in hal_jpege_vepu1_gen_regs()
366 ctx->hal_rc.qtables[0][qp_reorder_table[i * 4 + 3]]; in hal_jpege_vepu1_gen_regs()
370 regs[i + 80] = ctx->hal_rc.qtables[1][qp_reorder_table[i * 4 + 0]] << 24 | in hal_jpege_vepu1_gen_regs()
371 ctx->hal_rc.qtables[1][qp_reorder_table[i * 4 + 1]] << 16 | in hal_jpege_vepu1_gen_regs()
372 ctx->hal_rc.qtables[1][qp_reorder_table[i * 4 + 2]] << 8 | in hal_jpege_vepu1_gen_regs()
373 ctx->hal_rc.qtables[1][qp_reorder_table[i * 4 + 3]]; in hal_jpege_vepu1_gen_regs()
384 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_start() local
388 hal_jpege_vepu1_set_extra_info(ctx->dev, &ctx->syntax, 0); in hal_jpege_vepu1_start()
393 RK_U32 reg_size = ctx->reg_size; in hal_jpege_vepu1_start()
395 wr_cfg.reg = ctx->regs; in hal_jpege_vepu1_start()
399 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_REG_WR, &wr_cfg); in hal_jpege_vepu1_start()
405 rd_cfg.reg = ctx->regs; in hal_jpege_vepu1_start()
409 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_REG_RD, &rd_cfg); in hal_jpege_vepu1_start()
415 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_CMD_SEND, NULL); in hal_jpege_vepu1_start()
430 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_wait() local
431 JpegeBits bits = ctx->bits; in hal_jpege_vepu1_wait()
432 RK_U32 *regs = (RK_U32 *)ctx->regs; in hal_jpege_vepu1_wait()
433 JpegeFeedback *feedback = &ctx->feedback; in hal_jpege_vepu1_wait()
440 if (ctx->dev) { in hal_jpege_vepu1_wait()
441 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_CMD_POLL, NULL); in hal_jpege_vepu1_wait()
457 task->hw_length = task->length - ctx->hal_start_pos; in hal_jpege_vepu1_wait()
468 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_part_start() local
472 RK_U32 mcu_y = ctx->mcu_y; in hal_jpege_vepu1_part_start()
474 RK_U32 *regs = (RK_U32 *)ctx->regs; in hal_jpege_vepu1_part_start()
493 part_y_fill = ctx->part_y_fill; in hal_jpege_vepu1_part_start()
500 get_msb_lsb_at_pos(®s[22], ®s[23], ctx->base, ctx->part_bytepos); in hal_jpege_vepu1_part_start()
502 regs[24] = ctx->size - ctx->part_bytepos; in hal_jpege_vepu1_part_start()
506 regs[37] = ((ctx->part_bytepos & 7) * 8) << 23; in hal_jpege_vepu1_part_start()
509 if (ctx->part_bytepos) in hal_jpege_vepu1_part_start()
510 mpp_dev_set_reg_offset(ctx->dev, 5, ctx->part_bytepos); in hal_jpege_vepu1_part_start()
519 regs[20] = part_not_end << 24 | jpege_restart_marker[ctx->rst_marker_idx & 7]; in hal_jpege_vepu1_part_start()
520 ctx->rst_marker_idx++; in hal_jpege_vepu1_part_start()
522 hal_jpege_vepu1_set_extra_info(ctx->dev, syntax, mcu_y); in hal_jpege_vepu1_part_start()
523 ctx->mcu_y += part_enc_mcu_h; in hal_jpege_vepu1_part_start()
528 RK_U32 reg_size = ctx->reg_size; in hal_jpege_vepu1_part_start()
530 wr_cfg.reg = ctx->regs; in hal_jpege_vepu1_part_start()
534 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_REG_WR, &wr_cfg); in hal_jpege_vepu1_part_start()
540 rd_cfg.reg = ctx->regs_out; in hal_jpege_vepu1_part_start()
544 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_REG_RD, &rd_cfg); in hal_jpege_vepu1_part_start()
550 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_CMD_SEND, NULL); in hal_jpege_vepu1_part_start()
565 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_part_wait() local
566 RK_U32 *regs = ctx->regs_out; in hal_jpege_vepu1_part_wait()
567 JpegeFeedback *feedback = &ctx->feedback; in hal_jpege_vepu1_part_wait()
572 if (ctx->dev) { in hal_jpege_vepu1_part_wait()
573 ret = mpp_dev_ioctl(ctx->dev, MPP_DEV_CMD_POLL, NULL); in hal_jpege_vepu1_part_wait()
582 hal_jpege_dbg_detail("byte pos %d -> %d\n", ctx->part_bytepos, in hal_jpege_vepu1_part_wait()
583 (ctx->part_bytepos & (~7)) + (hw_bit / 8)); in hal_jpege_vepu1_part_wait()
584 ctx->part_bytepos = (ctx->part_bytepos & (~7)) + (hw_bit / 8); in hal_jpege_vepu1_part_wait()
586 feedback->stream_length = ctx->part_bytepos; in hal_jpege_vepu1_part_wait()
587 task->length = ctx->part_bytepos; in hal_jpege_vepu1_part_wait()
588 task->hw_length = task->length - ctx->hal_start_pos; in hal_jpege_vepu1_part_wait()
594 ctx->sw_bit, hw_bit, feedback->stream_length, task->hw_length); in hal_jpege_vepu1_part_wait()
602 HalJpegeCtx *ctx = (HalJpegeCtx *)hal; in hal_jpege_vepu1_ret_task() local
604 task->rc_task->info.bit_real = ctx->feedback.stream_length * 8; in hal_jpege_vepu1_ret_task()
605 task->hal_ret.data = &ctx->feedback; in hal_jpege_vepu1_ret_task()