RPI4 & Ubuntu MATE - How to enable video acceleration
文章推薦指數: 80 %
Tutorial showing how to enable hardware acceleration on Raspberry Pi 4 running Ubuntu MATE, including system configuration change, ... Dedoimedo APlacetoLearnaLotAboutaLot ≡Menu Computers Games World Art Books Cars Physics About BacktoTop ★ Computers Linux Windows Virtualization Hardware Internet Media Office UNIX Various Games Reviews Linuxgames Oldgames World Lifetopics Greatestsites Nonsense Youtubechannel Art 3Ddesign Interiordesign Linuxmaps Models Books Cars Physics RPI4&UbuntuMATE-Howtoenablevideoacceleration Updated:June27,2020 Let'sfixanotherproblem.Thisisabigone,andtechnicallyspeaking,themostimportantone. Becauseifyouintendtouse RaspberryPi4asadesktopsystem,likeIdo,then hardwareaccelerationisacriticalcomponentoftheoverallexperience.Whatthistranslatesto,in layman'sterms:smoothvideoplaybackwithlowsystemresourceutilizationandlessheating. Bydefault,eventheearlierPimodelscouldplay1080pmovieswithoutaproblem.Thismeansyou oughttogetsolidresultshere,too.However,thedefaultconfigurationisnot(currently)optimized foradesktopexperience,andwewillneedtomakeafewmanualchanges.Letmeshowyouwhatyouneed todoonthesystemlevelfirst-andthenhowtoallowFirefox,ChromiumandVLCtousehardware acceleration.Afterme. Updatesystem&installlibraries Thefirst,basicstepistoupdatethesystem: sudoapt-getupdate sudoapt-getdist-upgrade Then,youneedtoinstallafewweelibraries: sudoapt-getinstalllibgles2-mesalibgles2-mesa-devxorg-dev Configurationfiletweaks Wetalkedaboutthisinmyguideon howtofixthescreenresolutioninMATE, whereyouenduphavingeitherblackbarstopandbottom,orablackborderaroundyourdesktop,anda weirdresolutionlike1824x984insteadoffullHD1920x1080.Iwillbrieflyrepeatsomeofthestuff, forclarity. Therearetwowaysyoucandothis: Usingtheguidedtoolcalled raspi-config.However,itmaynotbepresentinMATEorwork correctly. Manuallychangethebootconfigurationfilethatisusedtosetupthesystem. Iwouldrecommendyougoforthemanualchange,becauseitalsoallowsyoutobetterunderstandwhat you'redoing.Thebootconfigurationisstoredinthefollowinglocations: 32-bitRaspberryPis(uptoModel3)under /boot/config.txt. 64-bitRaspberryPi(Model4)under /boot/firmware/usercfg.txt. OnRaspberryPi,/boot/firmware/config.txtalsoexists,butthisfiletellsyounottowritechanges toitdirectly,andtouseusercfg.txt.Atthebottomoftheconfig.txtfile,there'saninclude statement,whichwillpullallyourmanualoverridesfromtheusercfg.txtfile.Sothisiswherewe wanttomakethechange. Openthefileinatexteditorasrootorsudo: sudonano/boot/firmware/usercfg.txt Thenaddthefollowinglinesinthere: dtoverlay=vc4-fkms-v3d max_framebuffers=2 gpu_mem=128 hdmi_enable_4kp60=1 Whatwe'redoinghere,we'reenablingthe3Dvideodriver(so-calledFakeKMS),andwesetthe memoryto128MB-pleasenotethatPi4doesGPUmemorymanagementdifferentlyfrompreviousmodels, andsincethereisadiscreteprocessorforgraphics,youdon'tneedasmuchasyouwoulduseon earlierhardware. Now,therearetwootherdriversyoucantry,providedyoudon'tgetthehardwareacceleration workingasyoulike.Soinsteadofdtoverlay=vc4-fkms-v3d,youcanuse: dtoverlay=vc4-kms-v3d Orthisone: dtoverlay=vc4-kms-v3d-pi4 YoucanalsochangethememoryallocationfortheGPU,but thisisnota trivialtopic.Sowewon'tgointothatatthispoint.Justbeawarethatyouhavesomeflexibility inhowmuchmemoryyouwanttoallocate.TheamountofRAMyourPihaswillalsoplayaroleingetting thenumberright.128MBoughttobefine. MemorysplittingandCMAallocation Onemoretrickyoucandoismemorysplitting.Basically,youcantellhowmuchmemoryisallocated totheGPUandhowmuchgoestotheCPU.Normally,thememoryisallocateddynamically,butyoucando yourownsplit.Whatitactuallymeansisthatoncethisvalueiscrossed(inMB),theGPUwilleither requestmorememoryfromtheCPU,orrelinquishsomeback-thiscanleadtopotentialperformance bottlenecksduringintenseoperations,hencethesplitallowsyoutopre-optimizeforcharacteristic usecases.Youcanseethisconfigurationifyouruntheraspi-configtool,forinstance.Itallowsyou tospecifyhowmuchmemorywillbegiventotheCPU(ARM),andhowmuchtotheGPU(VideoCore). Theactualsettingisthen(eitherkmsorfkms)somethinglike: dtoverlay=vc4-kms-v3d,cma-128 dtoverlay=vc4-fkms-v3d,cma-128 Reboot&check OnceyourPibootsagain,youcancheckthat3Ddriversareloadedandworking: cat/proc/device-tree/soc/firmwarekms@7e600000/status cat/proc/device-tree/v3dbus/v3d@7ec04000/status Ifthesetwocommandsreturnokay,youhavehardwareaccelerationon.Iftheresultisdisabled,try withadifferentdtoverlayoption,reboot,andcheckagain.Pleasebeawarethatyoumaynotbeableto turnthehardwareaccelerationonforsomereason-kernelversion,missinggraphicsstackutilities, etc.Ifthathappens,justwaituntilthenextsystemupdate. EnablehardwareaccelerationinFirefox Havingyoursystemwithhardwareaccelerationisnotenough.Youalsoneedtotellindividual programstouseit.Forwhateverreason,neitherFirefoxnorChromiumhavetherightflagssetby default.InFirefox,youcancheckthestatuswithabout:support.GotoGraphicsandchecktheline thatreads Compositing.Ifthevalueis Basic,youdonothavehardwareaccelerationenabled. Tooverride,gotoabout:config,andsearchforthefollowingkey: layers.acceleration.force-enabled Andtoggleitto true.RestartFirefox.Opentheabout:supportpage.TheCompositingfield shouldhavethevalueOpenGL.Nowyoucanwatchvideosasintended. EnablehardwareaccelerationinChromium Similarly,ifyouchoosetouseChromium,itwillinitiallyreportnoHWaccelerationunder chrome://gpu.Wecanchangethatthroughchrome://flags.Whatyouwantis Overridesoftwarerenderinglist,andchangethesettingtoEnabled. PleasenotethatsomeoptionswillstillreadDisabledorSoftwareonly.Thisisbecausesomeof thesearehardware-dependent(ifyouhavesayWindowsandNvidiagraphics,dothesamecheck,forfun), andsomeofthesedependonOpenGL3.0.Tothebestofmyknowledge,RaspberryPionlysupportsOpenGL 2.1. EnablehardwareaccelerationinVLC Thisisthesimplestofthethree.Tools>Preferences.ClickonVideo.UnderVideoSettings> Output,selectOpenGLvideooutput.Pleasenotethatifyou'retryingthisonarandomdistributionof choice,orifVLChasnotbeencompiledwithOpenGL,thiswon'twork,regardlessofwhatyourplatform supports. Testing&results Andnow,youneedtoactuallyfireupsomenicevideocontentandseewhatgives. Conclusion Ibelievethatovertime,theseissueswilldisappear,andyouwon'tbeneedingthisguide.Well,I hopeso.LookingatUbuntuMATE-butalsoRaspberryPiOS,thedefaultsarenotdesignedwithtoomuch focusfordesktopusejustyet.That'sunderstandable,butforanyonewhodoesseektousethePiasan ordinarymouseandkeyboardsystem,thismeansalotofextrawork. Hopefully,thistutorialhasallthepiecesyouneedtohaveanenjoyablemultimediaexperience.In thenextarticleinthisseries,wewilldiscuss,youguessedit,audio,asecondandjustascritical component.Thatwouldbeallfornow,staytuned. Cheers. Youmayalsolike: About Contact FAQ Terms Advertise Support Subscribe Home Top Valid HTML CSS RSS CCBY-NC-ND4.0@Dedoimedo2006-2022
延伸文章資訊
- 1Raspberry Pi 4: Hardware accelerated video decoding (GPU ...
DIY: Video Decode using Hardware Acceleration · Start the raspi-config configurator, typing in a ...
- 2How To Enable Hardware Acceleration ... - Linux Uprising Blog
This article explains how to enable hardware acceleration in Chromium browser running on Raspberr...
- 3RPI4 & Ubuntu MATE - How to enable video acceleration
Tutorial showing how to enable hardware acceleration on Raspberry Pi 4 running Ubuntu MATE, inclu...
- 4Chromium 88 hardware acceleration [solved] - Raspberry Pi ...
I am on Raspberry Pi OS with the latest updates. When i go to chrome://gpu, "video decode" says "...
- 5Raspberry Pi 4 hardware acceleration : r/openSUSE - Reddit
Hi, Is it currently possible to have 3D and video hardware acceleration on the Raspberry Pi 4 yet...