| 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: bvdc_gfxfeeder.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/51 $ |
|---|
| 12 | * $brcm_Date: 7/20/11 1:56p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/vdc/7038/bvdc_gfxfeeder.c $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/51 7/20/11 1:56p vanessah |
|---|
| 21 | * SW7346-212: function prototype reformat |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/50 7/20/11 12:44p vanessah |
|---|
| 24 | * SW7346-212: pair ulInside isr value |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/49 4/28/11 7:15p vanessah |
|---|
| 27 | * SW7422-118: fix double buffer setting error |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/48 4/27/11 4:59p vanessah |
|---|
| 30 | * SW7425-404: enable HSCL and VSCL for 3D due to HW bug |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/47 4/1/11 7:38a vanessah |
|---|
| 33 | * SW7422-118: double buffer for GFD PI support |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/46 11/1/10 4:24p jessem |
|---|
| 36 | * SW7422-82: Added stereo 3D support to VFD as source feature. |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/45 11/1/10 1:13p vanessah |
|---|
| 39 | * SW7422-43: merge 2D into 3D with a unified interface, change input |
|---|
| 40 | * data structure as const |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/44 10/29/10 5:06p vanessah |
|---|
| 43 | * SW7422-43: 3D graphics render,merge 2D into 3D with a unified |
|---|
| 44 | * interface |
|---|
| 45 | * |
|---|
| 46 | * Hydra_Software_Devel/43 10/25/10 7:18p vanessah |
|---|
| 47 | * SW7422-43: Handle GFD programming for 3D. |
|---|
| 48 | * |
|---|
| 49 | * Hydra_Software_Devel/42 10/11/10 12:34p jessem |
|---|
| 50 | * SW7420-173: Added support for VDC as source feature. |
|---|
| 51 | * |
|---|
| 52 | * Hydra_Software_Devel/41 6/14/10 3:36p hongtaoz |
|---|
| 53 | * SW3548-2976: soft init GFD when DCX switches from ON to OFF, and when |
|---|
| 54 | * GFD source is created; added GFD BVB error monitoring to debug build; |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/40 5/7/10 7:09p albertl |
|---|
| 57 | * SW7125-364: Changed dirty bits to use union structure to avoid type-pun |
|---|
| 58 | * warnings. |
|---|
| 59 | * |
|---|
| 60 | * Hydra_Software_Devel/39 4/19/10 10:14p tdo |
|---|
| 61 | * SW3548-2814: Improvements to VDC ulBlackMagic. Move |
|---|
| 62 | * BDBG_OBJECT_ID_DECLARE private header files instead of .c. |
|---|
| 63 | * |
|---|
| 64 | * Hydra_Software_Devel/38 4/7/10 11:30a tdo |
|---|
| 65 | * SW3548-2814: Improvements to VDC ulBlackMagic. Rename TLA |
|---|
| 66 | * |
|---|
| 67 | * Hydra_Software_Devel/37 4/5/10 4:06p tdo |
|---|
| 68 | * SW3548-2814: Improvements to VDC ulBlackMagic |
|---|
| 69 | * |
|---|
| 70 | * Hydra_Software_Devel/36 3/18/10 3:59p syang |
|---|
| 71 | * SW7550-271: added error check for unsupported 7550 GFD1 features |
|---|
| 72 | * |
|---|
| 73 | * Hydra_Software_Devel/35 10/27/09 6:23p syang |
|---|
| 74 | * SW7420-338: add SetSurface_isr to VDC critical section protection |
|---|
| 75 | * assert group |
|---|
| 76 | * |
|---|
| 77 | * Hydra_Software_Devel/34 9/11/09 4:34p tdo |
|---|
| 78 | * SW7420-338: Need to init correct GFD with correct capability |
|---|
| 79 | * |
|---|
| 80 | * Hydra_Software_Devel/33 8/6/09 2:52p syang |
|---|
| 81 | * PR 56506: clean up gamma table format desc |
|---|
| 82 | * |
|---|
| 83 | * Hydra_Software_Devel/32 7/16/09 12:23p syang |
|---|
| 84 | * PR 56417: corrected a typo with EnableGammaCorrection para validation |
|---|
| 85 | * |
|---|
| 86 | * Hydra_Software_Devel/31 10/9/08 5:28p syang |
|---|
| 87 | * PR 46891: add _isr to the name of func used in _isr context |
|---|
| 88 | * |
|---|
| 89 | * Hydra_Software_Devel/30 10/3/08 9:24a yuxiaz |
|---|
| 90 | * PR46305, PR46307, PR46309: More Video TestFeature1 support. |
|---|
| 91 | * |
|---|
| 92 | * Hydra_Software_Devel/29 10/1/08 5:15p yuxiaz |
|---|
| 93 | * PR47303, PR46309: Add video TestFeature1 support for GFD on 3548 B0. |
|---|
| 94 | * |
|---|
| 95 | * Hydra_Software_Devel/28 9/22/08 4:52p yuxiaz |
|---|
| 96 | * PR46305, PR46307, PR46309: Added video TestFeature1 support for 3548 B0. |
|---|
| 97 | * |
|---|
| 98 | * Hydra_Software_Devel/27 5/8/08 1:23p syang |
|---|
| 99 | * PR 39206: remove alpha surface for 3548 and newer chips |
|---|
| 100 | * |
|---|
| 101 | * Hydra_Software_Devel/26 1/24/07 9:06p albertl |
|---|
| 102 | * PR22237: Updated BMEM calls to use new BMEM_Heap functions. |
|---|
| 103 | * |
|---|
| 104 | * Hydra_Software_Devel/25 5/26/06 3:40p pntruong |
|---|
| 105 | * PR20642: Refactored handling of hList. |
|---|
| 106 | * |
|---|
| 107 | * Hydra_Software_Devel/24 11/10/05 3:18p syang |
|---|
| 108 | * PR 12244: move alpha-only pixel constant color setting from BSUR to |
|---|
| 109 | * BVDC |
|---|
| 110 | * |
|---|
| 111 | * Hydra_Software_Devel/23 5/5/05 3:55p syang |
|---|
| 112 | * PR 15202: re-organize for better readability and debugability |
|---|
| 113 | * |
|---|
| 114 | * Hydra_Software_Devel/22 3/4/05 3:05p syang |
|---|
| 115 | * PR 13282: init pNextFrame to NULL before call callback_func; and add |
|---|
| 116 | * some msg |
|---|
| 117 | * |
|---|
| 118 | * Hydra_Software_Devel/21 1/20/05 4:01p syang |
|---|
| 119 | * PR 13282: added api func to query which surface is currently fetched by |
|---|
| 120 | * hardware |
|---|
| 121 | * |
|---|
| 122 | * Hydra_Software_Devel/20 1/19/05 4:09p syang |
|---|
| 123 | * PR 13282: new gfx surface setting is now sent to HW as soon as |
|---|
| 124 | * possible: with ApplyChanges in user mode, and immediately in _isr mode |
|---|
| 125 | * |
|---|
| 126 | * Hydra_Software_Devel/19 10/14/04 6:50p syang |
|---|
| 127 | * PR 10756: Re-organize code so that all window ajustments are done in a |
|---|
| 128 | * central place for better readability and debugablibilty; Added scale |
|---|
| 129 | * factor rounding routine. |
|---|
| 130 | * |
|---|
| 131 | * Hydra_Software_Devel/18 8/31/04 3:40p syang |
|---|
| 132 | * PR 11266: added BVDC_Source_SetSurface_isr back because it might still |
|---|
| 133 | * be needed |
|---|
| 134 | * |
|---|
| 135 | * Hydra_Software_Devel/17 8/26/04 6:36p syang |
|---|
| 136 | * PR 11266: added src picture call back func for gfx; added src state to |
|---|
| 137 | * call back func for XVD sync; |
|---|
| 138 | * |
|---|
| 139 | * Hydra_Software_Devel/16 5/24/04 5:09p jasonh |
|---|
| 140 | * PR 11189: Merge down from B0 to main-line |
|---|
| 141 | * |
|---|
| 142 | * Hydra_Software_Devel/Refsw_Devel_7038_B0/1 5/17/04 2:47p syang |
|---|
| 143 | * PR 9750: Eliminated BVDC_Source_EnableAlphaPreMultiply and |
|---|
| 144 | * BVDC_Source_DisableAlphaPreMultiply and changed to gfd hw alpha pre- |
|---|
| 145 | * multiply automatically basing blend factor setting; updated the para |
|---|
| 146 | * of BVDC_Window_SetBlendFactor for gfx window accordingly; updated the |
|---|
| 147 | * desc of BVDC_Window_SetAlpha, BVDC_Window_SetBlendFactor, |
|---|
| 148 | * BVDC_Source_EnableColorKey, BVDC_Source_DisableColorKey according to |
|---|
| 149 | * the change; added gfx blending setting validation with ValidateChanges |
|---|
| 150 | * and added blending setting adjust before RUL building for gfx window. |
|---|
| 151 | * |
|---|
| 152 | * Hydra_Software_Devel/15 4/5/04 12:39p syang |
|---|
| 153 | * PR 10477: Changed to copy ApplyChange activated user setting into |
|---|
| 154 | * current inside ApplyChange, and to copy intr surface context into |
|---|
| 155 | * current at the beginning of RUL building; 2) Use Dirty bit field to |
|---|
| 156 | * indicate change between new context and current context, and change |
|---|
| 157 | * between current context and las RUL; Use Flag bits field to replace |
|---|
| 158 | * bool to save size and copying time. |
|---|
| 159 | * |
|---|
| 160 | * Hydra_Software_Devel/14 2/12/04 10:33a syang |
|---|
| 161 | * PR 9712: PR 9609: 1). changed to use window alpha to set the HW |
|---|
| 162 | * "default key alpha" register; 2). added W1Alpha and W0Alpha parameters |
|---|
| 163 | * to BVDC_Source_SetAlphaSurface; 3). |
|---|
| 164 | * BVDC_Source_SetDefaultAlphaForKeying is removed from API; 4). the desc |
|---|
| 165 | * of BVDC_Window_SetAlpha / SetBlendFactor and |
|---|
| 166 | * BVDC_Source_EnableColorKey are also updated accordingly. |
|---|
| 167 | * |
|---|
| 168 | * Hydra_Software_Devel/13 12/17/03 4:58p syang |
|---|
| 169 | * PR 9025: Change MNO to C2C1C0, described default alpha of 0xff for |
|---|
| 170 | * format without alpha, mentioned defaultAlphaForKey usage when color |
|---|
| 171 | * is disabled in related places. |
|---|
| 172 | * |
|---|
| 173 | * Hydra_Software_Devel/12 12/10/03 3:53p syang |
|---|
| 174 | * PR 8914: ensure DefaultKeyAlpha and other register inited, fixed |
|---|
| 175 | * prroblem with GFD_0_SRC_START in the case of bottom field |
|---|
| 176 | * |
|---|
| 177 | * Hydra_Software_Devel/11 11/12/03 3:52p syang |
|---|
| 178 | * added real gfx scale filter coeff and color space conv matrix |
|---|
| 179 | * |
|---|
| 180 | * Hydra_Software_Devel/10 11/7/03 3:58p syang |
|---|
| 181 | * 1). added converting of bmem buf addr from virtual to device offset |
|---|
| 182 | * before sending to HW, hMemory added to gfx context; 2). splitted |
|---|
| 183 | * BVDC_P_GfxFeeder_ApplyChanges from BVDC_P_GfxFeeder_BuildRul_isr; 3). |
|---|
| 184 | * splitted alpha surface from main surface so that alpha surface change |
|---|
| 185 | * could be applied even if main sur does not change. |
|---|
| 186 | * |
|---|
| 187 | * Hydra_Software_Devel/9 10/28/03 2:03p syang |
|---|
| 188 | * added BVDC_Source_SetSourface_isr and BVDC_Source_SetAlphaSurface_isr, |
|---|
| 189 | * and corrected the usage of BDBG_ENTER / LEAVE |
|---|
| 190 | * |
|---|
| 191 | * Hydra_Software_Devel/8 9/19/03 4:37p pntruong |
|---|
| 192 | * Moved old & cur user's info into context to be consistent with other |
|---|
| 193 | * modules. |
|---|
| 194 | * |
|---|
| 195 | * Hydra_Software_Devel/7 9/8/03 5:07p syang |
|---|
| 196 | * change "unsigned int" to "uint32_t" for |
|---|
| 197 | * BVDC_Source_EnableGammaCorrection |
|---|
| 198 | * |
|---|
| 199 | * Hydra_Software_Devel/6 8/26/03 7:00p syang |
|---|
| 200 | * re-organize private data structure and code in order to support both |
|---|
| 201 | * user setting and multi buffer switching by M2MC interrupt handler |
|---|
| 202 | * |
|---|
| 203 | * Hydra_Software_Devel/5 8/25/03 11:36a pntruong |
|---|
| 204 | * Use handle. |
|---|
| 205 | * |
|---|
| 206 | * Hydra_Software_Devel/4 8/19/03 2:34p syang |
|---|
| 207 | * clean up variable and error code names for readability, and updating |
|---|
| 208 | * eA8_Y8_Cr8_Cb8 to eA8_Y8_Cb8_Cr8 |
|---|
| 209 | * |
|---|
| 210 | * Hydra_Software_Devel/4 8/19/03 2:28p syang |
|---|
| 211 | * clean up the variable names and error code names for readability |
|---|
| 212 | * |
|---|
| 213 | * Hydra_Software_Devel/3 8/12/03 4:22p syang |
|---|
| 214 | * First time check in after real gfx feeder implementation is added |
|---|
| 215 | * |
|---|
| 216 | * Hydra_Software_Devel/2 7/22/03 5:35p pntruong |
|---|
| 217 | * Added BDBG_MODULE for debugging. |
|---|
| 218 | * |
|---|
| 219 | * Hydra_Software_Devel/1 7/22/03 4:30p syang |
|---|
| 220 | * init version |
|---|
| 221 | * |
|---|
| 222 | ***************************************************************************/ |
|---|
| 223 | #include "bstd.h" /* standard types */ |
|---|
| 224 | #include "bvdc.h" /* Video display */ |
|---|
| 225 | #include "bvdc_source_priv.h" |
|---|
| 226 | #include "bvdc_gfxfeeder_priv.h" |
|---|
| 227 | #include "bvdc_feeder_priv.h" |
|---|
| 228 | |
|---|
| 229 | BDBG_MODULE(BVDC); |
|---|
| 230 | |
|---|
| 231 | /*************************************************************************** |
|---|
| 232 | * |
|---|
| 233 | */ |
|---|
| 234 | |
|---|
| 235 | BERR_Code BVDC_Source_SetSurface |
|---|
| 236 | ( BVDC_Source_Handle hSource, |
|---|
| 237 | const BAVC_Gfx_Picture *pGFXPicSetting) |
|---|
| 238 | { |
|---|
| 239 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 240 | bool bIsISRMode = false; |
|---|
| 241 | bool bIsGfxNULL = true, bIsVfdNULL = true; |
|---|
| 242 | BVDC_P_GfxFeeder_Handle pGfxFeeder = NULL; |
|---|
| 243 | |
|---|
| 244 | |
|---|
| 245 | BDBG_ENTER(BVDC_Source_SetSurface); |
|---|
| 246 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 247 | |
|---|
| 248 | bIsGfxNULL = (NULL ==hSource->hGfxFeeder); |
|---|
| 249 | bIsVfdNULL = (NULL ==hSource->hVfdFeeder); |
|---|
| 250 | |
|---|
| 251 | if ((NULL == pGFXPicSetting) || |
|---|
| 252 | ((bIsGfxNULL)&&(bIsVfdNULL))) |
|---|
| 253 | { |
|---|
| 254 | BDBG_ERR(("Not a valid feeder handle.")); |
|---|
| 255 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 256 | BDBG_LEAVE(BVDC_Source_SetSurface); |
|---|
| 257 | return BERR_TRACE(eStatus); |
|---|
| 258 | } |
|---|
| 259 | |
|---|
| 260 | /*Graphics feeder*/ |
|---|
| 261 | if( !bIsGfxNULL) |
|---|
| 262 | { |
|---|
| 263 | BVDC_P_GfxFeederMainSurfaceInfo *pCurrMnSur; |
|---|
| 264 | BVDC_P_GfxFeederMainSurfaceInfo *pUserMnSur; |
|---|
| 265 | pGfxFeeder = hSource->hGfxFeeder; |
|---|
| 266 | |
|---|
| 267 | |
|---|
| 268 | eStatus = BVDC_P_GfxFeeder_SetSurface ( |
|---|
| 269 | hSource->hGfxFeeder, |
|---|
| 270 | &(hSource->hGfxFeeder->UserMainSurInfo), |
|---|
| 271 | pGFXPicSetting); |
|---|
| 272 | pCurrMnSur = &(hSource->hGfxFeeder->CurrMainSurInfo); |
|---|
| 273 | pUserMnSur = &(hSource->hGfxFeeder->UserMainSurInfo); |
|---|
| 274 | |
|---|
| 275 | BDBG_MSG(("Surface set is hSur %x, start (%x %x)", |
|---|
| 276 | (uint32_t) pGFXPicSetting->hSurface, hSource->hGfxFeeder->UserMainSurInfo.ulAddress , |
|---|
| 277 | hSource->hGfxFeeder->UserMainSurInfo.ulAddress + hSource->hGfxFeeder->UserMainSurInfo.ulPitch)); |
|---|
| 278 | |
|---|
| 279 | } |
|---|
| 280 | else /*Video feeder*/ |
|---|
| 281 | { |
|---|
| 282 | BVDC_P_Feeder_SurfaceInfo *pCurrSurface; |
|---|
| 283 | BVDC_P_Feeder_SurfaceInfo *pUserSurface; |
|---|
| 284 | |
|---|
| 285 | |
|---|
| 286 | eStatus = BVDC_P_Source_SetSurface(&(hSource->hVfdFeeder->stUserSurInfo), |
|---|
| 287 | hSource->hVfdFeeder->hMem, pGFXPicSetting); |
|---|
| 288 | BDBG_MSG(("Surface set is hSur %x, start (%x %x)", |
|---|
| 289 | (uint32_t) pGFXPicSetting->hSurface, hSource->hVfdFeeder->stUserSurInfo.ulAddress , |
|---|
| 290 | hSource->hVfdFeeder->stUserSurInfo.ulAddress + hSource->hVfdFeeder->stUserSurInfo.ulPitch)); |
|---|
| 291 | |
|---|
| 292 | pUserSurface = &(hSource->hVfdFeeder->stUserSurInfo); |
|---|
| 293 | pCurrSurface = &(hSource->hVfdFeeder->stCurrSurInfo); |
|---|
| 294 | |
|---|
| 295 | |
|---|
| 296 | bIsISRMode = |
|---|
| 297 | (BERR_SUCCESS == eStatus) && |
|---|
| 298 | (pCurrSurface->bValidated) && |
|---|
| 299 | (pUserSurface->ulWidth == pCurrSurface->ulWidth) && |
|---|
| 300 | (pUserSurface->ulHeight == pCurrSurface->ulHeight) && |
|---|
| 301 | (pUserSurface->ulPitch == pCurrSurface->ulPitch) && |
|---|
| 302 | (pUserSurface->eInputPxlFmt == pCurrSurface->eInputPxlFmt); |
|---|
| 303 | |
|---|
| 304 | if(bIsISRMode) |
|---|
| 305 | { |
|---|
| 306 | BDBG_MSG(("Surface in _isr sent to HW, hSur 0x%x, start (0x%x 0x%x)", |
|---|
| 307 | (uint32_t) pGFXPicSetting->hSurface, pUserSurface->ulAddress, |
|---|
| 308 | pUserSurface->ulAddress + pUserSurface->ulPitch)); |
|---|
| 309 | pUserSurface->bValidated = true; |
|---|
| 310 | |
|---|
| 311 | BVDC_P_Feeder_SetRulSurfaceStart_isr(hSource->hVfdFeeder, pUserSurface); |
|---|
| 312 | } |
|---|
| 313 | |
|---|
| 314 | } |
|---|
| 315 | |
|---|
| 316 | BDBG_LEAVE(BVDC_Source_SetSurface); |
|---|
| 317 | return BERR_TRACE(eStatus); |
|---|
| 318 | } |
|---|
| 319 | |
|---|
| 320 | /*************************************************************************** |
|---|
| 321 | * |
|---|
| 322 | */ |
|---|
| 323 | BERR_Code BVDC_Source_SetSurface_isr |
|---|
| 324 | ( BVDC_Source_Handle hSource, |
|---|
| 325 | const BAVC_Gfx_Picture *pGFXPicSetting) |
|---|
| 326 | { |
|---|
| 327 | |
|---|
| 328 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 329 | bool bIsGfxNULL = true, bIsVfdNULL = true; |
|---|
| 330 | bool bIsISRMode = false; |
|---|
| 331 | |
|---|
| 332 | BDBG_ENTER(BVDC_Source_SetSurface_isr); |
|---|
| 333 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 334 | |
|---|
| 335 | /* Make sure the BKNI enter/leave critical section works. */ |
|---|
| 336 | BDBG_ASSERT(0 == hSource->hVdc->ulInsideCs); |
|---|
| 337 | |
|---|
| 338 | hSource->hVdc->ulInsideCs ++; |
|---|
| 339 | |
|---|
| 340 | bIsGfxNULL = (NULL ==hSource->hGfxFeeder); |
|---|
| 341 | bIsVfdNULL = (NULL ==hSource->hVfdFeeder); |
|---|
| 342 | |
|---|
| 343 | if ((NULL == pGFXPicSetting) || |
|---|
| 344 | ((bIsGfxNULL)&&(bIsVfdNULL))) |
|---|
| 345 | { |
|---|
| 346 | BDBG_ERR(("Not a valid feeder handle.")); |
|---|
| 347 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 348 | hSource->hVdc->ulInsideCs--; |
|---|
| 349 | BDBG_LEAVE(BVDC_Source_SetSurface_isr); |
|---|
| 350 | return BERR_TRACE(eStatus); |
|---|
| 351 | } |
|---|
| 352 | |
|---|
| 353 | /*Graphics feeder*/ |
|---|
| 354 | if( !bIsGfxNULL) |
|---|
| 355 | { |
|---|
| 356 | /*BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX);*/ |
|---|
| 357 | |
|---|
| 358 | BVDC_P_GfxFeederMainSurfaceInfo *pCurrMnSur; |
|---|
| 359 | BVDC_P_GfxFeederMainSurfaceInfo *pIntrMnSur; |
|---|
| 360 | pIntrMnSur = &(hSource->hGfxFeeder->IntrMainSurInfo); |
|---|
| 361 | eStatus = BVDC_P_GfxFeeder_SetSurface_isr( hSource->hGfxFeeder, |
|---|
| 362 | pIntrMnSur,pGFXPicSetting); |
|---|
| 363 | |
|---|
| 364 | |
|---|
| 365 | /* we could make the new surface setting be used by hw immediately if the |
|---|
| 366 | * new sur has the same size and pitch and DCX cfg as the "current" */ |
|---|
| 367 | pCurrMnSur = &(hSource->hGfxFeeder->CurrMainSurInfo); |
|---|
| 368 | |
|---|
| 369 | bIsISRMode = (pCurrMnSur->bValidated) && |
|---|
| 370 | (pIntrMnSur->ulWidth == pCurrMnSur->ulWidth) && |
|---|
| 371 | (pIntrMnSur->ulHeight == pCurrMnSur->ulHeight) && |
|---|
| 372 | (pIntrMnSur->ulPitch == pCurrMnSur->ulPitch) && |
|---|
| 373 | #if (BVDC_P_SUPPORT_VIDEO_TESTFEATURE1_GFD) |
|---|
| 374 | (pIntrMnSur->stTestFeature1.bEnable == pCurrMnSur->stTestFeature1.bEnable) && |
|---|
| 375 | (pIntrMnSur->stTestFeature1.ulBitsPerPixel == pCurrMnSur->stTestFeature1.ulBitsPerPixel) && |
|---|
| 376 | (pIntrMnSur->stTestFeature1.ulPredictionMode == pCurrMnSur->stTestFeature1.ulPredictionMode) && |
|---|
| 377 | #endif |
|---|
| 378 | (pIntrMnSur->eInputPxlFmt == pCurrMnSur->eInputPxlFmt) ; |
|---|
| 379 | if(!bIsISRMode) |
|---|
| 380 | { |
|---|
| 381 | BDBG_ERR(("Does not meet GFD set surface isr requirement!")); |
|---|
| 382 | hSource->hVdc->ulInsideCs --; |
|---|
| 383 | BDBG_LEAVE(BVDC_Source_SetSurface_isr); |
|---|
| 384 | return (BERR_INVALID_PARAMETER); |
|---|
| 385 | } |
|---|
| 386 | else |
|---|
| 387 | { |
|---|
| 388 | BDBG_MSG(("Main sur in _isr sent to HW, hSur 0x%x, hRSur 0x%x start (0x%x 0x%x)", |
|---|
| 389 | (uint32_t) pGFXPicSetting->hSurface, |
|---|
| 390 | (uint32_t) pGFXPicSetting->hRSurface, |
|---|
| 391 | pIntrMnSur->ulAddress, |
|---|
| 392 | pIntrMnSur->ulAddress + pIntrMnSur->ulPitch)); |
|---|
| 393 | BVDC_P_GfxFeeder_SetScratchSurAddr(hSource->hGfxFeeder, pIntrMnSur->ulAddress, pIntrMnSur->ulRAddress); |
|---|
| 394 | pIntrMnSur->bValidated = true; |
|---|
| 395 | } |
|---|
| 396 | } |
|---|
| 397 | else |
|---|
| 398 | { |
|---|
| 399 | BVDC_P_Feeder_SurfaceInfo *pCurrSurface; |
|---|
| 400 | BVDC_P_Feeder_SurfaceInfo *pInterruptSurface; |
|---|
| 401 | |
|---|
| 402 | pInterruptSurface = &(hSource->hVfdFeeder->stIntrSurInfo); |
|---|
| 403 | eStatus = BVDC_P_Feeder_SetSurface_isr( hSource->hVfdFeeder, |
|---|
| 404 | pInterruptSurface, |
|---|
| 405 | pGFXPicSetting); |
|---|
| 406 | |
|---|
| 407 | /* we could make the new surface setting be used by hw if the |
|---|
| 408 | * new sur has the same size and pitch as the "current". Just change the |
|---|
| 409 | * address accordingly */ |
|---|
| 410 | pCurrSurface = &(hSource->hVfdFeeder->stCurrSurInfo); |
|---|
| 411 | if ( (BERR_SUCCESS == eStatus) && |
|---|
| 412 | (pCurrSurface->bValidated) && |
|---|
| 413 | (pInterruptSurface->ulWidth == pCurrSurface->ulWidth) && |
|---|
| 414 | (pInterruptSurface->ulHeight == pCurrSurface->ulHeight) && |
|---|
| 415 | (pInterruptSurface->ulPitch == pCurrSurface->ulPitch) && |
|---|
| 416 | (pInterruptSurface->eInputPxlFmt == pCurrSurface->eInputPxlFmt) ) |
|---|
| 417 | { |
|---|
| 418 | BDBG_MSG(("Surface in _isr sent to HW, hSur 0x%x, start (0x%x 0x%x)", |
|---|
| 419 | (uint32_t) pGFXPicSetting->hSurface, pInterruptSurface->ulAddress, |
|---|
| 420 | pInterruptSurface->ulAddress + pInterruptSurface->ulPitch)); |
|---|
| 421 | pInterruptSurface->bValidated = true; |
|---|
| 422 | |
|---|
| 423 | BVDC_P_Feeder_SetRulSurfaceStart_isr(hSource->hVfdFeeder, pInterruptSurface); |
|---|
| 424 | } |
|---|
| 425 | } |
|---|
| 426 | |
|---|
| 427 | hSource->hVdc->ulInsideCs --; |
|---|
| 428 | BDBG_LEAVE(BVDC_Source_SetSurface_isr); |
|---|
| 429 | return BERR_TRACE(eStatus); |
|---|
| 430 | } |
|---|
| 431 | |
|---|
| 432 | |
|---|
| 433 | |
|---|
| 434 | /*************************************************************************** |
|---|
| 435 | * |
|---|
| 436 | */ |
|---|
| 437 | BERR_Code BVDC_Source_SetAlphaSurface |
|---|
| 438 | ( BVDC_Source_Handle hSource, |
|---|
| 439 | BSUR_Surface_Handle hSurface, |
|---|
| 440 | uint8_t ucW0Alpha, |
|---|
| 441 | uint8_t ucW1Alpha ) |
|---|
| 442 | { |
|---|
| 443 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 444 | bool bIsISRMode = false; |
|---|
| 445 | |
|---|
| 446 | BVDC_P_GfxFeederAlphaSurfaceInfo *pCurrAlfSur; |
|---|
| 447 | BVDC_P_GfxFeederAlphaSurfaceInfo *pUserAlfSur; |
|---|
| 448 | |
|---|
| 449 | BDBG_ENTER(BVDC_Source_SetAlphaSurface); |
|---|
| 450 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 451 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 452 | |
|---|
| 453 | |
|---|
| 454 | /* allow pSurface == NULL, WRGB1565 -> RGB565 */ |
|---|
| 455 | eStatus = BVDC_Source_P_SetAlphaSurface( &(hSource->hGfxFeeder->UserAlphaSurInfo), |
|---|
| 456 | hSource->hGfxFeeder->hMemory, |
|---|
| 457 | hSurface, ucW0Alpha, ucW1Alpha ); |
|---|
| 458 | |
|---|
| 459 | pUserAlfSur = &(hSource->hGfxFeeder->UserAlphaSurInfo); |
|---|
| 460 | pCurrAlfSur = &(hSource->hGfxFeeder->CurrAlphaSurInfo); |
|---|
| 461 | |
|---|
| 462 | |
|---|
| 463 | #if (BVDC_P_SUPPORT_GFD_VER == BVDC_P_SUPPORT_GFD_VER_1) |
|---|
| 464 | bIsISRMode = (BERR_SUCCESS == eStatus) && |
|---|
| 465 | (pCurrAlfSur->bValidated) && |
|---|
| 466 | (pUserAlfSur->ulWidth == pCurrAlfSur->ulWidth) && |
|---|
| 467 | (pUserAlfSur->ulHeight == pCurrAlfSur->ulHeight) && |
|---|
| 468 | (pUserAlfSur->ulPitch == pCurrAlfSur->ulPitch); |
|---|
| 469 | |
|---|
| 470 | if(bIsISRMode) |
|---|
| 471 | { |
|---|
| 472 | BDBG_MSG(("New alpha sur setting in _isr sent to HW")); |
|---|
| 473 | pUserAlfSur->bValidated = true; |
|---|
| 474 | BVDC_P_GfxFeeder_SetScratchSurAddr(hSource->hGfxFeeder, 0, pUserAlfSur->ulAddress); |
|---|
| 475 | } |
|---|
| 476 | #else |
|---|
| 477 | BSTD_UNUSED(pUserAlfSur); |
|---|
| 478 | BSTD_UNUSED(bIsISRMode); |
|---|
| 479 | |
|---|
| 480 | #endif |
|---|
| 481 | |
|---|
| 482 | BDBG_LEAVE(BVDC_Source_SetAlphaSurface); |
|---|
| 483 | return BERR_TRACE(eStatus); |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | |
|---|
| 487 | /*************************************************************************** |
|---|
| 488 | * |
|---|
| 489 | */ |
|---|
| 490 | BERR_Code BVDC_Source_SetAlphaSurface_isr |
|---|
| 491 | ( BVDC_Source_Handle hSource, |
|---|
| 492 | BSUR_Surface_Handle hSurface, |
|---|
| 493 | uint8_t ucW0Alpha, |
|---|
| 494 | uint8_t ucW1Alpha ) |
|---|
| 495 | { |
|---|
| 496 | BVDC_P_GfxFeederAlphaSurfaceInfo *pCurrAlfSur; |
|---|
| 497 | BVDC_P_GfxFeederAlphaSurfaceInfo *pIntrAlfSur; |
|---|
| 498 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 499 | bool bIsISRMode; |
|---|
| 500 | |
|---|
| 501 | |
|---|
| 502 | BDBG_ENTER(BVDC_Source_SetAlphaSurface_isr); |
|---|
| 503 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 504 | |
|---|
| 505 | hSource->hVdc->ulInsideCs ++; |
|---|
| 506 | |
|---|
| 507 | if( NULL != hSource ) /* alpha surface could be NULL */ |
|---|
| 508 | { |
|---|
| 509 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 510 | |
|---|
| 511 | if( NULL != hSource->hGfxFeeder) |
|---|
| 512 | { |
|---|
| 513 | pIntrAlfSur = &(hSource->hGfxFeeder->IntrAlphaSurInfo); |
|---|
| 514 | eStatus = BVDC_Source_P_SetAlphaSurface_isr( |
|---|
| 515 | pIntrAlfSur, hSource->hGfxFeeder->hMemory, hSurface, ucW0Alpha, ucW1Alpha ); |
|---|
| 516 | |
|---|
| 517 | #if (BVDC_P_SUPPORT_GFD_VER == BVDC_P_SUPPORT_GFD_VER_1) |
|---|
| 518 | /* we could make the new surface setting be used by hw immediately if the |
|---|
| 519 | * new sur has the same size and pitch as the "current" */ |
|---|
| 520 | pCurrAlfSur = &(hSource->hGfxFeeder->CurrAlphaSurInfo); |
|---|
| 521 | |
|---|
| 522 | bIsISRMode = (BERR_SUCCESS == eStatus) && |
|---|
| 523 | (pCurrAlfSur->bValidated) && |
|---|
| 524 | (pIntrAlfSur->ulWidth == pCurrAlfSur->ulWidth) && |
|---|
| 525 | (pIntrAlfSur->ulHeight == pCurrAlfSur->ulHeight) && |
|---|
| 526 | (pIntrAlfSur->ulPitch == pCurrAlfSur->ulPitch); |
|---|
| 527 | |
|---|
| 528 | if(!bIsISRMode) |
|---|
| 529 | { |
|---|
| 530 | BDBG_ERR(("Does not meet GFD set surface isr requirement!")); |
|---|
| 531 | hSource->hVdc->ulInsideCs --; |
|---|
| 532 | return (BERR_INVALID_PARAMETER); |
|---|
| 533 | } |
|---|
| 534 | else |
|---|
| 535 | { |
|---|
| 536 | BDBG_MSG(("New alpha sur setting in _isr sent to HW")); |
|---|
| 537 | pIntrAlfSur->bValidated = true; |
|---|
| 538 | BVDC_P_GfxFeeder_SetScratchSurAddr(hSource->hGfxFeeder, 0, pIntrAlfSur->ulAddress); |
|---|
| 539 | } |
|---|
| 540 | #else |
|---|
| 541 | BSTD_UNUSED(pCurrAlfSur); |
|---|
| 542 | BSTD_UNUSED(bIsISRMode); |
|---|
| 543 | #endif |
|---|
| 544 | } |
|---|
| 545 | else |
|---|
| 546 | { |
|---|
| 547 | BDBG_ERR(("Not a gfx source handle.")); |
|---|
| 548 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 549 | } |
|---|
| 550 | } |
|---|
| 551 | else |
|---|
| 552 | { |
|---|
| 553 | BDBG_ERR(("Invalid source or surface handle.")); |
|---|
| 554 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 555 | } |
|---|
| 556 | |
|---|
| 557 | hSource->hVdc->ulInsideCs --; |
|---|
| 558 | BDBG_LEAVE(BVDC_Source_SetAlphaSurface_isr); |
|---|
| 559 | return BERR_TRACE(eStatus); |
|---|
| 560 | } |
|---|
| 561 | |
|---|
| 562 | |
|---|
| 563 | /*************************************************************************** |
|---|
| 564 | * |
|---|
| 565 | */ |
|---|
| 566 | BERR_Code BVDC_Source_GetSurface_isr |
|---|
| 567 | ( BVDC_Source_Handle hSource, |
|---|
| 568 | BAVC_Gfx_Picture *pGFXPicSetting) |
|---|
| 569 | |
|---|
| 570 | { |
|---|
| 571 | BSUR_Surface_Handle hMainSurface, hMainRSurface; |
|---|
| 572 | BSUR_Surface_Handle hAlphaSurface; |
|---|
| 573 | uint32_t ulNodeInfo; |
|---|
| 574 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 575 | |
|---|
| 576 | BDBG_ENTER(BVDC_Source_GetSurface_isr); |
|---|
| 577 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 578 | |
|---|
| 579 | hSource->hVdc->ulInsideCs++; |
|---|
| 580 | |
|---|
| 581 | if( (NULL != hSource) && (NULL != pGFXPicSetting) ) |
|---|
| 582 | { |
|---|
| 583 | /*BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX);*/ |
|---|
| 584 | |
|---|
| 585 | if( NULL != hSource->hGfxFeeder) |
|---|
| 586 | { |
|---|
| 587 | BVDC_P_GfxFeeder_GetHwUsingSurs_isr( |
|---|
| 588 | hSource->hGfxFeeder, |
|---|
| 589 | &hMainSurface, &hMainRSurface, |
|---|
| 590 | &hAlphaSurface); |
|---|
| 591 | pGFXPicSetting->hSurface = hMainSurface; |
|---|
| 592 | pGFXPicSetting->hRSurface = hMainRSurface; |
|---|
| 593 | } |
|---|
| 594 | else if( NULL != hSource->hVfdFeeder) |
|---|
| 595 | { |
|---|
| 596 | BVDC_P_Feeder_GetSurfaceFromHw_isr(hSource->hVfdFeeder, NULL, pGFXPicSetting, &ulNodeInfo); |
|---|
| 597 | } |
|---|
| 598 | else |
|---|
| 599 | { |
|---|
| 600 | BDBG_ERR(("Not a VFD source handle.")); |
|---|
| 601 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 602 | } |
|---|
| 603 | } |
|---|
| 604 | else |
|---|
| 605 | { |
|---|
| 606 | BDBG_ERR(("Invalid source handle or NULL output addr.")); |
|---|
| 607 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 608 | } |
|---|
| 609 | hSource->hVdc->ulInsideCs--; |
|---|
| 610 | |
|---|
| 611 | BDBG_LEAVE(BVDC_Source_GetSurface_isr); |
|---|
| 612 | return eStatus; |
|---|
| 613 | } |
|---|
| 614 | |
|---|
| 615 | /*************************************************************************** |
|---|
| 616 | * |
|---|
| 617 | */ |
|---|
| 618 | BERR_Code BVDC_Source_GetSurface |
|---|
| 619 | ( BVDC_Source_Handle hSource, |
|---|
| 620 | BAVC_Gfx_Picture *pGFXPicSetting) |
|---|
| 621 | { |
|---|
| 622 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 623 | |
|---|
| 624 | BDBG_ENTER(BVDC_Source_GetSurface); |
|---|
| 625 | |
|---|
| 626 | if(NULL != pGFXPicSetting) |
|---|
| 627 | { |
|---|
| 628 | |
|---|
| 629 | BKNI_EnterCriticalSection(); |
|---|
| 630 | eStatus = BVDC_Source_GetSurface_isr( hSource, pGFXPicSetting); |
|---|
| 631 | BKNI_LeaveCriticalSection(); |
|---|
| 632 | } |
|---|
| 633 | |
|---|
| 634 | BDBG_LEAVE(BVDC_Source_GetSurface); |
|---|
| 635 | return BERR_TRACE(eStatus); |
|---|
| 636 | } |
|---|
| 637 | |
|---|
| 638 | /*************************************************************************** |
|---|
| 639 | * |
|---|
| 640 | */ |
|---|
| 641 | BERR_Code BVDC_Source_GetAlphaSurface_isr |
|---|
| 642 | ( BVDC_Source_Handle hSource, |
|---|
| 643 | BSUR_Surface_Handle *phSurface ) |
|---|
| 644 | { |
|---|
| 645 | BSUR_Surface_Handle hMainSurface; |
|---|
| 646 | BSUR_Surface_Handle hMainRSurface; |
|---|
| 647 | BSUR_Surface_Handle hAlphaSurface; |
|---|
| 648 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 649 | |
|---|
| 650 | BDBG_ENTER(BVDC_Source_GetAlphaSurface_isr); |
|---|
| 651 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 652 | |
|---|
| 653 | hSource->hVdc->ulInsideCs++; |
|---|
| 654 | if( (NULL != hSource) && (NULL != phSurface) ) |
|---|
| 655 | { |
|---|
| 656 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 657 | |
|---|
| 658 | if( NULL != hSource->hGfxFeeder) |
|---|
| 659 | { |
|---|
| 660 | BVDC_P_GfxFeeder_GetHwUsingSurs_isr( |
|---|
| 661 | hSource->hGfxFeeder, &hMainSurface, &hMainRSurface, &hAlphaSurface); |
|---|
| 662 | *phSurface = hAlphaSurface; |
|---|
| 663 | } |
|---|
| 664 | else |
|---|
| 665 | { |
|---|
| 666 | BDBG_ERR(("Not a gfx source handle.")); |
|---|
| 667 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 668 | } |
|---|
| 669 | } |
|---|
| 670 | else |
|---|
| 671 | { |
|---|
| 672 | BDBG_ERR(("Invalid source handle or NULL output addr.")); |
|---|
| 673 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 674 | } |
|---|
| 675 | hSource->hVdc->ulInsideCs--; |
|---|
| 676 | |
|---|
| 677 | BDBG_LEAVE(BVDC_Source_GetAlphaSurface_isr); |
|---|
| 678 | return eStatus; |
|---|
| 679 | } |
|---|
| 680 | |
|---|
| 681 | /*************************************************************************** |
|---|
| 682 | * |
|---|
| 683 | */ |
|---|
| 684 | BERR_Code BVDC_Source_GetAlphaSurface |
|---|
| 685 | ( BVDC_Source_Handle hSource, |
|---|
| 686 | BSUR_Surface_Handle *phSurface ) |
|---|
| 687 | { |
|---|
| 688 | BERR_Code eStatus; |
|---|
| 689 | |
|---|
| 690 | BDBG_ENTER(BVDC_Source_GetAlphaSurface); |
|---|
| 691 | |
|---|
| 692 | BKNI_EnterCriticalSection(); |
|---|
| 693 | eStatus = BVDC_Source_GetAlphaSurface_isr( hSource, phSurface ); |
|---|
| 694 | BKNI_LeaveCriticalSection(); |
|---|
| 695 | |
|---|
| 696 | BDBG_LEAVE(BVDC_Source_GetAlphaSurface); |
|---|
| 697 | return BERR_TRACE(eStatus); |
|---|
| 698 | } |
|---|
| 699 | |
|---|
| 700 | |
|---|
| 701 | /*************************************************************************** |
|---|
| 702 | * |
|---|
| 703 | */ |
|---|
| 704 | BERR_Code BVDC_Source_SetChromaExpansion |
|---|
| 705 | ( BVDC_Source_Handle hSource, |
|---|
| 706 | BVDC_ChromaExpansion eChromaExpansion ) |
|---|
| 707 | { |
|---|
| 708 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 709 | |
|---|
| 710 | BDBG_ENTER(BVDC_Source_SetChromaExpansion); |
|---|
| 711 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 712 | |
|---|
| 713 | if( NULL != hSource ) |
|---|
| 714 | { |
|---|
| 715 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 716 | if( (NULL != hSource->hGfxFeeder) && |
|---|
| 717 | (eChromaExpansion <= BVDC_ChromaExpansion_eLinearInterpolate) ) |
|---|
| 718 | { |
|---|
| 719 | hSource->hGfxFeeder->NewProcCfgInfo.stDirty.stBits.bChangeChromaExpan = 1; |
|---|
| 720 | hSource->hGfxFeeder->NewProcCfgInfo.eChromaExpansion = eChromaExpansion; |
|---|
| 721 | } |
|---|
| 722 | else |
|---|
| 723 | { |
|---|
| 724 | BDBG_ERR(("Not a gfx source handle, or bad eChromaExpansion.")); |
|---|
| 725 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 726 | } |
|---|
| 727 | } |
|---|
| 728 | else |
|---|
| 729 | { |
|---|
| 730 | BDBG_ERR(("Invaid source handle.")); |
|---|
| 731 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 732 | } |
|---|
| 733 | |
|---|
| 734 | BDBG_LEAVE(BVDC_Source_SetChromaExpansion); |
|---|
| 735 | return eStatus; |
|---|
| 736 | } |
|---|
| 737 | |
|---|
| 738 | |
|---|
| 739 | /*************************************************************************** |
|---|
| 740 | * |
|---|
| 741 | */ |
|---|
| 742 | BERR_Code BVDC_Source_EnableColorKey |
|---|
| 743 | ( BVDC_Source_Handle hSource, |
|---|
| 744 | uint32_t ulMinAC2C1C0, |
|---|
| 745 | uint32_t ulMaxAC2C1C0, |
|---|
| 746 | uint32_t ulMaskAC2C1C0, |
|---|
| 747 | uint8_t ucKeyedAlpha ) |
|---|
| 748 | { |
|---|
| 749 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 750 | |
|---|
| 751 | BDBG_ENTER(BVDC_Source_EnableColorKey); |
|---|
| 752 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 753 | |
|---|
| 754 | if( NULL != hSource ) |
|---|
| 755 | { |
|---|
| 756 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 757 | if( NULL != hSource->hGfxFeeder) |
|---|
| 758 | { |
|---|
| 759 | hSource->hGfxFeeder->NewProcCfgInfo.stDirty.stBits.bChangeKey = 1; |
|---|
| 760 | hSource->hGfxFeeder->NewProcCfgInfo.stFlags.bEnableKey = 1; |
|---|
| 761 | hSource->hGfxFeeder->NewProcCfgInfo.ulKeyMinAMNO = ulMinAC2C1C0; |
|---|
| 762 | hSource->hGfxFeeder->NewProcCfgInfo.ulKeyMaxAMNO = ulMaxAC2C1C0; |
|---|
| 763 | hSource->hGfxFeeder->NewProcCfgInfo.ulKeyMaskAMNO = ulMaskAC2C1C0; |
|---|
| 764 | hSource->hGfxFeeder->NewProcCfgInfo.ucKeyedAlpha = ucKeyedAlpha; |
|---|
| 765 | } |
|---|
| 766 | else |
|---|
| 767 | { |
|---|
| 768 | BDBG_ERR(("Not a gfx source handle.")); |
|---|
| 769 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 770 | } |
|---|
| 771 | } |
|---|
| 772 | else |
|---|
| 773 | { |
|---|
| 774 | BDBG_ERR(("Invaid source handle.")); |
|---|
| 775 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 776 | } |
|---|
| 777 | |
|---|
| 778 | BDBG_LEAVE(BVDC_Source_EnableColorKey); |
|---|
| 779 | return eStatus; |
|---|
| 780 | } |
|---|
| 781 | |
|---|
| 782 | |
|---|
| 783 | /*************************************************************************** |
|---|
| 784 | * |
|---|
| 785 | */ |
|---|
| 786 | BERR_Code BVDC_Source_DisableColorKey |
|---|
| 787 | ( BVDC_Source_Handle hSource ) |
|---|
| 788 | { |
|---|
| 789 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 790 | |
|---|
| 791 | |
|---|
| 792 | BDBG_ENTER(BVDC_Source_DisableColorKey); |
|---|
| 793 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 794 | |
|---|
| 795 | if( NULL != hSource ) |
|---|
| 796 | { |
|---|
| 797 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 798 | if( NULL != hSource->hGfxFeeder) |
|---|
| 799 | { |
|---|
| 800 | hSource->hGfxFeeder->NewProcCfgInfo.stFlags.bEnableKey = 0; |
|---|
| 801 | } |
|---|
| 802 | else |
|---|
| 803 | { |
|---|
| 804 | BDBG_ERR(("Not a gfx source handle.")); |
|---|
| 805 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 806 | } |
|---|
| 807 | } |
|---|
| 808 | else |
|---|
| 809 | { |
|---|
| 810 | BDBG_ERR(("Invaid source handle.")); |
|---|
| 811 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 812 | } |
|---|
| 813 | |
|---|
| 814 | BDBG_LEAVE(BVDC_Source_DisableColorKey); |
|---|
| 815 | return eStatus; |
|---|
| 816 | } |
|---|
| 817 | |
|---|
| 818 | |
|---|
| 819 | /*************************************************************************** |
|---|
| 820 | * |
|---|
| 821 | */ |
|---|
| 822 | BERR_Code BVDC_Source_SetHorizontalScaleCoeffs |
|---|
| 823 | ( BVDC_Source_Handle hSource, |
|---|
| 824 | BVDC_FilterCoeffs eCoeffs ) |
|---|
| 825 | { |
|---|
| 826 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 827 | |
|---|
| 828 | BDBG_ENTER(BVDC_Source_SetHorizontalScaleCoeffs); |
|---|
| 829 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 830 | |
|---|
| 831 | if( NULL != hSource ) |
|---|
| 832 | { |
|---|
| 833 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 834 | if( (NULL != hSource->hGfxFeeder) && |
|---|
| 835 | (eCoeffs <= BVDC_FilterCoeffs_eSharp) ) |
|---|
| 836 | { |
|---|
| 837 | hSource->hGfxFeeder->NewProcCfgInfo.stDirty.stBits.bChangeScaleCoeffs = 1; |
|---|
| 838 | hSource->hGfxFeeder->NewProcCfgInfo.eScaleCoeffs = eCoeffs; |
|---|
| 839 | } |
|---|
| 840 | else |
|---|
| 841 | { |
|---|
| 842 | BDBG_ERR(("Not a gfx source handle, or bad eCoeffs.")); |
|---|
| 843 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 844 | } |
|---|
| 845 | } |
|---|
| 846 | else |
|---|
| 847 | { |
|---|
| 848 | BDBG_ERR(("Invaid source handle.")); |
|---|
| 849 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 850 | } |
|---|
| 851 | |
|---|
| 852 | BDBG_LEAVE(BVDC_Source_SetHorizontalScaleCoeffs); |
|---|
| 853 | return eStatus; |
|---|
| 854 | } |
|---|
| 855 | |
|---|
| 856 | #define GFD_MAX_NUM_GAMMA_T_ENTR 256 |
|---|
| 857 | |
|---|
| 858 | /*************************************************************************** |
|---|
| 859 | * |
|---|
| 860 | */ |
|---|
| 861 | BERR_Code BVDC_Source_EnableGammaCorrection |
|---|
| 862 | ( BVDC_Source_Handle hSource, |
|---|
| 863 | uint32_t ulNumEntries, |
|---|
| 864 | uint32_t *pulGammaTable ) |
|---|
| 865 | { |
|---|
| 866 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 867 | uint32_t ulClutOffset; |
|---|
| 868 | |
|---|
| 869 | BDBG_ENTER(BVDC_Source_EnableGammaCorrection); |
|---|
| 870 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 871 | |
|---|
| 872 | if( (NULL != hSource) && (256 == ulNumEntries) ) |
|---|
| 873 | { |
|---|
| 874 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 875 | |
|---|
| 876 | #if (BVDC_P_SUPPORT_GFD_VER_0 == BVDC_P_SUPPORT_GFD1_VER) |
|---|
| 877 | if (BVDC_P_GfxFeederId_eGfx1 == hSource->hGfxFeeder->eId) |
|---|
| 878 | { |
|---|
| 879 | return BERR_TRACE(BVDC_ERR_GFX_UNSUPPORTED_GAMMATABLE); |
|---|
| 880 | } |
|---|
| 881 | #endif |
|---|
| 882 | |
|---|
| 883 | if( (NULL != hSource->hGfxFeeder) && |
|---|
| 884 | (ulNumEntries <= GFD_MAX_NUM_GAMMA_T_ENTR) ) |
|---|
| 885 | { |
|---|
| 886 | eStatus = BMEM_Heap_ConvertAddressToOffset( hSource->hGfxFeeder->hMemory, |
|---|
| 887 | (void *) pulGammaTable, |
|---|
| 888 | &ulClutOffset ); |
|---|
| 889 | if ( BERR_SUCCESS == eStatus ) |
|---|
| 890 | { |
|---|
| 891 | /* user might use the same clut buf, but change the content */ |
|---|
| 892 | hSource->hGfxFeeder->NewProcCfgInfo.stDirty.stBits.bChangeGammaTable = 1; |
|---|
| 893 | hSource->hGfxFeeder->NewProcCfgInfo.stFlags.bEnableGammaCorrection = 1; |
|---|
| 894 | hSource->hGfxFeeder->NewProcCfgInfo.ulNumGammaClutEntries = ulNumEntries; |
|---|
| 895 | hSource->hGfxFeeder->NewProcCfgInfo.ulGammaClutAddress = ulClutOffset; |
|---|
| 896 | } |
|---|
| 897 | else |
|---|
| 898 | { |
|---|
| 899 | BDBG_ERR(("Gamma table buf not Alloced by BMEM.")); |
|---|
| 900 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 901 | } |
|---|
| 902 | } |
|---|
| 903 | else |
|---|
| 904 | { |
|---|
| 905 | BDBG_ERR(("Not a gfx source handle, or bad ulNumEntries.")); |
|---|
| 906 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 907 | } |
|---|
| 908 | } |
|---|
| 909 | else |
|---|
| 910 | { |
|---|
| 911 | BDBG_ERR(("Invaid source handle.")); |
|---|
| 912 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 913 | } |
|---|
| 914 | |
|---|
| 915 | BDBG_LEAVE(BVDC_Source_EnableGammaCorrection); |
|---|
| 916 | return eStatus; |
|---|
| 917 | } |
|---|
| 918 | |
|---|
| 919 | |
|---|
| 920 | /*************************************************************************** |
|---|
| 921 | * |
|---|
| 922 | */ |
|---|
| 923 | BERR_Code BVDC_Source_DisableGammaCorrection |
|---|
| 924 | ( BVDC_Source_Handle hSource ) |
|---|
| 925 | { |
|---|
| 926 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 927 | |
|---|
| 928 | |
|---|
| 929 | BDBG_ENTER(BVDC_Source_DisableGammaCorrection); |
|---|
| 930 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 931 | |
|---|
| 932 | if( NULL != hSource ) |
|---|
| 933 | { |
|---|
| 934 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 935 | if( NULL != hSource->hGfxFeeder) |
|---|
| 936 | { |
|---|
| 937 | hSource->hGfxFeeder->NewProcCfgInfo.stFlags.bEnableGammaCorrection = 0; |
|---|
| 938 | } |
|---|
| 939 | else |
|---|
| 940 | { |
|---|
| 941 | BDBG_ERR(("Not a gfx source handle.")); |
|---|
| 942 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 943 | } |
|---|
| 944 | } |
|---|
| 945 | else |
|---|
| 946 | { |
|---|
| 947 | BDBG_ERR(("Invaid source handle.")); |
|---|
| 948 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 949 | } |
|---|
| 950 | |
|---|
| 951 | BDBG_LEAVE(BVDC_Source_DisableGammaCorrection); |
|---|
| 952 | return eStatus; |
|---|
| 953 | } |
|---|
| 954 | |
|---|
| 955 | |
|---|
| 956 | /*************************************************************************** |
|---|
| 957 | * |
|---|
| 958 | */ |
|---|
| 959 | BERR_Code BVDC_Source_SetConstantColor |
|---|
| 960 | ( BVDC_Source_Handle hSource, |
|---|
| 961 | uint8_t ucRed, |
|---|
| 962 | uint8_t ucGreen, |
|---|
| 963 | uint8_t ucBlue ) |
|---|
| 964 | { |
|---|
| 965 | BERR_Code eStatus = BERR_SUCCESS; |
|---|
| 966 | |
|---|
| 967 | BDBG_ENTER(BVDC_Source_SetConstantColor); |
|---|
| 968 | BDBG_OBJECT_ASSERT(hSource, BVDC_SRC); |
|---|
| 969 | |
|---|
| 970 | if( NULL != hSource ) |
|---|
| 971 | { |
|---|
| 972 | BDBG_OBJECT_ASSERT(hSource->hGfxFeeder, BVDC_GFX); |
|---|
| 973 | if( NULL != hSource->hGfxFeeder) |
|---|
| 974 | { |
|---|
| 975 | hSource->hGfxFeeder->NewProcCfgInfo.stDirty.stBits.bChangeConstantColor = 1; |
|---|
| 976 | hSource->hGfxFeeder->NewProcCfgInfo.ulConstantColor = |
|---|
| 977 | (ucRed << 16) | (ucGreen << 8) | (ucBlue); |
|---|
| 978 | } |
|---|
| 979 | else |
|---|
| 980 | { |
|---|
| 981 | BDBG_ERR(("Not a gfx source handle.")); |
|---|
| 982 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 983 | } |
|---|
| 984 | } |
|---|
| 985 | else |
|---|
| 986 | { |
|---|
| 987 | BDBG_ERR(("Invaid source handle.")); |
|---|
| 988 | eStatus = BERR_TRACE(BERR_INVALID_PARAMETER); |
|---|
| 989 | } |
|---|
| 990 | |
|---|
| 991 | BDBG_LEAVE(BVDC_Source_SetConstantColor); |
|---|
| 992 | return eStatus; |
|---|
| 993 | } |
|---|
| 994 | |
|---|
| 995 | |
|---|
| 996 | |
|---|
| 997 | /* End of File */ |
|---|