2009/8/14 Vladimir 'phcoder' Serbinenko <[email protected]>:
> On Fri, Aug 14, 2009 at 2:13 AM, Michal Suchanek<[email protected]> wrote:
>> 2009/8/13 Vladimir 'phcoder' Serbinenko <[email protected]>:
>>>> Considering that vbe.c and sdl.c currently aren't affected a lot
>>>> whether there is or there isn't encapsulation in place, I'm ok tih
>>>> encapsulating it but if any driver needs the breach of encapsulation
>>>> it will be broken and I'll post no opposition to it.
>>>> I'll do the encapsulation tomorrow.
>>> Patch attached. One incremental version (for review) and one complete
>>> (for patching)
>>
>> The patch as presented here works for me.
>>
>> However, I wonder some of the changes:
>>
>> In the latest round of patches struct grub_video_fbrender_target
>> declaration was needlessly and somewhat illogically moved from
>> video_fb.h to fbfill.h.
> fbfill.h is a private header whereas video_fb.h is public one. You're
> the one who requested encapsulation
OK, I did not get why fbfill.h of the three private headers.
Perhaps fbutil.h which already declares blit_info would be a better place then.
>> In grub_video_vbe_setup function in vbe.c the default palette is
>> loaded before the created render target is set as active. I guess this
>> would be a problem if the palette was actually needed/supported.
>> Changing the order to create, set_active, set_palette makes the code
>> fail for me,though.
> Works for me. Have you forgotten about 'return' ?
Yes, perhaps I did something wrong when reordering the calls for the first time.
>>
>> In this same code struct grub_video_mode_info mode_info is added in
>> the last round of patches but I cannot find where the changed code
>> touches the variable. This is somewhat odd.
> grep is your friend:
> framebuffer.mode_info.width = active_mode_info.x_resolution;
> and follows. Since now vbe.c can't manipulate directly the target.
> Again, you're the one who requested encapsulation.
Sorry, I just confused the
grub_video_mode_info mode_info
with the
grub_vbe_mode_info_block mode_info
Perhaps a more distinctive name for the latter would be helpful, though.
>>
>> In create_render_target_from_pointer the is_allocated is set to 0 twice.
> Fixed
>>
> I'm running the series of tests now and when I'm finished I'll commit
> it. After that you're welcome to submit patches for the problems you
> spot (you already talked about few)
This is a patch against the current (as far as git knows) framebuf branch:
* move video_fb_fender_target structure declaration to fbutil.h
* remove duplicate assignment in create_render_target_from_pointer
+ quiet warning
* rename local variable in grub_video_vbe_setup
* remove grub_video_fb_get_video_ptr from video_fb.c (dup in fbutil.c)
Take which you want
Thanks
Michal
diff --git a/include/grub/fbfill.h b/include/grub/fbfill.h
index 08cd7b8..11e22c6 100644
--- a/include/grub/fbfill.h
+++ b/include/grub/fbfill.h
@@ -24,29 +24,6 @@
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,
diff --git a/include/grub/fbutil.h b/include/grub/fbutil.h
index 76e1e57..fc1e885 100644
--- a/include/grub/fbutil.h
+++ b/include/grub/fbutil.h
@@ -25,13 +25,36 @@
#include <grub/types.h>
#include <grub/video.h>
+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;
+};
+
struct grub_video_fbblit_info
{
struct grub_video_mode_info *mode_info;
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,
diff --git a/include/grub/video_fb.h b/include/grub/video_fb.h
index 03ef385..17debd6 100644
--- a/include/grub/video_fb.h
+++ b/include/grub/video_fb.h
@@ -33,9 +33,6 @@ 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);
diff --git a/video/fb/fbblit.c b/video/fb/fbblit.c
index 138eba8..5b613bc 100644
--- a/video/fb/fbblit.c
+++ b/video/fb/fbblit.c
@@ -83,8 +83,8 @@ grub_video_fbblit_replace_directN (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_replace_BGRX8888_RGBX8888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_replace_BGRX8888_RGB888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_replace_BGR888_RGBX8888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_replace_BGR888_RGB888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_replace_RGBX8888_RGB888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_replace_RGB888_RGBX8888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_replace_index_RGB888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_blend_BGRA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_blend_BGR888_RGBA8888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_blend_RGBA8888_RGBA8888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_blend_RGB888_RGBA8888 (struct grub_video_fbblit_info *dst,
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 @@ grub_video_fbblit_blend_index_RGBA8888 (struct grub_video_fbblit_info *dst,
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++)
{
diff --git a/video/fb/fbutil.c b/video/fb/fbutil.c
index 09cbb12..1fa48ec 100644
--- a/video/fb/fbutil.c
+++ b/video/fb/fbutil.c
@@ -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 @@ get_pixel (struct grub_video_fbblit_info *source,
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 @@ set_pixel (struct grub_video_fbblit_info *source,
{
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 @@ set_pixel (struct grub_video_fbblit_info *source,
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 @@ set_pixel (struct grub_video_fbblit_info *source,
{
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 @@ set_pixel (struct grub_video_fbblit_info *source,
{
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);
}
diff --git a/video/fb/video_fb.c b/video/fb/video_fb.c
index a9cd76b..902e683 100644
--- a/video/fb/video_fb.c
+++ b/video/fb/video_fb.c
@@ -83,44 +83,6 @@ grub_video_fb_get_info (struct grub_video_mode_info *mode_info)
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)
@@ -1105,12 +1067,9 @@ grub_video_fb_create_render_target_from_pointer (struct grub_video_fbrender_targ
target->viewport.width = mode_info->width;
target->viewport.height = mode_info->height;
- /* Mark framebuffer memory as non allocated. */
- target->is_allocated = 0;
-
/* Clear render target with black and maximum transparency. */
for (y = 0; y < mode_info->height; y++)
- grub_memset (target->data + mode_info->pitch * y, 0,
+ grub_memset ((char *) target->data + mode_info->pitch * y, 0,
mode_info->bytes_per_pixel * mode_info->width);
/* Save result to caller. */
diff --git a/video/i386/pc/vbe.c b/video/i386/pc/vbe.c
index b3fe4d6..27ea08e 100644
--- a/video/i386/pc/vbe.c
+++ b/video/i386/pc/vbe.c
@@ -364,7 +364,7 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
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;
@@ -378,7 +378,7 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
{
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. */
@@ -386,33 +386,33 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
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;
@@ -420,28 +420,28 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
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. */
@@ -482,18 +482,18 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info);
- /* Copy default palette to initialize emulated palette. */
- err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
- grub_video_fbstd_colors);
+ err = grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr);
+
if (err)
return err;
- err = grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target, &framebuffer.mode_info, framebuffer.ptr);
-
+ err = grub_video_fb_set_active_render_target (framebuffer.render_target);
if (err)
return err;
- return grub_video_fb_set_active_render_target (framebuffer.render_target);
+ /* Copy default palette to initialize emulated palette. */
+ return grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
+ grub_video_fbstd_colors);
}
/* Couldn't found matching mode. */
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel