Browse Source
Merge pull request #9119 from DrWenz/feat/drm-init-size
Implement DrmOutputOptions.VideoMode
pull/9368/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
16 additions and
1 deletions
-
src/Linux/Avalonia.LinuxFramebuffer/DrmOutputOptions.cs
-
src/Linux/Avalonia.LinuxFramebuffer/Output/DrmOutput.cs
|
|
|
@ -23,5 +23,11 @@ namespace Avalonia.LinuxFramebuffer |
|
|
|
/// Default: R0 G0 B0 A0
|
|
|
|
/// </summary>
|
|
|
|
public Color InitialBufferSwappingColor { get; set; } = new Color(0, 0, 0, 0); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// specific the video mode with which the DrmOutput should be created, if it is not found it will fallback to the preferred mode.
|
|
|
|
/// If NULL preferred mode will be used.
|
|
|
|
/// </summary>
|
|
|
|
public PixelSize? VideoMode { get; set; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -51,7 +51,16 @@ namespace Avalonia.LinuxFramebuffer.Output |
|
|
|
if(connector == null) |
|
|
|
throw new InvalidOperationException("Unable to find connected DRM connector"); |
|
|
|
|
|
|
|
var mode = connector.Modes.OrderByDescending(x => x.IsPreferred) |
|
|
|
DrmModeInfo? mode = null; |
|
|
|
|
|
|
|
if (options?.VideoMode != null) |
|
|
|
{ |
|
|
|
mode = connector.Modes |
|
|
|
.FirstOrDefault(x => x.Resolution.Width == options.VideoMode.Value.Width && |
|
|
|
x.Resolution.Height == options.VideoMode.Value.Height); |
|
|
|
} |
|
|
|
|
|
|
|
mode ??= connector.Modes.OrderByDescending(x => x.IsPreferred) |
|
|
|
.ThenByDescending(x => x.Resolution.Width * x.Resolution.Height) |
|
|
|
//.OrderByDescending(x => x.Resolution.Width * x.Resolution.Height)
|
|
|
|
.FirstOrDefault(); |
|
|
|
|