mesa.git
10 years agoi915g: handle more formats in copy
Stéphane Marchesin [Mon, 26 May 2014 13:48:11 +0000 (06:48 -0700)]
i915g: handle more formats in copy

We can handle depth, luminance,... copies by simply replacing the
format with a known format of the same bpp.

10 years agonvc0: implement clear_buffer
Tobias Klausmann [Tue, 27 May 2014 00:19:01 +0000 (02:19 +0200)]
nvc0: implement clear_buffer

Provide an accelerated path for ARB_clear_buffer_object

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoi965: Switch types D->UD when possible to allow compaction.
Matt Turner [Sat, 17 May 2014 22:54:05 +0000 (15:54 -0700)]
i965: Switch types D->UD when possible to allow compaction.

Number of compacted instructions: 827404 -> 833045 (0.68%)

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoRevert "i965: Don't make instructions with a null dest a barrier to scheduling."
Matt Turner [Mon, 26 May 2014 18:45:48 +0000 (11:45 -0700)]
Revert "i965: Don't make instructions with a null dest a barrier to scheduling."

This reverts commit 42a26cb5e441a01d5288b299980f23affaad53fe.

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78648

10 years agoRevert "i965/fs: Simplify interference scan in register coalescing."
Matt Turner [Mon, 26 May 2014 18:44:57 +0000 (11:44 -0700)]
Revert "i965/fs: Simplify interference scan in register coalescing."

This reverts commit 5ff1e446d44bb9d50f84883c7058635cb070e069.

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77704

10 years agoRevert "i965/fs: Give up in interference check if we see a WHILE."
Matt Turner [Mon, 26 May 2014 18:44:53 +0000 (11:44 -0700)]
Revert "i965/fs: Give up in interference check if we see a WHILE."

This reverts commit 55de1c035cbca2b7087b3aa21a8c3dfc900a4ad9.

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoRevert "i965/fs: Reduce restrictions on interference in register coalescing."
Matt Turner [Mon, 26 May 2014 18:44:09 +0000 (11:44 -0700)]
Revert "i965/fs: Reduce restrictions on interference in register coalescing."

This reverts commit f770123f58b46459e8dbd27525162ee8ba89f30b.

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78692

10 years agonvc0: revert mistaken logic to collapse color outputs to the beginning
Ilia Mirkin [Fri, 23 May 2014 15:31:39 +0000 (11:31 -0400)]
nvc0: revert mistaken logic to collapse color outputs to the beginning

In commit af38ef907, I added a "fix" to color outputs not being assigned
correctly when sample mask was being output. This was totally wrong --
the color indices (i.e. "si" values) were the ones that were wrong. Undo
that hunk.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agomesa/st: fix color outputs in presence of sample mask output
Ilia Mirkin [Fri, 23 May 2014 15:18:16 +0000 (11:18 -0400)]
mesa/st: fix color outputs in presence of sample mask output

Commit c5d822dad90 added support for sample mask incorrectly. It became
treated as a color output, and messed up the color output indices.
Revert the hunk that did that, and add explicit support just like for
depth/stencil writes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Marek Olšák <marek.olsak@amd.com>
10 years agofreedreno/a3xx: texture fixes
Rob Clark [Mon, 26 May 2014 13:03:09 +0000 (09:03 -0400)]
freedreno/a3xx: texture fixes

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno: update generated headers
Rob Clark [Mon, 26 May 2014 12:58:17 +0000 (08:58 -0400)]
freedreno: update generated headers

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno: few caps fixes
Rob Clark [Sat, 24 May 2014 14:07:13 +0000 (10:07 -0400)]
freedreno: few caps fixes

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agomesa/x86: Fix build with clang <= 3.3.
Vinson Lee [Mon, 26 May 2014 04:32:49 +0000 (21:32 -0700)]
mesa/x86: Fix build with clang <= 3.3.

clang <= 3.3 cpuid.h does not define contants for feature bits.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79095
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agoi965: Don't treat HW_REGs as barriers if they're immediates.
Matt Turner [Thu, 17 Apr 2014 20:55:06 +0000 (13:55 -0700)]
i965: Don't treat HW_REGs as barriers if they're immediates.

We had a handful of cases where we'd used brw_imm_*() to generate an
immediate, rather than fs_reg(). We shouldn't do that but we shouldn't
limit scheduling flexibility on account of immediate arguments either.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Don't use brw_imm_* unnecessarily.
Matt Turner [Thu, 17 Apr 2014 18:53:22 +0000 (11:53 -0700)]
i965/fs: Don't use brw_imm_* unnecessarily.

Using brw_imm_* creates a source with file=HW_REG, and the scheduler
inserts barrier dependencies when it sees HW_REG. None of these are
hardware-registers in the sense that they're special and scheduling
shouldn't touch them. A few of the modified cases already have HW_REGs
for other sources, so it won't allow extra flexibility in some cases.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoautomake: correctly append the version-script
Emil Velikov [Sun, 25 May 2014 02:23:42 +0000 (03:23 +0100)]
automake: correctly append the version-script

