mesa.git
9 years agosoftpipe: Move the faces array from view to filter_args
Krzesimir Nowak [Fri, 11 Sep 2015 18:07:36 +0000 (20:07 +0200)]
softpipe: Move the faces array from view to filter_args

With that, sp_sampler_view instances are not abused anymore as a local
storage, so we can later make them constant.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agonir/from_ssa: Use instr_rewrite_dest
Jason Ekstrand [Wed, 9 Sep 2015 23:03:10 +0000 (16:03 -0700)]
nir/from_ssa: Use instr_rewrite_dest

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
9 years agonir: Add a function for rewriting instruction destinations
Jason Ekstrand [Wed, 9 Sep 2015 22:58:25 +0000 (15:58 -0700)]
nir: Add a function for rewriting instruction destinations

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
9 years agonir: Only unlink sources that are actually valid
Jason Ekstrand [Wed, 9 Sep 2015 22:58:08 +0000 (15:58 -0700)]
nir: Only unlink sources that are actually valid

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
9 years agonir: Remove the mem_ctx parameter from ssa_def_rewrite_uses
Jason Ekstrand [Wed, 9 Sep 2015 20:24:35 +0000 (13:24 -0700)]
nir: Remove the mem_ctx parameter from ssa_def_rewrite_uses

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
9 years agonir: Fix a bunch of ralloc parenting errors
Jason Ekstrand [Wed, 9 Sep 2015 20:18:29 +0000 (13:18 -0700)]
nir: Fix a bunch of ralloc parenting errors

As of a10d4937, we would really like things associated with an instruction
to be allocated out of that instruction and not out of the shader.  In
particular, you should be passing the instruction that will ultimately be
holding the source into nir_src_copy rather than an arbitrary memory
context.

We also change the prototypes of nir_dest_copy and nir_alu_src/dest_copy to
explicitly take an instruction so we catch this earlier in the future.

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
9 years agonir/lower_outputs_to_temporaries: Reparent the output name
Jason Ekstrand [Thu, 10 Sep 2015 20:56:08 +0000 (13:56 -0700)]
nir/lower_outputs_to_temporaries: Reparent the output name

We copy the output, make the old output the temporary, and give the
temporary a new name.  The copy keeps the pointer to the old name.  This
works just fine up until the point where we lower things to SSA and delete
the old variable and, with it, the name.  Instead, we should re-parent to
the copy.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
9 years agoi965/vec4: check writemask when bailing out at register coalesce
Alejandro Piñeiro [Fri, 11 Sep 2015 10:21:13 +0000 (12:21 +0200)]
i965/vec4: check writemask when bailing out at register coalesce

opt_register_coalesce stopped to check previous instructions to
coalesce with if somebody else was writing on the same
destination. This can be optimized to check if somebody else was
writing to the same channels of the same destination using the
writemask.

Shader DB results (taking into account only vec4):

total instructions in shared programs: 1781593 -> 1734957 (-2.62%)
instructions in affected programs:     1238390 -> 1191754 (-3.77%)
helped:                                12782
HURT:                                  0
GAINED:                                0
LOST:                                  0

v2: removed some parenthesis, fixed indentation, as suggested by
    Matt Turner
v3: added brackets, for consistency, as suggested by Eduardo Lima

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agotgsi,softpipe: capitalize the tgsi_sampler_control enum values
Brian Paul [Thu, 10 Sep 2015 18:26:18 +0000 (12:26 -0600)]
tgsi,softpipe: capitalize the tgsi_sampler_control enum values

We use capitalized enum values everywhere else.
This improves understanding a bit too.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agonir: Store some geometry shader data in nir_shader.
Kenneth Graunke [Tue, 18 Aug 2015 09:07:47 +0000 (02:07 -0700)]
nir: Store some geometry shader data in nir_shader.

This makes it possible for NIR shaders to know the number of output
vertices and the number of invocations.  Drivers could also access
these directly without going through gl_program.

We should probably add InputType and OutputType here too, but currently
those are stored as GL_* enums, and I wanted to avoid using those in
NIR, as I suspect Vulkan/SPIR-V will use different enums.  (We should
probably make our own.)

We could add VerticesIn, but it's easily computable from the input
topology, so I'm not sure whether it's worth it.  It's also currently
not stored in gl_shader (only gl_shader_program), which would require
changes to the glsl_to_nir interface or require us to store it there.

This is a bit of duplication of data...ideally, we would factor these
substructs out of gl_program, gl_shader_program, and nir_shader, creating
a gl_geometry_info class...but it would need to go in a new place (in
src/glsl?) that isn't mtypes.h nor nir.h.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir/builder: Add nir_load_var() and nir_store_var() helpers.
Kenneth Graunke [Tue, 12 May 2015 08:53:24 +0000 (01:53 -0700)]
nir/builder: Add nir_load_var() and nir_store_var() helpers.

These provide a convenient way to do simple variable loads and stores.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoglsl: Use hash tables for opt_constant_propagation() kill sets.
Kenneth Graunke [Wed, 12 Nov 2014 07:16:13 +0000 (23:16 -0800)]
glsl: Use hash tables for opt_constant_propagation() kill sets.

Cuts compile/link time of the fragment shader in #91857 by 19%
(16.28 -> 13.05).

I didn't bother with the acp sets because they're smaller, but it
might be worth doing as well.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91857
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoi965: Use hash tables for brw_fs_vector_splitting().
Kenneth Graunke [Sat, 5 Sep 2015 07:51:33 +0000 (00:51 -0700)]
i965: Use hash tables for brw_fs_vector_splitting().

Cuts compile/link time of the fragment shader in #91857 by 25%
(21.64 -> 16.28).

v2: Drop unnecessary _mesa_hash_table_destroy call, and use
    refs.ht->entries == 0 rather than ad-hoc checking (suggested by
    Timothy Arceri).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91857
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoglsl: Use hash tables in opt_constant_variable().
Kenneth Graunke [Sat, 5 Sep 2015 07:22:57 +0000 (00:22 -0700)]
glsl: Use hash tables in opt_constant_variable().

Cuts compile/link time of the fragment shader in bug #91857 by 31%
(31.79 -> 21.64).  It has over 8,000 variables so linked lists are
terrible.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91857
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
9 years agometa: Use result of texture coordinate clamping operation
Ian Romanick [Wed, 9 Sep 2015 17:27:04 +0000 (10:27 -0700)]
meta: Use result of texture coordinate clamping operation

Previously the result of the complicated clamp() expression just dropped
on the floor: clamp does not modify any of its parameters.  Looking at
the surrounding code, I believe this is supposed to modify the value of
tex_coord.

This change (along with a change to avoid the use of
brw_blorp_framebuffer) does not affect any existing piglit tests.  I'm
not sure what this clamp is trying to accomplish, so I'm not sure how to
write a test to exercise this path.

I also noticed another bug in this code.  There is no way the array
texture case could possibly work.  This will generate code for the
TEXEL_FETCH macro like:

    #define TEXEL_FETCH(coord) texelFetch(texSampler, ivec3(coord), sample_map[int(2 * fract(coord.x))]);

Since the coord parameter of this macro is a vec2 at all invocations, no
expansion of this macro will even compile.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
9 years agometa: Always bind the texture
Ian Romanick [Wed, 2 Sep 2015 23:06:58 +0000 (16:06 -0700)]
meta: Always bind the texture

We may have been called from glGenerateTextureMipmap with CurrentUnit
still set to 0, so we don't know when we can skip binding the texture.
Assume that _mesa_BindTexture will be fast if we're rebinding the same
texture.

v2: Remove currentTexUnitSave because it is now unused.  Suggested by
both Neil and Anuj.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91847
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi915, i965: Silence unused parameter warnings in intel_batchbuffer_advance
Ian Romanick [Wed, 2 Sep 2015 22:44:04 +0000 (15:44 -0700)]
i915, i965: Silence unused parameter warnings in intel_batchbuffer_advance

These only occurred in release builds, but they occurred in every file
that included intel_batchbuffer.h.  Lots of spam. :(

intel_batchbuffer.h: In function 'intel_batchbuffer_advance':
intel_batchbuffer.h:153:47: warning: unused parameter 'brw' [-Wunused-parameter]
 intel_batchbuffer_advance(struct brw_context *brw)
                                               ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi915: Silence unused parameter warning in intel_miptree_create_layout
Ian Romanick [Wed, 2 Sep 2015 22:11:34 +0000 (15:11 -0700)]
i915: Silence unused parameter warning in intel_miptree_create_layout

The for_bo parameter of intel_miptree_create_layout appears to be unused
since 27eedca when Eric removed some Gen5 code (after the i915 and i965
drivers parted ways).

intel_mipmap_tree.c: In function 'old_intel_miptree_create_layout':
intel_mipmap_tree.c:77:35: warning: unused parameter 'for_bo' [-Wunused-parameter]
                             bool for_bo)
                                   ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi915, i965: Silence unused parameter warnings in intel_miptree_unmap_gtt
Ian Romanick [Wed, 2 Sep 2015 22:04:59 +0000 (15:04 -0700)]
i915, i965: Silence unused parameter warnings in intel_miptree_unmap_gtt

intel_mipmap_tree.c: In function 'intel_miptree_unmap_gtt':
intel_mipmap_tree.c:777:34: warning: unused parameter 'map' [-Wunused-parameter]
    struct intel_miptree_map *map,
                                  ^
intel_mipmap_tree.c:778:17: warning: unused parameter 'level' [-Wunused-parameter]
    unsigned int level,
                 ^
intel_mipmap_tree.c:779:17: warning: unused parameter 'slice' [-Wunused-parameter]
    unsigned int slice)
                 ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi915: Silence unused parameter warnings
Ian Romanick [Wed, 2 Sep 2015 22:01:18 +0000 (15:01 -0700)]
i915: Silence unused parameter warnings

