# 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:** 4

<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 6, 2022, 9:47pm UTC](https://psychtoolbox.discourse.group/t/display-same-image-on-2-monitors/4631/4 "2022-11-06T21:47:38Z")

</div>

Ok, the original poster tuned out. But there is a related question from Tarana in [Linux (UBUNTU) + AMD - which card to choose? - #7 by Tarana](https://psychtoolbox.discourse.group/t/linux-ubuntu-amd-which-card-to-choose/3776/7) so lets continue that conversation here…

> [@Linux (UBUNTU) + AMD - which card to choose?](https://psychtoolbox.discourse.group/t/linux-ubuntu-amd-which-card-to-choose/3776/7):
>
> Hi!  
> I am also running Non-human primate electrophysiology experiments with ViewPixx(1920X1080@120Hz) with a Linux/X11 system. I want to mirror the display on the ViewPixx Monitor to another monitor (not the primary monitor- where I see the matlab window).  
> I tried the `PsychImaging('AddTask', 'General', 'MirrorDisplayToSingleSplitWindow')` as suggested above with an extended monitor configuration. But unfortunately , it only displays on one of the screens. Could you let me know if my [X.org](http://X.org) config file is set up in the right way to get this mirroring to work ? Thanks a lot!
> 
> The following is my xorg.conf file :  
> …
> 
> Thanks so much for your quick response and help !
> 
> 1. Unfortunately , we have ViewPixx/EEG model which doesnt have a second port to connect to the console monitor. Reg. the hardware solution - I am considering a possibility of a powered-DVI splitter- but I am not sure if that would cause more delays than any other software-side solution. If this is something you have tested, I’d be happy to know your experience with that.
> 2. I’ve been using Ubuntu 20.04.5 LTS. 1920X1080 @120Hz is the resolution of the console monitor .
> 3. If you have suggestions on how to change the [X.org](http://X.org) conf file such that mirroring or extending the screen could be established - I am happy to try that out too.  
> Thank you very much for your help! 🙂

1. Ok, I assumed all ViewPixx displays have that connector. Looking at the specs, the EEG variant seems to be a bit of a “light” edition with more limited functionality. An active hardware splitter might work, given that both monitors have same resolution and refresh rate, but I don’t have any practical experience with that specific setup, so no guarantee.

As far as pure software solutions go:

Ok, so the resolution and refresh rate of the console monitor is the same as the Viewpixx, and given that your AMD card uses DisplayPort connectors to drive both monitors, it is conceivable that the display driver will synchronize the video refresh cycles of both monitors if it considers them synchronizable. What model of AMD card is this?

Wrt. xorg.conf, you’d use XOrgConfCreator to create a dual-X-Screen setup, where you assign both monitors DisplayPort-1 and DisplayPort-2 to X-Screen 1. Then the usual XOrgConfSelector, logout + login.

Then you could test if the video outputs are auto-synchronized by running `GraphicsDisplaySyncAcrossDualHeadsTestLinux`. If that works, then it might work on Ubuntu 20.04.5-LTS. Another visual test is `PerceptualVBLSyncTest([],[],[],[],[],0,1);` - It should show a tear line somewhere in the middle of the screen, close to where the yellow line appears, and most importantly at the same vertical position on both monitors, ie. not shifted or drifting. On older AMD cards (not AMD Ryzen integrated graphics or AMD Navi cards), one can also run `GraphicsDisplaySyncAcrossDualHeadsTestLinux([],[],1)` to let Psychtoolbox manually synchronize the video refresh cycles iff the AMD display driver didn’t do it automatically.

→ If cycles are synchronizable without drift, great, Ubunt 20.04 will do.

→ If not, e.g., due to subtle hardware mode timing differences between the monitors, an upgrade to Ubuntu 22.04.1-LTS would be needed. Then you can rerun XOrgConfCreator and choose a new option under “Advanced settings…” by answering “Use AsyncFlipSecondaries mode for multi-display setups” with (y)es. This will make sure to only use vsync synchronization on the “primary monitor” of an X-Screen for proper timing, but run unsynchronized on all other connected non-primary monitors. By assigning your “console monitor” as secondary monitor and the Viewpixx as the primary monitor, you will get proper timing and performance on the Viewpixx and good enough quality with possibly mild tearing on the secondary console monitor.

You’d either have to assign the monitors (in XOrgConfCreator, or by plugging on the graphics card) in an order that makes the Viewpixx monitor the primary monitor, or edit the xorg conf file created by XOrgConfCreator to mark that monitor / video output explicitely as primary monitor. E.g., if “DisplayPort-1” would be connected to the Viewpixx, you’d change the relevant monitor section with a text editor to contain the Option “Primary” true":

```auto
Section “Monitor”
  Identifier “DisplayPort-1”
  Option "Primary" "true"
EndSection

```

After reconfiguring and logout + login etc. the PerceptualVBLSyncTest function mentioned above lets you verify that the Viewpixx shows perfect pictures, whereas the console monitor might either also show perfect pictures, or show slight tearing.

Mirroring can then be done with the `PsychImaging('AddTask', 'General', 'MirrorDisplayToSingleSplitWindow')` method. Or even without that, by putting both monitors in a mirror configuration, e.g., by replacing `Option "RightOf" ...` in the xorg.conf monitor sections with `Option "Position" "0 0"`, so all monitors are placed on top of each other and show the same image. This is a tad more efficient for a pure mirror image. The next Psychtoolbox release will have some further enhancements to the mirroring functionality.

-mario

---

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