imx8mp OpenGL without display

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8mp OpenGL without display

1,586 Views
KobusGvid
Contributor III

Is there a way to get OpenGL to work while running in headless mode (without connecting a display)?
I'm running a imx8mp with an fsl-xwayland based image. I know PGU et-al are configured correctly in my devicetree as I can get a display working when connected. If I try to run a simple gstreamer pipeline like this:

gst-launch-1.0 videotestsrc ! video/x-raw,format=NV12,width=1920,height=1080 ! queue ! glupload ! glcolorconvert ! gldownload ! video/x-raw,format=RGB ! queue ! fakesink

I get the following error: 

Got context from element 'gldownloadelement0': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayWayland\)\ gldisplaywayland0";
ERROR: from element /GstPipeline:pipeline0/GstGLUploadElement:gluploadelement0: Failed to perform a wayland roundtrip

 

My system is set up to use remote-x server via SSH, but even then I get nothing.

Is there some XDG variable to set? or is there a way to get a fake framebuffer or something?

0 Kudos
Reply
7 Replies

611 Views
KobusGvid
Contributor III

So to answer my own question for anyone else coming here: 

I could get the GPU working and perform gstreamer glupload/glshader etc commands by: 
- Loading VKMS kernel module for a virtual display

- setting renderer=gl and disabling "g2d" in westom.ini. 

 

With these chnages weston starts up, and I have opngl commands. 

Interestingly, I was able to verify that OpenCL works fine even when weston is offline. Unfortunately the performance of anything in OpenCV using UMat's and the T-API didn't improve vs a normal matrix. It does seem to be much faster than a simple element wise multiplication for example in C, so that's probably down to the ARM-Neon acceleration in OpenCV.  

0 Kudos
Reply

1,573 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

Please try this again:

$ DISPLAY=:0 gst-launch-1.0 videotestsrc ! video/x-raw(memory:NVMM),width=1920,height=1080, 'video/x-raw,width=1920, height=1080 ! xvimagesink sync=0

 

Regards

0 Kudos
Reply

1,569 Views
KobusGvid
Contributor III

I get the following:

WARNING: erroneous pipeline: could not link videotestsrc0 to xvimagesink0, neither element can handle caps video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080

Am I missing a kernel config?

0 Kudos
Reply

1,565 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

That's is not an error, your system should be running without display.

Regards

0 Kudos
Reply

1,529 Views
KobusGvid
Contributor III

so does they teach us anything? Do you have any other ideas what could be causing the issue?

Tags (1)
0 Kudos
Reply

1,395 Views
ugurkurt
Contributor I

 

Hi there, I encountered the same issue on my i.MX8M board. What worked for me was adding the weston, weston-init, and weston-xwayland packages to my Yocto image, which completely resolved the display errors. Additionally, I set the XDG_RUNTIME_DIR environment variable using the following command: 
export XDG_RUNTIME_DIR=/run/user/$(id -u)

I hope this helps you resolve your issue as well!

0 Kudos
Reply

1,383 Views
KobusGvid
Contributor III

thanks ugurkur, but that doesn't seem to help. 

If I check `echo $XDG_RUNTIME_DIR` I get "/run/user/0", so that seems fine. 

