Beispiel #1
0
        unsafe static bool QueryDisplay(int fd, ModeConnector* c, out LinuxDisplay display)
        {
            display = null;

            // Find corresponding encoder
            ModeEncoder* encoder = GetEncoder(fd, c);
            if (encoder == null)
                return false;

            ModeCrtc* crtc = GetCrtc(fd, encoder);
            if (crtc == null)
                return false;

            display = new LinuxDisplay(fd, (IntPtr)c, (IntPtr)encoder, (IntPtr)crtc);
            return true;
        }
Beispiel #2
0
        unsafe static ModeEncoder* GetEncoder(int fd, ModeConnector* c)
        {
            ModeEncoder* encoder = null;
            for (int i = 0; i < c->count_encoders && encoder == null; i++)
            {
                ModeEncoder* e = (ModeEncoder*)Drm.ModeGetEncoder(
                    fd, *(c->encoders + i));
                if (e != null)
                {
                    if (e->encoder_id == c->encoder_id)
                    {
                        encoder = e;
                    }
                    else
                    {
                        Drm.ModeFreeEncoder((IntPtr)e);
                    }
                }
            }

            if (encoder != null)
            {
                Debug.Print("[KMS] Encoder {0} found for connector {1}",
                    encoder->encoder_id, c->connector_id);
            }
            else
            {
                Debug.Print("[KMS] Failed to find encoder for connector {0}", c->connector_id);
            }

            return encoder;
        }