summaryrefslogtreecommitdiffstats
path: root/src/mesa
Commit message (Collapse)AuthorAgeFilesLines
* st_cb_bitmap: check NULL return from u_upload_allocJulien Isorce2017-03-281-0/+6
| | | | | | Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* i965: Delete tile resource mode codeAnuj Phogat2017-03-275-267/+35
| | | | | | | | | | | Yf/Ys tiling never got used in i965 due to not delivering the expected performance benefits. So, this patch is deleting this dead code in favor of adding it later in ISL when we actually find it useful. ISL can then share this code between vulkan and GL. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Delete fast copy blit codeAnuj Phogat2017-03-272-185/+48
| | | | | | | | | | | | | | | Fast copy blit was primarily added to support Yf/Ys detiling. But, Yf/Ys tiling never got used in i965 due to not delivering the expected performance benefits. Also, replacing legacy blits with fast copy blit didn't help the benchmarking numbers. This is probably due to a h/w restriction that says "start pixel for Fast Copy blit should be on an OWord boundary". This restriction causes many blit operations to skip fast copy blit and use legacy blits. So, this patch is deleting this dead code in favor of adding it later when we actually find it useful. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Require Kernel 3.6 for Gen4-5 platforms.Kenneth Graunke2017-03-272-3/+3
| | | | | | | | | | | | | | We've already required Kernel 3.6 on Gen6+ since Mesa 9.2 (May 2013, commit 92d2f5acfadea672417b6785710c9e8b7f605e41). It seems reasonable to require it for Gen4-5 as well, bumping the requirement from 2.6.39. This is necessary for glClientWaitSync with a timeout to work, which is a feature we expose on Gen4-5. Without it, we would fall back to an infinite wait, which is pretty bad. See kernel commit 172cf15d18889313bf2c3bfb81fcea08369274ef in 3.6+. Reviewed-by: Matt Turner <[email protected]>
* mesa/tests: Link main-test with CLOCK_LIB.Vinson Lee2017-03-271-1/+2
| | | | | | | | | | Fix 'make check' linking error with glibc < 2.17. CXXLD main-test ../../../../src/mesa/.libs/libmesa.a(libmesautil_la-u_queue.o): In function `u_thread_get_time_nano': src/util/../../src/util/u_thread.h:84: undefined reference to `clock_gettime' Signed-off-by: Vinson Lee <[email protected]>
* mesa: simplify code around 'variable_data' in marshal.cBrian Paul2017-03-271-12/+7
| | | | | | | Remove needless pointer increments, unneeded vars, etc. Untested. Plus, fix a couple comments. Reviewed-by: Timothy Arceri <[email protected]>
* st/mesa: move duplicated st_ws_framebuffer() function into header fileBrian Paul2017-03-273-28/+18
| | | | Reviewed-by: Marek Olšák <[email protected]>
* glsl, st/shader_cache: check the whole sha1 for zeroGrazvydas Ignotas2017-03-271-1/+2
| | | | | | | | | | | | The checks were only looking at the first byte, while the intention seems to be to check if the whole sha1 is zero. This prevented all shaders with first byte zero in their sha1 from being saved. This shaves around a second from Deus Ex load time on a hot cache. Signed-off-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* scons: Fix dependencies of marshal_generated.[ch].Jose Fonseca2017-03-261-2/+2
| | | | | | | | | | | These generated source files depend not only upon gl_and_es_API.xml, but all other XML files that are included by it. This change updates the generation rules to depend on all gen/*.xml files, like done for other SCons generation rules, and should fix incremental broken SCons builds due to missing dependencies. Trivial.
* mesa/glthread: add custom marshalling for ClearBufferfv()Timothy Arceri2017-03-252-0/+83
| | | | | | This is one of the main causes of syncs in Civ6. Reviewed-by: Nicolai Hähnle <[email protected]>
* i965: Fix symbolic size of next_offset[] array.Kenneth Graunke2017-03-241-1/+1
| | | | | | | It's indexed by buffer, not stream. BRW_MAX_SOL_BUFFERS and MAX_VERTEX_STREAMS happen to both be 4, so there's no actual bug. Reviewed-by: Matt Turner <[email protected]>
* i965: Remove pointless NULL check from Gen6 primitive counting code.Kenneth Graunke2017-03-241-2/+3
| | | | | | | | | We create the BO when creating a transform feedback object, and only destroy it when deleting that object. So it won't be NULL. CID: 1401410 Reviewed-by: Matt Turner <[email protected]>
* glsl_to_tgsi: don't rely on glsl types when visiting tex instructionsSamuel Pitoiset2017-03-241-7/+6
| | | | | | | Instead add is_cube_shadow like is_cube_array. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa/marshal: add custom BufferData/BufferSubData marshallingTimothy Arceri2017-03-242-0/+143
| | | | | | | | | | GL_AMD_pinned_memory requires memory to be aligned correctly, so we skip marshalling in this case. Also copying the data defeats the purpose of EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD. Fixes GL_AMD_pinned_memory piglit tests when glthread is enabled. Acked-by: Edward O'Callaghan <[email protected]>
* mesa: set thread name for glthreadMiklós Máté2017-03-241-0/+3
| | | | | Signed-off-by: Miklós Máté <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* i965: Return progress from brw_nir_lower_uniforms().Matt Turner2017-03-231-3/+3
| | | | Reviewed-by: Jason Ekstrand <[email protected]>
* android: i965: generate code for OA counter queriesMauro Rossi2017-03-231-0/+17
| | | | | | | | | | | | | | Automake generation rules are replicated for android. $* macro was expected to return "hsw" but instead gives "hsw.{h,c}" so $(basename $*) is used as a workaround to set the correct --chipset option for brw_oa.py script. Build tested with nougat-x86 Fixes: e565505 "i965: Add script to gen code for OA counter queries" Reviewed-by: Tapani Pälli <[email protected]> Acked-by: Robert Bragg <[email protected]> Acked-by: Emil Velikov <[email protected]>
* drirc: add force_glsl_abs_sqrt() for "Spec Ops: The Line"Samuel Pitoiset2017-03-221-0/+8
| | | | | | | | | | | | Game ported from D3D9 which expects sqrt() to compute the absolute value as explained in the spec. This gets rid of the NaN values as well as the black squares with RadeonSI. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97338 Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/glsl_to_tgsi: enable lower_sqrt() conditionallySamuel Pitoiset2017-03-221-0/+1
| | | | | | | It relies on the force_glsl_abs_sqrt driconf option. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* driconf: add force_glsl_abs_sqrt optionSamuel Pitoiset2017-03-225-0/+17
| | | | | | | | | This will allow to force computing the absolute value for sqrt() and inversesqrt() in order to follow D3D9 behaviour for buggy apps that rely on it. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* Android: drop Android 4.4 (KitKat) supportRob Herring2017-03-222-10/+0
| | | | | | | | | | | Any users of KitKat are likely using an older version of Mesa and KitKat support adds complexity to the make files. Dropping support allows removing the MESA_LOLLIPOP_BUILD make variable in various make files. Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* mesa/main: remove unused strndup.h includeEmil Velikov2017-03-221-1/+0
| | | | | | | | | No longer needed as of commit ac257f1070a ("glsl: calculate TOP_LEVEL_ARRAY_SIZE and STRIDE when adding resources") Reported-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Juha-Pekka Heikkila <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* mesa/program: consistently use ifndef guards over pragma onceEmil Velikov2017-03-224-4/+9
| | | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Vedran Miletić <[email protected]> Acked-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* mesa/main: consistently use ifndef guards over pragma onceEmil Velikov2017-03-225-3/+11
| | | | | | | Signed-off-by: Emil Velikov <[email protected]> Acked-by: Vedran Miletić <[email protected]> Acked-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* i965: consistently use ifndef guards over pragma onceEmil Velikov2017-03-224-3/+15
| | | | | | | | | | | The only remaining case is the brw_oa.py generator which pipes the generated file to stdout. That will be resolved with later commits. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Lionel Landwerlin <[email protected]> Acked-by: Vedran Miletić <[email protected]> Acked-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* i965: make brw_setup_image_uniform_values staticEmil Velikov2017-03-221-1/+1
| | | | | | | | | | Used only internally. Signed-off-by: Emil Velikov <[email protected]> Acked-by: Lionel Landwerlin <[email protected]> Acked-by: Vedran Miletić <[email protected]> Acked-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* mesa: more unused linux/version.h includeEmil Velikov2017-03-221-3/+0
| | | | | | | The header provides the LINUX_VERSION_CODE and KERNEL_VERSION macros. With neither of which being used by any part of mesa. Signed-off-by: Emil Velikov <[email protected]>
* mesa/main: fix MultiDrawElements[BaseVertex] validation of primcountNicolai Hähnle2017-03-222-3/+23
| | | | | | | | | | | | | | | | | | | | | | | primcount must be a GLsizei as in the signature for MultiDrawElements or bad things can happen. Furthermore, an error should be flagged when primcount is negative. Curiously, this code used to work somewhat correctly even when primcount was negative, because the loop that checks count[i] would iterate out of bounds and almost certainly hit a negative value at some point. Found by an ASAN error in GL45-CTS.gtf32.GL3Tests.draw_elements_base_vertex.draw_elements_base_vertex_primcount Note that the OpenGL spec seems to have s/primcount/drawcount/ at some point, and the code still reflects the old language. v2: provide the correct spec quotes (pointed out by Ian) Cc: [email protected] Reviewed-by: Marek Olšák <[email protected]> (v1) Reviewed-by: Ian Romanick <[email protected]>
* mesa: Avoid out-of-bounds stack read via _mesa_MaterialiNicolai Hähnle2017-03-221-2/+3
| | | | | | | | | | | | | | MATERIALFV may end up reading up to 4 floats from the passed parameter. This should really set a GL_INVALID_ENUM error in the cases where it matters, but does anybody really care? Found by ASAN in piglit gl-1.0-beginend-coverage. v2: fix a trivial compiler warning Reviewed-by: Marek Olšák <[email protected]> (v1) Reviewed-by: Ian Romanick <[email protected]> (v1)
* i965/dri: Turn on support for image modifiersBen Widawsky2017-03-211-1/+1
| | | | | | | | All the plumbing is in place so the extension just needs to be advertised. Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/dri: Handle X-tiled modifierBen Widawsky2017-03-211-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't really "do" anything because the default tiling for the winsys buffer is X tiled. We do however want the X tiled modifier to work correctly from the API perspective, which would imply that if you set this modifier, and later do a get_modifier, you get back at least X tiled. Running with a modified kmscube, here are the bandwidth measurements. Linear: Read bandwidth: 1039.31 MiB/s Write bandwidth: 1453.56 MiB/s Y-tiled: Read bandwidth: 458.29 MiB/s Write bandwidth: 542.12 MiB/s X-tiled: Read bandwidth: 575.01 MiB/s Write bandwidth: 606.25 MiB/s Cc: Kristian Høgsberg <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Acked-by: Daniel Stone <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/dri: Handle Y-tiled modifierBen Widawsky2017-03-211-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch begins introducing how we'll actually handle the potentially many modifiers coming in from the API, how we'll store them, and the structure in the code to support it. Prior to this patch, the Y-tiled modifier would be entirely ignored. It shouldn't actually be used until this point because we've not bumped the DRIimage extension version (which is a requirement to use modifiers). Measuring later in the series with kmscube: Linear: Read bandwidth: 1048.44 MiB/s Write bandwidth: 1483.17 MiB/s Y-tiled: Read bandwidth: 471.13 MiB/s Write bandwidth: 589.10 MiB/s Similar functionality was introduced and then reverted here: commit 6a0d036483caf87d43ebe2edd1905873446c9589 Author: Ben Widawsky <[email protected]> Date: Thu Apr 21 20:14:58 2016 -0700 i965: Always use Y-tiled buffers on SKL+ v2: Use last set bit instead of first set bit in modifiers to address bug found by Daniel Stone. v3: Use the new priority modifier selection thing. This nullifies the bug fixed by v2 also. v4: Get rid of modifier compaction which originally served another purpose and now serves none (Jason) Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Daniel Stone <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/dri: Handle the linear fb modifierBen Widawsky2017-03-211-11/+44
| | | | | | | | | | | | | | | | | | | | | | | | | At image creation create a path for dealing with the linear modifier. This works exactly like the old usage flags where __DRI_IMAGE_USE_LINEAR was specified. During development of this patch series, it was decided that a lack of modifier was an insufficient way to express the required modifiers. As a result, 0 was repurposed to mean a modifier for a LINEAR layout. NOTE: This patch was added for v3 of the patch series. v2: Rework the algorithm for modifier selection to go from a bitmask based selection to this priority value. v3: Make DRM_FORMAT_MOD_INVALID allowed at selection as a way of identifying no modifiers found (because 0 is LINEAR) (Jason) v4: Remove the logic to prune unknown modifiers (like those from other vendors) and simply handle is in select_best_modifier (Jason) Requested-by: Jason Ekstrand <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/dri: Enable modifier queriesBen Widawsky2017-03-212-0/+7
| | | | | | | | | | | | | | | | | | New to the patch series after reordering things for landing smaller chunks. This will essentially enable modifiers from clients that were just enabled in previous patches. A client could use the modifiers by setting all of them at create, but had no way to actually query them after creating the surface (ie. stupid clients could be broken before this patch, but in more ways than this). Obviously, there are no modifiers being actually stored yet - so this patch shouldn't do anything other than allow the API to get back 0 (or the LINEAR modifier). Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/dri: Store the screen associated with the imageBen Widawsky2017-03-212-6/+11
| | | | | | | | | | | | | | I intend to need to get to the devinfo structure, and storing the screen is an easy way to do that. It seems to be the consensus that you cannot share an image between multiple screens. Scape-goat: Rob Clark <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Daniel Stone <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/dri: Disallow image with INVALID modifierBen Widawsky2017-03-211-0/+3
| | | | | Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Shut up major()/minor() warnings.Kenneth Graunke2017-03-211-0/+7
| | | | | | | | | | | | | | | | | | | | | Recent glibc generates this warning: brw_performance_query.c:1648:13: warning: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. min = minor(sb.st_rdev); So, include sys/sysmacros.h to shut up the warning. v2: Use the AC_HEADER_MAJOR defines to figure out the right header (thanks to Jonathan Gray for helping me not break non-glibc systems) Reviewed-by: Matt Turner <[email protected]> [v1] Reviewed-by: Emil Velikov <[email protected]>
* i965: Drop AUB_TRACE_* stuff.Kenneth Graunke2017-03-2130-115/+65
| | | | | | | | | | | | This was used for aubdumping (deleted a while ago) and INTEL_DEBUG=bat decoding (deleted recently). While we're changing parameters, delete the wrapper macro and make the actual function brw_state_batch instead of __brw_state_batch. This subsumes a patch by Emil Velikov to drop this from BLORP. Reviewed-by: Emil Velikov <[email protected]>
* i965: Use aubinator/genxml for INTEL_DEBUG=bat state decoding.Kenneth Graunke2017-03-216-870/+151
| | | | | | | | | | | | | | | | | | | This deletes all of our handwritten code in favor of autogenerated genxml-based decoding. This should be much more usable, as the old code isn't entirely accurate - we updated some things for new generations, but not everything. Aubinator has one annoying limitation: it has no idea how many entries to print when encountering e.g. 3DSTATE_BINDING_TABLE_POINTERS_VS. It picks an arbitrary number, which may skip decoding valid data, and may print extra garbage entries. We do a better job here by making brw_state_batch track the size of the data stored at a particular batchbuffer offset. Then, we can divide by the structure size to obtain the exact number of entries. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* i965: Use aubinator/genxml for INTEL_DEBUG=bat commands.Kenneth Graunke2017-03-211-21/+39
| | | | | | | | | | | | | | | This should give substantially better decoding, as the public libdrm decoder hasn't been properly maintained in years. For now, we reuse the existing state dumping mechanism. We'll improve that in the next patch. To avoid increasing the size of the driver, we restrict this feature to debug builds of Mesa. There's probably very little use for it in release builds anyway. Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util/disk_cache: use a helper to compute cache keysGrazvydas Ignotas2017-03-211-6/+6
| | | | | | | | | | This will allow to hash additional data into the cache keys or even change the hashing algorithm easily, should we decide to do so. v2: don't try to compute key (and crash) if cache is disabled Signed-off-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* i965: Add autogenerated OA files to .gitignore.Kenneth Graunke2017-03-201-0/+1
|
* i965: Skip register write detection when possible.Kenneth Graunke2017-03-201-2/+8
| | | | | | | | | | | | | | | | | | | Detecting register write support by trial and error introduces a stall at screen creation time, which it would be nice to avoid. Certain command parser versions guarantee this will work (see the giant comment in intelInitScreen2 below, or a few commits ago): - Ivybridge: version >= 1 (kernel v3.16) - Baytrail: version >= 2 (kernel v3.19) - Haswell: version >= 7 (kernel v4.8) For simplicity, we don't bother with version 1 in this patch. This assumes that the user hasn't disabled aliasing PPGTT via a kernel command line parameter. Don't do that - you're only breaking things. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* i965: Set screen->cmd_parser_version to 0 if we can't write registers.Kenneth Graunke2017-03-201-6/+11
| | | | | | | | | | | | | | | | If we can't write registers, then the effective command parser version is 0 - it may exist, but it's not usefully enabling anything. See kernel commit 1ca3712ca3429a617ed6c5f87718e4f6fe4ae0c6 (in v4.8) where the kernel starts doing this for us. This makes us do more or less the same thing on older kernels. This should preserve a bit of sanity by allowing us to perform a screen->cmd_parser_version > N check to determine that we really can use the features promised by command parser version N. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* i965: Document the sad story of the kernel command parser.Kenneth Graunke2017-03-201-0/+97
| | | | | | | | This should help us figure out the complexities of which kernel versions we need to get various features on various platforms. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* i965: Fall back to GL 4.2/4.3 on Haswell if the kernel isn't new enough.Kenneth Graunke2017-03-201-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | In commit d2590eb65ff28a9cbd592353d15d7e6cbd2c6fc6 I enabled GL 4.5 on Haswell...but failed to check if we could do indirect compute shader dispatch...and query buffer objects. Indirect compute shader dispatch requires command parser version 5 (kernel commit 7b9748cb513a6bef4af87b79f0da3ff7e8b56cd8, which is in Linux v4.4). On earlier kernels we would have disabled ARB_compute_shader, which is a mandatory part of OpenGL 4.3+. Query buffer objects currently require MI_MATH and MI_LOAD_REGISTER_REG, which mean command parser version 7 (Linux v4.8). On earlier kernels we would have disabled ARB_query_buffer_object, which is a mandatory part of OpenGL 4.4+. The new version support looks like: - Kernel 4.1 and older => OpenGL 3.3 - Kernel 4.2-4.3 => OpenGL 4.2 - Kernel 4.4-4.7 => OpenGL 4.3 - Kernel 4.8+ => OpenGL 4.5 Cc: "17.0" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
* intel: Correct the BDW surface state sizeNanley Chery2017-03-201-3/+2
| | | | | | | | | | | The PRMs state that this packet is 16 DWORDS long. Ensure that the last three DWORDS are zeroed as required by the hardware when allocating a null surface state. Cc: <[email protected]> Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* st/mesa: set result writemask based on ir typeIlia Mirkin2017-03-181-0/+1
| | | | | | | | | | This prevents textureQueryLevels, which maps as LODQ, from ending up with a xyzw writemask, which is illegal. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100061 Signed-off-by: Ilia Mirkin <[email protected]> Cc: [email protected] Reviewed-by: Marek Olšák <[email protected]>
* i965: Allow a per gen timebase scale factorRobert Bragg2017-03-174-25/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to Skylake the Gen HW timestamps were driven by a 12.5MHz clock with the convenient property of being able to scale by an integer (80) to nanosecond units. For Skylake the frequency is 12MHz or a scale factor of 83.333333 This updates gen_device_info to track a floating point timebase_scale factor and makes corresponding _queryobj.c changes to no longer assume a scale factor of 80 works across all gens. Although the gen6_ code could have been been left alone, the changes keep the code more comparable, and it now shares a few utility functions for scaling raw timestamps and calculating deltas. The utility for calculating deltas takes into account 32 or 36bit overflow depending on the current kernel version. Note: this leaves the timestamp handling of ARB_query_buffer_object untouched, which continues to use an incorrect scale of 80 on Skylake for now. This is more awkward to solve since the scaling is currently done using a very limited uint64 ALU available to the command parser that doesn't support multiply or divide where it's already taking a large number of instructions just to effectively multiple by 80. This fixes piglit arb_timer_query-timestamp-get on Skylake v2: (Ken) Update timebase_scale for platforms past Skylake/Broxton too. Signed-off-by: Robert Bragg <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965: bounds checks while concatenating sysfs pathsRobert Bragg2017-03-171-11/+32
| | | | | | | | | | | | | | This adds some missing return value checks for all uses of snprintf in brw_performance_query.c. This also switches a use of strncpy + strncat for snprintf for consistency and to avoid the chance of the strncpy leaving an unterminated string in the dest buffer if the src is too long. This issue with strncpy was picked up by Coverity. CID: 1402201 Signed-off-by: Robert Bragg <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]>