Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: rpi_fb_capture: Unable to open primary display [pi4 problem] #5

Open
kottkrig opened this issue Jan 12, 2020 · 10 comments
Open

Comments

@kottkrig
Copy link

kottkrig commented Jan 12, 2020

Expected Behavior

I'm new to Nerves and Scenic but I hoped that I could follow along the guide at An eink display with Nerves and Elixir but use an Inky wHAT instead of a pHAT.

Current Behavior

I'm unable to render the Scenic graph from the example on an Inky wHAT display. I get the error message rpi_fb_capture: Unable to open primary display.

Failure Information

I can render a checkerboard pattern (described in the tutorial) with pure Inky but the Scenic render fails.

Hardware

Config

My scenic viewport configuration and the changes I made from the original example.

config :eink, :viewport, %{
  name: :main_viewport,
  default_scene: {Eink.Scene.Main, nil}
- size: {212, 104},
+ size: {400, 300},
  opts: [scale: 1.0],
  drivers: [
    %{
      module: ScenicDriverInky,
      opts: [
-       type: :phat,
+       type: :what,
        accent: :red,
        opts: %{
          border: :black
        }
      ]
    }
  ]
}

Failure Logs

00:05:30.953 [error] Jan  1 00:05:30 rpi_fb_capture: Unable to open primary display

