static DisplayModePtr imxOutputGetModes(xf86OutputPtr output) { /* Access the associated screen info. */ ScrnInfoPtr pScrn = output->scrn; /* Access driver private screen data */ ImxPtr imxPtr = IMXPTR(pScrn); /* Access driver private screen display data */ ImxDisplayPtr fPtr = IMXDISPLAYPTR(imxPtr); /* Access the built in frame buffer mode. */ DisplayModePtr modesList = imxDisplayGetBuiltinMode(pScrn); /* Try to read the monitor EDID info. */ xf86MonPtr pMonitor = imxDisplayGetEdid( pScrn, imxPtr->fbId, fPtr->edidDataBytes, sizeof(fPtr->edidDataBytes)); if (NULL != pMonitor) { xf86OutputSetEDID(output, pMonitor); } /* Access all the modes support by frame buffer driver. */ modesList = xf86ModesAdd(modesList, xf86OutputGetEDIDModes(output)); return modesList; }
static DisplayModePtr output_get_modes(xf86OutputPtr output) { struct output_private *priv = output->driver_private; drmModeConnectorPtr drm_connector = priv->drm_connector; drmModeModeInfoPtr drm_mode = NULL; drmModePropertyPtr props = NULL; xf86MonPtr ddc_mon = NULL; DisplayModePtr modes = NULL, mode = NULL; int i; for (i = 0; i < drm_connector->count_props; i++) { props = drmModeGetProperty(priv->fd, drm_connector->props[i]); if (!props) continue; if (!(props->flags & DRM_MODE_PROP_BLOB)) goto out_free; if (!strcmp(props->name, "EDID")) { if (priv->edid_blob) drmModeFreePropertyBlob(priv->edid_blob); priv->edid_blob = drmModeGetPropertyBlob(priv->fd, drm_connector->prop_values[i]); } out_free: drmModeFreeProperty(props); } if (priv->edid_blob) { ddc_mon = xf86InterpretEDID(output->scrn->scrnIndex, priv->edid_blob->data); if (ddc_mon && priv->edid_blob->length > 128) ddc_mon->flags |= MONITOR_EDID_COMPLETE_RAWDATA; } xf86OutputSetEDID(output, ddc_mon); for (i = 0; i < drm_connector->count_modes; i++) { drm_mode = &drm_connector->modes[i]; if (drm_mode) { mode = calloc(1, sizeof(DisplayModeRec)); if (!mode) continue; mode->Clock = drm_mode->clock; mode->HDisplay = drm_mode->hdisplay; mode->HSyncStart = drm_mode->hsync_start; mode->HSyncEnd = drm_mode->hsync_end; mode->HTotal = drm_mode->htotal; mode->VDisplay = drm_mode->vdisplay; mode->VSyncStart = drm_mode->vsync_start; mode->VSyncEnd = drm_mode->vsync_end; mode->VTotal = drm_mode->vtotal; mode->Flags = drm_mode->flags; mode->HSkew = drm_mode->hskew; mode->VScan = drm_mode->vscan; mode->VRefresh = xf86ModeVRefresh(mode); mode->Private = (void *)drm_mode; mode->type = 0; if (drm_mode->type & DRM_MODE_TYPE_PREFERRED) mode->type |= M_T_PREFERRED; if (drm_mode->type & DRM_MODE_TYPE_DRIVER) mode->type |= M_T_DRIVER; xf86SetModeDefaultName(mode); modes = xf86ModesAdd(modes, mode); xf86PrintModeline(0, mode); } } return modes; }
static DisplayModePtr drmmode_output_get_modes(xf86OutputPtr output) { drmmode_output_private_ptr drmmode_output = output->driver_private; drmModeConnectorPtr koutput = drmmode_output->mode_output; drmmode_ptr drmmode = drmmode_output->drmmode; int i; DisplayModePtr Modes = NULL, Mode; drmModePropertyPtr props; struct fixed_panel_lvds *p_lvds; drmModeModeInfo *mode_ptr; /* look for an EDID property */ for (i = 0; i < koutput->count_props; i++) { props = drmModeGetProperty(drmmode->fd, koutput->props[i]); if (!props) continue; if (!(props->flags & DRM_MODE_PROP_BLOB)) { drmModeFreeProperty(props); continue; } if (!strcmp(props->name, "EDID")) { drmModeFreePropertyBlob(drmmode_output->edid_blob); drmmode_output->edid_blob = drmModeGetPropertyBlob(drmmode->fd, koutput->prop_values[i]); } drmModeFreeProperty(props); } if (drmmode_output->edid_blob) xf86OutputSetEDID(output, xf86InterpretEDID(output->scrn->scrnIndex, drmmode_output->edid_blob->data)); else xf86OutputSetEDID(output, xf86InterpretEDID(output->scrn->scrnIndex, NULL)); /* modes should already be available */ for (i = 0; i < koutput->count_modes; i++) { Mode = xnfalloc(sizeof(DisplayModeRec)); drmmode_ConvertFromKMode(output->scrn, &koutput->modes[i], Mode); Modes = xf86ModesAdd(Modes, Mode); } p_lvds = drmmode_output->private_data; /* * If the connector type is LVDS, we will traverse the kernel mode to * get the panel limit. * If it is incorrect, please fix me. */ if ((koutput->connector_type == DRM_MODE_CONNECTOR_LVDS) && p_lvds) { p_lvds->hdisplay = 0; p_lvds->vdisplay = 0; for (i = 0; i < koutput->count_modes; i++) { mode_ptr = &koutput->modes[i]; if ((mode_ptr->hdisplay >= p_lvds->hdisplay) && (mode_ptr->vdisplay >= p_lvds->vdisplay)) { p_lvds->hdisplay = mode_ptr->hdisplay; p_lvds->vdisplay = mode_ptr->vdisplay; } } if (!p_lvds->hdisplay || !p_lvds->vdisplay) xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "Incorrect KMS mode.\n"); drmmode_output_lvds_edid(output, p_lvds); } return Modes; }