Skip to content

Commit

Permalink
[rpi] Always add desktop resolution to supported list
Browse files Browse the repository at this point in the history
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 8311ec3 commit b0fe309
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp
Expand Up @@ -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;
}
Expand All @@ -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
{
Expand Down Expand Up @@ -563,7 +562,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;
Expand All @@ -588,7 +587,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);
Expand Down Expand Up @@ -680,6 +678,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);
Expand Down

0 comments on commit b0fe309

Please sign in to comment.