summaryrefslogtreecommitdiffstats
path: root/kernel-headers/linux/bltsville.h
blob: 42256c31f8b0e64e748584d090eb17d7585d3e97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
/*
 * bltsville.h
 *
 * Copyright (C) 2011 Texas Instruments, Inc.
 *
 * This package is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef BLTSVILLE_H
#define BLTSVILLE_H

#include "ocd.h"
#include "bverror.h"
#include "bvblend.h"
#include "bvfilter.h"
#include "bvbuffdesc.h"
#include "bvcache.h"
#include "bventry.h"
#include "bvsurfgeom.h"

/*
 * bvrect - This structure is used to specify rectangles in BLTsville.
 */
struct bvrect {
	int left;
	int top;
	unsigned int width;
	unsigned int height;
};


/*
 * BVFLAG_* - These define the type of BLT to be performed and are placed in
 * the bvparams.flags element.
 */
#define BVFLAG_OP_SHIFT	0
#define BVFLAG_OP_MASK	(0xF << BVFLAG_OP_SHIFT)

/* 0 reserved */
#define BVFLAG_ROP	(0x1 << BVFLAG_OP_SHIFT) /* ROP4 spec'd in rop */
#define BVFLAG_BLEND	(0x2 << BVFLAG_OP_SHIFT) /* blend spec'd in blend */
/* 3 reserved */
#define BVFLAG_FILTER	(0x4 << BVFLAG_OP_SHIFT) /* filter spec'd in filter */
/* 5-F reserved */

#define BVFLAG_KEY_SRC		0x00000010 /* source color key - value spec'd
					      by pcolorkey; Mutually exclusive
					      with BVFLAG_KEY_DST */
#define BVFLAG_KEY_DST		0x00000020 /* dest color key - value spec'd
					      by pcolorkey; Mutually exclusive
					      with BVFLAG_KEY_SRC */
#define BVFLAG_CLIP		0x00000040 /* clipping rectangle spec'd by
					      cliprect */
#define BVFLAG_SRCMASK		0x00000080 /* when scaling a masked copy, mask
					      at the source instead of the
					      (default) destination */

#define BVFLAG_ASYNC		0x00000100 /* call should return once queued */

#define BVFLAG_TILE_SRC1	0x00000200 /* source 1 is tiled */
#define BVFLAG_TILE_SRC2	0x00000400 /* source 2 is tiled */
#define BVFLAG_TILE_MASK	0x00000800 /* mask is tiled */


#define BVFLAG_BATCH_SHIFT	12
#define BVFLAG_BATCH_MASK	(3 << BVFLAG_BATCH_SHIFT)

#define BVFLAG_BATCH_NONE	(0 << BVFLAG_BATCH_SHIFT) /* not batched */
#define BVFLAG_BATCH_BEGIN	(1 << BVFLAG_BATCH_SHIFT) /* begin batch */
#define BVFLAG_BATCH_CONTINUE	(2 << BVFLAG_BATCH_SHIFT) /* continue batch */
#define BVFLAG_BATCH_END	(3 << BVFLAG_BATCH_SHIFT) /* end batch */


#define BVFLAG_HORZ_FLIP_SRC1	0x00004000 /* flip src1 horizontally */
#define BVFLAG_VERT_FLIP_SRC1	0x00008000 /* flip src1 vertically */
#define BVFLAG_HORZ_FLIP_SRC2	0x00010000 /* flip src2 horizontally */
#define BVFLAG_VERT_FLIP_SRC2	0x00020000 /* flip src2 vertically */
#define BVFLAG_HORZ_FLIP_MASK	0x00040000 /* flip mask horizontally */
#define BVFLAG_VERT_FLIP_MASK	0x00080000 /* flip mask vertically */


#define BVFLAG_SCALE_RETURN	0x00100000 /* return scale type used */
#define BVFLAG_DITHER_RETURN	0x00200000 /* return dither type used */
/**** Bits 31-22 reserved ****/

/*
 * BVIMPL_* - BLTsville implementations may be combined under managers to
 * allow clients to take advantage of multiple implementations without doing
 * so explicitly.  The BVIMPL_* definition are placed into the
 * bvparams.implementation member by the client to override the manager's
 * choice of implementation.
 */
