1<?xml version='1.0'?> <!--*-nxml-*--> 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> 4 5<!-- 6 Written 2012 by David Herrmann <dh.herrmann@googlemail.com> 7 Dedicated to the Public Domain 8--> 9 10<refentry id="drmModeGetResources"> 11 <refentryinfo> 12 <title>Direct Rendering Manager</title> 13 <productname>libdrm</productname> 14 <date>September 2012</date> 15 <authorgroup> 16 <author> 17 <contrib>Developer</contrib> 18 <firstname>David</firstname> 19 <surname>Herrmann</surname> 20 <email>dh.herrmann@googlemail.com</email> 21 </author> 22 </authorgroup> 23 </refentryinfo> 24 25 <refmeta> 26 <refentrytitle>drmModeGetResources</refentrytitle> 27 <manvolnum>3</manvolnum> 28 </refmeta> 29 30 <refnamediv> 31 <refname>drmModeGetResources</refname> 32 <refpurpose>retrieve current display configuration information</refpurpose> 33 </refnamediv> 34 35 <refsynopsisdiv> 36 37 <funcsynopsis> 38 <funcsynopsisinfo>#include <xf86drm.h></funcsynopsisinfo> 39 <funcsynopsisinfo>#include <xf86drmMode.h></funcsynopsisinfo> 40 41 <funcprototype> 42 <funcdef>drmModeResPtr <function>drmModeGetResources</function></funcdef> 43 <paramdef>int <parameter>fd</parameter></paramdef> 44 </funcprototype> 45 </funcsynopsis> 46 47 </refsynopsisdiv> 48 49 <refsect1> 50 <title>Description</title> 51 <para><function>drmModeGetResources</function> allocates, populates, and 52 returns a <structname>drmModeRes</structname> structure containing 53 information about the current display configuration. The structure 54 contains the following fields: 55 56<programlisting> 57typedef struct _drmModeRes { 58 int count_fbs; 59 uint32_t *fbs; 60 61 int count_crtcs; 62 uint32_t *crtcs; 63 64 int count_connectors; 65 uint32_t *connectors; 66 67 int count_encoders; 68 uint32_t *encoders; 69 70 uint32_t min_width, max_width; 71 uint32_t min_height, max_height; 72} drmModeRes, *drmModeResPtr; 73</programlisting> 74 75 </para> 76 77 <para>The <structfield>count_fbs</structfield> and 78 <structfield>fbs</structfield> fields indicate the number of currently 79 allocated framebuffer objects (i.e., objects that can be attached to 80 a given CRTC or sprite for display).</para> 81 82 <para>The <structfield>count_crtcs</structfield> and 83 <structfield>crtcs</structfield> fields list the available CRTCs in 84 the configuration. A CRTC is simply an object that can scan out a 85 framebuffer to a display sink, and contains mode timing and relative 86 position information. CRTCs drive encoders, which are responsible for 87 converting the pixel stream into a specific display protocol (e.g., 88 MIPI or HDMI).</para> 89 90 <para>The <structfield>count_connectors</structfield> and 91 <structfield>connectors</structfield> fields list the available 92 physical connectors on the system. Note that some of these may not be 93 exposed from the chassis (e.g., LVDS or eDP). Connectors are attached 94 to encoders and contain information about the attached display sink 95 (e.g., width and height in mm, subpixel ordering, and various other 96 properties).</para> 97 98 <para>The <structfield>count_encoders</structfield> and 99 <structfield>encoders</structfield> fields list the available encoders 100 on the device. Each encoder may be associated with a CRTC, and may be 101 used to drive a particular encoder.</para> 102 103 <para>The <structfield>min*</structfield> and 104 <structfield>max*</structfield> fields indicate the maximum size of a 105 framebuffer for this device (i.e., the scanout size limit).</para> 106 </refsect1> 107 108 <refsect1> 109 <title>Return Value</title> 110 <para><function>drmModeGetResources</function> returns a drmModeRes 111 structure pointer on success, <literal>NULL</literal> on failure. The 112 returned structure must be freed with 113 <citerefentry><refentrytitle>drmModeFreeResources</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> 114 </refsect1> 115 116 <refsect1> 117 <title>Reporting Bugs</title> 118 <para>Bugs in this function should be reported to 119 https://bugs.freedesktop.org/enter_bug.cgi?product=DRI&component=libdrm 120 under the "DRI" product, component "libdrm"</para> 121 </refsect1> 122 123 <refsect1> 124 <title>See Also</title> 125 <para> 126 <citerefentry><refentrytitle>drm</refentrytitle><manvolnum>7</manvolnum></citerefentry>, 127 <citerefentry><refentrytitle>drm-kms</refentrytitle><manvolnum>7</manvolnum></citerefentry>, 128 <citerefentry><refentrytitle>drmModeGetFB</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 129 <citerefentry><refentrytitle>drmModeAddFB</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 130 <citerefentry><refentrytitle>drmModeAddFB2</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 131 <citerefentry><refentrytitle>drmModeRmFB</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 132 <citerefentry><refentrytitle>drmModeDirtyFB</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 133 <citerefentry><refentrytitle>drmModeGetCrtc</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 134 <citerefentry><refentrytitle>drmModeSetCrtc</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 135 <citerefentry><refentrytitle>drmModeGetEncoder</refentrytitle><manvolnum>3</manvolnum></citerefentry>, 136 <citerefentry><refentrytitle>drmModeGetConnector</refentrytitle><manvolnum>3</manvolnum></citerefentry> 137 </para> 138 </refsect1> 139</refentry> 140