<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/render.h, branch 1.26.1</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.26.1</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.26.1'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2026-02-02T11:40:50Z</updated>
<entry>
<title>wayland: wait for pre-apply damage thread before destroying a terminal instance</title>
<updated>2026-02-02T11:40:50Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2026-01-28T08:44:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c291194a4e593bbbb91420e81fa0111508084448'/>
<id>urn:sha1:c291194a4e593bbbb91420e81fa0111508084448</id>
<content type='text'>
It's possible, but unlikely, that we've pushed a "pre-apply damage"
job to the renderer thread queue (or that we've pushed it, and the
a thread is now working on it) when we shutdown a terminal instance.

This is sometimes caught in an assertion in term_destroy(), where we
check the queue length is 0. Other times, or in release builds, we
might crash in the thread, or in the shutdown logic when freeing the
buffer chains associated with the terminal instance.

Fix by ensuring there's no pre-apply damage operation queued, or
running, before shutting down a terminal instance.

Closes #2263
</content>
</entry>
<entry>
<title>render: when double-buffering, pre-apply previous frame's damage early</title>
<updated>2025-10-10T08:23:17Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-10-05T08:48:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=299186a6547f6e038ee6f3822caf9a0fdfabceef'/>
<id>urn:sha1:299186a6547f6e038ee6f3822caf9a0fdfabceef</id>
<content type='text'>
Foot likes it when compositor releases buffer immediately, as that
means we only have to re-render the cells that have changed since the
last frame.

For various reasons, not all compositors do this. In this case, foot
is typically forced to switch between two buffers, i.e. double-buffer.

In this case, each frame starts with copying over the damage from the
previous frame, to the new frame. Then we start rendering the updated
cells.

Bringing over the previous frame's damage can be slow, if the changed
area was large (e.g. when scrolling one or a few lines, or on full
screen updates). It's also done single-threaded. Thus it not only
slows down frame rendering, but pauses everything else (i.e. input
processing). All in all, it reduces performance and increases input
latency.

But we don't have to wait until it's time to render a frame to copy
over the previous frame's damage. We can do that as soon as the
compositor has released the buffer (for the frame _before_ the
previous frame). And we can do this in a thread.

This frees up foot to continue processing input, and reduces frame
rendering time since we can now start rendering the modified cells
immediately, without first doing a large memcpy(3).

In worst case scenarios (or perhaps we should consider them best case
scenarios...), I've seen up to a 10x performance increase in frame
rendering times (this obviously does *not* include the time it takes
to copy over the previous frame's damage, since that doesn't affect
neither input processing nor frame rendering).

Implemented by adding a callback mechanism to the shm abstraction
layer. Use it for the grid buffers, and kick off a thread that copies
the previous frame's damage, and resets the buffers age to 0 (so that
foot understands it can start render to it immediately when it later
needs to render a frame).

Since we have certain way of knowing if a compositor releases buffers
immediately or not, use a bit of heuristics; if we see 10 consecutive
non-immediate releases (that is, we reset the counter as soon as we do
see an immediate release), this new "pre-apply damage" logic is
enabled. It can be force-disabled with tweak.pre-apply-damage=no.

We also need to take care to wait for the thread before resetting the
render's "last_buf" pointer (or we'll SEGFAULT in the thread...).

We must also ensure we wait for the thread to finish before we start
rendering a new frame. Under normal circumstances, the wait time is
always 0, the thread has almost always finished long before we need to
render the next frame. But it _can_ happen.

Closes #2188
</content>
</entry>
<entry>
<title>config: tweak.surface-bit-depth now defaults to 'auto'</title>
<updated>2025-05-01T06:54:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-05-01T06:34:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e5a0755451b736c635be58764799ef8d7b536e8d'/>
<id>urn:sha1:e5a0755451b736c635be58764799ef8d7b536e8d</id>
<content type='text'>
When set to 'auto', use 10-bit surfaces if gamma-correct blending is
enabled, and 8-bit surfaces otherwise.

Note that we may still fallback to 8-bit surfaces (without disabling
gamma-correct blending) if the compositor does not support 10-bit
surfaces.

Closes #2082
</content>
</entry>
<entry>
<title>render: gamma-correct blending</title>
<updated>2025-03-05T17:45:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2025-02-21T10:01:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ccf625b9914917e131beb83379c526bab1927edc'/>
<id>urn:sha1:ccf625b9914917e131beb83379c526bab1927edc</id>
<content type='text'>
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 &gt;= 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 &gt;= 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
</content>
</entry>
<entry>
<title>render: Expose render_overlay</title>
<updated>2025-01-09T06:53:50Z</updated>
<author>
<name>Alexander Orzechowski</name>
<email>alex@ozal.ski</email>
</author>
<published>2025-01-05T03:26:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f0253633d3cdde994b48c25692707e1df2f1e1e7'/>
<id>urn:sha1:f0253633d3cdde994b48c25692707e1df2f1e1e7</id>
<content type='text'>
This function updates the overlay that foot uses. It will be used to
update the overlay when the flash effect ends.
</content>
</entry>
<entry>
<title>toplevel-icon: implement OSC-1, CSI 20/21/22/23 t</title>
<updated>2024-09-13T07:04:17Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2024-09-10T16:53:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=97ec375c67cc7b071b0478b6c887057008dc469e'/>
<id>urn:sha1:97ec375c67cc7b071b0478b6c887057008dc469e</id>
<content type='text'>
* The toplevel icon is now set to the app-id, unless "overridden" by
  OSC-1 or OSC-0.
* Implemented OSC-1
* OSC-0 extended to also set the icon
* Implemented CSI 20 t - report window icon
* Implemented CSI 21 t - report window title
* Implemented CSI 22 ; 1 t - push window icon
* Implemented CS 23 ; 1 t - pop window icon
* Extended CSI 22/23 ; 0 t to also push/pop the icon
* Verify app-id set by OSC-176 is valid UTF-8
* Verify icon set by OSC-0/1 is valid UTF-8
</content>
</entry>
<entry>
<title>osc: add support for osc 176 (app ID)</title>
<updated>2024-02-06T12:50:09Z</updated>
<author>
<name>delthas</name>
<email>delthas@dille.cc</email>
</author>
<published>2023-09-04T12:02:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6c56b04b3f312be8dcee307e29515f3c83b3ae87'/>
<id>urn:sha1:6c56b04b3f312be8dcee307e29515f3c83b3ae87</id>
<content type='text'>
This adds support for a new OSC escape sequence: OSC 176, that lets
terminal programs tell the terminal the name of the app that is
running. foot then sets the app ID of the toplevel to that ID,
which lets the compositor know which app is running, and typically
sets the appropriate icon, window grouping, ...

See: https://gist.github.com/delthas/d451e2cc1573bb2364839849c7117239
</content>
</entry>
<entry>
<title>feature: add resize-by-cells option to constrain window sizes...</title>
<updated>2024-02-05T11:14:53Z</updated>
<author>
<name>Andrew J. Hesford</name>
<email>ajh@sideband.org</email>
</author>
<published>2024-01-17T20:00:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=21a8d832ce12217ddd493cdcaefdc457128f2ada'/>
<id>urn:sha1:21a8d832ce12217ddd493cdcaefdc457128f2ada</id>
<content type='text'>
...to multiples of the cell size, and preserve grid size when changing
fonts or display scales in floating windows.
</content>
</entry>
<entry>
<title>refactor: track current xcursor using an enum, instead of a char pointer</title>
<updated>2023-07-03T12:36:32Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-06-27T14:57:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ee794a121e4603d01fb662ad6d1f3b18b6937d2c'/>
<id>urn:sha1:ee794a121e4603d01fb662ad6d1f3b18b6937d2c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: add render_xcursor_is_valid()</title>
<updated>2022-02-07T16:28:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-01-01T12:56:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e4f9dc7d581cf134e850bd02a9c4ae3e5989905a'/>
<id>urn:sha1:e4f9dc7d581cf134e850bd02a9c4ae3e5989905a</id>
<content type='text'>
Returns true if the provided cursor name is non-NULL, and exist in the
currently loaded xcursor theme.
</content>
</entry>
<entry>
<title>replace gettimeofday with clock_gettime</title>
<updated>2022-01-15T16:05:45Z</updated>
<author>
<name>Pranjal Kole</name>
<email>pranjal.kole7@gmail.com</email>
</author>
<published>2022-01-15T09:26:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0da19a81bc9a94f83bfcf8c5af0e3571f751cf38'/>
<id>urn:sha1:0da19a81bc9a94f83bfcf8c5af0e3571f751cf38</id>
<content type='text'>
POSIX.1-2008 has marked gettimeofday(2) as obsolete, recommending the
use of clock_gettime(2) instead.

CLOCK_MONOTONIC has been used instead of CLOCK_REALTIME because it is
unaffected by manual changes in the system clock. This makes it better
for our purposes, namely, measuring the difference between two points in
time.

tv_sec has been casted to long in most places since POSIX does not
define the actual type of time_t.
</content>
</entry>
<entry>
<title>input: Add support for xdg_toplevl.show_window_menu()</title>
<updated>2021-11-29T15:26:40Z</updated>
<author>
<name>Jonas Ådahl</name>
<email>jadahl@gmail.com</email>
</author>
<published>2021-11-19T14:08:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=38741baf9afc2697c7e508cb87c3b2983de9f0af'/>
<id>urn:sha1:38741baf9afc2697c7e508cb87c3b2983de9f0af</id>
<content type='text'>
This makes, if the compositor supports it, the window menu appear when
right clicking on the title bar.
</content>
</entry>
<entry>
<title>urls: initial support for detecting URLs and rendering jump-labels</title>
<updated>2021-02-07T15:33:31Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-31T10:12:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2cc84db97978388475504592c88911046bcd2eb6'/>
<id>urn:sha1:2cc84db97978388475504592c88911046bcd2eb6</id>
<content type='text'>
The jump labels work, but is currently hardcoded to use xdg-open
</content>
</entry>
<entry>
<title>render: remove render_refresh_margins()</title>
<updated>2020-09-29T08:08:59Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-09-29T08:08:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7ffd31e13a8834938550222d8b6078c4b98616f8'/>
<id>urn:sha1:7ffd31e13a8834938550222d8b6078c4b98616f8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: implement render_refresh_margins()</title>
<updated>2020-09-01T05:33:44Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-09-01T05:33:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=2488c3935bbd0cb8e920f294b31deec13cfb89bd'/>
<id>urn:sha1:2488c3935bbd0cb8e920f294b31deec13cfb89bd</id>
<content type='text'>
For now, it will reset term-&gt;render.last_buf to NULL, and then calls
grid_render() to do a full screen refresh.
</content>
</entry>
<entry>
<title>multi-seat: improve handling of multiple (mouse) pointers</title>
<updated>2020-07-09T07:52:11Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-07-09T07:52:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4e48d550efba98ebecf4b60045004e52c585c52d'/>
<id>urn:sha1:4e48d550efba98ebecf4b60045004e52c585c52d</id>
<content type='text'>
* xcursor always set for all pointers
* xcursor sometimes not updated when it should be
* mouse grabbed state wasn't per seat, but global (i.e. "does at least
  one seat enable mouse grabbing")
* selection enabled state wasn't per seat
</content>
</entry>
<entry>
<title>multi-seat: enable xcursor theme support again</title>
<updated>2020-07-08T16:08:39Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-07-08T16:08:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=be2490022d445bef2c5c00336aecf2bd9dd25ee7'/>
<id>urn:sha1:be2490022d445bef2c5c00336aecf2bd9dd25ee7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>render: pace title updates</title>
<updated>2020-03-25T17:23:55Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-03-25T17:23:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9bbbd26c7a2bad131b093cfd559a68fb59613af0'/>
<id>urn:sha1:9bbbd26c7a2bad131b093cfd559a68fb59613af0</id>
<content type='text'>
Synchronize window title updates with window rendering.
</content>
</entry>
<entry>
<title>render: never render CSD and/or search box "immediately"</title>
<updated>2020-03-06T18:16:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-03-06T18:16:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c5a1af4e534f0f290ea885b221d7d37d020ac994'/>
<id>urn:sha1:c5a1af4e534f0f290ea885b221d7d37d020ac994</id>
<content type='text'>
Handle the CSDs and the search box the same way we handle the main
grid; when we need to redraw them, call
render_refresh_{csd,search}(). This sets a flag that is checked after
each FDM iteration. All actual rendering is done here.

This also ties the commits of the Wayland sub-surfaces to the commit
of the main surface.
</content>
</entry>
<entry>
<title>csd: initial implementation of minimize/maximize/close buttons</title>
<updated>2020-03-02T19:29:28Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-03-02T19:29:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=9699c9b8bfcbd7f9ebef5ee4ffe370cb03b1c8a2'/>
<id>urn:sha1:9699c9b8bfcbd7f9ebef5ee4ffe370cb03b1c8a2</id>
<content type='text'>
</content>
</entry>
</feed>
