libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
9.82k stars 1.78k forks source link

XMB GUI lag and "black bug" for boxart and dynamic wallpaper #2791

Closed lollo78 closed 5 years ago

lollo78 commented 8 years ago

Hi guys, I open this issue on Lakka issue tracker, but this is a RA issue; so, I repost here to put in evidence. Please, for any reference and bug description see here: https://github.com/libretro/Lakka/issues/262#issuecomment-167562439

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/31865291-xmb-gui-lag-and-black-bug-for-boxart-and-dynamic-wallpaper?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github).
lollo78 commented 8 years ago

Here you can see a video of the bug: https://dl.dropboxusercontent.com/u/30093753/100_0029.MP4 Please, note that all the pause that you see in not "real pause", but retroarch GUI lags. I always hold down my finger on the controller during scroll. In the video you can see also whats happens when scrolling inside a platform with a boxart images. After a while the image disappar and the GUI show only a black square. If Dynamic wallpaper is activated, also the background disappear: https://dl.dropboxusercontent.com/u/30093753/VID_20160116_231440.3gp

@fr500: please don't consider it only a "minor bug". The user experience is really compromized and the usability becomes frustrating

lollo78 commented 8 years ago

I recently informed Kivutar and (I think) he still working on a fix. But maybe he needs some help from all the guys of Retroarch family that could help on this issue. He done some commits same days ago, but they didn't fix.

I really hope to see this nasty bug solved on 1.3.5 release.

To help you to reproduce the bug, use my playlist. playlist.zip

