# Display same image on 2 monitors

**URL:** <https://psychtoolbox.discourse.group/t/display-same-image-on-2-monitors/4631>\
**Category:** Programming Help\
**Tags:** linux\
**Created:** [September 29, 2022, 12:50pm UTC](https://psychtoolbox.discourse.group/t/display-same-image-on-2-monitors/4631 "2022-09-29T12:50:46Z")\
**Posts on this page:** 1\
**Showing post:** 11

<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:** [November 9, 2022, 3:00pm UTC](https://psychtoolbox.discourse.group/t/display-same-image-on-2-monitors/4631/11 "2022-11-09T15:00:23Z")

</div>

> [@Tarana](#):
>
> Hi Mario, Your descriptions were very helpful and useful in the above message!
> 
> I tried some of the things you suggested. I can now “in-principle” see a mirrored screen when I log on to the user. But can’t sync the two monitors (most likely caused by XOrg). The ViewPixx/EEG is set at 120Hz , but as soon as I logon to a user with XOrg settings , the second console monitor (only) turns to 60 Hz.  
> I checked that the monitor is certainly capable of 120 Hz - in fact when I logon the user using Wayland, I see 120 Hz. So I’m afraid Xorg on booting caps a 60Hz refresh rate on the 3rd display port.

Can you show me the output of `ResolutionTest(1)` in Matlab and/or `xrandr --screen 1` in a terminal? Actually maybe `xrandr --screen 1 --verbose > output.txt` and then the whole output.txt file? Also, what is the model of the gpu, e.g., the “PTB-INFO: OpenGL-Renderer is …” output line?

> [@](#):
>
> I tried the Screen(‘ConfigureDisplay’, ‘ScanMode’, 1,1, 1920,1080, 120) to change the refresh rate. It runs , but when I run Screen(‘ConfigureDisplay’, ‘ScanMode’, 1,1) again to check if the change actually happened, I see and error that this screen doesn’t exist.

→ It is ‘ScanOut’ not ‘ScanMode’, it can’t be a typo on your side, no? Should work just fine.

> [@](#):
>
> I can’t use xrandr because for some reason it doesn’t detect anything more than the Display Port-0. (Which is odd)

That’s because of those whole “Each X-Screen is its own little world” property mentioned in the previous post. You only see the outputs assigned to X-Screen 0 by default, because you only see X-Screen 0 by default.

`xrandr --screen 1 [whateverothercommandsyouwant]` would select X-Screen 1 for display and manipulation.

> [@](#):
>
> Do you know if there’s another way to force the refresh rate to 120 Hz, eg. Through some edid file ? Or something that fixes it at the startup of XOrg.

You could specify the “PreferredMode” option in the Monitor section, e.g., your monitor section for the video output of your console monitor could look like this, assuming DisplayPort-1 is the Viewpixx/EEG and DisplayPort-2 is the console monitor:

```auto
Section “Monitor”
  Identifier “DisplayPort-1”
  # Viewpixx is primary output:
  Option "Primary" "true"
EndSection

Section “Monitor”
  Identifier “DisplayPort-2”
  # Console monitor mirrors the image, forced to a 1920x1080 at 120 Hz mode:
  Option "Position" "0 0"
  Option "PreferredMode" "1920x1080"

  # Artificially restrict range of allowed refresh rates to 119 Hz - 121 Hz if commented in:
  #Option "VertRefresh" 119-121
EndSection

```

The X startup default is whatever the monitor reports as its preferred resolution and refresh rate, if i remember correctly. In the `xrandr --screen 1` output that would be the one with the + sign marking the monitors preferred mode. If the console monitor prefers 60 Hz, that would be it.

`xrandr --screen 1 --output DisplayPort-2 --mode 1920x1080 --rate 120`  
should do the same as  
`Screen('ConfigureDisplay', 'Scanout', 1, 1, 1920, 1080, 120);`  
If that PreferredMode setting in xorg.conf doesn’t work, one could also try to artificially restrict the range of valid refresh rates so the server has to choose 120, e.g., by adding  
the ‘VertRefresh’ option above. But i’d first try without.

---

_[View the full topic](https://psychtoolbox.discourse.group/t/display-same-image-on-2-monitors/4631)._