Turns out that the AC conditional did not include the
the version-scripts as expected. Rather it truncated
the remaining linker flags.

Cc: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
10 years agotargets/libgl-xlib: hide all the exported symbol mayhem
Emil Velikov [Sun, 25 May 2014 00:54:42 +0000 (01:54 +0100)]
targets/libgl-xlib: hide all the exported symbol mayhem

Leave only the gl/glx and mangled gl symbols.
XMesa* was never an official interface and the only
user of it was mesa-demos, while they were still in
the same repo as mesa.

v2: Conditionally use the version-script.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/osmesa: include mangled gl symbols
Emil Velikov [Sun, 25 May 2014 00:46:42 +0000 (01:46 +0100)]
targets/osmesa: include mangled gl symbols

Missed out with commit d4c3968c25885f6eb53dee4cc0c60d8d3f8fec32

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/xa: limit the amount of exported symbols
Emil Velikov [Fri, 2 May 2014 21:02:15 +0000 (22:02 +0100)]
targets/xa: limit the amount of exported symbols

In the presence of LLVM the final library exports every symbol from
the llvm namespace. Resolve this by using a version script (w/o the
version/name tag).

Considering that there are only ~35 symbols, explicitly list them
to minimize the chances of rogue symbols sneaking in.

v2: Conditionally include the version-script.

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> (v1)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agodri_util: keep __dri2ConfigOptions symbol private
Emil Velikov [Fri, 2 May 2014 21:02:14 +0000 (22:02 +0100)]
dri_util: keep __dri2ConfigOptions symbol private

The symbol was added with commit 45e2b51c853(DRI2/GLX: check for
vblank_mode in DRI2 GLX code) but was never used as such according
to git log.

Possibly it was marked as public due to confusion with
__driConfigOptions which was used for dri1 drivers.

Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/opencl: Fix (static) linking with LLVM (v2)
Kai Wasserbäch [Mon, 19 May 2014 15:02:49 +0000 (17:02 +0200)]
targets/opencl: Fix (static) linking with LLVM (v2)

Without this, I get linking failures (static linking).

The static linking is sort of required for me, because otherwise Steam and
applications using the Steam runtime regularily fail because my LLVM was
compiled and linked against a newer libgcc_s, libstdc++, etc. and uses
features from those newer versions. And instead of Steam just not
starting, my X starts crashing, whenever libGL fails to load a (32 bit)
driver.

Since I hate crashes of X and I don't think Valve/Steam will behave like
a proper distribution soon (rebuilds versus current Debian Testing, since
they base their Steam OS off that), I need a radeonsi which carries its
own LLVM within and doesn't care about what the runtime sets. This means
linking Mesa statically.

v1 → v2: Move logic to configure.ac

Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Kai Wasserbäch <kai@dev.carbon-project.org>
10 years agoglx: do not leak dri3Display
Emil Velikov [Sat, 10 May 2014 02:41:45 +0000 (03:41 +0100)]
glx: do not leak dri3Display

v2: Do not wrap the code in ifdef HAVE_DRI3 (suggested by Keith)

Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agogallium/egl: st_profiles are build time decision, treat them as such
Emil Velikov [Sat, 10 May 2014 02:41:44 +0000 (03:41 +0100)]
gallium/egl: st_profiles are build time decision, treat them as such

The profiles are present depending on the defines at build time.
Drop the extra functions and feed the defines directly into the
state-tracker at build time.

v2: Drop unused variable i.

Acked-by: Chia-I Wu <olvaffe@gmail.com> (v1)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agodri_util: set implemented version of the DRI_CORE extension
Emil Velikov [Sat, 10 May 2014 02:41:43 +0000 (03:41 +0100)]
dri_util: set implemented version of the DRI_CORE extension

... rather than the one defined in our internal interface (dri_interface.h)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoi965/fs: Don't modify ann_count if not debugging.
Matt Turner [Sun, 25 May 2014 17:30:13 +0000 (10:30 -0700)]
i965/fs: Don't modify ann_count if not debugging.

If we make ann_count non-zero, annotation_finalize() won't bail.

Not modifying it seems to make the code more clear than would modifying
annotation_finalize().

10 years agoRevert "i965/fs: Change fs_visitor::emit_lrp to use MAC for gen<6"
Matt Turner [Thu, 22 May 2014 16:39:13 +0000 (09:39 -0700)]
Revert "i965/fs: Change fs_visitor::emit_lrp to use MAC for gen<6"

This reverts commit a6860100b87415ab510d0d210cabfeeccebc9a0a.

Why this code didn't work in all circumstances is unknown and without a
working Ironlake simulator (which uses a different AUB format) we'll
probably never know, short of a lot of experimentation, and spending a
bunch of time to try to optimize a few instructions on Ironlake is not
time well spent.

Moreover, for mix(vec4, vec4, vec4) using the accumulator introduces a
dependence between the otherwise independent per-component calculations.
Not using the accumulator, even if it means an extra instruction per
component might be preferable. We don't know, we don't have data, and
we don't have the necessary register on Ironlake for shader_time to tell
us.

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77707
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoRevert "i965/vec4: Change vec4_visitor::emit_lrp to use MAC for gen<6"
Matt Turner [Thu, 22 May 2014 16:38:24 +0000 (09:38 -0700)]
Revert "i965/vec4: Change vec4_visitor::emit_lrp to use MAC for gen<6"

This reverts commit 2dfbbeca50b95ccdd714d9baa4411c779f6a20d9 with the
comment about MAC and implicit accumulator removed.

Why this code didn't work in all circumstances is unknown and without a
working Ironlake simulator (which uses a different AUB format) we'll
probably never know, short of a lot of experimentation, and spending a
bunch of time to try to optimize a few instructions on Ironlake is not
time well spent.

Moreover, for mix(vec4, vec4, vec4) using the accumulator introduces a
dependence between the otherwise independent per-component calculations.
Not using the accumulator, even if it means an extra instruction per
component might be preferable. We don't know, we don't have data, and
we don't have the necessary register on Ironlake for shader_time to tell
us.

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77703
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Remove useless typo'd debugging messages.
Matt Turner [Mon, 19 May 2014 21:08:37 +0000 (14:08 -0700)]
i965: Remove useless typo'd debugging messages.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Move brw_land_fwd_jump() to compilation unit of its use.
Matt Turner [Mon, 19 May 2014 21:02:26 +0000 (14:02 -0700)]
i965: Move brw_land_fwd_jump() to compilation unit of its use.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Use next_insn_offset rather than nr_insn.
Matt Turner [Sun, 18 May 2014 18:16:26 +0000 (11:16 -0700)]
i965/fs: Use next_insn_offset rather than nr_insn.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Emit 0.0:F sources with type VF instead.
Matt Turner [Fri, 2 May 2014 21:47:55 +0000 (14:47 -0700)]
i965: Emit 0.0:F sources with type VF instead.

Number of compacted instructions: 817752 -> 827404 (1.18%)

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Emit ARF:UD for non-present src1 on Gen6+.
Matt Turner [Fri, 2 May 2014 21:14:11 +0000 (14:14 -0700)]
i965: Emit ARF:UD for non-present src1 on Gen6+.

Enables the next commits to compact more instructions.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Support compacted instructions with immediate sources.
Matt Turner [Wed, 30 Apr 2014 23:28:59 +0000 (16:28 -0700)]
i965: Support compacted instructions with immediate sources.

Note the weirdness with src1 subregs. The compacted immediate fields are
uncompacted to bits [127:96] and the high five bits of the subreg
mapping maps to bits [100:96].

Number of compacted instructions: 790085 -> 817752 (3.50%)

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Use next_offset() in instruction compaction code.
Matt Turner [Sat, 17 May 2014 20:03:59 +0000 (13:03 -0700)]
i965: Use next_offset() in instruction compaction code.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Move next_offset() to brw_eu.h for use elsewhere.
Matt Turner [Sat, 17 May 2014 20:00:12 +0000 (13:00 -0700)]
i965: Move next_offset() to brw_eu.h for use elsewhere.

Also perform arithmetic on char* rather than void* since the latter is a
GNU C extension not available in C++.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Rename next_ip() -> next_offset().
Matt Turner [Sat, 17 May 2014 19:53:56 +0000 (12:53 -0700)]
i965: Rename next_ip() -> next_offset().

That we were comparing its return value with offsets should have been a
clue. :)

Make it take a void *store in preparation for making the function useful
elsewhere.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Print disassembly after compaction.
Matt Turner [Mon, 19 May 2014 17:20:37 +0000 (10:20 -0700)]
i965: Print disassembly after compaction.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs: Make patch_discard_jumps_to_fb_writes return bool.
Matt Turner [Fri, 16 May 2014 20:06:45 +0000 (13:06 -0700)]
i965/fs: Make patch_discard_jumps_to_fb_writes return bool.

... to tell us whether it emitted any code. Will be used to determine
whether we need to skip an annotation for it.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agoi965: Add annotation data structure and support code.
Matt Turner [Mon, 19 May 2014 17:17:51 +0000 (10:17 -0700)]
i965: Add annotation data structure and support code.

Will be used to print disassembly after jump targets are set and
instructions are compacted, while still retaining higher-level IR
annotations and basic block information.

An array of 'struct annotation' will live along side the generated
assembly. The generators will populate the array with their IR
annotations, and basic block pointers if the instructions began or ended
a basic block pointer.

We'll then update the instruction offset when we compact instructions
and then using the annotations print the disassembly.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965/fs+blorp: Remove left over dump_file arguments.
Matt Turner [Sat, 17 May 2014 20:25:15 +0000 (13:25 -0700)]
i965/fs+blorp: Remove left over dump_file arguments.

