2013-07-04 12:11:36 -07:00
|
|
|
/*
|
|
|
|
* Copyright © 2013 Intel Corporation
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
|
* IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-10-11 18:26:22 +01:00
|
|
|
#ifndef GEN_DEVICE_INFO_H
|
|
|
|
#define GEN_DEVICE_INFO_H
|
|
|
|
|
2013-07-04 12:11:36 -07:00
|
|
|
#include <stdbool.h>
|
2017-06-15 15:22:19 +01:00
|
|
|
#include <stdint.h>
|
2013-07-04 12:11:36 -07:00
|
|
|
|
2017-09-27 20:57:28 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-10-29 16:11:54 -07:00
|
|
|
/**
|
|
|
|
* Intel hardware information and quirks
|
|
|
|
*/
|
2016-08-22 15:01:08 -07:00
|
|
|
struct gen_device_info
|
2013-07-04 12:11:36 -07:00
|
|
|
{
|
|
|
|
int gen; /**< Generation number: 4, 5, 6, 7, ... */
|
|
|
|
int gt;
|
|
|
|
|
|
|
|
bool is_g4x;
|
|
|
|
bool is_ivybridge;
|
|
|
|
bool is_baytrail;
|
|
|
|
bool is_haswell;
|
2017-06-05 11:06:28 +01:00
|
|
|
bool is_broadwell;
|
2014-02-18 16:39:11 -08:00
|
|
|
bool is_cherryview;
|
2017-06-05 11:06:28 +01:00
|
|
|
bool is_skylake;
|
2015-06-17 15:50:11 -07:00
|
|
|
bool is_broxton;
|
2016-11-08 13:21:38 -08:00
|
|
|
bool is_kabylake;
|
2017-06-05 11:06:28 +01:00
|
|
|
bool is_geminilake;
|
2017-06-22 10:42:32 -07:00
|
|
|
bool is_coffeelake;
|
2017-06-05 11:06:28 +01:00
|
|
|
bool is_cannonlake;
|
2013-07-04 12:11:36 -07:00
|
|
|
|
|
|
|
bool has_hiz_and_separate_stencil;
|
|
|
|
bool must_use_separate_stencil;
|
|
|
|
|
|
|
|
bool has_llc;
|
2013-09-25 17:01:55 -07:00
|
|
|
|
2013-09-26 11:55:36 -07:00
|
|
|
bool has_pln;
|
|
|
|
bool has_compr4;
|
|
|
|
bool has_surface_tile_offset;
|
2015-04-16 17:52:03 -07:00
|
|
|
bool supports_simd16_3src;
|
2013-07-02 11:48:22 -04:00
|
|
|
bool has_resource_streamer;
|
2013-09-26 11:55:36 -07:00
|
|
|
|
2013-09-26 11:36:42 -07:00
|
|
|
/**
|
2015-10-29 12:12:40 -07:00
|
|
|
* \name Intel hardware quirks
|
2013-09-26 11:36:42 -07:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
bool has_negative_rhw_bug;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Some versions of Gen hardware don't do centroid interpolation correctly
|
|
|
|
* on unlit pixels, causing incorrect values for derivatives near triangle
|
|
|
|
* edges. Enabling this flag causes the fragment shader to use
|
|
|
|
* non-centroid interpolation for unlit pixels, at the expense of two extra
|
|
|
|
* fragment shader instructions.
|
|
|
|
*/
|
|
|
|
bool needs_unlit_centroid_workaround;
|
|
|
|
/** @} */
|
|
|
|
|
2013-09-25 17:01:55 -07:00
|
|
|
/**
|
2015-10-29 12:12:40 -07:00
|
|
|
* \name GPU hardware limits
|
2015-10-29 16:11:54 -07:00
|
|
|
*
|
|
|
|
* In general, you can find shader thread maximums by looking at the "Maximum
|
|
|
|
* Number of Threads" field in the Intel PRM description of the 3DSTATE_VS,
|
|
|
|
* 3DSTATE_GS, 3DSTATE_HS, 3DSTATE_DS, and 3DSTATE_PS commands. URB entry
|
Remove wrongly repeated words in comments
Clean up misrepetitions ('if if', 'the the' etc) found throughout the
comments. This has been done manually, after grepping
case-insensitively for duplicate if, is, the, then, do, for, an,
plus a few other typos corrected in fly-by
v2:
* proper commit message and non-joke title;
* replace two 'as is' followed by 'is' to 'as-is'.
v3:
* 'a integer' => 'an integer' and similar (originally spotted by
Jason Ekstrand, I fixed a few other similar ones while at it)
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2016-06-23 19:20:18 +02:00
|
|
|
* limits come from the "Number of URB Entries" field in the
|
2015-10-29 16:11:54 -07:00
|
|
|
* 3DSTATE_URB_VS command and friends.
|
|
|
|
*
|
|
|
|
* These fields are used to calculate the scratch space to allocate. The
|
|
|
|
* amount of scratch space can be larger without being harmful on modern
|
|
|
|
* GPUs, however, prior to Haswell, programming the maximum number of threads
|
|
|
|
* to greater than the hardware maximum would cause GPU performance to tank.
|
|
|
|
*
|
2013-09-25 17:01:55 -07:00
|
|
|
* @{
|
|
|
|
*/
|
2015-11-25 15:15:20 +02:00
|
|
|
/**
|
|
|
|
* Total number of slices present on the device whether or not they've been
|
|
|
|
* fused off.
|
2016-02-08 18:00:41 -08:00
|
|
|
*
|
|
|
|
* XXX: CS thread counts are limited by the inability to do cross subslice
|
|
|
|
* communication. It is the effectively the number of logical threads which
|
|
|
|
* can be executed in a subslice. Fuse configurations may cause this number
|
|
|
|
* to change, so we program @max_cs_threads as the lower maximum.
|
2015-11-25 15:15:20 +02:00
|
|
|
*/
|
|
|
|
unsigned num_slices;
|
2017-06-15 23:48:49 +01:00
|
|
|
|
2017-06-21 17:44:17 +01:00
|
|
|
/**
|
|
|
|
* Number of subslices for each slice (used to be uniform until CNL).
|
|
|
|
*/
|
|
|
|
unsigned num_subslices[3];
|
|
|
|
|
2017-06-15 23:48:49 +01:00
|
|
|
/**
|
|
|
|
* Number of threads per eu, varies between 4 and 8 between generations.
|
|
|
|
*/
|
|
|
|
unsigned num_thread_per_eu;
|
|
|
|
|
2017-06-01 09:28:04 -07:00
|
|
|
unsigned l3_banks;
|
2015-10-29 16:11:54 -07:00
|
|
|
unsigned max_vs_threads; /**< Maximum Vertex Shader threads */
|
2016-10-03 10:39:28 +11:00
|
|
|
unsigned max_tcs_threads; /**< Maximum Hull Shader threads */
|
2016-10-03 10:39:29 +11:00
|
|
|
unsigned max_tes_threads; /**< Maximum Domain Shader threads */
|
2015-10-29 16:11:54 -07:00
|
|
|
unsigned max_gs_threads; /**< Maximum Geometry Shader threads. */
|
|
|
|
/**
|
|
|
|
* Theoretical maximum number of Pixel Shader threads.
|
|
|
|
*
|
|
|
|
* PSD means Pixel Shader Dispatcher. On modern Intel GPUs, hardware will
|
|
|
|
* automatically scale pixel shader thread count, based on a single value
|
|
|
|
* programmed into 3DSTATE_PS.
|
|
|
|
*
|
|
|
|
* To calculate the maximum number of threads for Gen8 beyond (which have
|
|
|
|
* multiple Pixel Shader Dispatchers):
|
|
|
|
*
|
|
|
|
* - Look up 3DSTATE_PS and find "Maximum Number of Threads Per PSD"
|
|
|
|
* - Usually there's only one PSD per subslice, so use the number of
|
|
|
|
* subslices for number of PSDs.
|
|
|
|
* - For max_wm_threads, the total should be PSD threads * #PSDs.
|
|
|
|
*/
|
2013-09-25 17:01:55 -07:00
|
|
|
unsigned max_wm_threads;
|
2015-10-29 16:11:54 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maximum Compute Shader threads.
|
|
|
|
*
|
|
|
|
* Thread count * number of EUs per subslice
|
|
|
|
*/
|
2015-03-13 16:42:40 -07:00
|
|
|
unsigned max_cs_threads;
|
2013-09-25 17:01:55 -07:00
|
|
|
|
|
|
|
struct {
|
2015-11-25 14:51:16 +02:00
|
|
|
/**
|
2015-10-29 16:11:54 -07:00
|
|
|
* Hardware default URB size.
|
|
|
|
*
|
|
|
|
* The units this is expressed in are somewhat inconsistent: 512b units
|
|
|
|
* on Gen4-5, KB on Gen6-7, and KB times the slice count on Gen8+.
|
|
|
|
*
|
|
|
|
* Look up "URB Size" in the "Device Attributes" page, and take the
|
|
|
|
* maximum. Look up the slice count for each GT SKU on the same page.
|
|
|
|
* urb.size = URB Size (kbytes) / slice count
|
2015-11-25 14:51:16 +02:00
|
|
|
*/
|
2013-09-25 17:01:55 -07:00
|
|
|
unsigned size;
|
2016-11-15 00:07:35 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The minimum number of URB entries. See the 3DSTATE_URB_<XS> docs.
|
|
|
|
*/
|
|
|
|
unsigned min_entries[4];
|
2016-11-14 23:45:16 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum number of URB entries. See the 3DSTATE_URB_<XS> docs.
|
|
|
|
*/
|
|
|
|
unsigned max_entries[4];
|
2013-09-25 17:01:55 -07:00
|
|
|
} urb;
|
2016-10-27 22:08:19 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* For the longest time the timestamp frequency for Gen's timestamp counter
|
|
|
|
* could be assumed to be 12.5MHz, where the least significant bit neatly
|
|
|
|
* corresponded to 80 nanoseconds.
|
|
|
|
*
|
|
|
|
* Since Gen9 the numbers aren't so round, with a a frequency of 12MHz for
|
2017-06-15 15:22:19 +01:00
|
|
|
* SKL (or scale factor of 83.33333333) and a frequency of 19200000Hz for
|
2016-10-27 22:08:19 +01:00
|
|
|
* BXT.
|
|
|
|
*
|
|
|
|
* For simplicty to fit with the current code scaling by a single constant
|
|
|
|
* to map from raw timestamps to nanoseconds we now do the conversion in
|
|
|
|
* floating point instead of integer arithmetic.
|
|
|
|
*
|
|
|
|
* In general it's probably worth noting that the documented constants we
|
|
|
|
* have for the per-platform timestamp frequencies aren't perfect and
|
|
|
|
* shouldn't be trusted for scaling and comparing timestamps with a large
|
|
|
|
* delta.
|
|
|
|
*
|
|
|
|
* E.g. with crude testing on my system using the 'correct' scale factor I'm
|
|
|
|
* seeing a drift of ~2 milliseconds per second.
|
|
|
|
*/
|
2017-06-15 15:22:19 +01:00
|
|
|
uint64_t timestamp_frequency;
|
2016-10-27 22:08:19 +01:00
|
|
|
|
2013-09-25 17:01:55 -07:00
|
|
|
/** @} */
|
2013-07-04 12:11:36 -07:00
|
|
|
};
|
|
|
|
|
2017-06-20 11:06:24 +01:00
|
|
|
#define gen_device_info_is_9lp(devinfo) \
|
2017-09-01 15:34:54 -07:00
|
|
|
((devinfo)->is_broxton || (devinfo)->is_geminilake)
|
2017-06-20 11:06:24 +01:00
|
|
|
|
2016-10-03 09:32:54 +03:00
|
|
|
bool gen_get_device_info(int devid, struct gen_device_info *devinfo);
|
2016-08-25 16:22:58 -07:00
|
|
|
const char *gen_get_device_name(int devid);
|
2016-10-11 18:26:22 +01:00
|
|
|
|
2017-09-27 20:57:28 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-10-11 18:26:22 +01:00
|
|
|
#endif /* GEN_DEVICE_INFO_H */
|