aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
Commit message (Collapse)AuthorAgeFilesLines
* llvmpipe: add support for ARB_indirect_parameters.Dave Airlie2020-01-091-1/+18
| | | | | | | | | This just adds support for getting the draw count from the indirect buffer. Reviewed-by: Roland Scheidegger <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3234> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3234>
* gallium/util: add multi_draw_indirect to util_draw_indirect.Dave Airlie2020-01-091-9/+13
| | | | | | | | ARB_indirect_parameters needs drivers to deal with mutli_draw_indirect themselves. Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3234>
* gallium: bypass u_vbuf if it's not needed (no fallbacks and no user VBOs)Marek Olšák2020-01-082-0/+6
| | | | | | | This decreases CPU overhead, because u_vbuf is completely bypassed in those cases. Acked-by: Alyssa Rosenzweig <[email protected]>
* gallium: put u_vbuf_get_caps return values into u_vbuf_capsMarek Olšák2020-01-082-14/+13
| | | | Acked-by: Alyssa Rosenzweig <[email protected]>
* u_vbuf: don't try to delete NULL driver CSOIago Toral Quiroga2020-01-031-1/+2
| | | | | | | | | | | | | Since 18a8c3f7f11 we don't create a driver CSO if there are any incompatible elements, so only ask backends to delete it if it exists. Fixes multiple CTS crashes in V3D. Fixes: 18a8c3f7f11 ("u_vbuf: Only create driver CSO if no incompatible elements") Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* Revert "u_vbuf: Regard non-constant vbufs with non-instance elements as free"Marek Olšák2019-12-301-13/+4
| | | | | | This reverts commit c6ef79c488bb5fffde31e7065fd3e575f3c25fb5. It broke torcs.
* u_vbuf: Return true in u_vbuf_get_caps if nb of vbufs is below minimumPaul Cercueil2019-12-211-0/+5
| | | | | | | | | | Return true in u_vbuf_get_caps if the number of vertex buffers is below the minimum required for proper OpenGL 2.0. Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>
* u_vbuf: Regard non-constant vbufs with non-instance elements as freePaul Cercueil2019-12-211-4/+13
| | | | | | | | | | In the case of unroll_indices, we can regard all non-constant vertex buffers with only non-instance vertex elements as incompatible and thus free. Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>
* u_vbuf: use single vertex buffer if it's not possible to have multipleWladimir J. van der Laan2019-12-211-1/+20
| | | | | | | | | | Put CONST, VERTEX and INSTANCE attributes into one vertex buffer if necessary due to hardware constraints. Signed-off-by: Wladimir J. van der Laan <[email protected]> Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>
* u_vbuf: Only create driver CSO if no incompatible elementsPaul Cercueil2019-12-211-2/+6
| | | | | | Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>
* u_vbuf: Mark vbufs incompatible if more were requested than HW supportsPaul Cercueil2019-12-211-0/+11
| | | | | | | | | | | More vertex buffers are used than the hardware supports. In principle, we only need to make sure that less vertex buffers are used, and mark some of the latter vertex buffers as incompatible. For now, mark all vertex buffers as incompatible. Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>
* u_vbuf: add logic to use a limited number of vbufsWladimir J. van der Laan2019-12-212-0/+8
| | | | | | | | | | Make it possible to limit the number of vertex buffers as there exist GPUs with less then 32 supported vertex buffers. Signed-off-by: Wladimir J. van der Laan <[email protected]> Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>
* gallium: add PIPE_CAP_MAX_VERTEX_BUFFERSChristian Gmeiner2019-12-211-0/+3
| | | | | | | | | Add PIPE_CAP_MAX_VERTEX_BUFFERS param, which defaults to 16. Signed-off-by: Christian Gmeiner <[email protected]> Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>
* gallium/auxiliary: Handle count == 0 in u_vbuf_get_minmax_index_mappedIcecream952019-12-161-0/+6
| | | | | | | | | | | | | This makes u_vbuf_get_minmax_index_mapped return min = 0 / max = 0 when info->count == 0. That should never happen anyway, but this commit makes it at least return a sane value that callers expect, and also allows us - and GCC - to assume count != 0 for optimization purposes. Reviewed-by: Alyssa Rosenzweig <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3050> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3050>
* gallium/auxiliary: Reduce conversions in u_vbuf_get_minmax_index_mappedIcecream952019-12-161-6/+12
| | | | | | | | | | | | | | | With this patch, GCC generates vectorized code that does the comparisons without converting the indices to 32-bit first. This optimization makes the aforementioned function almost twice as fast for ARM NEON, and should speed up vectorised code on other platforms. Without vectorisation, the function is still a percent or two faster, but slightly larger. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3050>
* vc4: move the draw splitting routine to shared codeErico Nunes2019-12-142-0/+115
| | | | | | | | | | This can also be useful for other hardware which has similar limitations on vertex count per single draw. The Mali400 has a similar limitation and can reuse this. Signed-off-by: Erico Nunes <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2445>
* gallium/util: add alignment parameter to util_upload_index_bufferErico Nunes2019-12-142-3/+3
| | | | | | | | | | At least on Mali Utgard, index buffers need to be aligned on 0x40. To avoid duplicating this, add an alignment parameter. Keep the previous default for the other existing users. Signed-off-by: Erico Nunes <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2445>
* util: Don't access members of NULL pointersTomeu Vizoso2019-12-121-5/+10
| | | | | | | | | | | | | | | | | | | | | | Should be harmless, but UBSAN complains about it and fills the logs with noise. ../src/gallium/auxiliary/util/u_inlines.h:110:8: runtime error: member access within null pointer of type 'struct pipe_surface'"} #0 0xaaccf186 in pipe_surface_reference ../src/gallium/auxiliary/util/u_inlines.h:110"} #1 0xaaccf186 in util_copy_framebuffer_state ../src/gallium/auxiliary/util/u_framebuffer.c:105"} #2 0xaabfb60e in cso_set_framebuffer ../src/gallium/auxiliary/cso_cache/cso_context.c:723"} #3 0xaae195ce in st_update_framebuffer_state ../src/mesa/state_tracker/st_atom_framebuffer.c:207"} #4 0xaae12316 in st_validate_state ../src/mesa/state_tracker/st_atom.c:261"} #5 0xaae31302 in st_Clear ../src/mesa/state_tracker/st_cb_clear.c:438"} #6 0x4c3d0e in deqp::gles2::TestCaseWrapper::iterate(tcu::TestCase*) (/deqp/modules/gles2/deqp-gles2+0x2ad0e)"} #7 0x828cf2 in tcu::TestSessionExecutor::iterateTestCase(tcu::TestCase*) (/deqp/modules/gles2/deqp-gles2+0x38fcf2)"} #8 0x8295f0 in tcu::TestSessionExecutor::iterate() (/deqp/modules/gles2/deqp-gles2+0x3905f0)"} #9 0x810aac in tcu::App::iterate() (/deqp/modules/gles2/deqp-gles2+0x377aac)"} #10 0x4c1d4c in main (/deqp/modules/gles2/deqp-gles2+0x28d4c)"} #11 0xb64b6aa8 in __libc_start_main (/lib/arm-linux-gnueabihf/libc.so.6+0x1aaa8)"} Signed-off-by: Tomeu Vizoso <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
* gallium/util: Support POLYGON in u_stream_outputs_for_verticesAlyssa Rosenzweig2019-12-091-1/+8
| | | | | | | | | | | | u_decomposed_prims_for_vertices cannot support POLYGON, but POLYGON is trivial to support as a special case directly (since we have the number of vertices directly). Fixes aborts in Panfrost in apps using GL_POLYGON. Fixes: e881aa8c12c ("gallium/util: Add u_stream_outputs_for_vertices helper") Signed-off-by: Alyssa Rosenzweig <[email protected]> Revewied-by: Eric Anholt <[email protected]>
* mesa/main/util: moving gallium u_mm to util, remove main/mmAlejandro Piñeiro2019-12-022-390/+0
| | | | | | | | | | | | | | | | | | | | Right now there are two copies of mm: * mesa/main/mm.[ch] * gallium/auxiliary/util/u_mm.[ch] At some point they splitted, and from the commit message it was not clear why it was not possible to have only one copy at a common place. Taking into account that was several years ago, Im assuming that it was not possible then. This change would allow to have one copy of the same code, and also being able to use that code out of mesa/main or gallium, if needed. This commit moves u_mm and removes mm, as u_mm has slightly more changes. Reviewed-by: Jose Fonseca <[email protected]>
* util: Move gallium's PIPE_FORMAT utils to /util/format/Eric Anholt2019-11-1444-11222/+22
| | | | | | | | | | | | | | | To make PIPE_FORMATs usable from non-gallium parts of Mesa, I want to move their helpers out of gallium. Since u_format used util_copy_rect(), I moved that in there, too. I've put it in a separate directory in util/ because it's a big chunk of related code, and it's not clear to me whether we might want it as a separate library from libmesa_util at some point. Closes: #1905 Acked-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
* u_format: Fix swizzle of A1R5G5B5.Eric Anholt2019-11-081-1/+1
| | | | | | | Found once I started using the generated unpack code from the Mesa side. Fixes: 4bbaac3782ad ("gallium: Add some more channel orderings of packed formats.") Reviewed-by: Erik Faye-Lund <[email protected]>
* gallium: Add equivalents of packed MESA_FORMAT_*UINT formats.Eric Anholt2019-11-071-0/+17
| | | | | | | | These are the last formats that MESA_FORMAT had and PIPE_FORMAT didn't. The .csv entries channel sizes and swizzles all came from the corresponding UNORM format. Reviewed-by: Marek Olšák <[email protected]>
* gallium: Add an equivalent of MESA_FORMAT_BGR_UNORM8.Eric Anholt2019-11-071-0/+1
| | | | | | | | This is the last unorm format that MESA_FORMAT had and PIPE_FORMAT didn't. Note that it's an array format on gallium's side as well, since it's a NPOT pixel size. Reviewed-by: Marek Olšák <[email protected]>
* gallium: Add some more channel orderings of packed formats.Eric Anholt2019-11-071-0/+8
| | | | | | This covers everything that MESA_FORMAT had for packed unorm. Reviewed-by: Marek Olšák <[email protected]>
* gallium: Add defines for FXT1 texture compression.Eric Anholt2019-11-073-1/+7
| | | | | | | | | | This texture compression is exposed by 830 and 915, and to make MESA_FORMAT match PIPE_FORMAT defines I need a corresponding PIPE_FORMAT. v2: Set is_hand_written so we don't try to generate pack/unpack code. Reviewed-by: Marek Olšák <[email protected]>
* util: rename PIPE_ARCH_*_ENDIAN to UTIL_ARCH_*_ENDIANDylan Baker2019-11-052-12/+12
| | | | | | | | | | | As requested by Tim. This was generated with: grep 'PIPE_ARCH_.*_ENDIAN' -rIl | xargs sed -ie 's@PIPE_ARCH_\(.*\)_ENDIAN@UTIL_ARCH_\1_ENDIAN@'g v2: - add this patch Reviewed-by: Eric Engestrom <[email protected]>
* util/u_endian: set PIPE_ARCH_*_ENDIAN to 1Dylan Baker2019-11-052-11/+11
| | | | | | | | | | | | This will allow it to be used as a drop in replacement for _mesa_little_endian in a number of cases. v2: - Always define PIPE_ARCH_LITTLE_ENDIAN and PIPE_ARCH_BIG_ENDIAN, define the one that reflects the host system to 1 and the other to 0 - replace all uses of #ifdef, #ifndef, and #if defined() with #if and #if ! with PIPE_ARCH_*_ENDIAN Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_IS_EMPTY macroTimothy Arceri2019-10-281-4/+4
| | | | | | | Just use the inlined function directly. The new function was introduced in addcf410. Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_DEL macroTimothy Arceri2019-10-282-4/+4
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_DELINIT macroTimothy Arceri2019-10-281-1/+1
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_REPLACE macroTimothy Arceri2019-10-281-1/+1
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_ADD macroTimothy Arceri2019-10-281-1/+1
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_ADDTAIL macroTimothy Arceri2019-10-282-2/+2
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>
* util: remove LIST_INITHEAD macroTimothy Arceri2019-10-282-3/+3
| | | | | | | Just use the inlined function directly. The macro was replaced with the function in ebe304fa540f. Reviewed-by: Eric Engestrom <[email protected]>
* gallium: Fix a bunch of undefined left-shifts in u_format_*Adam Jackson2019-10-243-56/+56
| | | | | Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Adam Jackson <[email protected]>
* gallium/util: Cast to target type before shifting leftMichel Dänzer2019-10-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise a smaller type may be promoted to int, which can hit undefined behaviour: ../src/gallium/auxiliary/util/u_half.h:126:29: runtime error: left shift of 32768 by 16 places cannot be represented in type 'int' #0 0x5646ff63d488 in util_half_to_float ../src/gallium/auxiliary/util/u_half.h:126 #1 0x5646ff63d749 in _mesa_half_to_float ../src/util/half_float.c:145 #2 0x5646ff54d557 in nir_const_value_negative_equal ../src/compiler/nir/nir_instr_set.c:372 #3 0x5646ff44d29a in const_value_negative_equal_test_nir_type_float16_trivially_true_Test::TestBody() ../src/compiler/nir/tests/negative_equal_tests.cpp:121 #4 0x5646ff505c05 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #5 0x5646ff4f1513 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #6 0x5646ff4979b5 in testing::Test::Run() ../src/gtest/src/gtest.cc:2474 #7 0x5646ff49a08e in testing::TestInfo::Run() ../src/gtest/src/gtest.cc:2656 #8 0x5646ff49c81c in testing::TestCase::Run() ../src/gtest/src/gtest.cc:2774 #9 0x5646ff4b81f6 in testing::internal::UnitTestImpl::RunAllTests() ../src/gtest/src/gtest.cc:4649 #10 0x5646ff50981e in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2402 #11 0x5646ff4f4eeb in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../src/gtest/src/gtest.cc:2438 #12 0x5646ff4af818 in testing::UnitTest::Run() ../src/gtest/src/gtest.cc:4257 #13 0x5646ff52e639 in RUN_ALL_TESTS() ../src/gtest/include/gtest/gtest.h:2233 #14 0x5646ff52e4f9 in main ../src/gtest/src/gtest_main.cc:37 #15 0x7f6bacb78bba in __libc_start_main ../csu/libc-start.c:308 #16 0x5646ff448019 in _start (/home/daenzer/src/mesa-git/mesa/build-amd64-sanitize/src/compiler/nir/negative_equal+0x17c019) Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Adam Jackson <[email protected]>
* gallium: Drop the unused PIPE_FORMAT_A*L* formats.Eric Anholt2019-10-202-8/+0
| | | | | | | Now that Mesa is also using an array format for LA, nothing was using these. (And, clearly, no HW driver had exposed them). Reviewed-by: Marek Olšák <[email protected]>
* gallium/util: don't depend on implementation defined behavior in listen()Lucas Stach2019-10-181-1/+1
| | | | | | | | | | | | | | Using 0 as the backlog argument to listen() is exploiting implementation defined behavior and will lead to no connections being accepted on some libc implementations. Quote of the listen manpage: "A backlog argument of 0 may allow the socket to accept connections, in which case the length of the listen queue may be set to an implementation-defined minimum value." Fix this by using a more sensible backlog value. Signed-off-by: Lucas Stach <[email protected]>
* gallium/u_blitter: remove an unused variableMarek Olšák2019-10-171-2/+0
| | | | trivial
* mesa/st: support lowering user-clip-planes automaticallyErik Faye-Lund2019-10-171-0/+1
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa/gallium: automatically lower two-sided lightingErik Faye-Lund2019-10-171-0/+1
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa/gallium: automatically lower point-sizeErik Faye-Lund2019-10-171-0/+1
| | | | Reviewed-by: Marek Olšák <[email protected]>
* mesa/gallium: automatically lower alpha-testingErik Faye-Lund2019-10-171-0/+1
| | | | Reviewed-by: Marek Olšák <[email protected]>
* gallium: add flatshade lowering capabilityDave Airlie2019-10-171-0/+3
| | | | | | | This allows the driver to request flatshade lowering. (NIR drivers only so far). Reviewed-by: Marek Olšák <[email protected]>
* gallium/u_blitter: set a more sane viewport-stateErik Faye-Lund2019-10-171-6/+5
| | | | | | | This actually corresponds to legal GL depth-ranges, because depth-clear values are always in the 0..1 range in OpenGL. Reviewed-by: Marek Olšák <[email protected]>
* gallium: rename PIPE_CAP_MAX_FRAMES_IN_FLIGHT to PIPE_CAP_THROTTLEJames Xiong2019-10-141-1/+1
| | | | | | | | | v2: [ Michel Dänzer ] * Update src/gallium/docs/source/screen.rst accordingly Signed-off-by: James Xiong <[email protected]> Reviewed-by: Michel Dänzer <[email protected]> # v1 Reviewed-by: Marek Olšák <[email protected]> # v1
* gallium: add a a new cap for changing the TGSI TG4 instruction encodingDave Airlie2019-10-111-0/+1
| | | | | | | | | | | | | Accessing the TG4 component via immediates in the llvmpipe backend is quite messy (like really messy). Roland suggested we change the instruction encoding, so introduce a cap to allow the component to be selected to be store in the sampler swizzle, which should be otherwise unused. I could probably switch all drivers over, but virgl would need some work that I'd prefer not to rush it. Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* gallium/u_tests: test NV12 allocation and exportMarek Olšák2019-10-091-0/+159
| | | | Reviewed-by: Bas Nieuwenhuizen <[email protected]>
* gallium/util: add planar format layouts and helpersMarek Olšák2019-10-094-7/+108
| | | | Reviewed-by: Bas Nieuwenhuizen <[email protected]>