| 1 | /* (c)2007-2011 Broadcom Corporation |
|---|
| 2 | * |
|---|
| 3 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 4 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 5 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 6 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 7 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 8 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 9 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 10 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 11 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 12 | * |
|---|
| 13 | * Except as expressly set forth in the Authorized License, |
|---|
| 14 | * |
|---|
| 15 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 16 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 17 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 18 | * |
|---|
| 19 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 20 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 21 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 22 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 23 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 24 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 25 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 26 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 27 | * |
|---|
| 28 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 29 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 30 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 31 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 32 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 33 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 34 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 35 | * ANY LIMITED REMEDY. |
|---|
| 36 | * |
|---|
| 37 | * $brcm_Workfile: nexus_picture_ctrl.c $ |
|---|
| 38 | * $brcm_Revision: 54 $ |
|---|
| 39 | * $brcm_Date: 11/15/11 3:27p $ |
|---|
| 40 | * |
|---|
| 41 | * Module Description: |
|---|
| 42 | * |
|---|
| 43 | * Revision History: |
|---|
| 44 | * |
|---|
| 45 | * $brcm_Log: /nexus/modules/display/7400/src/nexus_picture_ctrl.c $ |
|---|
| 46 | * |
|---|
| 47 | * 54 11/15/11 3:27p erickson |
|---|
| 48 | * SW7425-1747: remove old code |
|---|
| 49 | * |
|---|
| 50 | * 53 7/29/10 6:43p mward |
|---|
| 51 | * SW7125-541: Set bInterpolateTables = false, since only one DC table is |
|---|
| 52 | * being provided. |
|---|
| 53 | * |
|---|
| 54 | * 52 5/13/10 10:55a erickson |
|---|
| 55 | * SW3548-2921: add pq_disabled=y support |
|---|
| 56 | * |
|---|
| 57 | * 51 3/26/10 5:25p erickson |
|---|
| 58 | * SW3548-2858: fix typo |
|---|
| 59 | * |
|---|
| 60 | * 50 3/26/10 12:26p erickson |
|---|
| 61 | * SW3548-2858: functions that malloc/free custom data for VDC need to |
|---|
| 62 | * free only after BVDC_ApplyChanges has released the memory from VDC's |
|---|
| 63 | * state |
|---|
| 64 | * |
|---|
| 65 | * 49 3/3/10 3:07p nickh |
|---|
| 66 | * SW7420-565: Refactor dynamic contrast settings and set default dynamic |
|---|
| 67 | * contrast table settings |
|---|
| 68 | * |
|---|
| 69 | * 48 2/9/10 4:52p rjain |
|---|
| 70 | * SW7550-198: For Dual display in Brutus, we need to add 7550 to this |
|---|
| 71 | * chip list |
|---|
| 72 | * |
|---|
| 73 | * 47 12/29/09 12:47p gmohile |
|---|
| 74 | * SW7408-1 : Add 7408 support |
|---|
| 75 | * |
|---|
| 76 | * 46 12/20/09 5:01p randyjew |
|---|
| 77 | * SW7468-6:Add 7468 support |
|---|
| 78 | * |
|---|
| 79 | * 45 11/11/09 6:38p mward |
|---|
| 80 | * SW7400-2606: Sharpness should default to minimum. |
|---|
| 81 | * |
|---|
| 82 | * 44 11/9/09 5:50p mward |
|---|
| 83 | * SW7400-2574: Don't set sharpness config on a window that doesnt' |
|---|
| 84 | * support it. |
|---|
| 85 | * |
|---|
| 86 | * 43 10/23/09 5:49p mward |
|---|
| 87 | * SW7125-45: Enable AdvColorSettings on 7125. |
|---|
| 88 | * |
|---|
| 89 | * 42 9/29/09 10:28a mward |
|---|
| 90 | * SW7125-27: 7125 also has sharpness control only on first window of |
|---|
| 91 | * primary display. |
|---|
| 92 | * |
|---|
| 93 | * 41 9/1/09 5:40p erickson |
|---|
| 94 | * SW7420-303: set dynamic contrast gain shift. comment out unused dynamic |
|---|
| 95 | * contrast settings. |
|---|
| 96 | * |
|---|
| 97 | * 40 8/12/09 10:10p jrubio |
|---|
| 98 | * PR55232: add 7340/7342 support |
|---|
| 99 | * |
|---|
| 100 | * 39 8/10/09 8:17a gmohile |
|---|
| 101 | * PR 56400 : Merge legacy vdc support to main line |
|---|
| 102 | * |
|---|
| 103 | * 38 7/31/09 11:17a gmohile |
|---|
| 104 | * PR 56512 : Add 7403 support |
|---|
| 105 | * |
|---|
| 106 | * 37 6/24/09 3:43p erickson |
|---|
| 107 | * PR56233: extend PEP restriction for CMP0_V0 to 7325 and 7335 |
|---|
| 108 | * |
|---|
| 109 | * 36 6/22/09 4:00p erickson |
|---|
| 110 | * PR56233: remove DTV code. added #error if this code is built for DTV in |
|---|
| 111 | * the future. |
|---|
| 112 | * |
|---|
| 113 | * 35 5/29/09 2:34p jrubio |
|---|
| 114 | * PR55232: fix typo |
|---|
| 115 | * |
|---|
| 116 | * 34 5/29/09 2:26p jrubio |
|---|
| 117 | * PR55232: add 7342/7340 support |
|---|
| 118 | * |
|---|
| 119 | * 33 4/17/09 7:14a erickson |
|---|
| 120 | * PR54147: move large BVDC_ContrastStretch structure off of the stack |
|---|
| 121 | * |
|---|
| 122 | * 32 3/12/09 11:55a nickh |
|---|
| 123 | * PR52746: Use the default dynamic contrast shift value from VDC to |
|---|
| 124 | * adjust the gain to a valid range |
|---|
| 125 | * |
|---|
| 126 | * 31 2/6/09 11:48a jrubio |
|---|
| 127 | * PR51629: add 7336 support |
|---|
| 128 | * |
|---|
| 129 | * 30 12/12/08 4:14p katrep |
|---|
| 130 | * PR48426: fix tnt error for 7405 |
|---|
| 131 | * |
|---|
| 132 | * 29 11/28/08 1:01p nickh |
|---|
| 133 | * PR48963: Add 7420 support |
|---|
| 134 | * |
|---|
| 135 | * 28 11/25/08 8:25p jrubio |
|---|
| 136 | * PR48426: fix TNT error, make sure that 7325/7335 only use main |
|---|
| 137 | * display/main window to set settings |
|---|
| 138 | * |
|---|
| 139 | * 27 11/19/08 6:46p mward |
|---|
| 140 | * PR47739: For 7400 make sure PEP, TNT are used only for first window of |
|---|
| 141 | * HD display. |
|---|
| 142 | * |
|---|
| 143 | * 26 11/14/08 5:44p jgarrett |
|---|
| 144 | * PR 48957: Updating to match new VDC API style |
|---|
| 145 | * |
|---|
| 146 | * 25 9/22/08 12:10p erickson |
|---|
| 147 | * PR47190: added NEXUS_PictureCtrl_SetColorClipSettings |
|---|
| 148 | * |
|---|
| 149 | * 24 9/22/08 10:34a erickson |
|---|
| 150 | * PR46948: merge |
|---|
| 151 | * |
|---|
| 152 | * PR46948/1 9/22/08 2:53p chengs |
|---|
| 153 | * PR46948: Backlight Dimming in Dynamic Contrast code. |
|---|
| 154 | * |
|---|
| 155 | * 23 9/5/08 1:16p erickson |
|---|
| 156 | * PR45897: add dynamic backlight options for panels |
|---|
| 157 | * |
|---|
| 158 | * 22 9/2/08 10:21a erickson |
|---|
| 159 | * PR45181: update hungarian notation change |
|---|
| 160 | * |
|---|
| 161 | * PR45479/1 8/12/08 12:25p chengs |
|---|
| 162 | * PR45479: Updated Dynamic Contrast code. |
|---|
| 163 | * |
|---|
| 164 | * 20 6/26/08 1:21p erickson |
|---|
| 165 | * PR43948: hardcode constrast stretch on for DTV |
|---|
| 166 | * |
|---|
| 167 | * 19 6/26/08 10:20a erickson |
|---|
| 168 | * PR44071: prevent overlap of NEXUS_PictureCtrlCommonSettings.colorTemp |
|---|
| 169 | * and NEXUS_PictureCtrlAdvColorSettings attenuation settings. added |
|---|
| 170 | * enable booleans. |
|---|
| 171 | * |
|---|
| 172 | * 18 6/23/08 4:22p erickson |
|---|
| 173 | * PR43699: Remove VDC Get's from NEXUS GetSettings calls to avoid race |
|---|
| 174 | * conditions |
|---|
| 175 | * |
|---|
| 176 | * 17 6/16/08 4:30p erickson |
|---|
| 177 | * PR43474: roll back merge. feature does not work. |
|---|
| 178 | * |
|---|
| 179 | * 15 5/23/08 10:49a erickson |
|---|
| 180 | * PR42982: rework PQ Dirty logic to reapply settings on channel change |
|---|
| 181 | * |
|---|
| 182 | * 14 5/9/08 3:47p erickson |
|---|
| 183 | * PR42552: readd Display luma stats functions |
|---|
| 184 | * |
|---|
| 185 | * 13 4/30/08 3:08p erickson |
|---|
| 186 | * PR39453: add 3548/3556 features |
|---|
| 187 | * |
|---|
| 188 | * 12 4/10/08 11:07a erickson |
|---|
| 189 | * PR41595: call BVDC_Window_GetLumaStatsConfiguration to init structure |
|---|
| 190 | * |
|---|
| 191 | * 11 4/8/08 3:18p erickson |
|---|
| 192 | * PR39453: add 3548 & 3556 |
|---|
| 193 | * |
|---|
| 194 | * 10 4/3/08 10:47a erickson |
|---|
| 195 | * PR41122: fix B_HAS_LEGACY_VDC |
|---|
| 196 | * |
|---|
| 197 | * 9 4/3/08 10:17a erickson |
|---|
| 198 | * PR41122: move picture quality code to 7400 |
|---|
| 199 | * |
|---|
| 200 | * 8 4/2/08 2:47p erickson |
|---|
| 201 | * PR40950: move PictureCtrl custom data into function params |
|---|
| 202 | * |
|---|
| 203 | * 7 3/31/08 12:32p erickson |
|---|
| 204 | * PR41073: check result of malloc and fail graciously |
|---|
| 205 | * |
|---|
| 206 | * 6 2/29/08 5:39p erickson |
|---|
| 207 | * PR40156: implement ColorMatrix function |
|---|
| 208 | * |
|---|
| 209 | * 5 2/22/08 5:09p erickson |
|---|
| 210 | * PR39738: fix mem leak |
|---|
| 211 | * |
|---|
| 212 | * 4 2/21/08 5:48p erickson |
|---|
| 213 | * PR39003: PQ api change |
|---|
| 214 | * |
|---|
| 215 | * PR38710/1 2/1/08 5:18p chengs |
|---|
| 216 | * PR38710: Rename GreenStretch and BlueStretch to GreenBoost and |
|---|
| 217 | * BlueBoost, support new BlueStretch. |
|---|
| 218 | * |
|---|
| 219 | * 2 1/25/08 9:42a erickson |
|---|
| 220 | * PR39003: adapt to latest VDC |
|---|
| 221 | * |
|---|
| 222 | * 1 1/18/08 2:20p jgarrett |
|---|
| 223 | * PR 38808: Merging to main branch |
|---|
| 224 | * |
|---|
| 225 | * Nexus_Devel/13 1/11/08 11:04a erickson |
|---|
| 226 | * PR36159: refactored LumaStatistics api |
|---|
| 227 | * |
|---|
| 228 | * Nexus_Devel/12 1/8/08 10:57a erickson |
|---|
| 229 | * PR36159: refactor some 3563 Display API's |
|---|
| 230 | * |
|---|
| 231 | * Nexus_Devel/11 12/18/07 1:35p erickson |
|---|
| 232 | * PR38213: analog video input rework |
|---|
| 233 | * |
|---|
| 234 | * Nexus_Devel/10 12/12/07 2:55p gezhang |
|---|
| 235 | * PR36159: Correct "offsetG" and "offsetB" in |
|---|
| 236 | * NEXUS_PictureCtrl_GetAdvColorSettings() |
|---|
| 237 | * |
|---|
| 238 | * Nexus_Devel/9 11/30/07 10:52a erickson |
|---|
| 239 | * PR35457: api update |
|---|
| 240 | * |
|---|
| 241 | * Nexus_Devel/8 11/29/07 2:23p vsilyaev |
|---|
| 242 | * PR 36159: All XXX_GetYYYSettings functions shall return void |
|---|
| 243 | * |
|---|
| 244 | * Nexus_Devel/7 11/29/07 10:57a vsilyaev |
|---|
| 245 | * PR 36159: Use flat structure to control color conversion |
|---|
| 246 | * |
|---|
| 247 | * Nexus_Devel/6 11/29/07 10:33a vsilyaev |
|---|
| 248 | * PR 36159: More renaming of structure members |
|---|
| 249 | * |
|---|
| 250 | * Nexus_Devel/5 11/29/07 10:17a vsilyaev |
|---|
| 251 | * PR 36159: Flattened structure to load custom tables |
|---|
| 252 | * |
|---|
| 253 | * Nexus_Devel/4 11/28/07 5:47p vsilyaev |
|---|
| 254 | * PR 36159: Use fixed point numbers for attenuation |
|---|
| 255 | * |
|---|
| 256 | * Nexus_Devel/3 11/28/07 1:44p vsilyaev |
|---|
| 257 | * PR 36159: Added global UpdateMode, removed per-function ApplyChanges |
|---|
| 258 | * |
|---|
| 259 | * Nexus_Devel/2 11/28/07 9:34a vsilyaev |
|---|
| 260 | * PR36159: Renamed structure members in new API's |
|---|
| 261 | * |
|---|
| 262 | * Nexus_Devel/1 11/26/07 12:47p vsilyaev |
|---|
| 263 | * PR36159: PR36159: Bring up Nexus on 93563 platform |
|---|
| 264 | * |
|---|
| 265 | * Nexus_Devel/PR36159/1 11/26/07 10:06a gezhang |
|---|
| 266 | * PR36159: Bring up Nexus on 93563 platform |
|---|
| 267 | * |
|---|
| 268 | * Nexus_Devel/1 10/18/07 9:59p gezhang |
|---|
| 269 | * PR36159: Bring up Nexus on 93563 platform |
|---|
| 270 | * |
|---|
| 271 | **************************************************************************/ |
|---|
| 272 | #include "nexus_base.h" |
|---|
| 273 | #include "nexus_display_module.h" |
|---|
| 274 | |
|---|
| 275 | BDBG_MODULE(NEXUS_picture_ctrl); |
|---|
| 276 | |
|---|
| 277 | /*=======================data structures===================================*/ |
|---|
| 278 | #define NEXUS_CCB_NUM_GAMMA_VALUE 3 |
|---|
| 279 | #define NEXUS_CCB_NUM_COLOR_TEMP 5 |
|---|
| 280 | |
|---|
| 281 | /*============================private methods====================================*/ |
|---|
| 282 | |
|---|
| 283 | /*************************************************************************** |
|---|
| 284 | Summary: |
|---|
| 285 | Apply the settings set before calling window connected. |
|---|
| 286 | Description: |
|---|
| 287 | VDC Window is created in NEXUS_VideoWindow_P_Setup, "setxxxSettings" |
|---|
| 288 | functions will only take effect after video window connect. |
|---|
| 289 | If you called "setxxxSettings" functions before window connected, |
|---|
| 290 | we will save the settings in the VWIN context and set flags to dirty. |
|---|
| 291 | Then in window connecting, we will call this function to apply the |
|---|
| 292 | dirty settings. |
|---|
| 293 | ****************************************************************************/ |
|---|
| 294 | NEXUS_Error NEXUS_PictureCtrl_P_ApplySetSettings( NEXUS_VideoWindowHandle window ) |
|---|
| 295 | { |
|---|
| 296 | NEXUS_Error rc = NEXUS_SUCCESS; |
|---|
| 297 | NEXUS_PictureCtrlContext *pContext; |
|---|
| 298 | BVDC_Window_Handle windowVDC; |
|---|
| 299 | |
|---|
| 300 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 301 | windowVDC = window->vdcState.window; |
|---|
| 302 | pContext = &(window->picContext); |
|---|
| 303 | |
|---|
| 304 | /* Apply Color settings */ |
|---|
| 305 | if (pContext->bCommonSet) |
|---|
| 306 | { |
|---|
| 307 | rc = NEXUS_PictureCtrl_SetCommonSettings(window, |
|---|
| 308 | &pContext->stCommonSettings |
|---|
| 309 | ); |
|---|
| 310 | if (rc != NEXUS_SUCCESS) return BERR_TRACE(rc); |
|---|
| 311 | } |
|---|
| 312 | |
|---|
| 313 | /* Apply Enhanced Color settings */ |
|---|
| 314 | if (pContext->bAdvColorSet) |
|---|
| 315 | { |
|---|
| 316 | rc = NEXUS_PictureCtrl_SetAdvColorSettings(window, |
|---|
| 317 | &pContext->stAdvColorSettings |
|---|
| 318 | ); |
|---|
| 319 | if (rc != NEXUS_SUCCESS) return BERR_TRACE(rc); |
|---|
| 320 | } |
|---|
| 321 | |
|---|
| 322 | /* Apply customized contrast stretch settings */ |
|---|
| 323 | if (pContext->bCustomContrastSet) |
|---|
| 324 | { |
|---|
| 325 | rc = NEXUS_PictureCtrl_SetCustomContrastStretch(window, |
|---|
| 326 | &pContext->stCustomContrast, |
|---|
| 327 | pContext->customContrastStretchData, |
|---|
| 328 | 0 |
|---|
| 329 | ); |
|---|
| 330 | if (rc != NEXUS_SUCCESS) return BERR_TRACE(rc); |
|---|
| 331 | } |
|---|
| 332 | |
|---|
| 333 | /* Apply customized sharpness settings */ |
|---|
| 334 | if (pContext->bCustomSharpnessSet) |
|---|
| 335 | { |
|---|
| 336 | rc = NEXUS_PictureCtrl_SetSharpnessValue(window, |
|---|
| 337 | &pContext->stCustomSharpness |
|---|
| 338 | ); |
|---|
| 339 | if (rc != NEXUS_SUCCESS) return BERR_TRACE(rc); |
|---|
| 340 | } |
|---|
| 341 | |
|---|
| 342 | /* Apply color management settings */ |
|---|
| 343 | if (pContext->bCmsSet) |
|---|
| 344 | { |
|---|
| 345 | rc = NEXUS_PictureCtrl_SetCmsSettings(window, |
|---|
| 346 | &pContext->stCmsSettings |
|---|
| 347 | ); |
|---|
| 348 | if (rc != NEXUS_SUCCESS) return BERR_TRACE(rc); |
|---|
| 349 | } |
|---|
| 350 | |
|---|
| 351 | /* Apply dither settings */ |
|---|
| 352 | if (pContext->bDitherSet) |
|---|
| 353 | { |
|---|
| 354 | rc = NEXUS_PictureCtrl_SetDitherSettings(window, |
|---|
| 355 | &pContext->stDitherSettings |
|---|
| 356 | ); |
|---|
| 357 | if (rc != NEXUS_SUCCESS) return BERR_TRACE(rc); |
|---|
| 358 | } |
|---|
| 359 | |
|---|
| 360 | return NEXUS_SUCCESS; |
|---|
| 361 | } |
|---|
| 362 | |
|---|
| 363 | |
|---|
| 364 | /*============================public methods====================================*/ |
|---|
| 365 | |
|---|
| 366 | /*************************************************************************** |
|---|
| 367 | Summary: |
|---|
| 368 | Get contrast stretch parameters. |
|---|
| 369 | ****************************************************************************/ |
|---|
| 370 | void |
|---|
| 371 | NEXUS_PictureCtrl_GetContrastStretch( |
|---|
| 372 | NEXUS_VideoWindowHandle window, |
|---|
| 373 | NEXUS_PictureCtrlContrastStretch *pContrast) |
|---|
| 374 | { |
|---|
| 375 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 376 | *pContrast = window->picContext.stCustomContrast; |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | /*************************************************************************** |
|---|
| 380 | Summary: |
|---|
| 381 | Set contrast stretch parameters. |
|---|
| 382 | ****************************************************************************/ |
|---|
| 383 | NEXUS_Error NEXUS_PictureCtrl_SetContrastStretch( NEXUS_VideoWindowHandle window, const NEXUS_PictureCtrlContrastStretch *pContrast) |
|---|
| 384 | { |
|---|
| 385 | return NEXUS_PictureCtrl_SetCustomContrastStretch(window, pContrast, NULL, 0); |
|---|
| 386 | } |
|---|
| 387 | |
|---|
| 388 | NEXUS_Error NEXUS_PictureCtrl_SetCustomContrastStretch( NEXUS_VideoWindowHandle window, const NEXUS_PictureCtrlContrastStretch *pContrast, const int16_t *pTable, unsigned numTableEntries ) |
|---|
| 389 | { |
|---|
| 390 | #if NEXUS_NUM_LAB |
|---|
| 391 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 392 | NEXUS_PictureCtrlContext *pContext; |
|---|
| 393 | BVDC_Window_Handle windowVDC; |
|---|
| 394 | BVDC_ContrastStretch *pVdcContrastStretchSettings; |
|---|
| 395 | void *freeAfter = NULL; |
|---|
| 396 | |
|---|
| 397 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 398 | windowVDC = window->vdcState.window; |
|---|
| 399 | pContext = &(window->picContext); |
|---|
| 400 | BDBG_ASSERT(pContrast); |
|---|
| 401 | |
|---|
| 402 | pContext->bCustomContrastSet = true; |
|---|
| 403 | pContext->stCustomContrast = *pContrast; |
|---|
| 404 | |
|---|
| 405 | if ( !((window->display->index == 0) && (window->windowId == BVDC_WindowId_eVideo0))) { |
|---|
| 406 | /* TODO: if HW doesn't exist, should we really avoid the error? */ |
|---|
| 407 | return 0; |
|---|
| 408 | } |
|---|
| 409 | |
|---|
| 410 | /* NEXUS_PictureCtrl_P_ApplySetSettings might call this function using the already-saved data */ |
|---|
| 411 | if (pContext->customContrastStretchData != pTable || numTableEntries != 0) { |
|---|
| 412 | if (pContext->customContrastStretchData) { |
|---|
| 413 | /* we cannot free pContext->customContrastStretchData because VDC still has the memory. free after BVDC_ApplyChanges. |
|---|
| 414 | if freeAfter is set, we must execute the "done:" code to avoid a KNI leak. */ |
|---|
| 415 | freeAfter = pContext->customContrastStretchData; |
|---|
| 416 | pContext->customContrastStretchData = NULL; |
|---|
| 417 | } |
|---|
| 418 | if (pTable) { |
|---|
| 419 | /* VDC does not copy the data, so we have to. */ |
|---|
| 420 | pContext->customContrastStretchData = BKNI_Malloc(numTableEntries * sizeof(pTable[0])); |
|---|
| 421 | if (!pContext->customContrastStretchData) { |
|---|
| 422 | rc = BERR_TRACE(NEXUS_OUT_OF_SYSTEM_MEMORY); |
|---|
| 423 | goto done; |
|---|
| 424 | } |
|---|
| 425 | BKNI_Memcpy(pContext->customContrastStretchData, pTable, numTableEntries * sizeof(pTable[0])); |
|---|
| 426 | } |
|---|
| 427 | } |
|---|
| 428 | |
|---|
| 429 | if (NULL == windowVDC || g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 430 | rc = NEXUS_SUCCESS; |
|---|
| 431 | goto done; |
|---|
| 432 | } |
|---|
| 433 | |
|---|
| 434 | pVdcContrastStretchSettings = BKNI_Malloc(sizeof(BVDC_ContrastStretch)); |
|---|
| 435 | if (!pVdcContrastStretchSettings) { |
|---|
| 436 | rc = BERR_TRACE(NEXUS_OUT_OF_SYSTEM_MEMORY); |
|---|
| 437 | goto done; |
|---|
| 438 | } |
|---|
| 439 | |
|---|
| 440 | rc = BVDC_Window_GetContrastStretch(windowVDC, pVdcContrastStretchSettings); |
|---|
| 441 | if (rc) { |
|---|
| 442 | BKNI_Free(pVdcContrastStretchSettings); |
|---|
| 443 | rc = BERR_TRACE(rc); |
|---|
| 444 | goto done; |
|---|
| 445 | } |
|---|
| 446 | |
|---|
| 447 | pVdcContrastStretchSettings->iGain = pContrast->gain; |
|---|
| 448 | pVdcContrastStretchSettings->ulShift = pContrast->gainShift; |
|---|
| 449 | |
|---|
| 450 | BDBG_CASSERT(sizeof(pVdcContrastStretchSettings->aulDcTable1) == sizeof(window->picContext.stCustomContrast.dcTable1)); |
|---|
| 451 | BKNI_Memcpy(&pVdcContrastStretchSettings->aulDcTable1[0], &window->picContext.stCustomContrast.dcTable1[0], sizeof(pVdcContrastStretchSettings->aulDcTable1)); |
|---|
| 452 | pVdcContrastStretchSettings->bInterpolateTables = false; |
|---|
| 453 | BDBG_CASSERT(sizeof(pVdcContrastStretchSettings->alIreTable) == sizeof(window->picContext.stCustomContrast.ireTable)); |
|---|
| 454 | BKNI_Memcpy(&pVdcContrastStretchSettings->alIreTable[0], &window->picContext.stCustomContrast.ireTable[0], sizeof(pVdcContrastStretchSettings->alIreTable)); |
|---|
| 455 | |
|---|
| 456 | #if 0 |
|---|
| 457 | /* unused */ |
|---|
| 458 | pVdcContrastStretchSettings->iFilterNum = pContrast->filterNum; |
|---|
| 459 | pVdcContrastStretchSettings->iFilterDenom = pContrast->filterDenom; |
|---|
| 460 | pVdcContrastStretchSettings->iDynContrastBlackGain = pContrast->dynamicContrastBlackGain; |
|---|
| 461 | pVdcContrastStretchSettings->iDynContrastWhiteGain = pContrast->dynamicContrastWhiteGain; |
|---|
| 462 | pVdcContrastStretchSettings->uiDynContrastBlackLimit = pContrast->dynamicContrastBlackLimit; |
|---|
| 463 | pVdcContrastStretchSettings->uiDynContrastWhiteLimit = pContrast->dynamicContrastWhiteLimit; |
|---|
| 464 | pVdcContrastStretchSettings->uiDynContrastEstCurMaxPt = pContrast->dynamicContrastEstCurMaxPt; |
|---|
| 465 | pVdcContrastStretchSettings->uiDynContrastEstCurMinPt = pContrast->dynamicContrastEstCurMinPt; |
|---|
| 466 | #endif |
|---|
| 467 | pVdcContrastStretchSettings->pvCustomParams = pContext->customContrastStretchData; |
|---|
| 468 | pVdcContrastStretchSettings->pfCallback = NULL; |
|---|
| 469 | |
|---|
| 470 | rc = BVDC_Window_SetContrastStretch(windowVDC, pVdcContrastStretchSettings); |
|---|
| 471 | if (rc) { |
|---|
| 472 | BKNI_Free(pVdcContrastStretchSettings); |
|---|
| 473 | rc = BERR_TRACE(rc); |
|---|
| 474 | goto done; |
|---|
| 475 | } |
|---|
| 476 | BKNI_Free(pVdcContrastStretchSettings); |
|---|
| 477 | |
|---|
| 478 | /* TODO: use pContrast->enabled instead? */ |
|---|
| 479 | if(pContrast->gain==0&&pContrast->dynamicContrastBlackGain==0&&pContrast->dynamicContrastWhiteGain==0) |
|---|
| 480 | rc = BVDC_Window_EnableContrastStretch(windowVDC, false); |
|---|
| 481 | else |
|---|
| 482 | rc = BVDC_Window_EnableContrastStretch(windowVDC, true); |
|---|
| 483 | if (rc) { |
|---|
| 484 | rc = BERR_TRACE(rc); |
|---|
| 485 | goto done; |
|---|
| 486 | } |
|---|
| 487 | |
|---|
| 488 | if (freeAfter) { |
|---|
| 489 | /* This NEXUS_Display_P_ApplyChanges must take effect if freeAfter is set. */ |
|---|
| 490 | if(g_NEXUS_DisplayModule_State.updateMode != NEXUS_DisplayUpdateMode_eAuto) { rc = BERR_TRACE(NEXUS_NOT_SUPPORTED);} /* fall through */ |
|---|
| 491 | |
|---|
| 492 | rc = BVDC_ApplyChanges(g_NEXUS_DisplayModule_State.vdc); |
|---|
| 493 | if (rc) { |
|---|
| 494 | rc = BERR_TRACE(rc); |
|---|
| 495 | goto done; |
|---|
| 496 | } |
|---|
| 497 | } |
|---|
| 498 | else { |
|---|
| 499 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 500 | if (rc) { |
|---|
| 501 | rc = BERR_TRACE(rc); |
|---|
| 502 | goto done; |
|---|
| 503 | } |
|---|
| 504 | } |
|---|
| 505 | |
|---|
| 506 | done: |
|---|
| 507 | if (freeAfter) { |
|---|
| 508 | BKNI_Free(freeAfter); |
|---|
| 509 | } |
|---|
| 510 | return rc; |
|---|
| 511 | #else |
|---|
| 512 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 513 | BSTD_UNUSED(pContrast); |
|---|
| 514 | BSTD_UNUSED(pTable); |
|---|
| 515 | BSTD_UNUSED(numTableEntries); |
|---|
| 516 | return BERR_SUCCESS; |
|---|
| 517 | #endif |
|---|
| 518 | } |
|---|
| 519 | |
|---|
| 520 | /*************************************************************************** |
|---|
| 521 | Summary: |
|---|
| 522 | Get customer sharpness setting registers. |
|---|
| 523 | ****************************************************************************/ |
|---|
| 524 | void NEXUS_PictureCtrl_GetSharpnessValue( NEXUS_VideoWindowHandle window, NEXUS_PictureCtrlSharpnessValue *pSettings) |
|---|
| 525 | { |
|---|
| 526 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 527 | *pSettings = window->picContext.stCustomSharpness; |
|---|
| 528 | } |
|---|
| 529 | |
|---|
| 530 | /*************************************************************************** |
|---|
| 531 | Summary: |
|---|
| 532 | Load customer sharpness setting registers. |
|---|
| 533 | ****************************************************************************/ |
|---|
| 534 | NEXUS_Error NEXUS_PictureCtrl_SetSharpnessValue( NEXUS_VideoWindowHandle window, const NEXUS_PictureCtrlSharpnessValue *pData ) |
|---|
| 535 | { |
|---|
| 536 | #if NEXUS_HAS_TNT |
|---|
| 537 | NEXUS_PictureCtrlContext *pContext; |
|---|
| 538 | BVDC_Window_Handle windowVDC; |
|---|
| 539 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 540 | BVDC_SharpnessSettings sharpnessCfg; |
|---|
| 541 | bool enable = false; |
|---|
| 542 | int16_t sharpness; |
|---|
| 543 | |
|---|
| 544 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 545 | windowVDC = window->vdcState.window; |
|---|
| 546 | pContext = &(window->picContext); |
|---|
| 547 | BDBG_ASSERT(pData); |
|---|
| 548 | |
|---|
| 549 | if ( (window->display->index == 0) && (window->windowId == BVDC_WindowId_eVideo0)) |
|---|
| 550 | { |
|---|
| 551 | |
|---|
| 552 | pContext->bCustomSharpnessSet = true; |
|---|
| 553 | pContext->stCustomSharpness = *pData; |
|---|
| 554 | |
|---|
| 555 | if (NULL == windowVDC || g_NEXUS_DisplayModule_State.pqDisabled) |
|---|
| 556 | { |
|---|
| 557 | return NEXUS_SUCCESS; |
|---|
| 558 | } |
|---|
| 559 | |
|---|
| 560 | rc = BVDC_Window_GetSharpnessConfig(windowVDC, |
|---|
| 561 | &sharpnessCfg); |
|---|
| 562 | if (rc) return BERR_TRACE(rc); |
|---|
| 563 | |
|---|
| 564 | /* update customer settings */ |
|---|
| 565 | sharpnessCfg.ulLumaCtrlCore = pData->lumaControlCore; |
|---|
| 566 | sharpnessCfg.ulLumaCtrlGain = pData->lumaControlGain; |
|---|
| 567 | sharpnessCfg.ulLumaCtrlBlur = pData->lumaControlBlur; |
|---|
| 568 | sharpnessCfg.bLumaCtrlSoften = pData->lumaCtrlSoften; |
|---|
| 569 | sharpnessCfg.bLumaCtrlHOnly = pData->lumaCtrlHOnly; |
|---|
| 570 | sharpnessCfg.ulLumaPeakingHAvoid = pData->lumaPeakingHAvoid; |
|---|
| 571 | sharpnessCfg.ulLumaPeakingVAvoid = pData->lumaPeakingVAvoid; |
|---|
| 572 | sharpnessCfg.ulLumaPeakingPeakLimit = pData->lumaPeakingPeakLimit; |
|---|
| 573 | sharpnessCfg.ulLumaPeakingPeakValue = pData->lumaPeakingPeakValue; |
|---|
| 574 | sharpnessCfg.ulChromaCtrlCore = pData->chromaControlCore; |
|---|
| 575 | sharpnessCfg.bChromaCtrlWideChroma = pData->chromaCtrlWideChroma; |
|---|
| 576 | sharpnessCfg.ulChromaCtrlFalseColor = pData->chromaControlFalseColor; |
|---|
| 577 | sharpnessCfg.ulChromaCtrlGain = pData->chromaControlGain; |
|---|
| 578 | sharpnessCfg.bChromaCtrlHOnly = pData->chromaCtrlHOnly; |
|---|
| 579 | sharpnessCfg.ulWideLumaCtrlCore = pData->wideLumaControlCore; |
|---|
| 580 | sharpnessCfg.ulWideLumaCtrlMode = pData->wideLumaControlMode; |
|---|
| 581 | if (pData->enable == true) |
|---|
| 582 | { |
|---|
| 583 | rc = BVDC_Window_SetSharpnessConfig(windowVDC, |
|---|
| 584 | &sharpnessCfg); |
|---|
| 585 | } |
|---|
| 586 | else |
|---|
| 587 | { |
|---|
| 588 | /* use "NULL" to disable customized sharpness */ |
|---|
| 589 | rc = BVDC_Window_SetSharpnessConfig(windowVDC, |
|---|
| 590 | NULL); |
|---|
| 591 | } |
|---|
| 592 | if (rc != BERR_SUCCESS) |
|---|
| 593 | { |
|---|
| 594 | rc = BERR_TRACE(rc); |
|---|
| 595 | return NEXUS_UNKNOWN; |
|---|
| 596 | } |
|---|
| 597 | |
|---|
| 598 | /* BVDC_Window_SetSharpness() must be called for customized |
|---|
| 599 | * sharpness settings to take effect. */ |
|---|
| 600 | rc = BVDC_Window_GetSharpness(windowVDC, |
|---|
| 601 | &enable, |
|---|
| 602 | &sharpness); |
|---|
| 603 | if (rc != BERR_SUCCESS) |
|---|
| 604 | { |
|---|
| 605 | rc = BERR_TRACE(rc); |
|---|
| 606 | return NEXUS_UNKNOWN; |
|---|
| 607 | } |
|---|
| 608 | |
|---|
| 609 | rc = BVDC_Window_SetSharpness(windowVDC, |
|---|
| 610 | pData->enable, |
|---|
| 611 | sharpness); |
|---|
| 612 | if (rc != BERR_SUCCESS) |
|---|
| 613 | { |
|---|
| 614 | rc = BERR_TRACE(rc); |
|---|
| 615 | return NEXUS_UNKNOWN; |
|---|
| 616 | } |
|---|
| 617 | |
|---|
| 618 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 619 | if (rc) return BERR_TRACE(rc); |
|---|
| 620 | } |
|---|
| 621 | |
|---|
| 622 | return NEXUS_SUCCESS; |
|---|
| 623 | #else |
|---|
| 624 | BSTD_UNUSED(window); |
|---|
| 625 | BSTD_UNUSED(pData); |
|---|
| 626 | return BERR_TRACE(NEXUS_NOT_SUPPORTED); |
|---|
| 627 | #endif |
|---|
| 628 | } |
|---|
| 629 | |
|---|
| 630 | |
|---|
| 631 | /*************************************************************************** |
|---|
| 632 | Summary: |
|---|
| 633 | Get color configurations. |
|---|
| 634 | ****************************************************************************/ |
|---|
| 635 | void |
|---|
| 636 | NEXUS_PictureCtrl_GetCommonSettings( |
|---|
| 637 | NEXUS_VideoWindowHandle window, |
|---|
| 638 | NEXUS_PictureCtrlCommonSettings *pSettings) |
|---|
| 639 | { |
|---|
| 640 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 641 | *pSettings = window->picContext.stCommonSettings; |
|---|
| 642 | } |
|---|
| 643 | |
|---|
| 644 | /*************************************************************************** |
|---|
| 645 | Summary: |
|---|
| 646 | Set color configurations. |
|---|
| 647 | ****************************************************************************/ |
|---|
| 648 | NEXUS_Error |
|---|
| 649 | NEXUS_PictureCtrl_SetCommonSettings( |
|---|
| 650 | NEXUS_VideoWindowHandle window, |
|---|
| 651 | const NEXUS_PictureCtrlCommonSettings *pSettings |
|---|
| 652 | ) |
|---|
| 653 | { |
|---|
| 654 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 655 | NEXUS_PictureCtrlContext *pContext; |
|---|
| 656 | BVDC_Window_Handle windowVDC; |
|---|
| 657 | |
|---|
| 658 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 659 | windowVDC = window->vdcState.window; |
|---|
| 660 | pContext = &(window->picContext); |
|---|
| 661 | BDBG_ASSERT(pSettings); |
|---|
| 662 | |
|---|
| 663 | pContext->bCommonSet = true; |
|---|
| 664 | pContext->stCommonSettings = *pSettings; |
|---|
| 665 | |
|---|
| 666 | if (NULL == windowVDC || g_NEXUS_DisplayModule_State.pqDisabled) |
|---|
| 667 | { |
|---|
| 668 | return NEXUS_SUCCESS; |
|---|
| 669 | } |
|---|
| 670 | |
|---|
| 671 | rc = BVDC_Window_SetContrast(windowVDC, pSettings->contrast); |
|---|
| 672 | if (rc) return BERR_TRACE(rc); |
|---|
| 673 | |
|---|
| 674 | rc = BVDC_Window_SetSaturation(windowVDC, pSettings->saturation); |
|---|
| 675 | if (rc) return BERR_TRACE(rc); |
|---|
| 676 | |
|---|
| 677 | rc = BVDC_Window_SetHue(windowVDC, pSettings->hue); |
|---|
| 678 | if (rc) return BERR_TRACE(rc); |
|---|
| 679 | |
|---|
| 680 | rc = BVDC_Window_SetBrightness(windowVDC, pSettings->brightness); |
|---|
| 681 | if (rc) return BERR_TRACE(rc); |
|---|
| 682 | |
|---|
| 683 | #if NEXUS_HAS_TNT |
|---|
| 684 | /* Pending PR49461, Check for 1st window of primary display */ |
|---|
| 685 | if ( (window->display->index == 0) && (window->windowId == BVDC_WindowId_eVideo0)) |
|---|
| 686 | { |
|---|
| 687 | rc = BVDC_Window_SetSharpness(windowVDC,true, pSettings->sharpness); /* once to set the value */ |
|---|
| 688 | if (pSettings->sharpness == -32768) |
|---|
| 689 | { |
|---|
| 690 | rc = BVDC_Window_SetSharpness(windowVDC,false, pSettings->sharpness); /* again to disable, if value is min. */ |
|---|
| 691 | } |
|---|
| 692 | if (rc) return BERR_TRACE(rc); |
|---|
| 693 | } |
|---|
| 694 | #endif |
|---|
| 695 | |
|---|
| 696 | #ifndef B_HAS_LEGACY_VDC |
|---|
| 697 | if (pSettings->colorTempEnabled) { |
|---|
| 698 | rc = BVDC_Window_SetColorTemp(windowVDC, pSettings->colorTemp); |
|---|
| 699 | if (rc) return BERR_TRACE(rc); |
|---|
| 700 | } |
|---|
| 701 | #endif |
|---|
| 702 | |
|---|
| 703 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 704 | if (rc) return BERR_TRACE(rc); |
|---|
| 705 | |
|---|
| 706 | return NEXUS_SUCCESS; |
|---|
| 707 | } |
|---|
| 708 | |
|---|
| 709 | /*************************************************************************** |
|---|
| 710 | Summary: |
|---|
| 711 | Get enhanced color configurations. |
|---|
| 712 | ****************************************************************************/ |
|---|
| 713 | void |
|---|
| 714 | NEXUS_PictureCtrl_GetAdvColorSettings( |
|---|
| 715 | NEXUS_VideoWindowHandle window, |
|---|
| 716 | NEXUS_PictureCtrlAdvColorSettings *pSettings) |
|---|
| 717 | { |
|---|
| 718 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 719 | *pSettings = window->picContext.stAdvColorSettings; |
|---|
| 720 | } |
|---|
| 721 | |
|---|
| 722 | #define NEXUS_P_ATTENUATION_LIMIT(a) (((a)<NEXUS_PICTURE_ATTENUATION_BASE) ? (a) : NEXUS_PICTURE_ATTENUATION_BASE) |
|---|
| 723 | |
|---|
| 724 | /*************************************************************************** |
|---|
| 725 | Summary: |
|---|
| 726 | Set enhanced color configurations. |
|---|
| 727 | ****************************************************************************/ |
|---|
| 728 | NEXUS_Error NEXUS_PictureCtrl_SetAdvColorSettings( NEXUS_VideoWindowHandle window, const NEXUS_PictureCtrlAdvColorSettings *pSettings ) |
|---|
| 729 | { |
|---|
| 730 | #if !B_HAS_LEGACY_VDC && NEXUS_NUM_CAB |
|---|
| 731 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 732 | NEXUS_PictureCtrlContext *pContext; |
|---|
| 733 | BVDC_Window_Handle windowVDC; |
|---|
| 734 | BVDC_BlueStretch stBlueStretchSettings; |
|---|
| 735 | |
|---|
| 736 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 737 | windowVDC = window->vdcState.window; |
|---|
| 738 | pContext = &(window->picContext); |
|---|
| 739 | BDBG_ASSERT(pSettings); |
|---|
| 740 | |
|---|
| 741 | /* Pending PR49461, Check for 1st window of primary display */ |
|---|
| 742 | if ( (window->display->index == 0) && (window->windowId == BVDC_WindowId_eVideo0)) |
|---|
| 743 | { |
|---|
| 744 | pContext->bAdvColorSet = true; |
|---|
| 745 | pContext->stAdvColorSettings = *pSettings; |
|---|
| 746 | |
|---|
| 747 | if (NULL == windowVDC || g_NEXUS_DisplayModule_State.pqDisabled) |
|---|
| 748 | { |
|---|
| 749 | return NEXUS_SUCCESS; |
|---|
| 750 | } |
|---|
| 751 | |
|---|
| 752 | if (pSettings->attenuationRbgEnabled) { |
|---|
| 753 | int32_t lAttenuationR, lAttenuationG, lAttenuationB; |
|---|
| 754 | lAttenuationR = NEXUS_P_ATTENUATION_LIMIT(pSettings->attenuationR); |
|---|
| 755 | lAttenuationG = NEXUS_P_ATTENUATION_LIMIT(pSettings->attenuationG); |
|---|
| 756 | lAttenuationB = NEXUS_P_ATTENUATION_LIMIT(pSettings->attenuationB); |
|---|
| 757 | |
|---|
| 758 | rc = BVDC_Window_SetAttenuationRGB(windowVDC, |
|---|
| 759 | lAttenuationR, |
|---|
| 760 | lAttenuationG, |
|---|
| 761 | lAttenuationB, |
|---|
| 762 | pSettings->offsetR, |
|---|
| 763 | pSettings->offsetG, |
|---|
| 764 | pSettings->offsetB); |
|---|
| 765 | if (rc) return BERR_TRACE(rc); |
|---|
| 766 | } |
|---|
| 767 | |
|---|
| 768 | /* load CAB table */ |
|---|
| 769 | rc = BVDC_Window_SetAutoFlesh(windowVDC, |
|---|
| 770 | pSettings->fleshTone); |
|---|
| 771 | if (rc) return BERR_TRACE(rc); |
|---|
| 772 | |
|---|
| 773 | rc = BVDC_Window_SetGreenBoost(windowVDC, |
|---|
| 774 | pSettings->greenBoost); |
|---|
| 775 | if (rc) return BERR_TRACE(rc); |
|---|
| 776 | |
|---|
| 777 | rc = BVDC_Window_SetBlueBoost(windowVDC, |
|---|
| 778 | pSettings->blueBoost); |
|---|
| 779 | if (rc) return BERR_TRACE(rc); |
|---|
| 780 | |
|---|
| 781 | stBlueStretchSettings.ulBlueStretchOffset = pSettings->blueStretchSettings.blueStretchOffset; |
|---|
| 782 | stBlueStretchSettings.ulBlueStretchSlope = pSettings->blueStretchSettings.blueStretchSlope; |
|---|
| 783 | rc = BVDC_Window_SetBlueStretch(windowVDC, |
|---|
| 784 | &stBlueStretchSettings); |
|---|
| 785 | if (rc) return BERR_TRACE(rc); |
|---|
| 786 | |
|---|
| 787 | |
|---|
| 788 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 789 | if (rc) return BERR_TRACE(rc); |
|---|
| 790 | |
|---|
| 791 | } |
|---|
| 792 | #else |
|---|
| 793 | BSTD_UNUSED(window); |
|---|
| 794 | BSTD_UNUSED(pSettings); |
|---|
| 795 | #endif |
|---|
| 796 | |
|---|
| 797 | return NEXUS_SUCCESS; |
|---|
| 798 | } |
|---|
| 799 | |
|---|
| 800 | /*************************************************************************** |
|---|
| 801 | Summary: |
|---|
| 802 | Get CMS control Settings. |
|---|
| 803 | ****************************************************************************/ |
|---|
| 804 | void |
|---|
| 805 | NEXUS_PictureCtrl_GetCmsSettings( |
|---|
| 806 | NEXUS_VideoWindowHandle window, |
|---|
| 807 | NEXUS_PictureCtrlCmsSettings *pSettings) |
|---|
| 808 | { |
|---|
| 809 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 810 | *pSettings = window->picContext.stCmsSettings; |
|---|
| 811 | } |
|---|
| 812 | |
|---|
| 813 | /*************************************************************************** |
|---|
| 814 | Summary: |
|---|
| 815 | Set CMS control Settings. |
|---|
| 816 | ****************************************************************************/ |
|---|
| 817 | NEXUS_Error |
|---|
| 818 | NEXUS_PictureCtrl_SetCmsSettings( |
|---|
| 819 | NEXUS_VideoWindowHandle window, |
|---|
| 820 | const NEXUS_PictureCtrlCmsSettings *pSettings |
|---|
| 821 | ) |
|---|
| 822 | { |
|---|
| 823 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 824 | #ifndef B_HAS_LEGACY_VDC |
|---|
| 825 | NEXUS_PictureCtrlContext *pContext; |
|---|
| 826 | BVDC_Window_Handle windowVDC; |
|---|
| 827 | BVDC_ColorBar hueGain, saturationGain; |
|---|
| 828 | |
|---|
| 829 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 830 | windowVDC = window->vdcState.window; |
|---|
| 831 | pContext = &(window->picContext); |
|---|
| 832 | BDBG_ASSERT(pSettings); |
|---|
| 833 | |
|---|
| 834 | pContext->bCmsSet = true; |
|---|
| 835 | pContext->stCmsSettings = *pSettings; |
|---|
| 836 | |
|---|
| 837 | if (NULL == windowVDC || g_NEXUS_DisplayModule_State.pqDisabled) |
|---|
| 838 | { |
|---|
| 839 | return NEXUS_SUCCESS; |
|---|
| 840 | } |
|---|
| 841 | |
|---|
| 842 | hueGain.lRed = pSettings->hueGain.red; |
|---|
| 843 | hueGain.lGreen = pSettings->hueGain.green; |
|---|
| 844 | hueGain.lBlue = pSettings->hueGain.blue; |
|---|
| 845 | hueGain.lCyan = pSettings->hueGain.cyan; |
|---|
| 846 | hueGain.lMagenta = pSettings->hueGain.magenta; |
|---|
| 847 | hueGain.lYellow = pSettings->hueGain.yellow; |
|---|
| 848 | saturationGain.lRed = pSettings->saturationGain.red; |
|---|
| 849 | saturationGain.lGreen = pSettings->saturationGain.green; |
|---|
| 850 | saturationGain.lBlue = pSettings->saturationGain.blue; |
|---|
| 851 | saturationGain.lCyan = pSettings->saturationGain.cyan; |
|---|
| 852 | saturationGain.lMagenta = pSettings->saturationGain.magenta; |
|---|
| 853 | saturationGain.lYellow = pSettings->saturationGain.yellow; |
|---|
| 854 | |
|---|
| 855 | rc = BVDC_Window_SetCmsControl(windowVDC, |
|---|
| 856 | &saturationGain, |
|---|
| 857 | &hueGain); |
|---|
| 858 | if (rc != BERR_SUCCESS) |
|---|
| 859 | { |
|---|
| 860 | rc = BERR_TRACE(rc); |
|---|
| 861 | return NEXUS_UNKNOWN; |
|---|
| 862 | } |
|---|
| 863 | |
|---|
| 864 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 865 | if (rc) return BERR_TRACE(rc); |
|---|
| 866 | |
|---|
| 867 | #else |
|---|
| 868 | BSTD_UNUSED(window); |
|---|
| 869 | BSTD_UNUSED(pSettings); |
|---|
| 870 | #endif |
|---|
| 871 | return rc; |
|---|
| 872 | } |
|---|
| 873 | |
|---|
| 874 | /*************************************************************************** |
|---|
| 875 | Summary: |
|---|
| 876 | Get current window dither configurations. |
|---|
| 877 | ****************************************************************************/ |
|---|
| 878 | void |
|---|
| 879 | NEXUS_PictureCtrl_GetDitherSettings( |
|---|
| 880 | NEXUS_VideoWindowHandle window, |
|---|
| 881 | NEXUS_PictureCtrlDitherSettings *pSettings) |
|---|
| 882 | { |
|---|
| 883 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 884 | *pSettings = window->picContext.stDitherSettings; |
|---|
| 885 | } |
|---|
| 886 | |
|---|
| 887 | /*************************************************************************** |
|---|
| 888 | Summary: |
|---|
| 889 | Set Dither configurations. |
|---|
| 890 | ****************************************************************************/ |
|---|
| 891 | NEXUS_Error |
|---|
| 892 | NEXUS_PictureCtrl_SetDitherSettings( |
|---|
| 893 | NEXUS_VideoWindowHandle window, |
|---|
| 894 | const NEXUS_PictureCtrlDitherSettings *pSettings |
|---|
| 895 | ) |
|---|
| 896 | { |
|---|
| 897 | #ifndef B_HAS_LEGACY_VDC |
|---|
| 898 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 899 | NEXUS_PictureCtrlContext *pContext; |
|---|
| 900 | BVDC_Window_Handle windowVDC; |
|---|
| 901 | BVDC_DitherSettings ditherSettings; |
|---|
| 902 | |
|---|
| 903 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 904 | windowVDC = window->vdcState.window; |
|---|
| 905 | pContext = &(window->picContext); |
|---|
| 906 | BDBG_ASSERT(pSettings); |
|---|
| 907 | |
|---|
| 908 | pContext->bDitherSet = true; |
|---|
| 909 | pContext->stDitherSettings = *pSettings; |
|---|
| 910 | |
|---|
| 911 | if (NULL == windowVDC || g_NEXUS_DisplayModule_State.pqDisabled) |
|---|
| 912 | { |
|---|
| 913 | return NEXUS_SUCCESS; |
|---|
| 914 | } |
|---|
| 915 | |
|---|
| 916 | ditherSettings.bReduceSmooth = pSettings->reduceSmooth; |
|---|
| 917 | ditherSettings.bSmoothEnable = pSettings->smoothEnable; |
|---|
| 918 | ditherSettings.ulSmoothLimit = pSettings->smoothLimit; |
|---|
| 919 | rc = BVDC_Window_SetDitherConfiguration(windowVDC, |
|---|
| 920 | &ditherSettings); |
|---|
| 921 | if (rc != BERR_SUCCESS) |
|---|
| 922 | { |
|---|
| 923 | rc = BERR_TRACE(rc); |
|---|
| 924 | return NEXUS_UNKNOWN; |
|---|
| 925 | } |
|---|
| 926 | |
|---|
| 927 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 928 | if (rc) return BERR_TRACE(rc); |
|---|
| 929 | #else |
|---|
| 930 | BSTD_UNUSED(window); |
|---|
| 931 | BSTD_UNUSED(pSettings); |
|---|
| 932 | #endif |
|---|
| 933 | |
|---|
| 934 | return NEXUS_SUCCESS; |
|---|
| 935 | } |
|---|
| 936 | |
|---|
| 937 | /*************************************************************************** |
|---|
| 938 | Summary: |
|---|
| 939 | This function loads the CAB table. |
|---|
| 940 | **************************************************************************/ |
|---|
| 941 | NEXUS_Error NEXUS_PictureCtrl_LoadCabTable( NEXUS_VideoWindowHandle window, const uint32_t *pTable, unsigned numTableEntries, unsigned offset ) |
|---|
| 942 | { |
|---|
| 943 | #if NEXUS_HAS_PEP |
|---|
| 944 | BVDC_Window_Handle windowVDC; |
|---|
| 945 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 946 | |
|---|
| 947 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 948 | windowVDC = window->vdcState.window; |
|---|
| 949 | |
|---|
| 950 | if (NULL == windowVDC) |
|---|
| 951 | { |
|---|
| 952 | BDBG_ERR(("VideoWindow must have VideoInput connected to load CAB table")); |
|---|
| 953 | return BERR_TRACE(NEXUS_UNKNOWN); |
|---|
| 954 | } |
|---|
| 955 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 956 | return 0; |
|---|
| 957 | } |
|---|
| 958 | |
|---|
| 959 | if (pTable && numTableEntries > 0) |
|---|
| 960 | { |
|---|
| 961 | rc = BVDC_Window_LoadCabTable(windowVDC, pTable, offset, numTableEntries); |
|---|
| 962 | if (rc) return BERR_TRACE(rc); |
|---|
| 963 | } |
|---|
| 964 | else |
|---|
| 965 | { |
|---|
| 966 | rc = BVDC_Window_LoadCabTable(windowVDC, NULL, 0, 0); |
|---|
| 967 | if (rc) return BERR_TRACE(rc); |
|---|
| 968 | } |
|---|
| 969 | |
|---|
| 970 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 971 | if (rc) return BERR_TRACE(rc); |
|---|
| 972 | |
|---|
| 973 | return NEXUS_SUCCESS; |
|---|
| 974 | #else |
|---|
| 975 | BSTD_UNUSED(window); |
|---|
| 976 | BSTD_UNUSED(pTable); |
|---|
| 977 | BSTD_UNUSED(numTableEntries); |
|---|
| 978 | BSTD_UNUSED(offset); |
|---|
| 979 | return BERR_TRACE(NEXUS_NOT_SUPPORTED); |
|---|
| 980 | #endif |
|---|
| 981 | } |
|---|
| 982 | |
|---|
| 983 | /*************************************************************************** |
|---|
| 984 | Summary: |
|---|
| 985 | This function loads the LAB table. |
|---|
| 986 | ****************************************************************************/ |
|---|
| 987 | NEXUS_Error NEXUS_PictureCtrl_LoadLabTable( NEXUS_VideoWindowHandle window, const uint32_t *pTable, unsigned numTableEntries, unsigned offset ) |
|---|
| 988 | { |
|---|
| 989 | #if NEXUS_HAS_PEP |
|---|
| 990 | BVDC_Window_Handle windowVDC; |
|---|
| 991 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 992 | |
|---|
| 993 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 994 | windowVDC = window->vdcState.window; |
|---|
| 995 | |
|---|
| 996 | if (NULL == windowVDC) |
|---|
| 997 | { |
|---|
| 998 | BDBG_ERR(("VideoWindow must have VideoInput connected to load LAB table")); |
|---|
| 999 | return BERR_TRACE(NEXUS_UNKNOWN); |
|---|
| 1000 | } |
|---|
| 1001 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 1002 | return 0; |
|---|
| 1003 | } |
|---|
| 1004 | |
|---|
| 1005 | if (pTable && numTableEntries > 0) |
|---|
| 1006 | { |
|---|
| 1007 | rc = BVDC_Window_LoadLabTable(windowVDC, pTable, offset, numTableEntries); |
|---|
| 1008 | if (rc) return BERR_TRACE(rc); |
|---|
| 1009 | } |
|---|
| 1010 | else |
|---|
| 1011 | { |
|---|
| 1012 | rc = BVDC_Window_LoadLabTable(windowVDC, NULL, 0, 0); |
|---|
| 1013 | if (rc) return BERR_TRACE(rc); |
|---|
| 1014 | } |
|---|
| 1015 | |
|---|
| 1016 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 1017 | if (rc) return BERR_TRACE(rc); |
|---|
| 1018 | |
|---|
| 1019 | return NEXUS_SUCCESS; |
|---|
| 1020 | #else |
|---|
| 1021 | BSTD_UNUSED(window); |
|---|
| 1022 | BSTD_UNUSED(pTable); |
|---|
| 1023 | BSTD_UNUSED(numTableEntries); |
|---|
| 1024 | BSTD_UNUSED(offset); |
|---|
| 1025 | return BERR_TRACE(NEXUS_NOT_SUPPORTED); |
|---|
| 1026 | #endif |
|---|
| 1027 | } |
|---|
| 1028 | |
|---|
| 1029 | NEXUS_Error |
|---|
| 1030 | NEXUS_PictureCtrl_ConfigDisplayLumaStatistics( |
|---|
| 1031 | NEXUS_DisplayHandle display, |
|---|
| 1032 | const NEXUS_ClipRect *pRect) |
|---|
| 1033 | { |
|---|
| 1034 | #if !B_HAS_LEGACY_VDC && BCHP_CHIP!= 7403 |
|---|
| 1035 | BVDC_LumaSettings lumaSettings; |
|---|
| 1036 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 1037 | |
|---|
| 1038 | BDBG_OBJECT_ASSERT(display, NEXUS_Display); |
|---|
| 1039 | |
|---|
| 1040 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 1041 | return 0; |
|---|
| 1042 | } |
|---|
| 1043 | |
|---|
| 1044 | BVDC_Compositor_GetLumaStatsConfiguration(display->compositor, &lumaSettings); |
|---|
| 1045 | |
|---|
| 1046 | lumaSettings.stRegion.ulLeft = pRect->left; |
|---|
| 1047 | lumaSettings.stRegion.ulTop = pRect->top; |
|---|
| 1048 | lumaSettings.stRegion.ulRight = pRect->right; |
|---|
| 1049 | lumaSettings.stRegion.ulBottom = pRect->bottom; |
|---|
| 1050 | |
|---|
| 1051 | rc = BVDC_Compositor_SetLumaStatsConfiguration(display->compositor, &lumaSettings); |
|---|
| 1052 | if (rc) return BERR_TRACE(rc); |
|---|
| 1053 | |
|---|
| 1054 | rc = BVDC_ApplyChanges(g_NEXUS_DisplayModule_State.vdc); |
|---|
| 1055 | if (rc) return BERR_TRACE(rc); |
|---|
| 1056 | #else |
|---|
| 1057 | BSTD_UNUSED(display); |
|---|
| 1058 | BSTD_UNUSED(pRect); |
|---|
| 1059 | #endif |
|---|
| 1060 | return NEXUS_SUCCESS; |
|---|
| 1061 | } |
|---|
| 1062 | |
|---|
| 1063 | NEXUS_Error |
|---|
| 1064 | NEXUS_PictureCtrl_GetDisplayLumaStatistics( |
|---|
| 1065 | NEXUS_DisplayHandle display, |
|---|
| 1066 | NEXUS_LumaStatistics *pLumaStat) |
|---|
| 1067 | { |
|---|
| 1068 | #ifndef B_HAS_LEGACY_VDC |
|---|
| 1069 | BVDC_LumaStatus lumaStatus; |
|---|
| 1070 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 1071 | |
|---|
| 1072 | BKNI_Memset(pLumaStat, 0, sizeof(*pLumaStat)); |
|---|
| 1073 | BDBG_OBJECT_ASSERT(display, NEXUS_Display); |
|---|
| 1074 | |
|---|
| 1075 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 1076 | return 0; |
|---|
| 1077 | } |
|---|
| 1078 | |
|---|
| 1079 | /* Get luma sum */ |
|---|
| 1080 | rc = BVDC_Compositor_GetLumaStatus(display->compositor, &lumaStatus); |
|---|
| 1081 | if (rc) return BERR_TRACE(rc); |
|---|
| 1082 | |
|---|
| 1083 | /* Calculate APL from luma sum and region */ |
|---|
| 1084 | pLumaStat->average = lumaStatus.ulSum / lumaStatus.ulPixelCnt; |
|---|
| 1085 | pLumaStat->min = lumaStatus.ulMin; |
|---|
| 1086 | pLumaStat->max = lumaStatus.ulMax; |
|---|
| 1087 | BKNI_Memcpy(pLumaStat->histogram, lumaStatus.aulHistogram, NEXUS_LUMA_HISTOGRAM_COUNT * 4); |
|---|
| 1088 | BKNI_Memcpy(pLumaStat->levelStats, lumaStatus.aulLevelStats, NEXUS_LUMA_HISTOGRAM_LEVELS * sizeof(uint32_t)); |
|---|
| 1089 | #else |
|---|
| 1090 | BSTD_UNUSED(display); |
|---|
| 1091 | BSTD_UNUSED(pLumaStat); |
|---|
| 1092 | #endif |
|---|
| 1093 | return NEXUS_SUCCESS; |
|---|
| 1094 | } |
|---|
| 1095 | |
|---|
| 1096 | |
|---|
| 1097 | /*************************************************************************** |
|---|
| 1098 | Summary: |
|---|
| 1099 | Set luma average calculation region. |
|---|
| 1100 | **************************************************************************/ |
|---|
| 1101 | NEXUS_Error |
|---|
| 1102 | NEXUS_PictureCtrl_ConfigWindowLumaStatistics( |
|---|
| 1103 | NEXUS_VideoWindowHandle window, |
|---|
| 1104 | const NEXUS_ClipRect *pRect) |
|---|
| 1105 | { |
|---|
| 1106 | #if !B_HAS_LEGACY_VDC && BCHP_CHIP != 7403 |
|---|
| 1107 | BVDC_Window_Handle windowVDC; |
|---|
| 1108 | BVDC_LumaSettings lumaSettings; |
|---|
| 1109 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 1110 | |
|---|
| 1111 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 1112 | |
|---|
| 1113 | windowVDC = window->vdcState.window; |
|---|
| 1114 | if (NULL == windowVDC) |
|---|
| 1115 | { |
|---|
| 1116 | BDBG_ERR(("Window not connnected\n")); |
|---|
| 1117 | return BERR_TRACE(NEXUS_UNKNOWN); |
|---|
| 1118 | } |
|---|
| 1119 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 1120 | return 0; |
|---|
| 1121 | } |
|---|
| 1122 | |
|---|
| 1123 | rc = BVDC_Window_GetLumaStatsConfiguration(windowVDC, &lumaSettings); |
|---|
| 1124 | if (rc) return BERR_TRACE(rc); |
|---|
| 1125 | |
|---|
| 1126 | lumaSettings.stRegion.ulLeft = pRect->left; |
|---|
| 1127 | lumaSettings.stRegion.ulTop = pRect->top; |
|---|
| 1128 | lumaSettings.stRegion.ulRight = pRect->right; |
|---|
| 1129 | lumaSettings.stRegion.ulBottom = pRect->bottom; |
|---|
| 1130 | |
|---|
| 1131 | rc = BVDC_Window_SetLumaStatsConfiguration(windowVDC, &lumaSettings); |
|---|
| 1132 | if (rc) return BERR_TRACE(rc); |
|---|
| 1133 | |
|---|
| 1134 | rc = BVDC_ApplyChanges(g_NEXUS_DisplayModule_State.vdc); |
|---|
| 1135 | if (rc) return BERR_TRACE(rc); |
|---|
| 1136 | #else |
|---|
| 1137 | BSTD_UNUSED(window); |
|---|
| 1138 | BSTD_UNUSED(pRect); |
|---|
| 1139 | #endif |
|---|
| 1140 | return NEXUS_SUCCESS; |
|---|
| 1141 | } |
|---|
| 1142 | |
|---|
| 1143 | /*************************************************************************** |
|---|
| 1144 | Summary: |
|---|
| 1145 | Get luma average value of main video surface. |
|---|
| 1146 | **************************************************************************/ |
|---|
| 1147 | NEXUS_Error |
|---|
| 1148 | NEXUS_PictureCtrl_GetWindowLumaStatistics( |
|---|
| 1149 | NEXUS_VideoWindowHandle window, |
|---|
| 1150 | NEXUS_LumaStatistics *pLumaStat) |
|---|
| 1151 | { |
|---|
| 1152 | #ifndef B_HAS_LEGACY_VDC |
|---|
| 1153 | BVDC_Window_Handle windowVDC; |
|---|
| 1154 | BVDC_LumaStatus lumaStatus; |
|---|
| 1155 | BERR_Code rc = BERR_SUCCESS; |
|---|
| 1156 | |
|---|
| 1157 | BDBG_OBJECT_ASSERT(window, NEXUS_VideoWindow); |
|---|
| 1158 | |
|---|
| 1159 | BKNI_Memset(pLumaStat, 0, sizeof(*pLumaStat)); |
|---|
| 1160 | windowVDC = window->vdcState.window; |
|---|
| 1161 | if (NULL == windowVDC) |
|---|
| 1162 | { |
|---|
| 1163 | BDBG_ERR(("VideoWindow must have VideoInput connected to get luma statistics\n")); |
|---|
| 1164 | return NEXUS_UNKNOWN; |
|---|
| 1165 | } |
|---|
| 1166 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 1167 | return 0; |
|---|
| 1168 | } |
|---|
| 1169 | |
|---|
| 1170 | /* Get luma sum */ |
|---|
| 1171 | rc = BVDC_Window_GetLumaStatus(windowVDC, &lumaStatus); |
|---|
| 1172 | if (rc) return BERR_TRACE(rc); |
|---|
| 1173 | |
|---|
| 1174 | /* Calculate APL from luma sum and region */ |
|---|
| 1175 | pLumaStat->average = lumaStatus.ulSum / lumaStatus.ulPixelCnt; |
|---|
| 1176 | pLumaStat->min = lumaStatus.ulMin; |
|---|
| 1177 | pLumaStat->max = lumaStatus.ulMax; |
|---|
| 1178 | BKNI_Memcpy(pLumaStat->histogram, lumaStatus.aulHistogram, NEXUS_LUMA_HISTOGRAM_COUNT * sizeof(uint32_t)); |
|---|
| 1179 | BKNI_Memcpy(pLumaStat->levelStats, lumaStatus.aulLevelStats, NEXUS_LUMA_HISTOGRAM_LEVELS * sizeof(uint32_t)); |
|---|
| 1180 | #else |
|---|
| 1181 | BSTD_UNUSED(window); |
|---|
| 1182 | BSTD_UNUSED(pLumaStat); |
|---|
| 1183 | #endif |
|---|
| 1184 | |
|---|
| 1185 | return NEXUS_SUCCESS; |
|---|
| 1186 | } |
|---|
| 1187 | |
|---|
| 1188 | NEXUS_Error |
|---|
| 1189 | NEXUS_PictureCtrl_SetColorCorrectionTable( NEXUS_DisplayHandle display, const NEXUS_PictureControlColorCorrectionSettings *pSettings ) |
|---|
| 1190 | { |
|---|
| 1191 | #ifndef B_HAS_LEGACY_VDC |
|---|
| 1192 | BERR_Code rc; |
|---|
| 1193 | |
|---|
| 1194 | BDBG_OBJECT_ASSERT(display, NEXUS_Display); |
|---|
| 1195 | |
|---|
| 1196 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 1197 | return 0; |
|---|
| 1198 | } |
|---|
| 1199 | |
|---|
| 1200 | if (pSettings==NULL || !pSettings->enabled) |
|---|
| 1201 | { |
|---|
| 1202 | rc = BVDC_Display_EnableColorCorrection(display->displayVdc, false); |
|---|
| 1203 | if (rc) return BERR_TRACE(rc); |
|---|
| 1204 | } |
|---|
| 1205 | else |
|---|
| 1206 | { |
|---|
| 1207 | rc = BVDC_Display_EnableColorCorrection(display->displayVdc, true); |
|---|
| 1208 | if (rc) return BERR_TRACE(rc); |
|---|
| 1209 | |
|---|
| 1210 | if((pSettings->gammaId < NEXUS_CCB_NUM_GAMMA_VALUE) && (pSettings->colorId < NEXUS_CCB_NUM_COLOR_TEMP)) |
|---|
| 1211 | { |
|---|
| 1212 | rc = BVDC_Display_SetColorCorrectionTable(display->displayVdc, pSettings->gammaId, pSettings->colorId); |
|---|
| 1213 | if (rc) return BERR_TRACE(rc); |
|---|
| 1214 | } |
|---|
| 1215 | else |
|---|
| 1216 | { |
|---|
| 1217 | BDBG_ERR(("Invalid CCB table IDs")); |
|---|
| 1218 | return BERR_TRACE(NEXUS_INVALID_PARAMETER); |
|---|
| 1219 | } |
|---|
| 1220 | } |
|---|
| 1221 | |
|---|
| 1222 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 1223 | if (rc) return BERR_TRACE(rc); |
|---|
| 1224 | #else |
|---|
| 1225 | BSTD_UNUSED(display); |
|---|
| 1226 | BSTD_UNUSED(pSettings); |
|---|
| 1227 | #endif |
|---|
| 1228 | return NEXUS_SUCCESS; |
|---|
| 1229 | } |
|---|
| 1230 | |
|---|
| 1231 | NEXUS_Error NEXUS_PictureCtrl_SetCustomColorCorrectionTable( NEXUS_DisplayHandle display, const uint32_t *pTable, unsigned numTableEntries ) |
|---|
| 1232 | { |
|---|
| 1233 | #ifndef B_HAS_LEGACY_VDC |
|---|
| 1234 | BERR_Code rc; |
|---|
| 1235 | |
|---|
| 1236 | BDBG_OBJECT_ASSERT(display, NEXUS_Display); |
|---|
| 1237 | BDBG_ASSERT(pTable); |
|---|
| 1238 | BSTD_UNUSED(numTableEntries); |
|---|
| 1239 | |
|---|
| 1240 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 1241 | return 0; |
|---|
| 1242 | } |
|---|
| 1243 | |
|---|
| 1244 | rc = BVDC_Display_EnableColorCorrection(display->displayVdc, true); |
|---|
| 1245 | if (rc) return BERR_TRACE(rc); |
|---|
| 1246 | |
|---|
| 1247 | rc = BVDC_Display_LoadColorCorrectionTable(display->displayVdc, pTable); |
|---|
| 1248 | if (rc) return BERR_TRACE(rc); |
|---|
| 1249 | |
|---|
| 1250 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 1251 | if (rc) return BERR_TRACE(rc); |
|---|
| 1252 | #else |
|---|
| 1253 | BSTD_UNUSED(display); |
|---|
| 1254 | BSTD_UNUSED(pTable); |
|---|
| 1255 | BSTD_UNUSED(numTableEntries); |
|---|
| 1256 | #endif |
|---|
| 1257 | return NEXUS_SUCCESS; |
|---|
| 1258 | } |
|---|
| 1259 | |
|---|
| 1260 | void NEXUS_PictureCtrl_GetColorClipSettings( NEXUS_DisplayHandle display, NEXUS_PictureCtrlColorClipSettings *pSettings ) |
|---|
| 1261 | { |
|---|
| 1262 | BDBG_OBJECT_ASSERT(display, NEXUS_Display); |
|---|
| 1263 | *pSettings = display->colorClipSettings; |
|---|
| 1264 | } |
|---|
| 1265 | |
|---|
| 1266 | NEXUS_Error NEXUS_PictureCtrl_SetColorClipSettings( NEXUS_DisplayHandle display, const NEXUS_PictureCtrlColorClipSettings *pSettings ) |
|---|
| 1267 | { |
|---|
| 1268 | #if !B_HAS_LEGACY_VDC && BCHP_CHIP != 7403 |
|---|
| 1269 | BERR_Code rc; |
|---|
| 1270 | |
|---|
| 1271 | BDBG_OBJECT_ASSERT(display, NEXUS_Display); |
|---|
| 1272 | BDBG_CASSERT(sizeof(BVDC_ColorClipSettings) == sizeof(NEXUS_PictureCtrlColorClipSettings)); |
|---|
| 1273 | BDBG_CASSERT(BVDC_ColorClipMode_Both == NEXUS_ColorClipMode_eMax-1); |
|---|
| 1274 | |
|---|
| 1275 | if (g_NEXUS_DisplayModule_State.pqDisabled) { |
|---|
| 1276 | return 0; |
|---|
| 1277 | } |
|---|
| 1278 | |
|---|
| 1279 | rc = BVDC_Compositor_SetColorClip(display->compositor, (BVDC_ColorClipSettings*)pSettings); |
|---|
| 1280 | if (rc) return BERR_TRACE(rc); |
|---|
| 1281 | |
|---|
| 1282 | rc = NEXUS_Display_P_ApplyChanges(); |
|---|
| 1283 | if (rc) return BERR_TRACE(rc); |
|---|
| 1284 | |
|---|
| 1285 | display->colorClipSettings = *pSettings; |
|---|
| 1286 | #else |
|---|
| 1287 | BSTD_UNUSED(display); |
|---|
| 1288 | BSTD_UNUSED(pSettings); |
|---|
| 1289 | #endif |
|---|
| 1290 | |
|---|
| 1291 | return NEXUS_SUCCESS; |
|---|
| 1292 | } |
|---|