Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Unified Diff: content/common/gpu/media/dxva_video_decode_accelerator.cc

Issue 11369229: Don't wait endlessly for flushing the batched queries sent to the GPU driver during H/W decode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/dxva_video_decode_accelerator.cc
===================================================================
--- content/common/gpu/media/dxva_video_decode_accelerator.cc (revision 167469)
+++ content/common/gpu/media/dxva_video_decode_accelerator.cc (working copy)
@@ -73,6 +73,10 @@
log << ", HRESULT: 0x" << std::hex << result, \
error_code, ret);
+// Maximum number of iterations we allow before aborting the attempt to flush
+// the batched queries to the driver.
Ami GONE FROM CHROMIUM 2012/11/13 23:07:13 Why is it safe to give up? What is the cost to co
ananta 2012/11/13 23:17:22 Cost to correctness would be torn frames in the wo
apatrick_chromium 2012/11/14 01:27:49 I expect it will be torn frames or similar. It won
+#define MAX_ITERATIONS_FOR_D3D_FLUSH 10
Ami GONE FROM CHROMIUM 2012/11/13 23:07:13 prefer enum to #define enum { kMaxiterationsForD3d
+
static IMFSample* CreateEmptySample() {
base::win::ScopedComPtr<IMFSample> sample;
HRESULT hr = MFCreateSample(sample.Receive());
@@ -135,12 +139,12 @@
CHECK_GE(static_cast<int>(max_length), size);
memcpy(destination, stream, size);
+ hr = buffer->SetCurrentLength(size);
Ami GONE FROM CHROMIUM 2012/11/13 23:07:13 what's this move about? unmentioned in CL descrip
ananta 2012/11/13 23:17:22 Sorry. needless change crept in. was debugging som
+ RETURN_ON_HR_FAILURE(hr, "Failed to set buffer length", NULL);
+
hr = buffer->Unlock();
RETURN_ON_HR_FAILURE(hr, "Failed to unlock buffer", NULL);
- hr = buffer->SetCurrentLength(size);
- RETURN_ON_HR_FAILURE(hr, "Failed to set buffer length", NULL);
-
return sample.Detach();
}
@@ -396,11 +400,22 @@
// the texture. Flush it once here though.
hr = query_->Issue(D3DISSUE_END);
RETURN_ON_HR_FAILURE(hr, "Failed to issue END", false);
+
+ // The loop below attempts to flush the batched queries to the driver. We
+ // don't want to loop endlessly waiting for the driver to return success.
Ami GONE FROM CHROMIUM 2012/11/13 23:07:13 ...because we've seen driver bugs?
+ // The current workaround is to allow a max of MAX_ITERATIONS_FOR_D3D_FLUSH
+ // iterations.
+ int iterations = 0;
do {
+ if (iterations > MAX_ITERATIONS_FOR_D3D_FLUSH)
Ami GONE FROM CHROMIUM 2012/11/13 23:07:13 putting this test in the while condition would obv
ananta 2012/11/13 23:17:22 Done.
+ break;
hr = query_->GetData(NULL, 0, D3DGETDATA_FLUSH);
- if (hr == S_FALSE)
+ if (hr == S_FALSE) {
Sleep(1); // Poor-man's Yield().
+ ++iterations;
+ }
} while (hr == S_FALSE);
Ami GONE FROM CHROMIUM 2012/11/13 23:07:13 l.408-417 could be rewritten as: int iterations =
ananta 2012/11/13 23:17:22 Done.
+
eglBindTexImage(
static_cast<EGLDisplay*>(eglGetDisplay(EGL_DEFAULT_DISPLAY)),
decoding_surface_,
@@ -818,6 +833,9 @@
MFVideoInterlace_MixedInterlaceOrProgressive);
RETURN_ON_HR_FAILURE(hr, "Failed to set interlace mode", false);
+ hr = MFSetAttributeSize(media_type, MF_MT_PIXEL_ASPECT_RATIO, 2, 1);
Ami GONE FROM CHROMIUM 2012/11/13 23:07:13 wat?
ananta 2012/11/13 23:17:22 Unrelated change. Was debugging the small video pa
+ RETURN_ON_HR_FAILURE(hr, "Failed to set aspect ratio", false);
+
hr = decoder_->SetInputType(0, media_type, 0); // No flags
RETURN_ON_HR_FAILURE(hr, "Failed to set decoder input type", false);
return true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698