aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-09-18 01:30:35 -0300
committerGitHub <noreply@github.com>2018-09-18 01:30:35 -0300
commitd4187aaa9d7194aa26d04aee838edbc3a38f1862 (patch)
tree06fe725c1067b4aeca21749799b835d85e7d2787 /Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs
parentbec95cacc1061f91373a1e3a1411981af7fe2e4e (diff)
Allow "reinterpretation" of framebuffer/zeta formats (#418)
* (Re)Implement format reinterpretation, other changes * Implement writeback to guest memory, some refactoring * More refactoring, implement reinterpretation the old way again * Clean up * Some fixes on M2MF (old Dma engine), added partial support for P2MF, fix conditional ssy, add Z24S8 zeta format, other fixes * nit: Formatting * Address PR feedback
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs48
1 files changed, 24 insertions, 24 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs
index 2a6918c4..a8493758 100644
--- a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs
+++ b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs
@@ -1,6 +1,7 @@
using Ryujinx.Graphics.Gal;
-using Ryujinx.Graphics.Texture;
+using Ryujinx.Graphics.Memory;
using Ryujinx.HLE.HOS.Kernel;
+using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS;
using Ryujinx.HLE.HOS.Services.Nv.NvMap;
using Ryujinx.HLE.Logging;
using System;
@@ -19,7 +20,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
private Dictionary<(string, int), ServiceProcessParcel> Commands;
- private KEvent ReleaseEvent;
+ private KEvent BinderEvent;
private IGalRenderer Renderer;
@@ -67,7 +68,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
private bool Disposed;
- public NvFlinger(IGalRenderer Renderer, KEvent ReleaseEvent)
+ public NvFlinger(IGalRenderer Renderer, KEvent BinderEvent)
{
Commands = new Dictionary<(string, int), ServiceProcessParcel>()
{
@@ -82,8 +83,8 @@ namespace Ryujinx.HLE.HOS.Services.Android
{ ("android.gui.IGraphicBufferProducer", 0xe), GbpPreallocBuffer }
};
- this.Renderer = Renderer;
- this.ReleaseEvent = ReleaseEvent;
+ this.Renderer = Renderer;
+ this.BinderEvent = BinderEvent;
BufferQueue = new BufferEntry[0x40];
@@ -301,42 +302,41 @@ namespace Ryujinx.HLE.HOS.Services.Android
bool FlipX = BufferQueue[Slot].Transform.HasFlag(HalTransform.FlipX);
bool FlipY = BufferQueue[Slot].Transform.HasFlag(HalTransform.FlipY);
- //Rotation is being ignored
+ //Note: Rotation is being ignored.
int Top = Crop.Top;
int Left = Crop.Left;
int Right = Crop.Right;
int Bottom = Crop.Bottom;
- Renderer.QueueAction(() => Renderer.RenderTarget.SetTransform(FlipX, FlipY, Top, Left, Right, Bottom));
+ NvGpuVmm Vmm = NvGpuASIoctl.GetASCtx(Context).Vmm;
- //TODO: Support double buffering here aswell, it is broken for GPU
- //frame buffers because it seems to be completely out of sync.
- if (Context.Device.Gpu.Engine3d.IsFrameBufferPosition(FbAddr))
+ Renderer.QueueAction(() =>
{
- //Frame buffer is rendered to by the GPU, we can just
- //bind the frame buffer texture, it's not necessary to read anything.
- Renderer.QueueAction(() => Renderer.RenderTarget.Set(FbAddr));
- }
- else
- {
- //Frame buffer is not set on the GPU registers, in this case
- //assume that the app is manually writing to it.
- TextureInfo Texture = new TextureInfo(FbAddr, FbWidth, FbHeight);
+ if (!Renderer.Texture.TryGetImage(FbAddr, out GalImage Image))
+ {
+ Image = new GalImage(
+ FbWidth,
+ FbHeight, 1, 16,
+ GalMemoryLayout.BlockLinear,
+ GalImageFormat.A8B8G8R8 | GalImageFormat.Unorm);
+ }
- byte[] Data = TextureReader.Read(Context.Memory, Texture);
+ Context.Device.Gpu.ResourceManager.ClearPbCache();
+ Context.Device.Gpu.ResourceManager.SendTexture(Vmm, FbAddr, Image);
- Renderer.QueueAction(() => Renderer.RenderTarget.Set(Data, FbWidth, FbHeight));
- }
+ Renderer.RenderTarget.SetTransform(FlipX, FlipY, Top, Left, Right, Bottom);
+ Renderer.RenderTarget.Set(FbAddr);
- Context.Device.Gpu.Renderer.QueueAction(() => ReleaseBuffer(Slot));
+ ReleaseBuffer(Slot);
+ });
}
private void ReleaseBuffer(int Slot)
{
BufferQueue[Slot].State = BufferState.Free;
- ReleaseEvent.WaitEvent.Set();
+ BinderEvent.WaitEvent.Set();
lock (WaitBufferFree)
{