#define BVIMPL_ANY		0
#define BVIMPL_FIRST_HW		(1 << 31) /* Continues to the right */
#define BVIMPL_FIRST_CPU	(1 << 0)  /* Continues to the left */


/*
 * bvscalemode - This specifies the type of scaling to perform.
 */
#define BVSCALEDEF_VENDOR_SHIFT 24
#define BVSCALEDEF_VENDOR_MASK (0xFF << BVSCALEDEF_VENDOR_SHIFT)

#define BVSCALEDEF_VENDOR_ALL (0 << BVSCALEDEF_VENDOR_SHIFT)
#define BVSCALEDEF_VENDOR_TI  (1 << BVSCALEDEF_VENDOR_SHIFT)
/* 0xF0-0xFE reserved */
#define BVSCALEDEF_VENDOR_GENERIC (0xFF << BVSCALEDEF_VENDOR_SHIFT)

/***** VENDOR_GENERIC definitions *****/
/**** Bits 23-22 indicate classification ****/
#define BVSCALEDEF_CLASS_SHIFT	22
#define BVSCALEDEF_IMPLICIT	(0 << BVSCALEDEF_CLASS_SHIFT)
#define BVSCALEDEF_EXPLICIT	(1 << BVSCALEDEF_CLASS_SHIFT)
/* 2-3 reserved */
#define BVSCALEDEF_CLASS_MASK	(3 << BVSCALEDEF_CLASS_MASK)

/**** IMPLICIT definitions ****/
/*** Bits 21-16 indicate the quality (speed) desired ***/
#define BVSCALEDEF_QUALITY_SHIFT 16
#define BVSCALEDEF_FASTEST	(0x00 << BVSCALEDEF_QUALITY_SHIFT)
#define BVSCALEDEF_GOOD		(0x15 << BVSCALEDEF_QUALITY_SHIFT)
#define BVSCALEDEF_BETTER	(0x2A << BVSCALEDEF_QUALITY_SHIFT)
#define BVSCALEDEF_BEST		(0x3F << BVSCALEDEF_QUALITY_SHIFT)
#define BVSCALEDEF_QUALITY_MASK	(0x3F << BVSCALEDEF_QUALITY_MASK)
/* Bits 15-12 are reserved */
/*** Bits 11-8 indicate the desired technique ***/
#define BVSCALEDEF_TECHNIQUE_SHIFT 8
#define BVSCALEDEF_DONT_CARE	(0x0 << BVSCALEDEF_TECHNIQUE_SHIFT)
#define BVSCALEDEF_NOT_NEAREST_NEIGHBOR	(0x1 << BVSCALEDEF_TECHNIQUE_SHIFT)
#define BVSCALEDEF_POINT_SAMPLE	(0x2 << BVSCALEDEF_TECHNIQUE_SHIFT)
#define BVSCALEDEF_INTERPOLATED	(0x3 << BVSCALEDEF_TECHNIQUE_SHIFT)
#define BVSCALEDEF_TECHNIQUE_MASK	(0xF << BVSCALEDEF_TECHNIQUE_SHIFT)
/* Bits 7-2 reserved */
/*** Bits 1-0 indicate the type of image ***/
#define BVSCALEDEF_TYPE_SHIFT 0
/* 0 don't know */
#define BVSCALEDEF_PHOTO	(1 << BVSCALEDEF_TYPE_SHIFT)
#define BVSCALEDEF_DRAWING	(2 << BVSCALEDEF_TYPE_SHIFT)
/* 3 reserved */
#define BVSCALEDEF_TYPE_MASK	(3 << BVSCALEDEF_TYPE_MASK)

/**** EXPLICIT definitions ****/
/* Bits 21-16 reserved */
#define BVSCALEDEF_HORZ_SHIFT	8
#define BVSCALEDEF_HORZ_MASK	(0xFF << BVSCALEDEF_HORZ_SHIFT)

#define BVSCALEDEF_VERT_SHIFT	0
#define BVSCALEDEF_VERT_MASK	(0xFF << BVSCALEDEF_VERT_SHIFT)

#define BVSCALEDEF_NEAREST_NEIGHBOR	0x00
#define BVSCALEDEF_LINEAR		0x01
#define BVSCALEDEF_CUBIC		0x02
#define	BVSCALEDEF_3_TAP		0x03
/* 0x04 reserved */
#define BVSCALEDEF_5_TAP		0x05
/* 0x06 reserved */
#define BVSCALEDEF_7_TAP		0x07
/* 0x08 reserved */
#define BVSCALEDEF_9_TAP		0x09
/* 0x0A-0xFF reserved */

enum bvscalemode {
	BVSCALE_FASTEST =	BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_FASTEST |
				BVSCALEDEF_DONT_CARE,
	BVSCALE_FASTEST_NOT_NEAREST_NEIGHBOR = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_FASTEST |
				BVSCALEDEF_NOT_NEAREST_NEIGHBOR,
	BVSCALE_FASTEST_POINT_SAMPLE = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_FASTEST |
				BVSCALEDEF_POINT_SAMPLE,
	BVSCALE_FASTEST_INTERPOLATED = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_FASTEST |
				BVSCALEDEF_INTERPOLATED,
	BVSCALE_FASTEST_PHOTO =	BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_FASTEST |
				BVSCALEDEF_PHOTO,
	BVSCALE_FASTEST_DRAWING = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_FASTEST |
				BVSCALEDEF_DRAWING,
	BVSCALE_GOOD =		BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_GOOD |
				BVSCALEDEF_DONT_CARE,
	BVSCALE_GOOD_POINT_SAMPLE = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_GOOD |
				BVSCALEDEF_POINT_SAMPLE,
	BVSCALE_GOOD_INTERPOLATED = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_GOOD |
				BVSCALEDEF_INTERPOLATED,
	BVSCALE_GOOD_PHOTO =	BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_GOOD |
				BVSCALEDEF_PHOTO,
	BVSCALE_GOOD_DRAWING =	BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_GOOD |
				BVSCALEDEF_DRAWING,
	BVSCALE_BETTER =	BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BETTER |
				BVSCALEDEF_DONT_CARE,
	BVSCALE_BETTER_POINT_SAMPLE = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BETTER |
				BVSCALEDEF_POINT_SAMPLE,
	BVSCALE_BETTER_INTERPOLATED = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BETTER |
				BVSCALEDEF_INTERPOLATED,
	BVSCALE_BETTER_PHOTO =	BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BETTER |
				BVSCALEDEF_PHOTO,
	BVSCALE_BETTER_DRAWING = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BETTER |
				BVSCALEDEF_DRAWING,
	BVSCALE_BEST =		BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BEST |
				BVSCALEDEF_DONT_CARE,
	BVSCALE_BEST_POINT_SAMPLE = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BEST |
				BVSCALEDEF_POINT_SAMPLE,
	BVSCALE_BEST_INTERPOLATED = BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BEST |
				BVSCALEDEF_INTERPOLATED,
	BVSCALE_BEST_PHOTO =	BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BEST |
				BVSCALEDEF_PHOTO,
	BVSCALE_BEST_DRAWING =	BVSCALEDEF_VENDOR_ALL |
				BVSCALEDEF_IMPLICIT |
				BVSCALEDEF_BEST |
				BVSCALEDEF_DRAWING,

	BVSCALE_NEAREST_NEIGHBOR = BVSCALEDEF_VENDOR_GENERIC |
		BVSCALEDEF_EXPLICIT |
		(BVSCALEDEF_NEAREST_NEIGHBOR << BVSCALEDEF_HORZ_SHIFT) |
		(BVSCALEDEF_NEAREST_NEIGHBOR << BVSCALEDEF_VERT_SHIFT),
	BVSCALE_BILINEAR = BVSCALEDEF_VENDOR_GENERIC |
		BVSCALEDEF_EXPLICIT |
		(BVSCALEDEF_LINEAR << BVSCALEDEF_HORZ_SHIFT) |
		(BVSCALEDEF_LINEAR << BVSCALEDEF_VERT_SHIFT),
	BVSCALE_BICUBIC = BVSCALEDEF_VENDOR_GENERIC |
		BVSCALEDEF_EXPLICIT |
		(BVSCALEDEF_CUBIC << BVSCALEDEF_HORZ_SHIFT) |
		(BVSCALEDEF_CUBIC << BVSCALEDEF_VERT_SHIFT),
	BVSCALE_3x3_TAP = BVSCALEDEF_VENDOR_GENERIC |
		BVSCALEDEF_EXPLICIT |
		(BVSCALEDEF_3_TAP << BVSCALEDEF_HORZ_SHIFT) |
		(BVSCALEDEF_3_TAP << BVSCALEDEF_VERT_SHIFT),
	BVSCALE_5x5_TAP = BVSCALEDEF_VENDOR_GENERIC |
		BVSCALEDEF_EXPLICIT |
		(BVSCALEDEF_5_TAP << BVSCALEDEF_HORZ_SHIFT) |
		(BVSCALEDEF_5_TAP << BVSCALEDEF_VERT_SHIFT),
	BVSCALE_7x7_TAP = BVSCALEDEF_VENDOR_GENERIC |
		BVSCALEDEF_EXPLICIT |
		(BVSCALEDEF_7_TAP << BVSCALEDEF_HORZ_SHIFT) |
		(BVSCALEDEF_7_TAP << BVSCALEDEF_VERT_SHIFT),
	BVSCALE_9x9_TAP = BVSCALEDEF_VENDOR_GENERIC |
		BVSCALEDEF_EXPLICIT |
		(BVSCALEDEF_9_TAP << BVSCALEDEF_HORZ_SHIFT) |
		(BVSCALEDEF_9_TAP << BVSCALEDEF_VERT_SHIFT),

#ifdef BVSCALE_EXTERNAL_INCLUDE
#include BVSCALE_EXTERNAL_INCLUDE
#endif
};


/*
 * bvdithermode - This defines the type of dithering to use.
 */
#define BVDITHERDEF_VENDOR_SHIFT 24
#define BVDITHERDEF_VENDOR_MASK (0xFF << BVDITHERDEF_VENDOR_SHIFT)

#define BVDITHERDEF_VENDOR_ALL (0 << BVDITHERDEF_VENDOR_SHIFT)
#define BVDITHERDEF_VENDOR_TI  (1 << BVDITHERDEF_VENDOR_SHIFT)
/* 0xF0-0xFE reserved */
#define BVDITHERDEF_VENDOR_GENERIC (0xFF << BVDITHERDEF_VENDOR_SHIFT)

/***** VENDOR_GENERIC definitions *****/
/* Bits 23-18 reserved */
/**** Bits 17-16 indicate the type of image - 0 = don't know ****/
#define BVDITHERDEF_TYPE_SHIFT 16
#define BVDITHERDEF_PHOTO	(0x01 << BVDITHERDEF_TYPE_SHIFT)
#define BVDITHERDEF_DRAWING	(0x02 << BVDITHERDEF_TYPE_SHIFT)
/**** Bits 15-8 indicate the desired technique ****/
#define BVDITHERDEF_TECHNIQUE_SHIFT 8
#define BVDITHERDEF_DONT_CARE	(0x00 << BVDITHERDEF_TECHNIQUE_SHIFT)
#define BVDITHERDEF_RANDOM	(0x01 << BVDITHERDEF_TECHNIQUE_SHIFT)
#define BVDITHERDEF_ORDERED	(0x02 << BVDITHERDEF_TECHNIQUE_SHIFT)
#define BVDITHERDEF_DIFFUSED	(0x04 << BVDITHERDEF_TECHNIQUE_SHIFT)
#define BVDITHERDEF_ON		(0xFF << BVDITHERDEF_TECHNIQUE_SHIFT)
/**** Bits 7-0 indicate the quality (speed) desired ****/
#define BVDITHERDEF_QUALITY_SHIFT 0
#define BVDITHERDEF_FASTEST	(0x00 << BVDITHERDEF_QUALITY_SHIFT)
#define BVDITHERDEF_GOOD	(0x55 << BVDITHERDEF_QUALITY_SHIFT)
#define BVDITHERDEF_BETTER	(0xAA << BVDITHERDEF_QUALITY_SHIFT)
#define BVDITHERDEF_BEST	(0xFF << BVDITHERDEF_QUALITY_SHIFT)

