mameau%CWD%:> █
OFFLINE
$ cat rpi4desktop.txt
Testing a RPI as daily driver desktop

Replacing a dead i2700K / Radeon RX580 / 16GB DDR3 temporarily

Version 0x01
@sairukau

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

- System administration
  - ssh (terminal)
  - remote desktop (remmina)
  - vnc (remmina)
- Web browsing using Firefox (yes i'm a FF user)
  - depends web browser
- IRC
  - depends ssh
- Social Media
  - depends web browser
- 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
Dual Head on HDMI

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

Shintaro (powered) USB HDD Dock

3x USBs consumed
 2x USB 2.0
 1x USB 3.0

Ethernet

Bose Quiet Comfort over Bluetooth (not connected yet)

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

Noobs shipped with RPi 
- Raspbian OS

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

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

The rest is deployed through ansible (locally)

Window Manager
- XFCE

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

===============================================================================
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


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
 Audio
 - Doesn't work through 3.5mm jack (raspi-config), HDMI audio OK
 
 
 Firefox
 This is an absolute 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
 
 
 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

 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
 

===============================================================================
Customisations
===============================================================================
HDMI
 This is really specific to my setup being the screens are both different but I
 and 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

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

 I am also testing the display-setup-script influence on the above HDMI layout
 issue,

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

===============================================================================
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 seem 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.accelration.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
===============================================================================

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

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-gtk2
 $ 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


===============================================================================
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

Emulation
 Have a bit interest in emulation performance

???

===============================================================================
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 is of my FBNeo dat pipeline is
 like on this hardware, it would need to be converted to compile the arm
 versions to generate the dats

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

Webcam 
 Logitech C910 Webcam performance