1/* $OpenBSD: wsfb_driver.c,v 1.18 2003/04/02 16:42:13 jason Exp $ */ 2/* 3 * Copyright (c) 2001 Matthieu Herrb 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 10 * - Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * - Redistributions in binary form must reproduce the above 13 * copyright notice, this list of conditions and the following 14 * disclaimer in the documentation and/or other materials provided 15 * with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 21 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * POSSIBILITY OF SUCH DAMAGE. 29 * 30 */ 31 32/* 33 * Based on fbdev.c written by: 34 * 35 * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> 36 * Michel Dänzer, <michdaen@iiic.ethz.ch> 37 */ 38 39#include <fcntl.h> 40#include <sys/types.h> 41#include <sys/time.h> 42#include <dev/wscons/wsconsio.h> 43 44#include "xorgVersion.h" 45 46#include "compat-api.h" 47 48#include "xf86.h" 49#include "xf86_OSproc.h" 50 51#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(25, 2) 52#include "xf86RamDac.h" 53#else 54#include "xf86Cursor.h" 55#endif 56 57#ifndef WSFB_H 58#define WSFB_H 59 60#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,14,99,2,0) 61#define HAVE_SHADOW_AFB 62#endif 63 64/* private data */ 65typedef struct { 66 int fd; /* file descriptor of open device */ 67 struct wsdisplayio_fbinfo fbi; 68 unsigned char* fbstart; 69 unsigned char* fbmem; 70 size_t fbmem_len; 71 int rotate; 72 Bool shadowFB; 73 void * shadow; 74 Bool HWCursor; 75 Bool useSwap32; 76 Bool useRGB16ToYUY2; 77#ifdef HAVE_SHADOW_AFB 78 Bool planarAfb; 79#endif 80 CloseScreenProcPtr CloseScreen; 81 CreateScreenResourcesProcPtr CreateScreenResources; 82 void (*PointerMoved)(SCRN_ARG_TYPE, int, int); 83 EntityInfoPtr pEnt; 84 struct wsdisplay_cmap saved_cmap; 85 86 struct wsdisplay_cursor cursor; 87 int maskoffset; 88 xf86CursorInfoPtr CursorInfoRec; 89#ifdef XFreeXDGA 90 /* DGA info */ 91 DGAModePtr pDGAMode; 92 int nDGAMode; 93#endif 94 OptionInfoPtr Options; 95} WsfbRec, *WsfbPtr; 96 97#define WSFBPTR(p) ((WsfbPtr)((p)->driverPrivate)) 98 99Bool WsfbSetupCursor(ScreenPtr); 100 101#endif 102