enum bvdithermode {
	BVDITHER_FASTEST =	BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_FASTEST |
				BVDITHERDEF_DONT_CARE,
	BVDITHER_FASTEST_ON =	BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_FASTEST |
				BVDITHERDEF_ON,
	BVDITHER_FASTEST_RANDOM = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_FASTEST |
				BVDITHERDEF_RANDOM,
	BVDITHER_FASTEST_ORDERED = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_FASTEST |
				BVDITHERDEF_ORDERED,
	BVDITHER_FASTEST_DIFFUSED = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_FASTEST |
				BVDITHERDEF_DIFFUSED,
	BVDITHER_FASTEST_PHOTO = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_FASTEST |
				BVDITHERDEF_PHOTO,
	BVDITHER_FASTEST_DRAWING = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_FASTEST |
				BVDITHERDEF_DRAWING,
	BVDITHER_GOOD =		BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_GOOD |
				BVDITHERDEF_DONT_CARE,
	BVDITHER_GOOD_ON =	BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_GOOD |
				BVDITHERDEF_ON,
	BVDITHER_GOOD_RANDOM = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_GOOD |
				BVDITHERDEF_RANDOM,
	BVDITHER_GOOD_ORDERED = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_GOOD |
				BVDITHERDEF_ORDERED,
	BVDITHER_GOOD_DIFFUSED = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_GOOD |
				BVDITHERDEF_DIFFUSED,
	BVDITHER_GOOD_PHOTO =	BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_GOOD |
				BVDITHERDEF_PHOTO,
	BVDITHER_GOOD_DRAWING = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_GOOD |
				BVDITHERDEF_DRAWING,
	BVDITHER_BETTER =	BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BETTER |
				BVDITHERDEF_DONT_CARE,
	BVDITHER_BETTER_ON =	BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BETTER |
				BVDITHERDEF_ON,
	BVDITHER_BETTER_RANDOM = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BETTER |
				BVDITHERDEF_RANDOM,
	BVDITHER_BETTER_ORDERED = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BETTER |
				BVDITHERDEF_ORDERED,
	BVDITHER_BETTER_DIFFUSED = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BETTER |
				BVDITHERDEF_DIFFUSED,
	BVDITHER_BETTER_PHOTO =	BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BETTER |
				BVDITHERDEF_PHOTO,
	BVDITHER_BETTER_DRAWING = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BETTER |
				BVDITHERDEF_DRAWING,
	BVDITHER_BEST =		BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BEST |
				BVDITHERDEF_DONT_CARE,
	BVDITHER_BEST_ON =	BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BEST |
				BVDITHERDEF_ON,
	BVDITHER_BEST_RANDOM = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BEST |
				BVDITHERDEF_RANDOM,
	BVDITHER_BEST_ORDERED = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BEST |
				BVDITHERDEF_ORDERED,
	BVDITHER_BEST_DIFFUSED = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BEST |
				BVDITHERDEF_DIFFUSED,
	BVDITHER_BEST_PHOTO = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BEST |
				BVDITHERDEF_PHOTO,
	BVDITHER_BEST_DRAWING = BVDITHERDEF_VENDOR_ALL |
				BVDITHERDEF_BEST |
				BVDITHERDEF_DRAWING,

	BVDITHER_NONE =		BVDITHERDEF_VENDOR_GENERIC + 0,
	BVDITHER_ORDERED_2x2 =	BVDITHERDEF_VENDOR_GENERIC + 4,
	BVDITHER_ORDERED_4x4 =	BVDITHERDEF_VENDOR_GENERIC + 16,
	BVDITHER_ORDERED_2x2_4x4 = BVDITHERDEF_VENDOR_GENERIC + 4 + 16,
					/* 2x2 for 6->8, 4x4 for 5->8 */

#ifdef BVDITHER_EXTERNAL_INCLUDE
#include BVDITHER_EXTERNAL_INCLUDE
#endif
};


/*
 * BVTILE_* flags - These specify parameters used when tiling.
 */
