video: rockchip: rga3: fix match core error in rotate mode

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: I8de477afdafcb127f3bf4dc53d2710c97e6d055f
This commit is contained in:
Yu Qiaowei
2025-03-28 16:34:41 +08:00
committed by Tao Huang
parent ec366993d0
commit 1c0e6c58e5

View File

@@ -174,8 +174,9 @@ static bool rga_check_align(struct rga_job *job,
static bool rga_check_channel(struct rga_job *job, const struct rga_hw_data *data,
struct rga_img_info_t *img,
const char *name, int input, int win_num)
const char *name, int input, int swap, int win_num)
{
int w, h;
const struct rga_rect_range *range;
if (input)
@@ -183,28 +184,36 @@ static bool rga_check_channel(struct rga_job *job, const struct rga_hw_data *dat
else
range = &data->output_range;
if (!rga_check_resolution(range, img->act_w, img->act_h)) {
if (swap) {
w = img->act_h;
h = img->act_w;
} else {
w = img->act_w;
h = img->act_h;
}
if (!rga_check_resolution(range, w, h)) {
if (DEBUGGER_EN(MSG))
rga_job_log(job, "%s resolution check error, input range[%dx%d ~ %dx%d], [w,h] = [%d, %d]\n",
name,
data->input_range.min.width, data->input_range.min.height,
data->input_range.max.width, data->input_range.max.height,
img->act_w, img->act_h);
w, h);
return false;
}
if (data == &rga3_data &&
!rga_check_resolution(&data->input_range,
img->act_w + img->x_offset,
img->act_h + img->y_offset)) {
w + img->x_offset,
h + img->y_offset)) {
if (DEBUGGER_EN(MSG))
rga_job_log(job, "%s RGA3 resolution check error, input range[%dx%d ~ %dx%d], [w+x,h+y] = [%d, %d]\n",
name,
data->input_range.min.width, data->input_range.min.height,
data->input_range.max.width, data->input_range.max.height,
img->act_w + img->x_offset,
img->act_h + img->y_offset);
w + img->x_offset,
h + img->y_offset);
return false;
}
@@ -303,6 +312,7 @@ int rga_job_assign(struct rga_job *job)
int i;
int min_of_job_count = -1;
unsigned long flags;
int need_swap = false;
/* assigned by userspace */
if (rga_base->core > RGA_NONE_CORE) {
@@ -345,6 +355,13 @@ int rga_job_assign(struct rga_job *job)
}
}
/* some mode rotate 90/270 need swap dst_width/dst_height */
if (((rga_base->rotate_mode & 0x0f) == 1) &&
((rga_base->sina == 65536 && rga_base->cosa == 0) ||
(rga_base->sina == -65536 && rga_base->cosa == 0))) {
need_swap = true;
}
/* only colorfill need single win (colorpalette?) */
if (!(feature & 1)) {
if (src1->yrgb_addr > 0) {
@@ -407,7 +424,7 @@ int rga_job_assign(struct rga_job *job)
continue;
}
if (!rga_check_channel(job, data, src0, "src0", true, 0)) {
if (!rga_check_channel(job, data, src0, "src0", true, false, 0)) {
if (DEBUGGER_EN(MSG))
rga_job_log(job, "%s(%#x), break on src0",
rga_get_core_name(scheduler->core),
@@ -416,7 +433,7 @@ int rga_job_assign(struct rga_job *job)
}
if (src1->yrgb_addr > 0) {
if (!rga_check_channel(job, data, src1, "src1", true, 1)) {
if (!rga_check_channel(job, data, src1, "src1", true, false, 1)) {
if (DEBUGGER_EN(MSG))
rga_job_log(job, "%s(%#x), break on src1",
rga_get_core_name(scheduler->core),
@@ -426,7 +443,7 @@ int rga_job_assign(struct rga_job *job)
}
}
if (!rga_check_channel(job, data, dst, "dst", false, 2)) {
if (!rga_check_channel(job, data, dst, "dst", false, need_swap, 2)) {
if (DEBUGGER_EN(MSG))
rga_job_log(job, "%s(%#x), break on dst",
rga_get_core_name(scheduler->core),