mesa.git
8 years agoradeonsi: Lower TGSI_OPCODE_ATOM* down to LLVM op
Nicolai Hähnle [Fri, 12 Feb 2016 01:54:25 +0000 (20:54 -0500)]
radeonsi: Lower TGSI_OPCODE_ATOM* down to LLVM op

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Lower TGSI_OPCODE_STORE down to LLVM op
Nicolai Hähnle [Tue, 9 Feb 2016 16:51:31 +0000 (11:51 -0500)]
radeonsi: Lower TGSI_OPCODE_STORE down to LLVM op

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Lower TGSI_OPCODE_LOAD down to LLVM op (v3)
Nicolai Hähnle [Tue, 9 Feb 2016 15:59:14 +0000 (10:59 -0500)]
radeonsi: Lower TGSI_OPCODE_LOAD down to LLVM op (v3)

v2: new signature style for buffer intrinsics (offsets)
v3: new signature style for llvm.amdgcn.buffer.load.format (overloaded return)

Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v2)
8 years agoradeonsi: extract the LLVM type name construction into its own function
Nicolai Hähnle [Tue, 9 Feb 2016 20:01:35 +0000 (15:01 -0500)]
radeonsi: extract the LLVM type name construction into its own function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Lower TGSI_OPCODE_RESQ down to LLVM op
Nicolai Hähnle [Sun, 7 Feb 2016 23:41:09 +0000 (18:41 -0500)]
radeonsi: Lower TGSI_OPCODE_RESQ down to LLVM op

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: extract TXQ buffer size computation into its own function
Nicolai Hähnle [Sun, 7 Feb 2016 22:34:57 +0000 (17:34 -0500)]
radeonsi: extract TXQ buffer size computation into its own function

This will allow it to be reused for RESQ.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: decompress shader images
Nicolai Hähnle [Mon, 8 Feb 2016 03:30:46 +0000 (22:30 -0500)]
radeonsi: decompress shader images

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: update shader image descriptor for invalidated buffer
Nicolai Hähnle [Wed, 16 Mar 2016 03:01:39 +0000 (22:01 -0500)]
radeonsi: update shader image descriptor for invalidated buffer

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: implement set_shader_images (v2)
Nicolai Hähnle [Sat, 6 Feb 2016 23:32:13 +0000 (18:32 -0500)]
radeonsi: implement set_shader_images (v2)

Whether DCC is disabled depends on the access flags with which the image
is bound: image_load supports DCC, but store and atomic don't.

v2: remove an unnecessary masking of images->desc.enabled_mask

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: make r600_texture_disable_dcc externally accessible
Nicolai Hähnle [Sat, 12 Mar 2016 00:39:18 +0000 (19:39 -0500)]
gallium/radeon: make r600_texture_disable_dcc externally accessible

We will need it in radeonsi for shader images.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agotgsi/scan: track which shader images are really buffers
Nicolai Hähnle [Sun, 13 Mar 2016 20:06:15 +0000 (15:06 -0500)]
tgsi/scan: track which shader images are really buffers

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agotgsi/scan: add images_writemask
Nicolai Hähnle [Sun, 13 Mar 2016 20:00:40 +0000 (15:00 -0500)]
tgsi/scan: add images_writemask

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/mesa: translate additional flags in MemoryBarrier
Nicolai Hähnle [Sun, 13 Mar 2016 16:37:10 +0000 (11:37 -0500)]
st/mesa: translate additional flags in MemoryBarrier

Re-order flags in the order in which they appear in the OpenGL spec in the
description of MemoryBarrier().

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: add additional PIPE_BARRIER_* bits
Nicolai Hähnle [Sun, 13 Mar 2016 16:36:53 +0000 (11:36 -0500)]
gallium: add additional PIPE_BARRIER_* bits

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agosvga: add svga_winsys_context::pipe_debug_callback pointer
Brian Paul [Wed, 24 Feb 2016 01:02:11 +0000 (18:02 -0700)]
svga: add svga_winsys_context::pipe_debug_callback pointer

