/*
* Copyright (c) 1998 Matt DeBergalis
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Matt DeBergalis
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* clear the screen */
for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(uint32_t))
*(uint32_t *)(dc->dc_videobase + i) =
color ? 0x0 : 0xffffffff;
case WSDISPLAYIO_LINEBYTES:
*(u_int *)data = dc->dc_rowbytes;
return 0;
case WSDISPLAYIO_SMODE:
new_mode = *(int *)data;
if (new_mode != sc->sc_mode) {
sc->sc_mode = new_mode;
}
return 0;
case WSDISPLAYIO_GETCMAP:
case WSDISPLAYIO_PUTCMAP:
case WSDISPLAYIO_GVIDEO:
case WSDISPLAYIO_SVIDEO:
case WSDISPLAYIO_GCURPOS:
case WSDISPLAYIO_GCURMAX:
case WSDISPLAYIO_GCURSOR:
printf("nextdisplay_ioctl: listed but unsupported ioctl\n");
return EPASSTHROUGH;
}
switch (sc->sc_mode) {
case WSDISPLAYIO_MODE_DUMBFB:
if (offset >= 0 && offset < dc->dc_size)
cookie = m68k_btop(dc->dc_paddr + offset);
break;
}
return cookie;
}
int
nextdisplay_alloc_screen(void *v, const struct wsscreen_descr *type,
void **cookiep, int *curxp, int *curyp, long *defattrp)
{
struct nextdisplay_softc *sc = v;
long defattr;
/* only allow one screen */
if (sc->nscreens > 0)
return ENOMEM;
*cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
*curxp = 0;
*curyp = 0;
rcons_allocattr(&sc->sc_dc->dc_rcons, 0, 0,
(strcmp(type->name, "color") == 0) ? 0 : WSATTR_REVERSE, &defattr);
*defattrp = defattr;
sc->nscreens++;
#if 0
printf("nextdisplay: allocating screen\n");
#endif
return 0;
}