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

Resolution limitations for OpenGL ES instances? #9

Open
MakerMatrix opened this issue Sep 24, 2020 · 6 comments
Open

Resolution limitations for OpenGL ES instances? #9

MakerMatrix opened this issue Sep 24, 2020 · 6 comments

Comments

@MakerMatrix
Copy link

I have been searching for python bindings to OpenGL ES, to make a simple OpenGL image server type app that will run on a console window (no X11).

I thought pi3d was exactly what I needed. I tested the ball.py prog and it worked. But then I installed a high resolution screen with custom HDMI timings and got a stack dump on that same prog. Then I noticed that not all the demos were working even on the original 1080P screen.

What are the limitations of pi3d with respect to running an OpenGL context on the console, outside of X11? If pi3d doesn't fully support this, do you have another recommendation for me? The features I need a quite simple. 2D only, basically just blitting images to the screen and maybe applying a texture with alpha.

@paddywwoof
Copy link
Member

@MakerMatrix sorry not to get to this today. What version RPi are you running on? I think the RPi 4 with the fake KMS driver will go up to 4k screen sizes OK but you need to set the GPU memory allocation high enough (what are you set at?) It's possible to run pi3d in multiple processes (well, I managed with two) and to split images across them. The fake KMS will only work with a display surface provided by X11 but it is possible to do this from the command line with xinit so that none of the desktop stuff gets loaded. Is there a specific reason you don't want X11?

But I'm not aware of a size limitation apart from a) GPU memory b) the earlier RPis had to have Texture2d widths at certain values ...1024, 1080, 1920 (being the widest, pre-RPi 4). But pi3d will resize images to these widths automatically if they don't match.

Does the stack dump give any indication of the problem? Is there any pattern to the demos that don't work?

@MakerMatrix
Copy link
Author

No hurry, appreciate the response!

Currently testing on Pi3B. I believe I gave the GPU 128MB, I can increase that and see, thanks for the idea.
I mostly don't want X11 because I believe less is more for what I'm trying to do here. But if I have to do that, I can probably figure out how to make startx (or whatever it's called these days) not load a window manager and go straight to the Pi3D image server thingy. I had already thought of that so it's good to have confirmation that it's an option.

I'll try increasing GPU memory and if I cannot make that work will give more details about how things fail. Thanks again.

@paddywwoof
Copy link
Member

Jarrod, I would expect 128 to be big enough to be honest so it might be something else. It would be nice to get to the bottom of it.

Wolfgang has posted lots of detailed info on running pi3d without desktop (and other things) on thedigitalpictureframe.com

@MakerMatrix
Copy link
Author

MakerMatrix commented Sep 27, 2020

I'll check the link you sent, thanks. But is are the details on what I'm seeing.  This is the stack trace for ball.py when I have the hi-resolution display (Sharp SX03 vi hdmi to mipi board) hooked up:

##############################################
Traceback (most recent call last):
  File "./ball.py", line 4, in
    DISPLAY = pi3d.Display.create()
  File "/usr/local/lib/python3.7/dist-packages/pi3d/Display.py", line 570, in create
    display_config=display_config, window_title=window_title, use_glx=use_glx)
  File "/usr/local/lib/python3.7/dist-packages/pi3d/util/DisplayOpenGL.py", line 121, in create_display
    self.create_surface(x, y, w, h, layer)
  File "/usr/local/lib/python3.7/dist-packages/pi3d/util/DisplayOpenGL.py", line 325, in create_surface
    assert r
AssertionError

##############################################

The display is configured thus:

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
framebuffer_width=1440
framebuffer_height=2560
max_framebuffer_width=1440
max_framebuffer_height=2560

hdmi_pixel_freq_limit=204792000
hdmi_timings=1440 1 70 35 45 2560 1 12 2 2 0 0 0 50 0 204792000 3
#display_hdmi_rotate=90


# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=87

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
hdmi_drive=1

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d
gpu_mem=128

@paddywwoof
Copy link
Member

Well I'm not really sure but the dtoverlay=vc4-fkms-v3d looks to me like it's specifying the fake KMS driver and, for that, pi3d relies on an X11 window being there to provide a display surface, so my suspicions are tending in that direction. It's still quite a big install but there is a 'cut down' x11 driver with some of the peripheral stuff excluded some mentions here

@MakerMatrix
Copy link
Author

MakerMatrix commented Sep 28, 2020

That's in the [pi4] section and I was on a pi3. I want to believe that section gets ignored in that case. That overlay is commented out in the [all] section.

Anyway I probably have tried it both ways but maybe I've flubbed that. I have spent a lot of time learning the ins and outs of the video options on Pi platforms these past two weeks, just so I can get arbitrary hi-res screens to work at all. I now have 2560x1600 and 2560x1440 tablet screens (with HDMI->MIPI) working on both Pi3 and Pi4. Those GL drivers are still somewhat of a mystery to me though. I need to pay closer attention to them.

I have digested some of the photoframe site and it seems that project wants you to have X11 running. So I have reinstalled with the desktop version on both computers. Next is to figure out how to disable the window manager and go right into Earth.py, for example.

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