The svga winsys modules can use this to send debug messages to the
state tracker and Mesa.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: José Fonseca <jfonseca@vmware.com>
8 years agosvga: Fix the index buffer rebind regression
Charmaine Lee [Tue, 26 Jan 2016 19:12:09 +0000 (11:12 -0800)]
svga: Fix the index buffer rebind regression

The index buffer handle saved in the hw_state structure could
be invalid after the index buffer is destroyed. Instead of
rebinding the index buffer using the saved index buffer handle,
we will reset the index buffer handle in the hw_state structure
to force resending of the index buffer.

Fixes bug 1593320

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agosvga: rebind stream output targets
Charmaine Lee [Wed, 20 Jan 2016 18:35:56 +0000 (10:35 -0800)]
svga: rebind stream output targets

To ensure stream output target surfaces are available for the draw commands,
we need to rebind the current stream output targets at the first draw in the
command buffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agosvga: rebind index buffer
Charmaine Lee [Wed, 20 Jan 2016 04:25:39 +0000 (20:25 -0800)]
svga: rebind index buffer

Similar to other resources, current index buffer needs to be
rebound at the first draw of the current command buffer to make
sure the buffer is available for the draw command.

Fixes bug 1587263.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agosvga: minor formatting fix, comment addition
Brian Paul [Mon, 21 Mar 2016 19:23:04 +0000 (13:23 -0600)]
svga: minor formatting fix, comment addition

To sync with our internal tree.

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agosvga: optimize constant buffer uploads
Charmaine Lee [Fri, 11 Mar 2016 22:54:36 +0000 (14:54 -0800)]
svga: optimize constant buffer uploads

When a constant buffer slot is allocated in the upload buffer,
the allocated slot size is always in multiple of 256. But the actual buffer
size might not be in multiple of 256. This causes a gap between
the ending offset of a slot and the starting offset of the next slot.
The gap will prevent the two slots to be updated in a single update command.
In order to maximize the chance of merging the contiguous dirty ranges,
when a slot is to be allocated in the constant upload buffer,
specify a buffer size in multiple of 256.

There is about 10% performance improvement with Lightsmark2008 and
30% with Cinebench R11.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
8 years agosvga: add a few more resource updates HUD query
Charmaine Lee [Fri, 11 Mar 2016 22:33:39 +0000 (14:33 -0800)]
svga: add a few more resource updates HUD query

This patch adds the following HUD queries:
.num-resource-updates  -- number of resource update. Commands include
                          UPDATE_SUBRESOURCE, UPDATE_GB_IMAGE.
.num-buffer-uploads    -- number of buffer uploads.
.num-const-buf-updates -- number of set constant buffer.
.num-const-updates     -- number of set shader constant.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
8 years agosvga: add new num-readbacks HUD query
Charmaine Lee [Thu, 10 Mar 2016 18:57:24 +0000 (10:57 -0800)]
svga: add new num-readbacks HUD query

To find out how many image readback command is issued.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
8 years agosvga: use shader sampler view declarations
Brian Paul [Fri, 18 Mar 2016 15:55:57 +0000 (09:55 -0600)]
svga: use shader sampler view declarations

Previously, we looked at the bound textures (via the pipe_sampler_views)
to determine texture dimensions (1D/2D/3D/etc) and datatype (float vs.
int).  But this could fail in out of memory conditions.  If we failed to
allocate a texture and didn't create a pipe_sampler_view, we'd default
to using 0 (PIPE_BUFFER) as the texture type.  This led to device errors
because of inconsistent shader code.

This change relies on all TGSI shaders having an SVIEW declaration for
each SAMP declaration.  The previous patch series does that.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agogallium/tests: declare sampler views in shaders
Brian Paul [Fri, 18 Mar 2016 20:20:44 +0000 (14:20 -0600)]
gallium/tests: declare sampler views in shaders

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agogallium/util: declare sampler view in util_make_fs_blit_msaa_depthstencil()
Brian Paul [Fri, 18 Mar 2016 20:20:27 +0000 (14:20 -0600)]
gallium/util: declare sampler view in util_make_fs_blit_msaa_depthstencil()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agopostprocess: declare sampler views in shaders
Brian Paul [Fri, 18 Mar 2016 20:20:01 +0000 (14:20 -0600)]
postprocess: declare sampler views in shaders

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agohud: add sampler view declaration in text fragment shader
Brian Paul [Fri, 18 Mar 2016 20:07:47 +0000 (14:07 -0600)]
hud: add sampler view declaration in text fragment shader

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: emit sampler view decls in drawpixels code
Brian Paul [Thu, 17 Mar 2016 00:43:00 +0000 (18:43 -0600)]
st/mesa: emit sampler view decls in drawpixels code

v2: support both TGSI_TEXTURE_2D and _RECT

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: emit sampler view declaration in bitmap shader
Brian Paul [Thu, 17 Mar 2016 00:43:00 +0000 (18:43 -0600)]
st/mesa: emit sampler view declaration in bitmap shader

In June 2015, Rob Clark started updating the tgsi utility code to emit
SVIEW declarations in various shaders (for polygon stipple, blitting,
etc).  These patches do the same for the Mesa state tracker.

The VMware driver will use this.

v2: support both TGSI_TEXTURE_2D and _RECT

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: emit sampler view declarations for ARB vert/frag programs
Brian Paul [Wed, 16 Mar 2016 21:58:37 +0000 (15:58 -0600)]
st/mesa: emit sampler view declarations for ARB vert/frag programs

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: use correct TGSI texture target in drawpix fragment shader
Brian Paul [Fri, 18 Mar 2016 18:20:10 +0000 (12:20 -0600)]
st/mesa: use correct TGSI texture target in drawpix fragment shader

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: use correct TGSI texture target in bitmap fragment shader
Brian Paul [Fri, 18 Mar 2016 18:16:50 +0000 (12:16 -0600)]
st/mesa: use correct TGSI texture target in bitmap fragment shader

Depending on the driver's support for NPOT textures, we might use
a RECT texture instead of 2D texture.  We should propogate that info
to the fragment shader's TEX instruction.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agogallium/tgsi: pass TGSI tex target to tgsi_transform_tex_inst()
Brian Paul [Fri, 18 Mar 2016 18:11:39 +0000 (12:11 -0600)]
gallium/tgsi: pass TGSI tex target to tgsi_transform_tex_inst()

Instead of hard-coded 2D tex target in tgsi_transform_tex_2d_inst()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: use the texture view's format for render-to-texture
Nicolai Hähnle [Fri, 18 Mar 2016 22:16:39 +0000 (17:16 -0500)]
st/mesa: use the texture view's format for render-to-texture

Aside from the bug below, it fixes a simplistic test I've written locally,
and I see no regression in Piglit for radeonsi.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94595
Cc: "11.0 11.1 11.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium: Remove unused TGSI_RESOURCE_ defines
Hans de Goede [Thu, 17 Mar 2016 09:04:15 +0000 (10:04 +0100)]
gallium: Remove unused TGSI_RESOURCE_ defines

These magic file-index defines where only ever used in the nouveau code
and that no longer uses them.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v2)
8 years agonouveau: codegen: Do not silently fail in handeLOAD / handleSTORE / handleATOM
Hans de Goede [Thu, 17 Mar 2016 09:00:59 +0000 (10:00 +0100)]
nouveau: codegen: Do not silently fail in handeLOAD / handleSTORE / handleATOM

handeLOAD / handleSTORE / handleATOM can only handle TGSI_FILE_BUFFER
and TGSI_FILE_MEMORY. Make things fail explictly when another
register-file is used in these functions.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
8 years agonouveau: codegen: Disable more old resource handling code
Hans de Goede [Wed, 16 Mar 2016 09:10:47 +0000 (10:10 +0100)]
nouveau: codegen: Disable more old resource handling code

Commit c3083c7082 ("nv50/ir: add support for BUFFER accesses") disabled /
commented out some of the old resource handling code, but not all of it.

