Mesa (master): nvc0: Update SConscript.

2011-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 19355a461a80c45e454f62f4496a93e36658ad65
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=19355a461a80c45e454f62f4496a93e36658ad65

Author: Vinson Lee 
Date:   Fri Mar  4 17:15:21 2011 -0800

nvc0: Update SConscript.

---

 src/gallium/drivers/nvc0/SConscript |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nvc0/SConscript 
b/src/gallium/drivers/nvc0/SConscript
index c49e0dd..dbbbf66 100644
--- a/src/gallium/drivers/nvc0/SConscript
+++ b/src/gallium/drivers/nvc0/SConscript
@@ -5,7 +5,6 @@ env = env.Clone()
 nvc0 = env.ConvenienceLibrary(
 target = 'nvc0',
 source = [
-'nvc0_buffer.c',
 'nvc0_context.c',
 'nvc0_draw.c',
 'nvc0_formats.c',
@@ -28,8 +27,6 @@ nvc0 = env.ConvenienceLibrary(
 'nvc0_pc_regalloc.c',
 'nvc0_push.c',
 'nvc0_push2.c',
-'nvc0_fence.c',
-'nvc0_mm.c',
 'nvc0_query.c'
 ])
 

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


Mesa (master): nv50: Update SConscript.

2011-03-04 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: dbf4970b694016671c9619d2218c4f8c9051eb55
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbf4970b694016671c9619d2218c4f8c9051eb55

Author: Vinson Lee 
Date:   Fri Mar  4 17:10:57 2011 -0800

nv50: Update SConscript.

---

 src/gallium/drivers/nv50/SConscript |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nv50/SConscript 
b/src/gallium/drivers/nv50/SConscript
index 8464451..3c8a727 100644
--- a/src/gallium/drivers/nv50/SConscript
+++ b/src/gallium/drivers/nv50/SConscript
@@ -5,7 +5,6 @@ env = env.Clone()
 nv50 = env.ConvenienceLibrary(
 target = 'nv50',
 source = [
-'nv50_buffer.c',
 'nv50_context.c',
 'nv50_draw.c',
 'nv50_formats.c',
@@ -27,9 +26,6 @@ nv50 = env.ConvenienceLibrary(
 'nv50_pc_optimize.c',
 'nv50_pc_regalloc.c',
 'nv50_push.c',
-'nv50_push2.c',
-'nv50_fence.c',
-'nv50_mm.c',
 'nv50_query.c'
 ])
 

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


Mesa (master): r600g: fix fragment shader size calculation

2011-03-04 Thread Christian König
Module: Mesa
Branch: master
Commit: fd2409ca2736dcc9339fd2ed7c021976a170d787
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd2409ca2736dcc9339fd2ed7c021976a170d787

Author: Christian König 
Date:   Sat Mar  5 01:46:31 2011 +0100

r600g: fix fragment shader size calculation

bc.ndw is altered in r600_bc_build, respect that
in fragment shader size calculation.

---

 src/gallium/drivers/r600/r600_asm.c |   17 +
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c 
b/src/gallium/drivers/r600/r600_asm.c
index 6777be8..626eb71 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -2196,14 +2196,6 @@ int r600_vertex_elements_build_fetch_shader(struct 
r600_pipe_context *rctx, stru
 
r600_bc_add_cfinst(&bc, BC_INST(&bc, V_SQ_CF_WORD1_SQ_CF_INST_RETURN));
 
-   /* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */
-   ve->fetch_shader = r600_bo(rctx->radeon, bc.ndw*4, 256, 
PIPE_BIND_VERTEX_BUFFER, 0);
-   if (ve->fetch_shader == NULL) {
-   r600_bc_clear(&bc);
-   return -ENOMEM;
-   }
-
-   ve->fs_size = bc.ndw*4;
if ((r = r600_bc_build(&bc))) {
r600_bc_clear(&bc);
return r;
@@ -2218,6 +2210,15 @@ int r600_vertex_elements_build_fetch_shader(struct 
r600_pipe_context *rctx, stru
fprintf(stderr, 
"__\n");
}
 
+   ve->fs_size = bc.ndw*4;
+
+   /* use PIPE_BIND_VERTEX_BUFFER so we use the cache buffer manager */
+   ve->fetch_shader = r600_bo(rctx->radeon, ve->fs_size, 256, 
PIPE_BIND_VERTEX_BUFFER, 0);
+   if (ve->fetch_shader == NULL) {
+   r600_bc_clear(&bc);
+   return -ENOMEM;
+   }
+
bytecode = r600_bo_map(rctx->radeon, ve->fetch_shader, 0, NULL);
if (bytecode == NULL) {
r600_bc_clear(&bc);

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


Mesa (master): glsl: Process redeclarations before initializers

2011-03-04 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 09a4ba0fc31fa8fc193dfb7b4fd78e32722b8312
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=09a4ba0fc31fa8fc193dfb7b4fd78e32722b8312

Author: Ian Romanick 
Date:   Fri Mar  4 16:15:20 2011 -0800

glsl: Process redeclarations before initializers

If an array redeclaration includes an initializer, the initializer
would previously be dropped on the floor.  Instead, directly apply the
initializer to the correct ir_variable instance and append the
generated instructions.

Fixes bugzilla #34374 and piglit tests glsl-{vs,fs}-array-redeclaration.

NOTE: This is a candidate for stable release branches.  0292ffb8 and
8e6cb9fe are also necessary.

---

 src/glsl/ast_to_hir.cpp |   87 ---
 1 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 0074ed2..651fae8 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2693,8 +2693,11 @@ ast_declarator_list::hir(exec_list *instructions,
* instruction stream.
*/
   exec_list initializer_instructions;
+  ir_variable *earlier = get_variable_being_redeclared(var, decl, state);
+
   if (decl->initializer != NULL) {
-result = process_initializer(var, decl, this->type,
+result = process_initializer((earlier == NULL) ? var : earlier,
+ decl, this->type,
  &initializer_instructions, state);
   }
 
@@ -2710,52 +2713,50 @@ ast_declarator_list::hir(exec_list *instructions,
  decl->identifier);
   }
 
-  ir_variable *earlier = get_variable_being_redeclared(var, decl, state);
-  if (earlier != NULL) {
-continue;
-  }
-
-  /* By now, we know it's a new variable declaration (we didn't hit the
-   * above "continue").
-   *
-   * From page 15 (page 21 of the PDF) of the GLSL 1.10 spec,
-   *
-   *   "Identifiers starting with "gl_" are reserved for use by
-   *   OpenGL, and may not be declared in a shader as either a
-   *   variable or a function."
+  /* If the declaration is not a redeclaration, there are a few additional
+   * semantic checks that must be applied.  In addition, variable that was
+   * created for the declaration should be added to the IR stream.
*/
-  if (strncmp(decl->identifier, "gl_", 3) == 0)
-_mesa_glsl_error(& loc, state,
- "identifier `%s' uses reserved `gl_' prefix",
- decl->identifier);
+  if (earlier == NULL) {
+/* From page 15 (page 21 of the PDF) of the GLSL 1.10 spec,
+ *
+ *   "Identifiers starting with "gl_" are reserved for use by
+ *   OpenGL, and may not be declared in a shader as either a
+ *   variable or a function."
+ */
+if (strncmp(decl->identifier, "gl_", 3) == 0)
+   _mesa_glsl_error(& loc, state,
+"identifier `%s' uses reserved `gl_' prefix",
+decl->identifier);
 
-  /* Add the variable to the symbol table.  Note that the initializer's
-   * IR was already processed earlier (though it hasn't been emitted yet),
-   * without the variable in scope.
-   *
-   * This differs from most C-like languages, but it follows the GLSL
-   * specification.  From page 28 (page 34 of the PDF) of the GLSL 1.50
-   * spec:
-   *
-   * "Within a declaration, the scope of a name starts immediately
-   * after the initializer if present or immediately after the name
-   * being declared if not."
-   */
-  if (!state->symbols->add_variable(var)) {
-YYLTYPE loc = this->get_location();
-_mesa_glsl_error(&loc, state, "name `%s' already taken in the "
- "current scope", decl->identifier);
-continue;
+/* Add the variable to the symbol table.  Note that the initializer's
+ * IR was already processed earlier (though it hasn't been emitted
+ * yet), without the variable in scope.
+ *
+ * This differs from most C-like languages, but it follows the GLSL
+ * specification.  From page 28 (page 34 of the PDF) of the GLSL 1.50
+ * spec:
+ *
+ * "Within a declaration, the scope of a name starts immediately
+ * after the initializer if present or immediately after the name
+ * being declared if not."
+ */
+if (!state->symbols->add_variable(var)) {
+   YYLTYPE loc = this->get_location();
+   _mesa_glsl_error(&loc, state, "name `%s' already taken in the "
+"current scope", decl->identifier);
+   continue;
+}
+
+/* Push the variable declaration to the top.  It means that all the
+ * variable declarations will appear in a f

Mesa (master): glsl: Refactor AST-to-HIR code handling variable initializers

2011-03-04 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 0292ffb85c03e9fa15b9395e3875109dd8979292
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0292ffb85c03e9fa15b9395e3875109dd8979292

Author: Ian Romanick 
Date:   Fri Mar  4 15:29:33 2011 -0800

glsl: Refactor AST-to-HIR code handling variable initializers

---

 src/glsl/ast_to_hir.cpp |  233 +--
 1 files changed, 125 insertions(+), 108 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 8864279..0074ed2 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2187,6 +2187,129 @@ get_variable_being_redeclared(ir_variable *var, 
ast_declaration *decl,
return earlier;
 }
 
+/**
+ * Generate the IR for an initializer in a variable declaration
+ */
+ir_rvalue *
+process_initializer(ir_variable *var, ast_declaration *decl,
+   ast_fully_specified_type *type,
+   exec_list *initializer_instructions,
+   struct _mesa_glsl_parse_state *state)
+{
+   ir_rvalue *result = NULL;
+
+   YYLTYPE initializer_loc = decl->initializer->get_location();
+
+   /* From page 24 (page 30 of the PDF) of the GLSL 1.10 spec:
+*
+*"All uniform variables are read-only and are initialized either
+*directly by an application via API commands, or indirectly by
+*OpenGL."
+*/
+   if ((state->language_version <= 110)
+   && (var->mode == ir_var_uniform)) {
+  _mesa_glsl_error(& initializer_loc, state,
+  "cannot initialize uniforms in GLSL 1.10");
+   }
+
+   if (var->type->is_sampler()) {
+  _mesa_glsl_error(& initializer_loc, state,
+  "cannot initialize samplers");
+   }
+
+   if ((var->mode == ir_var_in) && (state->current_function == NULL)) {
+  _mesa_glsl_error(& initializer_loc, state,
+  "cannot initialize %s shader input / %s",
+  _mesa_glsl_shader_target_name(state->target),
+  (state->target == vertex_shader)
+  ? "attribute" : "varying");
+   }
+
+   ir_dereference *const lhs = new(state) ir_dereference_variable(var);
+   ir_rvalue *rhs = decl->initializer->hir(initializer_instructions,
+  state);
+
+   /* Calculate the constant value if this is a const or uniform
+* declaration.
+*/
+   if (type->qualifier.flags.q.constant
+   || type->qualifier.flags.q.uniform) {
+  ir_rvalue *new_rhs = validate_assignment(state, var->type, rhs);
+  if (new_rhs != NULL) {
+rhs = new_rhs;
+
+ir_constant *constant_value = rhs->constant_expression_value();
+if (!constant_value) {
+   _mesa_glsl_error(& initializer_loc, state,
+"initializer of %s variable `%s' must be a "
+"constant expression",
+(type->qualifier.flags.q.constant)
+? "const" : "uniform",
+decl->identifier);
+   if (var->type->is_numeric()) {
+  /* Reduce cascading errors. */
+  var->constant_value = ir_constant::zero(state, var->type);
+   }
+} else {
+   rhs = constant_value;
+   var->constant_value = constant_value;
+}
+  } else {
+_mesa_glsl_error(&initializer_loc, state,
+ "initializer of type %s cannot be assigned to "
+ "variable of type %s",
+ rhs->type->name, var->type->name);
+if (var->type->is_numeric()) {
+   /* Reduce cascading errors. */
+   var->constant_value = ir_constant::zero(state, var->type);
+}
+  }
+   }
+
+   if (rhs && !rhs->type->is_error()) {
+  bool temp = var->read_only;
+  if (type->qualifier.flags.q.constant)
+var->read_only = false;
+
+  /* Never emit code to initialize a uniform.
+   */
+  const glsl_type *initializer_type;
+  if (!type->qualifier.flags.q.uniform) {
+result = do_assignment(initializer_instructions, state,
+   lhs, rhs,
+   type->get_location());
+initializer_type = result->type;
+  } else
+initializer_type = rhs->type;
+
+  /* If the declared variable is an unsized array, it must inherrit
+   * its full type from the initializer.  A declaration such as
+   *
+   * uniform float a[] = float[](1.0, 2.0, 3.0, 3.0);
+   *
+   * becomes
+   *
+   * uniform float a[4] = float[](1.0, 2.0, 3.0, 3.0);
+   *
+   * The assignment generated in the if-statement (below) will also
+   * automatically handle this case for non-uniforms.
+   *
+   * If the declared variable is not an array, the types must
+   * already match exactly.  As a result, the type assignment
+   * here can be done unconditionally. 

Mesa (master): glsl: Refactor AST-to-HIR code handling variable redeclarations

2011-03-04 Thread Ian Romanick
Module: Mesa
Branch: master
Commit: 8e6cb9fe51a2237e51b47198eb7d46b14ad288b5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e6cb9fe51a2237e51b47198eb7d46b14ad288b5

Author: Ian Romanick 
Date:   Fri Mar  4 15:28:40 2011 -0800

glsl: Refactor AST-to-HIR code handling variable redeclarations

---

 src/glsl/ast_to_hir.cpp |  246 +--
 1 files changed, 133 insertions(+), 113 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index fd1f0b4..8864279 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2055,6 +2055,137 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
}
 }
 
+/**
+ * Get the variable that is being redeclared by this declaration
+ *
+ * Semantic checks to verify the validity of the redeclaration are also
+ * performed.  If semantic checks fail, compilation error will be emitted via
+ * \c _mesa_glsl_error, but a non-\c NULL pointer will still be returned.
+ *
+ * \returns
+ * A pointer to an existing variable in the current scope if the declaration
+ * is a redeclaration, \c NULL otherwise.
+ */
+ir_variable *
+get_variable_being_redeclared(ir_variable *var, ast_declaration *decl,
+ struct _mesa_glsl_parse_state *state)
+{
+   /* Check if this declaration is actually a re-declaration, either to
+* resize an array or add qualifiers to an existing variable.
+*
+* This is allowed for variables in the current scope, or when at
+* global scope (for built-ins in the implicit outer scope).
+*/
+   ir_variable *earlier = state->symbols->get_variable(decl->identifier);
+   if (earlier == NULL ||
+   (state->current_function != NULL &&
+   !state->symbols->name_declared_this_scope(decl->identifier))) {
+  return NULL;
+   }
+
+
+   YYLTYPE loc = decl->get_location();
+
+   /* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec,
+*
+* "It is legal to declare an array without a size and then
+*  later re-declare the same name as an array of the same
+*  type and specify a size."
+*/
+   if ((earlier->type->array_size() == 0)
+   && var->type->is_array()
+   && (var->type->element_type() == earlier->type->element_type())) {
+  /* FINISHME: This doesn't match the qualifiers on the two
+   * FINISHME: declarations.  It's not 100% clear whether this is
+   * FINISHME: required or not.
+   */
+
+  /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
+   *
+   * "The size [of gl_TexCoord] can be at most
+   * gl_MaxTextureCoords."
+   */
+  const unsigned size = unsigned(var->type->array_size());
+  if ((strcmp("gl_TexCoord", var->name) == 0)
+ && (size > state->Const.MaxTextureCoords)) {
+_mesa_glsl_error(& loc, state, "`gl_TexCoord' array size cannot "
+ "be larger than gl_MaxTextureCoords (%u)\n",
+ state->Const.MaxTextureCoords);
+  } else if ((size > 0) && (size <= earlier->max_array_access)) {
+_mesa_glsl_error(& loc, state, "array size must be > %u due to "
+ "previous access",
+ earlier->max_array_access);
+  }
+
+  earlier->type = var->type;
+  delete var;
+  var = NULL;
+   } else if (state->ARB_fragment_coord_conventions_enable
+ && strcmp(var->name, "gl_FragCoord") == 0
+ && earlier->type == var->type
+ && earlier->mode == var->mode) {
+  /* Allow redeclaration of gl_FragCoord for ARB_fcc layout
+   * qualifiers.
+   */
+  earlier->origin_upper_left = var->origin_upper_left;
+  earlier->pixel_center_integer = var->pixel_center_integer;
+
+  /* According to section 4.3.7 of the GLSL 1.30 spec,
+   * the following built-in varaibles can be redeclared with an
+   * interpolation qualifier:
+   ** gl_FrontColor
+   ** gl_BackColor
+   ** gl_FrontSecondaryColor
+   ** gl_BackSecondaryColor
+   ** gl_Color
+   ** gl_SecondaryColor
+   */
+   } else if (state->language_version >= 130
+ && (strcmp(var->name, "gl_FrontColor") == 0
+ || strcmp(var->name, "gl_BackColor") == 0
+ || strcmp(var->name, "gl_FrontSecondaryColor") == 0
+ || strcmp(var->name, "gl_BackSecondaryColor") == 0
+ || strcmp(var->name, "gl_Color") == 0
+ || strcmp(var->name, "gl_SecondaryColor") == 0)
+ && earlier->type == var->type
+ && earlier->mode == var->mode) {
+  earlier->interpolation = var->interpolation;
+
+  /* Layout qualifiers for gl_FragDepth. */
+   } else if (state->AMD_conservative_depth_enable
+ && strcmp(var->name, "gl_FragDepth") == 0
+ && earlier->type == var->type
+ && earlier->mode == var->mode) {
+
+  /** From the AMD_conservative_

Mesa (master): nv50,nvc0: get format desc for TIC entry from sampler view format

2011-03-04 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: b0698396dcc70f6c8a16090dfb1674996538db3a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b0698396dcc70f6c8a16090dfb1674996538db3a

Author: Christoph Bumiller 
Date:   Fri Mar  4 22:17:36 2011 +0100

nv50,nvc0: get format desc for TIC entry from sampler view format

Fixes piglit/tex-srgb.

---

 src/gallium/drivers/nv50/nv50_tex.c |2 +-
 src/gallium/drivers/nvc0/nvc0_tex.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_tex.c 
b/src/gallium/drivers/nv50/nv50_tex.c
index e9d6e5f..9192d2e 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -79,7 +79,7 @@ nv50_create_sampler_view(struct pipe_context *pipe,
 
tic = &view->tic[0];
 
-   desc = util_format_description(mt->base.base.format);
+   desc = util_format_description(view->pipe.format);
 
/* TIC[0] */
 
diff --git a/src/gallium/drivers/nvc0/nvc0_tex.c 
b/src/gallium/drivers/nvc0/nvc0_tex.c
index a6f393d..24850b1 100644
--- a/src/gallium/drivers/nvc0/nvc0_tex.c
+++ b/src/gallium/drivers/nvc0/nvc0_tex.c
@@ -78,7 +78,7 @@ nvc0_create_sampler_view(struct pipe_context *pipe,
 
tic = &view->tic[0];
 
-   desc = util_format_description(mt->base.base.format);
+   desc = util_format_description(view->pipe.format);
 
/* TIC[0] */
 

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


Mesa (master): nv50,nvc0: share sampler state creation

2011-03-04 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 1f5d6fc59bd899e211c70026eb74cd2219858008
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f5d6fc59bd899e211c70026eb74cd2219858008

Author: Christoph Bumiller 
Date:   Fri Mar  4 22:15:17 2011 +0100

nv50,nvc0: share sampler state creation

---

 src/gallium/drivers/nv50/nv50_state.c|2 +-
 src/gallium/drivers/nv50/nv50_stateobj.h |   25 +--
 src/gallium/drivers/nv50/nv50_stateobj_tex.h |   34 +
 src/gallium/drivers/nv50/nv50_tex.c  |1 +
 src/gallium/drivers/nvc0/nvc0_context.h  |2 +-
 src/gallium/drivers/nvc0/nvc0_screen.c   |4 +-
 src/gallium/drivers/nvc0/nvc0_screen.h   |8 +-
 src/gallium/drivers/nvc0/nvc0_state.c|  100 ++---
 src/gallium/drivers/nvc0/nvc0_stateobj.h |   25 +--
 src/gallium/drivers/nvc0/nvc0_tex.c  |9 ++-
 10 files changed, 60 insertions(+), 150 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_state.c 
b/src/gallium/drivers/nv50/nv50_state.c
index 3d6423b..980bc36 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -380,7 +380,7 @@ nv50_tsc_wrap_mode(unsigned wrap)
}
 }
 
-static void *
+void *
 nv50_sampler_state_create(struct pipe_context *pipe,
   const struct pipe_sampler_state *cso)
 {
diff --git a/src/gallium/drivers/nv50/nv50_stateobj.h 
b/src/gallium/drivers/nv50/nv50_stateobj.h
index f4e458b..cf5b92e 100644
--- a/src/gallium/drivers/nv50/nv50_stateobj.h
+++ b/src/gallium/drivers/nv50/nv50_stateobj.h
@@ -16,35 +16,14 @@
 
 #define SB_DATA(so, u) (so)->state[(so)->size++] = (u)
 
+#include "nv50_stateobj_tex.h"
+
 struct nv50_blend_stateobj {
struct pipe_blend_state pipe;
int size;
uint32_t state[78];
 };
 
-struct nv50_tsc_entry {
-   int id;
-   uint32_t tsc[8];
-};
-
-static INLINE struct nv50_tsc_entry *
-nv50_tsc_entry(void *hwcso)
-{
-   return (struct nv50_tsc_entry *)hwcso;
-}
-
-struct nv50_tic_entry {
-   struct pipe_sampler_view pipe;
-   int id;
-   uint32_t tic[8];
-};
-
-static INLINE struct nv50_tic_entry *
-nv50_tic_entry(struct pipe_sampler_view *view)
-{
-   return (struct nv50_tic_entry *)view;
-}
-
 struct nv50_rasterizer_stateobj {
struct pipe_rasterizer_state pipe;
int size;
diff --git a/src/gallium/drivers/nv50/nv50_stateobj_tex.h 
b/src/gallium/drivers/nv50/nv50_stateobj_tex.h
new file mode 100644
index 000..99548cb
--- /dev/null
+++ b/src/gallium/drivers/nv50/nv50_stateobj_tex.h
@@ -0,0 +1,34 @@
+
+#ifndef __NV50_STATEOBJ_TEX_H__
+#define __NV50_STATEOBJ_TEX_H__
+
+#include "pipe/p_state.h"
+
+struct nv50_tsc_entry {
+   int id;
+   uint32_t tsc[8];
+};
+
+static INLINE struct nv50_tsc_entry *
+nv50_tsc_entry(void *hwcso)
+{
+   return (struct nv50_tsc_entry *)hwcso;
+}
+
+struct nv50_tic_entry {
+   struct pipe_sampler_view pipe;
+   int id;
+   uint32_t tic[8];
+};
+
+static INLINE struct nv50_tic_entry *
+nv50_tic_entry(struct pipe_sampler_view *view)
+{
+   return (struct nv50_tic_entry *)view;
+}
+
+extern void *
+nv50_sampler_state_create(struct pipe_context *,
+  const struct pipe_sampler_state *);
+
+#endif /* __NV50_STATEOBJ_TEX_H__ */
diff --git a/src/gallium/drivers/nv50/nv50_tex.c 
b/src/gallium/drivers/nv50/nv50_tex.c
index cb1f262..e9d6e5f 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -148,6 +148,7 @@ nv50_create_sampler_view(struct pipe_context *pipe,
   break;
case PIPE_BUFFER:
   tic[2] |= NV50_TIC_2_TARGET_BUFFER | NV50_TIC_2_LINEAR;
+  break;
default:
   NOUVEAU_ERR("invalid texture target: %d\n", mt->base.base.target);
   return FALSE;
diff --git a/src/gallium/drivers/nvc0/nvc0_context.h 
b/src/gallium/drivers/nvc0/nvc0_context.h
index 114e664..67c5a12 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nvc0/nvc0_context.h
@@ -112,7 +112,7 @@ struct nvc0_context {
 
struct pipe_sampler_view *textures[5][PIPE_MAX_SAMPLERS];
unsigned num_textures[5];
-   struct nvc0_tsc_entry *samplers[5][PIPE_MAX_SAMPLERS];
+   struct nv50_tsc_entry *samplers[5][PIPE_MAX_SAMPLERS];
unsigned num_samplers[5];
 
struct pipe_framebuffer_state framebuffer;
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index bf4e796..d430be9 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -651,7 +651,7 @@ nvc0_screen_tic_alloc(struct nvc0_screen *screen, void 
*entry)
screen->tic.next = (i + 1) & (NVC0_TIC_MAX_ENTRIES - 1);
 
if (screen->tic.entries[i])
-  nvc0_tic_entry(screen->tic.entries[i])->id = -1;
+  nv50_tic_entry(screen->tic.entries[i])->id = -1;
 
screen->tic.entries[i] = entry;
return i;
@@ -668,7 +668,7 @@ nvc0_screen_tsc_alloc(struct nvc0_screen *screen, void 
*entry)
screen->tsc.next = (i + 1) & (NVC0_TSC_MAX_ENTRIES - 1);
 
if (screen

Mesa (master): nv50,nvc0: update the format tables

2011-03-04 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: e4c968cdbbdc020afbf869d12b536c0a0dbf9de8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e4c968cdbbdc020afbf869d12b536c0a0dbf9de8

Author: Christoph Bumiller 
Date:   Fri Mar  4 23:54:42 2011 +0100

nv50,nvc0: update the format tables

Removed sampler view support for USCALED/SSCALED, the texture unit
refuses to convert to non-normalized float. The enums are treated
like UNORM.

Removed duplicate format related headers.

---

 src/gallium/drivers/nv50/nv50_formats.c |  178 +-
 src/gallium/drivers/nv50/nv50_tex.c |   23 ++-
 src/gallium/drivers/nv50/nv50_texture.xml.h |   60 --
 src/gallium/drivers/nvc0/nv50_defs.xml.h|  142 --
 src/gallium/drivers/nvc0/nv50_texture.xml.h |  259 
 src/gallium/drivers/nvc0/nvc0_formats.c |  283 ---
 src/gallium/drivers/nvc0/nvc0_state.c   |2 +-
 src/gallium/drivers/nvc0/nvc0_surface.c |2 +-
 src/gallium/drivers/nvc0/nvc0_tex.c |   25 ++-
 src/gallium/drivers/nvc0/nvc0_transfer.c|2 +-
 10 files changed, 335 insertions(+), 641 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=e4c968cdbbdc020afbf869d12b536c0a0dbf9de8
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nvc0: use m2mf for resource_copy_region if formats are equal

2011-03-04 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: f556b897eb5a41116529bec24d47f70a0c46789f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f556b897eb5a41116529bec24d47f70a0c46789f

Author: Christoph Bumiller 
Date:   Fri Mar  4 18:17:05 2011 +0100

nvc0: use m2mf for resource_copy_region if formats are equal

Which is always the case, but we'll keep the 2D engine blitter
nonetheless.

---

 src/gallium/drivers/nvc0/nvc0_surface.c  |   71 -
 src/gallium/drivers/nvc0/nvc0_transfer.c |2 +-
 src/gallium/drivers/nvc0/nvc0_transfer.h |6 +++
 3 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c 
b/src/gallium/drivers/nvc0/nvc0_surface.c
index 67991a0..2801e3b 100644
--- a/src/gallium/drivers/nvc0/nvc0_surface.c
+++ b/src/gallium/drivers/nvc0/nvc0_surface.c
@@ -30,6 +30,7 @@
 
 #include "nvc0_context.h"
 #include "nvc0_resource.h"
+#include "nvc0_transfer.h"
 
 #include "nv50_defs.xml.h"
 
@@ -186,6 +187,43 @@ nvc0_2d_texture_do_copy(struct nouveau_channel *chan,
 }
 
 static void
+nvc0_setup_m2mf_rect(struct nvc0_m2mf_rect *rect,
+ struct pipe_resource *restrict res, unsigned l,
+ unsigned x, unsigned y, unsigned z)
+{
+   struct nvc0_miptree *mt = nvc0_miptree(res);
+   const unsigned w = u_minify(res->width0, l);
+   const unsigned h = u_minify(res->height0, l);
+
+   rect->bo = mt->base.bo;
+   rect->domain = mt->base.domain;
+   rect->base = mt->level[l].offset;
+   rect->pitch = mt->level[l].pitch;
+   if (util_format_is_plain(res->format)) {
+  rect->width = w;
+  rect->height = h;
+  rect->x = x;
+  rect->y = y;
+   } else {
+  rect->width = util_format_get_nblocksx(res->format, w);
+  rect->height = util_format_get_nblocksy(res->format, h);
+  rect->x = util_format_get_nblocksx(res->format, x);
+  rect->y = util_format_get_nblocksy(res->format, y);
+   }
+   rect->tile_mode = mt->level[l].tile_mode;
+   rect->cpp = util_format_get_blocksize(res->format);
+
+   if (mt->layout_3d) {
+  rect->z = z;
+  rect->depth = u_minify(res->depth0, l);
+   } else {
+  rect->base += z * mt->layer_stride;
+  rect->z = 0;
+  rect->depth = 1;
+   }
+}
+
+static void
 nvc0_resource_copy_region(struct pipe_context *pipe,
   struct pipe_resource *dst, unsigned dst_level,
   unsigned dstx, unsigned dsty, unsigned dstz,
@@ -196,9 +234,36 @@ nvc0_resource_copy_region(struct pipe_context *pipe,
int ret;
unsigned dst_layer = dstz, src_layer = src_box->z;
 
-   assert((src->format == dst->format) ||
-  (nvc0_2d_format_faithful(src->format) &&
-   nvc0_2d_format_faithful(dst->format)));
+   nv04_resource(dst)->status |= NOUVEAU_BUFFER_STATUS_GPU_WRITING;
+
+   if (src->format == dst->format) {
+  struct nvc0_m2mf_rect drect, srect;
+  unsigned i;
+  unsigned nx = util_format_get_nblocksx(src->format, src_box->width);
+  unsigned ny = util_format_get_nblocksx(src->format, src_box->height);
+
+  nvc0_setup_m2mf_rect(&drect, dst, dst_level, dstx, dsty, dstz);
+  nvc0_setup_m2mf_rect(&srect, src, src_level,
+   src_box->x, src_box->y, src_box->z);
+
+  for (i = 0; i < src_box->depth; ++i) {
+ nvc0_m2mf_transfer_rect(&screen->base.base, &drect, &srect, nx, ny);
+
+ if (nvc0_miptree(dst)->layout_3d)
+drect.z++;
+ else
+drect.base += nvc0_miptree(dst)->layer_stride;
+
+ if (nvc0_miptree(src)->layout_3d)
+srect.z++;
+ else
+srect.base += nvc0_miptree(src)->layer_stride;
+  }
+  return;
+   }
+
+   assert(nvc0_2d_format_faithful(src->format));
+   assert(nvc0_2d_format_faithful(dst->format));
 
for (; dst_layer < dstz + src_box->depth; ++dst_layer, ++src_layer) {
   ret = nvc0_2d_texture_do_copy(screen->base.channel,
diff --git a/src/gallium/drivers/nvc0/nvc0_transfer.c 
b/src/gallium/drivers/nvc0/nvc0_transfer.c
index bc64266..f781fbc 100644
--- a/src/gallium/drivers/nvc0/nvc0_transfer.c
+++ b/src/gallium/drivers/nvc0/nvc0_transfer.c
@@ -14,7 +14,7 @@ struct nvc0_transfer {
uint16_t nlayers;
 };
 
-static void
+void
 nvc0_m2mf_transfer_rect(struct pipe_screen *pscreen,
 const struct nvc0_m2mf_rect *dst,
 const struct nvc0_m2mf_rect *src,
diff --git a/src/gallium/drivers/nvc0/nvc0_transfer.h 
b/src/gallium/drivers/nvc0/nvc0_transfer.h
index 222f72d..803ee34 100644
--- a/src/gallium/drivers/nvc0/nvc0_transfer.h
+++ b/src/gallium/drivers/nvc0/nvc0_transfer.h
@@ -35,4 +35,10 @@ struct nvc0_m2mf_rect {
uint16_t cpp;
 };
 
+void
+nvc0_m2mf_transfer_rect(struct pipe_screen *pscreen,
+const struct nvc0_m2mf_rect *dst,
+const struct nvc0_m2mf_rect *src,
+uint32_t nblocksx, uint32_t nblocksy);
+
 #endif

_

Mesa (master): nv50,nvc0: fix texture layer issues

2011-03-04 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 4fae7da9a3a3849ca08ffc6fcbdccc6a9c065ad2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4fae7da9a3a3849ca08ffc6fcbdccc6a9c065ad2

Author: Christoph Bumiller 
Date:   Sat Mar  5 00:05:14 2011 +0100

nv50,nvc0: fix texture layer issues

---

 src/gallium/drivers/nv50/nv50_tex.c|   14 +++--
 src/gallium/drivers/nvc0/nvc0_3d.xml.h |   20 +---
 src/gallium/drivers/nvc0/nvc0_miptree.c|   39 ++--
 src/gallium/drivers/nvc0/nvc0_resource.h   |3 ++
 src/gallium/drivers/nvc0/nvc0_screen.c |2 +-
 src/gallium/drivers/nvc0/nvc0_state_validate.c |   10 --
 src/gallium/drivers/nvc0/nvc0_stateobj.h   |2 +-
 src/gallium/drivers/nvc0/nvc0_surface.c|   27 +++-
 src/gallium/drivers/nvc0/nvc0_tex.c|   15 +++--
 src/gallium/drivers/nvc0/nvc0_transfer.c   |   22 +++--
 10 files changed, 89 insertions(+), 65 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_tex.c 
b/src/gallium/drivers/nv50/nv50_tex.c
index 4456553..d9bb3aa 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -90,7 +90,7 @@ nv50_create_sampler_view(struct pipe_context *pipe,
   (swz[2] << NV50_TIC_0_MAPB__SHIFT) |
   (swz[3] << NV50_TIC_0_MAPA__SHIFT);
 
-   /* tic[1] = mt->base.bo->offset; */
+   tic[1] = /* mt->base.bo->offset; */ 0;
tic[2] = /* mt->base.bo->offset >> 32 */ 0;
 
tic[2] |= 0x10001000 | /* NV50_TIC_2_NO_BORDER */ 0x4000;
@@ -107,6 +107,12 @@ nv50_create_sampler_view(struct pipe_context *pipe,
 
depth = MAX2(mt->base.base.array_size, mt->base.base.depth0);
 
+   if (mt->base.base.target == PIPE_TEXTURE_1D_ARRAY ||
+   mt->base.base.target == PIPE_TEXTURE_2D_ARRAY) {
+  tic[1] = view->pipe.u.tex.first_layer * mt->layer_stride;
+  depth = view->pipe.u.tex.last_layer - view->pipe.u.tex.first_layer + 1;
+   }
+
switch (mt->base.base.target) {
case PIPE_TEXTURE_1D:
   tic[2] |= NV50_TIC_2_TARGET_1D;
@@ -178,6 +184,8 @@ nv50_validate_tic(struct nv50_context *nv50, int s)
   res = &nv50_miptree(tic->pipe.texture)->base;
 
   if (tic->id < 0) {
+ uint32_t offset = tic->tic[1];
+
  tic->id = nv50_screen_tic_alloc(nv50->screen, tic);
 
  MARK_RING (chan, 24 + 8, 4);
@@ -206,8 +214,8 @@ nv50_validate_tic(struct nv50_context *nv50, int s)
  OUT_RING  (chan, 0);
  BEGIN_RING_NI(chan, RING_2D(SIFC_DATA), 8);
  OUT_RING  (chan, tic->tic[0]);
- OUT_RELOCl(chan, res->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
- OUT_RELOC (chan, res->bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
+ OUT_RELOCl(chan, res->bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
+ OUT_RELOC (chan, res->bo, offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD |
 NOUVEAU_BO_HIGH | NOUVEAU_BO_OR, tic->tic[2], tic->tic[2]);
  OUT_RINGp (chan, &tic->tic[3], 5);
 
diff --git a/src/gallium/drivers/nvc0/nvc0_3d.xml.h 
b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
index 73a605f..5857f7c 100644
--- a/src/gallium/drivers/nvc0/nvc0_3d.xml.h
+++ b/src/gallium/drivers/nvc0/nvc0_3d.xml.h
@@ -154,8 +154,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 
 #define NVC0_3D_LOCAL_SIZE_LOW 0x079c
 
-#define NVC0_3D_RT(i0)(0x0800 + 
0x20*(i0))
-#define NVC0_3D_RT__ESIZE  0x0020
+#define NVC0_3D_RT(i0)(0x0800 + 
0x40*(i0))
+#define NVC0_3D_RT__ESIZE  0x0040
 #define NVC0_3D_RT__LEN
0x0008
 
 #define NVC0_3D_RT_ADDRESS_HIGH(i0)   (0x0800 + 
0x40*(i0))
@@ -169,11 +169,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 #define NVC0_3D_RT_FORMAT(i0) (0x0810 + 
0x40*(i0))
 
 #define NVC0_3D_RT_TILE_MODE(i0)  (0x0814 + 
0x40*(i0))
-#define NVC0_3D_RT_TILE_MODE_UNK0  0x0001
+#define NVC0_3D_RT_TILE_MODE_X 0x0001
 #define NVC0_3D_RT_TILE_MODE_Y__MASK   0x0070
 #define NVC0_3D_RT_TILE_MODE_Y__SHIFT  4
 #define NVC0_3D_RT_TILE_MODE_Z__MASK   0x0700
 #define NVC0_3D_RT_TILE_MODE_Z__SHIFT  8
+#define NVC0_3D_RT_TILE_MODE_LINEAR0x1000
+#define NVC0_3D_RT_TILE_MODE_UNK16 0x0001
 
 #define NVC0_3D_RT_ARRAY_MODE(i0) (0x0818 + 
0x40*(i0))
 #define NVC0_3D_RT_ARRAY_MODE_LAYERS__MASK 0x
@@ -182,6 +184,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
 
 #define NVC0_3D_RT_LA

Mesa (master): i915g: Use tgsi_info from fragment shader instead

2011-03-04 Thread Jakob Bornecrantz
Module: Mesa
Branch: master
Commit: 9f0acfe1384d3236ac30ffca4be96e9531d2e876
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f0acfe1384d3236ac30ffca4be96e9531d2e876

Author: Jakob Bornecrantz 
Date:   Fri Mar  4 23:57:16 2011 +0100

i915g: Use tgsi_info from fragment shader instead

---

 src/gallium/drivers/i915/i915_fpc_translate.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c 
b/src/gallium/drivers/i915/i915_fpc_translate.c
index cd8219e..b145b58 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -1176,17 +1176,14 @@ i915_translate_fragment_program( struct i915_context 
*i915,
 {
struct i915_fp_compile *p;
const struct tgsi_token *tokens = fs->state.tokens;
-   struct tgsi_shader_info info;
 
 #if 0
tgsi_dump(tokens, 0);
 #endif
 
-   tgsi_scan_shader(tokens, &info);
-
/* hw doesn't seem to like empty frag programs, even when the depth write
 * fixup gets emitted below - may that one is fishy, too? */
-   if (info.num_instructions == 1) {
+   if (fs->info.num_instructions == 1) {
   i915_use_passthrough_shader(fs);
 
   return;

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


Mesa (master): i915g: use passthough shader for empty fragment programs

2011-03-04 Thread Daniel Vetter
Module: Mesa
Branch: master
Commit: 98b418e56e9592cb796f2f814b3c8b46238d05af
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=98b418e56e9592cb796f2f814b3c8b46238d05af

Author: Daniel Vetter 
Date:   Fri Mar  4 23:44:39 2011 +0100

i915g: use passthough shader for empty fragment programs

The hw doesn't like it - demos/shadowtex is broken. The emitted shader
isn't totally empty though, the depth write fixup gets emitted instead.
Maybe that one is somewhat fishy, too?

Idea for this patch from Jakob Bornecrantz.

Signed-off-by: Daniel Vetter 

---

 src/gallium/drivers/i915/i915_fpc_translate.c |   18 +++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c 
b/src/gallium/drivers/i915/i915_fpc_translate.c
index 9e20010..cd8219e 100644
--- a/src/gallium/drivers/i915/i915_fpc_translate.c
+++ b/src/gallium/drivers/i915/i915_fpc_translate.c
@@ -1174,15 +1174,27 @@ void
 i915_translate_fragment_program( struct i915_context *i915,
  struct i915_fragment_shader *fs)
 {
-   struct i915_fp_compile *p = i915_init_compile(i915, fs);
+   struct i915_fp_compile *p;
const struct tgsi_token *tokens = fs->state.tokens;
-
-   i915_find_wpos_space(p);
+   struct tgsi_shader_info info;
 
 #if 0
tgsi_dump(tokens, 0);
 #endif
 
+   tgsi_scan_shader(tokens, &info);
+
+   /* hw doesn't seem to like empty frag programs, even when the depth write
+* fixup gets emitted below - may that one is fishy, too? */
+   if (info.num_instructions == 1) {
+  i915_use_passthrough_shader(fs);
+
+  return;
+   }
+
+   p = i915_init_compile(i915, fs);
+   i915_find_wpos_space(p);
+
i915_translate_instructions(p, tokens);
i915_fixup_depth_write(p);
 

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


Mesa (master): egl/wayland: Move wayland-egl into a subdir

2011-03-04 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: e71920929e3933b007b0bd2358def91df1447eb3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e71920929e3933b007b0bd2358def91df1447eb3

Author: Benjamin Franzke 
Date:   Thu Mar  3 11:05:03 2011 +0100

egl/wayland: Move wayland-egl into a subdir

This hopefully fixes wayland-egl's dependency
resolution for autogenerated wayland-drm headers.

---

 src/egl/drivers/dri2/Makefile  |2 +-
 src/egl/wayland/Makefile   |   77 
 src/egl/wayland/wayland-egl/Makefile   |   71 ++
 .../wayland/{ => wayland-egl}/wayland-egl-priv.h   |0 
 src/egl/wayland/{ => wayland-egl}/wayland-egl.c|0 
 .../wayland/{ => wayland-egl}/wayland-egl.pc.in|0 
 src/gallium/state_trackers/egl/Makefile|2 +-
 7 files changed, 87 insertions(+), 65 deletions(-)

diff --git a/src/egl/drivers/dri2/Makefile b/src/egl/drivers/dri2/Makefile
index eac599e..4783975 100644
--- a/src/egl/drivers/dri2/Makefile
+++ b/src/egl/drivers/dri2/Makefile
@@ -27,7 +27,7 @@ endif
 ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
 EGL_SOURCES += platform_wayland.c
 EGL_INCLUDES += -DHAVE_WAYLAND_PLATFORM $(WAYLAND_CFLAGS) \
-   -I$(TOP)/src/egl/wayland \
+   -I$(TOP)/src/egl/wayland/wayland-egl \
-I$(TOP)/src/egl/wayland/wayland-drm
 EGL_LIBS += $(WAYLAND_LIBS) \
$(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
diff --git a/src/egl/wayland/Makefile b/src/egl/wayland/Makefile
index f484ff8..c38a130 100644
--- a/src/egl/wayland/Makefile
+++ b/src/egl/wayland/Makefile
@@ -3,62 +3,10 @@
 TOP = ../../..
 include $(TOP)/configs/current
 
-INCLUDE_DIRS = -I$(TOP)/include
+SUBDIRS = wayland-drm wayland-egl
 
-HEADERS = wayland-egl-priv.h
-SOURCES = wayland-egl.c
+default: subdirs
 
-OBJECTS = $(SOURCES:.c=.o)
-
-LOCAL_CFLAGS = -I$(TOP)/include/EGL \
-  -I$(TOP)/src/egl/wayland/wayland-drm \
-  $(LIBDRM_CFLAGS) \
-  $(WAYLAND_CFLAGS)
-
-LOCAL_LIBS =
-
-SUBDIRS = wayland-drm
-
-.c.o:
-   $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(LOCAL_CFLAGS) $< -o $@
-
-
-default: subdirs depend library
-
-# wayland-egl Library
-library: $(TOP)/$(LIB_DIR)/$(WAYLAND_EGL_LIB_NAME)
-
-$(TOP)/$(LIB_DIR)/$(WAYLAND_EGL_LIB_NAME): $(OBJECTS) $(LOCAL_LIBS)
-   $(MKLIB) -o $(WAYLAND_EGL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-   -install $(TOP)/$(LIB_DIR) $(MKLIB_OPTIONS) \
-   -L$(TOP)/$(LIB_DIR) $(WAYLAND_EGL_LIB_DEPS) \
-   $(OBJECTS) $(LOCAL_LIBS)
-
-PKG_CONFIG_DIR = $(INSTALL_LIB_DIR)/pkgconfig
-
-gl_pcedit = sed \
-   -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-   -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-   -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-   -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
-   -e 's,@WAYLAND_EGL_PC_REQ_PRIV@,$(WAYLAND_EGL_PC_REQ_PRIV),' \
-   -e 's,@WAYLAND_EGL_PC_LIB_PRIV@,$(WAYLAND_EGL_PC_LIB_PRIV),' \
-   -e 's,@WAYLAND_EGL_PC_CFLAGS@,$(WAYLAND_EGL_PC_CFLAGS),' \
-   -e 's,@WAYLAND_EGL_LIB@,$(WAYLAND_EGL_LIB),'
-
-wayland-egl.pc: wayland-egl.pc.in
-   $(gl_pcedit) $< > $@
-
-install: default wayland-egl.pc
-   $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
-   $(MINSTALL) $(TOP)/$(LIB_DIR)/$(WAYLAND_EGL_LIB_GLOB) \
-   $(DESTDIR)$(INSTALL_LIB_DIR)
-   $(INSTALL) -d $(DESTDIR)$(PKG_CONFIG_DIR)
-   $(INSTALL) -m 644 wayland-egl.pc $(DESTDIR)$(PKG_CONFIG_DIR)
-
-clean:
-   -rm -f *.o
-   -rm -f depend depend.bak
 
 subdirs:
@for dir in $(SUBDIRS) ; do \
@@ -67,13 +15,16 @@ subdirs:
fi \
done
 
-depend: $(SOURCES) $(HEADERS)
-   @ echo "running $(MKDEP)"
-   @ rm -f depend
-   @ touch depend
-   $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
-   $(SOURCES) $(HEADERS) > /dev/null 2>/dev/null
-
+install:
+   @for dir in $(SUBDIRS) ; do \
+   if [ -d $$dir ] ; then \
+   (cd $$dir && $(MAKE) install) || exit 1 ; \
+   fi \
+   done
 
--include depend
-# DO NOT DELETE
+clean:
+   -@for dir in $(SUBDIRS) ; do \
+   if [ -d $$dir ] ; then \
+   (cd $$dir && $(MAKE) clean) ; \
+   fi \
+   done
diff --git a/src/egl/wayland/wayland-egl/Makefile 
b/src/egl/wayland/wayland-egl/Makefile
new file mode 100644
index 000..b9d13dc
--- /dev/null
+++ b/src/egl/wayland/wayland-egl/Makefile
@@ -0,0 +1,71 @@
+# src/egl/wayland/wayland-egl/Makefile
+
+TOP = ../../../..
+include $(TOP)/configs/current
+
+INCLUDE_DIRS = -I$(TOP)/include \
+  -I$(TOP)/include/EGL \
+  -I$(TOP)/src/egl/wayland/wayland-drm
+
+
+HEADERS = wayland-egl-priv.h
+SOURCES = wayland-egl.c
+
+OBJECTS = $(SOURCES:.c=.o)
+
+LOCAL_CFLAGS = $(LIBDRM_CFLAGS) \
+  $(WAYLAND_CFLAGS)
+
+LOCAL_LIBS =
+
+.c.o:
+   $(CC) -c $(INCLU

Mesa (master): egl_dri2: Fix incompatible vfunc-pointer warning

2011-03-04 Thread Kristian Høgsberg
Module: Mesa
Branch: master
Commit: 22d9ae11bc436375a67752b90d8a5a273754d907
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=22d9ae11bc436375a67752b90d8a5a273754d907

Author: Benjamin Franzke 
Date:   Thu Mar  3 11:22:09 2011 +0100

egl_dri2: Fix incompatible vfunc-pointer warning

---

 src/egl/drivers/dri2/egl_dri2.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 5afd3d3..cb1de26 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -89,7 +89,7 @@ struct dri2_egl_display
struct wl_drm*wl_server_drm;
 #endif
 
-   int (*authenticate) (struct dri2_egl_display *dri_dpy, uint32_t id);
+   int (*authenticate) (_EGLDisplay *disp, uint32_t id);
 };
 
 struct dri2_egl_context

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


Mesa (master): i965: Apply a workaround for the Ironlake "vertex flashing".

2011-03-04 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 1a57717bbe8a2cedf2e1bb72cfd7ec85cd2350fc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a57717bbe8a2cedf2e1bb72cfd7ec85cd2350fc

Author: Eric Anholt 
Date:   Mon Feb 21 23:46:52 2011 -0800

i965: Apply a workaround for the Ironlake "vertex flashing".

This is an awful hack and will hurt performance on Ironlake, but we're
at a loss as to what's going wrong otherwise.  This is the only common
variable we've found that avoids the problem on 4 applications
(CelShading, gnome-shell, Pill Popper, and my GLSL demo), while other
variables we've tried appear to only be confounding.  Neither the
specifications nor the hardware team have been able to provide any
enlightenment, despite much searching.

https://bugs.freedesktop.org/show_bug.cgi?id=29172
Tested by:  Chris Lord  (Pill Popper)
Tested by:  Ryan Lortie  (gnome-shell)

---

 src/mesa/drivers/dri/i965/brw_vs_state.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c 
b/src/mesa/drivers/dri/i965/brw_vs_state.c
index be92313..c3a7cc2 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_state.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_state.c
@@ -96,7 +96,14 @@ vs_unit_create_from_key(struct brw_context *brw, struct 
brw_vs_unit_key *key)
 * and those dwords will be written to the second URB handle when we
 * brw_urb_WRITE() results.
 */
-   vs.thread1.single_program_flow = 0;
+   /* Disable single program flow on Ironlake.  We cannot reliably get
+* all applications working without it.  See:
+* https://bugs.freedesktop.org/show_bug.cgi?id=29172
+*
+* The most notable and reliably failing application is the Humus
+* demo "CelShading"
+   */
+   vs.thread1.single_program_flow = (intel->gen == 5);
 
if (intel->gen == 5)
   vs.thread1.binding_table_entry_count = 0; /* hardware requirement */

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


Mesa (master): r300g: preliminary implementation of clamping controls

2011-03-04 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: bdb811772fe1b11e32172b211d9935d37093c753
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bdb811772fe1b11e32172b211d9935d37093c753

Author: Marek Olšák 
Date:   Wed Feb 16 00:50:25 2011 +0100

r300g: preliminary implementation of clamping controls

---

 src/gallium/drivers/r300/r300_context.c   |3 +-
 src/gallium/drivers/r300/r300_context.h   |4 +-
 src/gallium/drivers/r300/r300_state.c |   17 +++--
 src/gallium/drivers/r300/r300_state_inlines.h |   31 +
 4 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c 
b/src/gallium/drivers/r300/r300_context.c
index a17be17..b8db6fb 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -201,7 +201,7 @@ static boolean r300_setup_atoms(struct r300_context* r300)
 /* SC. */
 R300_INIT_ATOM(scissor_state, 3);
 /* GB, FG, GA, SU, SC, RB3D. */
-R300_INIT_ATOM(invariant_state, 18 + (is_rv350 ? 4 : 0) + (is_r500 ? 4 : 
0));
+R300_INIT_ATOM(invariant_state, 16 + (is_rv350 ? 4 : 0) + (is_r500 ? 4 : 
0));
 /* VAP. */
 R300_INIT_ATOM(viewport_state, 9);
 R300_INIT_ATOM(pvs_flush, 2);
@@ -349,7 +349,6 @@ static void r300_init_states(struct pipe_context *pipe)
 BEGIN_CB(invariant->cb, r300->invariant_state.size);
 OUT_CB_REG(R300_GB_SELECT, 0);
 OUT_CB_REG(R300_FG_FOG_BLEND, 0);
-OUT_CB_REG(R300_GA_ROUND_MODE, 1);
 OUT_CB_REG(R300_GA_OFFSET, 0);
 OUT_CB_REG(R300_SU_TEX_WRAP, 0);
 OUT_CB_REG(R300_SU_DEPTH_SCALE, 0x4B7F);
diff --git a/src/gallium/drivers/r300/r300_context.h 
b/src/gallium/drivers/r300/r300_context.h
index 4469736..58e1094 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -136,7 +136,7 @@ struct r300_gpu_flush {
 uint32_t cb_flush_clean[6];
 };
 
-#define RS_STATE_MAIN_SIZE 23
+#define RS_STATE_MAIN_SIZE 25
 
 struct r300_rs_state {
 /* Original rasterizer state. */
@@ -235,7 +235,7 @@ struct r300_vertex_stream_state {
 };
 
 struct r300_invariant_state {
-uint32_t cb[26];
+uint32_t cb[24];
 };
 
 struct r300_vap_invariant_state {
diff --git a/src/gallium/drivers/r300/r300_state.c 
b/src/gallium/drivers/r300/r300_state.c
index 1878293..2b0c875 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -192,6 +192,7 @@ static void* r300_create_blend_state(struct pipe_context* 
pipe,
 uint32_t color_channel_mask = 0;  /* R300_RB3D_COLOR_CHANNEL_MASK: 0x4e0c 
*/
 uint32_t rop = 0; /* R300_RB3D_ROPCNTL: 0x4e18 */
 uint32_t dither = 0;  /* R300_RB3D_DITHER_CTL: 0x4e50 */
+boolean clamp = TRUE;
 CB_LOCALS;
 
 if (state->rt[0].blend_enable)
@@ -207,7 +208,7 @@ static void* r300_create_blend_state(struct pipe_context* 
pipe,
 /* despite the name, ALPHA_BLEND_ENABLE has nothing to do with alpha,
  * this is just the crappy D3D naming */
 blend_control = R300_ALPHA_BLEND_ENABLE |
-r300_translate_blend_function(eqRGB) |
+r300_translate_blend_function(eqRGB, clamp) |
 ( r300_translate_blend_factor(srcRGB) << R300_SRC_BLEND_SHIFT) |
 ( r300_translate_blend_factor(dstRGB) << R300_DST_BLEND_SHIFT);
 
@@ -268,7 +269,8 @@ static void* r300_create_blend_state(struct pipe_context* 
pipe,
  *
  * Equations other than ADD are rarely used and therefore won't be
  * optimized. */
-if ((eqRGB == PIPE_BLEND_ADD || eqRGB == PIPE_BLEND_REVERSE_SUBTRACT) 
&&
+if (clamp &&
+(eqRGB == PIPE_BLEND_ADD || eqRGB == PIPE_BLEND_REVERSE_SUBTRACT) 
&&
 (eqA == PIPE_BLEND_ADD || eqA == PIPE_BLEND_REVERSE_SUBTRACT)) {
 /* ADD: X+Y
  * REVERSE_SUBTRACT: Y-X
@@ -307,7 +309,7 @@ static void* r300_create_blend_state(struct pipe_context* 
pipe,
 if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) {
 blend_control |= R300_SEPARATE_ALPHA_ENABLE;
 alpha_blend_control =
-r300_translate_blend_function(eqA) |
+r300_translate_blend_function(eqA, clamp) |
 (r300_translate_blend_factor(srcA) << R300_SRC_BLEND_SHIFT) |
 (r300_translate_blend_factor(dstA) << R300_DST_BLEND_SHIFT);
 }
@@ -1014,12 +1016,14 @@ static void* r300_create_rs_state(struct pipe_context* 
pipe,
 uint32_t line_stipple_value;/* R300_GA_LINE_STIPPLE_VALUE: 0x4260 */
 uint32_t polygon_mode;  /* R300_GA_POLY_MODE: 0x4288 */
 uint32_t clip_rule; /* R300_SC_CLIP_RULE: 0x43D0 */
+uint32_t round_mode;/* R300_GA_ROUND_MODE: 0x428c */
 
 /* Point sprites texture coordinates, 0: lower left, 1: upper right */
 float point_texcoord_left = 0;  /* R300_GA_POINT_S0: 0x4200 */
 float point_texcoord

Mesa (master): r300g: implement FP16 alpha test

2011-03-04 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 10a893106be9dc4c843100468d8575b07ba6c4b9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=10a893106be9dc4c843100468d8575b07ba6c4b9

Author: Marek Olšák 
Date:   Fri Mar  4 17:28:44 2011 +0100

r300g: implement FP16 alpha test

---

 src/gallium/drivers/r300/r300_context.c |2 +-
 src/gallium/drivers/r300/r300_context.h |   17 ++-
 src/gallium/drivers/r300/r300_emit.c|   10 +++-
 src/gallium/drivers/r300/r300_state.c   |   34 +++---
 4 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c 
b/src/gallium/drivers/r300/r300_context.c
index 166d965..a17be17 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -194,7 +194,7 @@ static boolean r300_setup_atoms(struct r300_context* r300)
 /* ZB (unpipelined), SC. */
 R300_INIT_ATOM(ztop_state, 2);
 /* ZB, FG. */
-R300_INIT_ATOM(dsa_state, is_r500 ? 8 : 6);
+R300_INIT_ATOM(dsa_state, is_r500 ? (drm_2_6_0 ? 10 : 8) : 6);
 /* RB3D. */
 R300_INIT_ATOM(blend_state, 8);
 R300_INIT_ATOM(blend_color_state, is_r500 ? 3 : 2);
diff --git a/src/gallium/drivers/r300/r300_context.h 
b/src/gallium/drivers/r300/r300_context.h
index b0a67e0..4469736 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -92,9 +92,24 @@ struct r300_dsa_state {
 uint32_t stencil_ref_mask;  /* R300_ZB_STENCILREFMASK: 0x4f08 */
 uint32_t cb_reg;
 uint32_t stencil_ref_bf;/* R500_ZB_STENCILREFMASK_BF: 0x4fd4 */
+uint32_t cb_reg1;
+uint32_t alpha_value;   /* R500_FG_ALPHA_VALUE: 0x4be0 */
+
+/* The same, but for FP16 alpha test. */
+uint32_t cb_begin_fp16;
+uint32_t alpha_function_fp16;/* R300_FG_ALPHA_FUNC: 0x4bd4 */
+uint32_t cb_reg_seq_fp16;
+uint32_t z_buffer_control_fp16;  /* R300_ZB_CNTL: 0x4f00 */
+uint32_t z_stencil_control_fp16; /* R300_ZB_ZSTENCILCNTL: 0x4f04 */
+uint32_t stencil_ref_mask_fp16;  /* R300_ZB_STENCILREFMASK: 0x4f08 */
+uint32_t cb_reg_fp16;
+uint32_t stencil_ref_bf_fp16;/* R500_ZB_STENCILREFMASK_BF: 0x4fd4 */
+uint32_t cb_reg1_fp16;
+uint32_t alpha_value_fp16;   /* R500_FG_ALPHA_VALUE: 0x4be0 */
 
 /* The second command buffer disables zbuffer reads and writes. */
-uint32_t cb_no_readwrite[8];
+uint32_t cb_zb_no_readwrite[10];
+uint32_t cb_fp16_zb_no_readwrite[10];
 
 /* Whether a two-sided stencil is enabled. */
 boolean two_sided;
diff --git a/src/gallium/drivers/r300/r300_emit.c 
b/src/gallium/drivers/r300/r300_emit.c
index 24c82a3..e3945b7 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -77,9 +77,15 @@ void r300_emit_dsa_state(struct r300_context* r300, unsigned 
size, void* state)
 CS_LOCALS(r300);
 
 if (fb->zsbuf) {
-WRITE_CS_TABLE(&dsa->cb_begin, size);
+if (fb->nr_cbufs && fb->cbufs[0]->format == 
PIPE_FORMAT_R16G16B16A16_FLOAT)
+WRITE_CS_TABLE(&dsa->cb_begin_fp16, size);
+else
+WRITE_CS_TABLE(&dsa->cb_begin, size);
 } else {
-WRITE_CS_TABLE(dsa->cb_no_readwrite, size);
+if (fb->nr_cbufs && fb->cbufs[0]->format == 
PIPE_FORMAT_R16G16B16A16_FLOAT)
+WRITE_CS_TABLE(dsa->cb_fp16_zb_no_readwrite, size);
+else
+WRITE_CS_TABLE(dsa->cb_zb_no_readwrite, size);
 }
 }
 
diff --git a/src/gallium/drivers/r300/r300_state.c 
b/src/gallium/drivers/r300/r300_state.c
index 64fd713..1878293 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -580,29 +580,54 @@ static void*
 r300_translate_alpha_function(state->alpha.func) |
 R300_FG_ALPHA_FUNC_ENABLE;
 
-/* We could use 10bit alpha ref but who needs that? */
 dsa->alpha_function |= float_to_ubyte(state->alpha.ref_value);
+dsa->alpha_value = util_float_to_half(state->alpha.ref_value);
 
-if (caps->is_r500)
+if (caps->is_r500) {
+dsa->alpha_function_fp16 = dsa->alpha_function |
+   R500_FG_ALPHA_FUNC_FP16_ENABLE;
 dsa->alpha_function |= R500_FG_ALPHA_FUNC_8BIT;
+}
 }
 
-BEGIN_CB(&dsa->cb_begin, 8);
+BEGIN_CB(&dsa->cb_begin, 10);
 OUT_CB_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function);
 OUT_CB_REG_SEQ(R300_ZB_CNTL, 3);
 OUT_CB(dsa->z_buffer_control);
 OUT_CB(dsa->z_stencil_control);
 OUT_CB(dsa->stencil_ref_mask);
 OUT_CB_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf);
+OUT_CB_REG(R500_FG_ALPHA_VALUE, dsa->alpha_value);
+END_CB;
+
+BEGIN_CB(&dsa->cb_begin_fp16, 10);
+OUT_CB_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function_fp16);
+OUT_CB_REG_SEQ(R300_ZB_CNTL, 3);
+OUT_CB(dsa->z_buffer_control);
+OUT_CB(dsa->z_stencil_control);
+OUT_CB(dsa->stencil_ref_mask);
+OUT_CB_REG(R500_ZB

Mesa (master): r300g: implement blending for some of non-RGBA8 formats

2011-03-04 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 910bac63dfc5c6d9bf7162388c951784eba534f6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=910bac63dfc5c6d9bf7162388c951784eba534f6

Author: Marek Olšák 
Date:   Fri Mar  4 16:39:51 2011 +0100

r300g: implement blending for some of non-RGBA8 formats

Blending is now fully supported with:
- R8_UNORM
- R8G8_UNORM
- B8G8R8A8_UNORM
- R16G16B16A16_FLOAT (r500-only)

Blending is partially supported (DST_ALPHA not working) with:
- L8A8_UNORM
- I8_UNORM
- B5G5R5A1_UNORM
- B10G10R10A2_UNORM

The other formats can't do blending.

---

 src/gallium/drivers/r300/r300_context.h |1 +
 src/gallium/drivers/r300/r300_state.c   |   58 +++
 2 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.h 
b/src/gallium/drivers/r300/r300_context.h
index 6f2aab6..b0a67e0 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -70,6 +70,7 @@ struct r300_blend_state {
 };
 
 struct r300_blend_color_state {
+struct pipe_blend_color state;
 uint32_t cb[3];
 };
 
diff --git a/src/gallium/drivers/r300/r300_state.c 
b/src/gallium/drivers/r300/r300_state.c
index b810f40..64fd713 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -24,6 +24,7 @@
 #include "draw/draw_context.h"
 
 #include "util/u_framebuffer.h"
+#include "util/u_half.h"
 #include "util/u_math.h"
 #include "util/u_mm.h"
 #include "util/u_memory.h"
@@ -395,22 +396,64 @@ static void r300_set_blend_color(struct pipe_context* 
pipe,
  const struct pipe_blend_color* color)
 {
 struct r300_context* r300 = r300_context(pipe);
-struct r300_blend_color_state* state =
+struct pipe_framebuffer_state *fb = r300->fb_state.state;
+struct r300_blend_color_state *state =
 (struct r300_blend_color_state*)r300->blend_color_state.state;
+struct pipe_blend_color c;
+enum pipe_format format = fb->nr_cbufs ? fb->cbufs[0]->format : 0;
 CB_LOCALS;
 
+state->state = *color; /* Save it, so that we can reuse it in set_fb_state 
*/
+c = *color;
+
+/* The blend color is dependent on the colorbuffer format. */
+if (fb->nr_cbufs) {
+switch (format) {
+case PIPE_FORMAT_R8_UNORM:
+case PIPE_FORMAT_L8_UNORM:
+case PIPE_FORMAT_I8_UNORM:
+c.color[1] = c.color[0];
+break;
+
+case PIPE_FORMAT_A8_UNORM:
+c.color[1] = c.color[3];
+break;
+
+case PIPE_FORMAT_R8G8_UNORM:
+c.color[2] = c.color[1];
+break;
+
+case PIPE_FORMAT_L8A8_UNORM:
+c.color[2] = c.color[3];
+break;
+
+default:;
+}
+}
+
 if (r300->screen->caps.is_r500) {
-/* XXX if FP16 blending is enabled, we should use the FP16 format */
 BEGIN_CB(state->cb, 3);
 OUT_CB_REG_SEQ(R500_RB3D_CONSTANT_COLOR_AR, 2);
-OUT_CB(float_to_fixed10(color->color[0]) |
-   (float_to_fixed10(color->color[3]) << 16));
-OUT_CB(float_to_fixed10(color->color[2]) |
-   (float_to_fixed10(color->color[1]) << 16));
+
+switch (format) {
+case PIPE_FORMAT_R16G16B16A16_FLOAT:
+OUT_CB(util_float_to_half(c.color[2]) |
+   (util_float_to_half(c.color[3]) << 16));
+OUT_CB(util_float_to_half(c.color[0]) |
+   (util_float_to_half(c.color[1]) << 16));
+break;
+
+default:
+OUT_CB(float_to_fixed10(c.color[0]) |
+   (float_to_fixed10(c.color[3]) << 16));
+OUT_CB(float_to_fixed10(c.color[2]) |
+   (float_to_fixed10(c.color[1]) << 16));
+}
+
 END_CB;
 } else {
 union util_color uc;
-util_pack_color(color->color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+util_pack_color(c.color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
 
 BEGIN_CB(state->cb, 2);
 OUT_CB_REG(R300_RB3D_BLEND_COLOR, uc.ui);
@@ -686,6 +729,7 @@ void r300_mark_fb_state_dirty(struct r300_context *r300,
 /* What is marked as dirty depends on the enum r300_fb_state_change. */
 if (change == R300_CHANGED_FB_STATE) {
 r300_mark_atom_dirty(r300, &r300->aa_state);
+r300_set_blend_color(&r300->context, r300->blend_color_state.state);
 }
 
 if (change == R300_CHANGED_FB_STATE ||

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


Mesa (master): draw: Silence tgsi_emit_sse2 failed messages.

2011-03-04 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 4a4f6a390160d8c535e0a7ae96a203a99971f3c0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a4f6a390160d8c535e0a7ae96a203a99971f3c0

Author: José Fonseca 
Date:   Fri Mar  4 16:29:13 2011 +

draw: Silence tgsi_emit_sse2 failed messages.

---

 src/gallium/auxiliary/draw/draw_vs_sse.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c 
b/src/gallium/auxiliary/draw/draw_vs_sse.c
index d55b9b0..d918579 100644
--- a/src/gallium/auxiliary/draw/draw_vs_sse.c
+++ b/src/gallium/auxiliary/draw/draw_vs_sse.c
@@ -200,7 +200,8 @@ draw_create_vs_sse(struct draw_context *draw,
return &vs->base;
 
 fail:
-   debug_error("tgsi_emit_sse2() failed, falling back to interpreter\n");
+   if (0)
+  debug_warning("tgsi_emit_sse2() failed, falling back to interpreter\n");
 
x86_release_func( &vs->sse2_program );


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


Mesa (master): tgsi: Disable SSE2 code generation.

2011-03-04 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 6838c9ce74f16c765474c0d2b4ae1469dd4a64d5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6838c9ce74f16c765474c0d2b4ae1469dd4a64d5

Author: José Fonseca 
Date:   Fri Mar  4 14:54:24 2011 +

tgsi: Disable SSE2 code generation.

It's broken now that tgsi_exec_machine::Inputs/Ouputs are pointers.

Temporary if anybody still cares about tgsi_sse2.c. Permanent otherwise.

---

 src/gallium/auxiliary/tgsi/tgsi_sse2.c |   23 ---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c 
b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
index 92ba8b8..664946b 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c
@@ -28,7 +28,9 @@
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_ARCH_X86)
+#include "tgsi/tgsi_sse2.h"
+
+#if defined(PIPE_ARCH_X86) && 0 /* See FIXME notes below */
 
 #include "util/u_debug.h"
 #include "pipe/p_shader_tokens.h"
@@ -42,7 +44,6 @@
 #include "tgsi/tgsi_util.h"
 #include "tgsi/tgsi_dump.h"
 #include "tgsi/tgsi_exec.h"
-#include "tgsi/tgsi_sse2.h"
 
 #include "rtasm/rtasm_x86sse.h"
 
@@ -118,6 +119,7 @@ get_machine_base( void )
 static struct x86_reg
 get_input_base( void )
 {
+   /* FIXME: tgsi_exec_machine::Inputs is a pointer now! */
return x86_make_disp(
   get_machine_base(),
   Offset(struct tgsi_exec_machine, Inputs) );
@@ -126,6 +128,7 @@ get_input_base( void )
 static struct x86_reg
 get_output_base( void )
 {
+   /* FIXME: tgsi_exec_machine::Ouputs is a pointer now! */
return x86_make_disp(
   get_machine_base(),
   Offset(struct tgsi_exec_machine, Outputs) );
@@ -2760,6 +2763,7 @@ static void aos_to_soa( struct x86_function *func,
 
x86_mov( func, aos_input,  x86_fn_arg( func, arg_aos ) );
x86_mov( func, soa_input,  x86_fn_arg( func, arg_machine ) );
+   /* FIXME: tgsi_exec_machine::Inputs is a pointer now! */
x86_lea( func, soa_input,  
x86_make_disp( soa_input, 
   Offset(struct tgsi_exec_machine, Inputs) ) );
@@ -2828,6 +2832,7 @@ static void soa_to_aos( struct x86_function *func,
 
x86_mov( func, aos_output, x86_fn_arg( func, arg_aos ) );
x86_mov( func, soa_output, x86_fn_arg( func, arg_machine ) );
+   /* FIXME: tgsi_exec_machine::Ouputs is a pointer now! */
x86_lea( func, soa_output, 
x86_make_disp( soa_output, 
   Offset(struct tgsi_exec_machine, Outputs) ) );
@@ -3082,4 +3087,16 @@ tgsi_emit_sse2(
return ok;
 }
 
-#endif /* PIPE_ARCH_X86 */
+#else /* !PIPE_ARCH_X86 */
+
+unsigned
+tgsi_emit_sse2(
+   const struct tgsi_token *tokens,
+   struct x86_function *func,
+   float (*immediates)[4],
+   boolean do_swizzles )
+{
+   return 0;
+}
+
+#endif /* !PIPE_ARCH_X86 */

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


Mesa (master): scons: Unbreak mingw cross compilation.

2011-03-04 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: c8e904e159e6ddfe68fa5dc4de72b12eb7b7747d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c8e904e159e6ddfe68fa5dc4de72b12eb7b7747d

Author: José Fonseca 
Date:   Fri Mar  4 14:29:06 2011 +

scons: Unbreak mingw cross compilation.

---

 src/glsl/SConscript |   19 ---
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index ef10ca9..9ecc155 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -102,16 +102,16 @@ if env['msvc']:
 env.Prepend(CPPPATH = ['#/src/getopt'])
 env.PrependUnique(LIBS = [getopt])
 
-main_obj = env.StaticObject('main.cpp')
-
-mesa_objs = env.StaticObject([
-'#src/mesa/program/hash_table.c',
-'#src/mesa/program/symbol_table.c',
-])
-
 if env['crosscompile'] and env['platform'] != 'embedded':
 Import('builtin_glsl_function')
 else:
+main_obj = env.StaticObject('main.cpp')
+
+mesa_objs = env.StaticObject([
+'#src/mesa/program/hash_table.c',
+'#src/mesa/program/symbol_table.c',
+])
+
 builtin_compiler = env.Program(
 target = 'builtin_compiler',
 source = main_obj + glsl_sources + ['builtin_stubs.cpp'] + mesa_objs,
@@ -149,6 +149,11 @@ env.Depends(glsl, glsl_parser)
 
 Export('glsl')
 
+# Skip building these programs as they will cause SCons error "Two environments
+# with different actions were specified for the same target"
+if env['crosscompile'] or env['platform'] == 'embedded':
+Return()
+
 env = env.Clone()
 
 if env['platform'] == 'windows':

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


Mesa (master): st/mesa: set PIPE_BIND_RENDER_TARGET for sRGB formats if UNORM is supported

2011-03-04 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: ba48811fa8cbe80c67cdbbb9b8180aaf64433c4e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba48811fa8cbe80c67cdbbb9b8180aaf64433c4e

Author: Marek Olšák 
Date:   Fri Mar  4 06:38:13 2011 +0100

st/mesa: set PIPE_BIND_RENDER_TARGET for sRGB formats if UNORM is supported

Because the format can be changed to UNORM in a surface.

This fixes:
state_tracker/st_atom_framebuffer.c:163:update_framebuffer_state:
Assertion `framebuffer->cbufs[i]->texture->bind & (1 << 1)' failed.

---

 src/mesa/state_tracker/st_cb_texture.c |   11 +--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index c3c4246..3f98ffd 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -227,8 +227,15 @@ default_bindings(struct st_context *st, enum pipe_format 
format)
 
if (screen->is_format_supported(screen, format, target, 0, bindings, geom))
   return bindings;
-   else
-  return PIPE_BIND_SAMPLER_VIEW;
+   else {
+  /* Try non-sRGB. */
+  format = util_format_linear(format);
+
+  if (screen->is_format_supported(screen, format, target, 0, bindings, 
geom))
+ return bindings;
+  else
+ return PIPE_BIND_SAMPLER_VIEW;
+   }
 }
 
 

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


Mesa (master): glsl/glcpp: Use stdio.h instead of unistd.h.

2011-03-04 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 12d17bcadf79d473b29c902c1ac949dcc65ff354
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=12d17bcadf79d473b29c902c1ac949dcc65ff354

Author: José Fonseca 
Date:   Fri Mar  4 12:53:14 2011 +

glsl/glcpp: Use stdio.h instead of unistd.h.

---

 src/glsl/glcpp/glcpp.c |   40 +++-
 1 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c
index 564194c..3252891 100644
--- a/src/glsl/glcpp/glcpp.c
+++ b/src/glsl/glcpp/glcpp.c
@@ -21,10 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 
 #include 
 #include "glcpp.h"
@@ -40,16 +37,16 @@ _mesa_reference_shader(struct gl_context *ctx, struct 
gl_shader **ptr,
*ptr = sh;
 }
 
-/* Read from fd until EOF and return a string of everything read.
+/* Read from fp until EOF and return a string of everything read.
  */
 static char *
-load_text_fd (void *ctx, int fd)
+load_text_fp (void *ctx, FILE *fp)
 {
 #define CHUNK 4096
char *text = NULL;
-   ssize_t text_size = 0;
-   ssize_t total_read = 0;
-   ssize_t bytes;
+   size_t text_size = 0;
+   size_t total_read = 0;
+   size_t bytes;
 
while (1) {
if (total_read + CHUNK + 1 > text_size) {
@@ -60,19 +57,12 @@ load_text_fd (void *ctx, int fd)
return NULL;
}
}
-   bytes = read (fd, text + total_read, CHUNK);
-   if (bytes < 0) {
-   fprintf (stderr, "Error while reading: %s\n",
-strerror (errno));
-   ralloc_free (text);
-   return NULL;
-   }
+   bytes = fread (text + total_read, 1, CHUNK, fp);
+   total_read += bytes;
 
-   if (bytes == 0) {
+   if (bytes < CHUNK) {
break;
}
-
-   total_read += bytes;
}
 
text[total_read] = '\0';
@@ -84,21 +74,21 @@ static char *
 load_text_file(void *ctx, const char *filename)
 {
char *text;
-   int fd;
+   FILE *fp;
 
if (filename == NULL || strcmp (filename, "-") == 0)
-   return load_text_fd (ctx, STDIN_FILENO);
+   return load_text_fp (ctx, stdin);
 
-   fd = open (filename, O_RDONLY);
-   if (fd < 0) {
+   fp = fopen (filename, "r");
+   if (fp == NULL) {
fprintf (stderr, "Failed to open file %s: %s\n",
 filename, strerror (errno));
return NULL;
}
 
-   text = load_text_fd (ctx, fd);
+   text = load_text_fp (ctx, fp);
 
-   close(fd);
+   fclose(fp);
 
return text;
 }

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


Mesa (master): scons: Get glsl2 and glcpp programs building correctly.

2011-03-04 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 53789834176396ae69e21e460881600f36124fb5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=53789834176396ae69e21e460881600f36124fb5

Author: José Fonseca 
Date:   Fri Mar  4 13:11:49 2011 +

scons: Get glsl2 and glcpp programs building correctly.

---

 src/glsl/SConscript |   41 +
 1 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index bb02a87..ef10ca9 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -30,7 +30,7 @@ glcpp_parser = env.CFile('glcpp/glcpp-parse.c', 
'glcpp/glcpp-parse.y')
 glsl_lexer = parser_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
 glsl_parser = parser_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
 
-sources = [
+glsl_sources = [
 glcpp_lexer,
 glcpp_parser[0],
 'glcpp/pp.c',
@@ -98,19 +98,23 @@ sources = [
 'strtod.c',
 ] 
 
+if env['msvc']:
+env.Prepend(CPPPATH = ['#/src/getopt'])
+env.PrependUnique(LIBS = [getopt])
+
+main_obj = env.StaticObject('main.cpp')
+
+mesa_objs = env.StaticObject([
+'#src/mesa/program/hash_table.c',
+'#src/mesa/program/symbol_table.c',
+])
 
 if env['crosscompile'] and env['platform'] != 'embedded':
 Import('builtin_glsl_function')
 else:
-if env['msvc']:
-env.Prepend(CPPPATH = ['#/src/getopt'])
-env.PrependUnique(LIBS = [getopt])
-
 builtin_compiler = env.Program(
 target = 'builtin_compiler',
-source = sources + ['main.cpp', 'builtin_stubs.cpp',
-'#src/mesa/program/hash_table.c',
-'#src/mesa/program/symbol_table.c'],
+source = main_obj + glsl_sources + ['builtin_stubs.cpp'] + mesa_objs,
 )
 
 # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll
@@ -132,11 +136,11 @@ else:
 Return()
 
 
-sources += builtin_glsl_function
+glsl_sources += builtin_glsl_function
 
 glsl = env.ConvenienceLibrary(
 target = 'glsl',
-source = sources,
+source = glsl_sources,
 )
 
 # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
@@ -145,9 +149,6 @@ env.Depends(glsl, glsl_parser)
 
 Export('glsl')
 
-# FIXME: We can't build the programs because there's a cyclic dependency 
between tis directory and src/mesa
-Return()
-
 env = env.Clone()
 
 if env['platform'] == 'windows':
@@ -157,14 +158,14 @@ if env['platform'] == 'windows':
 
 env.Prepend(LIBS = [glsl])
 
-env.Program(
+glsl2 = env.Program(
 target = 'glsl2',
-source = [
-'main.cpp',
-]
+source = main_obj + mesa_objs,
 )
+env.Alias('glsl2', glsl2)
 
-env.Program(
-target = 'glcpp',
-source = ['glcpp/glcpp.c'],
+glcpp = env.Program(
+target = 'glcpp/glcpp',
+source = ['glcpp/glcpp.c'] + mesa_objs,
 )
+env.Alias('glcpp', glcpp)

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


Mesa (master): glsl: Define YY_NO_UNISTD_H on MSVC.

2011-03-04 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: f52660c3dc85632b4dce76d16bf6d78266c35173
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f52660c3dc85632b4dce76d16bf6d78266c35173

Author: José Fonseca 
Date:   Fri Mar  4 12:49:55 2011 +

glsl: Define YY_NO_UNISTD_H on MSVC.

---

 src/glsl/glcpp/glcpp-lex.l |4 
 src/glsl/glsl_lexer.ll |4 
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index 68e44eb..8661887 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -34,6 +34,10 @@
 int glcpp_get_column  (yyscan_t yyscanner);
 void glcpp_set_column (int  column_no , yyscan_t yyscanner);
 
+#ifdef _MSC_VER
+#define YY_NO_UNISTD_H
+#endif
+
 #define YY_NO_INPUT
 
 #define YY_USER_ACTION  \
diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index e4c469f..cfd8926 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -29,6 +29,10 @@
 
 static int classify_identifier(struct _mesa_glsl_parse_state *, const char *);
 
+#ifdef _MSC_VER
+#define YY_NO_UNISTD_H
+#endif
+
 #define YY_USER_ACTION \
do {\
   yylloc->source = 0;  \

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


Mesa (master): gallium: Define __func__ on MSVC.

2011-03-04 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: d40b868db5b82529cbe07598b2ebef23cc31a7fa
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d40b868db5b82529cbe07598b2ebef23cc31a7fa

Author: José Fonseca 
Date:   Fri Mar  4 11:46:13 2011 +

gallium: Define __func__ on MSVC.

---

 src/gallium/include/pipe/p_compiler.h |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/gallium/include/pipe/p_compiler.h 
b/src/gallium/include/pipe/p_compiler.h
index 3d6b5b5..3441db6 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -171,6 +171,18 @@ typedef unsigned char boolean;
 #  define __FUNCTION__ ""
 # endif
 #endif
+#ifndef __func__
+#  if (__STDC_VERSION__ >= 199901L) || \
+  (defined(__SUNPRO_C) && defined(__C99FEATURES__))
+   /* __func__ is part of C99 */
+#  elif defined(_MSC_VER)
+#if _MSC_VER >= 1300
+#  define __func__ __FUNCTION__
+#else
+#  define __func__ ""
+#endif
+#  endif
+#endif
 
 
 

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


Mesa (master): 31 new commits

2011-03-04 Thread Christoph Bumiller
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf143c1f4d7c3636ddd5c767518b1b00ff46b16c
Merge: 9d31138f53c0bee9193af73850ab6febddd29f51 
3bf92a281bdc6ebf2ec5975729d02bd9062e11f5
Author: Christoph Bumiller 
Date:   Fri Mar 4 11:02:10 2011 +0100

Merge remote branch 'origin/nvc0'

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3bf92a281bdc6ebf2ec5975729d02bd9062e11f5
Author: Christoph Bumiller 
Date:   Thu Mar 3 12:31:35 2011 +0100

nv50: check grclass instead of chipset for 3D caps

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7048ad62f89289c9e642203c009dca38ce8753f8
Author: Christoph Bumiller 
Date:   Thu Mar 3 12:25:12 2011 +0100

nv50: increase size of shader code bo

512 KiB should be quite enough, but dynamic resize might be nicer.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b4e3e8941f41b6d15ac557e3d47bf4f1aa8b185
Author: Ben Skeggs 
Date:   Thu Mar 3 15:56:20 2011 +1000

nouveau: allow pipe driver to define which buffers should start in sysmem

PIPE_BIND_CONSTANT_BUFFER alone was OK for nv50/nvc0, but nv30 will need
to be able to set others on certain chipsets.

Signed-off-by: Ben Skeggs 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c0e996d59380af2d247336e3e9cfae58a80791a
Author: Christoph Bumiller 
Date:   Wed Mar 2 22:36:22 2011 +0100

nv50: fix IB index buffer path

Add missing VERTEX_END and treat unaligned offsets correctly.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa94f8b209c111f2c3cd9250d9fec6cd03726114
Author: Christoph Bumiller 
Date:   Wed Mar 2 21:07:33 2011 +0100

nv50: fix POINT_COORD_REPLACE_MAP method size

Introduced in 223d98bb8d49c9e52e498a12980722467ae2bf87.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=47a62b1ca1357ea1f60ae60dd0cfd72f8e5fa1b3
Author: Christoph Bumiller 
Date:   Wed Mar 2 20:48:20 2011 +0100

nv50: primitive restart trick for vertex data through FIFO mode

Also, on nv50 the VERTEX_BEGIN method doesn't follow VERTEX_END,
which was erroneously taken over from nvc0 and is fixed now.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b8646bc2af87f4b2cde50980da878b89d09cdf96
Author: Christoph Bumiller 
Date:   Wed Mar 2 20:15:01 2011 +0100

nv50: fix depth clamp for disabled primitive clipping

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddcb90248fb491a3a9e2ada8c595f94b0bd95515
Author: Christoph Bumiller 
Date:   Wed Mar 2 19:41:08 2011 +0100

nv50: implement independent blend functions for nva3+ and fix cap

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=669de7016ce3e95c6d1e4ee8e41b5bfe95f32105
Author: Christoph Bumiller 
Date:   Wed Mar 2 19:21:46 2011 +0100

nv50: fix tile size calculations

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=223d98bb8d49c9e52e498a12980722467ae2bf87
Author: Christoph Bumiller 
Date:   Wed Mar 2 19:02:59 2011 +0100

nv50: fix point sprite state validation

Wasn't updated if the FP didn't change, and coordinate replacement
wasn't disabled anymore.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbdbbce066de9af2856c207f5de8be7f10c74597
Author: Christoph Bumiller 
Date:   Wed Mar 2 15:41:19 2011 +0100

nv50: allow accidentally disabled IB index buffers again

Must have sneaked in from debugging.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=908013b7370f8dfe20a1ab41b353968a60a9055d
Author: Christoph Bumiller 
Date:   Wed Mar 2 15:39:57 2011 +0100

nv50: apply relocations to shader code

On nv50, branches are absolute, so we need to adjust them according
to the shader's position in the code buffer.

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=040ff18a2116c7acee51c57b7b0442ca18cdb0ad
Author: Christoph Bumiller 
Date:   Wed Mar 2 20:57:29 2011 +0100

nv50: fix wrong miptree tile flags taken over from nvc0

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=450aa241bfd9d72737775633a6cf88db23952ebf
Author: Ben Skeggs 
Date:   Tue Mar 1 17:43:13 2011 +1000

nouveau: remove nouveau_stateobj.h

Signed-off-by: Ben Skeggs 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=28eb7214db3387eb55109273317a308617341a3f
Author: Ben Skeggs 
Date:   Tue Mar 1 17:08:03 2011 +1000

nvc0: fix a crash on context destruction

Signed-off-by: Ben Skeggs 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1ba8e9510812f155359d380bda6876cdee5ba21e
Author: Ben Skeggs 
Date:   Tue Mar 1 15:28:26 2011 +1000

nouveau: ensure vbo_dirty is set when buffer write transfer complete

This introduces a shared nouveau_context struct to track such things.

Signed-off-by: Ben Skeggs 

URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=96d57722fda62e7710eb5281bcf014ddfb824ef9
Author: Ben Skeggs 
Date:   Tue Mar 1 14:39:04 2011 +1000

nouveau: fix leak of nouveau_mman structs

Signed-off

Mesa (master): i965: Fix extending VB packets

2011-03-04 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 9d31138f53c0bee9193af73850ab6febddd29f51
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9d31138f53c0bee9193af73850ab6febddd29f51

Author: Chris Wilson 
Date:   Thu Mar  3 22:34:22 2011 +

i965: Fix extending VB packets

Computation of the delta of this array from the last had a silly little
bug and ignored any initial delta==0 causing grief in Nexuiz and
friends.

Signed-off-by: Chris Wilson 

---

 src/mesa/drivers/dri/i965/brw_draw_upload.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 4478ef9..e96c32a 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -484,7 +484,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
}
 
/* can we simply extend the current vb? */
-   if (0 && j == brw->vb.nr_current_buffers) {
+   if (j == brw->vb.nr_current_buffers) {
   int delta = 0;
   for (i = 0; i < j; i++) {
 int d;
@@ -494,7 +494,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
break;
 
 d = brw->vb.buffers[i].offset - brw->vb.current_buffers[i].offset;
-if (delta == 0)
+if (i == 0)
delta = d / brw->vb.current_buffers[i].stride;
 if (delta * brw->vb.current_buffers[i].stride != d)
break;

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


Mesa (master): i965: Handle URB_FENCE erratum for Broadwater

2011-03-04 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 18dd7932c7fc13e230384bcab08311a5de5d6de7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=18dd7932c7fc13e230384bcab08311a5de5d6de7

Author: Chris Wilson 
Date:   Thu Mar  3 18:15:03 2011 +

i965: Handle URB_FENCE erratum for Broadwater

There is a silicon bug which causes unpredictable behaviour if the
URB_FENCE command should cross a cache-line boundary. Pad before the
command to avoid such occurrences. As this command only applies to
gen4/5, do the fixup unconditionally as the specs do not actually state
for which chip it was fixed (and the cost is negligible)...

Signed-off-by: Chris Wilson 

---

 src/mesa/drivers/dri/i965/brw_urb.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_urb.c 
b/src/mesa/drivers/dri/i965/brw_urb.c
index dfc1551..b0419d8 100644
--- a/src/mesa/drivers/dri/i965/brw_urb.c
+++ b/src/mesa/drivers/dri/i965/brw_urb.c
@@ -248,5 +248,13 @@ void brw_upload_urb_fence(struct brw_context *brw)
uf.bits1.sf_fence  = brw->urb.cs_start; 
uf.bits1.cs_fence  = brw->urb.size;
 
+   /* erratum: URB_FENCE must not cross a 64byte cacheline */
+   if ((brw->intel.batch.used & 15) > 12) {
+  int pad = 16 - (brw->intel.batch.used & 15);
+  do
+brw->intel.batch.map[brw->intel.batch.used++] = MI_NOOP;
+  while (--pad);
+   }
+
BRW_BATCH_STRUCT(brw, &uf);
 }

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


Mesa (master): i965: Align index to type size and flush if the type changes

2011-03-04 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 1546291e5b8d3ac02f5bee38252f9d479bcf95cc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1546291e5b8d3ac02f5bee38252f9d479bcf95cc

Author: Chris Wilson 
Date:   Thu Mar  3 15:56:39 2011 +

i965: Align index to type size and flush if the type changes

Signed-off-by: Chris Wilson 

---

 src/mesa/drivers/dri/i965/brw_context.h   |4 ++--
 src/mesa/drivers/dri/i965/brw_draw_upload.c   |   21 ++---
 src/mesa/drivers/dri/intel/intel_buffer_objects.c |6 +++---
 src/mesa/drivers/dri/intel/intel_buffer_objects.h |1 +
 src/mesa/drivers/dri/intel/intel_tex_image.c  |3 ++-
 5 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 897220b..26a6388 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -517,9 +517,9 @@ struct brw_context
*/
   const struct _mesa_index_buffer *ib;
 
-  /* Updates to these fields are signaled by BRW_NEW_INDEX_BUFFER. */
+  /* Updates are signaled by BRW_NEW_INDEX_BUFFER. */
   drm_intel_bo *bo;
-  unsigned int offset;
+  GLuint type;
 
   /* Offset to index buffer index to use in CMD_3D_PRIM so that we can
* avoid re-uploading the IB packet over and over if we're actually
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 351ae07..4478ef9 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -343,7 +343,8 @@ static void brw_prepare_vertices(struct brw_context *brw)
struct brw_vertex_buffer *buffer = &brw->vb.buffers[j];
 
/* Named buffer object: Just reference its contents directly. */
-   buffer->bo = intel_bufferobj_source(intel, intel_buffer,
+buffer->bo = intel_bufferobj_source(intel,
+intel_buffer, type_size,
&buffer->offset);
drm_intel_bo_reference(buffer->bo);
buffer->offset += (uintptr_t)glarray->Ptr;
@@ -670,7 +671,6 @@ static void brw_prepare_indices(struct brw_context *brw)
   intel_upload_data(&brw->intel, index_buffer->ptr, ib_size, ib_type_size,
&bo, &offset);
   brw->ib.start_vertex_offset = offset / ib_type_size;
-  offset = 0;
} else {
   offset = (GLuint) (unsigned long) index_buffer->ptr;
 
@@ -687,7 +687,6 @@ static void brw_prepare_indices(struct brw_context *brw)
   intel_upload_data(&brw->intel, map, ib_size, ib_type_size,
 &bo, &offset);
   brw->ib.start_vertex_offset = offset / ib_type_size;
-  offset = 0;
 
ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, 
bufferobj);
} else {
@@ -697,22 +696,30 @@ static void brw_prepare_indices(struct brw_context *brw)
   */
  brw->ib.start_vertex_offset = offset / ib_type_size;
 
- bo = intel_bufferobj_source(intel, intel_buffer_object(bufferobj),
+ bo = intel_bufferobj_source(intel,
+ intel_buffer_object(bufferobj),
+ ib_type_size,
  &offset);
  drm_intel_bo_reference(bo);
+
+ brw->ib.start_vertex_offset += offset / ib_type_size;
}
}
 
-   if (brw->ib.bo != bo || brw->ib.offset != offset) {
+   if (brw->ib.bo != bo) {
   drm_intel_bo_unreference(brw->ib.bo);
   brw->ib.bo = bo;
-  brw->ib.offset = offset;
 
   brw_add_validated_bo(brw, brw->ib.bo);
   brw->state.dirty.brw |= BRW_NEW_INDEX_BUFFER;
} else {
   drm_intel_bo_unreference(bo);
}
+
+   if (index_buffer->type != brw->ib.type) {
+  brw->ib.type = index_buffer->type;
+  brw->state.dirty.brw |= BRW_NEW_INDEX_BUFFER;
+   }
 }
 
 const struct brw_tracked_state brw_indices = {
@@ -739,7 +746,7 @@ static void brw_emit_index_buffer(struct brw_context *brw)
  1);
OUT_RELOC(brw->ib.bo,
  I915_GEM_DOMAIN_VERTEX, 0,
- brw->ib.offset);
+ 0);
OUT_RELOC(brw->ib.bo,
  I915_GEM_DOMAIN_VERTEX, 0,
 brw->ib.bo->size - 1);
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c 
b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 2f750a7..439d6fc 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -723,11 +723,11 @@ void intel_upload_unmap(struct intel_context *intel,
 drm_intel_bo *
 intel_bufferobj_source(struct intel_context *intel,
struct intel_buffer_object *intel_obj,
-  GLuint *offset)
+  GLuint align, GLuint *offset)
 {
if (intel_obj->buffer == NULL) {
   intel_upload_

Mesa (master): intel: Add couple of missing gen6 commands to decode

2011-03-04 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: 1c0d09cd4efabf4e804780ebc45f1d120f6509c5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c0d09cd4efabf4e804780ebc45f1d120f6509c5

Author: Chris Wilson 
Date:   Sun Feb 27 19:21:54 2011 +

intel: Add couple of missing gen6 commands to decode

Signed-off-by: Chris Wilson 

---

 src/mesa/drivers/dri/intel/intel_decode.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_decode.c 
b/src/mesa/drivers/dri/intel/intel_decode.c
index 25b4131..688b8fe 100644
--- a/src/mesa/drivers/dri/intel/intel_decode.c
+++ b/src/mesa/drivers/dri/intel/intel_decode.c
@@ -1601,10 +1601,12 @@ decode_3d_965(uint32_t *data, int count, uint32_t 
hw_offset, uint32_t devid, int
{ 0x790a, 3, 3, "3DSTATE_AA_LINE_PARAMETERS" },
{ 0x790b, 4, 4, "3DSTATE_GS_SVB_INDEX" },
{ 0x790d, 3, 3, "3DSTATE_MULTISAMPLE" },
+   { 0x7910, 2, 2, "3DSTATE_CLEAR_PARAMS" },
{ 0x7b00, 6, 6, "3DPRIMITIVE" },
{ 0x7802, 4, 4, "3DSTATE_SAMPLER_STATE_POINTERS" },
{ 0x7805, 3, 3, "3DSTATE_URB" },
{ 0x780e, 4, 4, "3DSTATE_CC_STATE_POINTERS" },
+   { 0x780f, 2, 2, "3DSTATE_SCISSOR_STATE_POINTERS" },
{ 0x7810, 6, 6, "3DSTATE_VS_STATE" },
{ 0x7811, 7, 7, "3DSTATE_GS_STATE" },
{ 0x7812, 4, 4, "3DSTATE_CLIP_STATE" },

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


Mesa (master): i965: Prevent using a zero sized (or of unknown type) vertex array

2011-03-04 Thread Chris Wilson
Module: Mesa
Branch: master
Commit: b93684f5f311f89c965960ab42bfea71a397b180
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b93684f5f311f89c965960ab42bfea71a397b180

Author: Chris Wilson 
Date:   Thu Mar  3 11:25:30 2011 +

i965: Prevent using a zero sized (or of unknown type) vertex array

Signed-off-by: Chris Wilson 

---

 src/mesa/drivers/dri/i965/brw_draw_upload.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 185f1ff..351ae07 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -208,7 +208,7 @@ static GLuint get_surface_type( GLenum type, GLuint size,
   case GL_UNSIGNED_SHORT: return ushort_types_scale[size];
   case GL_UNSIGNED_BYTE: return ubyte_types_scale[size];
   default: assert(0); return 0;
-  }  
+  }
}
 }
 
@@ -225,11 +225,11 @@ static GLuint get_size( GLenum type )
case GL_UNSIGNED_INT: return sizeof(GLuint);
case GL_UNSIGNED_SHORT: return sizeof(GLushort);
case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
-   default: return 0;
-   }  
+   default: assert(0); return 0;
+   }
 }
 
-static GLuint get_index_type(GLenum type) 
+static GLuint get_index_type(GLenum type)
 {
switch (type) {
case GL_UNSIGNED_BYTE:  return BRW_INDEX_BYTE;
@@ -295,7 +295,8 @@ static void brw_prepare_vertices(struct brw_context *brw)
   struct brw_vertex_element *input = &brw->vb.inputs[i];
 
   vs_inputs &= ~(1 << i);
-  brw->vb.enabled[brw->vb.nr_enabled++] = input;
+  if (input->glarray->Size && get_size(input->glarray->Type))
+ brw->vb.enabled[brw->vb.nr_enabled++] = input;
}
 
if (brw->vb.nr_enabled == 0)

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