Hello I am sending the rest of framebuffer patches that were not included in the split by Vladimir.
remove-dup-function.patch * video_fb.c: remove grub_video_fb_get_video_ptr which is duplicated in fbutil.c * fbutil.c: copy the note from fbfill.c rename-var.patch vbe.c: grub_video_vbe_setup rename local variable - this should make the distinction between grub_vbe_mode_info_block and grub_video_mode_info clearer in this function Thanks Michal
Index: video/fb/fbblit.c =================================================================== --- video/fb/fbblit.c (revision 2496) +++ video/fb/fbblit.c (working copy) @@ -83,8 +83,8 @@ for (j = 0; j < height; j++) { - srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y); - dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j); + srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y); + dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j); grub_memmove (dstptr, srcptr, width * bpp); } @@ -110,8 +110,8 @@ srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width; dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; - srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y); - dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y); + srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y); for (j = 0; j < height; j++) { @@ -153,8 +153,8 @@ srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width; dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; - srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y); - dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y); + srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y); for (j = 0; j < height; j++) { @@ -197,8 +197,8 @@ srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width; dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; - srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y); - dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y); + srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y); for (j = 0; j < height; j++) { @@ -245,8 +245,8 @@ srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width; dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; - srcptr = (grub_uint8_t *) get_data_ptr (src, offset_x, offset_y); - dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y); + srcptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y); for (j = 0; j < height; j++) { @@ -285,8 +285,8 @@ for (j = 0; j < height; j++) { - srcptr = (grub_uint8_t *)get_data_ptr (src, offset_x, j + offset_y); - dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j); + srcptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y); + dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j); for (i = 0; i < width; i++) { @@ -321,8 +321,8 @@ for (j = 0; j < height; j++) { - srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y); - dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j); + srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y); + dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j); for (i = 0; i < width; i++) { @@ -358,8 +358,8 @@ for (j = 0; j < height; j++) { - srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y); - dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j); + srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y); + dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j); for (i = 0; i < width; i++) { @@ -394,8 +394,8 @@ for (j = 0; j < height; j++) { - srcptr = (grub_uint8_t *)get_data_ptr (src, offset_x, j + offset_y); - dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j); + srcptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y); + dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j); for (i = 0; i < width; i++) { @@ -491,8 +491,8 @@ srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width; dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; - srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y); - dstptr = (grub_uint32_t *) get_data_ptr (dst, x, y); + srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (dst, x, y); for (j = 0; j < height; j++) { @@ -572,8 +572,8 @@ srcrowskip = src->mode_info->pitch - src->mode_info->bytes_per_pixel * width; dstrowskip = dst->mode_info->pitch - dst->mode_info->bytes_per_pixel * width; - srcptr = (grub_uint32_t *) get_data_ptr (src, offset_x, offset_y); - dstptr = (grub_uint8_t *) get_data_ptr (dst, x, y); + srcptr = (grub_uint32_t *) grub_video_fb_get_video_ptr (src, offset_x, offset_y); + dstptr = (grub_uint8_t *) grub_video_fb_get_video_ptr (dst, x, y); for (j = 0; j < height; j++) { @@ -656,8 +656,8 @@ for (j = 0; j < height; j++) { - srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y); - dstptr = (grub_uint32_t *)get_data_ptr (dst, x, y + j); + srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y); + dstptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (dst, x, y + j); for (i = 0; i < width; i++) { @@ -721,8 +721,8 @@ for (j = 0; j < height; j++) { - srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y); - dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j); + srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y); + dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j); for (i = 0; i < width; i++) { @@ -788,8 +788,8 @@ for (j = 0; j < height; j++) { - srcptr = (grub_uint32_t *)get_data_ptr (src, offset_x, j + offset_y); - dstptr = (grub_uint8_t *)get_data_ptr (dst, x, y + j); + srcptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (src, offset_x, j + offset_y); + dstptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (dst, x, y + j); for (i = 0; i < width; i++) { Index: video/fb/fbutil.c =================================================================== --- video/fb/fbutil.c (revision 2496) +++ video/fb/fbutil.c (working copy) @@ -16,12 +16,23 @@ * along with GRUB. If not, see <http://www.gnu.org/licenses/>. */ +/* SPECIAL NOTES! + + Please note following when reading the code below: + + - In this driver we assume that every memory can be accessed by same memory + bus. If there are different address spaces do not use this code as a base + code for other archs. + + - Every function in this code assumes that bounds checking has been done in + previous phase and they are opted out in here. */ + #include <grub/fbutil.h> #include <grub/types.h> #include <grub/video.h> grub_uint8_t * -get_data_ptr (struct grub_video_fbblit_info *source, +grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source, unsigned int x, unsigned int y) { grub_uint8_t *ptr = 0; @@ -72,24 +83,24 @@ switch (source->mode_info->bpp) { case 32: - color = *(grub_uint32_t *)get_data_ptr (source, x, y); + color = *(grub_uint32_t *)grub_video_fb_get_video_ptr (source, x, y); break; case 24: { grub_uint8_t *ptr; - ptr = get_data_ptr (source, x, y); + ptr = grub_video_fb_get_video_ptr (source, x, y); color = ptr[0] | (ptr[1] << 8) | (ptr[2] << 16); } break; case 16: case 15: - color = *(grub_uint16_t *)get_data_ptr (source, x, y); + color = *(grub_uint16_t *)grub_video_fb_get_video_ptr (source, x, y); break; case 8: - color = *(grub_uint8_t *)get_data_ptr (source, x, y); + color = *(grub_uint8_t *)grub_video_fb_get_video_ptr (source, x, y); break; case 1: @@ -120,7 +131,7 @@ { grub_uint32_t *ptr; - ptr = (grub_uint32_t *)get_data_ptr (source, x, y); + ptr = (grub_uint32_t *)grub_video_fb_get_video_ptr (source, x, y); *ptr = color; } @@ -131,7 +142,7 @@ grub_uint8_t *ptr; grub_uint8_t *colorptr = (grub_uint8_t *)&color; - ptr = get_data_ptr (source, x, y); + ptr = grub_video_fb_get_video_ptr (source, x, y); ptr[0] = colorptr[0]; ptr[1] = colorptr[1]; @@ -144,7 +155,7 @@ { grub_uint16_t *ptr; - ptr = (grub_uint16_t *)get_data_ptr (source, x, y); + ptr = (grub_uint16_t *)grub_video_fb_get_video_ptr (source, x, y); *ptr = (grub_uint16_t) (color & 0xFFFF); } @@ -154,7 +165,7 @@ { grub_uint8_t *ptr; - ptr = (grub_uint8_t *)get_data_ptr (source, x, y); + ptr = (grub_uint8_t *)grub_video_fb_get_video_ptr (source, x, y); *ptr = (grub_uint8_t) (color & 0xFF); } Index: video/fb/video_fb.c =================================================================== --- video/fb/video_fb.c (revision 2496) +++ video/fb/video_fb.c (working copy) @@ -83,44 +83,6 @@ return GRUB_ERR_NONE; } - -grub_uint8_t * -grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source, - grub_uint32_t x, grub_uint32_t y) -{ - grub_uint8_t *ptr = 0; - - switch (source->mode_info->bpp) - { - case 32: - ptr = (grub_uint8_t *)source->data - + y * source->mode_info->pitch - + x * 4; - break; - - case 24: - ptr = (grub_uint8_t *)source->data - + y * source->mode_info->pitch - + x * 3; - break; - - case 16: - case 15: - ptr = (grub_uint8_t *)source->data - + y * source->mode_info->pitch - + x * 2; - break; - - case 8: - ptr = (grub_uint8_t *)source->data - + y * source->mode_info->pitch - + x; - break; - } - - return ptr; -} - grub_err_t grub_video_fb_get_palette (unsigned int start, unsigned int count, struct grub_video_palette_data *palette_data) Index: include/grub/fbutil.h =================================================================== --- include/grub/fbutil.h (revision 2496) +++ include/grub/fbutil.h (working copy) @@ -31,7 +31,7 @@ void *data; }; -grub_uint8_t *get_data_ptr (struct grub_video_fbblit_info *source, +grub_uint8_t *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source, unsigned int x, unsigned int y); grub_video_color_t get_pixel (struct grub_video_fbblit_info *source, Index: include/grub/video_fb.h =================================================================== --- include/grub/video_fb.h (revision 2496) +++ include/grub/video_fb.h (working copy) @@ -33,9 +33,6 @@ #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);
Index: video/i386/pc/vbe.c =================================================================== --- video/i386/pc/vbe.c (revision 2496) +++ video/i386/pc/vbe.c (working copy) @@ -382,7 +382,7 @@ unsigned int mode_type) { grub_uint16_t *p; - struct grub_vbe_mode_info_block mode_info; + struct grub_vbe_mode_info_block vbe_mode_info; struct grub_vbe_mode_info_block best_mode_info; grub_uint32_t best_mode = 0; int depth; @@ -396,7 +396,7 @@ { grub_uint32_t mode = *p; - grub_vbe_get_video_mode_info (mode, &mode_info); + grub_vbe_get_video_mode_info (mode, &vbe_mode_info); if (grub_errno != GRUB_ERR_NONE) { /* Could not retrieve mode info, retreat. */ @@ -404,33 +404,33 @@ break; } - if ((mode_info.mode_attributes & 0x001) == 0) + if ((vbe_mode_info.mode_attributes & 0x001) == 0) /* If not available, skip it. */ continue; - if ((mode_info.mode_attributes & 0x002) == 0) + if ((vbe_mode_info.mode_attributes & 0x002) == 0) /* Not enough information. */ continue; - if ((mode_info.mode_attributes & 0x008) == 0) + if ((vbe_mode_info.mode_attributes & 0x008) == 0) /* Monochrome is unusable. */ continue; - if ((mode_info.mode_attributes & 0x080) == 0) + if ((vbe_mode_info.mode_attributes & 0x080) == 0) /* We support only linear frame buffer modes. */ continue; - if ((mode_info.mode_attributes & 0x010) == 0) + if ((vbe_mode_info.mode_attributes & 0x010) == 0) /* We allow only graphical modes. */ continue; - if ((mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL) - && (mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR)) + if ((vbe_mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL) + && (vbe_mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR)) /* Not compatible memory model. */ continue; - if ((mode_info.x_resolution != width) - || (mode_info.y_resolution != height)) + if ((vbe_mode_info.x_resolution != width) + || (vbe_mode_info.y_resolution != height)) /* Non matching resolution. */ continue; @@ -438,28 +438,28 @@ if ((mode_type & GRUB_VIDEO_MODE_TYPE_COLOR_MASK) != 0) { if (((mode_type & GRUB_VIDEO_MODE_TYPE_INDEX_COLOR) != 0) - && (mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL)) + && (vbe_mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL)) /* Requested only index color modes. */ continue; if (((mode_type & GRUB_VIDEO_MODE_TYPE_RGB) != 0) - && (mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR)) + && (vbe_mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR)) /* Requested only RGB modes. */ continue; } /* If there is a request for specific depth, ignore others. */ - if ((depth != 0) && (mode_info.bits_per_pixel != depth)) + if ((depth != 0) && (vbe_mode_info.bits_per_pixel != depth)) continue; /* Select mode with most number of bits per pixel. */ if (best_mode != 0) - if (mode_info.bits_per_pixel < best_mode_info.bits_per_pixel) + if (vbe_mode_info.bits_per_pixel < best_mode_info.bits_per_pixel) continue; /* Save so far best mode information for later use. */ best_mode = mode; - grub_memcpy (&best_mode_info, &mode_info, sizeof (mode_info)); + grub_memcpy (&best_mode_info, &vbe_mode_info, sizeof (vbe_mode_info)); } /* Try to initialize best mode found. */
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel