Is the FB not refreshing issue being looked at ?

Post Reply
shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Is the FB not refreshing issue being looked at ?

Unread post by shanti » Fri May 03, 2019 4:05 pm

This has been an outstanding issue on the N2 for a while, but I see no one really discussing it or even mentioning it anymore, The issue is best described in a video https://youtu.be/tqu75m9YJS8
(another one https://youtu.be/9Qq9mre7COg and another this time with Kodi https://youtu.be/t3tq3bw07qI )
As you can see the FB sometimes does not refresh the image, everything is working as it should in the background. There are workarounds for this like opening and closing the FB between each change, but this also creates a lot of screen tearing (as you can also see in he video). A proper fix in the FB drivers (I assume its the drivers?) would be best.

Any idea, pointers as to what to look for in order to fix this ?

User avatar
odroid
Site Admin
Posts: 32364
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 147 times
Been thanked: 325 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by odroid » Fri May 03, 2019 4:59 pm

We've seen that issue here and there.
But it is really hard to know where is a root cause.

Is it possible making a simple OpenGL-ES example program on the fb-dev to reproduce the issue easily?
Retroarch or Kodi is a really big software and it is almost impossible to trace a root cause due to our limited knowledge.

I hope @crashoverride can give us a small light. ;)
These users thanked the author odroid for the post:
shanti (Sat May 04, 2019 1:02 am)

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Fri May 03, 2019 11:50 pm

I have never encountered this issue; however, I do not use Kodi or CoreELEC.

The issue should be apparent in the PPSSPP testing. That emulator uses vsync and (multiple) FBOs. If the issue can not be reproduced on the official Ubuntu minimal image, it may indicate a software issue with either the CoreELEC kernel or Kodi. It is unclear what software is being used (is ES launched from Kodi?). Further details are required to narrow the problem scope.

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Sat May 04, 2019 12:30 am

crashoverride wrote:
Fri May 03, 2019 11:50 pm
I have never encountered this issue; however, I do not use Kodi or CoreELEC.

The issue should be apparent in the PPSSPP testing. That emulator uses vsync and (multiple) FBOs. If the issue can not be reproduced on the official Ubuntu minimal image, it may indicate a software issue with either the CoreELEC kernel or Kodi. It is unclear what software is being used (is ES launched from Kodi?). Further details are required to narrow the problem scope.
It is not a CoreELEC/EmuELEC/Batocera/Kodi software issue, this can be replicated even on the Linux images provided by HK, It can be replicated in PPSSPP, unfortunately I didn't record a video, it can also be replicated with glmark2-es2-fbdev, in this test you can even see the terminal in the background not getting cleaned/hidden when you run it.

The problem with those included programs is that it might be harder to replicate since these programs exit back to the terminal and the examples I gave send you back to another program using the FB which is where I think the issue really is.

I will try to make a video using the provided Linux image as soon as I get some free time

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Sat May 04, 2019 1:29 am

shanti wrote:
Sat May 04, 2019 12:30 am
these programs exit back to the terminal
try:

Code: Select all

glmark2-es2 --run-forever

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Sat May 04, 2019 1:36 am

crashoverride wrote:
Sat May 04, 2019 1:29 am
shanti wrote:
Sat May 04, 2019 12:30 am
these programs exit back to the terminal
try:

Code: Select all

glmark2-es2 --run-forever
Thanks but I didn't mean it crashes or stops, I meant that when I exit the program (intentionally) it goes back to terminal (as it should) so its hard to reproduce the issue, The issue is easily reproducible when the program using the FB goes back to another program using the FB, like Emulationstation, retroarch, etc.

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Sat May 04, 2019 2:37 pm

Here is PPSSPP running on the minimal image provided by HK

https://youtu.be/duRYoD-5E18

The issues here are a bit different but they seem to be related as it seems the FB is not updating itself correctly.
(sorry I had to record with my phone)

hsu95066
Posts: 51
Joined: Wed Aug 10, 2016 5:01 pm
languages_spoken: Chinese, English
ODROIDs: C1, C1+, C2, XU4
Has thanked: 3 times
Been thanked: 6 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by hsu95066 » Sat May 04, 2019 6:07 pm

Hi,

I think I may have the same issue for ubuntu-18.04.2-4.9-minimal-odroid-n2-20190329.img.
Initially I executed my app on terminal and it performed fine, as in C2.
However, I press any button or mouse to cancel the screen saver when the screen saver is launched.
The flashing terminal text appears on the left side of the screen.
Actually, the left part of the screen is the non-updated region for my app.

20190504_160031_001.jpg
20190504_160031_001.jpg (729.47 KiB) Viewed 1568 times

Later, I downloaded and compiled glmakr2-es2-fbdev.
After execution, I can see that the terminal text and the rendered image are interlaced on the screen.

20190504_103141.jpg
20190504_103141.jpg (392 KiB) Viewed 1568 times
20190504_103532.jpg
20190504_103532.jpg (461.23 KiB) Viewed 1568 times

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Sun May 05, 2019 1:31 am

shanti wrote:
Sat May 04, 2019 2:37 pm
Here is PPSSPP running on the minimal image provided by HK
This is "correct" operation.

Linux is drawing to the same frame buffer as Mali (GPU). Neither is aware of the other. It is necessary to "tell" Linux that the console will be used for graphics (and should not be touched):
https://github.com/OtherCrashOverride/c ... ndow.h#L72

Code: Select all

int ret = ioctl(ttyfd, KDSETMODE, KD_GRAPHICS);
There is also a terminal escape sequence that can be used (echo), but I do not know what it is.
shanti wrote:
Sat May 04, 2019 2:37 pm
it seems the FB is not updating itself correctly.
hsu95066 wrote:
Sat May 04, 2019 6:07 pm
Initially I executed my app on terminal and it performed fine, as in C2.
The Mali GPU used in N2 is more advanced than that used in previous hardware. This means it will only update the part of the frame buffer that changed from the last frame it generated. This is intended to reduce the memory bandwidth and energy cost while delivering faster performance. When Linux also uses the frame buffer (see above), Mali has no idea that the frame buffer is 'dirty'. This results in the linux console (or screen saver) persisting until Mali renders a change to it.

TL;DR = previous GPUs always copied the entire frame. This covered up anything linux wrote to the framebuffer. The new GPU in N2 is much smarter and only updates things that it knows changed. This difference in behavior reveals the issue that fbdev programs do not set a graphics mode (KD_GRAPHICS) before use .

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Sun May 05, 2019 2:09 am

Thanks for the interesting info!
So is the issue I presented early (image frozen after switching to another program that uses the FB) the same thing? or is it something unrelated to the KD_GRAPHICS?

Either we (CoreELEC, EmuELEC, Batocera, TheRetroArena, probably others) have the same incorrect configuration on the kernel, or its something else entirely, but what could it be?
crashoverride wrote:
Sun May 05, 2019 1:31 am
There is also a terminal escape sequence that can be used (echo), but I do not know what it is.
I will try to find it and see if this changes anything.

Thanks

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Sun May 05, 2019 2:36 am

Here is a video that shows that the issue I reported is also present on the minimal ubuntu image. https://youtu.be/Z7Jadyuf2S0

Here is how to reproduce it:
* Fill up the terminal with random commands or whatever (not sure if needed)
* Run glmark2-es2-fbdev
* Press CTRL+C to end glmark2-es2-fbdev
* Now the terminal is behind the image, you cannot see it, but it is still working, the only way I found to reset it is by typing "exit" and re-login.

this is exactly what is happening on my previous videos, but now I can show you that is not only on EmuELEC or all the others I mentioned.

Again, it seems like the FB is not refreshing/cleaning itself when exiting programs.

I would love for this small issue to be resolved as it makes a huge difference with how you enjoy media on the N2 I have close to zero knowledge on developing for the FB so unfortunately all I can help with is testing.

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Sun May 05, 2019 12:00 pm

