Skip to content

Commit

Permalink
RBP: Hack: open display after changing hdmi mode
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Nov 18, 2019
1 parent ab5e90a commit f9ad7f1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
6 changes: 4 additions & 2 deletions xbmc/platform/linux/RBP.cpp
Expand Up @@ -162,19 +162,22 @@ static void vsync_callback_static(DISPMANX_UPDATE_HANDLE_T u, void *arg)

DISPMANX_DISPLAY_HANDLE_T CRBP::OpenDisplay(uint32_t device)
{
DISPMANX_DISPLAY_HANDLE_T last_display = m_display;
CSingleLock lock(m_critSection);
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);
}
CLog::Log(LOGDEBUG, "CRBP::%s device:%d m_display:%x (%x)", __FUNCTION__, device, m_display, last_display);
return m_display;
}

void CRBP::CloseDisplay(DISPMANX_DISPLAY_HANDLE_T display)
{
CSingleLock lock(m_critSection);
CLog::Log(LOGDEBUG, "CRBP::%s display:%x m_display:%x", __FUNCTION__, display, m_display);
assert(display == m_display);
int s = vc_dispmanx_vsync_callback(m_display, NULL, NULL);
assert(s == 0);
Expand Down Expand Up @@ -244,7 +247,6 @@ void CRBP::VSyncCallback()
uint32_t CRBP::WaitVsync(uint32_t target)
{
CSingleLock vlock(m_vsync_lock);
DISPMANX_DISPLAY_HANDLE_T display = m_display;
XbmcThreads::EndTime delay(50);
if (target == ~0U)
target = m_vsync_count+1;
Expand All @@ -256,7 +258,7 @@ uint32_t CRBP::WaitVsync(uint32_t target)
break;
}
if ((signed)(m_vsync_count - target) < 0)
CLog::Log(LOGDEBUG, "CRBP::%s no vsync %d/%d display:%x(%x) delay:%d", __FUNCTION__, m_vsync_count, target, m_display, display, delay.MillisLeft());
CLog::Log(LOGDEBUG, "CRBP::%s no vsync %d/%d display:%x delay:%d", __FUNCTION__, m_vsync_count, target, m_display, delay.MillisLeft());

return m_vsync_count;
}
Expand Down
4 changes: 2 additions & 2 deletions xbmc/platform/xbmc.cpp
Expand Up @@ -8,7 +8,7 @@

#include "Application.h"

#ifdef TARGET_RASPBERRY_PI
#if 1//def TARGET_RASPBERRY_PI
#include "platform/linux/RBP.h"
#endif

Expand Down Expand Up @@ -36,7 +36,7 @@ extern "C" int XBMC_Run(bool renderGUI, const CAppParamParser &params)
return status;
}

#ifdef TARGET_RASPBERRY_PI
#if 1//def TARGET_RASPBERRY_PI
if(!g_RBP.Initialize())
return false;
g_RBP.LogFirmwareVersion();
Expand Down
12 changes: 11 additions & 1 deletion xbmc/windowing/gbm/DRMAtomic.cpp
Expand Up @@ -118,10 +118,20 @@ void CDRMAtomic::FlipPage(struct gbm_bo *bo, bool rendered, bool videoLayer)
if (m_need_modeset)
{
flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
m_need_modeset = false;
if (m_dispman_display != DISPMANX_NO_HANDLE)
{
g_RBP.CloseDisplay(m_dispman_display);
m_dispman_display = DISPMANX_NO_HANDLE;
}
}

DrmAtomicCommit(!drm_fb ? 0 : drm_fb->fb_id, flags, rendered, videoLayer);

if (m_need_modeset)
{
m_need_modeset = false;
m_dispman_display = g_RBP.OpenDisplay(0);
}
}

bool CDRMAtomic::InitDrm()
Expand Down
2 changes: 2 additions & 0 deletions xbmc/windowing/gbm/DRMAtomic.h
Expand Up @@ -9,6 +9,7 @@
#pragma once

#include "DRMUtils.h"
#include "platform/linux/RBP.h"

namespace KODI
{
Expand Down Expand Up @@ -36,6 +37,7 @@ class CDRMAtomic : public CDRMUtils
bool m_need_modeset;
bool m_active = true;
drmModeAtomicReq *m_req = nullptr;
DISPMANX_ELEMENT_HANDLE_T m_dispman_display = 0;
};

}
Expand Down

0 comments on commit f9ad7f1

Please sign in to comment.