summaryrefslogtreecommitdiff
path: root/src/intel_display.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-08-04 09:57:12 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-08-04 10:05:09 +0100
commit622e600069ab0efd22586c7a71eecbd4baf21c40 (patch)
tree753c082a085a2b9959ce215a342873e7504080fc /src/intel_display.c
parenta6a707ca13097b85b319283b3a174b1986056ab8 (diff)
display: Cache whether we have probed for an EDID
Remember for the detection cycle whether we have already probed for the EDID -- as this can be slow. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/intel_display.c')
-rw-r--r--src/intel_display.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/intel_display.c b/src/intel_display.c
index 15399768..061d2223 100644
--- a/src/intel_display.c
+++ b/src/intel_display.c
@@ -82,6 +82,7 @@ struct intel_output {
int output_id;
drmModeConnectorPtr mode_output;
drmModeEncoderPtr mode_encoder;
+ Bool have_edid;
drmModePropertyBlobPtr edid_blob;
int num_props;
struct intel_property *props;
@@ -676,6 +677,8 @@ intel_output_detect(xf86OutputPtr output)
struct intel_mode *mode = intel_output->mode;
xf86OutputStatus status;
+ intel_output->have_edid = FALSE;
+
drmModeFreeConnector(intel_output->mode_output);
intel_output->mode_output =
drmModeGetConnector(mode->fd, intel_output->output_id);
@@ -767,40 +770,41 @@ intel_output_get_modes(xf86OutputPtr output)
struct intel_output *intel_output = output->driver_private;
drmModeConnectorPtr koutput = intel_output->mode_output;
struct intel_mode *mode = intel_output->mode;
- int i;
DisplayModePtr Modes = NULL, Mode;
- drmModePropertyPtr props;
drmModeModeInfo *mode_ptr;
+ int i;
- /* look for an EDID property */
- for (i = 0; i < koutput->count_props; i++) {
- props = drmModeGetProperty(mode->fd, koutput->props[i]);
- if (!props)
- continue;
+ if (!intel_output->have_edid) {
+ /* look for an EDID property */
+ for (i = 0; i < koutput->count_props; i++) {
+ drmModePropertyPtr props;
+
+ props = drmModeGetProperty(mode->fd, koutput->props[i]);
+ if (!props)
+ continue;
+
+ if ((props->flags & DRM_MODE_PROP_BLOB) &&
+ strcmp(props->name, "EDID") == 0) {
+ drmModeFreePropertyBlob(intel_output->edid_blob);
+ intel_output->edid_blob =
+ drmModeGetPropertyBlob(mode->fd,
+ koutput->prop_values[i]);
+ }
- if (!(props->flags & DRM_MODE_PROP_BLOB)) {
drmModeFreeProperty(props);
- continue;
}
- if (!strcmp(props->name, "EDID")) {
- drmModeFreePropertyBlob(intel_output->edid_blob);
- intel_output->edid_blob =
- drmModeGetPropertyBlob(mode->fd,
- koutput->prop_values[i]);
- }
- drmModeFreeProperty(props);
+ if (intel_output->edid_blob)
+ xf86OutputSetEDID(output,
+ xf86InterpretEDID(output->scrn->scrnIndex,
+ intel_output->edid_blob->data));
+ else
+ xf86OutputSetEDID(output,
+ xf86InterpretEDID(output->scrn->scrnIndex,
+ NULL));
+ intel_output->have_edid = TRUE;
}
- if (intel_output->edid_blob)
- xf86OutputSetEDID(output,
- xf86InterpretEDID(output->scrn->scrnIndex,
- intel_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));