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

pc-tty: add framebuffer-based console #515

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

adamgreloch
Copy link
Member

@adamgreloch adamgreloch commented Sep 25, 2024

Adds a graphics mode console that prints terminal output in 8x16 font to a linear framebuffer located under address queried via platformctl/pctl_graphmode in a maximum resolution supported by current graphic mode

This implementation assumes ARGB ordering of the framebuffer

JIRA: RTOS-925

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

tty/pc-tty/ttypc.h Outdated Show resolved Hide resolved
@phoenix-rtos phoenix-rtos deleted a comment from github-actions bot Oct 4, 2024
@phoenix-rtos phoenix-rtos deleted a comment from github-actions bot Oct 4, 2024
@phoenix-rtos phoenix-rtos deleted a comment from github-actions bot Oct 4, 2024
@phoenix-rtos phoenix-rtos deleted a comment from github-actions bot Oct 4, 2024
@phoenix-rtos phoenix-rtos deleted a comment from github-actions bot Oct 4, 2024
@adamgreloch adamgreloch marked this pull request as ready for review October 4, 2024 08:26
@adamgreloch adamgreloch marked this pull request as draft October 4, 2024 11:41
tty/pc-tty/ttypc_vt.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc_vt.c Show resolved Hide resolved
tty/pc-tty/ttypc_vt.c Show resolved Hide resolved
@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-925 branch 3 times, most recently from 6d0bbae to 1370274 Compare October 7, 2024 07:33
@adamgreloch adamgreloch marked this pull request as ready for review October 10, 2024 14:47
@adamgreloch adamgreloch force-pushed the adamgreloch/RTOS-925 branch 2 times, most recently from c8fb3ba to 7a450db Compare October 21, 2024 07:58
Copy link

github-actions bot commented Oct 21, 2024

Unit Test Results

7 787 tests  +46   7 069 ✅ +43   40m 59s ⏱️ - 1m 3s
  461 suites ± 0     718 💤 + 3 
    1 files   ± 0       0 ❌ ± 0 

Results for commit 25efa68. ± Comparison against base commit 3f95398.

♻️ This comment has been updated with latest results.

tty/pc-tty/ttypc.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc_fbcon.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc_fbcon.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc_fbcon.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc_fbcon.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc_fbfont.h Show resolved Hide resolved
tty/pc-tty/ttypc_vga.c Show resolved Hide resolved
tty/pc-tty/ttypc_vga.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc_vga.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc.c Outdated Show resolved Hide resolved
static void _drawPixel(ttypc_vt_t *vt, uint16_t x, uint16_t y, uint32_t color)
{
ttypc_t *ttypc = vt->ttypc;
*(volatile uint32_t *)((addr_t)ttypc->fbaddr + (x * (ttypc->fbbpp / 8U)) + (y * ttypc->fbpitch)) = color;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addr_t is reserved for physical addresses. Use uintptr_t or, even better, char *

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to uintptr_t for now. What's the idea behind char *?

tty/pc-tty/ttypc_vga.c Outdated Show resolved Hide resolved
tty/pc-tty/ttypc_vt.c Outdated Show resolved Hide resolved
Adds a graphics mode console that prints terminal output in 8x16 font
to a linear framebuffer located under address queried via platformctl/pctl_graphmode
in a 80x25 terminal resolution.

This implementation assumes ARGB ordering of the framebuffer

JIRA: RTOS-925
Graphical apps can now disable console drawing via ioctl/TTYSETMODE to
ensure uninterrupted drawing (otherwise app and console would draw
to the framebuffer in the same time, causing mess)

JIRA: RTOS-925
Current vt will now automatically resize from 80x25 to the maximum
resolution supported by current graphic mode if fbcon is enabled
(i.e. for 1280x800 and 8x16 font it will resize to 160x50)

JIRA: RTOS-925
Since the _ttypc_vga_{set,read,write,move} have the ttypc_vt_t already
passed, they can retrieve the vga pointer from that struct. This also
makes the API more secure in case of fbcon, which implicitly assumed
vga == vt->vram when calculating char positions. Now this assumption is
guaranteed

JIRA: RTOS-925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants