Skip to content

bcm2708_fb_check_var doesn't account for screen rotation #463

Closed

Description

@mschorer

we're using fullHD screens with screen_rotation set to 90/270 degrees.
we're also using "tvservice -o/-p" to send the display to sleep/wakeup ...
tvservice returns an error ...

this works perfectly if the screen is rotated 0/180 degrees, but fails if rotation is 90/270 ... as is obvious from https://github.com/raspberrypi/linux/blob/rpi-3.6.y/drivers/video/bcm2708_fb.c#L194

the comparison needs to be rotation-aware? e.g.

if (( <screen_rot> & 0x01) ? (xres > 1200) : (yres > 1200)) {

Activity

  1. popcornmix commented on Dec 17, 2013

    @popcornmix
    Collaborator

    Perhaps

    if (xres * yres > 1920 * 1200 || xres > 1920 || yres > 1920)
    

    would be sufficient. I think the 1200 limit is more a sanity check than an absolute limit.
    There's a danger if too high a resolution is selected you may get no image at all, so I'll need to check it's not easy to create an an invalid framebuffer with this change.

  2. mschorer commented on Dec 17, 2013

    @mschorer
    Author

    fine for me ... when can i have it? ;-)

  3. popcornmix commented on Jan 30, 2014

    @popcornmix
    Collaborator

    Source is pushed (76d183f) and I've sanity checked:

    tvservice -o && tvservice -p && fbset -depth 8 && fbset -depth 16
    

    does the right thing. Should be in next rpi-update (probably at weekend).

  4. mschorer commented on Jan 30, 2014

    @mschorer
    Author

    Perfect!
    On 30 Jan 2014 18:44, "popcornmix" notifications@github.com wrote:

    Source is pushed (76d183fhttps://github.com/raspberrypi/linux/commit/76d183fbc25004148d3f844a8c78c7cbc59dd1f0)
    and I've sanity checked:

    tvservice -o && tvservice -p && fbset -depth 8 && fbset -depth 16

    does the right thing. Should be in next rpi-update (probably at weekend).

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/463#issuecomment-33712572
    .

  5. popcornmix commented on Feb 2, 2014

    @popcornmix
    Collaborator

    rpi-update firmware should have this fix. Please update and test.

  6. mschorer commented on Feb 5, 2014

    @mschorer
    Author

    hmmh ...
    it seems to work for rotations of 0/180 degrees.

    for left/right-protrait (rot 90/270) setups ... the screen stays black:

    • no tvservice error.
    • screen turns on (from sleep) and shows correct resolution (in menu).
    • qt app runs without errors @ proper res
    • getting a screenshot from the app shows the right content
    • screen all black.

    i'm running in 1366x768@24bit ...

  7. popcornmix commented on Feb 5, 2014

    @popcornmix
    Collaborator

    First, does this work (from console):

    tvservice -o && tvservice -p && fbset -depth 8 && fbset -depth 16
    

    Note, after powering off display, the framebuffer needs to be recreated with something like fbset.
    You may also need to do something like xrefresh to ensure framebuffer is refreshed.

  8. mschorer commented on Feb 5, 2014

    @mschorer
    Author

    i know that and no it doesn't (no error but black screen)
    also, i'm using qt via eglfs from the console so no X involved.

    my process is:

    • run qt app, exit if we need to sleep
    • run "tvservice -o"
    • run sleep app, exit if we need to wake up
    • do a "tvservice -p && fbset -depth 16 && fbset -depth 24"
    • loop

    this does work with in a production digital signage setup for rotation of 0/180 degrees - but gives black for 90/270.
    tvservice used to return an error with -p before the fix - now it doesn't anymore.
    the framebuffer including opengl acceleration is working as i see in the screenshot - qt used to return something like "no framebuffer available" and bail out before.

    only the display stays black.

    is there another sanity check in the firmware preventing the "display-bitstream-generator" being "switched on"?

  9. popcornmix commented on Feb 5, 2014

    @popcornmix
    Collaborator

    Really I need to see the failure here. Can you try a clean raspbian install and enable 90 degrees rotation and check if:

    tvservice -o && tvservice -p && fbset -depth 8 && fbset -depth 16
    

    results in console returning. If it does, what is the minimal number of things you do to provoke a black screen.

  10. mschorer commented on Feb 5, 2014

    @mschorer
    Author

    sure i tested your statement!
    the screen stays black but is powered on - no error displayed on the commandline!

    pi@piMaster ~ $ tvservice -o && tvservice -p && fbset -depth 8 && fbset -depth 16
    Powering off HDMI
    Powering on HDMI with preferred settings
    pi@piMaster ~ $ tvservice -s
    state 0x12001a [HDMI DMT (81) RGB full 16:9], 1366x768 @ 60Hz, progressive
    pi@piMaster ~ $
    

    the above is from a ssh session (to be able to see something).
    the same happens if done on the pi console via keyboard.

    i mentioned all the other stuff only to show that i had my learning curve with pi's diplay controller.

  11. popcornmix commented on Feb 5, 2014

    @popcornmix
    Collaborator

    Just to confirm was this with a clean raspbian image?
    Did you run rpi-update to get the fixed kernel? (I didn't mention this, but you should).

  12. mschorer commented on Feb 5, 2014

    @mschorer
    Author

    freshly downloaded "2014-01-07-wheezy-raspbian.zip".
    boot into console.
    ssh into machine.
    set "display_rotate=3" in config.txt

    pi@raspberrypi ~ $ tvservice -o && tvservice -p && fbset -depth 8 && fbset -depth 16
    Powering off HDMI
    Powering on HDMI with preferred settings
    ioctl FBIOPUT_VSCREENINFO: Invalid argument
    pi@raspberrypi ~ $
    

    => ioctl error and black/blank screen as expected
    then "sudo rpi-update".
    then "sudo reboot"
    boot into console.
    ssh into machine.

    pi@raspberrypi ~ $ tvservice -o && tvservice -p && fbset -depth 8 && fbset -depth 16
    Powering off HDMI
    Powering on HDMI with preferred settings
    pi@raspberrypi ~ $
    

    => no ioctl error as expected, STILL BLACK SCREEN

    comment display rotation
    reboot. normal display. ssh in.

    pi@raspberrypi ~ $ tvservice -o && tvservice -p && fbset -depth 8 && fbset -depth 16
    Powering off HDMI
    Powering on HDMI with preferred settings
    pi@raspberrypi ~ $
    

    => screen blinks off and goes on again. console as before.

  13. szantaii commented on May 23, 2014

    @szantaii

    This issue is also affects me.

    The same thing happens what @mschorer described. I'd like to turn off and on the HDMI, and I'm also using a 270° rotated display (/boot/config.txt):

    hdmi_group=2
    hdmi_mode=35
    hdmi_force_hotplug=1
    display_rotate=3
    

    Has the fix gone into Raspbian already? (I'm using the latest one, I'm regularly update it.)

  14. 12 remaining items

  15. mschorer commented on May 24, 2014

    @mschorer
    Author

    @popcornmix: sure. Not sure if i`ll get to it on monday though. Latest on
    wednesday ...

    Thanks. That`ll be a huge improvement!
    Am 23.05.2014 23:47 schrieb "popcornmix" notifications@github.com:

    @mschorer https://github.com/mschorer can you test and close if happy?

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/463#issuecomment-44064226
    .

  16. szantaii commented on May 24, 2014

    @szantaii

    I just ran an rpi-update to get the lastest firmware:

    $ uname -a
    Linux raspberrypi 3.12.20+ #685 PREEMPT Fri May 23 18:59:01 BST 2014 armv6l GNU/Linux
    

    Tested the stuff, and now it works, so the monitor turns back on and everythings displays correctly. I've tested this both in console and under the default LXDE session also.

    @popcornmix Thanks for resolving this so fast! Could you point me to the code that was changed to fix this issue? I just want to learn what was the problem.

  17. popcornmix commented on May 24, 2014

    @popcornmix
    Collaborator

    It was on firmware side (in start.elf).
    Basically when running with display_rotate or dispmanx_offline an extra frame buffer is allocated.
    It turned out that when powering off this got freed, but wasn't reallocated when powered back on again.

  18. mschorer commented on May 26, 2014

    @mschorer
    Author

    Works for me now!

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions