mesa.git
8 years agofreedreno/ir3: fix compiler warn
Rob Clark [Sat, 6 Feb 2016 14:09:52 +0000 (09:09 -0500)]
freedreno/ir3: fix compiler warn

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agonvc0: make sure to disable fetches from previously-set VBOs when blitting
Ilia Mirkin [Mon, 28 Mar 2016 04:52:00 +0000 (00:52 -0400)]
nvc0: make sure to disable fetches from previously-set VBOs when blitting

We disable the vertex attributes, but also disable the VBO fetch details
as well, just in case. Not known to fix anything.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: disable primitive restart and index bias during blits
Ilia Mirkin [Sun, 27 Mar 2016 02:32:43 +0000 (22:32 -0400)]
nvc0: disable primitive restart and index bias during blits

Back in the dawn of time, we used to do immediate uploads for the vertex
data, and all was well. However Maxwell dropped support for immediate
vertex data, so we started feeding in a VBO (in all cases). But we
forgot to disable some things that apply in such cases, specifically
primitive restart and index bias. The latter was causing WoW and other
Blizzard games trouble as they use a pattern where they draw with a base
vertex (aka index bias), followed by texture uploads (aka blits,
internally).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91526
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Karol Herbst <nouveau@karolherbst.de>
8 years agonvc0/ir: fix picking of coordinates from tex instruction for textureGrad
Ilia Mirkin [Sun, 20 Mar 2016 21:26:13 +0000 (17:26 -0400)]
nvc0/ir: fix picking of coordinates from tex instruction for textureGrad

On Fermi, there's an argument in front of the coords that combines array
and indirect handle, while on Kepler the array and the indirect handle
are separate (and in front of the coords). We were previously only
accounting for the array bit of it, if there were an indirect access it
wouldn't be counted in the formula.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: saturate depth writes
Ilia Mirkin [Sun, 20 Mar 2016 17:11:01 +0000 (13:11 -0400)]
nv50/ir: saturate depth writes

Apparently there's no post-FS clamping logic, so we have to do this by
hand. The depth will never be outside of the 0..1 range, even on
floating point zeta buffers, so this should be safe.

Fixes dEQP-GLES3.functional.fbo.depth.*clamp.* which tests writing
invalid values on various zeta buffer formats.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogallium/util: fix up inaccurate behavior of util_framebuffer_state_equal (v2)
Marek Olšák [Sun, 27 Mar 2016 17:11:09 +0000 (19:11 +0200)]
gallium/util: fix up inaccurate behavior of util_framebuffer_state_equal (v2)

v2: move the nr_cbufs check above the loop

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)
8 years agost/mesa: only minify height if target != 1D array in st_finalize_texture
Marek Olšák [Mon, 21 Mar 2016 11:18:40 +0000 (12:18 +0100)]
st/mesa: only minify height if target != 1D array in st_finalize_texture

The st_texture_object documentation says:
  "the number of 1D array layers will be in height0"

We can't minify that.

Spotted by luck. No app is known to hit this issue.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: optimize out the realloc from glCopyTexImagexD()
Miklós Máté [Thu, 24 Mar 2016 00:13:02 +0000 (01:13 +0100)]
mesa: optimize out the realloc from glCopyTexImagexD()

v2: comment about the purpose of the code
v3: also compare texFormat,
 add a perf debug message,
 formatting fixes

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: fix handling the fallback texture
Miklós Máté [Thu, 24 Mar 2016 00:13:00 +0000 (01:13 +0100)]
st/mesa: fix handling the fallback texture

This fixes crash when post-processing is enabled in SW:KotOR.

v2: fix const-ness
v3: move assignment into the if() block

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: enable GL_ATI_fragment_shader
Miklós Máté [Thu, 24 Mar 2016 00:12:58 +0000 (01:12 +0100)]
st/mesa: enable GL_ATI_fragment_shader

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: implement GL_ATI_fragment_shader
Miklós Máté [Thu, 24 Mar 2016 00:12:57 +0000 (01:12 +0100)]
st/mesa: implement GL_ATI_fragment_shader

v2: fix arithmetic for special opcodes,
 fix fog state, cleanup
v3: simplify handling of special opcodes,
 fix rebinding with different textargets or fog equation,
 lots of formatting fixes
v4: adapt to the compile early, fix later architecture,
 formatting fixes

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoprogram: add ATI_fragment_shader to shader stages list
Miklós Máté [Thu, 24 Mar 2016 00:12:56 +0000 (01:12 +0100)]
program: add ATI_fragment_shader to shader stages list

Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: optionally associate a gl_program to ATI_fragment_shader
Miklós Máté [Thu, 24 Mar 2016 00:12:55 +0000 (01:12 +0100)]
mesa: optionally associate a gl_program to ATI_fragment_shader

the state tracker will use it

Acked-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Miklós Máté <mtmkls@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/p_context.h: Make comment more readable
Edward O'Callaghan [Sun, 27 Mar 2016 02:05:34 +0000 (13:05 +1100)]
gallium/p_context.h: Make comment more readable

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa/st: Remove GLSLVersion clamping
Edward O'Callaghan [Sat, 26 Mar 2016 07:35:07 +0000 (18:35 +1100)]
mesa/st: Remove GLSLVersion clamping

While here, remove itermediate glsl_feature_level variable.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeon/r600: Fix return type in failure branch
Edward O'Callaghan [Sat, 26 Mar 2016 07:35:06 +0000 (18:35 +1100)]
radeon/r600: Fix return type in failure branch

Commit `d4e847ea` introduced a warning about making an
integer from a pointer without a cast, fix it here.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeon/r600_query.c: Minor style fix
Edward O'Callaghan [Sat, 26 Mar 2016 07:35:05 +0000 (18:35 +1100)]
radeon/r600_query.c: Minor style fix

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agovirgl: drop next shader property for now.
Dave Airlie [Wed, 23 Mar 2016 23:28:49 +0000 (09:28 +1000)]
virgl: drop next shader property for now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: reduce buffer block duplication
Timothy Arceri [Thu, 24 Mar 2016 01:11:01 +0000 (12:11 +1100)]
glsl: reduce buffer block duplication

This reduces some of the craziness required for handling buffer
blocks. The problem is each shader stage holds its own information
about a block in memory, we were copying that information to a
program wide list but the per stage information remained meaning
when a binding was updated we needed to update all versions of it.

This changes the per stage blocks to instead point to a single
version of the block information in the program list.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agost/xa: emit sampler view declarations in shaders
Brian Paul [Fri, 25 Mar 2016 20:06:39 +0000 (14:06 -0600)]
st/xa: emit sampler view declarations in shaders

Fixes recent regressions with the VMware gallium driver.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Tested-by: Charmaine Lee <charmainel@vmware.com>
8 years agoswr: [rasterizer jitter] Fix MASKLOADD AVX prototype (float -> i32)
Tim Rowley [Thu, 24 Mar 2016 17:52:51 +0000 (11:52 -0600)]
swr: [rasterizer jitter] Fix MASKLOADD AVX prototype (float -> i32)

8 years agoswr: [rasterizer core] NUMA optimizations...
Tim Rowley [Thu, 24 Mar 2016 06:01:23 +0000 (00:01 -0600)]
swr: [rasterizer core] NUMA optimizations...

- Affinitize hot-tile memory to specific NUMA nodes.
- Only do BE work for macrotiles assoicated with the numa node

8 years agoswr: [rasterizer jitter] Fix logic bug for alpha-to-coverage.
Tim Rowley [Thu, 24 Mar 2016 00:12:11 +0000 (18:12 -0600)]
swr: [rasterizer jitter] Fix logic bug for alpha-to-coverage.

8 years agoswr: [rasterizer core] Fix Compute workitem retirement
Tim Rowley [Tue, 22 Mar 2016 23:28:06 +0000 (17:28 -0600)]
swr: [rasterizer core] Fix Compute workitem retirement

8 years agoswr: [rasterizer core] Cleanup state ring arena after last draw that references it...
Tim Rowley [Tue, 22 Mar 2016 21:13:29 +0000 (15:13 -0600)]
swr: [rasterizer core] Cleanup state ring arena after last draw that references it completes

Rather than waiting for the API thread to re-use it.

