* scrolling bug
@ 2010-02-14 12:26 Michal Suchanek
2010-02-16 23:25 ` Michal Suchanek
0 siblings, 1 reply; 4+ messages in thread
From: Michal Suchanek @ 2010-02-14 12:26 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 841 bytes --]
Hello
while trying to merge the recent changes with the framebuffer rotation
patches I found that terminal without a background picture does not
work for me in non-default directions.
I have not found the major issue which causes the part which is
scrolled to not get redrawn but I noticed that scrolling does not work
as expected - there is some off-by-one error in determining the
scrolled area which will likely cause memory adjacent to the render
target's framebuffer to be overwritten if the whole render target is
scrolled.
So far I have tracked this to r2112
Attaching a small patch which includes a crude visual scroll test in
the videotest command.
Before r2112 the area to the left is solid blue after (second)
scrolling but after the change the area is striped and right part of
the red frame is overwritten.
Thanks
Michal
[-- Attachment #2: scrolltest.patch --]
[-- Type: text/x-diff, Size: 1565 bytes --]
=== modified file 'commands/videotest.c'
--- commands/videotest.c 2010-02-03 00:24:07 +0000
+++ commands/videotest.c 2010-02-13 23:12:14 +0000
@@ -60,6 +60,45 @@
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
+#define BORDER 32
+#define INC1 2
+#define INC2 4
+ x += BORDER;
+ y += BORDER;
+ width -= 2* BORDER;
+ height -= 2* BORDER;
+ color = grub_video_map_rgb (255, 0, 0);
+ grub_video_fill_rect (color, x -1, y -1, width +2, height +2);
+ grub_video_set_viewport (x, y, width, height);
+
+ color = grub_video_map_rgb (0, 0, 0);
+ grub_video_fill_rect (color, 0, 0, width, height);
+
+ color = grub_video_map_rgb (0, 255, 0);
+ grub_video_fill_rect (color, BORDER, BORDER, width - 2* BORDER, height - 2* BORDER);
+ color = grub_video_map_rgb (0, 0, 0);
+ grub_video_fill_rect (color, BORDER + 1, BORDER + 1, width - 2* BORDER -2 , height - 2* BORDER -2);
+ color = grub_video_map_rgb (0, 255, 0);
+ grub_video_fill_rect (color, BORDER + 2, BORDER + 2, width - 2* BORDER -4 , height - 2* BORDER -4);
+
+ color = grub_video_map_rgb (0, 0, 255);
+
+ for(i=0; i<BORDER; i+= INC1)
+ grub_video_scroll(color, -INC1, 0);
+ grub_getkey();
+
+ for(i=0; i<BORDER; i+= INC2)
+ grub_video_scroll(color, INC2, 0);
+ grub_getkey();
+
+ for(i=0; i<BORDER; i+= INC1)
+ grub_video_scroll(color, 0, -INC1);
+ grub_getkey();
+
+ for(i=0; i<BORDER; i+= INC2)
+ grub_video_scroll(color, 0, INC2);
+ grub_getkey();
+
color = grub_video_map_rgb (0, 0, 0);
grub_video_fill_rect (color, 0, 0, width, height);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: scrolling bug
2010-02-14 12:26 scrolling bug Michal Suchanek
@ 2010-02-16 23:25 ` Michal Suchanek
2010-02-16 23:46 ` [patch] " Michal Suchanek
0 siblings, 1 reply; 4+ messages in thread
From: Michal Suchanek @ 2010-02-16 23:25 UTC (permalink / raw)
To: The development of GRUB 2
Hello
is it by any chance possible that while the tests in grub_fb_scroll
check if the start is aligned the (width -1) which is added when
scrolling backwards is not?
This would explain why scrolling backwards is misaligned.
This would require to run non-32bpp mode but I am not sure how to tell
which mode I am running.
Thanks
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch] scrolling bug
2010-02-16 23:25 ` Michal Suchanek
@ 2010-02-16 23:46 ` Michal Suchanek
2010-02-20 10:16 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 4+ messages in thread
From: Michal Suchanek @ 2010-02-16 23:46 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 63 bytes --]
Apparently it is the case.
Please test/apply.
Thanks
Michal
[-- Attachment #2: scrollfix.patch --]
[-- Type: text/x-diff, Size: 1484 bytes --]
=== modified file 'video/fb/video_fb.c'
--- video/fb/video_fb.c 2010-02-03 00:24:07 +0000
+++ video/fb/video_fb.c 2010-02-16 23:44:09 +0000
@@ -985,6 +985,13 @@ grub_video_fb_scroll (grub_video_color_t
linedelta = target.mode_info->pitch
- width * target.mode_info->bytes_per_pixel;
linelen = width * target.mode_info->bytes_per_pixel;
+ if (dy > 0 || (dy == 0 && dx > 0))
+ {
+ src_x += width - 1;
+ dst_x += width - 1;
+ src_y += height - 1;
+ dst_y += height - 1;
+ }
#define DO_SCROLL \
/* Check vertical direction of the move. */ \
if (dy < 0 || (dy == 0 && dx < 0)) \
@@ -1006,11 +1013,9 @@ grub_video_fb_scroll (grub_video_color_t
{ \
/* 3b. Move data downwards. */ \
dst = (void *) grub_video_fb_get_video_ptr (&target, \
- dst_x + width - 1, \
- dst_y + height - 1); \
+ dst_x, dst_y); \
src = (void *) grub_video_fb_get_video_ptr (&target, \
- src_x + width - 1, \
- src_y + height - 1); \
+ src_x, src_y); \
for (j = 0; j < height; j++) \
{ \
for (i = 0; i < linelen; i++) \
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-02-20 10:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-14 12:26 scrolling bug Michal Suchanek
2010-02-16 23:25 ` Michal Suchanek
2010-02-16 23:46 ` [patch] " Michal Suchanek
2010-02-20 10:16 ` Vladimir 'φ-coder/phcoder' Serbinenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.