15d492fd2Smacallan/* $OpenBSD: wsfb_driver.c,v 1.18 2003/04/02 16:42:13 jason Exp $ */ 25d492fd2Smacallan/* 35d492fd2Smacallan * Copyright (c) 2001 Matthieu Herrb 45d492fd2Smacallan * All rights reserved. 55d492fd2Smacallan * 65d492fd2Smacallan * Redistribution and use in source and binary forms, with or without 75d492fd2Smacallan * modification, are permitted provided that the following conditions 85d492fd2Smacallan * are met: 95d492fd2Smacallan * 105d492fd2Smacallan * - Redistributions of source code must retain the above copyright 115d492fd2Smacallan * notice, this list of conditions and the following disclaimer. 125d492fd2Smacallan * - Redistributions in binary form must reproduce the above 135d492fd2Smacallan * copyright notice, this list of conditions and the following 145d492fd2Smacallan * disclaimer in the documentation and/or other materials provided 155d492fd2Smacallan * with the distribution. 165d492fd2Smacallan * 175d492fd2Smacallan * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 185d492fd2Smacallan * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 195d492fd2Smacallan * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 205d492fd2Smacallan * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 215d492fd2Smacallan * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 225d492fd2Smacallan * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 235d492fd2Smacallan * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 245d492fd2Smacallan * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 255d492fd2Smacallan * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 265d492fd2Smacallan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 275d492fd2Smacallan * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 285d492fd2Smacallan * POSSIBILITY OF SUCH DAMAGE. 295d492fd2Smacallan * 305d492fd2Smacallan */ 315d492fd2Smacallan 325d492fd2Smacallan/* 335d492fd2Smacallan * Based on fbdev.c written by: 345d492fd2Smacallan * 355d492fd2Smacallan * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> 365d492fd2Smacallan * Michel Dänzer, <michdaen@iiic.ethz.ch> 375d492fd2Smacallan */ 385d492fd2Smacallan 395d492fd2Smacallan#include <fcntl.h> 405d492fd2Smacallan#include <sys/types.h> 415d492fd2Smacallan#include <sys/time.h> 425d492fd2Smacallan#include <dev/wscons/wsconsio.h> 435d492fd2Smacallan 44dc9c99a5Stsutsui#include "xorgVersion.h" 45dc9c99a5Stsutsui 469974adabSmrg#include "compat-api.h" 479974adabSmrg 485d492fd2Smacallan#include "xf86.h" 495d492fd2Smacallan#include "xf86_OSproc.h" 505d492fd2Smacallan 51a7f02474Smrg#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(25, 2) 525d492fd2Smacallan#include "xf86RamDac.h" 53a7f02474Smrg#else 54a7f02474Smrg#include "xf86Cursor.h" 55a7f02474Smrg#endif 565d492fd2Smacallan 575d492fd2Smacallan#ifndef WSFB_H 585d492fd2Smacallan#define WSFB_H 595d492fd2Smacallan 60dc9c99a5Stsutsui#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0) 61dc9c99a5Stsutsui#define HAVE_SHADOW_AFB 62dc9c99a5Stsutsui#endif 63dc9c99a5Stsutsui 645d492fd2Smacallan/* private data */ 655d492fd2Smacallantypedef struct { 665d492fd2Smacallan int fd; /* file descriptor of open device */ 673788fa92Smacallan struct wsdisplayio_fbinfo fbi; 685d492fd2Smacallan unsigned char* fbstart; 695d492fd2Smacallan unsigned char* fbmem; 705d492fd2Smacallan size_t fbmem_len; 718a4fa5cdStsutsui int rotate; 725d492fd2Smacallan Bool shadowFB; 738a4fa5cdStsutsui void * shadow; 745d492fd2Smacallan Bool HWCursor; 750ef55ed1Smacallan Bool useSwap32; 76bff82b7eSjmcneill Bool useRGB16ToYUY2; 77dc9c99a5Stsutsui#ifdef HAVE_SHADOW_AFB 783306a6a4Sjandberg Bool planarAfb; 79dc9c99a5Stsutsui#endif 805d492fd2Smacallan CloseScreenProcPtr CloseScreen; 815d492fd2Smacallan CreateScreenResourcesProcPtr CreateScreenResources; 829974adabSmrg void (*PointerMoved)(SCRN_ARG_TYPE, int, int); 835d492fd2Smacallan EntityInfoPtr pEnt; 845d492fd2Smacallan struct wsdisplay_cmap saved_cmap; 855d492fd2Smacallan 865d492fd2Smacallan struct wsdisplay_cursor cursor; 875d492fd2Smacallan int maskoffset; 885d492fd2Smacallan xf86CursorInfoPtr CursorInfoRec; 895d492fd2Smacallan#ifdef XFreeXDGA 905d492fd2Smacallan /* DGA info */ 915d492fd2Smacallan DGAModePtr pDGAMode; 925d492fd2Smacallan int nDGAMode; 935d492fd2Smacallan#endif 945d492fd2Smacallan OptionInfoPtr Options; 955d492fd2Smacallan} WsfbRec, *WsfbPtr; 965d492fd2Smacallan 975d492fd2Smacallan#define WSFBPTR(p) ((WsfbPtr)((p)->driverPrivate)) 985d492fd2Smacallan 995d492fd2SmacallanBool WsfbSetupCursor(ScreenPtr); 1005d492fd2Smacallan 1015d492fd2Smacallan#endif 102