mesa.git
8 years agost/omx/dec: Correct the timestamping
Nishanth Peethambaran [Fri, 11 Mar 2016 06:23:00 +0000 (01:23 -0500)]
st/omx/dec: Correct the timestamping

Attach the timestamp to the dpb buffer and use that timestamp
while pushing buffer from dpb list to the omx client.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Nishanth Peethambaran <nishanth.peethambaran@amd.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agost/omx: Remove trailing spaces
Nishanth Peethambaran [Tue, 15 Mar 2016 05:56:18 +0000 (01:56 -0400)]
st/omx: Remove trailing spaces

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Nishanth Peethambaran <nishanth.peethambaran@amd.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: fix indirect texturing for non-array textures on nvc0
Ilia Mirkin [Sun, 20 Mar 2016 17:43:43 +0000 (13:43 -0400)]
nv50/ir: fix indirect texturing for non-array textures on nvc0

If a layer parameter is provided, we want to flip it to position 0 (and
combine it with any indirect params). However if the target is not an
array, there is no layer, so we have to shift all of the arguments down
by one to make room for it.

This fixes situations where there were non-coordinate parameters, such
as bias, lod, depth compare, explicit derivatives. Instead of adding a
new parameter at the front for the indirect reference, we would swap one
of those in its place.

Fixes dEQP-GLES31.functional.shaders.opaque_type_indexing.sampler.uniform.compute.*shadow

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reported-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agost/mesa: only minify depth for 3d targets
Ilia Mirkin [Sun, 20 Mar 2016 01:25:36 +0000 (21:25 -0400)]
st/mesa: only minify depth for 3d targets

We make sure that that image depth matches the level's depth before
copying it into place. However we should only be minifying the first
level's depth for 3d textures - array textures have the same depth for
all levels.

This fixes tests such as
dEQP-GLES3.functional.texture.specification.texsubimage3d_depth.* and I
suspect account for a number of other odd situations I've run into where
level > 0 of array textures was messed up.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: normalize cube coordinates after derivatives have been computed
Ilia Mirkin [Sat, 19 Mar 2016 15:58:25 +0000 (11:58 -0400)]
nv50/ir: normalize cube coordinates after derivatives have been computed

In "manual" derivative mode (always used on nv50 and sometimes on nvc0
but always for cube), the idea is that using the quadop instruction, we
set up the "other" quads to have values such that the derivatives work
out, and then run the texture instruction as if nothing were strange. It
pulls values from the other lanes, and does its magic.

However cube coordinates have to be normalized - one of the 3 coords has
to be 1, to determine which is the major axis, to say which face is
being sampled. We were normalizing the coordinates first, and then
adding the derivatives. This is wrong for two reasons:

- the coordinates got normalized by a scaling factor but the
  derivatives didn't
- the result of the addition didn't end up normalized

To resolve this, we flip the logic around to normalize *after* the
per-lane coordinates are set up.

This fixes a bunch of textureGrad cube dEQP tests.

NOTE: nv50 cube arrays with explicit derivatives are still broken, to be
resolved at a later date.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agogallium/radeon: remove remnants of R600 TGSI->LLVM
Marek Olšák [Fri, 11 Mar 2016 14:59:28 +0000 (15:59 +0100)]
gallium/radeon: remove remnants of R600 TGSI->LLVM

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: flatten if (1) statement after removal of TGSI->LLVM
Marek Olšák [Fri, 11 Mar 2016 14:53:55 +0000 (15:53 +0100)]
r600g: flatten if (1) statement after removal of TGSI->LLVM

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor600g: remove TGSI->LLVM translation
Marek Olšák [Fri, 11 Mar 2016 14:49:21 +0000 (15:49 +0100)]
r600g: remove TGSI->LLVM translation

It was useful for testing and as a prototype for radeonsi bringup,
but it's not used anymore and doesn't support OpenGL 3.3 even.

v2: try to fix OpenCL build

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Jan Vesely <jan.vesely@rutgers.edu>
8 years agogallium/radeon: remove old CS tracing
Marek Olšák [Fri, 11 Mar 2016 14:24:05 +0000 (15:24 +0100)]
gallium/radeon: remove old CS tracing

Cons:
- it was only integrated in r600g
- it doesn't work with GPUVM
- it records buffer contents at the end of IBs instead of at the beginning,
  so the replay isn't exact
- it lacks an IB parser and user-friendliness

A better solution is apitrace in combination with gallium/ddebug, which
has a complete IB parser and can pinpoint hanging CP packets.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: process TGSI property NEXT_SHADER
Marek Olšák [Thu, 10 Mar 2016 12:29:12 +0000 (13:29 +0100)]
radeonsi: process TGSI property NEXT_SHADER

This allows compiling the main shader part as ES or LS.

If we get the correct hint, non-separable GLSL shaders no longer have to be
compiled as VS first, followed by LS or ES compiled on demand.

The result is that fewer shaders are compiled by piglit, but it doesn't
improve piglit running time.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: set TGSI property NEXT_SHADER
Marek Olšák [Thu, 10 Mar 2016 12:28:08 +0000 (13:28 +0100)]
st/mesa: set TGSI property NEXT_SHADER

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium: add TGSI property NEXT_SHADER
Marek Olšák [Thu, 10 Mar 2016 12:20:36 +0000 (13:20 +0100)]
gallium: add TGSI property NEXT_SHADER

Radeonsi needs to know which shader stage will execute after a shader
in order to make the best decision about which shader variant to compile
first.

This is only set for VS and TES, because we don't need it elsewhere.

VS has 3 variants:
- next shader is FS
- next shader is GS
- next shader is TCS

TES has 2 variants:
- next shader is FS
- next shader is GS

Currently, radeonsi always assumes the next shader is FS, which is suboptimal,
since st/mesa always knows which shader is next if the GLSL program is not
a "separate shader".

By default, ureg always sets "next shader is FS".

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agonvc0/ir: Use double constant in handleSQRT
Pierre Moreau [Sat, 19 Mar 2016 16:56:03 +0000 (17:56 +0100)]
nvc0/ir: Use double constant in handleSQRT

Fixes: a100d89d0998 (nv50,nvc0: Fix invalid constant.)
Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: Disallow GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME on winsys FBO.
Kenneth Graunke [Wed, 9 Mar 2016 07:59:37 +0000 (23:59 -0800)]
mesa: Disallow GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME on winsys FBO.

Fixes:
dEQP-GLES3.functional.negative_api.state.get_framebuffer_attachment_parameteriv

Apparently, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME is not allowed when
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is GL_FRAMEBUFFER_DEFAULT, and
is expected to result in a GL_INVALID_ENUM error.

No GL specification actually defines what GL_FRAMEBUFFER_DEFAULT means.
It probably means the window system FBO.  It also doesn't mention the
behavior of any queries for that type.  Various ARB folks seem fairly
confused about it too.  For now, just do something vaguely like what
dEQP expects.

I think we probably need to check the visual bits against 0 for the
attachment, but we haven't been doing that thusfar, and given how
confusingly this is specified, I can't imagine anyone relying on it.

v2: Improve comments, move error condition above the
    _mesa_get_fb0_attachment call, add forgotten "return"
    (all suggested/caught by Jordan Justen).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonv50/ir: force-enable derivatives on TXD ops
Ilia Mirkin [Sat, 19 Mar 2016 15:46:11 +0000 (11:46 -0400)]
nv50/ir: force-enable derivatives on TXD ops

This matters especially in vertex shaders, where derivatives are
disabled by default. This fixes textureGrad in vertex shaders on nv50.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agonv50: reset TFB bufctx when we no longer hold a reference to the buffers
Ilia Mirkin [Sat, 19 Mar 2016 15:43:37 +0000 (11:43 -0400)]
nv50: reset TFB bufctx when we no longer hold a reference to the buffers

This fix is analogous to commit ff085d014.

This fixes some use-after-free situations in dEQP when an xfb state is
removed, and then a clear is triggered, which only does a partial
validation. It would attempt to read the no-longer-valid buffers,
resulting in crashes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
8 years agonvc0: avoid using magic numbers for the uniform_bo offsets
Samuel Pitoiset [Wed, 24 Feb 2016 20:35:25 +0000 (21:35 +0100)]
nvc0: avoid using magic numbers for the uniform_bo offsets

Instead make use of constants to improve readability.

The first 32 bytes of the driver constant buffer are unknown... This
doesn't seem to be used in the codegen part, but if the texBindBase
offset is shifted from 0x20 to 0x00, this breaks the universe for
really weird reasons. This sounds like to be related to textures.

Anyway, name this NVC0_CB_AUX_UNK_INFO and add a todo should be
enough for now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50/ir: make use of auxCBSlot instead of magic numbers
Samuel Pitoiset [Tue, 15 Mar 2016 12:06:44 +0000 (13:06 +0100)]
nv50/ir: make use of auxCBSlot instead of magic numbers

This avoids using magic numbers for the driver constbuf slot which
is always 15 except for compute shaders on gk104+ where the slot 0
is used.

For gk104+, some special compute-related values like the thread
index are uploaded to screen->parm which is currently bound on c0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agonv50,nvc0: replace resInfoCBSlot by auxCBSlot
Samuel Pitoiset [Tue, 15 Mar 2016 12:16:44 +0000 (13:16 +0100)]
nv50,nvc0: replace resInfoCBSlot by auxCBSlot

Having two different variables for the driver constant buffer slot
is confusing and really useless.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agonv50/ir: fix compilation warning in handleSharedATOM()
Samuel Pitoiset [Sat, 19 Mar 2016 15:52:45 +0000 (16:52 +0100)]
nv50/ir: fix compilation warning in handleSharedATOM()

In release build mode only, op may be used uninitialized because
the assertion has been removed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50,nvc0: Fix invalid constant.
Vinson Lee [Sat, 19 Mar 2016 01:28:28 +0000 (18:28 -0700)]
nv50,nvc0: Fix invalid constant.

Fix clang build error.

  CXX      codegen/nv50_ir_lowering_nvc0.lo
codegen/nv50_ir_lowering_nvc0.cpp:1783:42: error: invalid suffix 'd' on floating constant
      Value *zero = bld.loadImm(NULL, 0.0d);
                                         ^

Fixes: c1e4a6bfbf01 ("nv50,nvc0: handle SQRT lowering inside the driver")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: Do proper format error checks for GenerateMipmap in ES 3.x.
Kenneth Graunke [Tue, 15 Mar 2016 07:41:16 +0000 (00:41 -0700)]
mesa: Do proper format error checks for GenerateMipmap in ES 3.x.

According to the OpenGL ES 3.2 spec's description of GenerateMipmap:

"An INVALID_OPERATION error is generated if the levelbase array was not
 specified with an unsized internal format from table 8.3 or a sized
 internal format that is both color-renderable and texture-filterable
 according to table 8.10."

Similar text exists in the ES 3.0 specification as well.

Our existing rules are pretty close, but miss a few things.  The
OpenGL specification actually doesn't have any text about internal
format checking - our existing code comes from a Khronos bug report.
The ES 3.x spec provides a clearer description.

Fixes dEQP-GLES3.functional.negative_api.texture.generatemipmap and
dEQP-GLES2.functional.negative_api.texture.generatemipmap_zero_level
_array_compressed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agomesa: Add color renderable/texture filterable format info for ES 3.x.
Kenneth Graunke [Tue, 15 Mar 2016 07:30:05 +0000 (00:30 -0700)]
mesa: Add color renderable/texture filterable format info for ES 3.x.

OpenGL ES 3.x contains a table of sized internal formats and their
required properties.  In particular, each format is marked as
"Color Renderable" or "Texture Filterable".

This patch introduces two functions that can be used to query the
information from that table.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Stop XY clipping point and line primitives.
Kenneth Graunke [Thu, 10 Mar 2016 22:36:25 +0000 (14:36 -0800)]
i965: Stop XY clipping point and line primitives.

Wide points and lines are not supposed to be clipped by the viewport.
Rather, they should be rendered, and any fragments outside of the
viewport should be discarded.

The traditional use case for this behavior is rendering moving wide
point particles.  When the center of the point approaches the viewport
edge, clipping would make it pop out of view early.

Fixes:
- dEQP-GLES2.functional.clipping.point.wide_point_clip
- dEQP-GLES3.functional.clipping.point.wide_point_clip
- dEQP-GLES3.functional.clipping.point.wide_point_clip_viewport_center
- dEQP-GLES3.functional.clipping.point.wide_point_clip_viewport_corner
- dEQP-GLES3.functional.clipping.line.wide_line_clip_viewport_center
- dEQP-GLES3.functional.clipping.line.wide_line_clip_viewport_corner

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94453
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94454
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Scissor to the viewport when rendering points/lines.
Kenneth Graunke [Thu, 10 Mar 2016 23:30:36 +0000 (15:30 -0800)]
i965: Scissor to the viewport when rendering points/lines.

We're about to start allowing wide points/lines whose vertices are
outside the viewport past the clipper.  This scissoring hack ensures
that any fragments generated are still restricted to the viewport.

It is not necessary on Gen8+ as those platforms already discard
fragments which are outside the viewport.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94453
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94454
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Include the viewport in the scissor rectangle.
Kenneth Graunke [Fri, 11 Mar 2016 00:04:01 +0000 (16:04 -0800)]
i965: Include the viewport in the scissor rectangle.

We'll need to use scissoring to restrict fragments to the viewport
soon.  It seems harmless to include it generally, so let's do that.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94453
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94454
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Introduce an is_drawing_lines() helper.
Kenneth Graunke [Thu, 10 Mar 2016 23:51:56 +0000 (15:51 -0800)]
i965: Introduce an is_drawing_lines() helper.

Similar to is_drawing_points().

v2: Account for isoline tessellation output topology.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Move is_drawing_points to brw_state.h.
Kenneth Graunke [Thu, 10 Mar 2016 23:46:34 +0000 (15:46 -0800)]
i965: Move is_drawing_points to brw_state.h.

I need to use this in multiple source files.

v2: Rebase on TES output domain fix.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Fix gl_TessLevelOuter[] for isolines.
Kenneth Graunke [Mon, 14 Mar 2016 21:22:39 +0000 (14:22 -0700)]
i965: Fix gl_TessLevelOuter[] for isolines.

Thanks to James Legg for finding this!

From the ARB_tessellation_shader spec:
"The number of isolines generated is derived from the first outer
 tessellation level; the number of segments in each isoline is
 derived from the second outer tessellation level."

According to the PRM, "TF.LineDensity determines # lines" while
"TF.LineDetail determines # segments".  Line Density is stored at
DWord 6, while Line Detail is at DWord 7.  So, they're not reversed
like they are for triangles and quads.

