summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2021-11-12 23:54:18 -0800
committerGravatar bunnei2022-03-24 18:13:33 -0700
commit5849c9a4cdcb3cb18c2b63c390365d2a00ddb916 (patch)
treea7e52d64a463d65f1a448c7f6c5364514be00488 /src
parenthle: vi: Integrate new NVFlinger and HosBinderDriverServer service. (diff)
downloadyuzu-5849c9a4cdcb3cb18c2b63c390365d2a00ddb916.tar.gz
yuzu-5849c9a4cdcb3cb18c2b63c390365d2a00ddb916.tar.xz
yuzu-5849c9a4cdcb3cb18c2b63c390365d2a00ddb916.zip
hle: nvflinger: BufferQueueProducer: Handle SetPreallocatedBuffer with empty buffer.
- Used by Naruto Ultimate Ninja Storm.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue_producer.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp
index d48e96b14..a347f8b3b 100644
--- a/src/core/hle/service/nvflinger/buffer_queue_producer.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue_producer.cpp
@@ -793,8 +793,6 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
793 const std::shared_ptr<GraphicBuffer>& buffer) { 793 const std::shared_ptr<GraphicBuffer>& buffer) {
794 LOG_DEBUG(Service_NVFlinger, "slot {}", slot); 794 LOG_DEBUG(Service_NVFlinger, "slot {}", slot);
795 795
796 UNIMPLEMENTED_IF_MSG(!buffer, "buffer must be valid!");
797
798 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { 796 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
799 return Status::BadValue; 797 return Status::BadValue;
800 } 798 }
@@ -802,13 +800,18 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
802 BufferQueueCore::AutoLock lock(core); 800 BufferQueueCore::AutoLock lock(core);
803 801
804 slots[slot] = {}; 802 slots[slot] = {};
805 slots[slot].is_preallocated = true;
806 slots[slot].graphic_buffer = buffer; 803 slots[slot].graphic_buffer = buffer;
807 804
808 core->override_max_buffer_count = core->GetPreallocatedBufferCountLocked(); 805 // Most games preallocate a buffer and pass a valid buffer here. However, it is possible for
809 core->default_width = buffer->Width(); 806 // this to be called with an empty buffer, Naruto Ultimate Ninja Storm is a game that does this.
810 core->default_height = buffer->Height(); 807 if (buffer) {
811 core->default_buffer_format = buffer->Format(); 808 slots[slot].is_preallocated = true;
809
810 core->override_max_buffer_count = core->GetPreallocatedBufferCountLocked();
811 core->default_width = buffer->Width();
812 core->default_height = buffer->Height();
813 core->default_buffer_format = buffer->Format();
814 }
812 815
813 core->SignalDequeueCondition(); 816 core->SignalDequeueCondition();
814 buffer_wait_event->GetWritableEvent().Signal(); 817 buffer_wait_event->GetWritableEvent().Signal();