shanti wrote:
Sun May 05, 2019 2:36 am
Now the terminal is behind the image, you cannot see it, but it is still working, the only way I found to reset it is by typing "exit" and re-login.
What happens if you run glmark2-es2-fbdev again (while the terminal is invisible)? Does it display properly?

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Sun May 05, 2019 3:22 pm

The issue above is most likely due to the framebuffer remaining "panned" when the program exists. This means that while linux is updating the framebuffer, it is offscreen and a different section is displayed. This is how front/back buffer flipping is implemented (FBIOPAN_DISPLAY ioctl). The likely resolution is to issue the ioctl to reset the yoffset to 0. It is also possible the reset command will restore functionality.

Code: Select all

reset

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Mon May 06, 2019 2:15 am

crashoverride wrote:
Sun May 05, 2019 3:22 pm
The issue above is most likely due to the framebuffer remaining "panned" when the program exists. This means that while linux is updating the framebuffer, it is offscreen and a different section is displayed. This is how front/back buffer flipping is implemented (FBIOPAN_DISPLAY ioctl). The likely resolution is to issue the ioctl to reset the yoffset to 0. It is also possible the reset command will restore functionality.

Code: Select all

reset
Unfortunately the reset command does nothing while the image is frozen, it does clean the terminal when there is no image on the FB.
crashoverride wrote:
Sun May 05, 2019 12:00 pm
shanti wrote:
Sun May 05, 2019 2:36 am
Now the terminal is behind the image, you cannot see it, but it is still working, the only way I found to reset it is by typing "exit" and re-login.
What happens if you run glmark2-es2-fbdev again (while the terminal is invisible)? Does it display properly?
If i run it again it will display again, but it has the same problem.

But the problem, for example on EmuELEC is that the FB is being switched by other programs all the time, so Emulationstation opens Retroarch which in turn opens a core that runs the game, all of this works like it should 90% of the time, the problem seems to be when you close the FB and return to the previous program using the FB the very last thing that used the FB is the image that stays frozen.
I am not sure if I am making technical sense

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Mon May 06, 2019 2:24 am

Btw, this also happens with PPSSPPSDL on the minimal linux image, its just a bit harder to reproduce since it seems to be random.

Another thing I just noticed is that if I leave the TV with the frozen FB it will eventually go to sleep (I guess?) and when you move the keyboard the image is gone and the terminal is usable again.

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Mon May 06, 2019 5:27 am

shanti wrote:
Mon May 06, 2019 2:15 am
If i run it again it will display again, but it has the same problem.
This is a key observation. It confirms that the "freezing" in glmark2-es2 is a result of the buffer swapping (FBIOPAN_DISPLAY) as previously described. When a program using fbdev exits, there is no guarantee the framebuffer will be restored to origin (yoffset = 0). This is a limitation of the linux fbdev interface (it does not restore state on program termination).
shanti wrote:
Mon May 06, 2019 2:24 am
Btw, this also happens with PPSSPPSDL on the minimal linux image, its just a bit harder to reproduce since it seems to be random.
It actually is random. The state of the panning is determined by how many frames have been displayed. If an even number of frames have been displayed (double buffering), the console will be at yoffset=0 and display correctly. If an odd number of frames have been displayed, it will be panned (yoffset != 0), and the console will be off-screen (appear frozen).
shanti wrote:
Mon May 06, 2019 2:15 am
But the problem, for example on EmuELEC is that the FB is being switched by other programs all the time, so Emulationstation opens Retroarch which in turn opens a core that runs the game, all of this works like it should 90% of the time, the problem seems to be when you close the FB and return to the previous program using the FB the very last thing that used the FB is the image that stays frozen.
I would recommend consulting other Emulationstation/Retroarch builds to discover how they manage fbdev state. The foundation of the issue seems to lie in the behavior change of libmali mentioned previously. The most likely solution is to record the fbdev state before executing another program and restore the state when the program exists.

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Mon May 06, 2019 5:31 am

