You are not logged in.

#1 2026-02-05 23:40

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

tde-compton "optimized" - update v3

Hello!
In my spare time, I had fun taking a look at the compton-tde code, and since - oh joy ^^ - it's in C and that's my language of choice, I attempted some optimizations, and since "my" optimized version has been running successfully for several weeks, I thought I could maybe "propose" it on github, it's at this address:

https://github.com/seb3773/compton-tde-x


No misunderstanding: the original compton-tde is already pretty well optimized, but it's fun and interesting to see what can still be done to improve performance and/or minimize memory usage. :-)

Here's an excerpt of what I attempted (apparently with success, no crashes or strange behavior so far...):

- Region Cache: Implemented a stack-based cache for XFixesCreateRegion, aligned to 64-byte cache lines to reduce X server round-trips.

- Picture Format Cache: Cached XRenderFindVisualFormat lookups for hot paths, reducing function call overhead.

- Disable Debug Logging: Configured printf_dbg to compile to no-ops when not debugging.

- Compiler Hints: Added HOT/COLD attributes and likely/unlikely branch prediction hints.

- Structure Packing: Reordered struct _win members to eliminate padding, improving cache testing.

- Data Types: Switched to float for shadow convolution and uint16_t for coordinates to reduce memory usage.

- Code Refactoring: Implemented generic FREE macros and merged duplicate window property update functions to reduce binary size.

- SIMD Shadows: SSE2-vectorized sum_gaussian = ~4x faster shadow blur computation on large kernels smile

- Integer Fading: Replaced double arithmetic in run_fade with uint64_t to avoid FPU overhead

- OpenGL Extension Caching: Cached glXQueryExtensionsString/glGetString results to avoid repeated X calls.

- OpenGL Memory Leak Fix: Fixed get_fbconfig_from_visualinfo leaking FBConfigs array

- OpenGL Shader Build: Optimized shader string building with cached lengths and sprintf return values

- Monotonic Clock: Replaced gettimeofday with clock_gettime(CLOCK_MONOTONIC_COARSE) for faster timing.


** There's one point for which I "self" opened an issue:

in the file c2.c : the original code freed a string (tstr) and then immediately accessed it for validity checks, leading to potential crashes during config parsing; so the fix is to reorder the logic to ensure the string is only freed after it has been used. This *should* improves stability, especially with complex configurations. I could be wrong, but it's maybe something to check in the original source.

=========================================================================

***Update v2.0: Optimized Dual-Kawase Blur Support ^^

compton-tde-x now support Dual-Kawase blur method for background blurring, inspired by the implementation found in picom.

Dual-Kawase blur is a multi-pass blur technique widely used in real-time rendering. It works by repeatedly downscaling the source image to smaller framebuffers and then upscaling it back while applying linear sampling. This approach provides a visually smooth and high-quality blur while being significantly more efficient than traditional Gaussian blur, especially on older or constrained GPUs.

Dual-Kawase is particularly well suited for compositors because it offers:

-Good visual quality at very low sample cost - this is exactly why I wanted to implement it, perfect for Trinity :-)
-Predictable performance
-Excellent scalability depending on blur strength and resolution

All technicals details explained (and a note about how I adapted it to compton-tde, which is designed around the X11 XDamage extension, the original architecture of Compton).
I'm testing it now with a LOT of windows with transparency and background blur activated, and I can confirm I can't even measure a cpu activity related to it on a pretty modest configuration. Seems perfect for low end computers [*as long as opengl is available of course].

.deb packages updated (14.1.1 & 14.1.5) + my config as an exemple using background blur with dual-kawase + the exceptions rules I'm using to avoid displays problem with some apps

=========================================================================

***Update v3.0: Enhanced Window Condition Matching and Native Software Cursor for Mixed-DPI Supersampling***


-PCRE2 Match Data Fix (c2.c)
During the PCRE1 → PCRE2 migration, the ~= operator could crash because pcre2_match() requires a valid pcre2_match_data* (PCRE1 allowed NULL).
A proper match block is now allocated with pcre2_match_data_create_from_pattern() and freed in c2_free(), ensuring all regex conditions work without segfaults.

                 -------------------------


-New Predefined Condition Targets (c2.h / c2.c)
Two new condition targets (backported from picom):

   group_focused, boolean, True if any window in the same leader group is focused
   and
   urgent, boolean, True if the window has the XUrgencyHint flag

Usage example:
opacity-rule = [ "80:group_focused = 0", "100:urgent = 1" ];


                 -------------------------


- PID‑Based WM_CLASS Inheritance (Chrome/Electron Fix)

Chrome/Electron popup/menu windows often lack WM_CLASS, breaking rules like class_i *= 'chrome'.
Two fallback mechanisms were added:

WM_TRANSIENT_FOR inheritance – inherit class from the parent window.
_NET_WM_PID inheritance – find another window with the same PID that already has a resolved class.

This ensures Chrome/Chromium/Electron popups now match class‑based rules correctly.

Examples:
shadow-exclude = [ "class_i *= 'chrome'" ];
blur-background-exclude = [ "class_i *= 'chrome'" ];


                 -------------------------


-  Native Software Cursor for Mixed‑DPI Supersampling
On multi‑monitor setups with different scaling factors (e.g., 4K @ 2.0× + 1080p @ 1.0×), some drivers (notably NVIDIA) cause the hardware cursor to flicker or disappear when using XRandR supersampling.

Enable via command line argument:
compton-tde --sw-cursor
or in your compton config file config file with :  sw-cursor = true;


                 -------------------------

* attached .deb packaged updated to v3.0 , config file example too.
----

Let me know what you think of my version smile (all criticism welcome!!)

Last edited by seb3773 (2026-03-07 22:55)


Attachments:
conf compton-tde.conf, Size: 2.23 KiB, Downloads: 10
deb compton-tde_X_tde14.1.1_amd64.deb, Size: 73.7 KiB, Downloads: 7
deb compton-tde_X_tde14.1.5_amd64.deb, Size: 68.72 KiB, Downloads: 10

Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#2 2026-02-06 09:29

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 5,990
Website

Re: tde-compton "optimized" - update v3

Nice one smile

Offline

#3 2026-02-09 15:24

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,558

Re: tde-compton "optimized" - update v3

Problem

Dependencies installed successfully!
You can now build compton-tde with:
  cmake . && make compton-tde
