Skip to contentSkip to conversation

Optimised 1bit blitters

PATCH In review Vladimir 'phcoder' Serbinenko 3 participants 7 messages Aug 21, 2009 – Aug 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Optimised 1bit blitters

Hello. Glyphs are 1-bit bitmaps and when they are blitted currently generic and slow blitter is used. This patch adds optimised blitters and this make text rendering faster

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +25 -0
index b76fe38..7d86044 100644
@@ -1,3 +1,28 @@
+2009-08-21  Vladimir Serbinenko  <[email protected]>
+
+	1-bit optimised blitters.
+
+	* include/grub/fbblit.h (grub_video_fbblit_replace_32bit_1bit): New
+	prototype.
+	(grub_video_fbblit_replace_24bit_1bit): Likewise.
+	(grub_video_fbblit_replace_16bit_1bit): Likewise.
+	(grub_video_fbblit_replace_8bit_1bit): Likewise.
+	(grub_video_fbblit_blend_XXXA8888_1bit): Likewise.
+	(grub_video_fbblit_blend_XXX888_1bit): Likewise.
+	(grub_video_fbblit_blend_XXX565_1bit): Likewise.
+	* video/fb/fbblit.c (grub_video_fbblit_replace_32bit_1bit): New
+	function.
+	(grub_video_fbblit_replace_24bit_1bit): Likewise.
+	(grub_video_fbblit_replace_16bit_1bit): Likewise.
+	(grub_video_fbblit_replace_8bit_1bit): Likewise.
+	(grub_video_fbblit_blend_XXXA8888_1bit): Likewise.
+	(grub_video_fbblit_blend_XXX888_1bit): Likewise.
+	(grub_video_fbblit_blend_XXX565_1bit): Likewise.
+	* video/fb/video_fb.c (common_blitter): Use 1-bit optimised blitters
+	when possible.
+	* video/video.c (grub_video_get_blit_format): Return 
+	GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED if bpp = 1.
+
 2009-08-17  Michal Suchanek  <[email protected]>
 
 	VBE cleanup.
include/grub/fbblit.h +48 -0

52 lines not on this page · raw message

video/fb/fbblit.c +587 -0

596 lines not on this page · raw message

video/fb/video_fb.c +66 -0

78 lines not on this page · raw message

video/video.c +2 -0
index 36ebfd1..c1d66bd 100644
@@ -181,6 +181,8 @@ grub_video_get_blit_format (struct grub_video_mode_info *mode_info)
 	  return GRUB_VIDEO_BLIT_FORMAT_RGB_565;
 	}
     }
+  else if (mode_info->bpp == 1)
+    return GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED;
 
   /* Backup route.  Unknown format.  */
 
#1 lore raw

video/fb/fbblit.c grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst, · line 135

Quoted 4 lines · Vladimir 'phcoder' Serbinenko
video/fb/fbblit.c +4 -0
+  for (j = 0; j < height; j++)
+    {
+      for (i = 0; i < width; i++)
+        {

It's a bit odd, but GCC doesn't seem to optimize those in a single loop. Could you use "i = 0; i < height * width; i++" instead? (for this and the other similar instances)

I can't comment much on the rest of this patch, as my understanding of graphics is limited. But please wait a few days before commit, hopefully someone else will review.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw
Quoted 9 lines · Robert Millan
Quoted 4 lines · Vladimir 'phcoder' Serbinenko

+  for (j = 0; j < height; j++)
+    {
+      for (i = 0; i < width; i++)
+        {

It's a bit odd, but GCC doesn't seem to optimize those in a single loop.  Could you use "i = 0; i < height * width; i++" instead?  (for this and the other similar instances)

There are some operations to do after completing inner loop.

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
#3 lore raw
Quoted 11 lines · Vladimir 'phcoder' Serbinenko
Quoted 9 lines · Robert Millan
Quoted 4 lines · Vladimir 'phcoder' Serbinenko

+  for (j = 0; j < height; j++)
+    {
+      for (i = 0; i < width; i++)
+        {

It's a bit odd, but GCC doesn't seem to optimize those in a single loop.  Could you use "i = 0; i < height * width; i++" instead?  (for this and the other similar instances)

There are some operations to do after completing inner loop.

Oh, right. Sorry I missread it. In that case, I have no objection but please let it rest a few days to see if someone else will review it.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#4 lore raw
In reply to Robert Millan

2009/8/23 Robert Millan <[email protected]>:

Quoted 6 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines

+  for (j = 0; j < height; j++)
+    {
+      for (i = 0; i < width; i++)
+        {

Quoted 7 lines

It's a bit odd, but GCC doesn't seem to optimize those in a single loop.  Could you use "i = 0; i < height * width; i++" instead?  (for this and the other similar instances)

I can't comment much on the rest of this patch, as my understanding of graphics is limited.  But please wait a few days before commit, hopefully someone else will review.

Well, this is not rocket science. You cache a function call which would be done on every iteration otherwise. This is not feasible with other bitmap types (except perhaps 8bit index->8bit index) because they use many more colours.

How well tested is this? There are quite a few blitters and some may not be ever used in current code.

The comment above the blend functions should probably not say they are replace blitters.

Thanks

Michal

#5 lore raw
Quoted 11 lines · Michal Suchanek

2009/8/23 Robert Millan <[email protected]>:

Quoted 10 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines

+  for (j = 0; j < height; j++)
+    {
+      for (i = 0; i < width; i++)
+        {

It's a bit odd, but GCC doesn't seem to optimize those in a single loop.  Could you use "i = 0; i < height * width; i++" instead?  (for this and the other similar instances)

Quoted 8 lines
Quoted 3 lines

I can't comment much on the rest of this patch, as my understanding of graphics is limited.  But please wait a few days before commit, hopefully someone else will review.

Well, this is not rocket science. You cache a function call which would be done on every iteration otherwise. This is not feasible with other bitmap types (except perhaps 8bit index->8bit index) because they use many more colours.

It's possible with RGB(A) because color transformation is formula-based.

Quoted 3 lines

How well tested is this? There are quite a few blitters and some may not be ever used in current code.

I modified videotest to test every blitting function. This part isn't included in the patch because it's dirty.

Quoted 4 lines

The comment above the blend functions should probably not say they are replace blitters.

Thanks.

Quoted 10 lines

Thanks

Michal

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
ChangeLog +25 -0
index d30cfd1..df4cff3 100644
@@ -1,3 +1,28 @@
+2009-08-21  Vladimir Serbinenko  <[email protected]>
+
+	1-bit optimised blitters.
+
+	* include/grub/fbblit.h (grub_video_fbblit_replace_32bit_1bit): New
+	prototype.
+	(grub_video_fbblit_replace_24bit_1bit): Likewise.
+	(grub_video_fbblit_replace_16bit_1bit): Likewise.
+	(grub_video_fbblit_replace_8bit_1bit): Likewise.
+	(grub_video_fbblit_blend_XXXA8888_1bit): Likewise.
+	(grub_video_fbblit_blend_XXX888_1bit): Likewise.
+	(grub_video_fbblit_blend_XXX565_1bit): Likewise.
+	* video/fb/fbblit.c (grub_video_fbblit_replace_32bit_1bit): New
+	function.
+	(grub_video_fbblit_replace_24bit_1bit): Likewise.
+	(grub_video_fbblit_replace_16bit_1bit): Likewise.
+	(grub_video_fbblit_replace_8bit_1bit): Likewise.
+	(grub_video_fbblit_blend_XXXA8888_1bit): Likewise.
+	(grub_video_fbblit_blend_XXX888_1bit): Likewise.
+	(grub_video_fbblit_blend_XXX565_1bit): Likewise.
+	* video/fb/video_fb.c (common_blitter): Use 1-bit optimised blitters
+	when possible.
+	* video/video.c (grub_video_get_blit_format): Return
+	GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED if bpp = 1.
+
 2009-08-25  Vladimir Serbinenko  <[email protected]>
 
 	Fix breakage in grub-setup.
include/grub/fbblit.h +48 -0

52 lines not on this page · raw message

video/fb/fbblit.c +587 -0

596 lines not on this page · raw message

video/fb/video_fb.c +66 -0

78 lines not on this page · raw message

video/video.c +2 -0
index 36ebfd1..c1d66bd 100644
@@ -181,6 +181,8 @@ grub_video_get_blit_format (struct grub_video_mode_info *mode_info)
 	  return GRUB_VIDEO_BLIT_FORMAT_RGB_565;
 	}
     }
+  else if (mode_info->bpp == 1)
+    return GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED;
 
   /* Backup route.  Unknown format.  */
 
#6 lore raw

comitted

Quoted 50 lines · Vladimir 'phcoder' Serbinenko
Quoted 11 lines · Michal Suchanek

2009/8/23 Robert Millan <[email protected]>:

Quoted 10 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines

+  for (j = 0; j < height; j++)
+    {
+      for (i = 0; i < width; i++)
+        {

It's a bit odd, but GCC doesn't seem to optimize those in a single loop.  Could you use "i = 0; i < height * width; i++" instead?  (for this and the other similar instances)

Quoted 8 lines
Quoted 3 lines

I can't comment much on the rest of this patch, as my understanding of graphics is limited.  But please wait a few days before commit, hopefully someone else will review.

Well, this is not rocket science. You cache a function call which would be done on every iteration otherwise. This is not feasible with other bitmap types (except perhaps 8bit index->8bit index) because they use many more colours.

It's possible with RGB(A) because color transformation is formula-based.

Quoted 3 lines

How well tested is this? There are quite a few blitters and some may not be ever used in current code.

I modified videotest to test every blitting function. This part isn't included in the patch because it's dirty.

Quoted 4 lines

The comment above the blend functions should probably not say they are replace blitters.

Thanks.

Quoted 10 lines

Thanks

Michal

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

--
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git