Fixes Piglit's spec/arb_tessellation_shader/execution/isoline,
and about 24 dEQP isoline tests (with GL_EXT_tessellation_shader
hacked on - it's not normally enabled).

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94524
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Decode non-normalized coordinates bit in SAMPLER_STATE.
Kenneth Graunke [Thu, 17 Mar 2016 00:01:10 +0000 (17:01 -0700)]
i965: Decode non-normalized coordinates bit in SAMPLER_STATE.

We weren't printing this for some reason.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agoi965: Account for TES in is_drawing_points().
Kenneth Graunke [Tue, 15 Mar 2016 08:00:18 +0000 (01:00 -0700)]
i965: Account for TES in is_drawing_points().

Now that we implement tessellation shaders, the TES might be the last
stage enabled.  If it's outputting points, then the primitive type
reaching the SF is points.  We need to account for this.

Caught by Ilia Mirkin.

v2: Update dirty bit comment above caller (caught by Iago)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonv50: Mark compute states as dirty on context switch
Pierre Moreau [Sun, 13 Mar 2016 21:11:42 +0000 (22:11 +0100)]
nv50: Mark compute states as dirty on context switch

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
[ Samuel Pitoiset: Trivial rebase conflict ]
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agonv50/ir: print SUBFM subops
Samuel Pitoiset [Thu, 17 Mar 2016 22:24:54 +0000 (23:24 +0100)]
nv50/ir: print SUBFM subops

Only 3d subop is currently emitted.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50: add a new validation path for compute
Samuel Pitoiset [Tue, 15 Mar 2016 14:03:26 +0000 (15:03 +0100)]
nv50: add a new validation path for compute

This makes use of the new state validation interface to be consistent
with 3d.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agonv50: rework nv50_compute_validate_program()
Samuel Pitoiset [Tue, 15 Mar 2016 13:58:20 +0000 (14:58 +0100)]
nv50: rework nv50_compute_validate_program()

Reduce the amount of duplicated code by re-using
nv50_program_validate(). While we are at it, change the prototype to
return void. We don't check anymore if the translation fails but
improving the state validation is a long process.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agonv50: rework the validation path for 3D
Samuel Pitoiset [Tue, 15 Mar 2016 13:49:39 +0000 (14:49 +0100)]
nv50: rework the validation path for 3D

This exposes an interface for state validation that will be also used
to rework the compute validation path.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agonv50: rename 3d binding points to NV50_BIND_3D_XXX
Samuel Pitoiset [Tue, 15 Mar 2016 13:34:34 +0000 (14:34 +0100)]
nv50: rename 3d binding points to NV50_BIND_3D_XXX

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agonv50: rename 3d dirty flags to NV50_NEW_3D_XXX
Samuel Pitoiset [Tue, 15 Mar 2016 13:24:49 +0000 (14:24 +0100)]
nv50: rename 3d dirty flags to NV50_NEW_3D_XXX

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agonv50: rename NV50_COMPUTE to NV50_CP
Samuel Pitoiset [Tue, 15 Mar 2016 13:09:05 +0000 (14:09 +0100)]
nv50: rename NV50_COMPUTE to NV50_CP

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agonv50: rename nv50_context::dirty to nv50_context::dirty_3d
Samuel Pitoiset [Tue, 15 Mar 2016 13:16:00 +0000 (14:16 +0100)]
nv50: rename nv50_context::dirty to nv50_context::dirty_3d

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre Moreau <pierre.morrow@free.fr>
Tested-by: Pierre Moreau <pierre.morrow@free.fr>
8 years agost/mesa: clean up st_translate_texture_target()
Brian Paul [Wed, 16 Mar 2016 21:12:42 +0000 (15:12 -0600)]
st/mesa: clean up st_translate_texture_target()

Reformat code.  Improve assertion.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: simplify drawpixels shader code with tgsi transform helper functions
Brian Paul [Wed, 16 Mar 2016 21:50:21 +0000 (15:50 -0600)]
st/mesa: simplify drawpixels shader code with tgsi transform helper functions

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: simplify bitmap shader code with tgsi transform helper functions
Brian Paul [Wed, 16 Mar 2016 21:49:34 +0000 (15:49 -0600)]
st/mesa: simplify bitmap shader code with tgsi transform helper functions

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agotgsi: add tgsi_transform_op3_inst() function
Brian Paul [Wed, 16 Mar 2016 21:47:41 +0000 (15:47 -0600)]
tgsi: add tgsi_transform_op3_inst() function

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agodoc: add 'vec4' option in INTEL_DEBUG
Juan A. Suarez Romero [Fri, 18 Mar 2016 16:29:55 +0000 (17:29 +0100)]
doc: add 'vec4' option in INTEL_DEBUG

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoegl: support EGL_LARGEST_PBUFFER in eglCreatePbufferSurface(...)
Daniel Czarnowski [Mon, 22 Feb 2016 06:00:14 +0000 (08:00 +0200)]
egl: support EGL_LARGEST_PBUFFER in eglCreatePbufferSurface(...)

Patch provides a default for a set pbuffer surface size when
EGL_LARGEST_PBUFFER is used by the client. MIN2 macro is moved
to egldefines so that it can be shared.

Fixes following Piglit test:
   egl-create-largest-pbuffer-surface

From EGL 1.5 spec:
   "Use EGL_LARGEST_PBUFFER to get the largest available pbuffer
   when the allocation of the pbuffer would otherwise fail."

Currently there exists no API to query largest available pixmap size
using xlib or xcb so right now this seems most straightforward way to
ensure that we fulfill above API and also we don't attempt to allocate
'too big' pixmap which might succeed on server side but not work in
practice when driver starts to use it as a texture.

v2: add more explanation about the change (Emil)

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
8 years agogallium/swr: Cleaned up some context-resource management
George Kyriazis [Mon, 14 Mar 2016 22:40:14 +0000 (17:40 -0500)]
gallium/swr: Cleaned up some context-resource management

Removed bound_to_context.  We now pick up the context from the screen
instead of the resource itself.  The resource could be out-of-date
and point to a pipe that is already freed.

Fixes manywin mesa xdemo.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agomesa: remove remaining tabs in prog_parameter.c
Timothy Arceri [Fri, 18 Mar 2016 01:33:27 +0000 (12:33 +1100)]
mesa: remove remaining tabs in prog_parameter.c

Acked-by: Matt Turner <mattst88@gmail.com>
8 years agomesa: inline _mesa_add_unnamed_constant()
Timothy Arceri [Fri, 18 Mar 2016 00:32:15 +0000 (11:32 +1100)]
mesa: inline _mesa_add_unnamed_constant()

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agomesa: simplify and inline _mesa_lookup_parameter_index()
Timothy Arceri [Fri, 18 Mar 2016 00:21:13 +0000 (11:21 +1100)]
mesa: simplify and inline _mesa_lookup_parameter_index()

The function has only one user and strings are always null terminated.

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agomesa: make _mesa_lookup_parameter_constant static
Timothy Arceri [Fri, 18 Mar 2016 00:10:06 +0000 (11:10 +1100)]
mesa: make _mesa_lookup_parameter_constant static

This is not used outside of prog_parameter.c

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agomesa: remove unused function
Timothy Arceri [Fri, 18 Mar 2016 00:09:32 +0000 (11:09 +1100)]
mesa: remove unused function

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agost/mesa: honour sized internal formats in st_choose_format (v2)
Nicolai Hähnle [Mon, 14 Mar 2016 20:33:34 +0000 (15:33 -0500)]
st/mesa: honour sized internal formats in st_choose_format (v2)

The bitcasting which is possible with shader images (and texture views?)
requires that when the user specifies a sized internal format for a
texture, we really allocate that format. To this end:

(1) find_exact_format should ignore sized internal formats and

(2) some of the entries in the mapping table corresponding to sized
    internal formats are reordered to use an RGBA format instead of
    a BGRA one.

This fixes arb_shader_image_load_store-bitcast in the (work in progress)
ARB_shader_image_load_store implementation for radeonsi.

v2: don't change the mapping of GL_RGB10: the change caused a regression
    because it preferred a format with an alpha channel, and GL_RGB10
    is not among the supported formats for shader images

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoconfigure.ac: enable_asm=yes when x-compiling across same X86 arch
Dongwon Kim [Tue, 16 Feb 2016 18:05:24 +0000 (10:05 -0800)]
configure.ac: enable_asm=yes when x-compiling across same X86 arch

Currently, configure script is forcing 'enable_asm' to be 'no'
whenever cross-compilation is performed on X86 host. This is
based on an assumption that target architecture is different
from host's (i.e. ARM). But there's always a case that we do
cross-compilation for target that is also X86 based just like
host in which same ASM codes will be supported. 'enable_asm'
should not be forced to be "no" anymore in this case.

v2: corrected commit message

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
8 years agoglsl: disable varying packing when its not safe
Timothy Arceri [Mon, 29 Feb 2016 00:46:37 +0000 (11:46 +1100)]
glsl: disable varying packing when its not safe

In GL 4.4+ there is no guarantee that interpolation qualifiers will
match between stages so we cannot safely pack varyings using the
current packing pass in Mesa.

We also disable packing on outerward facing interfaces for SSO
because in ES we need to retain the unpacked varying information
for draw time validation. For desktop GL we could allow packing for
SSO in versions < 4.4 but its just safer not to do so.

We do however enable packing on individual arrays, structs, and
matrices as these are required by the transform feedback code and it
is still safe to do so.

Finally we also enable packing when a varying is only used for
transform feedback and its not a SSO.

This fixes all remaining rendering issues with the dEQP SSO tests,
the only issues remaining with thoses tests are to do with validation.

Note: There is still one remaining SSO bug that this patch doesn't fix.
Their is a chance that VS -> TCS will have mismatching interfaces
because we pack VS output in case its used by transform feedback but
don't pack TCS input for performance reasons. This patch will make the
situation better but doesn't fix it.

V4: fix out of order function params after rebase, make sure packing
still disabled in tess stages. Update comments as to why we disable
packing on SSO.

V3: ES 3.1 *does* require interpolation to match so don't disable
packing there. Rebased on master rather than on enhanced layouts
component packing series.

V2: Make is_varying_packing_safe() a function in the varying_matches
class, fix spelling (Matt) and make sure to remove the outer array
when dealing with Geom and Tess shaders where appropriate.
Lastly fix piglit regression in new piglit test and document the
undefined behaviour it depends on:
arb_separate_shader_objects/execution/vs-gs-linking.shader_test

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoglsl: pass disable_varying_packing bool to the lowering pass
Timothy Arceri [Tue, 24 Nov 2015 01:56:45 +0000 (12:56 +1100)]
glsl: pass disable_varying_packing bool to the lowering pass

This will allow us to choose to ignore the disable which will be
useful for more fine grained control over when to enable or disable
packing.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoradeonsi: fix Hyper-Z hangs on P2 configs
Marek Olšák [Tue, 15 Mar 2016 20:49:54 +0000 (21:49 +0100)]
radeonsi: fix Hyper-Z hangs on P2 configs

Cc: 11.1 11.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agodocs: Renormalize older extensions.
Romain Failliot [Tue, 15 Mar 2016 20:14:11 +0000 (16:14 -0400)]
docs: Renormalize older extensions.

For older extensions, there is an explanation first and the extension
name in brackets, like that:
    Clamping controls (GL_ARB_color_buffer_float)
I inverted that so we have the extension first and then the explanation
in brackets, like that:
    GL_ARB_color_buffer_float (Clamping controls)

It will help me later to parse the few extensions that use this syntax:
    all drivers that support <GL_extension>

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agodocs: Renormalize some extensions.
Romain Failliot [Tue, 15 Mar 2016 20:14:10 +0000 (16:14 -0400)]
docs: Renormalize some extensions.

This fixes some exceptions I have to deal with in mesamatrix.net.
The extensions GL_ARB_texture_buffer_object had a comment between "DONE"
and the brackets.
And the extension GL_KHR_robustness (in GL 4.5 and GLES 3.1) was using
"90% done" instead of "in progress". The "90% done" is still here
though, but as an extension comment.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agodocs: Realign the "Status" column.
Romain Failliot [Tue, 15 Mar 2016 20:14:09 +0000 (16:14 -0400)]
docs: Realign the "Status" column.

The "Status" column was misaligned in some GL sections.
This is a lot of diffs, but it's only spaces in the end.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agodocs: howto to read and edit GL3.txt
Romain Failliot [Tue, 15 Mar 2016 20:14:08 +0000 (16:14 -0400)]
docs: howto to read and edit GL3.txt

Added a small guide on how to read and edit GL3.txt.
I think this would help as much the devs as the users reading this file.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agor300g: add missing layer argument to rws->buffer_get_handle() call
Brian Paul [Thu, 17 Mar 2016 15:47:21 +0000 (09:47 -0600)]
r300g: add missing layer argument to rws->buffer_get_handle() call

Fixes compilation error since 5aea0d691.

Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agoradeon/winsys: add layer support for BO export
Christian König [Thu, 14 Jan 2016 14:01:39 +0000 (15:01 +0100)]
radeon/winsys: add layer support for BO export

Add layer support to export individual array layers.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeon/winsys: add offset support for BO import/export
Christian König [Tue, 12 Jan 2016 14:59:11 +0000 (15:59 +0100)]
radeon/winsys: add offset support for BO import/export

Add offset support to handle NV12 offsets as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/winsys/drm: add layer to struct winsys_handle
Christian König [Thu, 14 Jan 2016 12:51:18 +0000 (13:51 +0100)]
gallium/winsys/drm: add layer to struct winsys_handle

For exporting a specific layer of an array texture.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/winsys/drm: add offset to struct winsys_handle
Christian König [Tue, 12 Jan 2016 14:19:54 +0000 (15:19 +0100)]
gallium/winsys/drm: add offset to struct winsys_handle

We are going to need this for EGL_EXT_image_dma_buf_import.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agonir: propagate bitsize information in nir_search
Connor Abbott [Fri, 14 Aug 2015 18:45:30 +0000 (11:45 -0700)]
nir: propagate bitsize information in nir_search

When we replace an expresion we have to compute bitsize information for the
replacement. We do this in two passes to validate that bitsize information
is consistent and correct: first we propagate bitsize from child nodes to
parent, then we do it the other way around, starting from the original's
instruction destination bitsize.

v2 (Iago):
- Always use nir_type_bool32 instead of nir_type_bool when generating
  algebraic optimizations. Before we used nir_type_bool32 with constants
  and nir_type_bool with variables.
- Fix bool comparisons in nir_search.c to account for bitsized types.

v3 (Sam):
- Unpack the double constant value as unsigned long long (8 bytes) in
nir_algrebraic.py.

v4 (Sam):
- Use helpers to get type size and base type from nir_alu_type.

Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir: add a bit_size parameter to nir_ssa_dest_init
Connor Abbott [Tue, 17 Nov 2015 12:57:54 +0000 (13:57 +0100)]
nir: add a bit_size parameter to nir_ssa_dest_init

v2: Squash multiple commits addressing the new parameter in different
    files so we don't break the build (Iago)

v3: Fix tgsi (Samuel)

v4: Fix nir_clone.c (Samuel)

v5: Fix vc4 and freedreno (Iago)

v6 (Sam)
- Fix build errors in nir_lower_indirect_derefs
- Use helper to get type size from nir_alu_type.

Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir: rename nir_const_value fields to include bitsize information
Iago Toral Quiroga [Wed, 16 Mar 2016 11:11:34 +0000 (12:11 +0100)]
nir: rename nir_const_value fields to include bitsize information

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agonir: update opcode definitions for different bit sizes
Connor Abbott [Fri, 14 Aug 2015 17:45:06 +0000 (10:45 -0700)]
nir: update opcode definitions for different bit sizes

Some opcodes need explicit bitsizes, and sometimes we need to use the
double version when constant folding.

v2: fix output type for u2f (Iago)

v3: do not change vecN opcodes to be float. The next commit will add
    infrastructure to enable 64-bit integer constant folding so this is isn't
    really necessary. Also, that created problems with source modifiers in
    some cases (Iago)

v4 (Jason):
  - do not change bcsel to work in terms of floats
  - leave ldexp generic

Squashed changes to handle different bit sizes when constant
folding since otherwise we would break the build.

v2:
- Use the bit-size information from the opcode information if defined (Iago)
- Use helpers to get type size and base type of nir_alu_type enum (Sam)
- Do not fallback to sized types to guess bit-size information. (Jason)

Squashed changes in i965 and gallium/nir drivers to support sized types.
These functions should only see sized types, but we can't make that change
until we make sure that nir uses the sized versions in all the relevant places.
A later commit will address this.

Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir: add nir_{src,dest}_bit_size() helpers
Connor Abbott [Fri, 14 Aug 2015 17:18:39 +0000 (10:18 -0700)]
nir: add nir_{src,dest}_bit_size() helpers

v2: use a ternary (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir: Add a bit_size to nir_register and nir_ssa_def
Jason Ekstrand [Tue, 17 Nov 2015 14:45:18 +0000 (15:45 +0100)]
nir: Add a bit_size to nir_register and nir_ssa_def

This really hacky commit adds a bit size to registers and SSA values.  It
also adds rules in the validator to validate that they do the right things.

It's still an open question as to whether or not we want a bit_size in
nir_alu_instr or if we just want to let it inherit from the destination.
I'm inclined to just let it inherit from the destination.  A similar
question needs to be asked about intrinsics.

v2 (Connor):
  - Relax validation: comparisons have explicit destination sizes
    and implicit source sizes.

v3 (Sam):
- Use helpers to get size and base types of nir_alu_type enum.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir/types: add a function to get the bitsize of a base type
Connor Abbott [Fri, 14 Aug 2015 17:36:15 +0000 (10:36 -0700)]
nir/types: add a function to get the bitsize of a base type

v2: fix it for GLSL_TYPE_SUBROUTINE (Iago)

Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965/nir: fix check to resolve booleans to work with sized nir_alu_type
Samuel Iglesias Gonsálvez [Wed, 24 Feb 2016 09:51:22 +0000 (10:51 +0100)]
i965/nir: fix check to resolve booleans to work with sized nir_alu_type

As nir_alu_type has now embedded the data size, the check for the
instruction's output type (to see if a boolean resolve is required)
should ignore the data size part.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir: Add explicitly sized types
Jason Ekstrand [Fri, 15 May 2015 16:21:23 +0000 (09:21 -0700)]
nir: Add explicitly sized types

v2: Fix size/type mask to properly handle 8-bit types.

v3: Add helpers to get the bitsize and base type of a
nir_alu_type enum.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965/nir: Lower nir compute shader shared variables
Jordan Justen [Mon, 18 Jan 2016 17:45:46 +0000 (09:45 -0800)]
i965/nir: Lower nir compute shader shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: Lower shared var atomics during nir_lower_io
Jordan Justen [Mon, 18 Jan 2016 17:59:19 +0000 (09:59 -0800)]
nir: Lower shared var atomics during nir_lower_io

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: Add support for lowering load/stores of shared variables
Jordan Justen [Mon, 18 Jan 2016 17:44:31 +0000 (09:44 -0800)]
nir: Add support for lowering load/stores of shared variables

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: Add atomic operations on variables
Jordan Justen [Mon, 18 Jan 2016 17:53:44 +0000 (09:53 -0800)]
nir: Add atomic operations on variables

This allows us to first generate atomic operations for shared
variables using these opcodes, and then later we can lower those to
the shared atomics intrinsics with nir_lower_io.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: Add compute shader shared variable storage class
Jordan Justen [Sat, 9 Jan 2016 01:16:29 +0000 (17:16 -0800)]
nir: Add compute shader shared variable storage class

Previously we were receiving shared variable accesses via a lowered
intrinsic function from glsl. This change allows us to send in
variables instead. For example, when converting from SPIR-V.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/print: Add space after shader_storage var mode
Jordan Justen [Sun, 17 Jan 2016 07:11:16 +0000 (23:11 -0800)]
nir/print: Add space after shader_storage var mode

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965: Skip execution size adjustment for instructions of width 4
Iago Toral Quiroga [Thu, 3 Dec 2015 08:50:49 +0000 (09:50 +0100)]
i965: Skip execution size adjustment for instructions of width 4

This code in brw_set_dest adjusts the execution size of any instruction
with a dst.width < 8. However, we don't want to do this with instructions
operating on doubles, since these will have a width of 4, but still
need an execution size of 8 (for SIMD8). Unfortunately, we can't just check
the size of the operands involved to detect if we are doing an operation on
doubles, because we can have instructions that do operations on double
operands interpreted as UD, operating on any of its 2 32-bit components.

Previous commits have made it so we never emit instructions with a horizontal
width of 4 that don't have the correct execution size set for gen6+, so
we can skip it in this case, avoiding the conflicts with fp64 requirements.

Expanding the same fix to other hardware generations requires many more
changes but since we are not targetting fp64 support on them
wer don't really care for now.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/vec4/gen6: fix exec_size for MOV with a width of 4 in generate_gs_ff_sync()
Samuel Iglesias Gonsalvez [Tue, 15 Dec 2015 08:34:38 +0000 (09:34 +0100)]
i965/vec4/gen6: fix exec_size for MOV with a width of 4 in generate_gs_ff_sync()

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/vec4/gen6: fix exec_size for instructions with destination width of 4
Samuel Iglesias Gonsalvez [Fri, 4 Dec 2015 09:23:15 +0000 (10:23 +0100)]
i965/vec4/gen6: fix exec_size for instructions with destination width of 4

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/vec4/gen6: fix exec_size for instructions with width of 4 in generate_gs_svb_write()
Samuel Iglesias Gonsalvez [Thu, 3 Dec 2015 17:27:39 +0000 (18:27 +0100)]
i965/vec4/gen6: fix exec_size for instructions with width of 4 in generate_gs_svb_write()

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/gs/gen6: fix execsize for instructions with width of 4 in gen6_sol_program()
Samuel Iglesias Gonsalvez [Thu, 3 Dec 2015 17:05:39 +0000 (18:05 +0100)]
i965/gs/gen6: fix execsize for instructions with width of 4 in gen6_sol_program()

v2:
- Add assert (Topi).

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965: set correct execsize for MOVS with a width of 4 in brw_find_live_channel
Iago Toral Quiroga [Thu, 3 Dec 2015 10:11:14 +0000 (11:11 +0100)]
i965: set correct execsize for MOVS with a width of 4 in brw_find_live_channel

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/eu: set execution size for SEND message in brw_send_indirect_message
Iago Toral Quiroga [Thu, 3 Dec 2015 10:10:12 +0000 (11:10 +0100)]
i965/eu: set execution size for SEND message in brw_send_indirect_message

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/fs: Set exec size for gen7 pull const loads
Iago Toral Quiroga [Thu, 3 Dec 2015 09:59:23 +0000 (10:59 +0100)]
i965/fs: Set exec size for gen7 pull const loads

v2 (Topi):
  - No need to set the execsize for the indirect send message,
    the next patch will handle that.
  - Set the execution size explicitly instead of taking it from
    the width of the dst that we set before.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/eu: set correct execution size in brw_NOP
Iago Toral Quiroga [Thu, 3 Dec 2015 07:49:13 +0000 (08:49 +0100)]
i965/eu: set correct execution size in brw_NOP

v2: NOP should have an execsize of 1 (Matt)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agometa: Don't use integer handles for shaders or programs.
Kenneth Graunke [Tue, 15 Mar 2016 17:51:55 +0000 (10:51 -0700)]
meta: Don't use integer handles for shaders or programs.

Previously, we gave our internal clear/blit shaders actual GL handles
and stored them in the shader/program hash table.  We used ordinary
GL API entrypoints to work with them.

We thought this shouldn't be a problem because GL doesn't allow
applications to invent their own names for shaders or programs.
GL allocates all names via glCreateShader and glCreateProgram.

However, having them in the hash table is a bit risky: if a broken
application guesses the name of our shaders or programs, it could
alter them, potentially screwing up future meta operations.

Also, test cases can observe the programs in the hash table.  Running
a single dEQP process that executes the following test list:

dEQP-GLES3.functional.negative_api.buffer.clear
dEQP-GLES3.functional.negative_api.shader.compile_shader
dEQP-GLES3.functional.negative_api.shader.delete_shader

would result in the last two tests breaking.  The compile_shader test
calls glCompileShader(9) straight away, and since it hasn't even created
any shaders or programs, it expects to get a GL_INVALID_VALUE error
because there's no such name.  However, because the clear test ran
first, it created Meta programs, so an object named "9" did exist.

This patch reworks Meta to work with gl_shader and gl_shader_program
pointers directly.  These internal programs have bogus names, and are
never stored in the hash tables, so they're invisible to applications.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94485
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agomesa: Expose compile_shader() and link_program() beyond the file.
Kenneth Graunke [Tue, 15 Mar 2016 17:51:33 +0000 (10:51 -0700)]
mesa: Expose compile_shader() and link_program() beyond the file.

This will allow me to use them directly from Meta, bypassing the
versions that work with GL integer handles.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: Make link_program() take a gl_shader_program, not a GLuint.
Kenneth Graunke [Wed, 16 Mar 2016 00:08:17 +0000 (17:08 -0700)]
mesa: Make link_program() take a gl_shader_program, not a GLuint.

In half the callers, we already have a pointer, and don't need
to look it up again.  This will also help with upcoming meta work.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: Make compile_shader() take a gl_shader, not a GLuint.
Kenneth Graunke [Tue, 15 Mar 2016 17:24:09 +0000 (10:24 -0700)]
mesa: Make compile_shader() take a gl_shader, not a GLuint.

In half the callers, we already have a pointer, and don't need
to look it up again.  This will also help with upcoming meta work.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agometa: Use the _mesa_meta_compile_and_link_program helper more places.
Kenneth Graunke [Tue, 15 Mar 2016 23:21:36 +0000 (16:21 -0700)]
meta: Use the _mesa_meta_compile_and_link_program helper more places.

Less boilerplate.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agovc4: Move discard handling to the condition flag.
Eric Anholt [Wed, 16 Mar 2016 01:00:22 +0000 (18:00 -0700)]
vc4: Move discard handling to the condition flag.

Now that the field exists in the instruction, we can make discards less
special.  As a bonus, that means that we should be able to merge some more
.sf instructions together when we get around to that.

This causes some scheduling changes, as it allows tlb_color_reads to be
delayed past the discard condition setup.  Since the tlb_color_read ends
up later, this may mean performance improvements, but I haven't tested.

total instructions in shared programs: 78114 -> 78035 (-0.10%)
instructions in affected programs:     1922 -> 1843 (-4.11%)
total estimated cycles in shared programs: 234318 -> 234329 (0.00%)
estimated cycles in affected programs:     8200 -> 8211 (0.13%)

8 years agovc4: Don't make a temporary for setting flags.
Eric Anholt [Wed, 16 Mar 2016 01:58:43 +0000 (18:58 -0700)]
vc4: Don't make a temporary for setting flags.

The register allocator doesn't really do anything about the temp, so it
doesn't seem like it should matter.  However, the scheduler would think
that a new def is being created.

This doesn't change anything yet, but it avoids a bunch of regressions in
the next commit.

8 years agovc4: Add a safety check for setting flags.
Eric Anholt [Wed, 16 Mar 2016 01:57:20 +0000 (18:57 -0700)]
vc4: Add a safety check for setting flags.

If a pack was on the src reg, should it be a float, int, or mul unpack?
Just complain, instead.

8 years agovc4: Reuse list_for_each_entry_safe_rev().
Eric Anholt [Wed, 16 Mar 2016 01:50:32 +0000 (18:50 -0700)]
vc4: Reuse list_for_each_entry_safe_rev().

This didn't exist when I wrote the code.

8 years agometa: Use ARB_explicit_attrib_location in the rest of the meta shaders.
Kenneth Graunke [Tue, 15 Mar 2016 18:13:25 +0000 (11:13 -0700)]
meta: Use ARB_explicit_attrib_location in the rest of the meta shaders.

This is cleaner than using glBindAttribLocation().

Not all drivers support the extension, but I don't think those drivers
use GLSL in the first place.  Apparently some Meta shaders already use
GL_ARB_explicit_attrib_location, so I think it should be okay.

Honestly, I'm not sure how the old code worked anyway - we bound the
attribute location for "texcoords", while all the shaders capitalized
or spelled it differently.

v2: Convert another instance in brw_meta_fast_clear.c.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>