FIX: Fixed framebuffer freeze upon screenshot

This commit is contained in:
boreddevnl
2026-04-01 23:05:52 +02:00
parent d7d97b5a97
commit 9634ebb086
6 changed files with 106 additions and 87 deletions

View File

@@ -842,19 +842,22 @@ void graphics_flip_buffer(void) {
void graphics_copy_screenbuffer(uint32_t *dest) {
if (!g_fb || !dest) return;
uint64_t rflags;
asm volatile("pushfq; pop %0; cli" : "=r"(rflags));
int sw = g_fb->width;
int sh = g_fb->height;
extern uint64_t wm_lock_acquire(void);
extern void wm_lock_release(uint64_t);
uint64_t rflags = wm_lock_acquire();
int sw = (int)g_fb->width;
int sh = (int)g_fb->height;
// Copy the internal back object to the dest directly
// Copy from the composition back buffer
for (int y = 0; y < sh; y++) {
uint32_t *src_row = &g_back_buffer[y * sw];
for (int x = 0; x < sw; x++) {
dest[y * sw + x] = src_row[x];
}
}
asm volatile("push %0; popfq" : : "r"(rflags));
wm_lock_release(rflags);
}
void graphics_set_clipping(int x, int y, int w, int h) {