hle: nvflinger: buffer_queue_core: StillTracking: Take const reference.

This commit is contained in:
bunnei 2022-03-19 22:06:46 -07:00
parent 53058ae73f
commit ddd5a2b1c6
4 changed files with 7 additions and 7 deletions

View file

@ -74,7 +74,7 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
LOG_DEBUG(Service_NVFlinger, "drop desire={} expect={} size={}", desired_present, LOG_DEBUG(Service_NVFlinger, "drop desire={} expect={} size={}", desired_present,
expected_present.count(), core->queue.size()); expected_present.count(), core->queue.size());
if (core->StillTracking(&*front)) { if (core->StillTracking(*front)) {
// Front buffer is still in mSlots, so mark the slot as free // Front buffer is still in mSlots, so mark the slot as free
slots[front->slot].buffer_state = BufferState::Free; slots[front->slot].buffer_state = BufferState::Free;
core->free_buffers.push_back(front->slot); core->free_buffers.push_back(front->slot);
@ -110,7 +110,7 @@ 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 the front buffer is still being tracked, update its slot state
if (core->StillTracking(&*front)) { if (core->StillTracking(*front)) {
slots[slot].acquire_called = true; slots[slot].acquire_called = true;
slots[slot].needs_cleanup_on_release = false; slots[slot].needs_cleanup_on_release = false;
slots[slot].buffer_state = BufferState::Acquired; slots[slot].buffer_state = BufferState::Acquired;

View file

@ -116,10 +116,10 @@ void BufferQueueCore::FreeAllBuffersLocked() {
} }
} }
bool BufferQueueCore::StillTracking(const BufferItem* item) const { bool BufferQueueCore::StillTracking(const BufferItem& item) const {
const BufferSlot& slot = slots[item->slot]; const BufferSlot& slot = slots[item.slot];
return (slot.graphic_buffer != nullptr) && (item->graphic_buffer == slot.graphic_buffer); return (slot.graphic_buffer != nullptr) && (item.graphic_buffer == slot.graphic_buffer);
} }
void BufferQueueCore::WaitWhileAllocatingLocked() const { void BufferQueueCore::WaitWhileAllocatingLocked() const {

View file

@ -45,7 +45,7 @@ private:
s32 GetPreallocatedBufferCountLocked() const; s32 GetPreallocatedBufferCountLocked() const;
void FreeBufferLocked(s32 slot); void FreeBufferLocked(s32 slot);
void FreeAllBuffersLocked(); void FreeAllBuffersLocked();
bool StillTracking(const BufferItem* item) const; bool StillTracking(const BufferItem& item) const;
void WaitWhileAllocatingLocked() const; void WaitWhileAllocatingLocked() const;
private: private:

View file

@ -554,7 +554,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
if (front->is_droppable) { if (front->is_droppable) {
// If the front queued buffer is still being tracked, we first // If the front queued buffer is still being tracked, we first
// mark it as freed // mark it as freed
if (core->StillTracking(&*front)) { if (core->StillTracking(*front)) {
slots[front->slot].buffer_state = BufferState::Free; slots[front->slot].buffer_state = BufferState::Free;
core->free_buffers.push_front(front->slot); core->free_buffers.push_front(front->slot);
} }