Were used by the blorp unit test programs.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
10 years agoi965/fs: Don't hardcode DEBUG_WM in generic fs code.
Matt Turner [Wed, 14 May 2014 22:05:09 +0000 (15:05 -0700)]
i965/fs: Don't hardcode DEBUG_WM in generic fs code.

Similar to Paul's commit e9fa3a944 except brw_fs_generator's debug_flag
is for DEBUG_WM and DEBUG_BLORP.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Pass in start_offset to brw_compact_instructions().
Matt Turner [Thu, 15 May 2014 23:56:13 +0000 (16:56 -0700)]
i965: Pass in start_offset to brw_compact_instructions().

Let's us avoid recompacting the SIMD8 instructions when we compact the
SIMD16 program.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoi965: Delete unused brw_blorp_blit_test_compile().
Matt Turner [Sun, 25 May 2014 06:01:42 +0000 (23:01 -0700)]
i965: Delete unused brw_blorp_blit_test_compile().

10 years agoi965/cfg: Make DO instruction begin a basic block.
Matt Turner [Sat, 17 May 2014 18:53:45 +0000 (11:53 -0700)]
i965/cfg: Make DO instruction begin a basic block.

The DO instruction doesn't exist on Gen6+. Since before this commit, DO
always ended a basic block, if it also happened to start one (e.g., a
while loop inside an if statement) the block containing only the DO
would actually contain no hardware instructions.

Pre-Gen6's WHILE instructions jumps to the instruction following the DO,
so strictly speaking we won't be modeling that properly, but I claim
there is actually no functional difference.

This will simplify an upcoming change where we want to mark the first
hardware instruction in the loop as beginning a block, and the last
instruction before the loop as ending one.

Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agodarwin: Guard Core Profile usage behind a testing envvar
Jeremy Huddleston Sequoia [Sat, 24 May 2014 21:08:16 +0000 (14:08 -0700)]
darwin: Guard Core Profile usage behind a testing envvar

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
10 years agodarwin: Write errors in choosing the pixel format to the crash log
Jeremy Huddleston Sequoia [Sat, 24 May 2014 21:13:33 +0000 (14:13 -0700)]
darwin: Write errors in choosing the pixel format to the crash log

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
10 years agonv50: count wrapped textures towards the tex_obj count
Joakim Sindholt [Mon, 8 Jul 2013 14:05:39 +0000 (16:05 +0200)]
nv50: count wrapped textures towards the tex_obj count

But don't count their size towards the allocated memory, since that
belongs to whoever created it.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0: assert that we have vertex elements state
Christoph Bumiller [Fri, 31 May 2013 19:06:11 +0000 (21:06 +0200)]
nvc0: assert that we have vertex elements state

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonvc0: use PRIxPTR for sizeof()
Christoph Bumiller [Fri, 31 May 2013 13:08:32 +0000 (15:08 +0200)]
nvc0: use PRIxPTR for sizeof()

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50,nvc0: allow 15,16,30 bpp display formats
Christoph Bumiller [Sat, 25 May 2013 19:27:11 +0000 (21:27 +0200)]
nv50,nvc0: allow 15,16,30 bpp display formats

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50,nvc0: handle guard band defines
Christoph Bumiller [Sat, 25 May 2013 00:04:25 +0000 (02:04 +0200)]
nv50,nvc0: handle guard band defines

[imirkin: moved default case out of switch]
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/tgsi: optimize KIL
Christoph Bumiller [Wed, 12 Jun 2013 19:31:19 +0000 (21:31 +0200)]
nv50/ir/tgsi: optimize KIL

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv50/ir: fix lowering of predicated instructions (without defs)
Christoph Bumiller [Wed, 12 Jun 2013 19:00:41 +0000 (21:00 +0200)]
nv50/ir: fix lowering of predicated instructions (without defs)

Note that predicated instructions with defs are still not supported
because transformation to SSA doesn't handle them yet.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv50/ir/opt: fix constant folding with saturate modifier
Christoph Bumiller [Tue, 11 Jun 2013 20:57:31 +0000 (22:57 +0200)]
nv50/ir/opt: fix constant folding with saturate modifier

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv50/ir/tgsi: TGSI_OPCODE_POW replicates its result
Christoph Bumiller [Thu, 6 Jun 2013 09:44:30 +0000 (11:44 +0200)]
nv50/ir/tgsi: TGSI_OPCODE_POW replicates its result

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv50,nvc0: set constbufs dirty on pipe context switch
Christoph Bumiller [Sun, 2 Jun 2013 15:55:34 +0000 (17:55 +0200)]
nv50,nvc0: set constbufs dirty on pipe context switch

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv50: setup scissors on clear_render_target/depth_stencil
Christoph Bumiller [Tue, 14 May 2013 21:42:39 +0000 (23:42 +0200)]
nv50: setup scissors on clear_render_target/depth_stencil

