| 1 | /****************************************************************************** |
|---|
| 2 | * (c)2008-2009 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: $ |
|---|
| 39 | * $brcm_Revision: $ |
|---|
| 40 | * $brcm_Date: $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * The application consists of two threads, application and system thread, with no |
|---|
| 45 | * overlapping functionality. The main application thread handles |
|---|
| 46 | * initialization/destruction, user input, OSD and events from the system thread. |
|---|
| 47 | * The system thread handles media processing like video decode, psi processing, |
|---|
| 48 | * status monitoring, code downloads, etc. The system thread also monitors events |
|---|
| 49 | * from the application thread and posts status events to the application thread. |
|---|
| 50 | * |
|---|
| 51 | * One advantage of this dual thread structure is that application thread is almost |
|---|
| 52 | * always free to provide feedback on the OSD to user input. The system thread |
|---|
| 53 | * manages most system resources without delaying or slowing user input and |
|---|
| 54 | * corresponding OSD feedback. |
|---|
| 55 | * |
|---|
| 56 | * To limit complexity neither application or system thread restricts or synchronizes |
|---|
| 57 | * use of any system resource and the assumptions is that the threads cooperate as such. |
|---|
| 58 | * |
|---|
| 59 | * Revision History: |
|---|
| 60 | * |
|---|
| 61 | * Created: 09/28/2009 by Jeff Fisher |
|---|
| 62 | * |
|---|
| 63 | * $brcm_Log: $ |
|---|
| 64 | * |
|---|
| 65 | * |
|---|
| 66 | *****************************************************************************/ |
|---|
| 67 | #ifndef BSETTOP_DISPLAY_PRIV_H__ |
|---|
| 68 | #define BSETTOP_DISPLAY_PRIV_H__ |
|---|
| 69 | |
|---|
| 70 | #include "bsettop_types.h" |
|---|
| 71 | #include "bvdc.h" |
|---|
| 72 | #include "brdc.h" |
|---|
| 73 | #include "bxvd.h" |
|---|
| 74 | #include "bint.h" |
|---|
| 75 | #include "bvbilib.h" |
|---|
| 76 | |
|---|
| 77 | /** |
|---|
| 78 | Summary: |
|---|
| 79 | To support dual SD and HD display (composite SD and HDMI HD) output the BVN needs to be |
|---|
| 80 | configured such that the single input source is connected to separate compositors. Therefore |
|---|
| 81 | two compositors handles, display handles video and graphics window handles will be required. |
|---|
| 82 | One compositor/display will be associated with SD composite output and the other will be |
|---|
| 83 | associated with the HDMI HD output but it is assumed that both the SD and HD outputs will share |
|---|
| 84 | the same video input and same graphics surface as input to the two graphics feeders. |
|---|
| 85 | **/ |
|---|
| 86 | typedef enum bsettop_display_id_t |
|---|
| 87 | { |
|---|
| 88 | #if HAS_HDMI |
|---|
| 89 | eBDISPLAY_HDMI, /* display 0 pipeline */ |
|---|
| 90 | #endif |
|---|
| 91 | eBDISPLAY_COMPOSITE, /* display 1 pipeline */ |
|---|
| 92 | eBDISPLAY_ID_MAX |
|---|
| 93 | }bsettop_display_id_t; |
|---|
| 94 | |
|---|
| 95 | /** |
|---|
| 96 | Summary: |
|---|
| 97 | same graphics surface used by both graphics feeders. |
|---|
| 98 | **/ |
|---|
| 99 | typedef enum bsettop_surf_idx_t |
|---|
| 100 | { |
|---|
| 101 | eBSURFACE_0, |
|---|
| 102 | eBSURFACE_1, |
|---|
| 103 | #if HAS_HDMI |
|---|
| 104 | eBSURFACE_2, |
|---|
| 105 | #endif |
|---|
| 106 | eBSURFACE_MAX |
|---|
| 107 | }bsettop_surf_idx_t; |
|---|
| 108 | |
|---|
| 109 | /** |
|---|
| 110 | Summary: |
|---|
| 111 | Collection of handles associated with a display pipeline. |
|---|
| 112 | **/ |
|---|
| 113 | typedef struct bsettop_disp_t |
|---|
| 114 | { |
|---|
| 115 | BVDC_Compositor_Handle hCmp; |
|---|
| 116 | BVDC_Display_Handle hDisplay; |
|---|
| 117 | BVDC_Window_Handle hVideoWindow; |
|---|
| 118 | BVDC_Window_Handle hGfxWindow; |
|---|
| 119 | BVDC_Source_Handle hGfxSource; |
|---|
| 120 | BINT_CallbackHandle hvsyncCbHandle; |
|---|
| 121 | }bsettop_disp_t; |
|---|
| 122 | /** |
|---|
| 123 | Summary: |
|---|
| 124 | Collection of values, handles and pointers associated with a surface. |
|---|
| 125 | **/ |
|---|
| 126 | struct bsettop_surf |
|---|
| 127 | { |
|---|
| 128 | BSUR_Surface_Handle hSurface; |
|---|
| 129 | BSUR_Palette_Handle hPalette; |
|---|
| 130 | uint32_t num_palette_entries; |
|---|
| 131 | uint32_t *p_palette; |
|---|
| 132 | uint32_t pitch; |
|---|
| 133 | uint8_t *p_pixels; |
|---|
| 134 | uint32_t width; |
|---|
| 135 | uint32_t height; |
|---|
| 136 | uint32_t pixel_format; |
|---|
| 137 | }; |
|---|
| 138 | |
|---|
| 139 | /** |
|---|
| 140 | Summary: |
|---|
| 141 | Central structure acting as agregator of all system resources. No attempt is made |
|---|
| 142 | to restrict mutual access to these resources as the general application structure |
|---|
| 143 | partitions responsibility to avoid such contention. |
|---|
| 144 | **/ |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | struct bdisplay |
|---|
| 148 | { |
|---|
| 149 | bool open; |
|---|
| 150 | bdisplay_settings settings; |
|---|
| 151 | BAVC_VdcDisplay_Info displayInfo; |
|---|
| 152 | |
|---|
| 153 | /* OSD Display */ |
|---|
| 154 | BVDC_Handle hVdc; |
|---|
| 155 | BRDC_Handle hRdc; |
|---|
| 156 | |
|---|
| 157 | bsettop_disp_t disp[eBDISPLAY_ID_MAX]; |
|---|
| 158 | BFMT_VideoFmt hdmiFmt; |
|---|
| 159 | BFMT_AspectRatio auto_hdmi_480i_aspect_ratio; |
|---|
| 160 | BFMT_AspectRatio auto_hdmi_480p_aspect_ratio; |
|---|
| 161 | |
|---|
| 162 | BVDC_Source_Handle hVideoSource; /* Mpeg feeder 0 */ |
|---|
| 163 | |
|---|
| 164 | /* double buffered graphics surface used by both Gfx feeders */ |
|---|
| 165 | bsettop_surf_t offscreen; |
|---|
| 166 | bsettop_surf_t overlay; |
|---|
| 167 | #ifdef CONFIG_GFX_ARGB32 |
|---|
| 168 | bsettop_surf_t osd; |
|---|
| 169 | #else |
|---|
| 170 | bsettop_surf_t osd[eBDISPLAY_ID_MAX]; |
|---|
| 171 | #endif |
|---|
| 172 | BPXL_Format pxl_format; |
|---|
| 173 | bsettop_surf_idx_t surface_idx; |
|---|
| 174 | |
|---|
| 175 | /* vbi output */ |
|---|
| 176 | struct { |
|---|
| 177 | BVBI_Handle hVbi; |
|---|
| 178 | BVBIlib_Handle hVbilib; |
|---|
| 179 | BVBIlib_List_Handle hVbilist; |
|---|
| 180 | BVBI_Encode_Handle enc_core; /* must be NULL if not created */ |
|---|
| 181 | BVBIlib_Encode_Handle enc; /* this is VBI encode handle destination for VBI data */ |
|---|
| 182 | BINT_CallbackHandle tf_isr; |
|---|
| 183 | BINT_CallbackHandle bf_isr; |
|---|
| 184 | } vbi; |
|---|
| 185 | b_mutex_t vdc_mutex; |
|---|
| 186 | }; |
|---|
| 187 | |
|---|
| 188 | #ifdef __cplusplus |
|---|
| 189 | extern "C" { |
|---|
| 190 | #endif |
|---|
| 191 | BERR_Code bdisplay_graphics_window_open(bdisplay_t display, |
|---|
| 192 | bsettop_display_id_t id); |
|---|
| 193 | BERR_Code bdisplay_graphics_window_close(bdisplay_t display, |
|---|
| 194 | bsettop_display_id_t id); |
|---|
| 195 | |
|---|
| 196 | |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | #ifdef __cplusplus |
|---|
| 200 | } |
|---|
| 201 | #endif |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | #endif /* BSETTOP_DISPLAY_PRIV_H__ */ |
|---|