mesa.git
11 years agointel: Enable blit glCopyTexSubImage/glBlitFramebuffer with sRGB.
Eric Anholt [Tue, 28 May 2013 17:59:53 +0000 (10:59 -0700)]
intel: Enable blit glCopyTexSubImage/glBlitFramebuffer with sRGB.

Since the introduction of default-to-SARGB8 window system framebuffers,
non-blorp hardware lost blit acceleration for these two paths between the
window system and ARGB8888 textures.  Since we shouldn't be doing any
conversion anyway, just compatibility-check the linear variants of the
formats.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61954
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
11 years agoradeonsi: Add ipo to LLVM_COMPONENTS
Andreas Hartmetz [Tue, 28 May 2013 21:59:41 +0000 (23:59 +0200)]
radeonsi: Add ipo to LLVM_COMPONENTS

r600g needs it too, so add ipo in the common radeon_llvm_check().

radeonsi compiled and linked, but it failed at dynamic link time
with a missing symbol.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
11 years agollvmpipe: get rid of tiled/linear layout remains
Roland Scheidegger [Tue, 28 May 2013 00:34:27 +0000 (02:34 +0200)]
llvmpipe: get rid of tiled/linear layout remains

Eliminate the rest of the no longer needed layout logic.
(It is possible some code could be simplified a bit further still.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agointel: Remove dead intel_drawbuf_region().
Eric Anholt [Fri, 24 May 2013 19:50:11 +0000 (12:50 -0700)]
intel: Remove dead intel_drawbuf_region().

Since the glBitmap() MRT change, it's unused.  There was basically no way
to responsibly use this function since MRT was introduced.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Fix format handling of blit glBitmap()
Eric Anholt [Fri, 24 May 2013 19:48:47 +0000 (12:48 -0700)]
intel: Fix format handling of blit glBitmap()

Any 32-bit format got ARGB8888 handling (including, say, GL_RG1616), and
anything else got 16-bit (including, say, GL_R8), which could potentially
hang the GPU by writing out of bounds.

NOTE: This is a candidate for the stable branches.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Fix MRT handling of glBitmap().
Eric Anholt [Fri, 24 May 2013 19:40:14 +0000 (12:40 -0700)]
intel: Fix MRT handling of glBitmap().

We'd only hit color buffer 0 even if multiple draw buffers were bound.

NOTE: This is a candidate for the stable branches.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Rebuild PBO blit glTexImage() on top of miptrees.
Eric Anholt [Fri, 24 May 2013 18:42:10 +0000 (11:42 -0700)]
intel: Rebuild PBO blit glTexImage() on top of miptrees.

This will ensure that we have resolves if we ever extend this to
glTexSubImage(), and fixes missing image start offset handling.

The texture buffer alloc ended up getting moved up, because we want to
look at the format of the image's actual mt to see if we'll end up
blitting the right thing, in the case of packed depth/stencil uploads.

This is the last caller of intelEmitCopyBlit() on a miptree-wrapped BO.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Rebuild PBO blit glReadPixels() on top of miptrees.
Eric Anholt [Fri, 24 May 2013 18:10:37 +0000 (11:10 -0700)]
intel: Rebuild PBO blit glReadPixels() on top of miptrees.

The previous code was missing depth resolves, that had only been prevented
due to no blitting of Y tiling.  The pair of flip args in the new blit
function means that we can just drop the pack->Invert fallback.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Rework intel_miptree_create_for_region() to wrap a BO.
Eric Anholt [Fri, 24 May 2013 17:54:36 +0000 (10:54 -0700)]
intel: Rework intel_miptree_create_for_region() to wrap a BO.

I needed to do this for the PBO blit cases to use intel_miptree_blit().
But this also actually partially fixes a bug in EGLImage handling: We
can't share regions across contexts, because regions have a refcount that
isn't protected by a mutex, and different contexts can be simulataneously
accessed from multiple threads.  Now we just need to get regions out of
__DRIImage.  There was also a missing use of image->offset in the EGLImage
renderbuffer storage code.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Make a temporary miptree for the blit path of miptree mapping.
Eric Anholt [Thu, 23 May 2013 23:58:58 +0000 (16:58 -0700)]
intel: Make a temporary miptree for the blit path of miptree mapping.

In a bit of debug code, we no longer have the inter-slice x/y to print.
But I think the level/slice is more useful in this case for looking at
what's getting mapped, especially given that INTEL_DEBUG=blit will tell
you the other value.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Make a temporary miptree when doing blit uploads for glTexSubImage().
Eric Anholt [Thu, 23 May 2013 21:16:15 +0000 (14:16 -0700)]
intel: Make a temporary miptree when doing blit uploads for glTexSubImage().

While this is a bit more CPU work, it also is less code to handle this
path, and fixes problems with 32k-pitch textures and missing resolves.

v2: Add error checking in new code.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Extend the force_y_tiling flag to allow forcing no tiling.
Eric Anholt [Thu, 23 May 2013 23:08:22 +0000 (16:08 -0700)]
intel: Extend the force_y_tiling flag to allow forcing no tiling.

For a blit-uploaded temporary, it's faster on current hardware to memcpy
the data into a linear CPU mapping than to go through the GTT.

v2: Turn the not-fully-supported mask into 3 supported enum values.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Paul Berry <stereotype441@gmail.com> (v2)
Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v2)
11 years agointel: Add an assert for glCopyTexSubImage() being called on MSAA buffers.
Eric Anholt [Fri, 24 May 2013 20:37:13 +0000 (13:37 -0700)]
intel: Add an assert for glCopyTexSubImage() being called on MSAA buffers.

