diff options
| author | Thog <me@thog.eu> | 2020-06-02 17:58:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-02 17:58:19 +0200 |
| commit | bcb7761eacaf9e40cc506648fec1eed58c23eff0 (patch) | |
| tree | 49bf2ccffab602324d7977c8d3ba83c7393098b3 /Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs | |
| parent | 44d7fcff399888d311f61772a53146d924ee5b62 (diff) | |
SurfaceFlinger: fix some bugs (#1262)
* SurfaceFlinger: fix some bugs
This fixes some bugs in the current implementation and make it closer to
the real implementation.
* Fix align of some variables
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs')
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs b/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs index 7386bafc..0b529a0e 100644 --- a/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs +++ b/Ryujinx.HLE/HOS/Services/SurfaceFlinger/BufferQueueCore.cs @@ -33,6 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger public BufferInfo[] BufferHistory; public uint BufferHistoryPosition; public bool EnableExternalEvent; + public int MaxBufferCountCached; public readonly object Lock = new object(); @@ -71,8 +72,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger Owner = process; - BufferHistory = new BufferInfo[BufferHistoryArraySize]; - EnableExternalEvent = true; + BufferHistory = new BufferInfo[BufferHistoryArraySize]; + EnableExternalEvent = true; + MaxBufferCountCached = 0; } public int GetMinUndequeuedBufferCountLocked(bool async) @@ -95,6 +97,14 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger return GetMinUndequeuedBufferCountLocked(async); } + public void UpdateMaxBufferCountCachedLocked(int slot) + { + if (MaxBufferCountCached <= slot) + { + MaxBufferCountCached = slot + 1; + } + } + public int GetMaxBufferCountLocked(bool async) { int minMaxBufferCount = GetMinMaxBufferCountLocked(async); @@ -103,7 +113,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger if (OverrideMaxBufferCount != 0) { - maxBufferCount = OverrideMaxBufferCount; + return OverrideMaxBufferCount; } // Preserve all buffers already in control of the producer and the consumer. @@ -163,18 +173,20 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger Monitor.Wait(Lock); } - public void SignalIsAbandonedEvent() + public void SignalIsAllocatingEvent() { Monitor.PulseAll(Lock); } - public void WaitIsAbandonedEvent() + public void WaitIsAllocatingEvent() { Monitor.Wait(Lock); } public void FreeBufferLocked(int slot) { + Slots[slot].GraphicBuffer.Reset(); + if (Slots[slot].BufferState == BufferState.Acquired) { Slots[slot].NeedsCleanupOnRelease = true; @@ -206,9 +218,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger public void WaitWhileAllocatingLocked() { - while (IsAbandoned) + while (IsAllocating) { - WaitIsAbandonedEvent(); + WaitIsAllocatingEvent(); } } |
