mesa.git
13 years agonouveau: Drop mapping we were doing around glGetTexImage().
Eric Anholt [Mon, 1 Aug 2011 04:07:00 +0000 (21:07 -0700)]
nouveau: Drop mapping we were doing around glGetTexImage().

It's handled by MapTextureImage() now.

13 years agointel: Drop our custom glGetTexImage() code.
Eric Anholt [Mon, 1 Aug 2011 04:02:46 +0000 (21:02 -0700)]
intel: Drop our custom glGetTexImage() code.

The mesa core code uses MapTextureImage() like we need now.

v2: Drop mapping around _mesa_generate_mipmap for compressed, since
    the whole path ends up going through MapTextureImage(), and the
    meta decompression code ended up causing us to lose track of the
    region that was originally mapped and assertion fail.

13 years agomesa: Finally, convert RGBA glGetTexImage() to using MapTextureImage().
Brian Paul [Mon, 1 Aug 2011 04:00:21 +0000 (21:00 -0700)]
mesa: Finally, convert RGBA glGetTexImage() to using MapTextureImage().

v2: Changes by Brian to MapTexImage in the decompression path.
v3: Changes by anholt to fix srcRowStride for decompression of NPOT.

Tested-by: Brian Paul <brianp@vmware.com> (v2)
13 years agomesa: Convert depth glGetTexImage() to using MapTextureImage().
Brian Paul [Mon, 1 Aug 2011 03:59:16 +0000 (20:59 -0700)]
mesa: Convert depth glGetTexImage() to using MapTextureImage().

Tested-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Convert depth/stencil glGetTexImage() to using MapTextureImage().
Brian Paul [Mon, 1 Aug 2011 03:48:24 +0000 (20:48 -0700)]
mesa: Convert depth/stencil glGetTexImage() to using MapTextureImage().

Note that the implementation before and after appears to be broken in
its handling of Z24_S8 vs S8_Z24.

Tested-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Switch ycbcr glGetTexImage() to using MapTextureImage().
Brian Paul [Mon, 1 Aug 2011 03:39:14 +0000 (20:39 -0700)]
mesa: Switch ycbcr glGetTexImage() to using MapTextureImage().

Tested-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Switch memcpy fast-path of glGetTexImage() to using MapTextureImage().
Brian Paul [Mon, 1 Aug 2011 03:37:54 +0000 (20:37 -0700)]
mesa: Switch memcpy fast-path of glGetTexImage() to using MapTextureImage().

Tested-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Update comments/assertions about buffer mapping for glGetTexImage().
Brian Paul [Mon, 1 Aug 2011 04:00:55 +0000 (21:00 -0700)]
mesa: Update comments/assertions about buffer mapping for glGetTexImage().

This code is about to stop needing ->Data and using MapTextureImage().

Tested-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Convert GetCompressedTexImage to using MapTextureImage().
Brian Paul [Sat, 30 Jul 2011 00:14:34 +0000 (17:14 -0700)]
mesa: Convert GetCompressedTexImage to using MapTextureImage().

This changes drivers to not map the texture on their own before
calling _mesa_get_compressed_teximage().

Tested-by: Brian Paul <brianp@vmware.com>
13 years agogallium: move border color to be a color union
Dave Airlie [Tue, 27 Sep 2011 09:08:34 +0000 (10:08 +0100)]
gallium: move border color to be a color union

EXT_texture_integer also specifies border color should be a color
union, the values are used according to the texture sampler format.

(update docs)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Allow override of GL version with environment variable
Chad Versace [Mon, 26 Sep 2011 18:48:46 +0000 (11:48 -0700)]
mesa: Allow override of GL version with environment variable

It is necessary to manually set the GL version to 3.0 in order to run
Piglit tests that use glGetUniform*().

This patch allows one to override the version of the OpenGL context by
setting the environment variable MESA_GL_VERSION_OVERRIDE.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agomesa: Make enable.c and get.c properly range check clip flags.
Paul Berry [Sun, 25 Sep 2011 18:55:41 +0000 (11:55 -0700)]
mesa: Make enable.c and get.c properly range check clip flags.

This is a follow-up to commit
2d686fe911a89fa477ee3848da41ebfb100500bf, which added decoding of
GL_CLIP_DISTANCE[67] to the _mesa_set_enable() function.  This patch
makes the following additional fixes:

- Uses GL_CLIP_DISTANCEi enums consistently within enable.c rather
  than the deprecated GL_CLIP_PLANEi enums.

- Generates an error if the user tries to access a clip flag that is
  unsupported by the hardware.

- Applies the same change to _mesa_IsEnabled(), so that querying clip
  flags using glIsEnabled() works properly.

- Applies corresponding changes to get.c, so that querying clip flags
  using glGet*() works properly.

Fixes piglit test clip-flag-behavior.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agomesa: fix indentation in mipmap.c (3 spaces)
Brian Paul [Tue, 27 Sep 2011 02:44:09 +0000 (20:44 -0600)]
mesa: fix indentation in mipmap.c (3 spaces)

13 years agoi965/vs: Fix access beyond array bounds for non-GRF operands.
Eric Anholt [Fri, 23 Sep 2011 20:52:47 +0000 (13:52 -0700)]
i965/vs: Fix access beyond array bounds for non-GRF operands.

Caught by valgrind.  I never saw a segfault from it (probably because
it's hard to have much more of any other file than GRF).

13 years agointel: Rename region->buffer to region->bo, and remove accessor function.
Eric Anholt [Thu, 22 Sep 2011 18:58:37 +0000 (11:58 -0700)]
intel: Rename region->buffer to region->bo, and remove accessor function.

We call all the other drm_intel_bo pointers in intel/*.h "bo", so this
one was rather out of place.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Drop stale comment about CopyTexSubImage.
Eric Anholt [Wed, 21 Sep 2011 23:43:08 +0000 (16:43 -0700)]
intel: Drop stale comment about CopyTexSubImage.

We get called for TexImage higher up, and in a relatively normal way
(pixels == NULL is common for FBO setup).

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Rely on AllocTextureImageBuffer for our teximage fallbacks.
Eric Anholt [Wed, 21 Sep 2011 22:56:04 +0000 (15:56 -0700)]
intel: Rely on AllocTextureImageBuffer for our teximage fallbacks.

It will do a more reliable job at getting the image size for
_mesa_texstore right than us.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Rely on mesa core for compressed texture image uploading.
Eric Anholt [Wed, 21 Sep 2011 22:47:59 +0000 (15:47 -0700)]
intel: Rely on mesa core for compressed texture image uploading.

There's nothing in our normal texture path we need for this.  We don't
PBO upload blit it.  We don't need to worry about flushing because
MapTextureImage handles it.  hiz scattergather doesn't apply, but MTI
handles it too.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Allow src == NULL and *dst != NULL in intel_miptree_reference().
Eric Anholt [Wed, 21 Sep 2011 22:38:32 +0000 (15:38 -0700)]
intel: Allow src == NULL and *dst != NULL in intel_miptree_reference().

This makes this API consistent with intel_region_reference, and the
consumers wanted it this way.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Drop the "intel" argument to intel_miptree_release().
Eric Anholt [Wed, 21 Sep 2011 22:34:35 +0000 (15:34 -0700)]
intel: Drop the "intel" argument to intel_miptree_release().

We don't have it in the other refcounting functions, and it was
totally unused.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Drop the immediate validation of the texture object in TFP.
Eric Anholt [Wed, 21 Sep 2011 22:20:20 +0000 (15:20 -0700)]
intel: Drop the immediate validation of the texture object in TFP.

It's totally gratuitous -- the image's miptree will be checked for
binding to the object later, anyway, with zero-copy or blitting as
appropriate.

Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Fix improper freeing of texture data in TFP.
Eric Anholt [Wed, 21 Sep 2011 22:17:36 +0000 (15:17 -0700)]
intel: Fix improper freeing of texture data in TFP.

If there happened to be ->Data present, we assertion failed instead of
handling it correctly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35234
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Refactor texture_from_pixmap and EGL_image region binding.
Eric Anholt [Wed, 21 Sep 2011 22:13:57 +0000 (15:13 -0700)]
intel: Refactor texture_from_pixmap and EGL_image region binding.

Tested-by: Kristian Høgsberg <krh@bitplanet.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Drop some extra equality checks on reference/release functions.
Eric Anholt [Wed, 21 Sep 2011 21:47:39 +0000 (14:47 -0700)]
intel: Drop some extra equality checks on reference/release functions.

_mesa_reference_renderbuffer already short-circuits equality, and
intel_miptree_release does nothing on NULL.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Set the pre/post-blend color clamp flags.
Eric Anholt [Fri, 9 Sep 2011 21:03:41 +0000 (14:03 -0700)]
i965: Set the pre/post-blend color clamp flags.

No change in piglit results on gen6, but the spec demands it so let's
do it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965/fs: Split generate_math into gen4/gen6 and 1/2 operand variants.
Kenneth Graunke [Thu, 18 Aug 2011 18:55:42 +0000 (11:55 -0700)]
i965/fs: Split generate_math into gen4/gen6 and 1/2 operand variants.

This mirrors the structure Eric used in the new VS backend, and seems
simpler.  In particular, the math1/math2 split will avoid having to
figure out how many operands there are, as this is already known by the
caller.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoswrast: always call _swrast_choose_texture_sample_func()
Brian Paul [Mon, 26 Sep 2011 20:39:52 +0000 (14:39 -0600)]
swrast: always call _swrast_choose_texture_sample_func()

_swrast_choose_texture_sample_func() handles null texture object pointers
and will return the "null" sampler function which returns (0,0,0,1).  This
fixes a minor regression from ce82914f5ad4bb9148370826099925590e9798fd

13 years agomesa: Remove EXT_abgr extension enable flag
Ian Romanick [Wed, 31 Aug 2011 19:18:37 +0000 (12:18 -0700)]
mesa: Remove EXT_abgr extension enable flag

All drivers remaining in Mesa support this extension.  This extension
is required in desktop OpenGL.  The existing support is already partially
broken in Mesa (e.g., using format=GL_ABGR for glTexImage2D in OpenGL ES 2.x).
This patch does not change the situation in any way.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Remove EXT_bgra and EXT_texture_format_BGRA8888 extension enable flags
Ian Romanick [Wed, 31 Aug 2011 18:43:39 +0000 (11:43 -0700)]
mesa: Remove EXT_bgra and EXT_texture_format_BGRA8888 extension enable flags

All drivers remaining in Mesa support this extension.  This extension
is either required or optional features in desktop OpenGL, OpenGL ES
1.x, and OpenGL ES 2.x.

EXT_texture_format_BGRA8888 is mostly a subset of EXT_bgra.  The only
difference seems to be that EXT_texture_format_BGRA8888 allows GL_BGRA
as an internal format to glTexImage2D and friends.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Remove OES_read_format extension enable flag
Ian Romanick [Wed, 24 Aug 2011 00:18:00 +0000 (17:18 -0700)]
mesa: Remove OES_read_format extension enable flag

This extension is always enabled, and drivers do not have
to option to disable it.

I kept this one separate from the others because I was a little
uncertain about the changes to get.c.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
13 years agomesa: Remove all mention of EXT_vertex_array_set
Ian Romanick [Wed, 31 Aug 2011 00:42:33 +0000 (17:42 -0700)]
mesa: Remove all mention of EXT_vertex_array_set

Mesa has never any portion of this extension, and neither has any
other vendor.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Fix extension year for EXT_texture_env_combine
Ian Romanick [Tue, 30 Aug 2011 23:56:20 +0000 (16:56 -0700)]
mesa: Fix extension year for EXT_texture_env_combine

The year 2006 apparently came from the "Last Modified Date" in the
spec header.  however, the revision history at the bottom say "2/22/00
mjk - added NVIDIA Implementation Details."  From that we can safely
infer that the spec is from at least 2000, and it may even be older.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Remove many extension enable flags
Ian Romanick [Tue, 30 Aug 2011 23:29:52 +0000 (16:29 -0700)]
mesa: Remove many extension enable flags

The following extensions are always enabled, and drivers do not have
to option to disable them:

    GL_ARB_multisample
    GL_ARB_texture_compression
    GL_ARB_vertex_buffer_object / GL_OES_mapbuffer
    GL_EXT_copy_texture
    GL_EXT_multi_draw_arrays / GL_SUN_multi_draw_arrays
    GL_EXT_polygon_offset
    GL_EXT_subtexture
    GL_EXT_texture_edge_clamp / GL_SGIS_texture_edge_clamp
    GL_EXT_vertex_array
    GL_SGIS_generate_mipmap

This set was picked because the are all either required or optional
features in desktop OpenGL, OpenGL ES 1.x, and OpenGL ES 2.x.  The
existing support for some is already partially broken in Mesa (e.g.,
proxy texture targets in OpenGL ES).  This patch does not change the
situation in any way.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agointel: Remove redundant GL_ARB_window_pos enable
Ian Romanick [Tue, 23 Aug 2011 02:01:27 +0000 (19:01 -0700)]
intel: Remove redundant GL_ARB_window_pos enable

This extension is enabled by default in _mesa_init_extensions, so
drivers don't need to enable it again.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agodri: Remove redundant GL_SGIS_texture_edge_clamp enables
Ian Romanick [Tue, 23 Aug 2011 02:00:04 +0000 (19:00 -0700)]
dri: Remove redundant GL_SGIS_texture_edge_clamp enables

This extension is enabled by default in _mesa_init_extensions, so
drivers don't need to enable it again.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoi965: Emit depth stalls and flushes before changing depth state on Gen6+.
Kenneth Graunke [Thu, 1 Sep 2011 11:18:20 +0000 (04:18 -0700)]
i965: Emit depth stalls and flushes before changing depth state on Gen6+.

Fixes OpenArena on Gen7.  Technically, adding only the first depth stall
fixes it, but the documentation says to do all three, and the Windows
driver seems to do it.

Not observed to fix anything on Gen6 yet.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38863
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Introduce a new intel_context::gt field to go along with gen.
Kenneth Graunke [Sat, 24 Sep 2011 08:10:04 +0000 (01:10 -0700)]
intel: Introduce a new intel_context::gt field to go along with gen.

It seems that GT1/GT2 sorts of variations are here to stay, and more
special cases will likely be required in the future.  Checking by PCI ID
via the IS_xxx_GTx macros is cumbersome; introducing a new 'gt' field
analogous to intel->gen will make this easier.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agointel: Remove intel_context::has_xrgb_textures/has_luminance_srgb.
Kenneth Graunke [Sat, 24 Sep 2011 07:51:39 +0000 (00:51 -0700)]
intel: Remove intel_context::has_xrgb_textures/has_luminance_srgb.

Seeing as they were only used once (in the same function they were
defined), having them as context members seemed rather pointless.

Remove them entirely (rather than using local variables) since the
chipset generation checks are actually just as straightforward.

While we're at it, clean up the remainder of the if-tree that set them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Fix incorrect maximum PS thread count shift on Ivybridge.
Kenneth Graunke [Sat, 24 Sep 2011 06:32:56 +0000 (23:32 -0700)]
i965: Fix incorrect maximum PS thread count shift on Ivybridge.

At one point, the documentation said that max thread count in 3DSTATE_PS
was at bit offset 23, but it's actually 24 on Ivybridge.  Not only did
this halve our thread count, it caused us to write 1 into a bit 23, which
is marked as MBZ (must be zero).  Furthermore, it made us write an even
number into this field, which is apparently not allowed.  Apparently we
were just lucky it worked.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agor600g: add index_bias to index buffer bounds
Marek Olšák [Mon, 26 Sep 2011 13:03:43 +0000 (15:03 +0200)]
r600g: add index_bias to index buffer bounds

This fixes ARB_draw_elements_base_vertex with max_index != ~0.

NOTE: This is a candidate for the 7.11 branch.

13 years agou_vbuf_mgr: fix uploading with a non-zero index bias
Marek Olšák [Mon, 26 Sep 2011 01:30:24 +0000 (03:30 +0200)]
u_vbuf_mgr: fix uploading with a non-zero index bias

Also don't rely on pipe_draw_info being set correctly.

NOTE: This is a candidate for the 7.11 branch.

13 years agou_vbuf_mgr: dereference some pointers only once etc.
Marek Olšák [Mon, 26 Sep 2011 12:41:08 +0000 (14:41 +0200)]
u_vbuf_mgr: dereference some pointers only once etc.

13 years agou_vbuf_mgr: rework user buffer uploads
Marek Olšák [Sun, 25 Sep 2011 17:57:35 +0000 (19:57 +0200)]
u_vbuf_mgr: rework user buffer uploads

- first determine the buffer range to upload for each buffer by walking over
  vertex elements
- take buffer_offset into account
- take src_offset into account
- take src_format into account in more places
- don't just blindly upload (stride*count) bytes

NOTE: This is a candidate for the 7.11 branch.

13 years agou_vbuf_mgr: remove unused flag U_VBUF_UPLOAD_FLUSHED
Marek Olšák [Sun, 25 Sep 2011 17:31:15 +0000 (19:31 +0200)]
u_vbuf_mgr: remove unused flag U_VBUF_UPLOAD_FLUSHED

13 years agou_vbuf_mgr: s/u_vbuf_mgr_/u_vbuf_
Marek Olšák [Sun, 25 Sep 2011 17:16:21 +0000 (19:16 +0200)]
u_vbuf_mgr: s/u_vbuf_mgr_/u_vbuf_

13 years agou_vbuf_mgr: fix max_index computation for large src_offset
Marek Olšák [Sun, 25 Sep 2011 16:58:54 +0000 (18:58 +0200)]
u_vbuf_mgr: fix max_index computation for large src_offset

NOTE: This is a candidate for the 7.11 branch.

13 years agou_vbuf_mgr: don't take per-instance attribs into acc. when computing max index
Marek Olšák [Sun, 25 Sep 2011 16:44:36 +0000 (18:44 +0200)]
u_vbuf_mgr: don't take per-instance attribs into acc. when computing max index

NOTE: This is a candidate for the 7.11 branch.

13 years agou_vbuf_mgr: cleanup original vs real vertex buffer arrays
Marek Olšák [Sun, 25 Sep 2011 16:13:50 +0000 (18:13 +0200)]
u_vbuf_mgr: cleanup original vs real vertex buffer arrays

It can now override both buffer offsets and strides in additions to resources.
Overriding buffer offsets was kinda hackish and could cause issues with
non-native vertex formats.

13 years agointel: fix potential segfault error at intel_(un)map_texture_image
Yuanhan Liu [Mon, 26 Sep 2011 01:23:06 +0000 (09:23 +0800)]
intel: fix potential segfault error at intel_(un)map_texture_image

intel_image->mt might be NULL, say with border width set. It then would
trigger a segfault at intel_map/unmap_texture_image function.

This would fix the oglc misctest(basic.textureBorderIgnore) fail.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
13 years agonouveau: fix crash during fence emission
Marcin Slusarz [Sun, 25 Sep 2011 14:01:19 +0000 (16:01 +0200)]
nouveau: fix crash during fence emission

Fence emission can flush the push buffer, which through flush_notify
unreferences recently emitted fence. If ref count is increased after
fence emission, unreference deletes the fence, which causes SIGSEGV.

Backtrace:
nouveau_fence_del
nouveau_fence_ref
nouveau_fence_next
nouveau_pushbuf_flush
MARK_RING
nv50_screen_fence_emit
nouveau_fence_emit
nv50_flush

This bug manifested as an assertion failure in nouveau_fence.c, because
SIGSEGV handler tried to shutdown the application and used messed up
fence.

This issue was reported by Maxim Levitsky.

Note: This is a candidate for the 7.11 branch.

13 years agomesa: Also set the remaining draw buffers to GL_NONE when updating just the first...
Henri Verbeet [Thu, 22 Sep 2011 21:46:34 +0000 (23:46 +0200)]
mesa: Also set the remaining draw buffers to GL_NONE when updating just the first buffer in _mesa_drawbuffers().

Without this we'd miss the last update in a sequence like {COLOR0, COLOR1},
{COLOR0}, {COLOR0, COLOR1}. I originally had a patch for this that called
updated_drawbuffers() when the buffer count changed, but later realized that
was wrong. The ARB_draw_buffers spec explicitly says "The draw buffer for
output colors beyond <n> is set to NONE.", and this is queryable state.
This fixes piglit arb_draw_buffers-state_change.

NOTE: This is a candidate for the 7.11 branch.

Signed-off-by: Henri Verbeet <hverbeet@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agopostprocess: Portability fixes.
José Fonseca [Sun, 25 Sep 2011 10:56:12 +0000 (11:56 +0100)]
postprocess: Portability fixes.

13 years agonoop: Always use memory allocation macros.
José Fonseca [Sun, 25 Sep 2011 10:48:17 +0000 (11:48 +0100)]
noop: Always use memory allocation macros.

13 years agollvmpipe: Always use memory allocation macros.
José Fonseca [Sun, 25 Sep 2011 10:48:00 +0000 (11:48 +0100)]
llvmpipe: Always use memory allocation macros.

13 years agosoftpipe: Use memory allocation macros.
José Fonseca [Sun, 25 Sep 2011 10:46:49 +0000 (11:46 +0100)]
softpipe: Use memory allocation macros.

Fixes segfault with memory debugging on.

13 years agost/vdpau: Link vdpau targets with librt to avoid unresolved symbols error related...
Emeric Grange [Thu, 22 Sep 2011 19:03:43 +0000 (21:03 +0200)]
st/vdpau: Link vdpau targets with librt to avoid unresolved symbols error related to the use of the clock_gettime() function

This patch fix a "Unresolved Symbols" run time error when using G3DVL
through the VDPAU state tracker, by linking the vdpau targets with librt.
Reported by Arkadiusz Miśkiewicz.

Caused by this commit :
commit e911dbb56374edf9f3b7c4cec0cf9a22738bb198
Author: Emeric Grange <emeric.grange@gmail.com>
Date:   Mon Sep 12 23:39:33 2011 +0200

Signed-off-by: Emeric Grange <emeric.grange@gmail.com>
13 years agog3dvl: Don't use SCALED types for iDCT
Christian König [Fri, 16 Sep 2011 16:43:44 +0000 (18:43 +0200)]
g3dvl: Don't use SCALED types for iDCT

This should bring g3dvl back to work until we figured out
how SCALED types should really work.

Signed-off-by: Christian König <deathsimple@vodafone.de>
13 years agodraw: Never allocate duplicate extra vertex attribs.
José Fonseca [Fri, 23 Sep 2011 18:55:47 +0000 (19:55 +0100)]
draw: Never allocate duplicate extra vertex attribs.

Prevents mismatches when the VS outputs generic attributes not used by
the FS.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agodraw: Make copy of the TGSI tokens.
José Fonseca [Fri, 23 Sep 2011 15:32:31 +0000 (16:32 +0100)]
draw: Make copy of the TGSI tokens.

There is no guarantee that the tokens TGSI will persist beyond the
create_fs_state. The pipe driver (and therefore the draw module) is
responsible for making copies of the TGSI tokens when it needs them.

Reviewed-by: Brian Paul <brianp@vmware.com>
13 years agoglsl: Fix Android build
Chad Versace [Sun, 25 Sep 2011 02:35:35 +0000 (19:35 -0700)]
glsl: Fix Android build

Add lower_clip_distance.cpp to list of source files.

Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agointel: Remove pointless boolean return value from *_miptree_layout.
Kenneth Graunke [Sat, 24 Sep 2011 05:42:18 +0000 (22:42 -0700)]
intel: Remove pointless boolean return value from *_miptree_layout.

i915_miptree_layout, i945_miptree_layout, and brw_miptree_layout always
just return GL_TRUE, so there's really no point to it.  Change them to
void functions and remove the (dead) error checking code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
13 years agoglsl: Free all S-Expressions immediately after reading IR.
Kenneth Graunke [Thu, 22 Sep 2011 20:05:03 +0000 (13:05 -0700)]
glsl: Free all S-Expressions immediately after reading IR.

For some reason I thought subexpressions were chained off the top-level
one.  This isn't the case, so just create a temporary context and free
it.  All of this memory would be eventually freed, but now is freed
much sooner.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl: Defer initialization of built-in functions until they're needed.
Kenneth Graunke [Tue, 20 Sep 2011 01:30:15 +0000 (18:30 -0700)]
glsl: Defer initialization of built-in functions until they're needed.

Very simple shaders don't actually use GLSL built-ins.  For example:
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_FragColor = vec4(0.0);
Both of the shaders used by _mesa_meta_glsl_Clear() also qualify.

By waiting to initialize the built-ins until the first time we need to
look for a signature, we can avoid the overhead entirely in these cases.

Makes piglit run roughly 18% faster (255 vs. 312 seconds).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Increase MaxClipPlanes to 8 for gen6+.
Paul Berry [Tue, 13 Sep 2011 17:58:47 +0000 (10:58 -0700)]
i965: Increase MaxClipPlanes to 8 for gen6+.

This is necessary for GLSL 1.30 compliance.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Allow clip distances to be read back in fragment shaders.
Paul Berry [Sun, 4 Sep 2011 19:18:06 +0000 (12:18 -0700)]
i965: Allow clip distances to be read back in fragment shaders.

Previously, we conditionally set up the SF pipline stage with a
urb_entry_read_offset of 2 when clipping was in use, and 1 otherwise,
causing the clip distance VUE slots to be skipped if present.  This
was an extremely minor savings (it saved the SF unit from reading 2
vec4s out of the URB, but it didn't affect any computation, since we
only instruct the SF unit to perform interpolation on VUE slots that
are actually used by the fragment shader).

GLSL 1.30 requires an interpolated version of gl_ClipDistance to be
available for reading in the fragment shader, so we need the SF's
urb_entry_read_offset to be 1 when the fragment shader reads from
gl_ClipDistance.

This patch just unconditionally sets the urb_entry_read_offset to 1 in
all cases; this is sufficient to make gl_ClipDistance available to the
fragment shader when it is needed, and the performance loss should be
negligible when it isn't.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Set up clip distance VUE slots appropriately for gl_ClipDistance.
Paul Berry [Fri, 2 Sep 2011 19:36:09 +0000 (12:36 -0700)]
i965: Set up clip distance VUE slots appropriately for gl_ClipDistance.

When gl_ClipDistance is in use, the contents of the gl_ClipDistance
array just need to be copied directly into the clip distance VUE
slots, so we re-use the code that copies all other generic VUE slots
(this has been extracted to its own method).  When gl_ClipDistance is
not in use, the vertex shader needs to calculate the clip distances
based on user-specified clipping planes.

This patch also removes the i965-specific enum values
BRW_VERT_RESULT_CLIP[01], since we now have generic Mesa enums that
serve the same purpose (VERT_RESULT_CLIP_DIST[01]).

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Don't upload clip planes when gl_ClipDistance is in use.
Paul Berry [Fri, 2 Sep 2011 21:57:18 +0000 (14:57 -0700)]
i965: Don't upload clip planes when gl_ClipDistance is in use.

When the vertex shader writes to gl_ClipDistance, we do clipping based
on clip distances rather than user clip planes, so don't waste push
constant space storing user clip planes that won't be used.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agoi965: Enable lower_clip_distance.
Paul Berry [Thu, 15 Sep 2011 22:16:08 +0000 (15:16 -0700)]
i965: Enable lower_clip_distance.

i965 requires gl_ClipDistance to be formatted as an array of 2 vec4's
(as opposed to an array of 8 floats), so enable the lowering pass that
performs this conversion.

Reviewed-by: Eric Anholt <eric@anholt.net>
13 years agomesa: Decode GL_CLIP_DISTANCE[67] properly in _mesa_set_enable().
Paul Berry [Tue, 13 Sep 2011 19:07:15 +0000 (12:07 -0700)]
mesa: Decode GL_CLIP_DISTANCE[67] properly in _mesa_set_enable().

In order to support 8 clip distances, we need to properly decode when
the user sets the GL_CLIP_DISTANCE6 and GL_CLIP_DISTANCE7 enable
flags.

For clarity, this patch changes the names GL_CLIP_PLANE[0-5] in the
switch statement to the equivalent names GL_CLIP_DISTANCE[0-5], since
the GL_CLIP_PLANE names are deprecated.

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
13 years agomesa: set up gl_vert_result and gl_frag_attrib values for gl_ClipDistance.
Paul Berry [Fri, 19 Aug 2011 20:12:23 +0000 (13:12 -0700)]
mesa: set up gl_vert_result and gl_frag_attrib values for gl_ClipDistance.

This patch assigns enumerated values for gl_ClipDistance in the
gl_vert_result and gl_frag_attrib enums, so that driver back-ends can
assign gl_ClipDistance to the appropriate hardware registers.  It also
adjusts the functions _mesa_vert_result_to_frag_attrib() and
_mesa_frag_attrib_to_vert_result() (which translate between the two
enums) to correctly translate the new enumerated values.

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
13 years agomesa: Add a flag to indicate whether a program uses gl_ClipDistance.
Paul Berry [Sat, 17 Sep 2011 16:42:02 +0000 (09:42 -0700)]
mesa: Add a flag to indicate whether a program uses gl_ClipDistance.

GLSL 1.30 requires us to use gl_ClipDistance for clipping if the
vertex shader contains a static write to it, and otherwise use
user-defined clipping planes.  Since the driver needs to behave
differently in these two cases, we need a flag to record whether the
shader has written to gl_ClipDistance.

The new flag is called UsesClipDistance.  We initially store it in
gl_shader_program (since that is the data structure that is available
when we check to see whethe gl_ClipDistance was written to), and we
later copy it to a flag with the same name in gl_vertex_program, since
that is a more convenient place for the driver to access it (in i965,
at least).

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Brian Paul <brianp@vmware.com>
13 years agoglsl: Implement a lowering pass for gl_ClipDistance.
Paul Berry [Fri, 12 Aug 2011 03:58:21 +0000 (20:58 -0700)]
glsl: Implement a lowering pass for gl_ClipDistance.

In i965 GEN6+ (and I suspect most other hardware), gl_ClipDistance
needs to be laid out as a pair of vec4's (the first containing clip
distances 0-3, and the second containing clip distances 4-7).
However, it is declared in GLSL as an array of 8 floats.

This lowering pass acts at the GLSL level, modifying the declaration
of gl_ClipDistance so that it is an array of vec4's rather than an
array of floats, and renaming it to gl_ClipDistanceMESA.  In addition,
it modifies all accesses to the array so that they access the
appropiate component of one of the vec4's.

Since some hardware may not internally represent gl_ClipDistance as a
pair of vec4's, this lowering pass is optional.  To enable it, set the
LowerClipDistance flag in gl_shader_compiler_options to true.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agoglsl hierarchical visitor: Do not overwrite base_ir for parameter lists.
Paul Berry [Fri, 19 Aug 2011 04:37:31 +0000 (21:37 -0700)]
glsl hierarchical visitor: Do not overwrite base_ir for parameter lists.

This patch fixes a bug in ir_hirearchical_visitor: when traversing an
exec_list representing the formal or actual parameters of a function,
it modified base_ir to point to each parameter in turn, rather than
leaving it as a pointer to the enclosing statement.  This was a
problem, since base_ir is used by visitor classes to locate the
statement containing the node being visited (usually so that
additional statements can be inserted before or after it).  Without
this fix, visitors might attempt to insert statements into parameter
lists.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
13 years agomesa: Add missing includes to meta.h
Chad Versace [Thu, 22 Sep 2011 18:04:40 +0000 (11:04 -0700)]
mesa: Add missing includes to meta.h

Include mtypes.h.

Signed-off-by: Chad Versace <chad@chad-versace.us>
13 years agodocs: mention VMware svga driver updates in 7.12 release notes
Brian Paul [Fri, 23 Sep 2011 14:05:36 +0000 (08:05 -0600)]
docs: mention VMware svga driver updates in 7.12 release notes

13 years agosvga: indentation/formatting fixes
Brian Paul [Thu, 22 Sep 2011 23:30:34 +0000 (17:30 -0600)]
svga: indentation/formatting fixes

13 years agosvga: remove emit_consts() offset parameter
Brian Paul [Thu, 22 Sep 2011 23:19:47 +0000 (17:19 -0600)]
svga: remove emit_consts() offset parameter

It was always zero.

13 years agosvga: s/int/unsigned/ in svga_state_constants.c
Brian Paul [Thu, 22 Sep 2011 23:17:34 +0000 (17:17 -0600)]
svga: s/int/unsigned/ in svga_state_constants.c

Be consistent with other functions in the file.  And add some comments.

13 years agosvga: s/unit/shader/ and related clean-ups
Brian Paul [Thu, 22 Sep 2011 23:10:24 +0000 (17:10 -0600)]
svga: s/unit/shader/ and related clean-ups

'shader' is more intuitive.  Also s/int/unsigned/ and add assertions.

13 years agosvga: clean up return values and error codes
Brian Paul [Thu, 22 Sep 2011 23:02:59 +0000 (17:02 -0600)]
svga: clean up return values and error codes

Previously we were using a hodge podge of int vs. pipe_enum and
0 vs. PIPE_OK.  Some functions that always returned PIPE_OK were
made void.

13 years agosvga: add format translation for DXT/sRGB formats
Brian Paul [Wed, 27 Jul 2011 22:12:25 +0000 (16:12 -0600)]
svga: add format translation for DXT/sRGB formats

Without this, apps/tests that tried to use a DXT/sRGB format would die on
a failed assertion (st_texture.c:80).

13 years agosvga: test register W component in emit_kil()
Brian Paul [Wed, 27 Jul 2011 15:13:32 +0000 (09:13 -0600)]
svga: test register W component in emit_kil()

Only the XYZ components are checked to be negative by SVGA3DOP_TEXKILL.
GL_ARB_fp requires all four components be checked.  Emit a second texkill
for W if needed.

13 years agosvga: fix depth/shadow compare for non-projected texcoords
Brian Paul [Tue, 26 Jul 2011 15:19:40 +0000 (09:19 -0600)]
svga: fix depth/shadow compare for non-projected texcoords

We only need to do the divide by Q step for TXP instructions.
This fixes the incorrectly rendered soft shadow test in Lightsmark.
Along with the previous texture swizzle commit, this also fixes all
the piglit glsl-fs-shadow2d-XX.shader_test failures.

13 years agosvga: implement texture swizzling
Brian Paul [Mon, 25 Jul 2011 22:06:45 +0000 (16:06 -0600)]
svga: implement texture swizzling

This exposes the GL_EXT_texture_swizzle extension and allows the various
depth texture modes to be implemented properly.  This, plus a follow-on
texture/shadow change fixes quite a few piglit GLSL shadow sampler test
failures.

13 years agosvga: check that we don't exceed input/ouput register limits
Brian Paul [Tue, 19 Jul 2011 20:52:54 +0000 (14:52 -0600)]
svga: check that we don't exceed input/ouput register limits

13 years agosvga: implement point sprite suppport
Brian Paul [Wed, 13 Jul 2011 16:58:01 +0000 (10:58 -0600)]
svga: implement point sprite suppport

Emit the SVGA3D_RS_POINTSPRITEENABLE render state.
When sprite_coord_mode=PIPE_SPRITE_COORD_LOWER_LEFT emit extra frag
shader code to invert the Y coordinate of the incoming texcoord.

13 years agosvga: add translation for float formats
Brian Paul [Mon, 11 Jul 2011 16:30:56 +0000 (10:30 -0600)]
svga: add translation for float formats

13 years agosvga: check to avoid writing beyond end of constant buffer
Brian Paul [Mon, 20 Jun 2011 17:07:57 +0000 (11:07 -0600)]
svga: check to avoid writing beyond end of constant buffer

See bug 688394

13 years agosvga: Cleanup format capability checking.
José Fonseca [Wed, 27 Apr 2011 11:02:08 +0000 (12:02 +0100)]
svga: Cleanup format capability checking.

Accurately describe what operations are supported when a format caps
entry is not advertised by the host, and which formats are never
supported, instead of making ad-hoc and often incorrect assumptions.

13 years agosvga: Don't use the new depth formats for surfaces that will never be sampled from.
José Fonseca [Thu, 14 Apr 2011 12:28:10 +0000 (13:28 +0100)]
svga: Don't use the new depth formats for surfaces that will never be sampled from.

Mitigates issues with hosts where support for these new depth formats is
flaky.

13 years agosvga: Share one texcoord between depth and fog
Jakob Bornecrantz [Thu, 7 Apr 2011 16:23:48 +0000 (17:23 +0100)]
svga: Share one texcoord between depth and fog

13 years agosvga: Only emit Z depth work if it is actually read
Jakob Bornecrantz [Thu, 7 Apr 2011 13:07:20 +0000 (14:07 +0100)]
svga: Only emit Z depth work if it is actually read

13 years agosvga: Fix vPos usage
Jakob Bornecrantz [Wed, 6 Apr 2011 11:13:33 +0000 (12:13 +0100)]
svga: Fix vPos usage

13 years agosvga: Wip for passing depth in a texcoord
Jakob Bornecrantz [Fri, 25 Mar 2011 02:59:07 +0000 (02:59 +0000)]
svga: Wip for passing depth in a texcoord

TODO: Can we pass this as the same texcoord as fog?

13 years agosvga: Add a comment about depth format selection.
José Fonseca [Fri, 8 Apr 2011 14:21:10 +0000 (15:21 +0100)]
svga: Add a comment about depth format selection.

13 years agosvga: Consider the new depth formats in svga_texture_from_handle().
José Fonseca [Fri, 8 Apr 2011 14:12:45 +0000 (15:12 +0100)]
svga: Consider the new depth formats in svga_texture_from_handle().

13 years agosvgadump: Dump the new depth format names.
José Fonseca [Fri, 8 Apr 2011 14:11:39 +0000 (15:11 +0100)]
svgadump: Dump the new depth format names.

13 years agosvga: Expose the new depth formats
Jakob Bornecrantz [Thu, 7 Apr 2011 17:46:09 +0000 (18:46 +0100)]
svga: Expose the new depth formats

13 years agosvga: Coalesce multiple shader constants in a single command.
José Fonseca [Wed, 23 Feb 2011 18:45:04 +0000 (18:45 +0000)]
svga: Coalesce multiple shader constants in a single command.

HWv8 feature.

Tested with GoogleEarth, Mesa demos.

13 years agosvgadump: Update for svga3d_reg.h header changes.
José Fonseca [Wed, 23 Feb 2011 18:43:53 +0000 (18:43 +0000)]
svgadump: Update for svga3d_reg.h header changes.