int cgeightioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l) { #if defined(SUN4) struct cgeight_softc *sc = device_lookup_private(&cgeight_cd, minor(dev)); struct fbgattr *fba; int error; switch (cmd) { case FBIOGTYPE: *(struct fbtype *)data = sc->sc_fb.fb_type; break; case FBIOGATTR: fba = (struct fbgattr *)data; fba->real_type = sc->sc_fb.fb_type.fb_type; fba->owner = 0; /* XXX ??? */ fba->fbtype = sc->sc_fb.fb_type; fba->sattr.flags = 0; fba->sattr.emu_type = sc->sc_fb.fb_type.fb_type; fba->sattr.dev_specific[0] = -1; fba->emu_types[0] = sc->sc_fb.fb_type.fb_type; fba->emu_types[1] = -1; break; case FBIOGETCMAP: #define p ((struct fbcmap *)data) return (bt_getcmap(p, &sc->sc_cmap, 256, 1)); case FBIOPUTCMAP: /* copy to software map */ error = bt_putcmap(p, &sc->sc_cmap, 256, 1); if (error) return (error); /* now blast them into the chip */ /* XXX should use retrace interrupt */ cgeightloadcmap(sc, p->index, p->count); #undef p break; case FBIOGVIDEO: *(int *)data = cgeight_get_video(sc); break; case FBIOSVIDEO: cgeight_set_video(sc, *(int *)data); break; default: return (ENOTTY); } #endif /* SUN4 */ return (0); }
int cgfour_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) { struct cgfour_softc *sc = v; struct wsdisplay_fbinfo *wdf; struct wsdisplay_cmap *cm; int error; switch (cmd) { case WSDISPLAYIO_GTYPE: *(u_int *)data = WSDISPLAY_TYPE_SUNCG4; break; case WSDISPLAYIO_GINFO: wdf = (struct wsdisplay_fbinfo *)data; wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: *(u_int *)data = sc->sc_sunfb.sf_linebytes; break; case WSDISPLAYIO_GETCMAP: cm = (struct wsdisplay_cmap *)data; error = bt_getcmap(&sc->sc_cmap, cm); if (error) return (error); break; case WSDISPLAYIO_PUTCMAP: cm = (struct wsdisplay_cmap *)data; error = bt_putcmap(&sc->sc_cmap, cm); if (error) return (error); bt_loadcmap(&sc->sc_cmap, &sc->sc_fbc->fbc_dac, cm->index, cm->count, 1); break; case WSDISPLAYIO_SVIDEO: case WSDISPLAYIO_GVIDEO: break; case WSDISPLAYIO_GCURPOS: case WSDISPLAYIO_SCURPOS: case WSDISPLAYIO_GCURMAX: case WSDISPLAYIO_GCURSOR: case WSDISPLAYIO_SCURSOR: default: return (-1); /* not supported yet */ } return (0); }
int tcx_ioctl(void *dev, u_long cmd, caddr_t data, int flags, struct proc *p) { struct tcx_softc *sc = dev; struct wsdisplay_cmap *cm; struct wsdisplay_fbinfo *wdf; int error; /* * Note that, although the emulation (text) mode is running in 8-bit * mode, if the frame buffer is able to run in 24-bit mode, it will * be advertized as such. */ switch (cmd) { case WSDISPLAYIO_GTYPE: *(u_int *)data = WSDISPLAY_TYPE_SUNTCX; break; case WSDISPLAYIO_GINFO: wdf = (struct wsdisplay_fbinfo *)data; wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; wdf->cmsize = sc->sc_cplane == 0 ? 256 : 0; break; case WSDISPLAYIO_GETSUPPORTEDDEPTH: if (sc->sc_cplane != 0) *(u_int *)data = WSDISPLAYIO_DEPTH_24_32; else return (-1); break; case WSDISPLAYIO_LINEBYTES: if (sc->sc_cplane == 0) *(u_int *)data = sc->sc_sunfb.sf_linebytes; else *(u_int *)data = sc->sc_sunfb.sf_linebytes * 4; break; case WSDISPLAYIO_GETCMAP: if (sc->sc_cplane == 0) { cm = (struct wsdisplay_cmap *)data; error = bt_getcmap(&sc->sc_cmap, cm); if (error) return (error); } break; case WSDISPLAYIO_PUTCMAP: if (sc->sc_cplane == 0) { cm = (struct wsdisplay_cmap *)data; error = bt_putcmap(&sc->sc_cmap, cm); if (error) return (error); tcx_loadcmap_deferred(sc, cm->index, cm->count); } break; case WSDISPLAYIO_SMODE: if (*(int *)data == WSDISPLAYIO_MODE_EMUL) { /* Back from X11 to text mode */ tcx_reset(sc, 8); } else { /* Starting X11, try to switch to 24 bit mode */ if (sc->sc_cplane != 0) tcx_reset(sc, 32); } break; case WSDISPLAYIO_SVIDEO: case WSDISPLAYIO_GVIDEO: break; default: return (-1); /* not supported yet */ } return (0); }
int p9000_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) { struct p9000_softc *sc = v; struct wsdisplay_fbinfo *wdf; struct wsdisplay_cmap *cm; #if NTCTRL > 0 struct wsdisplay_param *dp; #endif int error; switch (cmd) { case WSDISPLAYIO_GTYPE: *(u_int *)data = WSDISPLAY_TYPE_SB_P9000; break; case WSDISPLAYIO_SMODE: /* Restore proper acceleration state upon leaving X11 */ if (*(u_int *)data == WSDISPLAYIO_MODE_EMUL) { if (sc->sc_sunfb.sf_dev.dv_cfdata->cf_flags != 0) p9000_ras_init(sc); } break; case WSDISPLAYIO_GINFO: wdf = (struct wsdisplay_fbinfo *)data; wdf->height = sc->sc_sunfb.sf_height; wdf->width = sc->sc_sunfb.sf_width; wdf->depth = sc->sc_sunfb.sf_depth; wdf->cmsize = 256; break; case WSDISPLAYIO_LINEBYTES: *(u_int *)data = sc->sc_sunfb.sf_linebytes; break; case WSDISPLAYIO_GETCMAP: cm = (struct wsdisplay_cmap *)data; error = bt_getcmap(&sc->sc_cmap, cm); if (error) return (error); break; case WSDISPLAYIO_PUTCMAP: cm = (struct wsdisplay_cmap *)data; error = bt_putcmap(&sc->sc_cmap, cm); if (error) return (error); p9000_loadcmap_deferred(sc, cm->index, cm->count); break; #if NTCTRL > 0 case WSDISPLAYIO_GETPARAM: dp = (struct wsdisplay_param *)data; switch (dp->param) { case WSDISPLAYIO_PARAM_BRIGHTNESS: dp->min = 0; dp->max = 255; dp->curval = tadpole_get_brightness(); break; case WSDISPLAYIO_PARAM_BACKLIGHT: dp->min = 0; dp->max = 1; dp->curval = tadpole_get_video() & TV_ON ? 1 : 0; break; default: return (-1); } break; case WSDISPLAYIO_SETPARAM: dp = (struct wsdisplay_param *)data; switch (dp->param) { case WSDISPLAYIO_PARAM_BRIGHTNESS: tadpole_set_brightness(dp->curval); break; case WSDISPLAYIO_PARAM_BACKLIGHT: tadpole_set_video(dp->curval); break; default: return (-1); } break; #endif /* NTCTRL > 0 */ case WSDISPLAYIO_SVIDEO: case WSDISPLAYIO_GVIDEO: break; case WSDISPLAYIO_GCURPOS: case WSDISPLAYIO_SCURPOS: case WSDISPLAYIO_GCURMAX: case WSDISPLAYIO_GCURSOR: case WSDISPLAYIO_SCURSOR: default: return (-1); /* not supported yet */ } return (0); }
int p9100_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p) { struct p9100_softc *sc = v; struct wsdisplay_fbinfo *wdf; struct wsdisplay_cmap *cm; #if NTCTRL > 0 struct wsdisplay_param *dp; #endif int error; switch (cmd) { case WSDISPLAYIO_GTYPE: *(u_int *)data = WSDISPLAY_TYPE_SB_P9100; break; case WSDISPLAYIO_SMODE: sc->sc_mapmode = *(u_int *)data; switch (sc->sc_mapmode) { case WSDISPLAYIO_MODE_DUMBFB: case WSDISPLAYIO_MODE_MAPPED: #if NTCTRL > 0 if (ISSET(sc->sc_flags, SCF_MAPPEDSWITCH)) p9100_initialize_ramdac(sc, sc->sc_mapwidth, sc->sc_mapdepth); #endif break; case WSDISPLAYIO_MODE_EMUL: #if NTCTRL > 0 if (ISSET(sc->sc_flags, SCF_MAPPEDSWITCH)) p9100_initialize_ramdac(sc, LCD_WIDTH, 8); #endif fbwscons_setcolormap(&sc->sc_sunfb, p9100_setcolor); /* Restore proper acceleration state as well */ if (sc->sc_sunfb.sf_dev.dv_cfdata->cf_flags != 0) p9100_ras_init(sc); break; } break; case WSDISPLAYIO_GINFO: wdf = (struct wsdisplay_fbinfo *)data; #if NTCTRL > 0 if (ISSET(sc->sc_flags, SCF_MAPPEDSWITCH)) { wdf->width = sc->sc_mapwidth; wdf->height = sc->sc_mapheight; wdf->depth = sc->sc_mapdepth; wdf->cmsize = sc->sc_mapdepth == 8 ? 256 : 0; } else #endif { wdf->width = LCD_WIDTH; wdf->height = LCD_HEIGHT; wdf->depth = 8; wdf->cmsize = 256; } break; case WSDISPLAYIO_LINEBYTES: #if NTCTRL > 0 if (ISSET(sc->sc_flags, SCF_MAPPEDSWITCH)) *(u_int *)data = sc->sc_mapwidth * (sc->sc_mapdepth / 8); else #endif *(u_int *)data = sc->sc_sunfb.sf_linebytes; break; case WSDISPLAYIO_GETCMAP: cm = (struct wsdisplay_cmap *)data; error = bt_getcmap(&sc->sc_cmap, cm); if (error) return (error); break; case WSDISPLAYIO_PUTCMAP: cm = (struct wsdisplay_cmap *)data; error = bt_putcmap(&sc->sc_cmap, cm); if (error) return (error); p9100_loadcmap_deferred(sc, cm->index, cm->count); break; #if NTCTRL > 0 case WSDISPLAYIO_GETPARAM: dp = (struct wsdisplay_param *)data; switch (dp->param) { case WSDISPLAYIO_PARAM_BRIGHTNESS: dp->min = 0; dp->max = 255; dp->curval = tadpole_get_brightness(); break; case WSDISPLAYIO_PARAM_BACKLIGHT: dp->min = 0; dp->max = 1; if (ISSET(sc->sc_flags, SCF_INTERNAL)) dp->curval = tadpole_get_video() & TV_ON ? 1 : 0; else dp->curval = 0; break; default: return (-1); } break; case WSDISPLAYIO_SETPARAM: dp = (struct wsdisplay_param *)data; switch (dp->param) { case WSDISPLAYIO_PARAM_BRIGHTNESS: tadpole_set_brightness(dp->curval); break; case WSDISPLAYIO_PARAM_BACKLIGHT: if (ISSET(sc->sc_flags, SCF_INTERNAL)) tadpole_set_video(dp->curval); break; default: return (-1); } break; #endif /* NTCTRL > 0 */ case WSDISPLAYIO_SVIDEO: case WSDISPLAYIO_GVIDEO: break; case WSDISPLAYIO_GCURPOS: case WSDISPLAYIO_SCURPOS: case WSDISPLAYIO_GCURMAX: case WSDISPLAYIO_GCURSOR: case WSDISPLAYIO_SCURSOR: default: return (-1); /* not supported yet */ } return (0); }