diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-10-30 15:53:06 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-10-30 16:15:47 +0000 |
commit | d78200e53e6e5b889a71f79c103aa4e1ba148c95 (patch) | |
tree | 2f2a5df1f7529ee4eecf0ae5630e7da4ccab9892 /src/sna/sna_display.c | |
parent | 0196fa2da8140853e9542bf41b63cbd345e857be (diff) |
sna: Always refresh the blob property before reading
Ensure that the property value for the EDID is current before
retreiving the blob.
Reported-by: Rui Tiago Matos <tiagomatos@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92728
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_display.c')
-rw-r--r-- | src/sna/sna_display.c | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 5cacedcd..7d06450e 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -3113,6 +3113,29 @@ find_property(struct sna *sna, struct sna_output *output, const char *name) return -1; } +static void update_properties(struct sna *sna, struct sna_output *output) +{ + union compat_mode_get_connector compat_conn; + struct drm_mode_modeinfo dummy; + + VG_CLEAR(compat_conn); + + compat_conn.conn.connector_id = output->id; + compat_conn.conn.count_props = output->num_props; + compat_conn.conn.props_ptr = (uintptr_t)output->prop_ids; + compat_conn.conn.prop_values_ptr = (uintptr_t)output->prop_values; + compat_conn.conn.count_modes = 1; /* skip detect */ + compat_conn.conn.modes_ptr = (uintptr_t)&dummy; + compat_conn.conn.count_encoders = 0; + + (void)drmIoctl(sna->kgem.fd, + DRM_IOCTL_MODE_GETCONNECTOR, + &compat_conn.conn); + + assert(compat_conn.conn.count_props == output->num_props); + output->update_properties = false; +} + static xf86OutputStatus sna_output_detect(xf86OutputPtr output) { @@ -3240,6 +3263,13 @@ sna_output_attach_edid(xf86OutputPtr output) if (sna_output->edid_idx == -1) return; + /* Always refresh the blob as the kernel may randomly update the + * id even if the contents of the blob doesn't change, and a + * request for the stale id will return nothing. + */ + if (sna_output->update_properties) + update_properties(sna, sna_output); + raw = sna_output->edid_raw; blob.length = sna_output->edid_len; @@ -3352,6 +3382,9 @@ sna_output_attach_tile(xf86OutputPtr output) if (id == -1) goto out; + if (sna_output->update_properties) + update_properties(sna, sna_output); + VG_CLEAR(blob); blob.blob_id = sna_output->prop_values[id]; blob.length = 0; @@ -3962,29 +3995,6 @@ sna_output_set_property(xf86OutputPtr output, Atom property, return TRUE; } -static void update_properties(struct sna *sna, struct sna_output *output) -{ - union compat_mode_get_connector compat_conn; - struct drm_mode_modeinfo dummy; - - VG_CLEAR(compat_conn); - - compat_conn.conn.connector_id = output->id; - compat_conn.conn.count_props = output->num_props; - compat_conn.conn.props_ptr = (uintptr_t)output->prop_ids; - compat_conn.conn.prop_values_ptr = (uintptr_t)output->prop_values; - compat_conn.conn.count_modes = 1; /* skip detect */ - compat_conn.conn.modes_ptr = (uintptr_t)&dummy; - compat_conn.conn.count_encoders = 0; - - (void)drmIoctl(sna->kgem.fd, - DRM_IOCTL_MODE_GETCONNECTOR, - &compat_conn.conn); - - assert(compat_conn.conn.count_props == output->num_props); - output->update_properties = false; -} - static Bool sna_output_get_property(xf86OutputPtr output, Atom property) { |