Re: [Mesa-dev] SandyBridge not handling GL_TRIANGLE_STRIP_ADJACENCY with repeating vertex indices correctly

2014-07-29 Thread Iago Toral Quiroga
On mar, 2014-07-29 at 10:16 -0700, Kenneth Graunke wrote:
> On Tuesday, July 29, 2014 10:12:23 AM Iago Toral Quiroga wrote:
> > Hi,
> > 
> > running the piglit tests on my implementation of geometry shaders for
> > Sandy Bridge produces a GPU hang for the following test:
> > 
> > ./glsl-1.50-geometry-primitive-id-restart GL_TRIANGLE_STRIP_ADJACENCY
> > ffs
> > 
> > That test checks primitive restarts but the hang seems to be unrelated
> > to that, since it happens also when primitive restart is not enabled.
> > The problem, which only affects GL_TRIANGLE_STRIP_ADJACENCY and no other
> > primitive type -with our without adjacency-, is in this loop that the
> > test uses to setup the indices for the vertices:
> > 
> > elements = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_READ_WRITE);
> > num_elements = 0;
> > for (i = 1; i <= LONGEST_INPUT_SEQUENCE; i++) {
> >for (j = 0; j < i; j++) {
> >   /* Every element that isn't the primitive
> >* restart index can just be element 0, since
> >* we don't care about the actual vertex data.
> >*/
> >   elements[num_elements++] = 0;
> >}
> >elements[num_elements++] = prim_restart_index;
> > }
> > glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
> > 
> > Setting all elements to the same index (0 in this case) is the one thing
> > that causes the hang for GL_TRIANGLE_STRIP_ADJACENCY. A simple change
> > like this removes the hang:
> > -  elements[num_elements++] = 0;
> > +  elements[num_elements++] = j != prim_restart_index ? j : j + 1;
> > 
> > Skimming through the docs I have not seen any references to this being a
> > known problem. In fact, I don't see any references to
> > GL_TRIANGLE_STRIP_ADJACENCY being special in any way and it seems that
> > this is not a problem in IvyBridge, since the test runs correctly there.
> > 
> > Does this sound like a hardware bug specific to SandyBridge's handling
> > of GL_TRIANGLE_STRIP_ADJACENCY or is there something else I should check
> > before arriving to that conclusion?
> 
> Odd.  It could very well be, but I don't see anything in the documentation, 
> either.  Could you post a branch with your preliminary code?  I'd be happy to 
> look into the hang and see if I come up with any more useful information...

Samuel uploaded a branch to github here:
https://github.com/samuelig/mesa/tree/gs-and-tf-support-snb

Thanks for looking into this!

> > If it is a hardware bug I guess we want a workaround for it , at least
> > to prevent the hang or something but I am not sure what would be the
> > best option here, I think the only option for the driver would be to
> > explore the list of indices provided when this primitive type is used
> > and when we hit this scenario (I'd have to test how many repeating
> > indices we need for it to hang), error out and do not execute the
> > drawing command or something... any other suggestions? 
> > 
> > Iago


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/13] Fix gl_VertexID on i965

2014-07-29 Thread Tapani Pälli
Patches 5..10

Reviewed-by: Tapani Pälli 

Also tested that these fix the new Piglit tests and esconform3 test. I
made a little proposal for patch 10 but not sure if this change would be
worth the trouble.


On 06/21/2014 04:00 AM, Ian Romanick wrote:
> This patch series fixes bugs in the i965 w.r.t. several uses of
> gl_VertexID.  OpenGL (desktop and ES) have the following expectations of
> gl_VertexID:
>
> 1. When used with BaseVertex drawing commands, gl_VertexID will include
> the value of basevertex.  This differens from "the other API," but the
> change in OpenGL was based on feedback from application developers.
> This only affects OpenGL 3.2+.
>
> 2. When used with DrawArrays drawing commands, gl_VertexID will count
> from the 'start' value instead of zero.  This affects OpenGL 3.0+ and
> OpenGL ES 3.0+.
>
> The i965 driver botched both of these for slightly different reasons.
> For #1, our hardware was designed with the "other API's" semantic in
> mind, so gl_VertexID doesn't include the basevertex value.
>
> For #2, we implement DrawArrays with a non-zero start index by
> reprogramming the array base offset.  As a result, gl_VertexID always
> counts from zero.
>
> I suspect other hardware may suffer from one or both of these issues.  I
> have sent tests to the piglit list to reproduce them.
>
> To fix both of these issues, the shader needs to know the basevertex
> value.  A later GL extension, GL_ARB_shader_draw_parameters, adds
> gl_BaseVertex and gl_BaseInstance as built-in variables.  I believe some
> hardware implements these as system values much like gl_VertexID.
>
> I started this series with the assumption that we could have a
> SYSTEM_VALUE_BASE_VERTEX that might come from a uniform.  In the end, I
> couldn't make that work.  I left patch 7 in the series, but we may want
> to remove it.
>
> I added a STATE_BASE_VERTEX uniform instead.
>
> There is now a lowering pass that converts gl_VertexID to
> gl_VertexIDMESA + gl_BaseVertex (backed by a uniform).  Some of these
> names should probably be changed.
>
> I have also contemplated adding an extension that exposes the other
> semantic for gl_VertexID for applications that actually want that.  This
> is primarily things that are porting content (or "bridging" content)
> from the other API.  That, however, can happen later.
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/13] glsl: Add a lowering pass for gl_VertexID

