mesa.git
11 years agoglsl: Don't use random pointers as an array of glsl_type objects.
Kenneth Graunke [Tue, 18 Jun 2013 11:22:32 +0000 (04:22 -0700)]
glsl: Don't use random pointers as an array of glsl_type objects.

Using a random glsl_type convenience pointer as an array is a really bad
idea, for all the reasons mentioned in the previous commit.

The new glsl_type::bvec() function is simpler anyway.

Prevents breakage in the next commit.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: Stop being clever with pointer arithmetic when fetching types.
Kenneth Graunke [Tue, 18 Jun 2013 11:22:31 +0000 (04:22 -0700)]
glsl: Stop being clever with pointer arithmetic when fetching types.

Currently, vector types are linked together closely: the glsl_type
objects for float, vec2, vec3, and vec4 are all elements of the same
array, in that exact order.  This makes it possible to obtain vector
types via pointer arithmetic on the scalar type's convenience pointer.
For example, float_type + (3 - 1) = vec3.

However, relying on this is extremely fragile.  There's no particular
reason the underlying type objects need to be stored in an array.  They
could be individual class members, possibly with padding between them.
Then the pointer arithmetic would break, and we'd get bad pointers to
non-heap allocated data, causing subtle breakage that can't be detected
by valgrind.  Cue insanity.

Or someone could simply reorder the type variables, causing us to get
the wrong type entirely.  Also cue insanity.

Writing this explicitly is much safer.  With the new helper functions,
it's a bit less code even.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoglsl: Add simple vector type accessor helpers.
Kenneth Graunke [Tue, 18 Jun 2013 11:22:30 +0000 (04:22 -0700)]
glsl: Add simple vector type accessor helpers.

This patch introduces new functions to quickly grab a pointer to a
vector type.  For example:

   glsl_type::bvec(4)   returns   glsl_type::bvec4_type
   glsl_type::ivec(3)   returns   glsl_type::ivec3_type
   glsl_type::uvec(2)   returns   glsl_type::uvec2_type
   glsl_type::vec(1)    returns   glsl_type::float_type

This is less wordy than glsl_type::get_instance(GLSL_TYPE_BOOL, 4, 1),
which can help avoid extra word wrapping.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agomesa: update glext.h to version 20130624
Brian Paul [Tue, 25 Jun 2013 16:35:37 +0000 (10:35 -0600)]
mesa: update glext.h to version 20130624

In glapi_priv.h we always need the typedef for the GLclampx type
since GL_OES_fixed_point is now defined in glext.h but the
GLclampx type is not.  GLclampx is not used by anything in glext.h
but we need it for GL ES dispatch.

This is a huge patch because the structure of the file has been
changed.

The following extensions are new, however:

GL_AMD_interleaved_elements
GL_AMD_shader_trinary_minmax
GL_IBM_static_data
GL_INTEL_map_texture
GL_NV_compute_program5
GL_NV_deep_texture3D
GL_NV_draw_texture
GL_NV_shader_atomic_counters
GL_NV_shader_storage_buffer_object
GL_NVX_conditional_render
GL_OES_byte_coordinates
GL_OES_compressed_paletted_texture
GL_OES_fixed_point
GL_OES_query_matrix
GL_OES_single_precision

And these extensions were removed:

GL_FfdMaskSGIX
GL_INGR_palette_buffer
GL_INTEL_texture_scissor
GL_SGI_depth_pass_instrument
GL_SGIX_fog_scale
GL_SGIX_impact_pixel_texture
GL_SGIX_texture_select

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agost/mesa: add casts to silence MSVC warnings
Brian Paul [Wed, 26 Jun 2013 15:34:02 +0000 (09:34 -0600)]
st/mesa: add casts to silence MSVC warnings

11 years agost/mesa: make rtt_level, face, slice unsigned to silence MSVC warnings
Brian Paul [Wed, 26 Jun 2013 15:33:40 +0000 (09:33 -0600)]
st/mesa: make rtt_level, face, slice unsigned to silence MSVC warnings

11 years agohud: add float casts to silence MSVC warnings
Brian Paul [Wed, 26 Jun 2013 15:32:03 +0000 (09:32 -0600)]
hud: add float casts to silence MSVC warnings

11 years agohud: include stdio.h since we use fprintf(), fscanf(), etc
Brian Paul [Wed, 26 Jun 2013 15:31:37 +0000 (09:31 -0600)]
hud: include stdio.h since we use fprintf(), fscanf(), etc

11 years agohud: add cast to silence MSVC warning
Brian Paul [Wed, 26 Jun 2013 15:28:58 +0000 (09:28 -0600)]
hud: add cast to silence MSVC warning

11 years agoos: add cast in os_time_sleep() to silence MSVC warning
Brian Paul [Wed, 26 Jun 2013 15:28:20 +0000 (09:28 -0600)]
os: add cast in os_time_sleep() to silence MSVC warning

11 years agovega: add some casts to silence MSVC warnings
Brian Paul [Wed, 26 Jun 2013 15:27:34 +0000 (09:27 -0600)]
vega: add some casts to silence MSVC warnings

11 years agoutil: int/unsigned changes to silence some MSVC warnings
Brian Paul [Wed, 26 Jun 2013 15:26:42 +0000 (09:26 -0600)]
util: int/unsigned changes to silence some MSVC warnings

11 years agoutil: add some casts to silence some MSVC warnings
Brian Paul [Wed, 26 Jun 2013 15:26:25 +0000 (09:26 -0600)]
util: add some casts to silence some MSVC warnings

11 years agoutil: s/int/unsigned/ to silence some MSVC warnings
Brian Paul [Wed, 26 Jun 2013 15:25:52 +0000 (09:25 -0600)]
util: s/int/unsigned/ to silence some MSVC warnings

11 years agonvc0: set rsvd_kick correctly
Maarten Lankhorst [Wed, 26 Jun 2013 14:45:09 +0000 (16:45 +0200)]
nvc0: set rsvd_kick correctly

This prevents trampling beyond the end of the command stream during flushes.

NOTE: This is a candidate for the stable branches.

Reported-by: Christoph Bumiller <christoph.bumiller@speed.at>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 years agonvc0: fix push_space checks for video decoding
Maarten Lankhorst [Wed, 26 Jun 2013 14:18:42 +0000 (16:18 +0200)]
nvc0: fix push_space checks for video decoding

11 years agoilo: Remove max_threads dead code path.
Vinson Lee [Wed, 26 Jun 2013 03:55:40 +0000 (20:55 -0700)]
ilo: Remove max_threads dead code path.

max_threads cannot be greater than 28. It is either 21 or 28.

Fixes "Logically dead code" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
11 years agowinsys/intel: fix typo in "ETIMEOUT"
Jean-Sébastien Pédron [Wed, 5 Jun 2013 11:44:34 +0000 (13:44 +0200)]
winsys/intel: fix typo in "ETIMEOUT"

Should be "ETIMEDOUT".

[olv: commit message slightly re-formatted]

Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
11 years agoilo: use a bitmask for enabled constant buffers
Chia-I Wu [Wed, 26 Jun 2013 10:50:01 +0000 (18:50 +0800)]
ilo: use a bitmask for enabled constant buffers

Looping over 4 * 13 constant buffers while in most cases only two are enabled
is stupid.

11 years agovl/mpeg12: handle mpeg-1 bitstreams more correctly
Maarten Lankhorst [Wed, 26 Jun 2013 09:40:47 +0000 (11:40 +0200)]
vl/mpeg12: handle mpeg-1 bitstreams more correctly

Add support for D-frames.
Add support for slices ending on a different horizontal row of macroblocks.

11 years agoilo: support PIPE_CAP_USER_INDEX_BUFFERS
Chia-I Wu [Wed, 26 Jun 2013 05:44:27 +0000 (13:44 +0800)]
ilo: support PIPE_CAP_USER_INDEX_BUFFERS

We want to access the user buffer, if available, when primitive restart is
enabled and the restart index/primitive type is not natively supported.

And since we are handling index buffer uploads in the driver with this change,
we can also work around misalignment of index buffer offsets.

11 years agoilo: make pipe_draw_info a context state
Chia-I Wu [Wed, 26 Jun 2013 03:52:55 +0000 (11:52 +0800)]
ilo: make pipe_draw_info a context state

Rename ilo_finalize_states() to ilo_finalize_3d_states(), and bind
pipe_draw_info to the context when it is called.  This saves us from having to
pass pipe_draw_info around in several places.

11 years agoilo: support PIPE_CAP_USER_CONSTANT_BUFFERS
Chia-I Wu [Wed, 26 Jun 2013 04:26:02 +0000 (12:26 +0800)]
ilo: support PIPE_CAP_USER_CONSTANT_BUFFERS

We need it for HUD support, and will need it for push constants in the future.

11 years agoi915: Drop dead batch dumping code.
Eric Anholt [Fri, 21 Jun 2013 17:47:05 +0000 (10:47 -0700)]
i915: Drop dead batch dumping code.

Batch dumping is now handled by shared code in libdrm.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Drop little bits of dead code.
Eric Anholt [Fri, 21 Jun 2013 17:43:32 +0000 (10:43 -0700)]
intel: Drop little bits of dead code.

I noticed these while building the fork-i915 branch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Stop recomputing the miptree's size from the texture image.
Eric Anholt [Wed, 19 Jun 2013 21:08:29 +0000 (14:08 -0700)]
i965: Stop recomputing the miptree's size from the texture image.

We've already computed what the dimensions of the miptree are, and stored
it in the miptree.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Drop unused argument to translate_tex_format().
Eric Anholt [Wed, 19 Jun 2013 21:26:50 +0000 (14:26 -0700)]
i965: Drop unused argument to translate_tex_format().

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/gen4-5: Stop using bogus polygon_offset_scale field.
Eric Anholt [Wed, 12 Jun 2013 00:32:41 +0000 (17:32 -0700)]
i965/gen4-5: Stop using bogus polygon_offset_scale field.

The polygon offset math used for triangles by the WM is "OffsetUnits * 2 *
MRD + OffsetFactor * m" where 'MRD' is the minimum resolvable difference
for the depth buffer (~1/(1<<16) or ~1/(1<<24)), 'm' is the approximated
slope from the GL spec, and '2' is this magic number from the original
i965 code dump that we deviate from the GL spec by because "it makes glean
work" (except that it doesn't, because of some hilarity with 0.5 *
approximately 2.0 != 1.0.  go glean!).

This clipper code for unfilled polygons, on the other hand, was doing
"OffsetUnits * garbage + OffsetFactor * m", where garbage was MRD in the
case of 16-bit depth visual (regardless the FBO's depth resolution), or
128 * MRD for 24-bit depth visual.

This change just makes the unfilled polygons behavior match the WM's
filled polygons behavior.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi915: Use the current drawbuffer's depth for polygon offset scale.
Eric Anholt [Wed, 12 Jun 2013 03:24:41 +0000 (20:24 -0700)]
i915: Use the current drawbuffer's depth for polygon offset scale.

There's no reason to care about the window system visual's depth for
handling polygon offset in an FBO, and it could only lead to pain.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Add perf debug for glCopyPixels() fallback checks.
Eric Anholt [Thu, 6 Jun 2013 01:33:36 +0000 (18:33 -0700)]
intel: Add perf debug for glCopyPixels() fallback checks.

The separate function for the fallback checks wasn't particularly
clarifying things, so I put the improved checks in the caller.  (Note that
the dropped _mesa_update_state() had already happened once at the start of
the caller)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Add debug to INTEL_DEBUG=blorp describing hiz/blit/clear ops.
Eric Anholt [Thu, 30 May 2013 21:53:55 +0000 (14:53 -0700)]
i965: Add debug to INTEL_DEBUG=blorp describing hiz/blit/clear ops.

I think we've all added instrumentation at one point or another to see
what's being called in blorp.  Now you can quickly get output like:

Testing glCopyPixels(depth).
intel_hiz_exec depth clear to mt 0x16d9160 level 0 layer 0
intel_hiz_exec depth resolve to mt 0x16d9160 level 0 layer 0
intel_hiz_exec hiz ambiguate to mt 0x16d9160 level 0 layer 0
intel_hiz_exec depth resolve to mt 0x16d9160 level 0 layer 0

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agora: Fix register spilling.
Eric Anholt [Thu, 6 Jun 2013 20:21:21 +0000 (13:21 -0700)]
ra: Fix register spilling.

Commit 551c991606e543c3a264a762026f11348b37947e tried to avoid spilling
registers that were trivially colorable.  But since we do optimistic
coloring, the top of the stack also contains nodes that are not trivially
colorable, so we need to consider them for spilling (since they are some
of our best candidates).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58384
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63674
NOTE: This is a candidate for the 9.1 branch.

11 years agoi965/fs: Dump IR when fatally not compiling due to bad register spilling.
Eric Anholt [Thu, 6 Jun 2013 18:24:07 +0000 (11:24 -0700)]
i965/fs: Dump IR when fatally not compiling due to bad register spilling.

It should never happen, but it does, and at this point, you're going to
_mesa_problem() and abort() (unless it's just in precompile).  Give the
developer something to look at.

11 years agoxmlpool/build: Make sure to set mo properly
Naohiro Aota [Mon, 24 Jun 2013 08:53:10 +0000 (17:53 +0900)]
xmlpool/build: Make sure to set mo properly

Some shells does not set variables sequentially in a statement i.e. "a=X
b=${a}" won't set "b" to "X" but empty value.

This patch introduce ";" to make sure "mo" is set properly before "lang"
assignment.

Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=471302

11 years agoi965: Remove the rest of brw_update_draw_buffer().
Eric Anholt [Thu, 20 Jun 2013 16:53:27 +0000 (09:53 -0700)]
i965: Remove the rest of brw_update_draw_buffer().

The last piece of code with an effect was flagging _NEW_BUFFERS.  Only,
that is already flagged from everything that calls this function: Mesa GL
state updates flag it before even calling down into the driver, and the
calls from the DRI2 window system framebuffer update path end up flagging
it as part of the ResizeBuffers() hook.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Stop updating FBO state on drawbuffers change.
Eric Anholt [Thu, 20 Jun 2013 16:50:58 +0000 (09:50 -0700)]
i965: Stop updating FBO state on drawbuffers change.

The computed fields are updated appropriately as part of the normal draw
call path due to _NEW_BUFFERS being set.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Stop recomputing drawbuffer bounds on drawbuffer change.
Eric Anholt [Thu, 20 Jun 2013 16:49:32 +0000 (09:49 -0700)]
i965: Stop recomputing drawbuffer bounds on drawbuffer change.

For winsys FBOs, the bounds are appropriately updated immediately upon
_mesa_resize_framebuffer().  For user FBOs, they're updated as part of the
normal draw path state update due to _NEW_BUFFERS having been flagged.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Remove _NEW_DEPTH state flagging on drawbuffers change.
Eric Anholt [Thu, 20 Jun 2013 16:28:53 +0000 (09:28 -0700)]
i965: Remove _NEW_DEPTH state flagging on drawbuffers change.

Of the places noting a _NEW_DEPTH dependency, all were already checking
for _NEW_BUFFERS if appropriate.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Stop doing special _NEW_STENCIL state flagging on drawbuffers.
Eric Anholt [Thu, 20 Jun 2013 16:08:30 +0000 (09:08 -0700)]
intel: Stop doing special _NEW_STENCIL state flagging on drawbuffers.

2/3 packets depending on Stencil._Enabled already checked for
_NEW_BUFFERS, so just add _NEW_BUFFERS to the remaining one.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Stop flagging viewport/scissor change on drawbuffers change.
Eric Anholt [Thu, 20 Jun 2013 15:41:19 +0000 (08:41 -0700)]
i965: Stop flagging viewport/scissor change on drawbuffers change.

The viewport (ctx->Viewport._WindowMap) doesn't change with drawable size
changes, and we update scissor (ctx->DrawBuffer->_Xmin and friends) on
_NEW_BUFFERS in things like brw_sf_state.c.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965: Stop flagging _NEW_POLYGON on drawbuffers change.
Eric Anholt [Thu, 20 Jun 2013 15:39:56 +0000 (08:39 -0700)]
i965: Stop flagging _NEW_POLYGON on drawbuffers change.

Things like brw_sf.c that need to know about orientation are already
recomputing on _NEW_BUFFERS.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoradeon: Remove gratuitous custom framebuffer resize code.
Eric Anholt [Thu, 20 Jun 2013 16:03:56 +0000 (09:03 -0700)]
radeon: Remove gratuitous custom framebuffer resize code.

_mesa_resize_framebuffer(), the default value of the ResizeBuffers hook,
already checks for a window system framebuffer and walks the renderbuffers
calling AllocStorage().

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agointel: Remove gratuitous custom framebuffer resize code.
Eric Anholt [Thu, 20 Jun 2013 16:01:09 +0000 (09:01 -0700)]
intel: Remove gratuitous custom framebuffer resize code.

_mesa_resize_framebuffer(), the default value of the ResizeBuffers hook,
already checks for a window system framebuffer and walks the renderbuffers
calling AllocStorage().

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Remove the Initialized field from framebuffers.
Eric Anholt [Thu, 20 Jun 2013 16:41:10 +0000 (09:41 -0700)]
mesa: Remove the Initialized field from framebuffers.

This existed to tell the core not to call GetBufferSize, except that even
if you didn't set it nothing happened because nobody had a GetBufferSize.

v2: Remove two more instances of setting the field (from Brian)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Remove Driver.GetBufferSize and its callers.
Eric Anholt [Thu, 20 Jun 2013 16:39:11 +0000 (09:39 -0700)]
mesa: Remove Driver.GetBufferSize and its callers.

Only the GDI driver set it to non-NULL any more, and that driver has a
Viewport hook that should keep it limping along as well as it ever has.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Fix gl_shader_program::UniformLocationBaseScale assert.
Vinson Lee [Tue, 25 Jun 2013 05:50:30 +0000 (22:50 -0700)]
glsl: Fix gl_shader_program::UniformLocationBaseScale assert.

commit 26d86d26f9f972b19c7040bdb1b1daf48537ef3e added
gl_shader_program::UniformLocationBaseScale. According to the code
comments in that commit, UniformLocationBaseScale "must be >=1".

UniformLocationBaseScale is of type unsigned. Coverity reported a "Macro
compares unsigned to 0" defect as well.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agosvga: allow 3D transfers in svga_texture_transfer_map()
Brian Paul [Mon, 24 Jun 2013 22:15:02 +0000 (16:15 -0600)]
svga: allow 3D transfers in svga_texture_transfer_map()

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: use new svga_define_texture_level() helper
Brian Paul [Mon, 24 Jun 2013 20:59:53 +0000 (14:59 -0600)]
svga: use new svga_define_texture_level() helper

To get array bounds checking.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: fix layer/level mix-up in svga_mark_surface_dirty()
Brian Paul [Mon, 24 Jun 2013 22:25:09 +0000 (16:25 -0600)]
svga: fix layer/level mix-up in svga_mark_surface_dirty()

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: use new svga_age_texture_view() helper
Brian Paul [Mon, 24 Jun 2013 20:44:08 +0000 (14:44 -0600)]
svga: use new svga_age_texture_view() helper

The function does array bounds checking.  Note, this exposes a
bug in the svga_mark_surface_dirty() function: we're calling
svga_age_texture_view() with a texture slice instead of mipmap
level.  This can lead to a failed assertion.  That'll be fixed next.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: add array index assertion in svga_validate_sampler_view()
Brian Paul [Mon, 24 Jun 2013 20:48:57 +0000 (14:48 -0600)]
svga: add array index assertion in svga_validate_sampler_view()

11 years agosvga: use svga_texture() helper instead of casting
Brian Paul [Mon, 24 Jun 2013 20:42:38 +0000 (14:42 -0600)]
svga: use svga_texture() helper instead of casting

11 years agoutil/debug: Cleanup/improve debug_symbol_name_dbghelp.
José Fonseca [Mon, 24 Jun 2013 12:35:53 +0000 (13:35 +0100)]
util/debug: Cleanup/improve debug_symbol_name_dbghelp.

- use mgwhelp -- the successor for bfdhelp which does not have a hard
  dependency on BFD, and works on 64bits.
- use a macro instead of hand-typing to dispatch DbgHelp functions
- dump line numbers
- dump module names when symbols are not available
- support 64bits.
- add comments

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoutil/debug: Make debug_backtrace_capture work for 64bit windows.
José Fonseca [Mon, 24 Jun 2013 12:37:45 +0000 (13:37 +0100)]
util/debug: Make debug_backtrace_capture work for 64bit windows.

Rely on Windows' CaptureStackBackTrace to do the grunt work.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agodraw: allow overflows in the llvm paths
Zack Rusin [Mon, 24 Jun 2013 22:52:24 +0000 (18:52 -0400)]
draw: allow overflows in the llvm paths

Because our code couldn't handle it we were skipping rendering
if we detected overflows. According to the spec we should
still render but with all 0 vertices, which is what the llvm
code already does. So for the llvm paths lets enable processing
even if an overflow condition has been detected.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agodraw: avoid overflows in the llvm draw loop
Zack Rusin [Mon, 24 Jun 2013 22:49:40 +0000 (18:49 -0400)]
draw: avoid overflows in the llvm draw loop

Before we could easily overflow if start+count>max integer. To
avoid it we can just iterate over the count. This makes sure
that we never crash, since most of the overflow conditions
is already handled.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agonvc0: do not set tiled mode on gart bo when fence debugging is used
Maarten Lankhorst [Tue, 25 Jun 2013 11:34:15 +0000 (13:34 +0200)]
nvc0: do not set tiled mode on gart bo when fence debugging is used

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 years agoilo: honor render condition in blitter
Chia-I Wu [Tue, 25 Jun 2013 07:36:15 +0000 (15:36 +0800)]
ilo: honor render condition in blitter

Make pass_render_condition() available for blitter, and check for render
condition in (and only in) clear(), clear_render_target(), and
clear_depth_stencil().

11 years agoilo: remove ilo_shader_internal.h from GEN6 pipeline
Chia-I Wu [Tue, 25 Jun 2013 02:01:59 +0000 (10:01 +0800)]
ilo: remove ilo_shader_internal.h from GEN6 pipeline

Replace direct shader accesses with ilo_shader_get_kernel_param() and etc.

11 years agoilo: remove ilo_shader_internal.h from GEN7 pipeline
Chia-I Wu [Mon, 24 Jun 2013 15:54:49 +0000 (23:54 +0800)]
ilo: remove ilo_shader_internal.h from GEN7 pipeline

Replace direct shader accesses with ilo_shader_get_kernel_param() and etc.

11 years agoilo: speed up ilo_shader_select_kernel_routing() a bit
Chia-I Wu [Mon, 24 Jun 2013 08:26:25 +0000 (16:26 +0800)]
ilo: speed up ilo_shader_select_kernel_routing() a bit

Remember the order of the source attributes and avoid recomputation when it
does not change.

11 years agoilo: move SBE setup code to ilo_shader.c
Chia-I Wu [Mon, 24 Jun 2013 06:13:33 +0000 (14:13 +0800)]
ilo: move SBE setup code to ilo_shader.c

Add ilo_shader_select_kernel_routing() to construct 3DSTATE_SBE.  It is called
in ilo_finalize_states(), rather than in create_fs_state(), as it depends on
VS/GS and rasterizer states.

With this change, ilo_shader_internal.h is no longer needed for
ilo_gpe_gen6.c.

11 years agoilo: use ilo_shader_state exclusively in GPE
Chia-I Wu [Fri, 21 Jun 2013 06:29:08 +0000 (14:29 +0800)]
ilo: use ilo_shader_state exclusively in GPE

This allows us to remove ilo_shader_internal.h from ilo_gpe_gen7.c.  The
unfinished code in 3DSTATE_DS, 3DSTATE_HS, and INTERFACE_DESCRIPTOR_DATA are
partly or entirely removed.

11 years agoilo: map SO registers at shader compile time
Chia-I Wu [Fri, 21 Jun 2013 06:22:09 +0000 (14:22 +0800)]
ilo: map SO registers at shader compile time

The unmodified pipe_stream_output_info describes its outputs as if they are in
TGSI_FILE_OUTPUT.  Remap the register indices to where they appear in the VUE.

TGSI_SEMANTIC_PSIZE needs a little care because it is at the W channel.

11 years agoilo: use ilo_shader_cso for FS
Chia-I Wu [Fri, 21 Jun 2013 03:36:11 +0000 (11:36 +0800)]
ilo: use ilo_shader_cso for FS

Add ilo_gpe_init_fs_cso() to construct 3DSTATE_PS and shader part of
3DSTATE_WM once and early for fragment shaders.

11 years agoilo: use ilo_rasterizer_state exclusively in GPE
Chia-I Wu [Fri, 21 Jun 2013 04:30:23 +0000 (12:30 +0800)]
ilo: use ilo_rasterizer_state exclusively in GPE

Replace pipe_rasterizer_state by ilo_rasterizer_state for the remaining GPE
functions for consistency.

11 years agoilo: convert pipe_rasterizer_state to ilo_rasterizer_wm
Chia-I Wu [Fri, 21 Jun 2013 03:36:14 +0000 (11:36 +0800)]
ilo: convert pipe_rasterizer_state to ilo_rasterizer_wm

Add ilo_gpe_init_rasterizer_wm() to construct fixed-function part of
3DSTATE_WM once in create_rasterizer_state().

11 years agoilo: use ilo_shader_cso for GS
Chia-I Wu [Thu, 20 Jun 2013 09:42:21 +0000 (17:42 +0800)]
ilo: use ilo_shader_cso for GS

Add ilo_gpe_init_gs_cso() to construct 3DSTATE_GS once and early for geometry
shaders.

11 years agoilo: introduce ilo_shader_cso for VS
Chia-I Wu [Thu, 20 Jun 2013 08:34:25 +0000 (16:34 +0800)]
ilo: introduce ilo_shader_cso for VS

When a new VS kernel is generated, a newly added function,
ilo_gpe_init_vs_cso(), is called to construct 3DSTATE_VS command in
ilo_shader_cso.  When the command needs to be emitted later, we copy the
command from the CSO instead of constructing it dynamically.

11 years agoilo: add functions to query shaders
Chia-I Wu [Tue, 25 Jun 2013 04:12:09 +0000 (12:12 +0800)]
ilo: add functions to query shaders

Add ilo_shader_get_type() to query the type (PIPE_SHADER_x) of the shader.
Add ilo_shader_get_kernel_offset() and ilo_shader_get_kernel_param() to query
the cache offset and various kernel parameters of the selected kernel.

11 years agoilo: clean up finalize_shader_states()
Chia-I Wu [Thu, 20 Jun 2013 04:57:42 +0000 (12:57 +0800)]
ilo: clean up finalize_shader_states()

Add ilo_shader_select_kernel() to replace the dependency table,
ilo_shader_variant_init(), and ilo_shader_state_use_variant().

With the changes, we no longer need to include ilo_shader_internal.h in
ilo_state.c.

11 years agoilo: use multiple entry points for shader creation
Chia-I Wu [Thu, 20 Jun 2013 04:46:36 +0000 (12:46 +0800)]
ilo: use multiple entry points for shader creation

Replace ilo_shader_state_create() by

 ilo_shader_create_vs()
 ilo_shader_create_gs()
 ilo_shader_create_fs()
 ilo_shader_create_cs()

Rename ilo_shader_state_destroy() to ilo_shader_destroy().  The old
ilo_shader_destroy() is renamed to ilo_shader_destroy_kernel().

11 years agoilo: move internal shader interface to a new header
Chia-I Wu [Thu, 20 Jun 2013 03:52:03 +0000 (11:52 +0800)]
ilo: move internal shader interface to a new header

Move it to ilo_shader_internal.h.  The goal is to make files not part of the
compiler include only ilo_shader.h eventually.

11 years agogallium/hud: do not use free() for the free_query_data hook
Brian Paul [Mon, 24 Jun 2013 16:43:16 +0000 (10:43 -0600)]
gallium/hud: do not use free() for the free_query_data hook

That confuses Gallium's memory debugging code where CALLOC/MALLOC
must be matched with FREE, not free().

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agodraw: check for out-of-memory conditions in the AA line module.
Matthew McClure [Fri, 21 Jun 2013 19:44:44 +0000 (12:44 -0700)]
draw: check for out-of-memory conditions in the AA line module.

To prevent segfaults in the AA line module, the code will check for a
valid pointer to the aaline_stage in the draw context.

Fixes segfault from backtrace:

* aaline_stage_from_pipe
  aaline_delete_fs_state

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotests/graw: Fix typo in shader-leak.c
José Fonseca [Mon, 24 Jun 2013 14:29:25 +0000 (15:29 +0100)]
tests/graw: Fix typo in shader-leak.c

11 years agotools/trace: Fix syntax.
José Fonseca [Mon, 24 Jun 2013 13:45:49 +0000 (14:45 +0100)]
tools/trace: Fix syntax.

Cleaned/commented up the code, but forgot to actually test before
commiting...

11 years agost/dri/sw: Fix pitch calculation in drisw_update_tex_buffer
Richard Sandiford [Tue, 18 Jun 2013 15:41:43 +0000 (16:41 +0100)]
st/dri/sw: Fix pitch calculation in drisw_update_tex_buffer

swrastGetImage rounds the pitch up to 4 bytes for compatibility reasons
that are explained in drisw_glx.c:bytes_per_line, so drisw_update_tex_buffer
must do the same.

Fixes window skew seen while running firefox over vnc on a 16-bit screen.

NOTE: This is a candidate for the stable branches.

[ajax: fixed typo in comment]

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com>
11 years agogallium: Fix llvmpipe on big-endian machines
Adam Jackson [Mon, 24 Jun 2013 13:48:56 +0000 (09:48 -0400)]
gallium: Fix llvmpipe on big-endian machines

Squashed commit of the following:

commit 0857a7e105bfcbc4d1431b2cc56612094c747ca3
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:07 2013 -0400

    gallivm: Fix lp_build_rgba8_to_fi32_soa for big endian

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 0d65131649a8aa140e2db228ba779d685c4333e3
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:07 2013 -0400

    gallivm: Fix big-endian machines

    This adds a bit-shift count to the format table, and adds the concept of
    vector or bitwise alignment on gathers.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 9740bda9b7dc894b629ed38be9b51059ce90818f
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:07 2013 -0400

    llvmpipe: Fix convert_to_blend_type on big-endian

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit ae037c2de0f029e4e99371c0de25560484f0d8df
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    util: Convert color pack to packed formats

    This fixes them on big-endian.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 5b05ac0c89ae092ea8ba5bba9f739708d7396b5c
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    graw-xlib: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 51396e7d098cb6ff794391cf11afe4dbf86dbea0
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    format: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 417b60bc66eb450e68a92ab0e47f76e292b385e6
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    st/dri: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 0934b2e022a5e0847d312c40734e2b44cac52fd8
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    st/xlib: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit a307ea3c3716a706963acce7966b5e405ba11db9
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    gbm: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 53eebdd253e1960a645ea278f31d7ef6a6cf4aeb
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    tests: Convert to packed formats

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 2f77fe3ee524945eacd546efcac34f7799fb3124
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Jun 18 13:07:37 2013 -0400

    gallium: Document packed formats

Signed-off-by: Adam Jackson <ajax@redhat.com>
commit 1f1017159ce951f922210a430de9229f91f62714
Author: Richard Sandiford <r.sandiford@uk.ibm.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    gallium: Introduce 32-bit packed format names

    These are for interacting with buffers natively described in terms of
    bit shifts, like X11 visuals:

        uint32_t xyzw8888 = (x << 0) | (y << 8) | (z << 16) | (w << 24);

    Define these in terms of (endian-dependent) aliases to the array-style
    format names.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Richard Sandiford <r.sandiford@uk.ibm.com>
commit 6cc7ab1ee66ed668da78c1d951dfd7782b4e786a
Author: Adam Jackson <ajax@redhat.com>
Date:   Mon Jun 3 12:10:32 2013 -0400

    gallium: Document format name conventions

    v2:
    - Fix a channel name thinko (Michel Dänzer)
    - Elaborate on SCALED versus INT
    - Add links to DirectX and FOURCC docs

Signed-off-by: Adam Jackson <ajax@redhat.com>
commit df4d269e7fb62051a3c029b84147465001e5776e
Author: Adam Jackson <ajax@redhat.com>
Date:   Tue Jun 18 12:25:06 2013 -0400

    gallivm: Remove all notion of byte-swapping

Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
11 years agollvmpipe: fix wrong results for queries not in a scene
Roland Scheidegger [Thu, 20 Jun 2013 18:31:18 +0000 (20:31 +0200)]
llvmpipe: fix wrong results for queries not in a scene

The result isn't always 0 in this case (depends on query type),
so instead of special casing this just use the ordinary path (should result
in correct values thanks to initialization in query_begin/end), just
skipping the fence wait.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium/docs: more documentation for pipe_resource::array_size
Brian Paul [Fri, 21 Jun 2013 19:25:42 +0000 (13:25 -0600)]
gallium/docs: more documentation for pipe_resource::array_size

It should never be zero and for cube/cube_arrays it should be a
multiple of six.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
11 years agosvga: minor cleanups, comments in svga_tgsi_insn.c
Brian Paul [Fri, 21 Jun 2013 22:24:55 +0000 (16:24 -0600)]
svga: minor cleanups, comments in svga_tgsi_insn.c

11 years agosvga: add null ptr check in svga_get_tex_sampler_view()
Brian Paul [Fri, 21 Jun 2013 22:09:05 +0000 (16:09 -0600)]
svga: add null ptr check in svga_get_tex_sampler_view()

Trivial.

11 years agotools/trace: Several tweaks/fixes to dump_state
José Fonseca [Sat, 22 Jun 2013 11:30:12 +0000 (12:30 +0100)]
tools/trace: Several tweaks/fixes to dump_state

11 years agotrace: Dump result of create_stream_output_target
José Fonseca [Sat, 22 Jun 2013 11:26:10 +0000 (12:26 +0100)]
trace: Dump result of create_stream_output_target

11 years agovl/mpeg12: fix mpeg-1 bytestream parsing
Maarten Lankhorst [Sat, 22 Jun 2013 07:33:52 +0000 (09:33 +0200)]
vl/mpeg12: fix mpeg-1 bytestream parsing

This fixes the bytestream parsing of mpeg-1 stream, but still leaves
open a number of issues with the interpretation:
- IDCT mismatch control is not correct for MPEG-1.
- Slices do not have to start and end on the same horizontal row of macroblocks.
- picture_coding_type = 4 (D-pictures) is not handled.
- full_pel_*_vector is not handled.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
11 years agofreedreno/a3xx/compiler: ensure min # of cycles after bary instr
Rob Clark [Fri, 21 Jun 2013 19:05:12 +0000 (15:05 -0400)]
freedreno/a3xx/compiler: ensure min # of cycles after bary instr

The results of a bary.f do not appear to be immediatley available, but
there is no explicit sync bit.  Instead the compiler must just ensure
that there are a minimum number of instructions following the bary
before use of the result of the bary.  We aren't clever enough for that
so just throw in some nop's.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno/a3xx/compiler: add TGSI_OPCODE_ABS
Rob Clark [Fri, 21 Jun 2013 19:01:49 +0000 (15:01 -0400)]
freedreno/a3xx/compiler: add TGSI_OPCODE_ABS

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno/a3xx/compiler: add TGSI_OPCODE_DPH
Rob Clark [Fri, 21 Jun 2013 19:01:15 +0000 (15:01 -0400)]
freedreno/a3xx/compiler: add TGSI_OPCODE_DPH

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agofreedreno/a3xx/compiler: fix for replicating instructions
Rob Clark [Fri, 21 Jun 2013 18:39:54 +0000 (14:39 -0400)]
freedreno/a3xx/compiler: fix for replicating instructions

If we are accumulating result into tmp.x, and need a mov to final
destination, we want to move the .x component into all of the components
enabled from the read dest's writemask, ie. we want:

  MOV dst.xyzw tmp.xxxx

rather than:

  MOV dst.xyzw tmp.xyzw

Signed-off-by: Rob Clark <robclark@freedesktop.org>
11 years agomesa: Move the common _mesa_glsl_compile_shader() code to glsl/.
Eric Anholt [Wed, 12 Jun 2013 22:49:43 +0000 (15:49 -0700)]
mesa: Move the common _mesa_glsl_compile_shader() code to glsl/.

This code had no relation to ir_to_mesa.cpp, since it was also used by
intel and state_tracker, and most of it was duplicated with the standalone
compiler (which has periodically drifted from the Mesa copy).

v2: Split from the ir_to_mesa to shaderapi.c changes.

Acked-by: Paul Berry <stereotype441@gmail.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Move shader compiler API code to shaderapi.c
Eric Anholt [Wed, 19 Jun 2013 23:00:23 +0000 (16:00 -0700)]
mesa: Move shader compiler API code to shaderapi.c

There was nothing ir_to_mesa-specific about this code, but it's not
exactly part of the compiler's core turning-source-into-IR job either.

v2: Split from the ir_to_mesa to glsl/ commit, avoid renaming the sh
    variable.

Acked-by: Paul Berry <stereotype441@gmail.com> (v1)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Fix missing setting of shader->IsES.
Eric Anholt [Thu, 13 Jun 2013 17:24:36 +0000 (10:24 -0700)]
mesa: Fix missing setting of shader->IsES.

I noticed this while trying to merge code with the builtin compiler, which
does set it.

Note that this causes two regressions in piglit in
default-precision-sampler.* which try to link without a vertex or fragment
shader, due to being run under the desktop glslparsertest binary (using
ARB_ES3_compatibility) that doesn't know about this requirement.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agomesa: Use shared code for converting shader targets to short strings.
Eric Anholt [Wed, 12 Jun 2013 23:57:11 +0000 (16:57 -0700)]
mesa: Use shared code for converting shader targets to short strings.

We were duplicating this code all over the place, and they all would need
updating for the next set of shader targets.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Remove ir_print_visitor.h includes and usage
Eric Anholt [Wed, 12 Jun 2013 23:21:28 +0000 (16:21 -0700)]
glsl: Remove ir_print_visitor.h includes and usage

We have ir->print() to do the old declaration of a visitor and having the
IR accept the visitor (yuck!).  And now you can call _mesa_print_ir()
safely anywhere that you know what an ir_instruction is.

A couple of missing printf("\n")s are added in error paths -- when an
expression is handed to the visitor, it doesn't print '\n' (since it might
be a step in printing a whole expression tree).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Make _mesa_print_ir() available from anything including ir.h.
Eric Anholt [Wed, 12 Jun 2013 23:10:33 +0000 (16:10 -0700)]
glsl: Make _mesa_print_ir() available from anything including ir.h.

No more forgetting to #include "ir_print_visitor.h" when doing temporary
debug code, or forgetting and leaving it in after removing your temporary
debug code.  Also, available from C code so you don't need to move the
caller to C++ just to call it (see also: ir_to_mesa.cpp).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
11 years agoglsl: Make some files safe to include from C
Paul Berry [Fri, 22 Mar 2013 20:29:55 +0000 (13:29 -0700)]
glsl: Make some files safe to include from C

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agotools/trace: Quick instructions/notes.
José Fonseca [Fri, 21 Jun 2013 10:12:31 +0000 (11:12 +0100)]
tools/trace: Quick instructions/notes.
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotools/trace: Do a better job at comparing multi line strings.
José Fonseca [Fri, 21 Jun 2013 10:08:56 +0000 (11:08 +0100)]
tools/trace: Do a better job at comparing multi line strings.

For TGSI diffing.
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agotools/trace: Tool to compare json state dumps.
José Fonseca [Thu, 20 Jun 2013 18:40:47 +0000 (19:40 +0100)]
tools/trace: Tool to compare json state dumps.

Copied verbatim from apitrace's scripts/jsondiff.py
Reviewed-by: Brian Paul <brianp@vmware.com>