aboutsummaryrefslogtreecommitdiffstats
blob: 0ab6a68b11710fa9f0b3ef3743e7e2911a81041a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?xml version='1.0'?> <!--*-nxml-*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
          "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<!--
  Written 2012 by David Herrmann <dh.herrmann@googlemail.com>
  Dedicated to the Public Domain
-->

<refentry id="drmModeGetResources">
  <refentryinfo>
    <title>Direct Rendering Manager</title>
    <productname>libdrm</productname>
    <date>September 2012</date>
    <authorgroup>
      <author>
        <contrib>Developer</contrib>
        <firstname>David</firstname>
        <surname>Herrmann</surname>
        <email>dh.herrmann@googlemail.com</email>
      </author>
    </authorgroup>
  </refentryinfo>

  <refmeta>
    <refentrytitle>drmModeGetResources</refentrytitle>
    <manvolnum>3</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>drmModeGetResources</refname>
    <refpurpose>retrieve current display configuration information</refpurpose>
  </refnamediv>

  <refsynopsisdiv>

    <funcsynopsis>
      <funcsynopsisinfo>#include &lt;xf86drm.h&gt;</funcsynopsisinfo>
      <funcsynopsisinfo>#include &lt;xf86drmMode.h&gt;</funcsynopsisinfo>

      <funcprototype>
        <funcdef>drmModeResPtr <function>drmModeGetResources</function></funcdef>
        <paramdef>int <parameter>fd</parameter></paramdef>
      </funcprototype>
    </funcsynopsis>

  </refsynopsisdiv>

  <refsect1>
    <title>Description</title>
    <para><function>drmModeGetResources</function> allocates, populates, and
          returns a <structname>drmModeRes</structname> structure containing
          information about the current display configuration. The structure
          contains the following fields:

<programlisting>
typedef struct _drmModeRes {
    int count_fbs;
    uint32_t *fbs;

    int count_crtcs;
    uint32_t *crtcs;

    int count_connectors;
    uint32_t *connectors;

    int count_encoders;
    uint32_t *encoders;

    uint32_t min_width, max_width;
    uint32_t min_height, max_height;
} drmModeRes, *drmModeResPtr;
</programlisting>

          </para>

    <para>The <structfield>count_fbs</structfield> and
          <structfield>fbs</structfield> fields indicate the number of currently
          allocated framebuffer objects (i.e., objects that can be attached to
          a given CRTC or sprite for display).</para>

    <para>The <structfield>count_crtcs</structfield> and
          <structfield>crtcs</structfield> fields list the available CRTCs in
          the configuration. A CRTC is simply an object that can scan out a
          framebuffer to a display sink, and contains mode timing and relative
          position information. CRTCs drive encoders, which are responsible for
          converting the pixel stream into a specific display protocol (e.g.,
          MIPI or HDMI).</para>

    <para>The <structfield>count_connectors</structfield> and
          <structfield>connectors</structfield> fields list the available
          physical connectors on the system. Note that some of these may not be
          exposed from the chassis (e.g., LVDS or eDP). Connectors are attached
          to encoders and contain information about the attached display sink
          (e.g., width and height in mm, subpixel ordering, and various other
          properties).</para>

    <para>The <structfield>count_encoders</structfield> and
          <structfield>encoders</structfield> fields list the available encoders
          on the device. Each encoder may be associated with a CRTC, and may be
          used to drive a particular encoder.</para>

    <para>The <structfield>min*</structfield> and
          <structfield>max*</structfield> fields indicate the maximum size of a
          framebuffer for this device (i.e., the scanout size limit).</para>
  </refsect1>

  <refsect1>
    <title>Return Value</title>
    <para><function>drmModeGetResources</function> returns a drmModeRes
          structure pointer on success, <literal>NULL</literal> on failure. The
          returned structure must be freed with
          <citerefentry><refentrytitle>drmModeFreeResources</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
  </refsect1>

  <refsect1>
    <title>Reporting Bugs</title>
    <para>Bugs in this function should be reported to
      https://bugs.freedesktop.org/enter_bug.cgi?product=DRI&amp;component=libdrm
      under the "DRI" product, component "libdrm"</para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <citerefentry><refentrytitle>drm</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drm-kms</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeGetFB</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeAddFB</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeAddFB2</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeRmFB</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeDirtyFB</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeGetCrtc</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeSetCrtc</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeGetEncoder</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
      <citerefentry><refentrytitle>drmModeGetConnector</refentrytitle><manvolnum>3</manvolnum></citerefentry>
    </para>
  </refsect1>
</refentry>