summaryrefslogtreecommitdiffstats
path: root/src/mesa
Commit message (Collapse)AuthorAgeFilesLines
* mesa: remove unused vertex attrib WEIGHTMarek Olšák2017-11-259-24/+24
| | | | | | | | | | | | We don't support ARB_vertex_blend. Note that the attribute aliasing check for ARB_vertex_program had to be rewritten. vbo_context: 20344 -> 20008 bytes gl_context: 74672 -> 74616 bytes Reviewed-by: Ian Romanick <[email protected]>
* mesa: don't assign numbers to vertex attrib enums manuallyMarek Olšák2017-11-252-99/+99
| | | | | | I plan to remove one of them. Reviewed-by: Ian Romanick <[email protected]>
* meson: Enable SSE4.1 optimizationsDylan Baker2017-11-221-3/+11
| | | | | | | | | | | | This patch checks for an and then enables sse4.1 optimizations if the host machine will be x86/x86_64. v2: - Don't compile code, it's unnecessary since we require a compiler which always has SSE4.1 (Matt) v3: - x64 -> x86_64 (Matt) Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* i965: Support decoding INTERFACE_DESCRIPTOR_DATA with INTEL_DEBUG=batJordan Justen2017-11-211-0/+24
| | | | | | | | This will dump the INTERFACE_DESCRIPTOR_DATA along with the associated samplers & surfaces. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Scott D Phillips <[email protected]>
* mesa/teximage: add TEXTURE_CUBE_MAP_ARRAY target for CompressedTexImage3DJuan A. Suarez Romero2017-11-211-1/+19
| | | | | | | | | | | | | | | | | | | | | From section 8.7, page 179 of OpenGL ES 3.2 spec: An INVALID_OPERATION error is generated by CompressedTexImage3D if internalformat is one of the the formats in table 8.17 and target is not TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY or TEXTURE_3D. An INVALID_OPERATION error is generated by CompressedTexImage3D if internalformat is TEXTURE_CUBE_MAP_ARRAY and the “Cube Map Array” column of table 8.17 is not checked, or if internalformat is TEXTURE_3D and the “3D Tex.” column of table 8.17 is not checked. So far it was only considering TEXTURE_2D_ARRAY as valid target. But as "Cube Map Array" column is checked for all the cases, in practice we can consider also TEXTURE_CUBE_MAP_ARRAY. This fixes KHR-GLES32.core.texture_cube_map_array.etc2_texture Reviewed-by: Nanley Chery <[email protected]>
* st/glsl_to_nir: don't generate nir twice for gsTimothy Arceri2017-11-211-8/+2
| | | | | | This was left out of c980a3aa3133 Reviewed-by: Marek Olšák <[email protected]>
* i965: Optimize bucket index calculationAravindan Muthukumar2017-11-201-8/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reducing Bucket index calculation to O(1). This algorithm calculates the index using matrix method. Assuming PAGE_SIZE is 4096, matrix arrangement is as below: 1*4096 2*4096 3*4096 4*4096 5*4096 6*4096 7*4096 8*4096 10*4096 12*4096 14*4096 16*4096 20*4096 24*4096 28*4096 32*4096 ... ... ... ... ... ... ... ... ... ... ... max_cache_size From this matrix its clearly seen that every row follows the below way: ... ... ... n n+(1/4)n n+(1/2)n n+(3/4)n 2n Row is calculated as log2(size/PAGE_SIZE) Column is calculated as converting the difference between the elements to fit into power size of two and indexing it. Final Index is (row*4)+(col-1) Tested with Intel Mesa CI. Improves performance of 3DMark on BXT by 0.705966% +/- 0.229767% (n=20) v4: Review comments on style and code comments implemented (Ian). v3: Review comments implemented (Ian). v2: Review comments implemented (Jason). Signed-off-by: Aravindan Muthukumar <[email protected]> Signed-off-by: Kedar Karanje <[email protected]> Reviewed-by: Yogesh Marathe <[email protected]> Signed-off-by: Ian Romanick <[email protected]>
* st/mesa: use asynchronous flushes in st_finishNicolai Hähnle2017-11-201-1/+1
| | | | | | | | | With threaded gallium, the driver may currently be running in another thread. In that case, we will execute all remaining commands in that thread instead of syncing, which should be better for cache locality. Reviewed-by: Andres Rodriguez <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* st/mesa: implement st_server_wait_sync properlyNicolai Hähnle2017-11-201-2/+24
| | | | | | | | | | | | | | | | | | | | | Asynchronous flushes require a proper implementation of st_server_wait_sync, because we could have the following with threaded Gallium: Context 1 app Context 1 driver Context 2 ------------- ---------------- --------- f = glFenceSync glFlush <-- app sync --> <-- app sync --> glWaitSync(f) .. draw calls .. pipe_context::flush for glFenceSync pipe_context::flush for glFlush Reviewed-by: Andres Rodriguez <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* i965: Mark BOs as external when we export their handleJason Ekstrand2017-11-173-1/+11
| | | | | | | | | | | | | | | | | | | | Almost all of our BO export paths were already properly marked the BO as external and added it to the handle table. Most export use-cases go through a prime fd or flink where we have a brw_bo export helper that does the right thing. The one missing one happens when you call queryImage and ask for __DRI_IMAGE_ATTRIB_HANDLE. We just grabbed the gem handle out of the BO (because it's really easy to do that) and handed it off to the client; what could go wrong? As it turns out, this path is used by basically every compositor that wants to turn around and call drmModeAddFB2 on it so it can hand it off to display. The result, as of 4b1e70cc57d7ff5f465544644b2180dee1490cee, is that we no longer set MOCS_PTE on those surfaces and the kernel's attempts to disable caching fail and we scanout gets corruption. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103759 Fixes: 4b1e70cc57d7ff5f465544644b2180dee1490cee Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected]
* i965/bufmgr: Add a helper to mark a BO as externalJason Ekstrand2017-11-171-6/+11
| | | | | Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected]
* i965: Revert Gen8 aspect of VF PIPE_CONTROL workaround.Kenneth Graunke2017-11-171-1/+5
| | | | | | | This apparently causes hangs on Broadwell, so let's back it out for now. I think there are other PIPE_CONTROL workarounds that we're missing. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103787
* i965: Rewrite disassembly annotation codeMatt Turner2017-11-171-1/+1
| | | | | | | | | | | | | | | The old code used an array to store each "instruction group" (the new, better name than the old overloaded "annotation"), and required a memmove() to shift elements over in the array when we needed to split a group so that we could add an error message. This was confusing and difficult to get right, not the least of which was because the array has a tail sentinel not included in .ann_count. Instead use a linked list, a data structure made for efficient insertion. Acked-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965: Remove DWord length from MI_FLUSH_DW definitionAnuj Phogat2017-11-171-1/+1
| | | | | | | | Fixes: 6165fda59b8 ("i965: Program DWord Length in MI_FLUSH_DW") Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Nanley Chery <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/main/texcompress_s3tc_tmp.h: Fix two -Wparam-unused warnings.Gert Wollny2017-11-171-2/+2
| | | | | | | | | Decorate the params accordingly with "UNUSED". v2: move UNUSED decoration in front of parameter declaration Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Brian Paul <[email protected]> (v1)
* st/mesa: use enum types instead of int/unsigned (v3)Brian Paul2017-11-164-12/+23
| | | | | | | | | | | | | Use the proper enum types for various variables. Makes life in gdb a little nicer. Note that the size of enum bitfields must be one larger so the high bit is always zero (for MSVC). v2: also increase size of image_format bitfield, per Eric Engestrom. v3: use the new ASSERT_BITFIELD_SIZE() macro Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* st/mesa: don't move ssbo after atomic buffers if we support hw atomicsDave Airlie2017-11-172-9/+13
| | | | | | | There is no need to have these overlap if we support hw atomics. Reviewed-by: Ilia Mirkin <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* i965: Upload invariant state once at the start of the batch on Gen4-5.Kenneth Graunke2017-11-164-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | We want to emit invariant state at the start of a render batch. In the past, this more or less happened: a new batch flagged BRW_NEW_CONTEXT (because we don't have hardware contexts), which triggered the brw_invariant_state atom. So, it would be emitted before any 3D drawing. (Technically, there might be some BLT commands in the batch because Gen4-5 have a single combined render/BLT ring, but that should be harmless). With the advent of BLORP, this broke. The first item in a batch might be a BLORP operation, which bypasses the normal draw upload path. So, we need to ensure invariant state happens first. To do that, we just upload it when creating a new batch. On Gen6+ we'd need to worry about whether it's a RENDER or BLT batch, but because we have a combined ring, this approach should work fine on Gen4-5. Seems to fix GPU hangs when playing hardware accelerated video with mpv -hwdec=vaapi on Ironlake. Cc: [email protected] Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103529 Reviewed-by: Jason Ekstrand <[email protected]>
* meson: Add dridriverdir variable to dri.pc.Rafael Antognolli2017-11-161-0/+1
| | | | | | | | | Xorg (and possibly other things) depend on this variable to find the path to DRI drivers. Signed-off-by: Rafael Antognolli <[email protected]> Cc: Dylan Baker <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* i915: add missing extensions.h includeEmil Velikov2017-11-162-0/+2
| | | | | | | | | | | Otherwise we'll bail with due to -Werror=implicit-function-declaration. It went unnoticed since the we had a bug which did consistently set the compiler flag. Fixes: ba8a347f932 ("mesa: split extensions overrides and glGetString(GL_EXTENSIONS)") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Andres Gomez <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: return 'unrecognized' extensions in glGetStringiEmil Velikov2017-11-161-0/+13
| | | | | | | | Analogous to the glGetString() case - report all the extensions enabled via MESA_EXTENSION_OVERRIDE Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: rework the way we manage extra_extensionsEmil Velikov2017-11-162-43/+39
| | | | | | | | | | | | | | Store pointers to the tokenized strings in the gl_extensions struct. This way we can reuse them in glGetStringi() while we construct the really long string only in _mesa_make_extension_string. Only 16 pointers/strings are stored for now. v2: Warn only once when we provide more than 16 unk. extensions, rebase Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> (v1)
* mesa: pass the ctx to _mesa_one_time_init_extension_overridesEmil Velikov2017-11-163-3/+3
| | | | | | | Will be needed with next commit Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: call atexit() only as neededEmil Velikov2017-11-161-3/+1
| | | | | | | | | | If the extra_extensions string is empty there's no need to call atexit() - there's nothing to free. v2: Rebase Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> (v1)
* mesa: remove unnecessary 'sort by year' for the GL extensionsEmil Velikov2017-11-161-50/+3
| | | | | | | | | | | | | | | | | | | The sorting was originally added to work around broken games (comment says Quake3 demo) that were copying the extensions list into small buffer. Sorting does not solve the problem, since we'll still overflow and cause corruption/crash. Better workaround is to actually trim the string ... as done with a later commit which introduces the MESA_EXTENSION_MAX_YEAR env. variable. Side note: On my machine, the existing sorting makes no changes to the extensions string. Cc: Jose Fonseca <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: reuse set_extension() for _mesa_extension_override_disablesEmil Velikov2017-11-161-4/+3
| | | | | | | | We already use it for _mesa_extension_override_enables. Improve consistency and use it for both extension lists. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: drop unnecessary coping of extra_extensionsEmil Velikov2017-11-161-11/+6
| | | | | | | | | | The function get_extension_override() returns a copy of a string, only for it to be copied again ... Drop the unneeded calloc/strdup/free dance. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove duplicate 'disabled extensions' listEmil Velikov2017-11-161-7/+1
| | | | | | | | | | | | | | | While parsing MESA_EXTENSION_OVERRIDE we keep track of the disabled extensions, twice - in _mesa_extension_override_disables and disabled_extensions. Upon context creation, we use the former to modify the extensions list. Yet, we still check the updated list against disabled_extensions. Remove disabled_extensions, it's obsolete. Cc: Jordan Justen <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: call _mesa_make_extension_string only as neededEmil Velikov2017-11-162-2/+2
| | | | | | | | | | | | | | As of previous commit we removed the extension overrides from this function. Thus we no longer need to call it during MakeCurrent, so we can construct the extensions string when needed - _mesa_GetString. This commit effectively reverts a879d14ecf8 ("mesa: initialize extension string when context is first bound") Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: split extensions overrides and glGetString(GL_EXTENSIONS)Emil Velikov2017-11-1612-20/+24
| | | | | | | | | | | | | Currently we apply the extension overrides and construct the extensions string upon MakeCurrent. They are two distinct things, so let's slit the two while pushing the overrides management _before_ _mesa_compute_version(). This ensures that the version is updated to reflect the enabled/disabled extensions. Cc: Jordan Justen <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* i965: remove ARB_compute_shader extension overrideEmil Velikov2017-11-161-2/+1
| | | | | | | | | | | | Checking the override was useful in the early stages of developing the extension. Now that everything is wired, where possible, we can drop the check. Doing so allows us to simplify some of the related code. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
* i965: use _mesa_is_desktop_gl helperEmil Velikov2017-11-161-1/+1
| | | | | | | Use the helper over opencoding the check. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* i965: Implement another VF cache invalidate workaround on Gen8+.Kenneth Graunke2017-11-161-8/+33
| | | | | | | | | | | | ...and provide a better citation for the existing one. v2: - Apply the workaround to Gen8 too, as intended (caught by Topi). - Restructure to add bits instead of an extra flush (based on a similar patch by Rafael Antognolli). Cc: [email protected] Reviewed-by: Rafael Antognolli <[email protected]>
* st/mesa: whitespace fixes in st_manager.cBrian Paul2017-11-151-5/+31
| | | | Trivial.
* st/mesa: whitespace clean-ups in st_context.cBrian Paul2017-11-151-31/+46
| | | | Trivial.
* st/mesa: move st_manager_destroy() earlier in fileBrian Paul2017-11-151-13/+15
| | | | | | To avoid forward declaration. Reviewed-By: Gert Wollny <[email protected]>
* st/mesa: move st_init_driver_flags() earlier in fileBrian Paul2017-11-151-61/+62
| | | | | | To get rid of forward declaration. Reviewed-By: Gert Wollny <[email protected]>
* i965: Drop some reserved space remnants.Kenneth Graunke2017-11-152-4/+1
| | | | | | BATCH_RESERVED was deleted in commit 2c46a67b4138631217 (i965: Delete BATCH_RESERVED handling.) The reserved_space field is dead code, and the comments aren't useful these days.
* i965: Fold ABO state upload code into the SSBO/UBO state upload code.Kenneth Graunke2017-11-1510-189/+16
| | | | | | | | | | | Having this separate could potentially make programs that rebind atomics but no other surfaces ever so slightly faster. But it's a tiny amount of code to add to the existing UBO/SSBO atom, and very related. The extra atoms have a cost on every draw call, and so dropping some of them would be nice. This also reclaims a dirty bit. Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Use nir_lower_atomics_to_ssbos and delete ABO compiler code.Kenneth Graunke2017-11-153-11/+8
| | | | | | | | | | | | We use the same hardware mechanism for both atomic counters and SSBO atomics, so there's really no benefit to maintaining separate code to handle each case. Instead, we can just use Rob's shiny new NIR pass to convert atomic_uints to SSBOs, and delete piles of code. The ssbo_start section of the binding table becomes a combined ABO and SSBO section, with ABOs first, then SSBOs. Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Make a better helper function for UBO/SSBO/ABO surface handling.Kenneth Graunke2017-11-153-94/+37
| | | | | | | | | This fixes the missing AutomaticSize handling in the ABO code, removes a bunch of duplicated code, and drops an extra layer of wrapping around brw_emit_buffer_surface_state(). Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* st/glsl_to_tgsi: use tgsi_get_gl_varying_semantic() for gs/tes outputsTimothy Arceri2017-11-151-91/+5
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* st/glsl_to_tgsi: make use of tgsi_get_gl_varying_semantic()Timothy Arceri2017-11-151-71/+11
| | | | Reviewed-by: Nicolai Hähnle <[email protected]>
* i965: Make use of brw_load_register_imm32() helper functionAnuj Phogat2017-11-145-40/+19
| | | | | Signed-off-by: Anuj Phogat <[email protected]> Cc: Nanley Chery <[email protected]>
* i965/gen8+: Fix the number of dwords programmed in MI_FLUSH_DWAnuj Phogat2017-11-142-5/+19
| | | | | | | Number of dwords in MI_FLUSH_DW changed from 4 to 5 in gen8+. Signed-off-by: Anuj Phogat <[email protected]> Cc: <[email protected]>
* i965: Program DWord Length in MI_FLUSH_DWAnuj Phogat2017-11-142-2/+2
| | | | | Signed-off-by: Anuj Phogat <[email protected]> Cc: <[email protected]>
* mesa/st: add missing copyright headers to memoryobjects filesAndres Rodriguez2017-11-142-0/+48
| | | | | Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: minor tidy up for memory object error stringsAndres Rodriguez2017-11-141-16/+14
| | | | | Signed-off-by: Andres Rodriguez <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* i965: implement (un)mapImageJulien Isorce2017-11-141-2/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Already implemented for Gallium drivers. Useful for gbm_bo_(un)map. Tests: By porting wayland/weston/clients/simple-dmabuf-drm.c to GBM. kmscube --mode=rgba kmscube --mode=nv12-1img kmscube --mode=nv12-2img piglit ext_image_dma_buf_import-refcount -auto piglit ext_image_dma_buf_import-transcode-nv12-as-r8-gr88 -auto piglit ext_image_dma_buf_import-sample_rgb -fmt=XR24 -alpha-one -auto piglit ext_image_dma_buf_import-sample_rgb -fmt=AR24 -auto piglit ext_image_dma_buf_import-sample_yuv -fmt=NV12 -auto piglit ext_image_dma_buf_import-sample_yuv -fmt=YU12 -auto piglit ext_image_dma_buf_import-sample_yuv -fmt=YV12 -auto v2: add early return if (flag & MAP_INTERNAL_MASK) v3: take input rect into account and test with kmscube and piglit. v4: handle wraparound and bo reference. v5: indent, exclude 0 width and height on the boundary, map bo independently of the image. Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Chris Wilson <[email protected]>
* i965: Track the depth and render caches separatelyJason Ekstrand2017-11-135-22/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we just had one hash set for tracking depth and render caches called brw_context::render_cache. This is less than ideal because the depth and render caches are separate and we can't track moves between the depth and the render caches. This limitation led to some unnecessary flushing around the depth cache. There are cases (mostly with BLORP) where we can end up touching a depth or stencil buffer through the render cache. To guard against this, blorp would unconditionally do a render_cache_set_check_flush on it's destination which meant that if you did any rendering (including a BLORP operation) to a given surface and then used it as a blorp destination, you would end up flushing it out of the render cache before rendering into it. Things get worse when you dig into the depth/stencil state code for regular GL draw calls. Because we may end up rendering to a depth or stencil buffer via BLORP, we did a render_cache_set_check_flush on all depth and stencil buffers in brw_emit_depthbuffer to ensure that they got flushed out of the render cache prior to using them for depth or stencil testing. However, because we also need to track dirtiness for depth and stencil so that we can implement depth and stencil texturing correctly, we were adding all depth and stencil buffers to the render cache set in brw_postdraw_set_buffers_need_resolve. This meant that, if anything caused 3DSTATE_DEPTH_BUFFER to get re-emitted (currently _NEW_BUFFERS, BRW_NEW_BATCH, and BRW_NEW_BLORP), we would almost always do a full pipeline stall and render/depth cache flush. The root cause of both of these problems is that we can't tell the difference between the render and depth caches in our tracking. This commit splits our cache tracking into two sets, one for render and one for depth, and properly handles transitioning between the two. We still flush all the caches whenever anything needs to be flushed. The idea is that if we're going to take the hit of a flush and stall, we may as well flush everything in the hopes that we can avoid a flush by something else later. Reviewed-by: Kenneth Graunke <[email protected]>