Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid refactor #342

Merged
merged 5 commits into from
Dec 13, 2021
Merged

Grid refactor #342

merged 5 commits into from
Dec 13, 2021

Conversation

christianparpart
Copy link
Member

@christianparpart christianparpart commented Jul 23, 2021

goals

  • fix existing grid reflow related bugs and SEGV
  • greatly improve text throughput performance
  • reduce complexity

This PR also fixes: #371

Checklist

  • ESC c (RIS, hard reset) not working when LF'ing is moving lines into scrollback.
  • Change VT Parser to use char instead char32_t #471 VT Parser: use char instead of char32_t, later in Ground state and OSC (/DCS) payloads when UTF-8 is to be expected.
  • Change VT Parser to use char instead char32_t #471 Parser: see if we can optimize the FSM to lower the L1/L2 cache pressure.
  • Refactor Screen API to only deal with one grid and Terminal API has 2 Screen instances then. #472 - Screen: refactor Screen API to only know about one Grid, such that we can have a specialized Screen for primary screen (very thin grid cells) and another specialized Screen for the alternate screen whereas ThinCell is tuned for maximum throughput and FatCell is tuned for fast access of all attributes. - This requires factoring out all that is shared between the two screens, such as at least the modes.
  • Refactor Screen API to only deal with one grid and Terminal API has 2 Screen instances then. #472 Terminal API class acts like a wall, i.e. it does NOT give direct access to Screen nor Grid nor Cell but only via proxy functions and RenderBuffer and RenderCell, with the goal to have everything behind Cell templated.
  • Optimize LRU cache #470 LRU cache: do not use std::list but try a runtime fixed size list impl that has zero malloc's during use and it's elements stored in an array. This could even use an std::vector with a wrapper element type to point to prev and next
  • optimize bulk ASCII writes #473
  • Parser: SSE2 for plaintext ASCII throughput (no controls) and a fast-path for ASCII+LF
  • Grid: rewrite grid system to be a dense array of Cell objects. (WIP)
  • Grid: provide API for batched single-line text writes
  • Grid: 0-based numbering for line and column adressing.
  • Grid Cell: Use LRU cache for hyperlinks instead of shared_ptr<> and a unique uint as id key
  • Grid Cell: Use LRU cache for image fragments instead of shared_ptr<> (is this GPU-effeciently possible?)` , use unique uint as key here too
  • Grid Line: trivially copable, contain only start index and count into Grid's Cell array, line flags and initial SGR.
  • make Grid and Line a template over T = Cell and possibly an allocator = std::allocator

All unchecked parts above have now its own dedicated ticket.

consequences checklist

  • hyperlinks are still working and we'll tested (also LRU implications)
  • images are still working (also LRU implications)
  • notcurses demo and info works flawlessly :-D

@github-actions github-actions bot added documentation Improvements or additions to documentation frontend Contour Terminal Emulator (GUI frontend) test Unit tests VT: Backend Virtual Terminal Backend (libterminal API) labels Jul 23, 2021
@christianparpart christianparpart force-pushed the improvement/grid branch 3 times, most recently from c4e6f9a to 228f125 Compare July 24, 2021 15:52
@github-actions github-actions bot added OpenGL VT: rasterizer Rendering of the terminal into a pixmap using `terminal_renderer` library labels Jul 25, 2021
@christianparpart christianparpart force-pushed the improvement/grid branch 7 times, most recently from a19d76e to 44e2297 Compare August 1, 2021 16:04
@christianparpart christianparpart force-pushed the improvement/grid branch 12 times, most recently from ad396d0 to 7c7afe5 Compare August 9, 2021 07:49
@christianparpart christianparpart dismissed a stale review via 554cb7f August 18, 2021 00:28
@christianparpart christianparpart dismissed a stale review via d295634 December 9, 2021 23:31
@christianparpart christianparpart dismissed a stale review via 68180fa December 10, 2021 13:29
@christianparpart christianparpart dismissed stale reviews from ghost via 68180fa December 10, 2021 21:05
@christianparpart christianparpart dismissed a stale review via bbf18f4 December 12, 2021 19:44
@christianparpart christianparpart dismissed a stale review via e3a594f December 12, 2021 20:53
@christianparpart christianparpart changed the title [WIP] Grid refactor Grid refactor Dec 12, 2021
@data-man
Copy link
Contributor

Hurray! 🚀

@christianparpart
Copy link
Member Author

christianparpart commented Dec 13, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake documentation Improvements or additions to documentation fonts font rasterization and text shaping API and platform implementations frontend Contour Terminal Emulator (GUI frontend) OpenGL test Unit tests VT: Backend Virtual Terminal Backend (libterminal API) VT: rasterizer Rendering of the terminal into a pixmap using `terminal_renderer` library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor TextRenderer (LRU-cache texture atlas)
2 participants