* [PATCH] move DAC register setting to linux.c
@ 2009-09-10 21:03 Robert Millan
2009-09-12 13:07 ` Robert Millan
0 siblings, 1 reply; 2+ messages in thread
From: Robert Millan @ 2009-09-10 21:03 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 679 bytes --]
It didn't really seem right that we were *setting* values in the DAC palette
register in a function that was only meant to retrieve video mode information.
So I would rather move this to the Linux loader. In the event that other
loaders would need this facility, it can be moved into a shared function.
This has the advantage that we don't mess with the DAC palette in cases where
this is not necessary (read: the vast majority of them).
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
[-- Attachment #2: dac.diff --]
[-- Type: text/x-diff, Size: 2688 bytes --]
2009-09-10 Robert Millan <rmh.grub@aybabtu.com>
* video/i386/pc/vbe.c (grub_vbe_get_video_mode_info): Move packed
mode special handling (grub_vbe_bios_set_dac_palette_width() call)
from here ...
* loader/i386/linux.c [GRUB_MACHINE_PCBIOS]
(grub_linux_setup_video): ... to here (with some adjustments).
Index: video/i386/pc/vbe.c
===================================================================
--- video/i386/pc/vbe.c (revision 2583)
+++ video/i386/pc/vbe.c (working copy)
@@ -286,24 +286,6 @@ grub_vbe_get_video_mode_info (grub_uint3
/* Make copy of mode info block. */
grub_memcpy (mode_info, mi_tmp, sizeof (*mode_info));
-
- /* Packed mode. Query DAC Palette width for color sizes. */
- if (mode_info->bits_per_pixel <= 8)
- {
- int width = 8;
- status = 0;
-
- if (controller_info.capabilities & GRUB_VBE_CAPABILITY_DACWIDTH)
- status = grub_vbe_bios_set_dac_palette_width (& width);
-
- if (status != GRUB_VBE_STATUS_OK)
- /* 6 is default after mode reset. */
- width = 6;
-
- mode_info->red_mask_size = mode_info->green_mask_size
- = mode_info->blue_mask_size = width;
- mode_info->rsvd_mask_size = 0;
- }
}
else
/* Just clear mode info block if it isn't a VESA mode. */
Index: loader/i386/linux.c
===================================================================
--- loader/i386/linux.c (revision 2583)
+++ loader/i386/linux.c (working copy)
@@ -33,6 +33,7 @@
#include <grub/video.h>
#include <grub/video_fb.h>
#include <grub/command.h>
+#include <grub/i386/pc/vbe.h>
#define GRUB_LINUX_CL_OFFSET 0x1000
#define GRUB_LINUX_CL_END_OFFSET 0x2000
@@ -416,6 +417,33 @@ grub_linux_setup_video (struct linux_ker
params->reserved_mask_size = mode_info.reserved_mask_size;
params->reserved_field_pos = mode_info.reserved_field_pos;
+
+#ifdef GRUB_MACHINE_PCBIOS
+ /* VESA packed modes may come with zeroed mask sizes, which need
+ to be set here according to DAC Palette width. If we don't,
+ this results in Linux displaying a black screen. */
+ if (mode_info.bpp <= 8)
+ {
+ struct grub_vbe_info_block controller_info;
+ int status;
+ int width = 8;
+
+ status = grub_vbe_bios_get_controller_info (&controller_info);
+
+ if (status == GRUB_VBE_STATUS_OK &&
+ (controller_info.capabilities & GRUB_VBE_CAPABILITY_DACWIDTH))
+ status = grub_vbe_bios_set_dac_palette_width (&width);
+
+ if (status != GRUB_VBE_STATUS_OK)
+ /* 6 is default after mode reset. */
+ width = 6;
+
+ params->red_mask_size = params->green_mask_size
+ = params->blue_mask_size = width;
+ params->reserved_mask_size = 0;
+ }
+#endif
+
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] move DAC register setting to linux.c
2009-09-10 21:03 [PATCH] move DAC register setting to linux.c Robert Millan
@ 2009-09-12 13:07 ` Robert Millan
0 siblings, 0 replies; 2+ messages in thread
From: Robert Millan @ 2009-09-12 13:07 UTC (permalink / raw)
To: grub-devel
Committed.
On Thu, Sep 10, 2009 at 11:03:16PM +0200, Robert Millan wrote:
>
> It didn't really seem right that we were *setting* values in the DAC palette
> register in a function that was only meant to retrieve video mode information.
>
> So I would rather move this to the Linux loader. In the event that other
> loaders would need this facility, it can be moved into a shared function.
>
> This has the advantage that we don't mess with the DAC palette in cases where
> this is not necessary (read: the vast majority of them).
>
> --
> Robert Millan
>
> The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
> how) you may access your data; but nobody's threatening your freedom: we
> still allow you to remove your data and not access it at all."
> 2009-09-10 Robert Millan <rmh.grub@aybabtu.com>
>
> * video/i386/pc/vbe.c (grub_vbe_get_video_mode_info): Move packed
> mode special handling (grub_vbe_bios_set_dac_palette_width() call)
> from here ...
> * loader/i386/linux.c [GRUB_MACHINE_PCBIOS]
> (grub_linux_setup_video): ... to here (with some adjustments).
>
> Index: video/i386/pc/vbe.c
> ===================================================================
> --- video/i386/pc/vbe.c (revision 2583)
> +++ video/i386/pc/vbe.c (working copy)
> @@ -286,24 +286,6 @@ grub_vbe_get_video_mode_info (grub_uint3
>
> /* Make copy of mode info block. */
> grub_memcpy (mode_info, mi_tmp, sizeof (*mode_info));
> -
> - /* Packed mode. Query DAC Palette width for color sizes. */
> - if (mode_info->bits_per_pixel <= 8)
> - {
> - int width = 8;
> - status = 0;
> -
> - if (controller_info.capabilities & GRUB_VBE_CAPABILITY_DACWIDTH)
> - status = grub_vbe_bios_set_dac_palette_width (& width);
> -
> - if (status != GRUB_VBE_STATUS_OK)
> - /* 6 is default after mode reset. */
> - width = 6;
> -
> - mode_info->red_mask_size = mode_info->green_mask_size
> - = mode_info->blue_mask_size = width;
> - mode_info->rsvd_mask_size = 0;
> - }
> }
> else
> /* Just clear mode info block if it isn't a VESA mode. */
> Index: loader/i386/linux.c
> ===================================================================
> --- loader/i386/linux.c (revision 2583)
> +++ loader/i386/linux.c (working copy)
> @@ -33,6 +33,7 @@
> #include <grub/video.h>
> #include <grub/video_fb.h>
> #include <grub/command.h>
> +#include <grub/i386/pc/vbe.h>
>
> #define GRUB_LINUX_CL_OFFSET 0x1000
> #define GRUB_LINUX_CL_END_OFFSET 0x2000
> @@ -416,6 +417,33 @@ grub_linux_setup_video (struct linux_ker
> params->reserved_mask_size = mode_info.reserved_mask_size;
> params->reserved_field_pos = mode_info.reserved_field_pos;
>
> +
> +#ifdef GRUB_MACHINE_PCBIOS
> + /* VESA packed modes may come with zeroed mask sizes, which need
> + to be set here according to DAC Palette width. If we don't,
> + this results in Linux displaying a black screen. */
> + if (mode_info.bpp <= 8)
> + {
> + struct grub_vbe_info_block controller_info;
> + int status;
> + int width = 8;
> +
> + status = grub_vbe_bios_get_controller_info (&controller_info);
> +
> + if (status == GRUB_VBE_STATUS_OK &&
> + (controller_info.capabilities & GRUB_VBE_CAPABILITY_DACWIDTH))
> + status = grub_vbe_bios_set_dac_palette_width (&width);
> +
> + if (status != GRUB_VBE_STATUS_OK)
> + /* 6 is default after mode reset. */
> + width = 6;
> +
> + params->red_mask_size = params->green_mask_size
> + = params->blue_mask_size = width;
> + params->reserved_mask_size = 0;
> + }
> +#endif
> +
> return 0;
> }
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
--
Robert Millan
The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
how) you may access your data; but nobody's threatening your freedom: we
still allow you to remove your data and not access it at all."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-09-12 13:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-10 21:03 [PATCH] move DAC register setting to linux.c Robert Millan
2009-09-12 13:07 ` Robert Millan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.