Commit Graph

18203 Commits

Author SHA1 Message Date
Rob Clark 38d8b02eba freedreno: implement fd_screen_destroy()
Opps, didn't notice that I had left it stubbed out.

Also, make things fail a bit more gracefully when things go wrong.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-04-24 21:09:46 -04:00
Rob Clark a64e2d9d9f freedreno: set SWAP bit based on format
Really this should be set based on buffer format, not on color vs
depth/stencil.  Probably there should be more formats that set the bit
as we add support for more render target formats.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2013-04-24 21:09:46 -04:00
Tom Stellard d9a32b84e3 radeon/llvm: Fix segfault with a specifc libelf implementation
The libelf implementation that is distributed here:
http://www.mr511.de/software/english.html
requires calling elf_version() prior to calling elf_memory()

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2013-04-24 16:51:25 -07:00
Alex Deucher 5bbeae7a3d r600g: use CP DMA for buffer clears on evergreen+
Lighter weight then using streamout.  Only evergreen
and newer asics support embedded data as src with
CP DMA.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2013-04-24 18:54:31 -04:00
Tom Stellard f64058803a r600g/llvm: Pass struct r600_bytecode to r600_llvm_compile
This way we don't need to update the function signature everytime we
emit a new config value.  This also fixes the build with
--enable-opencl.
2013-04-24 12:42:41 -04:00
José Fonseca e29525f79f winsys/sw/xlib: Prevent shared memory segment leakage.
Running piglit with this was causing all sort of weird stuff happening
to my desktop (Chromium webpages become blank, Qt Creator flickered,
etc).  I tracked this down to shared memory segment leakage when GL is
not shutdown properly. The segments can be seen running `ipcs` and
looking for nattch==0.

This changes fixes this by calling shmctl(IPC_RMID) soon after creation
(which does not remove the segment immediately, but simply marks it for
removal when no more processes are attached).

This matches src/mesa/drivers/x11/xm_buffer.c behaviour.

v2:
- move shmctl(IPC_RMID) after XShmAttach() for *BSD, per Chris Wilson
- remove stray debug printfs, spotted by Ian Romanick

NOTE: This is a candidate for stable branches.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-24 16:54:58 +01:00
Zack Rusin 1a87473998 draw/gs: preserve leading vertex info for gs
We need to handle the leading vertex information when
assembling primitives for the geometry shader otherwise
the resulting triangles will have vertices at incorrect
input locations.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-04-23 06:17:59 -04:00
Christian König c5c754d184 radeonsi: cleanup disabling tiling for UVD v3
Should fix: https://bugs.freedesktop.org/show_bug.cgi?id=63702

v2: add a comment that this is just a workaround
v3: fix typo in comment

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-04-24 11:07:26 +02:00
Kenneth Graunke f0cb66b699 mesa: Restore 78-column wrapping of license text in C++-style comments.
The previous commit introduced extra words, breaking the formatting.

This text transformation was done automatically via the following shell
command:
$ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript2

where 'vimscript2' is a file containing:
/THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/^ *$/ !fmt -w 78 -p '// '
:wq

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:07:12 -07:00
Kenneth Graunke 3d8d5b298a mesa: Restore 78-column wrapping of license text in C-style comments.
The previous commit introduced extra words, breaking the formatting.

This text transformation was done automatically via the following shell
command:
$ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript

where 'vimscript' is a file containing:
/THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * '
:wq

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:07:09 -07:00
Kenneth Graunke 96ff2edc73 mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.
This brings the license text in line with the MIT License as published
on the Open Source Initiative website:

http://opensource.org/licenses/mit-license.php

Generated automatically be the following shell command:
$ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \
  sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {}

This introduces some wrapping issues, to be fixed in the next commit.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:07:06 -07:00
Kenneth Graunke dd404bc94f mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.
Generated automatically be the following shell command:
$ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \
  sed -i 's/BRIAN PAUL/THE AUTHORS/' {}

The intention here is to protect all authors, not just Brian Paul.  I
believe that was already the sensible interpretation, but spelling it
out is probably better.

More practically, it also prevents people from accidentally copy &
pasting the license into a new file which says Brian is not liable when
he isn't even one of the authors.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-23 22:06:38 -07:00
José Fonseca 2737abb44e gallium: Replace gl_rasterization_rules with lower_left_origin and half_pixel_center.
Squashed commit of the following:

commit 04c5fa2cbb8e89d6f2fa5a75af1cca03b1f6b852
Author: José Fonseca <jfonseca@vmware.com>
Date:   Tue Apr 23 17:37:18 2013 +0100

    gallium: s/lower_left_origin/bottom_edge_rule/

commit 4dff4f64fa83b9737def136fffd161d55e4f1722
Author: José Fonseca <jfonseca@vmware.com>
Date:   Tue Apr 23 17:35:04 2013 +0100

    gallium: Move diagram to docs.

commit 442a63012c8c3c3797f45e03f2ca20ad5f399832
Author: James Benton <jbenton@vmware.com>
Date:   Fri May 11 17:50:55 2012 +0100

    gallium: Replace gl_rasterization_rules with lower_left_origin and half_pixel_center.

    This change is necessary to achieve correct results when using OpenGL
    FBOs.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-04-23 19:42:47 +01:00
Marek Olšák b692076420 r600g: initialize CMASK and HTILE with the GPU using streamout
This fixes a crash when a resource cannot be mapped to the CPU's address space
because it's too big.

This puts a global pipe_context in r600_screen, which is guarded by a mutex,
so that we can use pipe_context when there isn't one around.
Hopefully our multi-context support is solid.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

NOTE: This is a candidate for the 9.1 branch.
2013-04-23 20:26:20 +02:00
Marek Olšák 1ba46bbb4c gallium/u_blitter: implement buffer clearing
Although this might be useful for ARB_clear_buffer_object,
I need it for initializating resources in r600g.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>

v2: comment cleanups

NOTE: This is a candidate for the 9.1 branch.
2013-04-23 20:26:20 +02:00
Vincent Lejeune edd90a19ca r600/llvm: Read stacksize from config header 2013-04-23 19:52:29 +02:00
Vincent Lejeune a7f73f5155 /bin/bash: q : commande introuvable 2013-04-23 19:52:02 +02:00
Tom Stellard a0c8942bb4 radeon/llvm: Fix build with LLVM >= r180063 2013-04-23 11:53:05 -04:00
Tom Stellard ead4db420e gallivm: Fix build with LLVM >= r180063 2013-04-23 11:53:05 -04:00
Zack Rusin 1fb8c3ce55 draw: use the prim count for ia primitives
Number of vertices to fetch doesn't always equal the number of input
vertices. To correctly compute the number if IA primitives we need
to use the total number of input vertices, not only those that
need to be fetched.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-04-22 20:36:07 -04:00
Zack Rusin 76587d2e5e tgsi/scan: set correct input limits for geometry shader
TGSI geometry shader input declerations are of the IN[][2] format
and the dimensions of the array have to be deduced from the input
primitive property.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-04-22 20:36:07 -04:00
Zack Rusin 913ed25f18 draw: add code to reset instance dependent data
We want to be able to reset certain parts of the pipeline,
in particular the input primitive index, but only either with
seperate invocations of the draw_vbo or new instances. In all
other cases (e.g. new invocations due to primitive restart)
that data needs to be preserved. Add a function through which
we can reset instance dependent data.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-04-22 20:36:07 -04:00
Zack Rusin 2aad06844f softpipe: fix streamout with an emptry geometry shader
Same approach as in the llvmpipe, if the geometry shader is
null and we have stream output then attach it to the vertex
shader right before executing the draw pipeline.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
2013-04-22 20:36:07 -04:00
José Fonseca 7c1bf8e381 gallium: Add a new clip_halfz rasterizer state.
gl_rasterization_rules lumps too many different flags.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-22 18:39:06 +01:00
José Fonseca c0538860bf gallivm: Fix assignment of unsigned values to OUT register.
TEMP is not the only register file that accept unsigned. OUT too.

Actually, what determines the appropriate type of the destination value is
not the opcode, but rather the register.

Also cleanup/simplify code.  Add a few more asserts, but also make
code more robust by handling graceful if assert fails.

This fixes segfault / assertion in the included vert-uadd.sh graw shader.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2013-04-22 18:23:42 +01:00
José Fonseca 9fb5b2f45c Revert "gallivm: Emit vector selects."
It caused inumerous regressions (LLVM 3.1) in blending. In particular:

 - lp_test_blend

    type=u8nx16 rgb_func=sub rgb_src_factor=zero rgb_dst_factor=inv_src_color alpha_func=rev_sub alpha_src_factor=one alpha_dst_factor=const_color ...  MISMATCH
     Src:  0  0  0 b5 49 29  0 a2  0 21 de  0 c3 1b ec  0
     Src1: 2d 85 14  0 f8  0 79 a1 99  0 d8  0 59 16  0  0
     Dst:  0 a9 97  0 c0  0 78  0  0 8b aa f0 bd  0 78 f6
     Con: 7d  0 c0  0  0 bb 77  0  0  0 50  0 40 51  0  0
     Res:  0  0  0  0  0 29  0  0  0  0 c8  0 97 1b e3  0
     Ref:  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
    type=u8nx16 rgb_func=max rgb_src_factor=one rgb_dst_factor=inv_const_color alpha_func=min alpha_src_factor=zero alpha_dst_factor=inv_src1_alpha ...  MISMATCH
     Src:  d  0  0 e9  0 37 35 f0 62  0  0 b2 e9 f7  0 5c
     Src1: 8f  0 bf  0 a8  5  0  0 c4  0 d7  7 92  a  0 17
     Dst: cb  0 1e  0  0  0 19 8e  0 4d  0  0  0  0  3 46
     Con: aa 5a 5f 8f  0  0 bc 92  0 88  0  0 b7 8a c0 88
     Res: 44  0 13  0  0  0  7 8e  0 24  0  0  0  0  1 40
     Ref: 44  0 13  0  0 37 35  0 62 24  0  0 e9 f7  1  0

This reverts commit 1e266c7ef0.
2013-04-21 09:07:19 +01:00
José Fonseca d8a4c4c524 llvmpipe: verify function on blend test. 2013-04-21 08:53:31 +01:00
José Fonseca a79990bec0 llvmpipe: Don't support Z32_FLOAT_S8X24_UINT texture sampling support either.
Because we don't support, and the u_format fallback doesn't work for
zs formats.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-20 23:25:36 +01:00
José Fonseca c08b04992a llvmpipe: Ignore depth-stencil state if format has no depth/stencil.
Prevents assertion failures inside the driver for such state combinations.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-20 23:25:36 +01:00
José Fonseca f701a5a0fe gallivm: Disable LLVM 2.7 workaround on other versions.
2.7 was a particularly trouble ridden release.

Furthermore, the bug no longer can be reproduced ever since the
first_level state was taken in account.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-20 23:25:36 +01:00
José Fonseca 1e266c7ef0 gallivm: Emit vector selects.
They are supported on LLVM 3.1, at least on x86. (I haven't tested on PPC
though.)

Actually lp_build_linear_mip_levels() already has been emitting them for
some time.

This avoids intrinsics, which tend to be an obstacle for certain
optimization passes.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-20 23:25:36 +01:00
Rob Clark 26b39df08f freedreno: move ir -> ir2
There will be a new IR for a3xx, which has a very different shader ISA
(more scalar oriented).  So rename to avoid conflicts later when I start
adding a3xx support to the gallium driver.

Signed-off-by: Rob Clark <Rob Clark robdclark@freedesktop.org>
2013-04-20 17:59:41 -04:00
Rob Clark d8134792ae freedreno: cleanup some cruft left over from fdre
The standalone shader assembler needed some meta-data to know about
attributes/varyings/etc, to do the shader linkage.  We don't need these
parts with gallium/tgsi, so just get rid of it.

Signed-off-by: Rob Clark <Rob Clark robdclark@freedesktop.org>
2013-04-20 17:31:47 -04:00
Roland Scheidegger 85974e5fee gallivm: implement switch opcode
Should be able to handle all things which make this tricky to implement.
Fallthroughs, including most notably into/out of default, should be handled
correctly but are quite a mess.
If we see largely unoptimized switches in the wild should probably think
about some "real" switch optimization pass, e.g. things like this:

switch
case1
someinst
brk
case2
default
case3
someinst
brk
case4
someinst
endswitch

are legal, but the pointless case2/case3 statements not only cause condition
evaluation but will turn this into a "fake" fallthrough case (because
mask and defaultmask are already updated for case2 when default is
encountered) requiring executing code twice.
If default is at the end though, there's never any code re-execution, and
if that's not the case if there's no fallthrough in (not even a fake one)
and out of default there's no code re-execution neither.

v2: add comments, and use enum for break type instead of magic boolean.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-04-20 02:27:53 +02:00
Roland Scheidegger 8f5d4283c0 gallivm: use uint build context for mask instead of float
Unsurprisingly noone was using it except for grabbing builder.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-04-20 02:27:53 +02:00
Roland Scheidegger 107550e71a gallivm/tgsi: fix up breakc
It seems there was a typo in gallivm breakc handling (I am actually still
not sure it is really needed but otherwise that statement really should go
away). Also fix the wrong src argument type, even though they weren't really
used.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-04-20 02:27:53 +02:00
Roland Scheidegger e8d1b26a82 svga: remove TGSI_OPCODE_BREAKC instruction translation
While initially that opcode probably was meant for something along the
lines of sm3 break_comp it has never worked that way (not even the
argument count was right) and now the opcode has quite different
semantics so just remove it. (Discovered by Jose Fonseca)
2013-04-20 02:27:53 +02:00
Roland Scheidegger 794579105a gallium: document breakc and switch/case/default/endswitch
docs were missing, especially the opcode-from-hell switch however is anything
but obvious.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-04-20 02:27:53 +02:00
Roland Scheidegger 443950c6aa gallivm: increase nesting limit to 66
This is still not really correct, since at least for sm 4.0
the nesting limit is 64 per subroutine, and subroutine nesting itself
has a limit of 32, so since we have a flat stack we'd need 32*64.
But this should probably be better fixed with per-subroutine stacks,
since otherwise these structures get really big (like 100kB for the
lp_exec_mask).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-04-20 02:27:53 +02:00
Zack Rusin 12eab7cc56 draw: implement primitive assembler
Input assembler needs to be able to decompose adjacency primitives
into something that can be understood by the rest of the pipeline.
The specs say that the adjacency primitives are *only* visible
in the geometry shader, for everything else they need to be
decomposed. Which in most of the cases is not an issue, because
the geometry shader always decomposes them for us, but without
geometry shader we were passing unchanged adjacency primitives
to the rest of the pipeline and causing crashes everywhere. This
commit introduces a primitive assembler which, if geometry
shader is missing and the input primitive is one of the
adjacency primitives, decomposes them into something
that the rest of the pipeline can understand.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-04-18 11:51:22 -07:00
Zack Rusin e4752d0f56 util/prim: fix decomposed counts for adjacency primitives
Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-04-18 11:37:37 -07:00
Zack Rusin c1299204ad draw/so: uses the correct index with the pre clipped coordinates
pre_clip_pos is a float[4] we just used (*float)[4] to be able to
jump within the array of vertex_headers with it. So if the idx
happened to be anything but 0, we'd actually read from some garbage
in memory. Change it to just be a simple pointer instead of casting
it to something that it's not. As suggested by Jose.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-04-18 11:36:38 -07:00
Eric Anholt ea6cf2b686 mesa: Use quotes on bool driconf options to prevent stdbool.h breakage.
Since stdbool.h's "true" and "false" are #defines, they got expanded when
used as macro arguments, and that expanded value was stored in the
XML string, producing XML that driconf would then fail to parse.

Currently no drivers included stdbool along with driconf, but I keep
accidentally doing so on intel as we move towards using normal C.

v2: rebase on master.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2013-04-19 10:10:22 -07:00
Brian Paul cecbfce5eb svga: whitespace, comment fixes in svga_pipe_query.c 2013-04-19 10:04:11 -06:00
Brian Paul ef1b2b8da7 svga: whitespace, comment fixes in svga_pipe_fs/vs.c 2013-04-19 10:03:56 -06:00
José Fonseca dbb690872e gallivm: Fix half floats with MCJIT.
Prevents:

  LLVM ERROR: Cannot select: intrinsic %llvm.x86.vcvtph2ps.128
2013-04-19 10:13:19 +01:00
Jerome Glisse d0e9aaa31c radeonsi: add support for compressed texture v2
Most test pass, issue are with border color and swizzle.

Based on ircnick<maelcum> patch.

v2: Restaged commit hunk

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-04-18 17:25:38 -04:00
Jerome Glisse dc21e30a62 radeonsi: add 2d tiling support for texture v3
v2: Remove left over code
v3: Restage properly the commit so hunk of first one are not in
    second one.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-04-18 17:25:38 -04:00
Vadim Girlin f732036f12 gallium: handle drirc disable_glsl_line_continuations option
NOTE: This is a candidate for the 9.1 branch

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-04-19 01:05:03 +04:00
José Fonseca b72ff373fb llvmpipe: Take in consideration all current constant buffers when mapping.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
2013-04-18 20:48:12 +01:00