| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2011, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bvdb.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/73 $ |
|---|
| 12 | * $brcm_Date: 7/20/11 4:05p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/vdb/35230/A0/bvdb.c $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/73 7/20/11 4:05p jerrylim |
|---|
| 21 | * SWDTV-8009: Prevent memory leakage |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/72 6/28/11 6:09p jerrylim |
|---|
| 24 | * SWDTV-7243: Added config205 |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/71 5/2/11 12:40p yingh |
|---|
| 27 | * SWDTV-6375: Added config204 with RTS supported |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/70 4/6/11 10:45a jerrylim |
|---|
| 30 | * SWDTV-5931: Added config101 for CAP1 buffer capture |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/69 3/16/11 5:26p yingh |
|---|
| 33 | * SWDTV-5403: Added config402 with RTS supported |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/68 2/22/11 3:39p jerrylim |
|---|
| 36 | * SWDTV-5417: Added config203 with RTS supported |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/67 2/14/11 12:11p jerrylim |
|---|
| 39 | * SW35230-2804: Added PC processing option (422 or 444) |
|---|
| 40 | * |
|---|
| 41 | * Hydra_Software_Devel/66 2/9/11 7:31p jerrylim |
|---|
| 42 | * SW35230-3000: Print source mapping table for debug |
|---|
| 43 | * |
|---|
| 44 | * Hydra_Software_Devel/65 2/9/11 4:28p jerrylim |
|---|
| 45 | * SW35230-2843: Added config202 |
|---|
| 46 | * |
|---|
| 47 | * Hydra_Software_Devel/64 2/4/11 3:30p jerrylim |
|---|
| 48 | * SW35230-1724: Added a 3D dual path processing to config200 |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/63 1/28/11 2:12p jerrylim |
|---|
| 51 | * SW35230-2895: config100 does not need global RTS settings |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/62 1/27/11 5:55p jerrylim |
|---|
| 54 | * SW35230-1170: moved 3D OSD support to common |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/61 1/27/11 11:58a jerrylim |
|---|
| 57 | * SW35230-2162: updated config300/301 in MCVP0_RWC2 to allocate proper BW |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/60 1/13/11 6:25p jerrylim |
|---|
| 60 | * SW35230-2674: Added RTC support to config200 |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/59 1/11/11 5:55p jerrylim |
|---|
| 63 | * SW35230-2630, SW35230-2301: VDEC memory clients are always given |
|---|
| 64 | * necessary memory bandwidth which ensures that there's no hole and 3D |
|---|
| 65 | * comb always works |
|---|
| 66 | * |
|---|
| 67 | * Hydra_Software_Devel/58 12/24/10 11:32a jerrylim |
|---|
| 68 | * SW35230-2526: Force CAP-SCL if a 1080p RP source is in dot-by-dot view |
|---|
| 69 | * mode |
|---|
| 70 | * |
|---|
| 71 | * Hydra_Software_Devel/57 12/20/10 3:51p jerrylim |
|---|
| 72 | * SW35230-2613, SW35230-2594: Updated config401 to support high bitrate |
|---|
| 73 | * streams and wider range of window and clipping size |
|---|
| 74 | * |
|---|
| 75 | * Hydra_Software_Devel/56 12/16/10 2:29p jerrylim |
|---|
| 76 | * SW35230-2579: Replaced user mode functions with kernel mode functions |
|---|
| 77 | * |
|---|
| 78 | * Hydra_Software_Devel/55 12/15/10 11:08a jerrylim |
|---|
| 79 | * SW35230-2579: Made VDB kernel mode safe |
|---|
| 80 | * |
|---|
| 81 | * Hydra_Software_Devel/54 12/14/10 10:14p jhaberf |
|---|
| 82 | * SW35230-2565: Removed includes of stdio.h/stdlib.h as these cause build |
|---|
| 83 | * errors when building for kernel mode |
|---|
| 84 | * |
|---|
| 85 | * Hydra_Software_Devel/53 12/14/10 2:48p jerrylim |
|---|
| 86 | * SWGERRARD-1145: Removed config400 (config401 covers it) and increased |
|---|
| 87 | * OSD size to 1920x1080 in config401 |
|---|
| 88 | * |
|---|
| 89 | * Hydra_Software_Devel/52 12/3/10 3:49p jerrylim |
|---|
| 90 | * SW35230-2132, SW35230-2182: use round robin for PDP WR to cover spike |
|---|
| 91 | * at the last line |
|---|
| 92 | * |
|---|
| 93 | * Hydra_Software_Devel/51 11/22/10 8:10p jerrylim |
|---|
| 94 | * SW35230-2346: Force 422 for non-PC sources |
|---|
| 95 | * |
|---|
| 96 | * Hydra_Software_Devel/50 11/22/10 3:11p jerrylim |
|---|
| 97 | * SW35230-2132, SW35230-2182: Go back to the original PDP workaround for |
|---|
| 98 | * dimming to correctly work |
|---|
| 99 | * |
|---|
| 100 | * Hydra_Software_Devel/49 11/19/10 1:29p jerrylim |
|---|
| 101 | * SW35230-2132, SW35230-2182: Removed PDP workaourd because a fix is |
|---|
| 102 | * available in PDP |
|---|
| 103 | * |
|---|
| 104 | * Hydra_Software_Devel/48 11/17/10 11:23a jerrylim |
|---|
| 105 | * SW35230-2131: Need to consider ADC Calibaration |
|---|
| 106 | * |
|---|
| 107 | * Hydra_Software_Devel/47 11/16/10 5:38p jerrylim |
|---|
| 108 | * SW35230-2132, SW35230-2182: Give enough bw to PDP WR to cover the spike |
|---|
| 109 | * at the end of line |
|---|
| 110 | * |
|---|
| 111 | * Hydra_Software_Devel/46 11/12/10 10:21a jerrylim |
|---|
| 112 | * SW35230-2131: handle NULL cases for monitor output |
|---|
| 113 | * |
|---|
| 114 | * Hydra_Software_Devel/45 11/10/10 8:15p jerrylim |
|---|
| 115 | * SW35230-2131, SW35230-1910, SW35230-1889: make sure CAP/VFD is not |
|---|
| 116 | * starting |
|---|
| 117 | * |
|---|
| 118 | * Hydra_Software_Devel/44 11/8/10 7:14p jerrylim |
|---|
| 119 | * SW35230-2067: Check PIG mode first, if a match found, then use the |
|---|
| 120 | * mode. Otherwise stick to full mode for dot by dot display |
|---|
| 121 | * |
|---|
| 122 | * Hydra_Software_Devel/43 11/5/10 4:59p jerrylim |
|---|
| 123 | * SW35230-1278: Adjust PDP worst case for 300/301/400/401 |
|---|
| 124 | * |
|---|
| 125 | * Hydra_Software_Devel/42 10/19/10 9:40a jerrylim |
|---|
| 126 | * SWGERRARD-790: Support OSD size for 3D video mode |
|---|
| 127 | * |
|---|
| 128 | * Hydra_Software_Devel/41 10/7/10 6:21p jerrylim |
|---|
| 129 | * SW35230-1192: No compensation for panel reversal |
|---|
| 130 | * |
|---|
| 131 | * Hydra_Software_Devel/40 10/7/10 6:10p jerrylim |
|---|
| 132 | * SW35230-1192: No compensation for panel reversal |
|---|
| 133 | * |
|---|
| 134 | * Hydra_Software_Devel/39 10/7/10 4:25p jerrylim |
|---|
| 135 | * SW35230-1610, SW35230-1607: Put back panel reversal support and |
|---|
| 136 | * extended cropping size to 32% |
|---|
| 137 | * |
|---|
| 138 | * Hydra_Software_Devel/38 9/29/10 4:12p jerrylim |
|---|
| 139 | * SW35230-1530: Added dot-by-dot mode |
|---|
| 140 | * |
|---|
| 141 | * Hydra_Software_Devel/37 9/28/10 6:53p jerrylim |
|---|
| 142 | * SW35230-1514: Added MFD 1080p @ 60 usage cases |
|---|
| 143 | * |
|---|
| 144 | * Hydra_Software_Devel/36 9/28/10 6:41p jerrylim |
|---|
| 145 | * SW35230-1514: Added MFD 1080p @ 60 usage cases |
|---|
| 146 | * |
|---|
| 147 | * Hydra_Software_Devel/35 9/20/10 4:31p jerrylim |
|---|
| 148 | * SW35230-765: Assume a max PC resolution if a matching format not found |
|---|
| 149 | * |
|---|
| 150 | * Hydra_Software_Devel/34 9/16/10 3:50p jerrylim |
|---|
| 151 | * SW35230-1335: Add config400, 401 |
|---|
| 152 | * |
|---|
| 153 | * Hydra_Software_Devel/33 9/15/10 11:17a jerrylim |
|---|
| 154 | * SW35230-1359: freed an allocated memory chunk when closing |
|---|
| 155 | * |
|---|
| 156 | * Hydra_Software_Devel/32 9/10/10 5:57p jerrylim |
|---|
| 157 | * SW35230-1332: Add VDB support for PDP and FRC |
|---|
| 158 | * |
|---|
| 159 | * Hydra_Software_Devel/31 8/31/10 12:07p jerrylim |
|---|
| 160 | * SW35230-1231: Added MFD JPEG source to get mapped to the new source |
|---|
| 161 | * group |
|---|
| 162 | * |
|---|
| 163 | * Hydra_Software_Devel/30 8/26/10 5:55p jerrylim |
|---|
| 164 | * SW35230-1170: Added support for OSD size for 3D sources |
|---|
| 165 | * |
|---|
| 166 | * Hydra_Software_Devel/29 8/24/10 2:02p jerrylim |
|---|
| 167 | * SW35230-785: Added support for auto aspect ratio correction |
|---|
| 168 | * |
|---|
| 169 | * Hydra_Software_Devel/28 8/23/10 6:21p jerrylim |
|---|
| 170 | * SW35230-785: Added support for Auto Aspect Ratio Correction |
|---|
| 171 | * |
|---|
| 172 | * Hydra_Software_Devel/27 8/13/10 4:06p jerrylim |
|---|
| 173 | * SW35230-224: Added a get function which returns feature set that each |
|---|
| 174 | * RTS configuration supports |
|---|
| 175 | * |
|---|
| 176 | * Hydra_Software_Devel/26 8/4/10 5:40a jerrylim |
|---|
| 177 | * SW35230-842: Adjusted MFD bo in a576i pig mode |
|---|
| 178 | * |
|---|
| 179 | * Hydra_Software_Devel/25 8/2/10 12:06a jerrylim |
|---|
| 180 | * SW35230-778: Make sure that all MFD formats fall under a predefined |
|---|
| 181 | * source format group |
|---|
| 182 | * |
|---|
| 183 | * Hydra_Software_Devel/24 7/30/10 6:05p jerrylim |
|---|
| 184 | * SW35230-785: Allowed any main win size when PIP is configured |
|---|
| 185 | * |
|---|
| 186 | * Hydra_Software_Devel/23 7/29/10 5:38p jerrylim |
|---|
| 187 | * SW35230-817: Added 3D support to config200 |
|---|
| 188 | * |
|---|
| 189 | * Hydra_Software_Devel/22 7/29/10 12:46p jerrylim |
|---|
| 190 | * SW35230-778: Added AVC 1920x720 @ 25 |
|---|
| 191 | * |
|---|
| 192 | * Hydra_Software_Devel/21 7/23/10 5:47p jerrylim |
|---|
| 193 | * SW35230-670: CAP bpp with panel reversal compensated |
|---|
| 194 | * |
|---|
| 195 | * Hydra_Software_Devel/20 7/23/10 9:58a jerrylim |
|---|
| 196 | * SW35230-744: Added the missing error checking. Set the proper OSD size |
|---|
| 197 | * to make OSD size checking valid |
|---|
| 198 | * |
|---|
| 199 | * Hydra_Software_Devel/19 7/22/10 7:51p jerrylim |
|---|
| 200 | * SW35230-742: Modified config200 with 667Mhz support w/o FRC, Added |
|---|
| 201 | * initial revision of config201 |
|---|
| 202 | * |
|---|
| 203 | * Hydra_Software_Devel/18 7/15/10 7:48p jerrylim |
|---|
| 204 | * SW35230-297: Added more debug prints |
|---|
| 205 | * |
|---|
| 206 | * Hydra_Software_Devel/17 7/15/10 5:39p jerrylim |
|---|
| 207 | * SW35230-320: Added initial revision of config300 and config301 |
|---|
| 208 | * |
|---|
| 209 | * Hydra_Software_Devel/16 7/15/10 4:58p jerrylim |
|---|
| 210 | * SW35230-663: Eanble MAD if ANR is enabled because MAD is tied to ANR |
|---|
| 211 | * |
|---|
| 212 | * Hydra_Software_Devel/15 7/12/10 3:51p jerrylim |
|---|
| 213 | * SW35230-297: Added PIP support. Added more message for easier problem |
|---|
| 214 | * identification |
|---|
| 215 | * |
|---|
| 216 | * Hydra_Software_Devel/14 7/8/10 1:11p jerrylim |
|---|
| 217 | * SW35230-297: Simplified display modes |
|---|
| 218 | * |
|---|
| 219 | * Hydra_Software_Devel/13 7/7/10 4:16p jerrylim |
|---|
| 220 | * SW35230-297: Simplified Get display Mode |
|---|
| 221 | * |
|---|
| 222 | * Hydra_Software_Devel/12 7/6/10 4:03p jerrylim |
|---|
| 223 | * SW35230-297: Made usage mode obey VDB |
|---|
| 224 | * |
|---|
| 225 | * Hydra_Software_Devel/11 7/2/10 5:44p jerrylim |
|---|
| 226 | * SW35230-297: Changed config100 to the new design style |
|---|
| 227 | * |
|---|
| 228 | * Hydra_Software_Devel/10 7/2/10 3:49p jerrylim |
|---|
| 229 | * SW35230-297: Added RTS status print, Added usagemode version print, |
|---|
| 230 | * Removed cfg101(obsolete), Added RTS table ID, Adjusted win to max |
|---|
| 231 | * |
|---|
| 232 | * Hydra_Software_Devel/9 6/29/10 11:18a jerrylim |
|---|
| 233 | * SW35230-297: cleaned up old design. Corrected VDB dump |
|---|
| 234 | * |
|---|
| 235 | * Hydra_Software_Devel/8 6/25/10 5:18p jerrylim |
|---|
| 236 | * SW35230-309: Treat AVC 1080i as 1080psf |
|---|
| 237 | * |
|---|
| 238 | * Hydra_Software_Devel/7 6/25/10 1:56p jerrylim |
|---|
| 239 | * SW35230-309: Handle ADC calibration differently |
|---|
| 240 | * |
|---|
| 241 | * Hydra_Software_Devel/6 6/23/10 8:27p jerrylim |
|---|
| 242 | * SW35230-309: Always use main RTS setting for sub |
|---|
| 243 | * |
|---|
| 244 | * Hydra_Software_Devel/5 6/23/10 6:50p jerrylim |
|---|
| 245 | * SW35230-309: Initialized win size and clipping size |
|---|
| 246 | * |
|---|
| 247 | * Hydra_Software_Devel/4 6/23/10 5:53p jerrylim |
|---|
| 248 | * SW35230-309: Added config 200 based on Usage Mode Rev.2.0 |
|---|
| 249 | * |
|---|
| 250 | * Hydra_Software_Devel/3 5/21/10 2:16p jerrylim |
|---|
| 251 | * SW35230-205: Merged all VDB changes checked into the SW23230-205 sub |
|---|
| 252 | * branch |
|---|
| 253 | * |
|---|
| 254 | * Hydra_Software_Devel/SW35230-205/5 5/19/10 6:00p jerrylim |
|---|
| 255 | * SW35230-205: Corrected some of usage modes |
|---|
| 256 | * |
|---|
| 257 | * Hydra_Software_Devel/SW35230-205/4 5/10/10 3:26p jerrylim |
|---|
| 258 | * SW35230-205: moved the default configs from 1/2 to 100/101 because |
|---|
| 259 | * nexus has some dependencies on configs and especially WXGA displayr |
|---|
| 260 | * resolution is forced with config 1. And client 127 is a special |
|---|
| 261 | * register which controls the DRAM refresh rate, and should be |
|---|
| 262 | * differently programmed |
|---|
| 263 | * |
|---|
| 264 | * Hydra_Software_Devel/SW35230-205/3 5/7/10 5:26p jerrylim |
|---|
| 265 | * SW35230-205: Capture forced except for MFD JPEG sources |
|---|
| 266 | * |
|---|
| 267 | * Hydra_Software_Devel/SW35230-205/2 5/7/10 4:22p jerrylim |
|---|
| 268 | * SW35230-205: dynamically compose the usage mode and return one of the |
|---|
| 269 | * two default RTS settings - hardware default for config1 and ASIC team |
|---|
| 270 | * simultation default fo rconfig2 |
|---|
| 271 | * |
|---|
| 272 | * Hydra_Software_Devel/SW35230-205/1 5/5/10 11:57a jerrylim |
|---|
| 273 | * SW35230-205: Test checkin. No functional change |
|---|
| 274 | * |
|---|
| 275 | * Hydra_Software_Devel/1 4/30/10 3:06p jerrylim |
|---|
| 276 | * SW35230-99: Added real VDB files |
|---|
| 277 | * |
|---|
| 278 | ***************************************************************************/ |
|---|
| 279 | #include "bstd.h" |
|---|
| 280 | #include "berr.h" |
|---|
| 281 | #include "bkni.h" |
|---|
| 282 | #include "bfmt.h" |
|---|
| 283 | #include "blst_circleq.h" |
|---|
| 284 | #include "bdbg.h" |
|---|
| 285 | |
|---|
| 286 | #include "bvdb.h" |
|---|
| 287 | #include "bvdb_priv.h" |
|---|
| 288 | |
|---|
| 289 | #include "bchp_memc_arb_0.h" |
|---|
| 290 | |
|---|
| 291 | BDBG_MODULE(BVDB); |
|---|
| 292 | |
|---|
| 293 | #define BVDB_P_FRC_PIXEL_PADDING_PDP_WORKAROUND 1 |
|---|
| 294 | #define BVDB_P_SCL_CAP_WORKAOURND 1 |
|---|
| 295 | #define BVDB_P_BIG_THRESHOLD 100000 |
|---|
| 296 | |
|---|
| 297 | /* Giving 100 max will make first comparison to get passed, so each display mode |
|---|
| 298 | * will be free to pick up any clipping size in percentage */ |
|---|
| 299 | #define BVDB_P_MAX_SRC_CLIP_HEIGHT_AMOUNT 100 /* percent */ |
|---|
| 300 | #define BVDB_P_MAX_SRC_CLIP_WIDTH_AMOUNT 100 /* percent */ |
|---|
| 301 | |
|---|
| 302 | /* In case a matched input format is not found, then it tries search this table |
|---|
| 303 | * if there's any match. This table is a collection of formats which cannot be |
|---|
| 304 | * grouped using the standard decision making process. The input format group |
|---|
| 305 | * used in this table is based on the RTS analysis tool. Note that this table |
|---|
| 306 | * contains non-PC formats only |
|---|
| 307 | * |
|---|
| 308 | * ********** NOTE ********** |
|---|
| 309 | * Each group of sources must be in the order from low to high frame rate where |
|---|
| 310 | * a group means sources which have same width, height and progressiveness */ |
|---|
| 311 | static BVDB_P_SourceFormat stNonPcNonStandardFormats[] = |
|---|
| 312 | { |
|---|
| 313 | /* EIA/CEA-861-B (also in HDMI) 1440x480p without pixel repetition */ |
|---|
| 314 | {1440, 480, true, 60000, false, BVDB_InputFormatGroup_e720p_60}, |
|---|
| 315 | |
|---|
| 316 | /* HDMI1.4 3D Video VIC 32 */ |
|---|
| 317 | {1920, 2205, true, 23976, true, BVDB_InputFormatGroup_e1080p3d_24}, |
|---|
| 318 | {1920, 2205, true, 24000, true, BVDB_InputFormatGroup_e1080p3d_24}, |
|---|
| 319 | |
|---|
| 320 | /* HDMI1.4 3D Video VIC 34 */ |
|---|
| 321 | {1920, 2205, true, 30000, true, BVDB_InputFormatGroup_e1080p3d_30}, |
|---|
| 322 | |
|---|
| 323 | /* HDMI1.4 3D Video VIC 19 */ |
|---|
| 324 | {1280, 1470, true, 50000, true, BVDB_InputFormatGroup_e720p3d_50}, |
|---|
| 325 | |
|---|
| 326 | /* HDMI1.4 3D Video VIC 4 */ |
|---|
| 327 | {1280, 1470, true, 59940, true, BVDB_InputFormatGroup_e720p3d_60}, |
|---|
| 328 | {1280, 1470, true, 60000, true, BVDB_InputFormatGroup_e720p3d_60}, |
|---|
| 329 | |
|---|
| 330 | /* wireless 3D Video 2160i48 */ |
|---|
| 331 | {1920, 2160, false, 47952, true, BVDB_InputFormatGroup_e1080p3d_24}, |
|---|
| 332 | {1920, 2160, false, 48000, true, BVDB_InputFormatGroup_e1080p3d_24}, |
|---|
| 333 | }; |
|---|
| 334 | |
|---|
| 335 | static BVDB_P_SourceFormat stMfdFormats[] = |
|---|
| 336 | { |
|---|
| 337 | { 720, 576, false, 60000, false, BVDB_InputFormatGroup_ePal}, |
|---|
| 338 | { 720, 576, true, 60000, false, BVDB_InputFormatGroup_e576p}, |
|---|
| 339 | {1280, 720, true, 60000, false, BVDB_InputFormatGroup_e720p_60}, |
|---|
| 340 | {1920, 1080, false, 60000, false, BVDB_InputFormatGroup_e1080i_60}, |
|---|
| 341 | {1920, 1080, true, 30000, false, BVDB_InputFormatGroup_e1080p_30}, |
|---|
| 342 | {1920, 1080, true, 60000, false, BVDB_InputFormatGroup_e1080p_60}, |
|---|
| 343 | }; |
|---|
| 344 | |
|---|
| 345 | |
|---|
| 346 | /* This is an interim solution to map an old source format to a new source |
|---|
| 347 | * format */ |
|---|
| 348 | static BVDB_P_MapToNewSourceGroup stMapToNewSourceGroup[] = |
|---|
| 349 | { |
|---|
| 350 | {BVDB_InputFormatGroup_eNtsc, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 351 | {BVDB_InputFormatGroup_ePal, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 352 | {BVDB_InputFormatGroup_e480p, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 353 | {BVDB_InputFormatGroup_e576p, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 354 | {BVDB_InputFormatGroup_e720p_50, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 355 | {BVDB_InputFormatGroup_e720p_60, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 356 | {BVDB_InputFormatGroup_e1080i_50, false, BVDB_SourceGroup_Rp_e1080i}, |
|---|
| 357 | {BVDB_InputFormatGroup_e1080i_60, false, BVDB_SourceGroup_Rp_e1080i}, |
|---|
| 358 | {BVDB_InputFormatGroup_e1080p_24, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 359 | {BVDB_InputFormatGroup_e1080p_25, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 360 | {BVDB_InputFormatGroup_e1080p_30, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 361 | {BVDB_InputFormatGroup_e1080p_50, false, BVDB_SourceGroup_Rp_e1080p}, |
|---|
| 362 | {BVDB_InputFormatGroup_e1080p_60, false, BVDB_SourceGroup_Rp_e1080p}, |
|---|
| 363 | {BVDB_InputFormatGroup_ePal_60, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 364 | {BVDB_InputFormatGroup_e720p_24, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 365 | {BVDB_InputFormatGroup_e720p_25, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 366 | {BVDB_InputFormatGroup_e720p_30, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 367 | {BVDB_InputFormatGroup_e544_576i_50, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 368 | {BVDB_InputFormatGroup_e1440_1080i_50, false, BVDB_SourceGroup_Rp_e1080i}, |
|---|
| 369 | {BVDB_InputFormatGroup_e1440_1080p_25, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 370 | {BVDB_InputFormatGroup_e544_480i_60, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 371 | {BVDB_InputFormatGroup_e1440_1080i_60, false, BVDB_SourceGroup_Rp_e1080i}, |
|---|
| 372 | {BVDB_InputFormatGroup_e1440_1080p_30, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 373 | {BVDB_InputFormatGroup_e1440_1080p_24, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 374 | {BVDB_InputFormatGroup_e1024_768_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 375 | {BVDB_InputFormatGroup_e1024_768_85_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 376 | {BVDB_InputFormatGroup_e1366_768_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 377 | {BVDB_InputFormatGroup_e1366_768_85_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 378 | {BVDB_InputFormatGroup_e1400_1050_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 379 | {BVDB_InputFormatGroup_e1400_1050_75_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 380 | {BVDB_InputFormatGroup_e1920_1080_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 381 | {BVDB_InputFormatGroup_e1600_1200_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 382 | {BVDB_InputFormatGroup_eAdcCalibration, false, BVDB_SourceGroup_eAdcCalibration}, |
|---|
| 383 | {BVDB_InputFormatGroup_eJpeg_540, false, BVDB_SourceGroup_eJpeg}, |
|---|
| 384 | {BVDB_InputFormatGroup_eJpeg_1080, false, BVDB_SourceGroup_eJpeg}, |
|---|
| 385 | {BVDB_InputFormatGroup_e1080p3d_24, false, BVDB_SourceGroup_Rp_e1080p3d}, |
|---|
| 386 | {BVDB_InputFormatGroup_e1080p3d_30, false, BVDB_SourceGroup_Rp_e1080p3d}, |
|---|
| 387 | {BVDB_InputFormatGroup_e720p3d_60, false, BVDB_SourceGroup_Rp_e720p3d}, |
|---|
| 388 | {BVDB_InputFormatGroup_e720p3d_50, false, BVDB_SourceGroup_Rp_e720p3d}, |
|---|
| 389 | |
|---|
| 390 | {BVDB_InputFormatGroup_eNtsc, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 391 | {BVDB_InputFormatGroup_ePal, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 392 | {BVDB_InputFormatGroup_e480p, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 393 | {BVDB_InputFormatGroup_e576p, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 394 | {BVDB_InputFormatGroup_e720p_50, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 395 | {BVDB_InputFormatGroup_e720p_60, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 396 | {BVDB_InputFormatGroup_e1080i_50, true, BVDB_SourceGroup_Avc_e1080i}, |
|---|
| 397 | {BVDB_InputFormatGroup_e1080i_60, true, BVDB_SourceGroup_Avc_e1080i}, |
|---|
| 398 | {BVDB_InputFormatGroup_e1080p_24, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 399 | {BVDB_InputFormatGroup_e1080p_25, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 400 | {BVDB_InputFormatGroup_e1080p_30, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 401 | {BVDB_InputFormatGroup_e1080p_50, true, BVDB_SourceGroup_Avc_e1080p}, |
|---|
| 402 | {BVDB_InputFormatGroup_e1080p_60, true, BVDB_SourceGroup_Avc_e1080p}, |
|---|
| 403 | {BVDB_InputFormatGroup_e1024_768_60_PC, true, BVDB_SourceGroup_Avc_e1080p}, |
|---|
| 404 | {BVDB_InputFormatGroup_e1024_768_85_PC, true, BVDB_SourceGroup_Avc_e1080p}, |
|---|
| 405 | {BVDB_InputFormatGroup_ePal_60, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 406 | {BVDB_InputFormatGroup_e720p_24, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 407 | {BVDB_InputFormatGroup_e720p_25, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 408 | {BVDB_InputFormatGroup_e720p_30, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 409 | {BVDB_InputFormatGroup_e544_576i_50, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 410 | {BVDB_InputFormatGroup_e1440_1080i_50, true, BVDB_SourceGroup_Avc_e1080i}, |
|---|
| 411 | {BVDB_InputFormatGroup_e1440_1080p_25, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 412 | {BVDB_InputFormatGroup_e544_480i_60, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 413 | {BVDB_InputFormatGroup_e1440_1080i_60, true, BVDB_SourceGroup_Avc_e1080i}, |
|---|
| 414 | {BVDB_InputFormatGroup_e1440_1080p_30, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 415 | {BVDB_InputFormatGroup_e1440_1080p_24, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 416 | {BVDB_InputFormatGroup_eJpeg_540, true, BVDB_SourceGroup_eJpeg}, |
|---|
| 417 | {BVDB_InputFormatGroup_eJpeg_1080, true, BVDB_SourceGroup_eJpeg} |
|---|
| 418 | }; |
|---|
| 419 | |
|---|
| 420 | static BVDB_P_TContext tvdb; |
|---|
| 421 | |
|---|
| 422 | #define BVDB_P_PRINT_SOURCE_MAPPING 0 |
|---|
| 423 | |
|---|
| 424 | #if (BDBG_DEBUG_BUILD && BVDB_P_PRINT_SOURCE_MAPPING) |
|---|
| 425 | typedef struct |
|---|
| 426 | { |
|---|
| 427 | uint32_t ulWidth; |
|---|
| 428 | uint32_t ulHeight; |
|---|
| 429 | uint32_t ulFrameRate; |
|---|
| 430 | uint32_t bProgressive; |
|---|
| 431 | } BVDB_P_DebugSourceFormat; |
|---|
| 432 | |
|---|
| 433 | static BVDB_P_DebugSourceFormat astSourceFormat[] = |
|---|
| 434 | { |
|---|
| 435 | /* DTV SD */ |
|---|
| 436 | {720, 480, 50000, false}, |
|---|
| 437 | {720, 480, 60000, false}, |
|---|
| 438 | {720, 480, 50000, true}, |
|---|
| 439 | {720, 480, 60000, true}, |
|---|
| 440 | |
|---|
| 441 | {720, 576, 50000, false}, |
|---|
| 442 | {720, 576, 60000, false}, |
|---|
| 443 | {720, 576, 50000, true}, |
|---|
| 444 | {720, 576, 60000, true}, |
|---|
| 445 | |
|---|
| 446 | /* DTV HD */ |
|---|
| 447 | {1280, 720, 50000, true}, |
|---|
| 448 | {1280, 720, 60000, true}, |
|---|
| 449 | |
|---|
| 450 | {1920, 1080, 50000, false}, |
|---|
| 451 | {1920, 1080, 60000, false}, |
|---|
| 452 | {1920, 1080, 50000, true}, |
|---|
| 453 | {1920, 1080, 60000, true}, |
|---|
| 454 | |
|---|
| 455 | /* PC formats */ |
|---|
| 456 | {640, 350, 85000, true}, |
|---|
| 457 | {640, 400, 85000, true}, |
|---|
| 458 | {640, 480, 59940, true}, |
|---|
| 459 | {640, 480, 66667, true}, |
|---|
| 460 | {640, 480, 72000, true}, |
|---|
| 461 | {640, 480, 75000, true}, |
|---|
| 462 | {640, 480, 85000, true}, |
|---|
| 463 | {720, 400, 85000, true}, |
|---|
| 464 | {800, 600, 56000, true}, |
|---|
| 465 | {800, 600, 56250, true}, |
|---|
| 466 | {800, 600, 59862, true}, |
|---|
| 467 | {800, 600, 60000, true}, |
|---|
| 468 | {800, 600, 60317, true}, |
|---|
| 469 | {800, 600, 72000, true}, |
|---|
| 470 | {800, 600, 72188, true}, |
|---|
| 471 | {800, 600, 75000, true}, |
|---|
| 472 | {800, 600, 85000, true}, |
|---|
| 473 | {800, 600, 85061, true}, |
|---|
| 474 | {848, 480, 60000, true}, |
|---|
| 475 | {848, 480, 60000, true}, |
|---|
| 476 | {832, 624, 74546, true}, |
|---|
| 477 | {832, 624, 75000, true}, |
|---|
| 478 | {1024, 768, 59920, true}, |
|---|
| 479 | {1024, 768, 60004, true}, |
|---|
| 480 | {1024, 768, 66110, true}, |
|---|
| 481 | {1024, 768, 70069, true}, |
|---|
| 482 | {1024, 768, 75029, true}, |
|---|
| 483 | {1024, 768, 84997, true}, |
|---|
| 484 | {1152, 864, 75000, true}, |
|---|
| 485 | {1280, 768, 59995, true}, |
|---|
| 486 | {1280, 768, 59870, true}, |
|---|
| 487 | {1280, 768, 74893, true}, |
|---|
| 488 | {1280, 768, 84837, true}, |
|---|
| 489 | {1280, 800, 59910, true}, |
|---|
| 490 | {1280, 800, 59810, true}, |
|---|
| 491 | {1280, 800, 74934, true}, |
|---|
| 492 | {1280, 800, 84880, true}, |
|---|
| 493 | {1280, 960, 60000, true}, |
|---|
| 494 | {1280, 960, 85002, true}, |
|---|
| 495 | {1280, 1024, 59895, true}, |
|---|
| 496 | {1280, 1024, 60020, true}, |
|---|
| 497 | {1280, 1024, 69995, true}, |
|---|
| 498 | {1280, 1024, 75025, true}, |
|---|
| 499 | {1280, 1024, 85024, true}, |
|---|
| 500 | {1340, 725, 60000, true}, |
|---|
| 501 | {1360, 768, 59799, true}, |
|---|
| 502 | {1360, 768, 60015, true}, |
|---|
| 503 | {1366, 768, 59650, true}, |
|---|
| 504 | {1366, 768, 59658, true}, |
|---|
| 505 | {1400, 1050, 59948, true}, |
|---|
| 506 | {1400, 1050, 59978, true}, |
|---|
| 507 | {1400, 1050, 74867, true}, |
|---|
| 508 | {1440, 900, 59901, true}, |
|---|
| 509 | {1440, 900, 59887, true}, |
|---|
| 510 | {1440, 900, 74984, true}, |
|---|
| 511 | {1440, 900, 84842, true}, |
|---|
| 512 | {1600, 1200, 60000, true}, |
|---|
| 513 | {1680, 1050, 59883, true}, |
|---|
| 514 | {1680, 1050, 59954, true}, |
|---|
| 515 | {1920, 1080, 59988, true}, |
|---|
| 516 | {1920, 1080, 60000, true}, |
|---|
| 517 | {1920, 1200, 60000, true}, |
|---|
| 518 | {0, 0, 0, false} |
|---|
| 519 | }; |
|---|
| 520 | #endif /* BDBG_DEBUG_BUILD && BVDB_P_PRINT_SOURCE_MAPPING */ |
|---|
| 521 | |
|---|
| 522 | /* Public Functions */ |
|---|
| 523 | BERR_Code BVDB_CreateVdb |
|---|
| 524 | ( BVDB_Handle *phVdb, |
|---|
| 525 | uint32_t *pulEntries) |
|---|
| 526 | { |
|---|
| 527 | BERR_Code err = BERR_SUCCESS; |
|---|
| 528 | BVDB_P_Context *pVdb; |
|---|
| 529 | |
|---|
| 530 | pVdb = (BVDB_P_Context *)BKNI_Malloc(sizeof(BVDB_P_Context)); |
|---|
| 531 | if (pVdb == NULL) |
|---|
| 532 | { |
|---|
| 533 | BDBG_ERR(("Out of memory")); |
|---|
| 534 | return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY); |
|---|
| 535 | } |
|---|
| 536 | |
|---|
| 537 | *phVdb = (BVDB_Handle) pVdb; |
|---|
| 538 | *pulEntries = sizeof( BVDB_Handle ); |
|---|
| 539 | |
|---|
| 540 | tvdb.ulConfigId = 0; |
|---|
| 541 | |
|---|
| 542 | tvdb.main.clipHeight = 0; |
|---|
| 543 | tvdb.main.clipWidth = 0; |
|---|
| 544 | tvdb.main.winHeight = 100; |
|---|
| 545 | tvdb.main.winWidth = 100; |
|---|
| 546 | |
|---|
| 547 | tvdb.sub.clipHeight = 0; |
|---|
| 548 | tvdb.sub.clipWidth = 0; |
|---|
| 549 | tvdb.sub.winHeight = 100; |
|---|
| 550 | tvdb.sub.winWidth = 100; |
|---|
| 551 | |
|---|
| 552 | /* Test source mapping of all possible formats */ |
|---|
| 553 | #if (BDBG_DEBUG_BUILD && BVDB_P_PRINT_SOURCE_MAPPING) |
|---|
| 554 | { |
|---|
| 555 | BVDB_InputFormatGroup eInputFormatGroup; |
|---|
| 556 | uint32_t uiInputType; |
|---|
| 557 | uint32_t i; |
|---|
| 558 | BERR_Code rc; |
|---|
| 559 | |
|---|
| 560 | for (uiInputType = BVDB_Input_eCvbsSvidIfd; uiInputType <= BVDB_Input_e656; uiInputType++) |
|---|
| 561 | { |
|---|
| 562 | i = 0; |
|---|
| 563 | for (;;) |
|---|
| 564 | { |
|---|
| 565 | if (astSourceFormat[i].ulWidth == 0) |
|---|
| 566 | { |
|---|
| 567 | break; |
|---|
| 568 | } |
|---|
| 569 | |
|---|
| 570 | rc = BVDB_GetInputFormatGroup(*phVdb, |
|---|
| 571 | astSourceFormat[i].ulHeight, |
|---|
| 572 | astSourceFormat[i].ulWidth, |
|---|
| 573 | astSourceFormat[i].ulFrameRate, |
|---|
| 574 | astSourceFormat[i].bProgressive, |
|---|
| 575 | false, |
|---|
| 576 | (BVDB_Input) uiInputType, |
|---|
| 577 | &eInputFormatGroup |
|---|
| 578 | ); |
|---|
| 579 | BDBG_P_PrintString("%s%s: %dx%d%s@%d -> %s\n", |
|---|
| 580 | rc == BERR_SUCCESS ? " " : "!", |
|---|
| 581 | uiInputType == BVDB_Input_eCvbsSvidIfd ? "BVDB_Input_eCvbsSvidIfd" : |
|---|
| 582 | uiInputType == BVDB_Input_eComponent ? "BVDB_Input_eComponent " : |
|---|
| 583 | uiInputType == BVDB_Input_eHdDvi ? "BVDB_Input_eHdDvi " : |
|---|
| 584 | uiInputType == BVDB_Input_eMfd ? "BVDB_Input_eMfd " : |
|---|
| 585 | uiInputType == BVDB_Input_eVga ? "BVDB_Input_eVga " : |
|---|
| 586 | uiInputType == BVDB_Input_e656 ? "BVDB_Input_e656 " : |
|---|
| 587 | "Unknown Source ", |
|---|
| 588 | astSourceFormat[i].ulWidth, |
|---|
| 589 | astSourceFormat[i].ulHeight, |
|---|
| 590 | astSourceFormat[i].bProgressive ? "p" : "i", |
|---|
| 591 | astSourceFormat[i].ulFrameRate, |
|---|
| 592 | |
|---|
| 593 | eInputFormatGroup == BVDB_InputFormatGroup_eNtsc ? "BVDB_InputFormatGroup_eNtsc" : |
|---|
| 594 | eInputFormatGroup == BVDB_InputFormatGroup_ePal ? "BVDB_InputFormatGroup_ePal" : |
|---|
| 595 | eInputFormatGroup == BVDB_InputFormatGroup_e480p ? "BVDB_InputFormatGroup_e480p" : |
|---|
| 596 | eInputFormatGroup == BVDB_InputFormatGroup_e576p ? "BVDB_InputFormatGroup_e576p" : |
|---|
| 597 | eInputFormatGroup == BVDB_InputFormatGroup_e720p_50 ? "BVDB_InputFormatGroup_e720p_50" : |
|---|
| 598 | eInputFormatGroup == BVDB_InputFormatGroup_e720p_60 ? "BVDB_InputFormatGroup_e720p_60" : |
|---|
| 599 | eInputFormatGroup == BVDB_InputFormatGroup_e1080i_50 ? "BVDB_InputFormatGroup_e1080i_50" : |
|---|
| 600 | eInputFormatGroup == BVDB_InputFormatGroup_e1080i_60 ? "BVDB_InputFormatGroup_e1080i_60" : |
|---|
| 601 | eInputFormatGroup == BVDB_InputFormatGroup_e1080p_24 ? "BVDB_InputFormatGroup_e1080p_24" : |
|---|
| 602 | eInputFormatGroup == BVDB_InputFormatGroup_e1080p_25 ? "BVDB_InputFormatGroup_e1080p_25" : |
|---|
| 603 | eInputFormatGroup == BVDB_InputFormatGroup_e1080p_30 ? "BVDB_InputFormatGroup_e1080p_30" : |
|---|
| 604 | eInputFormatGroup == BVDB_InputFormatGroup_e1080p_50 ? "BVDB_InputFormatGroup_e1080p_50" : |
|---|
| 605 | eInputFormatGroup == BVDB_InputFormatGroup_e1080p_60 ? "BVDB_InputFormatGroup_e1080p_60" : |
|---|
| 606 | eInputFormatGroup == BVDB_InputFormatGroup_ePal_60 ? "BVDB_InputFormatGroup_ePal_60" : |
|---|
| 607 | eInputFormatGroup == BVDB_InputFormatGroup_e720p_24 ? "BVDB_InputFormatGroup_e720p_24" : |
|---|
| 608 | eInputFormatGroup == BVDB_InputFormatGroup_e720p_25 ? "BVDB_InputFormatGroup_e720p_25" : |
|---|
| 609 | eInputFormatGroup == BVDB_InputFormatGroup_e720p_30 ? "BVDB_InputFormatGroup_e720p_30" : |
|---|
| 610 | eInputFormatGroup == BVDB_InputFormatGroup_e544_576i_50 ? "BVDB_InputFormatGroup_e544_576i_50" : |
|---|
| 611 | eInputFormatGroup == BVDB_InputFormatGroup_e1440_1080i_50 ? "BVDB_InputFormatGroup_e1440_1080i_50" : |
|---|
| 612 | eInputFormatGroup == BVDB_InputFormatGroup_e1440_1080p_25 ? "BVDB_InputFormatGroup_e1440_1080p_25" : |
|---|
| 613 | eInputFormatGroup == BVDB_InputFormatGroup_e544_480i_60 ? "BVDB_InputFormatGroup_e544_480i_60" : |
|---|
| 614 | eInputFormatGroup == BVDB_InputFormatGroup_e1440_1080i_60 ? "BVDB_InputFormatGroup_e1440_1080i_60" : |
|---|
| 615 | eInputFormatGroup == BVDB_InputFormatGroup_e1440_1080p_30 ? "BVDB_InputFormatGroup_e1440_1080p_30" : |
|---|
| 616 | eInputFormatGroup == BVDB_InputFormatGroup_e1440_1080p_24 ? "BVDB_InputFormatGroup_e1440_1080p_24" : |
|---|
| 617 | eInputFormatGroup == BVDB_InputFormatGroup_e1024_768_60_PC ? "BVDB_InputFormatGroup_e1024_768_60_PC" : |
|---|
| 618 | eInputFormatGroup == BVDB_InputFormatGroup_e1024_768_85_PC ? "BVDB_InputFormatGroup_e1024_768_85_PC" : |
|---|
| 619 | eInputFormatGroup == BVDB_InputFormatGroup_e1366_768_60_PC ? "BVDB_InputFormatGroup_e1366_768_60_PC" : |
|---|
| 620 | eInputFormatGroup == BVDB_InputFormatGroup_e1366_768_85_PC ? "BVDB_InputFormatGroup_e1366_768_85_PC" : |
|---|
| 621 | eInputFormatGroup == BVDB_InputFormatGroup_e1400_1050_60_PC ? "BVDB_InputFormatGroup_e1400_1050_60_PC" : |
|---|
| 622 | eInputFormatGroup == BVDB_InputFormatGroup_e1400_1050_75_PC ? "BVDB_InputFormatGroup_e1400_1050_75_PC" : |
|---|
| 623 | eInputFormatGroup == BVDB_InputFormatGroup_e1920_1080_60_PC ? "BVDB_InputFormatGroup_e1920_1080_60_PC" : |
|---|
| 624 | eInputFormatGroup == BVDB_InputFormatGroup_e1600_1200_60_PC ? "BVDB_InputFormatGroup_e1600_1200_60_PC" : |
|---|
| 625 | eInputFormatGroup == BVDB_InputFormatGroup_eAdcCalibration ? "BVDB_InputFormatGroup_eAdcCalibration" : |
|---|
| 626 | eInputFormatGroup == BVDB_InputFormatGroup_eJpeg_540 ? "BVDB_InputFormatGroup_eJpeg_540" : |
|---|
| 627 | eInputFormatGroup == BVDB_InputFormatGroup_eJpeg_1080 ? "BVDB_InputFormatGroup_eJpeg_1080" : |
|---|
| 628 | eInputFormatGroup == BVDB_InputFormatGroup_e1080p3d_24 ? "BVDB_InputFormatGroup_e1080p3d_24" : |
|---|
| 629 | eInputFormatGroup == BVDB_InputFormatGroup_e1080p3d_30 ? "BVDB_InputFormatGroup_e1080p3d_30" : |
|---|
| 630 | eInputFormatGroup == BVDB_InputFormatGroup_e720p3d_60 ? "BVDB_InputFormatGroup_e720p3d_60" : |
|---|
| 631 | eInputFormatGroup == BVDB_InputFormatGroup_e720p3d_50 ? "BVDB_InputFormatGroup_e720p3d_50" : |
|---|
| 632 | "BVDB_InputFormatGroup_eInvalid" |
|---|
| 633 | ); |
|---|
| 634 | i++; |
|---|
| 635 | } |
|---|
| 636 | } |
|---|
| 637 | } |
|---|
| 638 | #endif /* BDBG_DEBUG_BUILD && BVDB_P_PRINT_SOURCE_MAPPING */ |
|---|
| 639 | |
|---|
| 640 | return BERR_TRACE( err ); |
|---|
| 641 | } |
|---|
| 642 | |
|---|
| 643 | |
|---|
| 644 | BERR_Code BVDB_DestroyVdb |
|---|
| 645 | ( BVDB_Handle hVdb ) |
|---|
| 646 | { |
|---|
| 647 | BVDB_P_Context *pVdb; |
|---|
| 648 | |
|---|
| 649 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 650 | |
|---|
| 651 | BKNI_Free(pVdb); |
|---|
| 652 | |
|---|
| 653 | return BERR_TRACE( BERR_SUCCESS ); |
|---|
| 654 | } |
|---|
| 655 | |
|---|
| 656 | |
|---|
| 657 | BERR_Code BVDB_PrintUsageMode |
|---|
| 658 | ( const BVDB_UsageMode *pstUsageMode ) |
|---|
| 659 | { |
|---|
| 660 | BERR_Code err = BERR_SUCCESS; |
|---|
| 661 | char acStr[BVDB_MAX_STRLEN+1]; |
|---|
| 662 | char acStr1[BVDB_MAX_STRLEN+1]; |
|---|
| 663 | char acStr2[BVDB_MAX_STRLEN+1]; |
|---|
| 664 | char acStrAux[BVDB_MAX_STRLEN]; |
|---|
| 665 | |
|---|
| 666 | BDBG_ASSERT(pstUsageMode); |
|---|
| 667 | |
|---|
| 668 | /* ID */ |
|---|
| 669 | BDBG_P_PrintString("\n* RTS Configuration %d, ver %d.%1d\n", |
|---|
| 670 | tvdb.ulConfigId, tvdb.ulVdbVer / 10, tvdb.ulVdbVer % 10); |
|---|
| 671 | |
|---|
| 672 | if (pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 673 | { |
|---|
| 674 | BDBG_P_PrintString("\tCurrent VDB ID: Same as Main Window\n"); |
|---|
| 675 | } |
|---|
| 676 | else |
|---|
| 677 | { |
|---|
| 678 | BDBG_P_PrintString("\tCurrent VDB ID: %d\n", pstUsageMode->usageId); |
|---|
| 679 | } |
|---|
| 680 | |
|---|
| 681 | /* Input format */ |
|---|
| 682 | BVDB_P_GetInputStr(pstUsageMode->eInput, acStr); |
|---|
| 683 | BVDB_P_GetInputFormatGroupStr(pstUsageMode->eInputFormatGroup, acStr1); |
|---|
| 684 | BDBG_P_PrintString("\tInput type: %s, format: %s%s\n", acStr, acStr1, |
|---|
| 685 | pstUsageMode->b3dDualPathProcessing ? " (3D Dual Path Processing)" : "" ); |
|---|
| 686 | |
|---|
| 687 | /* Display */ |
|---|
| 688 | BVDB_P_GetDisplayTypeStr(pstUsageMode->stDisplay.eType, acStr); |
|---|
| 689 | BVDB_P_GetOutputResolutionStr(pstUsageMode->stDisplay.eResolution, acStr1); |
|---|
| 690 | BVDB_P_GetAspectRatioStr(pstUsageMode->stDisplay.eAspectRatio, acStr2); |
|---|
| 691 | BDBG_P_PrintString("\tDisplay: %s, resolution: %s, aspect ratio: %s\n", acStr, acStr1, acStr2); |
|---|
| 692 | |
|---|
| 693 | /* Window */ |
|---|
| 694 | BVDB_P_GetWindowStr(pstUsageMode->eWindow, acStr); |
|---|
| 695 | BDBG_P_PrintString("\tWindow: %s\n", acStr); |
|---|
| 696 | |
|---|
| 697 | if (pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 698 | { |
|---|
| 699 | BDBG_P_PrintString("\tVideo Display Usage Mode: n/a\n"); |
|---|
| 700 | } |
|---|
| 701 | else |
|---|
| 702 | { |
|---|
| 703 | BDBG_P_PrintString("\tVideo Display Usage Mode: %s.%d\n", |
|---|
| 704 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Any ? "any" : |
|---|
| 705 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Full ? "full" : |
|---|
| 706 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Pig ? "pig" : |
|---|
| 707 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Mheg ? "mheg" : |
|---|
| 708 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Pbp ? "pbp/pip" : "unknown", |
|---|
| 709 | pstUsageMode->ulDisplayModeNum); |
|---|
| 710 | } |
|---|
| 711 | |
|---|
| 712 | /* OSD size */ |
|---|
| 713 | BVDB_P_GetOsdStr(pstUsageMode->stOsd.eOsd, acStr); |
|---|
| 714 | BDBG_P_PrintString("\tOSD: %s (reserved %d)\n", acStr, pstUsageMode->stOsd.ulReserved); |
|---|
| 715 | |
|---|
| 716 | /* 3D comb */ |
|---|
| 717 | BVDB_P_GetStateStr(pstUsageMode->e3dComb, acStr); |
|---|
| 718 | BDBG_P_PrintString("\t3D Comb: %s\n", acStr); |
|---|
| 719 | |
|---|
| 720 | /* oversample */ |
|---|
| 721 | BVDB_P_GetStateStr(pstUsageMode->eOversample, acStr); |
|---|
| 722 | BDBG_P_PrintString("\tOversample: %s\n", acStr); |
|---|
| 723 | |
|---|
| 724 | BVDB_P_GetStateStr(pstUsageMode->eDnr, acStr); |
|---|
| 725 | BVDB_P_GetPixelFormatStr(pstUsageMode->stAnr.ePixelFormat, pstUsageMode->stAnr.eState, acStr1); |
|---|
| 726 | BDBG_P_PrintString("\tDNR %s, ANR: %s (reserved %d)\n", acStr, acStr1, pstUsageMode->stAnr.ulReserved); |
|---|
| 727 | |
|---|
| 728 | /* CAP/VFD */ |
|---|
| 729 | BVDB_P_GetPixelFormatStr(pstUsageMode->stCapVfd.ePixelFormat, pstUsageMode->stCapVfd.eState, acStr); |
|---|
| 730 | BDBG_P_PrintString("\tCAP/VFD: %s (reserved %d)\n", acStr, pstUsageMode->stCapVfd.ulReserved); |
|---|
| 731 | |
|---|
| 732 | /* MAD */ |
|---|
| 733 | BVDB_P_GetPixelFormatStr(pstUsageMode->stMad.ePixelFormat, pstUsageMode->stMad.eState, acStr); |
|---|
| 734 | if (pstUsageMode->stMad.eState == BVDB_State_eYes) |
|---|
| 735 | { |
|---|
| 736 | |
|---|
| 737 | BVDB_P_GetFieldStoreCntStr(pstUsageMode->stMad.eFieldStore, acStrAux); |
|---|
| 738 | } |
|---|
| 739 | else |
|---|
| 740 | { |
|---|
| 741 | if (pstUsageMode->stMad.ePixelFormat == BVDB_PixelFmt_eInvalid) |
|---|
| 742 | BVDB_P_STRCPY(acStrAux, "n/a"); |
|---|
| 743 | else |
|---|
| 744 | BVDB_P_STRCPY(acStrAux, "no"); |
|---|
| 745 | } |
|---|
| 746 | BDBG_P_PrintString("\tMAD: %s\t%s (reserved %d)\n", acStr, acStrAux, pstUsageMode->stMad.ulReserved); |
|---|
| 747 | |
|---|
| 748 | /* SCL-CAP tolerance and bias */ |
|---|
| 749 | BVDB_P_GetSclCapBiasStr(pstUsageMode->eSclCapBias, acStr); |
|---|
| 750 | BDBG_P_PrintString("\tSCL-CAP tolerance: %d, bias: %s\n", pstUsageMode->ulSclCapTolerance, acStr); |
|---|
| 751 | |
|---|
| 752 | return BERR_TRACE(err); |
|---|
| 753 | } |
|---|
| 754 | |
|---|
| 755 | |
|---|
| 756 | BERR_Code BVDB_GetInputFormatGroup |
|---|
| 757 | ( const BVDB_Handle hVdb, |
|---|
| 758 | const uint32_t ulHeight, |
|---|
| 759 | const uint32_t ulWidth, |
|---|
| 760 | const uint32_t ulFrameRate, |
|---|
| 761 | const bool bProgressive, |
|---|
| 762 | const bool bJpeg, |
|---|
| 763 | const BVDB_Input eInput, |
|---|
| 764 | BVDB_InputFormatGroup *peInputFormatGroup ) |
|---|
| 765 | { |
|---|
| 766 | BERR_Code err = BERR_SUCCESS; |
|---|
| 767 | BVDB_P_Context *pVdb; |
|---|
| 768 | uint32_t ulTempHeight = ulHeight; |
|---|
| 769 | BVDB_InputFormatGroup eNonPcInputFormatGroup; |
|---|
| 770 | |
|---|
| 771 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 772 | |
|---|
| 773 | *peInputFormatGroup = BVDB_InputFormatGroup_eInvalid; |
|---|
| 774 | eNonPcInputFormatGroup = BVDB_InputFormatGroup_eInvalid; |
|---|
| 775 | |
|---|
| 776 | if (BVDB_Input_eMfd == eInput && !bJpeg) |
|---|
| 777 | { |
|---|
| 778 | uint32_t ulMfdHeight; |
|---|
| 779 | uint32_t ulMfdWidth; |
|---|
| 780 | uint32_t ulMfdFrameRate; |
|---|
| 781 | uint32_t i; |
|---|
| 782 | uint32_t numEntry; |
|---|
| 783 | |
|---|
| 784 | /* Limit max values to make sure all MFD formats fall under a |
|---|
| 785 | * predefined source format group */ |
|---|
| 786 | ulMfdHeight = BVDB_P_MIN(ulHeight, BFMT_1080I_HEIGHT); |
|---|
| 787 | ulMfdWidth = BVDB_P_MIN(ulWidth, BFMT_1080I_WIDTH); |
|---|
| 788 | ulMfdFrameRate = BVDB_P_MIN(ulFrameRate, 60000); |
|---|
| 789 | |
|---|
| 790 | numEntry = sizeof(stMfdFormats) / sizeof(BVDB_P_SourceFormat); |
|---|
| 791 | for (i = 0; i < numEntry; i++) |
|---|
| 792 | { |
|---|
| 793 | if ((ulMfdHeight <= stMfdFormats[i].height) && |
|---|
| 794 | (ulMfdWidth <= stMfdFormats[i].width) && |
|---|
| 795 | ((bProgressive && stMfdFormats[i].bProgressive) || |
|---|
| 796 | (!bProgressive && !stMfdFormats[i].bProgressive)) && |
|---|
| 797 | (ulMfdFrameRate <= stMfdFormats[i].frameRate)) |
|---|
| 798 | { |
|---|
| 799 | *peInputFormatGroup = stMfdFormats[i].eInputFormatGroup; |
|---|
| 800 | return BERR_TRACE(BERR_SUCCESS); |
|---|
| 801 | } |
|---|
| 802 | } |
|---|
| 803 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 804 | } |
|---|
| 805 | |
|---|
| 806 | if (bJpeg) |
|---|
| 807 | { |
|---|
| 808 | *peInputFormatGroup = (ulTempHeight <= BFMT_1080I_HEIGHT/2) ? |
|---|
| 809 | BVDB_InputFormatGroup_eJpeg_540 : BVDB_InputFormatGroup_eJpeg_1080; |
|---|
| 810 | } |
|---|
| 811 | else |
|---|
| 812 | { |
|---|
| 813 | /* Let's see if we have a match in the non-standard format list. This list |
|---|
| 814 | * grows on-demand basis. Note that frame rates are compared for a match |
|---|
| 815 | * using "range". In case we haven't found a match using the standard |
|---|
| 816 | * way, they we'll use this match if there's a match here */ |
|---|
| 817 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 818 | { |
|---|
| 819 | /* For non-PC formats */ |
|---|
| 820 | if (eInput != BVDB_Input_eVga) |
|---|
| 821 | { |
|---|
| 822 | uint32_t i; |
|---|
| 823 | uint32_t numEntry; |
|---|
| 824 | |
|---|
| 825 | numEntry = sizeof(stNonPcNonStandardFormats) / sizeof(BVDB_P_SourceFormat); |
|---|
| 826 | for (i = 0; i < numEntry; i++) |
|---|
| 827 | { |
|---|
| 828 | if ((ulHeight == stNonPcNonStandardFormats[i].height) && |
|---|
| 829 | (ulWidth == stNonPcNonStandardFormats[i].width) && |
|---|
| 830 | (bProgressive == stNonPcNonStandardFormats[i].bProgressive) && |
|---|
| 831 | (ulFrameRate <= stNonPcNonStandardFormats[i].frameRate)) |
|---|
| 832 | { |
|---|
| 833 | eNonPcInputFormatGroup = stNonPcNonStandardFormats[i].eInputFormatGroup; |
|---|
| 834 | |
|---|
| 835 | /* Now we have a match in the non-standard format array. |
|---|
| 836 | * If the matched format is a 3D source, return right |
|---|
| 837 | * away because the following search does not consider |
|---|
| 838 | * the 3D sources */ |
|---|
| 839 | if (stNonPcNonStandardFormats[i].b3dSource && |
|---|
| 840 | (eInput == BVDB_Input_eHdDvi)) |
|---|
| 841 | { |
|---|
| 842 | * peInputFormatGroup = eNonPcInputFormatGroup; |
|---|
| 843 | return BERR_TRACE(BERR_SUCCESS); |
|---|
| 844 | } |
|---|
| 845 | break; |
|---|
| 846 | } |
|---|
| 847 | } |
|---|
| 848 | } |
|---|
| 849 | } |
|---|
| 850 | |
|---|
| 851 | if (!bProgressive) |
|---|
| 852 | { |
|---|
| 853 | /* the only interlaced VESA format! */ |
|---|
| 854 | if ((ulWidth == 1024 && ulTempHeight == 768 && |
|---|
| 855 | (eInput == BVDB_Input_eVga || eInput == BVDB_Input_eHdDvi) && |
|---|
| 856 | ulFrameRate == 86958) && |
|---|
| 857 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 858 | { |
|---|
| 859 | *peInputFormatGroup = BVDB_InputFormatGroup_e1366_768_85_PC; |
|---|
| 860 | } |
|---|
| 861 | |
|---|
| 862 | if (((ulFrameRate >= 59940 && ulFrameRate <= 60000) || |
|---|
| 863 | (ulFrameRate >= 23976 && ulFrameRate <= 24000) || |
|---|
| 864 | (ulFrameRate >= 29970 && ulFrameRate <= 30000)) && |
|---|
| 865 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 866 | { |
|---|
| 867 | if (ulTempHeight <= BFMT_NTSC_HEIGHT) |
|---|
| 868 | { |
|---|
| 869 | if (ulWidth <= 544) |
|---|
| 870 | { |
|---|
| 871 | *peInputFormatGroup = BVDB_InputFormatGroup_e544_480i_60; |
|---|
| 872 | } |
|---|
| 873 | else if (ulWidth <= BFMT_NTSC_WIDTH) |
|---|
| 874 | { |
|---|
| 875 | *peInputFormatGroup = BVDB_InputFormatGroup_eNtsc; |
|---|
| 876 | } |
|---|
| 877 | } |
|---|
| 878 | |
|---|
| 879 | if (ulTempHeight <= BFMT_PAL_HEIGHT && ulWidth <= BFMT_PAL_WIDTH && |
|---|
| 880 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 881 | { |
|---|
| 882 | *peInputFormatGroup = BVDB_InputFormatGroup_ePal_60; |
|---|
| 883 | } |
|---|
| 884 | |
|---|
| 885 | if (ulTempHeight <= BFMT_1080I_HEIGHT && *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 886 | { |
|---|
| 887 | if (ulWidth <= 1440) |
|---|
| 888 | { |
|---|
| 889 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080i_60; |
|---|
| 890 | } |
|---|
| 891 | else if (ulWidth <= BFMT_1080I_WIDTH) |
|---|
| 892 | { |
|---|
| 893 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080i_60; |
|---|
| 894 | } |
|---|
| 895 | } |
|---|
| 896 | } |
|---|
| 897 | |
|---|
| 898 | if ((ulFrameRate == 50000 || ulFrameRate == 25000) && |
|---|
| 899 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 900 | { |
|---|
| 901 | if (ulTempHeight <= BFMT_PAL_HEIGHT) |
|---|
| 902 | { |
|---|
| 903 | if (ulWidth <= 544) |
|---|
| 904 | { |
|---|
| 905 | *peInputFormatGroup = BVDB_InputFormatGroup_e544_576i_50; |
|---|
| 906 | } |
|---|
| 907 | else if (ulWidth <= BFMT_PAL_WIDTH) |
|---|
| 908 | { |
|---|
| 909 | *peInputFormatGroup = BVDB_InputFormatGroup_ePal; |
|---|
| 910 | } |
|---|
| 911 | } |
|---|
| 912 | |
|---|
| 913 | if (ulTempHeight <= BFMT_1080I_HEIGHT && *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 914 | { |
|---|
| 915 | if (ulWidth <= 1440) |
|---|
| 916 | { |
|---|
| 917 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080i_50; |
|---|
| 918 | } |
|---|
| 919 | else if (ulWidth <= BFMT_1080I_WIDTH) |
|---|
| 920 | { |
|---|
| 921 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080i_50; |
|---|
| 922 | } |
|---|
| 923 | } |
|---|
| 924 | } |
|---|
| 925 | |
|---|
| 926 | /* In case there's no match, use the non standard match if any */ |
|---|
| 927 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 928 | { |
|---|
| 929 | *peInputFormatGroup = eNonPcInputFormatGroup; |
|---|
| 930 | } |
|---|
| 931 | } |
|---|
| 932 | else |
|---|
| 933 | { |
|---|
| 934 | if (ulFrameRate >= 59934 && ulFrameRate <= 60000 && |
|---|
| 935 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 936 | { |
|---|
| 937 | if (ulWidth <= BFMT_480P_WIDTH && ulTempHeight <= BFMT_480P_HEIGHT) |
|---|
| 938 | { |
|---|
| 939 | *peInputFormatGroup = BVDB_InputFormatGroup_e480p; |
|---|
| 940 | } |
|---|
| 941 | else if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 942 | { |
|---|
| 943 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_60; |
|---|
| 944 | } |
|---|
| 945 | else if (ulTempHeight == BFMT_1080P_HEIGHT && ulWidth == BFMT_1080P_WIDTH) |
|---|
| 946 | { |
|---|
| 947 | *peInputFormatGroup = (eInput != BVDB_Input_eVga) ? BVDB_InputFormatGroup_e1080p_60 : |
|---|
| 948 | BVDB_InputFormatGroup_e1920_1080_60_PC; |
|---|
| 949 | } |
|---|
| 950 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 951 | eInput == BVDB_Input_eMfd) |
|---|
| 952 | { |
|---|
| 953 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_30; |
|---|
| 954 | } |
|---|
| 955 | } |
|---|
| 956 | |
|---|
| 957 | if (ulFrameRate == 50000 && |
|---|
| 958 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 959 | { |
|---|
| 960 | if (ulWidth <= BFMT_576P_WIDTH && ulTempHeight <= BFMT_576P_HEIGHT) |
|---|
| 961 | { |
|---|
| 962 | *peInputFormatGroup = BVDB_InputFormatGroup_e576p; |
|---|
| 963 | } |
|---|
| 964 | else if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 965 | { |
|---|
| 966 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_50; |
|---|
| 967 | } |
|---|
| 968 | else if (ulTempHeight == BFMT_1080P_HEIGHT && ulWidth == BFMT_1080P_WIDTH) |
|---|
| 969 | { |
|---|
| 970 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080p_50; |
|---|
| 971 | } |
|---|
| 972 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 973 | eInput == BVDB_Input_eMfd) |
|---|
| 974 | { |
|---|
| 975 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_25; |
|---|
| 976 | } |
|---|
| 977 | } |
|---|
| 978 | |
|---|
| 979 | if ((ulFrameRate == 23976 || ulFrameRate == 24000) && |
|---|
| 980 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 981 | { |
|---|
| 982 | if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 983 | { |
|---|
| 984 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_24; |
|---|
| 985 | } |
|---|
| 986 | else if (ulTempHeight == BFMT_1080P_HEIGHT) |
|---|
| 987 | { |
|---|
| 988 | if (ulWidth == BFMT_1080P_WIDTH) |
|---|
| 989 | { |
|---|
| 990 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080p_24; |
|---|
| 991 | } |
|---|
| 992 | else if (ulWidth < BFMT_1080P_WIDTH) |
|---|
| 993 | { |
|---|
| 994 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_24; |
|---|
| 995 | } |
|---|
| 996 | } |
|---|
| 997 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 998 | eInput == BVDB_Input_eMfd) |
|---|
| 999 | { |
|---|
| 1000 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_24; |
|---|
| 1001 | } |
|---|
| 1002 | } |
|---|
| 1003 | |
|---|
| 1004 | if (ulFrameRate == 25000 && |
|---|
| 1005 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 1006 | { |
|---|
| 1007 | if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 1008 | { |
|---|
| 1009 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_25; |
|---|
| 1010 | } |
|---|
| 1011 | else if (ulTempHeight == BFMT_1080P_HEIGHT) |
|---|
| 1012 | { |
|---|
| 1013 | if (ulWidth == BFMT_1080P_WIDTH) |
|---|
| 1014 | { |
|---|
| 1015 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080p_25; |
|---|
| 1016 | } |
|---|
| 1017 | else if (ulWidth < BFMT_1080P_WIDTH) |
|---|
| 1018 | { |
|---|
| 1019 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_25; |
|---|
| 1020 | } |
|---|
| 1021 | } |
|---|
| 1022 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 1023 | eInput == BVDB_Input_eMfd) |
|---|
| 1024 | { |
|---|
| 1025 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_25; |
|---|
| 1026 | } |
|---|
| 1027 | } |
|---|
| 1028 | |
|---|
| 1029 | if ((ulFrameRate == 29970 || ulFrameRate == 30000) && |
|---|
| 1030 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 1031 | { |
|---|
| 1032 | if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 1033 | { |
|---|
| 1034 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_30; |
|---|
| 1035 | } |
|---|
| 1036 | else if (ulTempHeight == BFMT_1080P_HEIGHT) |
|---|
| 1037 | { |
|---|
| 1038 | if (ulWidth == BFMT_1080P_WIDTH) |
|---|
| 1039 | { |
|---|
| 1040 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080p_30; |
|---|
| 1041 | } |
|---|
| 1042 | else if (ulWidth < BFMT_1080P_WIDTH) |
|---|
| 1043 | { |
|---|
| 1044 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_30; |
|---|
| 1045 | } |
|---|
| 1046 | } |
|---|
| 1047 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 1048 | eInput == BVDB_Input_eMfd) |
|---|
| 1049 | { |
|---|
| 1050 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_30; |
|---|
| 1051 | } |
|---|
| 1052 | } |
|---|
| 1053 | |
|---|
| 1054 | /* In case there's no match, use the non standard match if any */ |
|---|
| 1055 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 1056 | { |
|---|
| 1057 | *peInputFormatGroup = eNonPcInputFormatGroup; |
|---|
| 1058 | } |
|---|
| 1059 | |
|---|
| 1060 | /* The purpose here is not to tell whether the input PC format is |
|---|
| 1061 | * supported or not. The purpose is to pick a PC group so a proper |
|---|
| 1062 | * RTS settings can be applied. Currently, RTS analysis |
|---|
| 1063 | * differentiates PC input whether its numbers of line are greater |
|---|
| 1064 | * than 700. We try to find the PC group more accurately, and if not |
|---|
| 1065 | * found, then the PC ground is picked based on number of lines. |
|---|
| 1066 | * There is not reason to block other modules by returning the |
|---|
| 1067 | * invalid format as long as the RTS settings cover it. */ |
|---|
| 1068 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 1069 | { |
|---|
| 1070 | if (ulFrameRate <= 60000 + ((60000 * 1)/10)/100) |
|---|
| 1071 | { |
|---|
| 1072 | if (ulWidth <= 1024 && ulTempHeight <= 768) |
|---|
| 1073 | { |
|---|
| 1074 | *peInputFormatGroup = BVDB_InputFormatGroup_e1024_768_60_PC; |
|---|
| 1075 | } |
|---|
| 1076 | else if (ulWidth <= 1366 && ulTempHeight <= 768) |
|---|
| 1077 | { |
|---|
| 1078 | *peInputFormatGroup = BVDB_InputFormatGroup_e1366_768_60_PC; |
|---|
| 1079 | } |
|---|
| 1080 | else if (ulWidth >= 1280 && ulTempHeight >= 960 && |
|---|
| 1081 | ulWidth <= 1400 && ulTempHeight <= 1050) |
|---|
| 1082 | { |
|---|
| 1083 | *peInputFormatGroup = BVDB_InputFormatGroup_e1400_1050_60_PC; |
|---|
| 1084 | } |
|---|
| 1085 | else if (ulWidth == 1920 && ulTempHeight == 1080) |
|---|
| 1086 | { |
|---|
| 1087 | *peInputFormatGroup = BVDB_InputFormatGroup_e1920_1080_60_PC; |
|---|
| 1088 | } |
|---|
| 1089 | else if (ulWidth == 1600 && ulTempHeight == 1200) |
|---|
| 1090 | { |
|---|
| 1091 | *peInputFormatGroup = BVDB_InputFormatGroup_e1600_1200_60_PC; |
|---|
| 1092 | } |
|---|
| 1093 | |
|---|
| 1094 | /* accurate search failed. Pick a group based on # of lines */ |
|---|
| 1095 | if (ulTempHeight <=768) |
|---|
| 1096 | { |
|---|
| 1097 | *peInputFormatGroup = BVDB_InputFormatGroup_e1024_768_60_PC; |
|---|
| 1098 | } |
|---|
| 1099 | else if (ulTempHeight <= 1050) |
|---|
| 1100 | { |
|---|
| 1101 | *peInputFormatGroup = BVDB_InputFormatGroup_e1400_1050_60_PC; |
|---|
| 1102 | } |
|---|
| 1103 | else if (ulTempHeight <= 1080) |
|---|
| 1104 | { |
|---|
| 1105 | *peInputFormatGroup = BVDB_InputFormatGroup_e1920_1080_60_PC; |
|---|
| 1106 | } |
|---|
| 1107 | else if (ulTempHeight <= 1200) |
|---|
| 1108 | { |
|---|
| 1109 | *peInputFormatGroup = BVDB_InputFormatGroup_e1600_1200_60_PC; |
|---|
| 1110 | } |
|---|
| 1111 | } |
|---|
| 1112 | else /* odd rates */ |
|---|
| 1113 | { |
|---|
| 1114 | if (ulWidth <= 1024 && ulTempHeight <= 768) |
|---|
| 1115 | { |
|---|
| 1116 | *peInputFormatGroup = BVDB_InputFormatGroup_e1024_768_85_PC; |
|---|
| 1117 | } |
|---|
| 1118 | else if (ulWidth <= 1366 && ulTempHeight <= 768) |
|---|
| 1119 | { |
|---|
| 1120 | *peInputFormatGroup = BVDB_InputFormatGroup_e1366_768_85_PC; |
|---|
| 1121 | } |
|---|
| 1122 | else if (ulWidth >= 1152 && ulTempHeight >= 864 && |
|---|
| 1123 | ulWidth <= 1400 && ulTempHeight <= 1050) |
|---|
| 1124 | { |
|---|
| 1125 | *peInputFormatGroup = BVDB_InputFormatGroup_e1400_1050_75_PC; |
|---|
| 1126 | } |
|---|
| 1127 | |
|---|
| 1128 | /* accurate search failed. Pick a group based on # of lines */ |
|---|
| 1129 | if (ulTempHeight <=768) |
|---|
| 1130 | { |
|---|
| 1131 | *peInputFormatGroup = BVDB_InputFormatGroup_e1366_768_85_PC; |
|---|
| 1132 | } |
|---|
| 1133 | else if (ulTempHeight <= 1050) |
|---|
| 1134 | { |
|---|
| 1135 | *peInputFormatGroup = BVDB_InputFormatGroup_e1400_1050_75_PC; |
|---|
| 1136 | } |
|---|
| 1137 | else |
|---|
| 1138 | { |
|---|
| 1139 | *peInputFormatGroup = BVDB_InputFormatGroup_e1920_1080_60_PC; |
|---|
| 1140 | } |
|---|
| 1141 | } |
|---|
| 1142 | } |
|---|
| 1143 | } |
|---|
| 1144 | } |
|---|
| 1145 | |
|---|
| 1146 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 1147 | err = BERR_NOT_SUPPORTED; |
|---|
| 1148 | |
|---|
| 1149 | return BERR_TRACE(err); |
|---|
| 1150 | } |
|---|
| 1151 | |
|---|
| 1152 | |
|---|
| 1153 | |
|---|
| 1154 | BERR_Code BVDB_GetVdbEntry |
|---|
| 1155 | ( BVDB_Handle hVdb, |
|---|
| 1156 | BVDB_UsageMode *pstUsageMode, |
|---|
| 1157 | BVDB_System_Configurations *pstSysConfig) |
|---|
| 1158 | { |
|---|
| 1159 | BERR_Code err = BERR_SUCCESS; |
|---|
| 1160 | BVDB_P_Context *pVdb; |
|---|
| 1161 | BVDB_SourceGroup mappedSource; |
|---|
| 1162 | BVDB_SourceGroup mainSourceToMatch; |
|---|
| 1163 | BVDB_SourceGroup subSourceToMatch; |
|---|
| 1164 | BVDB_P_RtsData tmpUsageMode; |
|---|
| 1165 | bool bMainDispModeMatch; |
|---|
| 1166 | bool bSubDispModeMatch; |
|---|
| 1167 | bool bSourceMapped = false; |
|---|
| 1168 | bool bDontCareMainWinClipSize; |
|---|
| 1169 | bool bDontCareSubWinClipSize; |
|---|
| 1170 | bool bDontCareMain; |
|---|
| 1171 | bool bDontCareSub; |
|---|
| 1172 | bool bMfdSource; |
|---|
| 1173 | bool bUsageModeMatchFound; |
|---|
| 1174 | uint32_t dispModeToMatch; |
|---|
| 1175 | uint32_t numEntry; |
|---|
| 1176 | BVDB_P_BvnTopology * pBvn; |
|---|
| 1177 | uint32_t i; |
|---|
| 1178 | uint32_t j; |
|---|
| 1179 | bool bDotByDot = false; |
|---|
| 1180 | |
|---|
| 1181 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 1182 | |
|---|
| 1183 | /* Now get the new source format from the mapping table */ |
|---|
| 1184 | bMfdSource = pstUsageMode->eInput == BVDB_Input_eMfd; |
|---|
| 1185 | |
|---|
| 1186 | numEntry = sizeof(stMapToNewSourceGroup) / sizeof(BVDB_P_MapToNewSourceGroup); |
|---|
| 1187 | for (i = 0; i < numEntry; i++) |
|---|
| 1188 | { |
|---|
| 1189 | if ((stMapToNewSourceGroup[i].oldFormat == pstUsageMode->eInputFormatGroup) && |
|---|
| 1190 | ((stMapToNewSourceGroup[i].bMfdSource && bMfdSource) || |
|---|
| 1191 | (!stMapToNewSourceGroup[i].bMfdSource && !bMfdSource))) |
|---|
| 1192 | { |
|---|
| 1193 | mappedSource = stMapToNewSourceGroup[i].newFormat; |
|---|
| 1194 | bSourceMapped = true; |
|---|
| 1195 | break; |
|---|
| 1196 | } |
|---|
| 1197 | } |
|---|
| 1198 | |
|---|
| 1199 | if (!bSourceMapped) |
|---|
| 1200 | { |
|---|
| 1201 | BDBG_ERR(("No new source format found!:")); |
|---|
| 1202 | BDBG_ERR(("MFD source = %s, Old Source Group = %d", bMfdSource, pstUsageMode->eInputFormatGroup)); |
|---|
| 1203 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1204 | } |
|---|
| 1205 | |
|---|
| 1206 | /* AVC 1080i is treated as 1080psf because from VDB point of view, there's |
|---|
| 1207 | * no way to differentiate them. So take the superset which is 1080psf */ |
|---|
| 1208 | if (mappedSource == BVDB_SourceGroup_Avc_e1080i) |
|---|
| 1209 | { |
|---|
| 1210 | BDBG_MSG(("AVC1080i is mapped to AVC1080psf")); |
|---|
| 1211 | mappedSource = BVDB_SourceGroup_Avc_e1080psf; |
|---|
| 1212 | } |
|---|
| 1213 | |
|---|
| 1214 | /* If a 3D dual path processing is active, 3D source names will be remapped |
|---|
| 1215 | * to find correct usage modes */ |
|---|
| 1216 | pstUsageMode->b3dDualPathProcessing = pstSysConfig->b3dDualPathProcessing; |
|---|
| 1217 | if (pstSysConfig->b3dDualPathProcessing) |
|---|
| 1218 | { |
|---|
| 1219 | switch (mappedSource) |
|---|
| 1220 | { |
|---|
| 1221 | case BVDB_SourceGroup_Rp_e720p3d: |
|---|
| 1222 | mappedSource = BVDB_SourceGroup_Rp_e720p3dDual; |
|---|
| 1223 | break; |
|---|
| 1224 | case BVDB_SourceGroup_Rp_e1080p3d: |
|---|
| 1225 | mappedSource = BVDB_SourceGroup_Rp_e1080p3dDual; |
|---|
| 1226 | break; |
|---|
| 1227 | case BVDB_SourceGroup_Rp_e1080i3d: |
|---|
| 1228 | mappedSource = BVDB_SourceGroup_Rp_e1080i3dDual; |
|---|
| 1229 | break; |
|---|
| 1230 | default: |
|---|
| 1231 | BDBG_ERR(("3D Dual Path Enabled, but the current source is not a 3D source (Source = 0x%x", mappedSource)); |
|---|
| 1232 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1233 | break; |
|---|
| 1234 | } |
|---|
| 1235 | } |
|---|
| 1236 | |
|---|
| 1237 | |
|---|
| 1238 | |
|---|
| 1239 | |
|---|
| 1240 | BDBG_MSG(("Mapped source = 0x%x for %s window", mappedSource, |
|---|
| 1241 | pstUsageMode->eWindow == BVDB_Window_eMain ? "Main": |
|---|
| 1242 | pstUsageMode->eWindow == BVDB_Window_ePip ? "Pip" : |
|---|
| 1243 | "Monitor")); |
|---|
| 1244 | |
|---|
| 1245 | bUsageModeMatchFound = false; |
|---|
| 1246 | |
|---|
| 1247 | /* Just to avoid build warning messages */ |
|---|
| 1248 | tmpUsageMode = tvdb.pUsageMode[0]; |
|---|
| 1249 | |
|---|
| 1250 | if (pstUsageMode->eWindow == BVDB_Window_eMain || |
|---|
| 1251 | pstUsageMode->eWindow == BVDB_Window_ePip) |
|---|
| 1252 | { |
|---|
| 1253 | /* find main match - group, win, clipping |
|---|
| 1254 | * then find the sub or vcr match - group, wind clipping |
|---|
| 1255 | * use that RTS. The only exception is adcCalibration. If source is |
|---|
| 1256 | * adc then find rp | pc in pip or vcr */ |
|---|
| 1257 | BDBG_MSG(("Window %s: Prev Main Source = 0x%x, Prev Sub Source = 0x%x, PIP visible = %s, 3D Dual Path =%d\n", |
|---|
| 1258 | pstUsageMode->eWindow == BVDB_Window_eMain ? "main" : "pip", |
|---|
| 1259 | tvdb.curUsageMode.main.sourceGroup, |
|---|
| 1260 | tvdb.curUsageMode.sub.sourceGroup, |
|---|
| 1261 | pstSysConfig->bPipVisible ? "Yes" : "No", |
|---|
| 1262 | pstSysConfig->b3dDualPathProcessing)); |
|---|
| 1263 | |
|---|
| 1264 | /* If PIP is not supported or no source connected to sub path, do not check sub source */ |
|---|
| 1265 | if (pstUsageMode->eWindow == BVDB_Window_eMain) |
|---|
| 1266 | { |
|---|
| 1267 | /* There are cases where PC sources are forced to be captured as 422 |
|---|
| 1268 | * and RP sources are forced to be captured as 444 */ |
|---|
| 1269 | if ((pstSysConfig->ePixelMode == BVDB_PixelMode_e444Forced) && |
|---|
| 1270 | (mappedSource & BVDB_SourceGroup_Rp)) |
|---|
| 1271 | { |
|---|
| 1272 | mappedSource = BVDB_SourceGroup_ePc; |
|---|
| 1273 | BDBG_MSG(("444 forced (RP source mapped PC)")); |
|---|
| 1274 | } |
|---|
| 1275 | else if ((pstSysConfig->ePixelMode == BVDB_PixelMode_e422Forced) && |
|---|
| 1276 | (mappedSource == BVDB_SourceGroup_ePc)) |
|---|
| 1277 | { |
|---|
| 1278 | mappedSource = BVDB_SourceGroup_Rp_e1080p; |
|---|
| 1279 | BDBG_MSG(("422 forced (PC source mapped 1080p RP)")); |
|---|
| 1280 | } |
|---|
| 1281 | |
|---|
| 1282 | bDontCareMain = false; |
|---|
| 1283 | bDontCareSub = !pstSysConfig->bPipVisible || |
|---|
| 1284 | !tvdb.bPipSupport || |
|---|
| 1285 | (tvdb.curUsageMode.sub.sourceGroup == BVDB_SourceGroup_None) || |
|---|
| 1286 | (pstSysConfig->b3dDualPathProcessing && (mappedSource & BVDB_SourceGroup_3dDual)) || |
|---|
| 1287 | (!pstSysConfig->b3dDualPathProcessing && (tvdb.curUsageMode.sub.sourceGroup & BVDB_SourceGroup_3dDual)); |
|---|
| 1288 | |
|---|
| 1289 | /* Do not check clipping and window size for ADC and JPEG */ |
|---|
| 1290 | bDontCareMainWinClipSize = (mappedSource == BVDB_SourceGroup_eJpeg) || |
|---|
| 1291 | (mappedSource == BVDB_SourceGroup_eAdcCalibration) || |
|---|
| 1292 | tvdb.main.bAutomaticAspectRatioBoxMode; |
|---|
| 1293 | bDontCareSubWinClipSize = bDontCareSub || |
|---|
| 1294 | (tvdb.curUsageMode.sub.sourceGroup == BVDB_SourceGroup_eJpeg) || |
|---|
| 1295 | (tvdb.curUsageMode.sub.sourceGroup == BVDB_SourceGroup_eAdcCalibration) || |
|---|
| 1296 | tvdb.sub.bAutomaticAspectRatioBoxMode; |
|---|
| 1297 | |
|---|
| 1298 | mainSourceToMatch = mappedSource; |
|---|
| 1299 | subSourceToMatch = tvdb.curUsageMode.sub.sourceGroup; |
|---|
| 1300 | } |
|---|
| 1301 | else |
|---|
| 1302 | { |
|---|
| 1303 | /* PIP source cannot be used if the current RTS config doesn't |
|---|
| 1304 | * support PIP and 3D dual processing */ |
|---|
| 1305 | if (!tvdb.bPipSupport && |
|---|
| 1306 | !(tvdb.b3dDualPathProcessingSupport && pstSysConfig->b3dDualPathProcessing && |
|---|
| 1307 | (mappedSource & BVDB_SourceGroup_3dDual))) |
|---|
| 1308 | { |
|---|
| 1309 | BDBG_ERR(("PIP is not supported in this configuration")); |
|---|
| 1310 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1311 | } |
|---|
| 1312 | |
|---|
| 1313 | bDontCareMain = (tvdb.curUsageMode.main.sourceGroup == BVDB_SourceGroup_None) || |
|---|
| 1314 | (!pstSysConfig->b3dDualPathProcessing && (tvdb.curUsageMode.main.sourceGroup & BVDB_SourceGroup_3dDual)) || |
|---|
| 1315 | (pstSysConfig->b3dDualPathProcessing && (mappedSource & BVDB_SourceGroup_3dDual)); |
|---|
| 1316 | bDontCareSub = false; |
|---|
| 1317 | |
|---|
| 1318 | /* Do not check clipping and window size for ADC and JPEG */ |
|---|
| 1319 | bDontCareSubWinClipSize = bDontCareMain || |
|---|
| 1320 | (mappedSource == BVDB_SourceGroup_eJpeg) || |
|---|
| 1321 | (mappedSource == BVDB_SourceGroup_eAdcCalibration) || |
|---|
| 1322 | tvdb.sub.bAutomaticAspectRatioBoxMode; |
|---|
| 1323 | bDontCareMainWinClipSize = (tvdb.curUsageMode.main.sourceGroup == BVDB_SourceGroup_eJpeg) || |
|---|
| 1324 | (tvdb.curUsageMode.main.sourceGroup == BVDB_SourceGroup_eAdcCalibration) || |
|---|
| 1325 | tvdb.main.bAutomaticAspectRatioBoxMode; |
|---|
| 1326 | |
|---|
| 1327 | mainSourceToMatch = tvdb.curUsageMode.main.sourceGroup; |
|---|
| 1328 | subSourceToMatch = mappedSource; |
|---|
| 1329 | } |
|---|
| 1330 | |
|---|
| 1331 | BDBG_MSG(("Don't care main = %d, Don't care main win/clip size = %d", |
|---|
| 1332 | bDontCareMain, bDontCareMainWinClipSize)); |
|---|
| 1333 | BDBG_MSG(("Don't care sub = %d, Don't care sub win/clip size = %d", |
|---|
| 1334 | bDontCareSub, bDontCareSubWinClipSize)); |
|---|
| 1335 | |
|---|
| 1336 | /* If it's not both vertically and horizontally full, do not use full mode */ |
|---|
| 1337 | if (((tvdb.main.winHeight != 100 && tvdb.main.winWidth != 100) || |
|---|
| 1338 | ((tvdb.main.winHeight != 100 || tvdb.main.winWidth != 100) && tvdb.main.bAutomaticAspectRatioBoxMode)) && |
|---|
| 1339 | !tvdb.main.bDotByDot && |
|---|
| 1340 | !pstSysConfig->b3dDualPathProcessing) |
|---|
| 1341 | { |
|---|
| 1342 | BDBG_MSG(("Pick one from non-full mode")); |
|---|
| 1343 | dispModeToMatch = ~BVDB_DisplayMode_Full; |
|---|
| 1344 | } |
|---|
| 1345 | else |
|---|
| 1346 | { |
|---|
| 1347 | dispModeToMatch = BVDB_DisplayMode_Any; |
|---|
| 1348 | } |
|---|
| 1349 | |
|---|
| 1350 | BDBG_ASSERT(tvdb.pUsageMode != NULL); |
|---|
| 1351 | |
|---|
| 1352 | for (j = 0; j < 2; j++) |
|---|
| 1353 | { |
|---|
| 1354 | for (i = 0; i < tvdb.usageModeNum; i++) |
|---|
| 1355 | { |
|---|
| 1356 | BDBG_MSG(("Checking ID = %d, Looking for matches for Main: 0x%x = 0x%x (dispMode), 0x%x = 0x%x (dispRes), 0x%x = 0x%x (main source), 0x%x = 0x%x (pip source)", |
|---|
| 1357 | tvdb.pUsageMode[i].id, |
|---|
| 1358 | tvdb.pUsageMode[i].eDisplayMode, dispModeToMatch, |
|---|
| 1359 | tvdb.pUsageMode[i].ulMainOutputResolution, pstUsageMode->stDisplay.eResolution, |
|---|
| 1360 | tvdb.pUsageMode[i].main.sourceGroup, mainSourceToMatch, |
|---|
| 1361 | tvdb.pUsageMode[i].sub.sourceGroup, subSourceToMatch)); |
|---|
| 1362 | |
|---|
| 1363 | if ((tvdb.pUsageMode[i].eDisplayMode & dispModeToMatch) && |
|---|
| 1364 | (tvdb.pUsageMode[i].ulMainOutputResolution & pstUsageMode->stDisplay.eResolution) && |
|---|
| 1365 | (bDontCareMain || (tvdb.pUsageMode[i].main.sourceGroup & mainSourceToMatch)) && |
|---|
| 1366 | (bDontCareSub || (tvdb.pUsageMode[i].sub.sourceGroup & subSourceToMatch))) |
|---|
| 1367 | { |
|---|
| 1368 | /* Now we have main and sub match. Then find the matching display |
|---|
| 1369 | * mode. */ |
|---|
| 1370 | bMainDispModeMatch = bDontCareMainWinClipSize || |
|---|
| 1371 | (bDotByDot && (tvdb.pUsageMode[i].eDisplayMode == BVDB_DisplayMode_Full)) || |
|---|
| 1372 | ((tvdb.main.winHeight + 1 >= (tvdb.pUsageMode[i].main.minWinHeight)) && |
|---|
| 1373 | (tvdb.main.winHeight <= (tvdb.pUsageMode[i].main.maxWinHeight + 1)) && |
|---|
| 1374 | (tvdb.main.winWidth + 1 >= (tvdb.pUsageMode[i].main.minWinWidth)) && |
|---|
| 1375 | (tvdb.main.winWidth <= (tvdb.pUsageMode[i].main.maxWinWidth + 1)) && |
|---|
| 1376 | (tvdb.main.clipHeight <= (tvdb.pUsageMode[i].main.maxClippingHeight + 1)) && |
|---|
| 1377 | (tvdb.main.clipWidth <= (tvdb.pUsageMode[i].main.maxClippingWidth + 1))); |
|---|
| 1378 | |
|---|
| 1379 | bSubDispModeMatch = bDontCareSubWinClipSize || |
|---|
| 1380 | ((tvdb.sub.winHeight + 1 >= (tvdb.pUsageMode[i].sub.minWinHeight)) && |
|---|
| 1381 | (tvdb.sub.winHeight <= (tvdb.pUsageMode[i].sub.maxWinHeight + 1)) && |
|---|
| 1382 | (tvdb.sub.winWidth + 1 >= (tvdb.pUsageMode[i].sub.minWinWidth)) && |
|---|
| 1383 | (tvdb.sub.winWidth <= (tvdb.pUsageMode[i].sub.maxWinWidth + 1)) && |
|---|
| 1384 | (tvdb.sub.clipHeight <= (tvdb.pUsageMode[i].sub.maxClippingHeight + 1)) && |
|---|
| 1385 | (tvdb.sub.clipWidth <= (tvdb.pUsageMode[i].sub.maxClippingWidth + 1))); |
|---|
| 1386 | |
|---|
| 1387 | BDBG_MSG(("ID (%d) for Main (DontCareMain = %d): Looking for \"%d>=%d(minH), %d<=%d(maxH), %d>=%d(minW), %d<=%d(maxW), %d<=%d(MaxClipH), %d<=%d(MaxClipW)\"", |
|---|
| 1388 | tvdb.pUsageMode[i].id, |
|---|
| 1389 | bDontCareMainWinClipSize, |
|---|
| 1390 | tvdb.main.winHeight , tvdb.pUsageMode[i].main.minWinHeight - 1, |
|---|
| 1391 | tvdb.main.winHeight , tvdb.pUsageMode[i].main.maxWinHeight + 1, |
|---|
| 1392 | tvdb.main.winWidth , tvdb.pUsageMode[i].main.minWinWidth - 1, |
|---|
| 1393 | tvdb.main.winWidth , tvdb.pUsageMode[i].main.maxWinWidth + 1, |
|---|
| 1394 | tvdb.main.clipHeight, tvdb.pUsageMode[i].main.maxClippingHeight + 1, |
|---|
| 1395 | tvdb.main.clipWidth , tvdb.pUsageMode[i].main.maxClippingWidth + 1)); |
|---|
| 1396 | |
|---|
| 1397 | BDBG_MSG(("ID (%d) for Sub (DontCareSub = %d): Looking for \"%d>=%d(minH), %d<=%d(maxH), %d>=%d(minW), %d<=%d(maxW), %d<=%d(MaxClipH), %d<=%d(MaxClipW)\"", |
|---|
| 1398 | tvdb.pUsageMode[i].id, |
|---|
| 1399 | bDontCareSubWinClipSize, |
|---|
| 1400 | tvdb.sub.winHeight , tvdb.pUsageMode[i].sub.minWinHeight - 1, |
|---|
| 1401 | tvdb.sub.winHeight , tvdb.pUsageMode[i].sub.maxWinHeight + 1, |
|---|
| 1402 | tvdb.sub.winWidth , tvdb.pUsageMode[i].sub.minWinWidth - 1, |
|---|
| 1403 | tvdb.sub.winWidth , tvdb.pUsageMode[i].sub.maxWinWidth + 1, |
|---|
| 1404 | tvdb.sub.clipHeight, tvdb.pUsageMode[i].sub.maxClippingHeight + 1, |
|---|
| 1405 | tvdb.sub.clipWidth , tvdb.pUsageMode[i].sub.maxClippingWidth + 1)); |
|---|
| 1406 | |
|---|
| 1407 | BDBG_MSG(("Main disp match = %d, Sub disp match =%d", bMainDispModeMatch, bSubDispModeMatch)); |
|---|
| 1408 | if (bMainDispModeMatch && bSubDispModeMatch) |
|---|
| 1409 | { |
|---|
| 1410 | /* If it's a first time match, or we have a previous match, but the new |
|---|
| 1411 | * match has a higher priority, then update the match */ |
|---|
| 1412 | if (!bUsageModeMatchFound || |
|---|
| 1413 | (bUsageModeMatchFound && (tmpUsageMode.priority > tvdb.pUsageMode[i].priority))) |
|---|
| 1414 | { |
|---|
| 1415 | /* Copy usage mode, but update source group with real ones */ |
|---|
| 1416 | tmpUsageMode = tvdb.pUsageMode[i]; |
|---|
| 1417 | |
|---|
| 1418 | BDBG_MSG(("ID \"%d\" is picked", tvdb.pUsageMode[i].id)); |
|---|
| 1419 | |
|---|
| 1420 | if (pstUsageMode->eWindow == BVDB_Window_eMain) |
|---|
| 1421 | { |
|---|
| 1422 | /* update main source */ |
|---|
| 1423 | tmpUsageMode.main.sourceGroup = mappedSource; |
|---|
| 1424 | |
|---|
| 1425 | /* and update sub source */ |
|---|
| 1426 | if (bDontCareSub) |
|---|
| 1427 | { |
|---|
| 1428 | tmpUsageMode.sub.sourceGroup = BVDB_SourceGroup_None; |
|---|
| 1429 | } |
|---|
| 1430 | else |
|---|
| 1431 | { |
|---|
| 1432 | tmpUsageMode.sub.sourceGroup = tvdb.curUsageMode.sub.sourceGroup; |
|---|
| 1433 | } |
|---|
| 1434 | } |
|---|
| 1435 | else |
|---|
| 1436 | { |
|---|
| 1437 | /* update sub source */ |
|---|
| 1438 | tmpUsageMode.sub.sourceGroup = mappedSource; |
|---|
| 1439 | if (bDontCareMain) |
|---|
| 1440 | { |
|---|
| 1441 | tmpUsageMode.main.sourceGroup = BVDB_SourceGroup_None; |
|---|
| 1442 | } |
|---|
| 1443 | else |
|---|
| 1444 | { |
|---|
| 1445 | tmpUsageMode.main.sourceGroup = tvdb.curUsageMode.main.sourceGroup; |
|---|
| 1446 | } |
|---|
| 1447 | } |
|---|
| 1448 | bUsageModeMatchFound = true; |
|---|
| 1449 | } |
|---|
| 1450 | } |
|---|
| 1451 | } |
|---|
| 1452 | } |
|---|
| 1453 | |
|---|
| 1454 | /* If a match found, immediately exit, and if dot by dot mode and a |
|---|
| 1455 | * match not found, try to use full mode because full is designed to |
|---|
| 1456 | * support dot by dot for another loop. Otherwise we fail to find a |
|---|
| 1457 | * match */ |
|---|
| 1458 | if (bUsageModeMatchFound) break; |
|---|
| 1459 | else if (tvdb.main.bDotByDot) bDotByDot = true; |
|---|
| 1460 | else break; |
|---|
| 1461 | } |
|---|
| 1462 | } |
|---|
| 1463 | else /* Monitor */ |
|---|
| 1464 | { |
|---|
| 1465 | /* Just find sub group match */ |
|---|
| 1466 | for (i = 0; i < tvdb.usageModeNum; i++) |
|---|
| 1467 | { |
|---|
| 1468 | BDBG_MSG(("Looking for matches for Sub: 0x%x = 0x%x (source)", |
|---|
| 1469 | tvdb.pUsageMode[i].sub.sourceGroup , mappedSource)); |
|---|
| 1470 | |
|---|
| 1471 | if (tvdb.pUsageMode[i].sub.sourceGroup & mappedSource) |
|---|
| 1472 | { |
|---|
| 1473 | bUsageModeMatchFound = true; |
|---|
| 1474 | tmpUsageMode = tvdb.pUsageMode[i]; |
|---|
| 1475 | |
|---|
| 1476 | /* Use RTS which belongs to main */ |
|---|
| 1477 | if (tvdb.curUsageMode.pRtsRegisterTable != NULL) |
|---|
| 1478 | { |
|---|
| 1479 | tmpUsageMode.pRtsRegisterTable = tvdb.curUsageMode.pRtsRegisterTable; |
|---|
| 1480 | } |
|---|
| 1481 | break; |
|---|
| 1482 | } |
|---|
| 1483 | } |
|---|
| 1484 | } |
|---|
| 1485 | |
|---|
| 1486 | if (!bUsageModeMatchFound) |
|---|
| 1487 | { |
|---|
| 1488 | BDBG_ERR(("VDB Can't find a match. Video will be muted")); |
|---|
| 1489 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1490 | } |
|---|
| 1491 | |
|---|
| 1492 | /* There's a matching usage mode. Now fill up the Usage Mode */ |
|---|
| 1493 | BDBG_MSG(("Matching VDB ID: %d", tmpUsageMode.id)); |
|---|
| 1494 | |
|---|
| 1495 | pstUsageMode->eDisplayMode = tmpUsageMode.eDisplayMode; |
|---|
| 1496 | pstUsageMode->ulDisplayModeNum = tmpUsageMode.ulDisplayModeNum; |
|---|
| 1497 | pstUsageMode->usageId = tmpUsageMode.id; |
|---|
| 1498 | |
|---|
| 1499 | if (pstUsageMode->eWindow == BVDB_Window_eMain) |
|---|
| 1500 | { |
|---|
| 1501 | pBvn = &tmpUsageMode.main; |
|---|
| 1502 | } |
|---|
| 1503 | else |
|---|
| 1504 | { |
|---|
| 1505 | pBvn = &tmpUsageMode.sub; |
|---|
| 1506 | } |
|---|
| 1507 | |
|---|
| 1508 | /* Fill in Usage Mode Structure so Nexus can populate relative parameters |
|---|
| 1509 | * to magnum */ |
|---|
| 1510 | |
|---|
| 1511 | /* Each RTS configuration has a different OSD size to support and it |
|---|
| 1512 | * should be from each configuration context */ |
|---|
| 1513 | pstUsageMode->stOsd.ulReserved = 0; |
|---|
| 1514 | if (pstUsageMode->eWindow == BVDB_Window_ePip || |
|---|
| 1515 | pstUsageMode->eWindow == BVDB_Window_eInvalid) |
|---|
| 1516 | { |
|---|
| 1517 | /* PIP has no OSD, and main OSD will cover it */ |
|---|
| 1518 | pstUsageMode->stOsd.eOsd = BVDB_Osd_eInvalid; |
|---|
| 1519 | } |
|---|
| 1520 | else if (pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 1521 | { |
|---|
| 1522 | pstUsageMode->stOsd.eOsd = tvdb.eVcrOsdResolution; |
|---|
| 1523 | } |
|---|
| 1524 | else |
|---|
| 1525 | { |
|---|
| 1526 | pstUsageMode->stOsd.eOsd = tvdb.eMainOsdResolution; |
|---|
| 1527 | } |
|---|
| 1528 | |
|---|
| 1529 | /* e3dComb for composite signal and eOverampling for main path only */ |
|---|
| 1530 | if (pstUsageMode->eInput == BVDB_Input_eCvbsSvidIfd) |
|---|
| 1531 | { |
|---|
| 1532 | pstUsageMode->e3dComb = pBvn->b3dcomb; |
|---|
| 1533 | if (pstUsageMode->eWindow == BVDB_Window_eMain) |
|---|
| 1534 | { |
|---|
| 1535 | pstUsageMode->eOversample = true; |
|---|
| 1536 | } |
|---|
| 1537 | else |
|---|
| 1538 | { |
|---|
| 1539 | pstUsageMode->eOversample = false; |
|---|
| 1540 | } |
|---|
| 1541 | } |
|---|
| 1542 | else |
|---|
| 1543 | { |
|---|
| 1544 | pstUsageMode->e3dComb = false; |
|---|
| 1545 | pstUsageMode->eOversample = false; |
|---|
| 1546 | } |
|---|
| 1547 | |
|---|
| 1548 | /* Set DNR based on the usage mode */ |
|---|
| 1549 | pstUsageMode->eDnr = pBvn->bdnr; |
|---|
| 1550 | |
|---|
| 1551 | /* ANR */ |
|---|
| 1552 | pstUsageMode->stAnr.eState = pBvn->banr; |
|---|
| 1553 | if (pBvn->banr) |
|---|
| 1554 | { |
|---|
| 1555 | pstUsageMode->stAnr.ePixelFormat = BVDB_PixelFmt_e10Bit422; |
|---|
| 1556 | pstUsageMode->stAnr.ulReserved = pBvn->mc; |
|---|
| 1557 | } |
|---|
| 1558 | else |
|---|
| 1559 | { |
|---|
| 1560 | pstUsageMode->stAnr.ePixelFormat = BVDB_PixelFmt_eInvalid; |
|---|
| 1561 | pstUsageMode->stAnr.ulReserved = 0; |
|---|
| 1562 | } |
|---|
| 1563 | |
|---|
| 1564 | /* CAP/VFD */ |
|---|
| 1565 | pstUsageMode->stCapVfd.eState = pBvn->bcap; |
|---|
| 1566 | if (pBvn->bcap) |
|---|
| 1567 | { |
|---|
| 1568 | pstUsageMode->stCapVfd.ulReserved = pBvn->c; |
|---|
| 1569 | |
|---|
| 1570 | if (pstSysConfig->bPanelReversed && !tvdb.bPanelReversalSupport) |
|---|
| 1571 | { |
|---|
| 1572 | BDBG_ERR(("Panel reversal is not supported in this configuration")); |
|---|
| 1573 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1574 | } |
|---|
| 1575 | |
|---|
| 1576 | if (!pstSysConfig->bPanelReversed && (pBvn->c > tvdb.panelReversalCompensation)) |
|---|
| 1577 | { |
|---|
| 1578 | pstUsageMode->stCapVfd.ulReserved -= tvdb.panelReversalCompensation; |
|---|
| 1579 | BDBG_MSG(("Panel Reversal Compensation: %d -> %d", |
|---|
| 1580 | pBvn->c, |
|---|
| 1581 | pstUsageMode->stCapVfd.ulReserved)); |
|---|
| 1582 | } |
|---|
| 1583 | |
|---|
| 1584 | if (pstUsageMode->eWindow == BVDB_Window_ePip || |
|---|
| 1585 | pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 1586 | { |
|---|
| 1587 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_e8Bit422; |
|---|
| 1588 | } |
|---|
| 1589 | else |
|---|
| 1590 | { |
|---|
| 1591 | if (mappedSource == BVDB_SourceGroup_ePc) |
|---|
| 1592 | { |
|---|
| 1593 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_e10Bit444; |
|---|
| 1594 | } |
|---|
| 1595 | else if (mappedSource & BVDB_SourceGroup_3dDual) |
|---|
| 1596 | { |
|---|
| 1597 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_e8Bit422; |
|---|
| 1598 | } |
|---|
| 1599 | else |
|---|
| 1600 | { |
|---|
| 1601 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_e10Bit422; |
|---|
| 1602 | } |
|---|
| 1603 | } |
|---|
| 1604 | } |
|---|
| 1605 | else |
|---|
| 1606 | { |
|---|
| 1607 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_eInvalid; |
|---|
| 1608 | pstUsageMode->stCapVfd.ulReserved = 0; |
|---|
| 1609 | } |
|---|
| 1610 | |
|---|
| 1611 | /* MAD - it actually refers to MCVP in 35230 */ |
|---|
| 1612 | pstUsageMode->stMad.eState = pBvn->bmad || pBvn->banr; |
|---|
| 1613 | if (pstUsageMode->stMad.eState) |
|---|
| 1614 | { |
|---|
| 1615 | pstUsageMode->stMad.eFieldStore = BVDB_FieldStore_e5Fields; |
|---|
| 1616 | pstUsageMode->stMad.ePixelFormat = BVDB_PixelFmt_e10Bit422; |
|---|
| 1617 | pstUsageMode->stMad.ulReserved = pBvn->mc; |
|---|
| 1618 | } |
|---|
| 1619 | else |
|---|
| 1620 | { |
|---|
| 1621 | pstUsageMode->stMad.eFieldStore = BVDB_FieldStore_eNotApplicable; |
|---|
| 1622 | pstUsageMode->stMad.ePixelFormat = BVDB_PixelFmt_eInvalid; |
|---|
| 1623 | pstUsageMode->stMad.ulReserved = 0; |
|---|
| 1624 | } |
|---|
| 1625 | |
|---|
| 1626 | /* PDP */ |
|---|
| 1627 | pstUsageMode->stPdp.eState = BVDB_State_eYes; |
|---|
| 1628 | pstUsageMode->stPdp.ulReserved = pBvn->dc; |
|---|
| 1629 | |
|---|
| 1630 | /* FRC */ |
|---|
| 1631 | pstUsageMode->stFrc.eState = pBvn->bfrc; |
|---|
| 1632 | pstUsageMode->stFrc.ulReserved = pBvn->frcc; |
|---|
| 1633 | |
|---|
| 1634 | /* CAP-SCL bias and orientation */ |
|---|
| 1635 | pstUsageMode->ulSclCapTolerance = pBvn->bias; |
|---|
| 1636 | pstUsageMode->eSclCapBias = pBvn->eSclCap; |
|---|
| 1637 | |
|---|
| 1638 | #if BVDB_P_SCL_CAP_WORKAOURND |
|---|
| 1639 | /* When there's no scaling, scl-cap orientation is meaningless, but there is |
|---|
| 1640 | * a line artifact on top if scl-cap is used if a source 1080p @ 50/60 RP */ |
|---|
| 1641 | if ((pstUsageMode->eWindow == BVDB_Window_eMain) && |
|---|
| 1642 | (mappedSource == BVDB_SourceGroup_Rp_e1080p) && |
|---|
| 1643 | tvdb.main.bDotByDot) |
|---|
| 1644 | { |
|---|
| 1645 | pstUsageMode->ulSclCapTolerance = BVDB_P_BIG_THRESHOLD; |
|---|
| 1646 | pstUsageMode->eSclCapBias = BVDB_SclCapBias_eCapScl; |
|---|
| 1647 | } |
|---|
| 1648 | #endif |
|---|
| 1649 | |
|---|
| 1650 | /* We are updating the current usage mode only when the path is main or |
|---|
| 1651 | * pip because monitor will depend on the main source anyway */ |
|---|
| 1652 | if (pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 1653 | { |
|---|
| 1654 | pstUsageMode->pRtsSet = NULL; |
|---|
| 1655 | } |
|---|
| 1656 | else |
|---|
| 1657 | { |
|---|
| 1658 | pstUsageMode->pRtsSet = tmpUsageMode.pRtsRegisterTable; |
|---|
| 1659 | tvdb.curUsageMode = tmpUsageMode; |
|---|
| 1660 | } |
|---|
| 1661 | /* End of filling in "Usage Mode" */ |
|---|
| 1662 | |
|---|
| 1663 | #if BVDB_P_FRC_PIXEL_PADDING_PDP_WORKAROUND |
|---|
| 1664 | /* Give CAP/VFD maximum bandwidth because there may be bandwidth starvation |
|---|
| 1665 | * in CAP/VFD due to the pixel padding */ |
|---|
| 1666 | if ((err == BERR_SUCCESS) && |
|---|
| 1667 | (pstUsageMode->pRtsSet != NULL) && |
|---|
| 1668 | (tvdb.ulConfigId != 100) && |
|---|
| 1669 | (tvdb.ulConfigId != 101)) |
|---|
| 1670 | { |
|---|
| 1671 | uint32_t i; |
|---|
| 1672 | uint32_t blockout; |
|---|
| 1673 | |
|---|
| 1674 | for (i = 0; i < pstUsageMode->pRtsSet->ulValidTableEntries; i++) |
|---|
| 1675 | { |
|---|
| 1676 | blockout = (pstUsageMode->pRtsSet->astRts[i].ulRegValue & ~0xff) >> 8; |
|---|
| 1677 | |
|---|
| 1678 | /* CAP/VFD Needs more bandwidth as much as 1080p to support pixel |
|---|
| 1679 | * padding */ |
|---|
| 1680 | if ((pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_BVN_CAP0) || |
|---|
| 1681 | (pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_BVN_VFD0)) |
|---|
| 1682 | { |
|---|
| 1683 | |
|---|
| 1684 | /* CAP 0 and VFD 0 */ |
|---|
| 1685 | if (blockout > 96) |
|---|
| 1686 | { |
|---|
| 1687 | pstUsageMode->pRtsSet->astRts[i].ulRegValue = |
|---|
| 1688 | (pstUsageMode->pRtsSet->astRts[i].ulRegValue & 0xff) | (96 << 8); |
|---|
| 1689 | } |
|---|
| 1690 | } |
|---|
| 1691 | |
|---|
| 1692 | /* AVFE_VDEC_MD_RD needs to be backward compatible to support A0/B0 */ |
|---|
| 1693 | if (pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_AVFE_VDEC_MD_RD) |
|---|
| 1694 | { |
|---|
| 1695 | pstUsageMode->pRtsSet->astRts[i].ulRegValue = |
|---|
| 1696 | (pstUsageMode->pRtsSet->astRts[i].ulRegValue & 0xff) | (0x358 << 8); |
|---|
| 1697 | } |
|---|
| 1698 | |
|---|
| 1699 | /* "Keep VDEC memory clients always given necessary bandwidth": There |
|---|
| 1700 | * are cases where 3D filter doesn't work well if there's a brief |
|---|
| 1701 | * bandwidth starvation in a initial time, and it doesn't recover. |
|---|
| 1702 | * To prevent this, VDEC memory clients are always given memory |
|---|
| 1703 | * bandwidth. And it doesn't affect system performance because they |
|---|
| 1704 | * won't access memory in off state even though memory bandwidth is |
|---|
| 1705 | * given. */ |
|---|
| 1706 | if (pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_AVFE_VDEC_MD_WR) |
|---|
| 1707 | { |
|---|
| 1708 | pstUsageMode->pRtsSet->astRts[i].ulRegValue = |
|---|
| 1709 | (pstUsageMode->pRtsSet->astRts[i].ulRegValue & 0xff) | (0x1abf << 8); |
|---|
| 1710 | } |
|---|
| 1711 | if (pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_AVFE_VDEC_VD_RD) |
|---|
| 1712 | { |
|---|
| 1713 | pstUsageMode->pRtsSet->astRts[i].ulRegValue = |
|---|
| 1714 | (pstUsageMode->pRtsSet->astRts[i].ulRegValue & 0xff) | (0xe2 << 8); |
|---|
| 1715 | } |
|---|
| 1716 | if (pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_AVFE_VDEC_VD_WR) |
|---|
| 1717 | { |
|---|
| 1718 | pstUsageMode->pRtsSet->astRts[i].ulRegValue = |
|---|
| 1719 | (pstUsageMode->pRtsSet->astRts[i].ulRegValue & 0xff) | (0x2a9 << 8); |
|---|
| 1720 | } |
|---|
| 1721 | /* End if "Keep VDEC memory clients always given necessary bandwidth" */ |
|---|
| 1722 | |
|---|
| 1723 | |
|---|
| 1724 | /* Enable round robin in XPT RD0/WR0 enough bandwidth to cover high |
|---|
| 1725 | * bitrate */ |
|---|
| 1726 | if ((pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_XPT_RD0) || |
|---|
| 1727 | (pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_XPT_WR0)) |
|---|
| 1728 | { |
|---|
| 1729 | pstUsageMode->pRtsSet->astRts[i].ulRegValue |= BVDB_P_CLIENT_INFO_RR_EN; |
|---|
| 1730 | } |
|---|
| 1731 | |
|---|
| 1732 | /* Enable round robin in PDP WR enough bandwidth to cover spike */ |
|---|
| 1733 | /* PDP WR 0 or 1 */ |
|---|
| 1734 | if ((pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_BVN_PDP_WR0) || |
|---|
| 1735 | (pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_BVN_PDP_WR1)) |
|---|
| 1736 | { |
|---|
| 1737 | pstUsageMode->pRtsSet->astRts[i].ulRegValue |= BVDB_P_CLIENT_INFO_RR_EN; |
|---|
| 1738 | } |
|---|
| 1739 | |
|---|
| 1740 | /* The code enables 120Hz display in PDP even in case that it's not |
|---|
| 1741 | * supported in RTS, which allows to use 120Hz panel with an RTS |
|---|
| 1742 | * configuration with 60Hz support for convenience. Note that |
|---|
| 1743 | * the operation is not guaranteed and it must be used for |
|---|
| 1744 | * development purpose only, and a 60Hz display must be used for |
|---|
| 1745 | * evaluation. */ |
|---|
| 1746 | #ifdef BVDB_P_PDP_120HZ_SUPPORT |
|---|
| 1747 | /* Enable round robin in PDP RD to support 120Hz if needed at app |
|---|
| 1748 | * own risk */ |
|---|
| 1749 | if ((pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_BVN_PDP_RD0) || |
|---|
| 1750 | (pstUsageMode->pRtsSet->astRts[i].ulId == BVDB_P_CLIENT_ID_BVN_PDP_RD1)) |
|---|
| 1751 | { |
|---|
| 1752 | pstUsageMode->pRtsSet->astRts[i].ulRegValue = 0x80; |
|---|
| 1753 | } |
|---|
| 1754 | #endif |
|---|
| 1755 | } |
|---|
| 1756 | |
|---|
| 1757 | /* Give enough bpp for slice mode */ |
|---|
| 1758 | if (tvdb.bFrcSupport && |
|---|
| 1759 | (pstUsageMode->stCapVfd.ulReserved < 30) && |
|---|
| 1760 | (pstUsageMode->stCapVfd.ulReserved != 0)) |
|---|
| 1761 | { |
|---|
| 1762 | pstUsageMode->stCapVfd.ulReserved = 30; |
|---|
| 1763 | } |
|---|
| 1764 | |
|---|
| 1765 | } |
|---|
| 1766 | #endif /* BVDB_P_FRC_PIXEL_PADDING_WORKAROUND */ |
|---|
| 1767 | |
|---|
| 1768 | return BERR_TRACE(err); |
|---|
| 1769 | } |
|---|
| 1770 | |
|---|
| 1771 | |
|---|
| 1772 | /* Configuration ID is passed from upper layer */ |
|---|
| 1773 | BERR_Code BVDB_ValidateConfigId |
|---|
| 1774 | ( BVDB_Handle hVdb, |
|---|
| 1775 | const uint32_t ulConfigId ) |
|---|
| 1776 | { |
|---|
| 1777 | BERR_Code err = BERR_SUCCESS; |
|---|
| 1778 | BVDB_P_Context *pVdb; |
|---|
| 1779 | uint32_t ulVer; |
|---|
| 1780 | |
|---|
| 1781 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 1782 | |
|---|
| 1783 | if (ulConfigId == 100 || ulConfigId == 101 || |
|---|
| 1784 | ulConfigId == 200 || ulConfigId == 201 || ulConfigId == 202 || |
|---|
| 1785 | ulConfigId == 203 || ulConfigId == 204 || ulConfigId == 205 || |
|---|
| 1786 | ulConfigId == 300 || ulConfigId == 301 || |
|---|
| 1787 | ulConfigId == 401 || ulConfigId == 402) |
|---|
| 1788 | { |
|---|
| 1789 | tvdb.ulConfigId = ulConfigId; |
|---|
| 1790 | err = BVDB_P_GetRtsData(ulConfigId, &tvdb.pUsageMode, &tvdb.usageModeNum); |
|---|
| 1791 | |
|---|
| 1792 | if (err != BERR_SUCCESS) |
|---|
| 1793 | { |
|---|
| 1794 | BDBG_ERR(("Can't find RTS configuration %d", ulConfigId)); |
|---|
| 1795 | return BERR_TRACE(err); |
|---|
| 1796 | } |
|---|
| 1797 | |
|---|
| 1798 | /* TODO: To be moved to config context */ |
|---|
| 1799 | switch (ulConfigId) |
|---|
| 1800 | { |
|---|
| 1801 | default: |
|---|
| 1802 | case 100: |
|---|
| 1803 | ulVer = BVDB_USAGE_MODE_VER_CFG100; |
|---|
| 1804 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1805 | tvdb.eVcrOsdResolution = BVDB_Osd_e576i_8bpp; |
|---|
| 1806 | tvdb.panelReversalCompensation = 0; |
|---|
| 1807 | tvdb.bPipSupport = true; |
|---|
| 1808 | tvdb.b3dDualPathProcessingSupport = true; |
|---|
| 1809 | tvdb.bMonitorSupport = true; |
|---|
| 1810 | tvdb.bFrcSupport = true; |
|---|
| 1811 | tvdb.bRtcSupport = true; |
|---|
| 1812 | tvdb.bPanelReversalSupport = true; |
|---|
| 1813 | tvdb.worstPdpBpp = 20; |
|---|
| 1814 | tvdb.maxPipWinHeight = 100; |
|---|
| 1815 | tvdb.maxPipWinWidth = 100; |
|---|
| 1816 | break; |
|---|
| 1817 | |
|---|
| 1818 | case 101: |
|---|
| 1819 | ulVer = BVDB_USAGE_MODE_VER_CFG101; |
|---|
| 1820 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1821 | tvdb.eVcrOsdResolution = BVDB_Osd_e576i_8bpp; |
|---|
| 1822 | tvdb.panelReversalCompensation = 0; |
|---|
| 1823 | tvdb.bPipSupport = true; |
|---|
| 1824 | tvdb.b3dDualPathProcessingSupport = true; |
|---|
| 1825 | tvdb.bMonitorSupport = true; |
|---|
| 1826 | tvdb.bFrcSupport = true; |
|---|
| 1827 | tvdb.bRtcSupport = true; |
|---|
| 1828 | tvdb.bPanelReversalSupport = true; |
|---|
| 1829 | tvdb.worstPdpBpp = 20; |
|---|
| 1830 | tvdb.maxPipWinHeight = 100; |
|---|
| 1831 | tvdb.maxPipWinWidth = 100; |
|---|
| 1832 | break; |
|---|
| 1833 | |
|---|
| 1834 | case 200: |
|---|
| 1835 | ulVer = BVDB_USAGE_MODE_VER_CFG200; |
|---|
| 1836 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1837 | tvdb.panelReversalCompensation = 0; |
|---|
| 1838 | tvdb.bPipSupport = false; |
|---|
| 1839 | tvdb.b3dDualPathProcessingSupport = true; |
|---|
| 1840 | tvdb.bMonitorSupport = true; |
|---|
| 1841 | tvdb.bFrcSupport = false; |
|---|
| 1842 | tvdb.bRtcSupport = false; |
|---|
| 1843 | tvdb.bPanelReversalSupport = true; |
|---|
| 1844 | tvdb.worstPdpBpp = 30; |
|---|
| 1845 | tvdb.maxPipWinHeight = 0; |
|---|
| 1846 | tvdb.maxPipWinWidth = 0; |
|---|
| 1847 | break; |
|---|
| 1848 | |
|---|
| 1849 | case 201: |
|---|
| 1850 | ulVer = BVDB_USAGE_MODE_VER_CFG201; |
|---|
| 1851 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1852 | tvdb.panelReversalCompensation = 0; |
|---|
| 1853 | tvdb.bPipSupport = false; |
|---|
| 1854 | tvdb.b3dDualPathProcessingSupport = false; |
|---|
| 1855 | tvdb.bMonitorSupport = true; |
|---|
| 1856 | tvdb.bFrcSupport = true; |
|---|
| 1857 | tvdb.bRtcSupport = false; |
|---|
| 1858 | tvdb.bPanelReversalSupport = true; |
|---|
| 1859 | tvdb.worstPdpBpp = 30; |
|---|
| 1860 | tvdb.maxPipWinHeight = 0; |
|---|
| 1861 | tvdb.maxPipWinWidth = 0; |
|---|
| 1862 | break; |
|---|
| 1863 | |
|---|
| 1864 | case 202: |
|---|
| 1865 | ulVer = BVDB_USAGE_MODE_VER_CFG202; |
|---|
| 1866 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1867 | tvdb.panelReversalCompensation = 0; |
|---|
| 1868 | tvdb.bPipSupport = false; |
|---|
| 1869 | tvdb.b3dDualPathProcessingSupport = true; |
|---|
| 1870 | tvdb.bMonitorSupport = false; |
|---|
| 1871 | tvdb.bFrcSupport = false; |
|---|
| 1872 | tvdb.bRtcSupport = false; |
|---|
| 1873 | tvdb.bPanelReversalSupport = false; |
|---|
| 1874 | tvdb.worstPdpBpp = 30; |
|---|
| 1875 | tvdb.maxPipWinHeight = 0; |
|---|
| 1876 | tvdb.maxPipWinWidth = 0; |
|---|
| 1877 | break; |
|---|
| 1878 | |
|---|
| 1879 | case 203: |
|---|
| 1880 | ulVer = BVDB_USAGE_MODE_VER_CFG203; |
|---|
| 1881 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1882 | tvdb.panelReversalCompensation = 0; |
|---|
| 1883 | tvdb.bPipSupport = false; |
|---|
| 1884 | tvdb.b3dDualPathProcessingSupport = true; |
|---|
| 1885 | tvdb.bMonitorSupport = true; |
|---|
| 1886 | tvdb.bFrcSupport = false; |
|---|
| 1887 | tvdb.bRtcSupport = true; |
|---|
| 1888 | tvdb.bPanelReversalSupport = true; |
|---|
| 1889 | tvdb.worstPdpBpp = 30; |
|---|
| 1890 | tvdb.maxPipWinHeight = 0; |
|---|
| 1891 | tvdb.maxPipWinWidth = 0; |
|---|
| 1892 | break; |
|---|
| 1893 | |
|---|
| 1894 | case 204: |
|---|
| 1895 | ulVer = BVDB_USAGE_MODE_VER_CFG204; |
|---|
| 1896 | tvdb.eMainOsdResolution = BVDB_Osd_e1280_800p_32bpp; |
|---|
| 1897 | tvdb.panelReversalCompensation = 0; |
|---|
| 1898 | tvdb.bPipSupport = false; |
|---|
| 1899 | tvdb.b3dDualPathProcessingSupport = false; |
|---|
| 1900 | tvdb.bMonitorSupport = true; |
|---|
| 1901 | tvdb.bFrcSupport = false; |
|---|
| 1902 | tvdb.bRtcSupport = true; |
|---|
| 1903 | tvdb.bPanelReversalSupport = false; |
|---|
| 1904 | tvdb.worstPdpBpp = 30; |
|---|
| 1905 | tvdb.maxPipWinHeight = 0; |
|---|
| 1906 | tvdb.maxPipWinWidth = 0; |
|---|
| 1907 | break; |
|---|
| 1908 | |
|---|
| 1909 | case 205: |
|---|
| 1910 | ulVer = BVDB_USAGE_MODE_VER_CFG205; |
|---|
| 1911 | tvdb.eMainOsdResolution = BVDB_Osd_e1366_768p_32bpp; |
|---|
| 1912 | tvdb.panelReversalCompensation = 0; |
|---|
| 1913 | tvdb.bPipSupport = true; |
|---|
| 1914 | tvdb.b3dDualPathProcessingSupport = false; |
|---|
| 1915 | tvdb.bMonitorSupport = false; |
|---|
| 1916 | tvdb.bFrcSupport = false; |
|---|
| 1917 | tvdb.bRtcSupport = true; |
|---|
| 1918 | tvdb.bPanelReversalSupport = true; |
|---|
| 1919 | tvdb.worstPdpBpp = 30; |
|---|
| 1920 | tvdb.maxPipWinHeight = 50; |
|---|
| 1921 | tvdb.maxPipWinWidth = 40; |
|---|
| 1922 | break; |
|---|
| 1923 | |
|---|
| 1924 | case 300: |
|---|
| 1925 | ulVer = BVDB_USAGE_MODE_VER_CFG300; |
|---|
| 1926 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_1080p_32bpp; |
|---|
| 1927 | tvdb.eVcrOsdResolution = BVDB_Osd_eNone; |
|---|
| 1928 | tvdb.panelReversalCompensation = 0; |
|---|
| 1929 | tvdb.bPipSupport = true; |
|---|
| 1930 | tvdb.b3dDualPathProcessingSupport = false; |
|---|
| 1931 | tvdb.bMonitorSupport = false; |
|---|
| 1932 | tvdb.bFrcSupport = false; |
|---|
| 1933 | tvdb.bRtcSupport = false; |
|---|
| 1934 | tvdb.bPanelReversalSupport = false; |
|---|
| 1935 | tvdb.worstPdpBpp = 30; |
|---|
| 1936 | tvdb.maxPipWinHeight = 83; |
|---|
| 1937 | tvdb.maxPipWinWidth = 46; |
|---|
| 1938 | break; |
|---|
| 1939 | |
|---|
| 1940 | case 301: |
|---|
| 1941 | ulVer = BVDB_USAGE_MODE_VER_CFG301; |
|---|
| 1942 | tvdb.eMainOsdResolution = BVDB_Osd_e1280_720p_32bpp, |
|---|
| 1943 | tvdb.eVcrOsdResolution = BVDB_Osd_eNone; |
|---|
| 1944 | tvdb.panelReversalCompensation = 0; |
|---|
| 1945 | tvdb.bPipSupport = true; |
|---|
| 1946 | tvdb.b3dDualPathProcessingSupport = false; |
|---|
| 1947 | tvdb.bMonitorSupport = false; |
|---|
| 1948 | tvdb.bFrcSupport = true; |
|---|
| 1949 | tvdb.bRtcSupport = false; |
|---|
| 1950 | tvdb.bPanelReversalSupport = false; |
|---|
| 1951 | tvdb.worstPdpBpp = 30; |
|---|
| 1952 | tvdb.maxPipWinHeight = 64; |
|---|
| 1953 | tvdb.maxPipWinWidth = 45; |
|---|
| 1954 | break; |
|---|
| 1955 | |
|---|
| 1956 | case 401: |
|---|
| 1957 | ulVer = BVDB_USAGE_MODE_VER_CFG401; |
|---|
| 1958 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1959 | tvdb.eVcrOsdResolution = BVDB_Osd_eNone; |
|---|
| 1960 | tvdb.panelReversalCompensation = 0; |
|---|
| 1961 | tvdb.bPipSupport = true; |
|---|
| 1962 | tvdb.b3dDualPathProcessingSupport = false; |
|---|
| 1963 | tvdb.bMonitorSupport = false; |
|---|
| 1964 | tvdb.bFrcSupport = true; |
|---|
| 1965 | tvdb.bRtcSupport = false; |
|---|
| 1966 | tvdb.bPanelReversalSupport = false; |
|---|
| 1967 | tvdb.worstPdpBpp = 30; |
|---|
| 1968 | tvdb.maxPipWinHeight = 50; |
|---|
| 1969 | tvdb.maxPipWinWidth = 50; |
|---|
| 1970 | break; |
|---|
| 1971 | |
|---|
| 1972 | case 402: |
|---|
| 1973 | ulVer = BVDB_USAGE_MODE_VER_CFG402; |
|---|
| 1974 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1975 | tvdb.eVcrOsdResolution = BVDB_Osd_eNone; |
|---|
| 1976 | tvdb.panelReversalCompensation = 0; |
|---|
| 1977 | tvdb.bPipSupport = true; |
|---|
| 1978 | tvdb.b3dDualPathProcessingSupport = false; |
|---|
| 1979 | tvdb.bMonitorSupport = false; |
|---|
| 1980 | tvdb.bFrcSupport = true; |
|---|
| 1981 | tvdb.bRtcSupport = true; |
|---|
| 1982 | tvdb.bPanelReversalSupport = true; |
|---|
| 1983 | tvdb.worstPdpBpp = 30; |
|---|
| 1984 | tvdb.maxPipWinHeight = 50; |
|---|
| 1985 | tvdb.maxPipWinWidth = 50; |
|---|
| 1986 | break; |
|---|
| 1987 | |
|---|
| 1988 | } |
|---|
| 1989 | tvdb.ulVdbVer = ulVer; |
|---|
| 1990 | |
|---|
| 1991 | return BERR_SUCCESS; |
|---|
| 1992 | } |
|---|
| 1993 | else |
|---|
| 1994 | { |
|---|
| 1995 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1996 | } |
|---|
| 1997 | } |
|---|
| 1998 | |
|---|
| 1999 | |
|---|
| 2000 | |
|---|
| 2001 | BERR_Code BVDB_GetFeatures |
|---|
| 2002 | ( BVDB_Handle hVdb, |
|---|
| 2003 | BVDB_Config_Features *pConfigFeatures) |
|---|
| 2004 | { |
|---|
| 2005 | BVDB_P_Context *pVdb; |
|---|
| 2006 | |
|---|
| 2007 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 2008 | |
|---|
| 2009 | if (tvdb.ulConfigId == 0) |
|---|
| 2010 | { |
|---|
| 2011 | BDBG_ERR(("RTS configuration is not set\n")); |
|---|
| 2012 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 2013 | } |
|---|
| 2014 | |
|---|
| 2015 | BDBG_ASSERT(pConfigFeatures); |
|---|
| 2016 | |
|---|
| 2017 | pConfigFeatures->bPipSupport = tvdb.bPipSupport; |
|---|
| 2018 | pConfigFeatures->bMonitorSupport = tvdb.bMonitorSupport; |
|---|
| 2019 | pConfigFeatures->bFrcSupport = tvdb.bFrcSupport; |
|---|
| 2020 | pConfigFeatures->bRtcSupport = tvdb.bRtcSupport; |
|---|
| 2021 | pConfigFeatures->bPanelReversalSupport = tvdb.bPanelReversalSupport; |
|---|
| 2022 | pConfigFeatures->worstPdpBpp = tvdb.worstPdpBpp; |
|---|
| 2023 | pConfigFeatures->maxPipWinHeight = tvdb.maxPipWinHeight; |
|---|
| 2024 | pConfigFeatures->maxPipWinWidth = tvdb.maxPipWinWidth; |
|---|
| 2025 | |
|---|
| 2026 | return BERR_SUCCESS; |
|---|
| 2027 | } |
|---|
| 2028 | |
|---|
| 2029 | |
|---|
| 2030 | BERR_Code BVDB_GetMemoryAllocation |
|---|
| 2031 | (const uint32_t ulConfigId, |
|---|
| 2032 | const BVDB_Window eWindow, |
|---|
| 2033 | const BVDB_Input eInput, |
|---|
| 2034 | BVDB_Heap_Settings *pstHeapSettings, |
|---|
| 2035 | uint32_t *pulHeapSize ) |
|---|
| 2036 | { |
|---|
| 2037 | BERR_Code err = BERR_SUCCESS; |
|---|
| 2038 | uint32_t i, j, k; |
|---|
| 2039 | bool bFound = false; |
|---|
| 2040 | uint32_t ulNumConfigs; |
|---|
| 2041 | BVDB_P_Config_MemAlloc *pstConfigMemAlloc; |
|---|
| 2042 | |
|---|
| 2043 | BDBG_ASSERT(pstHeapSettings); |
|---|
| 2044 | |
|---|
| 2045 | err = BVDB_P_GetNumConfigs(&ulNumConfigs); |
|---|
| 2046 | if (err != BERR_SUCCESS) |
|---|
| 2047 | { |
|---|
| 2048 | return BERR_TRACE(err); |
|---|
| 2049 | } |
|---|
| 2050 | |
|---|
| 2051 | pstConfigMemAlloc = (BVDB_P_Config_MemAlloc *)BKNI_Malloc(sizeof(BVDB_P_Config_MemAlloc) * ulNumConfigs * BVDB_P_NUM_WINDOW_HEAPS); |
|---|
| 2052 | if (pstConfigMemAlloc == NULL) |
|---|
| 2053 | { |
|---|
| 2054 | BDBG_ERR(("Out of memory.")); |
|---|
| 2055 | err = BERR_OUT_OF_SYSTEM_MEMORY; |
|---|
| 2056 | return BERR_TRACE(err); |
|---|
| 2057 | } |
|---|
| 2058 | |
|---|
| 2059 | err = BVDB_P_GetConfigMemAllocArray(pstConfigMemAlloc); |
|---|
| 2060 | if (err != BERR_SUCCESS) |
|---|
| 2061 | { |
|---|
| 2062 | BDBG_ERR(("Cannot get memory allocation array for the given RTS configuration")); |
|---|
| 2063 | goto BVDB_GetMemoryAllocationMemFreeExit; |
|---|
| 2064 | } |
|---|
| 2065 | |
|---|
| 2066 | /* Search for config */ |
|---|
| 2067 | for (k=0; k<ulNumConfigs; k++) |
|---|
| 2068 | { |
|---|
| 2069 | /* configuration ID starts at 1 */ |
|---|
| 2070 | if (ulConfigId == pstConfigMemAlloc[k * BVDB_P_NUM_WINDOW_HEAPS].ulConfigId) |
|---|
| 2071 | { |
|---|
| 2072 | bFound = true; |
|---|
| 2073 | break; |
|---|
| 2074 | } |
|---|
| 2075 | } |
|---|
| 2076 | |
|---|
| 2077 | if (bFound) |
|---|
| 2078 | { |
|---|
| 2079 | BDBG_MSG(("Found configuration %d", ulConfigId)); |
|---|
| 2080 | bFound = false; |
|---|
| 2081 | |
|---|
| 2082 | /* Search for window */ |
|---|
| 2083 | for (i=0; i<BVDB_P_NUM_WINDOW_HEAPS; i++) |
|---|
| 2084 | { |
|---|
| 2085 | if (eWindow == pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i].eWindow) |
|---|
| 2086 | { |
|---|
| 2087 | bFound = true; |
|---|
| 2088 | break; |
|---|
| 2089 | } |
|---|
| 2090 | } |
|---|
| 2091 | |
|---|
| 2092 | if (bFound) |
|---|
| 2093 | { |
|---|
| 2094 | if (eWindow == BVDB_Window_eMain) |
|---|
| 2095 | { |
|---|
| 2096 | BDBG_MSG(("Found MAIN window")); |
|---|
| 2097 | bFound = false; |
|---|
| 2098 | |
|---|
| 2099 | /* Search for input. Is it MPEG or no? */ |
|---|
| 2100 | for (j=0; j<2; j++) |
|---|
| 2101 | { |
|---|
| 2102 | BVDB_Input eLocalInput = eInput; |
|---|
| 2103 | |
|---|
| 2104 | if (eLocalInput == BVDB_Input_eInvalid) |
|---|
| 2105 | { |
|---|
| 2106 | err = BERR_INVALID_PARAMETER; |
|---|
| 2107 | BDBG_ERR(("Invalid input.")); |
|---|
| 2108 | goto BVDB_GetMemoryAllocationMemFreeExit; |
|---|
| 2109 | } |
|---|
| 2110 | else if (eLocalInput != BVDB_Input_eMfd) |
|---|
| 2111 | { |
|---|
| 2112 | /* Force all valid non-MPEG inputs to use VDEC */ |
|---|
| 2113 | eLocalInput = BVDB_Input_eComponent; |
|---|
| 2114 | BDBG_MSG(("Found non-MFD input")); |
|---|
| 2115 | } |
|---|
| 2116 | else |
|---|
| 2117 | { |
|---|
| 2118 | BDBG_MSG(("Found MFD input %d, %d", eLocalInput, j)); |
|---|
| 2119 | } |
|---|
| 2120 | |
|---|
| 2121 | if (eLocalInput == pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i + j].eInput) |
|---|
| 2122 | { |
|---|
| 2123 | *pstHeapSettings = pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i + j].stHeapSettings; |
|---|
| 2124 | *pulHeapSize = pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i + j].ulHeapSize; |
|---|
| 2125 | bFound = true; |
|---|
| 2126 | break; |
|---|
| 2127 | } |
|---|
| 2128 | } |
|---|
| 2129 | } |
|---|
| 2130 | else /* PIP or Monitor */ |
|---|
| 2131 | { |
|---|
| 2132 | *pstHeapSettings = pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i].stHeapSettings; |
|---|
| 2133 | *pulHeapSize = pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i].ulHeapSize; |
|---|
| 2134 | } |
|---|
| 2135 | } |
|---|
| 2136 | else |
|---|
| 2137 | { |
|---|
| 2138 | err = BERR_INVALID_PARAMETER; |
|---|
| 2139 | BDBG_ERR(("Invalid window.")); |
|---|
| 2140 | goto BVDB_GetMemoryAllocationMemFreeExit; |
|---|
| 2141 | } |
|---|
| 2142 | |
|---|
| 2143 | } |
|---|
| 2144 | else |
|---|
| 2145 | { |
|---|
| 2146 | err = BERR_INVALID_PARAMETER; |
|---|
| 2147 | BDBG_ERR(("Configuration %d not found.", ulConfigId)); |
|---|
| 2148 | goto BVDB_GetMemoryAllocationMemFreeExit; |
|---|
| 2149 | } |
|---|
| 2150 | |
|---|
| 2151 | |
|---|
| 2152 | BVDB_GetMemoryAllocationMemFreeExit: |
|---|
| 2153 | BKNI_Free(pstConfigMemAlloc); |
|---|
| 2154 | |
|---|
| 2155 | return BERR_TRACE(err); |
|---|
| 2156 | } |
|---|
| 2157 | |
|---|
| 2158 | BERR_Code BVDB_SetVideoDisplayMode |
|---|
| 2159 | ( BVDB_Handle hVdb, |
|---|
| 2160 | const BVDB_Display *pstDisplay, |
|---|
| 2161 | const BVDB_Window eWindow, |
|---|
| 2162 | const uint32_t ulSrcHeight, |
|---|
| 2163 | const uint32_t ulSrcWidth, |
|---|
| 2164 | const uint32_t ulSrcHeightClipAmount, |
|---|
| 2165 | const uint32_t ulSrcWidthClipAmount, |
|---|
| 2166 | const uint32_t ulDestHeight, |
|---|
| 2167 | const uint32_t ulDestWidth, |
|---|
| 2168 | const bool bAutomaticAspectRatioBoxMode) |
|---|
| 2169 | { |
|---|
| 2170 | BERR_Code err = BERR_SUCCESS; |
|---|
| 2171 | BVDB_P_Context *pVdb; |
|---|
| 2172 | uint32_t ulHeightClipAmount, ulWidthClipAmount; |
|---|
| 2173 | uint32_t ulDisplayHeight, ulDisplayWidth; |
|---|
| 2174 | |
|---|
| 2175 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 2176 | |
|---|
| 2177 | /* Get display panel info */ |
|---|
| 2178 | err = BVDB_P_GetDisplaySize(pstDisplay->eResolution, &ulDisplayHeight, &ulDisplayWidth); |
|---|
| 2179 | if (err != BERR_SUCCESS) |
|---|
| 2180 | { |
|---|
| 2181 | return BERR_TRACE(err); |
|---|
| 2182 | } |
|---|
| 2183 | |
|---|
| 2184 | /* Get clip amount percentage */ |
|---|
| 2185 | ulHeightClipAmount = (ulSrcHeightClipAmount * 100)/ulSrcHeight; |
|---|
| 2186 | ulWidthClipAmount = (ulSrcWidthClipAmount * 100)/ulSrcWidth; |
|---|
| 2187 | |
|---|
| 2188 | if (eWindow == BVDB_Window_eMain) |
|---|
| 2189 | { |
|---|
| 2190 | tvdb.main.bDotByDot = (ulSrcHeight == ulDestHeight) && (ulSrcWidth == ulDestWidth); |
|---|
| 2191 | tvdb.main.clipHeight = BVDB_P_MIN(ulHeightClipAmount, 100); |
|---|
| 2192 | tvdb.main.clipWidth = BVDB_P_MIN(ulWidthClipAmount, 100); |
|---|
| 2193 | tvdb.main.winHeight = BVDB_P_MIN((ulDestHeight * 100) / ulDisplayHeight, 100); |
|---|
| 2194 | tvdb.main.winWidth = BVDB_P_MIN((ulDestWidth * 100) / ulDisplayWidth, 100); |
|---|
| 2195 | tvdb.main.bAutomaticAspectRatioBoxMode = bAutomaticAspectRatioBoxMode; |
|---|
| 2196 | } |
|---|
| 2197 | else |
|---|
| 2198 | { |
|---|
| 2199 | tvdb.sub.bDotByDot = (ulSrcHeight == ulDestHeight) && (ulSrcWidth == ulDestWidth); |
|---|
| 2200 | tvdb.sub.clipHeight = BVDB_P_MIN(ulHeightClipAmount, 100); |
|---|
| 2201 | tvdb.sub.clipWidth = BVDB_P_MIN(ulWidthClipAmount, 100); |
|---|
| 2202 | tvdb.sub.winHeight = BVDB_P_MIN((ulDestHeight * 100) / ulDisplayHeight, 100); |
|---|
| 2203 | tvdb.sub.winWidth = BVDB_P_MIN((ulDestWidth * 100) / ulDisplayWidth, 100); |
|---|
| 2204 | tvdb.sub.bAutomaticAspectRatioBoxMode = bAutomaticAspectRatioBoxMode; |
|---|
| 2205 | } |
|---|
| 2206 | |
|---|
| 2207 | BDBG_MSG(("%s Window Info: disp size (%d, %d) source size (%d, %d), clip size (%d, %d), win size (%d, %d), with Box mode %s, Dot-by-Dot %s", |
|---|
| 2208 | eWindow == BVDB_Window_eMain ? "main" : |
|---|
| 2209 | eWindow == BVDB_Window_ePip ? "pip" : "monitor", |
|---|
| 2210 | ulDisplayWidth, |
|---|
| 2211 | ulDisplayHeight, |
|---|
| 2212 | ulSrcWidth, |
|---|
| 2213 | ulSrcHeight, |
|---|
| 2214 | ulSrcWidthClipAmount, |
|---|
| 2215 | ulSrcHeightClipAmount, |
|---|
| 2216 | ulDestWidth, |
|---|
| 2217 | ulDestHeight, |
|---|
| 2218 | bAutomaticAspectRatioBoxMode ? "On" : "Off", |
|---|
| 2219 | tvdb.main.bDotByDot ? "On" : "Off")); |
|---|
| 2220 | |
|---|
| 2221 | return BERR_TRACE(err); |
|---|
| 2222 | } |
|---|
| 2223 | |
|---|