| 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/9 $ |
|---|
| 12 | * $brcm_Date: 7/21/11 8:19p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/vdb/35125/C0/bvdb.c $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/9 7/21/11 8:19p yingh |
|---|
| 21 | * SWDTV-6459: removed enforcing Capture to 422 format |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/8 6/13/11 10:50a yingh |
|---|
| 24 | * SWDTV-6977: Set GFX plane to 1920x1080 for config402 |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/7 5/5/11 1:22p yingh |
|---|
| 27 | * SWDTV-6549: Added config401 with RTS supported |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/6 4/19/11 3:33p yingh |
|---|
| 30 | * SWDTV-2538: Added config400 with RTS supported |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/5 4/8/11 2:56p yingh |
|---|
| 33 | * SW35125-102: Added PDP buffer allocation flag |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/4 4/5/11 11:21a yingh |
|---|
| 36 | * SW35125-102: Added config402 with RTS supported |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/3 2/16/11 8:32p zhang |
|---|
| 39 | * SW35125-73: Use 10-bit 422 pixel format for CAP / VFD to workaround |
|---|
| 40 | * memory issues. |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/2 11/17/10 3:33p jerrylim |
|---|
| 43 | * SW35125-22: Removed all 35230 configs except config100 |
|---|
| 44 | * |
|---|
| 45 | * Hydra_Software_Devel/1 11/17/10 2:52p jerrylim |
|---|
| 46 | * SW35125-22: Added 35125 VDB files |
|---|
| 47 | * |
|---|
| 48 | ***************************************************************************/ |
|---|
| 49 | #include <stdio.h> |
|---|
| 50 | #include <stdlib.h> |
|---|
| 51 | #include <string.h> |
|---|
| 52 | #include "bstd.h" |
|---|
| 53 | #include "berr.h" |
|---|
| 54 | #include "bkni.h" |
|---|
| 55 | #include "bfmt.h" |
|---|
| 56 | #include "blst_circleq.h" |
|---|
| 57 | #include "bdbg.h" |
|---|
| 58 | |
|---|
| 59 | #include "bvdb.h" |
|---|
| 60 | #include "bvdb_priv.h" |
|---|
| 61 | |
|---|
| 62 | #include "bchp_memc_arb_0.h" |
|---|
| 63 | |
|---|
| 64 | BDBG_MODULE(BVDB); |
|---|
| 65 | |
|---|
| 66 | #define BVDB_P_FRC_PIXEL_PADDING_PDP_WORKAROUND 1 |
|---|
| 67 | |
|---|
| 68 | /* Giving 100 max will make first comparison to get passed, so each display mode |
|---|
| 69 | * will be free to pick up any clipping size in percentage */ |
|---|
| 70 | #define BVDB_P_MAX_SRC_CLIP_HEIGHT_AMOUNT 100 /* percent */ |
|---|
| 71 | #define BVDB_P_MAX_SRC_CLIP_WIDTH_AMOUNT 100 /* percent */ |
|---|
| 72 | |
|---|
| 73 | /* In case a matched input format is not found, then it tries search this table |
|---|
| 74 | * if there's any match. This table is a collection of formats which cannot be |
|---|
| 75 | * grouped using the standard decision making process. The input format group |
|---|
| 76 | * used in this table is based on the RTS analysis tool. Note that this table |
|---|
| 77 | * contains non-PC formats only |
|---|
| 78 | * |
|---|
| 79 | * ********** NOTE ********** |
|---|
| 80 | * Each group of sources must be in the order from low to high frame rate where |
|---|
| 81 | * a group means sources which have same width, height and progressiveness */ |
|---|
| 82 | static BVDB_P_SourceFormat stNonPcNonStandardFormats[] = |
|---|
| 83 | { |
|---|
| 84 | /* EIA/CEA-861-B (also in HDMI) 1440x480p without pixel repetition */ |
|---|
| 85 | {1440, 480, true, 60000, false, BVDB_InputFormatGroup_e720p_60}, |
|---|
| 86 | |
|---|
| 87 | /* HDMI1.4 3D Video VIC 32 */ |
|---|
| 88 | {1920, 2205, true, 23976, true, BVDB_InputFormatGroup_e1080p3d_24}, |
|---|
| 89 | {1920, 2205, true, 24000, true, BVDB_InputFormatGroup_e1080p3d_24}, |
|---|
| 90 | |
|---|
| 91 | /* HDMI1.4 3D Video VIC 34 */ |
|---|
| 92 | {1920, 2205, true, 30000, true, BVDB_InputFormatGroup_e1080p3d_30}, |
|---|
| 93 | |
|---|
| 94 | /* HDMI1.4 3D Video VIC 19 */ |
|---|
| 95 | {1280, 1470, true, 50000, true, BVDB_InputFormatGroup_e720p3d_50}, |
|---|
| 96 | |
|---|
| 97 | /* HDMI1.4 3D Video VIC 4 */ |
|---|
| 98 | {1280, 1470, true, 59940, true, BVDB_InputFormatGroup_e720p3d_60}, |
|---|
| 99 | {1280, 1470, true, 60000, true, BVDB_InputFormatGroup_e720p3d_60}, |
|---|
| 100 | |
|---|
| 101 | /* wireless 3D Video 2160i48 */ |
|---|
| 102 | {1920, 2160, false, 47952, true, BVDB_InputFormatGroup_e1080p3d_24}, |
|---|
| 103 | {1920, 2160, false, 48000, true, BVDB_InputFormatGroup_e1080p3d_24}, |
|---|
| 104 | }; |
|---|
| 105 | |
|---|
| 106 | static BVDB_P_SourceFormat stMfdFormats[] = |
|---|
| 107 | { |
|---|
| 108 | { 720, 576, false, 60000, false, BVDB_InputFormatGroup_ePal}, |
|---|
| 109 | { 720, 576, true, 60000, false, BVDB_InputFormatGroup_e576p}, |
|---|
| 110 | {1280, 720, true, 60000, false, BVDB_InputFormatGroup_e720p_60}, |
|---|
| 111 | {1920, 1080, false, 60000, false, BVDB_InputFormatGroup_e1080i_60}, |
|---|
| 112 | {1920, 1080, true, 30000, false, BVDB_InputFormatGroup_e1080p_30}, |
|---|
| 113 | {1920, 1080, true, 60000, false, BVDB_InputFormatGroup_e1080p_60}, |
|---|
| 114 | }; |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | /* This is an interim solution to map an old source format to a new source |
|---|
| 118 | * format */ |
|---|
| 119 | static BVDB_P_MapToNewSourceGroup stMapToNewSourceGroup[] = |
|---|
| 120 | { |
|---|
| 121 | {BVDB_InputFormatGroup_eNtsc, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 122 | {BVDB_InputFormatGroup_ePal, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 123 | {BVDB_InputFormatGroup_e480p, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 124 | {BVDB_InputFormatGroup_e576p, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 125 | {BVDB_InputFormatGroup_e720p_50, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 126 | {BVDB_InputFormatGroup_e720p_60, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 127 | {BVDB_InputFormatGroup_e1080i_50, false, BVDB_SourceGroup_Rp_e1080i}, |
|---|
| 128 | {BVDB_InputFormatGroup_e1080i_60, false, BVDB_SourceGroup_Rp_e1080i}, |
|---|
| 129 | {BVDB_InputFormatGroup_e1080p_24, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 130 | {BVDB_InputFormatGroup_e1080p_25, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 131 | {BVDB_InputFormatGroup_e1080p_30, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 132 | {BVDB_InputFormatGroup_e1080p_50, false, BVDB_SourceGroup_Rp_e1080p}, |
|---|
| 133 | {BVDB_InputFormatGroup_e1080p_60, false, BVDB_SourceGroup_Rp_e1080p}, |
|---|
| 134 | {BVDB_InputFormatGroup_ePal_60, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 135 | {BVDB_InputFormatGroup_e720p_24, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 136 | {BVDB_InputFormatGroup_e720p_25, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 137 | {BVDB_InputFormatGroup_e720p_30, false, BVDB_SourceGroup_Rp_e720p}, |
|---|
| 138 | {BVDB_InputFormatGroup_e544_576i_50, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 139 | {BVDB_InputFormatGroup_e1440_1080i_50, false, BVDB_SourceGroup_Rp_e1080i}, |
|---|
| 140 | {BVDB_InputFormatGroup_e1440_1080p_25, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 141 | {BVDB_InputFormatGroup_e544_480i_60, false, BVDB_SourceGroup_Rp_e576i}, |
|---|
| 142 | {BVDB_InputFormatGroup_e1440_1080i_60, false, BVDB_SourceGroup_Rp_e1080i}, |
|---|
| 143 | {BVDB_InputFormatGroup_e1440_1080p_30, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 144 | {BVDB_InputFormatGroup_e1440_1080p_24, false, BVDB_SourceGroup_Rp_e1080psf}, |
|---|
| 145 | {BVDB_InputFormatGroup_e1024_768_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 146 | {BVDB_InputFormatGroup_e1024_768_85_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 147 | {BVDB_InputFormatGroup_e1366_768_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 148 | {BVDB_InputFormatGroup_e1366_768_85_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 149 | {BVDB_InputFormatGroup_e1400_1050_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 150 | {BVDB_InputFormatGroup_e1400_1050_75_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 151 | {BVDB_InputFormatGroup_e1920_1080_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 152 | {BVDB_InputFormatGroup_e1600_1200_60_PC, false, BVDB_SourceGroup_ePc}, |
|---|
| 153 | {BVDB_InputFormatGroup_eAdcCalibration, false, BVDB_SourceGroup_eAdcCalibration}, |
|---|
| 154 | {BVDB_InputFormatGroup_eJpeg_540, false, BVDB_SourceGroup_eJpeg}, |
|---|
| 155 | {BVDB_InputFormatGroup_eJpeg_1080, false, BVDB_SourceGroup_eJpeg}, |
|---|
| 156 | {BVDB_InputFormatGroup_e1080p3d_24, false, BVDB_SourceGroup_Rp_e1080p3d}, |
|---|
| 157 | {BVDB_InputFormatGroup_e1080p3d_30, false, BVDB_SourceGroup_Rp_e1080p3d}, |
|---|
| 158 | {BVDB_InputFormatGroup_e720p3d_60, false, BVDB_SourceGroup_Rp_e720p3d}, |
|---|
| 159 | {BVDB_InputFormatGroup_e720p3d_50, false, BVDB_SourceGroup_Rp_e720p3d}, |
|---|
| 160 | |
|---|
| 161 | {BVDB_InputFormatGroup_eNtsc, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 162 | {BVDB_InputFormatGroup_ePal, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 163 | {BVDB_InputFormatGroup_e480p, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 164 | {BVDB_InputFormatGroup_e576p, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 165 | {BVDB_InputFormatGroup_e720p_50, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 166 | {BVDB_InputFormatGroup_e720p_60, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 167 | {BVDB_InputFormatGroup_e1080i_50, true, BVDB_SourceGroup_Avc_e1080i}, |
|---|
| 168 | {BVDB_InputFormatGroup_e1080i_60, true, BVDB_SourceGroup_Avc_e1080i}, |
|---|
| 169 | {BVDB_InputFormatGroup_e1080p_24, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 170 | {BVDB_InputFormatGroup_e1080p_25, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 171 | {BVDB_InputFormatGroup_e1080p_30, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 172 | {BVDB_InputFormatGroup_e1080p_50, true, BVDB_SourceGroup_Avc_e1080p}, |
|---|
| 173 | {BVDB_InputFormatGroup_e1080p_60, true, BVDB_SourceGroup_Avc_e1080p}, |
|---|
| 174 | {BVDB_InputFormatGroup_e1024_768_60_PC, true, BVDB_SourceGroup_Avc_e1080p}, |
|---|
| 175 | {BVDB_InputFormatGroup_e1024_768_85_PC, true, BVDB_SourceGroup_Avc_e1080p}, |
|---|
| 176 | {BVDB_InputFormatGroup_ePal_60, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 177 | {BVDB_InputFormatGroup_e720p_24, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 178 | {BVDB_InputFormatGroup_e720p_25, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 179 | {BVDB_InputFormatGroup_e720p_30, true, BVDB_SourceGroup_Avc_e720p}, |
|---|
| 180 | {BVDB_InputFormatGroup_e544_576i_50, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 181 | {BVDB_InputFormatGroup_e1440_1080i_50, true, BVDB_SourceGroup_Avc_e1080i}, |
|---|
| 182 | {BVDB_InputFormatGroup_e1440_1080p_25, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 183 | {BVDB_InputFormatGroup_e544_480i_60, true, BVDB_SourceGroup_Avc_e576i}, |
|---|
| 184 | {BVDB_InputFormatGroup_e1440_1080i_60, true, BVDB_SourceGroup_Avc_e1080i}, |
|---|
| 185 | {BVDB_InputFormatGroup_e1440_1080p_30, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 186 | {BVDB_InputFormatGroup_e1440_1080p_24, true, BVDB_SourceGroup_Avc_e1080psf}, |
|---|
| 187 | {BVDB_InputFormatGroup_eJpeg_540, true, BVDB_SourceGroup_eJpeg}, |
|---|
| 188 | {BVDB_InputFormatGroup_eJpeg_1080, true, BVDB_SourceGroup_eJpeg} |
|---|
| 189 | }; |
|---|
| 190 | |
|---|
| 191 | static BVDB_P_TContext tvdb; |
|---|
| 192 | |
|---|
| 193 | /* Public Functions */ |
|---|
| 194 | BERR_Code BVDB_CreateVdb |
|---|
| 195 | ( BVDB_Handle *phVdb, |
|---|
| 196 | uint32_t *pulEntries) |
|---|
| 197 | { |
|---|
| 198 | BERR_Code err = BERR_SUCCESS; |
|---|
| 199 | BVDB_P_Context *pVdb; |
|---|
| 200 | |
|---|
| 201 | pVdb = (BVDB_P_Context *)BKNI_Malloc(sizeof(BVDB_P_Context)); |
|---|
| 202 | if (pVdb == NULL) |
|---|
| 203 | { |
|---|
| 204 | BDBG_ERR(("Out of memory")); |
|---|
| 205 | return BERR_TRACE(BERR_OUT_OF_SYSTEM_MEMORY); |
|---|
| 206 | } |
|---|
| 207 | |
|---|
| 208 | *phVdb = (BVDB_Handle) pVdb; |
|---|
| 209 | *pulEntries = sizeof( BVDB_Handle ); |
|---|
| 210 | |
|---|
| 211 | tvdb.ulConfigId = 0; |
|---|
| 212 | |
|---|
| 213 | tvdb.main.clipHeight = 0; |
|---|
| 214 | tvdb.main.clipWidth = 0; |
|---|
| 215 | tvdb.main.winHeight = 100; |
|---|
| 216 | tvdb.main.winWidth = 100; |
|---|
| 217 | |
|---|
| 218 | tvdb.sub.clipHeight = 0; |
|---|
| 219 | tvdb.sub.clipWidth = 0; |
|---|
| 220 | tvdb.sub.winHeight = 100; |
|---|
| 221 | tvdb.sub.winWidth = 100; |
|---|
| 222 | |
|---|
| 223 | return BERR_TRACE( err ); |
|---|
| 224 | } |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | BERR_Code BVDB_DestroyVdb |
|---|
| 228 | ( BVDB_Handle hVdb ) |
|---|
| 229 | { |
|---|
| 230 | BVDB_P_Context *pVdb; |
|---|
| 231 | |
|---|
| 232 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 233 | |
|---|
| 234 | BKNI_Free(pVdb); |
|---|
| 235 | |
|---|
| 236 | return BERR_TRACE( BERR_SUCCESS ); |
|---|
| 237 | } |
|---|
| 238 | |
|---|
| 239 | |
|---|
| 240 | BERR_Code BVDB_PrintUsageMode |
|---|
| 241 | ( const BVDB_UsageMode *pstUsageMode ) |
|---|
| 242 | { |
|---|
| 243 | BERR_Code err = BERR_SUCCESS; |
|---|
| 244 | char acStr[BVDB_MAX_STRLEN+1]; |
|---|
| 245 | char acStr1[BVDB_MAX_STRLEN+1]; |
|---|
| 246 | char acStr2[BVDB_MAX_STRLEN+1]; |
|---|
| 247 | |
|---|
| 248 | BDBG_ASSERT(pstUsageMode); |
|---|
| 249 | |
|---|
| 250 | /* ID */ |
|---|
| 251 | BDBG_P_PrintString("\n* RTS Configuration %d, %s\n", tvdb.ulConfigId, tvdb.vdbVerString); |
|---|
| 252 | |
|---|
| 253 | if (pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 254 | { |
|---|
| 255 | BDBG_P_PrintString("\tCurrent VDB ID: Same as Main Window\n"); |
|---|
| 256 | } |
|---|
| 257 | else |
|---|
| 258 | { |
|---|
| 259 | BDBG_P_PrintString("\tCurrent VDB ID: %d\n", pstUsageMode->usageId); |
|---|
| 260 | } |
|---|
| 261 | |
|---|
| 262 | /* Input format */ |
|---|
| 263 | BVDB_P_GetInputStr(pstUsageMode->eInput, acStr); |
|---|
| 264 | BVDB_P_GetInputFormatGroupStr(pstUsageMode->eInputFormatGroup, acStr1); |
|---|
| 265 | BDBG_P_PrintString("\tInput type: %s, format: %s\n", acStr, acStr1); |
|---|
| 266 | |
|---|
| 267 | /* Display */ |
|---|
| 268 | BVDB_P_GetDisplayTypeStr(pstUsageMode->stDisplay.eType, acStr); |
|---|
| 269 | BVDB_P_GetOutputResolutionStr(pstUsageMode->stDisplay.eResolution, acStr1); |
|---|
| 270 | BVDB_P_GetAspectRatioStr(pstUsageMode->stDisplay.eAspectRatio, acStr2); |
|---|
| 271 | BDBG_P_PrintString("\tDisplay: %s, resolution: %s, aspect ratio: %s\n", acStr, acStr1, acStr2); |
|---|
| 272 | |
|---|
| 273 | /* Window */ |
|---|
| 274 | BVDB_P_GetWindowStr(pstUsageMode->eWindow, acStr); |
|---|
| 275 | BDBG_P_PrintString("\tWindow: %s\n", acStr); |
|---|
| 276 | |
|---|
| 277 | if (pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 278 | { |
|---|
| 279 | BDBG_P_PrintString("\tVideo Display Usage Mode: n/a\n"); |
|---|
| 280 | } |
|---|
| 281 | else |
|---|
| 282 | { |
|---|
| 283 | BDBG_P_PrintString("\tVideo Display Usage Mode: %s.%d\n", |
|---|
| 284 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Any ? "any" : |
|---|
| 285 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Full ? "full" : |
|---|
| 286 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Pig ? "pig" : |
|---|
| 287 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Mheg ? "mheg" : |
|---|
| 288 | pstUsageMode->eDisplayMode == BVDB_DisplayMode_Pbp ? "pbp/pip" : "unknown", |
|---|
| 289 | pstUsageMode->ulDisplayModeNum); |
|---|
| 290 | } |
|---|
| 291 | |
|---|
| 292 | /* OSD size */ |
|---|
| 293 | BVDB_P_GetOsdStr(pstUsageMode->stOsd.eOsd, acStr); |
|---|
| 294 | BDBG_P_PrintString("\tOSD: %s (reserved %d)\n", acStr, pstUsageMode->stOsd.ulReserved); |
|---|
| 295 | |
|---|
| 296 | /* 3D comb */ |
|---|
| 297 | BVDB_P_GetStateStr(pstUsageMode->e3dComb, acStr); |
|---|
| 298 | BDBG_P_PrintString("\t3D Comb: %s\n", acStr); |
|---|
| 299 | |
|---|
| 300 | /* oversample */ |
|---|
| 301 | BVDB_P_GetStateStr(pstUsageMode->eOversample, acStr); |
|---|
| 302 | BDBG_P_PrintString("\tOversample: %s\n", acStr); |
|---|
| 303 | |
|---|
| 304 | BVDB_P_GetStateStr(pstUsageMode->eDnr, acStr); |
|---|
| 305 | BVDB_P_GetPixelFormatStr(pstUsageMode->stAnr.ePixelFormat, pstUsageMode->stAnr.eState, acStr1); |
|---|
| 306 | BDBG_P_PrintString("\tDNR %s, ANR: %s (reserved %d)\n", acStr, acStr1, pstUsageMode->stAnr.ulReserved); |
|---|
| 307 | |
|---|
| 308 | /* CAP/VFD */ |
|---|
| 309 | BVDB_P_GetPixelFormatStr(pstUsageMode->stCapVfd.ePixelFormat, pstUsageMode->stCapVfd.eState, acStr); |
|---|
| 310 | BDBG_P_PrintString("\tCAP/VFD: %s (reserved %d)\n", acStr, pstUsageMode->stCapVfd.ulReserved); |
|---|
| 311 | |
|---|
| 312 | /* MAD */ |
|---|
| 313 | BVDB_P_GetPixelFormatStr(pstUsageMode->stMad.ePixelFormat, pstUsageMode->stMad.eState, acStr); |
|---|
| 314 | if (pstUsageMode->stMad.eState == BVDB_State_eYes) |
|---|
| 315 | { |
|---|
| 316 | char acTemp[BVDB_MAX_STRLEN]; |
|---|
| 317 | |
|---|
| 318 | BVDB_P_GetFieldStoreCntStr(pstUsageMode->stMad.eFieldStore, acTemp); |
|---|
| 319 | BVDB_P_STRCAT(acTemp, "\t"); |
|---|
| 320 | BVDB_P_STRCAT(acTemp, acStr); |
|---|
| 321 | BVDB_P_STRCPY(acStr, acTemp); |
|---|
| 322 | } |
|---|
| 323 | else |
|---|
| 324 | { |
|---|
| 325 | if (pstUsageMode->stMad.ePixelFormat == BVDB_PixelFmt_eInvalid) |
|---|
| 326 | BVDB_P_STRCAT(acStr, "\tn/a"); |
|---|
| 327 | else |
|---|
| 328 | BVDB_P_STRCPY(acStr, "\tno"); |
|---|
| 329 | } |
|---|
| 330 | BDBG_P_PrintString("\tMAD: %s (reserved %d)\n", acStr, pstUsageMode->stMad.ulReserved); |
|---|
| 331 | |
|---|
| 332 | /* SCL-CAP tolerance and bias */ |
|---|
| 333 | BVDB_P_GetSclCapBiasStr(pstUsageMode->eSclCapBias, acStr); |
|---|
| 334 | BDBG_P_PrintString("\tSCL-CAP tolerance: %d, bias: %s\n", pstUsageMode->ulSclCapTolerance, acStr); |
|---|
| 335 | |
|---|
| 336 | return BERR_TRACE(err); |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | |
|---|
| 340 | BERR_Code BVDB_GetInputFormatGroup |
|---|
| 341 | ( const BVDB_Handle hVdb, |
|---|
| 342 | const uint32_t ulHeight, |
|---|
| 343 | const uint32_t ulWidth, |
|---|
| 344 | const uint32_t ulFrameRate, |
|---|
| 345 | const bool bProgressive, |
|---|
| 346 | const bool bJpeg, |
|---|
| 347 | const BVDB_Input eInput, |
|---|
| 348 | BVDB_InputFormatGroup *peInputFormatGroup ) |
|---|
| 349 | { |
|---|
| 350 | BERR_Code err = BERR_SUCCESS; |
|---|
| 351 | BVDB_P_Context *pVdb; |
|---|
| 352 | uint32_t ulTempHeight = ulHeight; |
|---|
| 353 | BVDB_InputFormatGroup eNonPcInputFormatGroup; |
|---|
| 354 | |
|---|
| 355 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 356 | |
|---|
| 357 | *peInputFormatGroup = BVDB_InputFormatGroup_eInvalid; |
|---|
| 358 | eNonPcInputFormatGroup = BVDB_InputFormatGroup_eInvalid; |
|---|
| 359 | |
|---|
| 360 | if (BVDB_Input_eMfd == eInput && !bJpeg) |
|---|
| 361 | { |
|---|
| 362 | uint32_t ulMfdHeight; |
|---|
| 363 | uint32_t ulMfdWidth; |
|---|
| 364 | uint32_t ulMfdFrameRate; |
|---|
| 365 | uint32_t i; |
|---|
| 366 | uint32_t numEntry; |
|---|
| 367 | |
|---|
| 368 | /* Limit max values to make sure all MFD formats fall under a |
|---|
| 369 | * predefined source format group */ |
|---|
| 370 | ulMfdHeight = BVDB_P_MIN(ulHeight, BFMT_1080I_HEIGHT); |
|---|
| 371 | ulMfdWidth = BVDB_P_MIN(ulWidth, BFMT_1080I_WIDTH); |
|---|
| 372 | ulMfdFrameRate = BVDB_P_MIN(ulFrameRate, 60000); |
|---|
| 373 | |
|---|
| 374 | numEntry = sizeof(stMfdFormats) / sizeof(BVDB_P_SourceFormat); |
|---|
| 375 | for (i = 0; i < numEntry; i++) |
|---|
| 376 | { |
|---|
| 377 | if ((ulMfdHeight <= stMfdFormats[i].height) && |
|---|
| 378 | (ulMfdWidth <= stMfdFormats[i].width) && |
|---|
| 379 | ((bProgressive && stMfdFormats[i].bProgressive) || |
|---|
| 380 | (!bProgressive && !stMfdFormats[i].bProgressive)) && |
|---|
| 381 | (ulMfdFrameRate <= stMfdFormats[i].frameRate)) |
|---|
| 382 | { |
|---|
| 383 | *peInputFormatGroup = stMfdFormats[i].eInputFormatGroup; |
|---|
| 384 | return BERR_TRACE(BERR_SUCCESS); |
|---|
| 385 | } |
|---|
| 386 | } |
|---|
| 387 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 388 | } |
|---|
| 389 | |
|---|
| 390 | if (bJpeg) |
|---|
| 391 | { |
|---|
| 392 | *peInputFormatGroup = (ulTempHeight <= BFMT_1080I_HEIGHT/2) ? |
|---|
| 393 | BVDB_InputFormatGroup_eJpeg_540 : BVDB_InputFormatGroup_eJpeg_1080; |
|---|
| 394 | } |
|---|
| 395 | else |
|---|
| 396 | { |
|---|
| 397 | /* Let's see if we have a match in the non-standard format list. This list |
|---|
| 398 | * grows on-demand basis. Note that frame rates are compared for a match |
|---|
| 399 | * using "range". In case we haven't found a match using the standard |
|---|
| 400 | * way, they we'll use this match if there's a match here */ |
|---|
| 401 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 402 | { |
|---|
| 403 | /* For non-PC formats */ |
|---|
| 404 | if (eInput != BVDB_Input_eVga) |
|---|
| 405 | { |
|---|
| 406 | uint32_t i; |
|---|
| 407 | uint32_t numEntry; |
|---|
| 408 | |
|---|
| 409 | numEntry = sizeof(stNonPcNonStandardFormats) / sizeof(BVDB_P_SourceFormat); |
|---|
| 410 | for (i = 0; i < numEntry; i++) |
|---|
| 411 | { |
|---|
| 412 | if ((ulHeight == stNonPcNonStandardFormats[i].height) && |
|---|
| 413 | (ulWidth == stNonPcNonStandardFormats[i].width) && |
|---|
| 414 | (bProgressive == stNonPcNonStandardFormats[i].bProgressive) && |
|---|
| 415 | (ulFrameRate <= stNonPcNonStandardFormats[i].frameRate)) |
|---|
| 416 | { |
|---|
| 417 | eNonPcInputFormatGroup = stNonPcNonStandardFormats[i].eInputFormatGroup; |
|---|
| 418 | |
|---|
| 419 | /* Now we have a match in the non-standard format array. |
|---|
| 420 | * If the matched format is a 3D source, return right |
|---|
| 421 | * away because the following search does not consider |
|---|
| 422 | * the 3D sources */ |
|---|
| 423 | if (stNonPcNonStandardFormats[i].b3dSource && |
|---|
| 424 | (eInput == BVDB_Input_eHdDvi)) |
|---|
| 425 | { |
|---|
| 426 | * peInputFormatGroup = eNonPcInputFormatGroup; |
|---|
| 427 | return BERR_TRACE(BERR_SUCCESS); |
|---|
| 428 | } |
|---|
| 429 | break; |
|---|
| 430 | } |
|---|
| 431 | } |
|---|
| 432 | } |
|---|
| 433 | } |
|---|
| 434 | |
|---|
| 435 | if (!bProgressive) |
|---|
| 436 | { |
|---|
| 437 | /* the only interlaced VESA format! */ |
|---|
| 438 | if ((ulWidth == 1024 && ulTempHeight == 768 && |
|---|
| 439 | (eInput == BVDB_Input_eVga || eInput == BVDB_Input_eHdDvi) && |
|---|
| 440 | ulFrameRate == 86958) && |
|---|
| 441 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 442 | { |
|---|
| 443 | *peInputFormatGroup = BVDB_InputFormatGroup_e1366_768_85_PC; |
|---|
| 444 | } |
|---|
| 445 | |
|---|
| 446 | if (((ulFrameRate >= 59940 && ulFrameRate <= 60000) || |
|---|
| 447 | (ulFrameRate >= 23976 && ulFrameRate <= 24000) || |
|---|
| 448 | (ulFrameRate >= 29970 && ulFrameRate <= 30000)) && |
|---|
| 449 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 450 | { |
|---|
| 451 | if (ulTempHeight <= BFMT_NTSC_HEIGHT) |
|---|
| 452 | { |
|---|
| 453 | if (ulWidth <= 544) |
|---|
| 454 | { |
|---|
| 455 | *peInputFormatGroup = BVDB_InputFormatGroup_e544_480i_60; |
|---|
| 456 | } |
|---|
| 457 | else if (ulWidth <= BFMT_NTSC_WIDTH) |
|---|
| 458 | { |
|---|
| 459 | *peInputFormatGroup = BVDB_InputFormatGroup_eNtsc; |
|---|
| 460 | } |
|---|
| 461 | } |
|---|
| 462 | |
|---|
| 463 | if (ulTempHeight <= BFMT_PAL_HEIGHT && ulWidth <= BFMT_PAL_WIDTH && |
|---|
| 464 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 465 | { |
|---|
| 466 | *peInputFormatGroup = BVDB_InputFormatGroup_ePal_60; |
|---|
| 467 | } |
|---|
| 468 | |
|---|
| 469 | if (ulTempHeight <= BFMT_1080I_HEIGHT && *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 470 | { |
|---|
| 471 | if (ulWidth <= 1440) |
|---|
| 472 | { |
|---|
| 473 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080i_60; |
|---|
| 474 | } |
|---|
| 475 | else if (ulWidth <= BFMT_1080I_WIDTH) |
|---|
| 476 | { |
|---|
| 477 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080i_60; |
|---|
| 478 | } |
|---|
| 479 | } |
|---|
| 480 | } |
|---|
| 481 | |
|---|
| 482 | if ((ulFrameRate == 50000 || ulFrameRate == 25000) && |
|---|
| 483 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 484 | { |
|---|
| 485 | if (ulTempHeight <= BFMT_PAL_HEIGHT) |
|---|
| 486 | { |
|---|
| 487 | if (ulWidth <= 544) |
|---|
| 488 | { |
|---|
| 489 | *peInputFormatGroup = BVDB_InputFormatGroup_e544_576i_50; |
|---|
| 490 | } |
|---|
| 491 | else if (ulWidth <= BFMT_PAL_WIDTH) |
|---|
| 492 | { |
|---|
| 493 | *peInputFormatGroup = BVDB_InputFormatGroup_ePal; |
|---|
| 494 | } |
|---|
| 495 | } |
|---|
| 496 | |
|---|
| 497 | if (ulTempHeight <= BFMT_1080I_HEIGHT && *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 498 | { |
|---|
| 499 | if (ulWidth <= 1440) |
|---|
| 500 | { |
|---|
| 501 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080i_50; |
|---|
| 502 | } |
|---|
| 503 | else if (ulWidth <= BFMT_1080I_WIDTH) |
|---|
| 504 | { |
|---|
| 505 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080i_50; |
|---|
| 506 | } |
|---|
| 507 | } |
|---|
| 508 | } |
|---|
| 509 | |
|---|
| 510 | /* In case there's no match, use the non standard match if any */ |
|---|
| 511 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 512 | { |
|---|
| 513 | *peInputFormatGroup = eNonPcInputFormatGroup; |
|---|
| 514 | } |
|---|
| 515 | } |
|---|
| 516 | else |
|---|
| 517 | { |
|---|
| 518 | if (ulFrameRate >= 59934 && ulFrameRate <= 60000 && |
|---|
| 519 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 520 | { |
|---|
| 521 | if (ulWidth <= BFMT_480P_WIDTH && ulTempHeight <= BFMT_480P_HEIGHT) |
|---|
| 522 | { |
|---|
| 523 | *peInputFormatGroup = BVDB_InputFormatGroup_e480p; |
|---|
| 524 | } |
|---|
| 525 | else if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 526 | { |
|---|
| 527 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_60; |
|---|
| 528 | } |
|---|
| 529 | else if (ulTempHeight == BFMT_1080P_HEIGHT && ulWidth == BFMT_1080P_WIDTH) |
|---|
| 530 | { |
|---|
| 531 | *peInputFormatGroup = (eInput != BVDB_Input_eVga) ? BVDB_InputFormatGroup_e1080p_60 : |
|---|
| 532 | BVDB_InputFormatGroup_e1920_1080_60_PC; |
|---|
| 533 | } |
|---|
| 534 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 535 | eInput == BVDB_Input_eMfd) |
|---|
| 536 | { |
|---|
| 537 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_30; |
|---|
| 538 | } |
|---|
| 539 | } |
|---|
| 540 | |
|---|
| 541 | if (ulFrameRate == 50000 && |
|---|
| 542 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 543 | { |
|---|
| 544 | if (ulWidth <= BFMT_576P_WIDTH && ulTempHeight <= BFMT_576P_HEIGHT) |
|---|
| 545 | { |
|---|
| 546 | *peInputFormatGroup = BVDB_InputFormatGroup_e576p; |
|---|
| 547 | } |
|---|
| 548 | else if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 549 | { |
|---|
| 550 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_50; |
|---|
| 551 | } |
|---|
| 552 | else if (ulTempHeight == BFMT_1080P_HEIGHT && ulWidth == BFMT_1080P_WIDTH) |
|---|
| 553 | { |
|---|
| 554 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080p_50; |
|---|
| 555 | } |
|---|
| 556 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 557 | eInput == BVDB_Input_eMfd) |
|---|
| 558 | { |
|---|
| 559 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_25; |
|---|
| 560 | } |
|---|
| 561 | } |
|---|
| 562 | |
|---|
| 563 | if ((ulFrameRate == 23976 || ulFrameRate == 24000) && |
|---|
| 564 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 565 | { |
|---|
| 566 | if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 567 | { |
|---|
| 568 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_24; |
|---|
| 569 | } |
|---|
| 570 | else if (ulTempHeight == BFMT_1080P_HEIGHT) |
|---|
| 571 | { |
|---|
| 572 | if (ulWidth == BFMT_1080P_WIDTH) |
|---|
| 573 | { |
|---|
| 574 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080p_24; |
|---|
| 575 | } |
|---|
| 576 | else if (ulWidth < BFMT_1080P_WIDTH) |
|---|
| 577 | { |
|---|
| 578 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_24; |
|---|
| 579 | } |
|---|
| 580 | } |
|---|
| 581 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 582 | eInput == BVDB_Input_eMfd) |
|---|
| 583 | { |
|---|
| 584 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_24; |
|---|
| 585 | } |
|---|
| 586 | } |
|---|
| 587 | |
|---|
| 588 | if (ulFrameRate == 25000 && |
|---|
| 589 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 590 | { |
|---|
| 591 | if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 592 | { |
|---|
| 593 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_25; |
|---|
| 594 | } |
|---|
| 595 | else if (ulTempHeight == BFMT_1080P_HEIGHT) |
|---|
| 596 | { |
|---|
| 597 | if (ulWidth == BFMT_1080P_WIDTH) |
|---|
| 598 | { |
|---|
| 599 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080p_25; |
|---|
| 600 | } |
|---|
| 601 | else if (ulWidth < BFMT_1080P_WIDTH) |
|---|
| 602 | { |
|---|
| 603 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_25; |
|---|
| 604 | } |
|---|
| 605 | } |
|---|
| 606 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 607 | eInput == BVDB_Input_eMfd) |
|---|
| 608 | { |
|---|
| 609 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_25; |
|---|
| 610 | } |
|---|
| 611 | } |
|---|
| 612 | |
|---|
| 613 | if ((ulFrameRate == 29970 || ulFrameRate == 30000) && |
|---|
| 614 | *peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 615 | { |
|---|
| 616 | if (ulWidth <= BFMT_720P_WIDTH && ulTempHeight <= BFMT_720P_HEIGHT) |
|---|
| 617 | { |
|---|
| 618 | *peInputFormatGroup = BVDB_InputFormatGroup_e720p_30; |
|---|
| 619 | } |
|---|
| 620 | else if (ulTempHeight == BFMT_1080P_HEIGHT) |
|---|
| 621 | { |
|---|
| 622 | if (ulWidth == BFMT_1080P_WIDTH) |
|---|
| 623 | { |
|---|
| 624 | *peInputFormatGroup = BVDB_InputFormatGroup_e1080p_30; |
|---|
| 625 | } |
|---|
| 626 | else if (ulWidth < BFMT_1080P_WIDTH) |
|---|
| 627 | { |
|---|
| 628 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_30; |
|---|
| 629 | } |
|---|
| 630 | } |
|---|
| 631 | else if (ulTempHeight <= BFMT_1080P_HEIGHT && ulWidth < BFMT_1080P_WIDTH && |
|---|
| 632 | eInput == BVDB_Input_eMfd) |
|---|
| 633 | { |
|---|
| 634 | *peInputFormatGroup = BVDB_InputFormatGroup_e1440_1080p_30; |
|---|
| 635 | } |
|---|
| 636 | } |
|---|
| 637 | |
|---|
| 638 | /* In case there's no match, use the non standard match if any */ |
|---|
| 639 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 640 | { |
|---|
| 641 | *peInputFormatGroup = eNonPcInputFormatGroup; |
|---|
| 642 | } |
|---|
| 643 | |
|---|
| 644 | /* The purpose here is not to tell whether the input PC format is |
|---|
| 645 | * supported or not. The purpose is to pick a PC group so a proper |
|---|
| 646 | * RTS settings can be applied. Currently, RTS analysis |
|---|
| 647 | * differentiates PC input whether its numbers of line are greater |
|---|
| 648 | * than 700. We try to find the PC group more accurately, and if not |
|---|
| 649 | * found, then the PC ground is picked based on number of lines. |
|---|
| 650 | * There is not reason to block other modules by returning the |
|---|
| 651 | * invalid format as long as the RTS settings cover it. */ |
|---|
| 652 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 653 | { |
|---|
| 654 | if (ulFrameRate <= 60000 + ((60000 * 1)/10)/100) |
|---|
| 655 | { |
|---|
| 656 | if (ulWidth <= 1024 && ulTempHeight <= 768) |
|---|
| 657 | { |
|---|
| 658 | *peInputFormatGroup = BVDB_InputFormatGroup_e1024_768_60_PC; |
|---|
| 659 | } |
|---|
| 660 | else if (ulWidth <= 1366 && ulTempHeight <= 768) |
|---|
| 661 | { |
|---|
| 662 | *peInputFormatGroup = BVDB_InputFormatGroup_e1366_768_60_PC; |
|---|
| 663 | } |
|---|
| 664 | else if (ulWidth >= 1280 && ulTempHeight >= 960 && |
|---|
| 665 | ulWidth <= 1400 && ulTempHeight <= 1050) |
|---|
| 666 | { |
|---|
| 667 | *peInputFormatGroup = BVDB_InputFormatGroup_e1400_1050_60_PC; |
|---|
| 668 | } |
|---|
| 669 | else if (ulWidth == 1920 && ulTempHeight == 1080) |
|---|
| 670 | { |
|---|
| 671 | *peInputFormatGroup = BVDB_InputFormatGroup_e1920_1080_60_PC; |
|---|
| 672 | } |
|---|
| 673 | else if (ulWidth == 1600 && ulTempHeight == 1200) |
|---|
| 674 | { |
|---|
| 675 | *peInputFormatGroup = BVDB_InputFormatGroup_e1600_1200_60_PC; |
|---|
| 676 | } |
|---|
| 677 | |
|---|
| 678 | /* accurate search failed. Pick a group based on # of lines */ |
|---|
| 679 | if (ulTempHeight <=768) |
|---|
| 680 | { |
|---|
| 681 | *peInputFormatGroup = BVDB_InputFormatGroup_e1024_768_60_PC; |
|---|
| 682 | } |
|---|
| 683 | else if (ulTempHeight <= 1050) |
|---|
| 684 | { |
|---|
| 685 | *peInputFormatGroup = BVDB_InputFormatGroup_e1400_1050_60_PC; |
|---|
| 686 | } |
|---|
| 687 | else if (ulTempHeight <= 1080) |
|---|
| 688 | { |
|---|
| 689 | *peInputFormatGroup = BVDB_InputFormatGroup_e1920_1080_60_PC; |
|---|
| 690 | } |
|---|
| 691 | else if (ulTempHeight <= 1200) |
|---|
| 692 | { |
|---|
| 693 | *peInputFormatGroup = BVDB_InputFormatGroup_e1600_1200_60_PC; |
|---|
| 694 | } |
|---|
| 695 | } |
|---|
| 696 | else /* odd rates */ |
|---|
| 697 | { |
|---|
| 698 | if (ulWidth <= 1024 && ulTempHeight <= 768) |
|---|
| 699 | { |
|---|
| 700 | *peInputFormatGroup = BVDB_InputFormatGroup_e1024_768_85_PC; |
|---|
| 701 | } |
|---|
| 702 | else if (ulWidth <= 1366 && ulTempHeight <= 768) |
|---|
| 703 | { |
|---|
| 704 | *peInputFormatGroup = BVDB_InputFormatGroup_e1366_768_85_PC; |
|---|
| 705 | } |
|---|
| 706 | else if (ulWidth >= 1152 && ulTempHeight >= 864 && |
|---|
| 707 | ulWidth <= 1400 && ulTempHeight <= 1050) |
|---|
| 708 | { |
|---|
| 709 | *peInputFormatGroup = BVDB_InputFormatGroup_e1400_1050_75_PC; |
|---|
| 710 | } |
|---|
| 711 | |
|---|
| 712 | /* accurate search failed. Pick a group based on # of lines */ |
|---|
| 713 | if (ulTempHeight <=768) |
|---|
| 714 | { |
|---|
| 715 | *peInputFormatGroup = BVDB_InputFormatGroup_e1366_768_85_PC; |
|---|
| 716 | } |
|---|
| 717 | else if (ulTempHeight <= 1050) |
|---|
| 718 | { |
|---|
| 719 | *peInputFormatGroup = BVDB_InputFormatGroup_e1400_1050_75_PC; |
|---|
| 720 | } |
|---|
| 721 | else |
|---|
| 722 | { |
|---|
| 723 | *peInputFormatGroup = BVDB_InputFormatGroup_e1920_1080_60_PC; |
|---|
| 724 | } |
|---|
| 725 | } |
|---|
| 726 | } |
|---|
| 727 | } |
|---|
| 728 | } |
|---|
| 729 | |
|---|
| 730 | if (*peInputFormatGroup == BVDB_InputFormatGroup_eInvalid) |
|---|
| 731 | err = BERR_NOT_SUPPORTED; |
|---|
| 732 | |
|---|
| 733 | return BERR_TRACE(err); |
|---|
| 734 | } |
|---|
| 735 | |
|---|
| 736 | |
|---|
| 737 | |
|---|
| 738 | BERR_Code BVDB_GetVdbEntry |
|---|
| 739 | ( BVDB_Handle hVdb, |
|---|
| 740 | BVDB_UsageMode *pstUsageMode, |
|---|
| 741 | bool bPipVisible, |
|---|
| 742 | bool bPanelReversed) |
|---|
| 743 | { |
|---|
| 744 | BERR_Code err = BERR_SUCCESS; |
|---|
| 745 | BVDB_P_Context *pVdb; |
|---|
| 746 | BVDB_SourceGroup mappedSource; |
|---|
| 747 | BVDB_SourceGroup mainSourceToMatch; |
|---|
| 748 | BVDB_SourceGroup subSourceToMatch; |
|---|
| 749 | BVDB_P_RtsData tmpUsageMode; |
|---|
| 750 | bool bMainDispModeMatch; |
|---|
| 751 | bool bSubDispModeMatch; |
|---|
| 752 | bool bSourceMapped = false; |
|---|
| 753 | bool bDontCareMainWinClipSize; |
|---|
| 754 | bool bDontCareSubWinClipSize; |
|---|
| 755 | bool bDontCareMain; |
|---|
| 756 | bool bDontCareSub; |
|---|
| 757 | bool bMfdSource; |
|---|
| 758 | bool bUsageModeMatchFound; |
|---|
| 759 | uint32_t dispModeToMatch; |
|---|
| 760 | uint32_t numEntry; |
|---|
| 761 | BVDB_P_BvnTopology * pBvn; |
|---|
| 762 | uint32_t i; |
|---|
| 763 | uint32_t j; |
|---|
| 764 | bool bDotByDot = false; |
|---|
| 765 | |
|---|
| 766 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 767 | |
|---|
| 768 | /* Now get the new source format from the mapping table */ |
|---|
| 769 | bMfdSource = pstUsageMode->eInput == BVDB_Input_eMfd; |
|---|
| 770 | |
|---|
| 771 | numEntry = sizeof(stMapToNewSourceGroup) / sizeof(BVDB_P_MapToNewSourceGroup); |
|---|
| 772 | for (i = 0; i < numEntry; i++) |
|---|
| 773 | { |
|---|
| 774 | if ((stMapToNewSourceGroup[i].oldFormat == pstUsageMode->eInputFormatGroup) && |
|---|
| 775 | ((stMapToNewSourceGroup[i].bMfdSource && bMfdSource) || |
|---|
| 776 | (!stMapToNewSourceGroup[i].bMfdSource && !bMfdSource))) |
|---|
| 777 | { |
|---|
| 778 | mappedSource = stMapToNewSourceGroup[i].newFormat; |
|---|
| 779 | bSourceMapped = true; |
|---|
| 780 | break; |
|---|
| 781 | } |
|---|
| 782 | } |
|---|
| 783 | |
|---|
| 784 | if (!bSourceMapped) |
|---|
| 785 | { |
|---|
| 786 | BDBG_ERR(("No new source format found!:")); |
|---|
| 787 | BDBG_ERR(("MFD source = %s, Old Source Group = %d", bMfdSource, pstUsageMode->eInputFormatGroup)); |
|---|
| 788 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 789 | } |
|---|
| 790 | |
|---|
| 791 | /* AVC 1080i is treated as 1080psf because from VDB point of view, there's |
|---|
| 792 | * no way to differentiate them. So take the superset which is 1080psf */ |
|---|
| 793 | if (mappedSource == BVDB_SourceGroup_Avc_e1080i) |
|---|
| 794 | { |
|---|
| 795 | BDBG_MSG(("AVC1080i is mapped to AVC1080psf")); |
|---|
| 796 | mappedSource = BVDB_SourceGroup_Avc_e1080psf; |
|---|
| 797 | } |
|---|
| 798 | |
|---|
| 799 | BDBG_MSG(("Mapped source = %d for %s window", mappedSource, |
|---|
| 800 | pstUsageMode->eWindow == BVDB_Window_eMain ? "Main": |
|---|
| 801 | pstUsageMode->eWindow == BVDB_Window_ePip ? "Pip" : |
|---|
| 802 | "Monitor")); |
|---|
| 803 | |
|---|
| 804 | bUsageModeMatchFound = false; |
|---|
| 805 | |
|---|
| 806 | /* Just to avoid build warning messages */ |
|---|
| 807 | tmpUsageMode = tvdb.pUsageMode[0]; |
|---|
| 808 | |
|---|
| 809 | if (pstUsageMode->eWindow == BVDB_Window_eMain || |
|---|
| 810 | pstUsageMode->eWindow == BVDB_Window_ePip) |
|---|
| 811 | { |
|---|
| 812 | /* find main match - group, win, clipping |
|---|
| 813 | * then find the sub or vcr match - group, wind clipping |
|---|
| 814 | * use that RTS. The only exception is adcCalibration. If source is |
|---|
| 815 | * adc then find rp | pc in pip or vcr */ |
|---|
| 816 | |
|---|
| 817 | BDBG_MSG(("Window %s: Prev Main Source = 0x%x, Prev Sub Source = 0x%x, PIP visible = %s\n", |
|---|
| 818 | pstUsageMode->eWindow == BVDB_Window_eMain ? "main" : "pip", |
|---|
| 819 | tvdb.curUsageMode.main.sourceGroup, |
|---|
| 820 | tvdb.curUsageMode.sub.sourceGroup, |
|---|
| 821 | bPipVisible ? "Yes" : "No")); |
|---|
| 822 | |
|---|
| 823 | /* If PIP is not supported or no source connected to sub path, do not check sub source */ |
|---|
| 824 | if (pstUsageMode->eWindow == BVDB_Window_eMain) |
|---|
| 825 | { |
|---|
| 826 | bDontCareMain = false; |
|---|
| 827 | bDontCareSub = !bPipVisible || |
|---|
| 828 | !tvdb.bPipSupport || |
|---|
| 829 | (tvdb.curUsageMode.sub.sourceGroup == BVDB_SourceGroup_None); |
|---|
| 830 | /* Do not check clipping and window size for ADC and JPEG */ |
|---|
| 831 | bDontCareMainWinClipSize = (mappedSource == BVDB_SourceGroup_eJpeg) || |
|---|
| 832 | (mappedSource == BVDB_SourceGroup_eAdcCalibration) || |
|---|
| 833 | tvdb.main.bAutomaticAspectRatioBoxMode; |
|---|
| 834 | bDontCareSubWinClipSize = bDontCareSub || |
|---|
| 835 | (tvdb.curUsageMode.sub.sourceGroup == BVDB_SourceGroup_eJpeg) || |
|---|
| 836 | (tvdb.curUsageMode.sub.sourceGroup == BVDB_SourceGroup_eAdcCalibration) || |
|---|
| 837 | tvdb.sub.bAutomaticAspectRatioBoxMode; |
|---|
| 838 | |
|---|
| 839 | mainSourceToMatch = mappedSource; |
|---|
| 840 | subSourceToMatch = tvdb.curUsageMode.sub.sourceGroup; |
|---|
| 841 | } |
|---|
| 842 | else |
|---|
| 843 | { |
|---|
| 844 | if (!tvdb.bPipSupport) |
|---|
| 845 | { |
|---|
| 846 | BDBG_ERR(("PIP is not supported in this configuration")); |
|---|
| 847 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 848 | } |
|---|
| 849 | |
|---|
| 850 | bDontCareMain = (tvdb.curUsageMode.main.sourceGroup == BVDB_SourceGroup_None); |
|---|
| 851 | bDontCareSub = false; |
|---|
| 852 | /* Do not check clipping and window size for ADC and JPEG */ |
|---|
| 853 | bDontCareSubWinClipSize = bDontCareMain || |
|---|
| 854 | (mappedSource == BVDB_SourceGroup_eJpeg) || |
|---|
| 855 | (mappedSource == BVDB_SourceGroup_eAdcCalibration) || |
|---|
| 856 | tvdb.sub.bAutomaticAspectRatioBoxMode; |
|---|
| 857 | bDontCareMainWinClipSize = (tvdb.curUsageMode.main.sourceGroup == BVDB_SourceGroup_eJpeg) || |
|---|
| 858 | (tvdb.curUsageMode.main.sourceGroup == BVDB_SourceGroup_eAdcCalibration) || |
|---|
| 859 | tvdb.main.bAutomaticAspectRatioBoxMode; |
|---|
| 860 | |
|---|
| 861 | mainSourceToMatch = tvdb.curUsageMode.main.sourceGroup; |
|---|
| 862 | subSourceToMatch = mappedSource; |
|---|
| 863 | } |
|---|
| 864 | |
|---|
| 865 | BDBG_MSG(("Don't care main = %d, Don't care main win/clip size = %d", |
|---|
| 866 | bDontCareMain, bDontCareMainWinClipSize)); |
|---|
| 867 | BDBG_MSG(("Don't care sub = %d, Don't care sub win/clip size = %d", |
|---|
| 868 | bDontCareSub, bDontCareSubWinClipSize)); |
|---|
| 869 | |
|---|
| 870 | /* If it's not both vertically and horizontally full, do not use full mode */ |
|---|
| 871 | if (((tvdb.main.winHeight != 100 && tvdb.main.winWidth != 100) || |
|---|
| 872 | ((tvdb.main.winHeight != 100 || tvdb.main.winWidth != 100) && tvdb.main.bAutomaticAspectRatioBoxMode)) && |
|---|
| 873 | !tvdb.main.bDotByDot) |
|---|
| 874 | { |
|---|
| 875 | BDBG_MSG(("Pick one from non-full mode")); |
|---|
| 876 | dispModeToMatch = ~BVDB_DisplayMode_Full; |
|---|
| 877 | } |
|---|
| 878 | else |
|---|
| 879 | { |
|---|
| 880 | dispModeToMatch = BVDB_DisplayMode_Any; |
|---|
| 881 | } |
|---|
| 882 | |
|---|
| 883 | BDBG_ASSERT(tvdb.pUsageMode != NULL); |
|---|
| 884 | |
|---|
| 885 | for (j = 0; j < 2; j++) |
|---|
| 886 | { |
|---|
| 887 | for (i = 0; i < tvdb.usageModeNum; i++) |
|---|
| 888 | { |
|---|
| 889 | 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)", |
|---|
| 890 | tvdb.pUsageMode[i].id, |
|---|
| 891 | tvdb.pUsageMode[i].eDisplayMode, dispModeToMatch, |
|---|
| 892 | tvdb.pUsageMode[i].ulMainOutputResolution, pstUsageMode->stDisplay.eResolution, |
|---|
| 893 | tvdb.pUsageMode[i].main.sourceGroup, mainSourceToMatch, |
|---|
| 894 | tvdb.pUsageMode[i].sub.sourceGroup, subSourceToMatch)); |
|---|
| 895 | |
|---|
| 896 | if ((tvdb.pUsageMode[i].eDisplayMode & dispModeToMatch) && |
|---|
| 897 | (tvdb.pUsageMode[i].ulMainOutputResolution & pstUsageMode->stDisplay.eResolution) && |
|---|
| 898 | (bDontCareMain || (tvdb.pUsageMode[i].main.sourceGroup & mainSourceToMatch)) && |
|---|
| 899 | (bDontCareSub || (tvdb.pUsageMode[i].sub.sourceGroup & subSourceToMatch))) |
|---|
| 900 | { |
|---|
| 901 | /* Now we have main and sub match. Then find the matching display |
|---|
| 902 | * mode. */ |
|---|
| 903 | bMainDispModeMatch = bDontCareMainWinClipSize || |
|---|
| 904 | (bDotByDot && (tvdb.pUsageMode[i].eDisplayMode == BVDB_DisplayMode_Full)) || |
|---|
| 905 | ((tvdb.main.winHeight + 1 >= (tvdb.pUsageMode[i].main.minWinHeight)) && |
|---|
| 906 | (tvdb.main.winHeight <= (tvdb.pUsageMode[i].main.maxWinHeight + 1)) && |
|---|
| 907 | (tvdb.main.winWidth + 1 >= (tvdb.pUsageMode[i].main.minWinWidth)) && |
|---|
| 908 | (tvdb.main.winWidth <= (tvdb.pUsageMode[i].main.maxWinWidth + 1)) && |
|---|
| 909 | (tvdb.main.clipHeight <= (tvdb.pUsageMode[i].main.maxClippingHeight + 1)) && |
|---|
| 910 | (tvdb.main.clipWidth <= (tvdb.pUsageMode[i].main.maxClippingWidth + 1))); |
|---|
| 911 | |
|---|
| 912 | bSubDispModeMatch = bDontCareSubWinClipSize || |
|---|
| 913 | ((tvdb.sub.winHeight + 1 >= (tvdb.pUsageMode[i].sub.minWinHeight)) && |
|---|
| 914 | (tvdb.sub.winHeight <= (tvdb.pUsageMode[i].sub.maxWinHeight + 1)) && |
|---|
| 915 | (tvdb.sub.winWidth + 1 >= (tvdb.pUsageMode[i].sub.minWinWidth)) && |
|---|
| 916 | (tvdb.sub.winWidth <= (tvdb.pUsageMode[i].sub.maxWinWidth + 1)) && |
|---|
| 917 | (tvdb.sub.clipHeight <= (tvdb.pUsageMode[i].sub.maxClippingHeight + 1)) && |
|---|
| 918 | (tvdb.sub.clipWidth <= (tvdb.pUsageMode[i].sub.maxClippingWidth + 1))); |
|---|
| 919 | |
|---|
| 920 | BDBG_MSG(("ID (%d) for Main (DontCareMain = %d): Looking for \"%d >= %d, %d <= %d, %d >= %d, %d <= %d, %d <= %d, %d <=%d\"", |
|---|
| 921 | tvdb.pUsageMode[i].id, |
|---|
| 922 | bDontCareMainWinClipSize, |
|---|
| 923 | tvdb.main.winHeight , tvdb.pUsageMode[i].main.minWinHeight - 1, |
|---|
| 924 | tvdb.main.winHeight , tvdb.pUsageMode[i].main.maxWinHeight + 1, |
|---|
| 925 | tvdb.main.winWidth , tvdb.pUsageMode[i].main.minWinWidth - 1, |
|---|
| 926 | tvdb.main.winWidth , tvdb.pUsageMode[i].main.maxWinWidth + 1, |
|---|
| 927 | tvdb.main.clipHeight, tvdb.pUsageMode[i].main.maxClippingHeight + 1, |
|---|
| 928 | tvdb.main.clipWidth , tvdb.pUsageMode[i].main.maxClippingWidth + 1)); |
|---|
| 929 | |
|---|
| 930 | BDBG_MSG(("ID (%d) for Sub (DontCareSub = %d): Looking for \"%d >= %d, %d <= %d, %d >= %d, %d <= %d, %d <= %d, %d <=%d\"", |
|---|
| 931 | tvdb.pUsageMode[i].id, |
|---|
| 932 | bDontCareSubWinClipSize, |
|---|
| 933 | tvdb.sub.winHeight , tvdb.pUsageMode[i].sub.minWinHeight - 1, |
|---|
| 934 | tvdb.sub.winHeight , tvdb.pUsageMode[i].sub.maxWinHeight + 1, |
|---|
| 935 | tvdb.sub.winWidth , tvdb.pUsageMode[i].sub.minWinWidth - 1, |
|---|
| 936 | tvdb.sub.winWidth , tvdb.pUsageMode[i].sub.maxWinWidth + 1, |
|---|
| 937 | tvdb.sub.clipHeight, tvdb.pUsageMode[i].sub.maxClippingHeight + 1, |
|---|
| 938 | tvdb.sub.clipWidth , tvdb.pUsageMode[i].sub.maxClippingWidth + 1)); |
|---|
| 939 | |
|---|
| 940 | BDBG_MSG(("Main disp match = %d, Sub disp match =%d", bMainDispModeMatch, bSubDispModeMatch)); |
|---|
| 941 | if (bMainDispModeMatch && bSubDispModeMatch) |
|---|
| 942 | { |
|---|
| 943 | /* If it's a first time match, or we have a previous match, but the new |
|---|
| 944 | * match has a higher priority, then update the match */ |
|---|
| 945 | if (!bUsageModeMatchFound || |
|---|
| 946 | (bUsageModeMatchFound && (tmpUsageMode.priority > tvdb.pUsageMode[i].priority))) |
|---|
| 947 | { |
|---|
| 948 | /* Copy usage mode, but update source group with real ones */ |
|---|
| 949 | tmpUsageMode = tvdb.pUsageMode[i]; |
|---|
| 950 | |
|---|
| 951 | BDBG_MSG(("ID \"%d\" is picked", tvdb.pUsageMode[i].id)); |
|---|
| 952 | |
|---|
| 953 | if (pstUsageMode->eWindow == BVDB_Window_eMain) |
|---|
| 954 | { |
|---|
| 955 | /* update main source */ |
|---|
| 956 | tmpUsageMode.main.sourceGroup = mappedSource; |
|---|
| 957 | /* and update sub source */ |
|---|
| 958 | if (bDontCareSub) |
|---|
| 959 | { |
|---|
| 960 | tmpUsageMode.sub.sourceGroup = BVDB_SourceGroup_None; |
|---|
| 961 | } |
|---|
| 962 | else |
|---|
| 963 | { |
|---|
| 964 | tmpUsageMode.sub.sourceGroup = tvdb.curUsageMode.sub.sourceGroup; |
|---|
| 965 | } |
|---|
| 966 | } |
|---|
| 967 | else |
|---|
| 968 | { |
|---|
| 969 | /* update sub source */ |
|---|
| 970 | tmpUsageMode.sub.sourceGroup = mappedSource; |
|---|
| 971 | if (bDontCareMain) |
|---|
| 972 | { |
|---|
| 973 | tmpUsageMode.main.sourceGroup = BVDB_SourceGroup_None; |
|---|
| 974 | } |
|---|
| 975 | else |
|---|
| 976 | { |
|---|
| 977 | tmpUsageMode.main.sourceGroup = tvdb.curUsageMode.main.sourceGroup; |
|---|
| 978 | } |
|---|
| 979 | } |
|---|
| 980 | bUsageModeMatchFound = true; |
|---|
| 981 | } |
|---|
| 982 | } |
|---|
| 983 | } |
|---|
| 984 | } |
|---|
| 985 | |
|---|
| 986 | /* If a match found, immediately exit, and if dot by dot mode and a |
|---|
| 987 | * match not found, try to use full mode because full is designed to |
|---|
| 988 | * support dot by dot for another loop. Otherwise we fail to find a |
|---|
| 989 | * match */ |
|---|
| 990 | if (bUsageModeMatchFound) break; |
|---|
| 991 | else if (tvdb.main.bDotByDot) bDotByDot = true; |
|---|
| 992 | else break; |
|---|
| 993 | } |
|---|
| 994 | } |
|---|
| 995 | else /* Monitor */ |
|---|
| 996 | { |
|---|
| 997 | /* Just find sub group match */ |
|---|
| 998 | for (i = 0; i < tvdb.usageModeNum; i++) |
|---|
| 999 | { |
|---|
| 1000 | BDBG_MSG(("Looking for matches for Sub: 0x%x = 0x%x (source)", |
|---|
| 1001 | tvdb.pUsageMode[i].sub.sourceGroup , mappedSource)); |
|---|
| 1002 | |
|---|
| 1003 | if (tvdb.pUsageMode[i].sub.sourceGroup & mappedSource) |
|---|
| 1004 | { |
|---|
| 1005 | bUsageModeMatchFound = true; |
|---|
| 1006 | tmpUsageMode = tvdb.pUsageMode[i]; |
|---|
| 1007 | |
|---|
| 1008 | /* Use RTS which belongs to main */ |
|---|
| 1009 | if (tvdb.curUsageMode.pRtsRegisterTable != NULL) |
|---|
| 1010 | { |
|---|
| 1011 | tmpUsageMode.pRtsRegisterTable = tvdb.curUsageMode.pRtsRegisterTable; |
|---|
| 1012 | } |
|---|
| 1013 | break; |
|---|
| 1014 | } |
|---|
| 1015 | } |
|---|
| 1016 | } |
|---|
| 1017 | |
|---|
| 1018 | if (!bUsageModeMatchFound) |
|---|
| 1019 | { |
|---|
| 1020 | BDBG_ERR(("VDB Can't find a match. Video will be muted")); |
|---|
| 1021 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1022 | } |
|---|
| 1023 | |
|---|
| 1024 | /* There's a matching usage mode. Now fill up the Usage Mode */ |
|---|
| 1025 | BDBG_MSG(("Matching VDB ID: %d", tmpUsageMode.id)); |
|---|
| 1026 | |
|---|
| 1027 | pstUsageMode->eDisplayMode = tmpUsageMode.eDisplayMode; |
|---|
| 1028 | pstUsageMode->ulDisplayModeNum = tmpUsageMode.ulDisplayModeNum; |
|---|
| 1029 | pstUsageMode->usageId = tmpUsageMode.id; |
|---|
| 1030 | |
|---|
| 1031 | if (pstUsageMode->eWindow == BVDB_Window_eMain) |
|---|
| 1032 | { |
|---|
| 1033 | pBvn = &tmpUsageMode.main; |
|---|
| 1034 | } |
|---|
| 1035 | else |
|---|
| 1036 | { |
|---|
| 1037 | pBvn = &tmpUsageMode.sub; |
|---|
| 1038 | } |
|---|
| 1039 | |
|---|
| 1040 | /* Fill in Usage Mode Structure so Nexus can populate relative parameters |
|---|
| 1041 | * to magnum */ |
|---|
| 1042 | |
|---|
| 1043 | /* Each RTS configuration has a different OSD size to support and it |
|---|
| 1044 | * should be from each configuration context */ |
|---|
| 1045 | pstUsageMode->stOsd.ulReserved = 0; |
|---|
| 1046 | if (pstUsageMode->eWindow == BVDB_Window_ePip || |
|---|
| 1047 | pstUsageMode->eWindow == BVDB_Window_eInvalid) |
|---|
| 1048 | { |
|---|
| 1049 | /* PIP has no OSD, and main OSD will cover it */ |
|---|
| 1050 | pstUsageMode->stOsd.eOsd = BVDB_Osd_eInvalid; |
|---|
| 1051 | } |
|---|
| 1052 | else if (pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 1053 | { |
|---|
| 1054 | pstUsageMode->stOsd.eOsd = tvdb.eVcrOsdResolution; |
|---|
| 1055 | } |
|---|
| 1056 | else |
|---|
| 1057 | { |
|---|
| 1058 | pstUsageMode->stOsd.eOsd = tvdb.eMainOsdResolution; |
|---|
| 1059 | } |
|---|
| 1060 | |
|---|
| 1061 | /* e3dComb for composite signal and eOverampling for main path only */ |
|---|
| 1062 | if (pstUsageMode->eInput == BVDB_Input_eCvbsSvidIfd) |
|---|
| 1063 | { |
|---|
| 1064 | pstUsageMode->e3dComb = pBvn->b3dcomb; |
|---|
| 1065 | if (pstUsageMode->eWindow == BVDB_Window_eMain) |
|---|
| 1066 | { |
|---|
| 1067 | pstUsageMode->eOversample = true; |
|---|
| 1068 | } |
|---|
| 1069 | else |
|---|
| 1070 | { |
|---|
| 1071 | pstUsageMode->eOversample = false; |
|---|
| 1072 | } |
|---|
| 1073 | } |
|---|
| 1074 | else |
|---|
| 1075 | { |
|---|
| 1076 | pstUsageMode->e3dComb = false; |
|---|
| 1077 | pstUsageMode->eOversample = false; |
|---|
| 1078 | } |
|---|
| 1079 | |
|---|
| 1080 | /* Set DNR based on the usage mode */ |
|---|
| 1081 | pstUsageMode->eDnr = pBvn->bdnr; |
|---|
| 1082 | |
|---|
| 1083 | /* ANR */ |
|---|
| 1084 | pstUsageMode->stAnr.eState = pBvn->banr; |
|---|
| 1085 | if (pBvn->banr) |
|---|
| 1086 | { |
|---|
| 1087 | pstUsageMode->stAnr.ePixelFormat = BVDB_PixelFmt_e10Bit422; |
|---|
| 1088 | pstUsageMode->stAnr.ulReserved = pBvn->mc; |
|---|
| 1089 | } |
|---|
| 1090 | else |
|---|
| 1091 | { |
|---|
| 1092 | pstUsageMode->stAnr.ePixelFormat = BVDB_PixelFmt_eInvalid; |
|---|
| 1093 | pstUsageMode->stAnr.ulReserved = 0; |
|---|
| 1094 | } |
|---|
| 1095 | |
|---|
| 1096 | /* CAP/VFD */ |
|---|
| 1097 | pstUsageMode->stCapVfd.eState = pBvn->bcap; |
|---|
| 1098 | if (pBvn->bcap) |
|---|
| 1099 | { |
|---|
| 1100 | pstUsageMode->stCapVfd.ulReserved = pBvn->c; |
|---|
| 1101 | |
|---|
| 1102 | if (bPanelReversed && !tvdb.bPanelReversalSupport) |
|---|
| 1103 | { |
|---|
| 1104 | BDBG_ERR(("Panel reversal is not supported in this configuration")); |
|---|
| 1105 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1106 | } |
|---|
| 1107 | |
|---|
| 1108 | if (!bPanelReversed && (pBvn->c > tvdb.panelReversalCompensation)) |
|---|
| 1109 | { |
|---|
| 1110 | pstUsageMode->stCapVfd.ulReserved -= tvdb.panelReversalCompensation; |
|---|
| 1111 | BDBG_MSG(("Panel Reversal Compensation: %d -> %d", |
|---|
| 1112 | pBvn->c, |
|---|
| 1113 | pstUsageMode->stCapVfd.ulReserved)); |
|---|
| 1114 | } |
|---|
| 1115 | |
|---|
| 1116 | if (pstUsageMode->eWindow == BVDB_Window_ePip || |
|---|
| 1117 | pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 1118 | { |
|---|
| 1119 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_e8Bit422; |
|---|
| 1120 | } |
|---|
| 1121 | else |
|---|
| 1122 | { |
|---|
| 1123 | if ((pstUsageMode->eInput == BVDB_Input_eHdDvi && mappedSource == BVDB_SourceGroup_ePc) || |
|---|
| 1124 | pstUsageMode->eInput == BVDB_Input_eVga) |
|---|
| 1125 | { |
|---|
| 1126 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_e10Bit444; |
|---|
| 1127 | } |
|---|
| 1128 | else |
|---|
| 1129 | { |
|---|
| 1130 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_e10Bit422; |
|---|
| 1131 | } |
|---|
| 1132 | } |
|---|
| 1133 | } |
|---|
| 1134 | else |
|---|
| 1135 | { |
|---|
| 1136 | pstUsageMode->stCapVfd.ePixelFormat = BVDB_PixelFmt_eInvalid; |
|---|
| 1137 | pstUsageMode->stCapVfd.ulReserved = 0; |
|---|
| 1138 | } |
|---|
| 1139 | |
|---|
| 1140 | /* MAD - it actually refers to MCVP in 35230 */ |
|---|
| 1141 | pstUsageMode->stMad.eState = pBvn->bmad || pBvn->banr; |
|---|
| 1142 | if (pstUsageMode->stMad.eState) |
|---|
| 1143 | { |
|---|
| 1144 | pstUsageMode->stMad.eFieldStore = BVDB_FieldStore_e5Fields; |
|---|
| 1145 | pstUsageMode->stMad.ePixelFormat = BVDB_PixelFmt_e10Bit422; |
|---|
| 1146 | pstUsageMode->stMad.ulReserved = pBvn->mc; |
|---|
| 1147 | } |
|---|
| 1148 | else |
|---|
| 1149 | { |
|---|
| 1150 | pstUsageMode->stMad.eFieldStore = BVDB_FieldStore_eNotApplicable; |
|---|
| 1151 | pstUsageMode->stMad.ePixelFormat = BVDB_PixelFmt_eInvalid; |
|---|
| 1152 | pstUsageMode->stMad.ulReserved = 0; |
|---|
| 1153 | } |
|---|
| 1154 | |
|---|
| 1155 | /* PDP */ |
|---|
| 1156 | pstUsageMode->stPdp.eState = BVDB_State_eYes; |
|---|
| 1157 | pstUsageMode->stPdp.ulReserved = pBvn->dc; |
|---|
| 1158 | |
|---|
| 1159 | /* FRC */ |
|---|
| 1160 | pstUsageMode->stFrc.eState = pBvn->bfrc; |
|---|
| 1161 | pstUsageMode->stFrc.ulReserved = pBvn->frcc; |
|---|
| 1162 | |
|---|
| 1163 | /* CAP-SCL bias and orientation */ |
|---|
| 1164 | pstUsageMode->ulSclCapTolerance = pBvn->bias; |
|---|
| 1165 | pstUsageMode->eSclCapBias = pBvn->eSclCap; |
|---|
| 1166 | |
|---|
| 1167 | /* We are updating the current usage mode only when the path is main or |
|---|
| 1168 | * pip because monitor will depend on the main source anyway */ |
|---|
| 1169 | if (pstUsageMode->eWindow == BVDB_Window_eMonitor) |
|---|
| 1170 | { |
|---|
| 1171 | pstUsageMode->pRtsSet = NULL; |
|---|
| 1172 | } |
|---|
| 1173 | else |
|---|
| 1174 | { |
|---|
| 1175 | pstUsageMode->pRtsSet = tmpUsageMode.pRtsRegisterTable; |
|---|
| 1176 | tvdb.curUsageMode = tmpUsageMode; |
|---|
| 1177 | } |
|---|
| 1178 | /* End of filling in "Usage Mode" */ |
|---|
| 1179 | |
|---|
| 1180 | |
|---|
| 1181 | return BERR_TRACE(err); |
|---|
| 1182 | } |
|---|
| 1183 | |
|---|
| 1184 | |
|---|
| 1185 | /* Configuration ID is passed from upper layer */ |
|---|
| 1186 | BERR_Code BVDB_ValidateConfigId |
|---|
| 1187 | ( BVDB_Handle hVdb, |
|---|
| 1188 | const uint32_t ulConfigId ) |
|---|
| 1189 | { |
|---|
| 1190 | BERR_Code err = BERR_SUCCESS; |
|---|
| 1191 | BVDB_P_Context *pVdb; |
|---|
| 1192 | char * pVerString; |
|---|
| 1193 | |
|---|
| 1194 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 1195 | |
|---|
| 1196 | if (ulConfigId == 100 || ulConfigId == 400 || ulConfigId == 401 || ulConfigId == 402) |
|---|
| 1197 | { |
|---|
| 1198 | tvdb.ulConfigId = ulConfigId; |
|---|
| 1199 | err = BVDB_P_GetRtsData(ulConfigId, &tvdb.pUsageMode, &tvdb.usageModeNum); |
|---|
| 1200 | |
|---|
| 1201 | if (err != BERR_SUCCESS) |
|---|
| 1202 | { |
|---|
| 1203 | BDBG_ERR(("Can't find RTS configuration %d", ulConfigId)); |
|---|
| 1204 | return BERR_TRACE(err); |
|---|
| 1205 | } |
|---|
| 1206 | |
|---|
| 1207 | /* TODO: To be moved to config context */ |
|---|
| 1208 | switch (ulConfigId) |
|---|
| 1209 | { |
|---|
| 1210 | default: |
|---|
| 1211 | case 100: |
|---|
| 1212 | pVerString = BVDB_USAGE_MODE_VER_STRING_CFG100; |
|---|
| 1213 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_2205p_32bpp; |
|---|
| 1214 | tvdb.eVcrOsdResolution = BVDB_Osd_e576i_8bpp; |
|---|
| 1215 | tvdb.panelReversalCompensation = 0; |
|---|
| 1216 | tvdb.bPipSupport = true; |
|---|
| 1217 | tvdb.bMonitorSupport = true; |
|---|
| 1218 | tvdb.bFrcSupport = false; |
|---|
| 1219 | tvdb.bRtcSupport = true; |
|---|
| 1220 | tvdb.bPanelReversalSupport = true; |
|---|
| 1221 | tvdb.bBacklightSupport = true; |
|---|
| 1222 | tvdb.worstPdpBpp = 20; |
|---|
| 1223 | tvdb.maxPipWinHeight = 100; |
|---|
| 1224 | tvdb.maxPipWinWidth = 100; |
|---|
| 1225 | break; |
|---|
| 1226 | |
|---|
| 1227 | case 400: |
|---|
| 1228 | pVerString = BVDB_USAGE_MODE_VER_STRING_CFG400; |
|---|
| 1229 | tvdb.eMainOsdResolution = BVDB_Osd_e960_540p_32bpp; |
|---|
| 1230 | tvdb.eVcrOsdResolution = BVDB_Osd_eNone; |
|---|
| 1231 | tvdb.panelReversalCompensation = 0; |
|---|
| 1232 | tvdb.bPipSupport = false; |
|---|
| 1233 | tvdb.bMonitorSupport = false; |
|---|
| 1234 | tvdb.bFrcSupport = false; |
|---|
| 1235 | tvdb.bRtcSupport = false; |
|---|
| 1236 | tvdb.bPanelReversalSupport = false; |
|---|
| 1237 | tvdb.bBacklightSupport = true; |
|---|
| 1238 | tvdb.worstPdpBpp = 0; |
|---|
| 1239 | tvdb.maxPipWinHeight = 0; |
|---|
| 1240 | tvdb.maxPipWinWidth = 0; |
|---|
| 1241 | break; |
|---|
| 1242 | |
|---|
| 1243 | case 401: |
|---|
| 1244 | pVerString = BVDB_USAGE_MODE_VER_STRING_CFG401; |
|---|
| 1245 | tvdb.eMainOsdResolution = BVDB_Osd_e960_540p_32bpp; |
|---|
| 1246 | tvdb.eVcrOsdResolution = BVDB_Osd_eNone; |
|---|
| 1247 | tvdb.panelReversalCompensation = 0; |
|---|
| 1248 | tvdb.bPipSupport = false; |
|---|
| 1249 | tvdb.bMonitorSupport = false; |
|---|
| 1250 | tvdb.bFrcSupport = false; |
|---|
| 1251 | tvdb.bRtcSupport = true; |
|---|
| 1252 | tvdb.bPanelReversalSupport = true; |
|---|
| 1253 | tvdb.bBacklightSupport = true; |
|---|
| 1254 | tvdb.worstPdpBpp = 0; |
|---|
| 1255 | tvdb.maxPipWinHeight = 0; |
|---|
| 1256 | tvdb.maxPipWinWidth = 0; |
|---|
| 1257 | break; |
|---|
| 1258 | |
|---|
| 1259 | case 402: |
|---|
| 1260 | pVerString = BVDB_USAGE_MODE_VER_STRING_CFG402; |
|---|
| 1261 | tvdb.eMainOsdResolution = BVDB_Osd_e1920_1080p_32bpp; |
|---|
| 1262 | tvdb.eVcrOsdResolution = BVDB_Osd_eNone; |
|---|
| 1263 | tvdb.panelReversalCompensation = 0; |
|---|
| 1264 | tvdb.bPipSupport = false; |
|---|
| 1265 | tvdb.bMonitorSupport = true; |
|---|
| 1266 | tvdb.bFrcSupport = false; |
|---|
| 1267 | tvdb.bRtcSupport = false; |
|---|
| 1268 | tvdb.bPanelReversalSupport = false; |
|---|
| 1269 | tvdb.bBacklightSupport = false; |
|---|
| 1270 | tvdb.worstPdpBpp = 30; |
|---|
| 1271 | tvdb.maxPipWinHeight = 0; |
|---|
| 1272 | tvdb.maxPipWinWidth = 0; |
|---|
| 1273 | break; |
|---|
| 1274 | } |
|---|
| 1275 | |
|---|
| 1276 | BDBG_ASSERT(strlen(pVerString) <= BVDB_MAX_VER_STRING); |
|---|
| 1277 | strcpy(tvdb.vdbVerString, pVerString); |
|---|
| 1278 | |
|---|
| 1279 | return BERR_SUCCESS; |
|---|
| 1280 | } |
|---|
| 1281 | else |
|---|
| 1282 | { |
|---|
| 1283 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1284 | } |
|---|
| 1285 | } |
|---|
| 1286 | |
|---|
| 1287 | |
|---|
| 1288 | |
|---|
| 1289 | BERR_Code BVDB_GetFeatures |
|---|
| 1290 | ( BVDB_Handle hVdb, |
|---|
| 1291 | BVDB_Config_Features *pConfigFeatures) |
|---|
| 1292 | { |
|---|
| 1293 | BVDB_P_Context *pVdb; |
|---|
| 1294 | |
|---|
| 1295 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 1296 | |
|---|
| 1297 | if (tvdb.ulConfigId == 0) |
|---|
| 1298 | { |
|---|
| 1299 | BDBG_ERR(("RTS configuration is not set\n")); |
|---|
| 1300 | return BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 1301 | } |
|---|
| 1302 | |
|---|
| 1303 | BDBG_ASSERT(pConfigFeatures); |
|---|
| 1304 | |
|---|
| 1305 | pConfigFeatures->bPipSupport = tvdb.bPipSupport; |
|---|
| 1306 | pConfigFeatures->bMonitorSupport = tvdb.bMonitorSupport; |
|---|
| 1307 | pConfigFeatures->bFrcSupport = tvdb.bFrcSupport; |
|---|
| 1308 | pConfigFeatures->bRtcSupport = tvdb.bRtcSupport; |
|---|
| 1309 | pConfigFeatures->bPanelReversalSupport = tvdb.bPanelReversalSupport; |
|---|
| 1310 | pConfigFeatures->bPdpBufAllocat = (tvdb.bBacklightSupport) || (tvdb.bRtcSupport); |
|---|
| 1311 | pConfigFeatures->worstPdpBpp = tvdb.worstPdpBpp; |
|---|
| 1312 | pConfigFeatures->maxPipWinHeight = tvdb.maxPipWinHeight; |
|---|
| 1313 | pConfigFeatures->maxPipWinWidth = tvdb.maxPipWinWidth; |
|---|
| 1314 | |
|---|
| 1315 | return BERR_SUCCESS; |
|---|
| 1316 | } |
|---|
| 1317 | |
|---|
| 1318 | |
|---|
| 1319 | BERR_Code BVDB_GetMemoryAllocation |
|---|
| 1320 | (const uint32_t ulConfigId, |
|---|
| 1321 | const BVDB_Window eWindow, |
|---|
| 1322 | const BVDB_Input eInput, |
|---|
| 1323 | BVDB_Heap_Settings *pstHeapSettings, |
|---|
| 1324 | uint32_t *pulHeapSize ) |
|---|
| 1325 | { |
|---|
| 1326 | BERR_Code err = BERR_SUCCESS; |
|---|
| 1327 | uint32_t i, j, k; |
|---|
| 1328 | bool bFound = false; |
|---|
| 1329 | uint32_t ulNumConfigs; |
|---|
| 1330 | BVDB_P_Config_MemAlloc *pstConfigMemAlloc; |
|---|
| 1331 | |
|---|
| 1332 | BDBG_ASSERT(pstHeapSettings); |
|---|
| 1333 | |
|---|
| 1334 | err = BVDB_P_GetNumConfigs(&ulNumConfigs); |
|---|
| 1335 | if (err != BERR_SUCCESS) |
|---|
| 1336 | { |
|---|
| 1337 | return BERR_TRACE(err); |
|---|
| 1338 | } |
|---|
| 1339 | |
|---|
| 1340 | pstConfigMemAlloc = (BVDB_P_Config_MemAlloc *)BKNI_Malloc(sizeof(BVDB_P_Config_MemAlloc) * ulNumConfigs * BVDB_P_NUM_WINDOW_HEAPS); |
|---|
| 1341 | if (pstConfigMemAlloc == NULL) |
|---|
| 1342 | { |
|---|
| 1343 | BDBG_ERR(("Out of memory.")); |
|---|
| 1344 | err = BERR_OUT_OF_SYSTEM_MEMORY; |
|---|
| 1345 | return BERR_TRACE(err); |
|---|
| 1346 | } |
|---|
| 1347 | |
|---|
| 1348 | err = BVDB_P_GetConfigMemAllocArray(pstConfigMemAlloc); |
|---|
| 1349 | if (err != BERR_SUCCESS) |
|---|
| 1350 | { |
|---|
| 1351 | return BERR_TRACE(err); |
|---|
| 1352 | } |
|---|
| 1353 | |
|---|
| 1354 | /* Search for config */ |
|---|
| 1355 | for (k=0; k<ulNumConfigs; k++) |
|---|
| 1356 | { |
|---|
| 1357 | /* configuration ID starts at 1 */ |
|---|
| 1358 | if (ulConfigId == pstConfigMemAlloc[k * BVDB_P_NUM_WINDOW_HEAPS].ulConfigId) |
|---|
| 1359 | { |
|---|
| 1360 | bFound = true; |
|---|
| 1361 | break; |
|---|
| 1362 | } |
|---|
| 1363 | } |
|---|
| 1364 | |
|---|
| 1365 | if (bFound) |
|---|
| 1366 | { |
|---|
| 1367 | BDBG_MSG(("Found configuration %d", ulConfigId)); |
|---|
| 1368 | bFound = false; |
|---|
| 1369 | |
|---|
| 1370 | /* Search for window */ |
|---|
| 1371 | for (i=0; i<BVDB_P_NUM_WINDOW_HEAPS; i++) |
|---|
| 1372 | { |
|---|
| 1373 | if (eWindow == pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i].eWindow) |
|---|
| 1374 | { |
|---|
| 1375 | bFound = true; |
|---|
| 1376 | break; |
|---|
| 1377 | } |
|---|
| 1378 | } |
|---|
| 1379 | |
|---|
| 1380 | if (bFound) |
|---|
| 1381 | { |
|---|
| 1382 | if (eWindow == BVDB_Window_eMain) |
|---|
| 1383 | { |
|---|
| 1384 | BDBG_MSG(("Found MAIN window")); |
|---|
| 1385 | bFound = false; |
|---|
| 1386 | |
|---|
| 1387 | /* Search for input. Is it MPEG or no? */ |
|---|
| 1388 | for (j=0; j<2; j++) |
|---|
| 1389 | { |
|---|
| 1390 | BVDB_Input eLocalInput = eInput; |
|---|
| 1391 | |
|---|
| 1392 | if (eLocalInput == BVDB_Input_eInvalid) |
|---|
| 1393 | { |
|---|
| 1394 | err = BERR_INVALID_PARAMETER; |
|---|
| 1395 | BDBG_ERR(("Invalid input.")); |
|---|
| 1396 | return BERR_TRACE(err); |
|---|
| 1397 | } |
|---|
| 1398 | else if (eLocalInput != BVDB_Input_eMfd) |
|---|
| 1399 | { |
|---|
| 1400 | /* Force all valid non-MPEG inputs to use VDEC */ |
|---|
| 1401 | eLocalInput = BVDB_Input_eComponent; |
|---|
| 1402 | BDBG_MSG(("Found non-MFD input")); |
|---|
| 1403 | } |
|---|
| 1404 | else |
|---|
| 1405 | { |
|---|
| 1406 | BDBG_MSG(("Found MFD input %d, %d", eLocalInput, j)); |
|---|
| 1407 | } |
|---|
| 1408 | |
|---|
| 1409 | if (eLocalInput == pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i + j].eInput) |
|---|
| 1410 | { |
|---|
| 1411 | *pstHeapSettings = pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i + j].stHeapSettings; |
|---|
| 1412 | *pulHeapSize = pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i + j].ulHeapSize; |
|---|
| 1413 | bFound = true; |
|---|
| 1414 | break; |
|---|
| 1415 | } |
|---|
| 1416 | } |
|---|
| 1417 | } |
|---|
| 1418 | else /* PIP or Monitor */ |
|---|
| 1419 | { |
|---|
| 1420 | *pstHeapSettings = pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i].stHeapSettings; |
|---|
| 1421 | *pulHeapSize = pstConfigMemAlloc[(k * BVDB_P_NUM_WINDOW_HEAPS) + i].ulHeapSize; |
|---|
| 1422 | } |
|---|
| 1423 | } |
|---|
| 1424 | else |
|---|
| 1425 | { |
|---|
| 1426 | err = BERR_INVALID_PARAMETER; |
|---|
| 1427 | BDBG_ERR(("Invalid window.")); |
|---|
| 1428 | return BERR_TRACE(err); |
|---|
| 1429 | } |
|---|
| 1430 | |
|---|
| 1431 | } |
|---|
| 1432 | else |
|---|
| 1433 | { |
|---|
| 1434 | err = BERR_INVALID_PARAMETER; |
|---|
| 1435 | BDBG_ERR(("Configuration %d not found.", ulConfigId)); |
|---|
| 1436 | return BERR_TRACE(err); |
|---|
| 1437 | } |
|---|
| 1438 | |
|---|
| 1439 | BKNI_Free(pstConfigMemAlloc); |
|---|
| 1440 | |
|---|
| 1441 | return BERR_TRACE(err); |
|---|
| 1442 | } |
|---|
| 1443 | |
|---|
| 1444 | BERR_Code BVDB_SetVideoDisplayMode |
|---|
| 1445 | ( BVDB_Handle hVdb, |
|---|
| 1446 | const BVDB_Display *pstDisplay, |
|---|
| 1447 | const BVDB_Window eWindow, |
|---|
| 1448 | const uint32_t ulSrcHeight, |
|---|
| 1449 | const uint32_t ulSrcWidth, |
|---|
| 1450 | const uint32_t ulSrcHeightClipAmount, |
|---|
| 1451 | const uint32_t ulSrcWidthClipAmount, |
|---|
| 1452 | const uint32_t ulDestHeight, |
|---|
| 1453 | const uint32_t ulDestWidth, |
|---|
| 1454 | const bool bAutomaticAspectRatioBoxMode) |
|---|
| 1455 | { |
|---|
| 1456 | BERR_Code err = BERR_SUCCESS; |
|---|
| 1457 | BVDB_P_Context *pVdb; |
|---|
| 1458 | uint32_t ulHeightClipAmount, ulWidthClipAmount; |
|---|
| 1459 | uint32_t ulDisplayHeight, ulDisplayWidth; |
|---|
| 1460 | |
|---|
| 1461 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 1462 | |
|---|
| 1463 | /* Get display panel info */ |
|---|
| 1464 | err = BVDB_P_GetDisplaySize(pstDisplay->eResolution, &ulDisplayHeight, &ulDisplayWidth); |
|---|
| 1465 | if (err != BERR_SUCCESS) |
|---|
| 1466 | { |
|---|
| 1467 | return BERR_TRACE(err); |
|---|
| 1468 | } |
|---|
| 1469 | |
|---|
| 1470 | /* Get clip amount percentage */ |
|---|
| 1471 | ulHeightClipAmount = (ulSrcHeightClipAmount * 100)/ulSrcHeight; |
|---|
| 1472 | ulWidthClipAmount = (ulSrcWidthClipAmount * 100)/ulSrcWidth; |
|---|
| 1473 | |
|---|
| 1474 | if (eWindow == BVDB_Window_eMain) |
|---|
| 1475 | { |
|---|
| 1476 | tvdb.main.bDotByDot = (ulSrcHeight == ulDestHeight) && (ulSrcWidth == ulDestWidth); |
|---|
| 1477 | tvdb.main.clipHeight = BVDB_P_MIN(ulHeightClipAmount, 100); |
|---|
| 1478 | tvdb.main.clipWidth = BVDB_P_MIN(ulWidthClipAmount, 100); |
|---|
| 1479 | tvdb.main.winHeight = BVDB_P_MIN((ulDestHeight * 100) / ulDisplayHeight, 100); |
|---|
| 1480 | tvdb.main.winWidth = BVDB_P_MIN((ulDestWidth * 100) / ulDisplayWidth, 100); |
|---|
| 1481 | tvdb.main.bAutomaticAspectRatioBoxMode = bAutomaticAspectRatioBoxMode; |
|---|
| 1482 | } |
|---|
| 1483 | else |
|---|
| 1484 | { |
|---|
| 1485 | tvdb.sub.bDotByDot = (ulSrcHeight == ulDestHeight) && (ulSrcWidth == ulDestWidth); |
|---|
| 1486 | tvdb.sub.clipHeight = BVDB_P_MIN(ulHeightClipAmount, 100); |
|---|
| 1487 | tvdb.sub.clipWidth = BVDB_P_MIN(ulWidthClipAmount, 100); |
|---|
| 1488 | tvdb.sub.winHeight = BVDB_P_MIN((ulDestHeight * 100) / ulDisplayHeight, 100); |
|---|
| 1489 | tvdb.sub.winWidth = BVDB_P_MIN((ulDestWidth * 100) / ulDisplayWidth, 100); |
|---|
| 1490 | tvdb.sub.bAutomaticAspectRatioBoxMode = bAutomaticAspectRatioBoxMode; |
|---|
| 1491 | } |
|---|
| 1492 | |
|---|
| 1493 | BDBG_MSG(("%s Window Info: source size (%d, %d), clip size (%d, %d), win size (%d, %d), with Box mode %s, Dot-by-Dot %s", |
|---|
| 1494 | eWindow == BVDB_Window_eMain ? "main" : |
|---|
| 1495 | eWindow == BVDB_Window_ePip ? "pip" : "monitor", |
|---|
| 1496 | ulSrcWidth, |
|---|
| 1497 | ulSrcHeight, |
|---|
| 1498 | ulSrcWidthClipAmount, |
|---|
| 1499 | ulSrcHeightClipAmount, |
|---|
| 1500 | ulDestWidth, |
|---|
| 1501 | ulDestHeight, |
|---|
| 1502 | bAutomaticAspectRatioBoxMode ? "On" : "Off", |
|---|
| 1503 | tvdb.main.bDotByDot ? "On" : "Off")); |
|---|
| 1504 | |
|---|
| 1505 | return BERR_TRACE(err); |
|---|
| 1506 | } |
|---|
| 1507 | |
|---|