aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpopcornmix <popcornmix@gmail.com>2014-10-26 17:57:59 +0000
committerRainer Hochecker <fernetmenta@online.de>2014-10-31 21:45:12 +0100
commitc05fbb66b993ff4f971e3a957e60856e75377f85 (patch)
tree3d8780f9c4e344938a2570c6cd40bb3deda52af3
parent8cf74b47b1c9b896838871350a53fc497fe78305 (diff)
[rbp] Add method for waiting for next vsync
-rw-r--r--xbmc/linux/RBP.cpp34
-rw-r--r--xbmc/linux/RBP.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp
index 73a42c4481..ba1a3d0ee6 100644
--- a/xbmc/linux/RBP.cpp
+++ b/xbmc/linux/RBP.cpp
@@ -32,6 +32,7 @@ CRBP::CRBP()
m_omx_initialized = false;
m_DllBcmHost = new DllBcmHost();
m_OMX = new COMXCore();
+ m_element = 0;
}
CRBP::~CRBP()
@@ -53,6 +54,9 @@ bool CRBP::Initialize()
m_DllBcmHost->bcm_host_init();
+ uint32_t vc_image_ptr;
+ m_resource = vc_dispmanx_resource_create( VC_IMAGE_RGB565, 1, 1, &vc_image_ptr );
+
m_omx_initialized = m_OMX->Initialize();
if(!m_omx_initialized)
return false;
@@ -156,6 +160,36 @@ unsigned char *CRBP::CaptureDisplay(int width, int height, int *pstride, bool sw
return image;
}
+void CRBP::WaitVsync(void)
+{
+ DISPMANX_DISPLAY_HANDLE_T display = vc_dispmanx_display_open( 0 /*screen*/ );
+ DISPMANX_UPDATE_HANDLE_T update = vc_dispmanx_update_start(0);
+
+ VC_DISPMANX_ALPHA_T alpha = { (DISPMANX_FLAGS_ALPHA_T)(DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS), 120, /*alpha 0->255*/ 0 };
+ VC_RECT_T src_rect;
+ VC_RECT_T dst_rect;
+ vc_dispmanx_rect_set( &src_rect, 0, 0, 1 << 16, 1 << 16 );
+ vc_dispmanx_rect_set( &dst_rect, 0, 0, 1, 1 );
+
+ if (m_element)
+ vc_dispmanx_element_remove( update, m_element );
+
+ m_element = vc_dispmanx_element_add( update,
+ display,
+ 2000, // layer
+ &dst_rect,
+ m_resource,
+ &src_rect,
+ DISPMANX_PROTECTION_NONE,
+ &alpha,
+ NULL, // clamp
+ (DISPMANX_TRANSFORM_T)0 );
+
+ vc_dispmanx_update_submit_sync(update);
+ vc_dispmanx_display_close( display );
+}
+
+
void CRBP::Deinitialize()
{
if (m_omx_image_init)
diff --git a/xbmc/linux/RBP.h b/xbmc/linux/RBP.h
index e9a2d5ab00..4fd18f3542 100644
--- a/xbmc/linux/RBP.h
+++ b/xbmc/linux/RBP.h
@@ -57,6 +57,7 @@ public:
// 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; }
+ void WaitVsync();
private:
DllBcmHost *m_DllBcmHost;
@@ -69,6 +70,8 @@ private:
bool m_codec_mpg2_enabled;
bool m_codec_wvc1_enabled;
COMXCore *m_OMX;
+ DISPMANX_RESOURCE_HANDLE_T m_resource;
+ DISPMANX_ELEMENT_HANDLE_T m_element;
class DllLibOMXCore;
CCriticalSection m_critSection;
};