mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
capture bytes in linux framebuffer graphics to sprixelbytes stat
This commit is contained in:
parent
b278d16f67
commit
8d46a0bd17
@ -440,6 +440,13 @@ If things break or seem otherwise lackluster, **please** consult the
|
||||
returns successfully.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Why do the stats show more Linux framebuffer bitmap bytes written
|
||||
than total bytes written to the terminal?</summary>
|
||||
Linux framebuffer graphics aren't implemented via terminal writes, but instead
|
||||
writes directly into a memory map.
|
||||
</details>
|
||||
|
||||
## Useful links
|
||||
|
||||
* [BiDi in Terminal Emulators](https://terminal-wg.pages.freedesktop.org/bidi/)
|
||||
|
@ -42,6 +42,7 @@ typedef struct ncstats {
|
||||
uint64_t sprixelelisions; // sprixel elision count
|
||||
uint64_t sprixelbytes; // sprixel bytes emitted
|
||||
uint64_t appsync_updates; // application-synchronized updates
|
||||
uint64_t input_events; // EGC inputs received or synthesized
|
||||
uint64_t input_errors; // errors processing input
|
||||
|
||||
// current state -- these can decrease
|
||||
@ -120,6 +121,12 @@ malformed control sequences or invalid UTF-8 (see **utf8(7)**).
|
||||
|
||||
Unsuccessful render operations do not contribute to the render timing stats.
|
||||
|
||||
Linux framebuffer bitmaps are not written through the terminal device, but
|
||||
instead directly into the memory-mapped framebuffer (see **mmap(2)**). Bytes
|
||||
used for framebuffer graphics are thus independent of bytes written to the
|
||||
terminal. This explains why **sprixelbytes** may be surprising given the
|
||||
value of **render_bytes**.
|
||||
|
||||
# RETURN VALUES
|
||||
|
||||
Neither **notcurses_stats** nor **notcurses_stats_reset** can fail. Neither
|
||||
@ -128,6 +135,7 @@ object on success, or **NULL** on failure.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
**mmap(2)**,
|
||||
**notcurses(3)**,
|
||||
**notcurses_render(3)**,
|
||||
**utf8(7)**
|
||||
|
@ -106,6 +106,7 @@ int fbcon_scrub(const struct ncpile* p, sprixel* s){
|
||||
int fbcon_draw(const struct ncpile *p, sprixel* s, FILE* out, int y, int x){
|
||||
(void)out; // we don't write to the stream
|
||||
const tinfo* ti = &p->nc->tcache;
|
||||
int wrote = 0;
|
||||
for(int l = 0 ; l < s->pixy ; ++l){
|
||||
// FIXME pixel size isn't necessarily 4B, line isn't necessarily psize*pixx
|
||||
size_t offset = ((l + y * ti->cellpixy) * ti->pixx + x * ti->cellpixx) * 4;
|
||||
@ -116,12 +117,13 @@ int fbcon_draw(const struct ncpile *p, sprixel* s, FILE* out, int y, int x){
|
||||
memcpy(&pixel, src, 4);
|
||||
if(!rgba_trans_p(pixel, 0)){
|
||||
memcpy(tl, &pixel, 4);
|
||||
wrote += 4;
|
||||
}
|
||||
src += 4;
|
||||
tl += 4;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return wrote;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
|
Loading…
x
Reference in New Issue
Block a user