aboutsummaryrefslogtreecommitdiff
path: root/pgo
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-02-21 10:01:29 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-03-05 17:45:01 +0000
commitccf625b9914917e131beb83379c526bab1927edc (patch)
treec996479765fcb3aba2547f211ae7e6f848a4b264 /pgo
parentconfig: add search-bindings.delete-to-{start,end} key bindings (diff)
render: gamma-correct blending
This implements gamma-correct blending, which mainly affects font rendering. The implementation requires compile-time availability of the new color-management protocol (available in wayland-protocols >= 1.41), and run-time support for the same in the compositor (specifically, the EXT_LINEAR TF function and sRGB primaries). How it works: all colors are decoded from sRGB to linear (using a lookup table, generated in the exact same way pixman generates it's internal conversion tables) before being used by pixman. The resulting image buffer is thus in decoded/linear format. We use the color-management protocol to inform the compositor of this, by tagging the wayland surfaces with the 'ext_linear' image attribute. Sixes: all colors are sRGB internally, and decoded to linear before being used in any sixels. Thus, the image buffers will contain linear colors. This is important, since otherwise there would be a decode/encode penalty every time a sixel is blended to the grid. Emojis: we require fcft >= 3.2, which adds support for sRGB decoding color glyphs. Meaning, the emoji pixman surfaces can be blended directly to the grid, just like sixels. Gamma-correct blending is enabled by default *when the compositor supports it*. There's a new option to explicitly enable/disable it: gamma-correct-blending=no|yes. If set to 'yes', and the compositor does not implement the required color-management features, warning logs are emitted. There's a loss of precision when storing linear pixels in 8-bit channels. For this reason, this patch also adds supports for 10-bit surfaces. For now, this is disabled by default since such surfaces only have 2 bits for alpha. It can be enabled with tweak.surface-bit-depth=10-bit. Perhaps, in the future, we can enable it by default if: * gamma-correct blending is enabled * the user has not enabled a transparent background
Diffstat (limited to 'pgo')
-rw-r--r--pgo/pgo.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/pgo/pgo.c b/pgo/pgo.c
index 88e862b8..8a4967ba 100644
--- a/pgo/pgo.c
+++ b/pgo/pgo.c
@@ -128,6 +128,12 @@ render_worker_thread(void *_ctx)
return 0;
}
+bool
+render_do_linear_blending(const struct terminal *term)
+{
+ return false;
+}
+
struct extraction_context *
extract_begin(enum selection_kind kind, bool strip_trailing_empty)
{
@@ -197,7 +203,9 @@ void shm_unref(struct buffer *buf) {}
void shm_chain_free(struct buffer_chain *chain) {}
struct buffer_chain *
-shm_chain_new(struct wl_shm *shm, bool scrollable, size_t pix_instances)
+shm_chain_new(
+ struct wayland *wayl, bool scrollable, size_t pix_instances,
+ bool ten_bit_it_if_capable)
{
return NULL;
}