d4mur / victus_brightness

3 stars 0 forks source link

Temporary patch for brightness issue on HP Victus 15 running Linux

UPDATE

The problem has been fixed in kernel branches 6.6.x, 6.10.x, and 6.11.x starting from versions 6.6.54, 6.10.13, and 6.11.2, so the patch is no longer necessary.

~~This patch is now outdated. The kernel developers have released a better solution here. It will be included in a future kernel release.~~

Overview

This repository provides a temporary patch for a brightness issue found in some HP Victus 15 laptops equipped with an AMD APU and Nvidia GPU. On these systems, running Linux, the maximum screen brightness is often stuck at a very low level, making the display difficult to use in well-lit environments.

Patch Details

The provided patch is a workaround for the amdgpu kernel module, that adjusts the input signals to the maximum range of 0-255, effectively restoring the screen brightness to its full range.

Note: This is a temporary solution intended to mitigate the issue until a permanent fix is released upstream. Use this patch at your own risk.

Warning

Applying this patch requires a basic understanding of kernel compilation and module management. Please make sure that you are comfortable with these tasks before proceeding, as improper application can affect system stability.

Instructions

Note 1: The following instructions have only been tested on Slackware Current. If you're using a different distribution, please refer to a specific guide for rebuilding a kernel module on your system.


Note 2: For Arch Linux users: follow this guide and edit the PKGBUILD file by adding these lines inside the prepare function, after the line local src:

echo "Patching the amdgpu driver to fix the Victus brightness issue"
wget https://raw.githubusercontent.com/d4mur/victus_brightness/main/max_brightness.patch
patch -p1 < ./max_brightness.patch

For more information, check out this discussion


To apply the patch, follow these steps:

  1. Download kernel source:

Obtain the source code for the kernel version currently running on your system. You can usually find it through your distribution’s package manager or from the kernel’s official website.

  1. Prepare the Kernel Source:
tar xjf /usr/src/linux-source-<version>.tar.bz2
cd linux-source-<version>
  1. Apply the Patch:

Copy the provided patch file to the kernel source directory and apply it:

cp /path/to/brightness-patch/amdgpu-patch.patch .
patch -p1 < max_brightness.patch
  1. Rebuild the amdgpu module:

If you have a custom .config, copy it to the directory and run:

make oldconfig

For more information, refer to a guide for building the Linux Kernel.

Then run

make SUBDIRS=drivers/gpu/drm/amd/amdgpu/ modules
  1. Replace the existing module:

Locate the existing amdgpu.ko module in your system and back it up:

sudo cp /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/amd/amdgpu/amdgpu.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/amd/amdgpu/amdgpu.ko.bak

Then, replace it with the newly compiled module:

sudo cp drivers/gpu/drm/amd/amdgpu/amdgpu.ko /lib/modules/$(uname -r)/kernel/drivers/gpu/drm/amd/amdgpu/amdgpu.ko
  1. Reboot Your System: Restart your system to load the new module:
sudo reboot

Disclaimer

This patch is a temporary workaround and may not work on all systems. It has been tested on a limited number of configurations and is not guaranteed to be free of bugs. Please proceed with caution and ensure you have backed up your data before applying this patch.