Skip to content

Commit

Permalink
Merge branch 'next' into feat-convert-legacy-parameters-to-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Oct 20, 2024
2 parents e83bf64 + 1648673 commit a14eb35
Show file tree
Hide file tree
Showing 38 changed files with 1,073 additions and 416 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/cross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: cross
on: push

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix build '.#picom-cross.merged' -L

2 changes: 2 additions & 0 deletions .github/workflows/page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
asciidoctor -a doctype=article -a stylesheet=../assets/next.css -b html man/picom-trans.1.adoc -D _site
cp -r assets _site/
cp _site/picom.1.html _site/index.html
- name: Copy .well-known
run: cp -r .well-known _site

- name: Upload
uses: actions/upload-pages-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions .well-known/funding-manifest-urls
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://yshui.github.io/funding.json
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
- `sw-opti`
- `clear-shadow`

# 12.x (unreleased)

## Build fixes

* Fix build on arm32 (#1355)

# 12.3 (2024-Oct-14)

## Improvements
Expand Down
83 changes: 34 additions & 49 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,22 @@
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
flake-utils,
nixpkgs,
git-ignore-nix,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
outputs =
{ self
, flake-utils
, nixpkgs
, git-ignore-nix
, ...
}:
flake-utils.lib.eachDefaultSystem (system:
let
# like lib.lists.remove, but takes a list of elements to remove
removeFromList = toRemove: list: pkgs.lib.foldl (l: e: pkgs.lib.remove e l) list toRemove;
overlay = self: super: {
picom = super.picom.overrideAttrs (oldAttrs: rec {
version = "11";
pname = "picom";
nativeBuildInputs = (removeFromList [ self.asciidoc ] oldAttrs.nativeBuildInputs) ++
[
self.asciidoctor
];
buildInputs =
[
self.pcre2
self.xorg.xcbutil
self.libepoxy
] ++ (removeFromList [
self.xorg.libXinerama
self.xorg.libXext
self.pcre
] oldAttrs.buildInputs);
src = git-ignore-nix.lib.gitignoreSource ./.;
});
};
python = pkgs.python3.withPackages (ps: with ps; [
xcffib pip dbus-next
]);

picomOverlay = final: prev: { picom = prev.callPackage ./package.nix { }; };
overlays = [
(final: prev: { inherit git-ignore-nix; })
picomOverlay
];
pkgs = import nixpkgs {
inherit system overlays;
config.allowBroken = true;
Expand All @@ -60,15 +41,8 @@
];
};

overlays = [overlay];
mkDevShell = p: p.overrideAttrs (o: {
nativeBuildInputs = o.nativeBuildInputs ++ (with pkgs; [
clang-tools_18
llvmPackages_18.clang-unwrapped.python
llvmPackages_18.libllvm
python
]);
hardeningDisable = ["fortify"];
hardeningDisable = [ "fortify" ];
shellHook = ''
# Workaround a NixOS limitation on sanitizers:
# See: https://github.com/NixOS/nixpkgs/issues/287763
Expand All @@ -77,21 +51,32 @@
export ASAN_OPTIONS="disable_coredump=0:unmap_shadow_on_exit=1:abort_on_error=1"
'';
});
in rec {
inherit
overlay
overlays
;
in
rec {
overlay = picomOverlay;
packages = {
picom = pkgs.picom;
default = pkgs.picom;
};
devShells.default = mkDevShell packages.default;
} // (nixpkgs.lib.optionalAttrs (system == "x86_64-linux") rec {
picom-cross = {
armv7l = pkgs.pkgsCross.armv7l-hf-multiplatform.picom;
aarch64 = pkgs.pkgsCross.aarch64-multiplatform.picom;
i686 = pkgs.pkgsi686Linux.picom;
merged = pkgs.runCommand "picom-merged" {} ''
mkdir $out
ln -s ${picom-cross.armv7l} $out/armv7l
ln -s ${picom-cross.aarch64} $out/aarch64
ln -s ${picom-cross.i686} $out/i686
'';
};
});
devShells.default = mkDevShell (packages.default.override { devShell = true; });
devShells.useClang = devShells.default.override {
inherit (pkgs.llvmPackages_18) stdenv;
};
# build picom and all dependencies with frame pointer, making profiling/debugging easier.
# WARNING! many many rebuilds
devShells.useClangProfile = (mkDevShell profilePkgs.picom).override {
devShells.useClangProfile = (mkDevShell (profilePkgs.picom.override { devShell = true; })).override {
stdenv = profilePkgs.withCFlags "-fno-omit-frame-pointer" profilePkgs.llvmPackages_18.stdenv;
};
});
Expand Down
43 changes: 0 additions & 43 deletions include/picom/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,49 +172,6 @@ enum backend_image_capability {
BACKEND_IMAGE_CAP_DST = 1 << 1,
};

enum backend_command_op {
BACKEND_COMMAND_INVALID = -1,
BACKEND_COMMAND_BLIT,
BACKEND_COMMAND_BLUR,
BACKEND_COMMAND_COPY_AREA,
};

/// Symbolic references used as render command source images. The actual `image_handle`
/// will later be filled in by the renderer using this symbolic reference.
enum backend_command_source {
BACKEND_COMMAND_SOURCE_WINDOW,
BACKEND_COMMAND_SOURCE_WINDOW_SAVED,
BACKEND_COMMAND_SOURCE_SHADOW,
BACKEND_COMMAND_SOURCE_BACKGROUND,
};

// TODO(yshui) might need better names

struct backend_command {
enum backend_command_op op;
ivec2 origin;
enum backend_command_source source;
union {
struct {
struct backend_blit_args blit;
/// Region of the screen that will be covered by this blit
/// operations, in screen coordinates.
region_t opaque_region;
};
struct {
image_handle source_image;
const region_t *region;
} copy_area;
struct backend_blur_args blur;
};
/// Source mask for the operation.
/// If the `source_mask` of the operation's argument points to this, a mask image
/// will be created for the operation for the renderer.
struct backend_mask_image source_mask;
/// Target mask for the operation.
region_t target_mask;
};

enum backend_quirk {
/// Backend cannot do blur quickly. The compositor will avoid using blur to create
/// shadows on this backend
Expand Down
21 changes: 10 additions & 11 deletions man/picom.1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ OPTIONS
Daemonize process. Fork to background after initialization. This option can only be set from the command line, setting this in the configuration file will have no effect.
*--log-level*::
Set the log level. Possible values are "TRACE", "DEBUG", "INFO", "WARN", "ERROR", in increasing level of importance. Case doesn't matter. If using the "TRACE" log level, it's better to log into a file using *--log-file*, since it can generate a huge stream of logs.
Set the log level. Possible values are "TRACE", "VERBOSE", "DEBUG", "INFO", "WARN", "ERROR", in increasing level of importance. Case doesn't matter. If using the "TRACE" log level, it's better to log into a file using *--log-file*, since it can generate a huge stream of logs.
*--log-file*::
Set the log file. If *--log-file* is never specified, logs will be written to stderr. Otherwise, logs will to written to the given file, though some of the early logs might still be written to the stderr. When setting this option from the config file, it is recommended to use an absolute path.
Expand All @@ -71,10 +71,10 @@ OPTIONS
Show all X errors (for debugging).
*--config* _PATH_::
Look for configuration file at the path. See *CONFIGURATION FILES* section below for where picom looks for a configuration file by default. Use `/dev/null` to avoid loading configuration file.
Look for configuration file at the path. See xref:_configuration_files[*CONFIGURATION FILES*] section below for where picom looks for a configuration file by default. Use `/dev/null` to avoid loading configuration file.
*--write-pid-path* _PATH_::
Write process ID to a file. it is recommended to use an absolute path.
Write process ID to a file. It is recommended to use an absolute path.
*--plugins* _PATH_::
Specify plugins to load. Plugins will first be searched in current working directory (unless specified in the config file, in which case this step is skipped), then in `$XDG_CONFIG_HOME/picom/plugins`, then in `$XDG_CONFIG_DIRS/picom/plugins`. If all of the above fail, the plugin name is passed directly to the dynamic loader. Can be specified multiple times to load more than one plugins.
Expand Down Expand Up @@ -173,10 +173,10 @@ OPTIONS
Use _WM_TRANSIENT_FOR_ to group windows, and consider windows in the same group focused at the same time.

[[detect-client-leader]]*--detect-client-leader*::
Use _WM_CLIENT_LEADER_ to group windows, and consider windows in the same group focused at the same time. This usually means windows from the same application will be considered focused or unfocused at the same time._WM_TRANSIENT_FOR_ has higher priority if *--detect-transient* is enabled, too.
Use _WM_CLIENT_LEADER_ to group windows, and consider windows in the same group focused at the same time. This usually means windows from the same application will be considered focused or unfocused at the same time. _WM_TRANSIENT_FOR_ has higher priority if *--detect-transient* is enabled, too.

*--blur-method*, *--blur-size*, *--blur-deviation*, *--blur-strength*::
Parameters for background blurring, see the *BLUR* section for more information.
Parameters for background blurring, see the xref:_blur[*BLUR*] section for more information.

*--blur-background*::
Blur background of semi-transparent / ARGB windows. Bad in performance, with driver-dependent behavior. The name of the switch may change without prior notifications.
Expand Down Expand Up @@ -206,7 +206,7 @@ A 7x7 Gaussian blur kernel (sigma = 0.84089642) looks like:
--blur-kern '7,7,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000102,0.003494,0.029143,0.059106,0.029143,0.003494,0.000102,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.001723,0.059106,0.493069,0.493069,0.059106,0.001723,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000102,0.003494,0.029143,0.059106,0.029143,0.003494,0.000102,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003'
----
+
May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box`, `3x3gaussian`, `5x5gaussian`, `7x7gaussian`, `9x9gaussian`, `11x11gaussian`. All Gaussian kernels are generated with sigma = 0.84089642 . If you find yourself needing to generate custom blur kernels, you might want to try the new blur configuration (See *BLUR*).
May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box`, `3x3gaussian`, `5x5gaussian`, `7x7gaussian`, `9x9gaussian`, `11x11gaussian`. All Gaussian kernels are generated with sigma = 0.84089642 . If you find yourself needing to generate custom blur kernels, you might want to try the new blur configuration (see the xref:_blur[*BLUR*] section).

[[blur-background-exclude]]*--blur-background-exclude* _CONDITION_::
Exclude conditions for background blur.
Expand All @@ -221,12 +221,11 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box
Crop shadow of a window fully on a particular monitor to that monitor. This is currently implemented using the X RandR extension.

*--backend* _BACKEND_::
Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`. `xrender` is the default one.
Specify the backend to use: `xrender` or `glx`. `xrender` is the default one.
+
--
* `xrender` backend performs all rendering operations with X Render extension. It is what `xcompmgr` uses, and is generally a safe fallback when you encounter rendering artifacts or instability.
* `glx` (OpenGL) backend performs all rendering operations with OpenGL. It is more friendly to some VSync methods, and has significantly superior performance on color inversion (*--invert-color-include*) or blur (*--blur-background*). It requires proper OpenGL 2.0 support from your driver and hardware. You may wish to look at the GLX performance optimization options below. *--xrender-sync-fence* might be needed on some systems to avoid delay in changes of screen contents.
* `xr_glx_hybrid` backend renders the updated screen contents with X Render and presents it on the screen with GLX. It attempts to address the rendering issues some users encountered with GLX backend and enables the better VSync of GLX backends. *--vsync-use-glfinish* might fix some rendering issues with this backend.
--

*--no-use-damage*::
Expand All @@ -239,7 +238,7 @@ May also be one of the predefined kernels: `3x3box` (default), `5x5box`, `7x7box
Force all windows to be painted with blending. Useful if you have a window shader that could turn opaque pixels transparent.

*--dbus*::
Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
Enable remote control via D-Bus. See the xref:_d_bus_api[*D-BUS API*] section below for more details.

*--benchmark* _CYCLES_::
Benchmark mode. Repeatedly paint until reaching the specified cycles.
Expand Down Expand Up @@ -750,11 +749,11 @@ If you have created an animation script that you think is particularly cool, you
SHADER INTERFACE
----------------
This secion describes the interface of a custom shader, how it is used by picom, and what parameters are passed by picom to the shader.
This section describes the interface of a custom shader, how it is used by picom, and what parameters are passed by picom to the shader.
A custom shader is a GLSL fragment shader program, which can be used to override the default way of how a window is rendered. If a custom shader is used, the default picom effects (e.g. dimming, color inversion, etc.) will no longer be automatically applied. It would be the custom shader's responsibility to apply these effects.
The interface between picom and a custom shader is dependent on which backend is being used. The xrender backend doesn't support shader at all. Here we descibe the interface provided by the glx backend.
The interface between picom and a custom shader is dependent on which backend is being used. The xrender backend doesn't support shader at all. Here we describe the interface provided by the glx backend.
The shader must define a function, _vec4 window_shader()_, which would be the entry point of the shader. The returned _vec4_ will be used to set __gl_FragColor__. A function, _vec4 default_post_processing(vec4 c)_, is provided for applying the default picom effects to input color 'c'.
Expand Down
109 changes: 109 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{ asciidoctor
, dbus
, docbook_xml_dtd_45
, docbook_xsl
, fetchFromGitHub
, clang-tools_18
, llvmPackages_18
, lib
, libconfig
, libdrm
, libev
, libGL
, libepoxy
, libX11
, libxcb
, libxdg_basedir
, libXext
, libxml2
, libxslt
, makeWrapper
, meson
, ninja
, pcre2
, pixman
, pkg-config
, python3
, stdenv
, uthash
, xcbutil
, xcbutilimage
, xcbutilrenderutil
, xorgproto
, xwininfo
, withDebug ? false
, git-ignore-nix
, devShell ? false
}:

let
versionFromMeson = s: builtins.head (builtins.match "project\\('picom',.*version: *'([0-9.]*)'.*" s);
in
stdenv.mkDerivation (finalAttrs: {
pname = "picom";
version = versionFromMeson (builtins.readFile ./meson.build);

src = git-ignore-nix.lib.gitignoreSource ./.;

strictDeps = true;


nativeBuildInputs = [
asciidoctor
docbook_xml_dtd_45
docbook_xsl
makeWrapper
meson
ninja
pkg-config
] ++ (lib.optional devShell [
clang-tools_18
llvmPackages_18.clang-unwrapped.python
llvmPackages_18.libllvm
(python3.withPackages (ps: with ps; [
xcffib pip dbus-next
]))
]);

buildInputs = [
dbus
libconfig
libdrm
libev
libGL
libepoxy
libX11
libxcb
libxdg_basedir
libXext
libxml2
libxslt
pcre2
pixman
uthash
xcbutil
xcbutilimage
xcbutilrenderutil
xorgproto
];

# Use "debugoptimized" instead of "debug" so perhaps picom works better in
# normal usage too, not just temporary debugging.
mesonBuildType = if withDebug then "debugoptimized" else "release";
dontStrip = withDebug;

mesonFlags = [
"-Dwith_docs=true"
];

installFlags = [ "PREFIX=$(out)" ];

# In debug mode, also copy src directory to store. If you then run `gdb picom`
# in the bin directory of picom store path, gdb finds the source files.
postInstall = ''
wrapProgram $out/bin/picom-trans \
--prefix PATH : ${lib.makeBinPath [ xwininfo ]}
'' + lib.optionalString withDebug ''
cp -r ../src $out/
'';
})
Loading

0 comments on commit a14eb35

Please sign in to comment.