drm: Request for help about drm_mode_getresources( ) returns empty modes message

He YunLei heyunlei at huawei.com
Fri Feb 6 02:10:59 PST 2015


hi all,
     when I run modetest process in libdrm to test our drm module, I find a strange problem:
     The test successfully opened /dev/dri/card0 (major:226 minor:0) device by using module name.
but the returned message about crtc, encoder and connector are all empty. I confirm the num of them
is one when our drm device driver register in kernel. So I track the kernel and find here:

     drivers/gpu/drm/drm_crtc.c

     1806         if (!drm_is_primary_client(file_priv)) {
     1807
     1808                 mode_group = NULL;
     1809                 list_for_each(lh, &dev->mode_config.crtc_list)
     1810                         crtc_count++;
     1811
     1812                 list_for_each(lh, &dev->mode_config.connector_list)
     1813                         connector_count++;
     1814
     1815                 list_for_each(lh, &dev->mode_config.encoder_list)
     1816                         encoder_count++;
     1817         } else {
     1818
     1819                 mode_group = &file_priv->master->minor->mode_group;
     1820                 crtc_count = mode_group->num_crtcs;
     1821                 connector_count = mode_group->num_connectors;
     1822                 encoder_count = mode_group->num_encoders;
     1823         }

     The device we opened with type of DRM_MINOR_LEGACY, so here come into else branch. The description
of drm_mode_group is that struct drm_mode_group - group of mode setting resources for potential sub-grouping,
and  the note in drm_crtc.h also said :

      943  * Currently this simply tracks the global mode setting state.  But in the
      944  * future it could allow groups of objects to be set aside into independent
      945  * control groups for use by different user level processes (e.g. two X servers
      946  * running simultaneously on different heads, each with their own mode
      947  * configuration and freedom of mode setting).

     I doubt the empty result has some relations with it, so I continue to track the kernel in function
drm_open, and I find mode_group lies in drm_minor, whick can be found by inode in function drm_open.
But when we create a crtc, encoder or connector, we do nothing to mode_group, just initializing it
when  drm_core register. Can you help me and give me some advice?

regards,
Yunlei He





More information about the dri-devel mailing list