Skip to content
Permalink
Browse files

Revert "[rbp] Refactor the vsync handle to support multiple callers"

This reverts commit b0c2c48.
  • Loading branch information
popcornmix committed Sep 18, 2015
1 parent a4b77d7 commit 21a87026cba28c82de1dc23cf79dce29cd121d25
Showing with 32 additions and 43 deletions.
  1. +30 −38 xbmc/linux/RBP.cpp
  2. +2 −5 xbmc/linux/RBP.h
@@ -66,7 +66,6 @@ CRBP::CRBP()
m_enabled = 0;
m_mb = mbox_open();
vcsm_init();
m_vsync_count = 0;
}

CRBP::~CRBP()
@@ -147,45 +146,11 @@ void CRBP::LogFirmwareVerison()
CLog::Log(LOGNOTICE, "Config:\n%s", response);
}

static void vsync_callback_static(DISPMANX_UPDATE_HANDLE_T u, void *arg)
{
CRBP *rbp = reinterpret_cast<CRBP*>(arg);
rbp->VSyncCallback();
}

void CRBP::VSyncCallback()
{
CSingleLock lock(m_vsync_lock);
m_vsync_count++;
m_vsync_cond.notifyAll();
}

unsigned int CRBP::WaitVsync(unsigned int target)
{
CSingleLock lock(m_vsync_lock);
if (target == ~0U)
target = m_vsync_count+1;

if (m_display == DISPMANX_NO_HANDLE)
{
CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__);
return m_vsync_count;
}

while (m_vsync_count < target)
if (!m_vsync_cond.wait(lock, 100))
break;

return m_vsync_count;
}

DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device)
{
if (m_display == DISPMANX_NO_HANDLE)
{
m_display = vc_dispmanx_display_open( 0 /*screen*/ );
int s = vc_dispmanx_vsync_callback(m_display, vsync_callback_static, (void *)this);
assert(s == 0);
init_cursor();
}
return m_display;
@@ -194,11 +159,9 @@ DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device)
void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display)
{
assert(display == m_display);
int s = vc_dispmanx_vsync_callback(m_display, NULL, NULL);
assert(s == 0);
uninit_cursor();
vc_dispmanx_display_close(m_display);
m_display = DISPMANX_NO_HANDLE;
uninit_cursor();
}

void CRBP::GetDisplaySize(int &width, int &height)
@@ -251,6 +214,35 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw
return image;
}


static void vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *arg)
{
CEvent *sync = (CEvent *)arg;
sync->Set();
}

void CRBP::WaitVsync()
{
int s;
DISPMANX_DISPLAY_HANDLE_T m_display = vc_dispmanx_display_open( 0 /*screen*/ );
if (m_display == DISPMANX_NO_HANDLE)
{
CLog::Log(LOGDEBUG, "CRBP::%s skipping while display closed", __func__);
return;
}
m_vsync.Reset();
s = vc_dispmanx_vsync_callback(m_display, vsync_callback, (void *)&m_vsync);
if (s == 0)
{
m_vsync.WaitMSec(1000);
}
else assert(0);
s = vc_dispmanx_vsync_callback(m_display, NULL, NULL);
assert(s == 0);
vc_dispmanx_display_close( m_display );
}


void CRBP::Deinitialize()
{
if (m_omx_image_init)
@@ -65,8 +65,7 @@ class CRBP
// stride can be null for packed output
unsigned char *CaptureDisplay(int width, int height, int *stride, bool swap_red_blue, bool video_only = true);
DllOMX *GetDllOMX() { return m_OMX ? m_OMX->GetDll() : NULL; }
unsigned int WaitVsync(unsigned int target = ~0U);
void VSyncCallback();
void WaitVsync();

void SuspendVideoOutput();
void ResumeVideoOutput();
@@ -83,9 +82,7 @@ class CRBP
bool m_codec_wvc1_enabled;
COMXCore *m_OMX;
DISPMANX_DISPLAY_HANDLE_T m_display;
CCriticalSection m_vsync_lock;
XbmcThreads::ConditionVariable m_vsync_cond;
unsigned int m_vsync_count;
CEvent m_vsync;
class DllLibOMXCore;
CCriticalSection m_critSection;

0 comments on commit 21a8702

Please sign in to comment.
You can’t perform that action at this time.