platform/upstream/mesa.git
11 years agor600g: suballocate memory for fetch shaders from a large buffer
Marek Olšák [Sun, 9 Dec 2012 17:51:31 +0000 (18:51 +0100)]
r600g: suballocate memory for fetch shaders from a large buffer

Fetch shaders are usually destroyed at the context destruction by the state
tracker, so we can put them all in a large buffer without wasting memory.

This reduces the number of relocations sent to the kernel a little bit.

Tested-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor600g: suballocate memory for the STRMOUT_BUFFER_FILLED_SIZE register
Marek Olšák [Sun, 9 Dec 2012 16:56:26 +0000 (17:56 +0100)]
r600g: suballocate memory for the STRMOUT_BUFFER_FILLED_SIZE register

Instead of having a 4-byte buffer for each streamout target, we suballocate
each dword from a 4K buffer.

This further reduces the overall number of relocations.

Tested-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agogallium/util: add a simple allocator for suballocating from a large buffer
Marek Olšák [Sun, 9 Dec 2012 16:33:28 +0000 (17:33 +0100)]
gallium/util: add a simple allocator for suballocating from a large buffer

Tested-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor600g: use u_upload_mgr for allocating staging transfer buffers
Marek Olšák [Sun, 9 Dec 2012 15:43:16 +0000 (16:43 +0100)]
r600g: use u_upload_mgr for allocating staging transfer buffers

u_upload_mgr suballocates memory from a large buffer and maps the allocated
range (unsychronized), which is perfect for short-lived staging buffers.

This reduces the number of relocations sent to the kernel.

Tested-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agowinsys/radeon: don't use BIND flags, add a flag for the cache bufmgr instead
Marek Olšák [Sat, 8 Dec 2012 23:02:46 +0000 (00:02 +0100)]
winsys/radeon: don't use BIND flags, add a flag for the cache bufmgr instead

11 years agost/dri: add a way to force MSAA on with an environment variable
Marek Olšák [Mon, 10 Dec 2012 20:35:59 +0000 (21:35 +0100)]
st/dri: add a way to force MSAA on with an environment variable

There are 2 ways. I prefer the former:
  GALLIUM_MSAA=n
  __GL_FSAA_MODE=n

Tested with ETQW, which doesn't support MSAA on Linux. This is
the only way to get MSAA there.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: don't advertise ARB_texture_buffer_object in legacy contexts
Marek Olšák [Sat, 8 Dec 2012 21:53:23 +0000 (22:53 +0100)]
mesa: don't advertise ARB_texture_buffer_object in legacy contexts

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: disallow creation of GL 3.1 compatibility contexts
Marek Olšák [Sat, 8 Dec 2012 21:48:47 +0000 (22:48 +0100)]
mesa: disallow creation of GL 3.1 compatibility contexts

Death to driver-specific hacks!

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agogallium: remove pipe_surface::usage
Marek Olšák [Sat, 8 Dec 2012 14:37:17 +0000 (15:37 +0100)]
gallium: remove pipe_surface::usage

Not really used by anybody now.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agosvga: stop using pipe_surface::usage
Marek Olšák [Sat, 8 Dec 2012 13:53:55 +0000 (14:53 +0100)]
svga: stop using pipe_surface::usage

There are only 2 possible usages: render target and depth stencil.
Both can be derived from the surface format, so the flag is redundant.

And it's going away...

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/util: move util_try_blit_via_copy_region to u_surface.c
Marek Olšák [Fri, 7 Dec 2012 19:07:48 +0000 (20:07 +0100)]
gallium/util: move util_try_blit_via_copy_region to u_surface.c

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/cso: don't use the pipe_error return type where it's not needed
Marek Olšák [Fri, 7 Dec 2012 18:59:03 +0000 (19:59 +0100)]
gallium/cso: don't use the pipe_error return type where it's not needed

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium: manage render condition in cso_context and fix postprocessing w/ it
Marek Olšák [Fri, 7 Dec 2012 18:52:00 +0000 (19:52 +0100)]
gallium: manage render condition in cso_context and fix postprocessing w/ it

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: remove a weird msaa hack
Marek Olšák [Fri, 7 Dec 2012 18:31:33 +0000 (19:31 +0100)]
st/mesa: remove a weird msaa hack

