Deleted Added
full compact
scvidctl.c (39287) scvidctl.c (39591)
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

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
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

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $Id$
29 * $Id: scvidctl.c,v 1.1 1998/09/15 18:16:37 sos Exp $
30 */
31
32#include "sc.h"
33#include "opt_syscons.h"
34
35#if NSC > 0
36
37#include <sys/param.h>

--- 6 unchanged lines hidden (view full) ---

44#include <machine/console.h>
45
46#include <i386/isa/videoio.h>
47#include <i386/isa/syscons.h>
48
49/* video ioctl */
50
51extern scr_stat *cur_console;
30 */
31
32#include "sc.h"
33#include "opt_syscons.h"
34
35#if NSC > 0
36
37#include <sys/param.h>

--- 6 unchanged lines hidden (view full) ---

44#include <machine/console.h>
45
46#include <i386/isa/videoio.h>
47#include <i386/isa/syscons.h>
48
49/* video ioctl */
50
51extern scr_stat *cur_console;
52extern u_short *Crtat;
53extern int fonts_loaded;
54extern int sc_history_size;
55extern u_char palette[];
56
57int
58sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
59 int fontsize)
60{

--- 167 unchanged lines hidden (view full) ---

228 xsize = info.vi_width/8;
229 if (ysize <= 0)
230 ysize = info.vi_height/fontsize;
231
232#ifdef SC_VIDEO_DEBUG
233 if (scp->scr_buf != NULL) {
234 printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n",
235 scp->mode, xsize, ysize, fontsize);
52extern int fonts_loaded;
53extern int sc_history_size;
54extern u_char palette[];
55
56int
57sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
58 int fontsize)
59{

--- 167 unchanged lines hidden (view full) ---

227 xsize = info.vi_width/8;
228 if (ysize <= 0)
229 ysize = info.vi_height/fontsize;
230
231#ifdef SC_VIDEO_DEBUG
232 if (scp->scr_buf != NULL) {
233 printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n",
234 scp->mode, xsize, ysize, fontsize);
236 printf("set_pixel_mode(): Crtat:%x, %dx%d, xoff:%d, yoff:%d\n",
237 Crtat, info.vi_width, info.vi_height,
235 printf("set_pixel_mode(): window:%x, %dx%d, xoff:%d, yoff:%d\n",
236 adp->va_window, info.vi_width, info.vi_height,
238 (info.vi_width/8 - xsize)/2,
239 (info.vi_height/fontsize - ysize)/2);
240 }
241#endif
242
237 (info.vi_width/8 - xsize)/2,
238 (info.vi_height/fontsize - ysize)/2);
239 }
240#endif
241
242 if ((info.vi_width < xsize*8) || (info.vi_height < ysize*fontsize))
243 return EINVAL;
244
245 /* only 16 color, 4 plane modes are supported XXX */
246 if ((info.vi_depth != 4) || (info.vi_planes != 4))
247 return ENODEV;
248
249 /*
250 * set_pixel_mode() currently does not support video modes whose
251 * memory size is larger than 64K. Because such modes require
252 * bank switching to access the entire screen. XXX
253 */
254 if (info.vi_width*info.vi_height/8 > info.vi_window_size*1024)
255 return ENODEV;
256
243 /* stop screen saver, etc */
244 s = spltty();
245 if ((error = sc_clean_up(scp))) {
246 splx(s);
247 return error;
248 }
249
250 /* set up scp */

--- 12 unchanged lines hidden (view full) ---

263
264 /* allocate buffers */
265 sc_alloc_scr_buffer(scp, TRUE, TRUE);
266 if (ISMOUSEAVAIL(adp->va_flags))
267 sc_alloc_cut_buffer(scp, FALSE);
268 sc_alloc_history_buffer(scp, sc_history_size, i, FALSE);
269 splx(s);
270
257 /* stop screen saver, etc */
258 s = spltty();
259 if ((error = sc_clean_up(scp))) {
260 splx(s);
261 return error;
262 }
263
264 /* set up scp */

--- 12 unchanged lines hidden (view full) ---

277
278 /* allocate buffers */
279 sc_alloc_scr_buffer(scp, TRUE, TRUE);
280 if (ISMOUSEAVAIL(adp->va_flags))
281 sc_alloc_cut_buffer(scp, FALSE);
282 sc_alloc_history_buffer(scp, sc_history_size, i, FALSE);
283 splx(s);
284
271 /* FIXME */
272 if (scp == cur_console)
285 if (scp == cur_console)
273 bzero(Crtat, scp->xpixel*scp->ypixel/8);
286 set_border(scp, scp->border);
274
275 scp->status &= ~UNKNOWN_MODE;
276
277#ifdef SC_VIDEO_DEBUG
278 printf("set_pixel_mode(): status:%x\n", scp->status);
279#endif
280
281 if (tp == NULL)

--- 48 unchanged lines hidden (view full) ---

330 case CONS_FINDMODE: /* find a matching video mode */
331 return ((*biosvidsw.query_mode)(scp->adp, (video_info_t *)data)
332 ? ENODEV : 0);
333
334 case CONS_SETWINORG:
335 return ((*biosvidsw.set_win_org)(scp->adp, *(u_int *)data)
336 ? ENODEV : 0);
337
287
288 scp->status &= ~UNKNOWN_MODE;
289
290#ifdef SC_VIDEO_DEBUG
291 printf("set_pixel_mode(): status:%x\n", scp->status);
292#endif
293
294 if (tp == NULL)

--- 48 unchanged lines hidden (view full) ---

343 case CONS_FINDMODE: /* find a matching video mode */
344 return ((*biosvidsw.query_mode)(scp->adp, (video_info_t *)data)
345 ? ENODEV : 0);
346
347 case CONS_SETWINORG:
348 return ((*biosvidsw.set_win_org)(scp->adp, *(u_int *)data)
349 ? ENODEV : 0);
350
351 /* generic text modes */
352 case SW_TEXT_80x25: case SW_TEXT_80x30:
353 case SW_TEXT_80x43: case SW_TEXT_80x50:
354 case SW_TEXT_80x60:
355 /* FALL THROUGH */
356
338 /* VGA TEXT MODES */
339 case SW_VGA_C40x25:
340 case SW_VGA_C80x25: case SW_VGA_M80x25:
341 case SW_VGA_C80x30: case SW_VGA_M80x30:
342 case SW_VGA_C80x50: case SW_VGA_M80x50:
343 case SW_VGA_C80x60: case SW_VGA_M80x60:
344 case SW_B40x25: case SW_C40x25:
345 case SW_B80x25: case SW_C80x25:

--- 60 unchanged lines hidden (view full) ---

406 s = spltty();
407 if ((error = sc_clean_up(scp))) {
408 splx(s);
409 return error;
410 }
411 scp->status |= UNKNOWN_MODE;
412 splx(s);
413 /* no restore fonts & palette */
357 /* VGA TEXT MODES */
358 case SW_VGA_C40x25:
359 case SW_VGA_C80x25: case SW_VGA_M80x25:
360 case SW_VGA_C80x30: case SW_VGA_M80x30:
361 case SW_VGA_C80x50: case SW_VGA_M80x50:
362 case SW_VGA_C80x60: case SW_VGA_M80x60:
363 case SW_B40x25: case SW_C40x25:
364 case SW_B80x25: case SW_C80x25:

--- 60 unchanged lines hidden (view full) ---

425 s = spltty();
426 if ((error = sc_clean_up(scp))) {
427 splx(s);
428 return error;
429 }
430 scp->status |= UNKNOWN_MODE;
431 splx(s);
432 /* no restore fonts & palette */
414 if (scp == cur_console) {
433 if (scp == cur_console)
415 set_mode(scp);
434 set_mode(scp);
416 /* FIXME */
417 if (scp->status & PIXEL_MODE)
418 bzero(Crtat, scp->xpixel*scp->ypixel/8);
419 }
420 sc_clear_screen(scp);
421 scp->status &= ~UNKNOWN_MODE;
422 return 0;
423
424 case KD_PIXEL: /* pixel (raster) display */
425 if (!(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
426 return EINVAL;
435 sc_clear_screen(scp);
436 scp->status &= ~UNKNOWN_MODE;
437 return 0;
438
439 case KD_PIXEL: /* pixel (raster) display */
440 if (!(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
441 return EINVAL;
427 if (!(scp->status & PIXEL_MODE))
442 if (scp->status & GRAPHICS_MODE)
428 return sc_set_pixel_mode(scp, tp, scp->xsize, scp->ysize,
429 scp->font_size);
430 s = spltty();
431 if ((error = sc_clean_up(scp))) {
432 splx(s);
433 return error;
434 }
435 scp->status |= (UNKNOWN_MODE | PIXEL_MODE);
436 splx(s);
437 if (scp == cur_console) {
438 set_mode(scp);
439 load_palette(scp, palette);
443 return sc_set_pixel_mode(scp, tp, scp->xsize, scp->ysize,
444 scp->font_size);
445 s = spltty();
446 if ((error = sc_clean_up(scp))) {
447 splx(s);
448 return error;
449 }
450 scp->status |= (UNKNOWN_MODE | PIXEL_MODE);
451 splx(s);
452 if (scp == cur_console) {
453 set_mode(scp);
454 load_palette(scp, palette);
440 /* FIXME */
441 bzero(Crtat, scp->xpixel*scp->ypixel/8);
442 }
443 sc_clear_screen(scp);
444 scp->status &= ~UNKNOWN_MODE;
445 return 0;
446
447 case KD_GRAPHICS: /* switch to GRAPHICS (unknown) mode */
448 s = spltty();
449 if ((error = sc_clean_up(scp))) {

--- 37 unchanged lines hidden ---
455 }
456 sc_clear_screen(scp);
457 scp->status &= ~UNKNOWN_MODE;
458 return 0;
459
460 case KD_GRAPHICS: /* switch to GRAPHICS (unknown) mode */
461 s = spltty();
462 if ((error = sc_clean_up(scp))) {

--- 37 unchanged lines hidden ---