Surface Flinger: Implement GetBufferHistory (#1232)
* Surface Flinger: Implement GetBufferHistory Also fix some bugs on the Surface Flinger implementation * Address Ac_K's comment
This commit is contained in:
parent
b2e5855928
commit
378259a40a
12 changed files with 167 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
|||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.HLE.HOS.Services.SurfaceFlinger.Types;
|
||||
using Ryujinx.HLE.HOS.Services.Time.Clock;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
||||
|
@ -57,6 +58,18 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||
Core.Slots[bufferItem.Slot].NeedsCleanupOnRelease = true;
|
||||
Core.Slots[bufferItem.Slot].BufferState = BufferState.Acquired;
|
||||
Core.Slots[bufferItem.Slot].Fence = AndroidFence.NoFence;
|
||||
|
||||
ulong targetFrameNumber = Core.Slots[bufferItem.Slot].FrameNumber;
|
||||
|
||||
for (int i = 0; i < Core.BufferHistory.Length; i++)
|
||||
{
|
||||
if (Core.BufferHistory[i].FrameNumber == targetFrameNumber)
|
||||
{
|
||||
Core.BufferHistory[i].State = BufferState.Acquired;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bufferItem.AcquireCalled)
|
||||
|
@ -368,5 +381,38 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||
|
||||
return Status.Success;
|
||||
}
|
||||
|
||||
public Status SetPresentTime(int slot, ulong frameNumber, TimeSpanType presentationTime)
|
||||
{
|
||||
if (slot < 0 || slot >= Core.Slots.Length)
|
||||
{
|
||||
return Status.BadValue;
|
||||
}
|
||||
|
||||
lock (Core.Lock)
|
||||
{
|
||||
if (Core.Slots[slot].FrameNumber != frameNumber)
|
||||
{
|
||||
return Status.StaleBufferSlot;
|
||||
}
|
||||
|
||||
if (Core.Slots[slot].PresentationTime.NanoSeconds == 0)
|
||||
{
|
||||
Core.Slots[slot].PresentationTime = presentationTime;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Core.BufferHistory.Length; i++)
|
||||
{
|
||||
if (Core.BufferHistory[i].FrameNumber == frameNumber)
|
||||
{
|
||||
Core.BufferHistory[i].PresentationTime = presentationTime;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Status.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue