diff options
| author | 2020-12-16 21:09:06 -0800 | |
|---|---|---|
| committer | 2020-12-28 21:33:34 -0800 | |
| commit | 6433b1dfd67f4c4f0c4b2e3742dc437a0d1e906e (patch) | |
| tree | d2a9a23be1a80d9351f99d7feb7978f3c2237882 /src/core/hle/service/vi | |
| parent | hle: service: Ensure system is powered on before writing IPC result. (diff) | |
| download | yuzu-6433b1dfd67f4c4f0c4b2e3742dc437a0d1e906e.tar.gz yuzu-6433b1dfd67f4c4f0c4b2e3742dc437a0d1e906e.tar.xz yuzu-6433b1dfd67f4c4f0c4b2e3742dc437a0d1e906e.zip | |
service: nvflinger: Improve synchronization for BufferQueue.
- Use proper mechanisms for blocking on DequeueBuffer.
- Ensure service thread terminates on emulation Shutdown.
Diffstat (limited to 'src/core/hle/service/vi')
| -rw-r--r-- | src/core/hle/service/vi/vi.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index ce0272e59..1051000f8 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp | |||
| @@ -544,6 +544,12 @@ private: | |||
| 544 | Settings::values.resolution_factor.GetValue()), | 544 | Settings::values.resolution_factor.GetValue()), |
| 545 | static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedHeight) * | 545 | static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedHeight) * |
| 546 | Settings::values.resolution_factor.GetValue())}; | 546 | Settings::values.resolution_factor.GetValue())}; |
| 547 | |||
| 548 | { | ||
| 549 | auto& buffer_queue = *nv_flinger.FindBufferQueue(id); | ||
| 550 | buffer_queue.Connect(); | ||
| 551 | } | ||
| 552 | |||
| 547 | ctx.WriteBuffer(response.Serialize()); | 553 | ctx.WriteBuffer(response.Serialize()); |
| 548 | break; | 554 | break; |
| 549 | } | 555 | } |
| @@ -565,18 +571,15 @@ private: | |||
| 565 | const u32 width{request.data.width}; | 571 | const u32 width{request.data.width}; |
| 566 | const u32 height{request.data.height}; | 572 | const u32 height{request.data.height}; |
| 567 | 573 | ||
| 568 | std::optional<std::pair<u32, Service::Nvidia::MultiFence*>> result; | 574 | auto& buffer_queue = *nv_flinger.FindBufferQueue(id); |
| 569 | 575 | do { | |
| 570 | while (!result) { | 576 | if (auto result = buffer_queue.DequeueBuffer(width, height); result) { |
| 571 | auto& buffer_queue = *nv_flinger.FindBufferQueue(id); | ||
| 572 | result = buffer_queue.DequeueBuffer(width, height); | ||
| 573 | |||
| 574 | if (result) { | ||
| 575 | // Buffer is available | 577 | // Buffer is available |
| 576 | IGBPDequeueBufferResponseParcel response{result->first, *result->second}; | 578 | IGBPDequeueBufferResponseParcel response{result->first, *result->second}; |
| 577 | ctx.WriteBuffer(response.Serialize()); | 579 | ctx.WriteBuffer(response.Serialize()); |
| 580 | break; | ||
| 578 | } | 581 | } |
| 579 | } | 582 | } while (buffer_queue.IsConnected()); |
| 580 | 583 | ||
| 581 | break; | 584 | break; |
| 582 | } | 585 | } |