summaryrefslogtreecommitdiffstats
path: root/src/core/hle
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-04-02 07:58:40 +0200
committerbunnei <bunneidev@gmail.com>2022-04-02 07:58:40 +0200
commit4036e37bbef38da8bc8ae017a049409219be1e51 (patch)
tree43c414006412a15b8d752f4fc6c6084b745f4ffc /src/core/hle
parenthle: service: nvflinger: buffer_queue_producer: Cleanup & add GetReleasedBuffers. (diff)
downloadyuzu-4036e37bbef38da8bc8ae017a049409219be1e51.tar
yuzu-4036e37bbef38da8bc8ae017a049409219be1e51.tar.gz
yuzu-4036e37bbef38da8bc8ae017a049409219be1e51.tar.bz2
yuzu-4036e37bbef38da8bc8ae017a049409219be1e51.tar.lz
yuzu-4036e37bbef38da8bc8ae017a049409219be1e51.tar.xz
yuzu-4036e37bbef38da8bc8ae017a049409219be1e51.tar.zst
yuzu-4036e37bbef38da8bc8ae017a049409219be1e51.zip
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/service/nvflinger/consumer_base.cpp29
-rw-r--r--src/core/hle/service/nvflinger/consumer_base.h3
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) {
}
void ConsumerBase::OnFrameAvailable(const BufferItem& item) {
- std::scoped_lock lock(mutex);
LOG_DEBUG(Service_NVFlinger, "called");
}
void ConsumerBase::OnFrameReplaced(const BufferItem& item) {
- std::scoped_lock lock(mutex);
LOG_DEBUG(Service_NVFlinger, "called");
}
void ConsumerBase::OnBuffersReleased() {
std::scoped_lock lock(mutex);
- LOG_DEBUG(Service_NVFlinger, "called");
-}
-void ConsumerBase::OnSidebandStreamChanged() {}
+ LOG_DEBUG(Service_NVFlinger, "called");
-Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when,
- u64 max_frame_number) {
if (is_abandoned) {
- LOG_ERROR(Service_NVFlinger, "consumer is abandoned!");
- return Status::NoInit;
+ // Nothing to do if we're already abandoned.
+ return;
}
- Status err = consumer->AcquireBuffer(item, present_when, max_frame_number);
+ u64 mask = 0;
+ consumer->GetReleasedBuffers(&mask);
+ for (int i = 0; i < BufferQueueDefs::NUM_BUFFER_SLOTS; i++) {
+ if (mask & (1ULL << i)) {
+ FreeBufferLocked(i);
+ }
+ }
+}
+
+void ConsumerBase::OnSidebandStreamChanged() {}
+
+Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when) {
+ Status err = consumer->AcquireBuffer(item, present_when);
if (err != Status::NoError) {
return err;
}
if (item->graphic_buffer != nullptr) {
- if (slots[item->slot].graphic_buffer != nullptr) {
- FreeBufferLocked(item->slot);
- }
slots[item->slot].graphic_buffer = item->graphic_buffer;
}
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:
virtual void OnSidebandStreamChanged() override;
void FreeBufferLocked(s32 slot_index);
- Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when,
- u64 max_frame_number = 0);
+ Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when);
Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer);
bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer) const;
Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer,