summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* radeonsi: move scratch reloc state setupMarek Olšák2015-03-162-15/+22
| | | | | | | | - move it to its own function - do it after all states are emitted - bump SI_MAX_DRAW_CS_DWORDS Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: don't emit PA_SC_LINE_STIPPLE if not rendering linesMarek Olšák2015-03-161-0/+8
| | | | Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: don't emit PA_SC_LINE_STIPPLE after every rasterizer state changeMarek Olšák2015-03-164-7/+7
| | | | | | Do it only when the line stipple state is changed. Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: move PA_SU_SC_MODE_CNTL to rasterizer stateMarek Olšák2015-03-165-30/+14
| | | | | | | | | This requires enabling the optional GL provoking vertex behavior for quads. + some cosmetic changes, so that the register is set exactly the same as on r600. Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: implement line and polygon smoothingMarek Olšák2015-03-164-10/+49
| | | | Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: add shader code for smoothingMarek Olšák2015-03-163-1/+39
| | | | | | | The fragment shader multiplies the alpha channel with gl_SampleMaskIn. If blending is enabled, it looks like MSAA. Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: split sample locations into its own state atomMarek Olšák2015-03-165-0/+18
| | | | | | Sample locations are not updated as often as framebuffers. Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: add basic code for overrasterizationMarek Olšák2015-03-165-16/+28
| | | | | | | This will be used for line and polygon smoothing. This is GCN-only even though it's in shared code. Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: small cleanup in si_shader_selector_keyMarek Olšák2015-03-161-12/+12
| | | | Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: simplify accessing alpha pointer in si_llvm_emit_fs_epilogueMarek Olšák2015-03-161-7/+8
| | | | Reviewed-by: Michel Dänzer <[email protected]>
* radeonsi: add support for easy opcodes from ARB_gpu_shader5Marek Olšák2015-03-161-0/+8
| | | | | | | | I have to use the BFE instrinsics, because BFE is one of the most complex instructions that can't be matched easily. BFE has 3 conditional branches and one of them is quite big. In the isel DAG, lowered BFE has 27 nodes (including leafs).
* radeonsi: implement bit-finding opcodes from ARB_gpu_shader5Marek Olšák2015-03-161-0/+92
| | | | Reviewed-by: Glenn Kennard <[email protected]>
* radeonsi: implement gl_SampleMaskInMarek Olšák2015-03-161-0/+4
| | | | Reviewed-by: Glenn Kennard <[email protected]>
* radeonsi: add support for SQRTMarek Olšák2015-03-162-1/+3
| | | | | Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Glenn Kennard <[email protected]>
* radeonsi: add support for FMAMarek Olšák2015-03-162-1/+4
| | | | | Reviewed-by: Tom Stellard <[email protected]> Reviewed-by: Glenn Kennard <[email protected]>
* gallium/radeon: don't use LLVMReadOnlyAttribute for ALUMarek Olšák2015-03-161-16/+9
| | | | | | | None of the instructions use a pointer argument. (+ small cosmetic changes) Reviewed-by: Tom Stellard <[email protected]>
* tgsi: handle bitwise opcodes in tgsi_opcode_infer_type (v2)Marek Olšák2015-03-161-0/+8
| | | | | | v2: set the same types as the destination type in tgsi_exec Reviewed-by: Ilia Mirkin <[email protected]>
* gallium: add FMA and DFMA opcodes (v3)Marek Olšák2015-03-1620-12/+62
| | | | | | | | | Needed by ARB_gpu_shader5. v2: select DMAD for FMA with double precision v3: add and select DFMA Reviewed-by: Ilia Mirkin <[email protected]>
* freedreno: update generated headersRob Clark2015-03-155-6/+6
| | | | | | | Fix a3xx texture layer-size. Signed-off-by: Rob Clark <[email protected]> Cc: "10.4 10.5" <[email protected]>
* freedreno/ir3: remove old compilerRob Clark2015-03-157-1574/+10
| | | | | | | Now that piglit is no longer falling back to old compiler for any tests, we can remove it. Hurray \o/ Signed-off-by: Rob Clark <[email protected]>
* freedreno/ir3: avoid scheduler deadlockRob Clark2015-03-153-0/+45
| | | | | | | | | | | Deadlock can occur if we schedule an address register write, yet some instructions which depend on that address register value also depend on other unscheduled instructions that depend on a different address register value. To solve this, before scheduling an address register write, ensure that all the other dependencies of the instructions which consume this address register are already scheduled. Signed-off-by: Rob Clark <[email protected]>
* freedreno/ir3: bit of cleanupRob Clark2015-03-153-19/+23
| | | | | | | | Add an array_insert() macro to simplify inserting into dynamically sized arrays, add a comment, and remove unused prototype inherited from the original freedreno.git/fdre-a3xx test code, etc. Signed-off-by: Rob Clark <[email protected]>
* i965: De-duplicate is_expression_commutative() functions.Kenneth Graunke2015-03-154-46/+25
| | | | | | | | Create a backend_inst::is_commutative() method to replace two static functions that did the exact same thing. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
* i965/gen4-5: Cope with immutable-format texture revalidationChris Forbes2015-03-141-3/+10
| | | | | | | | | | This is unfortunately sometimes necessary due to rebasing levels when rendering into them. 16 piglits crash -> pass, when building mesa with debug enabled. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* freedreno: fix slice pitch calculationsIlia Mirkin2015-03-131-1/+1
| | | | | | | | | | | | | For example if width were 65, the first slice would get 96 while the second would get 32. However the hardware appears to expect the second pitch to be 64, based on halving the 96 (and aligning up to 32). This fixes texelFetch piglit tests on a3xx below a certain size. Going higher they break again, but most likely due to unrelated reasons. Signed-off-by: Ilia Mirkin <[email protected]> Cc: "10.4 10.5" <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* freedreno/a3xx: use the same layer size for all slicesIlia Mirkin2015-03-131-1/+8
| | | | | | | | | | | | | | | | | | We only program in one layer size per texture, so that means that all levels must share one size. This makes the piglit test bin/texelFetch fs sampler2DArray have the same breakage as its non-array version instead of being completely off, and makes bin/ext_texture_array-gen-mipmap start passing. Signed-off-by: Ilia Mirkin <[email protected]> Cc: "10.4 10.5" <[email protected]> Reviewed-by: Rob Clark <[email protected]>
* i965/vs: Add missing resolve_bool_comparison calls on GEN4 and GEN5Ian Romanick2015-03-131-0/+13
| | | | | | | | | | | | | | | | | | | | | The ir_unop_any problem was discovered by some later optimization passes that generate ir_triop_csel. I was also able to reproduce it by modifying the gl-2.0-vertexattribpointer vertex shader to generate its result using color = mix(vec4(0, 1, 0, 0), vec4(1, 0, 0, 0), bvec4(any(greaterThan(diff, vec4(tolerance))))); instead of an if-statement. This also required using #version 130 and MESA_GLSL_VERSION_OVERRIDE=130. I have not nominated this for stable releases because I don't think there's any way to trigger the problem without GLSL 1.30 or optimizations that don't exist in stable. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Abdiel Janulgue <[email protected]>
* i965/disasm: Fix format stringsChris Forbes2015-03-141-24/+24
| | | | | | | | Most of the brw_inst_* api returns 64bit values. This fixes disassembly of sampler messages, etc. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* i965/disasm: Mark format() as being printf-style.Chris Forbes2015-03-141-0/+3
| | | | | | | | This allows us to get warnings from GCC when we mess up the format strings. Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* glsl: Expose built-in packing functions under GLSL 4.2.Matt Turner2015-03-131-1/+1
| | | | | | | | | | | | | | ARB_shading_language_packing is part of GLSL 4.2, not 4.0 as I mistakenly believed. The following functions are available only with ARB_shading_language_packing, GLSL 4.2 (not GLSL 4.0), or ES 3.0: - packSnorm2x16 - unpackSnorm2x16 - packHalf2x16 - unpackHalf2x16 Reviewed-by: Carl Worth <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* egl: Create queryable strings in eglInitialize().Matt Turner2015-03-132-125/+112
| | | | | | | | | | | | | | | | | | | | | | | Creating/recreating the strings in eglQueryString() is extra work and isn't thread-safe, as exhibited by shader-db's run.c using libepoxy. Multiple threads in run.c call eglReleaseThread() around the same time. libepoxy calls eglQueryString() to determine whether eglReleaseThread() exists, and our EGL implementation passes a pointer to the version string to libepoxy while simultaneously overwriting the string, leading to a failure in libepoxy. Moreover, the EGL spec says (emphasis mine): "eglQueryString returns a pointer to a *static*, zero-terminated string" This patch moves some auxiliary functions from eglmisc.c to eglapi.c so that they may be used to create the extension, API, and version strings once during eglInitialize(). The auxiliary functions are renamed from _eglUpdate* to _eglCreate*, and some checks made unnecessary by calling the functions from eglInitialize() are removed. Reviewed-by: Chad Versace <[email protected]>
* glsl: optimize (0 cmp x + y) into (-x cmp y).Samuel Iglesias Gonsalvez2015-03-131-3/+12
| | | | | | | | | | | | | The optimization done by commit 34ec1a24d did not take it into account. Fixes: dEQP-GLES3.functional.shaders.random.all_features.fragment.20 Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Cc: "10.4 10.5" <[email protected]>
* mesa: Check for valid PBO access in gl(Compressed)Tex(Sub)Image callsEduardo Lima Mitev2015-03-131-77/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds two types of checks to the gl(Compressed)Tex(Sub)Imgage family of functions when a pixel buffer object is bound to GL_PIXEL_UNPACK_BUFFER: - That the buffer is not mapped. - The total data size is within the boundaries of the buffer size. It does so by calling auxiliary validations functions from PBO API: _mesa_validate_pbo_source() for non-compressed texture calls, and _mesa_validate_pbo_source_compressed() for compressed texture calls. The first check is defined in Section 6.3.2 'Effects of Mapping Buffers on Other GL Commands' of the GLES 3.1 spec, page 57: "Any GL command which attempts to read from, write to, or change the state of a buffer object may generate an INVALID_OPERATION error if all or part of the buffer object is mapped. However, only commands which explicitly describe this error are required to do so. If an error is not generated, using such commands to perform invalid reads, writes, or state changes will have undefined results and may result in GL interruption or termination." Similar wording exists in GL 4.5 spec, page 76. In the case of gl(Compressed)Tex(Sub)Image(2,3)D, the specification doesn't force implemtations to throw an error. However since Mesa don't currently implement checks to determine when it is safe to read/write from/to a mapped PBO, we should always return the error if all or parts of it are mapped. The 2nd check is defined in Section 8.5 'Texture Image Specification' of the OpenGL 4.5 spec, page 203: "An INVALID_OPERATION error is generated if a pixel unpack buffer object is bound and storing texture data would access memory beyond the end of the pixel unpack buffer." Fixes 4 dEQP tests: * dEQP-GLES3.functional.negative_api.texture.compressedteximage2d_invalid_buffer_target * dEQP-GLES3.functional.negative_api.texture.compressedtexsubimage2d_invalid_buffer_target * dEQP-GLES3.functional.negative_api.texture.compressedteximage3d_invalid_buffer_target * dEQP-GLES3.functional.negative_api.texture.compressedtexsubimage3d_invalid_buffer_target Reviewed-by: Laura Ekstrand <[email protected]>
* mesa: Separate PBO validation checks from buffer mapping, to allow reuseEduardo Lima Mitev2015-03-132-31/+100
| | | | | | | | | | | Internal PBO functions such as _mesa_map_validate_pbo_source() and _mesa_validate_pbo_compressed_teximage() perform validation and buffer mapping within the same call. This patch takes out the validation into separate functions to allow reuse of functionality by other code (i.e, gl(Compressed)Tex(Sub)Image). Reviewed-by: Laura Ekstrand <[email protected]>
* mesa: Set the correct image size in _mesa_validate_pbo_access()Eduardo Lima Mitev2015-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _mesa_validate_pbo_access() provides a generic way to check that a requested pixel transfer operation on a PBO falls within the boundaries of the buffer. It is used in various other places, and depending on the caller, some arguments are used or not. In particular, the 'clientMemSize' argument is used only by calls that are knowledgeable of the total size of the user data involved in a pixel transfer, such as the case of compressed texture image calls. Other calls don't provide 'clientMemSize' directly since it is made implicit from the size and format of the texture, and its data type. In these cases, a sufficiently big value is passed to 'clientMemSize' (INT_MAX) to avoid an incorrect constrain. The problem is that _mesa_validate_pbo_access() use uint pointers to make the calculations, which are 64 bits long in 64 bits platforms, meanwhile the dummy INT_MAX passed in 'clientMemSize' is just 32 bits. This causes a constrain that is not desired. This patch fixes that by checking that if 'clientMemSize' is MAX_INT, then UINTPTR_MAX is assumed instead. This is an ugly workaround to the fact that _mesa_validate_pbo_access() intends to be a one function fits all. The clean solution here would be to break it into different functions that provide the adequate API for each of the possible code paths and validation needs. Since there are callers relying on passing INT_MAX to 'clientMemSize', this patch is necessary to deal with the problem above while a cleaner implementation of the PBO API is not implemented. Reviewed-by: Laura Ekstrand <[email protected]>
* meta: Remove error checks for texture <-> pixel-buffer transfers that don't ↵Eduardo Lima Mitev2015-03-131-32/+0
| | | | | | | | | | | | | | | | | belong in driver code The implementation of texture <-> pixel-buffer transfers in drivers common layer includes certain error checks and argument validation that don't belong there, considering how the Mesa codebase is laid out. These are higher level validations that, if necessary, should be performed earlier (i.e, in GL API entry points). This patch simply removes these error checks from driver code. For more information, see discussion at http://lists.freedesktop.org/archives/mesa-dev/2015-February/077417.html. Reviewed-by: Laura Ekstrand <[email protected]>
* util: convert slab macros to inline functionsBrian Paul2015-03-131-2/+11
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* egl: fix cast to silence compiler warningBrian Paul2015-03-131-1/+1
| | | | | | | | | | | | | | | | eglcurrent.c: In function '_eglSetTSD': eglcurrent.c:57:4: warning: passing argument 2 of 'tss_set' discards 'const' qualifier from pointer target type [enabled by default] tss_set(_egl_TSD, (const void *) t); ^ In file included from ../../../include/c11/threads.h:72:0, from eglcurrent.c:32: ../../../include/c11/threads_posix.h:357:1: note: expected 'void *' but argument is of type 'const void *' tss_set(tss_t key, void *val) ^ Reviewed-by: Emil Velikov <[email protected]>
* gallivm: (trivial) Fix typo in comment introduced by 70dc8aAlexandre Demers2015-03-131-1/+1
| | | | | | | Fix typo in comment introduced by 70dc8a Signed-off-by: Alexandre Demers <[email protected]> Signed-off-by: Jose Fonseca <[email protected]>
* mesa: improve ARB_copy_image internal format compat checkSeán de Búrca2015-03-121-21/+130
| | | | | | | | | | | | | | | | | | | | | | The memory layout of compatible internal formats may differ in bytes per block, so TexFormat is not a reliable measure of compatibility. For example, GL_RGB8 and GL_RGB8UI are compatible formats, but GL_RGB8 may be laid out in memory as B8G8R8X8. If GL_RGB8UI has a 3 byte-per-block memory layout, the existing compatibility check will fail. Additionally, the current check allows any two compressed textures which share block size to be used, whereas the spec gives an explicit table of compatible formats. v2: Use a switch instead of array iteration for block class and show the correct GL error when internal formats are mismatched. v3: Include spec citations for new compatibility checks, rearrange check order to ensure that compressed, view-compatible formats return the correct result, and make style fixes. Original commit message amended for clarity. v4: Reformatted spec citations. Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Fix non-determinism in nir_lower_vars_to_ssa().Kenneth Graunke2015-03-121-97/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we stored derefs in a hash table, using the malloc'd pointer as the key. Then, we walked through the hash table and generated code, based on the order of the hash table's elements. Memory addresses returned by malloc are pretty much random, which meant that the hash was random, and the hash table's elements would be walked in some random order. This led to successive compiles of the same shader using different variable names and slightly different orderings of phi-nodes. Code could not be diff'd, and the final assembly would sometimes change slightly too. It turns out the only point of the hash table was to avoid inserting the same node multiple times for different dereferences. We never actually searched the hash table! This patch uses an intrusive linked list instead. Since exec_list uses head and tail sentinels, checking prev or next against NULL will tell us whether the node is already in the list. Pair programming with Jason Ekstrand. Signed-off-by: Jason Ekstrand <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
* util: Fix foreach_list_typed_safe when exec_node is not at offset 0.Jason Ekstrand2015-03-121-2/+2
| | | | | | | | | | | | | | | | | | | | __next and __prev are pointers to the structure containing the exec_node link, not the embedded exec_node. NULL checks would fail unless the embedded exec_node happened to be at offset 0 in the parent struct. v2: Jason Ekstrand <[email protected]>: Use "(__node)->__field.next != NULL" to check for the end of the list instead of the "&__next->__field != NULL". The former is far more obviously correct as it matches what the non-safe versions do. The original code tried to avoid any use of __next as the client code may delete it during its execution. However, since the looping condition is checked after the iteration clause but before the client code is executed, we know that __node is valid during the looping condition. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* i965: Use NIR for scalar VS when INTEL_USE_NIR is set.Kenneth Graunke2015-03-121-5/+10
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Add VS output support to nir_setup_outputs().Kenneth Graunke2015-03-121-5/+11
| | | | | | | Adapted from fs_visitor::visit(ir_variable *). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Handle VS inputs in the NIR backend.Kenneth Graunke2015-03-121-1/+22
| | | | | | | | | | (Jason noted that this is not a good long term solution, and we should instead improve nir_lower_io so that this extra set of MOVs is unnecessary. I tend to agree, but decided we could do that as a follow-up improvement.) Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/fs: Refactor fs_visitor::nir_setup_inputs().Kenneth Graunke2015-03-121-10/+19
| | | | | | | | | | | No functional change. In preparation for supporting vertex shaders, this adds a switch statement on shader stage (since vertex attributes and fragment shader varyings will need different handling). It also renames "varying" to "input", to be more general. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965: Implement NIR intrinsics for loading VS system values.Kenneth Graunke2015-03-121-0/+51
| | | | | Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* nir: Add intrinsics for SYSTEM_VALUE_BASE_VERTEX and VERTEX_ID_ZERO_BASEKenneth Graunke2015-03-122-0/+8
| | | | | | | | | Ian and I added these around the time Connor was developing NIR. Now that both exist, we should make them work together! Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/nir: Lower to registers a bit later.Kenneth Graunke2015-03-121-3/+3
| | | | | | | | | | | We can't safely call nir_optimize() with register present, since several passes called in the loop can't handle registers, and will fail asserts. Notably, nir_lower_vec_alus() and nir_opt_algebraic() really don't want registers. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* i965/nir: Optimize after nir_lower_var_copies().Kenneth Graunke2015-03-121-0/+3
| | | | | | | | Array variable copy splitting generates a bunch of stuff we want to clean up before proceeding. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>