And according to my manifest I have all the packages you mentioned. Still I cant get OpenGL to work.

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2047350%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eimx8mp%20OpenGL%20without%20display%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2047350%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EIs%20there%20a%20way%20to%20get%20OpenGL%20to%20work%20while%20running%20in%20headless%20mode%20(without%20connecting%20a%20display)%3F%3CBR%20%2F%3EI'm%20running%20a%20imx8mp%20with%20an%20fsl-xwayland%20based%20image.%20I%20know%20PGU%20et-al%20are%20configured%20correctly%20in%20my%20devicetree%20as%20I%20can%20get%20a%20display%20working%20when%20connected.%20If%20I%20try%20to%20run%20a%20simple%20gstreamer%20pipeline%20like%20this%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Egst-launch-1.0%20videotestsrc%20!%20video%2Fx-raw%2Cformat%3DNV12%2Cwidth%3D1920%2Cheight%3D1080%20!%20queue%20!%20glupload%20!%20glcolorconvert%20!%20gldownload%20!%20video%2Fx-raw%2Cformat%3DRGB%20!%20queue%20!%20fakesink%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EI%20get%20the%20following%20error%3A%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EGot%20context%20from%20element%20'gldownloadelement0'%3A%20gst.gl.GLDisplay%3Dcontext%2C%20gst.gl.GLDisplay%3D(GstGLDisplay)%22%5C(GstGLDisplayWayland%5C)%5C%20gldisplaywayland0%22%3B%0AERROR%3A%20from%20element%20%2FGstPipeline%3Apipeline0%2FGstGLUploadElement%3Agluploadelement0%3A%20Failed%20to%20perform%20a%20wayland%20roundtrip%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EMy%20system%20is%20set%20up%20to%20use%20remote-x%20server%20via%20SSH%2C%20but%20even%20then%20I%20get%20nothing.%3C%2FP%3E%3CP%3EIs%20there%20some%20XDG%20variable%20to%20set%3F%20or%20is%20there%20a%20way%20to%20get%20a%20fake%20framebuffer%20or%20something%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2047350%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EGraphics%20%26amp%3B%20Display%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ei.MX%208M%20%7C%20i.MX%208M%20Mini%20%7C%20i.MX%208M%20Nano%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELinux%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMultimedia%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EYocto%20Project%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2149293%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx8mp%20OpenGL%20without%20display%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2149293%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ESo%20to%20answer%20my%20own%20question%20for%20anyone%20else%20coming%20here%3A%26nbsp%3B%3C%2FP%3E%3CP%3EI%20could%20get%20the%20GPU%20working%20and%20perform%20gstreamer%20glupload%2Fglshader%20etc%20commands%20by%3A%26nbsp%3B%3CBR%20%2F%3E-%20Loading%20VKMS%20kernel%20module%20for%20a%20virtual%20display%3C%2FP%3E%3CP%3E-%20setting%20renderer%3Dgl%20and%20disabling%20%22g2d%22%20in%20westom.ini.%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EWith%20these%20chnages%20weston%20starts%20up%2C%20and%20I%20have%20opngl%20commands.%26nbsp%3B%3C%2FP%3E%3CP%3EInterestingly%2C%20I%20was%20able%20to%20verify%20that%20OpenCL%20works%20fine%20even%20when%20weston%20is%20offline.%20Unfortunately%20the%20performance%20of%20anything%20in%20OpenCV%20using%20UMat's%20and%20the%20T-API%20didn't%20improve%20vs%20a%20normal%20matrix.%20It%20does%20seem%20to%20be%20much%20faster%20than%20a%20simple%20element%20wise%20multiplication%20for%20example%20in%20C%2C%20so%20that's%20probably%20down%20to%20the%20ARM-Neon%20acceleration%20in%20OpenCV.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2056407%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx8mp%20OpenGL%20without%20display%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2056407%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Ethanks%20ugurkur%2C%20but%20that%20doesn't%20seem%20to%20help.%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20check%20%60echo%20%24XDG_RUNTIME_DIR%60%20I%20get%20%22%2Frun%2Fuser%2F0%22%2C%20so%20that%20seems%20fine.%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20according%20to%20my%20manifest%20I%20have%20all%20the%20packages%20you%20mentioned.%20Still%20I%20cant%20get%20OpenGL%20to%20work.%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2056260%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx8mp%20OpenGL%20without%20display%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2056260%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CBR%20%2F%3E%3CP%3EHi%20there%2C%20I%26nbsp%3Bencountered%20the%20same%20issue%20on%20my%20i.MX8M%20board.%20What%20worked%20for%20me%20was%20adding%20the%20%3CSTRONG%3Eweston%3C%2FSTRONG%3E%2C%20%3CSTRONG%3Eweston-init%3C%2FSTRONG%3E%2C%20and%20%3CSTRONG%3Eweston-xwayland%3C%2FSTRONG%3E%20packages%20to%20my%20Yocto%20image%2C%20which%20completely%20resolved%20the%20display%20errors.%20Additionally%2C%20I%20set%20the%20%3CSTRONG%3EXDG_RUNTIME_DIR%3C%2FSTRONG%3E%20environment%20variable%20using%20the%20following%20command%3A%26nbsp%3B%3CBR%20%2F%3E%3CSPAN%3E%3CSPAN%20class%3D%22%22%3Eexport%3C%2FSPAN%3E%20XDG_RUNTIME_DIR%3D%2Frun%2Fuser%2F%24(%3CSPAN%20class%3D%22%22%3Eid%3C%2FSPAN%3E%20-u)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EI%20hope%20this%20helps%20you%20resolve%20your%20issue%20as%20well!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2048433%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx8mp%20OpenGL%20without%20display%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2048433%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3Eso%20does%20they%20teach%20us%20anything%3F%20Do%20you%20have%20any%20other%20ideas%20what%20could%20be%20causing%20the%20issue%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2047500%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx8mp%20OpenGL%20without%20display%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2047500%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThat's%20is%20not%20an%20error%2C%20your%20system%20should%20be%20running%20without%20display.%3C%2FP%3E%0A%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2047490%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx8mp%20OpenGL%20without%20display%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2047490%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20get%20the%20following%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EWARNING%3A%20erroneous%20pipeline%3A%20could%20not%20link%20videotestsrc0%20to%20xvimagesink0%2C%20neither%20element%20can%20handle%20caps%20video%2Fx-raw(memory%3ANVMM)%2C%20width%3D(int)1920%2C%20height%3D(int)1080%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EAm%20I%20missing%20a%20kernel%20config%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2047456%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx8mp%20OpenGL%20without%20display%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2047456%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%0A%3CP%3EPlease%20try%20this%20again%3A%3C%2FP%3E%0A%3CP%3E%24%20DISPLAY%3D%3A0%20gst-launch-1.0%20videotestsrc%20!%20video%2Fx-raw(memory%3ANVMM)%2Cwidth%3D1920%2Cheight%3D1080%2C%20'video%2Fx-raw%2Cwidth%3D1920%2C%20height%3D1080%20!%20xvimagesink%20sync%3D0%20%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%3C%2FP%3E%3C%2FLINGO-BODY%3E