1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-18 19:01:36 +03:00
Commit Graph

3328 Commits

Author SHA1 Message Date
Wez Furlong
04b7cedd02 fix animated gif playback
A casualty of b8dcfba9a4 was that
the decoded gif would get reset each time the texture filled up.

Take care to move that cached into the newly minted glyphcache.
2021-03-14 10:29:02 -07:00
Wez Furlong
09081d2189 improve texture upload performance, part 2
Continuing along the same lines as the prior commit, the goal
of this commit is to remove the buffer transformation that was
part of uploading the texture to the GPU provided surface.

In order to do so:

* The sense of our local textures needs to change from bgra32 to rgba32.
  bgra32 was a hangover from earlier versions of our window crate that
  allowed direct-to-fb writes in software mode.  We had to pick bgra32
  for that for the broadest OS compatibility.  I believe that that
  constraint has been totally removed, although there is a chance that
  this will flip the colors on macos.
* There was an additional linear-to-srgb conversion inlined in that
  buffer transformation.  I have no idea where that is needed because
  the source data is carefully constructed as SRGB.  I don't yet know
  how to signal that, but for now I've moved that gamma correction
  into the shader when we sample the texture.

With this change, timg playback now has vtparse as the hottest
region of code.

refs: #537
2021-03-14 09:14:30 -07:00
Wez Furlong
b8dcfba9a4 improve texture upload performance
Two issues highlighted by profiling:

* Clearing the texture takes a non-trivial percentage of the profile.
  The docs suggest that it is better to create a new texture than
  to update large portions of a texture, so add some plumbing so
  that we can do that in the first texture-full case.

* Next on the list is the code that translates from linear BGRA to
  SRGBA.  This is present for reasons that I believe are now legacy,
  but for the moment: those two primitives now have faster and
  easier implementations, so simplify to those.

This improves the timg video playback performance by ~10% for me.

refs: #537
2021-03-13 23:18:15 -08:00
Wez Furlong
693a717db2 improve output parsing performance and throughput
I've been meaning to do this for a while; this commit moves
the escape sequence parsing into the thread that reads the
pty output which achieves two goals:

* Large escape sequences (eg: image protocols) that span multiple
  4k buffers can be processed without ping-ponging between the
  reader thread and the main gui thread
* That parsing can happen in the reader thread, keeping the gui
  thread more responsive.

These changes free up the CPU during intensive operations such
as timg video playback.

This is a slight layering violation, in that this processing
really belongs to local pane (or any pane that embeds Terminal),
rather than generically at the Mux layer, but it's not any
worse a violation than `advance_bytes` already was.

refs: https://github.com/wez/wezterm/issues/537
2021-03-13 19:19:05 -08:00
Wez Furlong
c898250141 docs: changelog to summarize timg related changes
refs https://github.com/wez/wezterm/issues/537
2021-03-13 16:32:14 -08:00
Wez Furlong
fa7aa3a427 improve downscaling for single frame images
The default downscaling provided by the GPU can result in noisy
artifacts on highly detailed images.

This commit employs a cubic Catmull-Rom sampling filter for the
case where we have a single frame image that is being reduced
in size.  This isn't the highest quality filter but strikes
a good balance with speed vs appearance and is strictly better
than the GPU texture sampling options that I could try.
2021-03-13 16:22:44 -08:00
Wez Furlong
5fa5aef7f3 Disable newline splitting in output processing
In a couple of quick tests, this doesn't seem to break cat'ing
the emoji test data so it seems like it isn't needed anymore.

In addition, it removes a bottleneck from processing image
streams produced by timg, which tend to be very large with
new newlines.

With this change, I'm able to view a 25fps source video at
about 60fps.

refs: https://github.com/wez/wezterm/issues/537
2021-03-13 14:23:36 -08:00
Wez Furlong
6133f88d6a term: avoid full image decode when parsing iterm2 protocol
Just decode the size

refs: https://github.com/wez/wezterm/issues/537
2021-03-13 13:34:44 -08:00
Wez Furlong
e5974ad86f iterm2 image protocol: make image fit to terminal dimensions
when the size is set to auto, we'd essentially take the image as-is
and overflow the terminal.

This commit makes auto scale down the image to fit the terminal dimensions
if it is too big.
2021-03-13 13:14:46 -08:00
Wez Furlong
333f5f9750 fix a rounding issue when computing block glyphs
The leftmost pixel was being set to at least 1 by the scale
function.

Fix that up by computing the x coordinate without calling
the scale function.

