diff options
author | Yang Ni <yangni@google.com> | 2016-06-23 11:58:19 -0700 |
---|---|---|
committer | Yang Ni <yangni@google.com> | 2016-07-06 12:23:09 -0700 |
commit | 51c6dc550e845811bfb258148bbf10342984b8f1 (patch) | |
tree | 0357f3eb3a969a81b01257f4252ffa4ce1e739b3 | |
parent | d86e817fbeda2faba02a2d9c50bd581050ceb32f (diff) | |
download | cts-51c6dc550e845811bfb258148bbf10342984b8f1.tar.gz |
Remove data race from refocus test
Bug: 27882507
This was one of the two causes of failure on the IMG GPU driver.
Change-Id: Ic6aabf97c0d945bcdf1c17790204b89cf08d2ce1
(cherry picked from commit bc91299ca0380a1010d8117439d2d1ae29baad6a)
2 files changed, 11 insertions, 9 deletions
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java b/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java index 3942982d600..52bc4de1b80 100644 --- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java +++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java @@ -143,8 +143,9 @@ public class RefocusFilterd1new extends startnow = System.nanoTime(); //scriptC.forEach_MarkLayerMask(buffers.inAllocation); - // Pass sharp meta allocation directly into the kernel - scriptC.forEach_MarkLayerMaskPassInput(buffers.sharpActualDepthAllocation, buffers.sharpDilatedDepthAllocation); + // Pass the sharp actual depth allocation directly into the kernel, and modify the dilated depth + // allocation which is set as a global. + scriptC.forEach_MarkLayerMaskPassInput(buffers.sharpActualDepthAllocation); endnow = System.nanoTime(); Log.d(myTAG, "MarkLayerMask: "+(endnow - startnow)+ " ns" ); @@ -213,8 +214,9 @@ public class RefocusFilterd1new extends startnow = System.nanoTime(); //scriptC.forEach_MarkLayerMask(buffers.inAllocation); - // Pass sharp meta allocation directly into the kernel - scriptC.forEach_MarkLayerMaskPassInput(buffers.sharpActualDepthAllocation, buffers.sharpDilatedDepthAllocation); + // Pass the sharp actual depth allocation directly into the kernel, and modify the dilated depth + // allocation which is set as a global. + scriptC.forEach_MarkLayerMaskPassInput(buffers.sharpActualDepthAllocation); endnow = System.nanoTime(); Log.d(myTAG, "MarkLayerMask: "+(endnow - startnow)+ " ns" ); diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs b/tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs index e7342c624af..e21db8aa408 100644 --- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs +++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/layered_filter_fast_d1new.rs @@ -181,8 +181,8 @@ void __attribute__((kernel)) MarkLayerMask(uchar4 in, uint32_t x, uint32_t y) { // Another version of MarkLayerMask kernel that directly passes input allocation to kernels // Input: g_sharp_actual_depth // Output: g_sharp_dilated_depth -uchar __attribute__((kernel)) MarkLayerMaskPassInput(uchar in_sharp_actual_depth, uint32_t x) { - if (!OnTheLayer(in_sharp_actual_depth, g_target_layer_i2)) return rsGetElementAt_uchar(g_sharp_dilated_depth, x); +void __attribute__((kernel)) MarkLayerMaskPassInput(uchar in_sharp_actual_depth, uint32_t x) { + if (!OnTheLayer(in_sharp_actual_depth, g_target_layer_i2)) return; // Marks this pixel as active. rsSetElementAt_uchar(g_sharp_active, 1, x); @@ -209,7 +209,8 @@ uchar __attribute__((kernel)) MarkLayerMaskPassInput(uchar in_sharp_actual_depth ValidDepthNotOnTheLayer(sharp_actual_depth, g_target_layer_i2); if (!is_this_pixel_on_boundary) { - return in_sharp_actual_depth; + rsSetElementAt_uchar(g_sharp_dilated_depth, in_sharp_actual_depth, x); + return; } // Marks pixels near the boundary of active pixels to compute matte later. @@ -235,9 +236,8 @@ uchar __attribute__((kernel)) MarkLayerMaskPassInput(uchar in_sharp_actual_depth } current_meta_index += jump_to_next_row; } - - return in_sharp_actual_depth; } + // Distance transform in processing layers in pass one from the back-most to // the sharp depth. void __attribute__((kernel)) |