diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-02-18 13:51:13 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-02-18 13:51:13 +0000 |
commit | c4382c5e5b28a60261986b00bf0fcb8da4b78625 (patch) | |
tree | 7cad01c85e5d21d65867be468a5dc56247997330 /src | |
parent | aacc3442bb8c280a6ebc1fc1e34451613a72d7c4 (diff) |
sna: Check enable_psr module parameters
Despite protestations over the last 2 years, PSR was enabled by default
upstream with no way for userspace to detect the change in behaviour.
Have a look at the module parameter and take a guess.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_display.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 9215b232..f2fca7c1 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -7101,18 +7101,42 @@ bool sna_mode_wants_tear_free(struct sna *sna) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn); + bool found = false; + FILE *file; int i; for (i = 0; i < sna->mode.num_real_output; i++) { struct sna_output *output = to_sna_output(config->output[i]); int id = find_property(sna, output, "Panel Self-Refresh"); - if (id !=-1 && output->prop_values[id] != -1) { + if (id == -1) + continue; + + found = true; + if (output->prop_values[id] != -1) { DBG(("%s: Panel Self-Refresh detected on %s\n", __FUNCTION__, config->output[i]->name)); return true; } } + if (!found) { + file = fopen("/sys/module/i915/parameters/enable_psr", "r"); + if (file) { + int psr_enabled = 0; + int value; + + if (fscanf(file, "%d", &value) == 1) + psr_enabled = value > 0; + fclose(file); + + DBG(("%s: module parameter 'enable_psr' enabled? %d\n", + __FUNCTION__, psr_enabled)); + + if (psr_enabled) + return true; + } + } + return false; } |