refs: https://github.com/wez/wezterm/issues/536
2021-03-13 11:29:57 -08:00
Wez Furlong
04a21acdf4 docs: reorder changelog 2021-03-13 10:53:27 -08:00
Wez Furlong
3d642461f8 fixup pty pixel size calculation
Derive the pixels from the rows/cols rather than the available space.

refs: https://github.com/wez/wezterm/issues/535
2021-03-13 09:31:13 -08:00
Wez Furlong
868a085157 termwiz: shrink-to-fit Line::cells when clearing the line
refs: https://github.com/wez/wezterm/issues/534
2021-03-13 08:25:09 -08:00
Wez Furlong
f4105cb42f avoid excess capacity when dealing with iterm2 image protocol
Using a boxed slice means that we hold exactly the memory required
for the file data, rather than the next-power-of-two, which can
be wasteful when a large number of images are being sent to
the terminal.

This is a API breaking change for termwiz, so bump its version.

refs: #534
2021-03-13 08:10:48 -08:00
Wez Furlong
dd5db065dc remove stray debug print 2021-03-13 08:06:03 -08:00
Wez Furlong
9be7b8f6ec and fixup the test build
refs: #534
2021-03-13 01:03:04 -08:00
Wez Furlong
26f9d91e43 set an upper bound on the image/frame caches
While adding gif support I let this become unbounded.
This commit resolves that by categorizing images as either
single frame or animations.

Single frame images are decoded and held entirely in the texture
atlas, so occupy no additional space beyond the image file contents
and their sprite region in the texture atlas.

Animations are decoded into a set of frame bitmaps.  There can be
up to 16 animations (each with their full set of frames) cached.
The individual frames may also exist within the texture atlas
if space permits.

refs: #534
2021-03-13 00:47:38 -08:00
Wez Furlong
48a3674c9a wayland: fix a panic during initialization 2021-03-12 22:48:37 -08:00
Wez Furlong
9ddc2da625 docs: document styling the tab bar elements
refs: https://github.com/wez/wezterm/issues/500
2021-03-12 09:23:00 -08:00
Wez Furlong
4ec48b1245 gifs: start at frame 0, not 1!
This fixes the panic that @mborejdo reported in
<https://matrix.to/#/!PirwUBcuIlTXwNveYz:matrix.org/$skjhC1EgMG5x0Wte0i6JquMHkQK2mST2zJoB_qrLMRc?via=matrix.org>
2021-03-12 08:39:53 -08:00
Mark Juggurnauth-Thomas
60c0d91a07 termwiz: use cnorm instead of cvvis for CursorVisibility::Visible 2021-03-12 08:20:01 -08:00
Mark Juggurnauth-Thomas
ee03d9a260 termwiz: revert tmux workarounds
We can support tmux by properly supporting the distinction between
`cvvis` and `cnorm`.
2021-03-12 08:20:01 -08:00
Wez Furlong
77011593b7 termwiz: alternate plan for restoring cursor visibility in tmux
backout 7c49b43472 and go with
the alternate plan of switching TERM=tmux if `$TERM==screen && $TMUX`.

refs: https://github.com/markbt/streampager/issues/37#issuecomment-797274512
2021-03-11 23:23:32 -08:00
Wez Furlong
7c49b43472 termwiz: improve restoring cursor visibility under tmux
refs: <https://github.com/markbt/streampager/issues/37#issuecomment-797241725>
2021-03-11 22:23:53 -08:00
Wez Furlong
1097f329cf fixup x position for new tab button 2021-03-11 21:25:54 -08:00
Wez Furlong
eb4323ee59 add config for customizing the tabs and new tab button
```lua
local wezterm = require 'wezterm';

-- The filled in variant of the < symbol
local SOLID_LEFT_ARROW = utf8.char(0xe0b2)

-- The filled in variant of the > symbol
local SOLID_RIGHT_ARROW = utf8.char(0xe0b0)

return {
  tab_bar_style = {
    active_tab_left = wezterm.format({
      {Background={Color="#0b0022"}},
      {Foreground={Color="#2b2042"}},
      {Text=SOLID_LEFT_ARROW},
    }),
    active_tab_right = wezterm.format({
      {Background={Color="#0b0022"}},
      {Foreground={Color="#2b2042"}},
      {Text=SOLID_RIGHT_ARROW},
    }),
    inactive_tab_left = wezterm.format({
      {Background={Color="#0b0022"}},
      {Foreground={Color="#1b1032"}},
      {Text=SOLID_LEFT_ARROW},
    }),
    inactive_tab_right = wezterm.format({
      {Background={Color="#0b0022"}},
      {Foreground={Color="#1b1032"}},
      {Text=SOLID_RIGHT_ARROW},
    }),
  }
}
```
2021-03-11 21:22:10 -08:00
Wez Furlong
62d1d11eaf fall back to single frame gif parse if animated mode fails
At least we'll show something if we have a malformed gif.
2021-03-11 19:54:41 -08:00
Wez Furlong
9b3d35623f handle image decoding errors and return a placeholder
https://i.giphy.com/media/3owvKqP4VSydZE4pvq/200w.gif cannot
be decoded as an animated gif due to this error: `No end code in lzw stream`

Ensure that we don't completely fail to process the render phase
as a result.
2021-03-11 19:45:48 -08:00
Wez Furlong
b8390b3f7a animated images: now schedule repaint based on next frame time
Previously, invalidation for animation was driven by the cursor
blink rate, which meant that animated gifs/pngs could not play
faster than 5fps (default blink interval is 200ms).

This commit calculates the next invalidation time based on the
closes next frame time of all animated cells in the viewport.
2021-03-11 08:14:39 -08:00
Wez Furlong
c5cb0ef66d Added support for animated gifs and pngs
This is first draft; the animation rate is currently tied
to the cursor_blink_rate setting, so if the gif has frames that
are intended to display more frequently than that, they will
animate more slowly.

Animation is only carried out while the window has focus.
Animation increases the load on the GPU and thus uses more power.

It's kinda fun to stick one of these animated pixel gifs in the background:
https://imgur.com/gallery/F9DAH
2021-03-11 00:41:54 -08:00
Wez Furlong
684b7ea95d Windows: fix "Open WezTerm Here" for C:\
closes: https://github.com/wez/wezterm/issues/451
closes: https://github.com/wez/wezterm/issues/526
2021-03-10 20:12:47 -08:00
Wez Furlong
1c1a4ebe05 windows: track per-window config
I hadn't hooked this up fully... and so now I have.
2021-03-10 20:06:02 -08:00
Wez Furlong
f6c37ae371 increase default font size to 12 points 2021-03-10 19:43:02 -08:00
Wez Furlong
da2239f1be docs: fixup screenshot links
refs: #500
2021-03-10 19:32:23 -08:00
Wez Furlong
d853be02ad docs: for the new status bar feature
refs: https://github.com/wez/wezterm/issues/500
2021-03-10 19:29:17 -08:00
Wez Furlong
62e23858d0 docs: fix backslashes in hyperlink docs 2021-03-10 09:00:14 -08:00
Wez Furlong
182a4d068b ensure that we only use the default size when spawning new windows 2021-03-10 00:19:50 -08:00
Wez Furlong
83e9d672a4 spawning a new window should use the size from the config
rather than the size of the current window.
2021-03-10 00:15:26 -08:00
Wez Furlong
fc3ebcedc1 docs: improve SEO for finding how to specify window size 2021-03-10 00:12:28 -08:00
Wez Furlong
da596b83be docs: clarify which cursor 2021-03-09 23:57:14 -08:00
Wez Furlong
73c9a3e733 docs: fixup typo 2021-03-09 23:56:42 -08:00
Wez Furlong
229df874b7 docs: break out events into their own pages
Take the existing open-uri docs and move to their own page.
Add docs for the new window events.
2021-03-09 21:50:48 -08:00
Wez Furlong
354a12a0ff docs: mention the CLI config overrides and per-window overrides 2021-03-09 21:26:03 -08:00
Wez Furlong
4c6780bb32 changelog for XCursor theme changes
closes: https://github.com/wez/wezterm/issues/524
2021-03-09 21:16:26 -08:00
Wez Furlong
8f3b8586b0 docs: changelog for https://github.com/wez/wezterm/issues/515
closes: https://github.com/wez/wezterm/issues/515
closes: https://github.com/wez/wezterm/issues/523
2021-03-09 21:13:17 -08:00
Wez Furlong
21f3f90e34 x11: remove some dead code 2021-03-09 08:21:23 -08:00
Wez Furlong
64a0aab3be docs: mention F1-F24 as available keys
closes: https://github.com/wez/wezterm/issues/521
2021-03-09 07:47:27 -08:00
Wez Furlong
fa9cf66fa2 Add file:// to the default implicit hyperlink rule list
closes: https://github.com/wez/wezterm/issues/525
2021-03-09 07:43:33 -08:00
Wez Furlong
de92c0f8e3 add xcb-render for debian
refs: #524
2021-03-08 22:54:25 -08:00
Wez Furlong
381f0e68ef add xcb image for debian, freebsd and arch, maybe
not 100% sure about freebsd and arch

refs: https://github.com/wez/wezterm/issues/524
2021-03-08 22:26:29 -08:00