This is just in case someone else trips over this due to our weird reuse
of this code in glBlitFramebuffer().

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Allow glCopyTexSubImage() on depth textures.
Eric Anholt [Thu, 23 May 2013 20:40:26 +0000 (13:40 -0700)]
i965: Allow glCopyTexSubImage() on depth textures.

If the hw is pre-gen5 and can't blit depth, it'll cleanly error out.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Prefer blorp glBlitFramebuffer() to the glCopyTexSubImage-based blit.
Eric Anholt [Thu, 23 May 2013 23:43:58 +0000 (16:43 -0700)]
i965: Prefer blorp glBlitFramebuffer() to the glCopyTexSubImage-based blit.

I think we've measured no performance difference from this in the past,
except that the blorp code can do things like multisample resolves.
Prevents piglit regression in the next commit when a testcase started
trying to do a multisampled resolve through the old glCopyTexSubImage()
path.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoi965: Consistently do depth resolves before blitting.
Eric Anholt [Thu, 23 May 2013 20:36:26 +0000 (13:36 -0700)]
i965: Consistently do depth resolves before blitting.

We were protected for a long time by the fact that depth was Y tiled and
you couldn't blit Y.  Now that we can blit Y, we were failing to resolve
depth in glCopyPixels().

Note in the comment about swrast, that the swrast map path does resolves
appropriately already.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Make a wrapper for intelEmitCopyBlit using miptrees.
Eric Anholt [Mon, 4 Feb 2013 22:24:09 +0000 (14:24 -0800)]
intel: Make a wrapper for intelEmitCopyBlit using miptrees.

I had previously asserted that it was hard to write a useful, simpler
blit function, but I think this might be it.

This has the side effect of extending the 32k pitch check to a few more
places that were missing it.

v2: Update comment for being moved inside intel_miptree_blit().

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Rename intel_renderbuffer_tile_offsets.
Eric Anholt [Mon, 4 Feb 2013 22:21:24 +0000 (14:21 -0800)]
intel: Rename intel_renderbuffer_tile_offsets.

This makes it more consistent with intel_miptree_get_tile_offsets().

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Reduce intel_renderbuffer_tile_offsets to a thin wrapper.
Eric Anholt [Mon, 4 Feb 2013 18:05:51 +0000 (10:05 -0800)]
intel: Reduce intel_renderbuffer_tile_offsets to a thin wrapper.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agointel: Make intel_miptree_get_tile_offsets return a page offset.
Eric Anholt [Mon, 4 Feb 2013 18:00:10 +0000 (10:00 -0800)]
intel: Make intel_miptree_get_tile_offsets return a page offset.

