.. | .. |
---|
15 | 15 | #define GET_GCD(n1, n2) \ |
---|
16 | 16 | ({ \ |
---|
17 | 17 | int i; \ |
---|
18 | | - int gcd = 0; \ |
---|
| 18 | + int gcd = 1; \ |
---|
19 | 19 | for (i = 1; i <= (n1) && i <= (n2); i++) { \ |
---|
20 | 20 | if ((n1) % i == 0 && (n2) % i == 0) \ |
---|
21 | 21 | gcd = i; \ |
---|
.. | .. |
---|
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) |
---|
.. | .. |
---|
61 | 108 | int rd_mode, int format, int win_num) |
---|
62 | 109 | { |
---|
63 | 110 | int i; |
---|
64 | | - bool matched = false; |
---|
| 111 | + const uint32_t *formats; |
---|
| 112 | + uint32_t format_count; |
---|
65 | 113 | |
---|
66 | | - if (rd_mode == RGA_RASTER_MODE) { |
---|
67 | | - for (i = 0; i < data->win[win_num].num_of_raster_formats; i++) { |
---|
68 | | - if (format == data->win[win_num].raster_formats[i]) { |
---|
69 | | - matched = true; |
---|
70 | | - break; |
---|
71 | | - } |
---|
72 | | - } |
---|
73 | | - } else if (rd_mode == RGA_FBC_MODE) { |
---|
74 | | - for (i = 0; i < data->win[win_num].num_of_fbc_formats; i++) { |
---|
75 | | - if (format == data->win[win_num].fbc_formats[i]) { |
---|
76 | | - matched = true; |
---|
77 | | - break; |
---|
78 | | - } |
---|
79 | | - } |
---|
80 | | - } else if (rd_mode == RGA_TILE_MODE) { |
---|
81 | | - for (i = 0; i < data->win[win_num].num_of_tile_formats; i++) { |
---|
82 | | - if (format == data->win[win_num].tile_formats[i]) { |
---|
83 | | - matched = true; |
---|
84 | | - break; |
---|
85 | | - } |
---|
86 | | - } |
---|
| 114 | + switch (rd_mode) { |
---|
| 115 | + case RGA_RASTER_MODE: |
---|
| 116 | + formats = data->win[win_num].formats[RGA_RASTER_INDEX]; |
---|
| 117 | + format_count = data->win[win_num].formats_count[RGA_RASTER_INDEX]; |
---|
| 118 | + break; |
---|
| 119 | + case RGA_FBC_MODE: |
---|
| 120 | + formats = data->win[win_num].formats[RGA_AFBC16x16_INDEX]; |
---|
| 121 | + format_count = data->win[win_num].formats_count[RGA_AFBC16x16_INDEX]; |
---|
| 122 | + break; |
---|
| 123 | + case RGA_TILE_MODE: |
---|
| 124 | + formats = data->win[win_num].formats[RGA_TILE8x8_INDEX]; |
---|
| 125 | + format_count = data->win[win_num].formats_count[RGA_TILE8x8_INDEX]; |
---|
| 126 | + break; |
---|
| 127 | + default: |
---|
| 128 | + return false; |
---|
87 | 129 | } |
---|
88 | 130 | |
---|
89 | | - return matched; |
---|
| 131 | + if (formats == NULL || format_count == 0) |
---|
| 132 | + return false; |
---|
| 133 | + |
---|
| 134 | + for (i = 0; i < format_count; i++) |
---|
| 135 | + if (format == formats[i]) |
---|
| 136 | + return true; |
---|
| 137 | + |
---|
| 138 | + return false; |
---|
90 | 139 | } |
---|
91 | 140 | |
---|
92 | 141 | static bool rga_check_align(uint32_t byte_stride_align, uint32_t format, uint16_t w_stride) |
---|
.. | .. |
---|
324 | 373 | continue; |
---|
325 | 374 | } |
---|
326 | 375 | |
---|
| 376 | + if (!rga_check_csc(data, rga_base)) { |
---|
| 377 | + if (DEBUGGER_EN(MSG)) |
---|
| 378 | + pr_info("core = %d, break on rga_check_csc", |
---|
| 379 | + scheduler->core); |
---|
| 380 | + continue; |
---|
| 381 | + } |
---|
| 382 | + |
---|
327 | 383 | optional_cores |= scheduler->core; |
---|
328 | 384 | } |
---|
329 | 385 | |
---|