It doesn't work and it's not clear how it's supposed to work.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agosoftpipe: implement seamless cubemap support. (v1.1)
Dave Airlie [Tue, 11 Dec 2012 09:52:48 +0000 (19:52 +1000)]
softpipe: implement seamless cubemap support. (v1.1)

This adds seamless sampling for cubemap boundaries if requested.

The corner case averaging is messy but seems like it should be spec
compliant.

The face direction stuff is also a bit messy, I've no idea if that could
or should be simpler, or even if all my directions are fully correct!

v1.1: update comments, drop unneeded seamless calls for nearest, fix
if statement layout.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agogallium: fix cap warnings for tbo cap.
Dave Airlie [Tue, 11 Dec 2012 21:15:31 +0000 (07:15 +1000)]
gallium: fix cap warnings for tbo cap.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoglsl_to_tgsi: emit multi-level structs and arrays properly.
Dave Airlie [Mon, 10 Dec 2012 07:20:05 +0000 (17:20 +1000)]
glsl_to_tgsi: emit multi-level structs and arrays properly.

This follow the code from the i965 driver, and emits the structs
and arrays recursively.

This fixes an assert in the two UBO tests
fs-struct-copy-complicated and
vs-struct-copy-complicated

These tests now pass on softpipe, with no regressions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agollvmpipe: don't use user constant buffers
Brian Paul [Mon, 10 Dec 2012 19:35:23 +0000 (12:35 -0700)]
llvmpipe: don't use user constant buffers

This fixes some use-after-free issues.  I haven't measured any real
performance difference with a handful of Mesa demos.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: support pipe_resource-based constant buffers
Brian Paul [Mon, 10 Dec 2012 19:31:46 +0000 (12:31 -0700)]
llvmpipe: support pipe_resource-based constant buffers

Before this we only supported user-based constant buffers.

First, we basically plumb pipe_constant_buffer objects through llvmpipe
rather than pipe_resource objects.

Second, update llvmpipe_set_constant_buffer() and try_update_scene_state()
so they understand both resource- and user-based constant buffers.

The problem with user constant buffers is the potential for use-after-free,
as seen in some WebGL tests.  The next patch will flip the switch for
resource-based const buffers.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: add util_copy_constant_buffer() helper function
Brian Paul [Mon, 10 Dec 2012 19:29:08 +0000 (12:29 -0700)]
util: add util_copy_constant_buffer() helper function

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoi965/fs: Improve performance of shaders that start out with a discard.
Eric Anholt [Thu, 6 Dec 2012 18:15:08 +0000 (10:15 -0800)]
i965/fs: Improve performance of shaders that start out with a discard.

I had tried this in the past, but ran into trouble with applications
that sample from undiscarded pixels in the same subspan.  To fix that
issue, only jump to the end for an entire subspan at a time.

Improves GLbenchmark 2.7 (1024x768) performance by 7.9 +/- 1.5% (n=8).

v2: Drop the br variable in the jump instruction -- if I ever do jumps
    pre-gen6, it'll be a different code block anyway since we don't have
    HALT until gen6.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Rewrite discards to use a flag subreg to track discarded pixels.
Eric Anholt [Thu, 6 Dec 2012 20:15:13 +0000 (12:15 -0800)]
i965/fs: Rewrite discards to use a flag subreg to track discarded pixels.

This makes much more sense on gen6+, and will also prove useful for
early exit of shaders on discard.

v2: fix up a stale comment from before converting gen4-5.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Add an instruction flag for choosing the flag subregister.
Eric Anholt [Thu, 6 Dec 2012 18:36:11 +0000 (10:36 -0800)]
i965/fs: Add an instruction flag for choosing the flag subregister.

We're going to redo discard handling to track discards in the other flag
subregister, saving instructions in the discard and allowing predicated
jumps out to the end of the shader.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Let brw_flag_reg() choose the flag reg and subreg.
Eric Anholt [Thu, 6 Dec 2012 18:43:13 +0000 (10:43 -0800)]
i965: Let brw_flag_reg() choose the flag reg and subreg.

We're about to start using the f0.1 subregister.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Print the flag reg updated by conditional modifiers.
Eric Anholt [Thu, 6 Dec 2012 19:48:25 +0000 (11:48 -0800)]
i965: Print the flag reg updated by conditional modifiers.