intel_mipmap_tree.c: In function 'old_intel_miptree_unmap_raw':
intel_mipmap_tree.c:726:51: warning: unused parameter 'intel' [-Wunused-parameter]
 intel_miptree_unmap_raw(struct intel_context *intel,
                                                   ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi915: Remove prototype for nonexistent brw_miptree_layout
Ian Romanick [Wed, 2 Sep 2015 21:56:18 +0000 (14:56 -0700)]
i915: Remove prototype for nonexistent brw_miptree_layout

Hasn't existed in the i915 source since the i915 and i965 drivers parted
ways.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi965: Make intel_miptree_map_raw static
Ian Romanick [Wed, 2 Sep 2015 21:43:18 +0000 (14:43 -0700)]
i965: Make intel_miptree_map_raw static

This hasn't been used outside intel_mipmap_tree.c since d5d4ba9 started
using meta instead of the blitter for PBO TexSubImage.  While we're
here, remove the unused brw parameter from the function formerly known
as intel_miptree_unmap_raw.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi915, i965: Silence unused parameter warnings in intel_mipmap_tree.h
Ian Romanick [Wed, 2 Sep 2015 21:33:59 +0000 (14:33 -0700)]
i915, i965: Silence unused parameter warnings in intel_mipmap_tree.h

These only occurred in release builds, but they occurred in every file
that included intel_mipmap_tree.h.  Lots of spam. :(

intel_mipmap_tree.h: In function 'intel_miptree_check_level_layer':
intel_mipmap_tree.h:595:59: warning: unused parameter 'mt' [-Wunused-parameter]
 intel_miptree_check_level_layer(struct intel_mipmap_tree *mt,
                                                           ^
intel_mipmap_tree.h:596:42: warning: unused parameter 'level' [-Wunused-parameter]
                                 uint32_t level,
                                          ^
intel_mipmap_tree.h:597:42: warning: unused parameter 'layer' [-Wunused-parameter]
                                 uint32_t layer)
                                          ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi965: Silence unused parameter warnings in intel_mipmap_tree.c
Ian Romanick [Wed, 2 Sep 2015 21:02:18 +0000 (14:02 -0700)]
i965: Silence unused parameter warnings in intel_mipmap_tree.c

The target parameter of compute_msaa_layout appears to be unused since
83b83fb when support for CMS textures was added for Gen7.

The brw parameter of intel_get_non_msrt_mcs_alignment appears to be
unused since e92fbdc when the GEN check (along with the "can we fast
clear" decision) was moved to a different function.

intel_mipmap_tree.c: In function 'compute_msaa_layout':
intel_mipmap_tree.c:62:73: warning: unused parameter 'target' [-Wunused-parameter]
 compute_msaa_layout(struct brw_context *brw, mesa_format format, GLenum target,
                                                                         ^
intel_mipmap_tree.c: In function 'intel_get_non_msrt_mcs_alignment':
intel_mipmap_tree.c:143:54: warning: unused parameter 'brw' [-Wunused-parameter]
 intel_get_non_msrt_mcs_alignment(struct brw_context *brw,
                                                      ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: Ben Widawsky <benjamin.widawsky@intel.com>
9 years agoi965: Silence unused parameter warnings in intel_fbo.c
Ian Romanick [Wed, 9 Sep 2015 17:33:52 +0000 (10:33 -0700)]
i965: Silence unused parameter warnings in intel_fbo.c

intel_fbo.c: In function 'intel_alloc_window_storage':
intel_fbo.c:415:48: warning: unused parameter 'ctx' [-Wunused-parameter]
 intel_alloc_window_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
                                                ^
intel_fbo.c: In function 'intel_nop_alloc_storage':
intel_fbo.c:428:74: warning: unused parameter 'rb' [-Wunused-parameter]
 intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
                                                                          ^
intel_fbo.c:429:32: warning: unused parameter 'internalFormat' [-Wunused-parameter]
                         GLenum internalFormat, GLuint width, GLuint height)
                                ^
intel_fbo.c:429:55: warning: unused parameter 'width' [-Wunused-parameter]
                         GLenum internalFormat, GLuint width, GLuint height)
                                                       ^
intel_fbo.c:429:69: warning: unused parameter 'height' [-Wunused-parameter]
                         GLenum internalFormat, GLuint width, GLuint height)
                                                                     ^
intel_fbo.c: In function 'intel_blit_framebuffer_with_blitter':
intel_fbo.c:790:61: warning: unused parameter 'filter' [-Wunused-parameter]
                                     GLbitfield mask, GLenum filter)
                                                             ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agost/mesa: set the vbuffer to NULL if we are skipping it
Dave Airlie [Fri, 4 Sep 2015 00:24:39 +0000 (01:24 +0100)]
st/mesa: set the vbuffer to NULL if we are skipping it

If we skip a vbuffer we need to make sure we NULL out
the contents, otherwise when it gets passed to the driver
it will get confused.

This was hit by:
GL41-CTS.gpu_shader_fp64.varyings

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/cs: Enable barrier in MEDIA_INTERFACE_DESCRIPTOR
Jordan Justen [Wed, 5 Nov 2014 08:47:41 +0000 (00:47 -0800)]
i965/cs: Enable barrier in MEDIA_INTERFACE_DESCRIPTOR

Enable barrier in MEDIA_INTERFACE_DESCRIPTOR if the program uses the
barrier() GLSL function.

On Ivy Bridge and Haswell, this allows the piglit test
tests/spec/arb_compute_shader/execution/simple-barrier-atomics.shader_test
to pass. On gen8, this enables a similar test with a local group size
of 896 to pass.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/cs: Emit texture surfaces to enable CS sampling
Jordan Justen [Thu, 12 Mar 2015 05:54:20 +0000 (22:54 -0700)]
i965/cs: Emit texture surfaces to enable CS sampling

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Set up sampler state for compute shaders
Jordan Justen [Sat, 4 Oct 2014 02:07:45 +0000 (19:07 -0700)]
i965: Set up sampler state for compute shaders

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965/fs: Set first_non_payload_grf in assign_curb_setup
Jordan Justen [Sat, 4 Oct 2014 02:05:32 +0000 (19:05 -0700)]
i965/fs: Set first_non_payload_grf in assign_curb_setup

first_non_payload_grf may be updated in assign_urb_setup for FS or
assign_vs_urb_setup for VS.

We need to set this in assign_curb_setup for compute shaders since cs
does not have an assign_cs_urb_setup like assign_urb_setup (fs) or
assign_vs_urb_setup (vs).

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Support compute shaders in is_scalar_shader_stage()
Jordan Justen [Sat, 4 Oct 2014 02:01:24 +0000 (19:01 -0700)]
i965: Support compute shaders in is_scalar_shader_stage()

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: Support CS in update_stage_texture_surfaces
Jordan Justen [Sat, 4 Oct 2014 01:58:39 +0000 (18:58 -0700)]
i965: Support CS in update_stage_texture_surfaces

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoi965: enable ARB_shader_texture_image_samples
Ilia Mirkin [Wed, 12 Aug 2015 00:38:48 +0000 (20:38 -0400)]
i965: enable ARB_shader_texture_image_samples

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: add handling for imageSamples
Ilia Mirkin [Fri, 28 Aug 2015 03:34:47 +0000 (23:34 -0400)]
i965: add handling for imageSamples

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: convert glsl imageSamples into a new intrinsic
Ilia Mirkin [Fri, 28 Aug 2015 03:27:50 +0000 (23:27 -0400)]
nir: convert glsl imageSamples into a new intrinsic

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add support for the imageSamples function
Ilia Mirkin [Fri, 28 Aug 2015 03:22:18 +0000 (23:22 -0400)]
glsl: add support for the imageSamples function

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: add support for textureSamples function
Ilia Mirkin [Wed, 12 Aug 2015 00:37:32 +0000 (20:37 -0400)]
i965: add support for textureSamples function

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
[v2: kayden-supplied code in fs_nir replacing need for logical opcode]
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add support for the textureSamples function
Ilia Mirkin [Fri, 28 Aug 2015 03:06:57 +0000 (23:06 -0400)]
glsl: add support for the textureSamples function

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add ARB_shader_texture_image_samples infrastructure
Ilia Mirkin [Fri, 28 Aug 2015 03:06:29 +0000 (23:06 -0400)]
glsl: add ARB_shader_texture_image_samples infrastructure

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: add nir_texop_texture_samples and convert from glsl
Ilia Mirkin [Fri, 28 Aug 2015 03:05:03 +0000 (23:05 -0400)]
nir: add nir_texop_texture_samples and convert from glsl

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add ir_texture_samples texture opcode
Ilia Mirkin [Fri, 28 Aug 2015 03:03:46 +0000 (23:03 -0400)]
glsl: add ir_texture_samples texture opcode

Will be used for textureSamples()

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: add infra for ARB_shader_texture_image_samples
Ilia Mirkin [Fri, 28 Aug 2015 03:01:29 +0000 (23:01 -0400)]
mesa: add infra for ARB_shader_texture_image_samples

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Fix typos in license
Ian Romanick [Wed, 19 Aug 2015 23:36:35 +0000 (16:36 -0700)]
i965: Fix typos in license

grep -lr 'sub license' | while read f; do \
    sed --in-place -e 's/sub license/sublicense/' $f ;\
    done

grep -lr 'NON-INFRINGEMENT' | while read f; do \
    sed --in-place -e 's/NON-INFRINGEMENT/NONINFRINGEMENT/' $f ;\
    done

As noted by Matt, both of these changes match the MIT license text found
at http://opensource.org/licenses/MIT.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Remove horizontal bars from file header comments
Ian Romanick [Thu, 20 Aug 2015 02:24:45 +0000 (19:24 -0700)]
i965: Remove horizontal bars from file header comments

Why was that ever a thing?

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agosvga: clean up the compile_vs/gs/fs() functions
Brian Paul [Thu, 10 Sep 2015 14:55:01 +0000 (08:55 -0600)]
svga: clean up the compile_vs/gs/fs() functions

Sipmlify structure and remove gotos.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agosvga: fix shader variant memory leak
Brian Paul [Thu, 10 Sep 2015 14:47:16 +0000 (08:47 -0600)]
svga: fix shader variant memory leak

Fixes a small leak in a seldom-hit corner case for VS/FS compilation.
Found with coverity.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agosvga: remove useless MAX2() call
Brian Paul [Tue, 8 Sep 2015 15:40:29 +0000 (09:40 -0600)]
svga: remove useless MAX2() call

The sum of two unsigned ints is always >= 0.  Found with Coverity.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agowinsys/svga: remove useless assertion
Brian Paul [Tue, 8 Sep 2015 15:39:40 +0000 (09:39 -0600)]
winsys/svga: remove useless assertion

An unsigned int is always >= 0.  Found with Coverity.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agodocs: add news item and link release notes for 10.6.7
Emil Velikov [Thu, 10 Sep 2015 18:12:38 +0000 (19:12 +0100)]
docs: add news item and link release notes for 10.6.7

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: add sha256 checksums for 10.6.7
Emil Velikov [Thu, 10 Sep 2015 18:02:21 +0000 (19:02 +0100)]
docs: add sha256 checksums for 10.6.7

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 8789dd627ce3411a8d9271abead240f3265bd4d2)

9 years agodocs: add release notes for 10.6.7
Emil Velikov [Thu, 10 Sep 2015 17:45:17 +0000 (18:45 +0100)]
docs: add release notes for 10.6.7

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 32efdc87cbf89cfe08ad9571cd756e27c803caa8)

9 years agodocs: Update wrt. textureQueryLod on softpipe
Krzesimir Nowak [Thu, 10 Sep 2015 12:16:00 +0000 (14:16 +0200)]
docs: Update wrt. textureQueryLod on softpipe

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosoftpipe: Implement and enable textureQueryLod
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:59 +0000 (14:15 +0200)]
softpipe: Implement and enable textureQueryLod

Passes the shader piglit tests and introduces no regressions.

This commit finally makes use of the refactoring in previous
commits.

v2:
  - adapted the code to changes in previous commits (renames,
    need_cube_convert stuff)
  - splitted too long lines

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agotgsi: Add code for handling lodq opcode
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:58 +0000 (14:15 +0200)]
tgsi: Add code for handling lodq opcode

This introduces new vfunc in tgsi_sampler just for this opcode. I
decided against extending get_samples vfunc to return the mipmap level
and LOD - the function's prototype is already too scary and doing the
sampling for textureQueryLod would be a waste of time.

v2:
  - splitted too long lines

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosoftpipe: Add functions for computing relative mipmap level
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:57 +0000 (14:15 +0200)]
softpipe: Add functions for computing relative mipmap level

These functions will be used by textureQueryLod.

v2:

  - renamed mip_level_* funcs to mip_rel_level_* to indicate that
    these functions return mip level relative to base level and
    documented them
  - renamed a level member in sp_filter_funcs struct to relative_level
  - changed mip_rel_level_none and mip_rel_level_nearest to return mip
    level relative to base level, mip_rel_level_linear already did
    that
  - documented clamp_lod function

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosoftpipe: Split 3D to 2D coords conversion into separate function
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:56 +0000 (14:15 +0200)]
softpipe: Split 3D to 2D coords conversion into separate function

This is to avoid tying the conversion to the sampling -
textureQueryLod will need to do the conversion too, but it does not do
any sampling.

So instead of a "get_samples" vfunc, there is just a bool saying
whether the conversion is needed or not. This solution keeps a nice
property of not adding any overhead for the common case (2D textures).

v2:
  - replaced the "convert_coords" vfunc with a "need_cube_convert"
    boolean to avoid overhead of copying arrays in common case
  - removed an unused typedef
  - splitted too long lines in convert_cube
  - const fixes in convert_cube

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosoftpipe: Split code getting a filter into separate function
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:55 +0000 (14:15 +0200)]
softpipe: Split code getting a filter into separate function

This function will be later used by textureQueryLod. The
img_filter_func are optional, because textureQueryLod will not need
them.

v2:
  - adapted to changes in previous commit (renames)
  - simplified conditions a bit
  - updated docs
  - splitted too long lines

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosoftpipe: Put mip_filter_func inside a struct
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:54 +0000 (14:15 +0200)]
softpipe: Put mip_filter_func inside a struct

Putting this function pointer into a struct enables grouping of
several related functions in a single place. For now it is just a
single function, but the struct will be later extended with a
mip_level_func for returning relative mip level.

v2:
  - renamed sp_mip struct to sp_filter_funcs
  - renamed sp_filter_funcs instances from mip_foo to funcs_foo
  - splitted too long lines
  - sp_sampler now holds a pointer to sp_filter_funcs instead of an
    instance of it
  - some const fixes

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosoftpipe: Split compute_lambda_lod into two functions
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:53 +0000 (14:15 +0200)]
softpipe: Split compute_lambda_lod into two functions

textureQueryLod returns a vec2 with a mipmap information and a
LOD. The latter needs to be not clamped.

v2:
  - changed the "not_clamped" part to "unclamped"
  - corrected "clamp into" to "clamp to"
  - splitted too long lines

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosoftpipe: Fix textureLod with nonzero GL_TEXTURE_LOD_BIAS value
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:52 +0000 (14:15 +0200)]
softpipe: Fix textureLod with nonzero GL_TEXTURE_LOD_BIAS value

The level-of-detail bias wasn't simply added in the explicit LOD case.
This case seems to be tested only in piglit's
fs-texturequerylod-nearest-biased test, which is currently skipped, as
softpipe does not support textureQueryLod at the moment.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agotgsi: Remove trailing backslash in comment
Krzesimir Nowak [Thu, 10 Sep 2015 12:15:51 +0000 (14:15 +0200)]
tgsi: Remove trailing backslash in comment

It clearly is here by accident.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agogallium/radeon: handle PIPE_TRANSFER_FLUSH_EXPLICIT
Marek Olšák [Sun, 6 Sep 2015 13:41:35 +0000 (15:41 +0200)]
gallium/radeon: handle PIPE_TRANSFER_FLUSH_EXPLICIT

Basically, do the same thing as for buffer_unmap, but use the explicit range
instead. It's for apps which want to map a whole buffer and mark touched
ranges explicitly.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: don't update polygon offset state if it has no effect
Marek Olšák [Thu, 3 Sep 2015 17:34:58 +0000 (19:34 +0200)]
radeonsi: don't update polygon offset state if it has no effect

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: decrease the size of si_pm4_state
Marek Olšák [Sun, 6 Sep 2015 13:59:33 +0000 (15:59 +0200)]
radeonsi: decrease the size of si_pm4_state

Acked-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi/compute: add buffers to the CS directly
Marek Olšák [Sun, 6 Sep 2015 13:49:55 +0000 (15:49 +0200)]
radeonsi/compute: add buffers to the CS directly

Packets are emitted immediately anyway.

Acked-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: only use new versions of LLVM image and sample intrinsics
Marek Olšák [Thu, 3 Jul 2014 18:17:36 +0000 (20:17 +0200)]
radeonsi: only use new versions of LLVM image and sample intrinsics

Just a cleanup I had made a long time ago and forgot about.

v2: use tgsi_is_shadow_target

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agogallium/radeon: drop support for LLVM 3.4
Marek Olšák [Sun, 6 Sep 2015 14:26:21 +0000 (16:26 +0200)]
gallium/radeon: drop support for LLVM 3.4

This allows using the new tex instrinsics unconditionally.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agor600/llvm: remove dead code for LLVM 3.3
Marek Olšák [Sun, 6 Sep 2015 14:19:33 +0000 (16:19 +0200)]
r600/llvm: remove dead code for LLVM 3.3

LLVM 3.3 has been unsupported for quite a while.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agor600g: use pipe_resource::width0 instead pb_buffer::size
Marek Olšák [Sun, 6 Sep 2015 14:40:21 +0000 (16:40 +0200)]
r600g: use pipe_resource::width0 instead pb_buffer::size

pb_buffer::size was aligned by 29aaab2b5f55cc6d9a84f58ce2bb8607e76a9dde,
which broke the CMASK code I think.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91881

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: enable VGPR spilling on VI
Marek Olšák [Wed, 2 Sep 2015 17:05:09 +0000 (19:05 +0200)]
radeonsi: enable VGPR spilling on VI

This fixes corruption in Unigine Heaven on VI

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agowinsys/amdgpu: calculate the maximum number of compute units
Marek Olšák [Wed, 2 Sep 2015 17:04:25 +0000 (19:04 +0200)]
winsys/amdgpu: calculate the maximum number of compute units

Required for register spilling.

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoUse IMP_LIB_EXT when checking for LLVM shared libraries
Jon TURNEY [Fri, 4 Sep 2015 13:00:19 +0000 (14:00 +0100)]
Use IMP_LIB_EXT when checking for LLVM shared libraries

When checking for LLVM shared libraries, use IMP_LIB_EXT for the extension for
shared libraries appropriate to the target, rather than hardcoding '.so'

Also add some comments to explain why we have this circus of pain.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965: Resolve GCC sign-compare warning.
Rhys Kidd [Tue, 8 Sep 2015 15:52:50 +0000 (23:52 +0800)]
i965: Resolve GCC sign-compare warning.

