Zack Rusin [Thu, 11 Apr 2013 09:22:06 +0000 (02:22 -0700)]
gallivm/gs: fix the end primitive calls
The issue with SOA execution and end_primitive opcode is that it
can be executed both when we haven't emitted any vertices, in
which case we don't want to emit an empty primitive, and when
the execution mask is zero and the execution should be skipped. We
handled only the latter of those conditions. Now we're combining the
execution mask with a mask created from emitted vertices to handle
both cases. As a result we don't need the pending_end_primitive
flag which was broken because it was static and could be affected
by both above mentioned conditions at run-time.
Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Zack Rusin [Wed, 10 Apr 2013 22:28:01 +0000 (15:28 -0700)]
tgsi/exec: geometry shaders are executed on a single primitive
which means that our execution mask in GS is equal to 1 not 0xf.
Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Zack Rusin [Wed, 10 Apr 2013 22:25:18 +0000 (15:25 -0700)]
tgsi/exec: fix the udiv and umod instructions
Same as with llvmpipe: we can't be divind/moding by zero and we
need to make sure that dividing/moding by zero produces 0xffffffff.
Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
José Fonseca [Wed, 17 Apr 2013 12:32:15 +0000 (13:32 +0100)]
gallivm: JIT symbol resolution with linux perf.
Details on docs/llvmpipe.html
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
José Fonseca [Wed, 17 Apr 2013 12:32:46 +0000 (13:32 +0100)]
draw: Silence uninitialized var warnings.
Trivial.
Vincent Lejeune [Sat, 13 Apr 2013 14:36:02 +0000 (16:36 +0200)]
r600g/llvm: Use gprcount from llvm
Anuj Phogat [Tue, 16 Apr 2013 17:34:43 +0000 (10:34 -0700)]
intel: Add a null pointer check before dereferencing the pointer
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Emil Velikov [Fri, 12 Apr 2013 11:41:52 +0000 (12:41 +0100)]
docs: Update 'Making new mesa release'
Add a note to update PACKAGE_VERSION for Android and scons builds
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Emil Velikov [Fri, 12 Apr 2013 11:41:51 +0000 (12:41 +0100)]
docs: Add some missing release notes
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Emil Velikov [Fri, 12 Apr 2013 11:41:50 +0000 (12:41 +0100)]
docs: move specs to a separate folder
Handle legacy/obsolete specs as well
List all specs in extensions.html
Mark 'OLD' extensions as obsolete in extensions.html
Update the spec location in old relnotes
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Emil Velikov [Fri, 12 Apr 2013 11:41:49 +0000 (12:41 +0100)]
docs: restructure release notes into separate folder
relnotes-*html > relnotes/*html
RELNOTES-* > relnotes/*
fix links, css and frames
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
José Fonseca [Wed, 17 Apr 2013 09:47:03 +0000 (10:47 +0100)]
gallium: Disambiguate TGSI_OPCODE_IF.
TGSI_OPCODE_IF condition had two possible interpretations:
- src.x != 0.0f
- Mesa statetracker when PIPE_SHADER_CAP_INTEGERS was false either for
vertex and fragment shaders
- gallivm/llvmpipe
- postprocess
- vl state tracker
- vega state tracker
- most old drivers
- old internal state trackers
- many graw examples
- src.x != 0U
- Mesa statetracker when PIPE_SHADER_CAP_INTEGERS was true for both
vertex and fragment shaders
- tgsi_exec/softpipe
- r600
- radeonsi
- nv50
And drivers that use draw module also were a mess (because Mesa would
emit float IFs, but draw module supports native integers so it would
interpret IF arg as integers...)
This sort of works if the source argument is limited to float +0.0f or
+1.0f, integer 0, but would fail if source is float -0.0f, or integer in
the float NaN range. It could also fail if source is integer 1, and
hardware flushes denormalized numbers to zero.
But with this change there are now two opcodes, IF and UIF, with clear
meaning.
Drivers that do not support native integers do not need to worry about
UIF. However, for backwards compatibility with old state trackers and
examples, it is advisable that native integer capable drivers also
support the float IF opcode.
I tried to implement this for r600 and radeonsi based on the surrounding
code. I couldn't do this for nouveau, so I just shunted IF/UIF
together, which matches the current behavior.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
v2:
- Incorporate Roland's feedback.
- Fix r600_shader.c merge conflict.
- Fix typo in radeon, spotted by Michel Dänzer.
- Incorporte Christoph Bumiller's patch to handle TGSI_OPCODE_IF(float)
properly in nv50/ir.
José Fonseca [Sat, 13 Apr 2013 09:28:01 +0000 (10:28 +0100)]
gallium: Eliminate TGSI_OPCODE_IFC.
Never used or implemented.
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Kenneth Graunke [Wed, 3 Oct 2012 21:26:29 +0000 (14:26 -0700)]
i965: Enable the Bay Trail platform.
This patch adds PCI IDs for Bay Trail (sometimes called Valley View).
As far as the 3D driver is concerned, it's very similar to Ivybridge,
so the existing code should work just fine.
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Christian König [Fri, 12 Apr 2013 15:13:41 +0000 (17:13 +0200)]
r600/uvd: cleanup disabling tiling on pre EG asics
Set transfer flag instead of fiddling with the tilling params directly.
Signed-off-by: Christian König <christian.koenig@amd.com>
Christian König [Fri, 12 Apr 2013 08:25:18 +0000 (10:25 +0200)]
autoconf: enable detection of vdpau and xvmc by default
Since we now have UVD support we should enable them by default.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Ian Romanick [Mon, 15 Apr 2013 19:25:18 +0000 (12:25 -0700)]
mesa/swrast: Move memory allocation outside the blit loop
Assume the maximum pixel size (16 bytes per pixel). In addition to
moving redundant malloc and free calls outside the loop, this fixes a
potential resource leak when a surface is mapped and the malloc fails.
This also makes blit_nearest look a bit more like blit_linear.
v2: Use MAX_PIXEL_BYTES instead of 16. Suggested by Ken.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Fri, 12 Apr 2013 23:47:52 +0000 (16:47 -0700)]
mesa/swrast: Move free calls outside the attachment loop
This was originally discovered by Klocwork analysis:
Possible memory leak. Dynamic memory stored in 'srcBuffer0'
allocated through function 'malloc' at line 566 can be lost at line
746
However, I think the problem is actually much worse. Since the memory
is freed after the first pass through the loop, the released buffer may
be used on the next iteration!
NOTE: This is a candidate for stable release branches.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Fri, 12 Apr 2013 23:47:13 +0000 (16:47 -0700)]
mesa/swrast: Refactor no-memory error checking in blit_linear
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Martin Andersson [Tue, 16 Apr 2013 14:02:00 +0000 (18:02 +0400)]
r600g: Workaround for a harware bug with nested loops on Cayman
There is a hardware bug on Cayman where a BREAK/CONTINUE followed by
LOOP_STARTxxx for nested loops may put the branch stack into a state
such that ALU_PUSH_BEFORE doesn't work as expected. Workaround this
by replacing the ALU_PUSH_BEFORE with a PUSH + ALU
Fixes piglit tests EXT_transform_feedback/order*
v2: Use existing loop count and improve comment
v3: [Vadim Girlin] Set jump address for PUSH instructions
NOTE: This is a candidate for the 9.1 branch
Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
Marek Olšák [Thu, 11 Apr 2013 11:16:42 +0000 (13:16 +0200)]
gallium/hud: fix FPS computation for framerate > 4.2k
Marek Olšák [Wed, 10 Apr 2013 19:42:51 +0000 (21:42 +0200)]
gallium/hud: increase vertex buffer size for background black rectangles
Reviewed-by: Brian Paul <brianp@vmware.com>
Marek Olšák [Wed, 10 Apr 2013 19:41:48 +0000 (21:41 +0200)]
gallium/hud: update the contents of GALLIUM_HUD=help
Reviewed-by: Brian Paul <brianp@vmware.com>
Marek Olšák [Wed, 10 Apr 2013 19:40:39 +0000 (21:40 +0200)]
gallium/hud: remove pipeline-statistics- prefix in query names
for the env var string not to be awfully long
v2: fix bug in indexing of "name"
Reviewed-by: Brian Paul <brianp@vmware.com>
Marek Olšák [Wed, 10 Apr 2013 18:45:01 +0000 (20:45 +0200)]
r600g: implement pipeline statistics query
Marek Olšák [Wed, 10 Apr 2013 15:01:07 +0000 (17:01 +0200)]
winsys/radeon: use query_value for timestamp, remove query_timestamp
Marek Olšák [Fri, 5 Apr 2013 23:33:21 +0000 (01:33 +0200)]
r600g: add a debug flag for printing virtual addresses of resources
Marek Olšák [Fri, 5 Apr 2013 00:43:26 +0000 (02:43 +0200)]
r600g: add a query returning the amount of time spent during bo_map sync.
Matt Turner [Sun, 20 Jan 2013 23:32:08 +0000 (15:32 -0800)]
build: Get rid of GALLIUM_WINSYS_DIRS
configure still uses it to print the enabled winsys.
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sun, 20 Jan 2013 21:06:24 +0000 (13:06 -0800)]
build: Get rid of GALLIUM_TARGET_DIRS
configure still uses it to print the enabled targets.
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sun, 20 Jan 2013 20:54:31 +0000 (12:54 -0800)]
build: Build pipe-loader before gallium tests
And don't build it from other Makefiles. That's awful, and breaks
distclean.
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sun, 20 Jan 2013 19:46:02 +0000 (11:46 -0800)]
build: Get rid of GALLIUM_MAKE_DIRS
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sat, 19 Jan 2013 19:23:51 +0000 (11:23 -0800)]
build: Stop using GALLIUM_STATE_TRACKERS_DIRS for SUBDIRS
configure still uses it to print the enabled state trackers.
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sat, 19 Jan 2013 08:35:43 +0000 (00:35 -0800)]
build: Get rid of DRIVER_DIRS
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sat, 19 Jan 2013 08:28:29 +0000 (00:28 -0800)]
build: Stop AC_SUBST'ing DRI_DIRS and GALLIUM_DRIVERS_DIRS
Neither are used in Makefile.ams.
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sat, 19 Jan 2013 08:09:36 +0000 (00:09 -0800)]
build: Remove GALLIUM_DIRS
It's always constant anyway.
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sat, 19 Jan 2013 07:59:49 +0000 (23:59 -0800)]
build: Get rid of SRC_DIRS
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Sat, 19 Jan 2013 07:43:05 +0000 (23:43 -0800)]
build: Get rid of CORE_DIRS
A step toward working make dist/distcheck.
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Mon, 21 Jan 2013 18:27:25 +0000 (10:27 -0800)]
build: Move src/mapi/mapi/* to src/mapi/
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Matt Turner [Mon, 21 Jan 2013 18:25:31 +0000 (10:25 -0800)]
build: Rename sources.mak -> Makefile.sources
For the sake of consistency.
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-and-Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Tom Stellard [Thu, 4 Apr 2013 20:21:06 +0000 (16:21 -0400)]
radeonsi: Read config values from the .AMDGPU.config ELF section
Instead of emitting configuration values (e.g. number of gprs used) in a
predefined order, the LLVM backend now emits these values in
register/value pairs. The first dword contains the register address and
the second dword contians the value to write.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tom Stellard [Thu, 4 Apr 2013 20:02:51 +0000 (13:02 -0700)]
radeon/llvm: Handle ELF formatted binary output from the LLVM backend
Tom Stellard [Thu, 4 Apr 2013 16:57:13 +0000 (09:57 -0700)]
radeon/llvm: Use a struct for storing compiled code
Roland Scheidegger [Mon, 15 Apr 2013 01:57:23 +0000 (03:57 +0200)]
gallivm: fix small but severe bug in handling multiple lod level strides
Inserting the value for the second quad in the wrong place for the
following shuffle. This meant the row or image stride was undefined which is
quite catastrophic, can lead to bogus texels fetched or just segfault.
This code is only hit for SoA path currently, still surprising it
didn't crash more or caused more visible issues (I think llvm used a
broadcast shuffle for the undefined parts of the vector, hence the undefined
value for the second quad was just the same as that from the first quad,
so as long as both quads hit the same mip level everything was fine, and since
lower mips always have the same large stride it made it less likely to
hit out-of-bound memory in case of differing lods).
Note: this is a candidate for stable branches.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Francisco Jerez [Sun, 7 Apr 2013 16:31:06 +0000 (18:31 +0200)]
clover: Fix usage of incorrect object as destination in clEnqueueCopyBufferToImage.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Francisco Jerez [Sat, 6 Apr 2013 12:35:00 +0000 (14:35 +0200)]
clover: Define platform class and merge with device_registry.
Null platform IDs are OK according to the spec, but some applications have
been reported to get paranoid and assume that our NULL platform is unusable.
As it doesn't hurt to have device enumeration separate from the rest of the
device code (quite the opposite, it makes the code cleaner), make the API use
an actual platform object that keeps track of the available devices instead of
the former NULL pointer.
Reported-and-reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Francisco Jerez [Sat, 13 Apr 2013 10:17:32 +0000 (12:17 +0200)]
clover: Add missing fields to the module serializer.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Eric Anholt [Thu, 11 Apr 2013 17:46:02 +0000 (10:46 -0700)]
i965: Shut up the last release build warning.
I don't see a sensible value to use in this path, but we shouldn't ever
hit this outside of developer new-texture-target enabling.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:38:04 +0000 (10:38 -0700)]
i965: Silence one more compile warning.
We don't want to store this thing in the class, and we do need the
definition to be at the top of the function and held onto until the end
here, so there's not much to do besides (void) reference it.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:37:13 +0000 (10:37 -0700)]
i965: Fix a warning in the release build.
This was copy and pasted from can_reswizzle_dst(), and we can just fold it
in instead to avoid the warning.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:34:59 +0000 (10:34 -0700)]
i965: Fix an unused variable warning in the release build.
I think this actually clarifies what's going on in the asserts a bit,
given how many regions we've got floating around.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:33:00 +0000 (10:33 -0700)]
i965: Fix an unused variable warning in the release build.
It's used in an assert, but we have this as a member of the class anyway.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:30:51 +0000 (10:30 -0700)]
intel: Return failure properly in the texsubimage blit path.
We assert that failure doesn't happen, but it fixes a warning in the
release build and it would at least give working behavior for a user by
falling back to the normal texsubimage path.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:16:26 +0000 (10:16 -0700)]
intel: Fix a warning in the release build.
This was silly -- checking that we didn't overflow the array by dividing
the array size by 2 and then multiplying it back up by 2.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:14:58 +0000 (10:14 -0700)]
intel: Fix an unused variable warning in the release build.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:11:50 +0000 (10:11 -0700)]
intel: Improve diagnostics for emit_linear_blit failure path.
This fixes unused variable warnings in the release build, and should be
more useful if it ever triggers.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:08:56 +0000 (10:08 -0700)]
i965: Fix error path for MCS allocation.
Asserts don't stop execution in release builds, so we would continue on to
use an uninitialized format value. Just take the failure path, which
appears to continue up the call stack for a while.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 17:06:06 +0000 (10:06 -0700)]
i830: Move assert-only code into the assert.
The call has no side effects, and moving it into the assert cleans up a
compile warning in the release build.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 11 Apr 2013 16:54:41 +0000 (09:54 -0700)]
i965/fs: Fix some untriggered optimization bugs with uncompressed/sechalf.
We have this support for firsthalf/sechalf instructions, which would be
called in the !has_compr4 (aka original gen4) 16-wide case. We currently
only support 16-wide for gen5+, so we weren't tripping over this, but it
would have been a problem if we ever try to enable it.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Tue, 9 Apr 2013 00:43:06 +0000 (17:43 -0700)]
i965/fs: Add basic-block-level dead code elimination.
This is a poor substitute for proper global dead code elimination that
could replace both our current paths, but it was very easy to write. It
particularly helps with Valve's shaders that are translated out of DX
assembly, which has been register allocated and thus have a bunch of
unrelated uses of the same variable (some of which get copy-propagated
from and then left for dead).
shader-db results:
total instructions in shared programs: 1735753 -> 1731698 (-0.23%)
instructions in affected programs: 492620 -> 488565 (-0.82%)
v2: Fix comment typo
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Tue, 9 Apr 2013 01:46:23 +0000 (18:46 -0700)]
i965/fs: Remove incorrect note of writing attr in centroid workaround.
This instruction doesn't update its IR destination, it just moves from
payload to f0. This caused the dead code elimination pass I'm adding to
dead-code-eliminate the first step of interpolation.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Mon, 4 Jun 2012 15:59:00 +0000 (08:59 -0700)]
i965/fs: Add a helper function for checking for partial register updates.
These checks were all over, and every time I wrote one I had to try to
decide again what the cases were for partial updates.
v2: Fix inadvertent reladdr check removal.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Thu, 4 Apr 2013 16:47:03 +0000 (09:47 -0700)]
mesa: Add a macro to bitset for determining bitset size.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Eric Anholt [Fri, 5 Apr 2013 20:43:52 +0000 (13:43 -0700)]
i965: Fix compiler warnings since the introduction of texture multisample.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Ian Romanick [Wed, 10 Apr 2013 14:50:49 +0000 (07:50 -0700)]
mesa: Don't leak gl_context::BeginEnd at context destruction
The other dispatch tables (Exec and Save) are freed, but BeginEnd is
never freed. This was found by inspection why investigating the leak of
shared state in _mesa_initialize_context.
NOTE: This is a candidate for stable branches
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Ian Romanick [Wed, 10 Apr 2013 14:47:08 +0000 (07:47 -0700)]
mesa: Don't leak shared state when context initialization fails
Back up at line 1017 (not shown in patch), we add a reference to the
shared state. Several places after that may divert to the error
handler, but, as far as I can tell, nothing ever unreferences the shared
state.
Fixes issue identified by Klocwork analysis:
Resource acquired to 'shared->TexMutex' at line 1012 may be lost
here. Also there is one similar error on line 1087.
NOTE: This is a candidate for the stable branches.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Ian Romanick [Tue, 9 Apr 2013 03:00:30 +0000 (20:00 -0700)]
egl/dri2: NULL check value returned by dri2_create_surface
dri2_create_surface can fail for a variety of reasons, including bad
input data. Dereferencing the NULL pointer and crashing is not okay.
Fixes issue identified by Klocwork analysis:
Pointer 'surf' returned from call to function 'dri2_create_surface'
at line 285 may be NULL and will be dereferenced at line 291.
NOTE: This is a candidate for the stable branches.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Tue, 9 Apr 2013 02:55:18 +0000 (19:55 -0700)]
mesa: NULL check the pointer before trying to dereference it
Duh.
Fixes issues identified by Klocwork analysis:
Pointer 'table' returned from call to function 'calloc' at line 115
may be NULL and will be dereferenced at line 117.
and
Suspicious dereference of pointer 'table' before NULL check at line
119.
NOTE: This is a candidate for the stable branches.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Mon, 8 Apr 2013 23:53:46 +0000 (16:53 -0700)]
glsl: Fix hypothetical NULL dereference related to process_array_type
Ensure that process_array_type never returns NULL, and let
process_array_type handle the case where the supplied base type is NULL.
Fixes issues identified by Klocwork analysis:
Pointer 'type' returned from call to function 'get_type' at line
1907 may be NULL and may be dereferenced at line 1912.
and
Pointer 'field_type' checked for NULL at line 4160 will be
dereferenced at line 4165. Also there is one similar error on line
4174.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Ian Romanick [Mon, 8 Apr 2013 23:37:04 +0000 (16:37 -0700)]
glsl: Fix hypothetical NULL dereference in ast_process_structure_or_interface_block
Fixes issue identified by Klocwork analysis:
Pointer 'field_type' returned from call to function 'glsl_type' at
line 4126 may be NULL and may be dereferenced at line 4139. Also
there are 2 similar errors on line(s) 4165, 4174.
In practice, it should be impossible to actually get NULL in here
because a syntax error would have already caused compilation to halt.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tom Stellard [Wed, 20 Mar 2013 02:39:31 +0000 (22:39 -0400)]
r300g: Fix bug in OMOD optimization
https://bugs.freedesktop.org/show_bug.cgi?id=60503
NOTE: This is a candidate for the stable branches.
Emil Velikov [Thu, 11 Apr 2013 23:22:33 +0000 (00:22 +0100)]
nvc0: set ret variable if launch desc allocation failed
Pointed out by gcc
nve4_compute.c: In function 'nve4_launch_grid':
nve4_compute.c:511:7: warning: 'ret' may be used uninitialized in
this function [-Wmaybe-uninitialized]
if (ret)
^
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Edit by Christoph Bumiller:
Set it to -1 to indicate failure and only when it's actually required.
Emil Velikov [Thu, 11 Apr 2013 23:22:32 +0000 (00:22 +0100)]
nvc0: bail out early during nve4_compute_setup()
Exit gracefully rather than trying to create a random object, whenever the
chipset is unknown
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Thu, 11 Apr 2013 23:22:31 +0000 (00:22 +0100)]
nvc0: compile nve4_cache_split_name() only in debug build
As otherwise it is unused - pointed out by gcc
nve4_compute.c:586:20: warning: 'nve4_cache_split_name' defined but not used [-Wunused-function]
static const char *nve4_cache_split_name(unsigned value)
^
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Thu, 11 Apr 2013 23:22:30 +0000 (00:22 +0100)]
nv50/codegen: do not emitATOM() if the subOp is unknown
For debug build we'll hit the assert, for release we are going to emit random data
as subOp is used uninitilised. Spotted by gcc
codegen/nv50_ir_emit_nv50.cpp: In member function 'void nv50_ir::CodeEmitterNV50::emitATOM(const nv50_ir::Instruction*)':
codegen/nv50_ir_emit_nv50.cpp:1554:12: warning: 'subOp' may be used uninitialized in this function [-Wmaybe-uninitialized]
uint8_t subOp;
^
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Christoph Bumiller [Sat, 6 Apr 2013 12:52:05 +0000 (14:52 +0200)]
nvc0: implement multisample textures
Christoph Bumiller [Sat, 6 Apr 2013 15:40:02 +0000 (17:40 +0200)]
nvc0: patch up TEX cases with 5 or 6 sources on nve4
Hackishly fixes alignment requirement of 2nd tuple for now.
Christoph Bumiller [Sat, 6 Apr 2013 12:15:54 +0000 (14:15 +0200)]
nvc0: fix 2D engine MS2 resolve
Christoph Bumiller [Mon, 8 Apr 2013 11:47:26 +0000 (13:47 +0200)]
nv50,nvc0: add RGBX16/32_FLOAT formats
Matt Turner [Thu, 11 Apr 2013 16:57:23 +0000 (09:57 -0700)]
i965/vs: Print error if vertex shader fails to compile.
Reviewed-by: Eric Anholt <eric@anholt.net>
Matt Turner [Thu, 11 Apr 2013 16:55:42 +0000 (09:55 -0700)]
i965: NULL check prog on shader compilation failure.
Also change if (shader) to if (prog) for consistency.
Reviewed-by: Eric Anholt <eric@anholt.net>
José Fonseca [Thu, 11 Apr 2013 21:37:34 +0000 (22:37 +0100)]
scons: Add st_cb_msaa.c to source list.
Dave Airlie [Sun, 3 Mar 2013 20:19:07 +0000 (06:19 +1000)]
r600g: add get_sample_position support (v3)
v2: I rewrote this to use the sample positions properly.
v3: rewrite properly to use bitfield to cast back to signed ints
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sun, 3 Mar 2013 20:17:11 +0000 (06:17 +1000)]
st/mesa: add support for ARB_texture_multisample (v3)
This adds support to the mesa state tracker for ARB_texture_multisample.
hardware doesn't seem to use a different texture instructions, so
I don't think we need to create one for TGSI at this time.
Thanks to Marek for fixes to sample number picking.
v2: idr pointed out a bug in how we picked the max sample counts,
use new internal format chooser interface to pick proper answers.
v3: use st_choose_format directly, it was okay, fix anding of masks.
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sun, 3 Mar 2013 20:14:18 +0000 (06:14 +1000)]
st/mesa: add support for get sample position
This just calls into the gallium interface.
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sun, 3 Mar 2013 20:11:07 +0000 (06:11 +1000)]
gallium: add get_sample_position interface
This is to be used to implement glGet GL_SAMPLE_POSITION.
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Thu, 11 Apr 2013 04:51:35 +0000 (05:51 +0100)]
r600g: fix two issues in compressed msaa reading code
I've no idea when sample_chan would ever be 4 here, but 4 is most
definitely wrong, array textures have it as 3 as well.
Also the cayman code though unused is obviously wrong.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Paul Berry [Sat, 23 Mar 2013 04:55:03 +0000 (21:55 -0700)]
i965/vs: Don't hardcode DEBUG_VS in generic vec4 code.
Since the vec4_visitor and vec4_generator classes are going to be
re-used for geometry shaders, we can't enable their debug
functionality based on (INTEL_DEBUG & DEBUG_VS) anymore. Instead, add
a debug_flag boolean to these two classes, so that when they're
instantiated the caller can specify whether debug dumps are needed.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Fri, 22 Mar 2013 18:26:34 +0000 (11:26 -0700)]
i965/vs: Generalize computation of array strides in preparation for GS.
Geometry shader inputs are arrays, but they use an unusual array
layout: instead of all array elements for a given geometry shader
input being stored consecutively, all geometry shader inputs are
interleaved into one giant array. As a result, the array stride we
use to access geometry shader inputs must be equal to the size of the
input VUE, rather than the size of the array element.
This patch introduces a new virtual function,
vec4_visitor::compute_array_stride(), which will allow geometry shader
compilation to specialize the computation of array stride to account
for the unusual layout of geometry shader input arrays. It also
renames the local variable that the ir_dereference_array visitor uses
to store the stride, to avoid confusion.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Fri, 22 Mar 2013 15:47:49 +0000 (08:47 -0700)]
i965/vs: Generalize attribute setup code in preparation for GS.
This patch introduces a new function,
vec4_visitor::lower_attributes_to_hw_regs(), which replaces registers
of type ATTR in the instruction stream with the hardware registers
that store those attributes. This logic will need to be common
between the vertex and geometry shaders.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Fri, 22 Mar 2013 13:59:52 +0000 (06:59 -0700)]
i965/vs: Generalize vertex emission code in preparation for GS.
This patch introduces a new function, vec4_visitor::emit_vertex(),
which contains the code for emitting vertices that will need to be
common between the vertex and geometry shaders.
Geometry shaders will need to use a different message header, and a
different opcode, for their URB writes, so we introduce virtual
functions emit_urb_write_header() and emit_urb_write_opcode() to take
care of the GS-specific behaviours.
Also, since vertex emission happens at the end of the VS, but in the
middle of the GS, we need to be sure to only call
emit_shader_time_end() during VS vertex emission. We accomplish this
by moving the call to emit_shader_time_end() into the VS
implementation of emit_urb_write_opcode().
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sun, 17 Feb 2013 19:34:05 +0000 (11:34 -0800)]
i965/vs: rename vec4_generator::generate_vs_instruction.
Since this function is going to get used for geometry shaders too, it
deserves a more generic name: generate_vec4_instruction.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sun, 17 Feb 2013 19:25:37 +0000 (11:25 -0800)]
i965/vs: Generalize data structures pointed to by vec4_generator.
This patch removes the following field from vec4_generator, since it
is not used:
- struct brw_vs_compile *c
And changes the following field:
- struct gl_vertex_program *vp => struct gl_program *prog
With these changes, vec4_generator no longer refers to any VS-specific
data structures. This will pave the way for re-using it for geometry
shaders.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
v2: Use the name "prog" rather than "p".
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Tue, 9 Apr 2013 21:31:28 +0000 (14:31 -0700)]
i965/vs: Rename vec4_generator::prog to shader_prog.
The next patch is going to change the type of vec4_generator::vp from
struct gl_vertex_program * to struct gl_program *, and rename it. The
sensible name to change it to is vec4_generator::prog. However, prog
is already used. Since the existing vec4_generator::prog is of type
struct gl_shader_program, it makes sense to rename it to shader_prog.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sun, 17 Feb 2013 17:09:45 +0000 (09:09 -0800)]
i965/vs: move VS-specific data members to vs_vec4_visitor.
This patch moves the following data structures from vec4_visitor to
vec4_vs_visitor, since they contain VS-specific data:
- struct brw_vs_compile *c (renamed to vs_compile)
- struct brw_vs_prog_data *prog_data (renamed to vs_prog_data)
- src_reg *vp_temp_regs
- src_reg vp_addr_reg
Since brw_vs_compile and brw_vs_prog_data also contain vec4-generic
data, the following pointers are added to the base class, to allow it
to access the vec4-generic portions of these data structures:
- struct brw_vec4_compile *c
- struct brw_vec4_prog_key *key
- struct brw_vec4_prog_data *prog_data
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
v2: Use shorter names in the base class and longer names in the
derived class.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sat, 16 Feb 2013 04:27:03 +0000 (20:27 -0800)]
i965/vs: move ARB_vertex_program functions to vec4_vs_visitor.
This patch moves functions from vec4_visitor to vec4_vs_visitor that
deal with ARB (assembly) vertex programs. There's no point in having
these functions in the base class since we don't intend to support
assembly programs for the GS stage. The following functions are
moved:
- setup_vp_regs
- get_vp_dst_reg
- get_vp_src_reg
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sun, 17 Feb 2013 16:05:52 +0000 (08:05 -0800)]
i965/vs: Add virtual function make_reg_for_system_value().
The system values handled by vec4_visitor::visit(ir_variable *) are
VS-specific (vertex ID and instance ID). This patch moves the
handling of those values into a new virtual function,
make_reg_for_system_value(), so that this VS-specific code won't be
inherited by geomtry shaders.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sun, 17 Feb 2013 16:05:52 +0000 (08:05 -0800)]
i965/vs: Make some vec4_visitor functions virtual.
This patch makes the following vec4_visitor functions virtual, since
they will need to be implemented differently for vertex and geometry
shaders. Some of the functions are renamed to reflect their generic
purpose, rather than their VS-specific behaviour:
- setup_attributes
- emit_attribute_fixups (renamed to emit_prolog)
- emit_vertex_program_code (renamed to emit_program_code)
- emit_urb_writes (renamed to emit_thread_end)
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sat, 16 Feb 2013 04:12:13 +0000 (20:12 -0800)]
i965/vs: Make vec4_vs_visitor class derived from vec4_visitor.
This patch just creates the derived class; later patches will migrate
VS-specific functions and data structures from the base class into the
derived class.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Paul Berry [Sun, 17 Feb 2013 15:48:21 +0000 (07:48 -0800)]
i965/vs: split brw_vs_prog_data into generic and VS-specific parts.
This will allow the generic parts to be re-used for geometry shaders.
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
v2: Put urb_read_length and urb_entry_size in the generic struct.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>