shanti wrote:
Mon May 06, 2019 2:24 am
Another thing I just noticed is that if I leave the TV with the frozen FB it will eventually go to sleep (I guess?) and when you move the keyboard the image is gone and the terminal is usable again.
This is because the fbdev is reset (yoffset=0) when the screen 'wakes'.

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Mon May 06, 2019 1:25 pm

crashoverride wrote:
Mon May 06, 2019 5:27 am
I would recommend consulting other Emulationstation/Retroarch builds to discover how they manage fbdev state. The foundation of the issue seems to lie in the behavior change of libmali mentioned previously. The most likely solution is to record the fbdev state before executing another program and restore the state when the program exists.
Thanks for the explanation but as I mentioned on the first post, This is not an issue that only happens to me (EmuELEC), it happens to all the builds I've tested including the minimal linux image provided by HK as I demonstrated in the videos, Batocera and TheRetroArena. So there is nothing I can really discover from them as they all have the same issue.

any ideas on how to record the state and the restore it ?

Also this does not happen at all on the C2 or any other Amlogic S905/S912 I've tested, nor other linux distros I've tried (like Armbian) on these platforms, but it happens on all the ones I've tested for the N2, so this is a problem specific to the N2. so I am not sure what you describe is the problem, otherwise it would be widespread to even those platforms, right?
Last edited by shanti on Mon May 06, 2019 1:33 pm, edited 4 times in total.

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Mon May 06, 2019 1:26 pm

crashoverride wrote:
Mon May 06, 2019 5:31 am
shanti wrote:
Mon May 06, 2019 2:24 am
Another thing I just noticed is that if I leave the TV with the frozen FB it will eventually go to sleep (I guess?) and when you move the keyboard the image is gone and the terminal is usable again.
This is because the fbdev is reset (yoffset=0) when the screen 'wakes'.
So is there a way to reset the yoffset of the fb with a terminal command? or is there a program I can use to reset it ?

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Mon May 06, 2019 3:06 pm

shanti wrote:
Mon May 06, 2019 1:26 pm
So is there a way to reset the yoffset of the fb with a terminal command? or is there a program I can use to reset it ?
The following program proves the situation I described with FBIOPAN_DISPLAY. It was tested with 'glmark2-es2-fbdev' on the minimal Ubuntu image (20190329).

Code: Select all

#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <sys/ioctl.h>

int main()
{
    int fbfd = 0;
    struct fb_var_screeninfo vinfo;
    struct fb_fix_screeninfo finfo;


    /* Open the file for reading and writing */
    fbfd = open("/dev/fb0", O_RDWR);
    if (!fbfd) 
    {
        printf("Error: cannot open framebuffer device.\n");
        exit(1);
    }
    printf("The framebuffer device was opened successfully.\n");

    /* Get fixed screen information */
    if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo))
    {
        printf("Error reading fixed information.\n");
        exit(2);
    }

    /* Get variable screen information */
    if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) 
    {
        printf("Error reading variable information.\n");
        exit(3);
    }

    printf("vinfo.yoffset=%d\n", vinfo.yoffset);
    
    if (vinfo.yoffset != 0)
    {
        printf("FIX: setting vinfo.yoffset=0.\n");
        vinfo.yoffset = 0;
        if (ioctl(fbfd, FBIOPUT_VSCREENINFO, &vinfo)) 
        {
            printf("Error setting variable information.\n");
            exit(4);
        }
    }

    return 0;
}
The glmark2-es2-fbdev program was started and interrupted with CTRL-C to induce the 'frozen' display. The output is as follows:

Code: Select all

root@odroid:~/fbfix# ./fbfix 
The framebuffer device was opened successfully.
vinfo.yoffset=1080
FIX: setting vinfo.yoffset=0.
[edit]
For completeness, the following is the contents of the 'Makefile':

Code: Select all

all:
	gcc -g -O2 main.c -o fbfix
These users thanked the author crashoverride for the post:
shanti (Mon May 06, 2019 4:17 pm)

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Mon May 06, 2019 4:00 pm

Running that program on (almost) any FB frozen image worked perfectly!

