Re: Screen flickering on ThinkPad X270

2020-11-18 Thread Sine Astris


On 18/11/2020 07:05, Jonathan Gray wrote:
> On Wed, Nov 18, 2020 at 01:51:39AM +, Sine Astris wrote:
>> Hi,
>>
>> I was suffering from a subtle (yet annoying once noticed) problem with
>> screen flickering whilst using xenocara on my ThinkPad X270.
>>
>> It was only distinctly apparent with certain colours/images being
>> displayed, generally a darker (but not black) static background with
>> small bright regions changing. For example I could see a subtle
>> flicker/brightening of the entire background on each character typed in
>> an xterm. It also occasionally manifested (apparently randomly) as a
>> subtle flicker which looked like a quick change of brightness.
>>
>> After excluding any possible xorg.conf device options, a bit of googling
>> turned up some people experiencing a similar issue on windows and linux,
>> and they pointed to a feature of newer Intel GPUs called "PSR" / "Panel
>> Self Refresh". These issues were resolved via the settings application
>> on windows, and on linux machines by setting a linux kernel parameter:
>> i915.enable_psr=0
>>
>> OpenBSD doesn't appear to expose a mechanism for setting i915
>> parameters, so I changed the value from use hardware default to
>> disabled within: sys/dev/pci/drm/i915/i915_params.h.
>>
>> This resolved the problem completely (which is a great relief, as it's
>> frequently apparent once you've noticed it), and doesn't appear to have
>> resulted in any other issues.
>>
>> Below are a diff to i915_params.h, my xorg.conf, and dmesg. When I get
>> time I may see if I'm able to make the required changes to expose this 
>> as a flag.
> 
> Why have you opted into the intel xorg driver instead of using
> the modesetting driver which should be the default for this hardware?

I experience significant screen tearing on the modesetting driver, using the 
intel xorg driver with the "TearFree" option is the best solution I've found 
so far.

> Do you see the same behaviour with the modesetting driver?

Yes, the flickering behaviour is indentical with both the intel xorg driver 
and the modesetting driver. I've included my Xorg.0.log when using the 
modesetting driver at the bottom of the mail in case it's useful.

> 
> The params aren't something we'd make controllable from userspace.
> Ideally the problem with PSR would be tracked down so people do not have
> to change anything.

Ah righto, fixing the problem in PSR would be ideal, barring finding a 
solution within PSR, would adding some form of quirk be sensible?

I'm not sure what the actual power savings of PSR are, if mostly 
insignificant I might be tempted to just disable it by default.

> 
>>
>>
>> --- /usr/src/sys/dev/pci/drm/i915/i915_params.h  Tue Nov 17 09:50:23 2020
>> +++ /usr/src/sys/dev/pci/drm/i915/i915_params.h.new Tue Nov 17 09:30:24 2020
>> @@ -52,7 +52,7 @@
>>  param(int, vbt_sdvo_panel_type, -1, 0400) \
>>  param(int, enable_dc, -1, 0400) \
>>  param(int, enable_fbc, -1, 0600) \
>> -param(int, enable_psr, -1, 0600) \
>> +param(int, enable_psr, 0, 0600) \
>>  param(int, disable_power_well, -1, 0400) \
>>  param(int, enable_ips, 1, 0600) \
>>  param(int, invert_brightness, 0, 0600) \
>>
>>
>> [61.711] (WW) checkDevMem: failed to open /dev/xf86 and /dev/mem
>>  (Operation not permitted)
>>  Check that you have set 'machdep.allowaperture=1'
>>  in /etc/sysctl.conf and reboot your machine
>>  refer to xf86(4) for details
>> [61.711] linear framebuffer access unavailable
>> [61.732] (--) Using wscons driver on /dev/ttyC4
>> [61.739] 
>> X.Org X Server 1.20.8
>> X Protocol Version 11, Revision 0
>> [61.739] Build Operating System: OpenBSD 6.8 amd64 
>> [61.739] Current Operating System: OpenBSD heliospan.home 6.8 
>> GENERIC.MP#1 amd64
>> [61.739] Build Date: 17 November 2020  08:48:50PM
>> [61.739]  
>> [61.739] Current version of pixman: 0.38.4
>> [61.739] Before reporting problems, check http://wiki.x.org
>>  to make sure that you have the latest version.
>> [61.739] Markers: (--) probed, (**) from config file, (==) default 
>> setting,
>>  (++) from command line, (!!) notice, (II) informational,
>>  (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
>> [61.739] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Nov 17 22:33:05 
>> 2020
>> [61.741] (==) Using config directory: "/etc/X11/xorg.conf.d"
>> [61.741] (==) Using system config directory 
>> "/usr/X11R6/share/X11/xorg.conf.d"
>> [61.743] (==) No Layout section.  Using the first Screen section.
>> [61.743] (==) No screen section available. Using defaults.
>> [61.743] (**) |-->Screen "Default Screen Section" (0)
>> [61.743] (**) |   |-->Monitor ""
>> [61.744] (==) No device specified for screen "Default Screen Section".
>>  Using the first device section listed.
>> [61.744] (**) |   |-->Device "drm"
>> [61.744] (==) No monitor specified for screen "Default S

Re: Screen flickering on ThinkPad X270

2020-11-17 Thread Jonathan Gray
On Wed, Nov 18, 2020 at 01:51:39AM +, Sine Astris wrote:
> Hi,
> 
> I was suffering from a subtle (yet annoying once noticed) problem with
> screen flickering whilst using xenocara on my ThinkPad X270.
> 
> It was only distinctly apparent with certain colours/images being
> displayed, generally a darker (but not black) static background with
> small bright regions changing. For example I could see a subtle
> flicker/brightening of the entire background on each character typed in
> an xterm. It also occasionally manifested (apparently randomly) as a
> subtle flicker which looked like a quick change of brightness.
> 
> After excluding any possible xorg.conf device options, a bit of googling
> turned up some people experiencing a similar issue on windows and linux,
> and they pointed to a feature of newer Intel GPUs called "PSR" / "Panel
> Self Refresh". These issues were resolved via the settings application
> on windows, and on linux machines by setting a linux kernel parameter:
> i915.enable_psr=0
> 
> OpenBSD doesn't appear to expose a mechanism for setting i915
> parameters, so I changed the value from use hardware default to
> disabled within: sys/dev/pci/drm/i915/i915_params.h.
> 
> This resolved the problem completely (which is a great relief, as it's
> frequently apparent once you've noticed it), and doesn't appear to have
> resulted in any other issues.
> 
> Below are a diff to i915_params.h, my xorg.conf, and dmesg. When I get
> time I may see if I'm able to make the required changes to expose this 
> as a flag.

Why have you opted into the intel xorg driver instead of using
the modesetting driver which should be the default for this hardware?
Do you see the same behaviour with the modesetting driver?

The params aren't something we'd make controllable from userspace.
Ideally the problem with PSR would be tracked down so people do not have
to change anything.

> 
> 
> --- /usr/src/sys/dev/pci/drm/i915/i915_params.h   Tue Nov 17 09:50:23 2020
> +++ /usr/src/sys/dev/pci/drm/i915/i915_params.h.new Tue Nov 17 09:30:24 2020
> @@ -52,7 +52,7 @@
>   param(int, vbt_sdvo_panel_type, -1, 0400) \
>   param(int, enable_dc, -1, 0400) \
>   param(int, enable_fbc, -1, 0600) \
> - param(int, enable_psr, -1, 0600) \
> + param(int, enable_psr, 0, 0600) \
>   param(int, disable_power_well, -1, 0400) \
>   param(int, enable_ips, 1, 0600) \
>   param(int, invert_brightness, 0, 0600) \
> 
> 
> [61.711] (WW) checkDevMem: failed to open /dev/xf86 and /dev/mem
>   (Operation not permitted)
>   Check that you have set 'machdep.allowaperture=1'
>   in /etc/sysctl.conf and reboot your machine
>   refer to xf86(4) for details
> [61.711]  linear framebuffer access unavailable
> [61.732] (--) Using wscons driver on /dev/ttyC4
> [61.739] 
> X.Org X Server 1.20.8
> X Protocol Version 11, Revision 0
> [61.739] Build Operating System: OpenBSD 6.8 amd64 
> [61.739] Current Operating System: OpenBSD heliospan.home 6.8 
> GENERIC.MP#1 amd64
> [61.739] Build Date: 17 November 2020  08:48:50PM
> [61.739]  
> [61.739] Current version of pixman: 0.38.4
> [61.739]  Before reporting problems, check http://wiki.x.org
>   to make sure that you have the latest version.
> [61.739] Markers: (--) probed, (**) from config file, (==) default 
> setting,
>   (++) from command line, (!!) notice, (II) informational,
>   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
> [61.739] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Nov 17 22:33:05 
> 2020
> [61.741] (==) Using config directory: "/etc/X11/xorg.conf.d"
> [61.741] (==) Using system config directory 
> "/usr/X11R6/share/X11/xorg.conf.d"
> [61.743] (==) No Layout section.  Using the first Screen section.
> [61.743] (==) No screen section available. Using defaults.
> [61.743] (**) |-->Screen "Default Screen Section" (0)
> [61.743] (**) |   |-->Monitor ""
> [61.744] (==) No device specified for screen "Default Screen Section".
>   Using the first device section listed.
> [61.744] (**) |   |-->Device "drm"
> [61.744] (==) No monitor specified for screen "Default Screen Section".
>   Using a default monitor configuration.
> [61.744] (==) Automatically adding devices
> [61.744] (==) Automatically enabling devices
> [61.744] (==) Not automatically adding GPU devices
> [61.745] (==) Max clients allowed: 256, resource mask: 0x1f
> [61.751] (==) FontPath set to:
>   /usr/X11R6/lib/X11/fonts/misc/,
>   /usr/X11R6/lib/X11/fonts/TTF/,
>   /usr/X11R6/lib/X11/fonts/OTF/,
>   /usr/X11R6/lib/X11/fonts/Type1/,
>   /usr/X11R6/lib/X11/fonts/100dpi/,
>   /usr/X11R6/lib/X11/fonts/75dpi/
> [61.751] (==) ModulePath set to "/usr/X11R6/lib/modules"
> [61.751] (II) The server relies on wscons to provide the list of input 
> devices.
>   If no devices become available, reconfigure wscons or dis

Screen flickering on ThinkPad X270

2020-11-17 Thread Sine Astris
Hi,

I was suffering from a subtle (yet annoying once noticed) problem with
screen flickering whilst using xenocara on my ThinkPad X270.

It was only distinctly apparent with certain colours/images being
displayed, generally a darker (but not black) static background with
small bright regions changing. For example I could see a subtle
flicker/brightening of the entire background on each character typed in
an xterm. It also occasionally manifested (apparently randomly) as a
subtle flicker which looked like a quick change of brightness.

After excluding any possible xorg.conf device options, a bit of googling
turned up some people experiencing a similar issue on windows and linux,
and they pointed to a feature of newer Intel GPUs called "PSR" / "Panel
Self Refresh". These issues were resolved via the settings application
on windows, and on linux machines by setting a linux kernel parameter:
i915.enable_psr=0

OpenBSD doesn't appear to expose a mechanism for setting i915
parameters, so I changed the value from use hardware default to
disabled within: sys/dev/pci/drm/i915/i915_params.h.

This resolved the problem completely (which is a great relief, as it's
frequently apparent once you've noticed it), and doesn't appear to have
resulted in any other issues.

Below are a diff to i915_params.h, my xorg.conf, and dmesg. When I get
time I may see if I'm able to make the required changes to expose this 
as a flag.


--- /usr/src/sys/dev/pci/drm/i915/i915_params.h Tue Nov 17 09:50:23 2020
+++ /usr/src/sys/dev/pci/drm/i915/i915_params.h.new Tue Nov 17 09:30:24 2020
@@ -52,7 +52,7 @@
param(int, vbt_sdvo_panel_type, -1, 0400) \
param(int, enable_dc, -1, 0400) \
param(int, enable_fbc, -1, 0600) \
-   param(int, enable_psr, -1, 0600) \
+   param(int, enable_psr, 0, 0600) \
param(int, disable_power_well, -1, 0400) \
param(int, enable_ips, 1, 0600) \
param(int, invert_brightness, 0, 0600) \


[61.711] (WW) checkDevMem: failed to open /dev/xf86 and /dev/mem
(Operation not permitted)
Check that you have set 'machdep.allowaperture=1'
in /etc/sysctl.conf and reboot your machine
refer to xf86(4) for details
[61.711]linear framebuffer access unavailable
[61.732] (--) Using wscons driver on /dev/ttyC4
[61.739] 
X.Org X Server 1.20.8
X Protocol Version 11, Revision 0
[61.739] Build Operating System: OpenBSD 6.8 amd64 
[61.739] Current Operating System: OpenBSD heliospan.home 6.8 GENERIC.MP#1 
amd64
[61.739] Build Date: 17 November 2020  08:48:50PM
[61.739]  
[61.739] Current version of pixman: 0.38.4
[61.739]Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
[61.739] Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[61.739] (==) Log file: "/var/log/Xorg.0.log", Time: Tue Nov 17 22:33:05 
2020
[61.741] (==) Using config directory: "/etc/X11/xorg.conf.d"
[61.741] (==) Using system config directory 
"/usr/X11R6/share/X11/xorg.conf.d"
[61.743] (==) No Layout section.  Using the first Screen section.
[61.743] (==) No screen section available. Using defaults.
[61.743] (**) |-->Screen "Default Screen Section" (0)
[61.743] (**) |   |-->Monitor ""
[61.744] (==) No device specified for screen "Default Screen Section".
Using the first device section listed.
[61.744] (**) |   |-->Device "drm"
[61.744] (==) No monitor specified for screen "Default Screen Section".
Using a default monitor configuration.
[61.744] (==) Automatically adding devices
[61.744] (==) Automatically enabling devices
[61.744] (==) Not automatically adding GPU devices
[61.745] (==) Max clients allowed: 256, resource mask: 0x1f
[61.751] (==) FontPath set to:
/usr/X11R6/lib/X11/fonts/misc/,
/usr/X11R6/lib/X11/fonts/TTF/,
/usr/X11R6/lib/X11/fonts/OTF/,
/usr/X11R6/lib/X11/fonts/Type1/,
/usr/X11R6/lib/X11/fonts/100dpi/,
/usr/X11R6/lib/X11/fonts/75dpi/
[61.751] (==) ModulePath set to "/usr/X11R6/lib/modules"
[61.751] (II) The server relies on wscons to provide the list of input 
devices.
If no devices become available, reconfigure wscons or disable 
AutoAddDevices.
[61.751] (II) Loader magic: 0xaea07e33460
[61.751] (II) Module ABI versions:
[61.751]X.Org ANSI C Emulation: 0.4
[61.751]X.Org Video Driver: 24.1
[61.751]X.Org XInput driver : 24.1
[61.751]X.Org Server Extension : 10.0
[61.751] (--) PCI:*(0@0:2:0) 8086:5916:17aa:5062 rev 2, Mem @ 
0xe000/16777216, 0xc000/536870912, I/O @ 0xe000/64
[61.751] (II) LoadModule: "glx"
[61.754] (II) Loading /usr/X11R6/lib/modules/extensions/libglx.so
[61.767] (II) Module glx: vendor="X.Org Fo