superk
Posts: 8
Joined: Sat Dec 20, 2014 12:47 am

Pi dual screen

Sat Jan 03, 2015 2:47 am

Ok. I just got a pi. I am somewhat literate in *nix, but by no means an expert. My goal, is to run a small touch screen on either dsi or the spi, and a monitor on the hdmi.

After searching, I stumbled upon http://www.raspberrypi.org/forums/viewt ... 44&t=91764 which appeared promising, however seemed focused on the concept of one OR the other, rather than both simultaneously.

On page 2 however, I discovered http://www.raspberrypi.org/forums/viewt ... 85#p661085 which is definitely showing a good lean towards my goal.

Hoping that ragnarjensen can come answer a few questions for us all on his setup?

DirkS
Posts: 10445
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Pi dual screen

Sat Jan 03, 2015 1:06 pm

Ok. I just got a pi. I am somewhat literate in *nix, but by no means an expert. My goal, is to run a small touch screen on either dsi or the spi, and a monitor on the hdmi.
For now you'll be limited to gpio (spi) screens. The only screen using DSI is the RPF's lcd, which is not yet available.

Gr.
Dirk.

PiGraham
Posts: 4180
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Pi dual screen

Sat Jan 03, 2015 1:25 pm

I think you can simply startx a second time and specify frame buffer fb1 and you will get X on the SPI display. You need the fbtft driver installed of course. The CPU does all the graphics work on SPI in this case.

What questions did you have?

[ETA]

A few posts down Ragnar points out there is a major flaw with this:
ragnarjensen wrote:Yes, that gives two completely separate X server instances. They will fight over the input devices, though. Making them share the keyboard and mouse is not for the faint of heart.

But you don't need two X servers. One server can use several monitors.
Last edited by PiGraham on Sun Jan 04, 2015 8:15 pm, edited 1 time in total.

PiGraham
Posts: 4180
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Pi dual screen

Sat Jan 03, 2015 1:27 pm

A more interesting dual screen option is HDMI + GertVGA666. I don't think the software / firmware supports it yet, but that holds the promise of two independent full-size screens with GPU acceleration.

superk
Posts: 8
Joined: Sat Dec 20, 2014 12:47 am

Re: Pi dual screen

Sat Jan 03, 2015 5:10 pm

PiGraham wrote:I think you can simply startx a second time and specify frame buffer fb1 and you will get X on the SPI display. You need the fbtft driver installed of course. The CPU does all the graphics work on SPI in this case.

What questions did you have?
If I understand you correctly, this then means that the smaller touch screen is running x in its own window and process, and then hdmi is running x in its own window and process, and the two do/can not interact with each other?

User avatar
DougieLawson
Posts: 40167
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Pi dual screen

Sat Jan 03, 2015 6:23 pm

The HDMI and the TFT are separate framebuffers. You can get one to mirror the other with fbcp (that makes for a cute teeny tiny display on my 320x240 TFT) but I'm OK because I've got a very large magnifying glass or I can have one eye on the TV and one on the TFT.

I've not looked at whether you can have a single desktop extended over the two displays (in the way my Win8.1 laptop does funky stuff when I plug it into my TV).
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Pi dual screen

Sat Jan 03, 2015 7:02 pm

superk wrote:
PiGraham wrote:I think you can simply startx a second time and specify frame buffer fb1 and you will get X on the SPI display. You need the fbtft driver installed of course. The CPU does all the graphics work on SPI in this case.

What questions did you have?
If I understand you correctly, this then means that the smaller touch screen is running x in its own window and process, and then hdmi is running x in its own window and process, and the two do/can not interact with each other?
Yes, that gives two completely separate X server instances. They will fight over the input devices, though. Making them share the keyboard and mouse is not for the faint of heart.

But you don't need two X servers. One server can use several monitors.
In my post in the other thread that you referred to, I show a configuration file that enables you to choose between four different server layouts
  • Touchscreen only.
    RPi HDMI monitor only.
    Both monitors, one extended desktop.
    Both monitors, two separate desktops.
Most of what you need to know to get started is in that post and in the thread about multi-monitor setup with USB DisplayLink adapters.
USB DL are framebuffer devices too and are handled in the same way as the small touchscreens.
I'm actually looking at a triple-monitor set-up right now 8-)
--
Ragnar

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Pi dual screen

Sat Jan 03, 2015 7:03 pm

Some examples of what you can do.
Image
Two screens, one extended desktop.
HDMI + USB DL

Image
Two screens, two separate desktops.
HDMI + USB DL

Image
Three screens, one extended desktop.
HDMI + 2xUSB DL.

Image
Two screens, two separate desktops.
HDMI + PiTFT
--
Ragnar

superk
Posts: 8
Joined: Sat Dec 20, 2014 12:47 am

Re: Pi dual screen

Sat Jan 03, 2015 7:27 pm

ragnarjensen wrote:Some examples of what you can do.
Image
Two screens, one extended desktop.
HDMI + USB DL

Image
Two screens, two separate desktops.
HDMI + USB DL

Image
Three screens, one extended desktop.
HDMI + 2xUSB DL.

Image
Two screens, two separate desktops.
HDMI + PiTFT
--
Ragnar

Thanks for coming Ragnar!

