From: Johann Klammer <klammerj@a1.net>
To: FlorianSchandinat@gmx.de, linux-kernel@vger.kernel.org,
linux-fbdev@vger.kernel.org
Subject: [PATCH 05/08] viafb: fix cursor position and size
Date: Sat, 5 Dec 2026 23:23:30 +0100 [thread overview]
Message-ID: <25960a54-d148-4061-8ca7-1a70a2252fd2@a1.net> (raw)
Motivation: get those low-res modes working.
the hardware cursor is ignorant of doublescan.
y coordinate and cursor height has to be doubled, so it displays correctly.
From: [GPT-6]
Signed-off-by: Johann Klammer <klammerj@a1.net>
---
diff '--color=auto' -uprN -x '*.o' -x '*.ko' -x '*.mod*' -x '*.a' -x '*.cmd' -x modules.order -x Module.symvers -x .tmp_versions linux-7.3.0-gentoo.orig/drivers/video/fbdev/via/viafbdev.c linux-7.3.0-gentoo.work/drivers/video/fbdev/via/viafbdev.c
--- linux-7.3.0-gentoo.orig/drivers/video/fbdev/via/viafbdev.c 2026-12-05 21:25:49.332370762 +0100
+++ linux-7.3.0-gentoo.work/drivers/video/fbdev/via/viafbdev.c 2026-12-05 21:29:38.968377017 +0100
@@ -774,7 +774,7 @@ static int viafb_cursor(struct fb_info *
void __iomem *engine = viapar->shared->vdev->engine_mmio;
u32 temp, xx, yy, bg_color = 0, fg_color = 0,
chip_name = viapar->shared->chip_info.gfx_chip_name;
- int i, j = 0, cur_size = 64;
+ int i, cur_size = 64;
if (info->flags & FBINFO_HWACCEL_DISABLED || info != viafbinfo)
return -ENODEV;
@@ -793,6 +793,8 @@ static int viafb_cursor(struct fb_info *
if (cursor->set & FB_CUR_SETPOS) {
yy = cursor->image.dy - info->var.yoffset;
+ if(info->var.vmode & FB_VMODE_DOUBLE)
+ yy *= 2;
xx = cursor->image.dx - info->var.xoffset;
temp = yy & 0xFFFF;
temp |= (xx << 16);
@@ -890,19 +892,46 @@ static int viafb_cursor(struct fb_info *
break;
}
- if (cur_size == 32) {
- for (i = 0; i < size; i++) {
- cr_data->bak[j] = (u32) cr_data->data[i];
- cr_data->bak[j + 1] = ~cr_data->bak[j];
- j += 2;
- }
- } else {
- for (i = 0; i < size; i++) {
- cr_data->bak[j] = (u32) cr_data->data[i];
- cr_data->bak[j + 1] = 0x0;
- cr_data->bak[j + 2] = ~cr_data->bak[j];
- cr_data->bak[j + 3] = ~cr_data->bak[j + 1];
- j += 4;
+ {
+ int stride = (cursor->image.width + 7) >> 3;
+ int dbl = (info->var.vmode & FB_VMODE_DOUBLE) &&
+ (cursor->image.height <= 32);
+ int row, col, dst = 0;
+
+ if (cur_size == 32) {
+ for (row = 0; row < cursor->image.height; row++) {
+ u32 row_bits = 0;
+ for (col = 0; col < stride; col++)
+ row_bits |= (u32)cr_data->data[row * stride + col] << (col * 8);
+ cr_data->bak[dst] = row_bits;
+ cr_data->bak[dst + 1] = ~row_bits;
+ dst += 2;
+ if (dbl) {
+ cr_data->bak[dst] = row_bits;
+ cr_data->bak[dst + 1] = ~row_bits;
+ dst += 2;
+ }
+ }
+ } else {
+ for (row = 0; row < cursor->image.height; row++) {
+ u32 row_lo = 0, row_hi = 0;
+ for (col = 0; col < stride && col < 4; col++)
+ row_lo |= (u32)cr_data->data[row * stride + col] << (col * 8);
+ for (col = 4; col < stride && col < 8; col++)
+ row_hi |= (u32)cr_data->data[row * stride + col] << ((col - 4) * 8);
+ cr_data->bak[dst] = row_lo;
+ cr_data->bak[dst + 1] = row_hi;
+ cr_data->bak[dst + 2] = ~row_lo;
+ cr_data->bak[dst + 3] = ~row_hi;
+ dst += 4;
+ if (dbl) {
+ cr_data->bak[dst] = row_lo;
+ cr_data->bak[dst + 1] = row_hi;
+ cr_data->bak[dst + 2] = ~row_lo;
+ cr_data->bak[dst + 3] = ~row_hi;
+ dst += 4;
+ }
+ }
}
}
reply other threads:[~2026-12-05 22:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25960a54-d148-4061-8ca7-1a70a2252fd2@a1.net \
--to=klammerj@a1.net \
--cc=FlorianSchandinat@gmx.de \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®