This makes our output more consistent with other disasm tools, and
will be necessary when we start using f0.1.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add the new flag_reg_nr instruction field from IVB.
Eric Anholt [Thu, 6 Dec 2012 19:35:28 +0000 (11:35 -0800)]
i965: Add the new flag_reg_nr instruction field from IVB.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Correct the name and usage of the flag subregister number field.
Eric Anholt [Thu, 6 Dec 2012 18:55:26 +0000 (10:55 -0800)]
i965: Correct the name and usage of the flag subregister number field.

We've been calling it a register number, it's actually the subregister,
and things will get confusing once we start using it if it isn't fixed.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Remove bogus flag_reg_nr field from bits3.
Eric Anholt [Thu, 6 Dec 2012 19:31:31 +0000 (11:31 -0800)]
i965: Remove bogus flag_reg_nr field from bits3.

There's a flag subreg nr field in bits2 next to src0.vertstride, but
there shouldn't be anything in bits3 next to src1.vertstride.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agost/egl/drm: only unref the udev device if needed
Tobias Droste [Thu, 29 Nov 2012 16:02:28 +0000 (17:02 +0100)]
st/egl/drm: only unref the udev device if needed

Fixes compiler warning:

drm/native_drm.c: In function ‘native_create_display’:
drm/native_drm.c:180:21: warning: ‘device’ may be used uninitialized in this function [-Wmaybe-uninitialized]
drm/native_drm.c:157:24: note: ‘device’ was declared here

Signed-off-by: Tobias Droste <tdroste@gmx.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agosoftpipe: Use os_time_get_nano() everywhere.
José Fonseca [Sat, 8 Dec 2012 11:45:58 +0000 (11:45 +0000)]
softpipe: Use os_time_get_nano() everywhere.

11 years agoclover: Install CL headers.
Johannes Obermayr [Tue, 4 Dec 2012 13:18:03 +0000 (14:18 +0100)]
clover: Install CL headers.

Note: This is a candidate for the stable branches.

11 years agogallivm: Lower TGSI_OPCODE_MUL to fmul by default
Tom Stellard [Thu, 6 Dec 2012 19:56:21 +0000 (11:56 -0800)]
gallivm: Lower TGSI_OPCODE_MUL to fmul by default

This fixes a number of crashes on r600g due to the fact that
lp_build_mul assumes vector types when optimizing mul to bit shifts.

This bug was uncovered by 0ad1fefd6951aa47ab58a41dc9ee73083cbcf85c

11 years agollvmpipe: fix txq for 1d/2d arrays. (v3)
Dave Airlie [Sat, 8 Dec 2012 06:00:30 +0000 (06:00 +0000)]
llvmpipe: fix txq for 1d/2d arrays. (v3)

Noticed would fail, we were doing two things wrong

a) 1d arrays require the layers in height
b) minifying the layers field.

v2: don't change height code, fixup completely inside txq
as suggested by Roland.

v3: just add minify before texture array size

v1: Reviewed-by: Jose Fonseca <jfonseca@vmware.com>

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agollvmpipe: increase texture target width to reflect increase
Dave Airlie [Sat, 8 Dec 2012 05:41:03 +0000 (05:41 +0000)]
llvmpipe: increase texture target width to reflect increase

Now that we've gone over 7.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agomesa syncobj: don't store a pointer to the set_entry
Jordan Justen [Sat, 8 Dec 2012 20:43:10 +0000 (12:43 -0800)]
mesa syncobj: don't store a pointer to the set_entry

The set_entry pointer can become invalid if the set table
is re-hashed.

This likely will fix
https://bugs.freedesktop.org/show_bug.cgi?id=58012
(Regression since 56e95d3c)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agovega: remove unused variables
Fabio Pedretti [Fri, 7 Dec 2012 22:00:05 +0000 (23:00 +0100)]
vega: remove unused variables

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agonvc0: comment unused nvc0_validate_zcull function
Fabio Pedretti [Fri, 7 Dec 2012 22:00:00 +0000 (23:00 +0100)]
nvc0: comment unused nvc0_validate_zcull function

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agonv50: remove unused OpClassStr array
Fabio Pedretti [Fri, 7 Dec 2012 21:59:53 +0000 (22:59 +0100)]
nv50: remove unused OpClassStr array

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agor200: fix broken tcl lighting
smoki [Mon, 10 Dec 2012 16:30:26 +0000 (17:30 +0100)]
r200: fix broken tcl lighting

command mistakenly used vector instead of scalar emit (the more or less
identical code in radeon is already correct).
Seems like it would be broken ever since kms probably.
Should fix bugs 22576, 26809.

11 years agost_glsl_to_tgsi: fix ubo bools.
Dave Airlie [Mon, 10 Dec 2012 04:25:49 +0000 (14:25 +1000)]
st_glsl_to_tgsi: fix ubo bools.

This should fix the ubo boolean tests, along with the previous
ubo loading fix.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agost_glsl_to_tgsi: call ubo load pass earlier
Dave Airlie [Mon, 10 Dec 2012 04:22:34 +0000 (14:22 +1000)]
st_glsl_to_tgsi: call ubo load pass earlier

This calls it in around the same place as the 965 driver.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoglsl_to_tgsi: fix texture offset translation
Dave Airlie [Mon, 10 Dec 2012 02:23:47 +0000 (12:23 +1000)]
glsl_to_tgsi: fix texture offset translation

I noticed the texelFetch offset test failed on 2D rect samplers
with GLSL 1.40. This is because I wrote the immediate->offset
translation wrong.

Fixed the translation to actually use the ureg info to set the
offsets up.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrisw: fix up context and apis for software context
Dave Airlie [Sun, 9 Dec 2012 10:28:56 +0000 (20:28 +1000)]
drisw: fix up context and apis for software context

This ports over from the dri2 code to the drisw bits. It means 3.1
core contexts now work for softpipe.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoi965: Add missing _NEW_BUFFERS dirty bit in Gen7 SBE state.
Kenneth Graunke [Thu, 29 Nov 2012 10:40:09 +0000 (02:40 -0800)]
i965: Add missing _NEW_BUFFERS dirty bit in Gen7 SBE state.

This is needed to compute render_to_fbo.  It even has the comment.

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agost/mesa: set PIPE_BIND_SAMPLER_VIEW for TBOs in st_bufferobj_data
Christoph Bumiller [Sat, 8 Dec 2012 15:02:54 +0000 (16:02 +0100)]
st/mesa: set PIPE_BIND_SAMPLER_VIEW for TBOs in st_bufferobj_data

11 years agonvc0/ir: allow neg,abs modifiers on OP_SET with integer result
Christoph Bumiller [Sat, 8 Dec 2012 18:46:14 +0000 (19:46 +0100)]
nvc0/ir: allow neg,abs modifiers on OP_SET with integer result

11 years agonvc0/ir/emit: fix check for flags register use in logic ops
Christoph Bumiller [Sat, 8 Dec 2012 14:06:43 +0000 (15:06 +0100)]
nvc0/ir/emit: fix check for flags register use in logic ops

11 years agodraw: fix/improve dirty state validation
Brian Paul [Fri, 7 Dec 2012 20:58:34 +0000 (13:58 -0700)]
draw: fix/improve dirty state validation

This patch does two things:

1. Constant buffer state changes were broken (but happened to work by
   dumb luck).  The problem is we weren't calling draw_do_flush() in
   draw_set_mapped_constant_buffer() when we changed that state.  All the
   other draw_set_foo() functions were calling draw_do_flush() already.

2. Use a simpler state validation step when we're changing light-weight
   parameter state such as constant buffers, viewport dims or clip planes.
   There's no need to revalidate the whole pipeline when changing state
   like that.  The new validation method is called bind_parameters()
   and is called instead of the prepare() method.  A new
   DRAW_FLUSH_PARAMETER_CHANGE flag is used to signal these light-weight
   state changes.  This results in a modest but measurable increase in
   FPS for many Mesa demos.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: add reminder comments about similar code in different files
Brian Paul [Fri, 7 Dec 2012 19:21:08 +0000 (12:21 -0700)]
draw: add reminder comments about similar code in different files

When one function is changed, also look at the other.
Presently, there are some differences with respect to geometry
shaders and instanced drawing...

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: rearrange code in llvm_middle_end_prepare()
Brian Paul [Fri, 7 Dec 2012 19:15:28 +0000 (12:15 -0700)]
draw: rearrange code in llvm_middle_end_prepare()