I still don't understand why those issues are not present on any other platform I've tried, but I guess it is out of my scope, at least with this little program I can continue working on my build.

do you mind if I include it in?

Thanks!

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Tue May 07, 2019 2:26 am

shanti wrote:
Mon May 06, 2019 4:00 pm
do you mind if I include it in?
The program should be considered public domain, and you can use it as you see fit.
These users thanked the author crashoverride for the post:
shanti (Tue May 07, 2019 6:14 am)

wallyz21
Posts: 103
Joined: Thu Apr 04, 2019 11:00 am
languages_spoken: english
ODROIDs: N2
Has thanked: 9 times
Been thanked: 11 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by wallyz21 » Tue May 07, 2019 12:27 pm

hsu95066 wrote:
Sat May 04, 2019 6:07 pm
Hi,

I think I may have the same issue for ubuntu-18.04.2-4.9-minimal-odroid-n2-20190329.img.
Initially I executed my app on terminal and it performed fine, as in C2.
However, I press any button or mouse to cancel the screen saver when the screen saver is launched.
The flashing terminal text appears on the left side of the screen.
Actually, the left part of the screen is the non-updated region for my app.

.
.
.
I also see that you are not getting 60fps and only 58-59 fps. And your vsync times are inconsistent. I will continue to highlight this problem for everyone's notice and attention.

wallyz21
Posts: 103
Joined: Thu Apr 04, 2019 11:00 am
languages_spoken: english
ODROIDs: N2
Has thanked: 9 times
Been thanked: 11 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by wallyz21 » Tue May 07, 2019 12:37 pm

crashoverride wrote:
Mon May 06, 2019 3:06 pm
shanti wrote:
Mon May 06, 2019 1:26 pm
So is there a way to reset the yoffset of the fb with a terminal command? or is there a program I can use to reset it ?
The following program proves the situation I described with FBIOPAN_DISPLAY. It was tested with 'glmark2-es2-fbdev' on the minimal Ubuntu image (20190329).

Code: Select all

#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <sys/ioctl.h>

int main()
{
    int fbfd = 0;
    struct fb_var_screeninfo vinfo;
    struct fb_fix_screeninfo finfo;


    /* Open the file for reading and writing */
    fbfd = open("/dev/fb0", O_RDWR);
    if (!fbfd) 
    {
        printf("Error: cannot open framebuffer device.\n");
        exit(1);
    }
    printf("The framebuffer device was opened successfully.\n");

    /* Get fixed screen information */
    if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo))
    {
        printf("Error reading fixed information.\n");
        exit(2);
    }

    /* Get variable screen information */
    if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) 
    {
        printf("Error reading variable information.\n");
        exit(3);
    }

    printf("vinfo.yoffset=%d\n", vinfo.yoffset);
    
    if (vinfo.yoffset != 0)
    {
        printf("FIX: setting vinfo.yoffset=0.\n");
        vinfo.yoffset = 0;
        if (ioctl(fbfd, FBIOPUT_VSCREENINFO, &vinfo)) 
        {
            printf("Error setting variable information.\n");
            exit(4);
        }
    }

    return 0;
}
The glmark2-es2-fbdev program was started and interrupted with CTRL-C to induce the 'frozen' display. The output is as follows:

Code: Select all

root@odroid:~/fbfix# ./fbfix 
The framebuffer device was opened successfully.
vinfo.yoffset=1080
FIX: setting vinfo.yoffset=0.
[edit]
For completeness, the following is the contents of the 'Makefile':

Code: Select all

all:
	gcc -g -O2 main.c -o fbfix
Thanks but how do you run it if the console is frozen?

All the ctrl-alt-F(1-7) key combinations don't seem to work once the console is frozen so I have been getting around this issue by remote shelling in and killing the parent shell that the graphical application was started from.

Walter

wallyz21
Posts: 103
Joined: Thu Apr 04, 2019 11:00 am
languages_spoken: english
ODROIDs: N2
Has thanked: 9 times
Been thanked: 11 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by wallyz21 » Tue May 07, 2019 12:42 pm

