void CXBMCRenderManager::FrameFinish() { /* wait for this present to be valid */ SPresent& m = m_Queue[m_presentsource]; if(g_graphicsContext.IsFullScreenVideo()) WaitPresentTime(m.timestamp); m_clock_framefinish = GetPresentTime(); { CSingleLock lock(m_presentlock); if(m_presentstep == PRESENT_FRAME) { if( m.presentmethod == PRESENT_METHOD_BOB || m.presentmethod == PRESENT_METHOD_WEAVE) m_presentstep = PRESENT_FRAME2; else m_presentstep = PRESENT_IDLE; } else if(m_presentstep == PRESENT_FRAME2) m_presentstep = PRESENT_IDLE; if(m_presentstep == PRESENT_IDLE) { if(!m_queued.empty()) m_presentstep = PRESENT_READY; } m_presentevent.notifyAll(); } }
void CXBMCRenderManager::Present() { { CRetakeLock<CExclusiveLock> lock(m_sharedSection); if (!m_pRenderer) return; if(m_presentstep == PRESENT_FLIP) { m_overlays.Flip(); m_pRenderer->FlipPage(m_presentsource); m_presentstep = PRESENT_FRAME; m_presentevent.Set(); } } CSharedLock lock(m_sharedSection); lock.Leave(); if (g_application.m_pPlayer && !g_application.m_pPlayer->PreRender()) return; lock.Enter(); if ( m_presentmethod == VS_INTERLACEMETHOD_RENDER_BOB || m_presentmethod == VS_INTERLACEMETHOD_RENDER_BOB_INVERTED) PresentBob(); else if( m_presentmethod == VS_INTERLACEMETHOD_RENDER_WEAVE || m_presentmethod == VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED) PresentWeave(); else if( m_presentmethod == VS_INTERLACEMETHOD_RENDER_BLEND ) PresentBlend(); else PresentSingle(); m_overlays.Render(); if (g_application.m_pPlayer) g_application.m_pPlayer->PostRender(); /* wait for this present to be valid */ if(g_graphicsContext.IsFullScreenVideo()) WaitPresentTime(m_presenttime); m_presentevent.Set(); }
void CXBMCRenderManager::Present() { { CRetakeLock<CExclusiveLock> lock(m_sharedSection); if (!m_pRenderer) return; if(m_presentstep == PRESENT_FLIP) { m_overlays.Flip(); m_pRenderer->FlipPage(m_presentsource); m_presentstep = PRESENT_FRAME; m_presentevent.Set(); } } Render(true, 0, 255); /* wait for this present to be valid */ if(g_graphicsContext.IsFullScreenVideo()) WaitPresentTime(m_presenttime); m_presentevent.Set(); }
void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0LL*/, int source /*= -1*/, EFIELDSYNC sync /*= FS_NONE*/) { if(timestamp - GetPresentTime() > MAXPRESENTDELAY) timestamp = GetPresentTime() + MAXPRESENTDELAY; /* can't flip, untill timestamp */ if(!g_graphicsContext.IsFullScreenVideo()) WaitPresentTime(timestamp); /* make sure any queued frame was fully presented */ double timeout = m_presenttime + 1.0; while(m_presentstep != PRESENT_IDLE && !bStop) { if(!m_presentevent.WaitMSec(100) && GetPresentTime() > timeout && !bStop) { CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for previous frame"); return; } }; if(bStop) return; { CRetakeLock<CExclusiveLock> lock(m_sharedSection); if(!m_pRenderer) return; m_presenttime = timestamp; m_presentfield = sync; m_presentstep = PRESENT_FLIP; m_presentsource = source; EDEINTERLACEMODE deinterlacemode = g_settings.m_currentVideoSettings.m_DeinterlaceMode; EINTERLACEMETHOD interlacemethod = AutoInterlaceMethodInternal(g_settings.m_currentVideoSettings.m_InterlaceMethod); bool invert = false; if (deinterlacemode == VS_DEINTERLACEMODE_OFF) m_presentmethod = PRESENT_METHOD_SINGLE; else { if (deinterlacemode == VS_DEINTERLACEMODE_AUTO && m_presentfield == FS_NONE) m_presentmethod = PRESENT_METHOD_SINGLE; else { if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BLEND) m_presentmethod = PRESENT_METHOD_BLEND; else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_WEAVE) m_presentmethod = PRESENT_METHOD_WEAVE; else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED) { m_presentmethod = PRESENT_METHOD_WEAVE ; invert = true; } else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BOB) m_presentmethod = PRESENT_METHOD_BOB; else if (interlacemethod == VS_INTERLACEMETHOD_RENDER_BOB_INVERTED) { m_presentmethod = PRESENT_METHOD_BOB; invert = true; } else if (interlacemethod == VS_INTERLACEMETHOD_DXVA_BOB) m_presentmethod = PRESENT_METHOD_BOB; else if (interlacemethod == VS_INTERLACEMETHOD_DXVA_BEST) m_presentmethod = PRESENT_METHOD_BOB; else m_presentmethod = PRESENT_METHOD_SINGLE; /* default to odd field if we want to deinterlace and don't know better */ if (deinterlacemode == VS_DEINTERLACEMODE_FORCE && m_presentfield == FS_NONE) m_presentfield = FS_TOP; /* invert present field */ if(invert) { if( m_presentfield == FS_BOT ) m_presentfield = FS_TOP; else m_presentfield = FS_BOT; } } } } g_application.NewFrame(); /* wait untill render thread have flipped buffers */ timeout = m_presenttime + 1.0; while(m_presentstep == PRESENT_FLIP && !bStop) { if(!m_presentevent.WaitMSec(100) && GetPresentTime() > timeout && !bStop) { CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for flip to complete"); return; } } }
void CXBMCRenderManager::FlipPage(volatile bool& bStop, double timestamp /* = 0LL*/, int source /*= -1*/, EFIELDSYNC sync /*= FS_NONE*/) { if(timestamp - GetPresentTime() > MAXPRESENTDELAY) timestamp = GetPresentTime() + MAXPRESENTDELAY; /* can't flip, untill timestamp */ if(!g_graphicsContext.IsFullScreenVideo()) WaitPresentTime(timestamp); /* make sure any queued frame was fully presented */ double timeout = m_presenttime + 1.0; while(m_presentstep != PRESENT_IDLE && !bStop) { if(!m_presentevent.WaitMSec(100) && GetPresentTime() > timeout && !bStop) { CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for previous frame"); return; } }; if(bStop) return; { CRetakeLock<CExclusiveLock> lock(m_sharedSection); if(!m_pRenderer) return; m_presenttime = timestamp; m_presentfield = sync; m_presentstep = PRESENT_FLIP; m_presentsource = source; m_presentmethod = g_settings.m_currentVideoSettings.m_InterlaceMethod; /* select render method for auto */ if(m_presentmethod == VS_INTERLACEMETHOD_AUTO) { if(m_presentfield == FS_NONE) m_presentmethod = VS_INTERLACEMETHOD_NONE; else if(m_pRenderer->Supports(VS_INTERLACEMETHOD_RENDER_BOB)) m_presentmethod = VS_INTERLACEMETHOD_RENDER_BOB; else m_presentmethod = VS_INTERLACEMETHOD_NONE; } /* default to odd field if we want to deinterlace and don't know better */ if(m_presentfield == FS_NONE && m_presentmethod != VS_INTERLACEMETHOD_NONE) m_presentfield = FS_TOP; /* invert present field if we have one of those methods */ if( m_presentmethod == VS_INTERLACEMETHOD_RENDER_BOB_INVERTED || m_presentmethod == VS_INTERLACEMETHOD_RENDER_WEAVE_INVERTED ) { if( m_presentfield == FS_BOT ) m_presentfield = FS_TOP; else m_presentfield = FS_BOT; } } g_application.NewFrame(); /* wait untill render thread have flipped buffers */ timeout = m_presenttime + 1.0; while(m_presentstep == PRESENT_FLIP && !bStop) { if(!m_presentevent.WaitMSec(100) && GetPresentTime() > timeout && !bStop) { CLog::Log(LOGWARNING, "CRenderManager::FlipPage - timeout waiting for flip to complete"); return; } } }