Various user-contributed guides for software-related things
Post Reply
Posts: 56
Joined: Sun Apr 02, 2017 3:21 pm
Has thanked: 7 times
Been thanked: 39 times


Post by razer.93 » Fri Jan 05, 2018 12:38 pm

Hi guys,
recently I completed my second build featuring a DPI screen (https://www.sudomod.com/forum/viewtopic.php?f=43&t=4745) and designed a couple of useful piece of software I'm gonna share with you (not everyone agree upon this opensource policy but... anyway... :roll:).
This guide explains how to mirror the content of the gbz display (composite, SPI, DPI) to the HDMI output (and viceversa), as shown in the picture below and in the famous closed-source unreleased Sword project. Since this solution automatically detects when the HDMI cable is connected in order to turn mirroring and power on and off it's even better and more sophisticated than Sword's one)
hdmi.jpg (166.66 KiB) Viewed 5260 times
First, we need to understand that every screen plugged to the RPi GPU has a dedicated portion of memory (framebuffer) attached to it which is used to store the image shown on screen. The mirroring software basically copies the main screen's framebuffer into the secondary screen framebuffer at a given frame rate (this is when the gpu effort comes into play), more the frame rate, more the gpu effort.
So the first part of the process consists of cloning this repo I slighted modified in the RPi home and build it following the README instructions:

gertCloner: https://github.com/vascofazza/gertCloner

Execuing cloner.bin with default parameters you should be able to see the main screen cloned to the HDMI output, if this is not the case or you have a different screen configuration you may want to specify other values for srcScreen and dstScreen from command line.

Once you successfully mirrored your screen to HDMI from command line you can download this automatic HDMI cloner script, edit accordingly to your configuration, and enjoy the power of HOT-PLUG / PLUG-AND-PLAY HDMI mirroring!
Remember that cloner.bin must be located at /home/pi/gertCloner/cloner.bin!

HDMI_switcher: https://github.com/vascofazza/Retropie- ... witcher.sh

Third, you can include the script in your rc.local or cron listing and let the hdmi_switcher.sh script run at boot!

Happy mirroring everyone!

User avatar
Posts: 1719
Joined: Mon Jun 26, 2017 12:42 pm
Location: brittany - France
Has thanked: 871 times
Been thanked: 688 times


Post by YaYa » Fri Jan 05, 2018 1:44 pm

This is awesome ! Thanks for the job :D
Follow me on instagram Image

Posts: 22
Joined: Sat Apr 21, 2018 8:40 am
Been thanked: 1 time


Post by jungb » Thu Nov 08, 2018 6:14 pm

Thank you for your sharing

User avatar
Posts: 950
Joined: Thu May 12, 2016 4:30 am
Location: UK
Has thanked: 242 times
Been thanked: 332 times


Post by kite » Fri Nov 09, 2018 4:06 am

Nice, this looks good I'll have to try it out and possibly include (and credit you) it :) Just a note, the CS already has a cloner service running by default which you can enable/disable with "sudo service dpi-cloner start" and "sudo service dpi-cloner stop". If you want it off by default, then edit the /boot/config-cs.txt and change "CLONER=ON" to "CLONER=OFF" and it will prevent it starting on boot.

You should be able to edit your cron/sh script to instead call those above start/stop commands. The dpi-cloner service does similar stuff but implements a vsync to prevent tearing.

EDIT: Realise that this post was actually quite old, this was perhaps before I implemented my own cloning and hadn't seen this post before! On the CM3 the cloning in the background uses 1% CPU, on a 4 core system that doesn't ever have all cores used up this has no impact on performance.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest