| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2006, 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: $ |
|---|
| 11 | * $brcm_Revision: $ |
|---|
| 12 | * $brcm_Date: $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: $ |
|---|
| 19 | * |
|---|
| 20 | ***************************************************************************/ |
|---|
| 21 | |
|---|
| 22 | #include "bapp_nexus.h" |
|---|
| 23 | #include "bapp_palette.h" |
|---|
| 24 | #include "bapp_util.h" |
|---|
| 25 | #include "bapp_hdmi.h" |
|---|
| 26 | |
|---|
| 27 | BDBG_MODULE(bapp_nexus); /* Register software module with debug interface */ |
|---|
| 28 | |
|---|
| 29 | /** |
|---|
| 30 | Summary: |
|---|
| 31 | Return the OSD bits per pixel. |
|---|
| 32 | **/ |
|---|
| 33 | unsigned int bapp_get_bpp(void) |
|---|
| 34 | { |
|---|
| 35 | return 8; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | /** |
|---|
| 39 | Summary: |
|---|
| 40 | Return the OSD pixel format. |
|---|
| 41 | **/ |
|---|
| 42 | unsigned int bapp_get_pixel_format(void) |
|---|
| 43 | { |
|---|
| 44 | return (unsigned int)NEXUS_PixelFormat_ePalette8; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | /** |
|---|
| 48 | Summary: |
|---|
| 49 | Return the OSD format. |
|---|
| 50 | **/ |
|---|
| 51 | unsigned int bapp_get_osd_format(void) |
|---|
| 52 | { |
|---|
| 53 | return (unsigned int)NEXUS_VideoFormat_e720p/*NEXUS_VideoFormat_eNtsc*/; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | int g_gfx_width = 720; |
|---|
| 57 | int g_gfx_height = 480; |
|---|
| 58 | |
|---|
| 59 | static void bapp_rate_change_cb(void *pvParam1, |
|---|
| 60 | int iParam2, |
|---|
| 61 | void *pvVdcData) |
|---|
| 62 | { |
|---|
| 63 | |
|---|
| 64 | } |
|---|
| 65 | /** |
|---|
| 66 | Summary: |
|---|
| 67 | Allocate and reserve resources for a display pipeline. Expects allocated bapp_nexus_t structure. |
|---|
| 68 | **/ |
|---|
| 69 | static void bapp_nexus_disp_open(bapp_nexus_t *p_nexus, bapp_display_id_t id) |
|---|
| 70 | { |
|---|
| 71 | NEXUS_Error rc; |
|---|
| 72 | bapp_result_t result; |
|---|
| 73 | unsigned int *palette; /* ARGB palette entries */ |
|---|
| 74 | unsigned int size; /* Number of palette entries */ |
|---|
| 75 | BRDC_Settings rdcSettings; |
|---|
| 76 | BVDC_Settings vdcSettings; |
|---|
| 77 | BVDC_Display_CallbackSettings displayCBSettings; |
|---|
| 78 | |
|---|
| 79 | BDBG_ASSERT(p_nexus); |
|---|
| 80 | BKNI_Memset(p_nexus,0,sizeof(bapp_nexus_t)); |
|---|
| 81 | |
|---|
| 82 | p_nexus->hdmiFmt = BFMT_VideoFmt_e720p; |
|---|
| 83 | |
|---|
| 84 | rc = BRDC_GetDefaultSettings(GetCHP(),&rdcSettings); |
|---|
| 85 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 86 | rc = BRDC_Open(&(p_nexus->hRdc), GetCHP(),GetREG(),GetHeap(),&rdcSettings); |
|---|
| 87 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 88 | |
|---|
| 89 | BVDC_GetDefaultSettings(&vdcSettings); |
|---|
| 90 | |
|---|
| 91 | /* Open HDMI display pipeline first */ |
|---|
| 92 | rc = BVDC_Open(&(p_nexus->hVdc), GetCHP(),GetREG(),GetHeap(),GetINT(),p_nexus->hRdc,GetTMR(),&vdcSettings); |
|---|
| 93 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 94 | |
|---|
| 95 | rc = BVDC_Compositor_Create(p_nexus->hVdc, &(p_nexus->disp[id].hCmp), BVDC_CompositorId_eCompositor0, NULL); |
|---|
| 96 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 97 | |
|---|
| 98 | rc = BVDC_Display_Create( p_nexus->disp[id].hCmp, &(p_nexusdisp[id].hDisplay), BVDC_DisplayId_eAuto,NULL); |
|---|
| 99 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | rc = BVDC_Display_GetHdmiConfiguration(p_nexusdisp[id].hDisplay, BVDC_Hdmi_0, &p_nexus->hdmiMatrixCoef); |
|---|
| 103 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 104 | |
|---|
| 105 | BVDC_Display_SetVideoFormat(p_nexusdisp[id].hDisplay, p_nexus->hdmiFmt); |
|---|
| 106 | |
|---|
| 107 | if (id == eBAPP_DISPLAY_HDMI) |
|---|
| 108 | { |
|---|
| 109 | rc = BVDC_Display_SetHdmiConfiguration(p_nexusdisp[id].hDisplay, BVDC_Hdmi_0, &p_nexus->hdmiMatrixCoef); |
|---|
| 110 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 111 | |
|---|
| 112 | BVDC_Display_GetCallbackSettings(p_nexusdisp[id].hDisplay, &displayCBSettings); |
|---|
| 113 | displayCBSettings.stMask.bRateChange=1; |
|---|
| 114 | BVDC_Display_SetCallbackSettings(p_nexusdisp[id].hDisplay, &displayCBSettings); |
|---|
| 115 | rc = BVDC_Display_InstallCallback(p_nexusdisp[id].hDisplay, |
|---|
| 116 | (BVDC_CallbackFunc_isr)bapp_rate_change_cb, |
|---|
| 117 | p_nexusdisp[id].hDisplay, 0); |
|---|
| 118 | |
|---|
| 119 | rc = BVDC_Display_SetAspectRatio(p_nexusdisp[id].hDisplay, BFMT_AspectRatio_e16_9); |
|---|
| 120 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 121 | } |
|---|
| 122 | else |
|---|
| 123 | { |
|---|
| 124 | rc = BVDC_Display_SetVideoFormat(p_nexus->hDisplay, BFMT_VideoFmt_eNTSC); |
|---|
| 125 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 126 | rc = BVDC_Display_SetDacConfiguration( p_nexus->hDisplay, BVDC_Dac_2, BVDC_DacOutput_eComposite); |
|---|
| 127 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 128 | |
|---|
| 129 | rc = BVDC_Display_SetAspectRatio(p_nexusdisp[id].hDisplay, BFMT_AspectRatio_e16_9); |
|---|
| 130 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | rc = BVDC_Display_SetTimebase(p_nexusdisp[id].hDisplay, BAVC_Timebase_e0);/* XXX Set proper timebase BAVC_Timebase_e0 */ |
|---|
| 134 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 135 | |
|---|
| 136 | #if BDBG_DEBUG_BUILD |
|---|
| 137 | rc = BVDC_Compositor_SetBackgroundColor(p_nexus->disp[id].hCmp, 0, 0, 0xFF); |
|---|
| 138 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 139 | #endif |
|---|
| 140 | |
|---|
| 141 | #if 0 |
|---|
| 142 | |
|---|
| 143 | rc = BINT_CreateCallback(&display->vsyncCallback.intCallback[i], g_pCoreHandles->bint, intId, NEXUS_Display_P_VecInterrupt_isr, display, 0); |
|---|
| 144 | if (rc) return BERR_TRACE(rc); |
|---|
| 145 | rc = BINT_EnableCallback(display->vsyncCallback.intCallback[i]); |
|---|
| 146 | if (rc) return BERR_TRACE(rc); |
|---|
| 147 | #endif |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | /** |
|---|
| 151 | Summary: |
|---|
| 152 | Allocate and reserve resources. Expects allocated bapp_nexus_t structure. |
|---|
| 153 | **/ |
|---|
| 154 | void bapp_nexus_open(bapp_nexus_t *p_nexus, |
|---|
| 155 | bapp_tune_type_t fe_type) |
|---|
| 156 | { |
|---|
| 157 | NEXUS_Error rc; |
|---|
| 158 | bapp_result_t result; |
|---|
| 159 | unsigned int *palette; /* ARGB palette entries */ |
|---|
| 160 | unsigned int size; /* Number of palette entries */ |
|---|
| 161 | BRDC_Settings rdcSettings; |
|---|
| 162 | BVDC_Settings vdcSettings; |
|---|
| 163 | BVDC_Display_CallbackSettings displayCBSettings; |
|---|
| 164 | |
|---|
| 165 | BDBG_ASSERT(p_nexus); |
|---|
| 166 | BKNI_Memset(p_nexus,0,sizeof(bapp_nexus_t)); |
|---|
| 167 | |
|---|
| 168 | p_nexus->hdmiFmt = BFMT_VideoFmt_e720p; |
|---|
| 169 | |
|---|
| 170 | rc = BRDC_GetDefaultSettings(GetCHP(),&rdcSettings); |
|---|
| 171 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 172 | rc = BRDC_Open(&(p_nexus->hRdc), GetCHP(),GetREG(),GetHeap(),&rdcSettings); |
|---|
| 173 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 174 | |
|---|
| 175 | BVDC_GetDefaultSettings(&vdcSettings); |
|---|
| 176 | |
|---|
| 177 | /* Open HDMI display pipeline first */ |
|---|
| 178 | rc = BVDC_Open(&(p_nexus->hVdc), GetCHP(),GetREG(),GetHeap(),GetINT(),p_nexus->hRdc,GetTMR(),&vdcSettings); |
|---|
| 179 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 180 | |
|---|
| 181 | rc = BVDC_Compositor_Create(p_nexus->hVdc, &(p_nexus->disp[id].hCmp), BVDC_CompositorId_eCompositor0, NULL); |
|---|
| 182 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 183 | |
|---|
| 184 | rc = BVDC_Display_Create( p_nexus->disp[id].hCmp, &(p_nexusdisp[id].hDisplay), BVDC_DisplayId_eAuto,NULL); |
|---|
| 185 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 186 | |
|---|
| 187 | |
|---|
| 188 | rc = BVDC_Display_GetHdmiConfiguration(p_nexusdisp[id].hDisplay, BVDC_Hdmi_0, &p_nexus->hdmiMatrixCoef); |
|---|
| 189 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 190 | |
|---|
| 191 | BVDC_Display_SetVideoFormat(p_nexusdisp[id].hDisplay, p_nexus->hdmiFmt); |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | rc = BVDC_Display_SetHdmiConfiguration(p_nexusdisp[id].hDisplay, BVDC_Hdmi_0, &p_nexus->hdmiMatrixCoef); |
|---|
| 195 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 196 | |
|---|
| 197 | BVDC_Display_GetCallbackSettings(p_nexusdisp[id].hDisplay, &displayCBSettings); |
|---|
| 198 | displayCBSettings.stMask.bRateChange=1; |
|---|
| 199 | BVDC_Display_SetCallbackSettings(p_nexusdisp[id].hDisplay, &displayCBSettings); |
|---|
| 200 | rc = BVDC_Display_InstallCallback(p_nexusdisp[id].hDisplay, |
|---|
| 201 | (BVDC_CallbackFunc_isr)bapp_rate_change_cb, |
|---|
| 202 | p_nexusdisp[id].hDisplay, 0); |
|---|
| 203 | |
|---|
| 204 | rc = BVDC_Display_SetTimebase(p_nexusdisp[id].hDisplay, BAVC_Timebase_e0);/* XXX Set proper timebase BAVC_Timebase_e0 */ |
|---|
| 205 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 206 | |
|---|
| 207 | rc = BVDC_Display_SetAspectRatio(p_nexusdisp[id].hDisplay, BFMT_AspectRatio_e16_9); |
|---|
| 208 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 209 | |
|---|
| 210 | #if BDBG_DEBUG_BUILD |
|---|
| 211 | rc = BVDC_Compositor_SetBackgroundColor(p_nexus->disp[id].hCmp, 0, 0, 0xFF); |
|---|
| 212 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 213 | #endif |
|---|
| 214 | |
|---|
| 215 | #if 0 |
|---|
| 216 | |
|---|
| 217 | rc = BINT_CreateCallback(&display->vsyncCallback.intCallback[i], g_pCoreHandles->bint, intId, NEXUS_Display_P_VecInterrupt_isr, display, 0); |
|---|
| 218 | if (rc) return BERR_TRACE(rc); |
|---|
| 219 | rc = BINT_EnableCallback(display->vsyncCallback.intCallback[i]); |
|---|
| 220 | if (rc) return BERR_TRACE(rc); |
|---|
| 221 | #endif |
|---|
| 222 | |
|---|
| 223 | BVDC_Display_SetVideoFormat(p_nexus->hDisplay, BFMT_VideoFmt_eNTSC); |
|---|
| 224 | BVDC_Display_SetDacConfiguration( p_nexus->hDisplay, BVDC_Dac_2, BVDC_DacOutput_eComposite); |
|---|
| 225 | |
|---|
| 226 | BDBG_ASSERT(rc == BERR_SUCCESS); |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | rc = BVDC_Display_SetDacConfiguration(display, dacVdc, type); |
|---|
| 234 | /* Enable HDMI port in the VDC */ |
|---|
| 235 | rc = BVDC_Display_SetHdmiConfiguration(display->displayVdc, BVDC_Hdmi_0, g_NEXUS_DisplayModule_State.hdmiOutput.colorimetry); |
|---|
| 236 | if (rc) return BERR_TRACE(rc); |
|---|
| 237 | |
|---|
| 238 | BERR_Code BSUR_Surface_Create( |
|---|
| 239 | BMEM_Handle hMem, /* [in] Handle to BMEM module */ |
|---|
| 240 | uint32_t ulWidth, /* [in] Width of surface in pixels */ |
|---|
| 241 | uint32_t ulHeight, /* [in] Height of surface in pixels */ |
|---|
| 242 | uint32_t ulPitch, /* [in] Pitch of surface in bytes */ |
|---|
| 243 | void *pvPixelAddress, /* [in] Pointer surface's first pixel */ |
|---|
| 244 | BPXL_Format eFormat, /* [in] Pixel format of surface */ |
|---|
| 245 | BSUR_Palette_Handle hPalette, /* [in] Palette to associate with */ |
|---|
| 246 | uint32_t ulConstraintMask, /* [in] Constraint mask */ |
|---|
| 247 | BSUR_Surface_Settings *pSettings,/* [in] Extended settings, can be NULL*/ |
|---|
| 248 | BSUR_Surface_Handle *phSurface /* [out] Pointer to surface handle */ |
|---|
| 249 | ); |
|---|
| 250 | graphics->queuedSurface = surface; |
|---|
| 251 | frameBufferChanged = (graphics->frameBufferHeight != surfaceCfg.height || graphics->frameBufferWidth != surfaceCfg.width || graphics->frameBufferPixelFormat != surfaceCfg.pixelFormat); |
|---|
| 252 | graphics->frameBufferHeight = surfaceCfg.height; |
|---|
| 253 | graphics->frameBufferWidth = surfaceCfg.width; |
|---|
| 254 | graphics->frameBufferPixelFormat = surfaceCfg.pixelFormat; |
|---|
| 255 | rc = BVDC_Source_SetSurface( graphics->source, surface); |
|---|
| 256 | if (rc!=BERR_SUCCESS) { rc = BERR_TRACE(rc);goto err_set_source;} |
|---|
| 257 | if(frameBufferChanged) { |
|---|
| 258 | rc = NEXUS_Display_P_SetGraphicsSettings(display, &graphics->cfg, true); |
|---|
| 259 | if (rc!=BERR_SUCCESS) { rc = BERR_TRACE(rc);goto err_graphics_cfg;} |
|---|
| 260 | } |
|---|
| 261 | |
|---|
| 262 | |
|---|
| 263 | rc = BVDC_ApplyChanges(pVideo->vdc); |
|---|
| 264 | if (rc!=BERR_SUCCESS) {rc = BERR_TRACE(rc);goto err_applychanges;} |
|---|
| 265 | |
|---|
| 266 | |
|---|
| 267 | |
|---|
| 268 | |
|---|
| 269 | |
|---|
| 270 | |
|---|
| 271 | |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | |
|---|
| 275 | NEXUS_Display_GetDefaultSettings(&p_nexus->displaySettings); |
|---|
| 276 | p_nexus->displaySettings.background = 0xFF0000FF; |
|---|
| 277 | p_nexus->displaySettings.format = (NEXUS_VideoFormat)bapp_get_osd_format(); |
|---|
| 278 | p_nexus->display = NEXUS_Display_Open(0, &p_nexus->displaySettings); |
|---|
| 279 | NEXUS_Display_AddOutput(p_nexus->display, NEXUS_ComponentOutput_GetConnector(p_nexus->platformConfig.outputs.component[0])); |
|---|
| 280 | NEXUS_Display_AddOutput(p_nexus->display, NEXUS_CompositeOutput_GetConnector(p_nexus->platformConfig.outputs.composite[0])); |
|---|
| 281 | NEXUS_Display_AddOutput(p_nexus->display, NEXUS_HdmiOutput_GetVideoConnector(p_nexus->platformConfig.outputs.hdmi[0])); |
|---|
| 282 | |
|---|
| 283 | /* Install hotplug callback -- video only for now */ |
|---|
| 284 | NEXUS_HdmiOutput_GetSettings(p_nexus->platformConfig.outputs.hdmi[0], &hdmiSettings); |
|---|
| 285 | hdmiSettings.hotplugCallback.callback = bapp_hdmi_hotplug_callback; |
|---|
| 286 | hdmiSettings.hotplugCallback.context = p_nexus->platformConfig.outputs.hdmi[0]; |
|---|
| 287 | hdmiSettings.hotplugCallback.param = (int)p_nexus->display; |
|---|
| 288 | NEXUS_HdmiOutput_SetSettings(p_nexus->platformConfig.outputs.hdmi[0], &hdmiSettings); |
|---|
| 289 | |
|---|
| 290 | NEXUS_VideoFormat_GetInfo(p_nexus->displaySettings.format, &p_nexus->videoFormatInfo); |
|---|
| 291 | |
|---|
| 292 | for (p_nexus->surface_idx = 0; p_nexus->surface_idx < BAPP_NUM_SURFACES; p_nexus->surface_idx++) |
|---|
| 293 | { |
|---|
| 294 | BDBG_MSG(("%s:%d\n",__FUNCTION__,__LINE__)); |
|---|
| 295 | NEXUS_Surface_GetDefaultCreateSettings(&p_nexus->createSettings[p_nexus->surface_idx]); |
|---|
| 296 | p_nexus->createSettings[p_nexus->surface_idx].pixelFormat = (NEXUS_PixelFormat)bapp_get_pixel_format(); |
|---|
| 297 | p_nexus->createSettings[p_nexus->surface_idx].width = g_gfx_width; |
|---|
| 298 | p_nexus->createSettings[p_nexus->surface_idx].height = g_gfx_height; |
|---|
| 299 | p_nexus->surface[p_nexus->surface_idx] = NEXUS_Surface_Create(&p_nexus->createSettings[p_nexus->surface_idx]); |
|---|
| 300 | NEXUS_Surface_GetMemory(p_nexus->surface[p_nexus->surface_idx], &p_nexus->mem[p_nexus->surface_idx]); |
|---|
| 301 | BDBG_MSG(("%s:%d\n",__FUNCTION__,__LINE__)); |
|---|
| 302 | |
|---|
| 303 | bapp_palette_get(ePALETTE_APP,&palette,&size); |
|---|
| 304 | /* Set palette */ |
|---|
| 305 | bapp_util_memcpy(p_nexus->mem[p_nexus->surface_idx].palette,palette, size * sizeof(unsigned int)); |
|---|
| 306 | BDBG_MSG(("%s:%d\n",__FUNCTION__,__LINE__)); |
|---|
| 307 | |
|---|
| 308 | /* Clear surface */ |
|---|
| 309 | bapp_util_memset(p_nexus->mem[p_nexus->surface_idx].buffer, eCOLOR_CLEAR, p_nexus->createSettings[p_nexus->surface_idx].height * p_nexus->mem[p_nexus->surface_idx].pitch); |
|---|
| 310 | NEXUS_Surface_Flush(p_nexus->surface[p_nexus->surface_idx]); |
|---|
| 311 | BDBG_MSG(("%s:%d\n",__FUNCTION__,__LINE__)); |
|---|
| 312 | } |
|---|
| 313 | p_nexus->surface_idx = 0; |
|---|
| 314 | BDBG_MSG(("%s:%d\n",__FUNCTION__,__LINE__)); |
|---|
| 315 | |
|---|
| 316 | NEXUS_Display_GetGraphicsSettings(p_nexus->display, &p_nexus->graphicsSettings); |
|---|
| 317 | p_nexus->graphicsSettings.enabled = true; |
|---|
| 318 | /* graphicsSettings.position will default to the display size */ |
|---|
| 319 | p_nexus->graphicsSettings.clip.width = p_nexus->createSettings[p_nexus->surface_idx].width; |
|---|
| 320 | p_nexus->graphicsSettings.clip.height = p_nexus->createSettings[p_nexus->surface_idx].height; |
|---|
| 321 | BDBG_MSG(("%s:%d\n",__FUNCTION__,__LINE__)); |
|---|
| 322 | rc = NEXUS_Display_SetGraphicsSettings(p_nexus->display, &p_nexus->graphicsSettings); |
|---|
| 323 | BDBG_ASSERT(!rc); |
|---|
| 324 | BDBG_MSG(("%s:%d\n",__FUNCTION__,__LINE__)); |
|---|
| 325 | |
|---|
| 326 | rc = NEXUS_Display_SetGraphicsFramebuffer(p_nexus->display, p_nexus->surface[p_nexus->surface_idx]); |
|---|
| 327 | BDBG_ASSERT(!rc); |
|---|
| 328 | p_nexus->surface_idx++; |
|---|
| 329 | if (p_nexus->surface_idx >= BAPP_NUM_SURFACES) |
|---|
| 330 | { |
|---|
| 331 | p_nexus->surface_idx = 0; |
|---|
| 332 | } |
|---|
| 333 | |
|---|
| 334 | BDBG_MSG(("%s:%d\n",__FUNCTION__,__LINE__)); |
|---|
| 335 | result = bapp_tune_open(fe_type, &p_nexus->tune, &p_nexus->band); |
|---|
| 336 | BDBG_ASSERT(p_nexus->tune); |
|---|
| 337 | |
|---|
| 338 | } |
|---|
| 339 | |
|---|
| 340 | /** |
|---|
| 341 | Summary: |
|---|
| 342 | Release resources. Expects initialized bapp_nexus_t structure |
|---|
| 343 | **/ |
|---|
| 344 | void bapp_nexus_close(bapp_nexus_t *p_nexus) |
|---|
| 345 | { |
|---|
| 346 | BDBG_ASSERT(p_nexus); |
|---|
| 347 | |
|---|
| 348 | /* OSD DISPLAY */ |
|---|
| 349 | |
|---|
| 350 | if (p_nexus->display) |
|---|
| 351 | { |
|---|
| 352 | NEXUS_StopCallbacks(p_nexus->display); |
|---|
| 353 | NEXUS_Display_RemoveAllOutputs(p_nexus->display); |
|---|
| 354 | |
|---|
| 355 | NEXUS_Display_Close(p_nexus->display); |
|---|
| 356 | } |
|---|
| 357 | for (p_nexus->surface_idx = 0; p_nexus->surface_idx < BAPP_NUM_SURFACES; p_nexus->surface_idx++) |
|---|
| 358 | { |
|---|
| 359 | if (p_nexus->surface[p_nexus->surface_idx]) |
|---|
| 360 | NEXUS_Surface_Destroy(p_nexus->surface[p_nexus->surface_idx]); |
|---|
| 361 | } |
|---|
| 362 | NEXUS_Platform_Uninit(); |
|---|
| 363 | } |
|---|