c2cdad72d1aadaa071ddbdffd9534eb6bee4b177
2 * Mesa 3-D graphics library
4 * Copyright (C) 2012-2013 LunarG, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Chia-I Wu <olv@lunarg.com>
28 #include "genhw/genhw.h"
29 #include "intel_winsys.h"
31 #include "ilo_debug.h"
35 * Initialize the \p dev from \p winsys. \p winsys is considered owned by \p
36 * dev and will be destroyed in \p ilo_dev_cleanup().
39 ilo_dev_init(struct ilo_dev
*dev
, struct intel_winsys
*winsys
)
41 const struct intel_winsys_info
*info
;
43 assert(ilo_is_zeroed(dev
, sizeof(*dev
)));
45 info
= intel_winsys_get_info(winsys
);
48 dev
->devid
= info
->devid
;
49 dev
->aperture_total
= info
->aperture_total
;
50 dev
->aperture_mappable
= info
->aperture_mappable
;
51 dev
->has_llc
= info
->has_llc
;
52 dev
->has_address_swizzling
= info
->has_address_swizzling
;
53 dev
->has_logical_context
= info
->has_logical_context
;
54 dev
->has_ppgtt
= info
->has_ppgtt
;
55 dev
->has_timestamp
= info
->has_timestamp
;
56 dev
->has_gen7_sol_reset
= info
->has_gen7_sol_reset
;
58 if (!dev
->has_logical_context
) {
59 ilo_err("missing hardware logical context support\n");
64 * PIPE_CONTROL and MI_* use PPGTT writes on GEN7+ and privileged GGTT
67 * From the Sandy Bridge PRM, volume 1 part 3, page 101:
69 * "[DevSNB] When Per-Process GTT Enable is set, it is assumed that all
70 * code is in a secure environment, independent of address space.
71 * Under this condition, this bit only specifies the address space
72 * (GGTT or PPGTT). All commands are executed "as-is""
74 * We need PPGTT to be enabled on GEN6 too.
76 if (!dev
->has_ppgtt
) {
77 /* experiments show that it does not really matter... */
78 ilo_warn("PPGTT disabled\n");
81 if (gen_is_bdw(info
->devid
) || gen_is_chv(info
->devid
)) {
82 dev
->gen_opaque
= ILO_GEN(8);
83 dev
->gt
= (gen_is_bdw(info
->devid
)) ? gen_get_bdw_gt(info
->devid
) : 1;
84 /* XXX random values */
87 dev
->thread_count
= 336;
88 dev
->urb_size
= 384 * 1024;
89 } else if (dev
->gt
== 2) {
91 dev
->thread_count
= 168;
92 dev
->urb_size
= 384 * 1024;
95 dev
->thread_count
= 84;
96 dev
->urb_size
= 192 * 1024;
98 } else if (gen_is_hsw(info
->devid
)) {
100 * From the Haswell PRM, volume 4, page 8:
102 * "Description GT3 GT2 GT1.5 GT1
104 * EUs (Total) 40 20 12 10
105 * Threads (Total) 280 140 84 70
107 * URB Size (max, within L3$) 512KB 256KB 256KB 128KB
109 dev
->gen_opaque
= ILO_GEN(7.5);
110 dev
->gt
= gen_get_hsw_gt(info
->devid
);
113 dev
->thread_count
= 280;
114 dev
->urb_size
= 512 * 1024;
115 } else if (dev
->gt
== 2) {
117 dev
->thread_count
= 140;
118 dev
->urb_size
= 256 * 1024;
121 dev
->thread_count
= 70;
122 dev
->urb_size
= 128 * 1024;
124 } else if (gen_is_ivb(info
->devid
) || gen_is_vlv(info
->devid
)) {
126 * From the Ivy Bridge PRM, volume 1 part 1, page 18:
128 * "Device # of EUs #Threads/EU
129 * Ivy Bridge (GT2) 16 8
130 * Ivy Bridge (GT1) 6 6"
132 * From the Ivy Bridge PRM, volume 4 part 2, page 17:
134 * "URB Size URB Rows URB Rows when SLM Enabled
138 dev
->gen_opaque
= ILO_GEN(7);
139 dev
->gt
= (gen_is_ivb(info
->devid
)) ? gen_get_ivb_gt(info
->devid
) : 1;
142 dev
->thread_count
= 128;
143 dev
->urb_size
= 256 * 1024;
146 dev
->thread_count
= 36;
147 dev
->urb_size
= 128 * 1024;
149 } else if (gen_is_snb(info
->devid
)) {
151 * From the Sandy Bridge PRM, volume 1 part 1, page 22:
153 * "Device # of EUs #Threads/EU
157 * From the Sandy Bridge PRM, volume 4 part 2, page 18:
159 * "[DevSNB]: The GT1 product's URB provides 32KB of storage,
160 * arranged as 1024 256-bit rows. The GT2 product's URB provides
161 * 64KB of storage, arranged as 2048 256-bit rows. A row
162 * corresponds in size to an EU GRF register. Read/write access to
163 * the URB is generally supported on a row-granular basis."
165 dev
->gen_opaque
= ILO_GEN(6);
166 dev
->gt
= gen_get_snb_gt(info
->devid
);
169 dev
->thread_count
= 60;
170 dev
->urb_size
= 64 * 1024;
173 dev
->thread_count
= 24;
174 dev
->urb_size
= 32 * 1024;
177 ilo_err("unknown GPU generation\n");
185 ilo_dev_cleanup(struct ilo_dev
*dev
)
187 intel_winsys_destroy(dev
->winsys
);