Raspberry Pi monitor - display resolution "problems"


Posted on

Raspberry Pi monitor - display resolution

Now that the client and the server are in sync, saying that the server functionality is represented in the client. I was thinking it's time to begin with scaling so that different resolutions will display the exact same client interface. Already having some code to do the calculations, and some controls correctly scaled, it is now time to make it work as it really should. Just to see what happens on the pi when i change the framebuffer, thus thinking changing resolutions, i made changes in /boot/config.txt and set framebuffer_width=1280 and framebuffer_height=720. Well here the result in the below screenshot.


Uhmm… Whut? The console looks correct, why doesn’t the application scale to the screen? JavaFX on the pi is full screen, this does not look like full screen, this looks like 1280*720 in 1280*720… I have used different builds of the JavaFX 8 builds, and an earlier build works correctly.

I started digging in my code, doing many, many and yes, many debug outputs in my log, displaying a log line after every variable assignment, calculation and function. My log just displays the correct output as i was expecting:

2013-08-14 15:00:39,943 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Got 1 screens 
2013-08-14 15:00:43,048 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Staying primary
2013-08-14 15:00:43,087 [JavaFX Application Thread] DEBUG pidome.client.config.DisplayConfig - Screen properties: posX: 0.0, posY: 0.0, width: 1280.0, height: 720.0, ratioX: 0.6666666666666666, ratioY: 0.6666666666666667
2013-08-14 15:00:56,527 [JavaFX Application Thread] DEBUG pidome.client.system.scenes.MainScene - Set scene width: 1280.0, height: 720.0

Looks quite right, right? So i was bold enough to file a bug report (RT-32333) after searching for maybe others who have the same problem, but couldn’t find. Well, did i have to stand correct. The above is not a JavaFX or framebuffer problem on the pi. It was my display! Let’s fix this.

The display i have attached is a Samsung SyncMaster 2494HS connected with HDMI. After setting the resolution on the pi to 1280*720, I opened the OSD of the display, going to information, i think you can guess it, it reported a resolution of 1920*1080. If this is is a problem of the pi, or the display i do not know, but i’m 95% curtain it is the display. On the Pi you have a little utility called “tvservice”. With this little program you can view and change display settings at runtime. If you have a problem with your screen resolution (because it is just a common issue and not application wise) you can follow the below little tutorial to change your settings, allthough the below will not be the solution for everyone. This solutions is based on connected with hdmi, and not with an adapter like an HDMI to DVI or the composite connection.

Fix wrong resolutions used by monitors on the Raspberry Pi

First, make a backup of you’re /boot/config.txt. The easiest way i think is put the SD card in your windows pc, go to the boot folder, and copy the config.txt to some place where it is easy to find back. When things got screwed up, just copy your original config.txt back. Lets go:

  1. Log in to your pi with your usual credentials (preferable remote, for example with putty, you will read why).
  2. type: ‘sudo -i’ to become root, which i normally don’t but for now it saves me enormous hastle to type sudo before every command.
  3. type: ‘tvservice -s’ to view the current display configuration. In my case it was: “state 0x12001a [HDMI CEA (16) RGB lim 16:9], 1920×1080 @ 60Hz, progressive”. Thus still 1920×1080 while i configured 1280×720.
  4. Type ‘tvservice –modes=”CEA” (because connected with HDMI directly). You then will get a list of possible display modes supported by your monitor. Mine are:
    Group CEA has 11 modes:
    mode 1: 640x480 @ 60Hz 4:3, clock:25MHz progressive
    mode 2: 720x480 @ 60Hz 4:3, clock:27MHz progressive
    mode 3: 720x480 @ 60Hz 16:9, clock:27MHz progressive
    mode 4: 1280x720 @ 60Hz 16:9, clock:74MHz progressive
    mode 5: 1920x1080 @ 60Hz 16:9, clock:74MHz interlaced
    (prefer) mode 16: 1920x1080 @ 60Hz 16:9, clock:148MHz progressive
    mode 17: 720x576 @ 50Hz 4:3, clock:27MHz progressive
    mode 18: 720x576 @ 50Hz 16:9, clock:27MHz progressive
    mode 19: 1280x720 @ 50Hz 16:9, clock:74MHz progressive
    mode 20: 1920x1080 @ 50Hz 16:9, clock:74MHz interlaced
    mode 31: 1920x1080 @ 50Hz 16:9, clock:148MHz progressivers on the Raspberry Pi
  5. You can try to test the mode you need, in my case i want mode number 4. To test a mode type ‘tvservice -e “CEA 4″‘ It will try to force the display in my case to mode 4, which is 1280×720 @ 60Hz 16:9 progressive. This is the moment you should have logged in remotely. in my case the screen turned blank, i tested if i had a signal by setting my monitor option to automatic detect signals. It stayed on the HDMI input. To test if this is really true. I used the command ‘tvservice -o’ to disable to HDMI output. My monitor then started to search for signals. So i was sure that there is still signal output.
  6. To fix my problem, i opened the file /boot/config.txt with VI, and made a couple of changes, You can also do this in notepad on windows if you put you’re SD card in a windows pc and browse to the [SDCARD DRIVE]:/boot directory. There are in my case two options i had to change:
    # uncomment to force a specific HDMI mode (this will force VGA)
    # uncomment to force a HDMI mode rather than DVI. This can make audio work in
    # DMT (computer monitor) modes
  7. If all goes well, you will see the expected resolution on your monitor. To test this, log in on the Pi, and just type: ‘tvservice -s’ again. In my case it shows: “state 0x12001a [HDMI CEA (4) RGB lim 16:9], 1280×720 @ 60Hz, progressive”. In your case you should see your chosen resolution.
  8. If the above does not work for you, restore your config.txt. A lot of solutions have been posted on the Raspberry Pi forums, i think this posting is a good starting point.

I hope this little guide has helped, or gave a starting point for you. I can now start scaling the client.


Latest news/blog

Friends of PiDome

Webshop of the most prominent dutch tech magazines
Products for teams, from startup to enterprise
Home-automation hardware manufacturer
Affordable 433Mhz RF transceivers

Latest added technology

  • SMS
  • Z-Wave
  • PushBullet
  • PlugWise
  • MQTT

Some project stats

Open Hub project report for PiDome Platform


Official NLJUG Member