OpenGL without X on Raspberry Pi 4 (Part 1) - An external ...

文章推薦指數: 80 %
投票人數:10人

Introduction Many people wanting to use OpenGL on a Raspberry Pi will be happy to boot into the graphical desktop and use OpenGL inside an ... Anexternalmemorydump Whentheneuronsjustdon'tcutit Menu Skiptocontent Home›Uncategorized›OpenGLwithoutXonRaspberryPi4(Part 1) OpenGLwithoutXonRaspberryPi4(Part 1) PostedonFebruary3,2020bydrgeoffathome — Leaveacomment Introduction ManypeoplewantingtouseOpenGLonaRaspberryPiwillbehappytobootintothegraphicaldesktopanduseOpenGLinsideanX11window.Ifyouarenewtographicsprogrammingthenthesearenottheblogsyouarelookingfor. IfyouhavepreviouslyusedRPi0-3withoutX11thenyoumayhaveusedDispmanXtoobtainaNativeWindow.Usingavarietyofintertubesources,itnowseemsthatwiththeadventoftheRPi4,theuseoftheDispmanXlibraryhasmovedfromdiscouragedtothewrongway.Sowhatdoyouuse?Theanswerseemstobe,usetheLinuxDirectRenderingManager(DRM). IshouldfessupandletyouknowthatIhaveneverusedlibDRMbeforesothisblogisanaccountofmystumblingsaroundinthedark. KMSCube ThecanonicalOpenGLwithoutXexamplecodeisgiveninaprogramcalledKMSCube.Sourcecodeisavailableathttps://github.com/robclark/kmscubebutyoucaninstallabinaryversionusing sudoaptinstallkmscube Yourfirstinstinctwillbetotrytorun /usr/bin/kmscube whichwillfailwith drmModeGetResourcesfailed:Invalidargument failedtoinitializelegacyDRM Whatisgoingonhereisthatbydefaultkmscubetriestouse/dev/dri/card0asthedefault,whereasthehardwarewewanttouseiscard1. Pi0-3youonlyhavethevc4driver,thereforerenderisvia/dev/dri/card0.Pi4hasbothvc4forrender,andv3dfor3D.Youcanprobethedevicesfortheircapabilities–onlyoneshouldacknowledgethatithasDRIVER_RENDERorDRIVER_MODESETcapabilities.https://www.raspberrypi.org/forums/viewtopic.php?t=247540#p1511538 Noworries,kmscubehasyourback, /usr/bin/kmscube-D/dev/dri/card1 butboom! OpenGLES2.xinformation: version:"OpenGLES3.1Mesa19.3.2" shadinglanguageversion:"OpenGLESGLSLES3.10" vendor:"VMware,Inc." renderer:"llvmpipe(LLVM9.0.1,128bits)" failedtosetmode:Invalidargument Oneoftheunexpectedoutputsintheaboveisthattherendereristhesoftwarerenderer,llvmpipe,ratherthantheRaspberryPiV3Dengine.Ialsonotethatitfailedto“setmode”whichmakesmethink“permissions!”Solet’stakealookatthepermissionsofcard1andourowngroups: $ls-al/dev/dri/card1 crw-rw----1rootvideo226,1Jan3111:42/dev/dri/card1 $groups piadmdialoutcdromsudoaudiovideoplugdevgamesusersinputnetdevgpioi2cspi Thatappearstoberighttome,I’mingroupvideoandgroupvideohasread/writeaccessoncard1.HoweverifIjusthititwithahammer $sudo/usr/bin/kmscube-D/dev/dri/card1 thensuddenlyIhavethebeautifulrotatingcube. IfIlookslightlywider,Iseethat/dev/dri/renderD128isingrouprender.Addinguserpitogrouprender, $sudousermod-a-Grenderpi dothelogout/logindancetopickupthenewgroupsandsuddenlytheno-sudokmscubeworks. /usr/bin/kmscube-D/dev/dri/card1 Andthereportedinformationismorewhatyouwouldexpect OpenGLES2.xinformation: version:"OpenGLES3.1Mesa19.3.2" shadinglanguageversion:"OpenGLESGLSLES3.10" vendor:"Broadcom" renderer:"V3D4.2" InfutureblogsI’lltakealookattheactualcode. Sharethis:TwitterFacebookLikethis:LikeLoading... Related ‹AsimplelibCEC4examplefortheRaspberry Pi pvtrace(dynamicstacktrace visualisation)› Taggedwith:dispmanx,libDRM,OpenGL,raspberrypi PostedinUncategorized LeaveaReplyCancelreply Enteryourcommenthere... Fillinyourdetailsbeloworclickanicontologin: Email(required)(Addressnevermadepublic) Name(required) Website YouarecommentingusingyourWordPress.comaccount. ( Log Out /  Change ) YouarecommentingusingyourTwitteraccount. ( Log Out /  Change ) YouarecommentingusingyourFacebookaccount. ( Log Out /  Change ) Cancel Connectingto%s Notifymeofnewcommentsviaemail.Notifymeofnewpostsviaemail. Δ RecentPosts OpenGLwithoutX11onRaspberryPi4(Part 2) pvtrace(dynamicstacktrace visualisation) OpenGLwithoutXonRaspberryPi4(Part 1) AsimplelibCEC4examplefortheRaspberry Pi UsingTravis-CIonpython-compiletools RecentComments drgeoffathomeonCEC3.0.0ontheRaspberry…LiamonCEC3.0.0ontheRaspberry…LiamonCEC3.0.0ontheRaspberry…drgeoffathomeonApremadelibcec debTiloSchulzonApremadelibcec deb Archives February2020 October2018 November2016 September2015 August2015 July2015 June2015 August2014 June2014 May2014 November2013 October2013 September2013 August2013 Categories Uncategorized Meta Register Login Entriesfeed Commentsfeed WordPress.com ©2022Anexternalmemorydump ↑ BlogatWordPress.com. Privacy&Cookies:Thissiteusescookies.Bycontinuingtousethiswebsite,youagreetotheiruse. Tofindoutmore,includinghowtocontrolcookies,seehere: CookiePolicy Follow Following Anexternalmemorydump Signmeup AlreadyhaveaWordPress.comaccount?Loginnow. Anexternalmemorydump Customize Follow Following Signup Login Copyshortlink Reportthiscontent ViewpostinReader Managesubscriptions Collapsethisbar   LoadingComments...   WriteaComment... Email(Required) Name(Required) Website %dbloggerslikethis:



請為這篇文章評分?