Commit Graph

5491 Commits

Author SHA1 Message Date
Ilia Mirkin fb434e675f util/primconvert: support instanced rendering
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
2014-12-05 07:23:48 -05:00
Ilia Mirkin 1dfa039168 util/primconvert: pass index bias through
The index_bias (aka base_vertex) applies to the downstream draw just as
much, since the actual index values are never modified.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.3 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Rob Clark <robclark@freedesktop.org>
2014-12-05 07:23:48 -05:00
José Fonseca ef7e0b39a2 gallivm: Update for RTDyldMemoryManager becoming an unique_ptr.
Trivial.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=86958
2014-12-03 07:49:47 +00:00
Brian Paul ded14afa42 gallium: add include path to fix building of pipe-loader code
The pipe-loader code wasn't finding util/u_atomic.h

Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-12-01 15:22:08 -07:00
Matt Turner ccad3829e3 util: Move u_atomic.h to src/util.
To be shared outside of Gallium.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-12-01 11:28:44 -08:00
José Fonseca 4b6e93650c util/u_snprintf: Don't redefine HAVE_STDINT_H as 0.
We now always guarantee availability of stdint.h on MSVC -- if MSVC
doesn't supply one we use our own.

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-26 20:30:58 +00:00
José Fonseca 29557a1fa8 gallivm: Removed unused variable.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-26 20:25:12 +00:00
José Fonseca a0ddc54777 draw,gallivm,llvmpipe: Avoid implicit casts of 32-bit shifts to 64-bits.
Addresses MSVC warnings "result of 32-bit shift implicitly converted to
64 bits (was 64-bit shift intended?)", which can often be symptom of
bugs, but in these cases were all benign.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-26 20:25:12 +00:00
Emil Velikov c642e87d9f auxiliary/vl: rework the build of the VL code
Rather than shoving all the VL code for non-VL targets, increasing
their size, just split it out and use it when needed. This gives us
the side effect of building vl_winsys_dri.c once, dropping a few
automake warnings, and reducing the size of the dri modules as below

   text    data     bss     dec     hex filename
5850573  187549 1977928 8016050  7a50b2 before/nouveau_dri.so
5508486  187100  391240 6086826  5ce0aa after/nouveau_dri.so

The above data is for a nouveau + swrast + kms_swrast 'megadriver'.

v2: Do not include the vl sources in the auxiliary library.
v3: Rebase. Add nine.

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-26 20:09:09 +00:00
Emil Velikov 86a51eb861 auxiliary/vl: split the vl sources list into VL_SOURCES
With follow up commit we'll split vl static lib from the auxiliary one,
and choose the appropriate vl (galliumvl or galliumvl_stub) for the
respective targets to link against.

v2: Rebase.

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-26 20:09:09 +00:00
Emil Velikov f093c1c8ec auxiliary/vl: add galliumvl_stub.la
Will be used by the non-VL targets, to stub out the functions called
by the drivers. The entry point to those are within the VL
state-trackers, yet the compiler cannot determine that at link time.
Thus we'll need to stub them out to prevent unresolved symbols in the
dri, egl, gbm and pipe-loader targets.

v2: Rebase.

Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-26 20:09:09 +00:00
Eric Anholt 365a4a3f9a gallium: Drop the unused CND opcode.
Nothing in the tree generates it.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-11-24 14:56:22 -08:00
Eric Anholt 00f7002c5c gallium: Drop unused BRA opcode.
Never generated, and implemented in only nvfx vertprog.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-11-24 14:56:22 -08:00
Eric Anholt ecfe9e2ad2 gallium: Drop the unused SFL/STR opcodes.
Nothing generated them.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-11-24 14:56:22 -08:00
Eric Anholt dc00b382b5 gallium: Drop the unused RFL opcode.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-11-24 14:56:22 -08:00
Eric Anholt 8c822b1e91 gallium: Drop unused X2D opcode.
Nothing in the tree generates it.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-11-24 14:56:22 -08:00
Eric Anholt ff886c4955 gallium: Drop the unused ARA opcode.
Nothing in the tree generated it.

v2: Only drop ARA, not ARR as well.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com> (v2)
2014-11-24 14:56:22 -08:00
Eric Anholt de2f8d75db gallium: Drop the unused RCC opcode.
Nothing in the tree generated it.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-11-24 14:56:22 -08:00
Eric Anholt d4864cdf15 gallium: Drop the NRM and NRM4 opcodes.
They weren't generated in tree, and as far as I know all hardware had to
lower it to a DP, RSQ, MUL.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-11-24 14:56:22 -08:00
Matt Turner 024db256d4 util: Prefer atomic intrinsics to inline assembly.
Cuts a little more than 1k of .text size from i915g.

This was previously done in commit 5f66b340 and subsequently reverted in
commit 3661f757 after bug 30514 was filed. I believe the cause of bug
30514 wasn't anything related to cross compiling, but rather that the
toolchain used defaulted to -march=i386, and i386 doesn't have the
CMPXCHG or XADD instructions used to implement the intrinsics.

So we reverted a patch that improved things so that we didn't break
compilation for a platform that never could have worked anyway.
2014-11-24 14:09:23 -08:00
David Heidelberg 25b00f4617 draw: allow LLVM use on non-SSE2 X86 cpus
This patch remove workaround related to LLVM < 3.2 bug.

Original bug has been closed as fixed in 2011.
At this moment gallium requires LLVM 3.3 (2013).

LLVM has been tested without SSE2 support in commit
ca70de9bd2 and removed after requiring
LLVM 3.3 in commit 013ff2fae1

Original LLVM bug: http://llvm.org/bugs/show_bug.cgi?id=6960

Signed-off-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-22 04:29:00 +00:00
José Fonseca 56bf948e11 rtasm,translate: Re-enable SSE on Mingw64.
This reverts f4dd099171.

The src/gallium/tests/unit/translate_test.c gives the same results on
MinGW 64-bits as on Linux 64-bits.  And since MinGW is often used for
development/testing due to its convenience, it's better not to have this
sort of differences relative to MSVC.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-20 14:11:36 +00:00
Roland Scheidegger 4b6d6642d2 draw: fixes for vertex shaders outputting layer or viewport index
Mostly add a couple cases so we don't just check gs for this.
There's only one gotcha, the built-in vp transform in the llvm vs can't
handle it (this would be fixable though non-trivial due to vp index being
non-constant for the SoA outputs, but we don't use it if there's a gs
neither - the whole clip/vp transform integration there is suboptimal).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-11-19 18:35:30 +01:00
Andres Gomez 2d5af04bae draw: Fixed inline comments
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-11-18 08:47:03 -07:00
Roland Scheidegger 74f505fa73 gallivm: fix alignment issue for vertex data fetch
We cannot guarantee that vertex buffers have the necessary alignment for
fetching all AoS members at once (for instance 4x32bit XYZW data). We can
however guarantee that for textures. This did not cause errors for older
llvm versions but it now matters and will cause segfaults if the data
happens to not be aligned. Thus we need to set alignment manually.
(Note that we can't actually really guarantee data to be even element aligned
due to offsets in vertex buffers being bytes and OpenGL allowing this, but
it does not matter for x86 as alignment is only required for sse vectors -
not sure what happens on other archs, however.)

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=85467.
2014-11-18 15:26:59 +01:00
Ilia Mirkin 68db29c434 st/mesa: add a fallback for clear_with_quad when no vs_layer
Not all drivers can set gl_Layer from VS. Add a fallback that passes the
instance id from VS to GS, and then uses the GS to set the layer.

Tested by adding

  quad_buffers |= clear_buffers;
  clear_buffers = 0;

to the st_Clear logic, and forcing set_vertex_shader_layered in all
cases. No piglit regressions (on piglits with 'clear' in the name).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org>
2014-11-17 22:17:49 -05:00
Joakim Sindholt fdd96578ef nine: Add state tracker nine for Direct3D9 (v3)
Work of Joakim Sindholt (zhasha) and Christoph Bumiller (chrisbmr).
DRI3 port done by Axel Davy (mannerov).

v2: - nine_debug.c: klass extended from 32 chars to 96 (for sure) by glennk
    - Nine improvements by Axel Davy (which also fixed some wine tests)
    - by Emil Velikov:
     - convert to static/shared drivers
     - Sort and cleanup the includes
     - Use AM_CPPFLAGS for the defines
     - Add the linker garbage collector
     - Restrict the exported symbols (think llvm)

v3: - small nine fixes
    - build system improvements by Emil Velikov

v4: [Emil Velikov]
   - Do no link against libudev. No longer needed.

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: David Heidelberg <david@ixit.cz>
2014-11-18 02:02:54 +00:00
Christoph Bumiller 7d2573b537 gallium/auxiliary: add contained and rect checks (v6)
v3: thanks to Brian, improved coding style, also glennk helped spot few
things (unsigned -> int, two constify)
v4: thanks Ilia improved function, dropped u_box_clip_3d
v5: incorporated rest of Gregor proposed changes,clean ups
v6: u_box_clip_2d simplify proposed by Ilia Mirkin

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
2014-11-18 02:02:54 +00:00
Christoph Bumiller cb49132166 gallium/auxiliary: add inc and dec alternative with return (v4)
At this moment we use only zero or positive values.

v2: Implement it for also for Solaris, MSVC assembly
    and enable for other combinations.

v3: Replace MSVC assembly by assert + warning during compilation

v4: remove inc and dec with return for MSVC assembly

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: David Heidelberg <david@ixit.cz>
2014-11-18 02:02:53 +00:00
Christoph Bumiller e23d63cffd gallium/auxiliary: implement sw_probe_wrapped (v2)
Implement pipe_loader_sw_probe_wrapped which allows to use the wrapped
software renderer backend when using the pipe loader.

v2: - remove unneeded ifdef
    - use GALLIUM_PIPE_LOADER_WINSYS_LIBS
    - check for CALLOC_STRUCT
    thanks to Emil Velikov

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
2014-11-18 02:02:53 +00:00
Christoph Bumiller 259ec77db9 tgsi/ureg: add ureg_UARL shortcut (v2)
v2: moved in in same order as in p_shader_tokens (thanks Brian)

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
2014-11-18 02:02:53 +00:00
José Fonseca aafbebe8ab draw: Make it more clear that *_jit_context points to pipe_viewport_state structures.
No change in behavior.
2014-11-16 11:33:21 +00:00
José Fonseca 2a3e140ff4 draw: Fix breakage due to removal pipe_viewport_state::translate[3] and scale[3].
Unfortunately no LLVM type was generated for pipe_viewport_state -- it
was being treated as a single floating point array --, so llvmpipe (and
any driver that relies on draw/llvm) got totally busted.
2014-11-16 11:31:23 +00:00
José Fonseca d2dbeed006 gallium/auxiliary: Fix build without LLVM.
Trivial.
2014-11-16 10:22:46 +00:00
José Fonseca 4784623b3e gallium/auxiliary: Remove GALLIVM_CPP_SOURCES
Redundant.

Should fix ttps://bugs.freedesktop.org/show_bug.cgi?id=86330
2014-11-16 10:16:47 +00:00
Emil Velikov d936ef3fb7 auxiliary: ship all files in the distribution tarball
- Add all headers into Makefile.sources
 - Don't forget the target-helpers
 - Add the python scripts & the formats table/list (csv)
 - Temporary add vl/vl_winsys_dri.c to EXTRA_DIST until we rework the
way VL is build.
 - Add the following to EXTRA_DIST - they are included via the
generated u_indices_gen.c thus we should not add them to *SOURCES.
  indices/u_indices.c
  indices/u_unfilled_indices.c

XXX: Should we nuke gallivm/f.cpp ? It seems that no-one is using it.

v2: Rebase

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-16 01:07:32 +00:00
Emil Velikov dfa61dc37e pipe-loader: consolidate sources into Makefile.sources
Drop the unneeded subdir-objects.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-11-16 01:03:42 +00:00
Marek Olšák 2efabd9f5a gallium: remove unused pipe_viewport_state::translate[3] and scale[3]
Almost all drivers ignore them.
2014-11-16 01:28:28 +01:00
Marek Olšák 48f1409c3b tgsi/ureg: simplify code for declaring properties
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
2014-11-16 01:28:26 +01:00
Marek Olšák e6a2d3f7b6 gallium/util: add a test for TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION
Not testable by OpenGL. Required by Nine.

This is an example of how to implement a piglit-like test using gallium only.
2014-11-16 01:28:26 +01:00
Marek Olšák 717f2dd69f gallium/util: add a window_space option to the passthrough vertex shader
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
2014-11-16 01:28:24 +01:00
Marek Olšák ad54b01896 tgsi: fixup the string of VS_WINDOW_SPACE_POSITION
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
2014-11-16 01:28:09 +01:00
José Fonseca 977b18e486 gallivm: Fix build with LLVM 3.6 (r221751).
Tested with LLVM 3.3, 3.4, 3.5, and 3.6.

Trivial.
2014-11-12 11:08:07 +00:00
José Fonseca b238c756da util/format: Fix clamping to 32bit integers.
Use clamping constants that guarantee no integer overflows.

As spotted by Chris Forbes.

This causes the code to change as:

-         value |= (uint32_t)CLAMP(src[0], 0.0f, 4294967295.0f);
+         value |= (uint32_t)CLAMP(src[0], 0.0f, 4294967040.0f);

-         value |= (uint32_t)((int32_t)CLAMP(src[0], -2147483648.0f, 2147483647.0f));
+         value |= (uint32_t)((int32_t)CLAMP(src[0], -2147483648.0f, 2147483520.0f));

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-08 10:32:39 +00:00
José Fonseca d268eac3a9 util/format: Generate floating point constants for clamping.
This commit causes the generated C code to change as

            union util_format_r32g32b32a32_sscaled pixel;
  -         pixel.chan.r = (int32_t)CLAMP(src[0], -2147483648, 2147483647);
  -         pixel.chan.g = (int32_t)CLAMP(src[1], -2147483648, 2147483647);
  -         pixel.chan.b = (int32_t)CLAMP(src[2], -2147483648, 2147483647);
  -         pixel.chan.a = (int32_t)CLAMP(src[3], -2147483648, 2147483647);
  +         pixel.chan.r = (int32_t)CLAMP(src[0], -2147483648.0f, 2147483647.0f);
  +         pixel.chan.g = (int32_t)CLAMP(src[1], -2147483648.0f, 2147483647.0f);
  +         pixel.chan.b = (int32_t)CLAMP(src[2], -2147483648.0f, 2147483647.0f);
  +         pixel.chan.a = (int32_t)CLAMP(src[3], -2147483648.0f, 2147483647.0f);
            memcpy(dst, &pixel, sizeof pixel);

which surprisingly makes a difference for MSVC.

Thanks to Juraj Svec for diagnosing this and drafting a fix.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29661
2014-11-08 10:32:39 +00:00
José Fonseca bfd453f942 gallivm: Disable frame-pointer-omission on x86 to ensure right stack alignment.
Between release 3.2 and 3.3 LLVM stopped aligning properly when certain
conditions (no allocas, but large number of vectors causing spills to
the stack, and frame pointer omission enabled).

We were already disabling frame-pointer-omission on several build types,
but we now disable it on all build types.

It's not clear whether this affects 32-bits x86 processes only, or if it
can also affect 64-bits x86_64 processes when AVX registers are
available and used.  So disable frame-pointer-omission on both
x86/x86_64 to be on the safe side.

See also:
- http://llvm.org/PR21435

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-03 14:47:00 +00:00
José Fonseca b7e447d323 gallivm: When disassemble a function, start by printing out its name.
To help recognize what's supposed to do.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-11-03 14:47:00 +00:00
Brian Paul e6ee85ec61 tgsi: add a tgsi_free_tokens() function
To match tgsi_alloc_tokens().

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-10-31 15:29:59 -06:00
Brian Paul c996b22329 util: simplify u_pstipple.c code
Use the new helper functions in the tgsi_transform.h file to emit
declarations and instructions.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-10-31 15:29:59 -06:00
Brian Paul 55008ef697 util: simplify temp register selection in u_pstipple.c
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-10-31 15:29:59 -06:00
Brian Paul ccd1ea9d52 util: simplify util_pstipple_create_fragment_shader() params
Pass and return tgsi_token buffers instead of pipe_shader_state.

And update softpipe driver (the only user of this function).

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-10-31 15:29:59 -06:00
Emil Velikov c63eb5dd5e auxiliary/os: get the mmap/munmap wrappers working with android
- Use macro for munmap under Android - the STATIC_ASSERT uses
a off_t which is not used under Android for mmap. As loff_t size
does not vary as does off_t just ignore the assert.

 - Wrap the long lines to improve readability.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-10-23 15:18:11 +01:00
Alon Levy 23080e49c4 u_math.h: fix 64 to 32 bit truncation warning
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-10-23 14:45:40 +01:00
José Fonseca 75ad4fe78e gallivm: Fix build with LLVM 3.3.
The setMCJITMemoryManager method doesn't exist in LLVM 3.3.

I thought I had tested the latest version of my earlier change with LLVM
3.3, but it looks I missed it.

Trivial.
2014-10-23 10:42:12 +01:00
José Fonseca 065256dfc4 gallivm: Properly update for removal of JITMemoryManager in LLVM 3.6.
JITMemoryManager was removed in LLVM 3.6, and replaced by its base class
RTDyldMemoryManager.

This change fixes our JIT memory managers specializations to derive from
RTDyldMemoryManager in LLVM 3.6 instead of JITMemoryManager.

This enables llvmpipe to run with LLVM 3.6.

However, lp_free_generated_code is basically a no-op because there are
not enough hook points in RTDyldMemoryManager to track and free the code
of a module.  In other words, with MCJIT, code once created, stays
forever allocated until process destruction.  This is not speicfic to
LLVM 3.6 -- it will happen whenever MCJIT is used regardless of version.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-10-23 10:19:33 +01:00
José Fonseca 3fd220e2eb gallivm: Fix white-space.
Replace tabs with spaces.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-10-23 10:19:33 +01:00
José Fonseca 013ff2fae1 gallivm,llvmpipe,clover: Bump required LLVM version to 3.3.
We'll need to update gallivm for the interface changes in LLVM 3.6, and
the fewer the number of older LLVM versions we support the less hairy that
will be.

As consequence HAVE_AVX define can disappear.  (Note HAVE_AVX meant
whether LLVM version supports AVX or not.  Runtime support for AVX is
always checked and enforced independently.)

Verified llvmpipe builds and runs with with LLVM 3.3, 3.4, and 3.5.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-10-23 10:18:56 +01:00
Brian Paul c9a6ec1978 u_blitter: put a comment on util_blitter_cache_all_shaders()
Trivial.
2014-10-22 17:33:40 -06:00
Brian Paul f82a84c097 u_blitter: use ctx->bind_fs_state(), not pipe->bind_fs_state()
Consistently use the function pointer we saved earlier.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-10-22 17:33:40 -06:00
Brian Paul 0bcd9f5469 u_blitter: create basic fs shaders in util_blitter_cache_all_shaders()
We need to create all fs shaders in this function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-10-22 17:33:40 -06:00
Brian Paul 27de89d266 u_blitter: do error checking assertions for shader caching
If the user calls util_blitter_cache_all_shaders() set a flag and assert
that we never try to create any new fragment shaders after that point.
If the assertions fails, it means we missed generating some shader in
util_blitter_cache_all_shaders().

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-10-22 17:33:40 -06:00
Marek Olšák 5f5b83cbba gallium: add PIPE_SHADER_CAP_MAX_OUTPUTS and use it in st/mesa
With 5 shader stages and various combinations of enabled and disabled shaders,
the maximum number of outputs in one shader doesn't have to be equal to
the maximum number of inputs in the following shader.

v2: return 32 for softpipe and llvmpipe
2014-10-21 21:59:02 +02:00
Vinson Lee a2fd55cfb6 auxilary/os: Add DragonFly BSD support in os_get_total_physical_memory.
This patch fixes this build error on DragonFly BSD.

  CC       os/os_misc.lo
os/os_misc.c: In function 'os_get_total_physical_memory':
os/os_misc.c:132:2: error: #error Unsupported *BSD

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-10-13 23:40:46 -07:00
Eric Anholt f9854e169f gallium: Rename freedreno parts of tgsi_lowering.[ch].
Acked-by: Rob Clark <robclark@freedesktop.org>
2014-10-08 17:42:59 +02:00
Eric Anholt 19df602b39 gallium: Reformat tgsi_lowering.c for the normal style.
Acked-by: Rob Clark <robclark@freedesktop.org>
2014-10-08 17:42:59 +02:00
Eric Anholt 3141dc8e87 gallium: Copy fd_lowering.[ch] to tgsi_lowering.[ch] for code sharing.
Lots of drivers need to transform the weird instructions in TGSI into
reasonable scalar ops, and this code can make those translations
canonical.

Acked-by: Rob Clark <robclark@freedesktop.org>
2014-10-08 17:42:59 +02:00
Marek Olšák 0c4bc1e292 tgsi: change tgsi_shader_info::properties to a one-dimensional array
Reviewed-by: Roland Scheidegger <sroland@vmware.com>

v2: fix svga too
2014-10-04 15:36:39 +02:00
Marek Olšák 7dc0164192 tgsi: remove some not so useful variables from tgsi_shader_info 2014-10-04 15:16:14 +02:00
Marek Olšák 8908fae243 tgsi: simplify shader properties in tgsi_shader_info
Use an array of properties indexed by TGSI_PROPERTY_* definitions.
2014-10-04 15:16:14 +02:00
Marek Olšák af4f5a7c97 gallium/util: add util_bitcount64
I'll need this in radeonsi.

v2: use __builtin_popcountll if available

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2014-10-04 15:16:14 +02:00
Tomasz Figa d703abf735 util: Include in Android builds
This patch fixes Android build failures by including src/util directory
in compilation. Files inside of this directory are compiled into
libmesa_util static library and linked with resulting libGLES_mesa.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-10-03 01:25:28 +01:00
Ilia Mirkin 786f01c492 gallium/hud: use u_sampler_view_default_template helper
The existing code was not setting several fields, most importantly the
target, which is required on nv50/nvc0.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-10-02 12:18:21 -04:00
Leo Liu 0eb8f89981 st/vdpau: move common functions to util
Break out these functions so that they can be shared with a other
state trackers.  They will be used in subsequent patches for the new
VA-API state tracker.

Signed-off-by: Leo Liu <leo.liu@amd.com>
2014-10-01 13:21:36 -04:00
Mathias Fröhlich 6e7d36fd2c gallivm: Fix build for LLVM 3.2
Do not rely on LLVMMCJITMemoryManagerRef being available.
The c binding to the memory manager objects only appeared
on llvm-3.4.
The change is based on an initial patch of Brian Paul.

Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
2014-10-01 00:29:31 +02:00
Mathias Fröhlich 43e2109326 llvmpipe: Reuse llvmpipes LLVMContext in the draw context.
Reuse the LLVMContext already allocated in llvmpipe_context
for draw_llvm if ppossible. This should decrease the memory
footprint of an llvmpipe context.

v2: Fix compile with llvm disabled.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
2014-09-30 20:51:02 +02:00
Mathias Fröhlich d90ff351f3 llvmpipe: Make a llvmpipe OpenGL context thread safe.
This fixes the remaining problem with the recently introduced
global jit memory manager. This change again uses a memory manager
that is local to gallivm_state. This implementation still frees
the majority of the memory immediately after compilation.
Only the generated code is deferred until this code is no longer used.

This change and the previous one using private LLVMContext instances
I can now safely run several independent OpenGL contexts driven
by llvmpipe from different threads.

v3: Rebase on llvm-3.6 compile fixes.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
2014-09-30 20:51:02 +02:00
Mathias Fröhlich 83c62597fc llvmpipe: Use two LLVMContexts per OpenGL context instead of a global one.
This is one step to make llvmpipe thread safe as mandated by the OpenGL
standard. Using the global LLVMContext is obviously a problem for
that kind of use pattern. The patch introduces two LLVMContext
instances that are private to an OpenGL context and used for all
compiles. One is put into struct draw_llvm and the other
one into struct llvmpipe_context.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
2014-09-30 20:45:19 +02:00
Brian Paul b12899d752 tgsi: fix Semantic.Name assignment in tgsi_transform_input_decl()
Assign the sem_name parameter, not TGSI_SEMANTIC_GENERIC.
Fixes polygon stipple regression.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-30 12:08:49 -06:00
Brian Paul 0fb1e6b7b4 util: simplify PIPE_TEXTURE_CUBE case in util_max_layer()
For cube resources, the array_size value should be 6.  So handle
that case as we do for array texture resources.  But assert that
array_size==6 just to be safe.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-09-30 12:08:49 -06:00
Michel Dänzer 4a38b154fd gallivm: More fallout from disabling with LLVM 3.6
The draw module would still try to use gallivm, causing many piglit tests
to fail with an assertion failure. llvmpipe might have been similarly
affected.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2014-09-26 11:35:52 +09:00
Matt Turner 43267a325f mesa: Replace IS_NEGATIVE(x) with x < 0.0f.
I only made IS_NEGATIVE(x) use signbit in commit 0f3ba405 in an attempt
to fix 54805, but it didn't help. We didn't use signbit on some
platforms and instead defined it to x < 0.0f.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2014-09-25 13:57:29 -07:00
Brian Paul 9f47220450 util: use linear formats in util_blit_pixels()
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-09-24 15:35:11 -06:00
Brian Paul b6947e02de util: simplify writemask parameters for util_blit_pixels()
Instead of separate color and Z/S writemasks, just have one writemask
parameter that takes a mask of the PIPE_MASK_[RGBAZS] flags.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-24 15:35:11 -06:00
Brian Paul b32f05e153 util: s/PIPE_TEX_MIPFILTER/PIPE_TEX_FILTER/ in u_blit code
PIPE_TEX_MIPFILTER_x is not legal for the pipe_sampler_state::
min/mag_img_filter fields.  But PIPE_TEX_MIPFILTER_x == PIPE_TEX_FILTER_x
so we were getting lucky.

This also makes the code consistent with u_blitter.c.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-24 15:35:10 -06:00
Matt Turner 9499d6e358 mesa: Unifdef _WIN32_WCE.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-09-24 09:58:43 -07:00
Tom Stellard 180b152b24 gallivm: Wrap deleted inlcude in if HAVE_LLVM < 0x0306
This was missed in 8f4ee56.
2014-09-24 11:54:44 -04:00
Tom Stellard 8f4ee56e49 gallivm: Disable gallivm to fix build with LLVM 3.6
LLVM commit r218316 removes the JITMemoryManager class, which is
the parent for a seemingly important class in gallivm.  In order to
fix the build, I've wrapped most of lp_bld_misc.cpp in
if HAVE_LLVM < 0x0306 and modifyed the
lp_build_create_jit_compiler_for_module() function to return false
for 3.6 and newer which effectively disables the gallivm functionality.

I realize this is overkill, but I could not come up with a simple
solution to fix the build.  Also, since 3.6 will be the first release
without the old JIT, it would be really great if we could
move gallivm to use the C API only for accessing MCJIT.  There
is still time before the 3.6 release to extend the C API in
case it is missing some functionality that is required by gallivm.
2014-09-24 10:34:19 -04:00
Emil Velikov 6e1f846ce0 targets/pipe-loader: drop unused authentication
The dri, vdpau, omx, xvmc and gbm targets don't need any authentication
even the VL ones never used it. Either the respective loader or the
library itself (vl) is doing its auth prior to calling create_screen()

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
2014-09-24 10:43:44 +01:00
Roland Scheidegger 5e1fcc6258 gallivm: fix idiv
ffeb77c7b0 had a typo which turned all signed
integer divisions into unsigned ones. Oops.
This gets us back the 51 little piglits
(all from glsl built-in-functions, fs/vs/gs-op-div-int-ivec2 and similar).

Cc: "10.2 10.3" <mesa-stable@lists.freedesktop.org>

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-23 21:46:00 +02:00
Brian Paul e7a614c60c gallium: replace pipe_type enum with tgsi_return_type enum
The only place the enum pipe_type was used is for the TGSI sampler
view return type.  So make it a TGSI type.  Note: it appears this
part of TGSI isn't used by anyone so it may be removed in the future.

v2: the new name is tgsi_return_type, not tgsi_type.  This means we
can drop the previously posted tgsi_type -> tgsi_opcode_type patch.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-09-22 16:56:24 -06:00
Brian Paul 9ce72ac1fa draw: use new tgsi_transform inst/decl helpers in pstipple code
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:24 -06:00
Brian Paul 493ab77551 draw: use new tgsi_transform inst/decl helpers in aapoint code
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:24 -06:00
Brian Paul d7e5b7138a draw: use new tgsi_transform inst/decl helpers in aaline code
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:24 -06:00
Brian Paul e9d076e6d0 tgsi: add inst/decl helpers for tgsi_transform utility
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:24 -06:00
Brian Paul 16ff2fdd70 draw: use tgsi transform prolog callback in polygon stipple code
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:24 -06:00
Brian Paul 6581aa441e draw: use tgsi transform prolog/epilog callbacks in AA line code
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:24 -06:00
Brian Paul d77c0a2b52 draw: use tgsi transform prolog/epilog callbacks in AA point code
This simplifies the code and makes it a little easier to understand.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:24 -06:00
Brian Paul 9e0160fc58 tgsi: fix tgsi transform's epilog callback
We want to call the caller's epilog callback when we find the TGSI
END instruction, not after it.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:23 -06:00
Brian Paul b16bb3f50f tgsi: add prolog() method to tgsi_transform_context
Called when the user can insert new decls, instructions.
This could be used in a few places in the 'draw' module.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
2014-09-22 16:56:23 -06:00
Brian Paul 0100d45b7e target-helpers: add inline qualifier on configuration_query()
To silence unused function warnings.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-09-22 08:04:34 -06:00
Rob Clark 18291ee17a freedreno: add DRM_CONF_SHARE_FD
And config query and DRM_CONF_SHARE_FD to both mega-driver and
traditional build configs, so that EGL_EXT_image_dma_buf_import
works.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-21 15:35:53 -04:00
Roland Scheidegger 7ede5a1a7b gallivm: add information about different sampler/view units if analyzing shader
Useful to know in some cases.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-20 02:19:02 +02:00
Roland Scheidegger f2c39dd0e1 util: don't try to emit half-float intrinsics if avx isn't available
These instructions only have vex encodings, thus they can't be used without
avx. (Technically, one can still use avx-128 if avx isn't available because
the environment doesn't store the ymm registers, however I don't think llvm
can.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-19 16:58:28 +02:00
Roland Scheidegger 019ca99bee draw: (trivial) remove duplicated lines 2014-09-18 16:13:24 +02:00
rconde ffeb77c7b0 gallivm,tgsi: fix idiv by zero crash
While the result of signed integer division by zero is undefined by glsl
(and doesn't exist with d3d10), we must not crash, so need to make sure we
don't get sigfpe much like udiv already does.
Unlike udiv where we return 0xffffffff (as required by d3d10) there is
no requirement right now to return anything specific so we use zero.
2014-09-17 18:31:54 +02:00
Roland Scheidegger 4d996877ca gallivm: add texture target information for sample opcodes to tgsi info
sample opcodes don't have valid texture target information (and I don't think
this should be changed), however it would be nice if we had that information
ready elsewhere, so stuff that information into the tgsi info when analyzing
a shader.

v2: Ilja Mirkin spotted some bugs wrt not handling msaa resources. So add them
and while there also add them to the tex opcode analysis this was cloned from
as well (plus get rid of some bug not detecting indirect textures there in some
cases too).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-17 18:31:54 +02:00
Richard Sandiford f9d8574b5e gallium: Add PIPE_FORMAT_x8B8G8R8_SNORM formats
This means that each RnGnBnxn format has a reversed counterpart,
which is necessary for handling big-endian mesa<->gallium mappings.
The associated UNORM and SRGB formats already exist.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-17 13:17:46 +10:00
Richard Sandiford f14b40ab32 gallium: Add PIPE_FORMAT_AnLn and PIPE_FORMAT_GnRn formats
...i.e. formats in which the alpha or green channel is first in memory.

This means that each LnAn and RnGn format has a reversed counterpart,
which is necessary for handling big-endian mesa<->gallium mappings.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-17 13:17:46 +10:00
Dave Airlie ebcb2ee989 util: move shared rgtc code to util (v2)
This was being shared using a ../../ get out of gallium into
mesa, and I swore when I did it I'd fix things when we got a util
dir, we did, so I have.

v2: move RGTC_DEBUG define

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-17 11:27:25 +10:00
Richard Sandiford f93b6d8cc5 util: Add big-endian layout for a number of formats.
This patch builds on 6c8f547f66 and
previous patches by allowing u_format.csv to specify separate big-endian
and little-endian layouts.  It then uses this to specify the correct layouts
for various depth/stencil formats.  Later patches handle other formats.

To recap, the idea is that u_format.csv lists the channels for an N-byte
value as though it were an N-byte integer.  For little-endian targets
the channels are listed starting at the least-significant bit of the
integer while for big-endian targets the channels are listed starting
at the most-significant bit.  This means that for something like
PIPE_FORMAT_B8G8R8A8_UNORM (blue in first byte of memory, alpha in last
byte of memory) the orders are the same for both endiannesses.  But for
something like PIPE_FORMAT_S8_UINT_Z24_UNORM, where the stencil is in
the least significant byte of a 32-bit integer, there need to be separate
channel definitions for each endianness.

The effect of this patch is to make the affected PIPE_FORMAT_*s have
the same layout as the associated MESA_FORMAT_*s for big-endian.
The MESA_FORMAT_*s are already handled correctly.

Fixes various piglit tests on z.  No regressions on x86_64.

[airlied: squash subsequent patches]
util: Add big-endian layout for 5551 and 565 formats
util: Add big-endian layout for 10/10/10/2 formats
util: Add big-endian layout for 4444 formats
util: Add big-endian layout for 233 format
util: Add big-endian layout for 44 formats

Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-16 14:02:56 +10:00
Richard Sandiford 1a65629ccc gallivm: Fix uses of 2^24
Fallback cases in lp_bld_arit.c used 2^24 to mean "2 to the power 24",
but in C it's "2 xor 24", i.e. 26.  Fixed by using 1<< instead.

Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Cc: "10.2 10.3" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-09-16 14:02:55 +10:00
Richard Sandiford 0a7f9fe42b gallivm: Add SNORM clamping to lp_build_{add, sub}
...fixing the associated TODO.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
2014-09-16 14:02:54 +10:00
Rafael Ávila de Espíndola f6e71ff9eb gallivm: attach DataLayout to module too, not just pass manager.
It looks like it was possible to attach it to both for a long time, however
since llvm r217548 attaching it to just the pass manager is no longer
sufficient and causes bugs (see http://llvm.org/bugs/show_bug.cgi?id=20903).

Tested-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-16 03:50:32 +02:00
Roland Scheidegger 145fef9636 gallivm: handle SAMPLE opcode in aos sampling
This is just a very limited version, in particular sampler and sampler view
index must be the same. It cannot handle any modifiers neither.
Works much the same as soa version otherwise, to figure out the target we
need to store the sampler view dcls.
While here, also handle (no-op) RET and get rid of a couple bogus deprecated
comments.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-16 03:50:31 +02:00
Roland Scheidegger 02595c55b0 tgsi: accept offsets for sample opcodes too in the text parser
sample opcodes are a little oddly represented in the opcode_info, since
they don't count as texture instructions - they don't have valid target
information, but they may have offsets (unlike "ordinary" texture
instructions, the texture token may be optional for them).
So just make sure with these opcodes the optional offsets are accepted.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-16 03:50:31 +02:00
Roland Scheidegger 3a9eb40ee1 tgsi: don't print texture target for sample opcodes
sample opcodes don't encode a texture target, it would thus always
print UNKNOWN, which is not helpful (and wouldn't parse when giving
back the shader text to tgsi).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-16 03:50:31 +02:00
Rob Clark 3e0a82b52e util/u_format: add _is_alpha()
Because of render-to-alpha (000x) shenanigans, freedreno needs to do
some special handling when rendering to alpha-only formats.  And I
noticed that while we had _is_luminance(), _is_intensity(), etc, an
_is_alpha() helper was missing.  So fix that.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-09-12 16:23:52 -04:00
Andreas Boll 2a13ff954d gallium/util: add missing u_debug include
Needed for assert.
Fixes build on BE archs with -Werror=implicit-function-declaration.

In file included from
../../../../../src/gallium/auxiliary/draw/draw_fs.c:30:0:
../../../../../src/gallium/auxiliary/util/u_math.h: In function
'util_memcpy_cpu_to_le32':
../../../../../src/gallium/auxiliary/util/u_math.h:810:4: error:
implicit declaration of function 'assert'
[-Werror=implicit-function-declaration]
    assert(n % 4 == 0);
        ^

Cc: "10.3" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-09-12 15:55:12 +02:00
Ilia Mirkin c113095acd gallium: add a texture target to sampler view and a CAP to use it
This allows a sampler view to have a different texture target than the
underlying resource. This will be used to implement the type casting
between 2d arrays and cube maps as specified in ARB_texture_view.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-09-12 00:54:55 -04:00
Brian Paul 5cf8d9f54b u_vbuf: simple whitespace fix 2014-09-10 16:37:54 -06:00
Vinson Lee cc20c45a36 pipe-loader: Include unistd.h in pipe_loader_drm.c for close function.
This patch fixes a build error on DragonFly.

  CC       libpipe_loader_la-pipe_loader_drm.lo
pipe_loader_drm.c: In function 'pipe_loader_drm_probe':
pipe_loader_drm.c:207:10: error: implicit declaration of function 'close' [-Werror=implicit-function-declaration]

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-09-10 11:59:38 -07:00
Emil Velikov 3d8b53ffb4 automake: remove obsolete NEED_GALLIUM_LOADER
Superseded by HAVE_LOADER_GALLIUM. The latter has a *DRM* brethren
making the whose easier on which one to keep.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-09-09 19:45:24 +01:00
Roland Scheidegger 08f13ff439 gallivm: (trivial) don't try to use rcp when the division 1/x is integer
This would just crash. Noticed by accident while checking int divisions by zero
with a quickly hacked piglit test.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-09 01:44:08 +02:00
Roland Scheidegger 9405e15f51 gallivm: (trivial) fix min / max variable names
Calling the variable min when it's really max and vice versa seems a bit
confusing.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-09-09 01:44:05 +02:00
Ulrich Weigand 0feb977bbf gallivm: Fix Altivec pack intrinsics for little-endian
This patch fixes use of Altivec pack intrinsics on little-endian PowerPC
systems.  Since little-endian operation only affects the load and store
instructions, the semantics of pack (and other) instructions that take
two input vectors implicitly change: the pack instructions still fill
a register placing values from the first operand into the "high" parts
of the register, and values from the second operand into the "low" parts
of the register, but since vector loads and stores perform an endian swap,
the high parts end up at high memory addresses.

To still achieve the desired effect, we have to swap the two inputs to
the pack instruction on little-endian systems.  This is done automatically
by the back-end for instructions generated by LLVM, but needs to be done
manually when emitting intrisincs (which still result in that instruction
being emitted directly).

Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Maarten Lankhorst <dev@mblankhorst.nl>
2014-09-06 15:51:58 +02:00
Michel Dänzer 76b906c9f6 configure.ac: Add AC_SYS_LARGEFILE
Making sure large file support is enabled across the tree even on 32-bit
systems.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-09-05 18:08:59 +09:00
Michel Dänzer 58b386dce4 gallivm: Fix build against LLVM SVN >= r216982
Only MCJIT is available anymore.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2014-09-03 09:15:01 -07:00
Eric Anholt 2da9118852 u_primconvert: Use u_upload_mgr for our little IB allocations.
tex-miplevel-selection was hammering my memory manager with primconverts
on individual quads.  This gets all those converted IBs packed into larger
IBs.

Reviewed-by: Rob Clark <robclark@freedesktop.org>
2014-09-02 13:55:15 -07:00
Eric Anholt 6720d1573a u_primconvert: Shut up compiler warning.
gcc isn't detecting that src is set before used, since both are under if
(info->indexed).

Reviewed-by: Rob Clark <robclark@freedesktop.org>
2014-09-02 13:55:15 -07:00
Michel Dänzer b84b9eae20 u_blitter: Create all shaders on demand
Not all of these are used in every context, so this can make a
significant difference for short-lived contexts such as in piglit tests.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-09-02 15:24:07 +09:00
Marek Olšák b419c651fb gallium/pb_bufmgr_cache: limit the size of cache
This should make a machine which is running piglit more responsive at times.
e.g. streaming-texture-leak can easily eat 600 MB because of how fast it
creates new textures.
2014-09-01 20:17:48 +02:00
Marek Olšák bba7d29a86 pipe-loader: use the correct screen index 2014-09-01 20:09:19 +02:00
Roland Scheidegger ca4f0baca2 gallivm: fix somewhat broken NaN behavior for exp2
I actually screwed that up in 754319490f,
mistakenly thinking the code actually wanted the non-nan result before.
So, introduce that missing nan behavior case and use that instead.
For sse, there's no actual change in the resulting code at all, the fallback
code wouldn't have done the right thing though.
Of course, the actual issue I saw with pow() was completely unrelated...

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-08-30 01:34:41 +02:00
Roland Scheidegger 9da75f96bc gallivm: handle cube map arrays for texture sampling
Pretty easy, just make sure that all paths testing for PIPE_TEXTURE_CUBE
also recognize PIPE_TEXTURE_CUBE_ARRAY, and add the layer * 6 calculation
to the calculated face.
Also handle it for texture size query, looks like OpenGL wants the number
of cubes, not layers (so need division by 6).

No piglit regressions.

v2: fix up adding cube layer to face for seamless filtering (needs to happen
after calculating per-sample face). Undetected by piglit unfortunately.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com> (v1)
2014-08-30 01:33:02 +02:00
Roland Scheidegger 26a5156de7 draw: kill off bogus assertion in tgsi_fetch_gs_outputs
Not sure why it was there but it is definitely not an error if gs outputs are
infs/nans. Besides, the outputs can be ints, in which case any small negative
number asserted.
This fixes piglit's texelFetch gs isamplerXX crashes with softpipe (down from
14 to 2).

Bug https://bugs.freedesktop.org/show_bug.cgi?id=80012

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-08-30 01:17:47 +02:00
Roland Scheidegger 032fe4ed23 tgsi: (trivial) fix handling msaa resources on TXF
Just handle as ordinary 2d / 2d array resources. Prevents an assertion failure
with softpipe and piglit glsl-resource-not-bound 2DMS/2DMSArray tests.
While here also fix TXD shadowCube similarly, which fixes the crash with piglit
tex-miplevel-selection textureGrad CubeShadow (the test will still fail due to
softpipe being broken).

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=80011

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-08-30 01:17:47 +02:00
Roland Scheidegger 99105454b0 draw: remove fishy num_samplers/num_sampler_views check in llvm path
This was meant for softpipe to not crash at some point if vertex texturing
was used. It is, however, fishy because it uses values from
draw_set_samplers/draw_set_sampler_views and not from the shader key. Albeit
we should still in all cases actually generate a new shader if this changes
(because the samplers and views themselves are in the key) I don't want to
think again wondering if that's really correct in the future.
Besides, at least today, it does not actually work for softpipe, as this was
relying on softpipe not actually calling draw_set_samplers/sampler_views at
all - I've verified it crashes regardless (if there were a tex instruction in
the vs, which normally should not happen anyway). For drivers which do indeed
not call these functions because they don't support vertex texturing at all
(r300), this should still not crash because the static texture data is all
zero, which causes the sampling functions to take an early out (same as is done
if no texture is bound at the slot used for sampling - verified with hacked up
softpipe).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-08-30 01:17:46 +02:00
Michel Dänzer 6cd0dbc415 u_vbuf: Make sure all caps are initialized
Pointed out by valgrind.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83148
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2014-08-29 12:15:10 +09:00
Emil Velikov 664c2d7694 gallium/ilo: cleanup intel_winsys.h
Make the header location, inclusion and contents more common with
its i915,r* and nouveau counterparts:

 - Move the header within drivers/ilo.
 - Separate out intel_winsys_create_for_fd into 'drm_public' header.
 - Cleanup the compiler includes.

v2: Move the header to drivers/ilo. Suggested by Chia-I.
v3: Correct intel_winsys.h inclusion. Spotted by Chia-I.

Cc: Chia-I Wu <olvaffe@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
2014-08-28 21:24:16 +01:00
Roland Scheidegger eee9f6ae8a draw: fix base instance handling in llvm path
The base instance needs to be passed to the jited function, otherwise the
instanced data fetch will only work with the same start instance when the
jit function was created (and baking that into the key instead is not a viable
option).
This fixes piglit arb_base_instance-drawarrays (modulo some unrelated
core/compat context trouble I get for the test).
And fix the pipe cap bit in llvmpipe for it now that it actually works (it
already worked for softpipe).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-08-28 03:03:23 +02:00
Christian König 03a99ba9e4 vl/compositor: set the scissor before clearing the render target
Otherwise we clear areas that shouldn't be cleared.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
2014-08-26 17:56:57 +02:00
Eric Anholt e2f66315cb u_vbuf: Add a few more format fallbacks.
Fixes piglit draw-vertices and gl-2.0-vertexattribpointer on vc4, where
I'm only advertising R32F to RGBA32F support so far.

Note: regresses gl-1.5-normal3b3s-invariance due to introduced flushes and
missing depth buffer load/store support in the driver.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-08-24 22:13:25 -07:00
Eric Anholt bbbe3b65ad u_vbuf: Simplify the format fallback translation.
Individual caps made supporting new fallbacks more complicated than it
needed to be.  Instead, just make a table of fallbacks at context init
time.