Effectively all of it is dead already, if we ever enter the old code
paths in handeLOAD / handleSTORE / handleATOM we will get an exception
due to trying to access the now always zero-sized resources vector.

Disable all the dead code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
8 years agonouveau: codegen: gk110: Make emitSTORE offset handling identical to emitLOAD
Hans de Goede [Tue, 15 Mar 2016 13:37:27 +0000 (14:37 +0100)]
nouveau: codegen: gk110: Make emitSTORE offset handling identical to emitLOAD

Make the store offset handling in CodeEmitterGK110::emitSTORE identical
to the one in CodeEmitterGK110::emitLOAD handling.

This is just a cleanup, it does not cause any functional changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agonouveau: codegen: Slightly refactor Source::scanInstruction() dst handling
Hans de Goede [Tue, 15 Mar 2016 12:48:30 +0000 (13:48 +0100)]
nouveau: codegen: Slightly refactor Source::scanInstruction() dst handling

Use the dst temp variable which was used in the TGSI_FILE_OUTPUT
case everywhere. This makes the code somewhat easier to reads
and helps avoiding going over 80 chars with upcoming changes.

This also brings the dst handling more in line with the src
handling.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agonouveau: codegen: Add support for clover / OpenCL kernel input parameters
Hans de Goede [Thu, 10 Mar 2016 15:02:06 +0000 (16:02 +0100)]
nouveau: codegen: Add support for clover / OpenCL kernel input parameters

Add support for clover / OpenCL kernel input parameters.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
8 years agotgsi: Add support for global / private / input MEMORY
Hans de Goede [Thu, 10 Mar 2016 12:52:00 +0000 (13:52 +0100)]
tgsi: Add support for global / private / input MEMORY

Extend the MEMORY file support to differentiate between global, private
and shared memory, as well as "input" memory.

"MEMORY[x], INPUT" is intended to access OpenCL kernel parameters, a
special memory type is added for this, since the actual storage of these
(e.g. UBO-s) may differ per implementation. The uploading of kernel
parameters is handled by launch_grid, "MEMORY[x], INPUT" allows drivers
to use an access mechanism for parameter reads which matches with the
upload method.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
8 years agotgsi: Fix decl.Atomic and .Shared not propagating when parsing tgsi text
Hans de Goede [Thu, 10 Mar 2016 14:26:21 +0000 (15:26 +0100)]
tgsi: Fix decl.Atomic and .Shared not propagating when parsing tgsi text

When support for decl.Atomic and .Shared was added, tgsi_build_declaration
was not updated to propagate these properly.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> (v1)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (v2)
8 years agodoc: document spilling options accepted by INTEL_DEBUG
Iago Toral Quiroga [Fri, 18 Mar 2016 07:39:23 +0000 (08:39 +0100)]
doc: document spilling options accepted by INTEL_DEBUG

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agotgsi: Fix return of uninitialized memory in tgsi_*_instruction_memory
Hans de Goede [Wed, 16 Mar 2016 08:46:05 +0000 (09:46 +0100)]
tgsi: Fix return of uninitialized memory in tgsi_*_instruction_memory

tgsi_default_instruction_memory / tgsi_build_instruction_memory were
returning uninitialized memory for tgsi_instruction_memory.Texture and
tgsi_instruction_memory.Format. Note 0 means not set, and thus is a
correct default initializer for these.

Fixes: 3243b6fc97 ("tgsi: add Texture and Format to tgsi_instruction_memory")
Cc: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: report correct precision information for low/medium/high ints
Ilia Mirkin [Sun, 20 Mar 2016 03:27:56 +0000 (23:27 -0400)]
st/mesa: report correct precision information for low/medium/high ints

When we have native integers, these have full precision. Whether they're
low/medium/high isn't piped through the TGSI yet, but eventually those
might have differing precisions. For now they're just 32-bit ints.

Fixes the following dEQP tests:

  dEQP-GLES3.functional.state_query.shader.precision_vertex_highp_int
  dEQP-GLES3.functional.state_query.shader.precision_fragment_highp_int

which expected highp ints to have full 32-bit precision, not the default
23-bit float precision.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
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>