crime.h revision 556200c8
1/* $NetBSD: crime.h,v 1.8 2022/07/15 04:30:05 mrg 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
41#if ABI_VIDEODRV_VERSION < SET_ABI_VERSION(25, 2)
42#include "xf86RamDac.h"
43#else
44#include "xf86Cursor.h"
45#endif
46#include "xaa.h"
47
48#ifndef CRIME_H
49#define CRIME_H
50
51/*#define CRIME_DEBUG*/
52
53#define CRIME_DEBUG_LINES		0x00000001
54#define CRIME_DEBUG_BITBLT		0x00000002
55#define CRIME_DEBUG_RECTFILL		0x00000004
56#define CRIME_DEBUG_IMAGEWRITE		0x00000008
57#define CRIME_DEBUG_COLOUREXPAND	0x00000010
58#define CRIME_DEBUG_CLIPPING		0x00000020
59#define CRIME_DEBUG_SYNC		0x00000040
60#define CRIME_DEBUG_XRENDER		0x00000080
61#define CRIME_DEBUG_IMAGEREAD		0x00000100
62#define CRIME_DEBUG_ALL			0xffffffff
63#define CRIME_DEBUG_MASK 0
64
65#ifdef CRIME_DEBUG
66#define LOG(x) if (x & CRIME_DEBUG_MASK) xf86Msg(X_ERROR, "%s\n", __func__)
67#define DONE(x) if (x & CRIME_DEBUG_MASK) \
68		 xf86Msg(X_ERROR, "%s done\n", __func__)
69#else
70#define LOG(x)
71#define DONE(x)
72#endif
73
74/* private data */
75typedef struct {
76	int			fd; /* file descriptor of open device */
77	struct wsdisplay_fbinfo info; /* frame buffer characteristics */
78	Bool			HWCursor;
79	CloseScreenProcPtr	CloseScreen;
80	EntityInfoPtr		pEnt;
81
82	struct wsdisplay_cursor cursor;
83	int			maskoffset;
84	xf86CursorInfoPtr	CursorInfoRec;
85	OptionInfoPtr		Options;
86
87	XAAInfoRecPtr		pXAA;
88	void			*engine;
89	char			*linear;
90	void			*fb;
91	unsigned char		*buffers[8];
92	unsigned char		*expandbuffers[1];
93	int			ux, uy, uw, uh, us, um;
94	int			start, xdir, ydir;
95	int			format;
96	int			use_mte;
97	int			cxa, cxe, cya, cye;
98	uint32_t		expand[2048];
99	uint32_t		pattern[8];
100	uint32_t		alpha_color;
101	int			texture_depth;
102	unsigned char		*alpha_texture;
103	void			*src, *msk;
104} CrimeRec, *CrimePtr;
105
106#define CRIMEPTR(p) ((CrimePtr)((p)->driverPrivate))
107
108Bool CrimeSetupCursor(ScreenPtr);
109int CrimeAccelInit(ScrnInfoPtr);
110
111#endif
112