|
From: Geert U. <ge...@li...> - 2003-01-10 14:11:57
|
On 10 Jan 2003, Antonino Daplas wrote:
> For putcs and putc, I just made it mandatory that when one character is
> to be out of bounds, it just won't get drawn. A cleaner implementation
> is, of course, to clip the destination window + the passed bitmap.
Except for the geek value, why would it be cleaner to draw half of a character
near the border?
> Do we need to clip the fb_set_logo() too?
I don't think so. The current code already draws only the number of logos that
really fit on the screen. Unless you want to see half penguins as well :-)
> The patch may be a bit difficult to swallow because it is pretty much
> invasive and not so clean :-(, so it's okay if you don't take it.
> But it has the advantage of clipping the coordinates for hardware that
> does not support clipping (like the i810fb). For hardware that does
> support clipping, or wants to implement its own clipping code, we require
> a 'caps' (capabilities) field in fb_info or fb_fix_screeninfo. This is
> checked first and if set, the default clipping code is bypassed.
I prefer fb_info, since user space doesn't need to know.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@li...
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
|
|
From: Antonino D. <ad...@po...> - 2003-01-11 05:23:09
|
On Sat, 2003-01-11 at 04:31, James Simmons wrote:
>
> > > > Except for the geek value, why would it be cleaner to draw half of a character
> > > > near the border?
> > >
> > > This is one of the reasons why I moved from fbset to setting the console
> > > resolution via the console layer. You can't end up with half characters.
> > > Via fbset you could but fbcon had extra code to prevent such foolishness.
> > > But it still looked silly to have half line on the bottom of the screen
> > > that nothing ever drawed in.
> >
> > What else can you do? My notebook has a fixed LCD of 1024x768. With the 12x22
> > font, I have a text console of 85x34, using only 1020x748 pixels. Shrinking the
> > resolution to 1020x748 is not an option.
>
> Ug. I guess we handle it the best way we can. Also we can try BenH
> suggesting of incorpating scaling.
>
Or we can modify fbcon_resize() so it just checks if the resulting
resolution is enough to accomodate the console window size...
static int fbcon_resize(struct vc_data *vc, unsigned int width,
unsigned int height)
{
struct display *p = &fb_display[vc->vc_num];
struct fb_info *info = p->fb_info;
struct fb_var_screeninfo var = info->var;
int err, x, y;
var.xres = x = width * vc->vc_font.width;
var.yres = y = height * vc->vc_font.height;
var.activate = FB_ACTIVATE_TEST;
err = fb_set_var(&var, info);
if (err || var.xres < x || var.yres < y)
return -EINVAL;
var.activate = FB_ACTIVATE_NOW;
err = fb_set_var(&var, info);
p->vrows = info->var.yres_virtual/vc->vc_font.height;
return err;
}
...which implies that we also have to modify accel_clear_margins() so it
clears more than just a fraction of a character's width and height...
void accel_clear_margins(struct vc_data *vc, struct display *p,
int bottom_only)
{
struct fb_info *info = p->fb_info;
unsigned int cw = vc->vc_font.width;
unsigned int ch = vc->vc_font.height;
unsigned int rw = info->var.xres - vc->vc_cols * cw;
unsigned int bh = info->var.yres - vc->vc_rows * ch;
unsigned int rs = info->var.xres - rw;
unsigned int bs = info->var.yres - bh;
struct fb_fillrect region;
region.color = attr_bgcol_ec(p, vc);
region.rop = ROP_COPY;
if (rw & !bottom_only) {
region.dx = info->var.xoffset + rs;
region.dy = 0;
region.width = rw;
region.height = info->var.yres_virtual;
info->fbops->fb_fillrect(info, ®ion);
}
if (bh) {
region.dx = info->var.xoffset;
region.dy = info->var.yoffset + bs;
region.width = rs;
region.height = bh;
info->fbops->fb_fillrect(info, ®ion);
}
}
... which exposed a bug in vc_resize() in vt.c. In vc_resize(), the
global variables:
video_num_lines;
video_num_columns;
video_size_row;
screenbuf_size;
are modified before calling consw->con_resize() which, if it returns
with an error, are left with invalid numbers. So attached is a patch.
It behaves correctly now. When the resulting resolution is bigger than
the console window size, it's left with a small window at the upper left
corner. So stty must be called so rows and cols are enough but no
bigger than the supported resolution.
This works pretty well if panning is disabled. With panning, I get a
cursor "dissynchronous" with the display and where the virtual screen is
randomly placed anywhere within the display window.
We might need to fix for scrolling + panning here.
Tony
diff -Naur linux-2.5.54/drivers/char/vt.c linux/drivers/char/vt.c
--- linux-2.5.54/drivers/char/vt.c 2003-01-11 04:47:02.000000000 +0000
+++ linux/drivers/char/vt.c 2003-01-11 04:47:49.000000000 +0000
@@ -732,24 +732,24 @@
if (new_cols == video_num_columns && new_rows == video_num_lines)
return 0;
- newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER);
- if (!newscreen)
- return -ENOMEM;
-
old_rows = video_num_lines;
old_cols = video_num_columns;
old_row_size = video_size_row;
old_screen_size = screenbuf_size;
+ err = resize_screen(currcons, new_cols, new_rows);
+ if (err)
+ return err;
+
+ newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER);
+ if (!newscreen)
+ return -ENOMEM;
+
video_num_lines = new_rows;
video_num_columns = new_cols;
video_size_row = new_row_size;
screenbuf_size = new_screen_size;
- err = resize_screen(currcons, new_cols, new_rows);
- if (err)
- return err;
-
rlth = min(old_row_size, new_row_size);
rrem = new_row_size - rlth;
old_origin = origin;
|