this post was submitted on 23 Nov 2024
1 points (100.0% liked)

GNU/Linux Gaming on Reddit

226 readers
2 users here now

A subreddit for discussions and news about gaming on the GNU/Linux family of operating systems (including the Steam Deck).

founded 1 year ago
MODERATORS
 
This is an automated archive made by the Lemmit Bot.

The original was posted on /r/linux_gaming by /u/roadapathy on 2024-11-23 01:59:48+00:00.


OPTIMIZING

It's possible that we could compile Proton and up the performance using optimizations. Whether this increases FPS, or shortens the load times, or speeds up anything within the game I don't know and therefore this is all for educational purposes only.

DEPENDENCIES

You will need a distro that has updated libraries. I'm using Xubuntu 24.10. GCC should be version 14.1 or newer. I'm using CLANG 19.x. There's a very good chance that you will need a newer version of Docker, which can be found here with the instructions to install:

The Valve Proton project page doesn't really tell you explicitly which dependencies you will need so you will need to be able to check the logs and to log the build output. You can log the output like this and then check the file called output.log:

make redist > output.log 2>&1

Whatever you see might be missing in the output.log is what you can install to fulfill the requirements. For example, if it seems to be missing libvulkan then you'll search the repositories for "libvulkan dev" to include everything needed. If you need pthreads then install build-essential. I know, this is rather confusing. You could use AI to help find the packages needed.

DOWNLOAD THE VALVE PROTON PROJECT

You can download the latest stable, which is 9.0.3 (proton_9.0) currently, or the latest experimental, which is experimental_9.0.

git clone --recurse-submodules proton903OPT

Yes, this will create a directory called proton903OPT so that we know this is the optimized version of Proton 9.0.3.

MODIFYING THE MAKEFILE.IN

This is going to be where you tell the project to build with new GCC compile flags. We're hoping for higher performance here. Again, this is just for educational purposes and this will be a fun learning experience.

I commented out the original lines. Search for the part of the file near to the top that has the following and modify it like I did:

CROSSLDFLAGS += -Wl,--file-alignment,4096

#OPTIMIZE_FLAGS := -O2 -march=nocona -mtune=core-avx2 -mfpmath=sse

OPTIMIZE_FLAGS := -O3 -march=native -g0 -fomit-frame-pointer

SANITY_FLAGS := -fwrapv -fno-strict-aliasing

#DEBUG_FLAGS := -ggdb -ffunction-sections -fdata-sections -fno-omit-frame-pointer

DEBUG_FLAGS := -g0

COMMON_FLAGS = $(DEBUG_FLAGS) $(OPTIMIZE_FLAGS) $(SANITY_FLAGS) -ffile-prefix-map=$(CCACHE_BASEDIR)=.

COMMON_FLAGS32 := -mstackrealign -march=native -mfpmath=sse -g0 -fomit-frame-pointer

#COMMON_FLAGS64 := -mcmodel=small

COMMON_FLAGS64 := -mcmodel=small -march=native -g0 -fomit-frame-pointer

CARGO_BUILD_ARGS += --release

Add these:

DAV1D_MESON_ARGS = \

-Doptimization=3 \

-Dc_args="-O3 -march=native -g0 -fomit-frame-pointer -std=c17" \

-Dcpp_args="-O3 -march=native -g0 -fomit-frame-pointer -std=c++20" \

Add these:

GSTREAMER_MESON_ARGS := \

-Doptimization=3 \

-Dc_args="-O3 -march=native -g0 -fomit-frame-pointer" \

-Dcpp_args="-O3 -march=native -g0 -fomit-frame-pointer -std=c++20" \

Add these:

GST_BASE_MESON_ARGS := \

-Doptimization=3 \

-Dc_args="-O3 -march=native -g0 -fomit-frame-pointer" \

-Dcpp_args="-O3 -march=native -g0 -fomit-frame-pointer -std=c++20" \

Add these:

GST_GOOD_MESON_ARGS := \

-Doptimization=3 \

-Dc_args="-O3 -march=native -g0 -fomit-frame-pointer" \

-Dcpp_args="-O3 -march=native -g0 -fomit-frame-pointer -std=c++20" \

Add these:

GST_BAD_MESON_ARGS := \

-Doptimization=3 \

-Dc_args="-O3 -march=native -g0 -fomit-frame-pointer" \

-Dcpp_args="-O3 -march=native -g0 -fomit-frame-pointer -std=c++20" \

Add these but this will differ from the others:

FFMPEG_CONFIGURE_ARGS := \

--extra-cflags="-O3 -march=native -g0 -fomit-frame-pointer" \

--extra-cxxflags="-O3 -march=native -g0 -fomit-frame-pointer" \

--extra-objcflags="-O3 -march=native -g0 -fomit-frame-pointer" \

Find this and remove the error flag.

This is important because some versions will not build if the --enable-werror is not removed:

WINE_CONFIGURE_ARGS = \

--with-mingw \

--disable-tests

Last one in the Makefile.in to modify:

VKD3D_CONFIGURE_ARGS = \

--enable-silent-rules \

--disable-doxygen-doc \

--disable-tests \

--disable-demos \

--without-ncurses \

SONAME_LIBVULKAN=vulkan-1 \

CPPFLAGS="-O3 -march=native -flto -g0 -fomit-frame-pointer -std=c++20" \

COMPILE THE PROJECT:

cd proton903OPT

mkdir build

cd build

../configure.sh --enable-ccache --build-name=proton903OPT

You should see output similar to this:

build$ ../configure.sh --enable-ccache --build-name=proton903OPT

:: Configuring with build name: proton903OPT

:: Trying to find usable container engine.

:: Trying docker.

../configure.sh: line 32: docker: command not found

:: docker is unable to run the container.

:: Trying podman.

:: Using podman.

:: Created ./Makefile, now run make to build.

:: See README.md for make targets and instructions

If all goes well, you can begin the building process:

make redist

OR

make redist > output.log 2>&1

If you're building Proton for the first time then create the output.log and read through it in search of errors or missing dependencies. Then install and rebuild.

When I get errors, I correct them and then delete the build directory to start clean:

cd ..;sudo rm -r build;mkdir build; cd build

Then just do the two commands again:

../configure.sh --enable-ccache --build-name=proton903OPT

make redist

IF ALL GOES WELL THEN YOU HAVE THE FILES NEEDED

From the build directory, you should see a new directory called "redist." You will cut and paste this entire directory to:

/home//.steam/steam/compatibilitytools.d/

Rename that directory so that you know what it is. If this works then you will probably be creating others- different versions, maybe different optimizations, maybe some vanilla builds, etc. I called mine Proton9V1. I have a V2, V3, V4 based on tests that I did with various optimizations.

CONFIGURE STEAM TO USE YOUR PROTON VERSION BY DEFAULT

YOU CAN ALSO ADD THIS TO LUTRIS

This runs better for me that Glorious Eggroll and the other Runners that come with Lutris but your mileage may differ.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here