コード例 #1
0
 protected override void Dispose(bool manual)
 {
     if (manual)
     {
         // Reset the scanout region
         LinuxWindowInfo wnd = WindowInfo as LinuxWindowInfo;
         if (wnd != null)
         {
             unsafe
             {
                 int      connector_id = wnd.DisplayDevice.pConnector->connector_id;
                 ModeInfo mode         = wnd.DisplayDevice.OriginalMode;
                 Drm.ModeSetCrtc(fd,
                                 wnd.DisplayDevice.pCrtc->crtc_id,
                                 wnd.DisplayDevice.pCrtc->buffer_id,
                                 wnd.DisplayDevice.pCrtc->x,
                                 wnd.DisplayDevice.pCrtc->y,
                                 &connector_id,
                                 1,
                                 &mode);
             }
         }
     }
     base.Dispose(manual);
 }
コード例 #2
0
        private unsafe static void GetModes(LinuxDisplay display, DisplayResolution[] modes, out DisplayResolution current)
        {
            int mode_count = display.pConnector->count_modes;

            Debug.Print("[KMS] Display supports {0} mode(s)", mode_count);
            for (int i = 0; i < mode_count; i++)
            {
                ModeInfo *mode = display.pConnector->modes + i;
                if (mode != null)
                {
                    Debug.Print("Mode {0}: {1}x{2} @{3}", i,
                                mode->hdisplay, mode->vdisplay, mode->vrefresh);
                    DisplayResolution res = GetDisplayResolution(mode);
                    modes[i] = res;
                }
            }

            if (display.pCrtc->mode_valid != 0)
            {
                ModeInfo cmode = display.pCrtc->mode;
                current = GetDisplayResolution(&cmode);
            }
            else
            {
                current = GetDisplayResolution(display.pConnector->modes);
            }
            Debug.Print("Current mode: {0}", current.ToString());
        }
コード例 #3
0
 public LinuxDisplay(int fd, IntPtr c, IntPtr e, IntPtr r)
 {
     FD        = fd;
     Connector = c;
     Encoder   = e;
     Crtc      = r;
     unsafe
     {
         OriginalMode = pCrtc->mode; // in case we change resolution later on
     }
 }
コード例 #4
0
 public override bool TryRestoreResolution(DisplayDevice device)
 {
     unsafe
     {
         LinuxDisplay display      = (LinuxDisplay)device.Id;
         ModeInfo     mode         = display.OriginalMode;
         int          connector_id = display.pConnector->connector_id;
         return(Drm.ModeSetCrtc(FD, display.Id, 0, 0, 0,
                                &connector_id, 1, &mode) == 0);
     }
 }
コード例 #5
0
ファイル: LinuxDisplayDriver.cs プロジェクト: tecnikor/opentk
 public LinuxDisplay(int fd, IntPtr c, IntPtr e, IntPtr r)
 {
     FD = fd;
     Connector = c;
     Encoder = e;
     Crtc = r;
     unsafe
     {
         OriginalMode = pCrtc->mode; // in case we change resolution later on
     }
 }
コード例 #6
0
ファイル: LinuxDisplayDriver.cs プロジェクト: tecnikor/opentk
 unsafe static DisplayResolution GetDisplayResolution(ModeInfo* mode)
 {
     return new DisplayResolution(
         0, 0,
         mode->hdisplay, mode->vdisplay,
         32, // This is actually part of the framebuffer, not the DisplayResolution
         mode->vrefresh);
 }
コード例 #7
0
ファイル: Drm.cs プロジェクト: chantsunman/opentk
 unsafe public static extern int ModeSetCrtc(int fd, int crtcId, int bufferId,
     int x, int y, int* connectors, int count, ModeInfo* mode);