u32 port = iris_hfi_gen2_get_port(inst, plane);
u32 bottom_offset, right_offset;
u32 left_offset, top_offset;
- u32 payload[2];
+ u32 payload[2], codec_align;
if (inst->domain == DECODER) {
if (V4L2_TYPE_IS_OUTPUT(plane)) {
top_offset = inst->compose.top;
}
} else {
- bottom_offset = (inst->fmt_src->fmt.pix_mp.height - inst->crop.height);
- right_offset = (inst->fmt_src->fmt.pix_mp.width - inst->crop.width);
- left_offset = inst->crop.left;
- top_offset = inst->crop.top;
+ codec_align = inst->codec == V4L2_PIX_FMT_HEVC ? 32 : 16;
+ if (V4L2_TYPE_IS_OUTPUT(plane)) {
+ bottom_offset = (inst->enc_raw_height - inst->crop.height);
+ right_offset = (inst->enc_raw_width - inst->crop.width);
+ left_offset = inst->crop.left;
+ top_offset = inst->crop.top;
+ } else {
+ bottom_offset = (ALIGN(inst->fmt_dst->fmt.pix_mp.height, codec_align) -
+ inst->fmt_dst->fmt.pix_mp.height);
+ right_offset = (ALIGN(inst->fmt_dst->fmt.pix_mp.width, codec_align) -
+ inst->fmt_dst->fmt.pix_mp.width);
+ left_offset = 0;
+ top_offset = 0;
+ }
}
payload[0] = FIELD_PREP(GENMASK(31, 16), left_offset) | top_offset;
inst->crop.left = 0;
inst->crop.top = 0;
- inst->crop.width = f->fmt.pix_mp.width;
- inst->crop.height = f->fmt.pix_mp.height;
+ inst->crop.width = DEFAULT_WIDTH;
+ inst->crop.height = DEFAULT_HEIGHT;
inst->operating_rate = DEFAULT_FPS;
inst->frame_rate = DEFAULT_FPS;