To clean it up and make it look more like the non-LLVM
fetch_pipeline_prepare() function.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: fix comment typo
Brian Paul [Fri, 7 Dec 2012 19:41:22 +0000 (12:41 -0700)]
draw: fix comment typo

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: add comment on draw->pt.opt field
Brian Paul [Fri, 7 Dec 2012 19:33:27 +0000 (12:33 -0700)]
draw: add comment on draw->pt.opt field

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: update a comment about index buffers
Brian Paul [Fri, 7 Dec 2012 19:26:18 +0000 (12:26 -0700)]
draw: update a comment about index buffers

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium/os: Fix nano->micro second concersion.
José Fonseca [Sat, 8 Dec 2012 11:15:46 +0000 (11:15 +0000)]
gallium/os: Fix nano->micro second concersion.

copy'n'paste: best friend, worst enemy..

Trivial.

11 years agollvmpipe: fix missing tbo cap warning.
Dave Airlie [Sat, 8 Dec 2012 03:46:32 +0000 (03:46 +0000)]
llvmpipe: fix missing tbo cap warning.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agomesa/st: add ARB_uniform_buffer_object support (v2)
Dave Airlie [Thu, 6 Dec 2012 06:16:10 +0000 (16:16 +1000)]
mesa/st: add ARB_uniform_buffer_object support (v2)

this adds UBO support to the state tracker, it works with softpipe
as-is.

It uses UARL + CONST[x][ADDR[0].x] type constructs.

v2: don't disable UBOs if geom shaders don't exist (me)
rename upload to bind (calim)
fix 12 -> 13 comparison as comment (calim + brianp)
fix signed->unsigned (Brian)
remove assert (Brian)

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agosoftpipe: enable GLSL 1.40
Dave Airlie [Thu, 6 Dec 2012 06:14:25 +0000 (16:14 +1000)]
softpipe: enable GLSL 1.40

This enables GLSL 1.40 advertising by softpipe.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agosoftpipe: add texture buffer object support
Dave Airlie [Thu, 6 Dec 2012 06:14:03 +0000 (16:14 +1000)]
softpipe: add texture buffer object support

This adds TBO support to softpipe.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agost/mesa: add option to enable GLSL 1.40
Dave Airlie [Thu, 6 Dec 2012 06:13:15 +0000 (16:13 +1000)]
st/mesa: add option to enable GLSL 1.40

Allow GLSL 1.40 to be enabled if the driver advertises it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agost/mesa: add texture buffer object support to state tracker (v1.1)
Dave Airlie [Thu, 6 Dec 2012 06:12:11 +0000 (16:12 +1000)]
st/mesa: add texture buffer object support to state tracker (v1.1)

This adds the necessary changes to the st to allow texture buffer object
support if the driver advertises it.

v1.1: remove extra blank line and whitespace

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agogallium: add new texture buffer object capability
Dave Airlie [Thu, 6 Dec 2012 06:10:40 +0000 (16:10 +1000)]
gallium: add new texture buffer object capability

this just adds the define to the header.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agomesa/meta: Move declaration before statements.
José Fonseca [Sat, 8 Dec 2012 01:05:52 +0000 (01:05 +0000)]
mesa/meta: Move declaration before statements.

11 years agomesa: Move declaration before statement.
José Fonseca [Sat, 8 Dec 2012 01:02:30 +0000 (01:02 +0000)]
mesa: Move declaration before statement.

For MSVC's sake.

11 years agointel: Enable ETC2 support on intel hardware
Anuj Phogat [Mon, 17 Sep 2012 21:52:10 +0000 (14:52 -0700)]
intel: Enable ETC2 support on intel hardware

This patch enables support for ETC2 compressed textures on
all intel hardware. At present, ETC2 texture decoding is not
available on intel hardware. So, compressed ETC2 texture data
is decoded in software and stored in a suitable uncompressed
MESA_FORMAT at the time of glCompressedTexImage2D. Currently,
ETC2 formats are only exposed in OpenGL ES 3.0.

V2: Use single etc_wraps variable for both etc1 and etc2.
V3: Remove redundant code and use just one intel_miptree_map_etc()
    and intel_miptree_unmap_etc() function.
    Choose MESA_FORMAT_SIGNED_{R16, GR1616} for ETC2 signed-{r11, rg11}
    formats

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2
Anuj Phogat [Tue, 23 Oct 2012 19:22:20 +0000 (12:22 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2

Data in GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 format is decoded and stored
in MESA_FORMAT_SARGB.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
Anuj Phogat [Mon, 22 Oct 2012 20:34:30 +0000 (13:34 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2

Data in GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 format is decoded and stored
in MESA_FORMAT_RGBA8888_REV.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SIGNED_RG11_EAC
Anuj Phogat [Wed, 10 Oct 2012 20:46:20 +0000 (13:46 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_SIGNED_RG11_EAC

Data in GL_COMPRESSED_SIGNED_RG11_EAC format is decoded and stored in
MESA_FORMAT_SIGNED_GR1616.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SIGNED_R11_EAC
Anuj Phogat [Wed, 10 Oct 2012 00:02:37 +0000 (17:02 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_SIGNED_R11_EAC

Data in GL_COMPRESSED_SIGNED_R11_EAC format is decoded and stored in
MESA_FORMAT_SIGNED_R16.

v2:
16 bit signed data is converted to 16 bit unsigned data by
adding 2 ^ 15 and stored in an unsigned texture format.

v3:
1. Handle a corner case when base code word value is -128. As per
OpenGL ES 3.0 specification -128 is not an allowed value and should
be truncated to -127.
2. Converting a decoded 16 bit signed data to 16 bit unsigned data by
adding 2 ^ 15 gives us an output which matches the decompressed image
(.ppm) generated by ericsson's etcpack tool. ericsson is also doing this
conversion in their tool because .ppm image files don't support signed
data. But gles 3.0 specification doesn't suggest this conversion. We
need to keep the decoded data in signed format. Both signed format
tests in gles3 conformance pass with these changes.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_RG11_EAC
Anuj Phogat [Tue, 13 Nov 2012 00:32:08 +0000 (16:32 -0800)]
mesa: Add decoding functions for GL_COMPRESSED_RG11_EAC

Data in GL_COMPRESSED_RG11_EAC format is decoded and stored in
MESA_FORMAT_RG1616.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_R11_EAC
Anuj Phogat [Tue, 13 Nov 2012 00:28:07 +0000 (16:28 -0800)]
mesa: Add decoding functions for GL_COMPRESSED_R11_EAC

Data in GL_COMPRESSED_R11_EAC format is decoded and stored in
MESA_FORMAT_R16.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
Anuj Phogat [Tue, 13 Nov 2012 00:13:25 +0000 (16:13 -0800)]
mesa: Add decoding functions for GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC

Data in GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC format is decoded and stored
in MESA_FORMAT_SARGB8.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_RGBA8_ETC2_EAC
Anuj Phogat [Mon, 12 Nov 2012 23:58:25 +0000 (15:58 -0800)]
mesa: Add decoding functions for GL_COMPRESSED_RGBA8_ETC2_EAC

Data in GL_COMPRESSED_RGBA8_ETC2_EAC format is decoded and stored
in MESA_FORMAT_RGBA8888_REV.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_SRGB8_ETC2
Anuj Phogat [Fri, 28 Sep 2012 00:05:24 +0000 (17:05 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_SRGB8_ETC2

Data in GL_COMPRESSED_SRGB8_ETC2 format is decoded and stored
in MESA_FORMAT_SARGB8.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add decoding functions for GL_COMPRESSED_RGB8_ETC2
Anuj Phogat [Mon, 17 Sep 2012 21:47:56 +0000 (14:47 -0700)]
mesa: Add decoding functions for GL_COMPRESSED_RGB8_ETC2

Data in GL_COMPRESSED_RGB8_ETC2 format is decoded and stored in
MESA_FORMAT_RGBX8888_REV.

v2: Use CLAMP macro and stdbool.h
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Make nonlinear_to_linear() function available outside file
Anuj Phogat [Tue, 13 Nov 2012 01:58:46 +0000 (17:58 -0800)]
mesa: Make nonlinear_to_linear() function available outside file

This patch changes nonlinear_to_linear() function to non static inline
and makes it available outside format_unpack.c. Also, removes the
duplicate copies in other files.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Add new MESA_FORMATs for ETC2 compressed textures
Anuj Phogat [Tue, 6 Nov 2012 01:45:18 +0000 (17:45 -0800)]
mesa: Add new MESA_FORMATs for ETC2 compressed textures

It is required by OpenGL ES 3.0 to support ETC2 textures.
This patch adds new MESA_FORMATs for following etc2 texture
formats:
 GL_COMPRESSED_RGB8_ETC2
 GL_COMPRESSED_SRGB8_ETC2
 GL_COMPRESSED_RGBA8_ETC2_EAC
 GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC
 GL_COMPRESSED_R11_EAC
 GL_COMPRESSED_RG11_EAC
 GL_COMPRESSED_SIGNED_R11_EAC
 GL_COMPRESSED_SIGNED_RG11_EAC
 MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1
 MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1

Above formats are currently available in only gles 3.0.

v2: Add entries in texfetch_funcs[] array.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
v3 (Paul Berry <stereotype441@gmail.com>): comment out symbols that
are not implemented yet, so that this commit compiles on its own;
future commits will uncomment the symbols as they become available.

11 years agometa: Use #version 300 es for _mesa_glsl_Clear's integer shaders on ES3.
Kenneth Graunke [Tue, 20 Nov 2012 05:59:59 +0000 (21:59 -0800)]
meta: Use #version 300 es for _mesa_glsl_Clear's integer shaders on ES3.

Fixes es3conform's color_buffer_float_clamp_(fixed|on|off) tests.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agometa: Use #version 300 es in GenerateMipmap shaders on ES3.
Kenneth Graunke [Tue, 20 Nov 2012 05:51:25 +0000 (21:51 -0800)]
meta: Use #version 300 es in GenerateMipmap shaders on ES3.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoSet es_version to false when using FF fragment shading in meta ops
Paul Berry [Wed, 8 Aug 2012 18:30:42 +0000 (11:30 -0700)]
Set es_version to false when using FF fragment shading in meta ops

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: Use the new hash table for the variable refcount visitor.
Eric Anholt [Wed, 17 Oct 2012 22:20:09 +0000 (15:20 -0700)]
mesa: Use the new hash table for the variable refcount visitor.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
[jordan.l.justen@intel.com: open_hash_table => hash_table]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoprogram/hash_table.c: rename to program/prog_hash_table.c
Jordan Justen [Sat, 1 Dec 2012 00:32:11 +0000 (16:32 -0800)]
program/hash_table.c: rename to program/prog_hash_table.c

Removes a collision of the object file name for main/hash_table
and program/hash_table.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agomesa: Ignore size and offset parameters for BindBufferRange when buffer is 0
Matt Turner [Wed, 5 Dec 2012 01:52:00 +0000 (17:52 -0800)]
mesa: Ignore size and offset parameters for BindBufferRange when buffer is 0

The ES 3 conformance suite unbinds buffers (by binding buffer 0) and
passes zero for the size and offset, which the spec explicitly
disallows. Otherwise, this seems like a reasonable thing to do.

Khronos will be changing the spec to allow this (bug 9765). Fixes
es3conform's transform_feedback_init_defaults test.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agonv50,nvc0: fix shader eviction
Christoph Bumiller [Fri, 7 Dec 2012 21:43:10 +0000 (22:43 +0100)]
nv50,nvc0: fix shader eviction

11 years agonv50,nvc0: add support for cube map arrays
Christoph Bumiller [Fri, 7 Dec 2012 21:47:40 +0000 (22:47 +0100)]
nv50,nvc0: add support for cube map arrays

NOTE: nv50 support not enabled, someone with nva3/8 please fix.

11 years agor300: Don't disable destination read if the src blend factor needs it
Stefan Dösinger [Fri, 7 Dec 2012 16:38:35 +0000 (17:38 +0100)]
r300: Don't disable destination read if the src blend factor needs it

The read can remain disabled if the src alpha factor needs it because
the result would still be zero.

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

NOTE: This is a candidate for stable release branches.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
11 years agogallium/egl-static: Fix unresolved symbol 'clock_gettime'.
Michel Dänzer [Fri, 7 Dec 2012 11:20:57 +0000 (12:20 +0100)]
gallium/egl-static: Fix unresolved symbol 'clock_gettime'.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agogallivm: Rudimentary native integer support.
José Fonseca [Tue, 4 Dec 2012 19:06:54 +0000 (19:06 +0000)]
gallivm: Rudimentary native integer support.

Just enough for draw module to work ok.

This improves "piglit attribs GL3", though something fishy is still
happening with certain unsigned integer values.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: Dump LLVM shader key.
José Fonseca [Tue, 4 Dec 2012 16:55:32 +0000 (16:55 +0000)]
draw: Dump LLVM shader key.

Just like we do in llvmpipe for the fragment shader compilation key.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm: Allow indirection from TEMP registers too.
José Fonseca [Tue, 4 Dec 2012 16:54:41 +0000 (16:54 +0000)]
gallivm: Allow indirection from TEMP registers too.

The ADDR file is cumbersome for native integer capable drivers.  We
should consider deprecating it eventually, but this just adds support
for indirection from TEMP registers.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallivm,llvmpipe,draw: Support multiple constant buffers.
José Fonseca [Tue, 4 Dec 2012 14:52:44 +0000 (14:52 +0000)]
gallivm,llvmpipe,draw: Support multiple constant buffers.

Support 16 (defined in LP_MAX_TGSI_CONST_BUFFERS) as opposed to 32 (as
defined by PIPE_MAX_CONSTANT_BUFFERS) because that would make the jit
context become unnecessarily large.

v2: Bump limit from 4 to 16 to cover ARB_uniform_buffer_object needs,
per Dave Airlie.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: implement MSAA for GLX/DRI2 framebuffers
Marek Olšák [Mon, 3 Dec 2012 04:36:08 +0000 (05:36 +0100)]
st/dri: implement MSAA for GLX/DRI2 framebuffers

All MSAA buffers are allocated privately and resolved into the DRI-provided
back and front buffers.

If an MSAA visual is chosen, the buffers st/mesa receives are all
multi-sample. st/mesa doesn't have access to the single-sample buffers
in that case.

This makes MSAA work in games like Nexuiz.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium: pass the current context to the flush_front state tracker function
Marek Olšák [Mon, 3 Dec 2012 15:24:59 +0000 (16:24 +0100)]
gallium: pass the current context to the flush_front state tracker function

I will later use the context to resolve an MSAA front buffer.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: don't expose MSAA configs with accumulation buffer
Marek Olšák [Mon, 3 Dec 2012 02:40:43 +0000 (03:40 +0100)]
st/dri: don't expose MSAA configs with accumulation buffer

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: refactor dri_fill_in_modes
Marek Olšák [Mon, 3 Dec 2012 02:21:04 +0000 (03:21 +0100)]
st/dri: refactor dri_fill_in_modes

- We can use a single loop for adding new configs.
- The useless parameter depth_bits is removed.
- The maximum number of samples is bumped to 32.
- We can support Z16_UNORM and Z32_UNORM unconditionally since the zbuffers
  are private.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/dri: always allocate private depth-stencil buffers
Marek Olšák [Mon, 3 Dec 2012 00:26:22 +0000 (01:26 +0100)]
st/dri: always allocate private depth-stencil buffers

This disables DRI2 sharing of zbuffers. The window zbuffer is allocated just
like any other texture - through resource_create.

The idea of allocating a zbuffer through DRI2 isn't very useful with MSAA,
where a single-sample zbuffer is useless.

IIRC, the Intel driver does the same thing.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: implement CopyTexSubImage for MSAA framebuffers
Marek Olšák [Mon, 3 Dec 2012 16:34:58 +0000 (17:34 +0100)]
st/mesa: implement CopyTexSubImage for MSAA framebuffers

Reviewed-by: Brian Paul <brianp@vmware.com>
Just use pipe->blit, which can do resolve, flipping, and format conversions.
The util_blit_pixels codepath is still there for the cases where we have to
force alpha to 1.

This also turns on acceleration for copying GL_DEPTH_STENCIL.

11 years agogallium/u_blitter: fix conflict with u_memory.h
Marek Olšák [Mon, 3 Dec 2012 20:31:04 +0000 (21:31 +0100)]
gallium/u_blitter: fix conflict with u_memory.h

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g: transfers of MSAA color textures should do the resolve
Marek Olšák [Mon, 3 Dec 2012 21:21:39 +0000 (22:21 +0100)]
r600g: transfers of MSAA color textures should do the resolve

so that ReadPixels and various fallbacks work.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotrace: dump pipe_resource::nr_samples
Marek Olšák [Mon, 3 Dec 2012 04:35:30 +0000 (05:35 +0100)]
trace: dump pipe_resource::nr_samples

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoglx/dri2: set the __DRI2_FLUSH_DRAWABLE flag where it should be set
Marek Olšák [Mon, 3 Dec 2012 04:15:11 +0000 (05:15 +0100)]
glx/dri2: set the __DRI2_FLUSH_DRAWABLE flag where it should be set

Sorry, I accidentally omitted this.

It only broke MLAA.

Reviewed-by: Brian Paul <brianp@vmware.com>