-
Notifications
You must be signed in to change notification settings - Fork 6
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
Enable cursor for the frame buffer console #79
Comments
We’ve now got a XOR cursor in the console. @rickgaiser, setting up the ALPHA register was simple: GIF_PACKAGE_AD(package) {
.addr = gs_addr_alpha_1,
.data.alpha_1 = {
.a = gs_alpha_a_cs,
.b = gs_alpha_b_cd,
.c = gs_alpha_c_fix,
.d = gs_alpha_d_0,
.fix = GS_ALPHA_ONE
}
}; Then it was only a matter of sending four GS packages for a sprite with the GIF_PACKAGE_TAG(package) {
.flg = gif_reglist_mode,
.reg0 = gif_reg_prim,
.reg1 = gif_reg_rgbaq,
.reg2 = gif_reg_xyz2,
.reg3 = gif_reg_xyz2,
.nreg = 4,
.nloop = 1,
.eop = 1
};
GIF_PACKAGE_REG(package) {
.lo.prim = {
.abe = gs_blendning_on,
.prim = gs_sprite
},
.hi.rgbaq = c->fg_rgbaq
};
GIF_PACKAGE_REG(package) {
.lo.xyz2 = {
.x = gs_fbcs_to_pcs(c->sx),
.y = gs_fbcs_to_pcs(c->sy + c->th - c->dy)
},
.hi.xyz2 = {
.x = gs_fbcs_to_pcs(c->sx + c->tw),
.y = gs_fbcs_to_pcs(c->sy + c->th)
}
}; The cursor shape const u32 ch =
cursor->shape == FB_TILE_CURSOR_NONE ? 0 :
cursor->shape == FB_TILE_CURSOR_UNDERLINE ? 1 :
cursor->shape == FB_TILE_CURSOR_LOWER_THIRD ? th / 3 :
cursor->shape == FB_TILE_CURSOR_LOWER_HALF ? th / 2 :
cursor->shape == FB_TILE_CURSOR_TWO_THIRDS ? (2 * th) / 3 :
cursor->shape == FB_TILE_CURSOR_BLOCK ? th : th; Also, the cursor isn’t blinking but it remains unclear by which logic it would. Anyhow, a reasonable cursor is displayed now. :-) |
@rickgaiser, in addition, I think the alpha blending function, with similarities to a blitter, will be highly useful for a fully GS-accelerated X window system, eventually. :-) |
@rickgaiser, thank you very much for that! @frno7, way to go! |
@Arch91, I figured out how to manipulate the shape of the cursor. Amusingly, it works already: try linux/include/linux/console_struct.h Lines 161 to 167 in 59a11ab
|
Haha, try |
@Arch91, a cursor blinking like a Christmas tree could be a real crowd-pleaser. We should make a test suite to cover the combinations of settings. It seems most if not all settings can be applied using the |
Yes, and there should be a tutotial which describes the all available values for the all parameters, with an examples (4 high bits - background, 4 low bits - foreground, and for the both - the first cipher turns blinking/highliting, and the last three ciphers sets the color code (what are high/low bits, where they are in the examples, where to get the color code combos appropriate the colors)). Though, I see there is not described what need to be done to certainly achieve the blinking cursor, to set the times it will blink and after that times and moments of blinkings passed it will not blinks until cursor moving, and the speed between the moments of those blinkings. |
The article Cursor Appearance in the Linux Console is apparently an interpretation of
I could imagine that the kernel console would emulate blinking in software, either by periodically alternating the shape of the cursor with linux/drivers/video/fbdev/ps2fb.c Line 1339 in 7455188
or by setting Line 349 in 7455188
but the kernel console doesn’t seem to do any of those two alternatives for a blinking cursor effect. Also, the linux/drivers/video/fbdev/ps2fb.c Line 1352 in 7455188
(which can be observed with Line 352 in 7455188
that’s maybe the colour of the upper part of the cursor? |
Cursor blinking is on a timer function linux/drivers/video/fbdev/core/fbcon.c Lines 388 to 420 in 59a11ab
and it calls linux/drivers/video/fbdev/core/tileblit.c Lines 82 to 117 in 59a11ab
but it’s not entirely clear what, if anything, is controlling a blinking effect. |
@Arch91, if you’re satisfied with a dirty blinker, try this 3-line piece of hack (having the new static bool blink; // <<<----
union package * const base_package = par->package.buffer;
union package *package = base_package;
const u32 tw = par->cb.tile.width;
const u32 th = par->cb.tile.height;
const u32 dy =
blink ? 0 : // <<<----
cursor->shape == FB_TILE_CURSOR_NONE ? 0 :
cursor->shape == FB_TILE_CURSOR_UNDERLINE ? 1 :
cursor->shape == FB_TILE_CURSOR_LOWER_THIRD ? th / 3 :
cursor->shape == FB_TILE_CURSOR_LOWER_HALF ? th / 2 :
cursor->shape == FB_TILE_CURSOR_TWO_THIRDS ? (2 * th) / 3 :
cursor->shape == FB_TILE_CURSOR_BLOCK ? th : th;
const struct cb_cursor c = {
.sx = (var->xoffset + tw * cursor->sx) % var->xres_virtual,
.sy = (var->yoffset + th * cursor->sy) % var->yres_virtual,
.dy = dy,
.tw = tw,
.th = th,
.draw = cursor->mode,
.fg_rgbaq = console_pseudo_palette(cursor->fg, par)
};
blink = !blink; // <<<---- Then do |
The nearest time I only was reading your posts, guys, but today I redownloaded the source code from the main branch of the linux repository, recompiled the kernel and updated the modules in the appropriate places. Also changed to
I saw just a white rectangle/block. I tried them all from 0 to 6)
Red. Nice.
Well, I described the perfect) Adjustable cursor blink times and after these times and moments of blinkings passed it will not blinks until cursor moving; adjustable speed between the moments of those blinkings - both of GNU standards, which means that if there could be an app which tweaks those things, then that app will be working without any edits/additions in it's source code. And a side question. Is ps2fb driver ready for to be launched through Xvfb X-server? |
No, the DRM driver is likely to become deprecated.
Did you rerun
Probably not too fast, no.
This one should blink. Check that
This one turns off blinking, though...
Moving the cursor should not be necessary. It should blink by itself, and at least it does for me.
Not yet, it only does text at the moment. But it's pretty effective at that. :-) |
Well, yes, that was the place where I made a mistake - my old modules were placed in initramfs(and in my target system too)/lib/modules/5.4.169 while the modules from the new kernel are now placed in initramfs/lib/modules/5.4.169+ (with plus). I removed that 5.4.169 folder before the kernel recompiling. And that blinds my eyes, I thought that after the ps2fb.c is edited, the kernel rebuilding is enough. I did not mind about that modules must be rebuilt either. Exactly that ps2fb.c related edits are for the appropriate module. By the way, if to change the cursor shape to rectangle with
I mean... other. Here is the example of the cursor behaviour in the terminal with Xes in my Fedora 30:
I dare myself an unwary question of inquire - what is insufficient in ps2fb to become a serious linux videodriver?) I'm just in curious, I beleive whatever the answer I can't influence for that driver upgradation in any imaginable by me way :/ |
Nice! I made the dirty blinker default in the latest precompiled actions download. If people are annoyed, we can turn blinking off again...
Maybe the Nano editor is being naughty with the cursor settings? Resetting it perhaps? Bad, bad, editor.
The blinking we have now is a dirty piece of hack. As mentioned, it’s a bit of a mystery how the cursor actually is going to blink properly...
The two main alternatives to the current text console, as I see it, are A virtual frame buffer is best for compatibility with existing application software, but generally has poor performance, both in terms of speed and memory usage. For simple applications, performance may not matter, though. They may be fast enough anyway. A Graphics Synthesizer device can have excellent performance and memory usage, and make really good use of the hardware acceleration resources of the PlayStation 2, but it requires application software adjustments, which may be difficult to do. |
Well, totally the only info I found is that
all these seven (six and invisible) shapes are blinking by default. The blinking can be disabled by setting 0 to
It is called "cursor blink rate". It someway controlled by an escape sequence, the example of the setting it to 600milliseconds: I did not find the info about the adjusting of "when the times and moments of blinkings passed it will not blinks until cursor moving". I consider this feature is controllable by some side libraries such as terminfo or else, and maybe even when the cursor is choosed as softwared. I may assume that the "serenity" (not what is dirty for now) cursor was not blinking because of the absent blinking rate feature. If to assume that the blinking rate is 0 while the blinking is enabled (1) then it would happy to blink, but the blinking rate is momental, so no blinking) |
Do
/sys/class/graphics/fbcon/cursor_blink
is nonzero;FB_TILE_CURSOR_UNDERLINE
by some console command or other reasonable means;For details, see #10 (comment).
The text was updated successfully, but these errors were encountered: