Browse Source
feat: Allow to initialize `DrmCard` from existing file descriptor. (#15092)
pull/15108/head
workgroupengineering
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
10 additions and
4 deletions
-
src/Linux/Avalonia.LinuxFramebuffer/Output/DrmBindings.cs
-
src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs
|
|
|
@ -170,6 +170,11 @@ namespace Avalonia.LinuxFramebuffer.Output |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public DrmCard(int fd) |
|
|
|
{ |
|
|
|
Fd = fd; |
|
|
|
} |
|
|
|
|
|
|
|
public DrmResources GetResources(bool connectorsForceProbe = false) => new DrmResources(Fd, connectorsForceProbe); |
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
|
|
|
|
@ -7,10 +7,8 @@ using Avalonia.OpenGL; |
|
|
|
using Avalonia.OpenGL.Egl; |
|
|
|
using Avalonia.OpenGL.Surfaces; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.Platform.Interop; |
|
|
|
using static Avalonia.LinuxFramebuffer.NativeUnsafeMethods; |
|
|
|
using static Avalonia.LinuxFramebuffer.Output.LibDrm; |
|
|
|
using static Avalonia.LinuxFramebuffer.Output.LibDrm.GbmColorFormats; |
|
|
|
|
|
|
|
namespace Avalonia.LinuxFramebuffer.Output |
|
|
|
{ |
|
|
|
@ -51,12 +49,15 @@ namespace Avalonia.LinuxFramebuffer.Output |
|
|
|
} |
|
|
|
|
|
|
|
public DrmOutput(string path = null, bool connectorsForceProbe = false, DrmOutputOptions options = null) |
|
|
|
:this(new DrmCard(path), connectorsForceProbe, options) |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public DrmOutput(DrmCard card, bool connectorsForceProbe = false, DrmOutputOptions options = null) |
|
|
|
{ |
|
|
|
if (options != null) |
|
|
|
_outputOptions = options; |
|
|
|
|
|
|
|
var card = new DrmCard(path); |
|
|
|
|
|
|
|
var resources = card.GetResources(connectorsForceProbe); |
|
|
|
|
|
|
|
IEnumerable<DrmConnector> connectors = resources.Connectors; |
|
|
|
|