1d722e3fbSopenharmony_ci===================
2d722e3fbSopenharmony_cidrmModeGetResources
3d722e3fbSopenharmony_ci===================
4d722e3fbSopenharmony_ci
5d722e3fbSopenharmony_ci--------------------------------------------------
6d722e3fbSopenharmony_ciretrieve current display configuration information
7d722e3fbSopenharmony_ci--------------------------------------------------
8d722e3fbSopenharmony_ci
9d722e3fbSopenharmony_ci:Date: September 2012
10d722e3fbSopenharmony_ci:Manual section: 3
11d722e3fbSopenharmony_ci:Manual group: Direct Rendering Manager
12d722e3fbSopenharmony_ci
13d722e3fbSopenharmony_ciSynopsis
14d722e3fbSopenharmony_ci========
15d722e3fbSopenharmony_ci
16d722e3fbSopenharmony_ci``#include <xf86drm.h>``
17d722e3fbSopenharmony_ci
18d722e3fbSopenharmony_ci``#include <xf86drmMode.h>``
19d722e3fbSopenharmony_ci
20d722e3fbSopenharmony_ci``drmModeResPtr drmModeGetResources(int fd);``
21d722e3fbSopenharmony_ci
22d722e3fbSopenharmony_ciDescription
23d722e3fbSopenharmony_ci===========
24d722e3fbSopenharmony_ci
25d722e3fbSopenharmony_ci``drmModeGetResources`` allocates, populates, and returns a drmModeRes
26d722e3fbSopenharmony_cistructure containing information about the current display
27d722e3fbSopenharmony_ciconfiguration. The structure contains the following fields:
28d722e3fbSopenharmony_ci
29d722e3fbSopenharmony_ci::
30d722e3fbSopenharmony_ci
31d722e3fbSopenharmony_ci   typedef struct _drmModeRes {
32d722e3fbSopenharmony_ci       int count_fbs;
33d722e3fbSopenharmony_ci       uint32_t *fbs;
34d722e3fbSopenharmony_ci
35d722e3fbSopenharmony_ci       int count_crtcs;
36d722e3fbSopenharmony_ci       uint32_t *crtcs;
37d722e3fbSopenharmony_ci
38d722e3fbSopenharmony_ci       int count_connectors;
39d722e3fbSopenharmony_ci       uint32_t *connectors;
40d722e3fbSopenharmony_ci
41d722e3fbSopenharmony_ci       int count_encoders;
42d722e3fbSopenharmony_ci       uint32_t *encoders;
43d722e3fbSopenharmony_ci
44d722e3fbSopenharmony_ci       uint32_t min_width, max_width;
45d722e3fbSopenharmony_ci       uint32_t min_height, max_height;
46d722e3fbSopenharmony_ci   } drmModeRes, *drmModeResPtr;
47d722e3fbSopenharmony_ci
48d722e3fbSopenharmony_ciThe *count_fbs* and *fbs* fields indicate the number of currently allocated
49d722e3fbSopenharmony_ciframebuffer objects (i.e., objects that can be attached to a given CRTC
50d722e3fbSopenharmony_cior sprite for display).
51d722e3fbSopenharmony_ci
52d722e3fbSopenharmony_ciThe *count_crtcs* and *crtcs* fields list the available CRTCs in the
53d722e3fbSopenharmony_ciconfiguration. A CRTC is simply an object that can scan out a
54d722e3fbSopenharmony_ciframebuffer to a display sink, and contains mode timing and relative
55d722e3fbSopenharmony_ciposition information. CRTCs drive encoders, which are responsible for
56d722e3fbSopenharmony_ciconverting the pixel stream into a specific display protocol (e.g., MIPI
57d722e3fbSopenharmony_cior HDMI).
58d722e3fbSopenharmony_ci
59d722e3fbSopenharmony_ciThe *count_connectors* and *connectors* fields list the available physical
60d722e3fbSopenharmony_ciconnectors on the system. Note that some of these may not be exposed
61d722e3fbSopenharmony_cifrom the chassis (e.g., LVDS or eDP). Connectors are attached to
62d722e3fbSopenharmony_ciencoders and contain information about the attached display sink (e.g.,
63d722e3fbSopenharmony_ciwidth and height in mm, subpixel ordering, and various other
64d722e3fbSopenharmony_ciproperties).
65d722e3fbSopenharmony_ci
66d722e3fbSopenharmony_ciThe *count_encoders* and *encoders* fields list the available encoders on
67d722e3fbSopenharmony_cithe device. Each encoder may be associated with a CRTC, and may be used
68d722e3fbSopenharmony_cito drive a particular encoder.
69d722e3fbSopenharmony_ci
70d722e3fbSopenharmony_ciThe *min_\** and *max_\** fields indicate the maximum size of a framebuffer
71d722e3fbSopenharmony_cifor this device (i.e., the scanout size limit).
72d722e3fbSopenharmony_ci
73d722e3fbSopenharmony_ciReturn Value
74d722e3fbSopenharmony_ci============
75d722e3fbSopenharmony_ci
76d722e3fbSopenharmony_ci``drmModeGetResources`` returns a drmModeRes structure pointer on
77d722e3fbSopenharmony_cisuccess, NULL on failure. The returned structure must be freed with
78d722e3fbSopenharmony_ci**drmModeFreeResources**\ (3).
79d722e3fbSopenharmony_ci
80d722e3fbSopenharmony_ciReporting Bugs
81d722e3fbSopenharmony_ci==============
82d722e3fbSopenharmony_ci
83d722e3fbSopenharmony_ciBugs in this function should be reported to
84d722e3fbSopenharmony_cihttps://gitlab.freedesktop.org/mesa/drm/-/issues
85d722e3fbSopenharmony_ci
86d722e3fbSopenharmony_ciSee Also
87d722e3fbSopenharmony_ci========
88d722e3fbSopenharmony_ci
89d722e3fbSopenharmony_ci**drm**\ (7), **drm-kms**\ (7), **drmModeGetFB**\ (3), **drmModeAddFB**\ (3),
90d722e3fbSopenharmony_ci**drmModeAddFB2**\ (3), **drmModeRmFB**\ (3), **drmModeDirtyFB**\ (3),
91d722e3fbSopenharmony_ci**drmModeGetCrtc**\ (3), **drmModeSetCrtc** (3), **drmModeGetEncoder** (3),
92d722e3fbSopenharmony_ci**drmModeGetConnector**\ (3)
93