diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/nvflinger/consumer_base.cpp | 29 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/consumer_base.h | 3 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/core/hle/service/nvflinger/consumer_base.cpp b/src/core/hle/service/nvflinger/consumer_base.cpp index be65a3f88..c2c80832c 100644 --- a/src/core/hle/service/nvflinger/consumer_base.cpp +++ b/src/core/hle/service/nvflinger/consumer_base.cpp | |||
| @@ -36,38 +36,41 @@ void ConsumerBase::FreeBufferLocked(s32 slot_index) { | |||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | void ConsumerBase::OnFrameAvailable(const BufferItem& item) { | 38 | void ConsumerBase::OnFrameAvailable(const BufferItem& item) { |
| 39 | std::scoped_lock lock(mutex); | ||
| 40 | LOG_DEBUG(Service_NVFlinger, "called"); | 39 | LOG_DEBUG(Service_NVFlinger, "called"); |
| 41 | } | 40 | } |
| 42 | 41 | ||
| 43 | void ConsumerBase::OnFrameReplaced(const BufferItem& item) { | 42 | void ConsumerBase::OnFrameReplaced(const BufferItem& item) { |
| 44 | std::scoped_lock lock(mutex); | ||
| 45 | LOG_DEBUG(Service_NVFlinger, "called"); | 43 | LOG_DEBUG(Service_NVFlinger, "called"); |
| 46 | } | 44 | } |
| 47 | 45 | ||
| 48 | void ConsumerBase::OnBuffersReleased() { | 46 | void ConsumerBase::OnBuffersReleased() { |
| 49 | std::scoped_lock lock(mutex); | 47 | std::scoped_lock lock(mutex); |
| 50 | LOG_DEBUG(Service_NVFlinger, "called"); | ||
| 51 | } | ||
| 52 | 48 | ||
| 53 | void ConsumerBase::OnSidebandStreamChanged() {} | 49 | LOG_DEBUG(Service_NVFlinger, "called"); |
| 54 | 50 | ||
| 55 | Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when, | ||
| 56 | u64 max_frame_number) { | ||
| 57 | if (is_abandoned) { | 51 | if (is_abandoned) { |
| 58 | LOG_ERROR(Service_NVFlinger, "consumer is abandoned!"); | 52 | // Nothing to do if we're already abandoned. |
| 59 | return Status::NoInit; | 53 | return; |
| 60 | } | 54 | } |
| 61 | 55 | ||
| 62 | Status err = consumer->AcquireBuffer(item, present_when, max_frame_number); | 56 | u64 mask = 0; |
| 57 | consumer->GetReleasedBuffers(&mask); | ||
| 58 | for (int i = 0; i < BufferQueueDefs::NUM_BUFFER_SLOTS; i++) { | ||
| 59 | if (mask & (1ULL << i)) { | ||
| 60 | FreeBufferLocked(i); | ||
| 61 | } | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | void ConsumerBase::OnSidebandStreamChanged() {} | ||
| 66 | |||
| 67 | Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when) { | ||
| 68 | Status err = consumer->AcquireBuffer(item, present_when); | ||
| 63 | if (err != Status::NoError) { | 69 | if (err != Status::NoError) { |
| 64 | return err; | 70 | return err; |
| 65 | } | 71 | } |
| 66 | 72 | ||
| 67 | if (item->graphic_buffer != nullptr) { | 73 | if (item->graphic_buffer != nullptr) { |
| 68 | if (slots[item->slot].graphic_buffer != nullptr) { | ||
| 69 | FreeBufferLocked(item->slot); | ||
| 70 | } | ||
| 71 | slots[item->slot].graphic_buffer = item->graphic_buffer; | 74 | slots[item->slot].graphic_buffer = item->graphic_buffer; |
| 72 | } | 75 | } |
| 73 | 76 | ||
diff --git a/src/core/hle/service/nvflinger/consumer_base.h b/src/core/hle/service/nvflinger/consumer_base.h index 9ab949420..736080e3a 100644 --- a/src/core/hle/service/nvflinger/consumer_base.h +++ b/src/core/hle/service/nvflinger/consumer_base.h | |||
| @@ -35,8 +35,7 @@ protected: | |||
| 35 | virtual void OnSidebandStreamChanged() override; | 35 | virtual void OnSidebandStreamChanged() override; |
| 36 | 36 | ||
| 37 | void FreeBufferLocked(s32 slot_index); | 37 | void FreeBufferLocked(s32 slot_index); |
| 38 | Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when, | 38 | Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when); |
| 39 | u64 max_frame_number = 0); | ||
| 40 | Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer); | 39 | Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer); |
| 41 | bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer) const; | 40 | bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer) const; |
| 42 | Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer, | 41 | Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer, |