8 years agoswr: [rasterizer jitter] add missing include for llvm jitevents
Tim Rowley [Tue, 22 Mar 2016 18:41:13 +0000 (12:41 -0600)]
swr: [rasterizer jitter] add missing include for llvm jitevents

8 years agoswr: [rasterizer core] Reduce Arena blocksize to 128KB (from 1MB).
Tim Rowley [Tue, 22 Mar 2016 15:27:18 +0000 (09:27 -0600)]
swr: [rasterizer core] Reduce Arena blocksize to 128KB (from 1MB).

With global allocator this doesn't seem to affect performance at all.
Overall memory consumption drops by up to 85%.

8 years agoswr: [rasterizer core] One last pass at Arena optimizations
Tim Rowley [Mon, 21 Mar 2016 23:55:46 +0000 (17:55 -0600)]
swr: [rasterizer core] One last pass at Arena optimizations

8 years agoswr: [rasterizer core] CachedArena optimizations
Tim Rowley [Mon, 21 Mar 2016 23:30:03 +0000 (17:30 -0600)]
swr: [rasterizer core] CachedArena optimizations

Reduce list traversal during Alloc and Free.

Add ability to have multiple lists based on alloc size (not used for now)

8 years agoswr: [rasterizer jitter] support llvm-svn
Tim Rowley [Mon, 21 Mar 2016 20:08:38 +0000 (14:08 -0600)]
swr: [rasterizer jitter] support llvm-svn

8 years agoswr: [rasterizer core] Globally cache allocated arena blocks for fast re-allocation.
Tim Rowley [Mon, 21 Mar 2016 17:15:32 +0000 (11:15 -0600)]
swr: [rasterizer core] Globally cache allocated arena blocks for fast re-allocation.

8 years agoswr: [rasterizer] more arena work
Tim Rowley [Fri, 18 Mar 2016 18:11:20 +0000 (12:11 -0600)]
swr: [rasterizer] more arena work

8 years agoswr: [rasterizer core] Add clipping against user clip distances in the NullPS backend.
Tim Rowley [Fri, 18 Mar 2016 17:48:47 +0000 (11:48 -0600)]
swr: [rasterizer core] Add clipping against user clip distances in the NullPS backend.

8 years agoswr: [rasterizer core] Arena optimizations - preparing for global allocator.
Tim Rowley [Fri, 18 Mar 2016 00:10:25 +0000 (18:10 -0600)]
swr: [rasterizer core] Arena optimizations - preparing for global allocator.

8 years agoswr: [rasterizer core] Reset DrawContext arena at end of draw rather than upon reclai...
Tim Rowley [Thu, 17 Mar 2016 22:50:46 +0000 (16:50 -0600)]
swr: [rasterizer core] Reset DrawContext arena at end of draw rather than upon reclaim of DC

Keeps overall memory consumption lower.
Also, remove unused knobs.

8 years agoswr: [rasterizer core] Add clipping of user clip planes in clipper.
Tim Rowley [Thu, 17 Mar 2016 22:12:17 +0000 (16:12 -0600)]
swr: [rasterizer core] Add clipping of user clip planes in clipper.

8 years agoswr: [rasterizer] Reduce max in-flight draws to 96 (by default)
Tim Rowley [Thu, 17 Mar 2016 21:39:13 +0000 (15:39 -0600)]
swr: [rasterizer] Reduce max in-flight draws to 96 (by default)

8 years agoswr: [rasterizer] Fix run-time check asserts
Tim Rowley [Thu, 17 Mar 2016 18:22:43 +0000 (12:22 -0600)]
swr: [rasterizer] Fix run-time check asserts

One innocuous (uninitialized variable), and one not so innocuous
(stack corruption).

8 years agoswr: [rasterizer jitter] signed immediate builder
Tim Rowley [Wed, 16 Mar 2016 23:54:04 +0000 (17:54 -0600)]
swr: [rasterizer jitter] signed immediate builder

8 years agoswr: [rasterizer common] changes for cygwin
Tim Rowley [Wed, 16 Mar 2016 17:56:50 +0000 (11:56 -0600)]
swr: [rasterizer common] changes for cygwin

8 years agoswr: [rasterizer] code styling and update copyrights
Tim Rowley [Mon, 14 Mar 2016 21:54:29 +0000 (15:54 -0600)]
swr: [rasterizer] code styling and update copyrights

8 years agoswr: [rasterizer core] Guard against enquing work to invalid hot tiles
Tim Rowley [Fri, 11 Mar 2016 01:20:07 +0000 (19:20 -0600)]
swr: [rasterizer core] Guard against enquing work to invalid hot tiles

8 years agoswr: [rasterizer] Stop setting viewport size to larger than hottile array
Tim Rowley [Fri, 11 Mar 2016 01:19:30 +0000 (19:19 -0600)]
swr: [rasterizer] Stop setting viewport size to larger than hottile array

Guard against enquing work to invalid tiles

8 years agoswr: [rasterizer] Discard work + misc fixes
Tim Rowley [Fri, 11 Mar 2016 00:30:40 +0000 (18:30 -0600)]
swr: [rasterizer] Discard work + misc fixes

8 years agoswr: [rasterizer] remove use of BYTE type
Tim Rowley [Thu, 10 Mar 2016 21:15:40 +0000 (15:15 -0600)]
swr: [rasterizer] remove use of BYTE type

8 years agoswr: [rasterizer core] Fix crash that can occur when switching contexts
Tim Rowley [Wed, 9 Mar 2016 23:18:55 +0000 (17:18 -0600)]
swr: [rasterizer core] Fix crash that can occur when switching contexts

8 years agoswr: [rasterizer] remove unused knob
Tim Rowley [Wed, 9 Mar 2016 22:33:33 +0000 (16:33 -0600)]
swr: [rasterizer] remove unused knob

8 years agoswr: [rasterizer core] subcontext rework
Tim Rowley [Wed, 9 Mar 2016 22:15:37 +0000 (16:15 -0600)]
swr: [rasterizer core] subcontext rework

8 years agoswr: [rasterizer common] add _simd_s[rl]lv_epi32
Tim Rowley [Wed, 9 Mar 2016 00:58:54 +0000 (18:58 -0600)]
swr: [rasterizer common] add _simd_s[rl]lv_epi32

8 years agoswr: [rasterizer core] Alleviate potential stack overflow for 32bit builds
Tim Rowley [Tue, 8 Mar 2016 17:56:06 +0000 (11:56 -0600)]
swr: [rasterizer core] Alleviate potential stack overflow for 32bit builds

Move large stack allocations in the GS and clipper into thread local storage.

8 years agoswr: [rasterizer] remove use of UCHAR and UINT64 types
Tim Rowley [Mon, 7 Mar 2016 20:45:17 +0000 (14:45 -0600)]
swr: [rasterizer] remove use of UCHAR and UINT64 types

8 years agoswr: [rasterizer] remove use of FLOAT type
Tim Rowley [Mon, 7 Mar 2016 16:51:56 +0000 (10:51 -0600)]
swr: [rasterizer] remove use of FLOAT type

8 years agoswr: [rasterizer] Fix Coverity issues reported by Mesa developers.
Tim Rowley [Mon, 7 Mar 2016 07:14:13 +0000 (01:14 -0600)]
swr: [rasterizer] Fix Coverity issues reported by Mesa developers.

8 years agoswr: [rasterizer] add debug/perf category to knobs
Tim Rowley [Sat, 5 Mar 2016 06:53:04 +0000 (00:53 -0600)]
swr: [rasterizer] add debug/perf category to knobs

8 years agoswr: [rasterizer core] don't assume linux is 64-bit
Tim Rowley [Thu, 24 Mar 2016 16:07:32 +0000 (11:07 -0500)]
swr: [rasterizer core] don't assume linux is 64-bit

8 years agoswr: [rasterizer common] remove old unused win32 types
Tim Rowley [Thu, 24 Mar 2016 16:07:15 +0000 (11:07 -0500)]
swr: [rasterizer common] remove old unused win32 types

8 years agoswr: [rasterizer jitter] vpermps support
Tim Rowley [Fri, 4 Mar 2016 00:19:45 +0000 (18:19 -0600)]
swr: [rasterizer jitter] vpermps support

8 years agoswr: [rasterizer] Add rdtsc buckets support for shaders
Tim Rowley [Mon, 29 Feb 2016 18:01:48 +0000 (12:01 -0600)]
swr: [rasterizer] Add rdtsc buckets support for shaders

Pass pointer to core buckets mgr back to sim layer.

Add support for RDTSC_START/RDTSC_STOP macros in the builder.

Each unique shader now has a unique bucket associated with it,
enabling more detailed reporting at the shader level. Currently
due to some llvm issue with thread local storage, 64bit runs require
single threaded mode.

8 years agoswr: [rasterizer core] backend reorganization
Tim Rowley [Wed, 24 Feb 2016 19:34:50 +0000 (13:34 -0600)]
swr: [rasterizer core] backend reorganization

8 years agoswr: [rasterizer core] store blend output in temporary instead of PS output.
Tim Rowley [Thu, 25 Feb 2016 01:03:33 +0000 (19:03 -0600)]
swr: [rasterizer core] store blend output in temporary instead of PS output.

Fixes additive blend problem with MSAA

8 years agoswr: [rasterizer core] Move InitializeHotTiles and corresponding clear code out of...
Tim Rowley [Tue, 23 Feb 2016 23:29:59 +0000 (17:29 -0600)]
swr: [rasterizer core] Move InitializeHotTiles and corresponding clear code out of threads.cpp.

8 years agoswr: [rasterizer jitter] Cleanup use of types inside of Builder.
Tim Rowley [Tue, 23 Feb 2016 19:47:24 +0000 (13:47 -0600)]
swr: [rasterizer jitter] Cleanup use of types inside of Builder.

Also, cached the simd width since we don't have to keep querying
the JitManager for it.

8 years agoswr: [rasterizer jitter] Fix type mismatch on select args for SCATTERPS
Tim Rowley [Mon, 22 Feb 2016 17:00:07 +0000 (11:00 -0600)]
swr: [rasterizer jitter] Fix type mismatch on select args for SCATTERPS

8 years agoswr: [rasterizer core] fix rasterizing multisampling with scissor enabled
Tim Rowley [Sat, 20 Feb 2016 01:05:14 +0000 (19:05 -0600)]
swr: [rasterizer core] fix rasterizing multisampling with scissor enabled

We were not evaluating the scissor edge equations at sample positions.

8 years agoswr: [rasterizer core] RingBuffer class for DC/DS
Tim Rowley [Fri, 19 Feb 2016 23:55:23 +0000 (17:55 -0600)]
swr: [rasterizer core] RingBuffer class for DC/DS

Use head/tail ring buffer indices for thread synchronization.

1. SwrWaitForIdle loops until ring is empty. (head == tail)
2. GetDrawContext waits until ring is not full. (head - tail) == Ring Size
3. Draw enqueues by incrementing head.
4. Last worker thread to move past a DC dequeues by incrementing tail.

Todo: To reduce contention we can cache the tail in the API thread. For
example, if you know you have 64 free entries in the ring then you don't
need to keep checking the tail until you used those 64 entries.

8 years agoswr: [rasterizer] switch assert uses to SWR_ASSERT
Tim Rowley [Fri, 19 Feb 2016 01:00:30 +0000 (19:00 -0600)]
swr: [rasterizer] switch assert uses to SWR_ASSERT

8 years agoswr: [rasterizer core] Split all RECT_LIST draws into 1 RECT per draw
Tim Rowley [Wed, 17 Feb 2016 23:55:59 +0000 (17:55 -0600)]
swr: [rasterizer core] Split all RECT_LIST draws into 1 RECT per draw

Needed until proper RECT_LIST PrimAssembly code is written.

8 years agoswr: [rasterizer] Add string knob type
Tim Rowley [Tue, 16 Feb 2016 23:32:34 +0000 (17:32 -0600)]
swr: [rasterizer] Add string knob type

8 years agoradeonsi: add Polaris PCI IDs
Sonny Jiang [Wed, 4 Nov 2015 16:01:33 +0000 (11:01 -0500)]
radeonsi: add Polaris PCI IDs

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (Polaris10)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (Polaris11)
8 years agoradeon/vce: disable two pipe mode for Polaris11
Sonny Jiang [Tue, 15 Dec 2015 20:33:40 +0000 (15:33 -0500)]
radeon/vce: disable two pipe mode for Polaris11

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agoradeon/vce: add Polaris11 VCE firmware support
Sonny Jiang [Tue, 15 Dec 2015 20:16:29 +0000 (15:16 -0500)]
radeon/vce: add Polaris11 VCE firmware support

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
8 years agoradeonsi: add support for Polaris (v2)
Sonny Jiang [Wed, 4 Nov 2015 21:13:07 +0000 (16:13 -0500)]
radeonsi: add support for Polaris (v2)

v2: Polaris chips should be defined after Stoney

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com> (v1)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1)
Signed-off-by: Leo Liu <leo.liu@amd.com> (v2 diff)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v2 diff)
8 years agowinsys/amdgpu: addrlib - add Polaris support (v2)
Sonny Jiang [Tue, 3 Nov 2015 16:46:38 +0000 (11:46 -0500)]
winsys/amdgpu: addrlib - add Polaris support (v2)

v2: fix indentation as noted by Michel

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
8 years agomesa: Check glReadBuffer enums against the ES3 table.
Kenneth Graunke [Thu, 24 Mar 2016 05:35:41 +0000 (22:35 -0700)]
mesa: Check glReadBuffer enums against the ES3 table.

From the ES 3.2 spec, section 16.1.1 (Selecting Buffers for Reading):

   "An INVALID_ENUM error is generated if src is not BACK or one of
    the values from table 15.5."

Table 15.5 contains NONE and COLOR_ATTACHMENTi.

Mesa properly returned INVALID_ENUM for unknown enums, but it decided
what was known by using read_buffer_enum_to_index, which handles all
enums in every API.  So enums that were valid in GL were making it
past the "valid enum" check.  Such targets would then be classified
as unsupported, and we'd raise INVALID_OPERATION, but that's technically
the wrong error code.

Fixes dEQP-GLES31's
functional.debug.negative_coverage.get_error.buffer.read_buffer

v2: Only call read_buffer_enuM_to_index when required (Eduardo).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agonir: Add a pass to inline functions
Jason Ekstrand [Sun, 14 Feb 2016 01:31:05 +0000 (17:31 -0800)]
nir: Add a pass to inline functions

This commit adds a new NIR pass that lowers all function calls away by
inlining the functions.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/builder: Add helpers for easily inserting copy_var intrinsics
Jason Ekstrand [Sat, 26 Dec 2015 18:48:14 +0000 (10:48 -0800)]
nir/builder: Add helpers for easily inserting copy_var intrinsics

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add return lowering pass
Jason Ekstrand [Sun, 14 Feb 2016 01:08:57 +0000 (17:08 -0800)]
nir: Add return lowering pass

This commit adds a NIR pass for lowering away returns in functions.  If the
return is in a loop, it is lowered to a break.  If it is not in a loop,
it's lowered away by moving/deleting code as needed.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir: Add a cursor helper for getting a cursor after any phi nodes
Jason Ekstrand [Mon, 28 Dec 2015 06:50:14 +0000 (22:50 -0800)]
nir: Add a cursor helper for getting a cursor after any phi nodes

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/builder: Add a helper for inserting jump instructions
Jason Ekstrand [Sun, 14 Feb 2016 01:14:27 +0000 (17:14 -0800)]
nir/builder: Add a helper for inserting jump instructions

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/cf: Make extracting or re-inserting nothing a no-op
Jason Ekstrand [Thu, 24 Dec 2015 02:10:08 +0000 (18:10 -0800)]
nir/cf: Make extracting or re-inserting nothing a no-op

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Add a function for comparing cursors
Jason Ekstrand [Sat, 26 Dec 2015 18:32:10 +0000 (10:32 -0800)]
nir: Add a function for comparing cursors

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/cf: Handle relinking top-level blocks
Jason Ekstrand [Fri, 18 Dec 2015 19:27:00 +0000 (11:27 -0800)]
nir/cf: Handle relinking top-level blocks

This can happen if a function ends in a return instruction and you remove
the return.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Add a pass to repair SSA form
Jason Ekstrand [Sat, 13 Feb 2016 05:52:46 +0000 (21:52 -0800)]
nir: Add a pass to repair SSA form

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/vars_to_ssa: Use the new nir_phi_builder helper
Jason Ekstrand [Sat, 13 Feb 2016 05:48:26 +0000 (21:48 -0800)]
nir/vars_to_ssa: Use the new nir_phi_builder helper

The efficiency should be approximately the same.  We do a little more work
per phi node because we have to sort the predecessors.  However, we no
longer have to walk the blocks a second time to pop things off the stack.
The bigger advantage, however, is that we can now re-use the phi placement
and per-block SSA value tracking in other passes.

As a side-benifit, the phi builder actually handles unreachable blocks
correctly.  The original vars_to_ssa code, because of the way it iterated
the blocks and added phi sources, didn't add sources corresponding to
predecessors of unreachable blocks.  The new strategy employed by the phi
builder creates a phi source for each predecessor and should correctly
handle unreachable blocks by setting those sources to SSA undefs.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonir/dominance: Handle unreachable blocks
Jason Ekstrand [Tue, 29 Dec 2015 23:25:43 +0000 (15:25 -0800)]
nir/dominance: Handle unreachable blocks

Previously, nir_dominance.c didn't properly handle unreachable blocks.
This can happen if, for instance, you have something like this:

loop {
   if (...) {
      break;
   } else {
      break;
   }
}

In this case, the block right after the if statement will be unreachable.
This commit makes two changes to handle this.  First, it removes an assert
and allows block->imm_dom to be null if the block is unreachable.  Second,
it properly skips unreachable blocks in calc_dom_frontier_cb.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Add a phi node placement helper
Jason Ekstrand [Sat, 13 Feb 2016 05:41:42 +0000 (21:41 -0800)]
nir: Add a phi node placement helper

Right now, we have phi placement code in two places and there are other
places where it would be nice to be able to do this analysis.  Instead of
repeating it all over the place, this commit adds a helper for placing all
of the needed phi nodes for a value.

v2: Add better documentation

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoutil/bitset: Allow iterating over const bitsets
Jason Ekstrand [Sun, 17 Jan 2016 00:42:06 +0000 (16:42 -0800)]
util/bitset: Allow iterating over const bitsets

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agottn: remove stray global from header
Rob Clark [Thu, 24 Mar 2016 19:44:35 +0000 (15:44 -0400)]
ttn: remove stray global from header

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agonv50/ir: silence unhandled TGSI_PROPERTY_NEXT_SHADER info
Samuel Pitoiset [Wed, 23 Mar 2016 22:29:20 +0000 (23:29 +0100)]
nv50/ir: silence unhandled TGSI_PROPERTY_NEXT_SHADER info

radeonsi uses this property to make the best decision about which
shader to compile, but this is not currently used by our codegen.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: Handle negative length in glPushDebugGroup().
Kenneth Graunke [Thu, 24 Mar 2016 06:46:12 +0000 (23:46 -0700)]
mesa: Handle negative length in glPushDebugGroup().

The KHR_debug spec doesn't actually say we should handle this, but that
is most likely an oversight - it says to check against strlen and
generate errors if length is negative.  It appears they just forgot to
explicitly spell out that we should then proceed to actually handle it.

Fixes crashes from uncaught std::string exceptions in many
dEQP-GLES31.functional.debug.error_filters.* tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agomesa: Make glDebugMessageInsert deal with negative length for all types.
Kenneth Graunke [Thu, 24 Mar 2016 06:35:40 +0000 (23:35 -0700)]
mesa: Make glDebugMessageInsert deal with negative length for all types.

From the KHR_debug spec, section 5.5.5 (Externally Generated Messages):

   "If <length> is negative, it is implied that <buf> contains a null
    terminated string. The error INVALID_VALUE will be generated if the
    number of characters in <buf>, excluding the null terminator when
    <length> is negative, is not less than the value of
    MAX_DEBUG_MESSAGE_LENGTH."

This indicates that length should be set to strlen for all types, not
just GL_DEBUG_TYPE_MARKER.  We want it to be after validate_length()
so we still generate appropriate errors.