Also I have been avoiding the terminal background leeching into the graphics by starting my applications with stdout/stderr redirected to the null device like so:

$ ./my_graphic_app >/dev/null 2>/dev/null

This stops the terminal text from coming to the foreground.

However all these workarounds are no substitutes for a real fix!

hsu95066
Posts: 51
Joined: Wed Aug 10, 2016 5:01 pm
languages_spoken: Chinese, English
ODROIDs: C1, C1+, C2, XU4
Has thanked: 3 times
Been thanked: 6 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by hsu95066 » Tue May 07, 2019 8:09 pm

@wallyz21

The time intervals of vsync larger than nominal vlaue is indeed a issue on N2.
This is another issue about frame buffer updating on minimum Ubuntu.
Also I have been avoiding the terminal background leeching into the graphics by starting my applications with stdout/stderr redirected to the null device like so:

$ ./my_graphic_app >/dev/null 2>/dev/null

This stops the terminal text from coming to the foreground.
I will try your workround as soon as possibile.

User avatar
odroid
Site Admin
Posts: 32364
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 147 times
Been thanked: 325 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by odroid » Wed May 08, 2019 12:03 pm

@crashoverride,
Really appreciate for making a nice workaround.
Is there any right place in the kernel to insert the reset(fbfix) function?
Is it a bad idea?

hsu95066
Posts: 51
Joined: Wed Aug 10, 2016 5:01 pm
languages_spoken: Chinese, English
ODROIDs: C1, C1+, C2, XU4
Has thanked: 3 times
Been thanked: 6 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by hsu95066 » Wed May 08, 2019 1:40 pm

@wallyz21,

I executed my application today through your workaround.
Interlaced issues with rendered images and console text still exist when my app wakes up from the screen saver.

shanti
Posts: 64
Joined: Fri Feb 15, 2019 3:12 am
languages_spoken: english, spanish
ODROIDs: Odroid N2
Has thanked: 8 times
Been thanked: 9 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by shanti » Thu May 09, 2019 1:44 am

The fbfix that @crashoverride provided helps a ton with getting the screen "unfrozen", but once a "frozen" screen happens there is screen tearing that never really goes away until you quit the program that "froze" or you reboot, which I assume is caused by what @hsu95066 mentioned about vsync.

crashoverride
Posts: 4543
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 71 times
Contact:

Re: Is the FB not refreshing issue being looked at ?

Unread post by crashoverride » Thu May 09, 2019 6:05 am

odroid wrote:
Wed May 08, 2019 12:03 pm
Is there any right place in the kernel to insert the reset(fbfix) function?
Is it a bad idea?
The right place to insert the fix would likely be libmali.so since it is the one that is setting and using the yoffset. An alternative would be to reset it when /dev/fb0 is closed in the kernel driver. However, I can not predict what side effects this would have on other programs like Kodi.
wallyz21 wrote:
Tue May 07, 2019 12:37 pm
Thanks but how do you run it if the console is frozen?
In the situation described, nothing is frozen. The console is simply not visible. The command can be typed in 'blind'.
wallyz21 wrote:
Tue May 07, 2019 12:42 pm
This stops the terminal text from coming to the foreground.
The issue would be that it does not prevent any kernel log messages from displaying.
shanti wrote:
Thu May 09, 2019 1:44 am
once a "frozen" screen happens there is screen tearing that never really goes away until you quit the program that "froze" or you reboot
Programs that use SDL may change lots of fbdev state (modes, etc). A possible resolution is to capture the fbdev state before forking another program. Then, restore the state when the program terminates. The sample code I posted demonstrates the required ioctl calls:
FBIOGET_FSCREENINFO
FBIOGET_VSCREENINFO

Alternatively, there may be an issue with libmali.so losing track of the back/front buffer (pan) and incorrectly displaying the back buffer where its rendering to instead of the front buffer.
These users thanked the author crashoverride for the post:
shanti (Thu May 09, 2019 2:27 pm)

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 1 guest