ref: 65f046e29fa03d45f884dadae12d7240c29839d8
parent: 3be948d84b48c92386887aea0bd7ddb931ee03b4
parent: 41e376e494c39ac4f6e442e715d773e887da968e
author: hkuang <hkuang@google.com>
date: Thu Feb 5 07:44:04 EST 2015
Merge "Mute the harmless tsan error in frame parallel decode."
--- a/vp9/decoder/vp9_dthread.c
+++ b/vp9/decoder/vp9_dthread.c
@@ -45,6 +45,13 @@
#endif
}
+// This macro prevents thread_sanitizer from reporting known concurrent writes.
+#if defined(__has_feature)
+#if __has_feature(thread_sanitizer)
+#define BUILDING_WITH_TSAN
+#endif
+#endif
+
// TODO(hkuang): Remove worker parameter as it is only used in debug code.
void vp9_frameworker_wait(VP9Worker *const worker, RefCntBuffer *const ref_buf,
int row) {
@@ -52,9 +59,11 @@
if (!ref_buf)
return;
- // Enabling the following line of code will get harmless tsan error but
- // will get best performance.
- // if (ref_buf->row >= row && ref_buf->buf.corrupted != 1) return;
+#ifndef BUILDING_WITH_TSAN
+ // The following line of code will get harmless tsan error but it is the key
+ // to get best performance.
+ if (ref_buf->row >= row && ref_buf->buf.corrupted != 1) return;
+#endif
{
// Find the worker thread that owns the reference frame. If the reference