Lines Matching refs:p

50   pollfd p = {buffer->event_fd(), POLLIN, 0};  in PollBufferEvent()  local
51 return poll(&p, 1, timeout_ms); in PollBufferEvent()
57 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
59 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
61 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
69 EXPECT_EQ(p->client_state_mask(), kFirstClientBitMask); in TEST_F()
74 EXPECT_EQ(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
78 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
79 EXPECT_EQ(0, p->Post(LocalHandle())); in TEST_F()
82 EXPECT_EQ(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
96 EXPECT_EQ(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
98 EXPECT_EQ(1, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
100 EXPECT_EQ(0, p->Gain(&fence)); in TEST_F()
101 EXPECT_EQ(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
107 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
109 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
111 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
120 auto event_sources = p->GetEventSources(); in TEST_F()
125 .data = {.fd = p->event_fd()}}; in TEST_F()
144 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
145 EXPECT_EQ(0, p->Post({})); in TEST_F()
175 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
177 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
180 uint32_t client_state_masks = p->client_state_mask(); in TEST_F()
183 cs[i] = ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
192 auto state = p->CreateConsumer(); in TEST_F()
199 cs[i] = ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
208 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
210 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
212 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
216 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
222 EXPECT_EQ(0, p->Post(LocalHandle())); in TEST_F()
225 EXPECT_EQ(-EBUSY, p->Post(LocalHandle())); in TEST_F()
226 EXPECT_EQ(-EBUSY, p->Gain(&fence)); in TEST_F()
233 EXPECT_EQ(-EBUSY, p->Post(LocalHandle())); in TEST_F()
234 EXPECT_EQ(-EBUSY, p->Gain(&fence)); in TEST_F()
238 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
242 EXPECT_EQ(-EBUSY, p->Post(LocalHandle())); in TEST_F()
245 EXPECT_EQ(0, p->Gain(&fence)); in TEST_F()
252 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
254 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
256 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
261 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
269 EXPECT_EQ(0, p->PostAsync(&metadata, invalid_fence)); in TEST_F()
270 EXPECT_EQ(p->buffer_state(), c->buffer_state()); in TEST_F()
271 EXPECT_TRUE(isAnyClientPosted(p->buffer_state())); in TEST_F()
274 EXPECT_EQ(-EBUSY, p->PostAsync(&metadata, invalid_fence)); in TEST_F()
275 EXPECT_EQ(-EBUSY, p->GainAsync(&metadata, &invalid_fence)); in TEST_F()
282 EXPECT_EQ(p->buffer_state(), c->buffer_state()); in TEST_F()
283 EXPECT_TRUE(isAnyClientAcquired(p->buffer_state())); in TEST_F()
288 EXPECT_EQ(-EBUSY, p->PostAsync(&metadata, invalid_fence)); in TEST_F()
289 EXPECT_EQ(-EBUSY, p->GainAsync(&metadata, &invalid_fence)); in TEST_F()
294 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
295 EXPECT_EQ(p->buffer_state(), c->buffer_state()); in TEST_F()
296 EXPECT_TRUE(p->is_released()); in TEST_F()
301 EXPECT_EQ(-EBUSY, p->PostAsync(&metadata, invalid_fence)); in TEST_F()
304 EXPECT_EQ(0, p->GainAsync(&metadata, &invalid_fence)); in TEST_F()
306 EXPECT_EQ(p->buffer_state(), c->buffer_state()); in TEST_F()
307 EXPECT_TRUE(isAnyClientGained(p->buffer_state())); in TEST_F()
315 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
317 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
319 ASSERT_EQ(0, p->GainAsync()); in TEST_F()
320 ASSERT_EQ(0, p->GainAsync()); in TEST_F()
324 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
326 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
328 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
330 ASSERT_EQ(0, p->GainAsync()); in TEST_F()
331 ASSERT_EQ(0, p->Post(LocalHandle())); in TEST_F()
332 ASSERT_TRUE(isAnyClientPosted(p->buffer_state())); in TEST_F()
336 EXPECT_EQ(-EBUSY, p->Gain(&invalid_fence, false)); in TEST_F()
337 EXPECT_EQ(0, p->Gain(&invalid_fence, true)); in TEST_F()
341 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
343 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
345 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
347 ASSERT_EQ(0, p->GainAsync()); in TEST_F()
348 ASSERT_EQ(0, p->Post(LocalHandle())); in TEST_F()
349 ASSERT_TRUE(isAnyClientPosted(p->buffer_state())); in TEST_F()
355 EXPECT_EQ(-EBUSY, p->GainAsync(&metadata, &invalid_fence, false)); in TEST_F()
356 EXPECT_EQ(0, p->GainAsync(&metadata, &invalid_fence, true)); in TEST_F()
360 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
362 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
363 ASSERT_EQ(0, p->GainAsync()); in TEST_F()
364 ASSERT_EQ(0, p->Post(LocalHandle())); in TEST_F()
367 ASSERT_TRUE(isClientReleased(p->buffer_state(), p->client_state_mask())); in TEST_F()
368 ASSERT_TRUE(p->is_released()); in TEST_F()
369 ASSERT_TRUE(isAnyClientPosted(p->buffer_state())); in TEST_F()
373 EXPECT_EQ(0, p->Gain(&invalid_fence, false)); in TEST_F()
377 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
379 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
380 uint32_t producer_state_mask = p->client_state_mask(); in TEST_F()
384 cs[i] = ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
390 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
395 EXPECT_EQ(0, p->PostAsync(&metadata, invalid_fence)); in TEST_F()
396 EXPECT_TRUE(isClientReleased(p->buffer_state(), p->client_state_mask())); in TEST_F()
403 isClientAcquired(p->buffer_state(), cs[i]->client_state_mask())); in TEST_F()
409 EXPECT_FALSE(p->is_released()); in TEST_F()
413 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
414 EXPECT_TRUE(p->is_released()); in TEST_F()
418 EXPECT_EQ(p->buffer_state(), cs[i]->buffer_state()); in TEST_F()
423 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
425 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
426 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
427 EXPECT_TRUE(isAnyClientGained(p->buffer_state())); in TEST_F()
430 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
438 EXPECT_EQ(0, p->PostAsync(&metadata, invalid_fence)); in TEST_F()
439 EXPECT_TRUE(isAnyClientPosted(p->buffer_state())); in TEST_F()
446 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
448 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
449 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
450 EXPECT_TRUE(isAnyClientGained(p->buffer_state())); in TEST_F()
456 EXPECT_EQ(0, p->PostAsync(&metadata, invalid_fence)); in TEST_F()
457 EXPECT_TRUE(p->is_released()); in TEST_F()
458 EXPECT_EQ(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
463 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
470 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
472 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
475 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
478 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
483 EXPECT_EQ(0, p->PostAsync(&metadata, invalid_fence)); in TEST_F()
492 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
493 EXPECT_TRUE(p->is_released()); in TEST_F()
498 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
501 EXPECT_TRUE(p->is_released()); in TEST_F()
502 EXPECT_EQ(0, p->GainAsync(&metadata, &invalid_fence)); in TEST_F()
503 EXPECT_TRUE(isAnyClientGained(p->buffer_state())); in TEST_F()
511 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
513 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
515 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
517 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
519 EXPECT_EQ(0, p->Post(LocalHandle(), &m, sizeof(Metadata))); in TEST_F()
527 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p, /*timeout_ms=*/0))); in TEST_F()
540 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
542 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
544 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
546 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
551 EXPECT_NE(0, p->Post(LocalHandle(), &evil_meta, sizeof(OverSizedMetadata))); in TEST_F()
556 EXPECT_EQ(0, p->Post(LocalHandle())); in TEST_F()
569 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
571 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
573 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
575 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
578 EXPECT_EQ(0, p->Post(LocalHandle(), &m, sizeof(m))); in TEST_F()
595 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
597 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
599 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
601 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
604 EXPECT_EQ(0, p->Post(LocalHandle(), &sequence, sizeof(sequence))); in TEST_F()
611 std::unique_ptr<ProducerBuffer> p = in TEST_F() local
613 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
615 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
617 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
621 EXPECT_EQ(0, p->Post(LocalHandle())); in TEST_F()
626 std::unique_ptr<ProducerBuffer> p = in TEST_F() local
628 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
630 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
632 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
635 EXPECT_NE(0, p->Post(LocalHandle(), &sequence, sizeof(sequence))); in TEST_F()
641 pollfd p = {fd, POLLIN, 0}; in PollFd() local
642 return poll(&p, 1, timeout_ms); in PollFd()
648 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
650 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
652 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
654 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
660 EXPECT_EQ(0, p->PostAsync(&meta, f1)); in TEST_F()
681 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
682 EXPECT_EQ(0, p->GainAsync(&meta, &f3)); in TEST_F()
686 EXPECT_EQ(0, p->PostAsync(&meta, f1)); in TEST_F()
703 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
704 EXPECT_EQ(0, p->GainAsync(&meta, &f6)); in TEST_F()
710 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
712 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
714 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
718 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
720 EXPECT_EQ(0, p->PostAsync(&meta, LocalHandle())); in TEST_F()
730 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
734 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
742 EXPECT_EQ(0, p->GainAsync(&meta, &fence, false)); in TEST_F()
746 std::unique_ptr<ProducerBuffer> p = ProducerBuffer::Create( in TEST_F() local
748 ASSERT_TRUE(p.get() != nullptr); in TEST_F()
750 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
754 EXPECT_EQ(0, p->GainAsync()); in TEST_F()
756 EXPECT_EQ(0, p->PostAsync(&meta, LocalHandle())); in TEST_F()
762 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
776 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
792 EXPECT_LT(0, RETRY_EINTR(PollBufferEvent(p))); in TEST_F()
797 ConsumerBuffer::Import(p->CreateConsumer()); in TEST_F()
805 EXPECT_EQ(0, p->GainAsync(&meta, &invalid_fence)); in TEST_F()