1
/*****************************************************************************
3
* SOURCE FILE NAME = GRADD.H
5
* DESCRIPTIVE NAME = Structures and defines for the GRADD Architecture
7
* Copyright : COPYRIGHT IBM CORPORATION, 1996
8
* LICENSED MATERIAL - PROGRAM PROPERTY OF IBM
9
* REFER TO COPYRIGHT INSTRUCTION FORM#G120-2083
11
* ==========================================================================
16
* This file contains all of the defines and
17
* data structures that are shared between the
18
* video manager and the translation layers.
31
* DATE FLAG APAR CHANGE DESCRIPTION
32
* -------- ---------- ----- --------------------------------------
33
* mm/dd/yy @Vr.mpppxx xxxxx xxxxxxx
35
****************************************************************************/
37
#ifndef GRADD_INCLUDED
38
#define GRADD_INCLUDED
42
** Prototype declarations for low level driver function call table.
44
typedef ULONG CID; // Chain ID
45
typedef ULONG GrID; // Gradd ID
47
#define GrID_DONTCARE 0xffffffff
49
typedef ULONG (EXPENTRY FNHWCMD)(PVOID, PVOID);
50
typedef ULONG (EXPENTRY FNHWENTRY)(GrID, ULONG, PVOID, PVOID);
51
typedef ULONG (EXPENTRY FNSDBITBLT)(PVOID, PVOID);
52
typedef ULONG (EXPENTRY FNSDLINE)(PVOID, PVOID);
54
typedef FNHWENTRY * PFNHWENTRY;
60
#define FOURCC( ch0, ch1, ch2, ch3 ) \
61
( (ULONG)(BYTE)(ch0) | ( (ULONG)(BYTE)(ch1) << 8 ) | \
62
( (ULONG)(BYTE)(ch2) << 16 ) | ((ULONG)(BYTE)(ch3) << 24 ) )
64
#define FOURCC_LUT8 FOURCC('L','U','T','8') // 8-bit palettized
65
#define FOURCC_R565 FOURCC('R','5','6','5') // RGB 565
66
#define FOURCC_R555 FOURCC('R','5','5','5') // RGB 555
67
#define FOURCC_R666 FOURCC('R','6','6','6') // RGB 666
68
#define FOURCC_R664 FOURCC('R','6','6','4') // RGB 664
69
#define FOURCC_RGB3 FOURCC('R','G','B','3') // RGB 24 in 3 bytes
70
#define FOURCC_BGR3 FOURCC('B','G','R','3') // BGR 24 in 3 bytes
71
#define FOURCC_RGB4 FOURCC('R','G','B','4') // RGB 24 in 4 bytes
72
#define FOURCC_BGR4 FOURCC('B','G','R','4') // BGR 24 in 4 bytes
73
#define FOURCC_Y888 FOURCC('Y','8','8','8') // YUV 24
74
#define FOURCC_Y411 FOURCC('Y','4','1','1') // YUV 411 interleaved 4 by 1 subsampled
75
#define FOURCC_Y422 FOURCC('Y','4','2','2') // YUV 422 (CCIR601)
76
#define FOURCC_YUV9 FOURCC('Y','U','V','9') // YUV9
77
#define FOURCC_Y2X2 FOURCC('Y','2','X','2') // YUV 2 by 2 subsampled multi-plane
78
#define FOURCC_Y4X4 FOURCC('Y','4','X','4') // YUV 4 by 4 subsampled multi-plane
80
typedef struct _GDDMODEINFO { /* gddmodeinfo */
82
ULONG ulModeId; /* used to make SETMODE request */
83
ULONG ulBpp; /* no of colors (bpp) */
84
ULONG ulHorizResolution; /* horizontal pels */
85
ULONG ulVertResolution; /* vertical scan lines */
86
ULONG ulRefreshRate; /* in Hz (0 if not available) */
87
PBYTE pbVRAMPhys; /* physical address of VRAM */
88
ULONG ulApertureSize; /* Current bank size */
89
ULONG ulScanLineSize; /* size (in bytes) of one scan line */
90
ULONG fccColorEncoding; /* Pel format (defines above */
91
ULONG ulTotalVRAMSize; /* Total size of VRAM in bytes */
92
ULONG cColors; /* Total number of colors */
94
typedef GDDMODEINFO *PGDDMODEINFO;
97
** Structure for HWEntry router, see gdddata.c for array.
99
typedef struct _HWCMD { /* hwcmd */
101
ULONG ulRc; /* return code if pfnHWCmd is NULL */
102
/* ring change otherwise */
104
typedef HWCMD *PHWCMD;
113
** Prototype declarations for low level driver routines
118
** Graphics Hardware Interface (GHI) commands for
119
** the Base Function class.
121
#define BASE_FUNCTION_CLASS "Base Function"
123
#define GHI_CMD_INIT 0
124
#define GHI_CMD_INITPROC 1
125
#define GHI_CMD_TERM 2
126
#define GHI_CMD_TERMPROC 3
127
#define GHI_CMD_QUERYCAPS 4
128
#define GHI_CMD_QUERYMODES 5
129
#define GHI_CMD_SETMODE 6
130
#define GHI_CMD_PALETTE 7
131
#define GHI_CMD_BITBLT 8
132
#define GHI_CMD_LINE 9
133
#define GHI_CMD_MOVEPTR 10
134
#define GHI_CMD_SETPTR 11
135
#define GHI_CMD_SHOWPTR 12
136
#define GHI_CMD_VRAM 13
137
#define GHI_CMD_REQUESTHW 14
138
#define GHI_CMD_EVENT 15
139
#define GHI_CMD_EXTENSION 16
140
#define GHI_CMD_BANK 17
141
#define GHI_CMD_TEXT 18
142
#define GHI_CMD_USERCAPS 19
143
#define GHI_CMD_POLYGON 20
144
#define GHI_CMD_MAX 21
147
** Defines and structures for the GHI_CMD_INIT DDI
149
typedef struct _GDDINITIN { /* gddinitin */
151
PFNHWENTRY pfnChainedHWEntry;
153
typedef GDDINITIN *PGDDINITIN;
155
typedef struct _GDDINITOUT { /* gddinitout */
157
ULONG cFunctionClasses;
159
typedef GDDINITOUT *PGDDINITOUT;
162
** Defines and structures for the GHI_CMD_INITPROC DDI
164
typedef struct _INITPROCOUT { /* initprocout */
168
typedef INITPROCOUT *PINITPROCOUT;
171
** Defines and structures for the GHI_CMD_QUERYCAPS DDI
173
typedef struct _CAPSINFO { /* capsinfo */
174
ULONG ulLength; /* sizeof CAPSINFO structure */
175
PSZ pszFunctionClassID; /* Name describing function set */
176
ULONG ulFCFlags; /* Function class specific flags */
178
typedef CAPSINFO *PCAPSINFO;
181
** Defines for ulFCFlags field of the CAPSINFO data structure
182
** NOTE: The flags below are GRADD Caps for the base function class.
184
#define GC_SEND_MEM_TO_MEM 0x00000001 // GRADD wants to see M2M blits
185
#define GC_SIM_SRC_PAT_ROPS 0x00000002 // GRADD wants to simulate 3way rops as sequence of 2way rops.
186
//RESERVED - NOT USED NOW
187
#define GC_ALPHA_SUPPORT 0x00000004 // GRADD supports alpha blending rules and
189
// If this flag is not returned,
190
// VMAN will never call the Gradd for
192
// SHOULD match DS2_* in pmddi.h
193
#define GC_SRC_STRETCH 0x00000008 // GRADD handles stretchblts
194
#define GC_POLYGON_SIZE_ANY 0x00000010 // GRADD can handle polygon(concave or convex)
196
// GC_POLYGON_FILL must be set
197
#define GC_CLIP 0x00000020 // GRADD can handle single clip rect of
198
// polygons for pfnPolygon and
199
// source bitmap for pfnBitblt with
200
// GC_SRC_STRETCH set.
201
// see GC_CLP_COMPLEX
202
#define GC_CLIP_COMPLEX 0x00000040 // GRADD can handle clipping
203
// with more than one clip rect
204
// GC_CLIP must be set.
208
/* following defines GC_* SHOULD match DS_* in pmddi.h */
209
#define GC_TEXTBLT_DOWNLOADABLE 0x00002000 // Downloadable Fonts
210
#define GC_TEXTBLT_CLIPABLE 0x00004000 // CLIPPABLE Fonts
211
#define GC_TEXTBLT_DS_DEVICE_FONTS 0x00008000 // Device has Hardware Fonts
212
#define GC_SIMPLE_LINES 0x00800000 // Device handles LINEINFO2.
213
// For compatibility with old source code retain old definitions
214
#define TEXTBLT_DOWNLOADABLE GC_TEXTBLT_DOWNLOADABLE
215
#define TEXTBLT_CLIPABLE GC_TEXTBLT_CLIPABLE
216
#define TEXTBLT_DS_DEVICE_FONTS GC_TEXTBLT_DS_DEVICE_FONTS
217
#ifndef DS_SIMPLE_LINES
218
#define DS_SIMPLE_LINES GC_SIMPLE_LINES
220
//RESERVED - NOT USED NOW
221
#define GC_SRC_CONVERT 0x02000000 // send Device independent bitmaps
222
// without converting to device internal format.
223
// Gradd will convert during blts or
224
// call softdraw to simulate.
225
// If not set, GRE will convert DIB in a temporary buffer.
226
// Gradd should set this based on performance.
227
#define GC_POLYGON_FILL 0x08000000 // GRADD can handle polygon(triangle and quad)
228
// fills and POLYGONINFO. see GC_POLYGON_SIZE_ANY
229
// if set, Graphics Engine call pfnPolygon
230
// for fills instead of pfnBitBlt.
236
** Defines and structures for the GHI_CMD_QUERYMODES and GHI_CMD_SETMODE
238
#define QUERYMODE_NUM_MODES 0x0001
239
#define QUERYMODE_MODE_DATA 0x0002
240
#define QUERYMODE_VALID (QUERYMODE_NUM_MODES|QUERYMODE_MODE_DATA)
243
** Defines and structures for the GHI_CMD_VRAM
245
typedef struct _VRAMIN { /* vramin */
250
typedef VRAMIN *PVRAMIN;
253
** Defines for the ulFunction field of the VRAMIN data structure.
255
#define VRAM_ALLOCATE 1
256
#define VRAM_DEALLOCATE 2
258
#define VRAM_REGISTER 4
259
#define VRAM_DEREGISTER 5
261
typedef struct _VRAMREGISTERIN { /* vramregisterin */
262
ULONG ulLength; /* sizeof(VRAMREGISTERIN) */
263
ULONG ulHandle; /* de-registering handle */
264
ULONG ulFlags; /* Input flags */
266
typedef VRAMREGISTERIN *PVRAMREGISTERIN;
269
** Defines for the ulFlags field of the VRAMREGISTERIN data structure.
271
#define VRAM_REGISTER_HANDLE 0x0001 /* If this bit is set we have */
272
/* a registration if it is off */
273
/* we have a deregistration */
275
#define VRAM_REGISTER_VRAMONLY 0x1000 /* If this flag is set the app */
276
/* is registering and telling */
277
/* us that it does not intend */
278
/* to use the accelerator */
280
typedef struct _VRAMREGISTEROUT { /* vramregisterout */
282
ULONG ulFlags; /* Returned flags (currently none def) */
283
ULONG ulHandle; /* Returned handle */
285
typedef VRAMREGISTEROUT *PVRAMREGISTEROUT;
287
typedef struct _VRAMALLOCIN { /* vramallocin */
290
ULONG ulID; /* Used for de-allocation */
297
typedef VRAMALLOCIN *PVRAMALLOCIN;
300
** Defines for the ulFlags field of the VRAMALLOCIN data structure.
302
#define VRAM_ALLOC_SHARED 0x0001
303
#define VRAM_ALLOC_RECTANGLE 0x0002
304
#define VRAM_ALLOC_WORKBUFFER 0x0004
305
#define VRAM_ALLOC_STATIC 0x1000
308
** Defines for the ulFunction field of the VRAMALLOCIN data structure.
310
#define VRAM_ALLOCATE 1
311
#define VRAM_DEALLOCATE 2
314
typedef struct _VRAMALLOCOUT { /* vramallocout */
320
ULONG ulScanLineBytes;
322
typedef VRAMALLOCOUT *PVRAMALLOCOUT;
325
** Defines and structures for the GHI_CMD_EVENT command
327
typedef struct _HWEVENTIN { /* hweventin */
329
ULONG ulEvent; /* Event type */
330
PVOID pEventData; /* Pointer to event specific data */
332
typedef HWEVENTIN *PHWEVENTIN;
335
** Defines for the ulEvent field of the HWEVENTIN data structure.
337
#define EVENT_FOREGROUND 1
338
#define EVENT_BACKGROUND 2
339
#define EVENT_NEWCHAININFO 3
342
** Defines and structures for the GHI_CMD_EXTENSION command
344
typedef struct _HWEXTENSION { /* hwextension */
346
ULONG ulXSubFunction;
347
ULONG cScrChangeRects;
352
typedef HWEXTENSION *PHWEXTENSION;
355
** Defines for the ulXFlags field of the HWEXTENSION data structure.
357
#define X_REQUESTHW 1
364
#define GRADDPDD_IOCTL 0x10
365
#define GRADDPDD_LOCK 0
366
#define GRADDPDD_UNLOCK 1
367
#define GRADDPDD_SETMTRR 2
369
typedef struct _MTRRIN
371
ULONG ulPhysAddr; /* Starting Physical address */
372
ULONG ulLength; /* Range to be enabled for WC */
373
ULONG ulFlags; /* Flags as defined above. Bit 27 is */
374
/* interrpreted as a Enable MTRR if set */
375
/* and as a Disable MTRR if not set */
378
ULONG GHSetMTRR(PMTRRIN, BOOL);
381
** The following are the possible values for the flags which are returned when
382
** calling GRADDPDD_SETMTRR these are also defined in GRADDSYS.H for use by
383
** GRADD.SYS please make sure any updates are kept in synch.
385
** The first(low order byte) is reserved for Processor Identification and is
386
** interpreted as a number. The 2nd byte is reserved for future use. The
387
** 3rd byte is interpreted as a set of flags indicating what support is
388
** available and the high order byte is interpreted as a number corresponding
389
** to the command passed in to the SetMTRR function.
391
#define INTEL_PROCESSOR 0x00000001
392
#define AMD_PROCESSOR 0x00000002
393
#define CYRIX_PROCESSOR 0x00000003
394
#define CPUID_SUPPORT 0x00010000
395
#define MTRR_SUPPORT 0x00020000
396
#define MTRR_ENABLED 0x00040000
397
#define MTRR_AVAILABLE 0x00080000
398
#define WC_ENABLED 0x00100000
400
#define VENDOR_MASK 0x000000FF
401
#define COMMAND_MASK 0xFF000000
404
** Or one of the following into the ulFlags field of MTRRIN to
405
** enabled/disable WC
407
#define MTRR_DISABLE 0x00000000
408
#define MTRR_ENABLE 0x01000000
409
#define MTRR_QUERY 0x02000000
410
#define MTRR_CMD_MAX MTRR_QUERY
414
** End of GRADD.SYS defines
418
** Prototype declarations for Video Manager Interface (VMI)
421
typedef ULONG (EXPENTRY FNVMIENTRY)(GrID, ULONG, PVOID, PVOID);
424
** VMI commands which map directly to GRADD commands
426
#define VMI_CMD_INIT GHI_CMD_INIT
427
#define VMI_CMD_INITPROC GHI_CMD_INITPROC
428
#define VMI_CMD_TERM GHI_CMD_TERM
429
#define VMI_CMD_TERMPROC GHI_CMD_TERMPROC
430
#define VMI_CMD_QUERYCAPS GHI_CMD_QUERYCAPS
431
#define VMI_CMD_QUERYMODES GHI_CMD_QUERYMODES
432
#define VMI_CMD_SETMODE GHI_CMD_SETMODE
433
#define VMI_CMD_PALETTE GHI_CMD_PALETTE
434
#define VMI_CMD_BITBLT GHI_CMD_BITBLT
435
#define VMI_CMD_LINE GHI_CMD_LINE
436
#define VMI_CMD_MOVEPTR GHI_CMD_MOVEPTR
437
#define VMI_CMD_SETPTR GHI_CMD_SETPTR
438
#define VMI_CMD_SHOWPTR GHI_CMD_SHOWPTR
439
#define VMI_CMD_VRAM GHI_CMD_VRAM
440
#define VMI_CMD_REQUESTHW GHI_CMD_REQUESTHW
441
#define VMI_CMD_EVENT GHI_CMD_EVENT
442
#define VMI_CMD_EXTENSION GHI_CMD_EXTENSION
443
#define VMI_CMD_BANK GHI_CMD_BANK
444
#define VMI_CMD_TEXT GHI_CMD_TEXT
445
#define VMI_CMD_USERCAPS GHI_CMD_USERCAPS
446
#define VMI_CMD_POLYGON GHI_CMD_POLYGON
449
** VMI commands unique to the video manager
451
#define VMI_CMD_BASE 0x1000
453
#define VMI_CMD_QUERYCHAININFO VMI_CMD_BASE + 0
454
#define VMI_CMD_QUERYCURRENTMODE VMI_CMD_BASE + 1
455
#define VMI_CMD_EXCLUDEPTR VMI_CMD_BASE + 2
456
#define VMI_CMD_UPDATECHAININFO VMI_CMD_BASE + 3
457
#define VMI_CMD_MAX VMI_CMD_BASE + 4
460
** Defines and structures for VMI_CMD_QUERYCHAININFO
462
typedef struct _GRADDINFO { /* graddinfo */
465
PFNHWENTRY pGraddEntry;
466
PFNHWENTRY pChainEntry;
468
struct _GDDMODEINFO * pModeInfo;
469
struct _CAPSINFO * pCapsInfo;
470
struct _GRADDINFO * pNextGraddInfo;
472
typedef GRADDINFO *PGRADDINFO;
474
typedef struct _CHAININFO { /* chaininfo */
477
PFNHWENTRY pChainHWEntry;
478
PGRADDINFO pGraddList;
479
struct _CHAININFO * pNextChainInfo;
481
typedef CHAININFO *PCHAININFO;
484
typedef struct _VMIQCI { /* vmiqci */
486
PCHAININFO pciHead; /* Head of the GRADD chain */
488
typedef VMIQCI *PVMIQCI;
491
** Defines and structures for VMI_CMD_EXCLUDEPTR
493
typedef struct _EXCLUDEPTRIN { /* excludeptrin */
494
ULONG ulLength; /* sizeof(EXCLUDEPTRIN) */
495
BOOL fAdd; /* TRUE - add, FASE - remove rects */
496
ULONG cExcludeRects; /* count of exclude rectangles */
497
PRECTL apRectls; /* array of exclude rectangles */
499
typedef EXCLUDEPTRIN *PEXCLUDEPTRIN;
502
** Video Helper services exported by VMAN
504
typedef struct _MEMINFO { /* meminfo */
510
typedef MEMINFO *PMEMINFO;
512
ULONG VHMap(PVOID, ULONG);
513
ULONG VHMapVRAM(ULONG, ULONG, PBYTE *, PBYTE *);
514
ULONG VHLockMem(PVOID, ULONG, BOOL);
515
ULONG VHUnLockMem(ULONG);
516
PVOID VHAllocMem(ULONG);
517
ULONG VHFreeMem(PVOID);
518
ULONG VHPhysToVirt(PMEMINFO);
519
ULONG VHGetVRAMInfo(PMEMINFO);
520
ULONG VHSetMTRR(PMTRRIN, BOOL);
521
ULONG EXPENTRY VMIEntry(GrID, ULONG, PVOID, PVOID);
522
ULONG EXPENTRY VHSortTriangle(PPOINTL pptl, PPOINTL pptlBounds);
523
ULONG EXPENTRY VHSortQuad(PPOINTL pptl, PPOINTL pptlBounds);
525
// Defines for xxxxxx
527
#define TRAPEZOID_COLLINEAR 0x0000
528
#define TRAPEZOID_TRIANGLE 0x0001
529
#define TRAPEZOID_TWO_TRIANGLES 0x0002
530
#define TRAPEZOID_DIAMOND 0x0004
531
#define TRAPEZOID_MINY_HORIZONTAL 0x0010
532
#define TRAPEZOID_MAXY_HORIZONTAL 0x0020
533
#define TRAPEZOID_LEFT_SPLIT 0x0040
534
#define TRAPEZOID_RIGHT_SPLIT 0x0080
535
#define TRAPEZOID_MIDY_HORIZONTAL 0x0100
536
#define TRAPEZOID_SECOND_SPLIT_LEFT 0x0200
537
#define TRAPEZOID_SECOND_SPLIT_RIGHT 0x0400
541
** Defines for the ulFlags field of the HEADER data structure.
543
#define SERIALIZE_REQUIRED 0x1
546
#define QUERYCAPSLIST 2L
549
typedef struct _USERCAPSIN
555
typedef USERCAPSIN *PUSERCAPSIN;
560
#endif /* ifndef GRADD_INCLUDED */