vesacon: make it possible to request nonstandard resolutions
authorH. Peter Anvin <hpa@zytor.com>
Tue, 8 Dec 2009 00:17:10 +0000 (16:17 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 8 Dec 2009 00:17:10 +0000 (16:17 -0800)
Make it possible to request nonstandard resolutions when enabling
vesacon.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/include/syslinux/vesacon.h
com32/lib/sys/vesacon_write.c

index dad9fb5..11d72f3 100644 (file)
@@ -29,6 +29,7 @@
 #define _SYSLINUX_VESACON_H
 
 int vesacon_default_background(void);
+void vesacon_set_resolution(int, int);
 int vesacon_load_background(const char *);
 int vesacon_set_background(unsigned int);
 
index 49448c6..e85aba8 100644 (file)
@@ -70,6 +70,20 @@ static struct term_info ti = {
    reinitialization. */
 static int vesacon_counter = 0;
 
+static struct {
+    int x, y;
+} vesacon_resolution = {
+    .x = DEFAULT_VESA_X_SIZE,
+    .y = DEFAULT_VESA_Y_SIZE,
+};
+
+/* Set desired resolution - requires a full close/open cycle */
+void vesacon_set_resolution(int x, int y)
+{
+    vesacon_resolution.x = x;
+    vesacon_resolution.y = y;
+}
+
 /* Common setup */
 int __vesacon_open(struct file_info *fp)
 {
@@ -83,7 +97,7 @@ int __vesacon_open(struct file_info *fp)
            ti.cols = 80;
        } else {
            /* Switch mode */
-           if (__vesacon_init(DEFAULT_VESA_X_SIZE, DEFAULT_VESA_Y_SIZE)) {
+           if (__vesacon_init(vesacon_resolution.x, vesacon_resolution.y)) {
                vesacon_counter = -1;
                return EAGAIN;
            }