mameau%CWD%:> █
OFFLINE
$ cat article_0x05.txt
Testing a RPI as daily driver desktop (2020-12)       version 0x05 -- @sairukau

       Replacing a dead i7 2600K / Radeon RX580 / 16GB DDR3 temporarily

===============================================================================
Changelog
===============================================================================
v0x05  Tested out chiaki (PS4 remote play)
       Gave up on thunderbird and went back to mutt
v0x04  Fleshed out social media approach, primarily use bitlbee w/irssi already
       Compiled ckb-next and disabled keyboard rgb
       Figured out support for Mute/Volup/VolDown media keys
       Looking into IDEs normally use vim but was investigating vscodium when 
       the i7 bit it and vscodium has an arm deb available, wow
       Tested minetest and doco'd some FPS notes
v0x03  Remove firefox-esr and use chromium-browser
       browserpass extension for chromium-browser
       profile manager wrapper for chromium
       chromium-browser settings info listed
       Logitech C910 webcam tested
       found media keys aren't working on keyboard
v0x02  Connected up Bose QC35s through BT
       Applied fix for 3.5mm jack output with 2 HDMI displays
       Added speaker and sd card info
       Confirmed lightdm display config carries through to xfce session
       Fixed typo for pinentry (probably more)
v0x01  Initial Publication

===============================================================================
Expected Use cases
===============================================================================

- System administration
  - ssh (terminal)
  - remote desktop (remmina)
  - vnc (remmina)
- Developement work
  - python
  - bash
  - compiling (probably do this on vm now)
- Web browsing using Firefox (yes i was a FF user)
  - depends web browser
- Chat
  - IRC (irssi)
  - Gajim 
  - Skype
  - Hangouts
- Social Media
  - depends web browser and/or bitlbee
  - discord, no arm app (so see line above)
- Watching Streaming service: youtube, twitch
  - depends web browser
- NFS mount remote fs through automount
- Local s/hdd media from dock
  - performs OK, nothing much to report here
