[PATCH] mips gfxterm kludge

2009-12-13 Thread Robert Millan

Possible approach to solving mips / gfxterm kludge.

Comments?

-- 
Robert Millan
=== modified file 'term/gfxterm.c'
--- term/gfxterm.c	2009-10-24 19:01:27 +
+++ term/gfxterm.c	2009-12-13 20:37:57 +
@@ -27,7 +27,7 @@
 #include grub/bitmap.h
 #include grub/command.h
 
-#define DEFAULT_VIDEO_MODE 1024x600
+#define DEFAULT_VIDEO_MODE	640x480,800x600,1024x768,0x0
 #define DEFAULT_BORDER_WIDTH	10
 
 #define DEFAULT_STANDARD_COLOR  0x07

=== modified file 'video/sm712.c'
--- video/sm712.c	2009-12-02 10:48:10 +
+++ video/sm712.c	2009-12-13 20:33:44 +
@@ -55,7 +55,7 @@ grub_video_sm712_video_fini (void)
 {
   if (framebuffer.mapped)
 grub_pci_device_unmap_range (framebuffer.dev, framebuffer.ptr,
- 1024 * 600 * 2);
+ framebuffer.mode_info.width * framebuffer.mode_info.height * (framebuffer.mode_info.depth / 8));
 
   return grub_video_fb_fini ();
 }
@@ -68,7 +68,7 @@ grub_video_sm712_setup (unsigned int wid
   grub_err_t err;
   int found = 0;
 
-  int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)))
+  int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid)
 {
   grub_pci_address_t addr;
   grub_uint32_t class;
@@ -92,8 +92,16 @@ grub_video_sm712_setup (unsigned int wid
   depth = (mode_type  GRUB_VIDEO_MODE_TYPE_DEPTH_MASK)
GRUB_VIDEO_MODE_TYPE_DEPTH_POS;
 
-  if ((width != 1024  width != 0) || (height != 600  height != 0)
-  || (depth != 16  depth != 0))
+  if (width == 0)
+width = 1024;
+
+  if (height == 0)
+height = 600;
+
+  if (depth == 0)
+depth = 16;
+
+  if (width != 1024 || height != 600 || depth != 16)
 return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
 		   Only 1024x600x16 is supported);
 
@@ -107,10 +115,10 @@ grub_video_sm712_setup (unsigned int wid
 }
 
   /* Fill mode info details.  */
-  framebuffer.mode_info.width = 1024;
-  framebuffer.mode_info.height = 600;
+  framebuffer.mode_info.width = width;
+  framebuffer.mode_info.height = height;
   framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_RGB;
-  framebuffer.mode_info.bpp = 16;
+  framebuffer.mode_info.bpp = depth;
   framebuffer.mode_info.bytes_per_pixel = 2;
   framebuffer.mode_info.pitch = 1024 * 2;
   framebuffer.mode_info.number_of_colors = 256;
@@ -126,7 +134,7 @@ grub_video_sm712_setup (unsigned int wid
   /* We can safely discard volatile attribute.  */
   framebuffer.ptr = (void *) grub_pci_device_map_range (framebuffer.dev,
 			framebuffer.base,
-			1024 * 600 * 2);
+			width * height * (depth / 8));
   framebuffer.mapped = 1;
 
   err = grub_video_fb_create_render_target_from_pointer (framebuffer.render_target, framebuffer.mode_info, framebuffer.ptr);

___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] mips gfxterm kludge

2009-12-13 Thread Vladimir 'φ-coder/phcoder' Serbinenko
Robert Millan wrote:
 Possible approach to solving mips / gfxterm kludge.

 Comments?

   
It's already done cleanly when using some changes from gfxmenu branch
(look at how it was solved in experimental)

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko




signature.asc
Description: OpenPGP digital signature
___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel


Re: [PATCH] mips gfxterm kludge

2009-12-13 Thread Robert Millan
On Sun, Dec 13, 2009 at 11:05:50PM +0100, Vladimir 'φ-coder/phcoder' Serbinenko 
wrote:
 Robert Millan wrote:
  Possible approach to solving mips / gfxterm kludge.
 
  Comments?
 

 It's already done cleanly when using some changes from gfxmenu branch
 (look at how it was solved in experimental)

Oh, ok.

-- 
Robert Millan


___
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel