Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
344f4f52c1 | |||
eb212aa91b | |||
a6dbb2ad2b |
@ -31,11 +31,9 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
public int SubmissionCount;
|
public int SubmissionCount;
|
||||||
public CommandBuffer CommandBuffer;
|
public CommandBuffer CommandBuffer;
|
||||||
public FenceHolder Fence;
|
public FenceHolder Fence;
|
||||||
public SemaphoreHolder Semaphore;
|
|
||||||
|
|
||||||
public List<IAuto> Dependants;
|
public List<IAuto> Dependants;
|
||||||
public List<MultiFenceHolder> Waitables;
|
public List<MultiFenceHolder> Waitables;
|
||||||
public HashSet<SemaphoreHolder> Dependencies;
|
|
||||||
|
|
||||||
public void Initialize(Vk api, Device device, CommandPool pool)
|
public void Initialize(Vk api, Device device, CommandPool pool)
|
||||||
{
|
{
|
||||||
@ -51,7 +49,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
Dependants = new List<IAuto>();
|
Dependants = new List<IAuto>();
|
||||||
Waitables = new List<MultiFenceHolder>();
|
Waitables = new List<MultiFenceHolder>();
|
||||||
Dependencies = new HashSet<SemaphoreHolder>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,14 +140,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddDependency(int cbIndex, CommandBufferScoped dependencyCbs)
|
|
||||||
{
|
|
||||||
Debug.Assert(_commandBuffers[cbIndex].InUse);
|
|
||||||
var semaphoreHolder = _commandBuffers[dependencyCbs.CommandBufferIndex].Semaphore;
|
|
||||||
semaphoreHolder.Get();
|
|
||||||
_commandBuffers[cbIndex].Dependencies.Add(semaphoreHolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddWaitable(int cbIndex, MultiFenceHolder waitable)
|
public void AddWaitable(int cbIndex, MultiFenceHolder waitable)
|
||||||
{
|
{
|
||||||
ref var entry = ref _commandBuffers[cbIndex];
|
ref var entry = ref _commandBuffers[cbIndex];
|
||||||
@ -354,14 +343,8 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
waitable.RemoveBufferUses(cbIndex);
|
waitable.RemoveBufferUses(cbIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var dependency in entry.Dependencies)
|
|
||||||
{
|
|
||||||
dependency.Put();
|
|
||||||
}
|
|
||||||
|
|
||||||
entry.Dependants.Clear();
|
entry.Dependants.Clear();
|
||||||
entry.Waitables.Clear();
|
entry.Waitables.Clear();
|
||||||
entry.Dependencies.Clear();
|
|
||||||
entry.Fence?.Dispose();
|
entry.Fence?.Dispose();
|
||||||
|
|
||||||
if (refreshFence)
|
if (refreshFence)
|
||||||
|
@ -26,11 +26,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
_pool.AddWaitable(CommandBufferIndex, waitable);
|
_pool.AddWaitable(CommandBufferIndex, waitable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddDependency(CommandBufferScoped dependencyCbs)
|
|
||||||
{
|
|
||||||
_pool.AddDependency(CommandBufferIndex, dependencyCbs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public FenceHolder GetFence()
|
public FenceHolder GetFence()
|
||||||
{
|
{
|
||||||
return _pool.GetFence(CommandBufferIndex);
|
return _pool.GetFence(CommandBufferIndex);
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
using Silk.NET.Vulkan;
|
|
||||||
using System;
|
|
||||||
using System.Threading;
|
|
||||||
using VkSemaphore = Silk.NET.Vulkan.Semaphore;
|
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Vulkan
|
|
||||||
{
|
|
||||||
class SemaphoreHolder : IDisposable
|
|
||||||
{
|
|
||||||
private readonly Vk _api;
|
|
||||||
private readonly Device _device;
|
|
||||||
private VkSemaphore _semaphore;
|
|
||||||
private int _referenceCount;
|
|
||||||
private bool _disposed;
|
|
||||||
|
|
||||||
public unsafe SemaphoreHolder(Vk api, Device device)
|
|
||||||
{
|
|
||||||
_api = api;
|
|
||||||
_device = device;
|
|
||||||
|
|
||||||
var semaphoreCreateInfo = new SemaphoreCreateInfo
|
|
||||||
{
|
|
||||||
SType = StructureType.SemaphoreCreateInfo,
|
|
||||||
};
|
|
||||||
|
|
||||||
api.CreateSemaphore(device, in semaphoreCreateInfo, null, out _semaphore).ThrowOnError();
|
|
||||||
|
|
||||||
_referenceCount = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VkSemaphore GetUnsafe()
|
|
||||||
{
|
|
||||||
return _semaphore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public VkSemaphore Get()
|
|
||||||
{
|
|
||||||
Interlocked.Increment(ref _referenceCount);
|
|
||||||
return _semaphore;
|
|
||||||
}
|
|
||||||
|
|
||||||
public unsafe void Put()
|
|
||||||
{
|
|
||||||
if (Interlocked.Decrement(ref _referenceCount) == 0)
|
|
||||||
{
|
|
||||||
_api.DestroySemaphore(_device, _semaphore, null);
|
|
||||||
_semaphore = default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
if (!_disposed)
|
|
||||||
{
|
|
||||||
Put();
|
|
||||||
_disposed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -69,27 +69,32 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
{
|
{
|
||||||
DriverId.AmdProprietary => "AMD",
|
DriverId.AmdProprietary => "AMD",
|
||||||
DriverId.AmdOpenSource => "AMD (Open)",
|
DriverId.AmdOpenSource => "AMD (Open)",
|
||||||
DriverId.ArmProprietary => "ARM",
|
|
||||||
DriverId.BroadcomProprietary => "Broadcom",
|
|
||||||
DriverId.CoreaviProprietary => "CoreAVI",
|
|
||||||
DriverId.GgpProprietary => "GGP",
|
|
||||||
DriverId.GoogleSwiftshader => "SwiftShader",
|
|
||||||
DriverId.ImaginationProprietary => "Imagination",
|
|
||||||
DriverId.IntelOpenSourceMesa => "Intel (Open)",
|
|
||||||
DriverId.IntelProprietaryWindows => "Intel",
|
|
||||||
DriverId.JuiceProprietary => "Juice",
|
|
||||||
DriverId.MesaDozen => "Dozen",
|
|
||||||
DriverId.MesaLlvmpipe => "LLVMpipe",
|
|
||||||
DriverId.MesaPanvk => "PanVK",
|
|
||||||
DriverId.MesaRadv => "RADV",
|
DriverId.MesaRadv => "RADV",
|
||||||
|
DriverId.NvidiaProprietary => "NVIDIA",
|
||||||
|
DriverId.IntelProprietaryWindows => "Intel",
|
||||||
|
DriverId.IntelOpenSourceMesa => "Intel (Open)",
|
||||||
|
DriverId.ImaginationProprietary => "Imagination",
|
||||||
|
DriverId.QualcommProprietary => "Qualcomm",
|
||||||
|
DriverId.ArmProprietary => "ARM",
|
||||||
|
DriverId.GoogleSwiftshader => "SwiftShader",
|
||||||
|
DriverId.GgpProprietary => "GGP",
|
||||||
|
DriverId.BroadcomProprietary => "Broadcom",
|
||||||
|
DriverId.MesaLlvmpipe => "LLVMpipe",
|
||||||
|
DriverId.Moltenvk => "MoltenVK",
|
||||||
|
DriverId.CoreaviProprietary => "CoreAVI",
|
||||||
|
DriverId.JuiceProprietary => "Juice",
|
||||||
|
DriverId.VerisiliconProprietary => "Verisilicon",
|
||||||
DriverId.MesaTurnip => "Turnip",
|
DriverId.MesaTurnip => "Turnip",
|
||||||
DriverId.MesaV3DV => "V3DV",
|
DriverId.MesaV3DV => "V3DV",
|
||||||
DriverId.MesaVenus => "Venus",
|
DriverId.MesaPanvk => "PanVK",
|
||||||
DriverId.Moltenvk => "MoltenVK",
|
|
||||||
DriverId.NvidiaProprietary => "NVIDIA",
|
|
||||||
DriverId.QualcommProprietary => "Qualcomm",
|
|
||||||
DriverId.SamsungProprietary => "Samsung",
|
DriverId.SamsungProprietary => "Samsung",
|
||||||
DriverId.VerisiliconProprietary => "Verisilicon",
|
DriverId.MesaVenus => "Venus",
|
||||||
|
DriverId.MesaDozen => "Dozen",
|
||||||
|
|
||||||
|
// TODO: Use real enum when we have an up to date Silk.NET.
|
||||||
|
(DriverId)24 => "NVK",
|
||||||
|
(DriverId)25 => "Imagination (Open)",
|
||||||
|
(DriverId)26 => "Honeykrisp",
|
||||||
_ => id.ToString(),
|
_ => id.ToString(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -474,9 +474,9 @@ namespace Ryujinx.HLE.HOS.Services
|
|||||||
{
|
{
|
||||||
const int MessageSize = 0x100;
|
const int MessageSize = 0x100;
|
||||||
|
|
||||||
using IMemoryOwner<byte> reqDataOwner = ByteMemoryPool.Rent(MessageSize);
|
using SpanOwner<byte> reqDataOwner = SpanOwner<byte>.Rent(MessageSize);
|
||||||
|
|
||||||
Span<byte> reqDataSpan = reqDataOwner.Memory.Span;
|
Span<byte> reqDataSpan = reqDataOwner.Span;
|
||||||
|
|
||||||
_selfProcess.CpuMemory.Read(_selfThread.TlsAddress, reqDataSpan);
|
_selfProcess.CpuMemory.Read(_selfThread.TlsAddress, reqDataSpan);
|
||||||
|
|
||||||
|
@ -85,9 +85,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||||||
|
|
||||||
ReadOnlySpan<byte> inputParcel = context.Memory.GetSpan(dataPos, (int)dataSize);
|
ReadOnlySpan<byte> inputParcel = context.Memory.GetSpan(dataPos, (int)dataSize);
|
||||||
|
|
||||||
using IMemoryOwner<byte> outputParcelOwner = ByteMemoryPool.RentCleared(replySize);
|
using SpanOwner<byte> outputParcelOwner = SpanOwner<byte>.RentCleared(checked((int)replySize));
|
||||||
|
|
||||||
Span<byte> outputParcel = outputParcelOwner.Memory.Span;
|
Span<byte> outputParcel = outputParcelOwner.Span;
|
||||||
|
|
||||||
ResultCode result = OnTransact(binderId, code, flags, inputParcel, outputParcel);
|
ResultCode result = OnTransact(binderId, code, flags, inputParcel, outputParcel);
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ using Ryujinx.Common.Memory;
|
|||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using Ryujinx.HLE.HOS.Services.SurfaceFlinger.Types;
|
using Ryujinx.HLE.HOS.Services.SurfaceFlinger.Types;
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@ -13,7 +12,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||||||
{
|
{
|
||||||
sealed class Parcel : IDisposable
|
sealed class Parcel : IDisposable
|
||||||
{
|
{
|
||||||
private readonly IMemoryOwner<byte> _rawDataOwner;
|
private readonly MemoryOwner<byte> _rawDataOwner;
|
||||||
|
|
||||||
private Span<byte> Raw => _rawDataOwner.Memory.Span;
|
private Span<byte> Raw => _rawDataOwner.Memory.Span;
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||||||
|
|
||||||
public Parcel(ReadOnlySpan<byte> data)
|
public Parcel(ReadOnlySpan<byte> data)
|
||||||
{
|
{
|
||||||
_rawDataOwner = ByteMemoryPool.RentCopy(data);
|
_rawDataOwner = MemoryOwner<byte>.RentCopy(data);
|
||||||
|
|
||||||
_payloadPosition = 0;
|
_payloadPosition = 0;
|
||||||
_objectPosition = 0;
|
_objectPosition = 0;
|
||||||
@ -40,7 +39,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
|
|||||||
{
|
{
|
||||||
uint headerSize = (uint)Unsafe.SizeOf<ParcelHeader>();
|
uint headerSize = (uint)Unsafe.SizeOf<ParcelHeader>();
|
||||||
|
|
||||||
_rawDataOwner = ByteMemoryPool.RentCleared(BitUtils.AlignUp<uint>(headerSize + payloadSize + objectsSize, 4));
|
_rawDataOwner = MemoryOwner<byte>.RentCleared(checked((int)BitUtils.AlignUp<uint>(headerSize + payloadSize + objectsSize, 4)));
|
||||||
|
|
||||||
Header.PayloadSize = payloadSize;
|
Header.PayloadSize = payloadSize;
|
||||||
Header.ObjectsSize = objectsSize;
|
Header.ObjectsSize = objectsSize;
|
||||||
|
Reference in New Issue
Block a user