IMG_BOOL MRSTLFBFlipToSurface(MRSTLFB_DEVINFO *psDevInfo, unsigned long uiAddr) { int dspbase = (psDevInfo->ui32MainPipe == 0 ? DSPABASE : DSPBBASE); int dspsurf = (psDevInfo->ui32MainPipe == 0 ? DSPASURF : DSPBSURF); struct drm_device * dev = psDevInfo->psDrmDevice; struct drm_psb_private *dev_priv = (struct drm_psb_private *) psDevInfo->psDrmDevice->dev_private; MRSTLFB_SWAPCHAIN *psCurrentSwapChain = psDevInfo->psCurrentSwapChain; if (ospm_power_using_hw_begin(OSPM_DISPLAY_ISLAND, false)) { if (IS_MRST(dev)) { MRSTLFBVSyncWriteReg(psDevInfo, dspsurf, uiAddr); } else if (IS_MDFLD(dev)) { if (psCurrentSwapChain != NULL) { if (psCurrentSwapChain->ui32SwapChainPropertyFlag & PVRSRV_SWAPCHAIN_ATTACHED_PLANE_A) { dspsurf = DSPASURF; MRSTLFBVSyncWriteReg(psDevInfo, dspsurf, uiAddr); if (dev_priv->b_async_flip_enable && dev_priv->async_flip_update_fb) if (dev_priv->async_flip_update_fb( dev, 0) == IMG_FALSE) return IMG_FALSE; } #if defined(CONFIG_MDFD_DUAL_MIPI) if (psCurrentSwapChain->ui32SwapChainPropertyFlag & PVRSRV_SWAPCHAIN_ATTACHED_PLANE_C) { dspsurf = DSPCSURF; MRSTLFBVSyncWriteReg(psDevInfo, dspsurf, uiAddr); if (dev_priv->b_async_flip_enable && dev_priv->async_flip_update_fb) if (dev_priv->async_flip_update_fb( dev, 2) == IMG_FALSE) return IMG_FALSE; } #endif #ifdef CONFIG_MDFD_HDMI /* To avoid Plane B still fetches data from original frame * buffer. */ if (psCurrentSwapChain->ui32SwapChainPropertyFlag & PVRSRV_SWAPCHAIN_ATTACHED_PLANE_B) { dspsurf = DSPBSURF; MRSTLFBVSyncWriteReg(psDevInfo, dspsurf, uiAddr); } #endif } else { printk(KERN_WARNING "Current Swapchain is null, no attached plane info\ available, omit address update\n"); if (drm_psb_debug & PSB_D_GENERAL) dump_stack(); } } else { MRSTLFBVSyncWriteReg(psDevInfo, dspbase, uiAddr); } ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND); }
IMG_BOOL MRSTLFBFlipToSurface(MRSTLFB_DEVINFO *psDevInfo, unsigned long uiAddr) { int dspbase = (psDevInfo->ui32MainPipe == 0 ? DSPABASE : DSPBBASE); int dspsurf = (psDevInfo->ui32MainPipe == 0 ? DSPASURF : DSPBSURF); struct drm_device * dev = psDevInfo->psDrmDevice; struct drm_psb_private *dev_priv = (struct drm_psb_private *) psDevInfo->psDrmDevice->dev_private; MRSTLFB_SWAPCHAIN *psCurrentSwapChain = psDevInfo->psCurrentSwapChain; struct mdfld_dsi_config *dsi_config; struct mdfld_dsi_hw_context *ctx; unsigned int tmp; if (ospm_power_using_hw_begin(OSPM_DISPLAY_ISLAND, false)) { if (IS_MRST(dev)) { MRSTLFBVSyncWriteReg(psDevInfo, dspsurf, uiAddr); } else if (IS_MDFLD(dev)) { if (psCurrentSwapChain != NULL) { if (psCurrentSwapChain->ui32SwapChainPropertyFlag & PVRSRV_SWAPCHAIN_ATTACHED_PLANE_A) { dspsurf = DSPASURF; tmp = PSB_RVDC32(DSPACNTR); if (!(tmp & DISPLAY_PLANE_ENABLE)) PSB_WVDC32(tmp | DISPLAY_PLANE_ENABLE, DSPACNTR); MRSTLFBVSyncWriteReg(psDevInfo, dspsurf, uiAddr); dsi_config = dev_priv->dsi_configs[0]; if (dsi_config) { ctx = &dsi_config->dsi_hw_context; ctx->dspsurf = uiAddr; } if (mdfld_dsi_dsr_update_panel_fb(dsi_config)) { ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND); return IMG_FALSE; } } #if defined(CONFIG_MDFD_DUAL_MIPI) if (psCurrentSwapChain->ui32SwapChainPropertyFlag & PVRSRV_SWAPCHAIN_ATTACHED_PLANE_C) { dspsurf = DSPCSURF; tmp = PSB_RVDC32(DSPACNTR + 0x2000); if (!(tmp & DISPLAY_PLANE_ENABLE)) PSB_WVDC32(tmp | DISPLAY_PLANE_ENABLE, DSPACNTR + 0x2000); MRSTLFBVSyncWriteReg(psDevInfo, dspsurf, uiAddr); dsi_config = dev_priv->dsi_configs[1]; if (dsi_config) { ctx = &dsi_config->dsi_hw_context; ctx->dspsurf = uiAddr; } if (mdfld_dsi_dsr_update_panel_fb(dsi_config)) { ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND); return IMG_FALSE; } } #endif #ifdef CONFIG_SUPPORT_HDMI /* To avoid Plane B still fetches data from original frame * buffer. */ if (psCurrentSwapChain->ui32SwapChainPropertyFlag & PVRSRV_SWAPCHAIN_ATTACHED_PLANE_B) { dspsurf = DSPBSURF; tmp = PSB_RVDC32(DSPACNTR + 0x1000); if (!(tmp & DISPLAY_PLANE_ENABLE)) PSB_WVDC32(tmp | DISPLAY_PLANE_ENABLE, DSPACNTR + 0x1000); MRSTLFBVSyncWriteReg(psDevInfo, dspsurf, uiAddr); } #endif } else { printk(KERN_WARNING "Current Swapchain is null, no attached plane info\ available, omit address update\n"); if (drm_psb_debug & PSB_D_GENERAL) dump_stack(); } } else { MRSTLFBVSyncWriteReg(psDevInfo, dspbase, uiAddr); } ospm_power_using_hw_end(OSPM_DISPLAY_ISLAND); }