mesa.git
11 years agoradeonsi: initial PM4 changes for CIK
Alex Deucher [Thu, 8 Nov 2012 23:59:46 +0000 (18:59 -0500)]
radeonsi: initial PM4 changes for CIK

note which packets are removed and add new ones.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoradeonsi: initial support for CIK chips
Alex Deucher [Fri, 7 Jun 2013 18:00:11 +0000 (14:00 -0400)]
radeonsi: initial support for CIK chips

Add the infrastructure to differentiate them.
Just treat them like SI for now.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoradeonsi: rename SI chip class from TAHITI to SI
Alex Deucher [Fri, 7 Jun 2013 17:58:34 +0000 (13:58 -0400)]
radeonsi: rename SI chip class from TAHITI to SI

Covers the entire family.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor600g: Fix build
Tom Stellard [Fri, 28 Jun 2013 18:08:07 +0000 (11:08 -0700)]
r600g: Fix build

Broken since 2840bec56f79347b95dec5458b20d4a46d1aa445 when opencl is
disabled.

11 years agomesa: Return ZeroVec/dummyReg instead of NULL pointer
Anuj Phogat [Thu, 27 Jun 2013 23:12:07 +0000 (16:12 -0700)]
mesa: Return ZeroVec/dummyReg instead of NULL pointer

Assertions are not sufficient to check for null pointers as they don't
show up in release builds. So, return ZeroVec/dummyReg instead of NULL
pointer in get_{src,dst}_register_pointer(). This should calm down the
warnings from static analysis tool.

Note: This is a candidate for the 9.1 branch.
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agomesa: Fix build with older gcc since update of glext.h
Tom Stellard [Thu, 27 Jun 2013 15:27:30 +0000 (08:27 -0700)]
mesa: Fix build with older gcc since update of glext.h

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agor600g/compute: Accept LDS size from the LLVM backend
Tom Stellard [Wed, 12 Jun 2013 21:38:59 +0000 (14:38 -0700)]
r600g/compute: Accept LDS size from the LLVM backend

And allocate the correct amount before dispatching the kernel.

Tested-by: Aaron Watry <awatry@gmail.com>
11 years agor600g/compute: Move compute_shader_create() function into evergreen_compute.c
Tom Stellard [Wed, 12 Jun 2013 19:36:08 +0000 (12:36 -0700)]
r600g/compute: Move compute_shader_create() function into evergreen_compute.c

Tested-by: Aaron Watry <awatry@gmail.com>
11 years agosvga: pass svga_compile_key by reference instead of value
Brian Paul [Fri, 28 Jun 2013 14:09:48 +0000 (08:09 -0600)]
svga: pass svga_compile_key by reference instead of value

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosvga: use switch statement in svga_shader_type()
Brian Paul [Fri, 28 Jun 2013 14:08:38 +0000 (08:08 -0600)]
svga: use switch statement in svga_shader_type()

Safer in case the PIPE_SHADER_x tokens get renumbered (as Marek
wanted to do).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoilo: clean up states that use ilo_view_surface
Chia-I Wu [Fri, 28 Jun 2013 06:44:47 +0000 (14:44 +0800)]
ilo: clean up states that use ilo_view_surface

Use variables that are easier to remember what they are.

11 years agoilo: remove ilo_cbuf_state::count
Chia-I Wu [Fri, 28 Jun 2013 05:59:18 +0000 (13:59 +0800)]
ilo: remove ilo_cbuf_state::count

We can derive it from enabled_mask.

11 years agoilo: clean up ilo_set_constant_buffer()
Chia-I Wu [Fri, 28 Jun 2013 05:56:36 +0000 (13:56 +0800)]
ilo: clean up ilo_set_constant_buffer()

Add loops that will be optimized away.

11 years agoilo: clean up states that take a start_slot
Chia-I Wu [Fri, 28 Jun 2013 06:13:04 +0000 (14:13 +0800)]
ilo: clean up states that take a start_slot

They are similar, so clean them up to make them look similar.

11 years agoglsl: Initialize member variable is_ubo_var in constructor.
Vinson Lee [Sat, 8 Jun 2013 20:46:54 +0000 (13:46 -0700)]
glsl: Initialize member variable is_ubo_var in constructor.

Fixes "Uninitialized scalar field" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoilo: use shorter names for dirty flags
Chia-I Wu [Thu, 27 Jun 2013 07:17:08 +0000 (15:17 +0800)]
ilo: use shorter names for dirty flags

The new names match those of ilo_context's members respectively, and are
shorter.

11 years agoilo: track if primitive restart has changed
Chia-I Wu [Thu, 27 Jun 2013 10:19:16 +0000 (18:19 +0800)]
ilo: track if primitive restart has changed

Re-emit 3DSTATE_INDEX_BUFFER to enable/disable primitive restart.

11 years agoilo: avoid potential dangling pointer dereference
Chia-I Wu [Thu, 27 Jun 2013 06:52:54 +0000 (14:52 +0800)]
ilo: avoid potential dangling pointer dereference

Set pipe_draw_info to NULL after draw_vbo().

11 years agomesa: Remove GL_EXT_clip_volume_hint
Ian Romanick [Thu, 27 Jun 2013 18:23:33 +0000 (11:23 -0700)]
mesa: Remove GL_EXT_clip_volume_hint

As far as I can tell, no driver has enabled this extension since c6499a7
back in 2007.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965,i915: Return early if miptree allocation fails
Chad Versace [Wed, 26 Jun 2013 20:53:15 +0000 (13:53 -0700)]
i965,i915: Return early if miptree allocation fails

If allocation fails in intel_miptree_create_layout(), don't proceed to
dereference the miptree. Return an early NULL.

Fixes static analysis error reported by Klocwork.

Note: This is a candidate for the 9.1 branch.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
11 years agollvmpipe: handle offset_clamp
Roland Scheidegger [Thu, 27 Jun 2013 17:01:11 +0000 (19:01 +0200)]
llvmpipe: handle offset_clamp

This was just ignored (unless for some reason like unfilled polys draw was
handling this).
I'm not convinced of that code, putting the float for the clamp in the key
isn't really a good idea. Then again the other floats for depth bias are
already in there too anyway (should probably have a jit_context for the
setup function), so this is just a quick fix.
Also, the "minimum resolvable depth difference" used isn't really right as it
should be calculated according to the z values of the current primitive
and not be a constant (of course, this only makes a difference for float
depth buffers), at least for d3d10, so depth biasing is still not quite right.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: remove never reached code for timestamp queries.
Roland Scheidegger [Thu, 27 Jun 2013 16:56:26 +0000 (18:56 +0200)]
llvmpipe: remove never reached code for timestamp queries.

timestamp queries are always binned in an active scene, therefore
always have a result.

11 years agollvmpipe: fix a bug in opaque optimization
Roland Scheidegger [Thu, 27 Jun 2013 16:54:10 +0000 (18:54 +0200)]
llvmpipe: fix a bug in opaque optimization

If there are queries active the opaque optimization reseting the bin needs to
be disabled.
(Not really tested since the bug was discovered by code inspection not
an actual test failure.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoradeonsi/compute: Fix memory leak in radeonsi_launch_grid.
Vinson Lee [Wed, 26 Jun 2013 04:37:07 +0000 (21:37 -0700)]
radeonsi/compute: Fix memory leak in radeonsi_launch_grid.

Fixes "Resource leak" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agoclover: Fix build with LLVM 3.4
Tom Stellard [Thu, 27 Jun 2013 16:41:34 +0000 (09:41 -0700)]
clover: Fix build with LLVM 3.4

Reported on IRC by lordheavy

11 years agodocs: updated instructions for Mesa on Windows
Bill York [Wed, 19 Jun 2013 16:18:00 +0000 (10:18 -0600)]
docs: updated instructions for Mesa on Windows

Signed-off-by: Brian Paul <brianp@vmware.com>
11 years agopostprocess: handle partial intialization failures.
Matthew McClure [Fri, 21 Jun 2013 20:45:55 +0000 (13:45 -0700)]
postprocess: handle partial intialization failures.

This patch fixes segfaults observed when enabling the post processing
features. When the format is not supported, or a texture cannot be
created, the code must gracefully handle failure and report the error to
the calling code for proper failure handling.

To accomplish this the following changes were made to the filters.h
prototypes:

- bool return for pp_init_func
- Added pp_free_func for filter specific resource destruction

Fixes segfaults from backtraces:

* util_destroy_blit
  pp_free

* u_transfer_inline_write_vtbl
  pp_jimenezmlaa_init_run
  pp_init

This patch also uses tgsi_alloc_tokens to allocate temporary tokens in
pp_tgsi_to_state, instead of allocating the array on the stack. This
fixes the following stack corruption segfault in pp_run.c:

* _int_free
  aaline_delete_fs_state
  pp_free

Bug Number: 1021843
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoglx: return True/False instead of GL_TRUE/GL_FALSE
Brian Paul [Wed, 26 Jun 2013 19:42:51 +0000 (13:42 -0600)]
glx: return True/False instead of GL_TRUE/GL_FALSE

Just to be consistent with the functions' Bool return type.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoglx: move declarations before code
Brian Paul [Wed, 26 Jun 2013 19:38:18 +0000 (13:38 -0600)]
glx: move declarations before code

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: move declarations before code
Brian Paul [Wed, 26 Jun 2013 19:36:38 +0000 (13:36 -0600)]
mesa: move declarations before code

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoglsl: Use the C99 variadic macro syntax.
José Fonseca [Thu, 27 Jun 2013 06:41:36 +0000 (07:41 +0100)]
glsl: Use the C99 variadic macro syntax.

MSVC does not support the old GCC syntax.

See also
http://gcc.gnu.org/onlinedocs/gcc/Variadic-Macros.html

11 years agoscons: Add dependencies to all .xml files.
José Fonseca [Thu, 27 Jun 2013 06:25:10 +0000 (07:25 +0100)]
scons: Add dependencies to all .xml files.

Should prevent stuck builds when only some of the included .xml files
change.

11 years agoilo: plug a potential index buffer leak
Chia-I Wu [Thu, 27 Jun 2013 03:44:27 +0000 (11:44 +0800)]
ilo: plug a potential index buffer leak

This is harmless since st_context and u_vbuf both set index buffer to NULL
before destroying themselves.  But we do not want to rely on that behavior.

11 years agosoftpipe: honor predication for clear_render_target and clear_depth_stencil
Roland Scheidegger [Wed, 26 Jun 2013 21:15:15 +0000 (23:15 +0200)]
softpipe: honor predication for clear_render_target and clear_depth_stencil

trivial, copied from llvmpipe

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: add support for nested / overlapping queries
Roland Scheidegger [Wed, 26 Jun 2013 21:11:03 +0000 (23:11 +0200)]
llvmpipe: add support for nested / overlapping queries

OpenGL doesn't support this but d3d10 does.
It is a bit of a pain as it is necessary to keep track of queries
still active at the end of a scene, which is also why I cheat a bit
and limit the amount of simultaneously active queries to (arbitrary)
16 (simplifies things because don't have to deal with a real list
that way). I can't think of a reason why you'd really want large
numbers of overlapping/nested queries so it is hopefully fine.
(This only affects queries which need to be binned.)

v2: don't copy remainder of array when deleting an entry simply replace
the deleted entry with the last one (order doesn't matter).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: rework query logic
Roland Scheidegger [Tue, 25 Jun 2013 21:27:04 +0000 (23:27 +0200)]
llvmpipe: rework query logic

Previously lp_rast_begin_query commands were always inserted into each bin,
and re-issued if the scene was restarted, while lp_rast_end_query commands
were executed for each still active query at the end of tile rasterization.
Also, the ps_invocations and vis_counter were set to zero when the respective
command was encountered.
This however cannot work for multiple queries of the same type (note that
occlusion counter and occlusion predicate while different type were also
affected).
So, change the logic to always set the ps_invocations and vis_counter to zero
at the start of tile rasterization, and then use "start" and "end" per-thread
query values when encountering the begin/end query commands instead, which
should work for multiple queries of the same type. This also means queries do
not have to be reissued in a new scene, however they still need to be finished
at end of tile rasterization, so a list of queries still active at the end of
a scene needs to be maintained.
Also while here don't bin the queries which don't do anything in rasterization.
(This change does not actually handle multiple queries of the same type yet,
as the list of active queries is just a simple fixed array and setup can still
only have one query active per type.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoi965: Move the remaining intel code to the i965 directory.
Eric Anholt [Thu, 20 Jun 2013 23:07:07 +0000 (16:07 -0700)]
i965: Move the remaining intel code to the i965 directory.

Now that i915's forked off, they don't need to live in a shared directory.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chad Versace <chad.versace@linux.intel.com>
Acked-by: Adam Jackson <ajax@redhat.com>
(and I hear second hand that idr is OK with it, too)

11 years agoi915: Fork the shared code from i965.
Eric Anholt [Thu, 20 Jun 2013 17:00:18 +0000 (10:00 -0700)]
i915: Fork the shared code from i965.

Of this 15000 lines of code in intel/, we've identified 4000 lines that
are trivially unnecessary for i915, and another 1000 that are pointless for
i965, and expect to find more as time goes on.  Split the i915 driver off,
so that we can continue active development on i965 without worrying about
breaking i915.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Chad Versace <chad.versace@linux.intel.com>
Acked-by: Adam Jackson <ajax@redhat.com>
(and I hear second hand that idr is OK with it, too)

11 years agoi915: Remove dead symlink.
Eric Anholt [Thu, 20 Jun 2013 16:59:44 +0000 (09:59 -0700)]
i915: Remove dead symlink.

11 years agoglx: Fix another missed glMultiDrawElementsEXT const change.
Eric Anholt [Wed, 26 Jun 2013 19:24:08 +0000 (12:24 -0700)]
glx: Fix another missed glMultiDrawElementsEXT const change.

The build was broken for me since
b7d9478f36bde0f7b27321378c1bb799fdd4eaa1.

11 years agoglsl: Move all var decls to the front of the IR list in reverse order
Ian Romanick [Sat, 8 Jun 2013 00:05:22 +0000 (17:05 -0700)]
glsl: Move all var decls to the front of the IR list in reverse order

This has the (intended!) side effect that vertex shader inputs and
fragment shader outputs will appear in the IR in the same order that
they appeared in the shader code.  This results in the locations being
assigned in the declared order.  Many (arguably buggy) applications
depend on this behavior, and it matches what nearly all other drivers
do.

Fixes the (new) piglit test attrib-assignments.

NOTE: This is a candidate for stable release branches (and requires the
previous commit to prevent a regression in OpenGL ES 2.0 conformance
test stencil_plane_operation).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agoi965: Be more careful with the interleaved user array upload optimization
Ian Romanick [Thu, 20 Jun 2013 12:43:32 +0000 (05:43 -0700)]
i965: Be more careful with the interleaved user array upload optimization

The checks to determine when the data can be uploaded in an interleaved
fashion can be tricked by certain data layouts.  For example,

    float data[...];

    glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 16, &data[0]);
    glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, 16, &data[4]);
    glDrawArrays(GL_POINTS, 0, 1);

will hit the interleaved path with an incorrect size (16 bytes instead
of 32 bytes).  As a result, the data for attribute 1 never gets
uploaded.  The single element draw case is the only sensible case I can
think of for non-interleaved-that-looks-like-interleaved data, but there
may be others as well.

To fix this, make sure that the end of the element in the array being
checked is within the stride "window."  Previously the code would check
that the begining of the element was within the window.

NOTE: This is a candidate for stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: add const qualifier to glMultiDrawElementsEXT() indices param
Brian Paul [Wed, 26 Jun 2013 17:10:48 +0000 (11:10 -0600)]
mesa: add const qualifier to glMultiDrawElementsEXT() indices param

The 20130624 version of glext.h changed this to match the
glMultiDrawElements() function which already had the extra const
qualifier.

Fixes warnings/errors that seem to vary from one compiler to the next.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agomesa: remove const from glDebugMessageCallbackARB() function parameter
Brian Paul [Wed, 26 Jun 2013 17:09:21 +0000 (11:09 -0600)]
mesa: remove const from glDebugMessageCallbackARB() function parameter

The new 20130624 version of glext.h removed the const qualifier on
the 'userParam' parameter.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoi965/vs: Combine code generation's inst->opcode switch statements.
Kenneth Graunke [Thu, 13 Jun 2013 18:23:08 +0000 (11:23 -0700)]
i965/vs: Combine code generation's inst->opcode switch statements.

vec4_visitor::generate_code() switches on vec4_instruction::opcode and
calls into the brw_eu_emit.c layer to generate code for some of them.
It then has a default case which calls generate_vec4_instruction() to
handle the rest...which switches on opcode and handles the rest of the
cases.

The split apparently is that generate_code() handles the actual hardware
opcodes (BRW_OPCODE_*) while generate_vec4_instruction() handles the
virtual opcodes (SHADER_OPCODE_* and VS_OPCODE_*).  But this looks
fairly arbitrary, and it makes more sense to combine the two switches.

This patch moves the cases from generate_code() into the helper function
so that generate_code() isn't as large.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965: Remove broken source type assertions from brw_alu3().
Kenneth Graunke [Thu, 13 Jun 2013 21:55:19 +0000 (14:55 -0700)]
i965: Remove broken source type assertions from brw_alu3().

Commit 526ffdfc033ab01cf133cb7e8290c65d12ccc9be attempted to generalize
the source register type assertions to allow D and UD.  However, the
src1 and src2 assertions actually checked src0.type against D and UD due
to a copy and paste bug.

It also began setting the source and destination register types based on
dest.type, ignoring src0/src1/src2.type completely.  BFE and BFI2 may
actually pass mixed D/UD types and expect them to be ignored, which is
arguably a bit sloppy, but not too crazy either.

This patch simply removes the source register assertions as those values
aren't used anyway.  It also clarifies the comment above the block that
sets the register types.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoi965: Add back strict type assertions for MAD and LRP.
Kenneth Graunke [Thu, 13 Jun 2013 21:55:18 +0000 (14:55 -0700)]
i965: Add back strict type assertions for MAD and LRP.

Commit 526ffdfc033ab01cf133cb7e8290c65d12ccc9be relaxed the type
assertions in brw_alu3 to allow D/UD types (required by BFE and BFI2).
This lost us the strict type checking for MAD and LRP, which require
all four types to be float.

This patch adds a new ALU3F wrapper which checks these once again.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
11 years agoglsl: Streamline the built-in type handling code.
Kenneth Graunke [Tue, 18 Jun 2013 11:22:33 +0000 (04:22 -0700)]
glsl: Streamline the built-in type handling code.

Over the last few years, the compiler has grown to support 7 different
language versions and 6 extensions that add new built-in types.  With
more and more features being added, some of our core code has devolved
into an unmaintainable spaghetti of sorts.

A few problems with the old code:
1. Built-in types are declared...where exactly?

   The types in builtin_types.h were organized in arrays by the language
   version or extension they were introduced in.  It's factored out to
   avoid duplicates---every type only exists in one array.  But that
   means that sampler1D is declared in 110, sampler2D is in core types,
   sampler3D is a unique global not in a list...and so on.

2. Spaghetti call-chains with weird parameters:

   generate_300ES_types calls generate_130_types which calls
   generate_120_types and generate_EXT_texture_array_types, which calls
   generate_110_types, which calls generate_100ES_types...and more

   Except that ES doesn't want 1D types, so we have a skip_1d parameter.
   add_deprecated also falls into this category.

3. Missing type accessors.

   Common types have convenience pointers (like glsl_type::vec4_type),
   but others may not be accessible at all without a symbol table (for
   example, sampler types).

4. Global variable declarations in a header file?

   #include "builtin_types.h" in two C++ files would break the build.

The new code addresses these problems.  All built-in types are declared
together in a single table, independent of when they were introduced.
The macro that declares a new built-in type also creates a convenience
pointer, so every type is available and it won't get out of sync.

The code to populate a symbol table with the appropriate types for a
particular language version and set of extensions is now a single
table-driven function.  The table lists the type name and GL/ES versions
when it was introduced (similar to how the lexer handles reserved
words).  A single loop adds types based on the language version.
Explicit extension checks then add additional types.  If they were
already added based on the language version, glsl_symbol_table simply
ignores the request to add them a second time, meaning we don't need
to worry about duplicates and can simply list types where they belong.

v2: Mark uvecs and shadow samplers as ES3 only, and 1DArrayShadow as
    unsupported in ES entirely.  Add a touch more doxygen.

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