2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>

Framebuffer split.

	* commands/i386/pc/vbetest.c (grub_cmd_vbetest): Restore video
	subsystem at the end.
	* conf/common.rmk (pkglib_MODULES): Add video_fb.mod.
	(video_fb_mod_SOURCES): New variable.
	(video_fb_mod_CFLAGS): Likewise.
	(video_fb_mod_LDFLAGS): Likewise.
	* conf/i386-pc.rmk (vbe_mod_SOURCES): Remove video/i386/pc/vbeblit.c,
	video/i386/pc/vbefill.c and video/i386/pc/vbeutil.c.
	* video/i386/pc/vbeblit.c: Moved from here ...
	* video/fb/fbblit.c: ..here. Replaced 'vbe' with 'fb'.
	* video/i386/pc/vbefill.c: Moved from here ...
	* video/fb/fbfill.c: ..here. Replaced 'vbe' with 'fb'.
	* video/i386/pc/vbeutil.c: Moved from here ...
	* video/fb/fbutil.c: ..here. Replaced 'vbe' with 'fb'.
	* include/grub/i386/pc/vbeblit.h: Moved from here ...
	* include/grub/fbblit.h: ... here. Replaced 'vbe' with 'fb'.
	* include/grub/i386/pc/vbefill.h: Moved from here ...
	* include/grub/fbfill.h: ... here. Replaced 'vbe' with 'fb'.
	* include/grub/i386/pc/vbeutil.h: Moved from here ...
	* include/grub/fbutil.h: ... here. Replaced 'vbe' with 'fb'.
	* include/grub/i386/pc/vbe.h: Moved framebuffer part ...
	* include/grub/video_fb.h: ... here. Replaced 'vbe' with 'fb'.
	* include/grub/video.h (GRUB_VIDEO_RENDER_TARGET_FRONT_BUFFER): Removed.
	(GRUB_VIDEO_RENDER_TARGET_BACK_BUFFER): Likewise.
	(grub_video_adapter): Added 'get_info_and_fini'.
	(grub_video_get_info_and_fini): New prototype.
	(grub_video_set_mode): make modestring const char *.
	* loader/i386/linux.c (grub_linux_setup_video): Use
	grub_video_get_info_and_fini.
	(grub_linux_boot): Move modesetting just before booting.
	* loader/i386/pc/xnu.c (grub_xnu_set_video): Use
	grub_video_get_info_and_fini.
	* video/i386/pc/vbe.c: Moved framebuffer part ...
	* video/fb/video_fb.c: ... here. Replaced 'vbe' with 'fb'.
	* video/i386/pc/vbe.c (grub_vbe_set_video_mode): Use
	grub_video_fbstd_colors and grub_video_fb_set_palette.
	(grub_video_vbe_init): Clear 'framebuffer' variable and use
	grub_video_fb_init.
	(grub_video_vbe_fini): Use grub_video_fb_fini.
	(grub_video_vbe_setup): Use framebuffer.render_target instead of
	render_target and use grub_video_fb_set_active_render_target and
	grub_video_fb_set_palette.
	(grub_video_vbe_set_palette): Use grub_video_fb_set_palette.
	(grub_video_vbe_set_viewport): Use grub_video_fb_set_viewport.
	(grub_video_vbe_adapter): Use framebuffer.
	* video/video.c (grub_video_get_info_and_fini): New function.
	(grub_video_set_mode): Make modestring const char *.
	(GRUB_MOD_INIT(video_video)): Don't set variables to 0 since these
	values are already initialised.
This commit is contained in:
phcoder 2009-08-14 12:41:58 +00:00
parent d404ee5646
commit d3539132cd
20 changed files with 1840 additions and 1558 deletions

View file

@ -1,3 +1,57 @@
2009-08-14 Vladimir Serbinenko <phcoder@gmail.com>
Framebuffer split.
* commands/i386/pc/vbetest.c (grub_cmd_vbetest): Restore video
subsystem at the end.
* conf/common.rmk (pkglib_MODULES): Add video_fb.mod.
(video_fb_mod_SOURCES): New variable.
(video_fb_mod_CFLAGS): Likewise.
(video_fb_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (vbe_mod_SOURCES): Remove video/i386/pc/vbeblit.c,
video/i386/pc/vbefill.c and video/i386/pc/vbeutil.c.
* video/i386/pc/vbeblit.c: Moved from here ...
* video/fb/fbblit.c: ..here. Replaced 'vbe' with 'fb'.
* video/i386/pc/vbefill.c: Moved from here ...
* video/fb/fbfill.c: ..here. Replaced 'vbe' with 'fb'.
* video/i386/pc/vbeutil.c: Moved from here ...
* video/fb/fbutil.c: ..here. Replaced 'vbe' with 'fb'.
* include/grub/i386/pc/vbeblit.h: Moved from here ...
* include/grub/fbblit.h: ... here. Replaced 'vbe' with 'fb'.
* include/grub/i386/pc/vbefill.h: Moved from here ...
* include/grub/fbfill.h: ... here. Replaced 'vbe' with 'fb'.
* include/grub/i386/pc/vbeutil.h: Moved from here ...
* include/grub/fbutil.h: ... here. Replaced 'vbe' with 'fb'.
* include/grub/i386/pc/vbe.h: Moved framebuffer part ...
* include/grub/video_fb.h: ... here. Replaced 'vbe' with 'fb'.
* include/grub/video.h (GRUB_VIDEO_RENDER_TARGET_FRONT_BUFFER): Removed.
(GRUB_VIDEO_RENDER_TARGET_BACK_BUFFER): Likewise.
(grub_video_adapter): Added 'get_info_and_fini'.
(grub_video_get_info_and_fini): New prototype.
(grub_video_set_mode): make modestring const char *.
* loader/i386/linux.c (grub_linux_setup_video): Use
grub_video_get_info_and_fini.
(grub_linux_boot): Move modesetting just before booting.
* loader/i386/pc/xnu.c (grub_xnu_set_video): Use
grub_video_get_info_and_fini.
* video/i386/pc/vbe.c: Moved framebuffer part ...
* video/fb/video_fb.c: ... here. Replaced 'vbe' with 'fb'.
* video/i386/pc/vbe.c (grub_vbe_set_video_mode): Use
grub_video_fbstd_colors and grub_video_fb_set_palette.
(grub_video_vbe_init): Clear 'framebuffer' variable and use
grub_video_fb_init.
(grub_video_vbe_fini): Use grub_video_fb_fini.
(grub_video_vbe_setup): Use framebuffer.render_target instead of
render_target and use grub_video_fb_set_active_render_target and
grub_video_fb_set_palette.
(grub_video_vbe_set_palette): Use grub_video_fb_set_palette.
(grub_video_vbe_set_viewport): Use grub_video_fb_set_viewport.
(grub_video_vbe_adapter): Use framebuffer.
* video/video.c (grub_video_get_info_and_fini): New function.
(grub_video_set_mode): Make modestring const char *.
(GRUB_MOD_INIT(video_video)): Don't set variables to 0 since these
values are already initialised.
2009-08-14 Pavel Roskin <proski@gnu.org>
* boot/i386/pc/cdboot.S: Use LOCAL for local labels. Eliminate

View file

@ -155,6 +155,8 @@ grub_cmd_vbetest (grub_command_t cmd __attribute__ ((unused)),
grub_getkey ();
grub_video_restore ();
/* Restore old video mode. */
grub_vbe_set_video_mode (old_mode, 0);

View file

@ -535,13 +535,18 @@ lua_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Common Video Subsystem specific modules.
pkglib_MODULES += video.mod videotest.mod bitmap.mod tga.mod jpeg.mod \
png.mod font.mod gfxterm.mod
png.mod font.mod gfxterm.mod video_fb.mod
# For video.mod.
video_mod_SOURCES = video/video.c
video_mod_CFLAGS = $(COMMON_CFLAGS)
video_mod_LDFLAGS = $(COMMON_LDFLAGS)
video_fb_mod_SOURCES = video/fb/video_fb.c video/fb/fbblit.c \
video/fb/fbfill.c video/fb/fbutil.c
video_fb_mod_CFLAGS = $(COMMON_CFLAGS)
video_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For videotest.mod.
videotest_mod_SOURCES = commands/videotest.c
videotest_mod_CFLAGS = $(COMMON_CFLAGS)

View file

@ -271,8 +271,7 @@ multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For vbe.mod.
vbe_mod_SOURCES = video/i386/pc/vbe.c video/i386/pc/vbeblit.c \
video/i386/pc/vbefill.c video/i386/pc/vbeutil.c
vbe_mod_SOURCES = video/i386/pc/vbe.c
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
vbe_mod_LDFLAGS = $(COMMON_LDFLAGS)

134
include/grub/fbblit.h Normal file
View file

@ -0,0 +1,134 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_FBBLIT_HEADER
#define GRUB_FBBLIT_HEADER 1
/* NOTE: This header is private header for fb driver and should not be used
in other parts of the code. */
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);
#endif /* ! GRUB_FBBLIT_HEADER */

75
include/grub/fbfill.h Normal file
View file

@ -0,0 +1,75 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_FBFILL_HEADER
#define GRUB_FBFILL_HEADER 1
/* NOTE: This header is private header for fb driver and should not be used
in other parts of the code. */
struct grub_video_fbblit_info;
struct grub_video_fbrender_target
{
/* Copy of the screen's mode info structure, except that width, height and
mode_type has been re-adjusted to requested render target settings. */
struct grub_video_mode_info mode_info;
struct
{
unsigned int x;
unsigned int y;
unsigned int width;
unsigned int height;
} viewport;
/* Indicates whether the data has been allocated by us and must be freed
when render target is destroyed. */
int is_allocated;
/* Pointer to data. Can either be in video card memory or in local host's
memory. */
void *data;
};
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);
#endif /* ! GRUB_FBFILL_HEADER */

View file

@ -25,19 +25,19 @@
#include <grub/types.h>
#include <grub/video.h>
struct grub_video_i386_vbeblit_info
struct grub_video_fbblit_info
{
struct grub_video_mode_info *mode_info;
void *data;
};
grub_uint8_t *get_data_ptr (struct grub_video_i386_vbeblit_info *source,
grub_uint8_t *get_data_ptr (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y);
grub_video_color_t get_pixel (struct grub_video_i386_vbeblit_info *source,
grub_video_color_t get_pixel (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y);
void set_pixel (struct grub_video_i386_vbeblit_info *source,
void set_pixel (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y, grub_video_color_t color);
#endif /* ! GRUB_VBEUTIL_MACHINE_HEADER */

View file

@ -19,10 +19,7 @@
#ifndef GRUB_VBE_MACHINE_HEADER
#define GRUB_VBE_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/video.h>
#include <grub/video_fb.h>
/* Default video mode to be used. */
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101
@ -231,54 +228,5 @@ grub_err_t grub_vbe_get_video_mode (grub_uint32_t *mode);
grub_err_t grub_vbe_get_video_mode_info (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);
/* VBE module internal prototypes (should not be used from elsewhere). */
struct grub_video_i386_vbeblit_info;
struct grub_video_render_target
{
/* Copy of the screen's mode info structure, except that width, height and
mode_type has been re-adjusted to requested render target settings. */
struct grub_video_mode_info mode_info;
struct
{
unsigned int x;
unsigned int y;
unsigned int width;
unsigned int height;
} viewport;
/* Indicates whether the data has been allocated by us and must be freed
when render target is destroyed. */
int is_allocated;
/* Pointer to data. Can either be in video card memory or in local host's
memory. */
void *data;
};
grub_uint8_t * grub_video_vbe_get_video_ptr (struct grub_video_i386_vbeblit_info *source,
grub_uint32_t x, grub_uint32_t y);
grub_video_color_t grub_video_vbe_map_rgb (grub_uint8_t red, grub_uint8_t green,
grub_uint8_t blue);
grub_video_color_t grub_video_vbe_map_rgba (grub_uint8_t red,
grub_uint8_t green,
grub_uint8_t blue,
grub_uint8_t alpha);
grub_err_t grub_video_vbe_unmap_color (grub_video_color_t color,
grub_uint8_t *red,
grub_uint8_t *green,
grub_uint8_t *blue,
grub_uint8_t *alpha);
void grub_video_vbe_unmap_color_int (struct grub_video_i386_vbeblit_info *source,
grub_video_color_t color,
grub_uint8_t *red,
grub_uint8_t *green,
grub_uint8_t *blue,
grub_uint8_t *alpha);
#endif /* ! GRUB_VBE_MACHINE_HEADER */

View file

@ -1,134 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_VBEBLIT_MACHINE_HEADER
#define GRUB_VBEBLIT_MACHINE_HEADER 1
/* NOTE: This header is private header for vbe driver and should not be used
in other parts of the code. */
struct grub_video_i386_vbeblit_info;
void
grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_directN (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_BGRX8888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_BGRX8888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_BGR888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_BGR888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_RGBX8888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_RGB888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_blend_BGRA8888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_blend_BGR888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_blend_RGBA8888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_blend_RGB888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
void
grub_video_i386_vbeblit_blend_index_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y);
#endif /* ! GRUB_VBEBLIT_MACHINE_HEADER */

View file

@ -1,52 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_VBEFILL_MACHINE_HEADER
#define GRUB_VBEFILL_MACHINE_HEADER 1
/* NOTE: This header is private header for vbe driver and should not be used
in other parts of the code. */
struct grub_video_i386_vbeblit_info;
void
grub_video_i386_vbefill (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
void
grub_video_i386_vbefill_direct32 (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
void
grub_video_i386_vbefill_direct24 (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
void
grub_video_i386_vbefill_direct16 (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
void
grub_video_i386_vbefill_direct8 (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height);
#endif /* ! GRUB_VBEFILL_MACHINE_HEADER */

View file

@ -48,10 +48,8 @@ struct grub_video_bitmap;
#define GRUB_VIDEO_MODE_TYPE_DEPTH_MASK 0x0000ff00
#define GRUB_VIDEO_MODE_TYPE_DEPTH_POS 8
/* Defined predefined render targets. */
#define GRUB_VIDEO_RENDER_TARGET_DISPLAY ((struct grub_video_render_target *) 0)
#define GRUB_VIDEO_RENDER_TARGET_FRONT_BUFFER ((struct grub_video_render_target *) 0)
#define GRUB_VIDEO_RENDER_TARGET_BACK_BUFFER ((struct grub_video_render_target *) 1)
#define GRUB_VIDEO_RENDER_TARGET_DISPLAY \
((struct grub_video_render_target *) 0)
/* Defined blitting formats. */
enum grub_video_blit_format
@ -177,6 +175,9 @@ struct grub_video_adapter
grub_err_t (*get_info) (struct grub_video_mode_info *mode_info);
grub_err_t (*get_info_and_fini) (struct grub_video_mode_info *mode_info,
void **framebuffer);
grub_err_t (*set_palette) (unsigned int start, unsigned int count,
struct grub_video_palette_data *palette_data);
@ -241,6 +242,14 @@ grub_err_t grub_video_restore (void);
grub_err_t grub_video_get_info (struct grub_video_mode_info *mode_info);
/* Framebuffer address may change as a part of normal operation
(e.g. double buffering). That's why you need to stop video subsystem to be
sure that framebuffer address doesn't change. To ensure this abstraction
grub_video_get_info_and_fini is the only function supplying framebuffer
address. */
grub_err_t grub_video_get_info_and_fini (struct grub_video_mode_info *mode_info,
void **framebuffer);
enum grub_video_blit_format grub_video_get_blit_format (struct grub_video_mode_info *mode_info);
grub_err_t grub_video_set_palette (unsigned int start, unsigned int count,
@ -297,7 +306,7 @@ grub_err_t grub_video_set_active_render_target (struct grub_video_render_target
grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target);
grub_err_t grub_video_set_mode (char *modestring,
grub_err_t grub_video_set_mode (const char *modestring,
int NESTED_FUNC_ATTR (*hook) (grub_video_adapter_t p,
struct grub_video_mode_info *mode_info));

121
include/grub/video_fb.h Normal file
View file

@ -0,0 +1,121 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_VIDEO_FB_HEADER
#define GRUB_VIDEO_FB_HEADER 1
#include <grub/symbol.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/video.h>
/* FB module internal prototype (should not be used from elsewhere). */
struct grub_video_fbblit_info;
struct grub_video_fbrender_target;
#define GRUB_VIDEO_FBSTD_NUMCOLORS 16
extern struct grub_video_palette_data grub_video_fbstd_colors[GRUB_VIDEO_FBSTD_NUMCOLORS];
grub_uint8_t * grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
grub_uint32_t x, grub_uint32_t y);
grub_err_t
grub_video_fb_init (void);
grub_err_t
grub_video_fb_fini (void);
grub_err_t
grub_video_fb_get_info (struct grub_video_mode_info *mode_info);
grub_err_t
grub_video_fb_get_palette (unsigned int start, unsigned int count,
struct grub_video_palette_data *palette_data);
grub_err_t
grub_video_fb_set_palette (unsigned int start, unsigned int count,
struct grub_video_palette_data *palette_data);
grub_err_t
grub_video_fb_set_viewport (unsigned int x, unsigned int y,
unsigned int width, unsigned int height);
grub_err_t
grub_video_fb_get_viewport (unsigned int *x, unsigned int *y,
unsigned int *width, unsigned int *height);
grub_video_color_t
grub_video_fb_map_color (grub_uint32_t color_name);
grub_video_color_t
grub_video_fb_map_rgb (grub_uint8_t red, grub_uint8_t green,
grub_uint8_t blue);
grub_video_color_t
grub_video_fb_map_rgba (grub_uint8_t red, grub_uint8_t green,
grub_uint8_t blue, grub_uint8_t alpha);
grub_err_t
grub_video_fb_unmap_color (grub_video_color_t color,
grub_uint8_t *red, grub_uint8_t *green,
grub_uint8_t *blue, grub_uint8_t *alpha);
void
grub_video_fb_unmap_color_int (struct grub_video_fbblit_info * source,
grub_video_color_t color,
grub_uint8_t *red, grub_uint8_t *green,
grub_uint8_t *blue, grub_uint8_t *alpha);
grub_err_t
grub_video_fb_fill_rect (grub_video_color_t color, int x, int y,
unsigned int width, unsigned int height);
grub_err_t
grub_video_fb_blit_bitmap (struct grub_video_bitmap *bitmap,
enum grub_video_blit_operators oper, int x, int y,
int offset_x, int offset_y,
unsigned int width, unsigned int height);
grub_err_t
grub_video_fb_blit_render_target (struct grub_video_fbrender_target *source,
enum grub_video_blit_operators oper,
int x, int y, int offset_x, int offset_y,
unsigned int width, unsigned int height);
grub_err_t
grub_video_fb_scroll (grub_video_color_t color, int dx, int dy);
grub_err_t
grub_video_fb_create_render_target (struct grub_video_fbrender_target **result,
unsigned int width, unsigned int height,
unsigned int mode_type __attribute__ ((unused)));
grub_err_t
grub_video_fb_create_render_target_from_pointer (struct grub_video_fbrender_target **result,
const struct grub_video_mode_info *mode_info,
void *ptr);
grub_err_t
grub_video_fb_delete_render_target (struct grub_video_fbrender_target *target);
grub_err_t
grub_video_fb_get_active_render_target (struct grub_video_fbrender_target **target);
grub_err_t
grub_video_fb_set_active_render_target (struct grub_video_fbrender_target *target);
#endif /* ! GRUB_VIDEO_FB_HEADER */

View file

@ -31,9 +31,7 @@
#include <grub/term.h>
#include <grub/cpu/linux.h>
#include <grub/video.h>
/* FIXME: the definition of `struct grub_video_render_target' is
VBE-specific. */
#include <grub/i386/pc/vbe.h>
#include <grub/video_fb.h>
#include <grub/command.h>
#define GRUB_LINUX_CL_OFFSET 0x1000
@ -403,14 +401,11 @@ static int
grub_linux_setup_video (struct linux_kernel_params *params)
{
struct grub_video_mode_info mode_info;
struct grub_video_render_target *render_target;
void *framebuffer;
int ret;
ret = grub_video_get_info (&mode_info);
if (ret)
return 1;
ret = grub_video_get_info_and_fini (&mode_info, &framebuffer);
ret = grub_video_get_active_render_target (&render_target);
if (ret)
return 1;
@ -419,7 +414,7 @@ grub_linux_setup_video (struct linux_kernel_params *params)
params->lfb_depth = mode_info.bpp;
params->lfb_line_len = mode_info.pitch;
params->lfb_base = (grub_size_t) render_target->data;
params->lfb_base = (grub_size_t) framebuffer;
params->lfb_size = (params->lfb_line_len * params->lfb_height + 65535) >> 16;
params->red_mask_size = mode_info.red_mask_size;
@ -449,41 +444,6 @@ grub_linux_boot (void)
params = real_mode_mem;
modevar = grub_env_get ("gfxpayload");
/* Now all graphical modes are acceptable.
May change in future if we have modes without framebuffer. */
if (modevar && *modevar != 0)
{
tmp = grub_malloc (grub_strlen (modevar)
+ sizeof (DEFAULT_VIDEO_MODE) + 1);
if (! tmp)
return grub_errno;
grub_sprintf (tmp, "%s;" DEFAULT_VIDEO_MODE, modevar);
err = grub_video_set_mode (tmp, 0);
grub_free (tmp);
}
#ifndef GRUB_ASSUME_LINUX_HAS_FB_SUPPORT
else
err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0);
#endif
if (err)
{
grub_print_error ();
grub_printf ("Booting however\n");
grub_errno = GRUB_ERR_NONE;
}
if (! grub_linux_setup_video (params))
params->have_vga = GRUB_VIDEO_TYPE_VLFB;
else
{
params->have_vga = GRUB_VIDEO_TYPE_TEXT;
params->video_width = 80;
params->video_height = 25;
}
grub_dprintf ("linux", "code32_start = %x, idt_desc = %lx, gdt_desc = %lx\n",
(unsigned) params->code32_start,
(unsigned long) &(idt_desc.limit),
@ -534,6 +494,41 @@ grub_linux_boot (void)
grub_mmap_iterate (hook);
params->mmap_size = e820_num;
modevar = grub_env_get ("gfxpayload");
/* Now all graphical modes are acceptable.
May change in future if we have modes without framebuffer. */
if (modevar && *modevar != 0)
{
tmp = grub_malloc (grub_strlen (modevar)
+ sizeof (DEFAULT_VIDEO_MODE) + 1);
if (! tmp)
return grub_errno;
grub_sprintf (tmp, "%s;" DEFAULT_VIDEO_MODE, modevar);
err = grub_video_set_mode (tmp, 0);
grub_free (tmp);
}
#ifndef GRUB_ASSUME_LINUX_HAS_FB_SUPPORT
else
err = grub_video_set_mode (DEFAULT_VIDEO_MODE, 0);
#endif
if (err)
{
grub_print_error ();
grub_printf ("Booting however\n");
grub_errno = GRUB_ERR_NONE;
}
if (! grub_linux_setup_video (params))
params->have_vga = GRUB_VIDEO_TYPE_VLFB;
else
{
params->have_vga = GRUB_VIDEO_TYPE_TEXT;
params->video_width = 80;
params->video_height = 25;
}
/* Initialize these last, because terminal position could be affected by printfs above. */
if (params->have_vga == GRUB_VIDEO_TYPE_TEXT)
{

View file

@ -21,8 +21,7 @@
#include <grub/xnu.h>
#include <grub/mm.h>
#include <grub/cpu/xnu.h>
#include <grub/machine/vbe.h>
#include <grub/machine/vga.h>
#include <grub/video_fb.h>
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define max(a,b) (((a) > (b)) ? (a) : (b))
@ -43,10 +42,10 @@ grub_err_t
grub_xnu_set_video (struct grub_xnu_boot_params *params)
{
struct grub_video_mode_info mode_info;
struct grub_video_render_target *render_target;
int ret;
int x,y;
char *tmp, *modevar;
void *framebuffer;
grub_err_t err;
modevar = grub_env_get ("gfxpayload");
@ -67,11 +66,7 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
if (err)
return err;
ret = grub_video_get_info (&mode_info);
if (ret)
return grub_error (GRUB_ERR_IO, "couldn't retrieve video parameters");
ret = grub_video_get_active_render_target (&render_target);
ret = grub_video_get_info_and_fini (&mode_info, &framebuffer);
if (ret)
return grub_error (GRUB_ERR_IO, "couldn't retrieve video parameters");
@ -102,7 +97,7 @@ grub_xnu_set_video (struct grub_xnu_boot_params *params)
params->lfb_depth = mode_info.bpp;
params->lfb_line_len = mode_info.pitch;
params->lfb_base = PTR_TO_UINT32 (render_target->data);
params->lfb_base = PTR_TO_UINT32 (framebuffer);
params->lfb_mode = grub_xnu_bitmap
? GRUB_XNU_VIDEO_SPLASH : GRUB_XNU_VIDEO_TEXT_IN_VIDEO;

View file

@ -27,19 +27,19 @@
- Every function in this code assumes that bounds checking has been done in
previous phase and they are opted out in here. */
#include <grub/machine/vbe.h>
#include <grub/machine/vbeblit.h>
#include <grub/machine/vbeutil.h>
#include <grub/video_fb.h>
#include <grub/fbblit.h>
#include <grub/fbutil.h>
#include <grub/misc.h>
#include <grub/types.h>
#include <grub/video.h>
/* Generic replacing blitter (slow). Works for every supported format. */
void
grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y)
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)
{
int i;
int j;
@ -56,11 +56,11 @@ grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
{
src_color = get_pixel (src, i + offset_x, j + offset_y);
grub_video_vbe_unmap_color_int (src, src_color, &src_red, &src_green,
&src_blue, &src_alpha);
grub_video_fb_unmap_color_int (src, src_color, &src_red, &src_green,
&src_blue, &src_alpha);
dst_color = grub_video_vbe_map_rgba (src_red, src_green,
src_blue, src_alpha);
dst_color = grub_video_fb_map_rgba (src_red, src_green,
src_blue, src_alpha);
set_pixel (dst, x + i, y + j, dst_color);
}
@ -69,10 +69,10 @@ grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
/* Block copy replacing blitter. Works with modes multiple of 8 bits. */
void
grub_video_i386_vbeblit_replace_directN (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y)
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)
{
int j;
grub_uint32_t *srcptr;
@ -92,11 +92,11 @@ grub_video_i386_vbeblit_replace_directN (struct grub_video_i386_vbeblit_info *ds
/* Optimized replacing blitter for RGBX8888 to BGRX8888. */
void
grub_video_i386_vbeblit_replace_BGRX8888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
int i;
int j;
@ -135,11 +135,11 @@ grub_video_i386_vbeblit_replace_BGRX8888_RGBX8888 (struct grub_video_i386_vbebli
/* Optimized replacing blitter for RGB888 to BGRX8888. */
void
grub_video_i386_vbeblit_replace_BGRX8888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
int i;
int j;
@ -179,11 +179,11 @@ grub_video_i386_vbeblit_replace_BGRX8888_RGB888 (struct grub_video_i386_vbeblit_
/* Optimized replacing blitter for RGBX8888 to BGR888. */
void
grub_video_i386_vbeblit_replace_BGR888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t *srcptr;
grub_uint8_t *dstptr;
@ -227,11 +227,11 @@ grub_video_i386_vbeblit_replace_BGR888_RGBX8888 (struct grub_video_i386_vbeblit_
/* Optimized replacing blitter for RGB888 to BGR888. */
void
grub_video_i386_vbeblit_replace_BGR888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
int i;
int j;
@ -268,11 +268,11 @@ grub_video_i386_vbeblit_replace_BGR888_RGB888 (struct grub_video_i386_vbeblit_in
/* Optimized replacing blitter for RGB888 to RGBX8888. */
void
grub_video_i386_vbeblit_replace_RGBX8888_RGB888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t color;
int i;
@ -304,11 +304,11 @@ grub_video_i386_vbeblit_replace_RGBX8888_RGB888 (struct grub_video_i386_vbeblit_
/* Optimized replacing blitter for RGBX8888 to RGB888. */
void
grub_video_i386_vbeblit_replace_RGB888_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t color;
int i;
@ -341,11 +341,11 @@ grub_video_i386_vbeblit_replace_RGB888_RGBX8888 (struct grub_video_i386_vbeblit_
/* Optimized replacing blitter for RGBX8888 to indexed color. */
void
grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t color;
int i;
@ -369,7 +369,7 @@ grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_i
sg = (color >> 8) & 0xFF;
sb = (color >> 16) & 0xFF;
color = grub_video_vbe_map_rgb(sr, sg, sb);
color = grub_video_fb_map_rgb(sr, sg, sb);
*dstptr++ = color & 0xFF;
}
}
@ -377,11 +377,11 @@ grub_video_i386_vbeblit_replace_index_RGBX8888 (struct grub_video_i386_vbeblit_i
/* Optimized replacing blitter for RGB888 to indexed color. */
void
grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t color;
int i;
@ -403,7 +403,7 @@ grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_inf
sg = *srcptr++;
sb = *srcptr++;
color = grub_video_vbe_map_rgb(sr, sg, sb);
color = grub_video_fb_map_rgb(sr, sg, sb);
*dstptr++ = color & 0xFF;
}
@ -412,10 +412,10 @@ grub_video_i386_vbeblit_replace_index_RGB888 (struct grub_video_i386_vbeblit_inf
/* Generic blending blitter. Works for every supported format. */
void
grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y, int width, int height,
int offset_x, int offset_y)
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)
{
int i;
int j;
@ -436,24 +436,24 @@ grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t dst_color;
src_color = get_pixel (src, i + offset_x, j + offset_y);
grub_video_vbe_unmap_color_int (src, src_color, &src_red, &src_green,
&src_blue, &src_alpha);
grub_video_fb_unmap_color_int (src, src_color, &src_red, &src_green,
&src_blue, &src_alpha);
if (src_alpha == 0)
continue;
if (src_alpha == 255)
{
dst_color = grub_video_vbe_map_rgba (src_red, src_green,
src_blue, src_alpha);
dst_color = grub_video_fb_map_rgba (src_red, src_green,
src_blue, src_alpha);
set_pixel (dst, x + i, y + j, dst_color);
continue;
}
dst_color = get_pixel (dst, x + i, y + j);
grub_video_vbe_unmap_color_int (dst, dst_color, &dst_red,
&dst_green, &dst_blue, &dst_alpha);
grub_video_fb_unmap_color_int (dst, dst_color, &dst_red,
&dst_green, &dst_blue, &dst_alpha);
dst_red = (((src_red * src_alpha)
+ (dst_red * (255 - src_alpha))) / 255);
@ -463,8 +463,8 @@ grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
+ (dst_blue * (255 - src_alpha))) / 255);
dst_alpha = src_alpha;
dst_color = grub_video_vbe_map_rgba (dst_red, dst_green, dst_blue,
dst_alpha);
dst_color = grub_video_fb_map_rgba (dst_red, dst_green, dst_blue,
dst_alpha);
set_pixel (dst, x + i, y + j, dst_color);
}
@ -473,11 +473,11 @@ grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
/* Optimized blending blitter for RGBA8888 to BGRA8888. */
void
grub_video_i386_vbeblit_blend_BGRA8888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t *srcptr;
grub_uint32_t *dstptr;
@ -554,11 +554,11 @@ grub_video_i386_vbeblit_blend_BGRA8888_RGBA8888 (struct grub_video_i386_vbeblit_
/* Optimized blending blitter for RGBA8888 to BGR888. */
void
grub_video_i386_vbeblit_blend_BGR888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t *srcptr;
grub_uint8_t *dstptr;
@ -635,11 +635,11 @@ grub_video_i386_vbeblit_blend_BGR888_RGBA8888 (struct grub_video_i386_vbeblit_in
/* Optimized blending blitter for RGBA888 to RGBA8888. */
void
grub_video_i386_vbeblit_blend_RGBA8888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t color;
int i;
@ -700,11 +700,11 @@ grub_video_i386_vbeblit_blend_RGBA8888_RGBA8888 (struct grub_video_i386_vbeblit_
/* Optimized blending blitter for RGBA8888 to RGB888. */
void
grub_video_i386_vbeblit_blend_RGB888_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t color;
int i;
@ -766,11 +766,11 @@ grub_video_i386_vbeblit_blend_RGB888_RGBA8888 (struct grub_video_i386_vbeblit_in
/* Optimized blending blitter for RGBA8888 to indexed color. */
void
grub_video_i386_vbeblit_blend_index_RGBA8888 (struct grub_video_i386_vbeblit_info *dst,
struct grub_video_i386_vbeblit_info *src,
int x, int y,
int width, int height,
int offset_x, int offset_y)
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)
{
grub_uint32_t color;
int i;
@ -809,18 +809,18 @@ grub_video_i386_vbeblit_blend_index_RGBA8888 (struct grub_video_i386_vbeblit_inf
if (a == 255)
{
color = grub_video_vbe_map_rgb(sr, sg, sb);
color = grub_video_fb_map_rgb(sr, sg, sb);
*dstptr++ = color & 0xFF;
continue;
}
grub_video_vbe_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da);
grub_video_fb_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da);
dr = (dr * (255 - a) + sr * a) / 255;
dg = (dg * (255 - a) + sg * a) / 255;
db = (db * (255 - a) + sb * a) / 255;
color = grub_video_vbe_map_rgb(dr, dg, db);
color = grub_video_fb_map_rgb(dr, dg, db);
*dstptr++ = color & 0xFF;
}

View file

@ -27,32 +27,32 @@
- Every function in this code assumes that bounds checking has been done in
previous phase and they are opted out in here. */
#include <grub/machine/vbe.h>
#include <grub/machine/vbefill.h>
#include <grub/machine/vbeutil.h>
#include <grub/video_fb.h>
#include <grub/fbfill.h>
#include <grub/fbutil.h>
#include <grub/types.h>
#include <grub/video.h>
/* Generic filler that works for every supported mode. */
void
grub_video_i386_vbefill (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
grub_video_fbfill (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
{
int i;
int j;
for (j = 0; j < height; j++)
for (i = 0; i < width; i++)
set_pixel (dst, x+i, y+j, color);
set_pixel (dst, x + i, y + j, color);
}
/* Optimized filler for direct color 32 bit modes. It is assumed that color
is already mapped to destination format. */
void
grub_video_i386_vbefill_direct32 (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
grub_video_fbfill_direct32 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
{
int i;
int j;
@ -64,7 +64,7 @@ grub_video_i386_vbefill_direct32 (struct grub_video_i386_vbeblit_info *dst,
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
/* Get the start address. */
dstptr = (grub_uint32_t *) grub_video_vbe_get_video_ptr (dst, x, y);
dstptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (dst, x, y);
for (j = 0; j < height; j++)
{
@ -79,9 +79,9 @@ grub_video_i386_vbefill_direct32 (struct grub_video_i386_vbeblit_info *dst,
/* Optimized filler for direct color 24 bit modes. It is assumed that color
is already mapped to destination format. */
void
grub_video_i386_vbefill_direct24 (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
grub_video_fbfill_direct24 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
{
int i;
int j;
@ -96,7 +96,7 @@ grub_video_i386_vbefill_direct24 (struct grub_video_i386_vbeblit_info *dst,
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
/* Get the start address. */
dstptr = (grub_uint8_t *) grub_video_vbe_get_video_ptr (dst, x, y);
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
for (j = 0; j < height; j++)
{
@ -115,9 +115,9 @@ grub_video_i386_vbefill_direct24 (struct grub_video_i386_vbeblit_info *dst,
/* Optimized filler for direct color 16 bit modes. It is assumed that color
is already mapped to destination format. */
void
grub_video_i386_vbefill_direct16 (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
grub_video_fbfill_direct16 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
{
int i;
int j;
@ -131,7 +131,7 @@ grub_video_i386_vbefill_direct16 (struct grub_video_i386_vbeblit_info *dst,
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
/* Get the start address. */
dstptr = (grub_uint8_t *) grub_video_vbe_get_video_ptr (dst, x, y);
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
for (j = 0; j < height; j++)
{
@ -149,9 +149,9 @@ grub_video_i386_vbefill_direct16 (struct grub_video_i386_vbeblit_info *dst,
/* Optimized filler for index color. It is assumed that color
is already mapped to destination format. */
void
grub_video_i386_vbefill_direct8 (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
grub_video_fbfill_direct8 (struct grub_video_fbblit_info *dst,
grub_video_color_t color, int x, int y,
int width, int height)
{
int i;
int j;
@ -164,7 +164,7 @@ grub_video_i386_vbefill_direct8 (struct grub_video_i386_vbeblit_info *dst,
rowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width;
/* Get the start address. */
dstptr = (grub_uint8_t *) grub_video_vbe_get_video_ptr (dst, x, y);
dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y);
for (j = 0; j < height; j++)
{

View file

@ -16,12 +16,12 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/machine/vbeutil.h>
#include <grub/fbutil.h>
#include <grub/types.h>
#include <grub/video.h>
grub_uint8_t *
get_data_ptr (struct grub_video_i386_vbeblit_info *source,
get_data_ptr (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y)
{
grub_uint8_t *ptr = 0;
@ -64,7 +64,7 @@ get_data_ptr (struct grub_video_i386_vbeblit_info *source,
}
grub_video_color_t
get_pixel (struct grub_video_i386_vbeblit_info *source,
get_pixel (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y)
{
grub_video_color_t color = 0;
@ -111,7 +111,7 @@ get_pixel (struct grub_video_i386_vbeblit_info *source,
}
void
set_pixel (struct grub_video_i386_vbeblit_info *source,
set_pixel (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y, grub_video_color_t color)
{
switch (source->mode_info->bpp)

1156
video/fb/video_fb.c Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -93,6 +93,24 @@ grub_video_get_info (struct grub_video_mode_info *mode_info)
return grub_video_adapter_active->get_info (mode_info);
}
/* Get information about active video mode. */
grub_err_t
grub_video_get_info_and_fini (struct grub_video_mode_info *mode_info,
void **framebuffer)
{
grub_err_t err;
if (! grub_video_adapter_active)
return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
err = grub_video_adapter_active->get_info_and_fini (mode_info, framebuffer);
if (err)
return err;
grub_video_adapter_active = 0;
return GRUB_ERR_NONE;
}
/* Determine optimized blitting formation for specified video mode info. */
enum grub_video_blit_format
grub_video_get_blit_format (struct grub_video_mode_info *mode_info)
@ -380,7 +398,7 @@ grub_video_get_active_render_target (struct grub_video_render_target **target)
}
grub_err_t
grub_video_set_mode (char *modestring,
grub_video_set_mode (const char *modestring,
int NESTED_FUNC_ATTR (*hook) (grub_video_adapter_t p,
struct grub_video_mode_info *mode_info))
{
@ -695,8 +713,6 @@ grub_video_set_mode (char *modestring,
/* Initialize Video API module. */
GRUB_MOD_INIT(video_video)
{
grub_video_adapter_active = 0;
grub_video_adapter_list = 0;
}
/* Finalize Video API module. */