Merge pull request #8428 from bunnei/nvflinger-fix-timing

Follow-up fixes for NVFlinger rewrite (Part 3)
This commit is contained in:
bunnei 2022-06-08 11:20:05 -07:00 committed by GitHub
commit 073714a762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 31 deletions

View File

@ -89,14 +89,6 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
LOG_DEBUG(Service_NVFlinger, "acquiring slot={}", slot); LOG_DEBUG(Service_NVFlinger, "acquiring slot={}", slot);
// If the front buffer is still being tracked, update its slot state
if (core->StillTracking(*front)) {
slots[slot].acquire_called = true;
slots[slot].needs_cleanup_on_release = false;
slots[slot].buffer_state = BufferState::Acquired;
slots[slot].fence = Fence::NoFence();
}
// If the buffer has previously been acquired by the consumer, set graphic_buffer to nullptr to // If the buffer has previously been acquired by the consumer, set graphic_buffer to nullptr to
// avoid unnecessarily remapping this buffer on the consumer side. // avoid unnecessarily remapping this buffer on the consumer side.
if (out_buffer->acquire_called) { if (out_buffer->acquire_called) {
@ -139,26 +131,11 @@ Status BufferQueueConsumer::ReleaseBuffer(s32 slot, u64 frame_number, const Fenc
++current; ++current;
} }
if (slots[slot].buffer_state == BufferState::Acquired) {
slots[slot].fence = release_fence;
slots[slot].buffer_state = BufferState::Free; slots[slot].buffer_state = BufferState::Free;
listener = core->connected_producer_listener; listener = core->connected_producer_listener;
LOG_DEBUG(Service_NVFlinger, "releasing slot {}", slot); LOG_DEBUG(Service_NVFlinger, "releasing slot {}", slot);
} else if (slots[slot].needs_cleanup_on_release) {
LOG_DEBUG(Service_NVFlinger, "releasing a stale buffer slot {} (state = {})", slot,
slots[slot].buffer_state);
slots[slot].needs_cleanup_on_release = false;
return Status::StaleBufferSlot;
} else {
LOG_ERROR(Service_NVFlinger, "attempted to release buffer slot {} but its state was {}",
slot, slots[slot].buffer_state);
return Status::BadValue;
}
core->SignalDequeueCondition(); core->SignalDequeueCondition();
} }

View File

@ -84,10 +84,6 @@ void BufferQueueCore::FreeBufferLocked(s32 slot) {
slots[slot].graphic_buffer.reset(); slots[slot].graphic_buffer.reset();
if (slots[slot].buffer_state == BufferState::Acquired) {
slots[slot].needs_cleanup_on_release = true;
}
slots[slot].buffer_state = BufferState::Free; slots[slot].buffer_state = BufferState::Free;
slots[slot].frame_number = UINT32_MAX; slots[slot].frame_number = UINT32_MAX;
slots[slot].acquire_called = false; slots[slot].acquire_called = false;

View File

@ -31,7 +31,6 @@ struct BufferSlot final {
u64 frame_number{}; u64 frame_number{};
Fence fence; Fence fence;
bool acquire_called{}; bool acquire_called{};
bool needs_cleanup_on_release{};
bool attached_by_consumer{}; bool attached_by_consumer{};
bool is_preallocated{}; bool is_preallocated{};
}; };