[imirkin: add logic to also clear the "regular" scissors]
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agonv50,nvc0: always pull out bufctx on context destruction
Christoph Bumiller [Sun, 12 May 2013 13:41:29 +0000 (15:41 +0200)]
nv50,nvc0: always pull out bufctx on context destruction

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Properly return *RESET* status in glGetGraphicsResetStatusARB
Pavel Popov [Fri, 16 May 2014 05:00:02 +0000 (12:00 +0700)]
i965: Properly return *RESET* status in glGetGraphicsResetStatusARB

The glGetGraphicsResetStatusARB from ARB_robustness extension always
returns GUILTY_CONTEXT_RESET_ARB and never returns NO_ERROR for guilty
context with LOSE_CONTEXT_ON_RESET_ARB strategy.  This is because Mesa
returns GUILTY_CONTEXT_RESET_ARB if batch_active !=0 whereas kernel
driver never reset batch_active and this variable always > 0 for guilty
context.  The same behaviour also can be observed for batch_pending and
INNOCENT_CONTEXT_RESET_ARB.

But ARB_robustness spec says:

  If a reset status other than NO_ERROR is returned and subsequent calls
  return NO_ERROR, the context reset was encountered and completed. If a
  reset status is repeatedly returned, the context may be in the process
  of resetting.

  8. How should the application react to a reset context event?
  RESOLVED: For this extension, the application is expected to query the
  reset status until NO_ERROR is returned. If a reset is encountered, at
  least one *RESET* status will be returned. Once NO_ERROR is
  encountered, the application can safely destroy the old context and
  create a new one.

The main problem is the context may be in the process of resetting and
in this case a reset status should be repeatedly returned.  But looks
like the kernel driver returns nonzero active/pending only if the
context reset has already been encountered and completed.  For this
reason the *RESET* status cannot be repeatedly returned and should be
returned only once.

The reset_count and brw->reset_count variables can be used to control
that glGetGraphicsResetStatusARB returns *RESET* status only once for
each context.  Note the i915 triggers reset_count twice which allows to
return correct reset count immediately after active/pending have been
incremented.

v2 (idr): Trivial reformatting of comments.

Signed-off-by: Pavel Popov <pavel.e.popov@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agoappleglx: Improve error reporting if CGLChoosePixelFormat() didn't find any matching...
Jon TURNEY [Mon, 12 May 2014 14:38:26 +0000 (15:38 +0100)]
appleglx: Improve error reporting if CGLChoosePixelFormat() didn't find any matching pixel formats.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
10 years agoFix build of appleglx
Jon TURNEY [Mon, 12 May 2014 09:47:07 +0000 (10:47 +0100)]
Fix build of appleglx

Define GLX_USE_APPLEGL, as config/darwin used to, to turn on specific code to
use the applegl direct renderer

Convert src/glx/apple/Makefile to automake

Since the applegl libGL is now built by linking libappleglx into libGL, rather
than by linking selected files into a special libGL:

- Remove duplicate code in apple/glxreply.c and apple/apple_glx.c.  This makes
apple/glxreply.c empty, so remove it

- Some indirect rendering code is already guarded by !GLX_USE_APPLEGL, but we
need to add those guards to indirect_glx.c, indirect_init.c (via it's
generator), render2.c and vertarr.c so they don't generate anything

Fix and update various includes

glapi_gentable.c (which is only used on darwin), should be included in shared
glapi as well, to provide _glapi_create_table_from_handle()

Note that neither swrast nor indirect is supported in the APPLEGL path at the
moment, which makes things more complex than they need to be.  More untangling
is needed to allow that

v2: Correct apple/Makefile.am for srcdir != builddir

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoMake DRI dependencies and build depend on the target
Jon TURNEY [Mon, 12 May 2014 09:17:06 +0000 (10:17 +0100)]
Make DRI dependencies and build depend on the target

- Don't require xcb-dri[23] etc. if we aren't building for a target with DRM, as
we won't be using dri[23]

- Enable a more fine-grained control of what DRI code is built, so that a libGL
using direct swrast can be built on targets which don't have DRM.

The HAVE_DRI automake conditional is retired in favour of a number of other
conditionals:

HAVE_DRI2 enables building of code using the DRI2 interface (and possibly DRI3
with HAVE_DRI3)

HAVE_DRISW enables building of DRI swrast

HAVE_DRICOMMON enables building of target-independent DRI code, and also enables
some makefile cases where a more detailled decision is made at a lower level.

HAVE_APPLEDRI enables building of an Apple-specific direct rendering interface,
still which requires additional fixing up to build properly.

v2:
Place xfont.c and drisw_glx.c into correct categories.
Update 'make check' as well

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agoFix build for darwin
Jon TURNEY [Sun, 11 May 2014 13:38:52 +0000 (14:38 +0100)]
Fix build for darwin

Fix build for darwin, when ./configured --disable-driglx-direct

- darwin ld doesn't support -Bsymbolic or --version-script, so check if ld
supports those options before using them
- define GLX_ALIAS_UNSUPPORTED as config/darwin used to, as aliasing of non-weak
symbols isn't supported
- default to -with-dri-drivers=swrast

