<commit_before>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using Avalonia.OpenGL;
using Avalonia.OpenGL.Egl;
using Avalonia.OpenGL.Surfaces;
using Avalonia.Platform.Interop;
using JetBrains.Annotations;
using static Avalonia.LinuxFramebuffer.NativeUnsafeMethods;
using static Avalonia.LinuxFramebuffer.Output.LibDrm;
using static Avalonia.LinuxFramebuffer.Output.LibDrm.GbmColorFormats;

namespace Avalonia.LinuxFramebuffer.Output
{
    public unsafe class DrmOutput : IGlOutputBackend, IGlPlatformSurface
    {
        private DrmOutputOptions _outputOptions = new();
        private DrmCard _card;
        public PixelSize PixelSize => _mode.Resolution;

        public double Scaling
        {
            get => _outputOptions.Scaling;
            set => _outputOptions.Scaling = value;
        }
        public IGlContext PrimaryContext => _deferredContext;

        private EglPlatformOpenGlInterface _platformGl;
        public IPlatformOpenGlInterface PlatformOpenGlInterface => _platformGl;

        public DrmOutput(DrmCard card, DrmResources resources, DrmConnector connector, DrmModeInfo modeInfo,
            DrmOutputOptions? options = null)
        {
            if(options != null) 
                _outputOptions = options;
            Init(card, resources, connector, modeInfo);
        }
        public DrmOutput(string path = null, bool connectorsForceProbe = false, [CanBeNull] DrmOutputOptions options = null)
        {
            if(options != null) 
                _outputOptions = options;
            CreateDrmOutput(path, connectorsForceProbe);
        }

        private void CreateDrmOutput(string path = null, bool connectorsForceProbe = false)
        {
            var card = new DrmCard(path);

            var resources = card.GetResources(connectorsForceProbe);

            var connector =
                resources.Connectors.FirstOrDefault(x => x.Connection == DrmModeConnection.DRM_MODE_CONNECTED);
            if(connector == null)
                throw new InvalidOperationException("Unable to find connected DRM connector");<commit_msg>Clean up<commit_after>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using Avalonia.OpenGL;
using Avalonia.OpenGL.Egl;
using Avalonia.OpenGL.Surfaces;
using Avalonia.Platform.Interop;
using JetBrains.Annotations;
using static Avalonia.LinuxFramebuffer.NativeUnsafeMethods;
using static Avalonia.LinuxFramebuffer.Output.LibDrm;
using static Avalonia.LinuxFramebuffer.Output.LibDrm.GbmColorFormats;

namespace Avalonia.LinuxFramebuffer.Output
{
    public unsafe class DrmOutput : IGlOutputBackend, IGlPlatformSurface
    {
        private DrmOutputOptions _outputOptions = new();
        private DrmCard _card;
        public PixelSize PixelSize => _mode.Resolution;

        public double Scaling
        {
            get => _outputOptions.Scaling;
            set => _outputOptions.Scaling = value;
        }
        public IGlContext PrimaryContext => _deferredContext;

        private EglPlatformOpenGlInterface _platformGl;
        public IPlatformOpenGlInterface PlatformOpenGlInterface => _platformGl;

        public DrmOutput(DrmCard card, DrmResources resources, DrmConnector connector, DrmModeInfo modeInfo,
            DrmOutputOptions? options = null)
        {
            if(options != null) 
                _outputOptions = options;
            Init(card, resources, connector, modeInfo);
        }
        public DrmOutput(string path = null, bool connectorsForceProbe = false, [CanBeNull] DrmOutputOptions options = null)
        {
            if(options != null) 
                _outputOptions = options;
            
            var card = new DrmCard(path);

            var resources = card.GetResources(connectorsForceProbe);

            var connector =
                resources.Connectors.FirstOrDefault(x => x.Connection == DrmModeConnection.DRM_MODE_CONNECTED);
            if(connector == null)
                throw new InvalidOperationException("Unable to find connected DRM connector");
{'fraction_non_alphanumeric': 0.06965055050263284, 'fraction_numerical': 0.0, 'mean_word_length': 2.9424528301886794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1689116', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1083, 'n_words': 258}