Fixes crashes from uncaught std::string exceptions in many
dEQP-GLES31.functional.debug.error_filters.* tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agomesa: Include null terminator in GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH.
Kenneth Graunke [Thu, 24 Mar 2016 04:38:42 +0000 (21:38 -0700)]
mesa: Include null terminator in GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH.

From the KHR_debug spec:
"Applications can query the number of messages currently in the log by
 obtaining the value of DEBUG_LOGGED_MESSAGES, and the string length
 (including its null terminator) of the oldest message in the log
 through the value of DEBUG_NEXT_LOGGED_MESSAGE_LENGTH."

Because we weren't including the null terminator, many dEQP tests
called glGetDebugMessageLog with a bufSize parameter that was 1 too
small, and unable to contain the message, so we skipped returning it,
failing many cases.

Fixes 298 dEQP-GLES31.functional.debug.* tests.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Stephane Marchesin <stephane.marchesin@gmail.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agost/mesa: use RGBA instead of BGRA for SRGB_ALPHA
Nicolai Hähnle [Wed, 23 Mar 2016 20:22:16 +0000 (15:22 -0500)]
st/mesa: use RGBA instead of BGRA for SRGB_ALPHA

This fixes a regression introduced by commit a8eea696 "st/mesa: honour sized
internal formats in st_choose_format (v2)".

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94657
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94671
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: silence a coverity warning
Nicolai Hähnle [Wed, 23 Mar 2016 16:58:28 +0000 (11:58 -0500)]
radeonsi: silence a coverity warning

The following Coverity warning

5378      tmpl.fetch_args = atomic_fetch_args;
5379      tmpl.emit = atomic_emit;
>>>     CID 1357115:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value "tmpl". Field "tmpl.intr_name" is uninitialized.
5380      bld_base->op_actions[TGSI_OPCODE_ATOMUADD] = tmpl;
5381      bld_base->op_actions[TGSI_OPCODE_ATOMUADD].intr_name = "add";

... is a false positive, but what the hell. This change should "fix" it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: replace gl_context->Multisample._Enabled with _mesa_is_multisample_enabled.
Bas Nieuwenhuizen [Thu, 24 Mar 2016 14:30:09 +0000 (08:30 -0600)]
mesa: replace gl_context->Multisample._Enabled with _mesa_is_multisample_enabled.

This removes any dependency on driver validation of the number of
framebuffer samples.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Brian Paul <brianp@vmware.com>
8 years agonir: fix dangling ssadef->name ptrs
Rob Clark [Tue, 22 Mar 2016 19:02:42 +0000 (15:02 -0400)]
nir: fix dangling ssadef->name ptrs

In many places, the convention is to pass an existing ssadef name ptr
when construction/initializing a new nir_ssa_def.  But that goes badly
(as noticed by garbage in nir_print output) when the original string
gets freed.

Just use ralloc_strdup() instead, and add ralloc_free() in the two
places that would care (not that the strings wouldn't eventually get
freed anyways).

Also fixup the nir_search code which was directly setting ssadef->name
to use the parent instruction as memctx.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoglsl: Add propagate_invariance to the other makefile
Jason Ekstrand [Thu, 24 Mar 2016 04:04:18 +0000 (21:04 -0700)]
glsl: Add propagate_invariance to the other makefile

This fixes the scons build

8 years agonir/glsl: Propagate invariant into NIR alu ops
Jason Ekstrand [Thu, 17 Mar 2016 22:20:20 +0000 (15:20 -0700)]
nir/glsl: Propagate invariant into NIR alu ops

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoglsl/rebalance_tree: Don't handle invariant or precise trees
Jason Ekstrand [Thu, 17 Mar 2016 21:44:57 +0000 (14:44 -0700)]
glsl/rebalance_tree: Don't handle invariant or precise trees

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoglsl/opt_algebraic: Don't handle invariant or precise trees
Jason Ekstrand [Thu, 17 Mar 2016 21:41:14 +0000 (14:41 -0700)]
glsl/opt_algebraic: Don't handle invariant or precise trees

Reviewed-by: Francisco Jerez <currojerez@riseup.net>