forge
Explore
Log in

Don't you dare go Hollow

Tests that read a process-global hit counter take the exclusive knob lock

Browse files at this commit

2871886eae97932626f53d188c06d60024e66d98Ahmet Kaan GümüşParent: afd4958
  • test
    • tests that read a process-global hit counter take the exclusive knob lock
    • a reader-locked sibling zeroed the reference counter under the parallel suite
Show full message
test(av1): tests that read a process-global hit counter take the exclusive knob lock; a reader-locked sibling zeroed the reference counter under the parallel suite
crates/ec-av1/src/encoder.rsmodified+9 -4
@@ -2540,7 +2540,11 @@ mod tests {
2540 /// display-order list and fails here.2540 /// display-order list and fails here.
2541 #[test]2541 #[test]
2542 fn a_pyramid_stream_decodes_in_display_order_through_both_decoders() {2542 fn a_pyramid_stream_decodes_in_display_order_through_both_decoders() {
2543- let _knobs = crate::speed::knob_read();2543+ // `take_ref_frame_hits` is a process-global counter: a reader-locked
2544+ // sibling encoding at the same time zeroes it between our encode and
2545+ // our read (seen once: LAST 0 GOLDEN 0 ALTREF 0), so this takes the
2546+ // exclusive lock.
2547+ let _knobs = crate::speed::knob_write();
2544 pyramid_round_trip(Pyramid { mini_gop: 4, mid_q_offset: None, ..Pyramid::default() }, 2);2548 pyramid_round_trip(Pyramid { mini_gop: 4, mid_q_offset: None, ..Pyramid::default() }, 2);
2545 }2549 }
2546 2550
@@ -2552,7 +2556,7 @@ mod tests {
2552 /// against ffmpeg exactly as a top ARF does.2556 /// against ffmpeg exactly as a top ARF does.
2553 #[test]2557 #[test]
2554 fn a_three_level_pyramid_stream_decodes_in_display_order() {2558 fn a_three_level_pyramid_stream_decodes_in_display_order() {
2555- let _knobs = crate::speed::knob_read();2559+ let _knobs = crate::speed::knob_write();
2556 pyramid_round_trip(2560 pyramid_round_trip(
2557 Pyramid { mini_gop: 8, mid_q_offset: Some(-8), ..Pyramid::default() },2561 Pyramid { mini_gop: 8, mid_q_offset: Some(-8), ..Pyramid::default() },
2558 2,2562 2,
@@ -2569,7 +2573,7 @@ mod tests {
2569 /// display-order mismatch against ffmpeg.2573 /// display-order mismatch against ffmpeg.
2570 #[test]2574 #[test]
2571 fn a_four_level_pyramid_stream_decodes_in_display_order() {2575 fn a_four_level_pyramid_stream_decodes_in_display_order() {
2572- let _knobs = crate::speed::knob_read();2576+ let _knobs = crate::speed::knob_write();
2573 pyramid_round_trip(2577 pyramid_round_trip(
2574 Pyramid {2578 Pyramid {
2575 mini_gop: 8,2579 mini_gop: 8,
@@ -2722,7 +2726,7 @@ mod tests {
2722 /// nothing about whether a single 64x64 block was ever written.2726 /// nothing about whether a single 64x64 block was ever written.
2723 #[test]2727 #[test]
2724 fn a_static_clip_codes_64x64_roots_and_decodes_sample_exact() {2728 fn a_static_clip_codes_64x64_roots_and_decodes_sample_exact() {
2725- let _knobs = crate::speed::knob_read();2729+ let _knobs = crate::speed::knob_write();
2726 let _gate_lock = crate::stream::tests::lock_gate_counters();2730 let _gate_lock = crate::stream::tests::lock_gate_counters();
2727 let (width, height) = (256usize, 128usize);2731 let (width, height) = (256usize, 128usize);
2728 let still = test_card(width, height, 0);2732 let still = test_card(width, height, 0);
@@ -2784,6 +2788,7 @@ mod tests {
2784 /// desyncs the whole tile here.2788 /// desyncs the whole tile here.
2785 #[test]2789 #[test]
2786 fn a_dc_stepped_clip_codes_a_64x64_residual_and_decodes_sample_exact() {2790 fn a_dc_stepped_clip_codes_a_64x64_residual_and_decodes_sample_exact() {
2791+ let _knobs = crate::speed::knob_write();
2787 let _gate_lock = crate::stream::tests::lock_gate_counters();2792 let _gate_lock = crate::stream::tests::lock_gate_counters();
2788 let (width, height) = (256usize, 128usize);2793 let (width, height) = (256usize, 128usize);
2789 let still = test_card(width, height, 0);2794 let still = test_card(width, height, 0);