00:05:30.954 [error] GenServer #PID<0.31658.6> terminating
** (stop) bad return value: {:stop, :port_crashed}
Last message: {#Port<0.77607>, {:exit_status, 1}}
State: %RpiFbCapture.State{display_height: 0, display_id: 0, display_width: 0, height: 300, port: #Port<0.77607>, request: {{#PID<0.31655.6>, #Reference<0.27677081.805830660.247102>}, :rgb24}, width: 400}

00:05:30.955 [error] GenServer #PID<0.31655.6> terminating
** (MatchError) no match of right hand side value: {:error, :port_crashed}
    (scenic_driver_inky) lib/scenic_driver_inky.ex:90: ScenicDriverInky.handle_info/2
    (scenic) lib/scenic/view_port/driver.ex:215: Scenic.ViewPort.Driver.handle_info/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :capture
State: %{driver_module: ScenicDriverInky, driver_state: %{cap: #PID<0.31658.6>, color_affinity: :low, color_high: 180, color_low: 75, dithering: false, inky_pid: #PID<0.31657.6>, interval: 1000, last_crc: -1, size: {400, 300}, viewport: #PID<0.31640.6>}, viewport: #PID<0.31640.6>}

00:05:30.957 [error] GenServer #PID<0.31656.6> terminating
** (stop) bad return value: {:stop, :port_crashed}
Last message: {:EXIT, #PID<0.31655.6>, {:bad_return_value, {:stop, :port_crashed}}}
State: %{driver_module: Scenic.Driver.Nerves.Rpi, driver_state: %{clear_color: {0, 0, 0, 255}, closing: false, currently_drawing: [], debounce: %{}, dirty_graphs: [], dl_block_size: 128, dl_map: %{}, draw_busy: false, end_dl: nil, fonts: %{}, inputs: 0, last_used_dl: nil, pending_flush: false, port: #Port<0.77606>, ready: false, root_ref: nil, screen_factor: 1.0, start_dl: nil, sync_interval: 15, textures: %{}, used_dls: %{}, viewport: #PID<0.31640.6>}, viewport: #PID<0.31640.6>}

00:05:30.959 [error] dirty close
@kottkrig
Copy link
Author

I’m happy to dive deeper into the code and eventually submit a PR. But I’m unsure on where to begin.

@lawik
Copy link
Collaborator

lawik commented Jan 15, 2020

Sorry about the slow response. The GitHub notification system and I are not in agreement.

I think this could be related to some previous regression we've seen with the nerves system image missing the correct drivers that rpi_fb_capture requires to work. It was covered in this issue.

If you can give me what kind of Pi you are using and what your Nerves system version is (maybe what nerves bootstrap version you have), that'd be helpful. Also, check that thread, make sure you are on recent versions.

The fact that Inky works is reassuring. This error just means that rpi_fb_capture isn't working which we use to slurp the scenic render into Inky and onto your display. My hardware is packed for moving so I won't be able to verify the issue on my end but I'm sure we can figure it out :)

@kottkrig
Copy link
Author

Thanks for the pointers. It looks very promising. 👍

I won't be able to test it out until sometime next week but I'll be sure to update this issue with my findings.

@kottkrig
Copy link
Author

Unfortunately, I'm still getting the same error. I've tried my best to make sure I'm up to date by moving code from a new nerves_bootstrap project to my current project.

  • Elixir 1.9.4
  • OTP 22
  • Nerves bootstrap 1.7.0
  • Nerves system 1.10
  • Raspberry Pi 4
  • Inky wHat Red

Link to current commit in the project in case there is some setup info I forgot to mention: kottkrig/Restidscreen.

My next step will be to see if I can replicate the issue in a minimal test case based of nerves bootstrap. But I won't be able to do that for another week. :)

10:22:32.044 [error] Jan 25 10:22:32 rpi_fb_capture: Unable to open primary display

10:22:32.046 [error] GenServer #PID<0.25990.43> terminating
** (stop) bad return value: {:stop, :port_crashed}
Last message: {#Port<0.327035>, {:exit_status, 1}}
State: %RpiFbCapture.State{backend_name: "unknown", display_height: 0, display_id: 0, display_width: 0, height: 300, port: #Port<0.327035>, request: {{#PID<0.25956.43>, #Reference<0.3707906347.809762818.188483>}, :rgb24}, width: 400}

10:22:32.047 [error] GenServer #PID<0.25956.43> terminating
** (MatchError) no match of right hand side value: {:error, :port_crashed}
    (scenic_driver_inky) lib/scenic_driver_inky.ex:90: ScenicDriverInky.handle_info/2
    (scenic) lib/scenic/view_port/driver.ex:215: Scenic.ViewPort.Driver.handle_info/2
    (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: :capture
State: %{driver_module: ScenicDriverInky, driver_state: %{cap: #PID<0.25990.43>, color_affinity: :low, color_high: 180, color_low: 75, dithering: false, inky_pid: #PID<0.25979.43>, interval: 1000, last_crc: -1, size: {400, 300}, viewport: #PID<0.26004.43>}, viewport: #PID<0.26004.43>}

10:22:32.047 [error] dirty close

@lawik
Copy link
Collaborator

lawik commented Jan 25, 2020

Hmm, I think this might be related to the graphics driver changes for the Pi4 and them not working with the rpi_fb_capture. I will check with Frank on this.

@lawik
Copy link
Collaborator

lawik commented Jan 25, 2020

Also, I still would want to make a Scenic Driver for more primitive screens that could skip the framebuffer business. But time is a thing :P

@kottkrig
Copy link
Author

Hmm, I think this might be related to the graphics driver changes for the Pi4 and them not working with the rpi_fb_capture. I will check with Frank on this.

Alright. A valid workaround for me might be to pick up another Pi then? :D
Would a Raspberry Pi 3A+ be more reliable for this specific setup?

Also, I still would want to make a Scenic Driver for more primitive screens that could skip the framebuffer business. But time is a thing :P

It sure is. ⏳

@lawik
Copy link
Collaborator

lawik commented Jan 25, 2020

I've run it off a Pi3 and Pi Zero W, not sure I tried it with the A+ but that one works with both pi3a system and pi3 system for nerves and is well loved and supported. It should work great.

@lawik
Copy link
Collaborator

lawik commented Jan 25, 2020

Frank who maintains the rpi_fb_capture library figures the Pi 4 has some DRM API stuff that would prohibit us from accessing a framebuffer in the way that works on the older pis.
I'll edit the issue title to match the problem.

We can't really solve this right now. I have plans for a less framebuffer reliant Scenic driver that would work on the pi4.

@lawik lawik changed the title Error: rpi_fb_capture: Unable to open primary display (on Inky wHAT) Error: rpi_fb_capture: Unable to open primary display [pi4 problem] Jan 25, 2020
@kottkrig
Copy link
Author

kottkrig commented Feb 1, 2020

I can confirm that the same code works on a Raspberry Pi 3 Model A+. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants