Add multiple framebuffer support in nvnflinger

This fix libnx console rendering
This commit is contained in:
Thog 2019-01-05 02:08:37 +01:00
parent 52e7f95351
commit 0e77305c3d
No known key found for this signature in database
GPG key ID: 0CD291558FAFDBC6

View file

@ -379,6 +379,21 @@ namespace Ryujinx.HLE.HOS.Services.Android
return 0;
}
private GalImageFormat ConvertColorFormat(ColorFormat colorFormat)
{
switch (colorFormat)
{
case ColorFormat.A8B8G8R8:
return GalImageFormat.RGBA8 | GalImageFormat.Unorm;
case ColorFormat.X8B8G8R8:
return GalImageFormat.RGBX8 | GalImageFormat.Unorm;
case ColorFormat.R5G6B5:
return GalImageFormat.RGB565 | GalImageFormat.Unorm;
default:
throw new NotImplementedException($"Color Format \"{colorFormat}\" not implemented!");
}
}
// TODO: support multi surface
private void SendFrameBuffer(ServiceCtx context, int slot)
{
@ -405,6 +420,8 @@ namespace Ryujinx.HLE.HOS.Services.Android
bool flipX = _bufferQueue[slot].Transform.HasFlag(HalTransform.FlipX);
bool flipY = _bufferQueue[slot].Transform.HasFlag(HalTransform.FlipY);
GalImageFormat imageFormat = ConvertColorFormat(_bufferQueue[slot].Data.Buffer.Surfaces[0].ColorFormat);
//Note: Rotation is being ignored.
int top = crop.Top;
@ -412,6 +429,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
int right = crop.Right;
int bottom = crop.Bottom;
NvGpuVmm vmm = NvGpuASIoctl.GetASCtx(context).Vmm;
_renderer.QueueAction(() =>
@ -422,7 +440,7 @@ namespace Ryujinx.HLE.HOS.Services.Android
fbWidth,
fbHeight, 1, 16,
GalMemoryLayout.BlockLinear,
GalImageFormat.RGBA8 | GalImageFormat.Unorm);
imageFormat);
}
context.Device.Gpu.ResourceManager.ClearPbCache();