v2:
Use -Wl,-Bsymbolic, as before, not -Bsymbolic
Test that ld --version-script works, rather than just looking for it in ld --help
Don't use -Wl,--no-undefined on darwin, either

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agotargets/egl-static: add missing line break in ldflags
Emil Velikov [Sun, 18 May 2014 07:07:24 +0000 (08:07 +0100)]
targets/egl-static: add missing line break in ldflags

Accidently omitted by commit 7b7944ee1cedeaf.

Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
10 years agomesa: Fix unbinding GL_DEPTH_STENCIL_ATTACHMENT
James Legg [Fri, 23 May 2014 11:25:37 +0000 (12:25 +0100)]
mesa: Fix unbinding GL_DEPTH_STENCIL_ATTACHMENT

glFramebufferRender(..., GL_DEPTH_STENCIL_ATTACHMENT, ..., 0) only
detached the depth buffer and not the stencil buffer.

Bugzilla: http://bugs.freedesktop.org/show_bug.cgi?id=79115
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
10 years agotargets/osmesa: limit the amount of exported symbols
Emil Velikov [Wed, 21 May 2014 00:07:00 +0000 (18:07 -0600)]
targets/osmesa: limit the amount of exported symbols

src/gallium/targets/osmesa/Makefile.am |  1 +
src/gallium/targets/osmesa/osmesa.sym  | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
create mode 100644 src/gallium/targets/osmesa/osmesa.sym

10 years agogallivm: Disable workaround for PR12833 on LLVM 3.2+.
José Fonseca [Wed, 14 May 2014 11:55:50 +0000 (12:55 +0100)]
gallivm: Disable workaround for PR12833 on LLVM 3.2+.

Fixed upstream.

10 years agogallivm: Support MCJIT on Windows.
José Fonseca [Wed, 14 May 2014 11:20:14 +0000 (12:20 +0100)]
gallivm: Support MCJIT on Windows.

It works fine, though it requires using ELF objects.

With this change there is nothing preventing us to switch exclusively
to MCJIT, everywhere.  It's still off though.

10 years agomesa/x86: Fix build with clang 3.4.
José Fonseca [Fri, 23 May 2014 10:36:58 +0000 (11:36 +0100)]
mesa/x86: Fix build with clang 3.4.

It defines bit_SSE41 instead of bit_SSE4_1.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=79095

Trivial.

10 years agomesa: Move declaration to top of block.
José Fonseca [Fri, 23 May 2014 10:23:52 +0000 (11:23 +0100)]
mesa: Move declaration to top of block.

To fix MSVC build.  Trivial.

10 years agometa blit: Set Z texcoord during meta blit to sample the correct layer
Jordan Justen [Wed, 21 May 2014 22:34:26 +0000 (22:34 +0000)]
meta blit: Set Z texcoord during meta blit to sample the correct layer

If the source renderbuffer has a depth > 0, then send a Z texcoord
which is set to the source attachment Z offset.

This fixes piglit's gl-3.2-layered-rendering-gl-layer-render with the
GL_TEXTURE_2D_MULTISAMPLE_ARRAY case test on i965/gen8.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Listen to BRW_NEW_FRAGMENT_PROGRAM for 3DSTATE_PS_BLEND.
Kenneth Graunke [Tue, 20 May 2014 21:52:40 +0000 (14:52 -0700)]
i965: Listen to BRW_NEW_FRAGMENT_PROGRAM for 3DSTATE_PS_BLEND.

brw_color_buffer_write_enabled depends on brw->fragment_program, which
means we have to listen to BRW_NEW_FRAGMENT_PROGRAM.

On most generations, this was only called from a function that already
subscribed.  However, on Broadwell, we failed to listen to the necessary
event in the atom that emits 3DSTATE_PS_BLEND.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agoi965: Use WE_all for FB write header setup on Broadwell.
Kenneth Graunke [Tue, 20 May 2014 21:52:39 +0000 (14:52 -0700)]
i965: Use WE_all for FB write header setup on Broadwell.

I forgot to disable writemasking on the OR and MOV which set the render
target index and "source 0 alpha present to render target" bit.

Using get_element_ud is equivalent and avoids a line-wrap.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
10 years agomesa/x86: fix a typos in SSE4.1 detection
Tobias Klausmann [Fri, 23 May 2014 01:02:16 +0000 (03:02 +0200)]
mesa/x86: fix a typos in SSE4.1 detection

Commit a2fb71e23 introduced 32-bit code for SSE4.1. Fix compilation, and
make sure to check ecx for the SSE4.1 bit.

[imirkin: switch sse4.1 to look at ecx]
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agomesa: Rely on USE_X86_64_ASM.
José Fonseca [Thu, 22 May 2014 19:43:55 +0000 (20:43 +0100)]
mesa: Rely on USE_X86_64_ASM.

This fixes MinGW x64 builds.  We don't use assembly on any of the
Windows builds, to avoid divergence between MSVC and MinGW when testing.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoscons: Fix x86_64 build.
José Fonseca [Thu, 22 May 2014 19:24:44 +0000 (20:24 +0100)]
scons: Fix x86_64 build.

