| .. | .. |
|---|
| 46 | 46 | return feature; |
|---|
| 47 | 47 | } |
|---|
| 48 | 48 | |
|---|
| 49 | +static bool rga_check_csc_constant(const struct rga_hw_data *data, struct rga_req *rga_base, |
|---|
| 50 | + uint32_t mode, uint32_t flag) |
|---|
| 51 | +{ |
|---|
| 52 | + if (mode & flag) |
|---|
| 53 | + return true; |
|---|
| 54 | + |
|---|
| 55 | + if ((rga_base->full_csc.flag & 0x1) && (data->feature & RGA_FULL_CSC)) |
|---|
| 56 | + return true; |
|---|
| 57 | + |
|---|
| 58 | + return false; |
|---|
| 59 | +} |
|---|
| 60 | + |
|---|
| 61 | +static bool rga_check_csc(const struct rga_hw_data *data, struct rga_req *rga_base) |
|---|
| 62 | +{ |
|---|
| 63 | + switch (rga_base->yuv2rgb_mode) { |
|---|
| 64 | + case 0x1: |
|---|
| 65 | + return rga_check_csc_constant(data, rga_base, |
|---|
| 66 | + data->csc_y2r_mode, RGA_MODE_CSC_BT601L); |
|---|
| 67 | + case 0x2: |
|---|
| 68 | + return rga_check_csc_constant(data, rga_base, |
|---|
| 69 | + data->csc_y2r_mode, RGA_MODE_CSC_BT601F); |
|---|
| 70 | + case 0x3: |
|---|
| 71 | + return rga_check_csc_constant(data, rga_base, |
|---|
| 72 | + data->csc_y2r_mode, RGA_MODE_CSC_BT709); |
|---|
| 73 | + case 0x1 << 2: |
|---|
| 74 | + return rga_check_csc_constant(data, rga_base, |
|---|
| 75 | + data->csc_r2y_mode, RGA_MODE_CSC_BT601F); |
|---|
| 76 | + case 0x2 << 2: |
|---|
| 77 | + return rga_check_csc_constant(data, rga_base, |
|---|
| 78 | + data->csc_r2y_mode, RGA_MODE_CSC_BT601L); |
|---|
| 79 | + case 0x3 << 2: |
|---|
| 80 | + return rga_check_csc_constant(data, rga_base, |
|---|
| 81 | + data->csc_r2y_mode, RGA_MODE_CSC_BT709); |
|---|
| 82 | + default: |
|---|
| 83 | + break; |
|---|
| 84 | + } |
|---|
| 85 | + |
|---|
| 86 | + if ((rga_base->full_csc.flag & 0x1)) { |
|---|
| 87 | + if (data->feature & RGA_FULL_CSC) |
|---|
| 88 | + return true; |
|---|
| 89 | + else |
|---|
| 90 | + return false; |
|---|
| 91 | + } |
|---|
| 92 | + |
|---|
| 93 | + return true; |
|---|
| 94 | +} |
|---|
| 95 | + |
|---|
| 49 | 96 | static bool rga_check_resolution(const struct rga_rect_range *range, int width, int height) |
|---|
| 50 | 97 | { |
|---|
| 51 | 98 | if (width > range->max.width || height > range->max.height) |
|---|
| .. | .. |
|---|
| 118 | 165 | if (!rga_check_resolution(&data->input_range, src0->act_w, src0->act_h)) |
|---|
| 119 | 166 | return false; |
|---|
| 120 | 167 | |
|---|
| 168 | + if (data == &rga3_data && |
|---|
| 169 | + !rga_check_resolution(&data->input_range, |
|---|
| 170 | + src0->act_w + src0->x_offset, |
|---|
| 171 | + src0->act_h + src0->y_offset)) |
|---|
| 172 | + return false; |
|---|
| 173 | + |
|---|
| 121 | 174 | if (!rga_check_format(data, src0->rd_mode, src0->format, 0)) |
|---|
| 122 | 175 | return false; |
|---|
| 123 | 176 | |
|---|
| .. | .. |
|---|
| 133 | 186 | if (!rga_check_resolution(&data->input_range, src1->act_w, src1->act_h)) |
|---|
| 134 | 187 | return false; |
|---|
| 135 | 188 | |
|---|
| 189 | + if (data == &rga3_data && |
|---|
| 190 | + !rga_check_resolution(&data->input_range, |
|---|
| 191 | + src1->act_w + src1->x_offset, |
|---|
| 192 | + src1->act_h + src1->y_offset)) |
|---|
| 193 | + return false; |
|---|
| 194 | + |
|---|
| 136 | 195 | if (!rga_check_format(data, src1->rd_mode, src1->format, 1)) |
|---|
| 137 | 196 | return false; |
|---|
| 138 | 197 | |
|---|
| .. | .. |
|---|
| 146 | 205 | struct rga_img_info_t *dst) |
|---|
| 147 | 206 | { |
|---|
| 148 | 207 | if (!rga_check_resolution(&data->output_range, dst->act_w, dst->act_h)) |
|---|
| 208 | + return false; |
|---|
| 209 | + |
|---|
| 210 | + if (data == &rga3_data && |
|---|
| 211 | + !rga_check_resolution(&data->output_range, |
|---|
| 212 | + dst->act_w + dst->x_offset, |
|---|
| 213 | + dst->act_h + dst->y_offset)) |
|---|
| 149 | 214 | return false; |
|---|
| 150 | 215 | |
|---|
| 151 | 216 | if (!rga_check_format(data, dst->rd_mode, dst->format, 2)) |
|---|
| .. | .. |
|---|
| 306 | 371 | continue; |
|---|
| 307 | 372 | } |
|---|
| 308 | 373 | |
|---|
| 374 | + if (!rga_check_csc(data, rga_base)) { |
|---|
| 375 | + if (DEBUGGER_EN(MSG)) |
|---|
| 376 | + pr_info("core = %d, break on rga_check_csc", |
|---|
| 377 | + scheduler->core); |
|---|
| 378 | + continue; |
|---|
| 379 | + } |
|---|
| 380 | + |
|---|
| 309 | 381 | optional_cores |= scheduler->core; |
|---|
| 310 | 382 | } |
|---|
| 311 | 383 | |
|---|