]> xenbits.xensource.com Git - seabios.git/commitdiff
vgabios: Load the DAC palette in "packed" modes on Cirrus and BochsVGA.
authorKevin O'Connor <kevin@koconnor.net>
Fri, 29 Nov 2013 23:43:35 +0000 (18:43 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 4 Dec 2013 15:34:17 +0000 (10:34 -0500)
This is a port of a patch applied to the "lgpl vgabios" tree (that was
released in its v0.7a release).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
vgasrc/bochsvga.c
vgasrc/clext.c
vgasrc/stdvga.h
vgasrc/stdvgamodes.c

index 9425a8280deb3f5dab309aa7015e7fe92eaf48e2..27f7615ee7ae711ccbe03f307e0acae4fd088ce7 100644 (file)
@@ -318,14 +318,13 @@ bochsvga_set_mode(struct vgamode_s *vmode_g, int flags)
     if (!GET_GLOBAL(dispi_found))
         return -1;
 
-    u8 depth = GET_GLOBAL(vmode_g->depth);
-    if (depth == 4)
+    u8 memmodel = GET_GLOBAL(vmode_g->memmodel);
+    if (memmodel == MM_PLANAR)
         stdvga_set_mode(stdvga_find_mode(0x6a), 0);
-    if (depth == 8)
-        // XXX load_dac_palette(3);
-        ;
+    if (memmodel == MM_PACKED && !(flags & MF_NOPALETTE))
+        stdvga_set_packed_palette();
 
-    dispi_write(VBE_DISPI_INDEX_BPP, depth);
+    dispi_write(VBE_DISPI_INDEX_BPP, GET_GLOBAL(vmode_g->depth));
     u16 width = GET_GLOBAL(vmode_g->width);
     u16 height = GET_GLOBAL(vmode_g->height);
     dispi_write(VBE_DISPI_INDEX_XRES, width);
@@ -353,7 +352,7 @@ bochsvga_set_mode(struct vgamode_s *vmode_g, int flags)
     stdvga_attr_mask(0x10, 0x00, 0x01);
     stdvga_grdc_write(0x06, 0x05);
     stdvga_sequ_write(0x02, 0x0f);
-    if (depth >= 8) {
+    if (memmodel != MM_PLANAR) {
         stdvga_crtc_mask(crtc_addr, 0x14, 0x00, 0x40);
         stdvga_attr_mask(0x10, 0x00, 0x40);
         stdvga_sequ_mask(0x04, 0x00, 0x08);
index 93085cf1eaa1472fa642cfaffa52b580e254875f..f7751a2f17df92e885d653700153823713684316 100644 (file)
@@ -466,6 +466,8 @@ clext_set_mode(struct vgamode_s *vmode_g, int flags)
     struct cirrus_mode_s *table_g = container_of(
         vmode_g, struct cirrus_mode_s, info);
     cirrus_switch_mode(table_g);
+    if (GET_GLOBAL(vmode_g->memmodel) == MM_PACKED && !(flags & MF_NOPALETTE))
+        stdvga_set_packed_palette();
     if (!(flags & MF_LINEARFB))
         cirrus_enable_16k_granularity();
     if (!(flags & MF_NOCLEARMEM))
index bb8b8d8606ae49c15a2bb164f1cd9295116bdfe6..3685abab7ae9b0601530447ce95f365001c7dcc8 100644 (file)
@@ -50,6 +50,7 @@ void stdvga_list_modes(u16 seg, u16 *dest, u16 *last);
 void stdvga_build_video_param(void);
 void stdvga_override_crtc(int mode, u8 *crtc);
 int stdvga_set_mode(struct vgamode_s *vmode_g, int flags);
+void stdvga_set_packed_palette(void);
 
 // stdvgaio.c
 u8 stdvga_pelmask_read(void);
index dda35db15b6da16b86712829a72c425783a82e1e..a97c85fe710dccead15c6e0537f09e1ce5c4eb00 100644 (file)
@@ -505,3 +505,10 @@ stdvga_set_mode(struct vgamode_s *vmode_g, int flags)
 
     return 0;
 }
+
+// Load the standard palette associated with 8bpp packed pixel vga modes.
+void
+stdvga_set_packed_palette(void)
+{
+    stdvga_dac_write(get_global_seg(), palette3, 0, sizeof(palette3) / 3);
+}