Optimizing Responsiveness on Raspberry Pi 4B (4GB RAM)?

Hello,

I’ve got a 1080p TV hooked up to the Pi, and everything appears to be working just fine, as far as the display actually outputting.

There’s no Xorg conf file for the TV–everything appears to be happening inside xfconf, which I admittedly don’t know fully how to use yet. XFCE correctly identifies my TV as a Sony model, supporting 1080p60 with the wireless HDMI kit I’m using.

However, redrawing the screen and doing certain other things is sometimes unbearably slow. I am concerned that I don’t have the correct graphics drivers installed. Nor do I know which ones would be best.

At one point I actually watched it build a window line by line. It took seconds.
Firefox, with 1 tab open, tries to consume my entire CPU. Not sure if related.

I took a couple of photos of inxi -G and xrandr. I get different outputs when SSH’d in, and could not easily copy and paste on the XFCE desktop.

Question: Should I install different drivers (e.g.: vesa; fbturbo)? If so, how do I adjust XFCE to use that instead?

Do so and watch your graphics become crippled or your system otherwise implode. :wink:

I dont see that as an offering in mhwd … so… No. :wink:


While your inxi output looks a bit funny … its also a tv+pi thing that doesnt really have a graphics processor.
modesetting as the modern generic kernel driver … is the only sensible thing I could think of it using.
(which it shows being so in the Display section)

Tweaking things can probably be done, but ‘installing a new driver’ is probably not one of them.

For example - XFCE’s compositor is notoriously problematic - you can modify it, replace it, or at least for testing purposes - just disable it.

2 Likes

This is normal and don’t mess with anything with your monitor settings with config files. “If it ain’t broke don’t fix it”. You appear to go way over board looking at your various posts here with your thinking and can cause your self more problems and will make it harder to diagnose here.

Some people report the issue you seem to have which I have never seen here but disabling the compositor as @cscs said helps some people.

1 Like

Thank you both, @cscs & @Darksky. I’m glad to know it’s actually set up properly now.

I’m definitely guilty of making things too difficult on myself, @Darksky. An unfortunate combination of being a relative linux n00b and trying to put together a somewhat strange/customized setup: headless with no keyboard/mouse plugged directly in. I lost a lot of time at one point, for example, trying to get VNC working with XFCE, and that pretty much never worked right, likely because the instructions I was using were not XFCE-aware.

Then I decided I was going to set up docker (which I had never done) for an IPv6-aware installation of pi-hole. Docker hates IPv6. So I got to learn IPv6, docker, and pi-hole at the same time and spent a good amount of hours trying to figure out which of the three was causing my problems. (Hint: it was always docker).

A good amount of time today was spent figuring out how to pair a bluetooth keyboard from the command line. And after that I spent time trying to figure out why bluetoothd was utilizing an entire CPU core (didn’t really get anywhere with that).

I didn’t even realize XFCE did not take direction from the Xorg conf files until I randomly managed to get the wireless HDMI gizmo to work and then realized it didn’t generate an Xorg conf file for the display, so I spent literally hours trying to figure out how to use the Xorg conf files when I didn’t even have to.

I think a big part of my issues has been I don’t know what question to ask/what tutorials to look for. I keep taking the long way around to get to a place I didn’t actually need to try to go to, and discovering the actual problem/solution along the way.

On the plus side I’ve learned a lot about the system by poking around at parts of it that I didn’t even need to mess with. :stuck_out_tongue:

I do recall seeing some posts about the compositor. Is that behavior considered a bug, or is it something being actively worked on? I’m still unclear on whether the compositor had anything to do with Firefox trying to consume all available CPU resources.

It seems I read another post that the latest firefox was doing that here.

Try chromium and see if it is any better.

1 Like

Oh, good.

Not just me being an idiot, this time. :stuck_out_tongue:

Thanks for the tip re: chromium.

A couple of other thoughts is:

I always have my pi4’s overclocked. You have to have some type of cooling system though. You can monitor the temp for a while with “cpu-temp-speed”.

/boot/config.txt for pi4 only:

over_voltage=5
arm_freq=2000

A good fast sdcard. This helps with programs loading up and with the web browser when it loads up pages as it does a lot of writing to disk. My USB M.2 drive takes this even to another level.

I saw you were either getting or have a USB M.2 drive. They have a rep of interfering with usb radio devices. I at first had my usb drive as a usb stick and had to put a 6" usb extension inline and hang the stick over the side of my metal computer as my pi sits on the top of it or it would interfere with my usb mouse. When I got my M.2 USB drive the 6" usb extension was not log enough and had to put inline a 12" extension. I even as a after thought even wrapped the M.2 enclosure with heavy duty tin foil.

1 Like

Thanks for the additional advice, @Darksky. :slight_smile: I’ve got my Pi overclocked to 2 GHz, along with a GPU overclock (not really sure if that’s helpful–I’m seeing conflicting advice on whether or not to GPU overclock, but did it more just to see what would happen).

I’m using an Ice Tower cooler, which works great. It was a bit of an experience getting it installed, as I’d never installed a cooler in a system before and the instructions weren’t written too well, nor were the pictures entirely clear (at least for me). tl;dr I ended up putting the bracket on backwards the first time, and discovered just how easily the cheap screws it comes with strip at the screwdriver interface. BUT! It’s installed and not going anywhere now, and keeps things cool even under heavy load.

For storage at the moment, I’m using this Samsung (MB-ME256GA/AM) 256GB 100MB/s (U3) MicroSDXC EVO Select: https://www.amazon.com/gp/product/B072HRDM55/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1
I had a gift card that halved the price on it, so it was a great deal. Still, even though it’s rated for ~100MB/s, in the onboard SD card slot it gets ~40MB/s according to my benchmark tool. It’s otherwise stable and I have no issues with it, but I’d definitely prefer to be using an M.2. Not just for the speed–I find SD cards to be fragile and flimsy, and I’m not a huge fan of anything with exposed contacts that have to be kept clean.

OTOH, being able to neatly eject the boot drive and plug it into my Mac to edit config files on in the event I’ve borked something is a big plus. :stuck_out_tongue:

Thanks for the warning about the USB interference on the M.2 drives. I am using bluetooth right now, so that’s definitely something I’ll have to keep in mind. At the same time, I’ve already got a nearly unworkable cable snarl near the pi, since it’s right next to a router and also has the wireless HDMI dongle hanging off it along with a multi-card hub thing. Hopefully I can actually get that cleaned up, instead of needing to make a bigger mess.

This is what I’m doing for overclocking, right now. It seems stable under a testing load, but I’ve had one hard freeze in XFCE. That might have been firefox consuming all available resources, though; I’ve never had a problem with the overclock while just logged in via SSH with no display connected.

As to how I’m overclocking, here’s my current config.txt. I’d appreciate any tips on tweaking it. I bumped up the GPU memory to 512M, since you indicated in another post that would be useful if using a 4K display.

I do notice that some overclocking guides use a higher overvolt. I’m wary of lighting my CPU on fire, so I’ve left it at 4 for the moment. What do you suggest for this setting?

I also know there’s a command (force_turbo=1) to lock the CPU at its highest speed, instead of letting it ramp up/down as necessary. Is this actually useful for anything? It seems like it just requires more power and potentially stresses the CPU cores by never letting them go into a lower power state. Is the potential performance boost from eliminating the ramp-up time really that big?

$ bat /boot/config.txt
───────┬─────────────────────────────────────
│ File: /boot/config.txt
───────┼─────────────────────────────────────
1 │ # See /boot/overlays/README for all available options
2 │
3 │ initramfs initramfs-linux.img followkernel
4 │ kernel=kernel8.img
5 │ arm_64bit=1
6 │ enable_gic=1
7 │ disable_overscan=1
8 │
9 │ #enable sound
10 │ dtparam=audio=on
11 │ hdmi_drive=2
12 │
13 │ gpu_mem=512 # Set GPU memory to 512M
14 │ #enable vc4
15 │ dtoverlay=vc4-fkms-v3d
16 │ max_framebuffers=2
17 │
18 │ #Monitor Configuraiton
19 │ hdmi_enable_4kp60=1 # Enable 4K60 display
20 │
21 │ #overclock (ETA Prime @ https://www.youtube.com/watch?v=TwDbQ26_Mp8&t=398s )
22 │ over_voltage=4 # Overvolt CPU
23 │ arm_freq=2000 # Overclock to 2 GHz from 1.5 GHz
24 │ gpu_freq=750 # Overclock GPU to 600 MHz from 400 MHz
───────┴─────────────────────────────────────

I’m testing storage speed with sudo hdparm -t --direct /dev/devID.

ExplainingComputers on YouTube shared this script to test overclock stability/cooling. I can run it without crashing and my temps never breach 49 deg C, so I’m pretty happy with the overclock so far.

1 │ #!/bin/bash
2 │
3 │ # Test Cooling System using multiple runs of sysbench.
4 │ # Check temp before each run, then output final temp.
5 │ # Source: https://www.youtube.com/watch?v=h8YQNKxlvHM (ExplainingComputers @ Youtube)
6 │
7 │ clear
8 │
9 │ #test loop
10 │ for f in {1…7}
11 │ do
12 │ vcgencmd measure_temp
13 │ sysbench --test=cpu --cpu-max-prime=25000 --num-threads=4 run >/dev/null 2>&1
14 │ done
15 │
16 │ vcgencmd measure_temp

The last I saw you opted not to have fbturbo installed and went with V3D so if that is still the case the gpu_mem= value needs to be reduced. In this mode it uses cma 256M for the memory by default instead. It needs some gpu_mem memory at boot but anything above that is just wasted as it is not used.

gpu_mem=64

From reading most say that there is not enough difference to justify the extra gpu_freq so I do not set it here.

You can go up to over_voltage=5 but they say setting it to a value of 6 will set a bit some where on the board and it will void your warranty.

I do not use force_turbo=1 here. I messed with it and every once in a while it would give me a kernel panic when booting.

Thanks for the info on how to set gpu_mem when using the default drivers. . I’ve reverted that setting, and also pushed over_voltage to 5.

Everything booted again–which is a bit more exciting than it used to be since the wireless HDMI is working and every time it boots it takes over my TV–and it survived my stress test script with a max temp of 50 deg C. It idles at 36 deg C, so I’m still pretty happy with the temperature range.

(The stress test actually ran cooler the second time. Odd.)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.