2014-07-29 Thread Tapani Pälli
On 06/21/2014 04:01 AM, Ian Romanick wrote:
> From: Ian Romanick 
>
> Converts gl_VertexID to (gl_VertexIDMESA + gl_BaseVertex). gl_VertexIDMESA
> is backed by SYSTEM_VALUE_VERTEX_ID_ZERO_BASE, and gl_BaseVertex is backed
> by a built-in uniform from {STATE_INTERNAL, STATE_BASE_VERTEX}.
>
> NOTE: The enum has to be declared outside the struct or C++ just cannot
> find the values.  I tried many variations of scope resolution in
> linker.cpp, but could not make it do-the-right-thing.
>
> Signed-off-by: Ian Romanick 
> Cc: "10.2" 
> ---
>  src/glsl/Makefile.sources|   1 +
>  src/glsl/ir_optimization.h   |   2 +
>  src/glsl/linker.cpp  |   7 ++
>  src/glsl/lower_vertex_id.cpp | 152 
> +++
>  src/mesa/main/context.c  |   5 ++
>  src/mesa/main/mtypes.h   |  14 
>  6 files changed, 181 insertions(+)
>  create mode 100644 src/glsl/lower_vertex_id.cpp
>
> diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> index b54eae7..b884d66 100644
> --- a/src/glsl/Makefile.sources
> +++ b/src/glsl/Makefile.sources
> @@ -77,6 +77,7 @@ LIBGLSL_FILES = \
>   $(GLSL_SRCDIR)/lower_vec_index_to_swizzle.cpp \
>   $(GLSL_SRCDIR)/lower_vector.cpp \
>   $(GLSL_SRCDIR)/lower_vector_insert.cpp \
> + $(GLSL_SRCDIR)/lower_vertex_id.cpp \
>   $(GLSL_SRCDIR)/lower_output_reads.cpp \
>   $(GLSL_SRCDIR)/lower_ubo_reference.cpp \
>   $(GLSL_SRCDIR)/opt_algebraic.cpp \
> diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
> index b83c225..2892dc2 100644
> --- a/src/glsl/ir_optimization.h
> +++ b/src/glsl/ir_optimization.h
> @@ -125,6 +125,8 @@ bool optimize_redundant_jumps(exec_list *instructions);
>  bool optimize_split_arrays(exec_list *instructions, bool linked);
>  bool lower_offset_arrays(exec_list *instructions);
>  
> +bool lower_vertex_id(gl_shader *shader);
> +
>  ir_rvalue *
>  compare_index_block(exec_list *instructions, ir_variable *index,
>   unsigned base, unsigned components, void *mem_ctx);
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 813108c..2e9a0b6 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -1623,6 +1623,13 @@ link_intrastage_shaders(void *mem_ctx,
>}
> }
>  
> +   if (ctx->Const.VertexID != gl_VertexID_native) {
> +  /* FINISHME: The other lowering method is not yet implemented.
> +   */
> +  assert(ctx->Const.VertexID == gl_VertexID_using_uniform_gl_BaseVertex);
> +  lower_vertex_id(linked);
> +   }
> +
> /* Make a pass over all variable declarations to ensure that arrays with
>  * unspecified sizes have a size specified.  The size is inferred from the
>  * max_array_access field.
> diff --git a/src/glsl/lower_vertex_id.cpp b/src/glsl/lower_vertex_id.cpp
> new file mode 100644
> index 000..c9cced1
> --- /dev/null
> +++ b/src/glsl/lower_vertex_id.cpp
> @@ -0,0 +1,152 @@
> +/*
> + * Copyright © 2014 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */
> +
> +/**
> + * \file lower_vertex_id.cpp
> + *
> + * There exists hardware, such as i965, that does not implement the OpenGL
> + * semantic for gl_VertexID.  Instead, that hardware does not include the
> + * value of basevertex in the gl_VertexID value.  To implement the OpenGL
> + * semantic, we'll have to convert gl_Vertex_ID to
> + * gl_VertexIDMESA+gl_BaseVertexMESA.
> + */
> +
> +#include "glsl_symbol_table.h"
> +#include "ir_hierarchical_visitor.h"
> +#include "ir.h"
> +#include "ir_builder.h"
> +#include "linker.h"
> +#include "program/prog_statevars.h"
> +
> +namespace {
> +
> +class lower_vertex_id_visitor : public ir_hierarchical_visitor {
> +public:
> +   explicit lower_vertex_id_visitor(ir_function_signature *main_sig,
> +exec_list *ir_list)
> +  : progress(false), VertexID(NULL), gl_

[Mesa-dev] [Bug 81834] TGSI constant buffer overrun causes assertion failure

2014-07-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=81834

--- Comment #5 from Michel Dänzer  ---
(In reply to comment #4)
> Should I create a new bug report?

Yes, please.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] glsl: Add without_array type predicate

2014-07-29 Thread Timothy Arceri
On Tue, 2014-07-29 at 16:14 -0700, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Returns the type without any arrays.
> 
> This will be used in later patches in this series.
> 
> Signed-off-by: Ian Romanick 
> Suggested-by: Timothy Arceri 
> Cc: Timothy Arceri 
> ---
>  src/glsl/glsl_types.h | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
> index 0b63d48..9cd132a 100644
> --- a/src/glsl/glsl_types.h
> +++ b/src/glsl/glsl_types.h
> @@ -465,6 +465,18 @@ struct glsl_type {
> }
>  
> /**
> +* Get the type stripped of any arrays
> +*
> +* \return
> +* Pointer to the type of elements of the first non-array type for array
> +* types, or pointer to itself for non-array types.
> +*/
> +   const glsl_type *without_array() const
> +   {
> +  return this->is_array() ? this->fields.array : this;
> +   }
> +

Sorry I noticed this as I hit send on the last email with my reviewed by
but shouldn't this be:

return this->is_array() ? this->fields.array->without_array() : this;

> +   /**
>  * Return the amount of atomic counter storage required for a type.
>  */
> unsigned atomic_size() const


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] glsl: Use the without_array predicate to simplify some code

2014-07-29 Thread Timothy Arceri
On Tue, 2014-07-29 at 16:15 -0700, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Signed-off-by: Ian Romanick 
> Reviewed-by: Matt Turner  [v1]
> Cc: Timothy Arceri 
> ---
>  src/glsl/ast_to_hir.cpp|  3 +--
>  src/glsl/glsl_types.cpp|  3 +--
>  src/glsl/link_uniforms.cpp | 23 ---
>  src/glsl/link_varyings.cpp |  6 ++
>  4 files changed, 12 insertions(+), 23 deletions(-)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index a15ee9c..844e11c 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -5203,8 +5203,7 @@ ast_process_structure_or_interface_block(exec_list 
> *instructions,
>   "in uniform blocks or structures.");
>   }
>  
> - if (field_type->is_matrix() ||
> - (field_type->is_array() && 
> field_type->fields.array->is_matrix())) {
> + if (field_type->without_array()->is_matrix()) {
>  fields[i].row_major = block_row_major;
>  if (qual->flags.q.row_major)
> fields[i].row_major = true;
> diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
> index f9cd258..737e6dd 100644
> --- a/src/glsl/glsl_types.cpp
> +++ b/src/glsl/glsl_types.cpp
> @@ -872,8 +872,7 @@ glsl_type::std140_size(bool row_major) const
>  * and  rows, the matrix is stored identically to a row of *
>  * row vectors with  components each, according to rule (4).
>  */
> -   if (this->is_matrix() || (this->is_array() &&
> -  this->fields.array->is_matrix())) {
> +   if (this->without_array()->is_matrix()) {
>const struct glsl_type *element_type;
>const struct glsl_type *vec_type;
>unsigned int array_len;
> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
> index 6c73197..7489536 100644
> --- a/src/glsl/link_uniforms.cpp
> +++ b/src/glsl/link_uniforms.cpp
> @@ -59,10 +59,8 @@ values_for_type(const glsl_type *type)
>  void
>  program_resource_visitor::process(const glsl_type *type, const char *name)
>  {
> -   assert(type->is_record()
> -  || (type->is_array() && type->fields.array->is_record())
> -  || type->is_interface()
> -  || (type->is_array() && type->fields.array->is_interface()));
> +   assert(type->without_array()->is_record()
> +  || type->without_array()->is_interface());
>  
> char *name_copy = ralloc_strdup(NULL, name);
> recursion(type, &name_copy, strlen(name), false, NULL);
> @@ -136,7 +134,7 @@ program_resource_visitor::process(ir_variable *var)
> */
>recursion(var->type, &name, strlen(name), false, NULL);
>ralloc_free(name);
> -   } else if (t->is_record() || (t->is_array() && 
> t->fields.array->is_record())) {
> +   } else if (t->without_array()->is_record()) {
>char *name = ralloc_strdup(NULL, var->name);
>recursion(var->type, &name, strlen(name), false, NULL);
>ralloc_free(name);
> @@ -299,10 +297,8 @@ private:
> virtual void visit_field(const glsl_type *type, const char *name,
>  bool row_major)
> {
> -  assert(!type->is_record());
> -  assert(!(type->is_array() && type->fields.array->is_record()));
> -  assert(!type->is_interface());
> -  assert(!(type->is_array() && type->fields.array->is_interface()));
> +  assert(!type->without_array()->is_record());
> +  assert(!type->without_array()->is_interface());
>  
>(void) row_major;
>  
> @@ -514,10 +510,8 @@ private:
> virtual void visit_field(const glsl_type *type, const char *name,
>  bool row_major, const glsl_type *record_type)
> {
> -  assert(!type->is_record());
> -  assert(!(type->is_array() && type->fields.array->is_record()));
> -  assert(!type->is_interface());
> -  assert(!(type->is_array() && type->fields.array->is_interface()));
> +  assert(!type->without_array()->is_record());
> +  assert(!type->without_array()->is_interface());
>  
>(void) row_major;
>  
> @@ -590,8 +584,7 @@ private:
>   this->uniforms[id].array_stride = 0;
>}
>  
> -  if (type->is_matrix() ||
> -  (type->is_array() && type->fields.array->is_matrix())) {
> +  if (type->without_array()->is_matrix()) {
>   this->uniforms[id].matrix_stride = 16;
>   this->uniforms[id].row_major = ubo_row_major;
>} else {
> diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
> index a3fc2ae..1438a4b 100644
> --- a/src/glsl/link_varyings.cpp
> +++ b/src/glsl/link_varyings.cpp
> @@ -1068,10 +1068,8 @@ private:
> virtual void visit_field(const glsl_type *type, const char *name,
>  bool row_major)
> {
> -  assert(!type->is_record());
> -  assert(!(type->is_array() && type->fields.array->is_record()));
> -  assert(!type->is_interface());
> -  assert(!(type->is_array() && type->fields.array->is_interfa

Re: [Mesa-dev] [PATCH v2] glsl: Add without_array type predicate

2014-07-29 Thread Timothy Arceri
On Tue, 2014-07-29 at 16:14 -0700, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Returns the type without any arrays.
> 
> This will be used in later patches in this series.
> 
> Signed-off-by: Ian Romanick 
> Suggested-by: Timothy Arceri 
> Cc: Timothy Arceri 
> ---
>  src/glsl/glsl_types.h | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
> index 0b63d48..9cd132a 100644
> --- a/src/glsl/glsl_types.h
> +++ b/src/glsl/glsl_types.h
> @@ -465,6 +465,18 @@ struct glsl_type {
> }
>  
> /**
> +* Get the type stripped of any arrays
> +*
> +* \return
> +* Pointer to the type of elements of the first non-array type for array
> +* types, or pointer to itself for non-array types.
> +*/
> +   const glsl_type *without_array() const
> +   {
> +  return this->is_array() ? this->fields.array : this;
> +   }
> +
> +   /**
>  * Return the amount of atomic counter storage required for a type.
>  */
> unsigned atomic_size() const


Reviewed-by: Timothy Arceri 


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 19/29] glsl: Don't use strtod_l in Mesa on Android.

2014-07-29 Thread Ian Romanick
I think we should replace all the #ifdef garbage around this with a
HAVE_STRTOD_L macro.  Having lots of platform knowledge sprinkled around
the code is ugly, at best.

Also... doesn't strtof_l (later in strtod.c) need the same treatment?

On 07/29/2014 03:54 PM, Emil Velikov wrote:
> From: "Myles C. Maxfield" 
> 
> Android includes a fix to asm/posix_types.h inside
> /ndk/toolchains/x86-4.7/prebuilt/linux-x86_64/lib/gcc/
> i686-linux-android/4.7/include-fixed/asm/posix_types.h. That
> file #include_next's the real asm/posix_types.h, but then fixes
> (redefines) the __FD_ZERO macro. However, it also #includes
> features.h, which unconditionally defines _GNU_SOURCE.
> src/glsl/strtod.c assumes that if the _GNU_SOURCE macro is defined,
> that it can use locale_t, which isn't available on Android.
> 
> Review URL: https://chromiumcodereview.appspot.com/18594002
> 
> Patch pulled from the chromium project
> https://android.googlesource.com/platform/external/chromium_org/third_party/mesa/src/+/2a3406721cd61852bebd502c7a907cf07b7be731%5E%21
> 
> Cc: "10.1 10.2" 
> ---
>  src/glsl/strtod.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/glsl/strtod.c b/src/glsl/strtod.c
> index 5d4346b..ddc5564 100644
> --- a/src/glsl/strtod.c
> +++ b/src/glsl/strtod.c
> @@ -45,7 +45,7 @@ double
>  glsl_strtod(const char *s, char **end)
>  {
>  #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && 
> \
> -   !defined(__HAIKU__) && !defined(__UCLIBC__)
> +   !defined(__HAIKU__) && !defined(__UCLIBC__) && !defined(ANDROID)
> static locale_t loc = NULL;
> if (!loc) {
>loc = newlocale(LC_CTYPE_MASK, "C", NULL);
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallivm: fix up out-of-bounds level when using conformant out-of-bound behavior

2014-07-29 Thread sroland
From: Roland Scheidegger 

When using (d3d10) conformant out-of-bound behavior for texel fetching
(currently always enabled) the level still needs to be set to a safe value
even though the offset in the end won't get used because the level is used
to look up the mip offset itself and the actual strides, which might otherwise
crash.
For simplicity, we'll use level 0 in this case (this ought to be safe, llvmpipe
does not actually fill in level 0 information if first_level is larger, but
some random strides / offsets shouldn't hurt as ultimately we always use
offset 0 in this case).
Fixes a crash in some in-house test where random huge levels appear in
lp_build_fetch_texel() despite the test always using a fixed 0 for level
actually... But in any case the value comes from the shader and thus can
easily be outside max mip level.

CC: 
---
 src/gallium/auxiliary/gallivm/lp_bld_sample.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index aeecba8..f1bf285 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -927,6 +927,7 @@ lp_build_nearest_mip_level(struct lp_build_sample_context 
*bld,
 
bld->int_coord_bld.type,
 out);
   }
+  level = lp_build_andnot(&bld->int_coord_bld, level, *out_of_bounds);
   *level_out = level;
}
else {
-- 
1.9.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl/glcpp: rename ERROR to ERROR_TOKEN to fix MSVC build

2014-07-29 Thread Kenneth Graunke
On Tuesday, July 29, 2014 05:02:39 PM Brian Paul wrote:
> ERROR is a #define in the MSVC WinGDI.h header file.
> Add the _TOKEN suffix as we do for a few other lexer tokens.

How about ERROR_TOK?  That's what we use in the main compiler.

Either way,
Reviewed-by: Kenneth Graunke 

> ---
>  src/glsl/glcpp/glcpp-lex.l   |2 +-
>  src/glsl/glcpp/glcpp-parse.y |6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
> index 4b9ab23..c126850 100644
> --- a/src/glsl/glcpp/glcpp-lex.l
> +++ b/src/glsl/glcpp/glcpp-lex.l
> @@ -350,7 +350,7 @@ HEXADECIMAL_INTEGER   0[xX][0-9a-fA-F]+[uU]?
>  
>  error.* {
>   BEGIN INITIAL;
> - RETURN_STRING_TOKEN (ERROR);
> + RETURN_STRING_TOKEN (ERROR_TOKEN);
>  }
>  
>   /* After we see a "#define" we enter the  start state
> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
> index bc873cd..4ee4110 100644
> --- a/src/glsl/glcpp/glcpp-parse.y
> +++ b/src/glsl/glcpp/glcpp-parse.y
> @@ -171,11 +171,11 @@ add_builtin_define(glcpp_parser_t *parser, const char 
> *name, int value);
>   /* We use HASH_TOKEN, DEFINE_TOKEN and VERSION_TOKEN (as opposed to
>   * HASH, DEFINE, and VERSION) to avoid conflicts with other symbols,
>   * (such as the  and  start conditions in the lexer). 
> */
> -%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH_TOKEN DEFINE_TOKEN 
> FUNC_IDENTIFIER OBJ_IDENTIFIER ELIF ELSE ENDIF ERROR IF IFDEF IFNDEF LINE 
> PRAGMA UNDEF VERSION_TOKEN GARBAGE IDENTIFIER IF_EXPANDED INTEGER 
> INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE PLUS_PLUS 
> MINUS_MINUS
> +%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH_TOKEN DEFINE_TOKEN 
> FUNC_IDENTIFIER OBJ_IDENTIFIER ELIF ELSE ENDIF ERROR_TOKEN IF IFDEF IFNDEF 
> LINE PRAGMA UNDEF VERSION_TOKEN GARBAGE IDENTIFIER IF_EXPANDED INTEGER 
> INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE PLUS_PLUS 
> MINUS_MINUS
>  %token PASTE
>  %type  INTEGER operator SPACE integer_constant
>  %type  expression
> -%type  IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER 
> ERROR PRAGMA
> +%type  IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER 
> ERROR_TOKEN PRAGMA
>  %type  identifier_list
>  %type  preprocessing_token conditional_token
>  %type  pp_tokens replacement_list text_line conditional_tokens
> @@ -421,7 +421,7 @@ control_line_success:
>  ;
>  
>  control_line_error:
> - HASH_TOKEN ERROR NEWLINE {
> + HASH_TOKEN ERROR_TOKEN NEWLINE {
>   glcpp_error(& @1, parser, "#%s", $2);
>   }
>  |HASH_TOKEN GARBAGE pp_tokens NEWLINE  {
> 


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] glsl: Add without_array type predicate

2014-07-29 Thread Kenneth Graunke
On Tuesday, July 29, 2014 04:14:45 PM Ian Romanick wrote:
> From: Ian Romanick 
> 
> Returns the type without any arrays.
> 
> This will be used in later patches in this series.
> 
> Signed-off-by: Ian Romanick 
> Suggested-by: Timothy Arceri 
> Cc: Timothy Arceri 
> ---
>  src/glsl/glsl_types.h | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
> index 0b63d48..9cd132a 100644
> --- a/src/glsl/glsl_types.h
> +++ b/src/glsl/glsl_types.h
> @@ -465,6 +465,18 @@ struct glsl_type {
> }
>  
> /**
> +* Get the type stripped of any arrays
> +*
> +* \return
> +* Pointer to the type of elements of the first non-array type for array
> +* types, or pointer to itself for non-array types.
> +*/
> +   const glsl_type *without_array() const
> +   {
> +  return this->is_array() ? this->fields.array : this;
> +   }
> +
> +   /**
>  * Return the amount of atomic counter storage required for a type.
>  */
> unsigned atomic_size() const
> 

Reviewed-by: Kenneth Graunke 

signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/3] Some register allocator cleanups and optimizations

2014-07-29 Thread Connor Abbott
On Tue, Jul 29, 2014 at 5:53 PM, Connor Abbott  wrote:
> This patch series contains some improvements to the register allocator
> used by the i965 fs and vec4 backends and r300g. The most important
> patch, and the only one with an intended functional change, is the last
> one. Full shader-db results are reproduced in its commit message, but
> here's the summary:
>
> total instructions in shared programs: 4545447 -> 4545411 (-0.00%)
> instructions in affected programs: 1353 -> 1317 (-2.66%)
> GAINED:124
> LOST:  6
>
> Connor Abbott (3):
>   ra: cleanup the public API
>   ra: make the p, q test more efficient
>   ra: optimistically color only one node at a time
>
>  .../drivers/r300/compiler/radeon_pair_regalloc.c   |   2 +-
>  src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp  |   2 +-
>  .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |   2 +-
>  src/mesa/program/register_allocate.c   | 150 
> -
>  src/mesa/program/register_allocate.h   |   5 +-
>  5 files changed, 62 insertions(+), 99 deletions(-)
>
> --
> 1.9.3
>

Whoops, I forgot to mention... no piglit regressions on my Ivy Bridge.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] ra: cleanup the public API

2014-07-29 Thread Connor Abbott
Previously, there were 3 entrypoints into parts of the actual allocator,
and an API called ra_allocate_no_spills() that called all 3. Nobody
would ever want to call any of the 3 entrypoints by themselves, so
everybody just used ra_allocate_no_spills(). So just make them static
functions, and while we're at it rename ra_allocate_no_spills() to
ra_allocate() since there's no equivalent "with spills," because the
backend is supposed to handle spilling.

Signed-off-by: Connor Abbott 
---
 src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c |  2 +-
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp|  2 +-
 src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp  |  2 +-
 src/mesa/program/register_allocate.c | 12 ++--
 src/mesa/program/register_allocate.h |  5 +
 5 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c 
b/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c
index 1970a34..462adbd 100644
--- a/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c
+++ b/src/gallium/drivers/r300/compiler/radeon_pair_regalloc.c
@@ -617,7 +617,7 @@ static void do_advanced_regalloc(struct regalloc_state * s)
input_node++;
}
 
-   if (!ra_allocate_no_spills(graph)) {
+   if (!ra_allocate(graph)) {
rc_error(s->C, "Ran out of hardware temporaries\n");
return;
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index 3f27364..fa13f0d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -484,7 +484,7 @@ fs_visitor::assign_regs(bool allow_spilling)
   }
}
 
-   if (!ra_allocate_no_spills(g)) {
+   if (!ra_allocate(g)) {
   /* Failed to allocate registers.  Spill a reg, and the caller will
* loop back into here to try again.
*/
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
index 1caf5ab..ddab342 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
@@ -207,7 +207,7 @@ vec4_visitor::reg_allocate()
 
setup_payload_interference(g, first_payload_node, node_count);
 
-   if (!ra_allocate_no_spills(g)) {
+   if (!ra_allocate(g)) {
   /* Failed to allocate registers.  Spill a reg, and the caller will
* loop back into here to try again.
*/
diff --git a/src/mesa/program/register_allocate.c 
b/src/mesa/program/register_allocate.c
index 6fac690..e47a64a 100644
--- a/src/mesa/program/register_allocate.c
+++ b/src/mesa/program/register_allocate.c
@@ -440,7 +440,7 @@ pq_test(struct ra_graph *g, unsigned int n)
  * means that either spilling will be required, or optimistic coloring
  * should be applied.
  */
-bool
+static bool
 ra_simplify(struct ra_graph *g)
 {
bool progress = true;
@@ -477,7 +477,7 @@ ra_simplify(struct ra_graph *g)
  * If all nodes were trivially colorable, then this must succeed.  If
  * not (optimistic coloring), then it may return false;
  */
-bool
+static bool
 ra_select(struct ra_graph *g)
 {
int i;
@@ -530,7 +530,7 @@ ra_select(struct ra_graph *g)
  * locally-colorable and the rest of the register allocation
  * will succeed.
  */
-void
+static void
 ra_optimistic_color(struct ra_graph *g)
 {
unsigned int i;
@@ -547,7 +547,7 @@ ra_optimistic_color(struct ra_graph *g)
 }
 
 bool
-ra_allocate_no_spills(struct ra_graph *g)
+ra_allocate(struct ra_graph *g)
 {
if (!ra_simplify(g)) {
   ra_optimistic_color(g);
@@ -618,11 +618,11 @@ ra_get_best_spill_node(struct ra_graph *g)
 
/* For any registers not in the stack to be colored, consider them for
 * spilling.  This will mostly collect nodes that were being optimistally
-* colored as part of ra_allocate_no_spills() if we didn't successfully
+* colored as part of ra_allocate() if we didn't successfully
 * optimistically color.
 *
 * It also includes nodes not trivially colorable by ra_simplify() if it
-* was used directly instead of as part of ra_allocate_no_spills().
+* was used directly instead of as part of ra_allocate().
 */
for (n = 0; n < g->count; n++) {
   float cost = g->nodes[n].spill_cost;
diff --git a/src/mesa/program/register_allocate.h 
b/src/mesa/program/register_allocate.h
index 337dcf7..bfc9190 100644
--- a/src/mesa/program/register_allocate.h
+++ b/src/mesa/program/register_allocate.h
@@ -66,10 +66,7 @@ void ra_add_node_interference(struct ra_graph *g,
 /** @} */
 
 /** @{ Graph-coloring register allocation */
-bool ra_simplify(struct ra_graph *g);
-void ra_optimistic_color(struct ra_graph *g);
-bool ra_select(struct ra_graph *g);
-bool ra_allocate_no_spills(struct ra_graph *g);
+bool ra_allocate(struct ra_graph *g);
 
 unsigned int ra_get_node_reg(struct ra_

[Mesa-dev] [PATCH 3/3] ra: optimistically color only one node at a time

2014-07-29 Thread Connor Abbott
Before, when we encountered a situation where we had to optimistically
color a node, we would immediately give up and push all the remaining
nodes on the stack in the order of their index - which is a random, and
potentially not optimal, order. Instead, choose one node to
optimistically color in ra_select(), and then once we've optimistically
colored it, keep on going as normal in the hopes that we've opened up
more avenues for the normal select phase to make progress. In cases with
high register pressure, this helps make the order we push things on the
stack much better, and therefore increase the chance that we can allocate
successfully.

Also, consider all the spillable registers as canidates for spilling,
including the ones that were successfully given a color. The old
behavior was incompatible with the new way of doing optimistic coloring,
so while we're modifying this code let's make it do something more
sensible as well.

shader-db results:

helped: shaders/csgo/1376.shader_test SIMD8:  450 -> 445 (-1.11%)
helped: shaders/csgo/1435.shader_test SIMD8:  469 -> 433 (-7.68%)

HURT:   shaders/steam/dungeon-defenders/5008.shader_test SIMD8: 434 -> 439 
(1.15%)

LOST:   shaders/steam/left-4-dead-2/low/2484.shader_test SIMD16
LOST:   shaders/steam/left-4-dead-2/low/831.shader_test SIMD16
LOST:   shaders/steam/left-4-dead-2/medium/2484.shader_test SIMD16
LOST:   shaders/steam/left-4-dead-2/medium/831.shader_test SIMD16
LOST:   shaders/warsow/139.shader_test SIMD16
LOST:   shaders/xcom-enemy-unknown/203.shader_test SIMD16

GAINED: shaders/csgo/1344.shader_test SIMD16
GAINED: shaders/csgo/1370.shader_test SIMD16
GAINED: shaders/csgo/1382.shader_test SIMD16
GAINED: shaders/csgo/1403.shader_test SIMD16
GAINED: shaders/csgo/1430.shader_test SIMD16
GAINED: shaders/csgo/1431.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/1501.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/1548.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/1606.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/1703.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/1853.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/1904.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/1973.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/1985.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/2163.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/2394.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/2432.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/2546.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/2591.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/2725.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/3012.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/3121.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/3292.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/3351.shader_test SIMD16
GAINED: shaders/steam/brutal-legend/4086.shader_test SIMD16
GAINED: shaders/steam/costume-quest/2349.shader_test SIMD16
GAINED: shaders/steam/costume-quest/2358.shader_test SIMD16
GAINED: shaders/steam/costume-quest/2720.shader_test SIMD16
GAINED: shaders/steam/dota-2/8579.shader_test SIMD16
GAINED: shaders/steam/dota-2/973.shader_test SIMD16
GAINED: shaders/steam/dungeon-defenders/5004.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/high/3776.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/high/3791.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/high/3792.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/high/3811.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/high/3812.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/high/3832.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/1012.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/1090.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/1345.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/1445.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/1501.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/1839.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/2084.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/2148.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/2491.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/3669.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/3706.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/low/629.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/medium/1012.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/medium/1090.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/medium/1345.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/medium/1445.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/medium/1501.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/medium/1839.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/medium/2084.shader_test SIMD16
GAINED: shaders/steam/left-4-dead-2/medium/2

[Mesa-dev] [PATCH 2/3] ra: make the p, q test more efficient

2014-07-29 Thread Connor Abbott
We can store the q total that pq_test() would've calculated in the node
itself, updating it when we add a node to the stack. This way, we only
have to walk the adjacency list when we push a node on the stack (i.e.
when the p, q test succeeds) instead of every time we do the p, q test.

No difference in shader-db run times, but I'm keeping this in because
the q total that it calculates will also be used in the next commit.

Signed-off-by: Connor Abbott 
---
 src/mesa/program/register_allocate.c | 35 +++
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/src/mesa/program/register_allocate.c 
b/src/mesa/program/register_allocate.c
index e47a64a..d5732a7 100644
--- a/src/mesa/program/register_allocate.c
+++ b/src/mesa/program/register_allocate.c
@@ -145,6 +145,12 @@ struct ra_node {
 * having to actually modify the adjacency_list.
 */
bool in_stack;
+   
+   /**
+* The q total, as defined in the Runeson/Nyström paper, for all the
+* interfering nodes not in the stack.
+*/
+   unsigned int q_total;
 
/* For an implementation that needs register spilling, this is the
 * approximate cost of spilling this node.
@@ -353,6 +359,12 @@ static void
 ra_add_node_adjacency(struct ra_graph *g, unsigned int n1, unsigned int n2)
 {
BITSET_SET(g->nodes[n1].adjacency, n2);
+   
+   if (n1 != n2) {
+  int n1_class = g->nodes[n1].class;
+  int n2_class = g->nodes[n2].class;
+  g->nodes[n1].q_total += g->regs->classes[n1_class]->q[n2_class];
+   }
 
if (g->nodes[n1].adjacency_count >=
g->nodes[n1].adjacency_list_size) {
@@ -387,6 +399,7 @@ ra_alloc_interference_graph(struct ra_regs *regs, unsigned 
int count)
   g->nodes[i].adjacency_list =
  ralloc_array(g, unsigned int, g->nodes[i].adjacency_list_size);
   g->nodes[i].adjacency_count = 0;
+  g->nodes[i].q_total = 0;
 
   ra_add_node_adjacency(g, i, i);
   g->nodes[i].reg = NO_REG;
@@ -415,20 +428,25 @@ ra_add_node_interference(struct ra_graph *g,
 static bool
 pq_test(struct ra_graph *g, unsigned int n)
 {
-   unsigned int j;
-   unsigned int q = 0;
int n_class = g->nodes[n].class;
+   
+   return g->nodes[n].q_total < g->regs->classes[n_class]->p;
+}
 
-   for (j = 0; j < g->nodes[n].adjacency_count; j++) {
-  unsigned int n2 = g->nodes[n].adjacency_list[j];
+static void
+decrement_q(struct ra_graph *g, unsigned int n)
+{
+   unsigned int i;
+   int n_class = g->nodes[n].class;
+   
+   for (i = 0; i < g->nodes[n].adjacency_count; i++) {
+  unsigned int n2 = g->nodes[n].adjacency_list[i];
   unsigned int n2_class = g->nodes[n2].class;
-
+  
   if (n != n2 && !g->nodes[n2].in_stack) {
-q += g->regs->classes[n_class]->q[n2_class];
+g->nodes[n2].q_total -= g->regs->classes[n2_class]->q[n_class];
   }
}
-
-   return q < g->regs->classes[n_class]->p;
 }
 
 /**
@@ -454,6 +472,7 @@ ra_simplify(struct ra_graph *g)
continue;
 
 if (pq_test(g, i)) {
+   decrement_q(g, i);
g->stack[g->stack_count] = i;
g->stack_count++;
g->nodes[i].in_stack = true;
-- 
1.9.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 0/3] Some register allocator cleanups and optimizations

2014-07-29 Thread Connor Abbott
This patch series contains some improvements to the register allocator
used by the i965 fs and vec4 backends and r300g. The most important
patch, and the only one with an intended functional change, is the last
one. Full shader-db results are reproduced in its commit message, but
here's the summary:

total instructions in shared programs: 4545447 -> 4545411 (-0.00%)
instructions in affected programs: 1353 -> 1317 (-2.66%)
GAINED:124
LOST:  6

Connor Abbott (3):
  ra: cleanup the public API
  ra: make the p, q test more efficient
  ra: optimistically color only one node at a time

 .../drivers/r300/compiler/radeon_pair_regalloc.c   |   2 +-
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp  |   2 +-
 .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |   2 +-
 src/mesa/program/register_allocate.c   | 150 -
 src/mesa/program/register_allocate.h   |   5 +-
 5 files changed, 62 insertions(+), 99 deletions(-)

-- 
1.9.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 21/29] mesa: stop going behind the user's back wrt sse4.1 optimisations

2014-07-29 Thread Matt Turner
On Tue, Jul 29, 2014 at 5:02 PM, Emil Velikov  wrote:
> On 30/07/14 00:24, Matt Turner wrote:
>> On Tue, Jul 29, 2014 at 3:54 PM, Emil Velikov  
>> wrote:
>>> If the user/builder has a setup capable of using sse4.1 it's their
>>> responsibility to enable it.
>>>
>>> Let's unconditionally include main/streaming-load-memcpy.c, as it
>>> already features a ifdef __SSE4_1__ check and add a stub implementation
>>> for people that don't have -msse4.1 enabled at compile-time.
>>>
>>> This resolves undefined references to _mesa_streaming_load_memcpy for
>>> the Android build and compilers not capable of sse4.1 optimizations.
>>>
>>> Note: if your compiler is capable of -msse4.1 and you are interested
>>> in using such optimisations, enable them explicitly.
>>
>> The reason we build this file with -msse4.1 explicitly is because
>> distributions build things for the lowest common denominator but we
>> still want this code to be enabled (via a runtime check for SSE 4.1).
>>
>> If we do this, distributions building with typical CFLAGS won't get
>> this optimization. That's not what we want.
>>
>> What's the problem with the current solution -- that the Android build
>> system doesn't let you build this file with -msse4.1?
>>
> IMHO going behind the back of someone like that and toggling compiler
> optimisations is a slight nuisance, but I would not feel to strong about this
> either way.

This is a really common thing that a lot of projects do. How else can
you offer runtime-enabled fast paths? I don't think you're fully
appreciating the problem.

> The problem:
> Server/buildbot builds without -msse4.1 while the user's machine is capable.
> As such we'll end up calling _mesa_streaming_load_memcpy which is undefined
> and... How about we unconditionally include the file(s) so that the function
> becomes a no-op, rather than blowing up ?

Right, okay. This looks like a problem for autotools builds too, if
your compiler is old enough to not support -msse4.1.

pixman, for instance, uses AC_DEFINE to define macros like
USE_X86_MMX, and then the code that calls the MMX code is wrapped in
an #ifdef USE_X86_MMX. I suppose that's what we should do, and then
wrap the functions in intel_mipmap_tree.c so we can't have undefined
references.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 11/16] glsl: Track matrix layout of structure fields using two bits

2014-07-29 Thread Jordan Justen
On Wed, Jul 23, 2014 at 2:39 PM, Ian Romanick  wrote:
> On 07/21/2014 03:17 PM, Matt Turner wrote:
>> On Mon, Jul 21, 2014 at 2:04 PM, Ian Romanick  wrote:
>>> +enum glsl_matrix_layout {
>>> +   GLSL_MATRIX_LAYOUT_DEFAULT,
>>
>> Does this mean language-default, or does it really means the inherited
>> layout? E.g., for
>>
>> layout(row_major) uniform a {
>>mat4 m;
>> };
>>
>> m's .matrix_layout is GLSL_MATRIX_LAYOUT_DEFAULT, so we look to the
>> outer row_major qualifier on uniform a?
>
> Correct.  If some entity inside a block has GLSL_MATRIX_LAYOUT_DEFAULT
> then it either is not (or cannot contain) a matrix, or its layout is
> inherited from the next outer container.  The interface type itself will
> never have GLSL_MATRIX_LAYOUT_DEFAULT.
>
>> If so, could we name it _INHERITED or something?
>
> That works.  I think I like that better than _NOT_SET.  The layout may
> not be set for the interface type, but it will always have a layout of
> either GLSL_MATRIX_LAYOUT_COLUMN_MAJOR or GLSL_MATRIX_LAYOUT_ROW_MAJOR.

Patch Reviewed-by: Jordan Justen 

_DEFAULT=>_INHERITED seems like a good change to.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 13/15] mesa: Add gles3 error condition for GL_RGBA10_A2 buffer format in glCopyTexImage*()

2014-07-29 Thread Jason Ekstrand
On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Fixes many failures in gles3 Khronos CTS test: packed_pixels
>
> Khronos bug# 9807
> Cc: 
> Signed-off-by: Anuj Phogat 
>
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/teximage.c | 45
> -
>  1 file changed, 28 insertions(+), 17 deletions(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index c926a2f..11b8439 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -3647,24 +3647,35 @@ copyteximage(struct gl_context *ctx, GLuint dims,
>
> rb = _mesa_get_read_renderbuffer_for_format(ctx, internalFormat);
>
> -   /* From Page 139 of OpenGL ES 3.0 spec:
> -*"If internalformat is sized, the internal format of the new texel
> -*array is internalformat, and this is also the new texel array’s
> -*effective internal format. If the component sizes of
> internalformat
> -*do not exactly match the corresponding component sizes of the
> source
> -*buffer’s effective internal format, described below, an
> -*INVALID_OPERATION error is generated. If internalformat is
> unsized,
> -*the internal format of the new texel array is the effective
> internal
> -*format of the source buffer, and this is also the new texel
> array’s
> -*effective internal format.
> +   /* Conversion from GL_RGB10_A2 source buffer format is not allowed in
> +* OpenGL ES 3.0. Khronos bug# 9807.
>  */
>

It may be good to move the comment about RGB10_A2 inside the first two if
statements to keep it closer to the actual check.


> -   if (_mesa_is_gles3(ctx)
> -   && !_mesa_is_enum_format_unsized(internalFormat)
> -   && formats_differ_in_component_sizes (texFormat, rb->Format)) {
> -  _mesa_error(ctx, GL_INVALID_OPERATION,
> -  "glCopyTexImage%uD(componenet size changed in"
> -  " internal format)", dims);
> -  return;
> +   if (_mesa_is_gles3(ctx)) {
> +  if (_mesa_is_enum_format_unsized(internalFormat)) {
> + if (rb->InternalFormat == GL_RGB10_A2) {
> +   _mesa_error(ctx, GL_INVALID_OPERATION,
> +   "glCopyTexImage%uD(Reading from GL_RGB10_A2
> buffer and"
> +   " writing to unsized internal format)", dims);
> +   return;
> + }
> +  }
> +  /* From Page 139 of OpenGL ES 3.0 spec:
> +   *"If internalformat is sized, the internal format of the new
> texel
> +   *array is internalformat, and this is also the new texel
> array’s
> +   *effective internal format. If the component sizes of
> internalformat
> +   *do not exactly match the corresponding component sizes of the
> source
> +   *buffer’s effective internal format, described below, an
> +   *INVALID_OPERATION error is generated. If internalformat is
> unsized,
> +   *the internal format of the new texel array is the effective
> internal
> +   *format of the source buffer, and this is also the new texel
> array’s
> +   *effective internal format.
> +   */
> +  else if (formats_differ_in_component_sizes (texFormat, rb->Format))
> {
> +_mesa_error(ctx, GL_INVALID_OPERATION,
> +"glCopyTexImage%uD(componenet size changed in"
> +" internal format)", dims);
> +return;
> +  }
> }
>
> assert(texFormat != MESA_FORMAT_NONE);
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/15] mesa: Don't allow snorm internal formats in glCopyTexImage*() in GLES3

2014-07-29 Thread Jason Ekstrand
On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Fixes few failures in gles3 Khronos CTS test: packed_pixels
>
> Cc: "10.2" 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/teximage.c | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 03ebbd8..6474dba 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -2667,6 +2667,17 @@ copytexture_error_check( struct gl_context *ctx,
> GLuint dimensions,
>   "glCopyTexImage%dD(srgb usage mismatch)",
> dimensions);
>   return GL_TRUE;
>}
> +
> +  /* Page 139, Table 3.15 of OpenGL ES 3.0 spec does not define
> ReadPixels
> +   * types for SNORM formats. Also, conversion to SNORM formats is not
> +   * allowed by Table 3.2 on Page 110.
> +   */
> +  if(_mesa_is_enum_format_snorm(internalFormat)) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glCopyTexImage%dD(internalFormat=%s)", dimensions,
> + _mesa_lookup_enum_by_nr(internalFormat));
> + return GL_TRUE;
> +  }
>

I think I'm missing something.  How does this not completely prevent the
user from using CopyTexImage on SNORM formats?  Shouldn't they still be
able to do CopyTexImage between two RG8_SNORM textures for instance?


> }
>
> if (!_mesa_source_buffer_exists(ctx, baseFormat)) {
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 15/15] mesa: Add gles3 condition for normalized internal formats in glCopyTexImage*()

2014-07-29 Thread Jason Ekstrand
Looks good to me.

Reviewed-by: Jason Ekstrand 


On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Fixes many failures in gles3 Khronos CTS test: packed_pixels
>
> Cc: 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/teximage.c | 15 +++
>  1 file changed, 15 insertions(+)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 11b8439..a09d994 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -2696,6 +2696,8 @@ copytexture_error_check( struct gl_context *ctx,
> GLuint dimensions,
> if (_mesa_is_color_format(internalFormat)) {
>bool is_int = _mesa_is_enum_format_integer(internalFormat);
>bool is_rbint = _mesa_is_enum_format_integer(rb_internal_format);
> +  bool is_unorm = _mesa_is_enum_format_unorm(internalFormat);
> +  bool is_rbunorm = _mesa_is_enum_format_unorm(rb_internal_format);
>if (is_int || is_rbint) {
>   if (is_int != is_rbint) {
>  _mesa_error(ctx, GL_INVALID_OPERATION,
> @@ -2709,6 +2711,19 @@ copytexture_error_check( struct gl_context *ctx,
> GLuint dimensions,
>  return GL_TRUE;
>   }
>}
> +
> +  /* From page 138 of OpenGL ES 3.0 spec:
> +   *"The error INVALID_OPERATION is generated if floating-point
> RGBA
> +   *data is required; if signed integer RGBA data is required and
> the
> +   *format of the current color buffer is not signed integer; if
> +   *unsigned integer RGBA data is required and the format of the
> +   *current color buffer is not unsigned integer; or if
> fixed-point
> +   *RGBA data is required and the format of the current color
> buffer
> +   *is not fixed-point.
> +   */
> +  if (_mesa_is_gles(ctx) && is_unorm != is_rbunorm)
> +_mesa_error(ctx, GL_INVALID_OPERATION,
> +"glCopyTexImage%dD(unorm vs non-unorm)",
> dimensions);
> }
>
> if (_mesa_is_compressed_format(ctx, internalFormat)) {
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 21/29] mesa: stop going behind the user's back wrt sse4.1 optimisations

2014-07-29 Thread Emil Velikov
On 30/07/14 00:24, Matt Turner wrote:
> On Tue, Jul 29, 2014 at 3:54 PM, Emil Velikov  
> wrote:
>> If the user/builder has a setup capable of using sse4.1 it's their
>> responsibility to enable it.
>>
>> Let's unconditionally include main/streaming-load-memcpy.c, as it
>> already features a ifdef __SSE4_1__ check and add a stub implementation
>> for people that don't have -msse4.1 enabled at compile-time.
>>
>> This resolves undefined references to _mesa_streaming_load_memcpy for
>> the Android build and compilers not capable of sse4.1 optimizations.
>>
>> Note: if your compiler is capable of -msse4.1 and you are interested
>> in using such optimisations, enable them explicitly.
> 
> The reason we build this file with -msse4.1 explicitly is because
> distributions build things for the lowest common denominator but we
> still want this code to be enabled (via a runtime check for SSE 4.1).
> 
> If we do this, distributions building with typical CFLAGS won't get
> this optimization. That's not what we want.
> 
> What's the problem with the current solution -- that the Android build
> system doesn't let you build this file with -msse4.1?
> 
IMHO going behind the back of someone like that and toggling compiler
optimisations is a slight nuisance, but I would not feel to strong about this
either way. I have them enabled all the time :)
That is as long as we fix the issue mentioned below.

The problem:
Server/buildbot builds without -msse4.1 while the user's machine is capable.
As such we'll end up calling _mesa_streaming_load_memcpy which is undefined
and... How about we unconditionally include the file(s) so that the function
becomes a no-op, rather than blowing up ?

-Emil







___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 11/15] mesa: Add a helper function _mesa_is_enum_format_unsized()

2014-07-29 Thread Jason Ekstrand
On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Function is utilized by next patch in the series.
>
> Cc: 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/glformats.c | 18 ++
>  src/mesa/main/glformats.h |  3 +++
>  2 files changed, 21 insertions(+)
>
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 05a3842..b95ecea 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -356,6 +356,24 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum
> type)
>  }
>
>  /**
> + * Test if the given format is an unsized color format.
> + */
> +GLboolean
> +_mesa_is_enum_format_unsized(GLenum format)
> +{
> +   switch (format) {
> +   case GL_RGBA:
> +   case GL_RGB:
> +   case GL_ALPHA:
> +   case GL_LUMINANCE:
> +   case GL_LUMINANCE_ALPHA:
> +  return GL_TRUE;
> +   default:
> +  return GL_FALSE;
>

What about GL_RED, GL_RG, GL_INTENSITY, GL_DEPTH_COMPONENT,
GL_DEPTH_STENICIL, GL_SRGB, and GL_SRGB_ALPHA?  If we're going to add
another metadata function, we should probably at least try to include
these.  Otherwise, someone is liable to make a mistake with it later.


> +   }
> +}
> +
> +/**
>   * Test if the given format is a SNORM (signed-normalized) format.
>   */
>  GLboolean
> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> index d4856e5..b2ef77b 100644
> --- a/src/mesa/main/glformats.h
> +++ b/src/mesa/main/glformats.h
> @@ -60,6 +60,9 @@ extern GLboolean
>  _mesa_is_type_unsigned(GLenum type);
>
>  extern GLboolean
> +_mesa_is_enum_format_unsized(GLenum format);
> +
> +extern GLboolean
>  _mesa_is_enum_format_snorm(GLenum format);
>
>  extern GLboolean
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/15] mesa: Fix condition for using compressed internalformat in glCompressedTexImage3D()

2014-07-29 Thread Jason Ekstrand
Reviewed-by: Jason Ekstrand 


On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Cc: 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/teximage.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index b8627a3..03ebbd8 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -2262,7 +2262,14 @@ compressed_texture_error_check(struct gl_context
> *ctx, GLint dimensions,
>
> if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) {
>reason = "target";
> -  error = GL_INVALID_ENUM;
> +  /* From section 3.8.6, page 146 of OpenGL ES 3.0 spec:
> +   *
> +   *"The ETC2/EAC texture compression algorithm supports only
> +   * two-dimensional images. If internalformat is an ETC2/EAC
> format,
> +   * CompressedTexImage3D will generate an INVALID_OPERATION
> error if
> +   * target is not TEXTURE_2D_ARRAY."
> +   */
> +  error = _mesa_is_desktop_gl(ctx) ? GL_INVALID_ENUM :
> GL_INVALID_OPERATION;
>goto error;
> }
>
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 14/15] mesa: Add utility function _mesa_is_enum_format_unorm()

2014-07-29 Thread Jason Ekstrand
I think you're missing the SRGB and SLUMINANCE formats.  Other than that, I
think that's all of them.


On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Cc: 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/glformats.c | 67
> +++
>  src/mesa/main/glformats.h |  3 +++
>  2 files changed, 70 insertions(+)
>
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index b95ecea..8107757 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -374,6 +374,73 @@ _mesa_is_enum_format_unsized(GLenum format)
>  }
>
>  /**
> + * Test if the given format is a UNORM (unsigned-normalized) format.
> + */
> +GLboolean
> +_mesa_is_enum_format_unorm(GLenum format)
> +{
> +  switch(format) {
> +  case GL_RED:
> +  case GL_GREEN:
> +  case GL_BLUE:
> +  case GL_ALPHA:
> +  case GL_ALPHA4:
> +  case GL_ALPHA8:
> +  case GL_ALPHA12:
> +  case GL_ALPHA16:
> +  case 1:
> +  case GL_LUMINANCE:
> +  case GL_LUMINANCE4:
> +  case GL_LUMINANCE8:
> +  case GL_LUMINANCE12:
> +  case GL_LUMINANCE16:
> +  case 2:
> +  case GL_LUMINANCE_ALPHA:
> +  case GL_LUMINANCE4_ALPHA4:
> +  case GL_LUMINANCE6_ALPHA2:
> +  case GL_LUMINANCE8_ALPHA8:
> +  case GL_LUMINANCE12_ALPHA4:
> +  case GL_LUMINANCE12_ALPHA12:
> +  case GL_LUMINANCE16_ALPHA16:
> +  case GL_INTENSITY:
> +  case GL_INTENSITY4:
> +  case GL_INTENSITY8:
> +  case GL_INTENSITY12:
> +  case GL_INTENSITY16:
> +  case GL_R8:
> +  case GL_R16:
> +  case GL_RG:
> +  case GL_RG8:
> +  case GL_RG16:
> +  case 3:
> +  case GL_RGB:
> +  case GL_BGR:
> +  case GL_R3_G3_B2:
> +  case GL_RGB4:
> +  case GL_RGB5:
> +  case GL_RGB565:
> +  case GL_RGB8:
> +  case GL_RGB10:
> +  case GL_RGB12:
> +  case GL_RGB16:
> +  case 4:
> +  case GL_ABGR_EXT:
> +  case GL_RGBA:
> +  case GL_BGRA:
> +  case GL_RGBA2:
> +  case GL_RGBA4:
> +  case GL_RGB5_A1:
> +  case GL_RGBA8:
> +  case GL_RGB10_A2:
> +  case GL_RGBA12:
> +  case GL_RGBA16:
> + return GL_TRUE;
> +  default:
> + return GL_FALSE;
> +   }
> +}
> +
> +/**
>   * Test if the given format is a SNORM (signed-normalized) format.
>   */
>  GLboolean
> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> index b2ef77b..ce6e438 100644
> --- a/src/mesa/main/glformats.h
> +++ b/src/mesa/main/glformats.h
> @@ -63,6 +63,9 @@ extern GLboolean
>  _mesa_is_enum_format_unsized(GLenum format);
>
>  extern GLboolean
> +_mesa_is_enum_format_unorm(GLenum format);
> +
> +extern GLboolean
>  _mesa_is_enum_format_snorm(GLenum format);
>
>  extern GLboolean
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 09/15] mesa: Add utility function mesa_is_enum_format_snorm()

2014-07-29 Thread Jason Ekstrand
You should fix the commit message to be _mesa_is_enum_format_snorm (you
forgot the beginning underscore).  Other than that, looks good.

Reviewed-by: Jason Ekstrand 


On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Cc: 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/glformats.c | 37 +
>  src/mesa/main/glformats.h |  3 +++
>  2 files changed, 40 insertions(+)
>
> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
> index 9bb341c..05a3842 100644
> --- a/src/mesa/main/glformats.c
> +++ b/src/mesa/main/glformats.c
> @@ -355,6 +355,43 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum
> type)
> }
>  }
>
> +/**
> + * Test if the given format is a SNORM (signed-normalized) format.
> + */
> +GLboolean
> +_mesa_is_enum_format_snorm(GLenum format)
> +{
> +   switch (format) {
> +   /* signed, normalized texture formats */
> +   case GL_RED_SNORM:
> +   case GL_R8_SNORM:
> +   case GL_R16_SNORM:
> +   case GL_RG_SNORM:
> +   case GL_RG8_SNORM:
> +   case GL_RG16_SNORM:
> +   case GL_RGB_SNORM:
> +   case GL_RGB8_SNORM:
> +   case GL_RGB16_SNORM:
> +   case GL_RGBA_SNORM:
> +   case GL_RGBA8_SNORM:
> +   case GL_RGBA16_SNORM:
> +   case GL_ALPHA_SNORM:
> +   case GL_ALPHA8_SNORM:
> +   case GL_ALPHA16_SNORM:
> +   case GL_LUMINANCE_SNORM:
> +   case GL_LUMINANCE8_SNORM:
> +   case GL_LUMINANCE16_SNORM:
> +   case GL_LUMINANCE_ALPHA_SNORM:
> +   case GL_LUMINANCE8_ALPHA8_SNORM:
> +   case GL_LUMINANCE16_ALPHA16_SNORM:
> +   case GL_INTENSITY_SNORM:
> +   case GL_INTENSITY8_SNORM:
> +   case GL_INTENSITY16_SNORM:
> +  return GL_TRUE;
> +   default:
> +  return GL_FALSE;
> +   }
> +}
>
>  /**
>   * Test if the given format is an integer (non-normalized) format.
> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> index 5c3b2e3..d4856e5 100644
> --- a/src/mesa/main/glformats.h
> +++ b/src/mesa/main/glformats.h
> @@ -60,6 +60,9 @@ extern GLboolean
>  _mesa_is_type_unsigned(GLenum type);
>
>  extern GLboolean
> +_mesa_is_enum_format_snorm(GLenum format);
> +
> +extern GLboolean
>  _mesa_is_enum_format_integer(GLenum format);
>
>  extern GLboolean
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/15] mesa: Add error condition for using compressed internalformat in glTexStorage3D()

2014-07-29 Thread Jason Ekstrand
On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Fixes gles3 Khronos CTS test: texture_storage_texture_internal_formats
>
> Cc: 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/texstorage.c | 18 ++
>  1 file changed, 18 insertions(+)
>
> diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
> index 44b5374..897d589 100644
> --- a/src/mesa/main/texstorage.c
> +++ b/src/mesa/main/texstorage.c
> @@ -41,6 +41,7 @@
>  #include "texstorage.h"
>  #include "textureview.h"
>  #include "mtypes.h"
> +#include "glformats.h"
>
>
>
> @@ -301,6 +302,23 @@ tex_storage_error_check(struct gl_context *ctx,
> GLuint dims, GLenum target,
>return GL_TRUE;
> }
>
> +   /* From section 3.8.6, page 146 of OpenGL ES 3.0 spec:
> +*
> +*"The ETC2/EAC texture compression algorithm supports only
> +* two-dimensional images. If internalformat is an ETC2/EAC format,
> +* CompressedTexImage3D will generate an INVALID_OPERATION error if
> +* target is not TEXTURE_2D_ARRAY."
> +*
> +* This should also be applicable for glTexStorage3D().
> +*/
> +   if (_mesa_is_compressed_format(ctx, internalformat)
> +   && !_mesa_target_can_be_compressed(ctx, target, internalformat)) {
> +  _mesa_error(ctx, _mesa_is_desktop_gl(ctx)?
> +  GL_INVALID_ENUM : GL_INVALID_OPERATION,
> +  "glTexStorage3D(internalformat = %s)",
> +  _mesa_lookup_enum_by_nr(internalformat));
> +   }
>

It seems to me as if the mesa_target_can_be_compressed function completely
disallows 3D texture formats, but the spec implies that they are allowed in
some cases.  What's going on here?

--Jason Ekstrand


> +
> /* levels check */
> if (levels < 1) {
>_mesa_error(ctx, GL_INVALID_VALUE, "glTexStorage%uD(levels < 1)",
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/15] mesa: Turn target_can_be_compressed() in to a utility function

2014-07-29 Thread Jason Ekstrand
If we're going to make a utility function declared in glformats.h, let's
move the function body to glformats.c.


On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:

> Cc: 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/main/glformats.h |  3 +++
>  src/mesa/main/teximage.c  | 12 ++--
>  2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> index af10899..5c3b2e3 100644
> --- a/src/mesa/main/glformats.h
> +++ b/src/mesa/main/glformats.h
> @@ -125,6 +125,9 @@ extern GLenum
>  _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
>GLenum internalFormat);
>
> +extern GLboolean
> +_mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum
> target,
> +   GLenum intFormat);
>
>  #ifdef __cplusplus
>  }
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 845ba80..b8627a3 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -1779,9 +1779,9 @@ compressedteximage_only_format(const struct
> gl_context *ctx, GLenum format)
>   * Helper function to determine whether a target and specific compression
>   * format are supported.
>   */
> -static GLboolean
> -target_can_be_compressed(const struct gl_context *ctx, GLenum target,
> - GLenum intFormat)
> +GLboolean
> +_mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum
> target,
> +   GLenum intFormat)
>  {
> (void) intFormat;  /* not used yet */
>
> @@ -2204,7 +2204,7 @@ texture_error_check( struct gl_context *ctx,
>
> /* additional checks for compressed textures */
> if (_mesa_is_compressed_format(ctx, internalFormat)) {
> -  if (!target_can_be_compressed(ctx, target, internalFormat)) {
> +  if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) {
>   _mesa_error(ctx, GL_INVALID_ENUM,
>   "glTexImage%dD(target can't be compressed)",
> dimensions);
>   return GL_TRUE;
> @@ -2260,7 +2260,7 @@ compressed_texture_error_check(struct gl_context
> *ctx, GLint dimensions,
> GLenum error = GL_NO_ERROR;
> char *reason = ""; /* no error */
>
> -   if (!target_can_be_compressed(ctx, target, internalFormat)) {
> +   if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) {
>reason = "target";
>error = GL_INVALID_ENUM;
>goto error;
> @@ -2694,7 +2694,7 @@ copytexture_error_check( struct gl_context *ctx,
> GLuint dimensions,
> }
>
> if (_mesa_is_compressed_format(ctx, internalFormat)) {
> -  if (!target_can_be_compressed(ctx, target, internalFormat)) {
> +  if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) {
>   _mesa_error(ctx, GL_INVALID_ENUM,
>   "glCopyTexImage%dD(target)", dimensions);
>   return GL_TRUE;
> --
> 1.8.3.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 05/15] mesa: Fix error condition for valid texture targets in glTexStorage* functions

2014-07-29 Thread Jordan Justen
On Fri, Jun 6, 2014 at 9:13 PM, Matt Turner  wrote:
> On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat  wrote:
>> Fixes gles3 Khronos CTS test: texture_storage_texture_targets
>>
>> Cc: 
>> Signed-off-by: Anuj Phogat 
>> ---
>>  src/mesa/main/texstorage.c | 7 +++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
>> index 86c8f3c..44b5374 100644
>> --- a/src/mesa/main/texstorage.c
>> +++ b/src/mesa/main/texstorage.c
>> @@ -53,6 +53,13 @@
>>  static GLboolean
>>  legal_texobj_target(struct gl_context *ctx, GLuint dims, GLenum target)
>>  {
>> +   if (_mesa_is_gles3(ctx)
>> +   && target != GL_TEXTURE_2D
>> +   && target != GL_TEXTURE_CUBE_MAP
>> +   && target != GL_TEXTURE_3D
>> +   && target != GL_TEXTURE_2D_ARRAY)

I was hoping to find a concise spec ref. Closest I came up with was:
3.8.7 Texture Parameters: "target is the target, either TEXTURE_2D,
TEXTURE_3D, TEXTURE_2D_ARRAY, or TEXTURE_CUBE_MAP"

But, I think this code maybe applies to other non-TexParameter paths.

> Let's put && on the end of the previous line.

I agree, but with or without that changed:
Reviewed-by: Jordan Justen 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 17/23] i965: Make some brw_sampler_state.c functions static again.

2014-07-29 Thread Kenneth Graunke
Now that gen7_sampler_state.c is gone, everything is once again in a
single file.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c | 4 ++--
 src/mesa/drivers/dri/i965/brw_state.h | 6 --
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 9904718..f48e3c9 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -120,7 +120,7 @@ brw_emit_sampler_state(struct brw_context *brw,
}
 }
 
-uint32_t
+static uint32_t
 translate_wrap_mode(struct brw_context *brw, GLenum wrap, bool using_nearest)
 {
switch( wrap ) {
@@ -163,7 +163,7 @@ translate_wrap_mode(struct brw_context *brw, GLenum wrap, 
bool using_nearest)
 /**
  * Upload SAMPLER_BORDER_COLOR_STATE.
  */
-void
+static void
 upload_default_color(struct brw_context *brw,
  struct gl_sampler_object *sampler,
  int unit,
diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index bf711e3..abead18 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -261,12 +261,6 @@ void brw_emit_sampler_state(struct brw_context *brw,
 unsigned shadow_function,
 bool non_normalized_coordinates,
 uint32_t border_color_offset);
-uint32_t translate_wrap_mode(struct brw_context *brw,
- GLenum wrap, bool using_nearest);
-void upload_default_color(struct brw_context *brw,
- struct gl_sampler_object *sampler,
- int unit,
-  uint32_t *sdc_offset);
 
 /* gen6_sf_state.c */
 void
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 21/23] i965: Replace sizeof(struct gen7_sampler_state) with the size itself.

2014-07-29 Thread Kenneth Graunke
These are the last users of struct gen7_sampler_state.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp| 2 +-
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp  | 2 +-
 src/mesa/drivers/dri/i965/gen8_fs_generator.cpp   | 3 +--
 src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp | 3 +--
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 8e4a31d..9edffe5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -580,7 +580,7 @@ fs_generator::generate_tex(fs_inst *inst, struct brw_reg 
dst, struct brw_reg src
 get_element_ud(header_reg, 3),
 get_element_ud(brw_vec8_grf(0, 0), 3),
 brw_imm_ud(16 * (inst->sampler / 16) *
-   sizeof(gen7_sampler_state)));
+   (4 * sizeof(uint32_t;
  }
  brw_pop_insn_state(p);
   }
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index 5266f81..9c6a22d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -352,7 +352,7 @@ vec4_generator::generate_tex(vec4_instruction *inst,
 get_element_ud(header, 3),
 get_element_ud(brw_vec8_grf(0, 0), 3),
 brw_imm_ud(16 * (inst->sampler / 16) *
-   sizeof(gen7_sampler_state)));
+   (4 * sizeof(uint32_t;
  }
  brw_pop_insn_state(p);
   }
diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
index 4f0cf70..740e3ec 100644
--- a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
@@ -270,8 +270,7 @@ gen8_fs_generator::generate_tex(fs_inst *ir,
  gen8_instruction *add =
 ADD(get_element_ud(src, 3),
 get_element_ud(brw_vec8_grf(0, 0), 3),
-brw_imm_ud(16 * (ir->sampler / 16) *
-   sizeof(gen7_sampler_state)));
+brw_imm_ud(16 * (ir->sampler / 16) * (4 * sizeof(uint32_t;
  gen8_set_mask_control(add, BRW_MASK_DISABLE);
   }
 
diff --git a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp 
b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
index 4f9b2a3..511cab1 100644
--- a/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/gen8_vec4_generator.cpp
@@ -125,8 +125,7 @@ gen8_vec4_generator::generate_tex(vec4_instruction *ir, 
struct brw_reg dst)
  gen8_instruction *add =
 ADD(get_element_ud(brw_message_reg(ir->base_mrf), 3),
 get_element_ud(brw_vec8_grf(0, 0), 3),
-brw_imm_ud(16 * (ir->sampler / 16) *
-   sizeof(gen7_sampler_state)));
+brw_imm_ud(16 * (ir->sampler / 16) * (4 * sizeof(uint32_t;
  gen8_set_mask_control(add, BRW_MASK_DISABLE);
   }
 
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 03/23] i965: Write a better file comment for brw_sampler_state.c.

2014-07-29 Thread Kenneth Graunke
The old one has been inaccurate for years.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 8a4bfea..12aea39 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -29,6 +29,12 @@
   *   Keith Whitwell 
   */
 
+/**
+ * @file brw_sampler_state.c
+ *
+ * This file contains code for emitting SAMPLER_STATE structures, which
+ * specifies filter modes, wrap modes, border color, and so on.
+ */
 
 #include "brw_context.h"
 #include "brw_state.h"
@@ -38,13 +44,6 @@
 #include "main/macros.h"
 #include "main/samplerobj.h"
 
-
-/* Samplers aren't strictly wm state from the hardware's perspective,
- * but that is the only situation in which we use them in this driver.
- */
-
-
-
 uint32_t
 translate_wrap_mode(struct brw_context *brw, GLenum wrap, bool using_nearest)
 {
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 04/23] i965: Drop the degenerate brw_sampler_default_color structure.

2014-07-29 Thread Kenneth Graunke
It's just an array of four floats, and we have an array of four floats,
so this is literally just a memcpy...but with custom structs and strange
macros to give the appearance of doing something more.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c |  9 +++--
 src/mesa/drivers/dri/i965/brw_state_dump.c| 11 +--
 src/mesa/drivers/dri/i965/brw_structs.h   |  4 
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 12aea39..6343ceb 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -197,12 +197,9 @@ upload_default_color(struct brw_context *brw,
   sdc->f[2] = color[2];
   sdc->f[3] = color[3];
} else {
-  struct brw_sampler_default_color *sdc;
-
-  sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR,
-   sizeof(*sdc), 32, sdc_offset);
-
-  COPY_4V(sdc->color, color);
+  float *sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR,
+  4 * 4, 32, sdc_offset);
+  memcpy(sdc, color, 4 * 4);
}
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c 
b/src/mesa/drivers/dri/i965/brw_state_dump.c
index f0f185b..9d83859 100644
--- a/src/mesa/drivers/dri/i965/brw_state_dump.c
+++ b/src/mesa/drivers/dri/i965/brw_state_dump.c
@@ -243,12 +243,11 @@ dump_sdc(struct brw_context *brw, uint32_t offset)
   batch_out(brw, name, offset, 10, "s16 ba\n");
   batch_out(brw, name, offset, 11, "s8 rgba\n");
} else {
-  struct brw_sampler_default_color *sdc = (brw->batch.bo->virtual +
-  offset);
-  batch_out(brw, name, offset, 0, "r %f\n", sdc->color[0]);
-  batch_out(brw, name, offset, 1, "g %f\n", sdc->color[1]);
-  batch_out(brw, name, offset, 2, "b %f\n", sdc->color[2]);
-  batch_out(brw, name, offset, 3, "a %f\n", sdc->color[3]);
+  float *sdc = brw->batch.bo->virtual + offset;
+  batch_out(brw, name, offset, 0, "r %f\n", sdc[0]);
+  batch_out(brw, name, offset, 1, "g %f\n", sdc[1]);
+  batch_out(brw, name, offset, 2, "b %f\n", sdc[2]);
+  batch_out(brw, name, offset, 3, "a %f\n", sdc[3]);
}
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_structs.h 
b/src/mesa/drivers/dri/i965/brw_structs.h
index 620962e..9408ba2 100644
--- a/src/mesa/drivers/dri/i965/brw_structs.h
+++ b/src/mesa/drivers/dri/i965/brw_structs.h
@@ -589,10 +589,6 @@ struct brw_wm_unit_state
} wm10;
 };
 
-struct brw_sampler_default_color {
-   float color[4];
-};
-
 struct gen5_sampler_default_color {
uint8_t ub[4];
float f[4];
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 02/23] i965: Rename brw_wm_sampler_state.c to brw_sampler_state.c.

2014-07-29 Thread Kenneth Graunke
When the driver was originally written, it only supported texturing in
the pixel shader backend; vertex and geometry shader texturing came much
later.  Originally, the pixel shader was referred to as "WM" (the
Windowizer/Masker unit).  So, this code happened to only be relevant for
the WM stage, at the time.

However, sampler state really applies to all stages, so putting "wm" in
the filename doesn't make sense.  I dropped it in gen7_sampler_state.c;
at this point the asymmetry just trips people up.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/Makefile.sources   |   2 +-
 src/mesa/drivers/dri/i965/brw_sampler_state.c| 479 +++
 src/mesa/drivers/dri/i965/brw_state.h|   2 +-
 src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 479 ---
 4 files changed, 481 insertions(+), 481 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/brw_sampler_state.c
 delete mode 100644 src/mesa/drivers/dri/i965/brw_wm_sampler_state.c

I cut out the 'git mv' from the diff so the email wouldn't be so huge.

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
b/src/mesa/drivers/dri/i965/Makefile.sources
index e235679..d2ff804 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -86,6 +86,7 @@ i965_FILES = \
brw_primitive_restart.c \
brw_queryobj.c \
brw_reset.c \
+   brw_sampler_state.c \
brw_schedule_instructions.cpp \
brw_sf.c \
brw_sf_emit.c \
@@ -116,7 +117,6 @@ i965_FILES = \
brw_vs_surface_state.c \
brw_wm.c \
brw_wm_iz.cpp \
-   brw_wm_sampler_state.c \
brw_wm_state.c \
brw_wm_surface_state.c \
gen6_blorp.cpp \
diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index 6f1db6c..77de785 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -242,7 +242,7 @@ void gen7_upload_3dstate_so_decl_list(struct brw_context 
*brw,
 /* gen8_surface_state.c */
 void gen8_init_vtable_surface_functions(struct brw_context *brw);
 
-/* brw_wm_sampler_state.c */
+/* brw_sampler_state.c */
 uint32_t translate_wrap_mode(struct brw_context *brw,
  GLenum wrap, bool using_nearest);
 void upload_default_color(struct brw_context *brw,
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/23] i965/blorp: Don't set min_mag_neq bit in Gen6 SAMPLER_STATE.

2014-07-29 Thread Kenneth Graunke
The "Min/Mag State Not Equal" bit is supposed to be set when the min/mag
filters or address rounding modes differ.  BLORP uses identical min/mag
settings, so the bit should be unset.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/gen6_blorp.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index eb865b9..d419886 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -465,8 +465,6 @@ gen6_blorp_emit_sampler_state(struct brw_context *brw,
sampler->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
 
-   sampler->ss0.min_mag_neq = 1;
-
/* Set LOD bias:
 */
sampler->ss0.lod_bias = 0;
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 07/23] i965: Push computation for sampler state batch offsets up a level.

2014-07-29 Thread Kenneth Graunke
Other than this, brw_update_sampler_state only deals with a single
SAMPLER_STATE structure, and doesn't need to know which position it is
in the table.  The caller takes care of dealing with multiple surface
states.

Pushing this up a level allows us to drop the ss_index parameter.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 8933672..587da1a 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -207,11 +207,11 @@ upload_default_color(struct brw_context *brw,
  * Sets the sampler state for a single unit based off of the sampler key
  * entry.
  */
-static void brw_update_sampler_state(struct brw_context *brw,
-int unit,
- int ss_index,
- struct brw_sampler_state *sampler,
- uint32_t sampler_state_table_offset)
+static void
+brw_update_sampler_state(struct brw_context *brw,
+ int unit,
+ struct brw_sampler_state *sampler,
+ uint32_t batch_offset_for_sampler_state)
 {
struct gl_context *ctx = &brw->ctx;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -357,8 +357,7 @@ static void brw_update_sampler_state(struct brw_context 
*brw,
  (brw->batch.bo->offset64 + sdc_offset) >> 5;
 
   drm_intel_bo_emit_reloc(brw->batch.bo,
- sampler_state_table_offset +
- ss_index * sizeof(struct brw_sampler_state) +
+ batch_offset_for_sampler_state +
  offsetof(struct brw_sampler_state, ss2),
  brw->batch.bo, sdc_offset,
  I915_GEM_DOMAIN_SAMPLER, 0);
@@ -397,9 +396,12 @@ brw_upload_sampler_state_table(struct brw_context *brw,
for (unsigned s = 0; s < sampler_count; s++) {
   if (SamplersUsed & (1 << s)) {
  const unsigned unit = prog->SamplerUnits[s];
- if (ctx->Texture.Unit[unit]._Current)
-brw_update_sampler_state(brw, unit, s, &samplers[s],
- stage_state->sampler_offset);
+ if (ctx->Texture.Unit[unit]._Current) {
+uint32_t batch_offset_for_sampler_state =
+   stage_state->sampler_offset + s * sizeof(*samplers);
+brw_update_sampler_state(brw, unit, &samplers[s],
+ batch_offset_for_sampler_state);
+ }
   }
}
 
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] i965 sampler state cleanups

2014-07-29 Thread Kenneth Graunke
A while back, I wrote a patch to skip border color upload, and got
annoyed by having to write it twice - once for the Gen4-6 code, and
once for Gen7+.  So I decided to clean that up.

23 patches and a bug fix later, I've unified the code, deleting
gen7_sampler_state.c entirely.  There's now one copy of the logic to
upload sampler state tables, and one copy of the logic that decides
what values to program.  Packet assembly now uses bitshifts instead
of structures, which is more consistent with the surface state code.

Tested with Piglit on Crestline, Sandybridge, and Haswell: no regressions.
The series is available as the 'sampler-cleanups' branch of my tree.

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 18/23] i965: Delete redundant sampler state dumping code.

2014-07-29 Thread Kenneth Graunke
Although the Gen4-6 and Gen7+ variants used different structure types,
they didn't use any of the fields - only the size, which is identical.
So both decoders did exactly the same thing.

Someday we should implement useful decoders for SAMPLER_STATE.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_state_dump.c | 39 --
 1 file changed, 5 insertions(+), 34 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c 
b/src/mesa/drivers/dri/i965/brw_state_dump.c
index 9d83859..611998f 100644
--- a/src/mesa/drivers/dri/i965/brw_state_dump.c
+++ b/src/mesa/drivers/dri/i965/brw_state_dump.c
@@ -255,33 +255,9 @@ static void dump_sampler_state(struct brw_context *brw,
   uint32_t offset, uint32_t size)
 {
int i;
-   struct brw_sampler_state *samp = brw->batch.bo->virtual + offset;
+   uint32_t *samp = brw->batch.bo->virtual + offset;
 
-   assert(brw->gen < 7);
-
-   for (i = 0; i < size / sizeof(*samp); i++) {
-  char name[20];
-
-  sprintf(name, "WM SAMP%d", i);
-  batch_out(brw, name, offset, 0, "filtering\n");
-  batch_out(brw, name, offset, 1, "wrapping, lod\n");
-  batch_out(brw, name, offset, 2, "default color pointer\n");
-  batch_out(brw, name, offset, 3, "chroma key, aniso\n");
-
-  samp++;
-  offset += sizeof(*samp);
-   }
-}
-
-static void dump_gen7_sampler_state(struct brw_context *brw,
-   uint32_t offset, uint32_t size)
-{
-   struct gen7_sampler_state *samp = brw->batch.bo->virtual + offset;
-   int i;
-
-   assert(brw->gen >= 7);
-
-   for (i = 0; i < size / sizeof(*samp); i++) {
+   for (i = 0; i < size / 16; i++) {
   char name[20];
 
   sprintf(name, "WM SAMP%d", i);
@@ -290,12 +266,11 @@ static void dump_gen7_sampler_state(struct brw_context 
*brw,
   batch_out(brw, name, offset, 2, "default color pointer\n");
   batch_out(brw, name, offset, 3, "chroma key, aniso\n");
 
-  samp++;
-  offset += sizeof(*samp);
+  samp += 4;
+  offset += 4 * sizeof(uint32_t);
}
 }
 
-
 static void dump_sf_viewport_state(struct brw_context *brw,
   uint32_t offset)
 {
@@ -590,11 +565,7 @@ dump_state_batch(struct brw_context *brw)
 }
 break;
   case AUB_TRACE_SAMPLER_STATE:
-if (brw->gen < 7) {
-   dump_sampler_state(brw, offset, size);
-} else {
-   dump_gen7_sampler_state(brw, offset, size);
-}
+ dump_sampler_state(brw, offset, size);
 break;
   case AUB_TRACE_SAMPLER_DEFAULT_COLOR:
 dump_sdc(brw, offset);
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 19/23] i965: Make BLORP use brw_emit_sampler_state().

2014-07-29 Thread Kenneth Graunke
This simplifies the code, removes use of the old structures, and also
allows us to combine the Gen6 and Gen7+ code.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_blorp.h|  4 ++
 src/mesa/drivers/dri/i965/gen6_blorp.cpp | 65 ++--
 src/mesa/drivers/dri/i965/gen7_blorp.cpp | 59 +
 3 files changed, 33 insertions(+), 95 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h 
b/src/mesa/drivers/dri/i965/brw_blorp.h
index 683f09e..419744f 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -420,6 +420,10 @@ gen6_blorp_emit_clip_disable(struct brw_context *brw,
 void
 gen6_blorp_emit_drawing_rectangle(struct brw_context *brw,
   const brw_blorp_params *params);
+
+uint32_t
+gen6_blorp_emit_sampler_state(struct brw_context *brw,
+  const brw_blorp_params *params);
 /** \} */
 
 #endif /* __cplusplus */
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index d419886..1cab8b7 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -445,53 +445,44 @@ gen6_blorp_emit_binding_table(struct brw_context *brw,
 /**
  * SAMPLER_STATE.  See brw_update_sampler_state().
  */
-static uint32_t
+uint32_t
 gen6_blorp_emit_sampler_state(struct brw_context *brw,
   const brw_blorp_params *params)
 {
uint32_t sampler_offset;
+   uint32_t *sampler_state = (uint32_t *)
+  brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE, 16, 32, &sampler_offset);
 
-   struct brw_sampler_state *sampler = (struct brw_sampler_state *)
-  brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE,
-  sizeof(struct brw_sampler_state),
-  32, &sampler_offset);
-   memset(sampler, 0, sizeof(*sampler));
-
-   sampler->ss0.min_filter = BRW_MAPFILTER_LINEAR;
-   sampler->ss0.mip_filter = BRW_MIPFILTER_NONE;
-   sampler->ss0.mag_filter = BRW_MAPFILTER_LINEAR;
-
-   sampler->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
-   sampler->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
-   sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
-
-   /* Set LOD bias:
-*/
-   sampler->ss0.lod_bias = 0;
+   unsigned address_rounding = BRW_ADDRESS_ROUNDING_ENABLE_U_MIN |
+   BRW_ADDRESS_ROUNDING_ENABLE_V_MIN |
+   BRW_ADDRESS_ROUNDING_ENABLE_R_MIN |
+   BRW_ADDRESS_ROUNDING_ENABLE_U_MAG |
+   BRW_ADDRESS_ROUNDING_ENABLE_V_MAG |
+   BRW_ADDRESS_ROUNDING_ENABLE_R_MAG;
 
-   sampler->ss0.lod_preclamp = 1; /* OpenGL mode */
-   sampler->ss0.default_color_mode = 0; /* OpenGL/DX10 mode */
-
-   /* Set BaseMipLevel, MaxLOD, MinLOD:
-*
-* XXX: I don't think that using firstLevel, lastLevel works,
+   /* XXX: I don't think that using firstLevel, lastLevel works,
 * because we always setup the surface state as if firstLevel ==
 * level zero.  Probably have to subtract firstLevel from each of
 * these:
 */
-   sampler->ss0.base_level = U_FIXED(0, 1);
-
-   sampler->ss1.max_lod = U_FIXED(0, 6);
-   sampler->ss1.min_lod = U_FIXED(0, 6);
-
-   sampler->ss3.non_normalized_coord = 1;
-
-   sampler->ss3.address_round |= BRW_ADDRESS_ROUNDING_ENABLE_U_MIN |
-  BRW_ADDRESS_ROUNDING_ENABLE_V_MIN |
-  BRW_ADDRESS_ROUNDING_ENABLE_R_MIN;
-   sampler->ss3.address_round |= BRW_ADDRESS_ROUNDING_ENABLE_U_MAG |
-  BRW_ADDRESS_ROUNDING_ENABLE_V_MAG |
-  BRW_ADDRESS_ROUNDING_ENABLE_R_MAG;
+   brw_emit_sampler_state(brw,
+  sampler_state,
+  sampler_offset,
+  BRW_MAPFILTER_LINEAR, /* min filter */
+  BRW_MAPFILTER_LINEAR, /* mag filter */
+  BRW_MIPFILTER_NONE,
+  BRW_ANISORATIO_2,
+  address_rounding,
+  BRW_TEXCOORDMODE_CLAMP,
+  BRW_TEXCOORDMODE_CLAMP,
+  BRW_TEXCOORDMODE_CLAMP,
+  0, /* min LOD */
+  0, /* max LOD */
+  0, /* LOD bias */
+  0, /* base miplevel */
+  0, /* shadow function */
+  true, /* non-normalized coordinates */
+  0); /* border color offset - unused */
 
return sampler_offset;
 }
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 0ad570b..1cf55fd 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -223,63 +223,6 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,
 }
 
 
-/**
- * SAMPLER_STATE.  See gen7_update_sampler_state().
- */
-static uint32_t
-g

[Mesa-dev] [PATCH 13/23] i965: Introduce a function to emit a SAMPLER_STATE structure.

2014-07-29 Thread Kenneth Graunke
This simply assembles all the SAMPLER_STATE fields into their proper bit
locations.  Making it work on all generations was easy enough; some of
the fields are even in the same place.

Not used by anything yet, but will be soon.  I made it non-static so
BLORP can use it too.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c | 75 +++
 src/mesa/drivers/dri/i965/brw_state.h | 18 +++
 2 files changed, 93 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 1bc8922..c631b76 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -45,6 +45,81 @@
 #include "main/macros.h"
 #include "main/samplerobj.h"
 
+/**
+ * Emit a SAMPLER_STATE structure, given all the fields.
+ */
+void
+brw_emit_sampler_state(struct brw_context *brw,
+   uint32_t *ss,
+   uint32_t batch_offset_for_sampler_state,
+   unsigned min_filter,
+   unsigned mag_filter,
+   unsigned mip_filter,
+   unsigned max_anisotropy,
+   unsigned address_rounding,
+   unsigned wrap_s,
+   unsigned wrap_t,
+   unsigned wrap_r,
+   unsigned min_lod,
+   unsigned max_lod,
+   int lod_bias,
+   unsigned base_level,
+   unsigned shadow_function,
+   bool non_normalized_coordinates,
+   uint32_t border_color_offset)
+{
+   ss[0] = BRW_SAMPLER_LOD_PRECLAMP_ENABLE |
+   SET_FIELD(base_level, BRW_SAMPLER_BASE_MIPLEVEL) |
+   SET_FIELD(mip_filter, BRW_SAMPLER_MIP_FILTER) |
+   SET_FIELD(mag_filter, BRW_SAMPLER_MAG_FILTER) |
+   SET_FIELD(min_filter, BRW_SAMPLER_MIN_FILTER);
+
+   ss[2] = border_color_offset;
+   if (brw->gen < 6) {
+  ss[2] += brw->batch.bo->offset64; /* reloc */
+  drm_intel_bo_emit_reloc(brw->batch.bo,
+  batch_offset_for_sampler_state + 8,
+  brw->batch.bo, border_color_offset,
+  I915_GEM_DOMAIN_SAMPLER, 0);
+   }
+
+   ss[3] = SET_FIELD(max_anisotropy, BRW_SAMPLER_MAX_ANISOTROPY) |
+   SET_FIELD(address_rounding, BRW_SAMPLER_ADDRESS_ROUNDING);
+
+   if (brw->gen >= 7) {
+  ss[0] |= SET_FIELD(lod_bias & 0x1fff, GEN7_SAMPLER_LOD_BIAS);
+
+  if (min_filter == BRW_MAPFILTER_ANISOTROPIC)
+ ss[0] |= GEN7_SAMPLER_EWA_ANISOTROPIC_ALGORIHTM;
+
+  ss[1] = SET_FIELD(min_lod, GEN7_SAMPLER_MIN_LOD) |
+  SET_FIELD(max_lod, GEN7_SAMPLER_MAX_LOD) |
+  SET_FIELD(shadow_function, GEN7_SAMPLER_SHADOW_FUNCTION);
+
+  ss[3] |= SET_FIELD(wrap_s, BRW_SAMPLER_TCX_WRAP_MODE) |
+   SET_FIELD(wrap_t, BRW_SAMPLER_TCY_WRAP_MODE) |
+   SET_FIELD(wrap_r, BRW_SAMPLER_TCZ_WRAP_MODE);
+
+  if (non_normalized_coordinates)
+ ss[3] |= GEN7_SAMPLER_NON_NORMALIZED_COORDINATES;
+   } else {
+  ss[0] |= SET_FIELD(lod_bias & 0x7ff, GEN4_SAMPLER_LOD_BIAS) |
+   SET_FIELD(shadow_function, GEN4_SAMPLER_SHADOW_FUNCTION);
+
+  if (brw->gen == 6 && min_filter != mag_filter)
+ ss[0] |= GEN6_SAMPLER_MIN_MAG_NOT_EQUAL;
+
+  ss[1] = SET_FIELD(min_lod, GEN4_SAMPLER_MIN_LOD) |
+  SET_FIELD(max_lod, GEN4_SAMPLER_MAX_LOD) |
+  SET_FIELD(wrap_s, BRW_SAMPLER_TCX_WRAP_MODE) |
+  SET_FIELD(wrap_t, BRW_SAMPLER_TCY_WRAP_MODE) |
+  SET_FIELD(wrap_r, BRW_SAMPLER_TCZ_WRAP_MODE);
+
+  if (brw->gen >= 6 && non_normalized_coordinates)
+ ss[3] |= GEN6_SAMPLER_NON_NORMALIZED_COORDINATES;
+   }
+}
+
 uint32_t
 translate_wrap_mode(struct brw_context *brw, GLenum wrap, bool using_nearest)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index 0fda360..f875dba 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -243,6 +243,24 @@ void gen7_upload_3dstate_so_decl_list(struct brw_context 
*brw,
 void gen8_init_vtable_surface_functions(struct brw_context *brw);
 
 /* brw_sampler_state.c */
+void brw_emit_sampler_state(struct brw_context *brw,
+uint32_t *sampler_state,
+uint32_t batch_offset_for_sampler_state,
+unsigned min_filter,
+unsigned mag_filter,
+unsigned mip_filter,
+unsigned max_anisotropy,
+unsigned address_rounding,
+unsigned wrap_s,
+unsigned wrap_t,
+unsigned wrap_r,
+unsigned min_lod

[Mesa-dev] [PATCH 23/23] i965: Skip uploading border color when unnecessary.

2014-07-29 Thread Kenneth Graunke
The border color is only needed when using the GL_CLAMP_TO_BORDER or
(deprecated) GL_CLAMP wrap modes; all others ignore it, including the
common GL_CLAMP_TO_EDGE and GL_REPEAT wrap modes.

In those cases, we can skip uploading it entirely, saving a bit of space
in the batchbuffer.  Instead, we just point it at the start of the
batch (offset 0); we have to program something, and that address is safe
to read.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c | 22 --
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index f48e3c9..ad9a527 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -161,6 +161,16 @@ translate_wrap_mode(struct brw_context *brw, GLenum wrap, 
bool using_nearest)
 }
 
 /**
+ * Return true if the given wrap mode requires the border color to exist.
+ */
+static bool
+wrap_mode_needs_border_color(unsigned wrap_mode)
+{
+   return wrap_mode == BRW_TEXCOORDMODE_CLAMP_BORDER ||
+  wrap_mode == GEN8_TEXCOORDMODE_HALF_BORDER;
+}
+
+/**
  * Upload SAMPLER_BORDER_COLOR_STATE.
  */
 static void
@@ -410,8 +420,16 @@ brw_update_sampler_state(struct brw_context *brw,
   lod_bits);
base_level = U_FIXED(0, 1);
 
-   uint32_t border_color_offset;
-   upload_default_color(brw, sampler, unit, &border_color_offset);
+   /* Upload the border color if necessary.  If not, just point it at
+* offset 0 (the start of the batch) - the color should be ignored,
+* but that address won't fault in case something reads it anyway.
+*/
+   uint32_t border_color_offset = 0;
+   if (wrap_mode_needs_border_color(wrap_s) ||
+   wrap_mode_needs_border_color(wrap_t) ||
+   wrap_mode_needs_border_color(wrap_r)) {
+  upload_default_color(brw, sampler, unit, &border_color_offset);
+   }
 
brw_emit_sampler_state(brw,
   sampler_state,
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 12/23] i965: Add #defines for SAMPLER_STATE fields.

2014-07-29 Thread Kenneth Graunke
We'll use these to replace the existing structures.

I've adopted the convention that "BRW" applies to all hardware, and
"GENX" applies starting with generation X, but might be replaced by some
later generation.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_defines.h | 54 +
 1 file changed, 54 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index c0dfe4f..3564041 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -610,6 +610,60 @@
 #define HSW_SCS_BLUE 6
 #define HSW_SCS_ALPHA7
 
+/* SAMPLER_STATE DW0 */
+#define BRW_SAMPLER_DISABLE (1 << 31)
+#define BRW_SAMPLER_LOD_PRECLAMP_ENABLE (1 << 28)
+#define GEN6_SAMPLER_MIN_MAG_NOT_EQUAL  (1 << 27) /* Gen6 only */
+#define BRW_SAMPLER_BASE_MIPLEVEL_MASK  INTEL_MASK(26, 22)
+#define BRW_SAMPLER_BASE_MIPLEVEL_SHIFT 22
+#define BRW_SAMPLER_MIP_FILTER_MASK INTEL_MASK(21, 20)
+#define BRW_SAMPLER_MIP_FILTER_SHIFT20
+#define BRW_SAMPLER_MAG_FILTER_MASK INTEL_MASK(19, 17)
+#define BRW_SAMPLER_MAG_FILTER_SHIFT17
+#define BRW_SAMPLER_MIN_FILTER_MASK INTEL_MASK(16, 14)
+#define BRW_SAMPLER_MIN_FILTER_SHIFT14
+#define GEN4_SAMPLER_LOD_BIAS_MASK  INTEL_MASK(13, 3)
+#define GEN4_SAMPLER_LOD_BIAS_SHIFT 3
+#define GEN4_SAMPLER_SHADOW_FUNCTION_MASK   INTEL_MASK(2, 0)
+#define GEN4_SAMPLER_SHADOW_FUNCTION_SHIFT  0
+
+#define GEN7_SAMPLER_LOD_BIAS_MASK  INTEL_MASK(13, 1)
+#define GEN7_SAMPLER_LOD_BIAS_SHIFT 1
+#define GEN7_SAMPLER_EWA_ANISOTROPIC_ALGORIHTM  (1 << 0)
+
+/* SAMPLER_STATE DW1 */
+#define GEN4_SAMPLER_MIN_LOD_MASK   INTEL_MASK(31, 22)
+#define GEN4_SAMPLER_MIN_LOD_SHIFT  22
+#define GEN4_SAMPLER_MAX_LOD_MASK   INTEL_MASK(21, 12)
+#define GEN4_SAMPLER_MAX_LOD_SHIFT  12
+#define GEN4_SAMPLER_CUBE_CONTROL_OVERRIDE  (1 << 9)
+/* Wrap modes are in DW1 on Gen4-6 and DW3 on Gen7+ */
+#define BRW_SAMPLER_TCX_WRAP_MODE_MASK  INTEL_MASK(8, 6)
+#define BRW_SAMPLER_TCX_WRAP_MODE_SHIFT 6
+#define BRW_SAMPLER_TCY_WRAP_MODE_MASK  INTEL_MASK(5, 3)
+#define BRW_SAMPLER_TCY_WRAP_MODE_SHIFT 3
+#define BRW_SAMPLER_TCZ_WRAP_MODE_MASK  INTEL_MASK(2, 0)
+#define BRW_SAMPLER_TCZ_WRAP_MODE_SHIFT 0
+
+#define GEN7_SAMPLER_MIN_LOD_MASK   INTEL_MASK(31, 20)
+#define GEN7_SAMPLER_MIN_LOD_SHIFT  20
+#define GEN7_SAMPLER_MAX_LOD_MASK   INTEL_MASK(19, 8)
+#define GEN7_SAMPLER_MAX_LOD_SHIFT  8
+#define GEN7_SAMPLER_SHADOW_FUNCTION_MASK   INTEL_MASK(3, 1)
+#define GEN7_SAMPLER_SHADOW_FUNCTION_SHIFT  1
+#define GEN7_SAMPLER_CUBE_CONTROL_OVERRIDE  (1 << 0)
+
+/* SAMPLER_STATE DW2 - border color pointer */
+
+/* SAMPLER_STATE DW3 */
+#define BRW_SAMPLER_MAX_ANISOTROPY_MASK INTEL_MASK(21, 19)
+#define BRW_SAMPLER_MAX_ANISOTROPY_SHIFT19
+#define BRW_SAMPLER_ADDRESS_ROUNDING_MASK   INTEL_MASK(18, 13)
+#define BRW_SAMPLER_ADDRESS_ROUNDING_SHIFT  13
+#define GEN7_SAMPLER_NON_NORMALIZED_COORDINATES (1 << 10)
+/* Gen7+ wrap modes reuse the same BRW_SAMPLER_TC*_WRAP_MODE enums. */
+#define GEN6_SAMPLER_NON_NORMALIZED_COORDINATES (1 << 0)
+
 enum brw_wrap_mode {
BRW_TEXCOORDMODE_WRAP = 0,
BRW_TEXCOORDMODE_MIRROR   = 1,
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 20/23] i965: Drop sizeof(struct brw_sampler_state) from estimated prim size.

2014-07-29 Thread Kenneth Graunke
This is the last user of the structure.  Hardcoding 16 is poor style,
but this code is already a senseless mess, so it's not that much worse.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_draw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index ac21656..16f6f6a 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -444,9 +444,8 @@ static bool brw_try_draw_prims( struct gl_context *ctx,
   int estimated_max_prim_size;
 
   estimated_max_prim_size = 512; /* batchbuffer commands */
-  estimated_max_prim_size += (BRW_MAX_TEX_UNIT *
- (sizeof(struct brw_sampler_state) +
-  sizeof(struct gen5_sampler_default_color)));
+  estimated_max_prim_size +=
+ (BRW_MAX_TEX_UNIT * (16 + sizeof(struct gen5_sampler_default_color)));
   estimated_max_prim_size += 1024; /* gen6 VS push constants */
   estimated_max_prim_size += 1024; /* gen6 WM push constants */
   estimated_max_prim_size += 512; /* misc. pad */
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 08/23] i965: Shift brw_upload_sampler_state_table away from structures.

2014-07-29 Thread Kenneth Graunke
The Gen4-6 and Gen7+ code is virtually identical, but both use different
structure types.  Switching to use a uint32_t pointer and operate on the
number of DWords will make it possible to share code.

It turns out that SURFACE_STATE is the same number of DWords on every
platform currently; it will be easy to handle a change there, though.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c | 23 +++
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 587da1a..a14b5b3 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -380,7 +380,6 @@ brw_upload_sampler_state_table(struct brw_context *brw,
struct brw_stage_state *stage_state)
 {
struct gl_context *ctx = &brw->ctx;
-   struct brw_sampler_state *samplers;
uint32_t sampler_count = stage_state->sampler_count;
 
GLbitfield SamplersUsed = prog->SamplersUsed;
@@ -388,21 +387,29 @@ brw_upload_sampler_state_table(struct brw_context *brw,
if (sampler_count == 0)
   return;
 
-   samplers = brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE,
- sampler_count * sizeof(*samplers),
- 32, &stage_state->sampler_offset);
-   memset(samplers, 0, sampler_count * sizeof(*samplers));
+   /* SAMPLER_STATE is 4 DWords on all platforms. */
+   const int dwords = 4;
+   const int size_in_bytes = dwords * sizeof(uint32_t);
+
+   uint32_t *sampler_state = brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE,
+ sampler_count * size_in_bytes,
+ 32, &stage_state->sampler_offset);
+   memset(sampler_state, 0, sampler_count * size_in_bytes);
+
+   uint32_t batch_offset_for_sampler_state = stage_state->sampler_offset;
 
for (unsigned s = 0; s < sampler_count; s++) {
   if (SamplersUsed & (1 << s)) {
  const unsigned unit = prog->SamplerUnits[s];
  if (ctx->Texture.Unit[unit]._Current) {
-uint32_t batch_offset_for_sampler_state =
-   stage_state->sampler_offset + s * sizeof(*samplers);
-brw_update_sampler_state(brw, unit, &samplers[s],
+brw_update_sampler_state(brw, unit,
+ (struct brw_sampler_state *) 
sampler_state,
  batch_offset_for_sampler_state);
  }
   }
+
+  sampler_state += dwords;
+  batch_offset_for_sampler_state += size_in_bytes;
}
 
brw->state.dirty.cache |= CACHE_NEW_SAMPLER;
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 10/23] i965: Delete gen7_upload_sampler_state_table and vtable mechanism.

2014-07-29 Thread Kenneth Graunke
brw_upload_sampler_state_table now handles all generations, so we don't
need the vtable mechanism either.

There's still a lot of code duplication; the next patches will address
that.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_context.c|  3 --
 src/mesa/drivers/dri/i965/brw_context.h|  5 ---
 src/mesa/drivers/dri/i965/brw_sampler_state.c  | 13 ++-
 src/mesa/drivers/dri/i965/brw_state.h  |  2 --
 src/mesa/drivers/dri/i965/gen7_sampler_state.c | 50 --
 5 files changed, 3 insertions(+), 70 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index c47ad36..89f5df5 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -639,15 +639,12 @@ brwCreateContext(gl_api api,
brw->wm.base.stage = MESA_SHADER_FRAGMENT;
if (brw->gen >= 8) {
   gen8_init_vtable_surface_functions(brw);
-  gen7_init_vtable_sampler_functions(brw);
   brw->vtbl.emit_depth_stencil_hiz = gen8_emit_depth_stencil_hiz;
} else if (brw->gen >= 7) {
   gen7_init_vtable_surface_functions(brw);
-  gen7_init_vtable_sampler_functions(brw);
   brw->vtbl.emit_depth_stencil_hiz = gen7_emit_depth_stencil_hiz;
} else {
   gen4_init_vtable_surface_functions(brw);
-  gen4_init_vtable_sampler_functions(brw);
   brw->vtbl.emit_depth_stencil_hiz = brw_emit_depth_stencil_hiz;
}
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index f730cff..1bbcf46 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -929,11 +929,6 @@ struct brw_context
 unsigned mocs,
 bool rw);
 
-  /** Upload a SAMPLER_STATE table. */
-  void (*upload_sampler_state_table)(struct brw_context *brw,
- struct gl_program *prog,
- struct brw_stage_state *stage_state);
-
   /**
* Send the appropriate state packets to configure depth, stencil, and
* HiZ buffers (i965+ only)
diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index dc351bd..1bc8922 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -451,7 +451,7 @@ brw_upload_fs_samplers(struct brw_context *brw)
 {
/* BRW_NEW_FRAGMENT_PROGRAM */
struct gl_program *fs = (struct gl_program *) brw->fragment_program;
-   brw->vtbl.upload_sampler_state_table(brw, fs, &brw->wm.base);
+   brw_upload_sampler_state_table(brw, fs, &brw->wm.base);
 }
 
 const struct brw_tracked_state brw_fs_samplers = {
@@ -469,7 +469,7 @@ brw_upload_vs_samplers(struct brw_context *brw)
 {
/* BRW_NEW_VERTEX_PROGRAM */
struct gl_program *vs = (struct gl_program *) brw->vertex_program;
-   brw->vtbl.upload_sampler_state_table(brw, vs, &brw->vs.base);
+   brw_upload_sampler_state_table(brw, vs, &brw->vs.base);
 }
 
 
@@ -492,7 +492,7 @@ brw_upload_gs_samplers(struct brw_context *brw)
if (!gs)
   return;
 
-   brw->vtbl.upload_sampler_state_table(brw, gs, &brw->gs.base);
+   brw_upload_sampler_state_table(brw, gs, &brw->gs.base);
 }
 
 
@@ -505,10 +505,3 @@ const struct brw_tracked_state brw_gs_samplers = {
},
.emit = brw_upload_gs_samplers,
 };
-
-
-void
-gen4_init_vtable_sampler_functions(struct brw_context *brw)
-{
-   brw->vtbl.upload_sampler_state_table = brw_upload_sampler_state_table;
-}
diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index 64652cb..0fda360 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -249,13 +249,11 @@ void upload_default_color(struct brw_context *brw,
  struct gl_sampler_object *sampler,
  int unit,
   uint32_t *sdc_offset);
-void gen4_init_vtable_sampler_functions(struct brw_context *brw);
 
 /* gen7_sampler_state.c */
 void gen7_update_sampler_state(struct brw_context *brw,
int unit,
struct gen7_sampler_state *sampler_state);
-void gen7_init_vtable_sampler_functions(struct brw_context *brw);
 
 /* gen6_sf_state.c */
 void
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c 
b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index 66af26a..276c2b9 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -177,53 +177,3 @@ gen7_update_sampler_state(struct brw_context *brw, int 
unit,
 BRW_ADDRESS_ROUNDING_ENABLE_V_MAG |
 BRW_ADDRESS_ROUNDING_ENABLE_R_MAG;
 }
-
-
-static void
-gen7_upload_sampler_state_table(struct brw_context *brw,
- 

[Mesa-dev] [PATCH 22/23] i965: Delete sampler state structures.

2014-07-29 Thread Kenneth Graunke
We've moved to using bitshifts (like we did for surface state); nothing
uses the structures anymore.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_structs.h | 99 -
 1 file changed, 99 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_structs.h 
b/src/mesa/drivers/dri/i965/brw_structs.h
index 9408ba2..7c97a95 100644
--- a/src/mesa/drivers/dri/i965/brw_structs.h
+++ b/src/mesa/drivers/dri/i965/brw_structs.h
@@ -598,105 +598,6 @@ struct gen5_sampler_default_color {
uint8_t b[4];
 };
 
-struct brw_sampler_state
-{
-
-   struct
-   {
-  unsigned shadow_function:3;
-  unsigned lod_bias:11;
-  unsigned min_filter:3;
-  unsigned mag_filter:3;
-  unsigned mip_filter:2;
-  unsigned base_level:5;
-  unsigned min_mag_neq:1;
-  unsigned lod_preclamp:1;
-  unsigned default_color_mode:1;
-  unsigned pad0:1;
-  unsigned disable:1;
-   } ss0;
-
-   struct
-   {
-  unsigned r_wrap_mode:3;
-  unsigned t_wrap_mode:3;
-  unsigned s_wrap_mode:3;
-  unsigned cube_control_mode:1;
-  unsigned pad:2;
-  unsigned max_lod:10;
-  unsigned min_lod:10;
-   } ss1;
-
-
-   struct
-   {
-  unsigned pad:5;
-  unsigned default_color_pointer:27;
-   } ss2;
-
-   struct
-   {
-  unsigned non_normalized_coord:1;
-  unsigned pad:12;
-  unsigned address_round:6;
-  unsigned max_aniso:3;
-  unsigned chroma_key_mode:1;
-  unsigned chroma_key_index:2;
-  unsigned chroma_key_enable:1;
-  unsigned monochrome_filter_width:3;
-  unsigned monochrome_filter_height:3;
-   } ss3;
-};
-
-struct gen7_sampler_state
-{
-   struct
-   {
-  unsigned aniso_algorithm:1;
-  unsigned lod_bias:13;
-  unsigned min_filter:3;
-  unsigned mag_filter:3;
-  unsigned mip_filter:2;
-  unsigned base_level:5;
-  unsigned pad1:1;
-  unsigned lod_preclamp:1;
-  unsigned default_color_mode:1;
-  unsigned pad0:1;
-  unsigned disable:1;
-   } ss0;
-
-   struct
-   {
-  unsigned cube_control_mode:1;
-  unsigned shadow_function:3;
-  unsigned pad:4;
-  unsigned max_lod:12;
-  unsigned min_lod:12;
-   } ss1;
-
-   struct
-   {
-  unsigned pad:5;
-  unsigned default_color_pointer:27;
-   } ss2;
-
-   struct
-   {
-  unsigned r_wrap_mode:3;
-  unsigned t_wrap_mode:3;
-  unsigned s_wrap_mode:3;
-  unsigned pad:1;
-  unsigned non_normalized_coord:1;
-  unsigned trilinear_quality:2;
-  unsigned address_round:6;
-  unsigned max_aniso:3;
-  unsigned chroma_key_mode:1;
-  unsigned chroma_key_index:2;
-  unsigned chroma_key_enable:1;
-  unsigned pad0:6;
-   } ss3;
-};
-
 struct brw_clipper_viewport
 {
float xmin;
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 16/23] i965: Stop using gen7_update_sampler_state; rm gen7_sampler_state.c.

2014-07-29 Thread Kenneth Graunke
The code in brw_sampler_state.c now handles all generations; we don't
need the extra Gen7+ only code anymore.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/Makefile.sources |   1 -
 src/mesa/drivers/dri/i965/brw_sampler_state.c  |  11 +-
 src/mesa/drivers/dri/i965/brw_state.h  |   5 -
 src/mesa/drivers/dri/i965/gen7_sampler_state.c | 179 -
 4 files changed, 2 insertions(+), 194 deletions(-)
 delete mode 100644 src/mesa/drivers/dri/i965/gen7_sampler_state.c

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
b/src/mesa/drivers/dri/i965/Makefile.sources
index d2ff804..ee28dd9 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -138,7 +138,6 @@ i965_FILES = \
gen7_disable.c \
 gen7_gs_state.c \
gen7_misc_state.c \
-   gen7_sampler_state.c \
gen7_sf_state.c \
gen7_sol_state.c \
gen7_urb.c \
diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index d811cf5..9904718 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -455,15 +455,8 @@ brw_upload_sampler_state_table(struct brw_context *brw,
   if (SamplersUsed & (1 << s)) {
  const unsigned unit = prog->SamplerUnits[s];
  if (ctx->Texture.Unit[unit]._Current) {
-if (brw->gen >= 7) {
-   gen7_update_sampler_state(brw, unit,
- (struct gen7_sampler_state *)
- sampler_state);
-} else {
-   brw_update_sampler_state(brw, unit,
-sampler_state,
-batch_offset_for_sampler_state);
-}
+brw_update_sampler_state(brw, unit, sampler_state,
+ batch_offset_for_sampler_state);
  }
   }
 
diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index f875dba..bf711e3 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -268,11 +268,6 @@ void upload_default_color(struct brw_context *brw,
  int unit,
   uint32_t *sdc_offset);
 
-/* gen7_sampler_state.c */
-void gen7_update_sampler_state(struct brw_context *brw,
-   int unit,
-   struct gen7_sampler_state *sampler_state);
-
 /* gen6_sf_state.c */
 void
 calculate_attr_overrides(const struct brw_context *brw,
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c 
b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
deleted file mode 100644
index 276c2b9..000
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright © 2011 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include "brw_context.h"
-#include "brw_state.h"
-#include "brw_defines.h"
-#include "intel_batchbuffer.h"
-#include "intel_mipmap_tree.h"
-
-#include "main/macros.h"
-#include "main/samplerobj.h"
-
-/**
- * Sets the sampler state for a single unit.
- */
-void
-gen7_update_sampler_state(struct brw_context *brw, int unit,
- struct gen7_sampler_state *sampler)
-{
-   struct gl_context *ctx = &brw->ctx;
-   struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-   struct gl_texture_object *texObj = texUnit->_Current;
-   struct gl_sampler_object *gl_sampler = _mesa_get_samplerobj(ctx, unit);
-   bool using_nearest = false;
-
-   /* These don't use samplers at all. */
-   if (texObj->Target == GL_TEXTURE_BUFFER)
-  return;
-
-   switch (gl_sampler->MinFilter) {
-   case GL_NEAREST:
-  sampler->ss0.min_filter = BRW_MAPFILTER_NEAREST;
-  sampler-

[Mesa-dev] [PATCH 11/23] i965: Convert wrap mode #defines to an enum.

2014-07-29 Thread Kenneth Graunke
This makes it easy to tell that they're grouped together, and also
improves gdb printing.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_defines.h | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
b/src/mesa/drivers/dri/i965/brw_defines.h
index 8b73c5c..c0dfe4f 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -610,13 +610,15 @@
 #define HSW_SCS_BLUE 6
 #define HSW_SCS_ALPHA7
 
-#define BRW_TEXCOORDMODE_WRAP0
-#define BRW_TEXCOORDMODE_MIRROR  1
-#define BRW_TEXCOORDMODE_CLAMP   2
-#define BRW_TEXCOORDMODE_CUBE3
-#define BRW_TEXCOORDMODE_CLAMP_BORDER4
-#define BRW_TEXCOORDMODE_MIRROR_ONCE 5
-#define GEN8_TEXCOORDMODE_HALF_BORDER6
+enum brw_wrap_mode {
+   BRW_TEXCOORDMODE_WRAP = 0,
+   BRW_TEXCOORDMODE_MIRROR   = 1,
+   BRW_TEXCOORDMODE_CLAMP= 2,
+   BRW_TEXCOORDMODE_CUBE = 3,
+   BRW_TEXCOORDMODE_CLAMP_BORDER = 4,
+   BRW_TEXCOORDMODE_MIRROR_ONCE  = 5,
+   GEN8_TEXCOORDMODE_HALF_BORDER = 6,
+};
 
 #define BRW_THREAD_PRIORITY_NORMAL   0
 #define BRW_THREAD_PRIORITY_HIGH 1
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 06/23] i965: Drop unused 'ss_index' parameter from gen7_update_sampler_state.

2014-07-29 Thread Kenneth Graunke
This was copied from the Gen4-6 code, but is unused.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/gen7_sampler_state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c 
b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index 77a74e1..b6d45cc 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -34,7 +34,7 @@
  * Sets the sampler state for a single unit.
  */
 static void
-gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
+gen7_update_sampler_state(struct brw_context *brw, int unit,
  struct gen7_sampler_state *sampler)
 {
struct gl_context *ctx = &brw->ctx;
@@ -207,7 +207,7 @@ gen7_upload_sampler_state_table(struct brw_context *brw,
   if (SamplersUsed & (1 << s)) {
  const unsigned unit = prog->SamplerUnits[s];
  if (ctx->Texture.Unit[unit]._Current)
-gen7_update_sampler_state(brw, unit, s, &samplers[s]);
+gen7_update_sampler_state(brw, unit, &samplers[s]);
   }
}
 
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 05/23] i965: Stop storing sdc_offset in brw_stage_state.

2014-07-29 Thread Kenneth Graunke
sdc_offset is produced and consumed in the same function, so there's no
need to store it in the context, nor pass pointers to it through various
call chains.

Saves 128 bytes per brw_stage_state structure, and makes the code
clearer as well.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_context.h|  3 ---
 src/mesa/drivers/dri/i965/brw_sampler_state.c  | 17 -
 src/mesa/drivers/dri/i965/gen7_sampler_state.c | 11 +--
 3 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 2943a20..f730cff 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -890,9 +890,6 @@ struct brw_stage_state
/** SAMPLER_STATE count and table offset */
uint32_t sampler_count;
uint32_t sampler_offset;
-
-   /** Offsets in the batch to sampler default colors (texture border color) */
-   uint32_t sdc_offset[BRW_MAX_TEX_UNIT];
 };
 
 
diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 6343ceb..8933672 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -211,8 +211,7 @@ static void brw_update_sampler_state(struct brw_context 
*brw,
 int unit,
  int ss_index,
  struct brw_sampler_state *sampler,
- uint32_t sampler_state_table_offset,
- uint32_t *sdc_offset)
+ uint32_t sampler_state_table_offset)
 {
struct gl_context *ctx = &brw->ctx;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -347,20 +346,21 @@ static void brw_update_sampler_state(struct brw_context 
*brw,
   sampler->ss3.non_normalized_coord = 1;
}
 
-   upload_default_color(brw, gl_sampler, unit, sdc_offset);
+   uint32_t sdc_offset;
+   upload_default_color(brw, gl_sampler, unit, &sdc_offset);
 
if (brw->gen >= 6) {
-  sampler->ss2.default_color_pointer = *sdc_offset >> 5;
+  sampler->ss2.default_color_pointer = sdc_offset >> 5;
} else {
   /* reloc */
-  sampler->ss2.default_color_pointer = (brw->batch.bo->offset64 +
-   *sdc_offset) >> 5;
+  sampler->ss2.default_color_pointer =
+ (brw->batch.bo->offset64 + sdc_offset) >> 5;
 
   drm_intel_bo_emit_reloc(brw->batch.bo,
  sampler_state_table_offset +
  ss_index * sizeof(struct brw_sampler_state) +
  offsetof(struct brw_sampler_state, ss2),
- brw->batch.bo, *sdc_offset,
+ brw->batch.bo, sdc_offset,
  I915_GEM_DOMAIN_SAMPLER, 0);
}
 
@@ -399,8 +399,7 @@ brw_upload_sampler_state_table(struct brw_context *brw,
  const unsigned unit = prog->SamplerUnits[s];
  if (ctx->Texture.Unit[unit]._Current)
 brw_update_sampler_state(brw, unit, s, &samplers[s],
- stage_state->sampler_offset,
- &stage_state->sdc_offset[s]);
+ stage_state->sampler_offset);
   }
}
 
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c 
b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index 219a174..77a74e1 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -35,8 +35,7 @@
  */
 static void
 gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
- struct gen7_sampler_state *sampler,
-  uint32_t *sdc_offset)
+ struct gen7_sampler_state *sampler)
 {
struct gl_context *ctx = &brw->ctx;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -164,9 +163,10 @@ gen7_update_sampler_state(struct brw_context *brw, int 
unit, int ss_index,
   sampler->ss3.non_normalized_coord = 1;
}
 
-   upload_default_color(brw, gl_sampler, unit, sdc_offset);
+   uint32_t sdc_offset;
+   upload_default_color(brw, gl_sampler, unit, &sdc_offset);
 
-   sampler->ss2.default_color_pointer = *sdc_offset >> 5;
+   sampler->ss2.default_color_pointer = sdc_offset >> 5;
 
if (sampler->ss0.min_filter != BRW_MAPFILTER_NEAREST)
   sampler->ss3.address_round |= BRW_ADDRESS_ROUNDING_ENABLE_U_MIN |
@@ -207,8 +207,7 @@ gen7_upload_sampler_state_table(struct brw_context *brw,
   if (SamplersUsed & (1 << s)) {
  const unsigned unit = prog->SamplerUnits[s];
  if (ctx->Texture.Unit[unit]._Current)
-gen7_update_sampler_state(brw, unit, s, &samplers[s],
-  &stage_state->sdc_offset[s]);
+g

[Mesa-dev] [PATCH 14/23] i965: Make brw_update_sampler_state() use brw_emit_sampler_state().

2014-07-29 Thread Kenneth Graunke
Instead of stuffing bits directly into the brw_sampler_state structure,
we now store them in local variables, then use brw_emit_sampler_state()
to assemble the packet.  This separates the decision about what values
to use from the actual packet emission, which makes the code more
reusable across generations.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c | 206 +++---
 1 file changed, 90 insertions(+), 116 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index c631b76..ae4694b 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -286,100 +286,107 @@ upload_default_color(struct brw_context *brw,
 static void
 brw_update_sampler_state(struct brw_context *brw,
  int unit,
- struct brw_sampler_state *sampler,
+ uint32_t *sampler_state,
  uint32_t batch_offset_for_sampler_state)
 {
struct gl_context *ctx = &brw->ctx;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
struct gl_texture_object *texObj = texUnit->_Current;
-   struct gl_sampler_object *gl_sampler = _mesa_get_samplerobj(ctx, unit);
-   bool using_nearest = false;
+   struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
+
+   unsigned min_filter, mag_filter, mip_filter;
+   unsigned max_anisotropy = BRW_ANISORATIO_2;
+   unsigned address_rounding = 0;
+   unsigned wrap_s, wrap_t, wrap_r;
+   unsigned min_lod, max_lod, base_level;
+   unsigned shadow_function = 0;
+   int lod_bias;
+   bool non_normalized_coordinates = texObj->Target == GL_TEXTURE_RECTANGLE;
 
/* These don't use samplers at all. */
if (texObj->Target == GL_TEXTURE_BUFFER)
   return;
 
-   switch (gl_sampler->MinFilter) {
+   /* Select min and mip filters. */
+   switch (sampler->MinFilter) {
case GL_NEAREST:
-  sampler->ss0.min_filter = BRW_MAPFILTER_NEAREST;
-  sampler->ss0.mip_filter = BRW_MIPFILTER_NONE;
-  using_nearest = true;
+  min_filter = BRW_MAPFILTER_NEAREST;
+  mip_filter = BRW_MIPFILTER_NONE;
   break;
case GL_LINEAR:
-  sampler->ss0.min_filter = BRW_MAPFILTER_LINEAR;
-  sampler->ss0.mip_filter = BRW_MIPFILTER_NONE;
+  min_filter = BRW_MAPFILTER_LINEAR;
+  mip_filter = BRW_MIPFILTER_NONE;
   break;
case GL_NEAREST_MIPMAP_NEAREST:
-  sampler->ss0.min_filter = BRW_MAPFILTER_NEAREST;
-  sampler->ss0.mip_filter = BRW_MIPFILTER_NEAREST;
+  min_filter = BRW_MAPFILTER_NEAREST;
+  mip_filter = BRW_MIPFILTER_NEAREST;
   break;
case GL_LINEAR_MIPMAP_NEAREST:
-  sampler->ss0.min_filter = BRW_MAPFILTER_LINEAR;
-  sampler->ss0.mip_filter = BRW_MIPFILTER_NEAREST;
+  min_filter = BRW_MAPFILTER_LINEAR;
+  mip_filter = BRW_MIPFILTER_NEAREST;
   break;
case GL_NEAREST_MIPMAP_LINEAR:
-  sampler->ss0.min_filter = BRW_MAPFILTER_NEAREST;
-  sampler->ss0.mip_filter = BRW_MIPFILTER_LINEAR;
+  min_filter = BRW_MAPFILTER_NEAREST;
+  mip_filter = BRW_MIPFILTER_LINEAR;
   break;
case GL_LINEAR_MIPMAP_LINEAR:
-  sampler->ss0.min_filter = BRW_MAPFILTER_LINEAR;
-  sampler->ss0.mip_filter = BRW_MIPFILTER_LINEAR;
+  min_filter = BRW_MAPFILTER_LINEAR;
+  mip_filter = BRW_MIPFILTER_LINEAR;
   break;
default:
   break;
}
 
-   /* Set Anisotropy:
-*/
-   if (gl_sampler->MaxAnisotropy > 1.0) {
-  sampler->ss0.min_filter = BRW_MAPFILTER_ANISOTROPIC;
-  sampler->ss0.mag_filter = BRW_MAPFILTER_ANISOTROPIC;
+   /* Select mag filter. */
+   if (sampler->MagFilter == GL_LINEAR)
+  mag_filter = BRW_MAPFILTER_LINEAR;
+   else
+  mag_filter = BRW_MAPFILTER_NEAREST;
 
-  if (gl_sampler->MaxAnisotropy > 2.0) {
-sampler->ss3.max_aniso = MIN2((gl_sampler->MaxAnisotropy - 2) / 2,
-  BRW_ANISORATIO_16);
-  }
-   }
-   else {
-  switch (gl_sampler->MagFilter) {
-  case GL_NEAREST:
-sampler->ss0.mag_filter = BRW_MAPFILTER_NEAREST;
-using_nearest = true;
-break;
-  case GL_LINEAR:
-sampler->ss0.mag_filter = BRW_MAPFILTER_LINEAR;
-break;
-  default:
-break;
+   /* Enable anisotropic filtering if desired. */
+   if (sampler->MaxAnisotropy > 1.0) {
+  min_filter = BRW_MAPFILTER_ANISOTROPIC;
+  mag_filter = BRW_MAPFILTER_ANISOTROPIC;
+
+  if (sampler->MaxAnisotropy > 2.0) {
+max_anisotropy =
+MIN2((sampler->MaxAnisotropy - 2) / 2, BRW_ANISORATIO_16);
   }
}
 
-   sampler->ss1.r_wrap_mode = translate_wrap_mode(brw, gl_sampler->WrapR,
- using_nearest);
-   sampler->ss1.s_wrap_mode = translate_wrap_mode(brw, gl_sampler->WrapS,
- using_nearest);
-   sampler->ss1.t_wrap_mode = trans

[Mesa-dev] [PATCH 15/23] i965: Make brw_update_sampler_state use 8 bits for LOD fields on Gen7+.

2014-07-29 Thread Kenneth Graunke
This was the only actual difference between Gen4-6 and Gen7+ in terms of
the values we program.  The rest was just mechanical structure
rearrangement.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index ae4694b..d811cf5 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -403,9 +403,11 @@ brw_update_sampler_state(struct brw_context *brw,
 intel_translate_shadow_compare_func(sampler->CompareFunc);
}
 
-   min_lod = U_FIXED(CLAMP(sampler->MinLod, 0, 13), 6);
-   max_lod = U_FIXED(CLAMP(sampler->MaxLod, 0, 13), 6);
-   lod_bias = S_FIXED(CLAMP(texUnit->LodBias + sampler->LodBias, -16, 15), 6);
+   const int lod_bits = brw->gen >= 7 ? 8 : 6;
+   min_lod = U_FIXED(CLAMP(sampler->MinLod, 0, 13), lod_bits);
+   max_lod = U_FIXED(CLAMP(sampler->MaxLod, 0, 13), lod_bits);
+   lod_bias = S_FIXED(CLAMP(texUnit->LodBias + sampler->LodBias, -16, 15),
+  lod_bits);
base_level = U_FIXED(0, 1);
 
uint32_t border_color_offset;
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 09/23] i965: Make brw_upload_sampler_state_table handle Gen7+ as well.

2014-07-29 Thread Kenneth Graunke
This copies a few changes from gen7_upload_sampler_state_table; the next
patch will delete that function.

Gen7+ has per-stage sampler state pointer update packets, so we emit
them as soon as we emit a new table for a stage.  On Gen6 and earlier,
we have a single packet, so we delay until we've changed everything
that's going to be changed.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/brw_sampler_state.c  | 39 +++---
 src/mesa/drivers/dri/i965/brw_state.h  |  3 ++
 src/mesa/drivers/dri/i965/gen7_sampler_state.c |  2 +-
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c 
b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index a14b5b3..dc351bd 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -39,6 +39,7 @@
 #include "brw_context.h"
 #include "brw_state.h"
 #include "brw_defines.h"
+#include "intel_batchbuffer.h"
 #include "intel_mipmap_tree.h"
 
 #include "main/macros.h"
@@ -402,9 +403,16 @@ brw_upload_sampler_state_table(struct brw_context *brw,
   if (SamplersUsed & (1 << s)) {
  const unsigned unit = prog->SamplerUnits[s];
  if (ctx->Texture.Unit[unit]._Current) {
-brw_update_sampler_state(brw, unit,
- (struct brw_sampler_state *) 
sampler_state,
- batch_offset_for_sampler_state);
+if (brw->gen >= 7) {
+   gen7_update_sampler_state(brw, unit,
+ (struct gen7_sampler_state *)
+ sampler_state);
+} else {
+   brw_update_sampler_state(brw, unit,
+(struct brw_sampler_state *)
+sampler_state,
+batch_offset_for_sampler_state);
+}
  }
   }
 
@@ -412,7 +420,30 @@ brw_upload_sampler_state_table(struct brw_context *brw,
   batch_offset_for_sampler_state += size_in_bytes;
}
 
-   brw->state.dirty.cache |= CACHE_NEW_SAMPLER;
+   if (brw->gen >= 7) {
+  /* Emit a 3DSTATE_SAMPLER_STATE_POINTERS_XS packet. */
+  static const uint16_t packet_headers[] = {
+ [MESA_SHADER_VERTEX] = _3DSTATE_SAMPLER_STATE_POINTERS_VS,
+ [MESA_SHADER_GEOMETRY] = _3DSTATE_SAMPLER_STATE_POINTERS_GS,
+ [MESA_SHADER_FRAGMENT] = _3DSTATE_SAMPLER_STATE_POINTERS_PS,
+  };
+
+  /* Ivybridge requires a workaround flush before VS packets. */
+  if (brw->gen == 7 && !brw->is_haswell && !brw->is_baytrail &&
+  stage_state->stage == MESA_SHADER_VERTEX) {
+ gen7_emit_vs_workaround_flush(brw);
+  }
+
+  BEGIN_BATCH(2);
+  OUT_BATCH(packet_headers[stage_state->stage] << 16 | (2 - 2));
+  OUT_BATCH(stage_state->sampler_offset);
+  ADVANCE_BATCH();
+   } else {
+  /* Flag that the sampler state table pointer has changed; later atoms
+   * will handle it.
+   */
+  brw->state.dirty.cache |= CACHE_NEW_SAMPLER;
+   }
 }
 
 static void
diff --git a/src/mesa/drivers/dri/i965/brw_state.h 
b/src/mesa/drivers/dri/i965/brw_state.h
index 77de785..64652cb 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -252,6 +252,9 @@ void upload_default_color(struct brw_context *brw,
 void gen4_init_vtable_sampler_functions(struct brw_context *brw);
 
 /* gen7_sampler_state.c */
+void gen7_update_sampler_state(struct brw_context *brw,
+   int unit,
+   struct gen7_sampler_state *sampler_state);
 void gen7_init_vtable_sampler_functions(struct brw_context *brw);
 
 /* gen6_sf_state.c */
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c 
b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index b6d45cc..66af26a 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -33,7 +33,7 @@
 /**
  * Sets the sampler state for a single unit.
  */
-static void
+void
 gen7_update_sampler_state(struct brw_context *brw, int unit,
  struct gen7_sampler_state *sampler)
 {
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 21/29] mesa: stop going behind the user's back wrt sse4.1 optimisations

2014-07-29 Thread Matt Turner
On Tue, Jul 29, 2014 at 3:54 PM, Emil Velikov  wrote:
> If the user/builder has a setup capable of using sse4.1 it's their
> responsibility to enable it.
>
> Let's unconditionally include main/streaming-load-memcpy.c, as it
> already features a ifdef __SSE4_1__ check and add a stub implementation
> for people that don't have -msse4.1 enabled at compile-time.
>
> This resolves undefined references to _mesa_streaming_load_memcpy for
> the Android build and compilers not capable of sse4.1 optimizations.
>
> Note: if your compiler is capable of -msse4.1 and you are interested
> in using such optimisations, enable them explicitly.

The reason we build this file with -msse4.1 explicitly is because
distributions build things for the lowest common denominator but we
still want this code to be enabled (via a runtime check for SSE 4.1).

If we do this, distributions building with typical CFLAGS won't get
this optimization. That's not what we want.

What's the problem with the current solution -- that the Android build
system doesn't let you build this file with -msse4.1?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 6/7] glsl: fix inconsistent struct/class warning in vs12

2014-07-29 Thread Ian Romanick
Reviewed-by: Ian Romanick 

On 07/22/2014 02:07 PM, Alon Levy wrote:
> Remove incorrect struct prefix, ir_variable is a class
> 
> Signed-off-by: Alon Levy 
> ---
>  src/glsl/opt_dead_builtin_varyings.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/glsl/opt_dead_builtin_varyings.cpp 
> b/src/glsl/opt_dead_builtin_varyings.cpp
> index c2a306e..f98a21f 100644
> --- a/src/glsl/opt_dead_builtin_varyings.cpp
> +++ b/src/glsl/opt_dead_builtin_varyings.cpp
> @@ -334,7 +334,7 @@ public:
> }
>  
> void prepare_array(exec_list *ir,
> -  struct ir_variable **new_var,
> +  ir_variable **new_var,
>int max_elements, unsigned start_location,
>const char *var_name, const char *mode_str,
>unsigned usage, unsigned external_usage)

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v2] glsl: Use the without_array predicate to simplify some code

2014-07-29 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
Reviewed-by: Matt Turner  [v1]
Cc: Timothy Arceri 
---
 src/glsl/ast_to_hir.cpp|  3 +--
 src/glsl/glsl_types.cpp|  3 +--
 src/glsl/link_uniforms.cpp | 23 ---
 src/glsl/link_varyings.cpp |  6 ++
 4 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index a15ee9c..844e11c 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -5203,8 +5203,7 @@ ast_process_structure_or_interface_block(exec_list 
*instructions,
  "in uniform blocks or structures.");
  }
 
- if (field_type->is_matrix() ||
- (field_type->is_array() && 
field_type->fields.array->is_matrix())) {
+ if (field_type->without_array()->is_matrix()) {
 fields[i].row_major = block_row_major;
 if (qual->flags.q.row_major)
fields[i].row_major = true;
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index f9cd258..737e6dd 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -872,8 +872,7 @@ glsl_type::std140_size(bool row_major) const
 * and  rows, the matrix is stored identically to a row of *
 * row vectors with  components each, according to rule (4).
 */
-   if (this->is_matrix() || (this->is_array() &&
-this->fields.array->is_matrix())) {
+   if (this->without_array()->is_matrix()) {
   const struct glsl_type *element_type;
   const struct glsl_type *vec_type;
   unsigned int array_len;
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 6c73197..7489536 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -59,10 +59,8 @@ values_for_type(const glsl_type *type)
 void
 program_resource_visitor::process(const glsl_type *type, const char *name)
 {
-   assert(type->is_record()
-  || (type->is_array() && type->fields.array->is_record())
-  || type->is_interface()
-  || (type->is_array() && type->fields.array->is_interface()));
+   assert(type->without_array()->is_record()
+  || type->without_array()->is_interface());
 
char *name_copy = ralloc_strdup(NULL, name);
recursion(type, &name_copy, strlen(name), false, NULL);
@@ -136,7 +134,7 @@ program_resource_visitor::process(ir_variable *var)
*/
   recursion(var->type, &name, strlen(name), false, NULL);
   ralloc_free(name);
-   } else if (t->is_record() || (t->is_array() && 
t->fields.array->is_record())) {
+   } else if (t->without_array()->is_record()) {
   char *name = ralloc_strdup(NULL, var->name);
   recursion(var->type, &name, strlen(name), false, NULL);
   ralloc_free(name);
@@ -299,10 +297,8 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
 bool row_major)
{
-  assert(!type->is_record());
-  assert(!(type->is_array() && type->fields.array->is_record()));
-  assert(!type->is_interface());
-  assert(!(type->is_array() && type->fields.array->is_interface()));
+  assert(!type->without_array()->is_record());
+  assert(!type->without_array()->is_interface());
 
   (void) row_major;
 
@@ -514,10 +510,8 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
 bool row_major, const glsl_type *record_type)
{
-  assert(!type->is_record());
-  assert(!(type->is_array() && type->fields.array->is_record()));
-  assert(!type->is_interface());
-  assert(!(type->is_array() && type->fields.array->is_interface()));
+  assert(!type->without_array()->is_record());
+  assert(!type->without_array()->is_interface());
 
   (void) row_major;
 
@@ -590,8 +584,7 @@ private:
this->uniforms[id].array_stride = 0;
 }
 
-if (type->is_matrix() ||
-(type->is_array() && type->fields.array->is_matrix())) {
+if (type->without_array()->is_matrix()) {
this->uniforms[id].matrix_stride = 16;
this->uniforms[id].row_major = ubo_row_major;
 } else {
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index a3fc2ae..1438a4b 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -1068,10 +1068,8 @@ private:
virtual void visit_field(const glsl_type *type, const char *name,
 bool row_major)
{
-  assert(!type->is_record());
-  assert(!(type->is_array() && type->fields.array->is_record()));
-  assert(!type->is_interface());
-  assert(!(type->is_array() && type->fields.array->is_interface()));
+  assert(!type->without_array()->is_record());
+  assert(!type->without_array()->is_interface());
 
   (void) row_major;
 
-- 
1.8.1.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.

[Mesa-dev] [PATCH v2] glsl: Add without_array type predicate

2014-07-29 Thread Ian Romanick
From: Ian Romanick 

Returns the type without any arrays.

This will be used in later patches in this series.

Signed-off-by: Ian Romanick 
Suggested-by: Timothy Arceri 
Cc: Timothy Arceri 
---
 src/glsl/glsl_types.h | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 0b63d48..9cd132a 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -465,6 +465,18 @@ struct glsl_type {
}
 
/**
+* Get the type stripped of any arrays
+*
+* \return
+* Pointer to the type of elements of the first non-array type for array
+* types, or pointer to itself for non-array types.
+*/
+   const glsl_type *without_array() const
+   {
+  return this->is_array() ? this->fields.array : this;
+   }
+
+   /**
 * Return the amount of atomic counter storage required for a type.
 */
unsigned atomic_size() const
-- 
1.8.1.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glsl/glcpp: rename ERROR to ERROR_TOKEN to fix MSVC build

2014-07-29 Thread Brian Paul
ERROR is a #define in the MSVC WinGDI.h header file.
Add the _TOKEN suffix as we do for a few other lexer tokens.
---
 src/glsl/glcpp/glcpp-lex.l   |2 +-
 src/glsl/glcpp/glcpp-parse.y |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 4b9ab23..c126850 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -350,7 +350,7 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
 
 error.* {
BEGIN INITIAL;
-   RETURN_STRING_TOKEN (ERROR);
+   RETURN_STRING_TOKEN (ERROR_TOKEN);
 }
 
/* After we see a "#define" we enter the  start state
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index bc873cd..4ee4110 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -171,11 +171,11 @@ add_builtin_define(glcpp_parser_t *parser, const char 
*name, int value);
/* We use HASH_TOKEN, DEFINE_TOKEN and VERSION_TOKEN (as opposed to
  * HASH, DEFINE, and VERSION) to avoid conflicts with other symbols,
  * (such as the  and  start conditions in the lexer). */
-%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH_TOKEN DEFINE_TOKEN 
FUNC_IDENTIFIER OBJ_IDENTIFIER ELIF ELSE ENDIF ERROR IF IFDEF IFNDEF LINE 
PRAGMA UNDEF VERSION_TOKEN GARBAGE IDENTIFIER IF_EXPANDED INTEGER 
INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE PLUS_PLUS 
MINUS_MINUS
+%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH_TOKEN DEFINE_TOKEN 
FUNC_IDENTIFIER OBJ_IDENTIFIER ELIF ELSE ENDIF ERROR_TOKEN IF IFDEF IFNDEF LINE 
PRAGMA UNDEF VERSION_TOKEN GARBAGE IDENTIFIER IF_EXPANDED INTEGER 
INTEGER_STRING LINE_EXPANDED NEWLINE OTHER PLACEHOLDER SPACE PLUS_PLUS 
MINUS_MINUS
 %token PASTE
 %type  INTEGER operator SPACE integer_constant
 %type  expression
-%type  IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER 
ERROR PRAGMA
+%type  IDENTIFIER FUNC_IDENTIFIER OBJ_IDENTIFIER INTEGER_STRING OTHER 
ERROR_TOKEN PRAGMA
 %type  identifier_list
 %type  preprocessing_token conditional_token
 %type  pp_tokens replacement_list text_line conditional_tokens
@@ -421,7 +421,7 @@ control_line_success:
 ;
 
 control_line_error:
-   HASH_TOKEN ERROR NEWLINE {
+   HASH_TOKEN ERROR_TOKEN NEWLINE {
glcpp_error(& @1, parser, "#%s", $2);
}
 |  HASH_TOKEN GARBAGE pp_tokens NEWLINE  {
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 18/29] android: drop HAL_PIXEL_FORMAT_RGBA_{5551, 4444}

2014-07-29 Thread Emil Velikov
Upstream Android (system/core) has dropped these formats with commit
6bac41f1bf9(get rid of HAL pixelformats 5551 and ) yet does not
mention why.

These formats never really worked so we're safe to drop them as well.

Identical commit is available in the android-x86 external/mesa repo

commit 06a2d36edcd1e2247440e5800e6bf3028f37aee6
Author: Chih-Wei Huang 
Date:   Wed Sep 25 01:16:57 2013 +0800

android: get rid of HAL pixelformats 5551 and 

Cc: "10.1 10.2" 
Signed-off-by: Emil Velikov 
---
 src/egl/drivers/dri2/platform_android.c   | 4 
 src/gallium/state_trackers/egl/android/native_android.cpp | 4 
 2 files changed, 8 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index d1f597c..61a99ba 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -54,8 +54,6 @@ get_format_bpp(int native)
   bpp = 3;
   break;
case HAL_PIXEL_FORMAT_RGB_565:
-   case HAL_PIXEL_FORMAT_RGBA_5551:
-   case HAL_PIXEL_FORMAT_RGBA_:
   bpp = 2;
   break;
default:
@@ -371,8 +369,6 @@ dri2_create_image_android_native_buffer(_EGLDisplay *disp, 
_EGLContext *ctx,
   format = __DRI_IMAGE_FORMAT_XBGR;
   break;
case HAL_PIXEL_FORMAT_RGB_888:
-   case HAL_PIXEL_FORMAT_RGBA_5551:
-   case HAL_PIXEL_FORMAT_RGBA_:
   /* unsupported */
default:
   _eglLog(_EGL_WARNING, "unsupported native buffer format 0x%x", 
buf->format);
diff --git a/src/gallium/state_trackers/egl/android/native_android.cpp 
b/src/gallium/state_trackers/egl/android/native_android.cpp
index 8620ed8..889b644 100644
--- a/src/gallium/state_trackers/egl/android/native_android.cpp
+++ b/src/gallium/state_trackers/egl/android/native_android.cpp
@@ -147,10 +147,6 @@ get_pipe_format(int native)
case HAL_PIXEL_FORMAT_BGRA_:
   fmt = PIPE_FORMAT_B8G8R8A8_UNORM;
   break;
-   case HAL_PIXEL_FORMAT_RGBA_5551:
-  /* fmt = PIPE_FORMAT_A1B5G5R5_UNORM; */
-   case HAL_PIXEL_FORMAT_RGBA_:
-  /* fmt = PIPE_FORMAT_A4B4G4R4_UNORM; */
default:
   ALOGE("unsupported native format 0x%x", native);
   fmt = PIPE_FORMAT_NONE;
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 03/29] android: egl/main: fixup the nouveau build

2014-07-29 Thread Emil Velikov
For a while the nouveau pipe driver has been a static library
and it has been using STL for even longer.
Correct add the link and cleanup the gallium_DRIVERS.

Cc: "10.1 10.2" 
Signed-off-by: Emil Velikov 
---
 src/egl/main/Android.mk | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index 50d617d..4d1a21d 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -94,13 +94,9 @@ endif
 
 # nouveau
 ifneq ($(filter nouveau, $(MESA_GPU_DRIVERS)),)
-gallium_DRIVERS += \
-   libmesa_winsys_nouveau \
-   libmesa_pipe_nvfx \
-   libmesa_pipe_nv50 \
-   libmesa_pipe_nvc0 \
-   libmesa_pipe_nouveau
+gallium_DRIVERS +=  libmesa_winsys_nouveau libmesa_pipe_nouveau
 LOCAL_SHARED_LIBRARIES += libdrm_nouveau
+LOCAL_SHARED_LIBRARIES += libstlport
 endif
 
 # r300g/r600g/radeonsi
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 16/29] android: gallium/auxiliary: drop log2/log2f redefitions

2014-07-29 Thread Emil Velikov
Recent versions of bionic has picked up support for these functions,
leading to build issues due to the redefition of the symbols.

Note: wrapping things in #ifdef does not cut it :\

Identical patch is available in chromium, android-x86 and perhaps other
projects.

commit 66c1c789ce3407472de9ed620c9f815639058835
Author: rmcil...@chromium.org
Date:   Wed Apr 02 10:59:34 2014 +

Porting to x64 Android. Remove redefinitions of log2 and log2f.

BUG=
R=k...@chromium.org

Review URL: https://codereview.chromium.org/216773005

commit 9cc0a0d2b0499556680b182888af86f29d4ec30b
Author: Chih-Wei Huang 
Date:   Sun Jul 21 23:04:19 2013 +0800

android: remove log2, log2f

The functions are already defined in the latest bionic.

Cc: Chia-I Wu 
Cc: "10.1 10.2" 
Signed-off-by: Emil Velikov 
---
 src/gallium/auxiliary/util/u_math.h | 22 --
 1 file changed, 22 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index d956fa1..efaaf3d 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -149,28 +149,6 @@ roundf(float x)
 #endif /* _MSC_VER */
 
 
-#ifdef PIPE_OS_ANDROID
-
-static INLINE
-double log2(double d)
-{
-   return log(d) * (1.0 / M_LN2);
-}
-
-/* workaround a conflict with main/imports.h */
-#ifdef log2f
-#undef log2f
-#endif
-
-static INLINE
-float log2f(float f)
-{
-   return logf(f) * (float) (1.0 / M_LN2);
-}
-
-#endif
-
-
 #if __STDC_VERSION__ < 199901L && (!defined(__cplusplus) || defined(_MSC_VER))
 static INLINE long int
 lrint(double d)
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 07/29] android: gallium/freedreno: add preliminary build

2014-07-29 Thread Emil Velikov
For all the people interested in testing the freedreno driver on
their Android devices. The next commit will hook these up within
the libEGL driver (via the gallium-egl backend).

There may be some rough edges but those can be sorted when a
willing builder/tester comes along.

v2:
 - s/freefreno/freedreno/. Spotted by Matt Turner.
 - Use the installed libdrm headers.

Cc: "10.1 10.2" 
Cc: Rob Clark 
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Emil Velikov 
---
 Android.mk  |  4 +--
 src/gallium/Android.mk  |  5 
 src/gallium/drivers/freedreno/Android.mk| 44 +
 src/gallium/winsys/freedreno/drm/Android.mk | 37 
 4 files changed, 88 insertions(+), 2 deletions(-)
 create mode 100644 src/gallium/drivers/freedreno/Android.mk
 create mode 100644 src/gallium/winsys/freedreno/drm/Android.mk

diff --git a/Android.mk b/Android.mk
index 05ed62f..b50a8e0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -24,7 +24,7 @@
 # BOARD_GPU_DRIVERS should be defined.  The valid values are
 #
 #   classic drivers: i915 i965
-#   gallium drivers: swrast i915g ilo nouveau r300g r600g radeonsi vmwgfx
+#   gallium drivers: swrast freedreno i915g ilo nouveau r300g r600g radeonsi 
vmwgfx
 #
 # The main target is libGLES_mesa.  For each classic driver enabled, a DRI
 # module will also be built.  DRI modules will be loaded by libGLES_mesa.
@@ -42,7 +42,7 @@ DRM_TOP := external/drm
 DRM_GRALLOC_TOP := hardware/drm_gralloc
 
 classic_drivers := i915 i965
-gallium_drivers := swrast i915g ilo nouveau r300g r600g radeonsi vmwgfx
+gallium_drivers := swrast freedreno i915g ilo nouveau r300g r600g radeonsi 
vmwgfx
 
 MESA_GPU_DRIVERS := $(strip $(BOARD_GPU_DRIVERS))
 
diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index e365d67..767361a 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -34,6 +34,11 @@ SUBDIRS := \
 # swrast
 SUBDIRS += winsys/sw/android drivers/softpipe
 
+# freedreno
+ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
+SUBDIRS += winsys/freedreno/drm drivers/freedreno
+endif
+
 # i915g
 ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
 SUBDIRS += winsys/i915/drm drivers/i915
diff --git a/src/gallium/drivers/freedreno/Android.mk 
b/src/gallium/drivers/freedreno/Android.mk
new file mode 100644
index 000..6cab31f
--- /dev/null
+++ b/src/gallium/drivers/freedreno/Android.mk
@@ -0,0 +1,44 @@
+# Copyright (C) 2014 Emil Velikov 
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+LOCAL_PATH := $(call my-dir)
+
+# get C_SOURCES
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+   $(C_SOURCES) \
+   $(a2xx_SOURCES) \
+   $(a3xx_SOURCES)
+
+LOCAL_CFLAGS := \
+   -Wno-packed-bitfield-compat
+
+LOCAL_C_INCLUDES := \
+   $(LOCAL_PATH)/ir3 \
+   $(TARGET_OUT_HEADERS)/libdrm \
+   $(TARGET_OUT_HEADERS)/freedreno
+
+LOCAL_MODULE := libmesa_pipe_freedreno
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/winsys/freedreno/drm/Android.mk 
b/src/gallium/winsys/freedreno/drm/Android.mk
new file mode 100644
index 000..7bd31d9
--- /dev/null
+++ b/src/gallium/winsys/freedreno/drm/Android.mk
@@ -0,0 +1,37 @@
+# Copyright (C) 2014 Emil Velikov 
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, E

[Mesa-dev] [PATCH 10/29] automake: merge gallium/state_trackers/Makefile into gallium/Makefile

2014-07-29 Thread Emil Velikov
One makefile less, with the potential of further compacting the
automake build.

Signed-off-by: Emil Velikov 
---
 configure.ac   |  1 -
 src/Makefile.am|  1 -
 src/gallium/Makefile.am| 49 +
 src/gallium/state_trackers/Makefile.am | 66 --
 4 files changed, 49 insertions(+), 68 deletions(-)
 delete mode 100644 src/gallium/state_trackers/Makefile.am

diff --git a/configure.ac b/configure.ac
index acbfe8f..3ff30d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2191,7 +2191,6 @@ AC_CONFIG_FILES([Makefile
src/gallium/drivers/softpipe/Makefile
src/gallium/drivers/svga/Makefile
src/gallium/drivers/trace/Makefile
-   src/gallium/state_trackers/Makefile
src/gallium/state_trackers/clover/Makefile
src/gallium/state_trackers/dri/Makefile
src/gallium/state_trackers/egl/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index e25a7c7..d211652 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,7 +51,6 @@ if HAVE_GALLIUM
 SUBDIRS += \
gallium/auxiliary   \
gallium \
-   gallium/state_trackers  \
gallium/targets
 
 if HAVE_GALLIUM_TESTS
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index 03d469d..d6326db 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -102,3 +102,52 @@ endif
 if NEED_WINSYS_WRAPPER
 SUBDIRS += winsys/sw/wrapper
 endif
+
+
+##
+## Gallium state trackers
+##
+
+if HAVE_CLOVER
+SUBDIRS += state_trackers/clover
+endif
+
+if HAVE_DRICOMMON
+SUBDIRS += state_trackers/dri
+endif
+
+if HAVE_GALLIUM_EGL
+SUBDIRS += state_trackers/egl
+endif
+
+if HAVE_GALLIUM_GBM
+SUBDIRS += state_trackers/gbm
+endif
+
+if HAVE_X11_DRIVER
+SUBDIRS += state_trackers/glx/xlib
+endif
+
+if HAVE_ST_OMX
+SUBDIRS += state_trackers/omx
+endif
+
+if HAVE_GALLIUM_OSMESA
+SUBDIRS += state_trackers/osmesa
+endif
+
+if HAVE_ST_VDPAU
+SUBDIRS += state_trackers/vdpau
+endif
+
+if HAVE_OPENVG
+SUBDIRS += state_trackers/vega
+endif
+
+if HAVE_ST_XA
+SUBDIRS += state_trackers/xa
+endif
+
+if HAVE_ST_XVMC
+SUBDIRS += state_trackers/xvmc
+endif
diff --git a/src/gallium/state_trackers/Makefile.am 
b/src/gallium/state_trackers/Makefile.am
deleted file mode 100644
index 3ced6ad..000
--- a/src/gallium/state_trackers/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright © 2013 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-
-SUBDIRS =
-
-if HAVE_X11_DRIVER
-SUBDIRS += glx/xlib
-endif
-
-if HAVE_GALLIUM_OSMESA
-SUBDIRS += osmesa
-endif
-
-if HAVE_DRICOMMON
-SUBDIRS += dri
-endif
-
-if HAVE_GALLIUM_EGL
-SUBDIRS += egl
-endif
-
-if HAVE_GALLIUM_GBM
-SUBDIRS += gbm
-endif
-
-if HAVE_ST_XA
-SUBDIRS += xa
-endif
-
-if HAVE_OPENVG
-SUBDIRS += vega
-endif
-
-if HAVE_ST_XVMC
-SUBDIRS += xvmc
-endif
-
-if HAVE_ST_VDPAU
-SUBDIRS += vdpau
-endif
-
-if HAVE_CLOVER
-SUBDIRS += clover
-endif
-
-if HAVE_ST_OMX
-SUBDIRS += omx
-endif
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 06/29] automake: gallium/freedreno: drop spurious include dirs

2014-07-29 Thread Emil Velikov
Rather than including two extra folders only for two headers,
just prefix the headers and be done with it.

Cc: "10.1 10.2" 
Cc: Rob Clark 
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Emil Velikov 
Reviewed-by: Rob Clark 
---
 src/gallium/drivers/freedreno/Makefile.am| 2 --
 src/gallium/drivers/freedreno/freedreno_screen.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/freedreno/Makefile.am 
b/src/gallium/drivers/freedreno/Makefile.am
index 7d9c6e4..15a3e93 100644
--- a/src/gallium/drivers/freedreno/Makefile.am
+++ b/src/gallium/drivers/freedreno/Makefile.am
@@ -5,8 +5,6 @@ include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
-Wno-packed-bitfield-compat \
-   -I$(top_srcdir)/src/gallium/drivers/freedreno/a3xx \
-   -I$(top_srcdir)/src/gallium/drivers/freedreno/a2xx \
-I$(top_srcdir)/src/gallium/drivers/freedreno/ir3 \
$(GALLIUM_DRIVER_CFLAGS) \
$(FREEDRENO_CFLAGS)
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index e6d8e38..22669a7 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -50,8 +50,8 @@
 #include "freedreno_query.h"
 #include "freedreno_util.h"
 
-#include "fd2_screen.h"
-#include "fd3_screen.h"
+#include "a2xx/fd2_screen.h"
+#include "a3xx/fd3_screen.h"
 
 /* XXX this should go away */
 #include "state_tracker/drm_driver.h"
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 22/29] automake: mesa: whitespace fixes

2014-07-29 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/Makefile.am | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index d59af99..e7d55c9 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -120,20 +120,18 @@ endif
 libmesa_la_SOURCES = \
$(MESA_FILES) \
$(PROGRAM_FILES) \
-$(MESA_ASM_FILES_FOR_ARCH)
+   $(MESA_ASM_FILES_FOR_ARCH)
 
 libmesa_la_LIBADD = \
-$(top_builddir)/src/glsl/libglsl.la \
-$()
+   $(top_builddir)/src/glsl/libglsl.la
 
 libmesagallium_la_SOURCES = \
$(MESA_GALLIUM_FILES) \
$(PROGRAM_FILES) \
-$(MESA_ASM_FILES_FOR_ARCH)
+   $(MESA_ASM_FILES_FOR_ARCH)
 
 libmesagallium_la_LIBADD = \
-$(top_builddir)/src/glsl/libglsl.la \
-$()
+   $(top_builddir)/src/glsl/libglsl.la
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCHv2 00/29] Android inspired fixes and automake cleanups

2014-07-29 Thread Emil Velikov
Hello list,

Here is an update+expansion of a lovely series that cleans up our builds 
and as an added bonus it makes things build for android on almost every 
driver but
 - radeonsi - driver requires llvm but the build is not there yet.
 - nouveau - bionic loves tr1/* C++ headers + broken drm_gralloc
 - vmwgfx - broken drm_gralloc (mesa fails at link stage)
 - freedreno - builds like a charm, yet drm_gralloc lacks support for it.
Rob wrote one which I'm testing atm :)

Changes since last series
 - patches 15-29 are new.
 - all android patches are using the installed libdrm headers, rather 
than going through the libdrm sources.
 - some additional android build fixes - use correct includes, drop no
longer available symbols, function re-definitions, missing functions...
 - a few mesa fixes from the Chromium tree.
 - create an actual i915_dri.so driver under Android.
 - leave it up-to the user to thinker with compiler optimisations
(-msse4.1) re main/streaming-load-memcpy.c: streaming-load-memcpy.c()

Series is build on top of the egl-drm patches, and requires my recent
libdrm patches otherwise libdrm does not install the headers.

The whole thing is available in the android-inspired-fixes over at my
github repo.

Any input is greatly appreciated.

Cheers,
Emil

 46 files changed, 448 insertions(+), 562 deletions(-)

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 25/29] android: loader: use the installed libdrm headers

2014-07-29 Thread Emil Velikov
One step closer to the way we handle automake builds.

Signed-off-by: Emil Velikov 
---
 src/loader/Android.mk | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/loader/Android.mk b/src/loader/Android.mk
index 6890af4..1c6fdae 100644
--- a/src/loader/Android.mk
+++ b/src/loader/Android.mk
@@ -35,11 +35,9 @@ LOCAL_SRC_FILES := \
 
 # swrast only
 ifeq ($(MESA_GPU_DRIVERS),swrast)
-   LOCAL_CFLAGS += -D__NOT_HAVE_DRM_H
+LOCAL_CFLAGS += -D__NOT_HAVE_DRM_H
 else
-LOCAL_C_INCLUDES += \
-   $(DRM_TOP)/include/drm \
-   $(DRM_TOP)
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm
 endif
 
 LOCAL_MODULE := libloader
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 14/29] scons: group state-trackers' and targets' scons

2014-07-29 Thread Emil Velikov
Both share the identical dependencies, as such we can simplify
the scons script.

Signed-off-by: Emil Velikov 
---
 src/gallium/SConscript | 42 +++---
 1 file changed, 11 insertions(+), 31 deletions(-)

diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index cb61720..98d017e 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -22,34 +22,14 @@ SConscript([
 ])
 
 #
-# State trackers
-#
-
-# Needed by some state trackers
-SConscript('winsys/sw/null/SConscript')
-
-if not env['embedded']:
-SConscript('state_trackers/vega/SConscript')
-if env['platform'] not in ('cygwin', 'darwin', 'haiku', 'sunos'):
-SConscript('state_trackers/egl/SConscript')
-
-if env['x11']:
-SConscript('state_trackers/glx/xlib/SConscript')
-
-if env['dri']:
-SConscript('state_trackers/dri/SConscript')
-
-if env['platform'] == 'windows':
-SConscript('state_trackers/wgl/SConscript')
-
-#
 # Winsys
-# 
+#
 
 SConscript([
+'winsys/sw/null/SConscript',
 'winsys/sw/wrapper/SConscript',
 ])
-
+
 if env['x11']:
 SConscript([
 'winsys/sw/xlib/SConscript',
@@ -68,18 +48,13 @@ if env['platform'] == 'haiku':
 if env['dri']:
 SConscript([
 'winsys/sw/dri/SConscript',
-])
-
-SConscript([
 'winsys/sw/kms-dri/SConscript',
-])
-
-SConscript([
 'winsys/svga/drm/SConscript',
 ])
 
+
 #
-# Targets
+# State trackers and targets
 #
 
 SConscript([
@@ -87,19 +62,23 @@ SConscript([
 ])
 
 if not env['embedded']:
+SConscript('state_trackers/vega/SConscript')
 if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 
'sunos'):
 SConscript([
-'targets/egl-static/SConscript'
+'state_trackers/egl/SConscript',
+'targets/egl-static/SConscript',
 ])
 
 if env['x11']:
 SConscript([
+'state_trackers/glx/xlib/SConscript',
 'targets/graw-xlib/SConscript',
 'targets/libgl-xlib/SConscript',
 ])
 
 if env['platform'] == 'windows':
 SConscript([
+'state_trackers/wgl/SConscript',
 'targets/graw-gdi/SConscript',
 'targets/libgl-gdi/SConscript',
 ])
@@ -111,6 +90,7 @@ if not env['embedded']:
 
 if env['dri']:
 SConscript([
+'state_trackers/dri/SConscript',
 'targets/dri/SConscript',
 ])
 
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 05/29] android: egl/main: resolve radeon linking issues

2014-07-29 Thread Emil Velikov
From: Paulo Sergio Travaglia 

 - link against libdrm_radeon
 - link the r600 driver against libstlport
 - linkin the newly added libmesa_pipe_radeon library
required by r600 and radeonsi drivers

v2: Include pipe_radeon after pipe_r600/radeonsi.

Cc: "10.1 10.2" 
[Emil Velikov] Split up and add commit message.
Signed-off-by: Emil Velikov 
---
 src/egl/main/Android.mk | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index 4d1a21d..b134682 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -102,16 +102,21 @@ endif
 # r300g/r600g/radeonsi
 ifneq ($(filter r300g r600g radeonsi, $(MESA_GPU_DRIVERS)),)
 gallium_DRIVERS += libmesa_winsys_radeon
+LOCAL_SHARED_LIBRARIES += libdrm_radeon
 ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),)
 gallium_DRIVERS += libmesa_pipe_r300
-endif
+endif # r300g
+ifneq ($(filter r600g radeonsi, $(MESA_GPU_DRIVERS)),)
 ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),)
 gallium_DRIVERS += libmesa_pipe_r600
-endif
+LOCAL_SHARED_LIBRARIES += libstlport
+endif # r600g
 ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),)
 gallium_DRIVERS += libmesa_pipe_radeonsi
-endif
-endif
+endif # radeonsi
+gallium_DRIVERS += libmesa_pipe_radeon
+endif # r600g || radeonsi
+endif # r300g || r600g || radeonsi
 
 # vmwgfx
 ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 11/29] automake: compact gallium/target/Makefile into gallium/Makefile

2014-07-29 Thread Emil Velikov
Yet another makefile less to worry about.

Signed-off-by: Emil Velikov 
---
 configure.ac|  1 -
 src/Makefile.am |  3 +-
 src/gallium/Makefile.am | 25 ---
 src/gallium/targets/Makefile.am | 71 -
 4 files changed, 21 insertions(+), 79 deletions(-)
 delete mode 100644 src/gallium/targets/Makefile.am

diff --git a/configure.ac b/configure.ac
index 3ff30d2..6d364dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2202,7 +2202,6 @@ AC_CONFIG_FILES([Makefile
src/gallium/state_trackers/vega/Makefile
src/gallium/state_trackers/xa/Makefile
src/gallium/state_trackers/xvmc/Makefile
-   src/gallium/targets/Makefile
src/gallium/targets/dri/Makefile
src/gallium/targets/egl-static/Makefile
src/gallium/targets/gbm/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index d211652..4b8008c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,8 +50,7 @@ endif
 if HAVE_GALLIUM
 SUBDIRS += \
gallium/auxiliary   \
-   gallium \
-   gallium/targets
+   gallium
 
 if HAVE_GALLIUM_TESTS
 SUBDIRS += \
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index d6326db..892f840 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -105,49 +105,64 @@ endif
 
 
 ##
-## Gallium state trackers
+## Gallium state trackers and their users (targets)
 ##
 
+if NEED_GALLIUM_LOADER
+SUBDIRS += targets/pipe-loader
+endif
+
 if HAVE_CLOVER
 SUBDIRS += state_trackers/clover
+SUBDIRS += targets/opencl
 endif
 
 if HAVE_DRICOMMON
 SUBDIRS += state_trackers/dri
+SUBDIRS += targets/dri
+endif
+
+## the egl target depends on vega
+if HAVE_OPENVG
+SUBDIRS += state_trackers/vega
 endif
 
 if HAVE_GALLIUM_EGL
 SUBDIRS += state_trackers/egl
+SUBDIRS += targets/egl-static
 endif
 
 if HAVE_GALLIUM_GBM
 SUBDIRS += state_trackers/gbm
+SUBDIRS += targets/gbm
 endif
 
 if HAVE_X11_DRIVER
 SUBDIRS += state_trackers/glx/xlib
+SUBDIRS += targets/libgl-xlib
 endif
 
 if HAVE_ST_OMX
 SUBDIRS += state_trackers/omx
+SUBDIRS += targets/omx
 endif
 
 if HAVE_GALLIUM_OSMESA
 SUBDIRS += state_trackers/osmesa
+SUBDIRS += targets/osmesa
 endif
 
 if HAVE_ST_VDPAU
 SUBDIRS += state_trackers/vdpau
-endif
-
-if HAVE_OPENVG
-SUBDIRS += state_trackers/vega
+SUBDIRS += targets/vdpau
 endif
 
 if HAVE_ST_XA
 SUBDIRS += state_trackers/xa
+SUBDIRS += targets/xa
 endif
 
 if HAVE_ST_XVMC
 SUBDIRS += state_trackers/xvmc
+SUBDIRS += targets/xvmc
 endif
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
deleted file mode 100644
index 3cacb04..000
--- a/src/gallium/targets/Makefile.am
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright © 2013 Intel Corporation
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-SUBDIRS =
-
-if HAVE_DRI2
-SUBDIRS += dri
-else
-if HAVE_DRISW
-SUBDIRS += dri
-endif
-endif
-
-if HAVE_X11_DRIVER
-SUBDIRS += libgl-xlib
-endif
-
-if HAVE_ST_OMX
-SUBDIRS += omx
-endif
-
-if HAVE_GALLIUM_OSMESA
-SUBDIRS += osmesa
-endif
-
-if HAVE_GALLIUM_GBM
-SUBDIRS += gbm
-endif
-
-if HAVE_ST_VDPAU
-SUBDIRS += vdpau
-endif
-
-if HAVE_ST_XA
-SUBDIRS += xa
-endif
-
-if HAVE_ST_XVMC
-SUBDIRS += xvmc
-endif
-
-if HAVE_CLOVER
-SUBDIRS += opencl
-endif
-
-if NEED_GALLIUM_LOADER
-SUBDIRS += pipe-loader
-endif
-
-if HAVE_GALLIUM_EGL
-SUBDIRS += egl-static
-endif
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 27/29] android: dri: use the installed libdrm headers

2014-07-29 Thread Emil Velikov
Saves us a few lines and brings us closer to the automake build.
Drop DRM_TOP as it's not longer used.

Signed-off-by: Emil Velikov 
---
 Android.mk   | 1 -
 src/mesa/drivers/dri/Android.mk  | 3 +--
 src/mesa/drivers/dri/i915/Android.mk | 3 +--
 src/mesa/drivers/dri/i965/Android.mk | 3 +--
 4 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/Android.mk b/Android.mk
index b50a8e0..591c2fc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -38,7 +38,6 @@ MESA_ANDROID_VERSION := 
$(MESA_ANDROID_MAJOR_VERSION).$(MESA_ANDROID_MINOR_VERSI
 MESA_COMMON_MK := $(MESA_TOP)/Android.common.mk
 MESA_PYTHON2 := python
 
-DRM_TOP := external/drm
 DRM_GRALLOC_TOP := hardware/drm_gralloc
 
 classic_drivers := i915 i965
diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index e0cf51c..5cb6d7b 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -37,8 +37,7 @@ MESA_DRI_CFLAGS := \
 MESA_DRI_C_INCLUDES := \
$(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common) \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
-   $(DRM_TOP) \
-   $(DRM_TOP)/include/drm \
+   $(TARGET_OUT_HEADERS)/libdrm \
external/expat/lib
 
 MESA_DRI_WHOLE_STATIC_LIBRARIES := \
diff --git a/src/mesa/drivers/dri/i915/Android.mk 
b/src/mesa/drivers/dri/i915/Android.mk
index c4f74d9..02052f8 100644
--- a/src/mesa/drivers/dri/i915/Android.mk
+++ b/src/mesa/drivers/dri/i915/Android.mk
@@ -38,8 +38,7 @@ LOCAL_CFLAGS := \
 
 LOCAL_C_INCLUDES := \
$(addprefix $(MESA_TOP)/,$(i915_INCLUDES)) \
-   $(MESA_DRI_C_INCLUDES) \
-   $(DRM_TOP)/intel
+   $(MESA_DRI_C_INCLUDES)
 
 LOCAL_SRC_FILES := \
$(i915_FILES)
diff --git a/src/mesa/drivers/dri/i965/Android.mk 
b/src/mesa/drivers/dri/i965/Android.mk
index 7e3fd65..e75bb26 100644
--- a/src/mesa/drivers/dri/i965/Android.mk
+++ b/src/mesa/drivers/dri/i965/Android.mk
@@ -37,8 +37,7 @@ LOCAL_CFLAGS := \
 
 LOCAL_C_INCLUDES := \
$(i965_INCLUDES) \
-   $(MESA_DRI_C_INCLUDES) \
-   $(DRM_TOP)/intel
+   $(MESA_DRI_C_INCLUDES)
 
 LOCAL_SRC_FILES := \
$(i965_FILES)
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 09/29] automake: compact gallium/drivers and gallium/winsys makefiles

2014-07-29 Thread Emil Velikov
Rather than having two separate almost empty and identical makefiles,
compact them thus improving the configure and build time.
Additionally this makes the automake build symmetrical to the scons
and android one.

Signed-off-by: Emil Velikov 
---
 configure.ac|   3 +-
 src/Makefile.am |   3 +-
 src/gallium/Makefile.am | 104 
 src/gallium/drivers/Makefile.am |  92 ---
 src/gallium/winsys/Makefile.am  |  73 
 5 files changed, 106 insertions(+), 169 deletions(-)
 create mode 100644 src/gallium/Makefile.am
 delete mode 100644 src/gallium/drivers/Makefile.am
 delete mode 100644 src/gallium/winsys/Makefile.am

diff --git a/configure.ac b/configure.ac
index dd3366b..acbfe8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2172,9 +2172,9 @@ AC_CONFIG_FILES([Makefile
src/egl/wayland/wayland-drm/Makefile
src/egl/wayland/wayland-egl/Makefile
src/egl/wayland/wayland-egl/wayland-egl.pc
+   src/gallium/Makefile
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/pipe-loader/Makefile
-   src/gallium/drivers/Makefile
src/gallium/drivers/freedreno/Makefile
src/gallium/drivers/galahad/Makefile
src/gallium/drivers/i915/Makefile
@@ -2219,7 +2219,6 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/xvmc/Makefile
src/gallium/tests/trivial/Makefile
src/gallium/tests/unit/Makefile
-   src/gallium/winsys/Makefile
src/gallium/winsys/freedreno/drm/Makefile
src/gallium/winsys/i915/drm/Makefile
src/gallium/winsys/intel/drm/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index d4a7090..e25a7c7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -50,9 +50,8 @@ endif
 if HAVE_GALLIUM
 SUBDIRS += \
gallium/auxiliary   \
-   gallium/drivers \
+   gallium \
gallium/state_trackers  \
-   gallium/winsys  \
gallium/targets
 
 if HAVE_GALLIUM_TESTS
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
new file mode 100644
index 000..03d469d
--- /dev/null
+++ b/src/gallium/Makefile.am
@@ -0,0 +1,104 @@
+SUBDIRS =
+
+##
+## Gallium pipe drivers and their respective winsys'
+##
+
+SUBDIRS += \
+   drivers/galahad \
+   drivers/identity \
+   drivers/noop \
+   drivers/trace \
+   drivers/rbug
+
+## freedreno/msm/kgsl
+if HAVE_GALLIUM_FREEDRENO
+SUBDIRS += drivers/freedreno
+SUBDIRS += winsys/freedreno/drm
+endif
+
+## i915g/i915
+if HAVE_GALLIUM_I915
+SUBDIRS += drivers/i915
+SUBDIRS += winsys/i915/drm
+endif
+
+## ilo/i965
+if HAVE_GALLIUM_ILO
+SUBDIRS += drivers/ilo
+SUBDIRS += winsys/intel/drm
+endif
+
+## nouveau
+if HAVE_GALLIUM_NOUVEAU
+SUBDIRS += drivers/nouveau
+SUBDIRS += winsys/nouveau/drm
+endif
+
+## vmwgfx/svga
+if HAVE_GALLIUM_SVGA
+SUBDIRS += drivers/svga
+SUBDIRS += winsys/svga/drm
+endif
+
+## r300
+if HAVE_GALLIUM_R300
+SUBDIRS += drivers/r300
+endif
+
+## radeon - linked into r600 and radeonsi
+if HAVE_GALLIUM_RADEON_COMMON
+SUBDIRS += drivers/radeon
+endif
+
+## r600
+if HAVE_GALLIUM_R600
+SUBDIRS += drivers/r600
+endif
+
+## radeonsi
+if HAVE_GALLIUM_RADEONSI
+SUBDIRS += drivers/radeonsi
+endif
+
+## the radeon winsys - linked in by r300, r600 and radeonsi
+if NEED_RADEON_DRM_WINSYS
+SUBDIRS += winsys/radeon/drm
+endif
+
+## swrast/softpipe
+if NEED_GALLIUM_SOFTPIPE_DRIVER
+SUBDIRS += drivers/softpipe
+
+## swrast/llvmpipe
+if NEED_GALLIUM_LLVMPIPE_DRIVER
+SUBDIRS += drivers/llvmpipe
+endif
+endif
+
+## the sw winsys'
+SUBDIRS += winsys/sw/null
+
+if NEED_WINSYS_XLIB
+SUBDIRS += winsys/sw/xlib
+endif
+
+if HAVE_DRISW
+SUBDIRS += winsys/sw/dri
+endif
+
+if HAVE_DRI2
+SUBDIRS += winsys/sw/kms-dri
+endif
+
+if HAVE_EGL_PLATFORM_FBDEV
+SUBDIRS += winsys/sw/fbdev
+endif
+
+if HAVE_EGL_PLATFORM_WAYLAND
+SUBDIRS += winsys/sw/wayland
+endif
+
+if NEED_WINSYS_WRAPPER
+SUBDIRS += winsys/sw/wrapper
+endif
diff --git a/src/gallium/drivers/Makefile.am b/src/gallium/drivers/Makefile.am
deleted file mode 100644
index 3d53cad..000
--- a/src/gallium/drivers/Makefile.am
+++ /dev/null
@@ -1,92 +0,0 @@
-AUTOMAKE_OPTIONS = subdir-objects
-
-
-SUBDIRS = . galahad identity noop trace rbug
-
-
-
-if HAVE_GALLIUM_FREEDRENO
-
-SUBDIRS += freedreno
-
-endif
-
-
-
-if HAVE_GALLIUM_I915
-
-SUBDIRS += i915
-
-endif
-
-
-
-if HAVE_GALLIUM_ILO
-
-SUBDIRS += ilo
-
-endif
-
-
-
-if HAVE_GALLIUM_NOUVEAU
-
-SUBDIRS +

[Mesa-dev] [PATCH 26/29] android: gallium: use the installed libdrm headers

2014-07-29 Thread Emil Velikov
Saves us a few lines and brings us closer to the automake build.

Signed-off-by: Emil Velikov 
---
 src/gallium/winsys/i915/drm/Android.mk  | 5 +
 src/gallium/winsys/intel/drm/Android.mk | 5 +
 src/gallium/winsys/svga/drm/Android.mk  | 3 +--
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/gallium/winsys/i915/drm/Android.mk 
b/src/gallium/winsys/i915/drm/Android.mk
index c72d203..ffcf4d5 100644
--- a/src/gallium/winsys/i915/drm/Android.mk
+++ b/src/gallium/winsys/i915/drm/Android.mk
@@ -30,10 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
-LOCAL_C_INCLUDES := \
-   $(DRM_TOP) \
-   $(DRM_TOP)/include/drm \
-   $(DRM_TOP)/intel
+LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_winsys_i915
 
diff --git a/src/gallium/winsys/intel/drm/Android.mk 
b/src/gallium/winsys/intel/drm/Android.mk
index a375b59..a391883 100644
--- a/src/gallium/winsys/intel/drm/Android.mk
+++ b/src/gallium/winsys/intel/drm/Android.mk
@@ -29,10 +29,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
-LOCAL_C_INCLUDES := \
-   $(DRM_TOP) \
-   $(DRM_TOP)/include/drm \
-   $(DRM_TOP)/intel
+LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_winsys_intel
 
diff --git a/src/gallium/winsys/svga/drm/Android.mk 
b/src/gallium/winsys/svga/drm/Android.mk
index f6398e0..a26138e 100644
--- a/src/gallium/winsys/svga/drm/Android.mk
+++ b/src/gallium/winsys/svga/drm/Android.mk
@@ -35,8 +35,7 @@ LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64
 LOCAL_C_INCLUDES := \
$(GALLIUM_TOP)/drivers/svga \
$(GALLIUM_TOP)/drivers/svga/include \
-   $(DRM_TOP) \
-   $(DRM_TOP)/include/drm
+   $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_winsys_svga
 
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 21/29] mesa: stop going behind the user's back wrt sse4.1 optimisations

2014-07-29 Thread Emil Velikov
If the user/builder has a setup capable of using sse4.1 it's their
responsibility to enable it.

Let's unconditionally include main/streaming-load-memcpy.c, as it
already features a ifdef __SSE4_1__ check and add a stub implementation
for people that don't have -msse4.1 enabled at compile-time.

This resolves undefined references to _mesa_streaming_load_memcpy for
the Android build and compilers not capable of sse4.1 optimizations.

Note: if your compiler is capable of -msse4.1 and you are interested
in using such optimisations, enable them explicitly.

Cc: Matt Turner 
Cc: Adrian Negreanu 
Cc: "10.1 10.2" 
Signed-off-by: Emil Velikov 
---
 configure.ac  |  6 --
 src/mesa/Android.libmesa_dricore.mk   |  5 -
 src/mesa/Makefile.am  | 13 +
 src/mesa/Makefile.sources |  1 +
 src/mesa/main/streaming-load-memcpy.h |  8 
 5 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6d364dc..2b8df5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -235,12 +235,6 @@ AC_SUBST([VISIBILITY_CFLAGS])
 AC_SUBST([VISIBILITY_CXXFLAGS])
 
 dnl
-dnl Optional flags, check for compiler support
-dnl
-AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_SUPPORTED=1], [SSE41_SUPPORTED=0])
-AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
-
-dnl
 dnl Hacks to enable 32 or 64 bit build
 dnl
 AC_ARG_ENABLE([32-bit],
diff --git a/src/mesa/Android.libmesa_dricore.mk 
b/src/mesa/Android.libmesa_dricore.mk
index 217f649..1332ebf 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -47,11 +47,6 @@ ifeq ($(TARGET_ARCH),x86)
 endif # x86
 endif # MESA_ENABLE_ASM
 
-ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
-LOCAL_SRC_FILES += \
-   $(SRCDIR)main/streaming-load-memcpy.c
-endif
-
 LOCAL_C_INCLUDES := \
$(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
$(MESA_TOP)/src/mapi \
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 88eeff9..d59af99 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -81,7 +81,7 @@ main/get_hash.h: $(GLAPI)/gl_and_es_API.xml 
main/get_hash_params.py   \
-f $< > $@.tmp; \
mv $@.tmp $@;
 
-noinst_LTLIBRARIES = $(ARCH_LIBS)
+noinst_LTLIBRARIES =
 if NEED_LIBMESA
 noinst_LTLIBRARIES += libmesa.la
 else
@@ -95,11 +95,6 @@ AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
 AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
 
-ARCH_LIBS =
-
-if SSE41_SUPPORTED
-ARCH_LIBS += libmesa_sse41.la
-endif
 
 MESA_ASM_FILES_FOR_ARCH =
 
@@ -129,7 +124,6 @@ libmesa_la_SOURCES = \
 
 libmesa_la_LIBADD = \
 $(top_builddir)/src/glsl/libglsl.la \
-   $(ARCH_LIBS) \
 $()
 
 libmesagallium_la_SOURCES = \
@@ -139,13 +133,8 @@ libmesagallium_la_SOURCES = \
 
 libmesagallium_la_LIBADD = \
 $(top_builddir)/src/glsl/libglsl.la \
-   $(ARCH_LIBS) \
 $()
 
-libmesa_sse41_la_SOURCES = \
-   main/streaming-load-memcpy.c
-libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1
-
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
 
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index f4904fb..e0ff80b 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -91,6 +91,7 @@ MAIN_FILES = \
$(SRCDIR)main/shared.c \
$(SRCDIR)main/state.c \
$(SRCDIR)main/stencil.c \
+   $(SRCDIR)main/streaming-load-memcpy.c \
$(SRCDIR)main/syncobj.c \
$(SRCDIR)main/texcompress.c \
$(SRCDIR)main/texcompress_cpal.c \
diff --git a/src/mesa/main/streaming-load-memcpy.h 
b/src/mesa/main/streaming-load-memcpy.h
index 41c..80f0830 100644
--- a/src/mesa/main/streaming-load-memcpy.h
+++ b/src/mesa/main/streaming-load-memcpy.h
@@ -29,5 +29,13 @@
 /* Copies memory from src to dst, using SSE 4.1's MOVNTDQA to get streaming
  * read performance from uncached memory.
  */
+
+#ifdef __SSE4_1__
 void
 _mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t 
len);
+
+#else
+static void
+_mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t 
len) {}
+
+#endif
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 19/29] glsl: Don't use strtod_l in Mesa on Android.

2014-07-29 Thread Emil Velikov
From: "Myles C. Maxfield" 

Android includes a fix to asm/posix_types.h inside
/ndk/toolchains/x86-4.7/prebuilt/linux-x86_64/lib/gcc/
i686-linux-android/4.7/include-fixed/asm/posix_types.h. That
file #include_next's the real asm/posix_types.h, but then fixes
(redefines) the __FD_ZERO macro. However, it also #includes
features.h, which unconditionally defines _GNU_SOURCE.
src/glsl/strtod.c assumes that if the _GNU_SOURCE macro is defined,
that it can use locale_t, which isn't available on Android.

Review URL: https://chromiumcodereview.appspot.com/18594002

Patch pulled from the chromium project
https://android.googlesource.com/platform/external/chromium_org/third_party/mesa/src/+/2a3406721cd61852bebd502c7a907cf07b7be731%5E%21

Cc: "10.1 10.2" 
---
 src/glsl/strtod.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/strtod.c b/src/glsl/strtod.c
index 5d4346b..ddc5564 100644
--- a/src/glsl/strtod.c
+++ b/src/glsl/strtod.c
@@ -45,7 +45,7 @@ double
 glsl_strtod(const char *s, char **end)
 {
 #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
-   !defined(__HAIKU__) && !defined(__UCLIBC__)
+   !defined(__HAIKU__) && !defined(__UCLIBC__) && !defined(ANDROID)
static locale_t loc = NULL;
if (!loc) {
   loc = newlocale(LC_CTYPE_MASK, "C", NULL);
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 20/29] android: glsl: the stlport over the limited Android STL

2014-07-29 Thread Emil Velikov
The latter lacks various functionality used by mesa/glsl.

Cc: "10.1 10.2" 
Signed-off-by: Emil Velikov 
---
 src/glsl/Android.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/Android.mk b/src/glsl/Android.mk
index 8a39426..7b1fa7e 100644
--- a/src/glsl/Android.mk
+++ b/src/glsl/Android.mk
@@ -39,12 +39,12 @@ LOCAL_SRC_FILES := \
$(LIBGLSL_FILES)
 
 LOCAL_C_INCLUDES := \
-   external/astl/include \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/mesa
 
 LOCAL_MODULE := libmesa_glsl
 
+include external/stlport/libstlport.mk
 include $(LOCAL_PATH)/Android.gen.mk
 include $(MESA_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 29/29] android: dri/i9*5: remove used _INCLUDES variable

2014-07-29 Thread Emil Velikov
No longer needed as of last commit.

Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/i915/Android.mk   | 3 +--
 src/mesa/drivers/dri/i915/Makefile.sources | 4 
 src/mesa/drivers/dri/i965/Android.mk   | 3 +--
 src/mesa/drivers/dri/i965/Makefile.sources | 7 +--
 4 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/Android.mk 
b/src/mesa/drivers/dri/i915/Android.mk
index 02052f8..277d59b 100644
--- a/src/mesa/drivers/dri/i915/Android.mk
+++ b/src/mesa/drivers/dri/i915/Android.mk
@@ -29,7 +29,7 @@ LOCAL_MODULE := i915_dri
 LOCAL_MODULE_PATH := $(MESA_DRI_MODULE_PATH)
 LOCAL_UNSTRIPPED_PATH := $(MESA_DRI_MODULE_UNSTRIPPED_PATH)
 
-# Import variables i915_*.
+# Import variables i915_FILES.
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_CFLAGS := \
@@ -37,7 +37,6 @@ LOCAL_CFLAGS := \
-DI915
 
 LOCAL_C_INCLUDES := \
-   $(addprefix $(MESA_TOP)/,$(i915_INCLUDES)) \
$(MESA_DRI_C_INCLUDES)
 
 LOCAL_SRC_FILES := \
diff --git a/src/mesa/drivers/dri/i915/Makefile.sources 
b/src/mesa/drivers/dri/i915/Makefile.sources
index 243da9b..455ccde 100644
--- a/src/mesa/drivers/dri/i915/Makefile.sources
+++ b/src/mesa/drivers/dri/i915/Makefile.sources
@@ -1,7 +1,3 @@
-# Paths are relative to TOP.
-i915_INCLUDES = \
-   src/mesa/drivers/dri/intel
-
 i915_FILES = \
i830_context.c \
i830_state.c \
diff --git a/src/mesa/drivers/dri/i965/Android.mk 
b/src/mesa/drivers/dri/i965/Android.mk
index e75bb26..7ba9c31 100644
--- a/src/mesa/drivers/dri/i965/Android.mk
+++ b/src/mesa/drivers/dri/i965/Android.mk
@@ -29,14 +29,13 @@ LOCAL_MODULE := i965_dri
 LOCAL_MODULE_PATH := $(MESA_DRI_MODULE_PATH)
 LOCAL_UNSTRIPPED_PATH := $(MESA_DRI_MODULE_UNSTRIPPED_PATH)
 
-# Import variables i965_*.
+# Import variables i965_FILES.
 include $(LOCAL_PATH)/Makefile.sources
 
 LOCAL_CFLAGS := \
$(MESA_DRI_CFLAGS)
 
 LOCAL_C_INCLUDES := \
-   $(i965_INCLUDES) \
$(MESA_DRI_C_INCLUDES)
 
 LOCAL_SRC_FILES := \
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
b/src/mesa/drivers/dri/i965/Makefile.sources
index e235679..5dc7dc5 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -1,7 +1,3 @@
-i965_INCLUDES = \
-   $(MESA_TOP)/src \
-   $(MESA_TOP)/src/mesa/drivers/dri/intel
-
 i965_FILES = \
intel_asm_annotation.c \
intel_batchbuffer.c \
@@ -163,5 +159,4 @@ i965_FILES = \
gen8_viewport_state.c \
gen8_vs_state.c \
gen8_wm_depth_stencil.c \
-   gen8_ps_state.c \
-$()
+   gen8_ps_state.c
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 04/29] android: gallium/radeon: attempt to fix the android build

2014-07-29 Thread Emil Velikov
From: Paulo Sergio Travaglia 

 - include the correct folders
 - add a new buildscript for the common radeon folder

v2: Use the installed libdrm headers over the DRM_TOP ones.

Cc: "10.1 10.2" 
[Emil Velikov] Split up and add commit message.
Signed-off-by: Emil Velikov 
---
 src/gallium/Android.mk   |  3 +++
 src/gallium/drivers/r300/Android.mk  |  3 +--
 src/gallium/drivers/r600/Android.mk  |  2 +-
 src/gallium/drivers/radeon/Android.mk| 38 
 src/gallium/drivers/radeonsi/Android.mk  |  2 +-
 src/gallium/winsys/radeon/drm/Android.mk |  4 +---
 6 files changed, 45 insertions(+), 7 deletions(-)
 create mode 100644 src/gallium/drivers/radeon/Android.mk

diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index 85334cf..e365d67 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -57,6 +57,8 @@ SUBDIRS += winsys/radeon/drm
 ifneq ($(filter r300g, $(MESA_GPU_DRIVERS)),)
 SUBDIRS += drivers/r300
 endif
+ifneq ($(filter r600g radeonsi, $(MESA_GPU_DRIVERS)),)
+SUBDIRS += drivers/radeon
 ifneq ($(filter r600g, $(MESA_GPU_DRIVERS)),)
 SUBDIRS += drivers/r600
 endif
@@ -64,6 +66,7 @@ ifneq ($(filter radeonsi, $(MESA_GPU_DRIVERS)),)
 SUBDIRS += drivers/radeonsi
 endif
 endif
+endif
 
 # vmwgfx
 ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
diff --git a/src/gallium/drivers/r300/Android.mk 
b/src/gallium/drivers/r300/Android.mk
index ff27ef6..d3ef76d 100644
--- a/src/gallium/drivers/r300/Android.mk
+++ b/src/gallium/drivers/r300/Android.mk
@@ -34,8 +34,7 @@ LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/glsl \
$(MESA_TOP)/src/mesa \
-   $(DRM_TOP) \
-   $(DRM_TOP)/include/drm
+   $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_pipe_r300
 
diff --git a/src/gallium/drivers/r600/Android.mk 
b/src/gallium/drivers/r600/Android.mk
index 4d2f69f..3b12dd6 100644
--- a/src/gallium/drivers/r600/Android.mk
+++ b/src/gallium/drivers/r600/Android.mk
@@ -30,7 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES) $(CXX_SOURCES)
 
-LOCAL_C_INCLUDES := $(DRM_TOP)
+LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_pipe_r600
 
diff --git a/src/gallium/drivers/radeon/Android.mk 
b/src/gallium/drivers/radeon/Android.mk
new file mode 100644
index 000..d562f4c
--- /dev/null
+++ b/src/gallium/drivers/radeon/Android.mk
@@ -0,0 +1,38 @@
+# Mesa 3-D graphics library
+#
+# Copyright (C) 2011 Chia-I Wu 
+# Copyright (C) 2011 LunarG Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+LOCAL_PATH := $(call my-dir)
+
+# get C_SOURCES
+include $(LOCAL_PATH)/Makefile.sources
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(C_SOURCES)
+
+LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
+
+LOCAL_MODULE := libmesa_pipe_radeon
+
+include $(GALLIUM_COMMON_MK)
+include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/drivers/radeonsi/Android.mk 
b/src/gallium/drivers/radeonsi/Android.mk
index f7e01a3..22c0fdc 100644
--- a/src/gallium/drivers/radeonsi/Android.mk
+++ b/src/gallium/drivers/radeonsi/Android.mk
@@ -30,7 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
-LOCAL_C_INCLUDES :=
+LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_pipe_radeonsi
 
diff --git a/src/gallium/winsys/radeon/drm/Android.mk 
b/src/gallium/winsys/radeon/drm/Android.mk
index c192249..3165ba4 100644
--- a/src/gallium/winsys/radeon/drm/Android.mk
+++ b/src/gallium/winsys/radeon/drm/Android.mk
@@ -30,9 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
-LOCAL_C_INCLUDES := \
-   $(DRM_TOP) \
-   $(DRM_TOP)/include/drm
+LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_winsys_radeon
 
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/29] egl/main: Bring in the Makefile.sources

2014-07-29 Thread Emil Velikov
Rather than having the sources list duplicated across all three
build systems, define it once and use it whenever needed.

Signed-off-by: Emil Velikov 
---
 src/egl/main/Android.mk   | 23 ---
 src/egl/main/Makefile.am  | 40 +++-
 src/egl/main/Makefile.sources | 38 ++
 src/egl/main/SConscript   | 21 ++---
 4 files changed, 47 insertions(+), 75 deletions(-)
 create mode 100644 src/egl/main/Makefile.sources

diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index 580289f..50d617d 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -25,25 +25,10 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# from Makefile
-SOURCES = \
-   eglapi.c \
-   eglarray.c \
-   eglconfig.c \
-   eglcontext.c \
-   eglcurrent.c \
-   egldisplay.c \
-   egldriver.c \
-   eglfallbacks.c \
-   eglglobals.c \
-   eglimage.c \
-   egllog.c \
-   eglmisc.c \
-   eglmode.c \
-   eglscreen.c \
-   eglstring.c \
-   eglsurface.c \
-   eglsync.c
+include $(LOCAL_PATH)/Makefile.sources
+
+SOURCES := \
+   ${LIBEGL_C_FILES}
 
 # ---
 # Build libGLES_mesa
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index 38758a0..6746bcc 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -19,6 +19,8 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
+include Makefile.sources
+
 AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gbm/main \
@@ -32,43 +34,7 @@ AM_CFLAGS = \
 lib_LTLIBRARIES = libEGL.la
 
 libEGL_la_SOURCES = \
-   eglapi.c \
-   eglapi.h \
-   eglarray.c \
-   eglarray.h \
-   eglcompiler.h \
-   eglconfig.c \
-   eglconfig.h \
-   eglcontext.c \
-   eglcontext.h \
-   eglcurrent.c \
-   eglcurrent.h \
-   egldefines.h \
-   egldisplay.c \
-   egldisplay.h \
-   egldriver.c \
-   egldriver.h \
-   eglfallbacks.c \
-   eglglobals.c \
-   eglglobals.h \
-   eglimage.c \
-   eglimage.h \
-   egllog.c \
-   egllog.h \
-   eglmisc.c \
-   eglmisc.h \
-   eglmode.c \
-   eglmode.h \
-   eglmutex.h \
-   eglscreen.c \
-   eglscreen.h \
-   eglstring.c \
-   eglstring.h \
-   eglsurface.c \
-   eglsurface.h \
-   eglsync.c \
-   eglsync.h \
-   egltypedefs.h
+   ${LIBEGL_C_FILES}
 
 libEGL_la_LIBADD = \
$(EGL_LIB_DEPS)
diff --git a/src/egl/main/Makefile.sources b/src/egl/main/Makefile.sources
new file mode 100644
index 000..6a917e2
--- /dev/null
+++ b/src/egl/main/Makefile.sources
@@ -0,0 +1,38 @@
+LIBEGL_C_FILES := \
+   eglapi.c \
+   eglapi.h \
+   eglarray.c \
+   eglarray.h \
+   eglcompiler.h \
+   eglconfig.c \
+   eglconfig.h \
+   eglcontext.c \
+   eglcontext.h \
+   eglcurrent.c \
+   eglcurrent.h \
+   egldefines.h \
+   egldisplay.c \
+   egldisplay.h \
+   egldriver.c \
+   egldriver.h \
+   eglfallbacks.c \
+   eglglobals.c \
+   eglglobals.h \
+   eglimage.c \
+   eglimage.h \
+   egllog.c \
+   egllog.h \
+   eglmisc.c \
+   eglmisc.h \
+   eglmode.c \
+   eglmode.h \
+   eglmutex.h \
+   eglscreen.c \
+   eglscreen.h \
+   eglstring.c \
+   eglstring.h \
+   eglsurface.c \
+   eglsurface.h \
+   eglsync.c \
+   eglsync.h \
+   egltypedefs.h
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 8c57cea..390f28a 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -28,25 +28,8 @@ env.Append(CPPPATH = [
 '#/include',
 ])
 
-egl_sources = [
-'eglapi.c',
-'eglarray.c',
-'eglconfig.c',
-'eglcontext.c',
-'eglcurrent.c',
-'egldisplay.c',
-'egldriver.c',
-'eglfallbacks.c',
-'eglglobals.c',
-'eglimage.c',
-'egllog.c',
-'eglmisc.c',
-'eglmode.c',
-'eglscreen.c',
-'eglstring.c',
-'eglsurface.c',
-'eglsync.c',
-]
+# parse Makefile.sources
+egl_sources = env.ParseSourceList('Makefile.sources', 'LIBEGL_C_FILES')
 
 egl = env.ConvenienceLibrary(
 target = 'egl',
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 15/29] android: targets/egl-static: add correct include for DRM headers

2014-07-29 Thread Emil Velikov
Android build never really installs the headers, as such we need to
explicitly add their location in the source tree otherwise it will
fail to find them.

v2: Android now installs the headers, so let's use that ;)

Signed-off-by: Emil Velikov 
---
 src/gallium/targets/egl-static/Android.mk | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/gallium/targets/egl-static/Android.mk 
b/src/gallium/targets/egl-static/Android.mk
index d25c432..adaf582 100644
--- a/src/gallium/targets/egl-static/Android.mk
+++ b/src/gallium/targets/egl-static/Android.mk
@@ -47,9 +47,7 @@ LOCAL_CFLAGS += -DGALLIUM_SOFTPIPE
 
 # !swrast only
 ifneq ($(MESA_GPU_DRIVERS),swrast)
-LOCAL_C_INCLUDES += \
-   $(DRM_TOP)/include/drm \
-   $(DRM_TOP)
+LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libdrm
 endif
 
 ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 23/29] android: dri/i915: do not build an 'empty' driver

2014-07-29 Thread Emil Velikov
The variable i915_C_FILES changed to i915_FILES with commit
34d4216e641 back in mesa 9.1/9.2. Yet we've missed to update the
the android build, essentially creating an dummy/empty driver that
can never work.

Cc: "10.1 10.2" 
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/i915/Android.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i915/Android.mk 
b/src/mesa/drivers/dri/i915/Android.mk
index c74e11c..c4f74d9 100644
--- a/src/mesa/drivers/dri/i915/Android.mk
+++ b/src/mesa/drivers/dri/i915/Android.mk
@@ -42,7 +42,7 @@ LOCAL_C_INCLUDES := \
$(DRM_TOP)/intel
 
 LOCAL_SRC_FILES := \
-   $(i915_C_FILES)
+   $(i915_FILES)
 
 LOCAL_WHOLE_STATIC_LIBRARIES := \
$(MESA_DRI_WHOLE_STATIC_LIBRARIES)
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 28/29] android: drivers/dri: add $(mesa_top)/src to the includes list

2014-07-29 Thread Emil Velikov
Will allow us to nuke an include or two from the drivers.

Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/Android.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/Android.mk b/src/mesa/drivers/dri/Android.mk
index 5cb6d7b..1ffa845 100644
--- a/src/mesa/drivers/dri/Android.mk
+++ b/src/mesa/drivers/dri/Android.mk
@@ -35,6 +35,7 @@ MESA_DRI_CFLAGS := \
-DHAVE_ANDROID_PLATFORM
 
 MESA_DRI_C_INCLUDES := \
+   $(MESA_TOP)/src \
$(call intermediates-dir-for,STATIC_LIBRARIES,libmesa_dri_common) \
$(addprefix $(MESA_TOP)/, $(mesa_dri_common_INCLUDES)) \
$(TARGET_OUT_HEADERS)/libdrm \
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 24/29] android: egl/dri2: use the installed libdrm headers

2014-07-29 Thread Emil Velikov
Trying to get rid of the hardcoded dependency of DRM_TOP which
expects that mesa is localted in /external/drm. Will

Signed-off-by: Emil Velikov 
---
 src/egl/drivers/dri2/Android.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/egl/drivers/dri2/Android.mk b/src/egl/drivers/dri2/Android.mk
index c9e2b64..679cc2e 100644
--- a/src/egl/drivers/dri2/Android.mk
+++ b/src/egl/drivers/dri2/Android.mk
@@ -40,7 +40,7 @@ LOCAL_C_INCLUDES := \
$(MESA_TOP)/src/mapi \
$(MESA_TOP)/src/egl/main \
$(MESA_TOP)/src/loader \
-   $(DRM_TOP)/include/drm \
+   $(TARGET_OUT_HEADERS)/libdrm \
$(DRM_GRALLOC_TOP)
 
 LOCAL_STATIC_LIBRARIES := \
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 13/29] android: reorder gallium SUBDIRS

2014-07-29 Thread Emil Velikov
To be closer to its automake counterpart.

Signed-off-by: Emil Velikov 
---
 src/gallium/Android.mk | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/Android.mk b/src/gallium/Android.mk
index 767361a..bf99e4f 100644
--- a/src/gallium/Android.mk
+++ b/src/gallium/Android.mk
@@ -26,10 +26,11 @@
 GALLIUM_TOP := $(call my-dir)
 GALLIUM_COMMON_MK := $(GALLIUM_TOP)/Android.common.mk
 
-SUBDIRS := \
-   targets/egl-static \
-   state_trackers/egl \
-   auxiliary
+SUBDIRS := auxiliary
+
+#
+# Gallium drivers and their respective winsys
+#
 
 # swrast
 SUBDIRS += winsys/sw/android drivers/softpipe
@@ -78,5 +79,10 @@ ifneq ($(filter vmwgfx, $(MESA_GPU_DRIVERS)),)
 SUBDIRS += winsys/svga/drm drivers/svga
 endif
 
+#
+# Gallium state trackers and their users (targets)
+#
+SUBDIRS += state_trackers/egl targets/egl-static
+
 mkfiles := $(patsubst %,$(GALLIUM_TOP)/%/Android.mk,$(SUBDIRS))
 include $(mkfiles)
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 17/29] swrast: Fix a bug with Multiple Render Targets.

2014-07-29 Thread Emil Velikov
See https://code.google.com/p/chromium/issues/detail?id=308715 for more
info.

Review URL: https://codereview.chromium.org/27740005

Patch authored by hu...@chromium.org, as per
https://android.googlesource.com/platform/external/chromium_org/third_party/mesa/src/+/009d829daee69743d77f4eaea702633a2fd5d7c6%5E%21/

Cc: Stéphane Marchesin 
Cc: "10.1 10.2" 
---
 src/mesa/swrast/s_span.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 10aa33c..5e95b23 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1330,8 +1330,8 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan 
*span)
colorType == GL_FLOAT);
 
 /* set span->array->rgba to colors for renderbuffer's datatype */
-if (span->array->ChanType != colorType) {
-   convert_color_type(span, colorType, 0);
+if (span->array->ChanType != colorType || multiFragOutputs) {
+   convert_color_type(span, colorType, buf);
 }
 else {
if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 12/29] automake: handle gallium SUBDIRs in gallium/Makefile

2014-07-29 Thread Emil Velikov
Considering the way we've been consolidating things it makes
sense to add the final two (aux and tests) in here.

Signed-off-by: Emil Velikov 
---
 src/Makefile.am | 10 +-
 src/gallium/Makefile.am | 16 
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 4b8008c..d42b8ba 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,15 +48,7 @@ SUBDIRS += egl/main
 endif
 
 if HAVE_GALLIUM
-SUBDIRS += \
-   gallium/auxiliary   \
-   gallium
-
-if HAVE_GALLIUM_TESTS
-SUBDIRS += \
-   gallium/tests/trivial   \
-   gallium/tests/unit
-endif
+SUBDIRS += gallium
 endif
 
 EXTRA_DIST = getopt
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index 892f840..9be470d 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -1,6 +1,12 @@
 SUBDIRS =
 
 ##
+## Gallium auxiliary module
+##
+
+SUBDIRS += auxiliary
+
+##
 ## Gallium pipe drivers and their respective winsys'
 ##
 
@@ -166,3 +172,13 @@ if HAVE_ST_XVMC
 SUBDIRS += state_trackers/xvmc
 SUBDIRS += targets/xvmc
 endif
+
+##
+## Gallium tests
+##
+
+if HAVE_GALLIUM_TESTS
+SUBDIRS += \
+   tests/trivial \
+   tests/unit
+endif
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 02/29] android: gallium/nouveau: fix include folders, link against libstlport

2014-07-29 Thread Emil Velikov
nouveau uses STL for a while now thus we need to include
external/stlport/libstlport.mk in order to get the build
at least partially working.

v2: Use the installed libdrm headers over the DRM_TOP ones.

Cc: "10.1 10.2" 
Signed-off-by: Emil Velikov 
---
 src/gallium/drivers/nouveau/Android.mk| 9 +
 src/gallium/winsys/nouveau/drm/Android.mk | 5 +
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/nouveau/Android.mk 
b/src/gallium/drivers/nouveau/Android.mk
index 5275aa6..5870aa0 100644
--- a/src/gallium/drivers/nouveau/Android.mk
+++ b/src/gallium/drivers/nouveau/Android.mk
@@ -28,18 +28,19 @@ include $(LOCAL_PATH)/Makefile.sources
 
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := $(C_SOURCES) \
+LOCAL_SRC_FILES := \
+   $(C_SOURCES) \
$(NV30_C_SOURCES) \
$(NV50_CODEGEN_SOURCES) \
$(NV50_C_SOURES) \
$(NVC0_CODEGEN_SOURCES) \
$(NVC0_C_SOURCES)
 
-LOCAL_C_INCLUDES := $(DRM_TOP) \
-   $(DRM_TOP)/include/drm \
-   $(DRM_TOP)/nouveau
+LOCAL_C_INCLUDES := \
+   $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_pipe_nouveau
 
+include external/stlport/libstlport.mk
 include $(GALLIUM_COMMON_MK)
 include $(BUILD_STATIC_LIBRARY)
diff --git a/src/gallium/winsys/nouveau/drm/Android.mk 
b/src/gallium/winsys/nouveau/drm/Android.mk
index 2e2a9d1..142cc6b 100644
--- a/src/gallium/winsys/nouveau/drm/Android.mk
+++ b/src/gallium/winsys/nouveau/drm/Android.mk
@@ -30,10 +30,7 @@ include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := $(C_SOURCES)
 
-LOCAL_C_INCLUDES := \
-   $(DRM_TOP) \
-   $(DRM_TOP)/include/drm \
-   $(DRM_TOP)/nouveau
+LOCAL_C_INCLUDES := $(TARGET_OUT_HEADERS)/libdrm
 
 LOCAL_MODULE := libmesa_winsys_nouveau
 
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 08/29] android: egl/main: add/enable freedreno

2014-07-29 Thread Emil Velikov
For all everyone willing to give the freedreno driver
a go they can now build it under Android.

Cc: "10.1 10.2" 
Cc: Rob Clark 
Cc: freedr...@lists.freedesktop.org
Signed-off-by: Emil Velikov 
---
 src/egl/main/Android.mk   | 6 ++
 src/gallium/targets/egl-static/Android.mk | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index b134682..c3d9197 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -80,6 +80,12 @@ gallium_DRIVERS :=
 # swrast
 gallium_DRIVERS += libmesa_pipe_softpipe libmesa_winsys_sw_android
 
+# freedreno
+ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
+gallium_DRIVERS += libmesa_winsys_freedreno libmesa_pipe_freedreno
+LOCAL_SHARED_LIBRARIES += libdrm_freedreno
+endif
+
 # i915g
 ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
 gallium_DRIVERS += libmesa_winsys_i915 libmesa_pipe_i915
diff --git a/src/gallium/targets/egl-static/Android.mk 
b/src/gallium/targets/egl-static/Android.mk
index 00569dd..d25c432 100644
--- a/src/gallium/targets/egl-static/Android.mk
+++ b/src/gallium/targets/egl-static/Android.mk
@@ -52,6 +52,9 @@ LOCAL_C_INCLUDES += \
$(DRM_TOP)
 endif
 
+ifneq ($(filter freedreno, $(MESA_GPU_DRIVERS)),)
+LOCAL_CFLAGS += -DGALLIUM_FREEDRENO
+endif
 ifneq ($(filter i915g, $(MESA_GPU_DRIVERS)),)
 LOCAL_CFLAGS += -DGALLIUM_I915
 endif
-- 
2.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] i965: Bail on vec4 copy propagation for scratch writes with source modifiers

2014-07-29 Thread Anuj Phogat
On Tue, Jul 29, 2014 at 7:18 AM, Matt Turner  wrote:
>
> On Mon, Jul 28, 2014 at 8:47 PM, Anuj Phogat  wrote:
> > Fixes Khronos GLES3 CTS test:
> > dynamic_expression_array_access_vertex
> >
> > Cc: 
> > Signed-off-by: Anuj Phogat 
> > ---
> > I don't have a test case though it might be useful to also include
> > the check for VS_OPCODE_URB_WRITE here?
> >
> >  src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp 
> > b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
> > index 390448a..5a684a0 100644
> > --- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
> > @@ -273,6 +273,10 @@ try_copy_propagate(struct brw_context *brw, 
> > vec4_instruction *inst,
> > if (has_source_modifiers && value.type != inst->src[arg].type)
> >return false;
> >
> > +   if (has_source_modifiers &&
> > +   inst->opcode == SHADER_OPCODE_GEN4_SCRATCH_WRITE)
> > +  return false;
> > +
> > bool is_3src_inst = (inst->opcode == BRW_OPCODE_LRP ||
> >  inst->opcode == BRW_OPCODE_MAD ||
> >  inst->opcode == BRW_OPCODE_BFE ||
> > --
>
> I think the thing to do here is to prevent scratch writes from having
> source modifiers. They're sends from MRFs, so adding it to
> is_send_from_grf seems wrong. I'd add it to the list in
> brw_shader.cpp:can_do_source_mods.
>
It does look like a right place to add the opcode. But, adding it to the
list in brw_shader.cpp:can_do_source_mods will bail on copy
propagation for few other cases which we don't want to exclude. See
following code in try_copy_propagate() in brw_vec4_copy_propagation.cpp:

   if ((has_source_modifiers || value.file == UNIFORM ||
value.swizzle != BRW_SWIZZLE_XYZW) && !inst->can_do_source_mods(brw))
  return false;

Similar code also exists in fs_visitor::try_copy_propagate().

VS instruction count comparison for GLES3 CTS test:
With Mesa unchanged: 119
With my patch: 128
With suggested changes: 137


> VS_OPCODE_URB_WRITE shouldn't need any of this.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] State of llvmpipe geometry shaders?

2014-07-29 Thread P.A. Jimenez
master indeed works without having to set the environment variable (at
least with a simple test program targeting OpenGL 3.3 core using a geometry
shader). OpenGL Extensions Viewer, however, still sees only OpenGL 3.0
without the environment variable set. Although, it would be nice to find
out what steps cause that program not to see the forward contexts, the fact
that explicitly asking for one (forward context) works is quite
satisfactory.

Thanks for pointing out that the solution has already been committed.

On Tue, Jul 29, 2014 at 7:24 PM, Jose Fonseca  wrote:

> On 29/07/14 16:31, Brian Paul wrote:
>
>> On 07/19/2014 09:16 AM, Paul wrote:
>>
>>> Brian Paul  vmware.com> writes:
>>>
>>>
 On 07/11/2014 01:47 AM, Florian Link wrote:

> Hi everyone,
>
> I read a post from 2012 that MESA supports geometry shaders. I tried a
> current MESA 10.2.x release, but MESA GL_VERSION returns OpenGL version
> 3.0 (not 3.2) and the
> GL_ARB_geometry_shader4 extension is not reported in the MESA
>
 extensions.
>>>
 The function lookup for the functions of GL_ARB_geometry_shader4 works,
> though.
> When I run a shader program with a geometry shader, the MESA linker
> complains that the varying that is used in the fragment shader is not
> emitted from the vertex shader, which indicates that the geometry
> shader
> is not detected/used.
>
> Should geometry shaders work in the current MESA llvm pipe release, or
> do I need to enable/compile in some code?
>
> regards,
> Florian
>
> P.S. My geometry shader works on non-MESA native ATI/NVidia/Intel
> OpenGL
> drivers, so I don't think it is a problem of my shader code, especially
> the ATI drivers are quite strict.
>

 llvmpipe supports GS, but only in core profiles.  With glxinfo, use the
 -c option to see core profile version/extension info.

 -Brian


>>> Hi.
>>>
>>> I was also wondering about geometry shaders and the core profile with
>>> llvmpipe. I have cross compiled Mesa for Windows following the steps
>>> at qt-
>>> project, then tested the DLL with OpenGL Extensions Viewer. All I get is
>>> OpenGL 3.0, and no core profiles. I have tested versions 10.2.2,
>>> 10.2.3 and
>>> 10.3.0-devel with no luck so far.
>>>
>>
> You should test master.
>
> It's probably fixed with commit bd36cbfa5aa31817a04335a7c364224d0db64428
> "st/wgl: fix implementation of wglCreateContextAttribsARB()".
>
> Jose
>
>
>
> This message is as close as I have
>
>> gotten
>>> to an answer, but it only seems to indicate that in Linux it just
>>> works (if
>>> you ask for a core profile).
>>>
>>> Is it supported in Windows? If so, is there something that needs to be
>>> done
>>> to enable the core profile?
>>>
>>
>> Yeah, we probably do need some extra changes to get this to work on
>> Windows.  I just don't have any time right now to look into this.  If
>> you can debug it further that'd be great.
>>
>> -Brian
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://urldefense.proofpoint.com/v1/url?u=http://lists.
>> freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%
>> 2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80
>> qKwRgdodpoDzA%3D%0A&m=HI8ZuzSjiliG9JrUg27uknGI4ry1SI
>> ddE%2Fk%2FybaavmM%3D%0A&s=ca33a2ea6c6a6aab8bb0e7dc2af9be
>> c1b64725d0c59e90044f7d0be122012d22
>>
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 81881] Scons+MSVC 12.0 shared targets build fails

2014-07-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=81881

--- Comment #2 from Yury Blokhin  ---
Yes, this fix helped, thanx!

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Env var for forcing sw driver (Re: [PATCH 3/6] Add support for swrast to the DRM EGL platform)

2014-07-29 Thread Emil Velikov
On 25/07/14 07:34, Pekka Paalanen wrote:
> On Fri, 25 Jul 2014 09:14:40 +0300
> Pekka Paalanen  wrote:
> 
[snip]
> Hm, reading Kenneth's comments about variable naming at
> http://lists.freedesktop.org/archives/mesa-dev/2014-July/064103.html
> I wonder, is there real benefit for different driver loaders in Mesa
> each using a different env var for forcing loading a software
> driver/renderer?
> 
> Is there a reason why we just couldn't make LIBGL_ALWAYS_SOFTWARE
> actually always force the software driver or print a warning if the
> loader cannot do that?
> 
> Can a single process be wanting to use different loaders to load
> different software vs. hardware drivers at the same time?
> 
> Excuse me, this has nothing to do with the patch series anymore, I just
> hijacked the topic for discussion. :-)
> 
I believe that I rant more than enough on the topic so it would be nice to
avoid repeating the whole thing all over again. Yet if you feel that any of my
points in the thread do not make sense, please point them out specifically.

-Emil

> 
> Thanks,
> pq
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 6/6] gallium: remove PIPE_CAP_BUFFER_SHARE cap and get_param sw_winsys hook

2014-07-29 Thread Emil Velikov
On 24/07/14 01:43, Emil Velikov wrote:
> The kms_swrast driver has a separate InitScreen hook for its DriverAPI
> from the rest of the DRI2 drivers, all of which capable of buffer
> sharing. As such we no longer need to dive through the pipe-driver and
> winsys layers in order to determine if the driver can share buffers or
> not and we can explicitly set screen->can_share_buffer in InitScreen.
> 
> XXX: Squash with the original commit ?
> 
Hi Giovanni,

With the current implementation of kms_dri + megadrivers the PIPE_CAP is no
longer required. Are you OK if we drop it ?

-Emil

> Cc: Giovanni Campagna 
> Signed-off-by: Emil Velikov 
> ---
>  src/gallium/docs/source/screen.rst|  4 
>  src/gallium/drivers/freedreno/freedreno_screen.c  |  1 -
>  src/gallium/drivers/i915/i915_screen.c|  1 -
>  src/gallium/drivers/ilo/ilo_screen.c  |  2 --
>  src/gallium/drivers/llvmpipe/lp_screen.c  |  7 ---
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c|  1 -
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c|  1 -
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c|  1 -
>  src/gallium/drivers/r300/r300_screen.c|  1 -
>  src/gallium/drivers/r600/r600_pipe.c  |  1 -
>  src/gallium/drivers/radeonsi/si_pipe.c|  1 -
>  src/gallium/drivers/softpipe/sp_screen.c  |  7 ---
>  src/gallium/drivers/svga/svga_screen.c|  3 ---
>  src/gallium/include/pipe/p_defines.h  |  1 -
>  src/gallium/include/state_tracker/sw_winsys.h |  5 -
>  src/gallium/state_trackers/dri/dri2.c |  3 ++-
>  src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 14 --
>  17 files changed, 2 insertions(+), 52 deletions(-)
> 
> diff --git a/src/gallium/docs/source/screen.rst 
> b/src/gallium/docs/source/screen.rst
> index b09f18bd..ba583fe 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -213,10 +213,6 @@ The integer capabilities:
>  * ``PIPE_CAP_DRAW_INDIRECT``: Whether the driver supports taking draw 
> arguments
>{ count, instance_count, start, index_bias } from a PIPE_BUFFER resource.
>See pipe_draw_info.
> -* ``PIPE_CAP_BUFFER_SHARE``: Whether it is possible to share buffers between
> -  processes using the native window system. If this is 0, the buffers and
> -  display targets available are only valid for in-process rendering and
> -  scanout. This will be 1 for most HW drivers.
>  
>  
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
> b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 05426dc..c574cb8 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -175,7 +175,6 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
> pipe_cap param)
>   case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
>   case PIPE_CAP_USER_CONSTANT_BUFFERS:
>   case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> - case PIPE_CAP_BUFFER_SHARE:
>   return 1;
>  
>   case PIPE_CAP_SHADER_STENCIL_EXPORT:
> diff --git a/src/gallium/drivers/i915/i915_screen.c 
> b/src/gallium/drivers/i915/i915_screen.c
> index 437f4bd..86a7a67 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -186,7 +186,6 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
> cap)
> case PIPE_CAP_USER_VERTEX_BUFFERS:
> case PIPE_CAP_USER_INDEX_BUFFERS:
> case PIPE_CAP_USER_CONSTANT_BUFFERS:
> -   case PIPE_CAP_BUFFER_SHARE:
>return 1;
>  
> /* Unsupported features (boolean caps). */
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
> b/src/gallium/drivers/ilo/ilo_screen.c
> index 6b96e5b..e2a0e23 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -433,8 +433,6 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
> param)
> case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
> case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>return 0;
> -   case PIPE_CAP_BUFFER_SHARE:
> -  return 1;
>  
> default:
>return 0;
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
> b/src/gallium/drivers/llvmpipe/lp_screen.c
> index a7659c7..e25d14e 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -105,8 +105,6 @@ llvmpipe_get_name(struct pipe_screen *screen)
>  static int
>  llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>  {
> -   struct llvmpipe_screen *lp_screen = llvmpipe_screen(screen);
> -
> switch (param) {
> case PIPE_CAP_NPOT_TEXTURES:
> case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
> @@ -253,11 +251,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
> pipe_cap param)
>return 0;
> case PIPE_CAP_FAKE_SW_MSAA:
>return 1;
> -   case PIPE_CAP_BUFFER_SHARE:
> -  if (lp_screen->winsys->get_param !

[Mesa-dev] [Bug 81881] Scons+MSVC 12.0 shared targets build fails

2014-07-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=81881

Emil Velikov  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |NOTOURBUG

--- Comment #1 from Emil Velikov  ---
Seems like the scons regression Alon Levy mentioned a few days ago [1]. He also
raised the issue the scons people and has a workaround/fix for it in the
bugreport [2]


[1] http://lists.freedesktop.org/archives/mesa-dev/2014-July/063894.html
[2] http://scons.tigris.org/issues/show_bug.cgi?id=2966

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] State of llvmpipe geometry shaders?

2014-07-29 Thread Jose Fonseca

On 29/07/14 16:31, Brian Paul wrote:

On 07/19/2014 09:16 AM, Paul wrote:

Brian Paul  vmware.com> writes:



On 07/11/2014 01:47 AM, Florian Link wrote:

Hi everyone,

I read a post from 2012 that MESA supports geometry shaders. I tried a
current MESA 10.2.x release, but MESA GL_VERSION returns OpenGL version
3.0 (not 3.2) and the
GL_ARB_geometry_shader4 extension is not reported in the MESA

extensions.

The function lookup for the functions of GL_ARB_geometry_shader4 works,
though.
When I run a shader program with a geometry shader, the MESA linker
complains that the varying that is used in the fragment shader is not
emitted from the vertex shader, which indicates that the geometry
shader
is not detected/used.

Should geometry shaders work in the current MESA llvm pipe release, or
do I need to enable/compile in some code?

regards,
Florian

P.S. My geometry shader works on non-MESA native ATI/NVidia/Intel
OpenGL
drivers, so I don't think it is a problem of my shader code, especially
the ATI drivers are quite strict.


llvmpipe supports GS, but only in core profiles.  With glxinfo, use the
-c option to see core profile version/extension info.

-Brian



Hi.

I was also wondering about geometry shaders and the core profile with
llvmpipe. I have cross compiled Mesa for Windows following the steps
at qt-
project, then tested the DLL with OpenGL Extensions Viewer. All I get is
OpenGL 3.0, and no core profiles. I have tested versions 10.2.2,
10.2.3 and
10.3.0-devel with no luck so far.


You should test master.

It's probably fixed with commit bd36cbfa5aa31817a04335a7c364224d0db64428 
"st/wgl: fix implementation of wglCreateContextAttribsARB()".


Jose


This message is as close as I have

gotten
to an answer, but it only seems to indicate that in Linux it just
works (if
you ask for a core profile).

Is it supported in Windows? If so, is there something that needs to be
done
to enable the core profile?


Yeah, we probably do need some extra changes to get this to work on
Windows.  I just don't have any time right now to look into this.  If
you can debug it further that'd be great.

-Brian

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=NMr9uy2iTjWVixC0wOcYCWEIYhfo80qKwRgdodpoDzA%3D%0A&m=HI8ZuzSjiliG9JrUg27uknGI4ry1SIddE%2Fk%2FybaavmM%3D%0A&s=ca33a2ea6c6a6aab8bb0e7dc2af9bec1b64725d0c59e90044f7d0be122012d22



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] main/get_hash_params: Add GL_SAMPLE_SHADING_ARB

2014-07-29 Thread Kenneth Graunke
On Monday, July 28, 2014 06:32:47 PM Jason Ekstrand wrote:
> GL_SAMPLE_SHADING is specified as a valid pname for glGet in the
> GL_ARB_sample_shading extension.  It seems as if we forgot to add it to the
> table of pnames.
> 
> Signed-off-by: Jason Ekstrand 
> ---
>  src/mesa/main/get_hash_params.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/mesa/main/get_hash_params.py 
> b/src/mesa/main/get_hash_params.py
> index d45962d..28f1836 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -84,6 +84,7 @@ descriptor=[
>[ "SAMPLES_ARB", "BUFFER_INT(Visual.samples), extra_new_buffers" ],
>  
>  # GL_ARB_sample_shading
> +  [ "SAMPLE_SHADING_ARB", "CONTEXT_BOOL(Multisample.SampleShading), 
> extra_gl40_ARB_sample_shading" ],
>[ "MIN_SAMPLE_SHADING_VALUE_ARB", 
> "CONTEXT_FLOAT(Multisample.MinSampleShadingValue), 
> extra_gl40_ARB_sample_shading" ],
>  
>  # GL_SGIS_generate_mipmap
> 

Reviewed-by: Kenneth Graunke 
Cc: mesa-sta...@lists.freedesktop.org

(just put that Cc line in your commit message, and it'll get nominated for the 
stable branch)

signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] SandyBridge not handling GL_TRIANGLE_STRIP_ADJACENCY with repeating vertex indices correctly

2014-07-29 Thread Kenneth Graunke
On Tuesday, July 29, 2014 10:12:23 AM Iago Toral Quiroga wrote:
> Hi,
> 
> running the piglit tests on my implementation of geometry shaders for
> Sandy Bridge produces a GPU hang for the following test:
> 
> ./glsl-1.50-geometry-primitive-id-restart GL_TRIANGLE_STRIP_ADJACENCY
> ffs
> 
> That test checks primitive restarts but the hang seems to be unrelated
> to that, since it happens also when primitive restart is not enabled.
> The problem, which only affects GL_TRIANGLE_STRIP_ADJACENCY and no other
> primitive type -with our without adjacency-, is in this loop that the
> test uses to setup the indices for the vertices:
> 
> elements = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_READ_WRITE);
> num_elements = 0;
> for (i = 1; i <= LONGEST_INPUT_SEQUENCE; i++) {
>for (j = 0; j < i; j++) {
>   /* Every element that isn't the primitive
>* restart index can just be element 0, since
>* we don't care about the actual vertex data.
>*/
>   elements[num_elements++] = 0;
>}
>elements[num_elements++] = prim_restart_index;
> }
> glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
> 
> Setting all elements to the same index (0 in this case) is the one thing
> that causes the hang for GL_TRIANGLE_STRIP_ADJACENCY. A simple change
> like this removes the hang:
> -  elements[num_elements++] = 0;
> +  elements[num_elements++] = j != prim_restart_index ? j : j + 1;
> 
> Skimming through the docs I have not seen any references to this being a
> known problem. In fact, I don't see any references to
> GL_TRIANGLE_STRIP_ADJACENCY being special in any way and it seems that
> this is not a problem in IvyBridge, since the test runs correctly there.
> 
> Does this sound like a hardware bug specific to SandyBridge's handling
> of GL_TRIANGLE_STRIP_ADJACENCY or is there something else I should check
> before arriving to that conclusion?

Odd.  It could very well be, but I don't see anything in the documentation, 
either.  Could you post a branch with your preliminary code?  I'd be happy to 
look into the hang and see if I come up with any more useful information...

> If it is a hardware bug I guess we want a workaround for it , at least
> to prevent the hang or something but I am not sure what would be the
> best option here, I think the only option for the driver would be to
> explore the list of indices provided when this primitive type is used
> and when we hit this scenario (I'd have to test how many repeating
> indices we need for it to hang), error out and do not execute the
> drawing command or something... any other suggestions? 
> 
> Iago

signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 81881] Scons+MSVC 12.0 shared targets build fails

2014-07-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=81881

Yury Blokhin  changed:

   What|Removed |Added

 CC||ultrab...@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 81881] New: Scons+MSVC 12.0 shared targets build fails

2014-07-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=81881

  Priority: medium
Bug ID: 81881
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: Scons+MSVC 12.0 shared targets build fails
  Severity: normal
Classification: Unclassified
OS: Windows (All)
  Reporter: ultrab...@gmail.com
  Hardware: All
Status: NEW
   Version: 10.2
 Component: Other
   Product: Mesa

When building using mingw, VS2012 and python 2.7, and Scons 2.3.2, the shared
targets (.dll, for example osmesa) leads to error:

scons: *** [build\windows-x86\mesa\drivers\osmesa\osmesa.dll] Source file:
src\m
esa\drivers\osmesa\osmesa.def is static and is not compatible with shared
target
: build\windows-x86\mesa\drivers\osmesa\osmesa.dll

Removing .def file from SConscript leads to linking errors with lex generated
files.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 80848] [dri3] Building mesa fails with dri3 enabled

2014-07-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=80848

--- Comment #15 from Emil Velikov  ---
(In reply to comment #14)
> I paste the contents here for both xcb.pc files as they're short.
> Directories/files where they point are valid, I don't see anything wrong in
> these.
> 
AFAICT they look good and you're doing everything correctly, so ... back to
square one :\

> /usr/local/lib/pkgconfig/xcb.pc:
Do you have xcb and/or pkgconfig available in /usr/lib (without local) ?

Can you run git clean -nxd before and after building/installing commit
3ecd9e1a938 and attach the resulting src/glx/Makefile(s). It seems rather odd
that it causes such behaviour.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


  1   2   >