- Gaming
  - not sure how far we'll push this, considr it light-gaming
  - might consider steamlink to a remote machine (doesn't exist yet)
- Wine applications
  - might have to offload to a remote (pre-existing) windows VM

===============================================================================
Setup
===============================================================================

RPI4 4G

Dual Head on HDMI

Corsair Keyboard/Mouse (RGB :/)
- USB Keyboard
- USB Mouse

Shintaro (powered) USB HDD Dock

4x USBs consumed
 2x USB 2.0 k/m
 2x USB 3.0 hdd/webcam

Ethernet

Bose Quiet Comfort 35 over Bluetooth

2x 32" FullHD (cheap) TVs
- 1x Sanyo (Native: 1920x1080_60)
- 1x Dick Smith (Native: 1360x768)

External Logitec speaker set 1sub+2t 3.5mm jack

32GB SD Card (shipped with RPi)

Noobs (shipped with RPi)
- Raspbian OS (Full)

===============================================================================
Changes
===============================================================================

OS Changes
- Install python3 and set as default
- Install ansible

The rest is deployed through ansible (locally)

Window Manager
- XFCE
- menulibre

Software
 $HOME/devel/ansible/raspbian/packages.yaml

===============================================================================
Migration
===============================================================================
I am looking to migrate from a dead i7 2600K setup temporarily so i'm only 
going to bring across some previous settings from my old environment

- Ansible playbooks
  - no issue
- XFCE
  - no issues
- Firefox
  - see Usage section
- Thunderbird
  - see Usage section
- SSH
  - no issues
- GNUPG
  - see Configuration section
- pass password store
  - see gnupg
- gajim
  - no issues
- social media and chat
  - a lot of networks are integrated with irssi using bitlbee
    - twitter, skype, steam, hangouts, discord, mastadon
  - any others can be used in chromium-browser (ff-esr lagged out)
- Automounts NFS
  - migrated configuration without issue
  - mounts to NAS are up

===============================================================================
Usage
===============================================================================

Keyboard/Mouse
 Intermittent issues on reboot enumerating the USB devices leaves then
 non-working in the OS works find in recovery mode though. Have to reinsert the
 devices a few times on occasion. Seems to only on a cold boot
 
 the ckb-next software isn't available in the raspbian repo so i'm stuck with
 idiotic rgb until i see if i can get that build for raspbian
 
 ckb-next: https://github.com/ckb-next/ckb-next/wiki/Linux-Installation

 ckb-next compiled without issue following the standard debian instructions
 Installed, migrated over settings and started ckb ... no issues

 media keys don't work

 - Created custom wrapper for patcl
 - Added custom keyboard shortcuts for 
   - XF86AudioLowerVolume
   - XF86AudioRaiseVolume
   - XF86AudioMute

 Noted the pulse plugin applet is laggy

Screens
 RPI will only boot with screens configured as
 - HDMI-1 Dick Smitch
 - HDMI-2 Sanyo

HDMI
 Text is horrible to read over HDMI on these screens, i knew this going in after
 experimenting on my HTPC years ago. Normally i run VGA on these screens and
 tweak the Modelines
 
 Have purchased some UGREEN Active MicroHDMI to VGA adapters to test

Default Performance
 Desktop
 - Laggy and almost unusable with 2 displays
 - Nothing is accelerated by default
 Web Browsing
 - Comes with chromium, i cannot migrate my setup to chromium from FF
 - Turns out firefox-esr wouldn't import profiles
 Audio
 - Doesn't work through 3.5mm jack (raspi-config), HDMI audio OK
 
 Firefox
 This is an absolutely horrible experience, firefox-esr is available this is 
 based on (currently) Firefox 78. Video playback is non-functional, audio cuts 
 out, sites do not function. 

 So for some key complaints
 - Sites display in the mobile version, can be fixed with a custom UA
 - Amazon.com does not function on this older browser, can be fixed with a custom UA
 - Audio works then cuts out and I haven't found a way to restore
 - Video playback never starts on youtube but did on twitch
 - Migrating profile across from the desktop release is impossible because the
   version is too old all profiles needed to be recreated

 ** ended up removing firefox-esr all together
 
 Chromium
 This is not a browser i'm used too and I can't import my profiles across easily
 atm but it seems to function OK in general compared with Firefox so its
 probably a preferable option in the long run

 Thunderbird
 - Seems to perform horribly but would not find my existing settings so I need
   to revisit this
 - Using imap anyway so i may return to Mutt as my daiy driver
 - Gave up on this, it wouldn't import the existing profiles and I have better
   things to do

 VLC
 - Can playback twitch/youtube streams
 - Consumes a ridiculous amount of CPU decoding (even hardware accellerated in
   theory)

 Storage performance
 This is over USB 3.0, I haven't completed any specific tests but it seems
 reasonable enough for general use.

 Network Performance
 Works well enough need to do some specific tests, speedtest results are
 comparable to my desktop results

  $ speedtest-cli --simple
  Ping: 16.382 ms
  Download: 273.90 Mbit/s
  Upload: 41.90 Mbit/s

Development
 Normally use vim for developerment in general but I had started to look into
 transitioning to codium the unbranded port. So to pickup where I left off ...

 vscodium is actually build for armhf which will run on the pi4, this was
 suprising to say the least. performance seems OK generally but I'm not doing
 too much with it yet

 get the latest armhf deb build from 
 https://github.com/VSCodium/vscodium/releases/latest

 # dpkg -i 

===============================================================================
Customisations
===============================================================================

HDMI
 This is really specific to my setup being the screens are both different but I
 am ignoring the EDID of the displays to get them both up on 1920x1080.

 # vi /boot/config.txt

 add this line, nfi what the 0xa5000080 represents for this setting atm

 hdmi_ignore_edid=0xa5000080

 Both displays come up at 1920x1080 after this without additional modelines

 The displays based on the boot issue are mapped incorrectly so I run the
 following to correct it.

 $ xrandr --output HDMI-2 --primary --left-of HDMI-1

 NB: .xprofile does not run atm so putting it there makes no difference

 You can work around this issue but configuring script that lightdm runs at
 startup once the screens are configured it carries through the xfce

 # vi /etc/lightdm/lightdm.conf
 display-setup-script=

Window Manager
 I wanted to use XFCE not LXDE so had to configure lightdm to run the session.
 I know you can configure lightdm to allow user selection but that isn't
 necessary in this case

 # vi /etc/lightdm/lightdm.conf

 set the following

 session-wrapper=xfce4-session

 Use display-setup-script to setup your screens through xrandr see
 Customisations -> HDMI.

Python 3
 Replaced python2 with python3 ... time to catch up

 # apt-get install python3
 # update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
 # update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
 # update-alternatives --config python

Audio
 3.5mm jack output fixed by applying a custom udev ruleset from
 - https://ubuntu-mate.community/t/3-5mm-audio-output-not-working-on-rpi4-with-20-04/22456/7 

 # vi /etc/udev/rules.d/79-rpi-pulseadio-fixes.rules

 Rule content
  SUBSYSTEM!="sound*", GOTO="end"
  ACTION!="change", GOTO="end"
  KERNEL!="card*", GOTO="end"
  
  # remove the 'internal' sound form factor, so more descriptive
  # names are used in pulseaudio for bcm... entries
  ENV{SOUND_FORM_FACTOR}=="internal", ENV{SOUND_FORM_FACTOR}=""
  
  # uncomment to ignore audio sink on HDMI1, even if present, so that
  # headphones + HDMI0 audio will work in pulseaudio - temporary workaround
  ATTRS{id}=="b2", ENV{PULSE_IGNORE}="1"
  
  LABEL="end"

 Then enter the mixer and turn on Analog Mono Output for bcm2835 Headphones

 Not sure why its mono, perhaps its a limitation of the jack.

Removed the default pi user

===============================================================================
Accelation
===============================================================================

Configuring Accelartion
 There is only the fake kms driver available and i'm not particularly across
 the vulkan support etc that is supposed to be coming, the rpi foundation 
 really doesn't seem to give a crap about real desktop performance on this 
 device because all the effort seems to be one man shows and not a roadmapped
 effort.

 This setup isn't terrible and make a distinct different to performance once
 completed.

 These references aren't exactly what i had to do but lets run with it and I'll
 doco my stuff thereafter, e.g. dont enable 4k support.

 References:
 - https://www.dedoimedo.com/computers/rpi4-ubuntu-mate-hw-video-acceleration.html 

 Setup acceleration
 # vi /boot/config.txt

 Add the following

 ## 4k support
 #hdmi_enable_4kp60=1

 ## fake kms
 dtoverlay=vc4-fkms-v3d 
 #dtoverlay=vc4-fkms-v3d-pi4
 ## real kms need to test
 #dtoverlay=vc4-kms-v3d
 #dtoverlay=vc4-kms-v3d-pi4

 # nfi need to look into it
 max_framebuffers=2

 # memory for GPU, 512 was crap
 gpu_mem=128
  
 Reboot and test

 # cat /proc/device-tree/soc/firmwarekms@7e600000/status
 # cat /proc/device-tree/v3dbus/v3d@7ec04000/status

 both should return "okay"


Configure acceleration in Applications
 Firefox
  about:config
  layers.acceleration.force-enabled -> true
 Chromium
  chrome://flags
  Override software rending list -> Enabled
 VLC
  Tools -> Preferences -> Video -> OpenGL video output
  NB: i'm not convinced the fkms driver actually offloads this I was seeing 400%
  CPU usage on twitch streams in top which is 100% usage on every core


===============================================================================
Post Acceleration Performance - fkms (fake kms)
===============================================================================

Firefox
 Video playback starts on youtube and twitch but hdmi audio cuts out pretty
 quickly

Chromium
 Video playback is near perfect on both platforms
 Amazon works

VLC
 As per the accelation config section, i'm not convinced the fkms achieves
 anything of note here

Gaming
 See dedicated section 

===============================================================================
Configuration
===============================================================================

gpg-agent (for pass)
 the configured pinentry program wasn't available on the rpi this presented as
 a "no secret key available" error which is shiteful but a list-secret-keys
 showed the key for decryption was available and could be confirmed by checking
 the ~/.password-store/.gpg-id entry

 Was gnome3, now gtk2
 
 $ vi ~/.gnupg/gpg-agent.conf
 pinentry-program /usr/bin/pinentry-gtk-2
 $ gpg-agent kill-agent bye

 or

 update-alternatives --config pinentry


bluetooth
 no applet available, not the end of the world but annoying from a desktop
 perspective

 # apt-get install blueman pulseaudio-module-bluetooth
 $ pactl load-module module-bluetooth-discover
 $ mkdir ~/.config/autostart
 $ ln -s /usr/bin/blueman-applet ~/.config/autostart/
 # service restart bluetooth

remmina
 Migrated settings without issue
 Performance seems on par with what I remember on the desktop OS (rdp)

===============================================================================
Replace firefox(-esr) with chromium-browser
===============================================================================
As a longtime firefox user this is a fair undertaking, need 
 - multiple profiles
 - pass intergration
 - proxy support
 - DOH support

chromium-browser
 integration with pass needs
 - browserpass ext
 - browserpass native messager (not available for arm 32b)

pass integration (browserpass extension)
 - install golang
   
 # apt-get install golang

 - add arm compilation support: https://github.com/sairuk/browserpass-native

 $ git clone https://github.com/sairuk/browserpass-native.git
 $ make browserpass-arm
 $ make BIN=browserpass-arm configure
 $ sudo make BIN=browserpass-arm install

 - add the extension in chromium

Multiple Profiles
 mimic firefox's profile screen
 will be handled at launch with custom profile browser written in tk

 will leverage --user-data-dir=DIR optiona

 profiles are now handled by a custom wrapper chromium-profile (bash/zenity)

Proxy support
 must be handled on launch by the command line
 see external multiple profiles solution

 e.g. --proxy-server=socks5://127.0.0.1:9050

DOH Support
  Needs to be configured via "Secure DNS Lookups"
  chrome://flags/#dns-over-https

  Doesn't work like firefox, still uses OS DNS anyway upgrades if recognized

General settings

 Some notes for myself where settings are when as opposed to FF

 chrome://settings

 Start-up
 - Browser to a specific page -> per Profile

 Sync and Google service
 Other Google services
 - Allow Chromium sign-in  -> Off

 Search Engine
 - Search engine used in the address bar -> DuckDuckGo

 Passwords 
 - Offer to save passwords -> Off
 - Auto Sign-in            -> Off

 Security
 - Safe browsing           -> Standard Protection

 Cookes and other site data
 - Block third-part cookies                           -> On
 - Send a 'Do Not Track' request                      -> On
 - Clear cookes and site data when you quite Chromium -> per Profile

===============================================================================
Gaming
===============================================================================

Not expecting anything much in regards to this, most games will not run on arm
and Steam is not available for arm but Steamlink is so that may be a possiblity

Box86
 I've played with this before its an interesting product may investigate whats
 available here

Steamlink
 Its available for pi and I have a laptop lying around that runs Steam
 currently

 ** have run out of usb ports for the SL adapter

Emulation
 Have a bit interest in emulation performance

Minetest
 Use as an fps benchmark maybe?
 - 800x600   windowed   ~25fps  (default)
 - 1280x720  windowed   ~23fps
 - 1920x1080 Fullscreen ~17fps

Chiaki (PS4 Remote play)
 Well this is something i never would have expected to be possible but with
 some massaging chiaki compiles for the rpi albeit without sound. The
 recommended fork is from zerojay.

 https://github.com/zerojay/chiaki

 After a successful compilation the binary will end up in 

 /build/gui/

 Sound requires an upgrade to QT, upgrade to 5.12 and patch chiaki and
 recompile (ta RedMarsBlueMoon)

 Install Qt5.12 from https://github.com/koendv/qt5-opengl-raspberrypi

 # wget https://github.com/koendv/qt5-opengl-raspberrypi/releases/download/v5.12.5-1/qt5-opengl-dev_5.12.5_armhf.deb
 # apt install ./qt5-opengl-dev_5.12.5_armhf.deb

 Add QT_SELECT to your bashrc
 $ vi ~/.bashrc 
 export QT_SELECT=qt5-opengl

 Recomile (noting that cmake will complain about directory conflicts)

 Map the qt5 libraries into the chiaki dir so they use the 5.12 version

 $ ldd ./chiaki | grep -i qt

	libQt5Multimedia.so.5 => /usr/lib/qt5.12/lib/libQt5Multimedia.so.5 (0xb6e51000)
	libQt5OpenGL.so.5 => /usr/lib/qt5.12/lib/libQt5OpenGL.so.5 (0xb6e0b000)
	libQt5Svg.so.5 => /usr/lib/qt5.12/lib/libQt5Svg.so.5 (0xb6dc4000)
	libQt5Network.so.5 => /usr/lib/qt5.12/lib/libQt5Network.so.5 (0xb546a000)
	libQt5Widgets.so.5 => /usr/lib/qt5.12/lib/libQt5Widgets.so.5 (0xb4f4e000)
	libQt5Gui.so.5 => /usr/lib/qt5.12/lib/libQt5Gui.so.5 (0xb4a55000)
	libQt5Core.so.5 => /usr/lib/qt5.12/lib/libQt5Core.so.5 (0xb4560000)

 $ sudo make install

 Runs fine, set it to 720p/30fps
 
===============================================================================
Wine Applications
===============================================================================
I need to run Clrmame Pro or an equivilent but that may need to be offloaded to
an external host



===============================================================================
Extra Credit
===============================================================================
Just some additional items to potentially test

Docker FBNeo Dat infrastructure
 Might be interesting to see what the performance of my FBNeo dat pipeline is
 like on this hardware, it would need to be converted to compile the arm
 versions of fbneo to generate the dats

Filer
 A python/mysql based file database that supports external media, this will 
 function but the performance should be an interesting test

Webcam 
 Logitech C910 Webcam performance
 Works perfectly fine in discord test area, no noticable lag