mrworf / photoframe

Software to pull random photos from Google Photos and show them, like a photo frame
GNU General Public License v3.0
221 stars 38 forks source link

[Dadr Bullseye Branch] Unable to launch frame.py #205

Open jakemauer opened 2 years ago

jakemauer commented 2 years ago

Hey @dadr I gave your Bullseye branch a try on a Pi4 B. I was able to get everything configured but the frame service failed with the following output:

Traceback (most recent call last):
  File "/root/photoframe/./frame.py", line 196, in <module>
    frame = Photoframe(cmdline)
  File "/root/photoframe/./frame.py", line 85, in __init__
    self.validateSettings()
  File "/root/photoframe/./frame.py", line 158, in validateSettings
    current = self.displayMgr.current()
  File "/root/photoframe/modules/display.py", line 347, in current
    if self.isHDMI() and os.path.exists('/usr/bin/tvservice'):
  File "/root/photoframe/modules/display.py", line 105, in isHDMI
    return self.getDevice() == '/dev/fb0' and not display._isDPI()
  File "/root/photoframe/modules/display.py", line 299, in _isDPI
    output = debug.subprocess_check_output(['/usr/bin/tvservice', '-s'], stderr=subprocess.STDOUT)
  File "/root/photoframe/modules/debug.py", line 45, in subprocess_check_output
    return subprocess.check_output(cmds, stderr=stderr).decode("utf-8")
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/tvservice', '-s']' returned non-zero exit status 1.
  1. I can get past that by switching dt-overlay to vc4-fkms-v3d in /boot/config.txt. (Context from here: https://github.com/SvenVD/rpisurv/issues/143)

  2. I'm able to load the web config but even though I have an HDMI display connected and powered on, the config says there are no available displays and I've tried ports 1 and 2. I feel like I'm probably missing something obvious.

EDIT 3:

Anyways, thanks for your work keeping this project going.

jakemauer commented 2 years ago

So I tried switching back to the vc4-kms-v3d driver and I get this error when trying to call the tvservice binary: /usr/bin/tvservice is not supported when using the vc4-kms-v3d driver

dadr commented 2 years ago

Hi @jakemauer,

Just got back from a vacation. Thanks for trying out photoframe and providing feedback. I've been trying to get my hands on a 4B and also a Zero 2 W to work with, but have been having trouble with availability at reasonable cost. There was another person, @Decman84, who was looking at getting this to run on the 4B, but I have not heard from him for a few months. You provide some good news: that the web interface and basics seem fine on the 4B. (The current photoframe is based on stretch kernel so old it can't even boot on the 4B. I bet there are some additional parameters that need to be added to the tvservice commands to point to the proper HDMI port, and as you point out, we need to work out which video driver to load.

(The install instructions for the vc4-kms-v3d driver came from a recommendation on the DDC support page. It seems that they might not be correct for Bullseye.)

I'm curious whether you see any reasonable output before trying to set a resolution or even before photoframe starts? I think that the Pi should boot with the default resolution of the TV. Did you run the TV successfully with a plain RPI OS install?

Thanks again and Regards, Tom

shokwaav commented 2 years ago

Hi @dadr I seem to be having a similar problem as @jakemauer. I'm trying to install the v2 version from your github and also running into the same problem with starting the frame service.

I'm installing it on a raspberry 3b+ running bullseye. Changing the dt-overlay as suggested by @jakemauer enables the service to be started. However, the only display output I'm getting is a yellow screen which says "No internet connection" at the bottom. The yellow screen also shows these black bars. PXL_20220504_092626320

I've tried attaching a USB stick to the pi to load images onto the screen, but it doesn't seem to read the images either. Screenshot 2022-05-04 172810

Any help would be appreciated!

shokwaav commented 2 years ago

Oh I managed to get the display to work again.

I ran sudo raspi-configand then go to Advanced Options -> GL Driver -> Legacy.

shokwaav commented 2 years ago

So playing around with the bullseye build on my spare raspberry 4b, I'm getting the same issue as @jakemauer where the screen goes all yellow with vc4-fkms-v3d.

Disabling all drivers makes it work again (similar to the pi3b+), but I'm unable to get 4K working.

I don't mind helping out with any debugging needed.

dadr commented 2 years ago

Hi @shokwaav, Yes, you need to configure Bullseye to use the legacy driver. I have a 3b that I use to test with, and can say that it works well with that Pi. I should have added this point to the manual install instructions.

The delay you see with the USB (or Google) service is when you add it the first time. Photoframe will walk through the directory and count pictures - checking each if it's really a supported picture file instead of some other type of file. This takes more time for more pictures. However, once the service has been added initially, it should not take that long to show pictures anymore.

I really like the simple URL, try https://source.unsplash.com/featured/?nature, or https://source.unsplash.com/featured/?national,park You can put in a search term to get pictures with a theme.

Thank You for helping with debugging! The log report button should be helpful there. There should be several threads running: Web server dispatch (usually shown first and with debug.py as the last item - since that's the button you clicked on the web UI); Slideshow; shutdown; timekeeper, colormatch (photo sensor), and the root "thread."

It's also possible to start frame.py with a debug flag in order to show more information in the log report. See The readme for details, but you just stop the frame service and then manually run the frame program (as root) with --debug flag.

shokwaav commented 2 years ago

I just enabled the debug and just looking through the debug, I've noticed that it takes quite a while for the pi to resample the image to smaller resolutions - but the service doesn't cache the temp images either, so each image needs to be processed every time it's shown.

Also, if there was a way to enable 4k on the 3b would be great, I enabled it in the config but I just get a black screen when I select it in the web interface.

EDIT: So obviously resampling the photos down to a lower resolution before putting it on the USB helped a lot - but I think it would make more sense for it to not delete all the temporary files though.

dadr commented 2 years ago

You're correct about not caching re-sized images. I asked mrworf about that before, and he answered that the modifications to the image are not cached so that changes in resolution or effects would not force flushing the cache. This cache behavior optimizes against network outages, and I think mrworf primarily serves pictures from google photos. I can see your point also that caching the modified photos makes more sense when the originals are local on the USB. BTW - caching does funny things when you use the web URL. The same URL gives a different picture each time it is called, so caching tends to break that one too. I typically have caching turned off.

Tell me more about enabling 4K on a 3B - I thought it was limited to something like 15Hz refresh and that most TVs/ monitors would not show that rate. Have you learned more than that? Also, to be clear, I have a 3B, not a 3B+. I think you have the 3B+, and I think that there was a GPU upgrade between them.

shokwaav commented 2 years ago

Ah yea I have a 3B+.

I was playing around with the options here: https://forums.raspberrypi.com/viewtopic.php?f=38&t=79330

I'll play around more with it to see if I can get it working.

jakemauer commented 2 years ago

Thanks for the support and comments @dadr and @shokwaav. I haven't had time to work on the display but I'm hopefully going to get back to it this weekend and will keep you posted.

shokwaav commented 2 years ago

So I managed to get 4K working on my 3b+.

Using the code I found from here.

disable_overscan=1
framebuffer_width=3840
framebuffer_height=2160
max_framebuffer_width=3840
max_framebuffer_height=2160
hdmi_ignore_edid=0xa5000080
hdmi_pixel_freq_limit=400000000
hdmi_cvt 3840 2160 24
hdmi_group=2
hdmi_mode=87
hdmi_timings=3840 1 48 32 80 2160 1 3 5 54 0 0 0 24 0 211190000 3
gpu_mem=256

PXL_20220505_133039041

Seems the Pi overheats after a while though and throttles and I get occasional black screens. I think the combination of pushing 4k through and processing for the blur taxes the processor too much.

shokwaav commented 2 years ago

Quick update before I go to bed.

I can't seem to get the 3B+ stable on 4K output. It works for a while then the output stops working. I ordered a FLIRC case to see if it helps with the thermals but I think a 4b+ would be the way forward.

Disabling the gpu driver by commenting out the dtoverlay completely to force it to use legacy drivers gets it working. I now have overscan issues though, so I'll fiddle around with the numbers in the config.txt to see if it helps. PXL_20220505_150612385

shokwaav commented 2 years ago

Managed to get the Pi4 working.

framebuffer_width=3840
framebuffer_height=2160
hdmi_group=1
hdmi_mode=97
hdmi_enable_4kp60=1
hdmi_drive=2
config_hdmi_boost=4

and also comment out dtoverlay=vc4-kms-3d

dadr commented 2 years ago

@shokwaav that is wonderful news! Thank you so very much for sharing. (Xie xie!) Maybe this can help @jakemauer also. I’m happy to add the solution to the install instructions. Since I don’t have a Pi 4 I was worried that all the tvservices calls would need to be modified to specify a port - or some other similar gotcha that would add a lot of work to making the support complete. This is very happy.

shokwaav commented 2 years ago

Happy to say the standby and resume features work fine too!