robin@trinity:~/compton-tde-x$ cmake . && make compton-tde
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- The C compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1")
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Checking for module 'gl'
--   Found gl, version 1.2
-- Checking for module 'libconfig'
--   Found libconfig, version 1.7.3
-- Checking for module 'libpcre2-8'
--   Found libpcre2-8, version 10.46
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.16.2
-- Configuring done (1.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/robin/compton-tde-x
[ 20%] Building C object CMakeFiles/compton-tde.dir/compton.c.o
[ 40%] Building C object CMakeFiles/compton-tde.dir/opengl.c.o
[ 60%] Building C object CMakeFiles/compton-tde.dir/dbus.c.o
[ 80%] Building C object CMakeFiles/compton-tde.dir/c2.c.o
[100%] Linking C executable compton-tde
collect2: fatal error: cannot find ‘ld’
compilation terminated.
make[3]: *** [CMakeFiles/compton-tde.dir/build.make:158: compton-tde] Error 1
make[2]: *** [CMakeFiles/Makefile2:87: CMakeFiles/compton-tde.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:94: CMakeFiles/compton-tde.dir/rule] Error 2
make: *** [Makefile:169: compton-tde] Error 2

Offline

#4 2026-02-09 20:33

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

Oops! It looks like I forgot to add this to the script for installing dependencies.
This is a toolchain issue: the linker ld is missing (or not found).
ld is part of the binutils package—without it, gcc can compile .o files… but cannot link the executable.
You need to install binutils:

sudo apt install binutils

(*You can also install build-essential, which includes gcc, binutils, libc-dev, make, etc.)

Then restart the compilation:

make clean
cmake .
make

And it should compile correctly smile


Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#5 2026-02-10 09:38

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,558

Re: tde-compton "optimized" - update v3

I already have binutils and build-essential installed - hence my puzzle.

There are any number of search results to collect2: fatal error: cannot find ‘ld’ but I confess they do not make any sense to me at all.

Offline

#6 2026-02-10 10:45

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

That’s odd indeed! ?

Could you try running these commands and let me know what they output?

which ld
ld --version

And also these:

ls -l /usr/bin/ld
ls -l /usr/bin/*ld
ls -l /usr/bin/x86_64-linux-gnu-ld

And this one:

gcc -print-prog-name=ld

Another check:

dpkg -l | grep binutils

With this last one, we should see "binutils-x86-64-linux-gnu" in the results. If not, you can install it with:

sudo apt install binutils-x86-64-linux-gnu

Tell me if it works, if not, what are the result of the commands ?


Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#7 2026-02-10 13:36

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,558

Re: tde-compton "optimized" - update v3

Yep sure.

which ld
/usr/bin/ld

ld --version
GNU ld (GNU Binutils for Debian) 2.44

ls -l /usr/bin/ld
lrwxrwxrwx 1 root root 19 Mar  3  2025 /usr/bin/ld -> x86_64-linux-gnu-ld

ls -l /usr/bin/*ld
-rwxr-xr-x 1 root root 47528 Jun  4  2025 /usr/bin/fold
lrwxrwxrwx 1 root root    19 Mar  3  2025 /usr/bin/ld -> x86_64-linux-gnu-ld
-rwxr-xr-x 1 root root 18664 Apr 12  2025 /usr/bin/pamthreshold
lrwxrwxrwx 1 root root    23 Mar  3  2025 /usr/bin/x86_64-linux-gnu-ld -> x86_64

ls -l /usr/bin/x86_64-linux-gnu-ld
lrwxrwxrwx 1 root root 23 Mar  3  2025 /usr/bin/x86_64-linux-gnu-ld -> x86_64-linux-gnu-l   

gcc -print-prog-name=ld
ld

dpkg -l | grep binutils
ii  binutils                              2.44-3                               amd64        GNU assembler, linker and binary utilities
ii  binutils-common:amd64                 2.44-3                               amd64        Common files for the GNU assembler, linker and binary utilities
ii  binutils-x86-64-linux-gnu             2.44-3                               amd64        GNU binary utilities, for x86-64-linux-gnu target
ii  libbinutils:amd64                     2.44-3                               amd64        GNU binary utilities (private shared library)

echo $PATH
/usr/local/bin:/opt/trinity/bin:/usr/bin:/bin:/usr/local/games:/opt/trinity/games:/usr/games

Installed binutils-dev and lld but makes no difference.

Offline

#8 2026-02-10 14:14

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 5,990
Website

Re: tde-compton "optimized" - update v3

@seb3773
We would suggest you to make your projects Debhelper  https://wiki.debian.org/Debhelper based, so any Debian user could create the .deb package. It would also make easier for us to build your packages.

Offline

#9 2026-02-10 15:02

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

q4osteam wrote:

@seb3773
We would suggest you to make your projects Debhelper  https://wiki.debian.org/Debhelper based, so any Debian user could create the .deb package. It would also make easier for us to build your packages.

thanks, will take a look at it, seems interesting !

*If needed, there are .deb with binaries for 14.1.1 & 14.1.5 on the github repository page


Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#10 2026-02-11 00:47

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

While waiting for me to provide a better build system, generally speaking, if you can compile the relevant tdebase for your system, then you can compile compton-tde-x. All you need to do is retrieve your tdebase (the one corresponding to the version : tde-config --version) and then simply overwrite the files in /twin/compton-tde/ with those from the GitHub repository. After that, recompile everything.
More specifically (excerpt from the readme):

The build is configured to strictly require features like libconfig by default.


cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
        -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
        -DWITH_XDAMAGE=ON

Optimization flags are automatically applied by the CMake configuration.
Build:


make compton-tde

Optimize Size (Optional but Recommended): If you have sstrip installed (from elfkickers):


sstrip compton-tde

Otherwise, use standard strip:


strip --strip-all compton-tde

Install:


sudo make install

OR manually copy compton-tde to your bin path

Then: killall compton-tde, and ALT+F2 : compton-tde (to stop "old" compton process and restart with the new installed compton-tde binary)

Nothing out of the ordinary, normally, which is why I don’t understand the error encountered... I coded this on tdebase 14.1.1 and successfully applied the method mentioned above on a more recent install (Andromeda) with tdebase 14.1.5. (That’s how I was able to create the two packages provided on GitHub—using my create_deb.sh script once the compilation was successful.)

The absolute requirement: you must be able to successfully compile tdebase (whithout any modifications) first. If that works, then once the files in /twin/compton-tde/ are overwritten with my sources, it should also compile the optimized compton (hopefully) successfully.

Last edited by seb3773 (2026-02-11 01:40)


Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#11 2026-02-11 08:17

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,558

Re: tde-compton "optimized" - update v3

Might I suggest you take a vanilla build of Andromeda, follow your original build instructions and see what happens?
You mention a 4.1.5 deb file - I can only see a 4.1.1 in assets.

Last edited by bin (2026-02-11 08:18)

Offline

#12 2026-02-11 12:15

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

bin wrote:

Might I suggest you take a vanilla build of Andromeda, follow your original build instructions and see what happens?
You mention a 4.1.5 deb file - I can only see a 4.1.1 in assets.

Yes, that’s exactly what I did, but I forgot to upload the package—sorry about that ! It’s on GitHub now.

I did follow the procedure with a tdebase 14.1.5, and it worked, BUT I think I know why it’s not working for you: My Q4OS Andromeda TDE installation is used for development, and I have a lot of non-standard things installed, such as the gold linker (ld.gold), which is no longer available by default on Debian 13! However, the compilation options use the gold linker, so I believe that’s the source of the error—if it’s not present, it won’t work with the current CMakeLists...

So, I did the following:

Modified install_deps.sh to offer the option to install the gold linker.
Made it optional: If you don’t want to install this linker, the CMakeLists can use another available linker.

The README.md has been updated with these new instructions.
This should definitely fix the issue :-) Tell me if it works for you

Last edited by seb3773 (2026-02-11 12:18)


Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#13 2026-02-11 15:24

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,558

Re: tde-compton "optimized" - update v3

Just checked and my system does have Gold linker installed.
Ran git clone to start again.
Make falls over as a number of files are pointing to the wrong place
CMake Error: The current CMakeCache.txt directory /home/robin/compton-tde-x/CMakeCache.txt is different than the directory /home/seb/tdebase-trinity-14.1.5/twin/compton-tde where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt

cmake_install.cmake
CMakeCache.txt
Makefile

Previous git clone changed them all to correct value to reflect my local file location - no idea what is going here.

In the end I just extracted compton.tde from your 4.1.5 deb file and swapped it out with the original.

Not sure I can see any difference but then I switch most of the effects off. However if it is more efficient then that's a good thing in itself!!

Offline

#14 2026-02-11 15:52

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 5,990
Website

Re: tde-compton "optimized" - update v3

- Fresh install - Q4OS-6 Andromeda, Basic profile
- Cloned the project from Github to /tmp/
- Followed the build instructions

 $ cd /tmp/compton-tde-x/
 $ cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON -DWITH_XDAMAGE=ON

Error:
CMake Error: The current CMakeCache.txt directory /tmp/compton-tde-x/CMakeCache.txt is different than the directory /home/seb/tdebase-trinity-14.1.5/twin/compton-tde where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt

Offline

#15 2026-02-11 20:21

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

My bad!!
I had directly uploaded the files to GitHub and accidentally included build files generated by CMake that contain my local paths :-(
Obviously, I shouldn’t have uploaded these files to GitHub:

CMakeCache.txt (contains absolute paths)
cmake_install.cmake
Makefile (generated by CMake)
compton_config.h (also generated)

These are what caused the error. I’ve removed them from the repo, so you’ll need to do the same before rerunning CMake. Sorry again for that!


I realized that the README.md is not enough to understand how to compile, so I made a detailled step-by-step instructions for building and installing compton-tde-x from source:

- TDE Versions: 14.1.1 or later (tested on 14.1.1 and 14.1.5)

- Getting the Source Code

First, check which version of TDE is installed on your system:

tde-config --version

Note the TDE version and then download TDE Base Source: You need the `tdebase` source code matching your installed TDE version (Download from TDE Git)

--> Clone tdebase for your TDE version (replace 14.1.5 with your version)
git clone https://mirror.git.trinitydesktop.org/g … debase.git -b r14.1.5 tdebase-trinity-14.1.5

Then,clone the compton-tde-x repository to a temporary location:
cd /tmp
git clone https://github.com/seb3773/compton-tde-x

Next, copy Compton-tde-x Files into TDE Base: (let's assume you clone the tdebase in ~/src/ )

cp -r /tmp/compton-tde-x ~/src/tdebase-trinity-14.1.5/twin/compton-tde

Then verify the files are in place:
ls ~/src/tdebase-trinity-14.1.5/twin/compton-tde

You should see files like `CMakeLists.txt`, `compton.c`, `compton.h`, `install_deps.sh`, `README.md`, etc.

Now, all commands assume you are in the tdebase directory:

cd ~/src/tdebase-trinity-14.1.5

The `install_deps.sh` script will install all required development packages and optionally install optimization tools.

cd twin/compton-tde
./install_deps.sh


This will: - install core build dependencies (X11 libraries, OpenGL, libconfig, dbus, pcre2, etc.)
           - check if the **gold linker** is available (optional but better for smaller binaries)
           - checks if **sstrip** is available (optional, for more binary size reduction)


Next, let's verify dependencies:


cmake --version

check pkg-config:
pkg-config --version

check if gold linker is available
ld.gold --version

check if sstrip is available (optional)
sstrip --version



Now, let's build. There are two build modes:

- Mode 1: Standard Build (with logging)

> Includes console logging for debugging purposes. Binary size: ~200-210KB.

make sure you're in the compton-tde directory:
cd ~/src/tdebase-trinity-14.1.5/twin/compton-tde

next, configure with cmake:

cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
        -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
        -DWITH_XDAMAGE=ON

And build:

make

- Mode 2: Optimized Build (silent, no logging)

> this one removes all console logging strings for a smaller binary. Binary size around ~175-180KB.

This is what I use for production release.


make sure you're in the compton-tde directory:
cd ~/src/tdebase-trinity-14.1.5/twin/compton-tde

# Configure with cmake (note the -DWITH_SILENT_BUILD=ON flag) :
#
cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
        -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
        -DWITH_XDAMAGE=ON -DWITH_SILENT_BUILD=ON

and then build:
make


During CMake configuration, you should see:


"-- Using gold linker for better optimization"


or

"Gold linker not available, using standard ld"


or

"-- Using lld linker"

(this indicates which linker is being used.)


During compilation, you should see something like that:

...
[ 20%] Building C object CMakeFiles/compton-tde.dir/compton.c.o
[ 40%] Building C object CMakeFiles/compton-tde.dir/opengl.c.o
[ 60%] Building C object CMakeFiles/compton-tde.dir/dbus.c.o
[ 80%] Building C object CMakeFiles/compton-tde.dir/c2.c.o
[100%] Linking C executable compton-tde
[100%] Built target compton-tde


Then, check that the binary was created:


ls -lh compton-tde


The size will vary depending on:
- Build mode (standard vs silent)
- Linker used (gold vs ld vs lld)
- Whether sstrip was applied

After a successful build, you will find:

```
twin/compton-tde/
├── compton-tde              # Main executable binary <--- this one should go to /opt/trinity/bin/ for installing
├── CMakeCache.txt           # CMake cache (generated)
├── CMakeFiles/              # CMake build files (generated)
├── cmake_install.cmake      # CMake install script (generated)
├── Makefile                 # Generated Makefile
├── compton_config.h         # Generated configuration header
└── ... (other sources files)


* Installing

To install compton-tde-x system-wide (requires root privileges):

make sure you're in the compton-tde directory:
cd ~/src/tdebase-trinity-14.1.5/twin/compton-tde

sudo make install
(this will simply copy `compton-tde` binary to `/usr/local/bin/` (or `/usr/bin/` depending on CMAKE_INSTALL_PREFIX) )

You can also test compton-tde without installing it system-wide:
./compton-tde &

** Packaging:
Built the binary firstof course, then run the Packaging Script:


cd ~/src/tdebase-trinity-14.1.5/twin/compton-tde
chmod +x ./create_deb.sh
./create_deb.sh

Expected output:

```
Creating .deb package for compton-tde...
Trinity version: 14.1.5
Architecture: amd64
Copying binaries and assets...
Stripping binaries...
Creating control file...
Building package...
dpkg-deb: warning: root directory package_build has unusual owner or group 1000:1000
dpkg-deb: hint: you might need to pass --root-owner-group
dpkg-deb: building package 'compton-tde' in 'compton-tde_1.0_tde14.1.5_amd64.deb'.
Success! Package created: compton-tde_1.0_tde14.1.5_amd64.deb
-rw-r--r-- 1 user user 175K Feb 11 14:25 compton-tde_1.0_tde14.1.5_amd64.deb
```

(warning about "unusual owner or group" is normal when building packages as a non-root user, this can be safely ignored.)

The created package includes:
- **Binary**: `/usr/bin/compton-tde`
- **Package name**: `compton-tde`
- **Version**: Automatically detected from your TDE version
- **Architecture**: Automatically detected
- **Dependencies**: Listed in the package metadata

---

## Troubleshooting (some issues I experienced myself :-p )


**** CMake Error - "Unknown CMake command 'tde_add_kpart'"
Error message:

CMake Error at CMakeLists.txt:17 (tde_add_kpart):
  Unknown CMake command "tde_add_kpart".

--> You tried to run `cmake .` in a subdirectory that uses TDE-specific macros, but this project is designed to be built from the `twin/compton-tde` directory within the tdebase source tree, not as a standalone project.

---

***** CMake Error - "CMakeCache.txt directory is different"
Error message:

CMake Error: The current CMakeCache.txt directory /tmp/compton-tde-x/CMakeCache.txt
is different than the directory /home/seb/tdebase-trinity-14.1.5/twin/compton-tde
where CMakeCache.txt was created.

--> I included generated build files with hardcoded paths from my system : clean the build artifacts before running CMake:

cd ~/src/tdebase-trinity-14.1.5/twin/compton-tde
rm -rf CMakeCache.txt CMakeFiles/ cmake_install.cmake Makefile compton_config.h

And run cmake again:

cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
        -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
        -DWITH_XDAMAGE=ON


*****Linker Error - "cannot find 'ld'"
Error message:

collect2: fatal error: cannot find 'ld'


--> The build system is trying to use the gold linker, but it's not installed: Now the CMakeLists.txt automatically detects available linkers. If you see this error, it means the detection failed. Clean and rebuild:


rm -rf CMakeCache.txt CMakeFiles/ cmake_install.cmake Makefile compton_config.h

cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
        -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
        -DWITH_XDAMAGE=ON
make

Now the build system will automatically fall back to the standard linker if gold is not available.



**** "make: *** No targets specified and no makefile found"

--> You're in the wrong directory or cmake hasn't been run yet:

cd ~/src/tdebase-trinity-14.1.5/twin/compton-tde

run cmake first:

cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
        -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
        -DWITH_XDAMAGE=ON

then make

make






- cmake options:

| Option | Values | Default | Description |
|--------|--------|---------|-------------|
| `WITH_LIBCONFIG` | ON/OFF | ON | Enable libconfig support (required) |
| `WITH_OPENGL` | ON/OFF | ON | Enable OpenGL backend for VSync |
| `WITH_PCRE2` | ON/OFF | ON | Enable PCRE2 regex support |
| `WITH_XRENDER` | ON/OFF | ON | Enable XRender support (required) |
| `WITH_XFIXES` | ON/OFF | ON | Enable XFixes support (required) |
| `WITH_XCOMPOSITE` | ON/OFF | ON | Enable XComposite support |
| `WITH_XDAMAGE` | ON/OFF | ON | Enable XDamage support |
| `WITH_XINERAMA` | ON/OFF | ON | Enable Xinerama support |
| `WITH_XRANDR` | ON/OFF | ON | Enable XRandr support |
| `WITH_DBUS` | ON/OFF | ON | Enable DBus support |
| `WITH_SILENT_BUILD` | ON/OFF | OFF | Disable console logging (smaller binary) |
| `


Don't hesitate to tell me if something isn't clear enough. I hope this will help you to build and test successfully smile


Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#16 2026-02-12 10:39

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,558

Re: tde-compton "optimized" - update v3

"Next, copy Compton-tde-x Files into TDE Base: (let's assume you clone the tdebase in ~/src/ )

cp -r /tmp/compton-tde-x ~/src/tdebase-trinity-14.1.5/twin/compton-tde"
compton-tde already exists from the git clone from the TDE base library so I removed all files in that folder and replaced with contents of compton-tde-x

Contrary to the check results of the original script which said Gold linker is installed, in fact it isn't... never mind.

Still getting an error - on 'make'

robin@trinity:~/src/tdebase-trinity-14.1.5/twin/compton-tde$ cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
>         -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
>         -DWITH_XDAMAGE=ON
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- The C compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1")
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_
64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_
64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Checking for module 'gl'
--   Found gl, version 1.2
-- Checking for module 'libconfig'
--   Found libconfig, version 1.7.3
-- Checking for module 'libpcre2-8'
--   Found libpcre2-8, version 10.46
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.16.2
-- Gold linker not available, using standard ld with optimizations
-- Using lld linker
-- Configuring done (1.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/robin/src/tdebase-trinity-14.1.5/twin
/compton-tde
robin@trinity:~/src/tdebase-trinity-14.1.5/twin/compton-tde$ cmake . -DWITH_LIBC
ONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
>         -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
>         -DWITH_XDAMAGE=ON -DWITH_SILENT_BUILD=ON
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Gold linker not available, using standard ld with optimizations
-- Using lld linker
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/robin/src/tdebase-trinity-14.1.5/twin/compton-tde
robin@trinity:~/src/tdebase-trinity-14.1.5/twin/compton-tde$ make
[ 20%] Building C object CMakeFiles/compton-tde.dir/compton.c.o
[ 40%] Building C object CMakeFiles/compton-tde.dir/opengl.c.o
[ 60%] Building C object CMakeFiles/compton-tde.dir/dbus.c.o
[ 80%] Building C object CMakeFiles/compton-tde.dir/c2.c.o
[100%] Linking C executable compton-tde
ld.lld: error: undefined symbol: main
>>> referenced by /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scr t1.o:(_start)
collect2: error: ld returned 1 exit status

I have attached the out files which I think are referenced above in case it helps

Offline

#17 2026-02-12 10:40

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,558

Re: tde-compton "optimized" - update v3

"Next, copy Compton-tde-x Files into TDE Base: (let's assume you clone the tdebase in ~/src/ )

cp -r /tmp/compton-tde-x ~/src/tdebase-trinity-14.1.5/twin/compton-tde"
compton-tde already exists from the git clone from the TDE base library so I removed all files in that folder and replaced with contents of compton-tde-x

Contrary to the check results of the original script which said Gold linker is installed, in fact it isn't... never mind.

Still getting an error - on 'make'

robin@trinity:~/src/tdebase-trinity-14.1.5/twin/compton-tde$ cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
>         -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
>         -DWITH_XDAMAGE=ON
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- The C compiler identification is GNU 14.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1")
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_
64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_
64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Checking for module 'gl'
--   Found gl, version 1.2
-- Checking for module 'libconfig'
--   Found libconfig, version 1.7.3
-- Checking for module 'libpcre2-8'
--   Found libpcre2-8, version 10.46
-- Checking for module 'dbus-1'
--   Found dbus-1, version 1.16.2
-- Gold linker not available, using standard ld with optimizations
-- Using lld linker
-- Configuring done (1.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/robin/src/tdebase-trinity-14.1.5/twin
/compton-tde
robin@trinity:~/src/tdebase-trinity-14.1.5/twin/compton-tde$ cmake . -DWITH_LIBC
ONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
>         -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
>         -DWITH_XDAMAGE=ON -DWITH_SILENT_BUILD=ON
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.


-- Gold linker not available, using standard ld with optimizations
-- Using lld linker
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/robin/src/tdebase-trinity-14.1.5/twin/compton-tde
robin@trinity:~/src/tdebase-trinity-14.1.5/twin/compton-tde$ make
[ 20%] Building C object CMakeFiles/compton-tde.dir/compton.c.o
[ 40%] Building C object CMakeFiles/compton-tde.dir/opengl.c.o
[ 60%] Building C object CMakeFiles/compton-tde.dir/dbus.c.o
[ 80%] Building C object CMakeFiles/compton-tde.dir/c2.c.o
[100%] Linking C executable compton-tde
ld.lld: error: undefined symbol: main
>>> referenced by /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scr t1.o:(_start)
collect2: error: ld returned 1 exit status

Which files do you need from compton-tde.dir to help debug? - Could not attach all in zip due to file limit but can provide via a cloud site if needed.

Offline

#18 2026-02-12 11:43

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

bin wrote:

"compton-tde already exists from the git clone from the TDE base library so I removed all files in that folder and replaced with contents of compton-tde-x"

I think this could be problematic. You must not delete anything in this directory; you should only copy the files from the repo into it (which will overwrite the existing modified files). All the contents of the directory are important, and you must not delete anything before copying the files into it.
In general, I only post the files that have been modified, to make it easier to integrate into an existing tdebase directory structure. So the correct procedure is to overwrite the modified files but leave the other unmodified files untouched.
That said, this doesn’t seem to be the real cause of the error. The CMakeLists.txt uses -flto=2 (Link Time Optimization) in both the compilation and linking flags. With the lld linker, there’s a known conflict with LTO that can cause errors like "undefined symbol: main". The issue is:
The code is compiled with -flto=2
The lld linker is used with -flto=2
LTO with lld can have compatibility issues
I’ve modified the CMakeLists.txt to automatically disable LTO when the lld linker is detected (attached). You should replace the old CMakeLists.txt with the attached one and try this:

cd ~/src/tdebase-trinity-14.1.5/twin/compton-tde
rm -rf CMakeCache.txt CMakeFiles/ compton-tde

cmake . -DWITH_LIBCONFIG=ON -DWITH_OPENGL=ON -DWITH_PCRE2=ON \
        -DWITH_XRENDER=ON -DWITH_XFIXES=ON -DWITH_XCOMPOSITE=ON \
        -DWITH_XDAMAGE=ON

make
sudo make install
The output should now display: "Using lld linker (LTO disabled for compatibility)", and the compilation should hopefully succeed.
Regarding the issue with gold that’s been causing trouble: currently, the script checks if the compiler can use -fuse-ld=gold. However, there are several reasons why this might fail even if gold is installed: it might not be the default linker, or system alternatives might not be configured. You should check:

which ld.gold
update-alternatives --display ld
ld --version

I also wonder if the CMake test was too strict, so I’ve modified that as well.
Let me know if this resolves the issue, and sorry for the hassle. These are some of my first experiments with TDE’s code, and I don’t yet fully master the toolchain. The phrase "But it works on my machine!" definitely applies here :-p As I mentioned in another post, if I do more experiments with plugins or other Trinity elements, I’m seriously considering doing this in a Docker environment to ensure perfect reproducibility regardless of the machine used for compilation. I’ll need to look into how to set that up.

Last edited by seb3773 (2026-02-12 11:44)


Attachments:
txt CMakeLists.txt, Size: 7.04 KiB, Downloads: 21

Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#19 2026-02-12 13:57

bin
Member
From: U.K.
Registered: 2016-01-28
Posts: 1,558

Re: tde-compton "optimized" - update v3

Phew!! That worked! smile

Offline

#20 2026-02-15 20:10

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

bin wrote:

Phew!! That worked! smile

Cool !!

bin wrote:

Not sure I can see any difference but then I switch most of the effects off. However if it is more efficient then that's a good thing in itself!!

Yes, that should be the case. I’m almost certain I fixed at least one bug (which can only surface under rare conditions, but it’s cleaner this way) and a memory leak (the get_fbconfig_from_visualinfo function was leaking the FBConfigs array).
Most of the optimizations are cache/memory-related, so they won’t necessarily be visible in terms of raw performance, but they’re beneficial for memory management.
The only two actual performance optimizations are:

"SSE2-vectorized sum_gaussian for ~4x faster shadow blur computation on large kernels."
"Replaced gettimeofday with clock_gettime(CLOCK_MONOTONIC_COARSE) for faster timing."

Let’s be honest: on CPUs less than 15 years old, these are probably imperceptible. But just because something isn’t perceptible doesn’t mean it isn’t real. Having worked on embedded systems, I know that small streams make big rivers—meaning no optimization is negligible. Even if individual unoptimized parts don’t show noticeable effects in isolation, their cumulative impact always ends up costing you in performance.
To conclude, as I mentioned earlier, the stock compton-tde is already highly optimized and extremely lightweight/efficient. This iteration is more about pushing the limits further without compromising stability. (Other optimizations are possible, but not without risking stability, in my opinion.)
Using it will likely save very slightly on resources—even more so if you’re not using effects—but either way, it can’t hurt. wink

Last edited by seb3773 (2026-02-15 20:10)


Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

#21 2026-02-23 01:24

seb3773
Member
From: France
Registered: 2023-11-01
Posts: 210

Re: tde-compton "optimized" - update v3

***Update v2.0: Optimized Dual-Kawase Blur Support, initial post updated :-)


Debian & Q4OS (especially TDE), low-level C, ASM (z80/68k/x86/ARM64), embedded systems, CPU architectures (RISC-V, binary formats, assembly), retro-computing, metal, and sci-fi.

Offline

Board footer

Powered by FluxBB