Fix SSD2092 wake, fuel-gauge jump, XLibre rotation, media keys, and popup rendering
This commit is contained in:
1 parent
7f3b3c2c0c
commit
dbc0275979
43 files changed
+3388
-115
No files matched your search
@@ -0,0 +1,235 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Geminux Project <dev@geminux.local>
|
||||
Date: Tue, 24 Nov 2026 10:25:00 +0200
|
||||
Subject: [PATCH] geminux: skip redundant shadow->front_bo copy and add 16x16 tiled 32bpp rotation
|
||||
|
||||
---
|
||||
diff --git a/hw/xfree86/drivers/video/modesetting/driver.c b/hw/xfree86/drivers/video/modesetting/driver.c
|
||||
--- a/hw/xfree86/drivers/video/modesetting/driver.c
|
||||
+++ b/hw/xfree86/drivers/video/modesetting/driver.c
|
||||
@@ -1666,6 +1666,28 @@
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
modesettingPtr ms = modesettingPTR(pScrn);
|
||||
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
+
|
||||
+ if (xf86_config && xf86_config->num_crtc > 0) {
|
||||
+ int enabled_crtcs = 0;
|
||||
+ Bool all_rotated = TRUE;
|
||||
+
|
||||
+ for (int c = 0; c < xf86_config->num_crtc; c++) {
|
||||
+ xf86CrtcPtr crtc = xf86_config->crtc[c];
|
||||
+ if (!crtc || !crtc->enabled)
|
||||
+ continue;
|
||||
+ enabled_crtcs++;
|
||||
+ if (!crtc->transform_in_use || !crtc->rotatedPixmap) {
|
||||
+ all_rotated = FALSE;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (enabled_crtcs > 0 && all_rotated) {
|
||||
+ DamageEmpty(pBuf->pDamage);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
bool use_3224 = ms->drmmode.force_24_32 && pScrn->bitsPerPixel == 32;
|
||||
|
||||
if (ms->drmmode.shadow_enable2 && ms->drmmode.shadow_fb2) do {
|
||||
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
|
||||
--- a/hw/xfree86/modes/xf86Rotate.c
|
||||
+++ b/hw/xfree86/modes/xf86Rotate.c
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <xorg-config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
+#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -40,6 +41,174 @@
|
||||
#include "xf86Modes.h"
|
||||
#include "xf86RandR12.h"
|
||||
|
||||
+static inline void
|
||||
+xf86RotateBlitRect32(Rotation rot,
|
||||
+ const uint32_t *src_base, size_t src_stride32,
|
||||
+ uint32_t *dst_base, size_t dst_stride32,
|
||||
+ int crtc_x, int crtc_y, int W, int H,
|
||||
+ int x1, int y1, int x2, int y2)
|
||||
+{
|
||||
+ if (rot == RR_Rotate_270) {
|
||||
+ for (int ty = y1; ty < y2; ty += 16) {
|
||||
+ int bh = (y2 - ty < 16) ? (y2 - ty) : 16;
|
||||
+ for (int tx = x1; tx < x2; tx += 16) {
|
||||
+ int bw = (x2 - tx < 16) ? (x2 - tx) : 16;
|
||||
+ uint32_t tile[16][16];
|
||||
+
|
||||
+ for (int bx = 0; bx < bw; bx++) {
|
||||
+ const uint32_t *srow = src_base +
|
||||
+ (size_t)(crtc_y + (W - 1 - (tx + bx))) * src_stride32 +
|
||||
+ (size_t)(crtc_x + ty);
|
||||
+ for (int by = 0; by < bh; by++)
|
||||
+ tile[by][bx] = srow[by];
|
||||
+ }
|
||||
+ for (int by = 0; by < bh; by++) {
|
||||
+ uint32_t *drow = dst_base +
|
||||
+ (size_t)(ty + by) * dst_stride32 + (size_t)tx;
|
||||
+ memcpy(drow, tile[by], (size_t)bw * sizeof(uint32_t));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } else if (rot == RR_Rotate_90) {
|
||||
+ for (int ty = y1; ty < y2; ty += 16) {
|
||||
+ int bh = (y2 - ty < 16) ? (y2 - ty) : 16;
|
||||
+ for (int tx = x1; tx < x2; tx += 16) {
|
||||
+ int bw = (x2 - tx < 16) ? (x2 - tx) : 16;
|
||||
+ uint32_t tile[16][16];
|
||||
+
|
||||
+ for (int bx = 0; bx < bw; bx++) {
|
||||
+ const uint32_t *srow = src_base +
|
||||
+ (size_t)(crtc_y + tx + bx) * src_stride32 +
|
||||
+ (size_t)(crtc_x + H - ty - bh);
|
||||
+ for (int k = 0; k < bh; k++)
|
||||
+ tile[bh - 1 - k][bx] = srow[k];
|
||||
+ }
|
||||
+ for (int by = 0; by < bh; by++) {
|
||||
+ uint32_t *drow = dst_base +
|
||||
+ (size_t)(ty + by) * dst_stride32 + (size_t)tx;
|
||||
+ memcpy(drow, tile[by], (size_t)bw * sizeof(uint32_t));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ for (int dy = y1; dy < y2; dy++) {
|
||||
+ const uint32_t *srow = src_base +
|
||||
+ (size_t)(crtc_y + H - 1 - dy) * src_stride32 +
|
||||
+ (size_t)(crtc_x + W - 1);
|
||||
+ uint32_t *drow = dst_base + (size_t)dy * dst_stride32;
|
||||
+ uint32_t rowbuf[64];
|
||||
+
|
||||
+ for (int tx = x1; tx < x2; tx += 64) {
|
||||
+ int bw = (x2 - tx < 64) ? (x2 - tx) : 64;
|
||||
+ for (int k = 0; k < bw; k++)
|
||||
+ rowbuf[k] = srow[-(tx + k)];
|
||||
+ memcpy(drow + tx, rowbuf, (size_t)bw * sizeof(uint32_t));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static Bool
|
||||
+xf86RotateTryFast32(xf86CrtcPtr crtc, PixmapPtr dst_pixmap,
|
||||
+ DrawableRec *src_drawable, RegionPtr region,
|
||||
+ Bool transform_src)
|
||||
+{
|
||||
+ ScrnInfoPtr scrn = crtc->scrn;
|
||||
+ ScreenPtr screen = scrn->pScreen;
|
||||
+ Rotation rot = crtc->rotation & 0xf;
|
||||
+ int W = crtc->mode.HDisplay;
|
||||
+ int H = crtc->mode.VDisplay;
|
||||
+ PixmapPtr src_pixmap;
|
||||
+ const uint32_t *src_base;
|
||||
+ uint32_t *dst_base;
|
||||
+ size_t src_stride32, dst_stride32;
|
||||
+ int n = RegionNumRects(region);
|
||||
+ BoxPtr b = RegionRects(region);
|
||||
+
|
||||
+ if (!transform_src || crtc->transformPresent || crtc->filter)
|
||||
+ return FALSE;
|
||||
+ if (crtc->rotation & (RR_Reflect_X | RR_Reflect_Y))
|
||||
+ return FALSE;
|
||||
+ if (rot != RR_Rotate_270 && rot != RR_Rotate_90 && rot != RR_Rotate_180)
|
||||
+ return FALSE;
|
||||
+ if (W <= 0 || H <= 0)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ if (src_drawable->type == DRAWABLE_PIXMAP)
|
||||
+ src_pixmap = (PixmapPtr)src_drawable;
|
||||
+ else
|
||||
+ src_pixmap = (*screen->GetWindowPixmap)((WindowPtr)src_drawable);
|
||||
+
|
||||
+ if (!src_pixmap || !dst_pixmap ||
|
||||
+ !src_pixmap->devPrivate.ptr || !dst_pixmap->devPrivate.ptr)
|
||||
+ return FALSE;
|
||||
+ if (src_pixmap->drawable.bitsPerPixel != 32 ||
|
||||
+ dst_pixmap->drawable.bitsPerPixel != 32)
|
||||
+ return FALSE;
|
||||
+ if ((src_pixmap->devKind & 3) != 0 || (dst_pixmap->devKind & 3) != 0)
|
||||
+ return FALSE;
|
||||
+ if (src_drawable->x != 0 || src_drawable->y != 0)
|
||||
+ return FALSE;
|
||||
+ if (src_drawable->type != DRAWABLE_PIXMAP &&
|
||||
+ (src_pixmap->screen_x != 0 || src_pixmap->screen_y != 0))
|
||||
+ return FALSE;
|
||||
+ if (W > dst_pixmap->drawable.width || H > dst_pixmap->drawable.height)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ if (rot == RR_Rotate_90 || rot == RR_Rotate_270) {
|
||||
+ if (crtc->x < 0 || crtc->y < 0 ||
|
||||
+ crtc->x + H > src_pixmap->drawable.width ||
|
||||
+ crtc->y + W > src_pixmap->drawable.height)
|
||||
+ return FALSE;
|
||||
+ } else {
|
||||
+ if (crtc->x < 0 || crtc->y < 0 ||
|
||||
+ crtc->x + W > src_pixmap->drawable.width ||
|
||||
+ crtc->y + H > src_pixmap->drawable.height)
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
+ if (screen->SourceValidate)
|
||||
+ (*screen->SourceValidate)(src_drawable, 0, 0,
|
||||
+ src_drawable->width, src_drawable->height,
|
||||
+ IncludeInferiors);
|
||||
+
|
||||
+ src_base = (const uint32_t *)src_pixmap->devPrivate.ptr;
|
||||
+ dst_base = (uint32_t *)dst_pixmap->devPrivate.ptr;
|
||||
+ src_stride32 = (size_t)src_pixmap->devKind >> 2;
|
||||
+ dst_stride32 = (size_t)dst_pixmap->devKind >> 2;
|
||||
+
|
||||
+ if (crtc->shadowClear) {
|
||||
+ xf86RotateBlitRect32(rot, src_base, src_stride32, dst_base, dst_stride32,
|
||||
+ crtc->x, crtc->y, W, H, 0, 0, W, H);
|
||||
+ crtc->shadowClear = FALSE;
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ while (n--) {
|
||||
+ BoxRec dst_box = *b++;
|
||||
+
|
||||
+ pixman_f_transform_bounds(&crtc->f_framebuffer_to_crtc, &dst_box);
|
||||
+ if (dst_box.x1 < 0)
|
||||
+ dst_box.x1 = 0;
|
||||
+ if (dst_box.y1 < 0)
|
||||
+ dst_box.y1 = 0;
|
||||
+ if (dst_box.x2 > W)
|
||||
+ dst_box.x2 = W;
|
||||
+ if (dst_box.y2 > H)
|
||||
+ dst_box.y2 = H;
|
||||
+
|
||||
+ if (dst_box.x1 < dst_box.x2 && dst_box.y1 < dst_box.y2) {
|
||||
+ xf86RotateBlitRect32(rot, src_base, src_stride32,
|
||||
+ dst_base, dst_stride32,
|
||||
+ crtc->x, crtc->y, W, H,
|
||||
+ dst_box.x1, dst_box.y1,
|
||||
+ dst_box.x2, dst_box.y2);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return TRUE;
|
||||
+}
|
||||
+
|
||||
void
|
||||
xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, PixmapPtr dst_pixmap,
|
||||
DrawableRec *src_drawable, RegionPtr region,
|
||||
@@ -57,6 +226,10 @@
|
||||
if (crtc->driverIsPerformingTransform & XF86DriverTransformOutput)
|
||||
return;
|
||||
|
||||
+ if (xf86RotateTryFast32(crtc, dst_pixmap, src_drawable, region,
|
||||
+ transform_src))
|
||||
+ return;
|
||||
+
|
||||
src = CreatePicture(None,
|
||||
src_drawable,
|
||||
format,
|
||||
Reference in new issue
Block a user