Skip to content

Commit

Permalink
dxva: never try to open more than a single hw decoder on ati HD 2xxx …
Browse files Browse the repository at this point in the history
…and HD3xxx
  • Loading branch information
FernetMenta committed Sep 19, 2014
1 parent 3ffb86c commit 161060e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
21 changes: 17 additions & 4 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp
Expand Up @@ -231,6 +231,7 @@ CDXVAContext::CDXVAContext()
m_context = NULL;
m_refCount = 0;
m_service = NULL;
m_atiWorkaround = false;
}

void CDXVAContext::Release(CDecoder *decoder)
Expand Down Expand Up @@ -303,6 +304,15 @@ bool CDXVAContext::CreateContext()
{
m_DXVA2CreateVideoService(g_Windowing.Get3DDevice(), IID_IDirectXVideoDecoderService, (void**)&m_service);
QueryCaps();

// Some older Ati devices can only open a single decoder at a given time
std::string renderer = g_Windowing.GetRenderRenderer();
if (renderer.find("Radeon HD 2") != std::string::npos ||
renderer.find("Radeon HD 3") != std::string::npos)
{
m_atiWorkaround = true;
}

return true;
}

Expand Down Expand Up @@ -437,15 +447,18 @@ bool CDXVAContext::CreateDecoder(GUID &inGuid, DXVA2_VideoDesc *format, const DX
int retry = 0;
while (retry < 2)
{
HRESULT res = m_service->CreateVideoDecoder(inGuid, format, config, surfaces, count, decoder);
if (!FAILED(res))
if (!m_atiWorkaround || retry > 0)
{
return true;
HRESULT res = m_service->CreateVideoDecoder(inGuid, format, config, surfaces, count, decoder);
if (!FAILED(res))
{
return true;
}
}

if (retry == 0)
{
CLog::Log(LOGERROR, "%s - hw may not support multiple decoders, releasing existing ones", __FUNCTION__);
CLog::Log(LOGNOTICE, "%s - hw may not support multiple decoders, releasing existing ones", __FUNCTION__);
std::vector<CDecoder*>::iterator it;
for (it = m_decoders.begin(); it != m_decoders.end(); ++it)
{
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.h
Expand Up @@ -107,6 +107,7 @@ class CDXVAContext
UINT m_input_count;
GUID *m_input_list;
std::vector<CDecoder*> m_decoders;
bool m_atiWorkaround;
};

class CDecoder
Expand Down

0 comments on commit 161060e

Please sign in to comment.