With regards to your setups, when you are using hdmi+pitft, does the touch portion of pitft still work?

Basically im looking to have the smaller screen as an in-dash driver control for music/videos. I also have a usb-wifi keyboard/touchpad.

Here is my setup arrangement:


In dash 2.8pitft for controlling basic stuff like music, getting time, etc.
hdmi feeding to a splitter/duplicator. one hdmi headed to front living room tv, second hdmi to rear bedroom tv.

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Pi dual screen

Sat Jan 03, 2015 7:55 pm

Yes, the touch function works. When using two monitors, you have to transform the touch area, though.
By default the touch panel maps itself to the entire screen area - both monitors.
E.g. in my PiTFT set-up, when I touch the upper right corner of the touchscreen, the cursor moves to the upper right corner of the HDMI monitor if there's no touch transformation in place. The touch transformation is easy to set up, you just have to know the height and width in pixels of the two monitors and do some simple math.
--
Ragnar

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Pi dual screen

Sat Jan 03, 2015 8:08 pm

superk wrote:... in-dash driver control ...front living room tv...rear bedroom tv.
I think your car is bigger than mine :lol:
--
Ragnar

superk
Posts: 8
Joined: Sat Dec 20, 2014 12:47 am

Re: Pi dual screen

Sat Jan 03, 2015 9:38 pm

ragnarjensen wrote:Yes, the touch function works. When using two monitors, you have to transform the touch area, though.
By default the touch panel maps itself to the entire screen area - both monitors.
E.g. in my PiTFT set-up, when I touch the upper right corner of the touchscreen, the cursor moves to the upper right corner of the HDMI monitor if there's no touch transformation in place. The touch transformation is easy to set up, you just have to know the height and width in pixels of the two monitors and do some simple math.
--
Ragnar
Would it not be easier to determine the pixel count myself by setting the desired resolution?
ragnarjensen wrote:
superk wrote:... in-dash driver control ...front living room tv...rear bedroom tv.
I think your car is bigger than mine :lol:
--
Ragnar
If it were a car, indeed. Its a class a motorhome. I am making it.. smart :P

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Pi dual screen

Sat Jan 03, 2015 9:55 pm

superk wrote:Would it not be easier to determine the pixel count myself by setting the desired resolution?
In almost all cases you don't have to set the resolution yourself. The X server is smart enough to figure out what the connected monitors are capable of and sets the optimum resolution.

Then, it's just a matter of looking in the log file to find out what they are:

Code: Select all

$ grep '(--) FBDEV(' /var/log/Xorg.0.log 
[   860.391] (--) FBDEV(0): Virtual size is 320x240 (pitch 320)
[   860.400] (--) FBDEV(1): Virtual size is 1680x1050 (pitch 1680)

--
Ragnar

superk
Posts: 8
Joined: Sat Dec 20, 2014 12:47 am

Re: Pi dual screen

Sun Jan 04, 2015 8:00 pm

ragnarjensen wrote:
superk wrote:Would it not be easier to determine the pixel count myself by setting the desired resolution?
In almost all cases you don't have to set the resolution yourself. The X server is smart enough to figure out what the connected monitors are capable of and sets the optimum resolution.

Then, it's just a matter of looking in the log file to find out what they are:

Code: Select all

$ grep '(--) FBDEV(' /var/log/Xorg.0.log 
[   860.391] (--) FBDEV(0): Virtual size is 320x240 (pitch 320)
[   860.400] (--) FBDEV(1): Virtual size is 1680x1050 (pitch 1680)

--
Ragnar

Thanks for the advice, much appreciated. Ok so I just ordered my adafruit 3.5inch touchscreen. Is it possible to simply duplicate the screens? I realize that some things might be hard to read but so long as I can use the touch screen and still sorta see, im good. 3.5 inches is perfect size of lcd too!

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Pi dual screen

Sun Jan 04, 2015 8:41 pm

There is a program to do that - fbcp. I don't think it is in the repository, you have to build it from source.

Code: Select all

sudo apt-get install cmake
wget https://github.com/tasanakorn/rpi-fbcp/archive/master.zip
unzip  master.zip
cd rpi-fbcp-master/
mkdir build
cd build
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp
Then just start it and put it in the background:

Code: Select all

fbcp &
To stop it, kill it:

Code: Select all

killall fbcp
--
Ragnar

superk
Posts: 8
Joined: Sat Dec 20, 2014 12:47 am

Re: Pi dual screen

Mon Jan 05, 2015 1:48 am

I assume that the framebuffer app needs to be running prior to starting x? If so, I think I would most likely set it up in cron. I am fairly competent in *nix, however I do realize that as this is a different architecture many of the usual conveniences are not available lol.

Once I get the setup running I will post photos. Thanks again to all who helped, especially ragnarjensen for returning repeatedly!

User avatar
ragnarjensen
Posts: 332
Joined: Wed May 15, 2013 6:13 pm
Location: Stockholm, Sweden
Contact: Website

Re: Pi dual screen

Mon Jan 05, 2015 5:03 pm

superk wrote:I assume that the framebuffer app needs to be running prior to starting x?
Nope, you can start it whenever you want, even if X is already running..
--
Ragnar

Return to “Interfacing (DSI, CSI, I2C, etc.)”