Permalink
Browse files

[rpi] Always add desktop resolution to supported list

There was an assumption that the desktop resolution would be in the probed list, but that is sometimes not the case.
We don't add interlaced resolutions to list, but they can be the preferred resolution read from edid. See:
http://openelec.tv/forum/124-raspberry-pi/77074-forcing-interlaced-output

Also hotplug changes causing an edid reread may cause the supported modes to change (e.g. powering on receiver)
and it is possible the previous preferred mode is no longer there

So ensure that desktop resolution is always added to list. Also handle the case where desktop resolution is invalid on launch
(e.g. hdmi output powered off)
  • Loading branch information...
popcornmix committed Jun 3, 2015
1 parent 23d765c commit 77daa1353ee63ca6e699d8a08acb5983ce9ae457
Showing with 9 additions and 5 deletions.
  1. +9 −5 xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp
@@ -190,7 +190,7 @@ int CEGLNativeTypeRaspberryPI::FindMatchingResolution(const RESOLUTION_INFO &res
for (int i = 0; i < (int)resolutions.size(); i++)
{
if(resolutions[i].iScreenWidth == res.iScreenWidth && resolutions[i].iScreenHeight == res.iScreenHeight && resolutions[i].fRefreshRate == res.fRefreshRate &&
(resolutions[i].dwFlags & (D3DPRESENTFLAG_MODE3DSBS|D3DPRESENTFLAG_MODE3DTB)) == (res.dwFlags & (D3DPRESENTFLAG_MODE3DSBS|D3DPRESENTFLAG_MODE3DTB)))
(resolutions[i].dwFlags & D3DPRESENTFLAG_MODEMASK) == (res.dwFlags & D3DPRESENTFLAG_MODEMASK))
{
return i;
}
@@ -206,8 +206,7 @@ int CEGLNativeTypeRaspberryPI::AddUniqueResolution(RESOLUTION_INFO &res, std::ve
int i = FindMatchingResolution(res, resolutions);
if (i>=0)
{ // don't replace a progressive resolution with an interlaced one of same resolution
if (!(res.dwFlags & D3DPRESENTFLAG_INTERLACED))
resolutions[i] = res;
resolutions[i] = res;
}
else
{
@@ -569,7 +568,7 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector<RESOLUTION_INFO> &r
vc_tv_hdmi_get_property(&property);
m_desktopRes.fRefreshRate = property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ? tv_state.display.hdmi.frame_rate * (1000.0f/1001.0f) : tv_state.display.hdmi.frame_rate;
}
else // sdtv
else if ((tv_state.state & ( VC_SDTV_NTSC | VC_SDTV_PAL )) != 0) // sdtv
{
m_desktopRes.iScreen = 0;
m_desktopRes.bFullScreen = true;
@@ -594,7 +593,6 @@ bool CEGLNativeTypeRaspberryPI::ProbeResolutions(std::vector<RESOLUTION_INFO> &r
GetSupportedModes(HDMI_RES_GROUP_CEA, resolutions);
GetSupportedModes(HDMI_RES_GROUP_DMT, resolutions);
if(resolutions.size() == 0)
{
AddUniqueResolution(m_desktopRes, resolutions);
CLog::Log(LOGDEBUG, "EGL probe resolution %s:%x\n", m_desktopRes.strMode.c_str(), m_desktopRes.dwFlags);
@@ -686,6 +684,12 @@ void CEGLNativeTypeRaspberryPI::GetSupportedModes(HDMI_RES_GROUP_T group, std::v
res.fPixelRatio = get_display_aspect_ratio((HDMI_ASPECT_T)tv->aspect_ratio) / ((float)res.iScreenWidth / (float)res.iScreenHeight);
res.iSubtitles = (int)(0.965 * res.iHeight);
if (!m_desktopRes.dwFlags && prefer_group == group && prefer_mode == tv->code)
m_desktopRes = res;
if (res.dwFlags & D3DPRESENTFLAG_INTERLACED)
continue;
AddUniqueResolution(res, resolutions);
CLog::Log(LOGDEBUG, "EGL mode %d: %s (%.2f) %s%s:%x\n", i, res.strMode.c_str(), res.fPixelRatio,
tv->native ? "N" : "", tv->scan_mode ? "I" : "", tv->code);

0 comments on commit 77daa13

Please sign in to comment.