#define BVTILE_LEFT_SHIFT    0
#define BVTILE_TOP_SHIFT     (BVTILE_LEFT_SHIFT + 2)
#define BVTILE_RIGHT_SHIFT   (BVTILE_TOP_SHIFT + 2)
#define BVTILE_BOTTOM_SHIFT  (BVTILE_RIGHT_SHIFT + 2)
#define BVTILE_LEFT_REPEAT   (0 << BVTILE_LEFT_SHIFT)	/* ...012301230123 */
#define BVTILE_TOP_REPEAT    (0 << BVTILE_TOP_SHIFT)	/* ...012301230123 */
#define BVTILE_RIGHT_REPEAT  (0 << BVTILE_RIGHT_SHIFT)	/* 012301230123... */
#define BVTILE_BOTTOM_REPEAT (0 << BVTILE_BOTTOM_SHIFT)	/* 012301230123... */
#define BVTILE_LEFT_MIRROR   (1 << BVTILE_LEFT_SHIFT)	/* ...012332100123 */
#define BVTILE_TOP_MIRROR    (1 << BVTILE_TOP_SHIFT)	/* ...012332100123 */
#define BVTILE_RIGHT_MIRROR  (1 << BVTILE_RIGHT_SHIFT)	/* 012332100123... */
#define BVTILE_BOTTOM_MIRROR (1 << BVTILE_BOTTOM_SHIFT)	/* 012332100123... */

/*
 * bvtileparams - This structure provides additional parameters needed when
 * tiling.  This structure replaces the bvbuffdesc in bvbltparams when the
 * associated BVFLAG_TILE_* flag is set in bvbltparams.flags.
 */
struct bvtileparams {
	unsigned int structsize; /* used to ID structure version */
	unsigned long flags;	 /* tile flags */
	void *virtaddr;		 /* pointer to the brush */
	int dstleft;		 /* horizontal offset */
	int dsttop;		 /* vertical offset */
	unsigned int srcwidth;	 /* w/dst width to spec horz scale */
	unsigned int srcheight;	 /* w/dst height to spec vert scale */
};

/*
 * BVBATCH_* - These flags specify the parameters that change between
 * batched BLTs, when BVFLAG_CONTINUE or BVFLAG_END set.
 */
#define BVBATCH_OP		0x00000001 /* type of operation changed */
#define BVBATCH_KEY		0x00000002 /* color key changed */
#define BVBATCH_MISCFLAGS	0x00000004 /* other flags changed */
#define BVBATCH_ALPHA		0x00000008 /* global alpha changed */
#define BVBATCH_DITHER		0x00000010 /* dither changed */
#define BVBATCH_SCALE		0x00000020 /* scaling type changed */
/* Bits 6-7 reserved */
#define BVBATCH_DST		0x00000100 /* destination surface changed */
#define BVBATCH_SRC1		0x00000200 /* source 1 surface changed */
#define BVBATCH_SRC2		0x00000400 /* source 2 surface changed */
#define BVBATCH_MASK		0x00000800 /* mask surface changed */
#define BVBATCH_DSTRECT_ORIGIN	0x00001000 /* dest rect origin changed */
#define BVBATCH_DSTRECT_SIZE	0x00002000 /* dest rect dimensions changed */
#define BVBATCH_SRC1RECT_ORIGIN	0x00004000 /* src 1 rect origin changed */
#define BVBATCH_SRC1RECT_SIZE	0x00008000 /* src 1 rect dimensions changed */
#define BVBATCH_SRC2RECT_ORIGIN	0x00010000 /* src 2 rect origin changed */
#define BVBATCH_SRC2RECT_SIZE	0x00020000 /* src 2 rect dimensions changed */
#define BVBATCH_MASKRECT_ORIGIN	0x00040000 /* mask rect origin changed */
#define BVBATCH_MASKRECT_SIZE	0x00080000 /* mask rect dimensions changed */
#define BVBATCH_CLIPRECT_ORIGIN	0x00100000 /* Clip rect origin changed */
#define BVBATCH_CLIPRECT_SIZE	0x00200000 /* Clip rect dimensions changed */
#define BVBATCH_CLIPRECT	(BVBATCH_CLIPRECT_ORIGIN | \
				 BVBATCH_CLIPRECT_SIZE)	/* clip rect... */
							/* ...changed */
