crime.h revision 34c4e112
1/* $NetBSD: crime.h,v 1.2 2009/02/19 20:03:30 macallan Exp $ */
2/*
3 * Copyright (c) 2008 Michael Lorenz
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#include <fcntl.h>
33#include <sys/types.h>
34#include <sys/time.h>
35#include <dev/wscons/wsconsio.h>
36#include <dev/crmfbreg.h>
37
38#include "xf86.h"
39#include "xf86_OSproc.h"
40#include "xf86_ansic.h"
41
42#include "xf86RamDac.h"
43#include "xaa.h"
44
45#ifndef CRIME_H
46#define CRIME_H
47
48#define CRIME_DEBUG
49
50#define CRIME_DEBUG_LINES		0x00000001
51#define CRIME_DEBUG_BITBLT		0x00000002
52#define CRIME_DEBUG_RECTFILL		0x00000004
53#define CRIME_DEBUG_IMAGEWRITE		0x00000008
54#define CRIME_DEBUG_COLOUREXPAND	0x00000010
55#define CRIME_DEBUG_CLIPPING		0x00000020
56#define CRIME_DEBUG_SYNC		0x00000040
57#define CRIME_DEBUG_XRENDER		0x00000080
58#define CRIME_DEBUG_ALL			0xffffffff
59#define CRIME_DEBUG_MASK (/*CRIME_DEBUG_IMAGEWRITE*/0)
60
61#ifdef CRIME_DEBUG
62#define LOG(x) if (x & CRIME_DEBUG_MASK) xf86Msg(X_ERROR, "%s\n", __func__)
63#define DONE(x) if (x & CRIME_DEBUG_MASK) \
64		 xf86Msg(X_ERROR, "%s done\n", __func__)
65#else
66#define LOG(x)
67#define DONE(x)
68#endif
69
70/* private data */
71typedef struct {
72	int			fd; /* file descriptor of open device */
73	struct wsdisplay_fbinfo info; /* frame buffer characteristics */
74	Bool			HWCursor;
75	CloseScreenProcPtr	CloseScreen;
76	EntityInfoPtr		pEnt;
77
78	struct wsdisplay_cursor cursor;
79	int			maskoffset;
80	xf86CursorInfoPtr	CursorInfoRec;
81	OptionInfoPtr		Options;
82
83	XAAInfoRecPtr		pXAA;
84	void			*engine;
85	char			*linear;
86	void			*fb;
87	unsigned char		*buffers[8];
88	unsigned char		*expandbuffers[1];
89	int			ux, uy, uw, uh, us, um;
90	int			start, xdir, ydir;
91	int			format;
92	int			use_mte;
93	uint32_t		expand[2048];
94	uint32_t		alpha_color;
95	int			texture_depth;
96	unsigned char		*alpha_texture;
97	void			*src, *msk;
98} CrimeRec, *CrimePtr;
99
100#define CRIMEPTR(p) ((CrimePtr)((p)->driverPrivate))
101
102Bool CrimeSetupCursor(ScreenPtr);
103int CrimeAccelInit(ScrnInfoPtr);
104
105#endif
106