x86/common_x86.c is required also for x86_64 builds.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agodocs: Import 10.1.4 release notes, add news item.
Carl Worth [Tue, 20 May 2014 22:31:34 +0000 (15:31 -0700)]
docs: Import 10.1.4 release notes, add news item.

10 years agomesa/x86: Brown bag fix for undeclared variable.
Matt Turner [Thu, 22 May 2014 18:02:18 +0000 (11:02 -0700)]
mesa/x86: Brown bag fix for undeclared variable.

10 years agoi965: Use SSE4.1 runtime detection for intel_miptree_map.
Matt Atwood [Fri, 2 May 2014 16:44:45 +0000 (09:44 -0700)]
i965: Use SSE4.1 runtime detection for intel_miptree_map.

Previous it was a compile-time decision.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa/x86: add SSE4.1 runtime detection.
Matt Atwood [Fri, 2 May 2014 16:44:44 +0000 (09:44 -0700)]
mesa/x86: add SSE4.1 runtime detection.

Add a bit to _mesa_x86_features for SSE 4.1, along with macros to query.

Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa/x86: Support SSE 4.1 detection on x86-64.
Matt Turner [Fri, 2 May 2014 19:10:17 +0000 (12:10 -0700)]
mesa/x86: Support SSE 4.1 detection on x86-64.

Uses the cpuid.h header provided by gcc and clang. Other platforms are
encouraged to switch.

10 years agomesa: Add uninitialized_vars macro from the Linux kernel.
Matt Turner [Fri, 2 May 2014 19:10:16 +0000 (12:10 -0700)]
mesa: Add uninitialized_vars macro from the Linux kernel.

10 years agoconfigure.ac: Do not enable -Wl,--no-undefined on Mac OS X.
Vinson Lee [Thu, 22 May 2014 05:13:13 +0000 (22:13 -0700)]
configure.ac: Do not enable -Wl,--no-undefined on Mac OS X.

This patch fixes this build error on Mac OS X.

  CCLD     libglapi.la
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
ld: unknown option: --no-undefined
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agohaiku: Add missing u_memory.h for FREE()
Alexander von Gluck IV [Wed, 21 May 2014 00:20:58 +0000 (19:20 -0500)]
haiku: Add missing u_memory.h for FREE()

Acked-by: Brian Paul <brianp@vmware.com>
10 years agoconfigure.ac: Remove -fstack-protector-strong from LLVM flags.
Vinson Lee [Sat, 10 May 2014 01:21:59 +0000 (18:21 -0700)]
configure.ac: Remove -fstack-protector-strong from LLVM flags.

-fstack-protector-strong is not supported by clang.

This patch fixes this build error on Fedora 20 with clang.

  CXX      gallivm/lp_bld_debug.lo
clang: error: unknown argument: '-fstack-protector-strong'

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75010
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
10 years agofreedreno/a3xx: fix blend opcode
Rob Clark [Wed, 21 May 2014 20:51:12 +0000 (16:51 -0400)]
freedreno/a3xx: fix blend opcode

Seems the opcodes are slightly different from a2xx.  Resync headers and
move blend_func() helper into hw generation specific code.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agomesa: check constant before null check
Timothy Arceri [Wed, 21 May 2014 11:26:16 +0000 (21:26 +1000)]
mesa: check constant before null check

For most drivers this if statement is always going to fail so check the constant value first.

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agofreedreno/a3xx: fix depth/stencil gmem restore
Rob Clark [Wed, 21 May 2014 19:41:25 +0000 (15:41 -0400)]
freedreno/a3xx: fix depth/stencil gmem restore

We already multiply by bytes per pixel for this, so f3ba7611 broke
mem2gmem for depth/stencil.  Drop the now-redundant mutiply by cpp.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoi965: Ask the VBO module to actually use VBOs.
Eric Anholt [Fri, 4 Oct 2013 01:52:10 +0000 (18:52 -0700)]
i965: Ask the VBO module to actually use VBOs.

