scvidctl.c (def802441f777c1283984bef358b7d8339004388) | scvidctl.c (2ad872c5794e4c26fdf6ed219ad3f09ca0d5304a) |
---|---|
1/*- 2 * Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $Id: scvidctl.c,v 1.4 1998/09/29 02:00:56 ache Exp $ | 26 * $Id: $ |
27 */ 28 29#include "sc.h" 30#include "opt_syscons.h" 31 32#if NSC > 0 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/signalvar.h> 37#include <sys/tty.h> 38#include <sys/kernel.h> 39 40#include <machine/apm_bios.h> 41#include <machine/console.h> 42 | 27 */ 28 29#include "sc.h" 30#include "opt_syscons.h" 31 32#if NSC > 0 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/signalvar.h> 37#include <sys/tty.h> 38#include <sys/kernel.h> 39 40#include <machine/apm_bios.h> 41#include <machine/console.h> 42 |
43#include <i386/isa/videoio.h> 44#include <i386/isa/syscons.h> | 43#include <dev/fb/fbreg.h> 44#include <dev/syscons/syscons.h> |
45 | 45 |
46/* video ioctl */ | 46/* for compatibility with previous versions */ 47typedef struct old_video_adapter { 48 int va_index; 49 int va_type; 50 int va_flags; 51#define V_ADP_COLOR (1<<0) 52#define V_ADP_MODECHANGE (1<<1) 53#define V_ADP_STATESAVE (1<<2) 54#define V_ADP_STATELOAD (1<<3) 55#define V_ADP_FONT (1<<4) 56#define V_ADP_PALETTE (1<<5) 57#define V_ADP_BORDER (1<<6) 58#define V_ADP_VESA (1<<7) 59 int va_crtc_addr; 60 u_int va_window; /* virtual address */ 61 size_t va_window_size; 62 size_t va_window_gran; 63 u_int va_buffer; /* virtual address */ 64 size_t va_buffer_size; 65 int va_initial_mode; 66 int va_initial_bios_mode; 67 int va_mode; 68} old_video_adapter_t; |
47 | 69 |
70#define OLD_CONS_ADPINFO _IOWR('c', 101, old_video_adapter_t) 71 72/* variables */ |
|
48extern scr_stat *cur_console; 49extern int fonts_loaded; 50extern int sc_history_size; 51extern u_char palette[]; 52 53int 54sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize, 55 int fontsize) 56{ | 73extern scr_stat *cur_console; 74extern int fonts_loaded; 75extern int sc_history_size; 76extern u_char palette[]; 77 78int 79sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize, 80 int fontsize) 81{ |
57 video_adapter_t *adp; | |
58 video_info_t info; 59 int error; 60 int s; 61 int i; 62 | 82 video_info_t info; 83 int error; 84 int s; 85 int i; 86 |
63 if ((*biosvidsw.get_info)(scp->adp, mode, &info)) | 87 if ((*vidsw[scp->ad]->get_info)(scp->adp, mode, &info)) |
64 return ENODEV; | 88 return ENODEV; |
65 adp = get_adapter(scp); | |
66 67 /* adjust argument values */ 68 if (fontsize <= 0) 69 fontsize = info.vi_cheight; 70 if (fontsize < 14) { 71 fontsize = 8; 72 if (!(fonts_loaded & FONT_8)) 73 return EINVAL; --- 29 unchanged lines hidden (view full) --- 103 * muck around with scp. XXX 104 */ 105 scp->status |= UNKNOWN_MODE; 106 scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE); 107 scp->mode = mode; 108 scp->font_size = fontsize; 109 scp->xsize = xsize; 110 scp->ysize = ysize; | 89 90 /* adjust argument values */ 91 if (fontsize <= 0) 92 fontsize = info.vi_cheight; 93 if (fontsize < 14) { 94 fontsize = 8; 95 if (!(fonts_loaded & FONT_8)) 96 return EINVAL; --- 29 unchanged lines hidden (view full) --- 126 * muck around with scp. XXX 127 */ 128 scp->status |= UNKNOWN_MODE; 129 scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE); 130 scp->mode = mode; 131 scp->font_size = fontsize; 132 scp->xsize = xsize; 133 scp->ysize = ysize; |
134 scp->xoff = 0; 135 scp->yoff = 0; |
|
111 scp->xpixel = scp->xsize*8; 112 scp->ypixel = scp->ysize*fontsize; 113 114 /* allocate buffers */ 115 sc_alloc_scr_buffer(scp, TRUE, TRUE); | 136 scp->xpixel = scp->xsize*8; 137 scp->ypixel = scp->ysize*fontsize; 138 139 /* allocate buffers */ 140 sc_alloc_scr_buffer(scp, TRUE, TRUE); |
116 if (ISMOUSEAVAIL(adp->va_flags)) | 141 if (ISMOUSEAVAIL(scp->adp->va_flags)) |
117 sc_alloc_cut_buffer(scp, FALSE); 118 sc_alloc_history_buffer(scp, sc_history_size, i, FALSE); 119 splx(s); 120 121 if (scp == cur_console) 122 set_mode(scp); 123 scp->status &= ~UNKNOWN_MODE; 124 --- 7 unchanged lines hidden (view full) --- 132 } 133 134 return 0; 135} 136 137int 138sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode) 139{ | 142 sc_alloc_cut_buffer(scp, FALSE); 143 sc_alloc_history_buffer(scp, sc_history_size, i, FALSE); 144 splx(s); 145 146 if (scp == cur_console) 147 set_mode(scp); 148 scp->status &= ~UNKNOWN_MODE; 149 --- 7 unchanged lines hidden (view full) --- 157 } 158 159 return 0; 160} 161 162int 163sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode) 164{ |
140 video_adapter_t *adp; | |
141 video_info_t info; 142 int error; 143 int s; 144 | 165 video_info_t info; 166 int error; 167 int s; 168 |
145 if ((*biosvidsw.get_info)(scp->adp, mode, &info)) | 169 if ((*vidsw[scp->ad]->get_info)(scp->adp, mode, &info)) |
146 return ENODEV; | 170 return ENODEV; |
147 adp = get_adapter(scp); | |
148 149 /* stop screen saver, etc */ 150 s = spltty(); 151 if ((error = sc_clean_up(scp))) { 152 splx(s); 153 return error; 154 } 155 156 /* set up scp */ 157 scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE); 158 scp->status &= ~PIXEL_MODE; 159 scp->mode = mode; | 171 172 /* stop screen saver, etc */ 173 s = spltty(); 174 if ((error = sc_clean_up(scp))) { 175 splx(s); 176 return error; 177 } 178 179 /* set up scp */ 180 scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE); 181 scp->status &= ~PIXEL_MODE; 182 scp->mode = mode; |
183 scp->xoff = 0; 184 scp->yoff = 0; |
|
160 scp->xpixel = info.vi_width; 161 scp->ypixel = info.vi_height; 162 scp->xsize = info.vi_width/8; 163 scp->ysize = info.vi_height/info.vi_cheight; 164 scp->font_size = FONT_NONE; 165 /* move the mouse cursor at the center of the screen */ 166 sc_move_mouse(scp, scp->xpixel / 2, scp->ypixel / 2); 167 splx(s); --- 14 unchanged lines hidden (view full) --- 182 183 return 0; 184} 185 186int 187sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, 188 int fontsize) 189{ | 185 scp->xpixel = info.vi_width; 186 scp->ypixel = info.vi_height; 187 scp->xsize = info.vi_width/8; 188 scp->ysize = info.vi_height/info.vi_cheight; 189 scp->font_size = FONT_NONE; 190 /* move the mouse cursor at the center of the screen */ 191 sc_move_mouse(scp, scp->xpixel / 2, scp->ypixel / 2); 192 splx(s); --- 14 unchanged lines hidden (view full) --- 207 208 return 0; 209} 210 211int 212sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize, 213 int fontsize) 214{ |
190 video_adapter_t *adp; | |
191 video_info_t info; 192 int error; 193 int s; 194 int i; 195 | 215 video_info_t info; 216 int error; 217 int s; 218 int i; 219 |
196 if ((*biosvidsw.get_info)(scp->adp, scp->mode, &info)) | 220 if ((*vidsw[scp->ad]->get_info)(scp->adp, scp->mode, &info)) |
197 return ENODEV; /* this shouldn't happen */ | 221 return ENODEV; /* this shouldn't happen */ |
198 adp = get_adapter(scp); | |
199 200#ifdef SC_VIDEO_DEBUG 201 if (scp->scr_buf != NULL) { 202 printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n", 203 scp->mode, xsize, ysize, fontsize); 204 } 205#endif 206 --- 18 unchanged lines hidden (view full) --- 225 if (ysize <= 0) 226 ysize = info.vi_height/fontsize; 227 228#ifdef SC_VIDEO_DEBUG 229 if (scp->scr_buf != NULL) { 230 printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n", 231 scp->mode, xsize, ysize, fontsize); 232 printf("set_pixel_mode(): window:%x, %dx%d, xoff:%d, yoff:%d\n", | 222 223#ifdef SC_VIDEO_DEBUG 224 if (scp->scr_buf != NULL) { 225 printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n", 226 scp->mode, xsize, ysize, fontsize); 227 } 228#endif 229 --- 18 unchanged lines hidden (view full) --- 248 if (ysize <= 0) 249 ysize = info.vi_height/fontsize; 250 251#ifdef SC_VIDEO_DEBUG 252 if (scp->scr_buf != NULL) { 253 printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n", 254 scp->mode, xsize, ysize, fontsize); 255 printf("set_pixel_mode(): window:%x, %dx%d, xoff:%d, yoff:%d\n", |
233 adp->va_window, info.vi_width, info.vi_height, | 256 scp->adp->va_window, info.vi_width, info.vi_height, |
234 (info.vi_width/8 - xsize)/2, 235 (info.vi_height/fontsize - ysize)/2); 236 } 237#endif 238 239 if ((info.vi_width < xsize*8) || (info.vi_height < ysize*fontsize)) 240 return EINVAL; 241 --- 27 unchanged lines hidden (view full) --- 269 scp->xsize = xsize; 270 scp->ysize = ysize; 271 scp->font_size = fontsize; 272 scp->xoff = (scp->xpixel/8 - xsize)/2; 273 scp->yoff = (scp->ypixel/fontsize - ysize)/2; 274 275 /* allocate buffers */ 276 sc_alloc_scr_buffer(scp, TRUE, TRUE); | 257 (info.vi_width/8 - xsize)/2, 258 (info.vi_height/fontsize - ysize)/2); 259 } 260#endif 261 262 if ((info.vi_width < xsize*8) || (info.vi_height < ysize*fontsize)) 263 return EINVAL; 264 --- 27 unchanged lines hidden (view full) --- 292 scp->xsize = xsize; 293 scp->ysize = ysize; 294 scp->font_size = fontsize; 295 scp->xoff = (scp->xpixel/8 - xsize)/2; 296 scp->yoff = (scp->ypixel/fontsize - ysize)/2; 297 298 /* allocate buffers */ 299 sc_alloc_scr_buffer(scp, TRUE, TRUE); |
277 if (ISMOUSEAVAIL(adp->va_flags)) | 300 if (ISMOUSEAVAIL(scp->adp->va_flags)) |
278 sc_alloc_cut_buffer(scp, FALSE); 279 sc_alloc_history_buffer(scp, sc_history_size, i, FALSE); 280 splx(s); 281 282 if (scp == cur_console) 283 set_border(scp, scp->border); 284 285 scp->status &= ~UNKNOWN_MODE; --- 13 unchanged lines hidden (view full) --- 299 300 return 0; 301} 302 303int 304sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) 305{ 306 scr_stat *scp; | 301 sc_alloc_cut_buffer(scp, FALSE); 302 sc_alloc_history_buffer(scp, sc_history_size, i, FALSE); 303 splx(s); 304 305 if (scp == cur_console) 306 set_border(scp, scp->border); 307 308 scp->status &= ~UNKNOWN_MODE; --- 13 unchanged lines hidden (view full) --- 322 323 return 0; 324} 325 326int 327sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p) 328{ 329 scr_stat *scp; |
307 video_adapter_t *adp; | |
308 int error; 309 int s; 310 311 scp = sc_get_scr_stat(tp->t_dev); 312 313 switch (cmd) { 314 315 case CONS_CURRENT: /* get current adapter type */ | 330 int error; 331 int s; 332 333 scp = sc_get_scr_stat(tp->t_dev); 334 335 switch (cmd) { 336 337 case CONS_CURRENT: /* get current adapter type */ |
316 adp = get_adapter(scp); 317 *(int *)data = adp->va_type; | 338 if (scp->adp == NULL) 339 return ENODEV; 340 *(int *)data = scp->adp->va_type; |
318 return 0; 319 320 case CONS_CURRENTADP: /* get current adapter index */ | 341 return 0; 342 343 case CONS_CURRENTADP: /* get current adapter index */ |
321 *(int *)data = scp->adp; | 344 *(int *)data = scp->ad; |
322 return 0; 323 | 345 return 0; 346 |
347 case OLD_CONS_ADPINFO: /* adapter information */ 348 if (scp->adp == NULL) 349 return ENODEV; 350 ((old_video_adapter_t *)data)->va_index = scp->adp->va_index; 351 ((old_video_adapter_t *)data)->va_type = scp->adp->va_type; 352 ((old_video_adapter_t *)data)->va_flags = scp->adp->va_flags; 353 ((old_video_adapter_t *)data)->va_crtc_addr = scp->adp->va_crtc_addr; 354 ((old_video_adapter_t *)data)->va_window = scp->adp->va_window; 355 ((old_video_adapter_t *)data)->va_window_size 356 = scp->adp->va_window_size; 357 ((old_video_adapter_t *)data)->va_window_gran 358 = scp->adp->va_window_gran; 359 ((old_video_adapter_t *)data)->va_buffer = scp->adp->va_buffer; 360 ((old_video_adapter_t *)data)->va_buffer_size 361 = scp->adp->va_buffer_size; 362 ((old_video_adapter_t *)data)->va_mode = scp->adp->va_mode; 363 ((old_video_adapter_t *)data)->va_initial_mode 364 = scp->adp->va_initial_mode; 365 ((old_video_adapter_t *)data)->va_initial_bios_mode 366 = scp->adp->va_initial_bios_mode; 367 return 0; 368 |
|
324 case CONS_ADPINFO: /* adapter information */ | 369 case CONS_ADPINFO: /* adapter information */ |
325 adp = (*biosvidsw.adapter)(((video_adapter_t *)data)->va_index); 326 if (adp == NULL) | 370 if (scp->adp == NULL) |
327 return ENODEV; | 371 return ENODEV; |
328 bcopy(adp, data, sizeof(*adp)); | 372 ((video_adapter_info_t *)data)->va_index = scp->adp->va_index; 373 ((video_adapter_info_t *)data)->va_type = scp->adp->va_type; 374 bcopy(scp->adp->va_name, ((video_adapter_info_t *)data)->va_name, 375 imin(strlen(scp->adp->va_name) + 1, 376 sizeof(((video_adapter_info_t *)data)->va_name))); 377 ((video_adapter_info_t *)data)->va_unit = scp->adp->va_unit; 378 ((video_adapter_info_t *)data)->va_flags = scp->adp->va_flags; 379 ((video_adapter_info_t *)data)->va_io_base = scp->adp->va_io_base; 380 ((video_adapter_info_t *)data)->va_io_size = scp->adp->va_io_size; 381 ((video_adapter_info_t *)data)->va_crtc_addr = scp->adp->va_crtc_addr; 382 ((video_adapter_info_t *)data)->va_mem_base = scp->adp->va_mem_base; 383 ((video_adapter_info_t *)data)->va_mem_size = scp->adp->va_mem_size; 384 ((video_adapter_info_t *)data)->va_window = scp->adp->va_window; 385 ((video_adapter_info_t *)data)->va_window_size 386 = scp->adp->va_window_size; 387 ((video_adapter_info_t *)data)->va_window_gran 388 = scp->adp->va_window_gran; 389 ((video_adapter_info_t *)data)->va_buffer = scp->adp->va_buffer; 390 ((video_adapter_info_t *)data)->va_buffer_size 391 = scp->adp->va_buffer_size; 392 ((video_adapter_info_t *)data)->va_mode = scp->adp->va_mode; 393 ((video_adapter_info_t *)data)->va_mode_flags = scp->adp->va_mode_flags; 394 ((video_adapter_info_t *)data)->va_initial_mode 395 = scp->adp->va_initial_mode; 396 ((video_adapter_info_t *)data)->va_initial_bios_mode 397 = scp->adp->va_initial_bios_mode; |
329 return 0; 330 331 case CONS_GET: /* get current video mode */ 332 *(int *)data = scp->mode; 333 return 0; 334 335 case CONS_MODEINFO: /* get mode information */ | 398 return 0; 399 400 case CONS_GET: /* get current video mode */ 401 *(int *)data = scp->mode; 402 return 0; 403 404 case CONS_MODEINFO: /* get mode information */ |
336 return ((*biosvidsw.get_info)(scp->adp, | 405 return ((*vidsw[scp->ad]->get_info)(scp->adp, |
337 ((video_info_t *)data)->vi_mode, (video_info_t *)data) 338 ? ENODEV : 0); 339 340 case CONS_FINDMODE: /* find a matching video mode */ | 406 ((video_info_t *)data)->vi_mode, (video_info_t *)data) 407 ? ENODEV : 0); 408 409 case CONS_FINDMODE: /* find a matching video mode */ |
341 return ((*biosvidsw.query_mode)(scp->adp, (video_info_t *)data) | 410 return ((*vidsw[scp->ad]->query_mode)(scp->adp, (video_info_t *)data) |
342 ? ENODEV : 0); 343 344 case CONS_SETWINORG: | 411 ? ENODEV : 0); 412 413 case CONS_SETWINORG: |
345 return ((*biosvidsw.set_win_org)(scp->adp, *(u_int *)data) | 414 return ((*vidsw[scp->ad]->set_win_org)(scp->adp, *(u_int *)data) |
346 ? ENODEV : 0); 347 348 /* generic text modes */ 349 case SW_TEXT_80x25: case SW_TEXT_80x30: 350 case SW_TEXT_80x43: case SW_TEXT_80x50: 351 case SW_TEXT_80x60: 352 /* FALL THROUGH */ 353 --- 4 unchanged lines hidden (view full) --- 358 case SW_VGA_C80x50: case SW_VGA_M80x50: 359 case SW_VGA_C80x60: case SW_VGA_M80x60: 360 case SW_B40x25: case SW_C40x25: 361 case SW_B80x25: case SW_C80x25: 362 case SW_ENH_B40x25: case SW_ENH_C40x25: 363 case SW_ENH_B80x25: case SW_ENH_C80x25: 364 case SW_ENH_B80x43: case SW_ENH_C80x43: 365 case SW_EGAMONO80x25: | 415 ? ENODEV : 0); 416 417 /* generic text modes */ 418 case SW_TEXT_80x25: case SW_TEXT_80x30: 419 case SW_TEXT_80x43: case SW_TEXT_80x50: 420 case SW_TEXT_80x60: 421 /* FALL THROUGH */ 422 --- 4 unchanged lines hidden (view full) --- 427 case SW_VGA_C80x50: case SW_VGA_M80x50: 428 case SW_VGA_C80x60: case SW_VGA_M80x60: 429 case SW_B40x25: case SW_C40x25: 430 case SW_B80x25: case SW_C80x25: 431 case SW_ENH_B40x25: case SW_ENH_C40x25: 432 case SW_ENH_B80x25: case SW_ENH_C80x25: 433 case SW_ENH_B80x43: case SW_ENH_C80x43: 434 case SW_EGAMONO80x25: |
366 adp = get_adapter(scp); 367 if (!(adp->va_flags & V_ADP_MODECHANGE)) | 435 436#ifdef PC98 437 /* PC98 TEXT MODES */ 438 case SW_PC98_80x25: 439 case SW_PC98_80x30: 440#endif 441 if (!(scp->adp->va_flags & V_ADP_MODECHANGE)) |
368 return ENODEV; 369 return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0); 370 371 /* GRAPHICS MODES */ 372 case SW_BG320: case SW_BG640: 373 case SW_CG320: case SW_CG320_D: case SW_CG640_E: 374 case SW_CG640x350: case SW_ENH_CG640: 375 case SW_BG640x480: case SW_CG640x480: case SW_VGA_CG320: 376 case SW_VGA_MODEX: | 442 return ENODEV; 443 return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0); 444 445 /* GRAPHICS MODES */ 446 case SW_BG320: case SW_BG640: 447 case SW_CG320: case SW_CG320_D: case SW_CG640_E: 448 case SW_CG640x350: case SW_ENH_CG640: 449 case SW_BG640x480: case SW_CG640x480: case SW_VGA_CG320: 450 case SW_VGA_MODEX: |
377 adp = get_adapter(scp); 378 if (!(adp->va_flags & V_ADP_MODECHANGE)) | 451 if (!(scp->adp->va_flags & V_ADP_MODECHANGE)) |
379 return ENODEV; 380 return sc_set_graphics_mode(scp, tp, cmd & 0xff); 381 382 case KDSETMODE: /* set current mode of this (virtual) console */ 383 switch (*(int *)data) { 384 case KD_TEXT: /* switch to TEXT (known) mode */ 385 /* 386 * If scp->mode is of graphics modes, we don't know which 387 * text mode to switch back to... 388 */ 389 if (scp->status & GRAPHICS_MODE) 390 return EINVAL; 391 /* restore fonts & palette ! */ 392#if 0 | 452 return ENODEV; 453 return sc_set_graphics_mode(scp, tp, cmd & 0xff); 454 455 case KDSETMODE: /* set current mode of this (virtual) console */ 456 switch (*(int *)data) { 457 case KD_TEXT: /* switch to TEXT (known) mode */ 458 /* 459 * If scp->mode is of graphics modes, we don't know which 460 * text mode to switch back to... 461 */ 462 if (scp->status & GRAPHICS_MODE) 463 return EINVAL; 464 /* restore fonts & palette ! */ 465#if 0 |
393 adp = get_adapter(scp); 394 if (ISFONTAVAIL(adp->va_flags) | 466 if (ISFONTAVAIL(scp->adp->va_flags) |
395 && !(scp->status & (GRAPHICS_MODE | PIXEL_MODE))) 396 /* 397 * FONT KLUDGE 398 * Don't load fonts for now... XXX 399 */ 400 if (fonts_loaded & FONT_8) 401 copy_font(scp, LOAD, 8, font_8); 402 if (fonts_loaded & FONT_14) 403 copy_font(scp, LOAD, 14, font_14); 404 if (fonts_loaded & FONT_16) 405 copy_font(scp, LOAD, 16, font_16); 406 } 407#endif | 467 && !(scp->status & (GRAPHICS_MODE | PIXEL_MODE))) 468 /* 469 * FONT KLUDGE 470 * Don't load fonts for now... XXX 471 */ 472 if (fonts_loaded & FONT_8) 473 copy_font(scp, LOAD, 8, font_8); 474 if (fonts_loaded & FONT_14) 475 copy_font(scp, LOAD, 14, font_14); 476 if (fonts_loaded & FONT_16) 477 copy_font(scp, LOAD, 16, font_16); 478 } 479#endif |
408 load_palette(scp, palette); | 480 load_palette(scp->adp, palette); |
409 410 /* move hardware cursor out of the way */ | 481 482 /* move hardware cursor out of the way */ |
411 (*biosvidsw.set_hw_cursor)(scp->adp, -1, -1); | 483 (*vidsw[scp->ad]->set_hw_cursor)(scp->adp, -1, -1); |
412 413 /* FALL THROUGH */ 414 415 case KD_TEXT1: /* switch to TEXT (known) mode */ 416 /* 417 * If scp->mode is of graphics modes, we don't know which 418 * text/pixel mode to switch back to... 419 */ 420 if (scp->status & GRAPHICS_MODE) 421 return EINVAL; 422 s = spltty(); 423 if ((error = sc_clean_up(scp))) { 424 splx(s); 425 return error; 426 } | 484 485 /* FALL THROUGH */ 486 487 case KD_TEXT1: /* switch to TEXT (known) mode */ 488 /* 489 * If scp->mode is of graphics modes, we don't know which 490 * text/pixel mode to switch back to... 491 */ 492 if (scp->status & GRAPHICS_MODE) 493 return EINVAL; 494 s = spltty(); 495 if ((error = sc_clean_up(scp))) { 496 splx(s); 497 return error; 498 } |
499#ifndef PC98 |
|
427 scp->status |= UNKNOWN_MODE; 428 splx(s); 429 /* no restore fonts & palette */ 430 if (scp == cur_console) 431 set_mode(scp); 432 sc_clear_screen(scp); 433 scp->status &= ~UNKNOWN_MODE; | 500 scp->status |= UNKNOWN_MODE; 501 splx(s); 502 /* no restore fonts & palette */ 503 if (scp == cur_console) 504 set_mode(scp); 505 sc_clear_screen(scp); 506 scp->status &= ~UNKNOWN_MODE; |
507#else /* PC98 */ 508 scp->status &= ~UNKNOWN_MODE; 509 /* no restore fonts & palette */ 510 if (scp == cur_console) 511 set_mode(scp); 512 sc_clear_screen(scp); 513 splx(s); 514#endif /* PC98 */ |
|
434 return 0; 435 436 case KD_PIXEL: /* pixel (raster) display */ 437 if (!(scp->status & (GRAPHICS_MODE | PIXEL_MODE))) 438 return EINVAL; 439 if (scp->status & GRAPHICS_MODE) 440 return sc_set_pixel_mode(scp, tp, scp->xsize, scp->ysize, 441 scp->font_size); 442 s = spltty(); 443 if ((error = sc_clean_up(scp))) { 444 splx(s); 445 return error; 446 } 447 scp->status |= (UNKNOWN_MODE | PIXEL_MODE); 448 splx(s); 449 if (scp == cur_console) { 450 set_mode(scp); | 515 return 0; 516 517 case KD_PIXEL: /* pixel (raster) display */ 518 if (!(scp->status & (GRAPHICS_MODE | PIXEL_MODE))) 519 return EINVAL; 520 if (scp->status & GRAPHICS_MODE) 521 return sc_set_pixel_mode(scp, tp, scp->xsize, scp->ysize, 522 scp->font_size); 523 s = spltty(); 524 if ((error = sc_clean_up(scp))) { 525 splx(s); 526 return error; 527 } 528 scp->status |= (UNKNOWN_MODE | PIXEL_MODE); 529 splx(s); 530 if (scp == cur_console) { 531 set_mode(scp); |
451 load_palette(scp, palette); | 532 load_palette(scp->adp, palette); |
452 } 453 sc_clear_screen(scp); 454 scp->status &= ~UNKNOWN_MODE; 455 return 0; 456 457 case KD_GRAPHICS: /* switch to GRAPHICS (unknown) mode */ 458 s = spltty(); 459 if ((error = sc_clean_up(scp))) { 460 splx(s); 461 return error; 462 } 463 scp->status |= UNKNOWN_MODE; 464 splx(s); | 533 } 534 sc_clear_screen(scp); 535 scp->status &= ~UNKNOWN_MODE; 536 return 0; 537 538 case KD_GRAPHICS: /* switch to GRAPHICS (unknown) mode */ 539 s = spltty(); 540 if ((error = sc_clean_up(scp))) { 541 splx(s); 542 return error; 543 } 544 scp->status |= UNKNOWN_MODE; 545 splx(s); |
546#ifdef PC98 547 if (scp == cur_console) 548 set_mode(scp); 549#endif |
|
465 return 0; 466 467 default: 468 return EINVAL; 469 } 470 /* NOT REACHED */ 471 472 case KDRASTER: /* set pixel (raster) display mode */ --- 8 unchanged lines hidden (view full) --- 481 * as KD_TEXT... 482 */ 483 *data = ISGRAPHSC(scp) ? KD_GRAPHICS : KD_TEXT; 484 return 0; 485 486 case KDSBORDER: /* set border color of this (virtual) console */ 487 scp->border = *data; 488 if (scp == cur_console) | 550 return 0; 551 552 default: 553 return EINVAL; 554 } 555 /* NOT REACHED */ 556 557 case KDRASTER: /* set pixel (raster) display mode */ --- 8 unchanged lines hidden (view full) --- 566 * as KD_TEXT... 567 */ 568 *data = ISGRAPHSC(scp) ? KD_GRAPHICS : KD_TEXT; 569 return 0; 570 571 case KDSBORDER: /* set border color of this (virtual) console */ 572 scp->border = *data; 573 if (scp == cur_console) |
489 set_border(cur_console, scp->border); | 574 set_border(scp, scp->border); |
490 return 0; 491 } 492 493 return ENOIOCTL; 494} 495 496#endif /* NSC > 0 */ | 575 return 0; 576 } 577 578 return ENOIOCTL; 579} 580 581#endif /* NSC > 0 */ |