Setting up the Pi HDMI display

Fortunately, the new Jessie system defaults to 'half HD' output - which is what you got when the old system 'spotted' a HDMI display (or if you set 'force HDMI').

Of course, for a photo-frame, you would typically want the maximum possible quality and that means using the displays 'native' resolution.

If your display natively supports 16:9 HD (1080x1920) you can skip the then end of this note. If your display is a more typical 4:3 aspect ratio (eg 1024x1280 or similar) you will need to read it all

What's the problem ?

a1. Real HDMI displays will transmit 'allowed settings' data to the Pi up the HDMI cable. DVI displays will do the same (if the adaptor is wired up correctly), however VGA displays conected via HDMI->VGA converters won't.

The settings sent by the HDMI display to the Pi end up stored in 'edid.dat'.

Whilst the Pi should discover that your HDMI->VGA 'converter' doesn't support 'edid' data, you may have to specify "hdmi_ignore_edid=0xa5000080" (in boot/config.txt file) to 'force' the Pi to ignore the 'missing' data (and use the settings you specify) at boot time

a2. There exists a list of 'allowed display definitions' which the GPU HDMI generator will 'consult'. The display settings you want must exist in this list

The list contains two 'sets' - 'CEA' (for 'real' analogue RCA socket TV's) and 'DMT' (for computer 'HDMI' monitors).

DMT modes 35 and 36 are 1280x1024 (at 60 and 75 fps).
I found a complete list here.

a3. When you boot the Pi it starts by using the 'system default' then (about half way through the boot) switches to the 'system preferred'. Each 'user' of the Pi has their own 'preferred' display settings. When a user 'logs in', the Pi switches to that users 'preferred' settings. Applications (such as 'fbi') can specify their own display settings

You can setup the photoframe to 'run under' a user or leave it to 'run under' the system.

Whatever you choose, it would be 'a good idea' to set ALL the various display choices to match your actual display, especially if your actual display is unable to handle the 'default' HDMI (1080x1920 or 720x1920)

The system settings can be found in 'boot/config.txt'.

The 'allowed' user/application settings are found in 'etc/fb.modes'

a4. The Pi has 6 logical 'terminal windows' and, by default, the HDMI output will show 'terminal 1' aka 'fb0' = frame buffer 0

fb0 is the only actual 'image' (photo) frame buffer that exists = all the others are all text only.

You can switch the HDMI output screen between terminal windows using the CTRL+ALT+Function keys (1-6) from a directly connected keyboard.

When you control the Pi via PuTTY (a SSH terminal) from your PC (via Ethernet), you will be using a 'text only' terminal window.

If you try to display an image without specifying the frame buffer (HDMI display) as the 'destination', the command will fail (with the error "ioctl VT_GETSTATE: Invalid argument (not a linux console?)".

a5. You can control the HDMI display using the 'tvservice' command. The command "/opt/vc/bin/tvservice -s" will display the current display settings (you should expect something like :-

state: HPD high|DVI mode|HDCP off|composite off (0x120016), 1280x1024 @ 75Hz, progressive)
Whilst "tvservice -o" can be used to 'stop' the HDMI, you can only get it to 'start' HDMI (with -p for 'preferred' settings, or -e for 'explicit (eg "tvservice -e 'DMT 35'" for 1280x1024)) if the Pi 'finds' a 'real' HDMI display (apparently tvservice refuses to start unless the 'edid.dat' file of 'allowed' settings exists).

So don't be too surprised if the only way to 'reset' the display is to reboot

a6. The HDMI display generated by the GPU, however this does not mean that the GPU is necessarily being used for all graphics / image operations. In particular, it appears that the re-sizing of images for display depends on how the software is written - and the simple display software ('fbi') appears to ignore the GPU and use the ARM instead

As we will see later, this is not really an issue because you will re-size your photo's before sending them to the photoframe

a7. Finally, the 'frame buffer' does not have to be the same 'size' as the display. The GPU is quite capable of 'resizing' at video data rate speed 'on the fly' from the frame buffer to a totally different display pixel resolution.

This means that the GPU can quite happily take 'standard resolution' aspect ratio distorted 16:9 Mpeg DVD movies (576x720 pixels) and display them on a HDMI TV (720 or 1080 x 1920)

It also means that you may never find out why your pre-scaled landscape photo's (1280 pixels wide) loaded into a 1280x1024 frame buffer are being displayed (centered) with black borders all the way around on a 1280 wide (x 1024 high) photoframe display

Setting up the correct 'boot' display resolution

Since your photo-frame display is going to be 'permanently' wired to the HDMI socket, it's a very good idea to set the HDMI to the 'correct' resolution at boot-up time :-). To do this, edit the boot/config.txt file using your PC (PuTTY). The settings I needed for 1280x1024 are group 2, mode 35, plus 'hdmi_drive = 2'.

cd ..
cd ..
cd boot
sudo nano config.txt

Force the frame buffer to 1280x1024 using the entry :-
framebuffer_width=1280
framebuffer_height=1024

= and add the following lines to ignore the edid & set Group 2 = DMT, code 35 = 1280x1024 60Hz
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=35
hdmi_drive=2

= then Save & exit

How do I define the normal 'frame buffer' resolution ?

The 'frame buffer' is the GPU graphics image 'source' pixel store. It should 'match' the display resolution, otherwise the GPU will 'interpolate' pixels from the buffer 'on-the fly' to fit the required display output

Go to the etc/ directory and edit the fb.modes file :-
cd ..
cd etc
sudo nano fb.modes

Scroll down and check a suitable resolution for your photoframe display exists. If not, add the new mode. For example, I added '1280x1024' directly before the existing '1280x1024-43-lace' mode. I found a list of what the various settings mean here
# photoframe settings
    mode "1280x1024"
    geometry 1280 1024 1280 1024 32
    timings 0 0 0 0 0 0 0
    accel true
    rgba 8/16,8/8,8/0,0/0
    endmode

Save & exit

To switch the HDMI output to a new mode, you must restart the Pi by typing 'sudo reboot'

Note - whilst 'tvservice -o' can be used to 'stop' the HDMI, you can only get it to 'start' HDMI (-p for 'preferred' settings) if the Pi detects a 'real' HDMI display. This has something to do with the 'edid.dat' file of 'allowed' settings generated from the data sent to the Pi by a real HDMI (or DVI) display (and plainly not by a VGA converter :-) )

Once the Pi has restarted, check what display mode it's using by typing :-

/opt/vc/bin/tvservice -s

You should expect something like :- state: HPD high|DVI mode|HDCP off|composite off (0x120016), 1280x1024 @ 75Hz, progressive

Checking everything is OK

Launch fbi to display whatever it finds onto the HDMI screen (note, in linux file names are CASE SENSITIVE = so '*.jpg' won't find any images with suffix .JPG :-) )

The '-T 2' parameter 'tells' fbi to display photo's on the HDMI screen (and not try to send them to the PuTTY text window). The '-m' setting is one of the 'fb.modes' (choose the one you set up earlier for your actual display).

cd home
cd pi
cd photos
sudo fbi -T 2 -m 1280x1024 -a -t 1 *.jpg

Your images should start appearing on the HDMI connected screen. If this works, then you are almost finished !

Note. To stop the display, just press the 'return' (or Ctrl+c, or Esc) key on a directly connected keyboard. To stop the display from the PuTTY window, you may need to stop (i.e. 'kill') the fbi task

To stop the fbi task, you need to know it's 'PID' number. To get a list of everything you ('pi') have started running, use the 'ps' command :-
ps -fu pi
To end the task type 'kill {fbi PID}'. For example, if fbi is PID 3210, then type :-
kill 3210