mesa/src/mesa/drivers/dri/i965/brw_eu_compact.c: In function 'set_3src_control_index':
mesa/src/mesa/drivers/dri/i965/brw_eu_compact.c:805:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < ARRAY_SIZE(gen8_3src_control_index_table); i++) {
                      ^
mesa/src/mesa/drivers/dri/i965/brw_eu_compact.c: In function 'set_3src_source_index':
mesa/src/mesa/drivers/dri/i965/brw_eu_compact.c:839:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < ARRAY_SIZE(gen8_3src_source_index_table); i++) {
                      ^
mesa/src/mesa/drivers/dri/i965/brw_state_dump.c: In function 'dump_sampler_state':
mesa/src/mesa/drivers/dri/i965/brw_state_dump.c:382:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size / 16; i++) {
                  ^
mesa/src/mesa/drivers/dri/i965/brw_state_upload.c: In function 'brw_pipeline_state_finished':
mesa/src/mesa/drivers/dri/i965/brw_state_upload.c:801:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (i != pipeline) {
             ^
mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c: In function 'intel_gen7_hiz_buf_create':
mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1544:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int level = mt->first_level; level <= mt->last_level; ++level) {
                                               ^
mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c: In function 'intel_gen8_hiz_buf_create':
mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1638:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int level = mt->first_level; level <= mt->last_level; ++level) {
                                            ^
mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c: In function 'intel_miptree_alloc_hiz':
mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1771:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int level = mt->first_level; level <= mt->last_level; ++level) {
                                            ^
mesa/src/mesa/drivers/dri/i965/intel_mipmap_tree.c:1775:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int layer = 0; layer < mt->level[level].depth; ++layer) {
                                 ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomesa: Resolve GCC sign-compare warning.
Rhys Kidd [Tue, 8 Sep 2015 15:52:49 +0000 (23:52 +0800)]
mesa: Resolve GCC sign-compare warning.

mesa/src/mesa/program/prog_to_nir.c: In function 'setup_registers_and_variables':
/mesa/src/mesa/program/prog_to_nir.c:1059:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < c->prog->NumTemporaries; i++) {
                      ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglsl: Resolve GCC sign-compare warning.
Rhys Kidd [Tue, 8 Sep 2015 15:52:48 +0000 (23:52 +0800)]
glsl: Resolve GCC sign-compare warning.

mesa/src/glsl/nir/nir_lower_tex_projector.c: In function 'nir_lower_tex_projector_block':
mesa/src/glsl/nir/nir_lower_tex_projector.c:63:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = 0; i < tex->num_srcs; i++) {
                         ^
mesa/src/glsl/nir/nir_lower_tex_projector.c: In function 'nir_lower_tex_projector_block':
mesa/src/glsl/nir/nir_lower_tex_projector.c:114:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (int i = proj_index + 1; i < tex->num_srcs; i++) {
                                      ^
mesa/src/glsl/nir/nir_lower_tex_projector.c: In function 'nir_lower_tex_projector_block':
mesa/src/glsl/nir/nir_lower_tex_projector.c:53:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (proj_index = 0; proj_index < tex->num_srcs; proj_index++) {
                                       ^
mesa/src/glsl/nir/nir_lower_tex_projector.c:57:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (proj_index == tex->num_srcs)
                      ^
mesa/src/glsl/nir/nir_search.c: In function 'match_value':
mesa/src/glsl/nir/nir_search.c:84:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < num_components; ++i)
                      ^
mesa/src/glsl/nir/nir_search.c: In function 'match_value':
mesa/src/glsl/nir/nir_search.c:110:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          for (int i = 0; i < num_components; ++i) {
                            ^
mesa/src/glsl/nir/nir_search.c: In function 'match_value':
mesa/src/glsl/nir/nir_search.c:139:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (i < num_components)
                   ^
mesa/src/glsl/nir/nir_opt_peephole_ffma.c: In function 'get_mul_for_src':
mesa/src/glsl/nir/nir_opt_peephole_ffma.c:130:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (unsigned i = 0; i < num_components; i++)
                           ^

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomesa: Resolve GCC missing field initializer warning.
Rhys Kidd [Tue, 8 Sep 2015 15:15:27 +0000 (23:15 +0800)]
mesa: Resolve GCC missing field initializer warning.

Resolve a series of missing field initializer warnings within get_hash_params.py

Of the form:
In file included from mesa/src/mesa/main/get.c:495:0:
mesa/src/mesa/main/get_hash.h:180:5: warning: missing initializer for field
'extra' of 'const struct value_desc' [-Wmissing-field-initializers]
     { GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES, LOC_CUSTOM, TYPE_INT, 0 },
     ^
mesa/src/mesa/main/get.c:165:15: note: 'extra' declared here
    const int *extra;
               ^

This patch addresses some likely code rot around the *extra field, where the
initialization is via C code generated indirectly from a Python script.
It resolves a number of warnings reported by GCC when configured to be pedantic.

$ gcc --version
gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2

No piglit regressions on Ironlake.

v2:
- Squash series into a single patch.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoclover: Avoid using typename to allow compilation of clover by clang
Albert Freeman [Tue, 8 Sep 2015 13:06:40 +0000 (13:06 +0000)]
clover: Avoid using typename to allow compilation of clover by clang

When parsing an variable declaration qualified with the typename
keyword, clang attempted to declare a variable with the type of non
type member "enum type type" of module::argument (within the header
file clover/core/module.hpp) instead of the typed member of
module::argument "enum type".

Replaced "typename" with "enum" to force clang to declare the variable
marg_type with type "enum type" of module::argument.

CC: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Albert Freeman <albertwdfreeman@gmail.com>
9 years agoi965: Advertise 65536 for GL_MAX_UNIFORM_BLOCK_SIZE.
Kenneth Graunke [Tue, 8 Sep 2015 22:41:11 +0000 (15:41 -0700)]
i965: Advertise 65536 for GL_MAX_UNIFORM_BLOCK_SIZE.

Our old value of 16384 is the minimum value.  DirectX apparently
requires 65536 at a minimum; that's also what nVidia and the Intel
Windows driver advertise.  AMD advertises MAX_INT.

Ilia Mirkin noticed that "Shadow Warrior" uses UBOs larger than 16k
on Nouveau, which advertises 65536 bytes for this limit.  Traces
captured on Nouveau don't work on i965 because our lower limit causes
the GLSL linker to reject the captured shaders.  While this isn't
important in and of itself, it does suggest that raising the limit
would be beneficial.

We can read linear buffers up to 2^27 bytes in size, so raising this
should be safe; we could probably even go larger.  For now, matching
nVidia and Intel/Windows seems like a good plan.

We have to reinitialize MaxCombinedUniformComponents as core Mesa will
have set it based on a stale value for MaxUniformBlockSize.

According to Tapani, there's an unreleased game that asserts on this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50/ir: don't fold immediate into mad if registers are too high
Ilia Mirkin [Thu, 10 Sep 2015 09:02:26 +0000 (05:02 -0400)]
nv50/ir: don't fold immediate into mad if registers are too high

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91551
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50/ir: fix emission of 8-byte wide interp instruction
Ilia Mirkin [Thu, 10 Sep 2015 07:55:06 +0000 (03:55 -0400)]
nv50/ir: fix emission of 8-byte wide interp instruction

This can come up if the target register number is > 63, which is fairly
rare.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91551
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50/ir: r63 is only 0 if we are using less than 63 registers
Ilia Mirkin [Thu, 10 Sep 2015 07:49:36 +0000 (03:49 -0400)]
nv50/ir: r63 is only 0 if we are using less than 63 registers

It is advantageous to use r63 instead of r127 since r63 can fit into the
shorter encoding. However if we've RA'd over 63 registers, we must use
r127 as the replacement instead.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50/ir: make edge splitting fix up phi node sources
Ilia Mirkin [Thu, 10 Sep 2015 05:54:30 +0000 (01:54 -0400)]
nv50/ir: make edge splitting fix up phi node sources

Unfortunately nv50_ir phi nodes aren't directly connected to the CFG, so
the mapping between source and the actual BB is by inbound edge order.
So when manipulating edges one has to be extremely careful. We were
insufficiently careful when splitting critical edges which resulted in
the phi nodes being confused as to where their sources were coming from.

This primarily manifests itself with the TXL-lowering logic on nv50,
when it is inside of a conditional. I've been unable to trigger the
issue anywhere else so far. This resolves rendering failures
in a number of games like Two Worlds 2, Trine: Enchanted Edition, Trine 2,
XCOM:Enemy Unknown, Stacking. It also improves the situation in
Hearthstone, Sonic Generations, and The Raven: Legacy of a Master Thief.
However more work needs to be done there (splitting a lot more edges
solves it, so it's some other sort of RA-related issue).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90887
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: Remove ADD_VARYING macro
Ian Romanick [Wed, 26 Aug 2015 12:45:52 +0000 (13:45 +0100)]
glsl: Remove ADD_VARYING macro

The purpose of the macro was to create the name_as_gs_input from name.
The previous commit removed the name_as_gs_input from add_varying, so
the macro is unnecessary.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Silence unused parameter warnings
Ian Romanick [Wed, 26 Aug 2015 12:38:49 +0000 (13:38 +0100)]
glsl: Silence unused parameter warnings

builtin_variables.cpp:1062:53: warning: unused parameter 'name_as_gs_input' [-Wunused-parameter]
                                         const char *name_as_gs_input)
                                                     ^
builtin_functions.cpp:4774:47: warning: unused parameter 'intrinsic_name' [-Wunused-parameter]
                                   const char *intrinsic_name,
                                               ^
builtin_functions.cpp:4907:66: warning: unused parameter 'state' [-Wunused-parameter]
 _mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
                                                                  ^
builtin_functions.cpp:4915:49: warning: unused parameter 'num_arguments' [-Wunused-parameter]
                                        unsigned num_arguments,
                                                 ^
builtin_functions.cpp:4916:49: warning: unused parameter 'flags' [-Wunused-parameter]
                                        unsigned flags)
                                                 ^
ir_print_visitor.cpp:589:37: warning: unused parameter 'ir' [-Wunused-parameter]
 ir_print_visitor::visit(ir_barrier *ir)
                                     ^
linker.cpp:3212:48: warning: unused parameter 'ctx' [-Wunused-parameter]
 build_program_resource_list(struct gl_context *ctx,
                                                ^
standalone_scaffolding.cpp:65:57: warning: unused parameter ‘id’ [-Wunused-parameter]
 _mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
                                                         ^

v2: Rebase on top of GL_ARB_shader_image_size work (especially
58a86897).  Silence more warnings added by that work.

v3: Remove mention of the removed parameter from comments.  Suggested by
Iago.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> [v1]
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: "Martin Peres <martin.peres@linux.intel.com>"
9 years agonvc0: remove BGRA4 format support
Ilia Mirkin [Thu, 10 Sep 2015 01:50:03 +0000 (21:50 -0400)]
nvc0: remove BGRA4 format support

Something is wrong with the support somewhere. I couldn't get the blob
driver to use it either, although it happily used RGB5_A1.
teximage-colors works, but WoW seems to fail in the menus for drawing
text.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91526
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agogallium/ttn: fix cursor handling vs builder
Rob Clark [Wed, 9 Sep 2015 21:27:17 +0000 (17:27 -0400)]
gallium/ttn: fix cursor handling vs builder

After inserting instructions the cursor.option becomes _after_instr
(even if it started life as an _after_block).  So we cannot simply stash
the current cursor on the if/loop_stack.  Otherwise we end up inserting
instructions after the endif/endloop in the block preceeding the if/
loop.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonvc0: keep track of cb bindings per buffer, use for upload settings
Ilia Mirkin [Wed, 9 Sep 2015 07:17:38 +0000 (03:17 -0400)]
nvc0: keep track of cb bindings per buffer, use for upload settings

CB updates to bound buffers need to go through the CB_DATA endpoints,
otherwise the shader may not notice that the updates happened.
Furthermore, these updates have to go in to the same address as the
bound buffer, otherwise, again, the shader may not notice updates.

So we keep track of all the places where a constbuf is bound, and
iterate over all of them when updating data. If a binding is found that
encompasses the region to be updated, then we use the settings of that
binding for the upload. Otherwise we upload as a regular data update.

This fixes piglit 'arb_uniform_buffer_object-rendering offset' as well
as blurriness in Witcher2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91890
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonir/glsl: Use lower_outputs_to_temporaries instead of relying on GLSL IR
Jason Ekstrand [Tue, 8 Sep 2015 21:31:11 +0000 (14:31 -0700)]
nir/glsl: Use lower_outputs_to_temporaries instead of relying on GLSL IR

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agonir: Add a pass to lower outputs to temporary variables
Jason Ekstrand [Sat, 29 Aug 2015 00:09:02 +0000 (17:09 -0700)]
nir: Add a pass to lower outputs to temporary variables

This pass can be used as a helper for NIR producers so they don't have to
worry about creating the temporaries themselves.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agonir/cursor: Add a constructor for the end of a block but before the jump
Jason Ekstrand [Sat, 29 Aug 2015 00:17:39 +0000 (17:17 -0700)]
nir/cursor: Add a constructor for the end of a block but before the jump

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agonv30: Disable msaa unless requested from the env by NV30_MAX_MSAA
Hans de Goede [Wed, 9 Sep 2015 13:52:09 +0000 (15:52 +0200)]
nv30: Disable msaa unless requested from the env by NV30_MAX_MSAA

Some modern apps try to use msaa without keeping in mind the
restrictions on videomem of older cards. Resulting in dmesg saying:

 [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate
 [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list
 [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12

Because we are running out of video memory, after which the program
using the msaa visual freezes, and eventually the entire system freezes.

To work around this we do not allow msaa visauls by default and allow
the user to override this via NV30_MAX_MSAA.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[imirkin: move env var lookup to screen so that it's only done once]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv30: Fix color resolving for nv3x cards
Hans de Goede [Wed, 9 Sep 2015 13:52:08 +0000 (15:52 +0200)]
nv30: Fix color resolving for nv3x cards

We do not have a generic blitter on nv3x cards, so we must use the
sifm object for color resolving.

This commit divides the sources and dest surfaces in to tiles which
match the constraints of the sifm object, so that color resolving
will work properly on nv3x cards.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agogallium/docs: clairify dmabuf fd ownership
Rob Clark [Thu, 3 Sep 2015 18:53:03 +0000 (14:53 -0400)]
gallium/docs: clairify dmabuf fd ownership

Since debugging issues w/ fd's close()d at the wrong time can be quite
fun, this should probably be made more explicit in the docs.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoandroid: radeonsi: add support for sid_tables.h generated sources
Mauro Rossi [Sun, 6 Sep 2015 12:15:38 +0000 (14:15 +0200)]
android: radeonsi: add support for sid_tables.h generated sources

This patch is necessary to avoid building error on android,
due to missing sid_tables.h generated sources

v2:[Emil Velikov] Correctly split the lists.

Fixes: fbbebeae10f(radeonsi: inline si_cmd_context_control)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoandroid: Always define __STDC_LIMIT_MACROS.
Mauro Rossi [Fri, 21 Aug 2015 21:46:29 +0000 (23:46 +0200)]
android: Always define __STDC_LIMIT_MACROS.

Analogous to commit 02a4fe22b13 (configure.ac: Always define
__STDC_LIMIT_MACROS.)

v2: [Emil Velikov] keep the LLVM specific __STDC_FORMAT_MACROS

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoandroid: rename LLVM_VERSION_PATCH to MESA_LLVM_VERSION_PATCH
Mauro Rossi [Fri, 21 Aug 2015 21:46:28 +0000 (23:46 +0200)]
android: rename LLVM_VERSION_PATCH to MESA_LLVM_VERSION_PATCH

Fixes: 797f4eacea8(configure.ac: rename LLVM_VERSION_PATCH to avoid
conflict with llvm-config.h)
Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agonouveau: android: add space before PRIx64 macro
Mauro Rossi [Fri, 21 Aug 2015 21:46:27 +0000 (23:46 +0200)]
nouveau: android: add space before PRIx64 macro

Otherwise the android build fails with

   error : unable to find string literal operator ‘operator"" PRIx64’

There are several resources referring to the problem, which is related
to c++11, in our case used when building mesa for lollipop.

http://comments.gmane.org/gmane.comp.graphics.opensg.user/5883

I've not investigated all the semantics, some people even suggested a
bug in the gcc compiler,
I just saw the building error was solved with one little space for
lollipop and no side effect when c+11 not used.

v2: [Emil Velikov] add an alternative commit message from Mauro.

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agosvga: pick all the files into the tarball
Emil Velikov [Wed, 9 Sep 2015 12:22:23 +0000 (13:22 +0100)]
svga: pick all the files into the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.co.uk>
9 years agoauxiliary: rework the python generated sources rules
Emil Velikov [Fri, 17 Jul 2015 09:52:35 +0000 (10:52 +0100)]
auxiliary: rework the python generated sources rules

There are a few bits this commit aims to resolve:

One can generalise the mkdir rule to a simple MKDIR_P $(@D) which will
expand appropriately for even if we change the subdir name, and/or add
new rules. We can also drop the explicit $(srcdir) prefix for the
dependency rules, they they are not strictly required, nor used
elsewhere in mesa.

Finally replace $< with explicit filename to be consistent through the
file, and honour PYTHON_FLAGS.

v2: Add comprehensive commit summary/message (Ian, Matt)

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglsl: build: remove bogus dependency
Emil Velikov [Wed, 9 Sep 2015 11:40:03 +0000 (12:40 +0100)]
glsl: build: remove bogus dependency

v2: rebase on top of the previous commit - don't touch the LOCAL_PATH
prefix for nir_constant_expressions.h

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>