v2: Fix inverted "do we need to install vbuf?" flagging caught by Marek.

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v2)
2014-08-24 22:13:25 -07:00
Vinson Lee c2867f5b36 auxilary/os: Add Solaris support in os_get_total_physical_memory.
The patch fixes the build on Oracle Solaris.

  CC     os/os_misc.lo
"os/os_misc.c", line 59: #error: unexpected platform in os_sysinfo.c

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-08-22 18:24:34 -07:00
Tom Stellard 43d954342e pipe-loader: Fix memory leak v2
v2:
  - Change driver_name to char*

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
CC: "10.2" <mesa-stable@lists.freedesktop.org>
2014-08-21 06:12:12 -07:00
Jon TURNEY bde2a62af7 Teach os_get_total_physical_memory about Cygwin
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-08-20 17:18:39 +01:00
Vinson Lee c04a6d5c29 gallivm: Fix build with LLVM >= 3.6 r215967.
This LLVM 3.6 commit changed EngineBuilder constructor.

commit 3f4ed32b4398eaf4fe0080d8001ba01e6c2f43c8
Author: Rafael Espindola <rafael.espindola@gmail.com>
Date:   Tue Aug 19 04:04:25 2014 +0000

    Make it explicit that ExecutionEngine takes ownership of the modules.

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215967 91177308-0d34-0410-b5e6-96231b3b80d8

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2014-08-20 15:24:44 +09:00
Alexander von Gluck IV 8cbf01f12a gallium/aux: Fill in Haiku get process name code
Acked-by: Brian Paul <brianp@vmware.com>
2014-08-19 10:03:05 -04:00
Marek Olšák a6fcdbf560 gallium/u_blitter: don't use an empty fragment shader if there's a colorbuffer
This is custom code used by some drivers.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-08-19 12:20:18 +02:00
Marek Olšák 406ab1662c gallium/util: handle PIPE_BUFFER in util_pipe_tex_to_tgsi_tex
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-08-19 12:20:18 +02:00