Commit 65616819 authored by fischman@chromium.org's avatar fischman@chromium.org

Yield instead of spinning the CPU in CopyOutputSampleDataToPictureBuffer.

Also guard in Initialize() against bad API/card combos.

BUG=139671


Review URL: https://chromiumcodereview.appspot.com/10832067

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149059 0039d316-1c4b-4281-b951-d872f2087c98
parent f67d1f2b
...@@ -391,10 +391,11 @@ bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer:: ...@@ -391,10 +391,11 @@ bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::
// Ideally, this should be done immediately before the draw call that uses // Ideally, this should be done immediately before the draw call that uses
// the texture. Flush it once here though. // the texture. Flush it once here though.
hr = query_->Issue(D3DISSUE_END); hr = query_->Issue(D3DISSUE_END);
RETURN_ON_HR_FAILURE(hr, "Failed to issue END", false);
do { do {
hr = query_->GetData(NULL, 0, D3DGETDATA_FLUSH); hr = query_->GetData(NULL, 0, D3DGETDATA_FLUSH);
if (hr == S_FALSE) if (hr == S_FALSE)
Sleep(0); Sleep(1); // Poor-man's Yield().
} while (hr == S_FALSE); } while (hr == S_FALSE);
eglBindTexImage( eglBindTexImage(
...@@ -489,6 +490,10 @@ bool DXVAVideoDecodeAccelerator::CreateD3DDevManager() { ...@@ -489,6 +490,10 @@ bool DXVAVideoDecodeAccelerator::CreateD3DDevManager() {
hr = device_->CreateQuery(D3DQUERYTYPE_EVENT, &query_); hr = device_->CreateQuery(D3DQUERYTYPE_EVENT, &query_);
RETURN_ON_HR_FAILURE(hr, "Failed to create D3D device query", false); RETURN_ON_HR_FAILURE(hr, "Failed to create D3D device query", false);
// Ensure query_ API works (to avoid an infinite loop later in
// CopyOutputSampleDataToPictureBuffer).
hr = query_->Issue(D3DISSUE_END);
RETURN_ON_HR_FAILURE(hr, "Failed to issue END test query", false);
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment