mesa.git
11 years agor300g/swtcl: simplify vertex uploading
Marek Olšák [Fri, 4 Jan 2013 17:00:46 +0000 (18:00 +0100)]
r300g/swtcl: simplify vertex uploading

- skip the vertex buffer reallocation in flush and just use
  the unsynchronized flag to get new memory.
- remove the cruft needed to get around the issues with the vertex buffer
  reallocation in flush
- use pb_buffer instead of pipe_resource

11 years agor300g/swtcl: fix crash when setting vertex buffers
Marek Olšák [Fri, 4 Jan 2013 17:27:21 +0000 (18:27 +0100)]
r300g/swtcl: fix crash when setting vertex buffers

Broken by e73bf3b805de78299f1a652668ba4e6eab9bac94.

11 years agor300g: don't set PIPE_BIND flags for internal textures
Marek Olšák [Wed, 2 Jan 2013 19:23:57 +0000 (20:23 +0100)]
r300g: don't set PIPE_BIND flags for internal textures

11 years agoi965: Fix glCompressedTexSubImage2D offsets for ETC textures.
Paul Berry [Sat, 29 Dec 2012 19:31:37 +0000 (11:31 -0800)]
i965: Fix glCompressedTexSubImage2D offsets for ETC textures.

This patch fixes intel_miptree_unmap_etc() (which decompresses ETC
textures to linear) to pay attention to map->x and map->y when writing
to the destination image.  Previously these values were ignored,
causing the xoffset and yoffset parameters passed to
glCompressedTexSubImage2D() to be ignored.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoegl/wayland: Remove kooky flush code
Kristian Høgsberg [Fri, 14 Dec 2012 04:32:51 +0000 (23:32 -0500)]
egl/wayland: Remove kooky flush code

We used to have to jump through hoops to call glFlush at swap buffer time,
but the flush extension made that unnecessary a long time ago.

11 years agoegl/wayland: Remove confusing comment about front buffer rendering
Kristian Høgsberg [Fri, 14 Dec 2012 04:21:46 +0000 (23:21 -0500)]
egl/wayland: Remove confusing comment about front buffer rendering

11 years agoegl_dri2: Remove unused struct dri2_egl_buffer from header file
Kristian Høgsberg [Fri, 14 Dec 2012 04:20:16 +0000 (23:20 -0500)]
egl_dri2: Remove unused struct dri2_egl_buffer from header file

11 years agoegl: Add extension infrastructure for EGL_EXT_buffer_age
Kristian Høgsberg [Thu, 13 Dec 2012 20:59:24 +0000 (15:59 -0500)]
egl: Add extension infrastructure for EGL_EXT_buffer_age

11 years agoegl: Update to revision 19987 of eglext.h
Kristian Høgsberg [Fri, 14 Dec 2012 04:44:09 +0000 (23:44 -0500)]
egl: Update to revision 19987 of eglext.h

This pulls in EGL_EXT_buffer_age.

11 years agoutil: move var declaration before loop to fix MSVC error
Brian Paul [Fri, 4 Jan 2013 15:21:12 +0000 (08:21 -0700)]
util: move var declaration before loop to fix MSVC error

11 years agor600g: implement 3D transfers
Marek Olšák [Thu, 20 Dec 2012 02:45:49 +0000 (03:45 +0100)]
r600g: implement 3D transfers

That means we can map and read multiple slices with one transfer_map call.

11 years agost/mesa: fix assertion failures with 2101010 vertex formats
Marek Olšák [Thu, 20 Dec 2012 16:00:06 +0000 (17:00 +0100)]
st/mesa: fix assertion failures with 2101010 vertex formats

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: accelerate CopyTexSubImage for 1D array textures
Marek Olšák [Thu, 20 Dec 2012 15:40:33 +0000 (16:40 +0100)]
st/mesa: accelerate CopyTexSubImage for 1D array textures

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix CopyTexSubImage fallback for 1D array textures
Marek Olšák [Thu, 20 Dec 2012 14:15:15 +0000 (15:15 +0100)]
st/mesa: fix CopyTexSubImage fallback for 1D array textures

- We should use a 3D transfer of size Width x 1 x NumLayers.
- We should use layer_stride instead of stride.
  (even though they are likely to be equal with 1D array textures)

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix GetTexImage for compressed 2D array textures
Marek Olšák [Thu, 20 Dec 2012 02:54:33 +0000 (03:54 +0100)]
st/mesa: fix GetTexImage for compressed 2D array textures

This uses a 3D blit to decompress the texture and then a 3D transfer
to read it.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/util: remove unused helper util_create_rgba_texture
Marek Olšák [Thu, 20 Dec 2012 01:33:45 +0000 (02:33 +0100)]
gallium/util: remove unused helper util_create_rgba_texture

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: try to find the format matching format+type in decompressed_with_blit
Marek Olšák [Thu, 20 Dec 2012 01:09:56 +0000 (02:09 +0100)]
st/mesa: try to find the format matching format+type in decompressed_with_blit

There was the fast path based on _mesa_format_matches_format_and_type
for GetTexImage, but it never worked, because the Mesa format we were testing
there was always compressed. Further testing showed that the fast path
had been completely broken.

In this commit, the somewhat limited helper util_create_rgba_texture is
no longer used and instead, custom code for the texture creation is added,
which tries to find the best matching RGBA8 format, so that we can hit
the fast path *always* if the read format is a variant of RGBA8 and supported
by the driver.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/mesa: fix GetTexImage for compressed cubemaps
Marek Olšák [Thu, 20 Dec 2012 00:41:57 +0000 (01:41 +0100)]
st/mesa: fix GetTexImage for compressed cubemaps

I'll deal with 2D arrays later.

NOTE: This is a candidate for the stable branches.

11 years agogallium/u_blitter: implement 3D blitting
Marek Olšák [Thu, 20 Dec 2012 02:43:57 +0000 (03:43 +0100)]
gallium/u_blitter: implement 3D blitting

Scaling and flipping in the Z direction isn't allowed yet.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_blitter: fix blitting TEXTURE_CUBE_ARRAY with a non-zero cube index
Marek Olšák [Thu, 20 Dec 2012 12:08:00 +0000 (13:08 +0100)]
gallium/u_blitter: fix blitting TEXTURE_CUBE_ARRAY with a non-zero cube index

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_blitter: minor simplification
Marek Olšák [Thu, 20 Dec 2012 02:42:11 +0000 (03:42 +0100)]
gallium/u_blitter: minor simplification

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_blitter: unify some parameters into a dstbox parameter in blit_generic
Marek Olšák [Wed, 19 Dec 2012 22:06:51 +0000 (23:06 +0100)]
gallium/u_blitter: unify some parameters into a dstbox parameter in blit_generic

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/u_blitter: remove useless parameter from blitter_default_dst_texture
Marek Olšák [Wed, 19 Dec 2012 21:25:22 +0000 (22:25 +0100)]
gallium/u_blitter: remove useless parameter from blitter_default_dst_texture

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/util: complete implementation of util_dump_transfer
Marek Olšák [Thu, 20 Dec 2012 14:07:35 +0000 (15:07 +0100)]
gallium/util: complete implementation of util_dump_transfer

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: allow TEXTURE_CUBE_MAP_ARRAY in GetTexImage
Marek Olšák [Thu, 20 Dec 2012 02:57:39 +0000 (03:57 +0100)]
mesa: allow TEXTURE_CUBE_MAP_ARRAY in GetTexImage

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium/radeon: send the END_OF_FRAME flag to the DRM
Marek Olšák [Fri, 21 Dec 2012 16:15:56 +0000 (17:15 +0100)]
gallium/radeon: send the END_OF_FRAME flag to the DRM

11 years agogallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag
Marek Olšák [Fri, 21 Dec 2012 16:03:22 +0000 (17:03 +0100)]
gallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag

Usage with pipe_context:
  pipe->flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);

Usage with st_context_iface:
  st->flush(st, ST_FLUSH_END_OF_FRAME, NULL);

The flag is only a hint for drivers. Radeon will use it for buffer eviction
heuristics in the kernel (e.g. for queries like how many frames have passed
since a buffer was used).

The flag is currently only generated by st/dri on SwapBuffers.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
11 years agoradeonsi: fix int->bool conversion in fence_signalled
Marek Olšák [Fri, 4 Jan 2013 11:40:33 +0000 (12:40 +0100)]
radeonsi: fix int->bool conversion in fence_signalled

11 years agor600g: fix int->bool conversion in fence_signalled
Marek Olšák [Fri, 4 Jan 2013 11:40:04 +0000 (12:40 +0100)]
r600g: fix int->bool conversion in fence_signalled

NOTE: This is a candidate for the stable branches.

11 years agoAdd new .gitignore entries for Automake 1.13 tests
Paul Berry [Thu, 3 Jan 2013 19:51:38 +0000 (11:51 -0800)]
Add new .gitignore entries for Automake 1.13 tests

Automake 1.13 creates a bunch of new build artefacts:
- bin/test-driver, a script for running tests.
- *.trs files for every "make check" test result.
- *.log files containing the output of every test run by "make check".

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Replace structs with bit-shifting for Gen7 SURFACE_STATE entries.
Kenneth Graunke [Fri, 28 Dec 2012 20:45:14 +0000 (12:45 -0800)]
i965: Replace structs with bit-shifting for Gen7 SURFACE_STATE entries.

Every generation except Gen7 creates SURFACE_STATE entries via a
uint32_t array.  Only Gen7 uses the older bitfield structure, which we
moved away from because it was less efficient.  Convert it for
consistency.

This reduces the compiled size of gen7_wm_surface_state.o by 2.86% in a
release build.

v2: Fix accidental use of BRW_SURFACE_WIDTH/HEIGHT in brw_state_dump.c;
    switch back to gen7_set_surface_mcs_info setting surf[6] directly
    (both per Eric's review comments).

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoradeon/r200: Fix tcl culling
smoki [Thu, 3 Jan 2013 17:57:40 +0000 (18:57 +0100)]
radeon/r200: Fix tcl culling

Should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=57842

11 years agowayland: Don't cancel a roundtrip when any event is received
Jonas Ådahl [Tue, 25 Dec 2012 12:01:08 +0000 (13:01 +0100)]
wayland: Don't cancel a roundtrip when any event is received

Since wl_display_dispatch_queue() returns the number of processed events
or -1 on error, only cancel the roundtrip if an -1 is returned.

This also fixes a potential memory corruption bug happening when the
roundtrip does an early return and the callback later writes to the then
out of scope stack allocated `done' parameter.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
11 years agoi965: Add break statement at end of BRW_OPCODE_CONTINUE case.
Vinson Lee [Wed, 2 Jan 2013 01:02:38 +0000 (17:02 -0800)]
i965: Add break statement at end of BRW_OPCODE_CONTINUE case.

Fixes missing break in switch defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoegl/android: Fix build for Jelly Bean (v2)
Chad Versace [Thu, 20 Dec 2012 22:16:50 +0000 (14:16 -0800)]
egl/android: Fix build for Jelly Bean (v2)

In Jelly Bean, the interface to ANativeWindow changed. The change included
adding a new parameter the queueBuffer and dequeueBuffer methods,
removing the lockBuffer method, and requiring libsync.

v2:
  - s/fence_fd == -1/fence_fd != -1/
  - Fix leak. Close the fence_fd.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoandroid: Define Make variables for Android version
Chad Versace [Thu, 20 Dec 2012 22:14:51 +0000 (14:14 -0800)]
android: Define Make variables for Android version

Define the following Make variables:
    MESA_ANDROID_MAJOR_VERSION
    MESA_ANDROID_MINOR_VERSION
    MESA_ANDROID_VERSION

These variable will allow us to make version-dependent decisions on
library dependencies. In particular, building Mesa against JellyBean will
require libsync.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agomesa: Add missing ASSERT_OUTSIDE_BEGIN_END to GetSamplerParameter*
Matt Turner [Mon, 31 Dec 2012 21:41:57 +0000 (13:41 -0800)]
mesa: Add missing ASSERT_OUTSIDE_BEGIN_END to GetSamplerParameter*

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Add missing ASSERT_OUTSIDE_BEGIN_END to SamplerParameter*
Matt Turner [Mon, 31 Dec 2012 21:10:32 +0000 (13:10 -0800)]
mesa: Add missing ASSERT_OUTSIDE_BEGIN_END to SamplerParameter*

Commit f22d49de added the SamplerParamter* functions but only used
ASSERT_OUTSIDE_BEGIN_END inside the -f and -fv versions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Mark _mesa_{init,delete}_sampler_object as static
Matt Turner [Mon, 31 Dec 2012 20:58:08 +0000 (12:58 -0800)]
mesa: Mark _mesa_{init,delete}_sampler_object as static

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglcpp: Typo fix.
Adam Jackson [Wed, 2 Jan 2013 19:09:22 +0000 (14:09 -0500)]
glcpp: Typo fix.

Note: this is a candidate for the 9.0 stable branch.

Signed-off-by: Adam Jackson <ajax@redhat.com>
11 years agor300g: Fix visibility CFLAGS in automake
Adam Jackson [Wed, 2 Jan 2013 19:04:18 +0000 (14:04 -0500)]
r300g: Fix visibility CFLAGS in automake

Note: this is a candidate for the 9.0 stable branch.

Signed-off-by: Adam Jackson <ajax@redhat.com>
11 years agogalahad, noop: Fix visibility CFLAGS in automake
Adam Jackson [Wed, 2 Jan 2013 19:02:59 +0000 (14:02 -0500)]
galahad, noop: Fix visibility CFLAGS in automake

Note: this is a candidate for the 9.0 stable branch.

Signed-off-by: Adam Jackson <ajax@redhat.com>
11 years agoglcpp: Fix visibility CFLAGS in automake
Adam Jackson [Wed, 2 Jan 2013 19:02:00 +0000 (14:02 -0500)]
glcpp: Fix visibility CFLAGS in automake

Note: this is a candidate for the 9.0 stable branch.

Signed-off-by: Adam Jackson <ajax@redhat.com>
11 years agomesa: Implement compressed 2D array textures.
Paul Berry [Fri, 28 Dec 2012 19:26:06 +0000 (11:26 -0800)]
mesa: Implement compressed 2D array textures.

This patch adds functionality to Mesa to upload compressed
2-dimensional array textures, using the glCompressedTexImage3D and
glCompressedTexSubImage3D calls.

Fixes piglit tests "EXT_texture_array/compressed *" and "!OpenGL ES
3.0/ext_texture_array-compressed_gles3 *".  Also partially fixes GLES3
conformance test "CoverageES30.test".

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: Fix error reporting in _mesa_invalidate_pbo_{compressed_,}teximage.
Paul Berry [Mon, 31 Dec 2012 17:00:41 +0000 (09:00 -0800)]
mesa: Fix error reporting in _mesa_invalidate_pbo_{compressed_,}teximage.

The old error reporting was completely bogus, passing _mesa_error() a
format string that didn't even match the remaining arguments.  Also,
in many cases the number of dimensions in the TexImage call was not
preserved in the error message (e.g. an error in glTexImage2D was
reported simply as an error in glTexImage).

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agomesa: fix signed/unsignd mix-up in fetch_signed_l_latc1()
Brian Paul [Wed, 2 Jan 2013 16:00:36 +0000 (09:00 -0700)]
mesa: fix signed/unsignd mix-up in fetch_signed_l_latc1()

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

11 years agoglsl: add cast to silence signed/unsigned comparision warning
Brian Paul [Tue, 1 Jan 2013 15:47:04 +0000 (08:47 -0700)]
glsl: add cast to silence signed/unsigned comparision warning

11 years agoxlib: handle _mesa_initialize_visual()'s return value
Brian Paul [Wed, 26 Dec 2012 23:26:58 +0000 (16:26 -0700)]
xlib: handle _mesa_initialize_visual()'s return value

If the call fails, we should return NULL from XMesaCreateVisual().
This was found when Waffle tried to create a visual with depth/stencil
bits = -1.  That's an illegal value for glXChooseFBConfig() and we should
return NULL in that situation.

Note: This is a candidate for the stable branches.

11 years agoi965: Fail to blit rather than assert on invalid pitch requirements.
Kenneth Graunke [Wed, 26 Dec 2012 04:55:38 +0000 (20:55 -0800)]
i965: Fail to blit rather than assert on invalid pitch requirements.

Dungeon Defenders hits TexImage()'s try_pbo_upload() path where
image->Width == 2, which doesn't meet intelEmitCopyBlit's requirement
that the pitch needs to be a multiple of 4.

Since intelEmitCopyBlit can already fail for a myriad of other reasons,
and it's not clear that other callers are immune to this failure mode,
simply make it return false rather than assert.

Fixes Dungeon Defenders on i965/Ivybridge.  Now playable (aside from
having to work around the EXT_bindable_uniform issue).

NOTE: This is probably a candidate for the 9.0 branch.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agointel: Skip texture validation logic when nothing has changed.
Eric Anholt [Thu, 20 Dec 2012 22:09:32 +0000 (14:09 -0800)]
intel: Skip texture validation logic when nothing has changed.

Improves GLBenchmark 2.1 offscreen performance by 3.2% +/- 1.5% (n=52).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Turn a test in miptree_match_image into an assert.
Eric Anholt [Thu, 20 Dec 2012 21:52:30 +0000 (13:52 -0800)]
intel: Turn a test in miptree_match_image into an assert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Stop making a copy of non-builtin uniforms in ParameterValues[].
Eric Anholt [Wed, 21 Nov 2012 22:33:52 +0000 (14:33 -0800)]
i965: Stop making a copy of non-builtin uniforms in ParameterValues[].

We don't need them now that our set of parameter pointers points at the
GL core storage for them.  This should save memory/bandwidth/overhead in
uniform updates.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Consistently use nr_pull_params instead of NumParameters.
Eric Anholt [Wed, 21 Nov 2012 22:30:55 +0000 (14:30 -0800)]
i965: Consistently use nr_pull_params instead of NumParameters.

NumParameters used to be an upper bound on the number of vec4s to be
uploaded, which was basically safe (unless your buffer was bound near
the top of address space *and* you array indexed outside the buffer, in
which case I think you might GPU hang).  As I migrate the driver away
from ParameterValues[], this is no longer true.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vs: Reference the core GL uniform storage for non-builtin uniforms.
Eric Anholt [Wed, 21 Nov 2012 03:18:45 +0000 (19:18 -0800)]
i965/vs: Reference the core GL uniform storage for non-builtin uniforms.

Like in the FS, there's no reason to use an external copy if the
ParameterValues[] relayout of it isn't the layout we need.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Reference the core GL uniform storage for non-builtin uniforms.
Eric Anholt [Wed, 21 Nov 2012 01:43:31 +0000 (17:43 -0800)]
i965/fs: Reference the core GL uniform storage for non-builtin uniforms.

There's no reason to use an external copy if the relayout in the
external copy isn't serving us.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Add a note about a surprising feature of gl_uniform_storage->type.
Eric Anholt [Wed, 21 Nov 2012 02:53:34 +0000 (18:53 -0800)]
glsl: Add a note about a surprising feature of gl_uniform_storage->type.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Remove the param_index/param_offset indirection.
Eric Anholt [Wed, 21 Nov 2012 00:26:22 +0000 (16:26 -0800)]
i965/fs: Remove the param_index/param_offset indirection.

Now that ParameterValues doesn't change across the visitor, we don't
need to go through this.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add asserts to check that we don't realloc ParameterValues.
Eric Anholt [Wed, 21 Nov 2012 21:11:32 +0000 (13:11 -0800)]
i965: Add asserts to check that we don't realloc ParameterValues.

Things are even more restrictive than they used to be, so I've made
mistakes in this area.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add texrect scale parameters before pointers to ParameterValues.
Eric Anholt [Wed, 21 Nov 2012 21:23:36 +0000 (13:23 -0800)]
i965: Add texrect scale parameters before pointers to ParameterValues.

If adding scale parameters during program compile caused a realloc of
ParameterValues, then the driver uniform storage set up by
_mesa_associate_uniform_storage() would point to potentially freed
memory.

Note that this uses TexturesUsed, which may change at runtime for GLSL
when sampler uniforms change.  This is a flaw in our handling of texrect
in general, and not one I'm fixing currently.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Fix a typo in a comment.
Eric Anholt [Wed, 21 Nov 2012 21:57:58 +0000 (13:57 -0800)]
i965: Fix a typo in a comment.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add a note about a bug from the no-recompile-on-sampler-updates change.
Eric Anholt [Tue, 20 Nov 2012 22:28:48 +0000 (14:28 -0800)]
i965: Add a note about a bug from the no-recompile-on-sampler-updates change.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: add missing texel fetch code for sRGB DXT formats
Brian Paul [Fri, 21 Dec 2012 20:41:23 +0000 (13:41 -0700)]
mesa: add missing texel fetch code for sRGB DXT formats

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=58548

11 years agoi965: Fix border color handling for deprecated SNORM formats.
Eric Anholt [Thu, 20 Dec 2012 23:45:11 +0000 (15:45 -0800)]
i965: Fix border color handling for deprecated SNORM formats.

We don't have native hardware support for these, so they get promoted to
RGBA, in which case we don't have hardware dealing with the channel
swizzling for us.

Fixes piglit EXT_texture_snorm/texwrap formats bordercolor (-swizzled).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Start using HIZ for Z16 textures.
Eric Anholt [Wed, 19 Dec 2012 00:05:24 +0000 (16:05 -0800)]
i965: Start using HIZ for Z16 textures.

I had left this out for a long time because it regressed some
depthstencil-render-miplevels cases when it was enabled.  Now that the
bugs causing those are fixed, there's nothing stopping us.

Improves glbenchmark 2.1 offscreen performance by 7.3% +/- 2.8% (n=10).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Use the parent miptree's format for setting up HiZ miptrees.
Eric Anholt [Thu, 20 Dec 2012 19:36:38 +0000 (11:36 -0800)]
intel: Use the parent miptree's format for setting up HiZ miptrees.

This worked out before because the parent was always 4 bytes so it
didn't affect the layout, but now we want to support Z16 too.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Remove a couple of dead function prototypes.
Eric Anholt [Tue, 18 Dec 2012 22:12:50 +0000 (14:12 -0800)]
intel: Remove a couple of dead function prototypes.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoi965: Add perf debug for depth/stencil alignment workaround.
Eric Anholt [Tue, 18 Dec 2012 21:45:14 +0000 (13:45 -0800)]
i965: Add perf debug for depth/stencil alignment workaround.

Fixing these rendering bugs has been implicated in performance
regressions (which may be unfixable), but at least knowing that it's
happening should help diagnose those regressions.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoi965: Assert that relayout laid out something that won't need it again.
Eric Anholt [Tue, 18 Dec 2012 19:55:16 +0000 (11:55 -0800)]
i965: Assert that relayout laid out something that won't need it again.

The ETC1 changes failed at this, so let's make sure it will be caught in
testing next time.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoi965: Also fix validation of Z32F_S8 textures.
Eric Anholt [Tue, 18 Dec 2012 21:10:29 +0000 (13:10 -0800)]
i965: Also fix validation of Z32F_S8 textures.

This was caught by the assertion in the next commit.  It fixes the
remaining piglit depthstencil-render-miplevels cases, probably by
avoiding broken stencil copies in the validation path.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoi965: Fix validation of ETC miptrees.
Eric Anholt [Tue, 18 Dec 2012 20:03:49 +0000 (12:03 -0800)]
i965: Fix validation of ETC miptrees.

When comparing to the teximage's format, we have to look at the
format-the-mt-was-created-for not the format-actually-stored-in-the-mt.

Improves glbenchmark 2.1 offscreen test performance 159% +/- 17% (n=3).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54582
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agoqi965: Add perf debug for texture relayout.
Eric Anholt [Tue, 18 Dec 2012 19:47:25 +0000 (11:47 -0800)]
qi965: Add perf debug for texture relayout.

Relayout is expensive, so it's something developers (both us and others)
should know about when it happens.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoi965: Fix hiz resolves getting stomped by depth offset validation.
Eric Anholt [Tue, 18 Dec 2012 22:25:42 +0000 (14:25 -0800)]
i965: Fix hiz resolves getting stomped by depth offset validation.

Fixes all the remaining non-Z32F_S8 depthstencil-render-miplevels tests
in piglit.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
11 years agor600g: rename GPU_FLUSH -> INVAL_READ_CACHES
Marek Olšák [Sat, 22 Dec 2012 18:05:37 +0000 (19:05 +0100)]
r600g: rename GPU_FLUSH -> INVAL_READ_CACHES

because that's what it does.

11 years agor600g: remove redundant parameter alloc_bo from r600_texture_create_object
Marek Olšák [Sat, 22 Dec 2012 01:54:52 +0000 (02:54 +0100)]
r600g: remove redundant parameter alloc_bo from r600_texture_create_object

alloc_bo == !buf

11 years agoMake IsVertexArray() return false before BindVertexArray()
Matt Turner [Thu, 20 Dec 2012 04:20:34 +0000 (20:20 -0800)]
Make IsVertexArray() return false before BindVertexArray()

Rename existing _Used flag to EverBound.

The GL 4.3 and ES 3.0 specs say

   These names are marked as used, for the purposes of GenVertexArrays
   only, but they do not acquire array state until they are first bound.

This also affects Apple VAOs, which is fine since the
APPLE_vertex_array_object spec says

   A vertex array object is created by binding an unused name. This
   binding is accomplished by calling BindVertexArrayAPPLE with id set
   to the name of the new vertex array object.

Fixes arb_vertex_array_object_isvertexarray.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoMake IsTransformFeedback() return false before BindTransformFeedback()
Matt Turner [Wed, 19 Dec 2012 21:43:31 +0000 (13:43 -0800)]
Make IsTransformFeedback() return false before BindTransformFeedback()

The GL 4.3 an ES 3.0 specs say

   A transform feedback object is created by binding a name returned by
   GenTransformFeedbacks with the command
      void BindTransformFeedback( enum target, uint id );

Fixes arb_transform_feedback2-istransformfeedback and part of
es3conform's CoverageES30.test.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agonouveau: deal with tbo cap for now.
Dave Airlie [Sat, 22 Dec 2012 03:12:30 +0000 (13:12 +1000)]
nouveau: deal with tbo cap for now.

This fixes the printk running apps against master.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agor600g: always use a tiled resource as the destination of MSAA resolve
Marek Olšák [Fri, 21 Dec 2012 19:34:52 +0000 (20:34 +0100)]
r600g: always use a tiled resource as the destination of MSAA resolve

i.e. we have to allocate a temporary tiled resource if dst isn't tiled.

This fixes hardlocks on r6xx-r7xx, though using a linear resource is forbidden
on later asics as well.

NOTE: This is a candidate for the stable branches.

11 years agowinsys/radeon: the env var RADEON_NOOP can be used to skip CS ioctls
Marek Olšák [Fri, 21 Dec 2012 18:15:20 +0000 (19:15 +0100)]
winsys/radeon: the env var RADEON_NOOP can be used to skip CS ioctls

11 years agor600g: remove a false comment
Marek Olšák [Fri, 21 Dec 2012 18:15:02 +0000 (19:15 +0100)]
r600g: remove a false comment

11 years agor600g: don't suspend TIME_ELAPSED queries during flushing
Marek Olšák [Fri, 21 Dec 2012 15:29:19 +0000 (16:29 +0100)]
r600g: don't suspend TIME_ELAPSED queries during flushing

According to the GL spec, the result should be equivalent to comparing
two timestamps.

11 years agogallium/tests: fix build breakage after pipe_surface::usage removal
Marek Olšák [Fri, 21 Dec 2012 15:56:41 +0000 (16:56 +0100)]
gallium/tests: fix build breakage after pipe_surface::usage removal

11 years agomesa: add bounds checking for uniform array access
Frank Henigman [Fri, 14 Dec 2012 20:52:17 +0000 (15:52 -0500)]
mesa: add bounds checking for uniform array access

No piglit regressions and now passes glsl-uniform-out-of-bounds-2.

validate_uniform_parameters now checks that the array index is
valid.  This means if an index is out of bounds, glGetUniform* now
fails with GL_INVALID_OPERATION, as it should.
_mesa_uniform and _mesa_uniform_matrix also call
validate_uniform_parameters so the bounds checks there became
redundant and were removed.

The test in glGetUniformLocation is modified to check array bounds
so it now returns GL_INVALID_INDEX (-1) if you ask for the location
of a non-existent array element, as it should.

Signed-off-by: Frank Henigman <fjhenigman@google.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
11 years agoutil/u_format: Round when converting depth values from float to z16_unorm.
José Fonseca [Thu, 20 Dec 2012 12:03:45 +0000 (12:03 +0000)]
util/u_format: Round when converting depth values from float to z16_unorm.

This makes the z16_unorm -> float -> z16_unorm conversion lossless.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agor600g: add cs tracing infrastructure for lockup pin pointing
Jerome Glisse [Wed, 19 Dec 2012 17:23:50 +0000 (12:23 -0500)]
r600g: add cs tracing infrastructure for lockup pin pointing

It's a build time option you need to set R600_TRACE_CS to 1 and it
will print to stderr all cs along as cs trace point value which
gave last offset into a cs process by the GPU.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agor600g: add htile support v16
Jerome Glisse [Thu, 11 Oct 2012 14:40:30 +0000 (10:40 -0400)]
r600g: add htile support v16

htile is used for HiZ and HiS support and fast Z/S clears.
This commit just adds the htile setup and Fast Z clear.
We don't take full advantage of HiS with that patch.

v2 really use fast clear, still random issue with some tiles
   need to try more flush combination, fix depth/stencil
   texture decompression
v3 fix random issue on r6xx/r7xx
v4 rebase on top of lastest mesa, disable CB export when clearing
   htile surface to avoid wasting bandwidth
v5 resummarize htile surface when uploading z value. Fix z/stencil
   decompression, the custom blitter with custom dsa is no longer
   needed.
v6 Reorganize render control/override update mecanism, fixing more
   issues in the process.
v7 Add nop after depth surface base update to work around some htile
   flushing issue. For htile to 8x8 on r6xx/r7xx as other combination
   have issue. Do not enable hyperz when flushing/uncompressing
   depth buffer.
v8 Fix htile surface, preload and prefetch setup. Only set preload
   and prefetch on htile surface clear like fglrx. Record depth
   clear value per level. Support several level for the htile
   surface. First depth clear can't be a fast clear.
v9 Fix comments, properly account new register in emit function,
   disable fast zclear if clearing different layer of texture
   array to different value
v10 Disable hyperz for texture array making test simpler. Force
    db_misc_state update when no depth buffer is bound. Remove
    unused variable, rename depth_clearstencil to depth_clear.
    Don't allocate htile surface for flushed depth. Something
    broken the cliprect change, this need to be investigated.
v11 Rebase on top of newer mesa
v12 Rebase on top of newer mesa
v13 Rebase on top of newer mesa, htile surface need to be initialized
    to zero, somehow special casing first clear to not use fast clear
    and thus initialize the htile surface with proper value does not
    work in all case.
v14 Use resource not texture for htile buffer make the htile buffer
    size computation easier and simpler. Disable preload on evergreen
    as its still troublesome in some case
v15 Cleanup some comment and remove some left over
v16 Define name for bit 20 of CP_COHER_CNTL

Signed-off-by: Pierre-Eric Pelloux-Prayer <pelloux@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agor600g: rework flusing and synchronization pattern v7
Jerome Glisse [Thu, 1 Nov 2012 20:09:40 +0000 (16:09 -0400)]
r600g: rework flusing and synchronization pattern v7

This bring r600g allmost inline with closed source driver when
it comes to flushing and synchronization pattern.

v2-v4: history lost somewhere in outer space
v5: Fix compute size of flushing, use define for flags, update
    worst case cs size requirement for flush, treat rs780 and
    newer as r7xx when it comes to streamout.
v6: Fix num dw computation for framebuffer state, remove dead
    code, use define instead of hardcoded value.
v7: Remove dead code

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agomesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.
Paul Berry [Wed, 19 Dec 2012 18:08:58 +0000 (10:08 -0800)]
mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.

Previously, Mesa code assumed that glReadBuffer(GL_NONE) was only
valid for user-created framebuffer objects.  However, the spec is
quite clear that is should also be valid for the default framebuffer.
From section 18.2.1 ("Obtaining Pixels from the Framebuffer") of the
GL 4.3 spec:

    "When READ_FRAMEBUFFER_BINDING is zero, i.e. the default
    framebuffer, src must be one of the values listed in table 17.4,
    including NONE."

Similar language exists in the GLES 3.0 spec, and in desktop GL all
the way back to ARB_framebuffer_object.

Partially fixes GLES3 conformance test "CoverageES30.test".

NOTE: This is a candidate for stable branches.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agollvmpipe: Drop PIPE_QUERY_TIME_ELAPSED support.
José Fonseca [Sun, 9 Dec 2012 10:15:19 +0000 (10:15 +0000)]
llvmpipe: Drop PIPE_QUERY_TIME_ELAPSED support.

It was slightly wrong: we were computing the longest duration of
the query among all the rasterizer tasks.

Regardless, for tile-based implementations such as llvmpipe, time differences
will never be very useful, because rendering before/during/after the query
is all interleaved.  And this is expected, see ARB_timer_query spec, issue 10.

In particular, piglit ext_timer_query-time-elapsed still fails, because
it makes assumptions that don't hold true in in tiled architectures. Not
sure how to fix that though.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa/st: Implement GL_TIME_ELAPSED w/ PIPE_QUERY_TIMESTAMP.
José Fonseca [Sun, 9 Dec 2012 10:08:13 +0000 (10:08 +0000)]
mesa/st: Implement GL_TIME_ELAPSED w/ PIPE_QUERY_TIMESTAMP.

ARB/EXT_timer_query's definition of GL_TIME_ELAPSED match precisely the
subtraction of two GL_TIMESTAMP queries.

And for a lot of drivers, that's precisely how they have to implement
internally -- by emitting two hardware timestamp queries.

So, to simplify driver implementation, simply allow doing so in the state
tracker.

Eventually if no driver implements PIPE_QUERY_TIME_ELAPSED then we could
retire it.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agogallium: s/PIPE_CAP_TIMER_QUERY/PIPE_CAP_QUERY_TIME_ELAPSED/
José Fonseca [Sun, 9 Dec 2012 09:50:34 +0000 (09:50 +0000)]
gallium: s/PIPE_CAP_TIMER_QUERY/PIPE_CAP_QUERY_TIME_ELAPSED/

To better reflect what it is being advertised.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g: add assertions to prevent creation of invalid surfaces
Marek Olšák [Wed, 19 Dec 2012 23:28:24 +0000 (00:28 +0100)]
r600g: add assertions to prevent creation of invalid surfaces

11 years agor600g: refactor and make streamout dumping more informative
Marek Olšák [Wed, 19 Dec 2012 16:05:01 +0000 (17:05 +0100)]
r600g: refactor and make streamout dumping more informative

Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agor600g: try to fix streamout for the cases where BURST_COUNT > 0
Marek Olšák [Wed, 19 Dec 2012 15:59:45 +0000 (16:59 +0100)]
r600g: try to fix streamout for the cases where BURST_COUNT > 0

The burst was incorrectly used, because ELEM_SIZE was always 0.
I don't know if the burst works, because I don't know of any test
which uses it.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agor600g: lower stream outputs with dst_offset < start_component
Marek Olšák [Wed, 19 Dec 2012 14:09:54 +0000 (15:09 +0100)]
r600g: lower stream outputs with dst_offset < start_component

This fixes streamout breakage caused by the varying packing.

Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agor600g: use r600_get_temp to get temporaries for CLIPDIST shader outputs
Marek Olšák [Wed, 19 Dec 2012 14:00:45 +0000 (15:00 +0100)]
r600g: use r600_get_temp to get temporaries for CLIPDIST shader outputs

I need this to be able to use r600_get_temp in the function later.

Reviewed-by: Dave Airlie <airlied@redhat.com>
11 years agosoftpipe: fix up FS variant unbinding / deletion
Brian Paul [Fri, 14 Dec 2012 17:47:46 +0000 (10:47 -0700)]
softpipe: fix up FS variant unbinding / deletion

The old call to tgsi_exec_machine_bind_shader() in
softpipe_delete_fs_state() was never called since the shader's original
tokens are never passed to the tgsi interpreter (only shader _variant_
tokens are).  Now, unbind the variant's tokens from the tgsi interpreter
when we free the variant.

This doesn't fix any known bugs but it's the right thing to do.

Note: This is a candidate for the stable branches.

11 years agosoftpipe: fix unreliable FS variant binding bug
Brian Paul [Fri, 14 Dec 2012 17:34:33 +0000 (10:34 -0700)]
softpipe: fix unreliable FS variant binding bug

In exec_prepare() we were comparing pointers to see if the fragment
shader variant had changed before calling tgsi_exec_machine_bind_shader().
This didn't work reliably when there was a lot of shader token malloc/
freeing going on because the memory might get reused.
Instead, bind the shader variant during regular state validation.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=40404
(fixes a couple of piglit's glsl-max-varyings test)

Note: This is a candidate for the stable branches.

11 years agoRevert "r600g: work around ddx over alignment"
Jerome Glisse [Wed, 19 Dec 2012 14:56:17 +0000 (09:56 -0500)]
Revert "r600g: work around ddx over alignment"

This reverts commit d8287bac1fd4a77abc2db38de134f14176740d23.

Cause more issue than it fix. Need to think of a proper solution.

11 years agor600g: work around ddx over alignment
Jerome Glisse [Tue, 18 Dec 2012 17:45:31 +0000 (12:45 -0500)]
r600g: work around ddx over alignment

This force surface allocated from ddx to be consider as height
aligned on 8 and fix 1D->2D tiling transition that result from
this.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>