Right now, the callers in i965 don't expect a nonzero page offset to
actually occur (since that's being handled elsewhere), but it seems
like a trap to leave it this way.

Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Fix MSVC build.
José Fonseca [Tue, 28 May 2013 12:56:18 +0000 (13:56 +0100)]
glsl: Fix MSVC build.

It appears that `sizeof(Class::member)` is either non-standard or
merely unsupported in MSVC.

So use `sizeof(instance->member)` instead, which is guaranteed to work
everywhere.

Also promote the assert to a static assert.

Trivial.

11 years agomesa: fix GLSL program objects with more than 16 samplers combined
Marek Olšák [Mon, 13 May 2013 13:46:49 +0000 (15:46 +0200)]
mesa: fix GLSL program objects with more than 16 samplers combined

The problem is the sampler units are allocated from the same pool for all
shader stages, so if a vertex shader uses 12 samplers (0..11), the fragment
shader samplers start at index 12, leaving only 4 sampler units
for the fragment shader. The main cause is probably the fact that samplers
(texture unit -> sampler unit mapping, etc.) are tracked globally
for an entire program object.

This commit adapts the GLSL linker and core Mesa such that the sampler units
are assigned to sampler uniforms for each shader stage separately
(if a sampler uniform is used in all shader stages, it may occupy a different
sampler unit in each, and vice versa, an i-th sampler unit may refer to
a different sampler uniform in each shader stage), and the sampler-specific
variables are moved from gl_shader_program to gl_shader.

This doesn't require any driver changes, and it fixes piglit/max-samplers
for gallium and classic swrast. It also works with any number of shader
stages.

v2: - converted tabs to spaces
    - added an assertion to _mesa_get_sampler_uniform_value

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoswrast: increase array size of TextureSample
Marek Olšák [Mon, 13 May 2013 14:24:57 +0000 (16:24 +0200)]
swrast: increase array size of TextureSample

to match the size of ctx->Texture.Unit, and it will also fix
piglit/max-samplers with the following commit.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: declare UniformBufferBindings as an array with a static size
Marek Olšák [Tue, 14 May 2013 15:58:32 +0000 (17:58 +0200)]
mesa: declare UniformBufferBindings as an array with a static size

Some Gallium drivers were crashing, because the array was not large enough.

v2: clamp the per-shader maximum in st/mesa, then sum them all up

NOTE: This is a candidate for the stable branches.

11 years agoradeonsi: Enable GLSL 1.30
Michel Dänzer [Fri, 24 May 2013 14:49:42 +0000 (16:49 +0200)]
radeonsi: Enable GLSL 1.30

11 years agoradeonsi: Handle TGSI TXQ opcode
Michel Dänzer [Mon, 6 May 2013 10:45:14 +0000 (12:45 +0200)]
radeonsi: Handle TGSI TXQ opcode

11 years agoradeonsi: Add support for TGSI TXF opcode
Michel Dänzer [Thu, 2 May 2013 07:44:45 +0000 (09:44 +0200)]
radeonsi: Add support for TGSI TXF opcode

11 years agoradeonsi: Use tgsi_util_get_texture_coord_dim()
Michel Dänzer [Fri, 24 May 2013 12:23:26 +0000 (13:23 +0100)]
radeonsi: Use tgsi_util_get_texture_coord_dim()

11 years agoradeonsi: Handle TGSI_SEMANTIC_CLIPDIST
Michel Dänzer [Thu, 2 May 2013 12:53:17 +0000 (14:53 +0200)]
radeonsi: Handle TGSI_SEMANTIC_CLIPDIST

11 years agoradeonsi: Make border colour state handling safe for integer textures
Michel Dänzer [Wed, 1 May 2013 16:15:36 +0000 (18:15 +0200)]
radeonsi: Make border colour state handling safe for integer textures

11 years agoradeonsi: Fix hardware state for dual source blending
Michel Dänzer [Tue, 30 Apr 2013 14:34:10 +0000 (16:34 +0200)]
radeonsi: Fix hardware state for dual source blending

Set up CB_SHADER_MASK register according to pixel shader exports, and enable
some minimal state for colour buffer 1 in case dual source blending is used.

11 years agor600g/sb: handle more cases for folding in gvn pass
Vadim Girlin [Tue, 28 May 2013 01:24:53 +0000 (05:24 +0400)]
r600g/sb: handle more cases for folding in gvn pass

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agost/vdpau: destroy handle table only when it's empty
Christian König [Thu, 23 May 2013 17:31:08 +0000 (19:31 +0200)]
st/vdpau: destroy handle table only when it's empty

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agost/vdpau: remove vlCreateHTAB from surface functions
Christian König [Thu, 23 May 2013 17:28:57 +0000 (19:28 +0200)]
st/vdpau: remove vlCreateHTAB from surface functions

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agost/vdpau: invalidate the handles on destruction
Christian König [Thu, 23 May 2013 17:17:19 +0000 (19:17 +0200)]
st/vdpau: invalidate the handles on destruction

Fixes a problem with xbmc when switching channels.

Signed-off-by: Christian König <christian.koenig@amd.com>
11 years agor600g/sb: improve folding for SETcc
Vadim Girlin [Mon, 27 May 2013 10:23:47 +0000 (14:23 +0400)]
r600g/sb: improve folding for SETcc

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: optimize CNDcc instructions
Vadim Girlin [Mon, 27 May 2013 11:29:56 +0000 (15:29 +0400)]
r600g/sb: optimize CNDcc instructions

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: improve optimization of conditional instructions
Vadim Girlin [Mon, 27 May 2013 00:00:03 +0000 (04:00 +0400)]
r600g/sb: improve optimization of conditional instructions

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agoilo: enable multiple constant buffers
Chia-I Wu [Mon, 27 May 2013 04:31:01 +0000 (12:31 +0800)]
ilo: enable multiple constant buffers

This effectively enables uniform buffer object support.

11 years agoilo: add support for indirect access of CONST in FS
Chia-I Wu [Mon, 27 May 2013 04:09:33 +0000 (12:09 +0800)]
ilo: add support for indirect access of CONST in FS

Unlike other register files, CONST is read with a message and indirect access
is easier to implement.

11 years agoilo: add support for TBOs on GEN6
Chia-I Wu [Mon, 27 May 2013 04:29:51 +0000 (12:29 +0800)]
ilo: add support for TBOs on GEN6

This hunk was missing in the last commit.

11 years agoilo: advertise supports for pure integer formats
Chia-I Wu [Thu, 23 May 2013 06:02:36 +0000 (14:02 +0800)]
ilo: advertise supports for pure integer formats

For pure integer formats, no filtering nor blending is needed.

11 years agoilo: add support for texture buffer objects
Chia-I Wu [Thu, 23 May 2013 04:50:14 +0000 (12:50 +0800)]
ilo: add support for texture buffer objects

Take care of sampler views that have buffers as the underlying resources.
Update caps related to TBOs.

11 years agotgsi: add buffer texture to tgsi_util_get_texture_coord_dim()
Chia-I Wu [Thu, 23 May 2013 05:24:55 +0000 (13:24 +0800)]
tgsi: add buffer texture to tgsi_util_get_texture_coord_dim()

TGSI_TEXTURE_BUFFER is one-dimensional.  Assert that exec_tex() is never
called with TGSI_TEXTURE_BUFFER.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g/sb: improve handling of KILL instructions
Vadim Girlin [Sun, 26 May 2013 21:37:54 +0000 (01:37 +0400)]
r600g/sb: improve handling of KILL instructions

This patch improves handling of unconditional KILL instructions inside
the conditional blocks, uncovering more opportunities for if-conversion.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix peephole optimization for PRED_SETE
Vadim Girlin [Sun, 26 May 2013 21:41:11 +0000 (01:41 +0400)]
r600g/sb: fix peephole optimization for PRED_SETE

Fixes incorrect condition that prevented optimization for
PRED_SETE/PRED_SETE_INT.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix scheduling of PRED_SET instructions
Vadim Girlin [Sun, 26 May 2013 21:39:54 +0000 (01:39 +0400)]
r600g/sb: fix scheduling of PRED_SET instructions

PRED_SET instructions that update exec mask should be scheduled immediately
prior to the "if-then-else" block, because any instruction that is
inserted after alu clause with PRED_SET and before conditional block is
also conditionally executed by hw (exec mask is already updated at that
moment).

Propbably it's better to make PRED_SET a part of conditional
"if-then-else" block in the IR to handle this more cleanly,
but for now this temporary solution should prevent the problem.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix handling of preloaded inputs for compute shaders
Vadim Girlin [Sat, 25 May 2013 18:56:53 +0000 (22:56 +0400)]
r600g/sb: fix handling of preloaded inputs for compute shaders

For compute shaders we need to let the backend know that
GPRs 0 and 1 are preloaded with some compute-specific input
values, otherwise any use of these regs without previous
definition is considered as undefined value and usually
is simply replaced with 0.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agoxlib: add null ctx check in glXDestroyContext()
Brian Paul [Fri, 24 May 2013 14:06:19 +0000 (08:06 -0600)]
xlib: add null ctx check in glXDestroyContext()

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64934
NOTE: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agost/glx: add null ctx check in glXDestroyContext()
Brian Paul [Fri, 24 May 2013 14:06:04 +0000 (08:06 -0600)]
st/glx: add null ctx check in glXDestroyContext()

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64934
NOTE: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agost/mesa: add switch cases for new IR enums to silence warnings
Brian Paul [Thu, 23 May 2013 15:33:19 +0000 (09:33 -0600)]
st/mesa: add switch cases for new IR enums to silence warnings

11 years agost/glx/xlib: assorted whitespace, comment fixes
Brian Paul [Tue, 21 May 2013 20:11:42 +0000 (14:11 -0600)]
st/glx/xlib: assorted whitespace, comment fixes

11 years agor600g/sb: fix incorrect assert
Vadim Girlin [Fri, 24 May 2013 15:07:27 +0000 (19:07 +0400)]
r600g/sb: fix incorrect assert

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: relax some restrictions for FETCH instructions
Vadim Girlin [Fri, 24 May 2013 14:15:57 +0000 (18:15 +0400)]
r600g/sb: relax some restrictions for FETCH instructions

This allows GVN rewrite pass to propagate non-const (register)
values to FETCH source operands, helping to eliminate unnecessary
copies in some cases.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: relax register allocation for compute shaders
Vadim Girlin [Fri, 24 May 2013 14:07:55 +0000 (18:07 +0400)]
r600g/sb: relax register allocation for compute shaders

We have to assume that all GPRs in compute shader can be indirectly
addressed because LLVM backend doesn't provide any indirect array info.
That's why for compute shaders GPR array is created that covers all used
GPRs (0..r600_bytecode::ngpr-1), but this seriously restricts register
allocation in sb.

This patch checks for actual use of indirect access in the shader and
if it's not used then GPR array is not created, so that regalloc is not
unnecessarily restricted.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix gpr array handling for compute shaders
Vadim Girlin [Fri, 24 May 2013 12:45:58 +0000 (16:45 +0400)]
r600g/sb: fix gpr array handling for compute shaders

Fixes segfault with bfgminer and R600_DEBUG=sbcl.

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/sb: fix buffer overflow in sb_ostream
Vadim Girlin [Fri, 24 May 2013 12:24:09 +0000 (16:24 +0400)]
r600g/sb: fix buffer overflow in sb_ostream

Fixes segfault during bytecode dump with bfgminer kernel

Signed-off-by: Vadim Girlin <vadimgirlin@gmail.com>
11 years agor600g/compute: Use common transfer_{map,unmap} functions for global resources
Tom Stellard [Tue, 14 May 2013 15:56:25 +0000 (08:56 -0700)]
r600g/compute: Use common transfer_{map,unmap} functions for global resources

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor600g/compute: Use common transfer_{map,unmap} functions for kernel inputs
Tom Stellard [Tue, 14 May 2013 15:56:25 +0000 (08:56 -0700)]
r600g/compute: Use common transfer_{map,unmap} functions for kernel inputs

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965: Go back to using the kernel SOL reset feature.
Kenneth Graunke [Fri, 24 May 2013 03:19:19 +0000 (20:19 -0700)]
i965: Go back to using the kernel SOL reset feature.

It turns out the MI_LOAD_REGISTER_IMM approach doesn't work on Haswell,
and regressed essentially all the transform feedback Piglit tests.

This morally reverts eaa6fbe6d54dc99efac4ab8e800edef65ce8220d.  However,
the code is still simpler than it was.  On BeginTransformFeedback, we
simply flush the batch and set the SOL reset flag so that the next batch
will start with zeroed offsets.  There's still no software counting.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64887
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agofreedreno: scissor fix
Rob Clark [Wed, 15 May 2013 00:05:55 +0000 (20:05 -0400)]
freedreno: scissor fix

Don't assume the state-tracker will set the scissor after the
framebuffer state is changed.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno: implement pipe->resource_copy_region()
Rob Clark [Tue, 14 May 2013 17:57:06 +0000 (13:57 -0400)]
freedreno: implement pipe->resource_copy_region()

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agoglsl linker: compare interface blocks during interstage linking
Kenneth Graunke [Tue, 21 May 2013 06:46:16 +0000 (23:46 -0700)]
glsl linker: compare interface blocks during interstage linking

Verify that interface blocks match when linking separate shader
stages into a program.

Fixes piglit glsl-1.50 tests:
* linker/interface-blocks-vs-fs-member-count-mismatch.shader_test
* linker/interface-blocks-vs-fs-member-order-mismatch.shader_test

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoglsl linker: compare interface blocks during intrastage linking
Jordan Justen [Tue, 21 May 2013 06:42:49 +0000 (23:42 -0700)]
glsl linker: compare interface blocks during intrastage linking

Verify that interface blocks match when combining compilation
units at the same stage. (For example, when merging all vertex
shaders.)

Fixes piglit glsl-1.50 test:
* linker/interface-blocks-multiple-vs-member-count-mismatch.shader_test

v5 (Ken): Rename to link_interface_blocks.cpp and drop the separate .h
file for consistency with other linker code.  Remove "ok" variable.
Fold cross_validate_interface_blocks into its caller.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl linker: support arrays of interface block instances
Jordan Justen [Sun, 17 Mar 2013 09:04:56 +0000 (02:04 -0700)]
glsl linker: support arrays of interface block instances

With this change we now support interface block arrays.
For example, cases like this:

out block_name {
    float f;
} block_instance[2];

This allows Mesa to pass the piglit glsl-1.50 test:
* execution/interface-blocks-complex-vs-fs.shader_test

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl link_varyings: link interface blocks using the block name
Jordan Justen [Sun, 10 Mar 2013 10:48:53 +0000 (03:48 -0700)]
glsl link_varyings: link interface blocks using the block name

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl linker: remove interface block instance names
Jordan Justen [Sun, 10 Mar 2013 10:20:03 +0000 (03:20 -0700)]
glsl linker: remove interface block instance names

Convert interface blocks with instance names into flat
interface blocks without an instance name.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl ast_to_hir: support in/out for interface blocks
Jordan Justen [Sun, 10 Mar 2013 00:34:55 +0000 (16:34 -0800)]
glsl ast_to_hir: support in/out for interface blocks

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl ast_to_hir: reject row/column_major for in/out interface blocks
Jordan Justen [Sun, 24 Mar 2013 00:16:28 +0000 (17:16 -0700)]
glsl ast_to_hir: reject row/column_major for in/out interface blocks

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl ast_to_hir: move uniform block symbols to interface blocks namespace
Jordan Justen [Thu, 21 Mar 2013 18:10:04 +0000 (11:10 -0700)]
glsl ast_to_hir: move uniform block symbols to interface blocks namespace

Uniform/interface blocks are a separate namespace from types.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl_symbol_table: add interface block namespaces
Jordan Justen [Thu, 21 Mar 2013 16:57:20 +0000 (09:57 -0700)]
glsl_symbol_table: add interface block namespaces

For interface blocks, there are three separate namespaces for
uniform, input and output blocks.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: allow in & out for interface block members
Jordan Justen [Sat, 9 Mar 2013 22:52:14 +0000 (14:52 -0800)]
glsl parser: allow in & out for interface block members

Previously uniform blocks allowed for the 'uniform' keyword
to be used with members of a uniform blocks. With interface
blocks 'in' can be used on 'in' interface block members and
'out' can be used on 'out' interface block members.

The basic_interface_block rule will verify that the same
qualifier type is used with the block and each member.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl ast_to_hir: reject interpolation qualifiers for uniform blocks
Jordan Justen [Sun, 24 Mar 2013 00:14:37 +0000 (17:14 -0700)]
glsl ast_to_hir: reject interpolation qualifiers for uniform blocks

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: handle interface block member qualifier
Jordan Justen [Thu, 21 Mar 2013 17:52:19 +0000 (10:52 -0700)]
glsl parser: handle interface block member qualifier

An interface block member may specify the type:
in {
    in vec4 in_var_with_qualifier;
};

When specified with the member, it must match the same
type as interface block type.

It can also omit the qualifier:
uniform {
    vec4 uniform_var_without_qualifier;
};

When the type is not specified with the member,
it will adopt the same type as the interface block.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: on desktop GL require GLSL 150 for instance names
Jordan Justen [Sat, 9 Mar 2013 22:09:30 +0000 (14:09 -0800)]
glsl parser: on desktop GL require GLSL 150 for instance names

Interface blocks in GLSL 150 allow an instance name to be used.

v2:
 * use state->check_version

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: reject VS+in & FS+out interface blocks
Jordan Justen [Sat, 9 Mar 2013 21:01:13 +0000 (13:01 -0800)]
glsl parser: reject VS+in & FS+out interface blocks

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: parse in/out types for interface blocks
Jordan Justen [Sat, 9 Mar 2013 19:36:11 +0000 (11:36 -0800)]
glsl: parse in/out types for interface blocks

Previously only 'uniform' was allowed for uniform blocks.

Now, in/out can be parsed, but it will only be allowed for
GLSL >= 150.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl parser: rename uniform block to interface block
Jordan Justen [Sat, 9 Mar 2013 19:00:59 +0000 (11:00 -0800)]
glsl parser: rename uniform block to interface block

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: rename ast_uniform_block to ast_interface_block
Jordan Justen [Sat, 9 Mar 2013 18:40:41 +0000 (10:40 -0800)]
glsl: rename ast_uniform_block to ast_interface_block

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Enable guardband clipping on Gen4/5.
Chris Forbes [Sun, 19 May 2013 08:44:29 +0000 (20:44 +1200)]
i965: Enable guardband clipping on Gen4/5.

Enables guardband clipping when the viewport covers the entire render
target.

No piglit regressions on Ironlake.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoARB_fp: accept duplicate precision options
Chris Forbes [Thu, 16 May 2013 09:21:05 +0000 (21:21 +1200)]
ARB_fp: accept duplicate precision options

Relaxes the validation of

   OPTION ARB_precision_hint_{nicest,fastest};

to allow duplicate options. The spec says that both /nicest/ and
/fastest/ cannot be specified together, but could be interpreted
either way for respecification of the same option.

Other drivers (NVIDIA etc) accept this, and at least one Unity3D game
expects it to succeed (Kerbal Space Program).

V2: Add spec quote.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoilo: Initialize need_flush in draw_vbo.
Vinson Lee [Thu, 23 May 2013 06:24:35 +0000 (23:24 -0700)]
ilo: Initialize need_flush in draw_vbo.

need_flush was uninitialized if hw3d->new_batch was true.

Fixes "Uninitialized scalar variable" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
11 years agoradeon: Initialize variables in radeon_llvm_context_init.
Vinson Lee [Sat, 18 May 2013 07:21:52 +0000 (00:21 -0700)]
radeon: Initialize variables in radeon_llvm_context_init.

'type' was not fully initialized when calling lp_build_context_init.

Fixes "Uninitialized scalar variable" defect reported by Coverity.

NOTE: This is a candidate for the stable branches.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agointel: Count fragments in our blitter-based glBitmap() path.
Eric Anholt [Tue, 21 May 2013 23:20:18 +0000 (16:20 -0700)]
intel: Count fragments in our blitter-based glBitmap() path.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59440
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Shut up more compiler warnings from vector insert/extract changes.
Eric Anholt [Wed, 22 May 2013 00:39:58 +0000 (17:39 -0700)]
i965: Shut up more compiler warnings from vector insert/extract changes.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agosoftpipe: change TEX_TILE_SIZE and NUM_TEX_TILE_ENTRIES
Roland Scheidegger [Wed, 22 May 2013 20:55:21 +0000 (22:55 +0200)]
softpipe: change TEX_TILE_SIZE and NUM_TEX_TILE_ENTRIES

Initially we had NUM_TEX_TILE_ENTRIES of 50, however this was using too much
memory (mostly because the tile cache is operating on fixed max current
sampler views which could be fixed but that's another topic). So it was
decreased to 4. However this is a ridiculously low number which can't
actually really work (the number of tiles needed for as little as
a single quad with linear_mipmap_linear is 2 to 8 for a 2d texture, and
4 to 16 for a 3d texture), as it just about guarantees there will be
cache thrashing sometimes (just about always for 3d textures in fact, since
while there are 4 entries the cache is direct mapped).
So increase that number to 16 (which is still on the low side for direct
mapped cache though I guess using something like 4-way associativity would
be more effective than increasing this further) which has at least some good
chance to avoid thrashing. Since we don't want to increase memory requirements
however in turn decrease the tile size accordingly from 64 to 32 (as a bonus
point this also decreases the cost of texture thrashing which might still
happen sometimes).
I've seen performance improvement in the order of factor ~200 (specifically,
drawing the first frame from the replay from bug 41787 needs "only" ~10s
instead of ~30min, meaning I can actually compare the output with other
drivers...) with this.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosoftpipe: disambiguate TILE_SIZE / TEX_TILE_SIZE
Roland Scheidegger [Wed, 22 May 2013 00:13:02 +0000 (02:13 +0200)]
softpipe: disambiguate TILE_SIZE / TEX_TILE_SIZE

These can be different (just like NUM_TEX_TILE_ENTRIES / NUM_ENTRIES),
though currently they aren't.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: disable simple_shader optimization
Roland Scheidegger [Wed, 22 May 2013 20:47:59 +0000 (22:47 +0200)]
llvmpipe: disable simple_shader optimization

This optimization disabled mask checks if the shader is simple enough.
While this should work correctly, the problem is that it can hide real issues
because shaders in practice are usually complex enough (8 instructions or 1
texture is already enough) so this doesn't get used, whereas dumbed-down
tests which should hit all the same code paths suddenly do something quite
different. This was the reason that bug 41787 could not be easily tracked as
stencil test not working correctly (piglit would in fact have failed some
tests without that optimization).
So disable it for now, it's unclear if it's much of a win in any case.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix early depth test / late depth write stencil issues
Roland Scheidegger [Tue, 21 May 2013 21:57:33 +0000 (23:57 +0200)]
llvmpipe: fix early depth test / late depth write stencil issues

We actually did early depth/stencil test and late depth/stencil write even
when the shader could kill the fragment (alpha test or discard). Since it
matters for the new stencil value if the fragment is killed by depth/stencil
test or by the shader (in which case it will not reach the depth/stencil
test) this simply cannot work (we also would possibly skip writing the new
stencil value due to mask checks but this is a secondary issue).
So use late depth test / late depth write instead in this case.
(No piglit changes as it doesn't seem to hit such bogus early depth test
/ late depth write path.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix issue with not writing new stencil values
Roland Scheidegger [Wed, 22 May 2013 20:42:11 +0000 (22:42 +0200)]
llvmpipe: fix issue with not writing new stencil values

We did mask checks between depth/stencil testing and depth/stencil write.
This meant that if the depth/stencil test killed off all fragments we never
actually wrote the new stencil value. This issue affected all early/late
test/write combinations.
So move the mask check after depth/stencil write (for early depth test,
could do the same for late depth test but might not be worth it at that
point so just skip it there).
This addresses https://bugs.freedesktop.org/show_bug.cgi?id=41787.
Piglit does not hit this issue because of the simple_shader optimization
in generate_fs_loop() which means we're skipping the mask checks.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: (trivial) remove confusing code in stencil test
Roland Scheidegger [Tue, 21 May 2013 21:10:53 +0000 (23:10 +0200)]
llvmpipe: (trivial) remove confusing code in stencil test

This was meant to disable some code which isn't needed when depth/stencil
isn't written. However, there's more code which wouldn't be needed in that
case so having the condition there was just odd (llvm will drop all the code
anyway).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix bug in early depth test / late depth write handling
Roland Scheidegger [Tue, 21 May 2013 20:51:15 +0000 (22:51 +0200)]
llvmpipe: fix bug in early depth test / late depth write handling

Using wrong type if the format was less than 32bits.
No piglit changes as it doesn't hit that path.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoHaiku: Add Gallium winsys and target code
Alexander von Gluck IV [Tue, 21 May 2013 20:55:24 +0000 (15:55 -0500)]
Haiku: Add Gallium winsys and target code

* We generate a static library for Haiku
  Gallium targets as our port system combines
  the compiled rendering code into a modular
  ar for each module (for example, our port
  system combines llvm libsoftpipe.a libllvmpipe.a
  into a single ar for the Haiku build system.
  I'd like the Gallium hgl target scons build
  system to do this some day, however how is
  beyond me at the moment. This is a first step.

11 years agoilo: set more fields of 3DSTATE_DEPTH_BUFFER
Chia-I Wu [Wed, 22 May 2013 04:19:13 +0000 (12:19 +0800)]
ilo: set more fields of 3DSTATE_DEPTH_BUFFER

Set lod/layer related fields of 3DSTATE_DEPTH_BUFFER.  Since we always point
to a single level/layer, those fields are always zero and this commit
effectively makes no change.

While at it, make it easier to disable manual slice offset calculation.

11 years agoilo: correctly set view extent in SURFACE_STATE
Chia-I Wu [Wed, 22 May 2013 05:00:30 +0000 (13:00 +0800)]
ilo: correctly set view extent in SURFACE_STATE

The view extent was set to be the same as the depth while it should be set to
the number of layers.  It makes a difference for 3D textures.

Also use this as a chance to clean up the code.

11 years agoilo: avoid unnecessary emission of SO states
Chia-I Wu [Wed, 22 May 2013 07:33:15 +0000 (15:33 +0800)]
ilo: avoid unnecessary emission of SO states

No need to emit 3DSTATE_SO_BUFFER and 3DSTATE_SO_DECL_LIST when SO is
disabled.  As the implicit flush done by the commands is also gone, emit an
explicit flush.

11 years agoi965: Skip etc-to-rgb transcode on BayTrail.
Eric Anholt [Tue, 21 May 2013 21:55:31 +0000 (14:55 -0700)]
i965: Skip etc-to-rgb transcode on BayTrail.

The hardware does it, so no need for this workaround.

Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Remove extension checking from ChooseTexFormat.
Eric Anholt [Thu, 21 Mar 2013 16:50:45 +0000 (09:50 -0700)]
mesa: Remove extension checking from ChooseTexFormat.

This should already be handled by _mesa_base_tex_format() calls in
TexImage*.

11 years agomesa: Add ChooseTexFormat support for the new XBGR formats.
Eric Anholt [Thu, 21 Mar 2013 16:45:20 +0000 (09:45 -0700)]
mesa: Add ChooseTexFormat support for the new XBGR formats.

11 years agoi965: Split BeginTransformFeedback hook into Gen6 and Gen7+ variants.
Kenneth Graunke [Mon, 20 May 2013 22:25:28 +0000 (15:25 -0700)]
i965: Split BeginTransformFeedback hook into Gen6 and Gen7+ variants.

Most of the work in BeginTransformFeedback is only necessary on Gen6.
We may as well just skip it on Gen7+.

v2: Add an intel->gen == 6 assert.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Paul Berry <stereotype441@gmail.com>