Note that this covers the Begin/End rendering path, but not user vertex
arrays (so we can't drop copy_array_to_vbo_array() code).  Improves
performance of isosurf GLVERTEX|TRIANGLES by 16.7506% +/- 4.98934%
(n=20). No difference on openarena (n=10), which was why this was reverted
back in cbde2765804a4fc62bcf092230a01376aedbf2cd.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agofreedreno/a3xx: fix depth/stencil GMEM positioning
Rob Clark [Tue, 20 May 2014 18:02:18 +0000 (14:02 -0400)]
freedreno/a3xx: fix depth/stencil GMEM positioning

In cases where there was no color buf bound, there were inconsistancies
in register settings related to position of depth/stencil inside GMEM.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno: update generated headers
Rob Clark [Tue, 20 May 2014 22:49:09 +0000 (18:49 -0400)]
freedreno: update generated headers

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno: use OUT_RELOCW when buffer is written
Rob Clark [Wed, 21 May 2014 13:24:20 +0000 (09:24 -0400)]
freedreno: use OUT_RELOCW when buffer is written

These aren't buffers we ever read back from CPU, so using incorrect
reloc fxn wasn't really harming anything.  But might as well be correct.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agorbug: add missing pipe->blit() entrypoint
Rob Clark [Wed, 21 May 2014 12:41:06 +0000 (08:41 -0400)]
rbug: add missing pipe->blit() entrypoint

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
10 years agometa: Use gl_FragColor to output color values to all the draw buffers
Anuj Phogat [Mon, 19 May 2014 18:55:01 +0000 (11:55 -0700)]
meta: Use gl_FragColor to output color values to all the draw buffers

_mesa_meta_setup_blit_shader() currently generates a fragment shader
which, irrespective of the number of draw buffers, writes the color
to only one 'out' variable. Current shader rely on an undefined
behavior and possibly works by chance.

From OpenGL 4.0  spec, page 256:
  "If a fragment shader writes to gl_FragColor, DrawBuffers specifies a
   set of draw buffers into which the single fragment color defined by
   gl_FragColor is written. If a fragment shader writes to gl_FragData,
   or a user-defined varying out variable, DrawBuffers specifies a set
   of draw buffers into which each of the multiple output colors defined
   by these variables are separately written. If a fragment shader writes
   to none of gl_FragColor, gl_FragData, nor any user defined varying out
   variables, the values of the fragment colors following shader execution
   are undefined, and may differ for each fragment color."

OpenGL 4.4 spec, page 463, added an additional line in this section:
  "If some, but not all user-defined output variables are written, the
   values of fragment colors corresponding to unwritten variables are
   similarly undefined."

V2: Write color output to gl_FragColor instead of writing to multiple
    'out' variables. This'll avoid recompiling the shader every time
    draw buffers count is updated.

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agometa: Refactor _mesa_meta_setup_blit_shader() to avoid duplicate shader code
Anuj Phogat [Mon, 19 May 2014 18:47:46 +0000 (11:47 -0700)]
meta: Refactor _mesa_meta_setup_blit_shader() to avoid duplicate shader code

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agotgsi: add GS_INVOCATIONS to property names array
Ilia Mirkin [Tue, 20 May 2014 03:54:40 +0000 (23:54 -0400)]
tgsi: add GS_INVOCATIONS to property names array

In commit 4be146b1, I neglected to add the new property to the strings
array. This leads to the string '(null)' to be printed instead when
converting a GS shader to text.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agonv50,nvc0: fix 3d blits with mipmap levels
Ilia Mirkin [Sun, 18 May 2014 02:48:58 +0000 (22:48 -0400)]
nv50,nvc0: fix 3d blits with mipmap levels

Make sure to normalize the z coordinates as well as the x/y ones when
there are mipmaps present. Fixes 3d mipmap generation, which now uses
the blit path.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
10 years agonv50/ir: fix constant folding for OP_MUL subop HIGH
Ilia Mirkin [Thu, 15 May 2014 03:22:32 +0000 (23:22 -0400)]
nv50/ir: fix constant folding for OP_MUL subop HIGH

These instructions can come in either through IMUL_HI/UMUL_HI TGSI
opcodes, or from OP_DIV constant folding.

Also make sure that the constant foldings which delete the original
instruction still get counted as having done something.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
10 years agonv50/ir: fix s32 x s32 -> high s32 multiply logic
Ilia Mirkin [Thu, 15 May 2014 03:30:16 +0000 (23:30 -0400)]
nv50/ir: fix s32 x s32 -> high s32 multiply logic

Retrieving the high 32 bits of a signed multiply is rather annoying. It
appears that the simplest way to do this is to compute the absolute
value of the arguments, and perform a u32 x u32 -> u64 operation. If the
arguments' signs differ, then negate the result. Since there is no u64
support in the cvt instruction, we have the perform the 2's complement
negation "by hand".

This logic can come into use by the IMUL_HI instruction (very unlikely
to be seen), as well as from constant folding of division by a constant.
Fixes dolphin's divisions by 255.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.1 10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
10 years agoi965/fs: Assume fragment color clamping is off when precompiling.
Kenneth Graunke [Sun, 26 Jan 2014 03:22:56 +0000 (19:22 -0800)]
i965/fs: Assume fragment color clamping is off when precompiling.

Modern applications frequencly use both UNORM buffers and FLOAT buffers
with color clamping disabled.  (FLOAT with clamping explicitly enabled
and SNORM buffers appear to be less common.)  We don't need to emit
saturates in the fragment shader in either of the common cases.

Mesa sets ctx->Color._ClampFragmentColor to false if all the color
buffers are UNORM.  Also, for GL_FIXED_ONLY mode (the default in
legacy OpenGL), it will be false if any FLOAT buffers are bound.
Since the common case is false, that should be our default.

Thanks to Roland Scheidegger for pointing out some faulty logic
in v1 of this patch (unnecessary code and incorrect explanations).

v2: Drop superfluous code and reword commit message.

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