# setResolution doesn't work properly on Ubuntu 22.04

**URL:** <https://psychtoolbox.discourse.group/t/setresolution-doesnt-work-properly-on-ubuntu-22-04/4574>\
**Category:** Programming Help\
**Tags:** linux\
**Created:** [August 18, 2022, 2:51pm UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-work-properly-on-ubuntu-22-04/4574 "2022-08-18T14:51:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksgfan](https://avatars.discourse-cdn.com/v4/letter/k/ce7236/32.png) [@ksgfan](https://psychtoolbox.discourse.group/u/ksgfan)\
**Post date:** [August 18, 2022, 2:51pm UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-work-properly-on-ubuntu-22-04/4574/1 "2022-08-18T14:51:51Z")

</div>

I am on Ubuntu 22.04 and running Psychtoolbox 3.0.18.

For my experiment I am using 2 Displays, which were organized using `XOrgConfCreator`. In computer settings I set the refresh rate of the display to 100Hz. To be sure that the refresh rate is in fact 100 Hz, I also set it in Psychtoolbox using `setResolution(1, 1920, 1080, 100)`. However, it doesn’t work, when I run the code for the first time after starting computer. `hz = Screen('FrameRate', 1, 1)` returns 60 Hz. What is confusing, is that it will work at some point, if I run `setResolution` many times without rebooting my computer.

Do you know, how to fix this issue?

---

<div class="post-metadata">

**Author:** ![lattice](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/lattice/32/381_2.png) [@lattice](https://psychtoolbox.discourse.group/u/lattice)\
**Post date:** [August 19, 2022, 10:44am UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-work-properly-on-ubuntu-22-04/4574/2 "2022-08-19T10:44:47Z")

</div>

I’m having the same problem.

Before `XOrgConfCreator`, the frame rate can be set to 144 Hz in the Ubuntu display settings.  
After `XOrgCongCreator` and `XOrgConfSelector`, frame rate of the motnitor is set as 60Hz, `hz = Screen('FrameRate', 1, 1)`  
I tried to change it by mode = 2 option as `Screen('FrameRate', 1, 2, 144) `, but it failed.  
Is it possible to change the frame rate when the display setting was configured by XOrgConfCreator?

Ubuntu 20.04.4LTS  
MATLAB 2020b  
PTB 3.0.17

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [August 21, 2022, 10:45pm UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-work-properly-on-ubuntu-22-04/4574/3 "2022-08-21T22:45:32Z")

</div>

@ksgfan Quick testing of PTB 3.0.18.12 on AMD + Ubuntu 22.04 and Intel + Ubuntu 20.04 with `SetResolution() + Screen('Framerate')` showed no obvious problem under the standard Ubuntu desktop, also not immediately after a reboot. The graphical display settings GUI’s usually only allow setup of X-Screen 0 and ignores additional X-Screens, but SetResolution seems to work fine.

@lattice Use `SetResolution` for X-Screen’s with a single display attached. Use `Screen('ConfigureDisplays', 'Scanout', ...)` for multiple displays on a single X-Screen, e.g., dual-display stereo setups. PTB 3.0.17 is end-of-life btw.

For further investigation or advice before end of August, please post your paid support authentication token (`help PsychPaidSupportAndServices`) for up to 30 minutes of work with the new memberships or up to 60 minutes with the old ones. If your labs don’t have a support membership yet, support can’t be provided before sometime late September, as the person responsible for license activation is on vacation until early September, and I will be on vacation starting early September.

-mario

---

<div class="post-metadata">

**Author:** ![lattice](https://yyz2.discourse-cdn.com/free1/user_avatar/psychtoolbox.discourse.group/lattice/32/381_2.png) [@lattice](https://psychtoolbox.discourse.group/u/lattice)\
**Post date:** [August 22, 2022, 1:09am UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-work-properly-on-ubuntu-22-04/4574/4 "2022-08-22T01:09:14Z")

</div>

@mariokleiner Thank you for your quick reply! Now I can change the ‘FrameRate’ of the second display (for stimulus presentation) from 60 Hz to 144 Hz, using `Screen('ConfigureDisplay', 'Scanout', 1, 0, [], [], 144)`. And I update the PTB version to 3.0.18.

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [August 22, 2022, 2:06am UTC](https://psychtoolbox.discourse.group/t/setresolution-doesnt-work-properly-on-ubuntu-22-04/4574/5 "2022-08-22T02:06:19Z")

</div>

The best way to thank us and to help keep PTB alive is to buy a support membership. If your lab takes part in our user survey, you’d even get it with a small discount.

If your stimulus display is only a single display, `SetResolution(1, 1920, 1080, 144)`, e.g., for 1920x1080@144Hz is preferable for people who are forced to use lesser operating-systems occasionally, as that should work cross-platform on MS-Windows or macOS as well, whereas the more fine-grained ‘ConfigureDisplay’ method is Linux only.