#define BVBATCH_TILE_SRC1	0x00400000 /* tile params for src 1 changed */
#define BVBATCH_TILE_SRC2	0x00800000 /* tile params for src 2 changed */
#define BVBATCH_TILE_MASK	0x00100000 /* tile params for mask changed */
/* Bits 30-21 reserved */
#define BVBATCH_ENDNOP		0x80000000 /* just end batch, don't do BLT;
					      only with BVFLAG_BATCH_END */

/*
 * bvcallbackerror - This structure is passed into the callback function
 * if an error occurs.
 */
struct bvcallbackerror {
	unsigned int structsize;	/* used to ID structure version */
	enum bverror error;		/* error during async BLT */
	char *errdesc;			/* 0-terminated ASCII string
					   with extended error info (not
					   for end users) */
};

/*
 * bvbatch - an implementation-specific container for batch information;
 * not used by client; forward declaration here
 */
struct bvbatch;

/*
 * bvinbuff - provides the buffer in bvbltparams
 */
union bvinbuff {
	struct bvbuffdesc *desc;	 /* buffer description when
					    associated BVFLAG_TILE_*
					    is not set */
	struct bvtileparams *tileparams; /* tile params when associated
					    BVFLAG_TILE_* flag is set */
};

/*
 * bvop - used to hold the operation in bvbltparams
 */
union bvop {
	unsigned short rop;		/* when BVFLAG_ROP set */
	enum bvblend blend;		/* when BVFLAG_BLEND set */
	struct bvfilter *filter;	/* when BVFLAG_FILTER set */
};


/*
 * bvbltparams - This structure is passed into bv_blt() to specify the
 * parameters for a BLT.
 */
struct bvbltparams {
	unsigned int structsize;	/* (i) used to ID structure version */
	char *errdesc;			/* (o) 0-terminated ASCII string
					       with extended error info (not
					       for end users) */

	unsigned long implementation;	/* (i) override manager choice */

	unsigned long flags;		/* (i) see BVFLAG_* above */

	union bvop op;			/* (i) operation; determined by
					       BVFLAG_OP_MASK bits in flags */

	void *colorkey;			/* (i) pointer to color key pixel
					       matching non-SUBSAMPLE format
					       of the keyed surface when
					       BVFLAG_KEY_* is set */

	union bvalpha globalalpha;	/* (i) global alpha when BVFLAG_BLEND
					       set in flags and
					       BVBLENDDEF_GLOBAL_* is set in
					       blend; typed determined by
					       BVBLENDDEF_GLOBAL_* */

	enum bvscalemode scalemode;	/* (i/o) type of scaling */
	enum bvdithermode dithermode;	/* (i/o) type of dither */

	struct bvbuffdesc *dstdesc;	/* (i) dest after bv_map() */
	struct bvsurfgeom *dstgeom;	/* (i) dest surf fmt and geometry */
	struct bvrect dstrect;		/* (i) rect into which data written */

	union bvinbuff src1;		/* (i) src1 buffer */
	struct bvsurfgeom *src1geom;	/* (i) src1 surf fmt and geometry */
	struct bvrect src1rect;		/* (i) rect from which data is read */

	union bvinbuff src2;		/* (i) src2 buffer */
	struct bvsurfgeom *src2geom;	/* (i) src2 surf fmt and geometry */
	struct bvrect src2rect;		/* (i) rect from which data is read */

	union bvinbuff mask;		/* (i) mask buffer */
	struct bvsurfgeom *maskgeom;	/* (i) mask surf fmt and geometry */
	struct bvrect maskrect;		/* (i) rect from which data is read */

	struct bvrect cliprect;		/* (i) dest clipping rect when
					       BVFLAG_CLIP flag set */

	unsigned long batchflags;	/* (i) BVBATCH_* flags used to
					       indicate params changed between
					       batch BLTs */
	struct bvbatch *batch;		/* (i/o) handle for associated batch;
						 returned when
						 BVFLAG_BATCH_BEGIN set;
						 provided to subsequent BLTs
						 with BVFLAG_BATCH_CONTINUE */

	void (*callbackfn)(struct bvcallbackerror *err,
			   unsigned long callbackdata); /* (i) callback
							 function when
							 BVFLAG_ASYNC is set -
							 err is 0 when no
							 error; handle contains
							 callbackdata below */
	unsigned long callbackdata;	/* (i) callback data */
};

#endif /* BLTSVILLE_H */