| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2007-2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: bhdm_edid_3d.c $ |
|---|
| 39 | * $brcm_Revision: Hydra_Software_Devel/5 $ |
|---|
| 40 | * $brcm_Date: 11/21/11 6:25p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /magnum/portinginterface/hdm/7038/bhdm_edid_3d.c $ |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/5 11/21/11 6:25p rgreen |
|---|
| 49 | * SW7125-1129: Fix non debug build warning |
|---|
| 50 | * |
|---|
| 51 | * Hydra_Software_Devel/4 11/21/11 6:00p rgreen |
|---|
| 52 | * SW7125-1129: Fix coverity overrun error |
|---|
| 53 | * |
|---|
| 54 | * Hydra_Software_Devel/3 10/13/11 3:55p vle |
|---|
| 55 | * SW7125-1110: Merge to mainline - Fix coverity issue |
|---|
| 56 | * |
|---|
| 57 | * Hydra_Software_Devel/SW7420-2056/2 10/7/11 4:39p vle |
|---|
| 58 | * SW7231-345, SW7125-1110: Fix coverity issue. |
|---|
| 59 | * |
|---|
| 60 | * Hydra_Software_Devel/2 9/15/11 6:07p vle |
|---|
| 61 | * SW7420-2056: merge to mainline |
|---|
| 62 | * |
|---|
| 63 | * Hydra_Software_Devel/SW7420-2056/1 9/15/11 3:51p vle |
|---|
| 64 | * SW7420-2056: Fix incorrect Hdmi 3D formats support from parsing EDID |
|---|
| 65 | * |
|---|
| 66 | * Hydra_Software_Devel/1 6/17/11 1:46p vle |
|---|
| 67 | * SW7405-5358, SW7405-5312: EDID parser for 3D and HDMI 1.4 features |
|---|
| 68 | * |
|---|
| 69 | ***************************************************************************/ |
|---|
| 70 | |
|---|
| 71 | #include "bhdm_priv.h" |
|---|
| 72 | #include "bhdm_edid_3d.h" |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | BDBG_MODULE(BHDM_EDID) ; |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | #define BHDM_CHECK_RC( rc, func ) \ |
|---|
| 79 | do \ |
|---|
| 80 | { \ |
|---|
| 81 | if( (rc = BERR_TRACE(func)) != BERR_SUCCESS ) \ |
|---|
| 82 | { \ |
|---|
| 83 | goto done; \ |
|---|
| 84 | } \ |
|---|
| 85 | } while(0) |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | static void BHDM_EDID_P_CheckSupportedHdmi3DFormats(BHDM_Handle hHDMI); |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | /****************************************************************************** |
|---|
| 92 | Summary: |
|---|
| 93 | Return all 3D video formats supported by the attached monitor. |
|---|
| 94 | *******************************************************************************/ |
|---|
| 95 | BERR_Code BHDM_EDID_GetSupported3DFormats( |
|---|
| 96 | BHDM_Handle hHDMI, /* [in] HDMI handle */ |
|---|
| 97 | BHDM_EDID_3D_Structure_ALL *_3DFormats /* [out] supported true/false */ |
|---|
| 98 | ) |
|---|
| 99 | { |
|---|
| 100 | BERR_Code rc = BERR_SUCCESS ; |
|---|
| 101 | |
|---|
| 102 | BDBG_ENTER(BHDM_EDID_GetSupported3DFormats) ; |
|---|
| 103 | |
|---|
| 104 | BKNI_Memset(_3DFormats, 0, sizeof(BHDM_EDID_3D_Structure_ALL)) ; |
|---|
| 105 | |
|---|
| 106 | /* Need HDMI for 3D Support */ |
|---|
| 107 | if (!hHDMI->AttachedEDID.RxHasHdmiSupport) |
|---|
| 108 | goto done ; |
|---|
| 109 | |
|---|
| 110 | if (hHDMI->edidStatus == BHDM_EDID_STATE_eInvalid) { |
|---|
| 111 | rc = BHDM_EDID_NOT_FOUND ; |
|---|
| 112 | goto done ; |
|---|
| 113 | } |
|---|
| 114 | |
|---|
| 115 | if (hHDMI->AttachedEDID.Bcm3DFormatsChecked == 0) |
|---|
| 116 | { |
|---|
| 117 | rc = BHDM_EDID_VIDEO_FORMATS_UNAVAILABLE ; |
|---|
| 118 | goto done ; |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | BKNI_Memcpy(_3DFormats, &hHDMI->AttachedEDID.BcmSupported3DFormats, |
|---|
| 122 | sizeof(hHDMI->AttachedEDID.BcmSupported3DFormats)) ; |
|---|
| 123 | |
|---|
| 124 | done: |
|---|
| 125 | BDBG_LEAVE(BHDM_EDID_GetSupported3DFormats) ; |
|---|
| 126 | return rc ; |
|---|
| 127 | |
|---|
| 128 | } /* BHDM_EDID_GetSupported3DFormats */ |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | static void BHDM_EDID_P_ParseVsdb3dStruct(BHDM_Handle hHDMI, uint8_t DataBlockIndex, uint8_t *index) |
|---|
| 132 | { |
|---|
| 133 | hHDMI->AttachedEDID.BcmSupported3DStructureAll = |
|---|
| 134 | (hHDMI->AttachedEDID.Block[DataBlockIndex + *index] << 8) |
|---|
| 135 | | hHDMI->AttachedEDID.Block[DataBlockIndex + *index + 1] ; |
|---|
| 136 | BDBG_WRN(("3D_Structure_ALL: %#04x located at offset %#02x (%d)", |
|---|
| 137 | hHDMI->AttachedEDID.BcmSupported3DStructureAll, DataBlockIndex + *index, DataBlockIndex + *index)) ; |
|---|
| 138 | *index = *index + 2 ; |
|---|
| 139 | |
|---|
| 140 | #if BHDM_CONFIG_DEBUG_EDID_3DSTRUCT |
|---|
| 141 | if (hHDMI->AttachedEDID.BcmSupported3DStructureAll & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_FRAME_PACKING) { |
|---|
| 142 | BDBG_WRN(("Rx Supports 3D FramePacking")) ; |
|---|
| 143 | } |
|---|
| 144 | |
|---|
| 145 | if (hHDMI->AttachedEDID.BcmSupported3DStructureAll & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_FIELD_ALTERNATIVE) { |
|---|
| 146 | BDBG_WRN(("Rx Supports 3D Field Alternative")) ; |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | if (hHDMI->AttachedEDID.BcmSupported3DStructureAll & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_LINE_ALTERNATIVE) { |
|---|
| 150 | BDBG_WRN(("Rx Supports 3D Line Alternative")) ; |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | if (hHDMI->AttachedEDID.BcmSupported3DStructureAll & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_SBS_FULL) { |
|---|
| 154 | BDBG_WRN(("Rx Supports 3D Side by Side Full")) ; |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | if (hHDMI->AttachedEDID.BcmSupported3DStructureAll & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_LDEPTH) { |
|---|
| 158 | BDBG_WRN(("Rx Supports 3D Line Depth")) ; |
|---|
| 159 | } |
|---|
| 160 | |
|---|
| 161 | if (hHDMI->AttachedEDID.BcmSupported3DStructureAll & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_LDEPTH_GFX) { |
|---|
| 162 | BDBG_WRN(("Rx Supports 3D LDepth + Graphics")) ; |
|---|
| 163 | } |
|---|
| 164 | |
|---|
| 165 | if (hHDMI->AttachedEDID.BcmSupported3DStructureAll & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_TOP_BOTTOM) { |
|---|
| 166 | BDBG_WRN(("Rx Supports 3D Top and Bottom")) ; |
|---|
| 167 | } |
|---|
| 168 | |
|---|
| 169 | if (hHDMI->AttachedEDID.BcmSupported3DStructureAll & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_SBS_HALF_HORIZ) { |
|---|
| 170 | BDBG_WRN(("Rx Supports 3D Side by Side Half")) ; |
|---|
| 171 | } |
|---|
| 172 | #endif |
|---|
| 173 | |
|---|
| 174 | return; |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | static void BHDM_EDID_P_ParseVsdb3dMask(BHDM_Handle hHDMI, uint8_t DataBlockIndex, uint8_t *index) |
|---|
| 179 | { |
|---|
| 180 | uint16_t Edid3DMask ; |
|---|
| 181 | uint16_t i; |
|---|
| 182 | BHDM_EDID_P_VideoDescriptor *pVideoDescriptor ; |
|---|
| 183 | |
|---|
| 184 | Edid3DMask = |
|---|
| 185 | (hHDMI->AttachedEDID.Block[DataBlockIndex + *index] << 8) |
|---|
| 186 | | hHDMI->AttachedEDID.Block[DataBlockIndex + *index + 1] ; |
|---|
| 187 | BDBG_WRN(("3D_Structure_MASK: %#04x located at offset %#02x (%d)", |
|---|
| 188 | Edid3DMask, DataBlockIndex + *index, DataBlockIndex + *index)) ; |
|---|
| 189 | *index = *index + 2 ; |
|---|
| 190 | |
|---|
| 191 | #if BHDM_CONFIG_DEBUG_EDID_3DMASK |
|---|
| 192 | if (Edid3DMask) |
|---|
| 193 | BDBG_WRN(("Rx Supports 3D_Structure_ALL for the following formats:")); |
|---|
| 194 | #endif |
|---|
| 195 | |
|---|
| 196 | pVideoDescriptor = BLST_Q_FIRST(&hHDMI->AttachedEDID.VideoDescriptorList); |
|---|
| 197 | for (i=0; i<16 && pVideoDescriptor; i++) |
|---|
| 198 | { |
|---|
| 199 | if (hHDMI->AttachedEDID.First16VideoDescriptorsMask & (1 << i)) |
|---|
| 200 | { |
|---|
| 201 | if (Edid3DMask & (1 << i)) |
|---|
| 202 | { |
|---|
| 203 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 204 | hHDMI->AttachedEDID.BcmSupported3DStructureAll; |
|---|
| 205 | |
|---|
| 206 | #if BHDM_CONFIG_DEBUG_EDID_3DMASK |
|---|
| 207 | BDBG_WRN((" %s", |
|---|
| 208 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 209 | #endif |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | pVideoDescriptor = BLST_Q_NEXT(pVideoDescriptor, link); |
|---|
| 213 | } |
|---|
| 214 | } |
|---|
| 215 | |
|---|
| 216 | return; |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | void BHDM_EDID_P_ParseVSDB3D(BHDM_Handle hHDMI, uint8_t DataBlockIndex, uint8_t *offset, uint8_t DataBlockLength) |
|---|
| 221 | { |
|---|
| 222 | uint8_t i; |
|---|
| 223 | uint8_t offsetByte; |
|---|
| 224 | uint8_t additional3dFmtBytes; |
|---|
| 225 | uint8_t _2dVicOrderX, _3dStructureX, _3dDetailX=0x0F; |
|---|
| 226 | BHDM_EDID_P_VideoDescriptor *pVideoDescriptor ; |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | /* check for HDMI VICs and 3D support info */ |
|---|
| 230 | offsetByte = hHDMI->AttachedEDID.Block[DataBlockIndex + *offset] ; |
|---|
| 231 | (*offset)++; |
|---|
| 232 | |
|---|
| 233 | |
|---|
| 234 | /* retrieve 3D_present, 3D_Multi_present fields */ |
|---|
| 235 | hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Present = (offsetByte & 0x80) >> 7 ; |
|---|
| 236 | hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Multi_Present = (offsetByte & 0x60) >> 5 ; |
|---|
| 237 | hHDMI->AttachedEDID.RxVSDB.HDMI_Image_Size = (offsetByte & 0x18) >> 3 ; |
|---|
| 238 | |
|---|
| 239 | BDBG_MSG(("HDMI_3D_Present=%d, HDMI_3D_Multi_Present=%d, HDMI_Image_Size=%d", |
|---|
| 240 | hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Present, hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Multi_Present, |
|---|
| 241 | hHDMI->AttachedEDID.RxVSDB.HDMI_Image_Size)); |
|---|
| 242 | |
|---|
| 243 | /************************ |
|---|
| 244 | * Rx has 3D support. |
|---|
| 245 | * It must support all the mandatory formats below |
|---|
| 246 | *************************/ |
|---|
| 247 | if (hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Present) |
|---|
| 248 | { |
|---|
| 249 | hHDMI->AttachedEDID.BcmSupported3DFormats[BFMT_VideoFmt_e1080p_24Hz] = |
|---|
| 250 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_FRAME_PACKING |
|---|
| 251 | | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_TOP_BOTTOM ; |
|---|
| 252 | |
|---|
| 253 | |
|---|
| 254 | if ((50 >= hHDMI->AttachedEDID.MonitorRange.MinVertical) && |
|---|
| 255 | (50 <= hHDMI->AttachedEDID.MonitorRange.MaxVertical)) |
|---|
| 256 | { |
|---|
| 257 | hHDMI->AttachedEDID.BcmSupported3DFormats[BFMT_VideoFmt_e720p_50Hz] = |
|---|
| 258 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_FRAME_PACKING |
|---|
| 259 | | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_TOP_BOTTOM ; |
|---|
| 260 | |
|---|
| 261 | hHDMI->AttachedEDID.BcmSupported3DFormats[BFMT_VideoFmt_e1080i_50Hz] = |
|---|
| 262 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_SBS_HALF_HORIZ ; |
|---|
| 263 | } |
|---|
| 264 | |
|---|
| 265 | if ((59 >= hHDMI->AttachedEDID.MonitorRange.MinVertical) && |
|---|
| 266 | (59 <= hHDMI->AttachedEDID.MonitorRange.MaxVertical)) |
|---|
| 267 | { |
|---|
| 268 | hHDMI->AttachedEDID.BcmSupported3DFormats[BFMT_VideoFmt_e720p] = |
|---|
| 269 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_FRAME_PACKING |
|---|
| 270 | | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_TOP_BOTTOM ; |
|---|
| 271 | hHDMI->AttachedEDID.BcmSupported3DFormats[BFMT_VideoFmt_e1080i] = |
|---|
| 272 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_SBS_HALF_HORIZ ; |
|---|
| 273 | } |
|---|
| 274 | } |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | offsetByte = hHDMI->AttachedEDID.Block[DataBlockIndex + *offset] ; |
|---|
| 278 | (*offset)++; |
|---|
| 279 | |
|---|
| 280 | hHDMI->AttachedEDID.RxVSDB.HDMI_VIC_Len = (offsetByte & 0xE0) >> 5 ; |
|---|
| 281 | hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Len = (offsetByte & 0x1F) ; |
|---|
| 282 | additional3dFmtBytes = hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Len; |
|---|
| 283 | |
|---|
| 284 | /* finished parsing 3D_present, 3D_Multi_present, HDMI_VIC_LEN, and HDMI_3D_LEN */ |
|---|
| 285 | if (*offset > DataBlockLength) |
|---|
| 286 | goto done ; /* no more optional data */ |
|---|
| 287 | |
|---|
| 288 | |
|---|
| 289 | /****** |
|---|
| 290 | TODO HDMI Extended Resolutions are currently not supported |
|---|
| 291 | *******/ |
|---|
| 292 | for (i = 0 ; i < hHDMI->AttachedEDID.RxVSDB.HDMI_VIC_Len; i++) |
|---|
| 293 | { |
|---|
| 294 | uint8_t hdmiVic ; |
|---|
| 295 | |
|---|
| 296 | hdmiVic = hHDMI->AttachedEDID.Block[DataBlockIndex + *offset] ; |
|---|
| 297 | (*offset)++ ; |
|---|
| 298 | BDBG_WRN(("No Support for HDMI VIC %d", hdmiVic)) ; |
|---|
| 299 | } |
|---|
| 300 | |
|---|
| 301 | |
|---|
| 302 | /******** |
|---|
| 303 | Parse 3D Timing/Structure |
|---|
| 304 | |
|---|
| 305 | if 3D_Multi_Present = 00 |
|---|
| 306 | 3D_Structure_ALL_15...0 and |
|---|
| 307 | 3D_MASK_15..0 are not present |
|---|
| 308 | |
|---|
| 309 | if 3D_Multi_Present = 01 |
|---|
| 310 | 3D_Structure_ALL_15...0 is present and assigns 3D formats to all the VICs listed in the first 16 entires in the EDID |
|---|
| 311 | 3D_MASK_15..0 is not present |
|---|
| 312 | |
|---|
| 313 | if 3D_Multi_Present = 10 |
|---|
| 314 | 3D_Structure_ALL_15...0 and |
|---|
| 315 | 3D_MASK_15..0 are present and assign 3D formats to some of the VICs listed in the first 16 entires in the EDID |
|---|
| 316 | |
|---|
| 317 | if 3D_Multi_Present = 11 |
|---|
| 318 | Reserved for future use |
|---|
| 319 | 3D_Structure_ALL_15...0 and |
|---|
| 320 | 3D_MASK_15..0 are not present |
|---|
| 321 | ********/ |
|---|
| 322 | #define BHDM_EDID_P_VSDB_3D_MULTI_NONE 0x0 |
|---|
| 323 | #define BHDM_EDID_P_VSDB_3D_MULTI_STRUCT 0x1 |
|---|
| 324 | #define BHDM_EDID_P_VSDB_3D_MULTI_STRUCT_AND_MASK 0x2 |
|---|
| 325 | #define BHDM_EDID_P_VSDB_3D_MULTI_RESERVED 0x3 |
|---|
| 326 | |
|---|
| 327 | switch(hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Multi_Present) |
|---|
| 328 | { |
|---|
| 329 | case BHDM_EDID_P_VSDB_3D_MULTI_STRUCT : |
|---|
| 330 | BHDM_EDID_P_ParseVsdb3dStruct(hHDMI, DataBlockIndex, offset) ; |
|---|
| 331 | additional3dFmtBytes -= 2; |
|---|
| 332 | |
|---|
| 333 | #if BHDM_CONFIG_DEBUG_EDID_3DSTRUCT |
|---|
| 334 | BDBG_WRN(("All 3D Structures are supported on the first 16th Short Video Descriptors")); |
|---|
| 335 | #endif |
|---|
| 336 | /* Set 3D Structure support for ALL of the first 16 short video descriptors */ |
|---|
| 337 | pVideoDescriptor = BLST_Q_FIRST(&hHDMI->AttachedEDID.VideoDescriptorList); |
|---|
| 338 | for (i=0; i<16 && pVideoDescriptor; i++) |
|---|
| 339 | { |
|---|
| 340 | if (hHDMI->AttachedEDID.First16VideoDescriptorsMask & (1 << i)) |
|---|
| 341 | { |
|---|
| 342 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 343 | hHDMI->AttachedEDID.BcmSupported3DStructureAll; |
|---|
| 344 | pVideoDescriptor = BLST_Q_NEXT(pVideoDescriptor, link); |
|---|
| 345 | } |
|---|
| 346 | } |
|---|
| 347 | break ; |
|---|
| 348 | |
|---|
| 349 | case BHDM_EDID_P_VSDB_3D_MULTI_STRUCT_AND_MASK : |
|---|
| 350 | BHDM_EDID_P_ParseVsdb3dStruct(hHDMI, DataBlockIndex, offset) ; |
|---|
| 351 | BHDM_EDID_P_ParseVsdb3dMask(hHDMI, DataBlockIndex, offset) ; |
|---|
| 352 | additional3dFmtBytes -= 4; |
|---|
| 353 | break; |
|---|
| 354 | |
|---|
| 355 | case BHDM_EDID_P_VSDB_3D_MULTI_NONE : |
|---|
| 356 | /* do nothing */ |
|---|
| 357 | break ; |
|---|
| 358 | |
|---|
| 359 | default : |
|---|
| 360 | case BHDM_EDID_P_VSDB_3D_MULTI_RESERVED : |
|---|
| 361 | BDBG_WRN(("Use of 3D_Multi_Present Reserved Value %#x; No 3D formats detected", |
|---|
| 362 | hHDMI->AttachedEDID.RxVSDB.HDMI_3D_Multi_Present)) ; |
|---|
| 363 | break ; |
|---|
| 364 | } |
|---|
| 365 | |
|---|
| 366 | |
|---|
| 367 | /* Parse additional 3D Timing/Structure Support indication if applicable */ |
|---|
| 368 | do |
|---|
| 369 | { |
|---|
| 370 | offsetByte = hHDMI->AttachedEDID.Block[DataBlockIndex + *offset] ; |
|---|
| 371 | (*offset)++; |
|---|
| 372 | additional3dFmtBytes--; |
|---|
| 373 | |
|---|
| 374 | _2dVicOrderX = (offsetByte & 0xF0) >> 4 ; |
|---|
| 375 | _3dStructureX = (offsetByte & 0x0F); |
|---|
| 376 | if (_3dStructureX == BHDM_EDID_VSDB_3D_STRUCTURE_X_SBS_HALF) |
|---|
| 377 | { |
|---|
| 378 | offsetByte = hHDMI->AttachedEDID.Block[DataBlockIndex + *offset] ; |
|---|
| 379 | (*offset)++; |
|---|
| 380 | _3dDetailX = (offsetByte & 0xF0) >> 4 ; |
|---|
| 381 | additional3dFmtBytes--; |
|---|
| 382 | } |
|---|
| 383 | |
|---|
| 384 | /* Set the supported 3D Structure for the specific 2D video format */ |
|---|
| 385 | pVideoDescriptor = BLST_Q_FIRST(&hHDMI->AttachedEDID.VideoDescriptorList); |
|---|
| 386 | for (i=0; i<16 && pVideoDescriptor; i++) |
|---|
| 387 | { |
|---|
| 388 | if (!(hHDMI->AttachedEDID.First16VideoDescriptorsMask & (1 << i))) |
|---|
| 389 | continue; |
|---|
| 390 | |
|---|
| 391 | if (i != _2dVicOrderX) |
|---|
| 392 | goto next_format; |
|---|
| 393 | |
|---|
| 394 | switch (_3dStructureX) |
|---|
| 395 | { |
|---|
| 396 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_FRAME_PACKING: |
|---|
| 397 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 398 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_FRAME_PACKING; |
|---|
| 399 | BDBG_MSG(("Rx supports 3D Frame Packing for %s format", |
|---|
| 400 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 401 | break; |
|---|
| 402 | |
|---|
| 403 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_FIELD_ALTERNATIVE: |
|---|
| 404 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 405 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_FIELD_ALTERNATIVE; |
|---|
| 406 | BDBG_MSG(("Rx supports 3D Field Alternative for %s format", |
|---|
| 407 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 408 | break; |
|---|
| 409 | |
|---|
| 410 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_LINE_ALTERNATIVE: |
|---|
| 411 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 412 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_LINE_ALTERNATIVE; |
|---|
| 413 | BDBG_MSG(("Rx supports 3D Line Alternative for %s format", |
|---|
| 414 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 415 | break; |
|---|
| 416 | |
|---|
| 417 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_SBS_FULL: |
|---|
| 418 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 419 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_SBS_FULL; |
|---|
| 420 | BDBG_MSG(("Rx supports 3D SidebySide Full for %s format", |
|---|
| 421 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 422 | break; |
|---|
| 423 | |
|---|
| 424 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_LDEPTH: |
|---|
| 425 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 426 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_LDEPTH; |
|---|
| 427 | BDBG_MSG(("Rx supports 3D LDepth for %s format", |
|---|
| 428 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 429 | break; |
|---|
| 430 | |
|---|
| 431 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_LDEPTH_GFX: |
|---|
| 432 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 433 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_LDEPTH_GFX; |
|---|
| 434 | BDBG_MSG(("Rx supports 3D LDepth GFX for %s format", |
|---|
| 435 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 436 | break; |
|---|
| 437 | |
|---|
| 438 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_TOP_BOTTOM: |
|---|
| 439 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 440 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_TOP_BOTTOM; |
|---|
| 441 | BDBG_MSG(("Rx supports 3D TopAndBottom for %s format", |
|---|
| 442 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 443 | break; |
|---|
| 444 | |
|---|
| 445 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_SBS_HALF: |
|---|
| 446 | if (_3dDetailX <= BHDM_EDID_VSDB_3D_EXT_DATA_HORIZ_SUB_SAMPLING) { |
|---|
| 447 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 448 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_SBS_HALF_HORIZ; |
|---|
| 449 | BDBG_MSG(("Rx supports 3D SidexSide Half with Horizontal sub-sampling for %s format", |
|---|
| 450 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 451 | } |
|---|
| 452 | else if (_3dDetailX <= BHDM_EDID_VSDB_3D_EXT_DATA_QUINCUNX_MATRIX) { |
|---|
| 453 | hHDMI->AttachedEDID.BcmSupported3DFormats[(BFMT_VideoFmt) pVideoDescriptor->eVideoFmt] |= |
|---|
| 454 | BHDM_EDID_VSDB_3D_STRUCTURE_ALL_SBS_HALF_QUINC; |
|---|
| 455 | BDBG_MSG(("Rx supports 3D SidexSide Half Quincunx matrix for %s format", |
|---|
| 456 | (char *) BAVC_HDMI_AviInfoFrame_VideoIdCodeToStr((uint8_t) pVideoDescriptor->VideoIdCode))); |
|---|
| 457 | } |
|---|
| 458 | break; |
|---|
| 459 | |
|---|
| 460 | case BHDM_EDID_VSDB_3D_STRUCTURE_X_RESERVED: |
|---|
| 461 | default: |
|---|
| 462 | BDBG_MSG(("RESERVED 3D_Structure_X")); |
|---|
| 463 | break; |
|---|
| 464 | } |
|---|
| 465 | |
|---|
| 466 | /* Already found the corresponding 2D_VIC and set the supported 3D format. |
|---|
| 467 | Stop searching and move on to the next 2D_VIC, break out of the for loop. */ |
|---|
| 468 | break; |
|---|
| 469 | |
|---|
| 470 | next_format: |
|---|
| 471 | /* Move to next supported format in the list */ |
|---|
| 472 | pVideoDescriptor = BLST_Q_NEXT(pVideoDescriptor, link); |
|---|
| 473 | |
|---|
| 474 | } |
|---|
| 475 | }while (additional3dFmtBytes > 0); |
|---|
| 476 | |
|---|
| 477 | /* Check HDMI 3D formats for supported */ |
|---|
| 478 | BHDM_EDID_P_CheckSupportedHdmi3DFormats(hHDMI); |
|---|
| 479 | |
|---|
| 480 | done: |
|---|
| 481 | |
|---|
| 482 | hHDMI->AttachedEDID.Bcm3DFormatsChecked = true; |
|---|
| 483 | return; |
|---|
| 484 | } |
|---|
| 485 | |
|---|
| 486 | |
|---|
| 487 | typedef struct _BHDM_EDID_HDMI_3D_FORMAT_ |
|---|
| 488 | { |
|---|
| 489 | BFMT_VideoFmt eVideoFmt; |
|---|
| 490 | } BHDM_EDID_HDMI_3D_FORMAT; |
|---|
| 491 | |
|---|
| 492 | static const BHDM_EDID_HDMI_3D_FORMAT BHDM_EDID_3DFormats[]= |
|---|
| 493 | { |
|---|
| 494 | { BFMT_VideoFmt_e720p_60Hz_3DOU_AS }, /* HD 3D 720p */ |
|---|
| 495 | { BFMT_VideoFmt_e720p_50Hz_3DOU_AS }, /* HD 3D 720p50 */ |
|---|
| 496 | { BFMT_VideoFmt_e720p_30Hz_3DOU_AS }, /* HD 3D 720p30 */ |
|---|
| 497 | { BFMT_VideoFmt_e720p_24Hz_3DOU_AS }, /* HD 3D 720p24 */ |
|---|
| 498 | { BFMT_VideoFmt_e1080p_24Hz_3DOU_AS }, /* HD 1080p 24Hz, 2750 sample per line, SMPTE 274M-1998 */ |
|---|
| 499 | { BFMT_VideoFmt_e1080p_30Hz_3DOU_AS } /* HD 1080p 30Hz, 2200 sample per line, SMPTE 274M-1998 */ |
|---|
| 500 | }; |
|---|
| 501 | |
|---|
| 502 | void BHDM_EDID_P_CheckSupportedHdmi3DFormats(BHDM_Handle hHDMI) |
|---|
| 503 | { |
|---|
| 504 | BFMT_VideoFmt eVideoFmt = 0 ; |
|---|
| 505 | #if BHDM_CONFIG_DEBUG_EDID_3DSTRUCT |
|---|
| 506 | BFMT_VideoInfo stVideoFmtInfo ; |
|---|
| 507 | #endif |
|---|
| 508 | |
|---|
| 509 | uint8_t j=0; |
|---|
| 510 | uint8_t NumBcmSupported3DFormats ; |
|---|
| 511 | bool OverUnderSupport ; |
|---|
| 512 | |
|---|
| 513 | NumBcmSupported3DFormats = |
|---|
| 514 | sizeof(BHDM_EDID_3DFormats) / sizeof(BHDM_EDID_3DFormats[0]) ; |
|---|
| 515 | |
|---|
| 516 | for (eVideoFmt = 0 ; eVideoFmt < BFMT_VideoFmt_eMaxCount ; eVideoFmt++) |
|---|
| 517 | { |
|---|
| 518 | /* if format is not supported, continue */ |
|---|
| 519 | if (!hHDMI->AttachedEDID.BcmSupportedVideoFormats[eVideoFmt]) |
|---|
| 520 | continue; |
|---|
| 521 | |
|---|
| 522 | /* if frame packing not supported, continue */ |
|---|
| 523 | if (!(hHDMI->AttachedEDID.BcmSupported3DFormats[eVideoFmt] & BHDM_EDID_VSDB_3D_STRUCTURE_ALL_FRAME_PACKING)) |
|---|
| 524 | continue ; |
|---|
| 525 | |
|---|
| 526 | OverUnderSupport = false ; |
|---|
| 527 | |
|---|
| 528 | switch (eVideoFmt) |
|---|
| 529 | { |
|---|
| 530 | case BFMT_VideoFmt_e1080p_24Hz: |
|---|
| 531 | for (j=0 ; j < NumBcmSupported3DFormats ; j++) |
|---|
| 532 | if (BHDM_EDID_3DFormats[j].eVideoFmt == BFMT_VideoFmt_e1080p_24Hz_3DOU_AS) |
|---|
| 533 | { |
|---|
| 534 | OverUnderSupport = true ; |
|---|
| 535 | hHDMI->AttachedEDID.BcmSupportedVideoFormats[BFMT_VideoFmt_e1080p_24Hz_3DOU_AS] = true; |
|---|
| 536 | break; |
|---|
| 537 | } |
|---|
| 538 | break; |
|---|
| 539 | |
|---|
| 540 | case BFMT_VideoFmt_e1080p_30Hz: |
|---|
| 541 | for (j=0 ; j < NumBcmSupported3DFormats ; j++) |
|---|
| 542 | if (BHDM_EDID_3DFormats[j].eVideoFmt == BFMT_VideoFmt_e1080p_30Hz_3DOU_AS) |
|---|
| 543 | { |
|---|
| 544 | OverUnderSupport = true ; |
|---|
| 545 | hHDMI->AttachedEDID.BcmSupportedVideoFormats[BFMT_VideoFmt_e1080p_30Hz_3DOU_AS] = true; |
|---|
| 546 | break; |
|---|
| 547 | } |
|---|
| 548 | break; |
|---|
| 549 | |
|---|
| 550 | case BFMT_VideoFmt_e720p: |
|---|
| 551 | for (j=0 ; j < NumBcmSupported3DFormats ; j++) |
|---|
| 552 | if (BHDM_EDID_3DFormats[j].eVideoFmt == BFMT_VideoFmt_e720p_60Hz_3DOU_AS) |
|---|
| 553 | { |
|---|
| 554 | OverUnderSupport = true ; |
|---|
| 555 | hHDMI->AttachedEDID.BcmSupportedVideoFormats[BFMT_VideoFmt_e720p_60Hz_3DOU_AS] = true; |
|---|
| 556 | break; |
|---|
| 557 | } |
|---|
| 558 | break; |
|---|
| 559 | |
|---|
| 560 | case BFMT_VideoFmt_e720p_50Hz: |
|---|
| 561 | for (j=0 ; j < NumBcmSupported3DFormats ; j++) |
|---|
| 562 | if (BHDM_EDID_3DFormats[j].eVideoFmt == BFMT_VideoFmt_e720p_50Hz_3DOU_AS) |
|---|
| 563 | { |
|---|
| 564 | OverUnderSupport = true ; |
|---|
| 565 | hHDMI->AttachedEDID.BcmSupportedVideoFormats[BFMT_VideoFmt_e720p_50Hz_3DOU_AS] = true; |
|---|
| 566 | break; |
|---|
| 567 | } |
|---|
| 568 | break; |
|---|
| 569 | |
|---|
| 570 | case BFMT_VideoFmt_e720p_24Hz: |
|---|
| 571 | for (j=0 ; j < NumBcmSupported3DFormats ; j++) |
|---|
| 572 | if (BHDM_EDID_3DFormats[j].eVideoFmt == BFMT_VideoFmt_e720p_24Hz_3DOU_AS) |
|---|
| 573 | { |
|---|
| 574 | OverUnderSupport = true ; |
|---|
| 575 | hHDMI->AttachedEDID.BcmSupportedVideoFormats[BFMT_VideoFmt_e720p_24Hz_3DOU_AS] = true; |
|---|
| 576 | break; |
|---|
| 577 | } |
|---|
| 578 | break; |
|---|
| 579 | |
|---|
| 580 | case BFMT_VideoFmt_e720p_30Hz: |
|---|
| 581 | for (j=0 ; NumBcmSupported3DFormats ; j++) |
|---|
| 582 | if (BHDM_EDID_3DFormats[j].eVideoFmt == BFMT_VideoFmt_e720p_30Hz_3DOU_AS) |
|---|
| 583 | { |
|---|
| 584 | OverUnderSupport = true ; |
|---|
| 585 | hHDMI->AttachedEDID.BcmSupportedVideoFormats[BFMT_VideoFmt_e720p_30Hz_3DOU_AS] = true; |
|---|
| 586 | break; |
|---|
| 587 | } |
|---|
| 588 | break; |
|---|
| 589 | |
|---|
| 590 | default: |
|---|
| 591 | break; |
|---|
| 592 | }/* end switch */ |
|---|
| 593 | |
|---|
| 594 | #if BHDM_CONFIG_DEBUG_EDID_3DSTRUCT |
|---|
| 595 | if (OverUnderSupport) |
|---|
| 596 | { |
|---|
| 597 | /* there is a separate FMT enumeration for OU formats; just print corresponding 2D format */ |
|---|
| 598 | BFMT_GetVideoFormatInfo(eVideoFmt, &stVideoFmtInfo) ; |
|---|
| 599 | BDBG_WRN(("3D Top/Bottom support found for %s", stVideoFmtInfo.pchFormatStr)) ; |
|---|
| 600 | } |
|---|
| 601 | #endif |
|---|
| 602 | } |
|---|
| 603 | |
|---|
| 604 | return; |
|---|
| 605 | } |
|---|
| 606 | |
|---|
| 607 | |
|---|