1 | /**********************************************************
|
---|
2 | * Copyright 2007-2009 VMware, Inc. All rights reserved.
|
---|
3 | *
|
---|
4 | * Permission is hereby granted, free of charge, to any person
|
---|
5 | * obtaining a copy of this software and associated documentation
|
---|
6 | * files (the "Software"), to deal in the Software without
|
---|
7 | * restriction, including without limitation the rights to use, copy,
|
---|
8 | * modify, merge, publish, distribute, sublicense, and/or sell copies
|
---|
9 | * of the Software, and to permit persons to whom the Software is
|
---|
10 | * furnished to do so, subject to the following conditions:
|
---|
11 | *
|
---|
12 | * The above copyright notice and this permission notice shall be
|
---|
13 | * included in all copies or substantial portions of the Software.
|
---|
14 | *
|
---|
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
---|
19 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
---|
20 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
21 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
22 | * SOFTWARE.
|
---|
23 | *
|
---|
24 | **********************************************************/
|
---|
25 |
|
---|
26 | /*
|
---|
27 | * svga3d_caps.h --
|
---|
28 | *
|
---|
29 | * Definitions for SVGA3D hardware capabilities. Capabilities
|
---|
30 | * are used to query for optional rendering features during
|
---|
31 | * driver initialization. The capability data is stored as very
|
---|
32 | * basic key/value dictionary within the "FIFO register" memory
|
---|
33 | * area at the beginning of BAR2.
|
---|
34 | *
|
---|
35 | * Note that these definitions are only for 3D capabilities.
|
---|
36 | * The SVGA device also has "device capabilities" and "FIFO
|
---|
37 | * capabilities", which are non-3D-specific and are stored as
|
---|
38 | * bitfields rather than key/value pairs.
|
---|
39 | */
|
---|
40 |
|
---|
41 | #ifndef _SVGA3D_CAPS_H_
|
---|
42 | #define _SVGA3D_CAPS_H_
|
---|
43 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
44 | # pragma once
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | #define SVGA_FIFO_3D_CAPS_SIZE (SVGA_FIFO_3D_CAPS_LAST - \
|
---|
48 | SVGA_FIFO_3D_CAPS + 1)
|
---|
49 |
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * SVGA3dCapsRecordType
|
---|
53 | *
|
---|
54 | * Record types that can be found in the caps block.
|
---|
55 | * Related record types are grouped together numerically so that
|
---|
56 | * SVGA3dCaps_FindRecord() can be applied on a range of record
|
---|
57 | * types.
|
---|
58 | */
|
---|
59 |
|
---|
60 | typedef enum {
|
---|
61 | SVGA3DCAPS_RECORD_UNKNOWN = 0,
|
---|
62 | SVGA3DCAPS_RECORD_DEVCAPS_MIN = 0x100,
|
---|
63 | SVGA3DCAPS_RECORD_DEVCAPS = 0x100,
|
---|
64 | SVGA3DCAPS_RECORD_DEVCAPS_MAX = 0x1ff
|
---|
65 | } SVGA3dCapsRecordType;
|
---|
66 |
|
---|
67 |
|
---|
68 | /*
|
---|
69 | * SVGA3dCapsRecordHeader
|
---|
70 | *
|
---|
71 | * Header field leading each caps block record. Contains the offset (in
|
---|
72 | * register words, NOT bytes) to the next caps block record (or the end
|
---|
73 | * of caps block records which will be a zero word) and the record type
|
---|
74 | * as defined above.
|
---|
75 | */
|
---|
76 |
|
---|
77 | typedef
|
---|
78 | struct SVGA3dCapsRecordHeader {
|
---|
79 | uint32_t length;
|
---|
80 | SVGA3dCapsRecordType type;
|
---|
81 | }
|
---|
82 | SVGA3dCapsRecordHeader;
|
---|
83 |
|
---|
84 |
|
---|
85 | /*
|
---|
86 | * SVGA3dCapsRecord
|
---|
87 | *
|
---|
88 | * Caps block record; "data" is a placeholder for the actual data structure
|
---|
89 | * contained within the record; for example a record containing a FOOBAR
|
---|
90 | * structure would be of size "sizeof(SVGA3dCapsRecordHeader) +
|
---|
91 | * sizeof(FOOBAR)".
|
---|
92 | */
|
---|
93 |
|
---|
94 | typedef
|
---|
95 | struct SVGA3dCapsRecord {
|
---|
96 | SVGA3dCapsRecordHeader header;
|
---|
97 | uint32_t data[1];
|
---|
98 | }
|
---|
99 | SVGA3dCapsRecord;
|
---|
100 |
|
---|
101 |
|
---|
102 | typedef uint32_t SVGA3dCapPair[2];
|
---|
103 |
|
---|
104 |
|
---|
105 | /*
|
---|
106 | *----------------------------------------------------------------------
|
---|
107 | *
|
---|
108 | * SVGA3dCaps_FindRecord
|
---|
109 | *
|
---|
110 | * Finds the record with the highest-valued type within the given range
|
---|
111 | * in the caps block.
|
---|
112 | *
|
---|
113 | * Result: pointer to found record, or NULL if not found.
|
---|
114 | *
|
---|
115 | *----------------------------------------------------------------------
|
---|
116 | */
|
---|
117 | #if 0
|
---|
118 | static INLINE SVGA3dCapsRecord *
|
---|
119 | SVGA3dCaps_FindRecord(const uint32_t *capsBlock,
|
---|
120 | SVGA3dCapsRecordType recordTypeMin,
|
---|
121 | SVGA3dCapsRecordType recordTypeMax)
|
---|
122 | {
|
---|
123 | SVGA3dCapsRecord *record, *found = NULL;
|
---|
124 | uint32_t offset;
|
---|
125 |
|
---|
126 | /*
|
---|
127 | * Search linearly through the caps block records for the specified type.
|
---|
128 | */
|
---|
129 | for (offset = 0; capsBlock[offset] != 0; offset += capsBlock[offset]) {
|
---|
130 | record = (SVGA3dCapsRecord *) (capsBlock + offset);
|
---|
131 | if ((record->header.type >= recordTypeMin) &&
|
---|
132 | (record->header.type <= recordTypeMax) &&
|
---|
133 | (!found || (record->header.type > found->header.type))) {
|
---|
134 | found = record;
|
---|
135 | }
|
---|
136 | }
|
---|
137 |
|
---|
138 | return found;
|
---|
139 | }
|
---|
140 | #endif
|
---|
141 |
|
---|
142 | #endif // _SVGA3D_CAPS_H_
|
---|