Try to lateral scroll my playlist holding down your finger (don't lift it or do a single click) on left or right keys of the controller. You will notice a nasty lag (seems that xmb freezes for a while).

Now, activate boxarts view and try to scroll down in a platform (like n64). Also here, holding down your finger and continue to scroll down like an infinite loop, sooner or later (depends on system used: on Rpi it happens first) the images disappear and you will see only a black square. Sometimes also the icons and menu disappears. The only way is restart Retroarch. :*

RobLoach commented 8 years ago

Not happening for me on latest RetroArch build with your playlist.

kivutar commented 8 years ago

I was able to reproduce it on RPi3

lollo78 commented 8 years ago

I tried yesterday on my Rpi2 and Rp3 with commit https://github.com/libretro/RetroArch/commit/1bb8ae4a1da3aa0820bca9036b47322b29263b76 and the issue was still present. I see that @sronsse has released two new commits: https://github.com/libretro/RetroArch/commit/2b3718a86c5edf5994d3b969a0b5a7acea97d559 https://github.com/libretro/RetroArch/commit/e77599be32f931c6d147e6964c3d3e7271623846 Maybe this fix the issue? I'll try later (at home) with the latest commit available and I'll post the results here.

lollo78 commented 8 years ago

I tried the last commit ecf88d0 but the "lag bug" and the "black square bug" are always here. :(

OGWillikers commented 7 years ago

Video of the bug, since the other one isn't working. Don't have to scroll fast to cause it. I've done it by just being indecisive and taking a long time scrolling one by one.

https://youtu.be/0to3Kznk3Z4

jcreznor commented 7 years ago

Could solve this error ?, I have the same problem. Thank you if someone already solved it

brnrdbrk commented 7 years ago

This issue is still present on Lakka 2.0 RC4 with Retroarch 1.5.0 (Running on RPi3).

leokendall commented 7 years ago

having same problem on raspberry pi 3.

Lomig commented 6 years ago

As I still have this issue on a fresh install (RPi3 too), I wondered if someone found something to help with such an issue :)

RobLoach commented 6 years ago

Try disabling the Horizontal menu animations? There's been a few enhancements put in place since last year.

flapjackfiasco commented 6 years ago

Just tested on RPi3 with Horizontal Menu Animations turned off. Bug still persists. ☹️

markwkidd commented 6 years ago

This seems to affect low power devices. I have this trouble with an Amlogic S905X box and an Asus EeePC 900A but not more powerful systems that I use with RetroArch/Lakka.

MopheusDG commented 6 years ago

Same problem here on RPI3, in my case it's quite fast actually. I start moving around the playlists and the black boxes bug starts to happen pretty quickly. Not sure if it helps, but my Roms and BoxArts are on a Pen Drive connected to my Router, so it's not really very fast at all, so, maybe, could that be affecting the bug start time ? Maybe it starts faster cause it's being ignite but the slow performance of the storage location ?... just thinking....

markwkidd commented 6 years ago

What might be most helpful now is precise details to reproduce the situation, step by step.

Can this be reproduced, for example, just by downloading the Vectrex games and thumbnails from the content downloader and then browsing around?

Can it be always reproduced by starting with a fresh install and loading the NES No-Intro set, etc.

lollo78 did this a while back by providing an example playlist. an updated buggy playlist could be helpful too

OGWillikers commented 6 years ago

I haven't generated any new playlists in a few months, but the steps to reproduce seem to just be...

  1. Have a low power device such as a Raspberry Pi with a large playlist.
  2. Download and enable thumbnails or boxart.
  3. Scroll around looking for a game to play.

I'll try it out on my main gaming rig to see if I can reproduce it on a high-end Windows system when I get a chance. Might have to rubber-band the thumbstick or something.

MopheusDG commented 6 years ago

I tested on my PC (i5 with GTX1070) using Retroarch 1.7.3 and the same playlists that give me problems with RPi3 and on my PC I wasn't able to reproduce the problem. On my RPi3 takes just a couple of seconds. I have 3 playlists, GameWatch with 53 games, MAME with 500-/+ games and SNES with 235 roms. Both PC and RPi3 use the same playlists located on a network drive.

Hope it helps.

markwkidd commented 6 years ago

@Tatsuya79 I'm sorry to tag you out of the blue, but from what I can tell xmb image display is an area where you have a lot of expertise.

Tatsuya79 commented 6 years ago

I spent some time to understand how to tweak pictures in xmb but that is just that. I have no idea how memory is handled in the background if that's a problem of that kind.

markwkidd commented 6 years ago

Probably more of a file loading / memory management issue if I had to guess. Thank you for looking, anyway.

leokendall commented 6 years ago

i have reduced pictures file size and dimensions down to a few kb in size. Still same problem on the raspberry pi. Happens on a class 10 sd card and a usb drive.

TedSpinks commented 6 years ago

I have the same problem with XMB title screens using the latest version of Lakka (2.1) for Raspberry Pi 3, also using a class 10 sd card (SanDisk Ultra 64GB microSDXC UHS-I). It was driving me nuts, so I'm glad its not just me! I've tried re-imaging the sd card, and swapping Pi's, and can't seem to get this to go away. I wonder if anyone who uses thumbnails and a Raspberry PI doesn't have this issue?? As others have stated, no issues with RetroArch on my PC (exact same thumbnails).

markwkidd commented 6 years ago

Hello everyone: per twinaphex's suggestion I have made a new Issue for this problem. Hopefully we can cast some new light on it as well as start a Bounty going.

georgelouk commented 5 years ago

I have the same issue on rpi3..

dfranusic commented 5 years ago

Same here on Pi2, dynamic wallpers sometimes fail to appear and thumbnails become black boxes.

daliaetnano commented 5 years ago

Hi guys, I also have this bug for a while on my Raspberry Pi 3. That would be nice to fix it because it is really anoying.

I also would like to say that this bug is from my point of vue, the highest problem on Lakka. It makes Lakka completely unusable and each time it appears, I have to restart retroarch. Please update the criticity of this Bug. It is obviously more than a "minor" bug.

Thank you for your help.

markwkidd commented 5 years ago

@stuartcarnie you mentioned that you are using profiling tools with RetroArch on osx that are different than what's been used to investigate memory leaks in RetroArch. I just wanted to tag you in case this issue sounds like something you have a way to pinpoint.

daliaetnano commented 5 years ago

I did many tests by adding debug logs to the code to find what's going wrong. I recompiled Lakka and RetroArch on Ubuntu and uploaded the retroarch executable to test. I checked the memory usage but It seems to be ok.

The problem appears when calling video_driver_texture_load in xmb.c. I am using a raspberry Pi3 with a recycled laptop screen (from Asus N71JQ laptop) and a Display Controller.

As I noticed that the video driver is threaded, I set the video_threaded=false. It took me a few minutes scrolling up and down heavilly, to reproduce the bug. Even if it does not fix this issue, it considerably reduces the probability to reproduce the bug.

Could it be a driver issue ? Is GL the only driver available ?

daliaetnano commented 5 years ago

I found the origin of the problem. The texture_unload of the thumbnail images is done only if the replacing thumbnail images exists. If the thumbnail image does not exists the xmb->thumbnail is set to 0 (in xmb_update_thumbnail_image) and the texture can not be deleted.

The issue can be fixed by calling video_driver_texture_unload in xmb.c to unload the previous thumbnails in xmb_update_thumbnail_image.

static void xmb_update_thumbnail_image(void *data)
{
   xmb_handle_t *xmb = (xmb_handle_t*)data;
   . . .
   if (!(string_is_empty(xmb->thumbnail_file_path)))
   {
      if (filestream_exists(xmb->thumbnail_file_path))
         task_push_image_load(xmb->thumbnail_file_path,
               menu_display_handle_thumbnail_upload, NULL);
      else {
         video_driver_texture_unload(&xmb->thumbnail);
         xmb->thumbnail = 0;
      }
      . . .
   }

   if (!(string_is_empty(xmb->left_thumbnail_file_path)))
   {
      if (filestream_exists(xmb->left_thumbnail_file_path))
         task_push_image_load(xmb->left_thumbnail_file_path,
               menu_display_handle_left_thumbnail_upload, NULL);
      else  {
         video_driver_texture_unload(&xmb->left_thumbnail);
         xmb->left_thumbnail = 0;
      }

}

I could not reproduce the bug whit video-threaded=false. Unfortunately I reproduced the bug with video-threaded=true.

daliaetnano commented 5 years ago

The gl_unload_texture in gl.c is not implemented for video-threaded mode. This imply that the call to glDeleteTexture do nothing because it is not called from the thread. This consumes rapidely the memory used by the GPU and cause the black bug and the lags.

I did a test with the same implementation as for gl_load_texture in gl_unload_texture and it fixes the issue.

@kivutar @markwkidd I can implement the fix (for threaded and not threaded) for the master branch. How can I contribute ? Can I create a Pull Request with the fix ?

markwkidd commented 5 years ago

Please do submit a PR. That is the preferred way to contribute to retroarch.

On Sat, Dec 22, 2018, 12:00 PM daliaetnano <notifications@github.com wrote:

The gl_unload_texture in gl.c is not implemented for video-threaded mode. This imply that the call to glDeleteTexture do nothing because it is not called from the thread. This consumes rapidely the memory used by the GPU and cause the black bug and the lags.

I did a test with the same implementation as for gl_load_texture in gl_unload_texture and it fixes the issue.

@kivutar https://github.com/kivutar @markwkidd https://github.com/markwkidd I can implement the fix (for threaded and not threaded) for the master branch. How can I contribute ? Can I create a Pull Request with the fix ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/2791#issuecomment-449587829, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdnURh2aaBiet1_ZLCFoyPsZWmjVYks5u7nMggaJpZM4Hv_Yi .

daliaetnano commented 5 years ago

Hi @markwkidd I don't have privileges to push my fix branch and create the PR. Nano

markwkidd commented 5 years ago

Please fork this repo, then make a branch in your fork with the changes and submit that branch as a PR here.

I will write a more detailed description of this process when I'm not working on my phone :)

On Sun, Dec 23, 2018, 10:18 AM daliaetnano <notifications@github.com wrote:

Hi @markwkidd https://github.com/markwkidd I don't have privileges to push my fix branch and create the PR. Nano

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/libretro/RetroArch/issues/2791#issuecomment-449646933, or mute the thread https://github.com/notifications/unsubscribe-auth/ASphdlF9T_Qn5gPm7nnggZASzT2EA3Jdks5u76zMgaJpZM4Hv_Yi .

daliaetnano commented 5 years ago

Thank you @markwkidd, I've read the guidelines and created the PR with the fix.

orbea commented 5 years ago

So this issue is resolved now?

Edit: I suppose not...

daliaetnano commented 5 years ago

Hi @twinaphex Sorry for the inconvenience. I will test on windows next week and fix it for good.

markwkidd commented 5 years ago

@daliaetnano if your fix also resolves the bug described in this other issue (I believe they are the same issue) then there is a $170 bounty reward.

[Bounty: $170] XMB always stops displaying images with low-power/memory (rpi, Switch, Classic, others) https://github.com/libretro/RetroArch/issues/6747

hizzlekizzle commented 5 years ago

Since this has been essentially abandoned by the OP and is a duplicate of another issue with a bounty attached (https://github.com/libretro/RetroArch/issues/6747), I'm going to close this issue.

markwkidd commented 5 years ago

This version of the issue is closed so that all the conversation can take place in the better version of this issue: https://github.com/libretro/RetroArch/issues/6747