mesa.git
10 years agoi965: Move intel_context::driContext to brw_context.
Kenneth Graunke [Thu, 4 Jul 2013 17:30:01 +0000 (10:30 -0700)]
i965: Move intel_context::driContext to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::NewGLState to brw_context.
Kenneth Graunke [Thu, 4 Jul 2013 17:29:50 +0000 (10:29 -0700)]
i965: Move intel_context::NewGLState to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::upload to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:46:44 +0000 (14:46 -0700)]
i965: Move intel_context::upload to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::max_gtt_map_object_size to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:44:07 +0000 (14:44 -0700)]
i965: Move intel_context::max_gtt_map_object_size to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::perf_debug to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:41:58 +0000 (14:41 -0700)]
i965: Move intel_context::perf_debug to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::no_batch_wrap to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:29:56 +0000 (14:29 -0700)]
i965: Move intel_context::no_batch_wrap to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context's framerate throttling fields to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:28:29 +0000 (14:28 -0700)]
i965: Move intel_context's framerate throttling fields to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::stats_wm to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:26:01 +0000 (14:26 -0700)]
i965: Move intel_context::stats_wm to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::batch to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:21:19 +0000 (14:21 -0700)]
i965: Move intel_context::batch to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::hw_ctx to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:12:41 +0000 (14:12 -0700)]
i965: Move intel_context::hw_ctx to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::bufmgr to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 21:09:51 +0000 (14:09 -0700)]
i965: Move intel_context::bufmgr to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context's driconf flags to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 20:54:53 +0000 (13:54 -0700)]
i965: Move intel_context's driconf flags to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::reduced_primitive to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 18:55:59 +0000 (11:55 -0700)]
i965: Move intel_context::reduced_primitive to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move front buffer rendering fields from intel_context to brw.
Kenneth Graunke [Wed, 3 Jul 2013 18:37:51 +0000 (11:37 -0700)]
i965: Move front buffer rendering fields from intel_context to brw.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::vtbl to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 18:14:56 +0000 (11:14 -0700)]
i965: Move intel_context::vtbl to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move intel_context::optionCache to brw_context.
Kenneth Graunke [Wed, 3 Jul 2013 17:57:11 +0000 (10:57 -0700)]
i965: Move intel_context::optionCache to brw_context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Pass brw_context to functions rather than intel_context.
Kenneth Graunke [Wed, 3 Jul 2013 06:17:14 +0000 (23:17 -0700)]
i965: Pass brw_context to functions rather than intel_context.

This makes brw_context available in every function that used
intel_context.  This makes it possible to start migrating fields from
intel_context to brw_context.

Surprisingly, this actually removes some code, as functions that use
OUT_BATCH don't need to declare "intel"; they just use "brw."

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Remove pointless intel_context parameter from try_copy_propagate.
Kenneth Graunke [Wed, 3 Jul 2013 07:49:28 +0000 (00:49 -0700)]
i965: Remove pointless intel_context parameter from try_copy_propagate.

It's already part of the visitor class.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Add forward declarations of brw_context to a few places.
Kenneth Graunke [Wed, 3 Jul 2013 06:15:53 +0000 (23:15 -0700)]
i965: Add forward declarations of brw_context to a few places.

These files have forward declarations for intel_context.  This makes
brw_context available in the same places without further #include
monkeying.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Replace #include "intel_context.h" with brw_context.h.
Kenneth Graunke [Wed, 3 Jul 2013 01:56:43 +0000 (18:56 -0700)]
i965: Replace #include "intel_context.h" with brw_context.h.

brw_context.h includes intel_context.h, but additionally makes the
brw_context structure available.  Switching this allows us to start
using brw_context in more places.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Move ctx->Const setup from intelInitContext to the new helper.
Kenneth Graunke [Wed, 3 Jul 2013 01:05:48 +0000 (18:05 -0700)]
i965: Move ctx->Const setup from intelInitContext to the new helper.

This also requires moving _mesa_init_point() to after the ctx->Const
initialization.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Split code to set ctx->Const values into a helper function.
Kenneth Graunke [Wed, 3 Jul 2013 00:57:42 +0000 (17:57 -0700)]
i965: Split code to set ctx->Const values into a helper function.

brwCreateContext() has a lot of random things to do.  Factoring out the
part that initializes ctx->Const values and shader compiler options
makes the main function a bit easier to read.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi915: Remove i965+ chip names.
Kenneth Graunke [Thu, 4 Jul 2013 18:46:51 +0000 (11:46 -0700)]
i915: Remove i965+ chip names.

i965+ chipsets shouldn't ever hit this driver.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Remove i915 chip names.
Kenneth Graunke [Thu, 4 Jul 2013 18:46:07 +0000 (11:46 -0700)]
i965: Remove i915 chip names.

i915 chipsets shouldn't ever hit this driver.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Replace intel_context:needs_ff_sync with intel->gen == 5.
Kenneth Graunke [Thu, 4 Jul 2013 18:26:54 +0000 (11:26 -0700)]
i965: Replace intel_context:needs_ff_sync with intel->gen == 5.

Technically, needs_ff_sync was set on Gen5+, but it was only consulted
in the clipper threads and quad/lineloop decomposition code, which are
both Gen4-5 only.  So in reality it only identified Ironlake.

The named flag doesn't really clarify things, and seems like overkill.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Paul Berry <stereotype441@gmail.com>
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965: Add missing newline to blorp color clear perf_debug message.
Kenneth Graunke [Tue, 9 Jul 2013 17:09:57 +0000 (10:09 -0700)]
i965: Add missing newline to blorp color clear perf_debug message.

perf_debug() doesn't add a newline for you; without this, all the
INTEL_DEBUG=perf output was jumbled together.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Silence unused variable warning in the release build
Emil Velikov [Mon, 8 Jul 2013 17:30:44 +0000 (18:30 +0100)]
glsl: Silence unused variable warning in the release build

Resolves the following gcc warning

 opt_flip_matrices.cpp:84:32: warning: unused variable 'deref'

v2: keep the variable, but wrap it in a ifndef NDEBUG block
    (suggested by Ian)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl/ast: Silence uninitialized variable warnings in the release build
Emil Velikov [Mon, 8 Jul 2013 17:29:17 +0000 (18:29 +0100)]
glsl/ast: Silence uninitialized variable warnings in the release build

Resolves the following gcc warnings

 warning: 'iface_type_name' may be used uninitialized in this function
 warning: 'var_mode' may be used uninitialized in this function

Note: The variables are initialised to UNKNOWN and ir_var_auto

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Add an assertion to brwProgramStringNotify.
Paul Berry [Tue, 2 Jul 2013 15:02:47 +0000 (08:02 -0700)]
i965: Add an assertion to brwProgramStringNotify.

driver->ProgramStringNotify is only called for ARB programs, fixed
function vertex programs, and ir_to_mesa (which isn't used by the i965
back-end).  Therefore, even after geometry shaders are added,
brwProgramStringNotify should only ever be called with a target of
GL_VERTEX_PROGRAM_ARB or GL_FRAGMENT_PROGRAM_ARB.

This patch adds an assertion to clarify that.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Allow non-constant expression initializers of const-qualified vars.
Matt Turner [Thu, 23 May 2013 18:48:40 +0000 (11:48 -0700)]
glsl: Allow non-constant expression initializers of const-qualified vars.

Required by ARB_shading_language_420pack.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agor600g: improve the mechanism for recognizing an empty CS
Marek Olšák [Sun, 30 Jun 2013 16:29:17 +0000 (18:29 +0200)]
r600g: improve the mechanism for recognizing an empty CS

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: explicitly flush caches for streamout-based buffer copying & clearing
Marek Olšák [Mon, 1 Jul 2013 00:31:22 +0000 (02:31 +0200)]
r600g: explicitly flush caches for streamout-based buffer copying & clearing

It's done automatically for vertex buffers, but not for constant buffers,
textures, and colorbuffers.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: only flush the caches that need to be flushed during CP DMA operations
Marek Olšák [Sun, 30 Jun 2013 17:57:59 +0000 (19:57 +0200)]
r600g: only flush the caches that need to be flushed during CP DMA operations

This should increase performance if constant uploads are done with the CP DMA,
because only the cache that needs to be flushed is flushed.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: split INVAL_READ_CACHES into vertex, tex, and const cache flags
Marek Olšák [Sun, 30 Jun 2013 15:01:24 +0000 (17:01 +0200)]
r600g: split INVAL_READ_CACHES into vertex, tex, and const cache flags

also flushing any cache in evergreen_emit_cs_shader seems to be superfluous
(we don't flush caches when changing the other shaders either)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: adjust flush flags (v3)
Alex Deucher [Sun, 23 Jun 2013 17:36:42 +0000 (13:36 -0400)]
r600g: adjust flush flags (v3)

1. flush SH with read caches
2. add flag for DB flushes
3. add flag for CB flushes

v2: flush all CBs, remove redundant emit_state variable.
v3: Marek: also set the new flags in r600_context_flush, the CP dma functions,
    and texture_barrier, and rename them

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: don't call buffer_wait in buffer_mmap_sync_with_rings
Marek Olšák [Sun, 30 Jun 2013 12:57:17 +0000 (14:57 +0200)]
r600g: don't call buffer_wait in buffer_mmap_sync_with_rings

The winsys should do this, because it measures how much time we spend
in buffer_map doing synchronization, which can be viewed with the gallium
HUD.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: don't read back the MSAA depth buffer if the read flag is not set
Marek Olšák [Sun, 30 Jun 2013 12:55:06 +0000 (14:55 +0200)]
r600g: don't read back the MSAA depth buffer if the read flag is not set

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: don't flush the context in texture_transfer_map
Marek Olšák [Sun, 30 Jun 2013 12:53:03 +0000 (14:53 +0200)]
r600g: don't flush the context in texture_transfer_map

the winsys does this automatically

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: fix texture offset computation for mapped MSAA depth buffers
Marek Olšák [Sun, 30 Jun 2013 12:34:23 +0000 (14:34 +0200)]
r600g: fix texture offset computation for mapped MSAA depth buffers

It was wrong, because the offset shouldn't be applied to MSAA depth buffers.
This small cleanup should prevent such issues in the future.

This fixes a lockup in "piglit/fbo-depthstencil default_fb -samples=n".

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: fix color resolve for RGBX8 and RGBX16 integer formats
Marek Olšák [Mon, 1 Jul 2013 00:36:37 +0000 (02:36 +0200)]
r600g: fix color resolve for RGBX8 and RGBX16 integer formats

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: enable fast MSAA color clear for array/3D/cube textures
Marek Olšák [Mon, 1 Jul 2013 00:29:50 +0000 (02:29 +0200)]
r600g: enable fast MSAA color clear for array/3D/cube textures

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600g: implement fast MSAA color clear for integer textures
Marek Olšák [Mon, 1 Jul 2013 00:57:21 +0000 (02:57 +0200)]
r600g: implement fast MSAA color clear for integer textures

this also fixes the fast clear with multiple colorbuffers and each having
a different format

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
10 years agor600/uvd: fix check for UVD 2.x
Christian König [Mon, 8 Jul 2013 17:51:20 +0000 (19:51 +0200)]
r600/uvd: fix check for UVD 2.x

Signed-off-by: Christian König <christian.koenig@amd.com>
10 years agoi965: fix alpha test for MRT
Chris Forbes [Mon, 1 Jul 2013 11:30:55 +0000 (23:30 +1200)]
i965: fix alpha test for MRT

Include src0 alpha in the RT write message when using MRT, so it is used
for the alpha test instead of the normal per-RT alpha value.

Fixes broken rendering in Dota2 under Wine [FDO #62647].

No Piglit regressions on Ivybridge.

V2: reuse (and simplify) existing sample_alpha_to_coverage flag in
the FS key, rather than adding another redundant one.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewd-by: Paul Berry <stereotype441@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62647
NOTE: This is a candidate for the stable branches.

10 years agogallivm: (trivial) fix using one lod instead of per-quad lod for texel fetch
Roland Scheidegger [Fri, 5 Jul 2013 16:06:17 +0000 (18:06 +0200)]
gallivm: (trivial) fix using one lod instead of per-quad lod for texel fetch

The logic for choosing number of lods was bogus.
(The code should ultimately handle the case of only one lod even with multiple
quads but currently can't.)

10 years agogallivm: Remove bogus assert.
José Fonseca [Fri, 5 Jul 2013 13:34:34 +0000 (14:34 +0100)]
gallivm: Remove bogus assert.

It is perfectly valid for the swizzle to be bigger than 2. For example the
texel offsets could be

  SAMPLE ..., IMM[0].zzz

What is not correct is for chan_index to be bigger than 2.

Trivial.

10 years agonvc0: enable very initial support for nvf0 (GK110)
Ben Skeggs [Fri, 17 May 2013 04:48:15 +0000 (14:48 +1000)]
nvc0: enable very initial support for nvf0 (GK110)

Shaders need a lot of work still.  Basic stuff generally works, so this
is basically just fine for gnome-shell, OA etc at this point.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agogallivm: (trivial) fix bogus assertion for per-element lod with 1d resources
Roland Scheidegger [Thu, 4 Jul 2013 23:18:24 +0000 (01:18 +0200)]
gallivm: (trivial) fix bogus assertion for per-element lod with 1d resources

The assertion was always broken but the code unused until enabling the
per-element lod code. Fixes piglit texelFetch vs isampler1D and similar
tests (only run with GL 3.0 version override).

10 years agogallivm: do per-pixel lod calculations for explicit lod
Roland Scheidegger [Thu, 4 Jul 2013 17:40:11 +0000 (19:40 +0200)]
gallivm: do per-pixel lod calculations for explicit lod

d3d10 requires per-pixel lod calculations for explicit lod, lod bias and
explicit derivatives, and we should probably do it for OpenGL too - at least
if they are used from vertex or geometry shaders (so doesn't apply to lod
bias) this doesn't just affect neighboring pixels.
Some code was already there to handle this so fix it up and enable it.
There will no doubt be a performance hit unfortunately, we could do better
if we'd knew we had a real vector shift instruction (with variable shift
count) but this requires AVX2 on x86 (or a AMD Bulldozer family cpu).
Don't do anything for lod bias and explicit derivatives yet, though
no special magic should be needed for them neither.
Likewise, the size query is still broken just the same.

v2: Use information if lod is a (broadcast) scalar or not. The idea would be
to base this on the actual value, for now just pretend it's a scalar in fs
and not a scalar otherwise (so, per-pixel lod is only used in gs/vs but same
code is generated for fs as before).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
10 years agodraw: fix overflows in the indexed rendering paths
Zack Rusin [Wed, 3 Jul 2013 03:56:59 +0000 (23:56 -0400)]
draw: fix overflows in the indexed rendering paths

The semantics for overflow detection are a bit tricky with
indexed rendering. If the base index in the elements array
overflows, then the index of the first element should be used,
if the index with bias overflows then it should be treated
like a normal overflow. Also overflows need to be checked for
in all paths that either the bias, or the starting index location.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agodraw/llvm: index overflows if it's greater than elt max
Zack Rusin [Wed, 3 Jul 2013 01:52:55 +0000 (21:52 -0400)]
draw/llvm: index overflows if it's greater than elt max

The comparison, incorrectly, was greater-than-or-equal to
elt max.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoi965: Move the rest of intel_tex_layout.c into brw_tex_layout.c.
Kenneth Graunke [Tue, 2 Jul 2013 22:53:35 +0000 (15:53 -0700)]
i965: Move the rest of intel_tex_layout.c into brw_tex_layout.c.

The texture alignment unit functions are called from brw_tex_layout.c,
so it makes sense to put them there.  Since the only caller of
intel_get_texture_alignment_unit() is in brw_tex_layout.c, it could be
made into a static function.  However, this patch instead simply folds
it into the caller, as it's only two lines anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Push intel_get_texture_alignment_unit call into brw_miptree_layout
Kenneth Graunke [Tue, 2 Jul 2013 22:06:10 +0000 (15:06 -0700)]
i965: Push intel_get_texture_alignment_unit call into brw_miptree_layout

intel_miptree_create_layout() calls intel_get_texture_alignment_unit()
and then immediately calls brw_miptree_layout().  There are no other
callers.

intel_get_texture_alignment_unit() populates the miptree's alignment
unit fields, which are used by brw_miptree_layout() to determine where
to place each miplevel.  Since brw_miptree_layout() needs those to be
present, it makes sense to have it initialize them as the first step.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Declare for-loop counters in the loop in brw_tex_layout.c.
Kenneth Graunke [Fri, 28 Jun 2013 22:56:22 +0000 (15:56 -0700)]
i965: Declare for-loop counters in the loop in brw_tex_layout.c.

The driver is compiled in C99 mode, so this is not a problem.  It's
slighlty tidier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Remove use of GLuint/GLint in brw_tex_layout.c.
Kenneth Graunke [Fri, 28 Jun 2013 22:49:20 +0000 (15:49 -0700)]
i965: Remove use of GLuint/GLint in brw_tex_layout.c.

Using GL types is silly; this isn't even remotely API-facing.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Tidy the brw_tex_layout.c copyright and file header comments.
Kenneth Graunke [Fri, 28 Jun 2013 22:47:28 +0000 (15:47 -0700)]
i965: Tidy the brw_tex_layout.c copyright and file header comments.

This uses Doxygen style for the file comments, and generally makes it
more consistent with the rest of the driver.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Move i945_texture_layout_2d to brw_tex_layout.c
Kenneth Graunke [Fri, 28 Jun 2013 22:25:12 +0000 (15:25 -0700)]
i965: Move i945_texture_layout_2d to brw_tex_layout.c

This consolidates the miptree layout logic in a single file.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Remove fallthrough for Gen4 cube map layout.
Kenneth Graunke [Fri, 28 Jun 2013 22:06:47 +0000 (15:06 -0700)]
i965: Remove fallthrough for Gen4 cube map layout.

Now that both 2DArray and Cube layouts are taken care of by helper
functions, it's easy to just call the right function for each
generation.  This is a little cleaner than falling through.

This also reworks the comments.  Referencing "Volume 1" of the BSpec
isn't very helpful, since that's only available inside Intel, and it
doesn't even use volume numbers.  Also, "Ironlake...finally" sounds a
bit strange considering that almost all hardware uses the 2D array
approach.  At this point, Gen4 is the only special case.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Combine GL_TEXTURE_CUBE_MAP_ARRAY case with the other array cases.
Kenneth Graunke [Fri, 28 Jun 2013 22:00:07 +0000 (15:00 -0700)]
i965: Combine GL_TEXTURE_CUBE_MAP_ARRAY case with the other array cases.

These do the exact same thing; combining them is tidier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Pull 3D texture layout code out into a helper function.
Kenneth Graunke [Fri, 28 Jun 2013 21:50:30 +0000 (14:50 -0700)]
i965: Pull 3D texture layout code out into a helper function.

A bit cleaner than having it in one giant function.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Replace maxBatchSize variable with BATCH_SZ define.
Kenneth Graunke [Sat, 29 Jun 2013 02:38:13 +0000 (19:38 -0700)]
i965: Replace maxBatchSize variable with BATCH_SZ define.

maxBatchSize was only ever initialized to BATCH_SZ, and a few places
used BATCH_SZ directly anyway.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Move annotate_aub out of the vtable.
Kenneth Graunke [Tue, 2 Jul 2013 08:19:23 +0000 (01:19 -0700)]
i965: Move annotate_aub out of the vtable.

brw_annotate_aub() is the only implementation of this function, so it
makes sense to just call it directly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Move debug_batch hook out of the vtable.
Kenneth Graunke [Sat, 29 Jun 2013 02:36:04 +0000 (19:36 -0700)]
i965: Move debug_batch hook out of the vtable.

brw_debug_batch() is the only implementation of this function, so it
makes sense to just call it directly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Remove render_target_supported from the vtable.
Kenneth Graunke [Sat, 29 Jun 2013 02:30:19 +0000 (19:30 -0700)]
i965: Remove render_target_supported from the vtable.

brw_render_target_supported() is the only implementation of this
function, so it makes sense to just call it directly.

Rather than adding an #include of brw_wm.h, this patch moves the
prototype to brw_context.h.  Prototypes seem to be in rather arbitrary
places at the moment, and either place seems as good as the other.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Move is_hiz_depth_format out of the vtable.
Kenneth Graunke [Sat, 29 Jun 2013 02:26:07 +0000 (19:26 -0700)]
i965: Move is_hiz_depth_format out of the vtable.

brw_is_hiz_depth_format() is the only implementation of this function,
so it makes sense to just call it directly.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Remove the invalidate_state() vtable hook.
Kenneth Graunke [Sat, 29 Jun 2013 02:18:10 +0000 (19:18 -0700)]
i965: Remove the invalidate_state() vtable hook.

The hook was a noop.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Replace fprintfs with assertions in GLenum comparison translators.
Kenneth Graunke [Sat, 29 Jun 2013 02:03:06 +0000 (19:03 -0700)]
i965: Replace fprintfs with assertions in GLenum comparison translators.

These functions translate GLenum comparison operations into the hardware
enumerations.  They should never be passed something other than a GL
comparison operator, or something is very broken.

Assertions seem more appropriate than fprintf.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Replace intel_state.c enums with those from brw_defines.h.
Kenneth Graunke [Sat, 29 Jun 2013 01:46:47 +0000 (18:46 -0700)]
i965: Replace intel_state.c enums with those from brw_defines.h.

Both intel_context.h and brw_defines.h have #defines for comparison
functions, stencil ops, blending logic ops, and blending factors.
They're exactly the same values, so it makes sense to pick one.

brw_defines.h is the logical place for this kind of stuff, so this patch
converts intel_state.c to use the set defined there.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Delete pre-DRI2.3 viewport hacks.
Kenneth Graunke [Fri, 28 Jun 2013 23:35:18 +0000 (16:35 -0700)]
i965: Delete pre-DRI2.3 viewport hacks.

The __DRI_USE_INVALIDATE extension was added in May 11th, 2010 by commit
4258e3a2e1c327.  At this point, it's unlikely that anyone's using the
right mix of new and old components to hit this path.  Deleting it
removes an untested code path and cleans up the driver a bit.

Cc: Kristian Høgsberg <krh@bitplanet.net>
Cc: Keith Packard <keithp@keithp.com>
10 years agoi965: Remove "There are probably better ways" comment.
Kenneth Graunke [Fri, 28 Jun 2013 23:07:40 +0000 (16:07 -0700)]
i965: Remove "There are probably better ways" comment.

There are always better ways to do things.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Delete brw_print_reg() function.
Kenneth Graunke [Sat, 29 Jun 2013 02:53:41 +0000 (19:53 -0700)]
i965: Delete brw_print_reg() function.

This wasn't called from anywhere; presumably it was used to examine
brw_regs when debugging shader assembly.  However, it prints registers
in a different notation than brw_disasm.c which everyone is used
to...which means I doubt anyone will want to use it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Move contents of intel_clear.h to intel_context.h.
Kenneth Graunke [Tue, 2 Jul 2013 04:36:48 +0000 (21:36 -0700)]
i965: Move contents of intel_clear.h to intel_context.h.

Having a header file for a single prototype seems rather excessive.
Plus, the actual function is in brw_clear.c, not intel_clear.c, so
there isn't even the .c/.h filename symmetry one might expect.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Move contents of intel_extensions.h to intel_context.h.
Kenneth Graunke [Tue, 2 Jul 2013 04:28:27 +0000 (21:28 -0700)]
i965: Move contents of intel_extensions.h to intel_context.h.

Having an entire header file for a single prototype seems a bit
excessive.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Remove some dead code.
Kenneth Graunke [Fri, 28 Jun 2013 23:06:26 +0000 (16:06 -0700)]
i965: Remove some dead code.

A random smattering of things that just aren't used anymore.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Delete dead intel_buffer_object::range_map_size field.
Kenneth Graunke [Tue, 2 Jul 2013 05:16:16 +0000 (22:16 -0700)]
i965: Delete dead intel_buffer_object::range_map_size field.

Nothing uses this, apparently.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Remove intel_buffer_object::source.
Kenneth Graunke [Tue, 2 Jul 2013 04:57:46 +0000 (21:57 -0700)]
i965: Remove intel_buffer_object::source.

This was only used for BOs backed by system memory on i915.  With that
gone, there's nothing that even sets source to non-zero, so this is
purely dead code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoi965: Fix buffer object segfault since removal of system memory BOs.
Kenneth Graunke [Tue, 2 Jul 2013 05:08:22 +0000 (22:08 -0700)]
i965: Fix buffer object segfault since removal of system memory BOs.

Commit cf31a19300cbcecddb6bd0f878abb9316ebad2a1 removed support for BOs
backed by system memory, as it was only useful for i915.  However, it
removed a little too much code: intel_bufferobj_buffer() used to call
intel_bufferobj_alloc_buffer(), and after that commit, it didn't.

This led to NULL pointer dereferences in several test cases, such as
es3conform's transform_feedback_state_variables test.

This commit restores the allocation, preserving the original behavior.
It may not be the cleanest approach, but tidying should come later.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66432
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
10 years agopostprocess: move second temporary assertion into isolated configuration
Matthew McClure [Mon, 1 Jul 2013 21:03:37 +0000 (14:03 -0700)]
postprocess: move second temporary assertion into isolated configuration

With this patch we will only assert that the second temporary is allocated,
when there are more than two active filters.

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

Signed-off-by: Brian Paul <brianp@vmware.com>
10 years agoglsl: Ensure snprintf is defined on MSVC builds.
José Fonseca [Wed, 3 Jul 2013 07:24:08 +0000 (08:24 +0100)]
glsl: Ensure snprintf is defined on MSVC builds.

Should fix:

  src\glsl\opt_dead_builtin_varyings.cpp(244) : error C3861: 'snprintf': identifier not found
  ...

10 years agotargets/xvmc-nouveau: add in missing nv30 lib
Ilia Mirkin [Sun, 23 Jun 2013 16:59:25 +0000 (12:59 -0400)]
targets/xvmc-nouveau: add in missing nv30 lib

Currently libXvMCnouveau.so is missing nv30_screen_create. Add it in so
that it may be dlopen'd.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa,glsl,gallium: remove GLSLSkipStrictMaxVaryingLimitCheck and dependencies
Marek Olšák [Thu, 13 Jun 2013 11:13:34 +0000 (13:13 +0200)]
mesa,glsl,gallium: remove GLSLSkipStrictMaxVaryingLimitCheck and dependencies

Not needed with do_dead_builtin_varyings.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agost/mesa: disable EXT_separate_shader_objects
Marek Olšák [Wed, 12 Jun 2013 19:38:28 +0000 (21:38 +0200)]
st/mesa: disable EXT_separate_shader_objects

The extension disallows elimination of set-but-unused varyings.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl/linker: eliminate unused and set-but-unused built-in varyings
Marek Olšák [Wed, 12 Jun 2013 11:23:48 +0000 (13:23 +0200)]
glsl/linker: eliminate unused and set-but-unused built-in varyings

This eliminates built-in varyings such as gl_Color, gl_SecondaryColor,
gl_TexCoord, and gl_FogFragCoord if they are unused by the next stage or
not written at all (e.g. gl_TexCoord elements). The gl_TexCoord array is
broken down into separate vec4s if needed.

v2: - use a switch statement in varying_info_visitor::visit(ir_variable*)
    - use snprintf
    - disable the optimization for GLES2

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl/linker: check against varying limit after unused varyings are eliminated
Marek Olšák [Thu, 13 Jun 2013 01:17:22 +0000 (03:17 +0200)]
glsl/linker: check against varying limit after unused varyings are eliminated

We counted even the varyings which were later eliminated, which was
suboptimal.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl/linker: link shaders in the opposite order (from fragment to vertex)
Marek Olšák [Wed, 12 Jun 2013 00:18:09 +0000 (02:18 +0200)]
glsl/linker: link shaders in the opposite order (from fragment to vertex)

This ensures that inter-shader outputs and inputs are properly eliminated
across 3 or more shader stages. The behavior is unchanged with 2 or less
shader stages.

For example, elimination of unused FS inputs causes elimination of matching
GS outputs, which causes elimination of the GS inputs that were needed for
evaluation of the eliminated GS outputs, which causes elimination of
matching VS outputs. An unused FS input is all that's needed to trigger
this chain reaction.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agomesa: renumber shader indices according to their placement in pipeline
Marek Olšák [Wed, 12 Jun 2013 15:15:46 +0000 (17:15 +0200)]
mesa: renumber shader indices according to their placement in pipeline

See my explanation in mtypes.h.

v2: don't do this in gallium
v3: also updated the comment at the gl_shader_type definition

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agogallivm: Simplify intrinsic name construction.
José Fonseca [Tue, 2 Jul 2013 05:53:25 +0000 (06:53 +0100)]
gallivm: Simplify intrinsic name construction.

Just noticed this could be slightly shortened when fixing MSVC build.

Trivial.

10 years agoglsl/builtins: Fix ARB_texture_cube_map_array built-in availability.
Kenneth Graunke [Fri, 28 Jun 2013 20:46:44 +0000 (13:46 -0700)]
glsl/builtins: Fix ARB_texture_cube_map_array built-in availability.

This patch adds texture() for isamplerCubeArray and usamplerCubeArray,
which were entirely missing.

It also makes texture() with a LOD bias fragment shader specific.  The
main GLSL specification explicitly says that texturing with LOD bias
should not be allowed for vertex shaders.

Affects Piglit's ARB_texture_cube_map_array/compiler/tex_bias-01.vert.
which tries to use bias in a vertex shader.  Currently, it expects this
to pass (so this patch regresses the test), but I've sent a patch to
reverse the expected behavior (so this patch would fix the updated test):
http://lists.freedesktop.org/archives/piglit/2013-June/006123.html

NOTE: This is a candidate for stable branches.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
10 years agogallivm: Fix MSVC build.
José Fonseca [Tue, 2 Jul 2013 05:41:32 +0000 (06:41 +0100)]
gallivm: Fix MSVC build.

10 years agogallivm: Fix indirect immediate registers.
José Fonseca [Mon, 1 Jul 2013 19:54:19 +0000 (20:54 +0100)]
gallivm: Fix indirect immediate registers.

If reg->Register.Indirect is true then the immediate is not truly a
constant LLVM expression.

There is no performance regression in using LLVMBuildBitCast, as it will
fallback to LLVMConstBitCast internally when the argument is a constant.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
10 years agogallium/tests: fix the translate test
Zack Rusin [Fri, 28 Jun 2013 13:42:35 +0000 (09:42 -0400)]
gallium/tests: fix the translate test

10 years agoi965: Enable ext_framebuffer_multisample_blit_scaled on intel h/w
Anuj Phogat [Tue, 14 May 2013 15:15:59 +0000 (08:15 -0700)]
i965: Enable ext_framebuffer_multisample_blit_scaled on intel h/w

This patch enables ext_framebuffer_multisample_blit_scaled extension
on intel h/w >= gen6.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agoi965/blorp: Add bilinear filtering of samples for multisample scaled blits
Anuj Phogat [Fri, 31 May 2013 17:59:50 +0000 (10:59 -0700)]
i965/blorp: Add bilinear filtering of samples for multisample scaled blits

Current implementation of ext_framebuffer_multisample_blit_scaled in
i965/blorp uses nearest filtering for multisample scaled blits. Using
nearest filtering produces blocky artifacts and negates the benefits
of MSAA. That is the reason why extension was not enabled on i965.

This patch implements the bilinear filtering of samples in blorp engine.
Images generated with this patch are free from blocky artifacts and show
big improvement in visual quality.

Observed no piglit and gles3 regressions.

V3:
- Algorithm used for filtering assumes a rectangular grid of samples
  roughly corresponding to sample locations.
- Test the boundary conditions on the edges of texture.

V4:
- Clip texcoords and use conditional MOVs.
- Send texture dimensions as push constants.
- Remove the optimization in case of scaled multisample blits.

V5:
- Move mcs_fetch() inside the 'for' loop after computing pixel coordinates.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Acked-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
10 years agodocs: Import 9.1.4 release notes, add news item.
Ian Romanick [Mon, 1 Jul 2013 21:42:13 +0000 (14:42 -0700)]
docs: Import 9.1.4 release notes, add news item.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agodraw/translate: fix instancing
Zack Rusin [Fri, 28 Jun 2013 00:40:10 +0000 (20:40 -0400)]
draw/translate: fix instancing

We were incorrectly computing the buffer offset when using the
instances. The buffer offset is always equal to:
start_instance * stride + (instance_num / instance_divisor) *
stride
We were completely ignoring the start instance quite
often producing instances that completely wrong, e.g. if
start instance = 5, instance divisor = 2, then on the first
iteration it should be:
5 * stride, not (5/2) * stride as we'd have currently, and if
start instance = 1, instance divisor = 3, then on the first
iteration it should be:
1 * stride, not 0 as we'd have.
This fixes it and adjusts all the code to the changes.

Signed-off-by: Zack Rusin <zackr@vmware.com>
10 years agodraw: fix incorrect clipper invocation statistics
Zack Rusin [Thu, 27 Jun 2013 19:24:52 +0000 (15:24 -0400)]
draw: fix incorrect clipper invocation statistics

clipper invocations are computed earlier (of course
before the emittion) so this code was adding bogus
numbers to already computed clipper invocations.

Signed-off-by: Zack Rusin <zackr@vmware.com>
10 years agodraw/gallivm: export overflow arithmetic to its own file
Zack Rusin [Thu, 27 Jun 2013 19:23:21 +0000 (15:23 -0400)]
draw/gallivm: export overflow arithmetic to its own file

We'll be reusing this code so lets put it in a common file
and use it in the draw module.

Signed-off-by: Zack Rusin <zackr@vmware.com>
10 years agodraw: check for integer overflows in instance computation
Zack Rusin [Tue, 25 Jun 2013 21:01:14 +0000 (17:01 -0400)]
draw: check for integer overflows in instance computation

Integers could easily overflow is the starting instance
was large enough. Instead of letting bogus counts through
set the instance to max if it overflown and let our
regular buffer overflow computation handle it.

Signed-off-by: Zack Rusin <zackr@vmware.com>
10 years agodraw: check for an integer overflow when computing stride
Zack Rusin [Tue, 25 Jun 2013 20:14:06 +0000 (16:14 -0400)]
draw: check for an integer overflow when computing stride

Our buffer overflow arithmetic was susceptible to integer
overflows which was the buffer overflow logic to break.
Lets use the llvm overflow intrinsics to check for integer
overflows while computing the stride/needed buffer size.

Signed-off-by: Zack Rusin <zackr@vmware.com>
10 years agodraw: account for elem size when computing overflow
Zack Rusin [Tue, 25 Jun 2013 17:54:47 +0000 (13:54 -0400)]
draw: account for elem size when computing overflow

We weren't taking into account the size of element
that is to be fetched, which meant that it was possible
to overflow the buffer reads if the stride was very
close to the end of the buffer, e.g. stride = 3, buffer
size = 4, and the element to be read = 4. This should
be properly detected as an overflow.

Signed-off-by: Zack Rusin <zackr@vmware.com>