aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/syscons/scvidctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/syscons/scvidctl.c')
-rw-r--r--sys/dev/syscons/scvidctl.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/sys/dev/syscons/scvidctl.c b/sys/dev/syscons/scvidctl.c
index 8fbb3c78c755..614cecbfe2fb 100644
--- a/sys/dev/syscons/scvidctl.c
+++ b/sys/dev/syscons/scvidctl.c
@@ -2,6 +2,9 @@
* Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
* All rights reserved.
*
+ * This code is derived from software contributed to The DragonFly Project
+ * by Sascha Wildner <saw@online.de>
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -367,16 +370,29 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize,
if ((info.vi_width < xsize*8) || (info.vi_height < ysize*fontsize))
return EINVAL;
- /* only 16 color, 4 plane modes are supported XXX */
- if ((info.vi_depth != 4) || (info.vi_planes != 4))
- return ENODEV;
-
/*
- * set_pixel_mode() currently does not support video modes whose
- * memory size is larger than 64K. Because such modes require
- * bank switching to access the entire screen. XXX
+ * We currently support the following graphic modes:
+ *
+ * - 4 bpp planar modes whose memory size does not exceed 64K
+ * - 15, 16, 24 and 32 bpp linear modes
*/
- if (info.vi_width*info.vi_height/8 > info.vi_window_size)
+
+ if (info.vi_mem_model == V_INFO_MM_PLANAR) {
+ if (info.vi_planes != 4)
+ return ENODEV;
+
+ /*
+ * A memory size >64K requires bank switching to access the entire
+ * screen. XXX
+ */
+
+ if (info.vi_width * info.vi_height / 8 > info.vi_window_size)
+ return ENODEV;
+ } else if (info.vi_mem_model == V_INFO_MM_DIRECT) {
+ if ((info.vi_depth != 15) && (info.vi_depth != 16) &&
+ (info.vi_depth != 24) && (info.vi_depth != 32))
+ return ENODEV;
+ } else
return ENODEV;
/* stop screen saver, etc */