2 * Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
5 * This code is derived from software contributed to The DragonFly Project
6 * by Sascha Wildner <saw@online.de>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer as
13 * the first lines of this file unmodified.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include <sys/cdefs.h>
31 __FBSDID("$FreeBSD$");
33 #include "opt_compat.h"
34 #include "opt_syscons.h"
36 #include <sys/param.h>
37 #include <sys/systm.h>
39 #include <sys/signalvar.h>
41 #include <sys/kernel.h>
43 #include <sys/consio.h>
44 #include <sys/filedesc.h>
47 #include <sys/mutex.h>
50 #include <dev/fb/fbreg.h>
51 #include <dev/syscons/syscons.h>
53 SET_DECLARE(scrndr_set, const sc_renderer_t);
55 /* for compatibility with previous versions */
56 /* 3.0-RELEASE used the following structure */
57 typedef struct old_video_adapter {
61 /* flag bits are the same as the -CURRENT
62 #define V_ADP_COLOR (1<<0)
63 #define V_ADP_MODECHANGE (1<<1)
64 #define V_ADP_STATESAVE (1<<2)
65 #define V_ADP_STATELOAD (1<<3)
66 #define V_ADP_FONT (1<<4)
67 #define V_ADP_PALETTE (1<<5)
68 #define V_ADP_BORDER (1<<6)
69 #define V_ADP_VESA (1<<7)
72 u_int va_window; /* virtual address */
73 size_t va_window_size;
74 size_t va_window_gran;
75 u_int va_buffer; /* virtual address */
76 size_t va_buffer_size;
78 int va_initial_bios_mode;
80 } old_video_adapter_t;
82 #define OLD_CONS_ADPINFO _IOWR('c', 101, old_video_adapter_t)
84 /* 3.1-RELEASE used the following structure */
85 typedef struct old_video_adapter_info {
96 u_int va_window; /* virtual address */
97 size_t va_window_size;
98 size_t va_window_gran;
100 size_t va_buffer_size;
102 int va_initial_bios_mode;
105 } old_video_adapter_info_t;
107 #define OLD_CONS_ADPINFO2 _IOWR('c', 101, old_video_adapter_info_t)
109 /* 3.0-RELEASE and 3.1-RELEASE used the following structure */
110 typedef struct old_video_info {
113 /* flag bits are the same as the -CURRENT
114 #define V_INFO_COLOR (1<<0)
115 #define V_INFO_GRAPHICS (1<<1)
116 #define V_INFO_LINEAR (1<<2)
117 #define V_INFO_VESA (1<<3)
125 u_int vi_window; /* physical address */
126 size_t vi_window_size;
127 size_t vi_window_gran;
128 u_int vi_buffer; /* physical address */
129 size_t vi_buffer_size;
132 #define OLD_CONS_MODEINFO _IOWR('c', 102, old_video_info_t)
133 #define OLD_CONS_FINDMODE _IOWR('c', 103, old_video_info_t)
136 sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
137 int fontsize, int fontwidth)
145 if (vidd_get_info(scp->sc->adp, mode, &info))
148 /* adjust argument values */
150 fontwidth = info.vi_cwidth;
152 fontsize = info.vi_cheight;
155 #ifndef SC_NO_FONT_LOADING
156 if (!(scp->sc->fonts_loaded & FONT_8))
158 font = scp->sc->font_8;
162 } else if (fontsize >= 16) {
164 #ifndef SC_NO_FONT_LOADING
165 if (!(scp->sc->fonts_loaded & FONT_16))
167 font = scp->sc->font_16;
173 #ifndef SC_NO_FONT_LOADING
174 if (!(scp->sc->fonts_loaded & FONT_14))
176 font = scp->sc->font_14;
181 if ((xsize <= 0) || (xsize > info.vi_width))
182 xsize = info.vi_width;
183 if ((ysize <= 0) || (ysize > info.vi_height))
184 ysize = info.vi_height;
186 /* stop screen saver, etc */
188 if ((error = sc_clean_up(scp))) {
193 if (sc_render_match(scp, scp->sc->adp->va_name, 0) == NULL) {
199 #ifndef SC_NO_HISTORY
200 if (scp->history != NULL)
203 prev_ysize = scp->ysize;
205 * This is a kludge to fend off scrn_update() while we
206 * muck around with scp. XXX
208 scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
209 scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE | MOUSE_VISIBLE);
215 scp->xpixel = scp->xsize*8;
216 scp->ypixel = scp->ysize*fontsize;
218 scp->font_size = fontsize;
219 scp->font_width = fontwidth;
221 /* allocate buffers */
222 sc_alloc_scr_buffer(scp, TRUE, TRUE);
223 sc_init_emulator(scp, NULL);
224 #ifndef SC_NO_CUTPASTE
225 sc_alloc_cut_buffer(scp, FALSE);
227 #ifndef SC_NO_HISTORY
228 sc_alloc_history_buffer(scp, 0, prev_ysize, FALSE);
232 if (scp == scp->sc->cur_scp)
234 scp->status &= ~UNKNOWN_MODE;
238 DPRINTF(5, ("ws_*size (%d,%d), size (%d,%d)\n",
239 tp->t_winsize.ws_col, tp->t_winsize.ws_row, scp->xsize, scp->ysize));
240 if (tp->t_winsize.ws_col != scp->xsize
241 || tp->t_winsize.ws_row != scp->ysize) {
242 tp->t_winsize.ws_col = scp->xsize;
243 tp->t_winsize.ws_row = scp->ysize;
245 tty_signal_pgrp(tp, SIGWINCH);
252 sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode)
254 #ifdef SC_NO_MODE_CHANGE
261 if (vidd_get_info(scp->sc->adp, mode, &info))
264 /* stop screen saver, etc */
266 if ((error = sc_clean_up(scp))) {
271 if (sc_render_match(scp, scp->sc->adp->va_name, GRAPHICS_MODE) == NULL) {
277 scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE | MOUSE_HIDDEN);
278 scp->status &= ~(PIXEL_MODE | MOUSE_VISIBLE);
281 * Don't change xsize and ysize; preserve the previous vty
282 * and history buffers.
286 scp->xpixel = info.vi_width;
287 scp->ypixel = info.vi_height;
290 #ifndef SC_NO_SYSMOUSE
291 /* move the mouse cursor at the center of the screen */
292 sc_mouse_move(scp, scp->xpixel / 2, scp->ypixel / 2);
294 sc_init_emulator(scp, NULL);
297 if (scp == scp->sc->cur_scp)
299 /* clear_graphics();*/
300 scp->status &= ~UNKNOWN_MODE;
304 if (tp->t_winsize.ws_xpixel != scp->xpixel
305 || tp->t_winsize.ws_ypixel != scp->ypixel) {
306 tp->t_winsize.ws_xpixel = scp->xpixel;
307 tp->t_winsize.ws_ypixel = scp->ypixel;
309 tty_signal_pgrp(tp, SIGWINCH);
313 #endif /* SC_NO_MODE_CHANGE */
317 sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize,
318 int fontsize, int fontwidth)
320 #ifndef SC_PIXEL_MODE
329 if (vidd_get_info(scp->sc->adp, scp->mode, &info))
330 return ENODEV; /* this shouldn't happen */
332 /* adjust argument values */
334 fontsize = info.vi_cheight;
337 #ifndef SC_NO_FONT_LOADING
338 if (!(scp->sc->fonts_loaded & FONT_8))
340 font = scp->sc->font_8;
344 } else if (fontsize >= 16) {
346 #ifndef SC_NO_FONT_LOADING
347 if (!(scp->sc->fonts_loaded & FONT_16))
349 font = scp->sc->font_16;
355 #ifndef SC_NO_FONT_LOADING
356 if (!(scp->sc->fonts_loaded & FONT_14))
358 font = scp->sc->font_14;
364 xsize = info.vi_width/8;
366 ysize = info.vi_height/fontsize;
368 if ((info.vi_width < xsize*8) || (info.vi_height < ysize*fontsize))
372 * We currently support the following graphic modes:
374 * - 4 bpp planar modes whose memory size does not exceed 64K
375 * - 15, 16, 24 and 32 bpp linear modes
378 if (info.vi_mem_model == V_INFO_MM_PLANAR) {
379 if (info.vi_planes != 4)
383 * A memory size >64K requires bank switching to access the entire
387 if (info.vi_width * info.vi_height / 8 > info.vi_window_size)
389 } else if (info.vi_mem_model == V_INFO_MM_DIRECT) {
390 if (!(info.vi_flags & V_INFO_LINEAR) &&
391 (info.vi_depth != 15) && (info.vi_depth != 16) &&
392 (info.vi_depth != 24) && (info.vi_depth != 32))
397 /* stop screen saver, etc */
399 if ((error = sc_clean_up(scp))) {
404 if (sc_render_match(scp, scp->sc->adp->va_name, PIXEL_MODE) == NULL) {
411 (*scp->tsw->te_term)(scp, scp->ts);
417 #ifndef SC_NO_HISTORY
418 if (scp->history != NULL)
421 prev_ysize = scp->ysize;
422 scp->status |= (UNKNOWN_MODE | PIXEL_MODE | MOUSE_HIDDEN);
423 scp->status &= ~(GRAPHICS_MODE | MOUSE_VISIBLE);
426 scp->xoff = (scp->xpixel/8 - xsize)/2;
427 scp->yoff = (scp->ypixel/fontsize - ysize)/2;
429 scp->font_size = fontsize;
430 scp->font_width = fontwidth;
432 /* allocate buffers */
433 sc_alloc_scr_buffer(scp, TRUE, TRUE);
434 sc_init_emulator(scp, NULL);
435 #ifndef SC_NO_CUTPASTE
436 sc_alloc_cut_buffer(scp, FALSE);
438 #ifndef SC_NO_HISTORY
439 sc_alloc_history_buffer(scp, 0, prev_ysize, FALSE);
443 if (scp == scp->sc->cur_scp) {
444 sc_set_border(scp, scp->border);
445 sc_set_cursor_image(scp);
448 scp->status &= ~UNKNOWN_MODE;
452 if (tp->t_winsize.ws_col != scp->xsize
453 || tp->t_winsize.ws_row != scp->ysize) {
454 tp->t_winsize.ws_col = scp->xsize;
455 tp->t_winsize.ws_row = scp->ysize;
456 if (tp->t_pgrp != NULL) {
457 PGRP_LOCK(tp->t_pgrp);
458 pgsignal(tp->t_pgrp, SIGWINCH, 1);
459 PGRP_UNLOCK(tp->t_pgrp);
464 #endif /* SC_PIXEL_MODE */
467 #define fb_ioctl(a, c, d) \
468 (((a) == NULL) ? ENODEV : \
469 vidd_ioctl((a), (c), (caddr_t)(d)))
472 sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
475 video_adapter_t *adp;
477 video_adapter_info_t adp_info;
480 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
481 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
486 if (scp == NULL) /* tp == SC_MOUSE */
489 if (adp == NULL) /* shouldn't happen??? */
494 case CONS_CURRENTADP: /* get current adapter index */
496 return fb_ioctl(adp, FBIO_ADAPTER, data);
498 case CONS_CURRENT: /* get current adapter type */
500 return fb_ioctl(adp, FBIO_ADPTYPE, data);
502 case OLD_CONS_ADPINFO: /* adapter information (old interface) */
503 if (((old_video_adapter_t *)data)->va_index >= 0) {
504 adp = vid_get_adapter(((old_video_adapter_t *)data)->va_index);
508 ((old_video_adapter_t *)data)->va_index = adp->va_index;
509 ((old_video_adapter_t *)data)->va_type = adp->va_type;
510 ((old_video_adapter_t *)data)->va_flags = adp->va_flags;
511 ((old_video_adapter_t *)data)->va_crtc_addr = adp->va_crtc_addr;
512 ((old_video_adapter_t *)data)->va_window = adp->va_window;
513 ((old_video_adapter_t *)data)->va_window_size = adp->va_window_size;
514 ((old_video_adapter_t *)data)->va_window_gran = adp->va_window_gran;
515 ((old_video_adapter_t *)data)->va_buffer = adp->va_buffer;
516 ((old_video_adapter_t *)data)->va_buffer_size = adp->va_buffer_size;
517 ((old_video_adapter_t *)data)->va_mode = adp->va_mode;
518 ((old_video_adapter_t *)data)->va_initial_mode = adp->va_initial_mode;
519 ((old_video_adapter_t *)data)->va_initial_bios_mode
520 = adp->va_initial_bios_mode;
523 case OLD_CONS_ADPINFO2: /* adapter information (yet another old I/F) */
524 adp_info.va_index = ((old_video_adapter_info_t *)data)->va_index;
525 if (adp_info.va_index >= 0) {
526 adp = vid_get_adapter(adp_info.va_index);
530 error = fb_ioctl(adp, FBIO_ADPINFO, &adp_info);
532 bcopy(&adp_info, data, sizeof(old_video_adapter_info_t));
535 case CONS_ADPINFO: /* adapter information */
537 if (((video_adapter_info_t *)data)->va_index >= 0) {
538 adp = vid_get_adapter(((video_adapter_info_t *)data)->va_index);
542 return fb_ioctl(adp, FBIO_ADPINFO, data);
544 case CONS_GET: /* get current video mode */
546 *(int *)data = scp->mode;
549 #ifndef SC_NO_MODE_CHANGE
550 case FBIO_SETMODE: /* set video mode */
551 if (!(adp->va_flags & V_ADP_MODECHANGE))
553 info.vi_mode = *(int *)data;
554 error = fb_ioctl(adp, FBIO_MODEINFO, &info);
557 if (info.vi_flags & V_INFO_GRAPHICS)
558 return sc_set_graphics_mode(scp, tp, *(int *)data);
560 return sc_set_text_mode(scp, tp, *(int *)data, 0, 0, 0, 0);
561 #endif /* SC_NO_MODE_CHANGE */
563 case OLD_CONS_MODEINFO: /* get mode information (old infterface) */
564 info.vi_mode = ((old_video_info_t *)data)->vi_mode;
565 error = fb_ioctl(adp, FBIO_MODEINFO, &info);
567 bcopy(&info, (old_video_info_t *)data, sizeof(old_video_info_t));
570 case CONS_MODEINFO: /* get mode information */
572 return fb_ioctl(adp, FBIO_MODEINFO, data);
574 case OLD_CONS_FINDMODE: /* find a matching video mode (old interface) */
575 bzero(&info, sizeof(info));
576 bcopy((old_video_info_t *)data, &info, sizeof(old_video_info_t));
577 error = fb_ioctl(adp, FBIO_FINDMODE, &info);
579 bcopy(&info, (old_video_info_t *)data, sizeof(old_video_info_t));
582 case CONS_FINDMODE: /* find a matching video mode */
584 return fb_ioctl(adp, FBIO_FINDMODE, data);
586 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
587 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
589 ival = IOCPARM_IVAL(data);
590 data = (caddr_t)&ival;
593 case CONS_SETWINORG: /* set frame buffer window origin */
595 if (scp != scp->sc->cur_scp)
596 return ENODEV; /* XXX */
597 return fb_ioctl(adp, FBIO_SETWINORG, data);
599 case FBIO_GETWINORG: /* get frame buffer window origin */
600 if (scp != scp->sc->cur_scp)
601 return ENODEV; /* XXX */
602 return fb_ioctl(adp, FBIO_GETWINORG, data);
604 case FBIO_GETDISPSTART:
605 case FBIO_SETDISPSTART:
606 case FBIO_GETLINEWIDTH:
607 case FBIO_SETLINEWIDTH:
608 if (scp != scp->sc->cur_scp)
609 return ENODEV; /* XXX */
610 return fb_ioctl(adp, cmd, data);
612 case FBIO_GETPALETTE:
613 case FBIO_SETPALETTE:
625 if (scp != scp->sc->cur_scp)
626 return ENODEV; /* XXX */
627 return fb_ioctl(adp, cmd, data);
630 if (scp != scp->sc->cur_scp)
631 return ENODEV; /* XXX */
632 return fb_ioctl(adp, cmd, data);
634 #ifndef SC_NO_MODE_CHANGE
635 /* generic text modes */
636 case SW_TEXT_80x25: case SW_TEXT_80x30:
637 case SW_TEXT_80x43: case SW_TEXT_80x50:
643 case SW_VGA_C80x25: case SW_VGA_M80x25:
644 case SW_VGA_C80x30: case SW_VGA_M80x30:
645 case SW_VGA_C80x50: case SW_VGA_M80x50:
646 case SW_VGA_C80x60: case SW_VGA_M80x60:
647 case SW_VGA_C90x25: case SW_VGA_M90x25:
648 case SW_VGA_C90x30: case SW_VGA_M90x30:
649 case SW_VGA_C90x43: case SW_VGA_M90x43:
650 case SW_VGA_C90x50: case SW_VGA_M90x50:
651 case SW_VGA_C90x60: case SW_VGA_M90x60:
652 case SW_B40x25: case SW_C40x25:
653 case SW_B80x25: case SW_C80x25:
654 case SW_ENH_B40x25: case SW_ENH_C40x25:
655 case SW_ENH_B80x25: case SW_ENH_C80x25:
656 case SW_ENH_B80x43: case SW_ENH_C80x43:
657 case SW_EGAMONO80x25:
660 /* PC98 TEXT MODES */
664 if (!(adp->va_flags & V_ADP_MODECHANGE))
666 return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0, 0);
669 case SW_BG320: case SW_BG640:
670 case SW_CG320: case SW_CG320_D: case SW_CG640_E:
671 case SW_CG640x350: case SW_ENH_CG640:
672 case SW_BG640x480: case SW_CG640x480: case SW_VGA_CG320:
675 /* PC98 GRAPHICS MODES */
676 case SW_PC98_EGC640x400: case SW_PC98_PEGC640x400:
677 case SW_PC98_PEGC640x480:
679 if (!(adp->va_flags & V_ADP_MODECHANGE))
681 return sc_set_graphics_mode(scp, tp, cmd & 0xff);
682 #endif /* SC_NO_MODE_CHANGE */
684 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
685 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
687 ival = IOCPARM_IVAL(data);
688 data = (caddr_t)&ival;
691 case KDSETMODE: /* set current mode of this (virtual) console */
692 switch (*(int *)data) {
693 case KD_TEXT: /* switch to TEXT (known) mode */
695 * If scp->mode is of graphics modes, we don't know which
696 * text mode to switch back to...
698 if (scp->status & GRAPHICS_MODE)
700 /* restore fonts & palette ! */
702 #ifndef SC_NO_FONT_LOADING
703 if (ISFONTAVAIL(adp->va_flags)
704 && !(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
707 * Don't load fonts for now... XXX
709 if (scp->sc->fonts_loaded & FONT_8)
710 sc_load_font(scp, 0, 8, 8, scp->sc->font_8, 0, 256);
711 if (scp->sc->fonts_loaded & FONT_14)
712 sc_load_font(scp, 0, 14, 8, scp->sc->font_14, 0, 256);
713 if (scp->sc->fonts_loaded & FONT_16)
714 sc_load_font(scp, 0, 16, 8, scp->sc->font_16, 0, 256);
716 #endif /* SC_NO_FONT_LOADING */
719 #ifndef SC_NO_PALETTE_LOADING
720 vidd_load_palette(adp, scp->sc->palette);
724 /* move hardware cursor out of the way */
725 vidd_set_hw_cursor(adp, -1, -1);
730 case KD_TEXT1: /* switch to TEXT (known) mode */
732 * If scp->mode is of graphics modes, we don't know which
733 * text/pixel mode to switch back to...
735 if (scp->status & GRAPHICS_MODE)
738 if ((error = sc_clean_up(scp))) {
743 scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
745 /* no restore fonts & palette */
746 if (scp == scp->sc->cur_scp)
748 sc_clear_screen(scp);
749 scp->status &= ~UNKNOWN_MODE;
751 scp->status &= ~UNKNOWN_MODE;
752 /* no restore fonts & palette */
753 if (scp == scp->sc->cur_scp)
755 sc_clear_screen(scp);
761 case KD_PIXEL: /* pixel (raster) display */
762 if (!(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
764 if (scp->status & GRAPHICS_MODE)
765 return sc_set_pixel_mode(scp, tp, scp->xsize, scp->ysize,
766 scp->font_size, scp->font_width);
768 if ((error = sc_clean_up(scp))) {
772 scp->status |= (UNKNOWN_MODE | PIXEL_MODE | MOUSE_HIDDEN);
774 if (scp == scp->sc->cur_scp) {
776 #ifndef SC_NO_PALETTE_LOADING
777 vidd_load_palette(adp, scp->sc->palette);
780 sc_clear_screen(scp);
781 scp->status &= ~UNKNOWN_MODE;
783 #endif /* SC_PIXEL_MODE */
785 case KD_GRAPHICS: /* switch to GRAPHICS (unknown) mode */
787 if ((error = sc_clean_up(scp))) {
791 scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN;
794 if (scp == scp->sc->cur_scp)
805 case KDRASTER: /* set pixel (raster) display mode */
806 if (ISUNKNOWNSC(scp) || ISTEXTSC(scp))
808 return sc_set_pixel_mode(scp, tp, ((int *)data)[0], ((int *)data)[1],
809 ((int *)data)[2], 8);
810 #endif /* SC_PIXEL_MODE */
812 case KDGETMODE: /* get current mode of this (virtual) console */
814 * From the user program's point of view, KD_PIXEL is the same
817 *data = ISGRAPHSC(scp) ? KD_GRAPHICS : KD_TEXT;
820 #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
821 defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
823 ival = IOCPARM_IVAL(data);
824 data = (caddr_t)&ival;
827 case KDSBORDER: /* set border color of this (virtual) console */
828 scp->border = *(int *)data;
829 if (scp == scp->sc->cur_scp)
830 sc_set_border(scp, scp->border);
837 static LIST_HEAD(, sc_renderer) sc_rndr_list =
838 LIST_HEAD_INITIALIZER(sc_rndr_list);
841 sc_render_add(sc_renderer_t *rndr)
843 LIST_INSERT_HEAD(&sc_rndr_list, rndr, link);
848 sc_render_remove(sc_renderer_t *rndr)
851 LIST_REMOVE(rndr, link);
853 return EBUSY; /* XXX */
857 *sc_render_match(scr_stat *scp, char *name, int mode)
859 const sc_renderer_t **list;
860 const sc_renderer_t *p;
862 if (!LIST_EMPTY(&sc_rndr_list)) {
863 LIST_FOREACH(p, &sc_rndr_list, link) {
864 if ((strcmp(p->name, name) == 0)
865 && (mode == p->mode)) {
867 ~(VR_CURSOR_ON | VR_CURSOR_BLINK);
872 SET_FOREACH(list, scrndr_set) {
874 if ((strcmp(p->name, name) == 0)
875 && (mode == p->mode)) {
877 ~(VR_CURSOR_ON | VR_CURSOR_BLINK);