Git Product home page Git Product logo

Comments (9)

matusnovak avatar matusnovak commented on May 25, 2024

Hi @ArtArt0

Are you using Raspberry Pi 4? How is the LCD connected to the board?

from rpi-opengl-without-x.

ArtArt0 avatar ArtArt0 commented on May 25, 2024

With the standard cable (for the official 7'' LCD). Why? It shows the console successfully.

from rpi-opengl-without-x.

matusnovak avatar matusnovak commented on May 25, 2024

Are you able to get any OpenGL output if you use only the LCD display without second HDMI screen? (I am trying to figure out if this is DRM device problem or EGL problem).

from rpi-opengl-without-x.

ArtArt0 avatar ArtArt0 commented on May 25, 2024

Yes, I have no problem with it.

from rpi-opengl-without-x.

matusnovak avatar matusnovak commented on May 25, 2024

I am not 100% sure because I haven't tried two displays, but I think you may need to call eglInitialize twice, once for the LCD display and second time for the HDMI display. As seen here: https://github.com/matusnovak/rpi-opengl-without-x/blob/master/triangle_rpi4.c#L48 with the correct EGLDisplay.

The drmModeGetResources and drmModeGetResources is used to get the EGLDisplay as shown here: https://github.com/matusnovak/rpi-opengl-without-x/blob/master/triangle_rpi4.c#L48 so I believe you should have two resources for your two displays.

Could you try iterating over the drmModeRes *resources as shown here: https://github.com/matusnovak/rpi-opengl-without-x/blob/master/triangle_rpi4.c#L28 and check if you have multiple connectors? It may be that you have two connectors that are DRM_MODE_CONNECTED. When you get the connector C structure then you can iterate over the connector->modes to get the resolution to identify the display.

from rpi-opengl-without-x.

ArtArt0 avatar ArtArt0 commented on May 25, 2024

Finally I think I figured out!

The problem was in the getDisplay(): the gbm_create_device must call only once, and the second display uses the first gbmDevice struct.

Anyway the cardX device must open once too.

from rpi-opengl-without-x.

matusnovak avatar matusnovak commented on May 25, 2024

Awesome! You would be willing to share the code? I would like to give it a try and maybe make a sample code out of it and put it here in this repository.

And yeah, the device /dev/dri/card1 is the GPU so selecting card0 would not work. I originally thought the cardX is the HDMI<->GPU port (or something like that) but I was wrong.

from rpi-opengl-without-x.

ArtArt0 avatar ArtArt0 commented on May 25, 2024

Sorry, I can not share it, but I hope it easy to implement to anyone now.

Anyway not always the card1 is the right one. You should detect with the following mode:

open card0
if not OK or getdisplay is not OK:
  open card1
  if OK:
    getdisplay

from rpi-opengl-without-x.

matusnovak avatar matusnovak commented on May 25, 2024

That's alright. I will play around with that when I get the chance and will create a sample code as well.

Closing for now.

from rpi-opengl-without-x.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.