and relocation overhead.
+2013-05-30 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Move blit and fill dispatcher to appropriate files to decrease export
+ and relocation overhead.
+
2013-05-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/font/font.c, include/grub/font.h: Inline simple font
#include <grub/video.h>
/* Generic replacing blitter (slow). Works for every supported format. */
-void
+static void
grub_video_fbblit_replace (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y, int width, int height,
}
/* Block copy replacing blitter. Works with modes multiple of 8 bits. */
-void
+static void
grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y, int width, int height,
}
/* Optimized replacing blitter for 1-bit to 32bit. */
-void
+static void
grub_video_fbblit_replace_32bit_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
#ifdef GRUB_HAVE_UNALIGNED_ACCESS
/* Optimized replacing blitter for 1-bit to 24-bit. */
-void
+static void
grub_video_fbblit_replace_24bit_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
#endif
/* Optimized replacing blitter for 1-bit to 16-bit. */
-void
+static void
grub_video_fbblit_replace_16bit_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for 1-bit to 8-bit. */
-void
+static void
grub_video_fbblit_replace_8bit_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
}
-void
+static void
grub_video_fbblit_replace_32bit_indexa (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for 1-bit to 16bit. */
-void
+static void
grub_video_fbblit_replace_24bit_indexa (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for 1-bit to 16bit. */
-void
+static void
grub_video_fbblit_replace_16bit_indexa (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for 1-bit to 8bit. */
-void
+static void
grub_video_fbblit_replace_8bit_indexa (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
-void
+static void
grub_video_fbblit_blend_32bit_indexa (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for 1-bit to 16bit. */
-void
+static void
grub_video_fbblit_blend_24bit_indexa (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for 1-bit to 16bit. */
-void
+static void
grub_video_fbblit_blend_16bit_indexa (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for 1-bit to 8bit. */
-void
+static void
grub_video_fbblit_blend_8bit_indexa (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
/* Optimized replacing blitter for RGBX8888 to BGRX8888. */
-void
+static void
grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for RGB888 to BGRX8888. */
-void
+static void
grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for RGBX8888 to BGR888. */
-void
+static void
grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for RGB888 to BGR888. */
-void
+static void
grub_video_fbblit_replace_BGR888_RGB888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for RGB888 to RGBX8888. */
-void
+static void
grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for RGBX8888 to RGB888. */
-void
+static void
grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for RGBX8888 to indexed color. */
-void
+static void
grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized replacing blitter for RGB888 to indexed color. */
-void
+static void
grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Generic blending blitter. Works for every supported format. */
-void
+static void
grub_video_fbblit_blend (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y, int width, int height,
}
/* Optimized blending blitter for RGBA8888 to BGRA8888. */
-void
+static void
grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized blending blitter for RGBA8888 to BGR888. */
-void
+static void
grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized blending blitter for RGBA888 to RGBA8888. */
-void
+static void
grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized blending blitter for RGBA8888 to RGB888. */
-void
+static void
grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized blending blitter for RGBA8888 to indexed color. */
-void
+static void
grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
}
/* Optimized blending blitter for 1-bit to XXXA8888. */
-void
+static void
grub_video_fbblit_blend_XXXA8888_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
/* Optimized blending blitter for 1-bit to XXX888. */
#ifdef GRUB_HAVE_UNALIGNED_ACCESS
-void
+static void
grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
#endif
/* Optimized blending blitter for 1-bit to XXX888. */
-void
+static void
grub_video_fbblit_blend_XXX565_1bit (struct grub_video_fbblit_info *dst,
struct grub_video_fbblit_info *src,
int x, int y,
GRUB_VIDEO_FB_ADVANCE_POINTER (dstptr, dstrowskip);
}
}
+
+/* NOTE: This function assumes that given coordinates are within bounds of
+ handled data. */
+void
+grub_video_fb_dispatch_blit (struct grub_video_fbblit_info *target,
+ struct grub_video_fbblit_info *source,
+ enum grub_video_blit_operators oper, int x, int y,
+ unsigned int width, unsigned int height,
+ int offset_x, int offset_y)
+{
+ if (oper == GRUB_VIDEO_BLIT_REPLACE)
+ {
+ /* Try to figure out more optimized version for replace operator. */
+ switch (source->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
+ switch (target->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
+ grub_video_fbblit_replace_directN (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
+ grub_video_fbblit_replace_BGRX8888_RGBX8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
+ grub_video_fbblit_replace_BGR888_RGBX8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
+ grub_video_fbblit_replace_RGB888_RGBX8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
+ grub_video_fbblit_replace_index_RGBX8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ default:
+ break;
+ }
+ break;
+ case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
+ switch (target->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
+ grub_video_fbblit_replace_BGRX8888_RGB888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
+ grub_video_fbblit_replace_RGBX8888_RGB888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
+ grub_video_fbblit_replace_BGR888_RGB888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
+ grub_video_fbblit_replace_directN (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
+ grub_video_fbblit_replace_index_RGB888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ default:
+ break;
+ }
+ break;
+ case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
+ switch (target->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
+ grub_video_fbblit_replace_directN (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ default:
+ break;
+ }
+ break;
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
+ switch (target->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA:
+ grub_video_fbblit_replace_directN (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ default:
+ break;
+ }
+ break;
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA:
+ switch (target->mode_info->bytes_per_pixel)
+ {
+ case 4:
+ grub_video_fbblit_replace_32bit_indexa (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case 3:
+ grub_video_fbblit_replace_24bit_indexa (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case 2:
+ grub_video_fbblit_replace_16bit_indexa (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case 1:
+ grub_video_fbblit_replace_8bit_indexa (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ default:
+ break;
+ }
+ break;
+ case GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED:
+ switch (target->mode_info->bytes_per_pixel)
+ {
+ case 4:
+ grub_video_fbblit_replace_32bit_1bit (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+#ifdef GRUB_HAVE_UNALIGNED_ACCESS
+ case 3:
+ grub_video_fbblit_replace_24bit_1bit (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+#endif
+ case 2:
+ grub_video_fbblit_replace_16bit_1bit (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case 1:
+ grub_video_fbblit_replace_8bit_1bit (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+
+ /* No optimized replace operator found, use default (slow) blitter. */
+ grub_video_fbblit_replace (target, source, x, y, width, height,
+ offset_x, offset_y);
+ }
+ else
+ {
+ /* Try to figure out more optimized blend operator. */
+ switch (source->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
+ switch (target->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
+ grub_video_fbblit_blend_BGRA8888_RGBA8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
+ grub_video_fbblit_blend_RGBA8888_RGBA8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
+ grub_video_fbblit_blend_BGR888_RGBA8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
+ grub_video_fbblit_blend_RGB888_RGBA8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
+ grub_video_fbblit_blend_index_RGBA8888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ default:
+ break;
+ }
+ break;
+ case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
+ /* Note: There is really no alpha information here, so blend is
+ changed to replace. */
+
+ switch (target->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
+ grub_video_fbblit_replace_BGRX8888_RGB888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
+ grub_video_fbblit_replace_RGBX8888_RGB888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
+ grub_video_fbblit_replace_BGR888_RGB888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
+ grub_video_fbblit_replace_directN (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
+ grub_video_fbblit_replace_index_RGB888 (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ default:
+ break;
+ }
+ break;
+ case GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED:
+ switch (target->mode_info->blit_format)
+ {
+ case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
+ case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
+ grub_video_fbblit_blend_XXXA8888_1bit (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+#ifdef GRUB_HAVE_UNALIGNED_ACCESS
+ case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
+ case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
+ grub_video_fbblit_blend_XXX888_1bit (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+#endif
+ case GRUB_VIDEO_BLIT_FORMAT_BGR_565:
+ case GRUB_VIDEO_BLIT_FORMAT_RGB_565:
+ grub_video_fbblit_blend_XXX565_1bit (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ default:
+ break;
+ }
+ break;
+ case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA:
+ switch (target->mode_info->bytes_per_pixel)
+ {
+ case 4:
+ grub_video_fbblit_blend_32bit_indexa (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case 3:
+ grub_video_fbblit_blend_24bit_indexa (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case 2:
+ grub_video_fbblit_blend_16bit_indexa (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ case 1:
+ grub_video_fbblit_blend_8bit_indexa (target, source,
+ x, y, width, height,
+ offset_x, offset_y);
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+
+ /* No optimized blend operation found, use default (slow) blitter. */
+ grub_video_fbblit_blend (target, source, x, y, width, height,
+ offset_x, offset_y);
+ }
+}
#include <grub/video.h>
/* Generic filler that works for every supported mode. */
-void
+static void
grub_video_fbfill (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
/* Optimized filler for direct color 32 bit modes. It is assumed that color
is already mapped to destination format. */
-void
+static void
grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
/* Optimized filler for direct color 24 bit modes. It is assumed that color
is already mapped to destination format. */
-void
+static void
grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
/* Optimized filler for direct color 16 bit modes. It is assumed that color
is already mapped to destination format. */
-void
+static void
grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
/* Optimized filler for index color. It is assumed that color
is already mapped to destination format. */
-void
+static void
grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
dstptr += rowskip;
}
}
+
+void
+grub_video_fb_fill_dispatch (struct grub_video_fbblit_info *target,
+ grub_video_color_t color, int x, int y,
+ unsigned int width, unsigned int height)
+{
+ /* Try to figure out more optimized version. Note that color is already
+ mapped to target format so we can make assumptions based on that. */
+ switch (target->mode_info->bytes_per_pixel)
+ {
+ case 4:
+ grub_video_fbfill_direct32 (target, color, x, y,
+ width, height);
+ return;
+ case 3:
+ grub_video_fbfill_direct24 (target, color, x, y,
+ width, height);
+ return;
+ case 2:
+ grub_video_fbfill_direct16 (target, color, x, y,
+ width, height);
+ return;
+ case 1:
+ grub_video_fbfill_direct8 (target, color, x, y,
+ width, height);
+ return;
+ }
+
+ /* No optimized version found, use default (slow) filler. */
+ grub_video_fbfill (target, color, x, y, width, height);
+}
target.mode_info = &framebuffer.render_target->mode_info;
target.data = framebuffer.render_target->data;
- /* Try to figure out more optimized version. Note that color is already
- mapped to target format so we can make assumptions based on that. */
- switch (target.mode_info->bytes_per_pixel)
- {
- case 4:
- grub_video_fbfill_direct32 (&target, color, x, y,
- width, height);
- return GRUB_ERR_NONE;
- case 3:
- grub_video_fbfill_direct24 (&target, color, x, y,
- width, height);
- return GRUB_ERR_NONE;
- case 2:
- grub_video_fbfill_direct16 (&target, color, x, y,
- width, height);
- return GRUB_ERR_NONE;
- case 1:
- grub_video_fbfill_direct8 (&target, color, x, y,
- width, height);
- return GRUB_ERR_NONE;
- }
-
- /* No optimized version found, use default (slow) filler. */
- grub_video_fbfill (&target, color, x, y, width, height);
-
+ grub_video_fb_fill_dispatch (&target, color, x, y,
+ width, height);
return GRUB_ERR_NONE;
}
-/* NOTE: This function assumes that given coordinates are within bounds of
- handled data. */
-static void
-common_blitter (struct grub_video_fbblit_info *target,
- struct grub_video_fbblit_info *source,
- enum grub_video_blit_operators oper, int x, int y,
- unsigned int width, unsigned int height,
- int offset_x, int offset_y)
-{
- dirty (y, height);
-
- if (oper == GRUB_VIDEO_BLIT_REPLACE)
- {
- /* Try to figure out more optimized version for replace operator. */
- switch (source->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
- switch (target->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
- grub_video_fbblit_replace_directN (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
- grub_video_fbblit_replace_BGRX8888_RGBX8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
- grub_video_fbblit_replace_BGR888_RGBX8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
- grub_video_fbblit_replace_RGB888_RGBX8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
- grub_video_fbblit_replace_index_RGBX8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- default:
- break;
- }
- break;
- case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
- switch (target->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
- grub_video_fbblit_replace_BGRX8888_RGB888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
- grub_video_fbblit_replace_RGBX8888_RGB888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
- grub_video_fbblit_replace_BGR888_RGB888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
- grub_video_fbblit_replace_directN (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
- grub_video_fbblit_replace_index_RGB888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- default:
- break;
- }
- break;
- case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
- switch (target->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
- grub_video_fbblit_replace_directN (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- default:
- break;
- }
- break;
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
- switch (target->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA:
- grub_video_fbblit_replace_directN (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- default:
- break;
- }
- break;
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA:
- switch (target->mode_info->bytes_per_pixel)
- {
- case 4:
- grub_video_fbblit_replace_32bit_indexa (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case 3:
- grub_video_fbblit_replace_24bit_indexa (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case 2:
- grub_video_fbblit_replace_16bit_indexa (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case 1:
- grub_video_fbblit_replace_8bit_indexa (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- default:
- break;
- }
- break;
- case GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED:
- switch (target->mode_info->bytes_per_pixel)
- {
- case 4:
- grub_video_fbblit_replace_32bit_1bit (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
-#ifdef GRUB_HAVE_UNALIGNED_ACCESS
- case 3:
- grub_video_fbblit_replace_24bit_1bit (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
-#endif
- case 2:
- grub_video_fbblit_replace_16bit_1bit (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case 1:
- grub_video_fbblit_replace_8bit_1bit (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- }
- break;
- default:
- break;
- }
-
- /* No optimized replace operator found, use default (slow) blitter. */
- grub_video_fbblit_replace (target, source, x, y, width, height,
- offset_x, offset_y);
- }
- else
- {
- /* Try to figure out more optimized blend operator. */
- switch (source->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
- switch (target->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
- grub_video_fbblit_blend_BGRA8888_RGBA8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
- grub_video_fbblit_blend_RGBA8888_RGBA8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
- grub_video_fbblit_blend_BGR888_RGBA8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
- grub_video_fbblit_blend_RGB888_RGBA8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
- grub_video_fbblit_blend_index_RGBA8888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- default:
- break;
- }
- break;
- case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
- /* Note: There is really no alpha information here, so blend is
- changed to replace. */
-
- switch (target->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
- grub_video_fbblit_replace_BGRX8888_RGB888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
- grub_video_fbblit_replace_RGBX8888_RGB888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
- grub_video_fbblit_replace_BGR888_RGB888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
- grub_video_fbblit_replace_directN (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR:
- grub_video_fbblit_replace_index_RGB888 (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- default:
- break;
- }
- break;
- case GRUB_VIDEO_BLIT_FORMAT_1BIT_PACKED:
- switch (target->mode_info->blit_format)
- {
- case GRUB_VIDEO_BLIT_FORMAT_BGRA_8888:
- case GRUB_VIDEO_BLIT_FORMAT_RGBA_8888:
- grub_video_fbblit_blend_XXXA8888_1bit (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
-#ifdef GRUB_HAVE_UNALIGNED_ACCESS
- case GRUB_VIDEO_BLIT_FORMAT_BGR_888:
- case GRUB_VIDEO_BLIT_FORMAT_RGB_888:
- grub_video_fbblit_blend_XXX888_1bit (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
-#endif
- case GRUB_VIDEO_BLIT_FORMAT_BGR_565:
- case GRUB_VIDEO_BLIT_FORMAT_RGB_565:
- grub_video_fbblit_blend_XXX565_1bit (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- default:
- break;
- }
- break;
- case GRUB_VIDEO_BLIT_FORMAT_INDEXCOLOR_ALPHA:
- switch (target->mode_info->bytes_per_pixel)
- {
- case 4:
- grub_video_fbblit_blend_32bit_indexa (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case 3:
- grub_video_fbblit_blend_24bit_indexa (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case 2:
- grub_video_fbblit_blend_16bit_indexa (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- case 1:
- grub_video_fbblit_blend_8bit_indexa (target, source,
- x, y, width, height,
- offset_x, offset_y);
- return;
- }
- break;
- default:
- break;
- }
-
- /* No optimized blend operation found, use default (slow) blitter. */
- grub_video_fbblit_blend (target, source, x, y, width, height,
- offset_x, offset_y);
- }
-}
-
grub_err_t
grub_video_fb_blit_bitmap (struct grub_video_bitmap *bitmap,
enum grub_video_blit_operators oper, int x, int y,
target.data = framebuffer.render_target->data;
/* Do actual blitting. */
- common_blitter (&target, &source, oper, x, y, width, height,
- offset_x, offset_y);
+ dirty (y, height);
+ grub_video_fb_dispatch_blit (&target, &source, oper, x, y, width, height,
+ offset_x, offset_y);
return GRUB_ERR_NONE;
}
target_info.data = framebuffer.render_target->data;
/* Do actual blitting. */
- common_blitter (&target_info, &source_info, oper, x, y, width, height,
- offset_x, offset_y);
+ dirty (y, height);
+ grub_video_fb_dispatch_blit (&target_info, &source_info, oper, x, y, width, height,
+ offset_x, offset_y);
return GRUB_ERR_NONE;
}
struct grub_video_fbblit_info;
-void
-grub_video_fbblit_replace (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y, int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y, int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y, int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_BGR888_RGB888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y, int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y, int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_32bit_1bit (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_24bit_1bit (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_16bit_1bit (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_replace_8bit_1bit (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend_XXXA8888_1bit (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend_XXX888_1bit (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-grub_video_fbblit_blend_XXX565_1bit (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
+/* NOTE: This function assumes that given coordinates are within bounds of
+ handled data. */
+void
+grub_video_fb_dispatch_blit (struct grub_video_fbblit_info *target,
+ struct grub_video_fbblit_info *source,
+ enum grub_video_blit_operators oper,
+ int x, int y,
+ unsigned int width, unsigned int height,
+ int offset_x, int offset_y);
#endif /* ! GRUB_FBBLIT_HEADER */
};
void
-grub_video_fbfill (struct grub_video_fbblit_info *dst,
- grub_video_color_t color, int x, int y,
- int width, int height);
-
-void
-grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
- grub_video_color_t color, int x, int y,
- int width, int height);
-
-void
-grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
- grub_video_color_t color, int x, int y,
- int width, int height);
-
-void
-grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
- grub_video_color_t color, int x, int y,
- int width, int height);
-
-void
-grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
- grub_video_color_t color, int x, int y,
- int width, int height);
+grub_video_fb_fill_dispatch (struct grub_video_fbblit_info *target,
+ grub_video_color_t color, int x, int y,
+ unsigned int width, unsigned int height);
#endif /* ! GRUB_FBFILL_HEADER */
grub_err_t
EXPORT_FUNC(grub_video_fb_set_active_render_target) (struct grub_video_fbrender_target *target);
-void
-EXPORT_FUNC (grub_video_fbblit_blend_32bit_indexa) (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-EXPORT_FUNC (grub_video_fbblit_blend_24bit_indexa) (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-void
-EXPORT_FUNC (grub_video_fbblit_blend_16bit_indexa) (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-void
-EXPORT_FUNC (grub_video_fbblit_blend_8bit_indexa) (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-
-void
-EXPORT_FUNC (grub_video_fbblit_replace_32bit_indexa) (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-EXPORT_FUNC (grub_video_fbblit_replace_24bit_indexa) (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
-void
-EXPORT_FUNC (grub_video_fbblit_replace_16bit_indexa) (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-void
-EXPORT_FUNC (grub_video_fbblit_replace_8bit_indexa) (struct grub_video_fbblit_info *dst,
- struct grub_video_fbblit_info *src,
- int x, int y,
- int width, int height,
- int offset_x, int offset_y);
-
typedef grub_err_t (*grub_video_fb_set_page_t) (int page);
grub_err_t
-grub_video_fb_setup (unsigned int mode_type, unsigned int mode_mask,
+EXPORT_FUNC (grub_video_fb_setup) (unsigned int mode_type, unsigned int mode_mask,
struct grub_video_mode_info *mode_info,
volatile void *page0_ptr,
grub_video_fb_set_page_t set_page_in,
volatile void *page1_ptr);
grub_err_t
-grub_video_fb_swap_buffers (void);
+EXPORT_FUNC (grub_video_fb_swap_buffers) (void);
grub_err_t
-grub_video_fb_get_info_and_fini (struct grub_video_mode_info *mode_info,
- void **framebuf);
+EXPORT_FUNC (grub_video_fb_get_info_and_fini) (struct grub_video_mode_info *mode_info,
+ void **framebuf);
#endif /* ! GRUB_VIDEO_FB_HEADER */