Mesa (master): clover: Added missing address space checking of kernel parameters v2

2013-07-30 Thread Tom Stellard
Module: Mesa
Branch: master
Commit: d9576598c7e1c6e4fee913a918345190248a9d19
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d9576598c7e1c6e4fee913a918345190248a9d19

Author: Jonathan Charest jcharest+mesa-...@gmail.com
Date:   Wed Jul 24 09:29:49 2013 -0400

clover: Added missing address space checking of kernel parameters v2

Here is an updated patch with no line wrapping and respecting 80-column limit 
(for my changes).

v2: Tom Stellard
  - Create global arguments for constant buffers so we don't break
r600g.

Reviewed-by: Tom Stellard thomas.stell...@amd.com

---

 .../state_trackers/clover/llvm/invocation.cpp  |   46 +--
 1 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index f3ab113..e6cd415 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -26,6 +26,7 @@
 #include clang/Frontend/TextDiagnosticBuffer.h
 #include clang/Frontend/TextDiagnosticPrinter.h
 #include clang/CodeGen/CodeGenAction.h
+#include clang/Basic/TargetInfo.h
 #include llvm/Bitcode/BitstreamWriter.h
 #include llvm/Bitcode/ReaderWriter.h
 #include llvm/Linker.h
@@ -113,7 +114,7 @@ namespace {
llvm::Module *
compile(const std::string source, const std::string name,
const std::string triple, const std::string processor,
-   const std::string opts) {
+   const std::string opts, clang::LangAS::Map address_spaces) {
 
   clang::CompilerInstance c;
   clang::CompilerInvocation invocation;
@@ -205,6 +206,10 @@ namespace {
   if (!c.ExecuteAction(act))
  throw build_error(log);
 
+  // Get address spaces map to be able to find kernel argument address 
space
+  memcpy(address_spaces, c.getTarget().getAddressSpaceMap(), 
+
sizeof(address_spaces));
+
   return act.takeModule();
}
 
@@ -283,7 +288,8 @@ namespace {
 
module
build_module_llvm(llvm::Module *mod,
- const std::vectorllvm::Function * kernels) {
+ const std::vectorllvm::Function * kernels,
+ clang::LangAS::Map address_spaces) {
 
   module m;
   struct pipe_llvm_program_header header;
@@ -326,18 +332,26 @@ namespace {
 }
 
 if (arg_type-isPointerTy()) {
-   // XXX: Figure out LLVM-OpenCL address space mappings for each
-   // target.  I think we need to ask clang what these are.  For 
now,
-   // pretend everything is in the global address space.
unsigned address_space = 
llvm::castllvm::PointerType(arg_type)-getAddressSpace();
-   switch (address_space) {
-  default:
- args.push_back(
-module::argument(module::argument::global, arg_size,
- target_size, target_align,
- module::argument::zero_ext));
- break;
-   }
+   if (address_space == address_spaces[clang::LangAS::opencl_local
+ - clang::LangAS::Offset]) 
{
+  args.push_back(module::argument(module::argument::local,
+  arg_size, target_size,
+  target_align,
+  module::argument::zero_ext));
+   } else {
+  // XXX: Correctly handle constant address space.  There is no
+  // way for r600g to pass a handle for constant buffers back
+  // to clover like it can for global buffers, so
+  // creating constant arguements will break r600g.  For now,
+  // continue treating constant buffers as global buffers
+  // until we can come up with a way to create handles for
+  // constant buffers.
+  args.push_back(module::argument(module::argument::global,
+  arg_size, target_size,
+  target_align,
+  module::argument::zero_ext));
+  }
 
 } else {
llvm::AttributeSet attrs = kernel_func-getAttributes();
@@ -379,10 +393,12 @@ clover::compile_program_llvm(const compat::string source,
std::string processor(target.begin(), 0, processor_str_len);
std::string triple(target.begin(), processor_str_len + 1,
   target.size() - processor_str_len - 1);
+   clang::LangAS::Map address_spaces;
 
// The input file name must have the .cl extension in order for the
// CompilerInvocation class to 

Mesa (master): r600g/compute: Added missing address space checking of kernel parameters

2013-07-30 Thread Tom Stellard
Module: Mesa
Branch: master
Commit: 4f8048bb5a8558ae4313b12ffd70b593cc629fe8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f8048bb5a8558ae4313b12ffd70b593cc629fe8

Author: Jonathan Charest jcharest+mesa-...@gmail.com
Date:   Mon Jul 22 09:24:56 2013 -0400

r600g/compute: Added missing address space checking of kernel parameters

To have non-static buffers in local memory, it is necessary to pass them
as arguments to the kernel.

For r600, the correct lds size must be set to the SQ_LDS_ALLOC register.
The correct size is the clover size plus the size reported by the
compiler.

Reviewed-by: Tom Stellard thomas.stell...@amd.com

---

 src/gallium/drivers/r600/evergreen_compute.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
b/src/gallium/drivers/r600/evergreen_compute.c
index f76fc9c..9b2bae3 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -211,8 +211,7 @@ void *evergreen_create_compute_state(
 #endif
 
shader-ctx = (struct r600_context*)ctx;
-   /* XXX: We ignore cso-req_local_mem, because we compute this value
-* ourselves on a per-kernel basis. */
+   shader-local_size = cso-req_local_mem;
shader-private_size = cso-req_private_mem;
shader-input_size = cso-req_input_mem;
 
@@ -334,7 +333,7 @@ static void evergreen_emit_direct_dispatch(
unsigned wave_divisor = (16 * num_pipes);
int group_size = 1;
int grid_size = 1;
-   unsigned lds_size = shader-active_kernel-bc.nlds_dw;
+   unsigned lds_size = shader-local_size / 4 + 
shader-active_kernel-bc.nlds_dw;
 
/* Calculate group_size/grid_size */
for (i = 0; i  3; i++) {

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


Mesa (master): glsl: Remove bogus check on return value of link_uniform_blocks().

2013-07-30 Thread Paul Berry
Module: Mesa
Branch: master
Commit: 4682b9b7bf0caa7bd0f6af3ae820a1df08af
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4682b9b7bf0caa7bd0f6af3ae820a1df08af

Author: Paul Berry stereotype...@gmail.com
Date:   Sat Jul 27 15:07:08 2013 -0700

glsl: Remove bogus check on return value of link_uniform_blocks().

A comment in link_intrastage_shaders(), and an if-test that followed
it, seemed to indicate that link_uniform_blocks() would return a
negative value in the event of an error.  But this is not the
case--all error checking has already been performed by
validate_intrastage_interface_blocks(), and link_uniform_blocks() can
only return unsigned values.

So get rid of the if-test and change the return type of
link_intrastage_shaders() to clarify that it can only return unsigned
values.

Reviewed-by: Jordan Justen jordan.l.jus...@intel.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/link_uniform_blocks.cpp |2 +-
 src/glsl/linker.cpp  |6 ++
 src/glsl/linker.h|2 +-
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp
index c72d1d8..1083653 100644
--- a/src/glsl/link_uniform_blocks.cpp
+++ b/src/glsl/link_uniform_blocks.cpp
@@ -137,7 +137,7 @@ struct block {
bool has_instance_name;
 };
 
-int
+unsigned
 link_uniform_blocks(void *mem_ctx,
 struct gl_shader_program *prog,
 struct gl_shader **shader_list,
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index ac010cf..4ffd40e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -964,12 +964,10 @@ link_intrastage_shaders(void *mem_ctx,
  num_shaders))
   return NULL;
 
-   /* Check that uniform blocks between shaders for a stage agree. */
-   const int num_uniform_blocks =
+   /* Link up uniform blocks defined within this stage. */
+   const unsigned num_uniform_blocks =
   link_uniform_blocks(mem_ctx, prog, shader_list, num_shaders,
   uniform_blocks);
-   if (num_uniform_blocks  0)
-  return NULL;
 
/* Check that there is only a single definition of each function signature
 * across all shaders.
diff --git a/src/glsl/linker.h b/src/glsl/linker.h
index 2fe2410..85a6817 100644
--- a/src/glsl/linker.h
+++ b/src/glsl/linker.h
@@ -53,7 +53,7 @@ extern bool
 link_uniform_blocks_are_compatible(const gl_uniform_block *a,
   const gl_uniform_block *b);
 
-extern int
+extern unsigned
 link_uniform_blocks(void *mem_ctx,
 struct gl_shader_program *prog,
 struct gl_shader **shader_list,

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


Mesa (master): glsl: Add error message for intrastage interface block mismatch.

2013-07-30 Thread Paul Berry
Module: Mesa
Branch: master
Commit: 659ec1c958b59b77b5334d1121722ea0c80dddf8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=659ec1c958b59b77b5334d1121722ea0c80dddf8

Author: Paul Berry stereotype...@gmail.com
Date:   Sat Jul 27 14:58:43 2013 -0700

glsl: Add error message for intrastage interface block mismatch.

Previously we failed to link (which is correct), but we did not output
an error message, which could have been confusing for users.

Reviewed-by: Jordan Justen jordan.l.jus...@intel.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/link_interface_blocks.cpp |5 -
 src/glsl/linker.cpp|3 ++-
 src/glsl/linker.h  |3 ++-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/glsl/link_interface_blocks.cpp 
b/src/glsl/link_interface_blocks.cpp
index b91860d..4f67291 100644
--- a/src/glsl/link_interface_blocks.cpp
+++ b/src/glsl/link_interface_blocks.cpp
@@ -32,7 +32,8 @@
 #include main/macros.h
 
 bool
-validate_intrastage_interface_blocks(const gl_shader **shader_list,
+validate_intrastage_interface_blocks(struct gl_shader_program *prog,
+ const gl_shader **shader_list,
  unsigned num_shaders)
 {
glsl_symbol_table interfaces;
@@ -62,6 +63,8 @@ validate_intrastage_interface_blocks(const gl_shader 
**shader_list,
 interfaces.add_interface(iface_type-name, iface_type,
  (enum ir_variable_mode) var-mode);
  } else if (old_iface_type != iface_type) {
+linker_error(prog, definitions of interface block `%s' do not
+  match\n, iface_type-name);
 return false;
  }
   }
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 4ffd40e..3d9c59d 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -960,7 +960,8 @@ link_intrastage_shaders(void *mem_ctx,
 
/* Check that interface blocks defined in multiple shaders are consistent.
 */
-   if (!validate_intrastage_interface_blocks((const gl_shader **)shader_list,
+   if (!validate_intrastage_interface_blocks(prog,
+ (const gl_shader **)shader_list,
  num_shaders))
   return NULL;
 
diff --git a/src/glsl/linker.h b/src/glsl/linker.h
index 85a6817..9f5deb5 100644
--- a/src/glsl/linker.h
+++ b/src/glsl/linker.h
@@ -61,7 +61,8 @@ link_uniform_blocks(void *mem_ctx,
 struct gl_uniform_block **blocks_ret);
 
 bool
-validate_intrastage_interface_blocks(const gl_shader **shader_list,
+validate_intrastage_interface_blocks(struct gl_shader_program *prog,
+ const gl_shader **shader_list,
  unsigned num_shaders);
 
 bool

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


Mesa (master): glsl: Improve error message for interstage interface block mismatch.

2013-07-30 Thread Paul Berry
Module: Mesa
Branch: master
Commit: 5fe6b90c87c055fdfe24eb8b2075e6725ad59ecd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5fe6b90c87c055fdfe24eb8b2075e6725ad59ecd

Author: Paul Berry stereotype...@gmail.com
Date:   Sat Jul 27 15:24:46 2013 -0700

glsl: Improve error message for interstage interface block mismatch.

We're now emitting this error from a point where we have easy access
to the name of the block that failed to match, so go ahead and include
that in the error message, as we do for intrastage interface block
mismatches.

Reviewed-by: Jordan Justen jordan.l.jus...@intel.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/link_interface_blocks.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/glsl/link_interface_blocks.cpp 
b/src/glsl/link_interface_blocks.cpp
index ffb4453..928a88e 100644
--- a/src/glsl/link_interface_blocks.cpp
+++ b/src/glsl/link_interface_blocks.cpp
@@ -105,7 +105,8 @@ validate_interstage_interface_blocks(struct 
gl_shader_program *prog,
  continue;
 
   if (var-interface_type != expected_type) {
- linker_error(prog, interface block mismatch between shader 
stages\n);
+ linker_error(prog, definitions of interface block `%s' do not 
+  match\n, var-interface_type-name);
  return;
   }
}

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


Mesa (master): glsl: Remove redundant writes to prog-LinkStatus

2013-07-30 Thread Paul Berry
Module: Mesa
Branch: master
Commit: 1299694ed5e3c2f51c076b020a9ad2fef2e1d059
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1299694ed5e3c2f51c076b020a9ad2fef2e1d059

Author: Paul Berry stereotype...@gmail.com
Date:   Sat Jul 27 15:37:15 2013 -0700

glsl: Remove redundant writes to prog-LinkStatus

The linker_error() function sets prog-LinkStatus to false.  There's
no reason for the caller of linker_error() to also do so.

Reviewed-by: Jordan Justen jordan.l.jus...@intel.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/ir_function_detect_recursion.cpp |1 -
 src/mesa/program/ir_to_mesa.cpp   |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/glsl/ir_function_detect_recursion.cpp 
b/src/glsl/ir_function_detect_recursion.cpp
index 5df3ac5..280c473 100644
--- a/src/glsl/ir_function_detect_recursion.cpp
+++ b/src/glsl/ir_function_detect_recursion.cpp
@@ -319,7 +319,6 @@ emit_errors_linked(const void *key, void *data, void 
*closure)
 
linker_error(prog, function `%s' has static recursion.\n, proto);
ralloc_free(proto);
-   prog-LinkStatus = false;
 }
 
 
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 4af1c82..f0fc1b9 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -3108,7 +3108,6 @@ _mesa_glsl_link_shader(struct gl_context *ctx, struct 
gl_shader_program *prog)
for (i = 0; i  prog-NumShaders; i++) {
   if (!prog-Shaders[i]-CompileStatus) {
 linker_error(prog, linking with uncompiled shader);
-prog-LinkStatus = GL_FALSE;
   }
}
 

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


Mesa (master): glsl: Use a consistent technique for tracking link success/ failure.

2013-07-30 Thread Paul Berry
Module: Mesa
Branch: master
Commit: b95d237fe6731055dad2ff3eaa59e4d6fc14bfff
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b95d237fe6731055dad2ff3eaa59e4d6fc14bfff

Author: Paul Berry stereotype...@gmail.com
Date:   Sat Jul 27 11:08:31 2013 -0700

glsl: Use a consistent technique for tracking link success/failure.

This patch changes link_shaders() so that it sets prog-LinkStatus to
true when it starts, and then relies on linker_error() to set it to
false if a link failure occurs.

Previously, link_shaders() would set prog-LinkStatus to true halfway
through its execution; as a result, linker functions that executed
during the first half of link_shaders() would have to do their own
success/failure tracking; if they didn't, then calling linker_error()
would add an error message to the log, but not cause the link to fail.
Since it wasn't always obvious from looking at a linker function
whether it was called before or after link_shaders() set
prog-LinkStatus to true, this carried a high risk of bugs.

Reviewed-by: Jordan Justen jordan.l.jus...@intel.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/glsl/link_interface_blocks.cpp |   19 +++---
 src/glsl/link_varyings.cpp |   12 ++--
 src/glsl/link_varyings.h   |2 +-
 src/glsl/linker.cpp|  117 +---
 src/glsl/linker.h  |7 +-
 5 files changed, 75 insertions(+), 82 deletions(-)

diff --git a/src/glsl/link_interface_blocks.cpp 
b/src/glsl/link_interface_blocks.cpp
index 4f67291..ffb4453 100644
--- a/src/glsl/link_interface_blocks.cpp
+++ b/src/glsl/link_interface_blocks.cpp
@@ -31,7 +31,7 @@
 #include linker.h
 #include main/macros.h
 
-bool
+void
 validate_intrastage_interface_blocks(struct gl_shader_program *prog,
  const gl_shader **shader_list,
  unsigned num_shaders)
@@ -65,16 +65,15 @@ validate_intrastage_interface_blocks(struct 
gl_shader_program *prog,
  } else if (old_iface_type != iface_type) {
 linker_error(prog, definitions of interface block `%s' do not
   match\n, iface_type-name);
-return false;
+return;
  }
   }
}
-
-   return true;
 }
 
-bool
-validate_interstage_interface_blocks(const gl_shader *producer,
+void
+validate_interstage_interface_blocks(struct gl_shader_program *prog,
+ const gl_shader *producer,
  const gl_shader *consumer)
 {
glsl_symbol_table interfaces;
@@ -105,9 +104,9 @@ validate_interstage_interface_blocks(const gl_shader 
*producer,
   if (expected_type == NULL)
  continue;
 
-  if (var-interface_type != expected_type)
- return false;
+  if (var-interface_type != expected_type) {
+ linker_error(prog, interface block mismatch between shader 
stages\n);
+ return;
+  }
}
-
-   return true;
 }
diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index 51cbdaa..2c7e451 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -43,7 +43,7 @@
 /**
  * Validate that outputs from one stage match inputs of another
  */
-bool
+void
 cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
 gl_shader *producer, gl_shader *consumer)
 {
@@ -106,7 +106,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program 
*prog,
producer_stage, output-name,
output-type-name,
consumer_stage, input-type-name);
-  return false;
+  return;
}
 }
 
@@ -121,7 +121,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program 
*prog,
 (output-centroid) ? has : lacks,
 consumer_stage,
 (input-centroid) ? has : lacks);
-   return false;
+   return;
 }
 
 if (input-invariant != output-invariant) {
@@ -133,7 +133,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program 
*prog,
 (output-invariant) ? has : lacks,
 consumer_stage,
 (input-invariant) ? has : lacks);
-   return false;
+   return;
 }
 
 if (input-interpolation != output-interpolation) {
@@ -147,12 +147,10 @@ cross_validate_outputs_to_inputs(struct gl_shader_program 
*prog,
 output-interpolation_string(),
 consumer_stage,
 input-interpolation_string());
-   return false;
+   return;
 }
   }
}
-
-   return true;
 }
 
 
diff --git a/src/glsl/link_varyings.h b/src/glsl/link_varyings.h
index 7f7be35..cfc6e47 100644
--- a/src/glsl/link_varyings.h
+++ b/src/glsl/link_varyings.h
@@ -214,7 +214,7 @@ 

Mesa (master): get-pick-list.sh: Include commits mentionining CC: mesa-stable... in pick list

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: master
Commit: 122d8d2f5a28030f2397d61d49f3873c8db6a987
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=122d8d2f5a28030f2397d61d49f3873c8db6a987

Author: Carl Worth cwo...@cworth.org
Date:   Tue Jul 30 12:36:37 2013 -0700

get-pick-list.sh: Include commits mentionining CC: mesa-stable... in pick list

We recently adopted a new convention that patches can be nominated for the
stable branch by including a line in the commit message as follows:

CC: mesa-sta...@lists.freedesktop.org

This is a convenient syntax as git send-email will notice this line and
automatically copy the resulting patch email to the mesa-stable mailing list.

Here we extend the regular expression in the get-pick-list.sh script to also
notice this pattern, (as well as the traditional NOTE: This patch is a
candidate... form.

---

 bin/get-pick-list.sh |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/bin/get-pick-list.sh b/bin/get-pick-list.sh
index d2b76e7..b9def6b 100755
--- a/bin/get-pick-list.sh
+++ b/bin/get-pick-list.sh
@@ -14,7 +14,7 @@ git log --reverse --grep=cherry picked from commit 
origin/master..HEAD |\
sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 
's/)//'  already_picked
 
 # Grep for commits that were marked as a candidate for the stable tree.
-git log --reverse --pretty=%H -i --grep='^[[:space:]]*NOTE: .*[Cc]andidate' 
HEAD..origin/master |\
+git log --reverse --pretty=%H -i --grep='^\([[:space:]]*NOTE: 
.*[Cc]andidate\|CC:[[:space:]]*mesa-stable\)' HEAD..origin/master |\
 while read sha
 do
# Check to see whether the patch is on the ignore list.

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


Mesa (master): Revert r300g: Give CLIP_DISABLE another try

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 4dfe1a0df56d084b6a29fe423afe0535abec29e9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4dfe1a0df56d084b6a29fe423afe0535abec29e9

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:00 2013 +0200

Revert r300g: Give CLIP_DISABLE another try

This reverts commit e866bd1adea2c3b4971ad68e69c644752f2ab7b6.

https://bugs.freedesktop.org/show_bug.cgi?id=57875

Cc: mesa-sta...@lists.freedesktop.org

---

 src/gallium/drivers/r300/r300_screen.c |2 +-
 src/gallium/drivers/r300/r300_state.c  |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_screen.c 
b/src/gallium/drivers/r300/r300_screen.c
index 8d7ffa9..7ead292 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -104,7 +104,6 @@ static int r300_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
 case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
 case PIPE_CAP_USER_INDEX_BUFFERS:
 case PIPE_CAP_USER_CONSTANT_BUFFERS:
-case PIPE_CAP_DEPTH_CLIP_DISABLE: /* XXX implemented, but breaks 
Regnum Online */
 case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
 return 1;
 
@@ -138,6 +137,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum 
pipe_cap param)
 case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
 case PIPE_CAP_INDEP_BLEND_ENABLE:
 case PIPE_CAP_INDEP_BLEND_FUNC:
+case PIPE_CAP_DEPTH_CLIP_DISABLE:
 case PIPE_CAP_SHADER_STENCIL_EXPORT:
 case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
 case PIPE_CAP_TGSI_INSTANCEID:
diff --git a/src/gallium/drivers/r300/r300_state.c 
b/src/gallium/drivers/r300/r300_state.c
index 6cfc192..e69a605 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -1333,8 +1333,7 @@ static void* r300_create_rs_state(struct pipe_context* 
pipe,
 
 if (r300_screen(pipe-screen)-caps.has_tcl) {
vap_clip_cntl = (state-clip_plane_enable  63) |
-   R300_PS_UCP_MODE_CLIP_AS_TRIFAN |
-   (state-depth_clip ? 0 : R300_CLIP_DISABLE);
+   R300_PS_UCP_MODE_CLIP_AS_TRIFAN;
 } else {
vap_clip_cntl = R300_CLIP_DISABLE;
 }

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


Mesa (master): mesa: default DEPTH_TEXTURE_MODE should be RED in the core profile

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: a6b1a7c0d269256ffbaf2300710601cde8ac872c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6b1a7c0d269256ffbaf2300710601cde8ac872c

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:08 2013 +0200

mesa: default DEPTH_TEXTURE_MODE should be RED in the core profile

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

---

 src/mesa/drivers/dri/i915/intel_tex.c  |2 +-
 src/mesa/drivers/dri/i965/intel_tex.c  |2 +-
 src/mesa/drivers/dri/nouveau/nouveau_texture.c |2 +-
 src/mesa/drivers/dri/r200/r200_tex.c   |2 +-
 src/mesa/drivers/dri/radeon/radeon_tex.c   |2 +-
 src/mesa/main/texobj.c |7 ---
 src/mesa/main/texobj.h |3 ++-
 src/mesa/state_tracker/st_cb_texture.c |2 +-
 8 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_tex.c 
b/src/mesa/drivers/dri/i915/intel_tex.c
index 6ac5a09..ce17395 100644
--- a/src/mesa/drivers/dri/i915/intel_tex.c
+++ b/src/mesa/drivers/dri/i915/intel_tex.c
@@ -39,7 +39,7 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, 
GLenum target)
if (obj == NULL)
   return NULL;
 
-   _mesa_initialize_texture_object(obj-base, name, target);
+   _mesa_initialize_texture_object(ctx, obj-base, name, target);
 
obj-needs_validate = true;
 
diff --git a/src/mesa/drivers/dri/i965/intel_tex.c 
b/src/mesa/drivers/dri/i965/intel_tex.c
index 175387d..eecffc9 100644
--- a/src/mesa/drivers/dri/i965/intel_tex.c
+++ b/src/mesa/drivers/dri/i965/intel_tex.c
@@ -39,7 +39,7 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, 
GLenum target)
if (obj == NULL)
   return NULL;
 
-   _mesa_initialize_texture_object(obj-base, name, target);
+   _mesa_initialize_texture_object(ctx, obj-base, name, target);
 
obj-needs_validate = true;
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c 
b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 0889b5a..da74e8f 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -46,7 +46,7 @@ nouveau_texture_new(struct gl_context *ctx, GLuint name, 
GLenum target)
 {
struct nouveau_texture *nt = CALLOC_STRUCT(nouveau_texture);
 
-   _mesa_initialize_texture_object(nt-base, name, target);
+   _mesa_initialize_texture_object(ctx, nt-base, name, target);
 
return nt-base;
 }
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c 
b/src/mesa/drivers/dri/r200/r200_tex.c
index 31a65c8..57e96de 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -476,7 +476,7 @@ static struct gl_texture_object 
*r200NewTextureObject(struct gl_context * ctx,
   __FUNCTION__, ctx,
   _mesa_lookup_enum_by_nr(target), t);
 
-   _mesa_initialize_texture_object(t-base, name, target);
+   _mesa_initialize_texture_object(ctx, t-base, name, target);
t-base.Sampler.MaxAnisotropy = rmesa-radeon.initialMaxAnisotropy;
 
/* Initialize hardware state */
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c 
b/src/mesa/drivers/dri/radeon/radeon_tex.c
index 301949d..fe8d8ed 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex.c
@@ -410,7 +410,7 @@ radeonNewTextureObject( struct gl_context *ctx, GLuint 
name, GLenum target )
r100ContextPtr rmesa = R100_CONTEXT(ctx);
radeonTexObj* t = CALLOC_STRUCT(radeon_tex_obj);
 
-   _mesa_initialize_texture_object(t-base, name, target);
+   _mesa_initialize_texture_object(ctx, t-base, name, target);
t-base.Sampler.MaxAnisotropy = rmesa-radeon.initialMaxAnisotropy;
 
t-border_fallback = GL_FALSE;
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 2168bff..a2b112c 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -83,7 +83,7 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint 
name, GLenum target )
struct gl_texture_object *obj;
(void) ctx;
obj = MALLOC_STRUCT(gl_texture_object);
-   _mesa_initialize_texture_object(obj, name, target);
+   _mesa_initialize_texture_object(ctx, obj, name, target);
return obj;
 }
 
@@ -95,7 +95,8 @@ _mesa_new_texture_object( struct gl_context *ctx, GLuint 
name, GLenum target )
  * \param target  the texture target
  */
 void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
+_mesa_initialize_texture_object( struct gl_context *ctx,
+ struct gl_texture_object *obj,
  GLuint name, GLenum target )
 {
ASSERT(target == 0 ||
@@ -146,7 +147,7 @@ _mesa_initialize_texture_object( struct gl_texture_object 
*obj,
obj-Sampler.MaxAnisotropy = 1.0;
obj-Sampler.CompareMode = GL_NONE; /* ARB_shadow */

Mesa (master): mesa: default texture buffer format should be R8 in the core profile

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 7db83d8d4b6329f8edcac7bc72d225016b5188d4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7db83d8d4b6329f8edcac7bc72d225016b5188d4

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:10 2013 +0200

mesa: default texture buffer format should be R8 in the core profile

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

v2: Since we don't expose the extension in the compatibility profile,
the if (API == CORE) .. else .. statement is removed.

---

 src/mesa/main/texobj.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index a2b112c..334dee7 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -155,8 +155,8 @@ _mesa_initialize_texture_object( struct gl_context *ctx,
obj-Swizzle[3] = GL_ALPHA;
obj-_Swizzle = SWIZZLE_NOOP;
obj-Sampler.sRGBDecode = GL_DECODE_EXT;
-   obj-BufferObjectFormat = GL_LUMINANCE8;
-   obj-_BufferObjectFormat = MESA_FORMAT_L8;
+   obj-BufferObjectFormat = GL_R8;
+   obj-_BufferObjectFormat = MESA_FORMAT_R8;
 }
 
 

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


Mesa (master): st/mesa: expose EXT_framebuffer_multisample_blit_scaled if MSAA is supported

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 63569dbeb0b33776043b141571700123b7cf6bf5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=63569dbeb0b33776043b141571700123b7cf6bf5

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:06 2013 +0200

st/mesa: expose EXT_framebuffer_multisample_blit_scaled if MSAA is supported

Surprisingly all drivers supporting MSAA can already do this (r300g and r600g
for sure) and I think Christoph wanted to have this feature for his Nouveau
drivers anyway.

---

 src/mesa/state_tracker/st_extensions.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index d019429..bc0de49 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -710,6 +710,7 @@ void st_init_extensions(struct st_context *st)
}
else if (ctx-Const.MaxSamples = 2) {
   ctx-Extensions.EXT_framebuffer_multisample = GL_TRUE;
+  ctx-Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
}
 
if (ctx-Const.MaxDualSourceDrawBuffers  0)

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


Mesa (master): st/mesa: fix sRGB renderbuffers without EXT_framebuffer_sRGB support

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 1302c66896e6fbdb4eeb086d41901ddaeb89513f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1302c66896e6fbdb4eeb086d41901ddaeb89513f

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:04 2013 +0200

st/mesa: fix sRGB renderbuffers without EXT_framebuffer_sRGB support

https://bugs.freedesktop.org/show_bug.cgi?id=59322

Cc: mesa-sta...@lists.freedesktop.org

---

 src/mesa/state_tracker/st_cb_fbo.c |8 
 src/mesa/state_tracker/st_format.c |7 +++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_fbo.c 
b/src/mesa/state_tracker/st_cb_fbo.c
index 826722b..77aaccd 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -37,6 +37,7 @@
 #include main/context.h
 #include main/fbobject.h
 #include main/framebuffer.h
+#include main/glformats.h
 #include main/macros.h
 #include main/renderbuffer.h
 
@@ -132,6 +133,13 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
pipe_surface_reference( strb-surface, NULL );
pipe_resource_reference( strb-texture, NULL );
 
+   /* If an sRGB framebuffer is unsupported, sRGB formats behave like linear
+* formats.
+*/
+   if (!ctx-Extensions.EXT_framebuffer_sRGB) {
+  internalFormat = _mesa_get_linear_internalformat(internalFormat);
+   }
+
/* Handle multisample renderbuffers first.
 *
 * From ARB_framebuffer_object:
diff --git a/src/mesa/state_tracker/st_format.c 
b/src/mesa/state_tracker/st_format.c
index 16d977f..64bfd1f 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -1782,6 +1782,13 @@ st_QuerySamplesForFormat(struct gl_context *ctx, GLenum 
target,
else
   bind = PIPE_BIND_RENDER_TARGET;
 
+   /* If an sRGB framebuffer is unsupported, sRGB formats behave like linear
+* formats.
+*/
+   if (!ctx-Extensions.EXT_framebuffer_sRGB) {
+  internalFormat = _mesa_get_linear_internalformat(internalFormat);
+   }
+
/* Set sample counts in descending order. */
for (i = 16; i  1; i--) {
   format = st_choose_format(st, internalFormat, GL_NONE, GL_NONE,

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


Mesa (master): docs/GL3: clarify core vs compatibility extension support

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: c40f8d087a30d4a2cc452a64e4567bea9ffdb3c5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c40f8d087a30d4a2cc452a64e4567bea9ffdb3c5

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:11 2013 +0200

docs/GL3: clarify core vs compatibility extension support

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 docs/GL3.txt |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index cd377ec..9b056d0 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -7,6 +7,14 @@ infrastructure is complete but it may be the case that few (if 
any) drivers
 implement the features.
 
 
+OpenGL Core and Compatibility context support
+
+OpenGL 3.1 and later versions are only supported with the Core profile.
+There are no plans to support GL_ARB_compatibility. The last supported OpenGL
+version with all deprecated features is 3.0. Some of the later GL features
+are exposed in the 3.0 context as extensions.
+
+
 Feature   Status
 - 
 

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


Mesa (master): gallium/postprocessing: fix shader parsing

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: c84e8d039ec9c7532b25757012aa3828f4f8a70d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c84e8d039ec9c7532b25757012aa3828f4f8a70d

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:12 2013 +0200

gallium/postprocessing: fix shader parsing

tokens was converted to a pointer, which made the Elements macro return 1.

Broken by e87fc11cac696881469a57955af2ac7b4929a2c7.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com

---

 src/gallium/auxiliary/postprocess/pp_run.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/postprocess/pp_run.c 
b/src/gallium/auxiliary/postprocess/pp_run.c
index 0d95c72..7c0f85c 100644
--- a/src/gallium/auxiliary/postprocess/pp_run.c
+++ b/src/gallium/auxiliary/postprocess/pp_run.c
@@ -218,8 +218,8 @@ pp_tgsi_to_state(struct pipe_context *pipe, const char 
*text, bool isvs,
   return NULL;
}
 
-   if (tgsi_text_translate(text, tokens, Elements(tokens)) == FALSE) {
-  pp_debug(Failed to translate %s\n, name);
+   if (tgsi_text_translate(text, tokens, PP_MAX_TOKENS) == FALSE) {
+  _debug_printf(pp: Failed to translate a shader for %s\n, name);
   return NULL;
}
 

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


Mesa (master): gallium/postprocessing: convert blits to pipe-blit

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 4c89ec1f69c0cba995cb4aa939469ead82c6a8ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c89ec1f69c0cba995cb4aa939469ead82c6a8ec

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:14 2013 +0200

gallium/postprocessing: convert blits to pipe-blit

PP saves current states to cso_context and then util_blit_pixels does
the same. cso_context doesn't like that and the original state is not
correctly restored.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Brian Paul bri...@vmware.com

---

 src/gallium/auxiliary/postprocess/postprocess.h |8 
 src/gallium/auxiliary/postprocess/pp_init.c |   13 --
 src/gallium/auxiliary/postprocess/pp_mlaa.c |8 +--
 src/gallium/auxiliary/postprocess/pp_program.h  |2 -
 src/gallium/auxiliary/postprocess/pp_run.c  |   48 --
 5 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/src/gallium/auxiliary/postprocess/postprocess.h 
b/src/gallium/auxiliary/postprocess/postprocess.h
index 52c6c75..04b6c75 100644
--- a/src/gallium/auxiliary/postprocess/postprocess.h
+++ b/src/gallium/auxiliary/postprocess/postprocess.h
@@ -77,6 +77,14 @@ void pp_debug(const char *, ...);
 struct program *pp_init_prog(struct pp_queue_t *, struct pipe_context *pipe,
  struct cso_context *);
 void pp_init_fbos(struct pp_queue_t *, unsigned int, unsigned int);
+void pp_blit(struct pipe_context *pipe,
+ struct pipe_resource *src_tex,
+ int srcX0, int srcY0,
+ int srcX1, int srcY1,
+ int srcZ0,
+ struct pipe_surface *dst,
+ int dstX0, int dstY0,
+ int dstX1, int dstY1);
 
 /* The filters */
 
diff --git a/src/gallium/auxiliary/postprocess/pp_init.c 
b/src/gallium/auxiliary/postprocess/pp_init.c
index 1130248..201a357 100644
--- a/src/gallium/auxiliary/postprocess/pp_init.c
+++ b/src/gallium/auxiliary/postprocess/pp_init.c
@@ -31,7 +31,6 @@
 
 #include pipe/p_screen.h
 #include util/u_inlines.h
-#include util/u_blit.h
 #include util/u_math.h
 #include util/u_debug.h
 #include util/u_memory.h
@@ -111,13 +110,6 @@ pp_init(struct pipe_context *pipe, const unsigned int 
*enabled,
   }
}
 
-   ppq-p-blitctx = util_create_blit(ppq-p-pipe, cso);
-
-   if (ppq-p-blitctx == NULL) {
-  pp_debug(Unable to create a blit context.\n);
-  goto error;
-   }
-
ppq-n_filters = curpos;
ppq-n_tmp = (curpos  2 ? 2 : 1);
ppq-n_inner_tmp = tmp_req;
@@ -180,11 +172,6 @@ pp_free(struct pp_queue_t *ppq)
pp_free_fbos(ppq);
 
if (ppq  ppq-p) {
-  /* Only destroy created contexts. */
-  if (ppq-p-blitctx) {
- util_destroy_blit(ppq-p-blitctx);
-  }
-
   if (ppq-p-pipe  ppq-filters  ppq-shaders) {
  for (i = 0; i  ppq-n_filters; i++) {
 unsigned int filter = ppq-filters[i];
diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c 
b/src/gallium/auxiliary/postprocess/pp_mlaa.c
index 503749b..b299c66 100644
--- a/src/gallium/auxiliary/postprocess/pp_mlaa.c
+++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c
@@ -43,7 +43,6 @@
 #include postprocess/postprocess.h
 #include postprocess/pp_mlaa.h
 #include postprocess/pp_filters.h
-#include util/u_blit.h
 #include util/u_box.h
 #include util/u_sampler.h
 #include util/u_inlines.h
@@ -191,10 +190,9 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct 
pipe_resource *in,
pp_filter_set_fb(p);
 
/* Blit the input to the output */
-   util_blit_pixels(p-blitctx, in, 0, 0, 0,
-w, h, 0, p-framebuffer.cbufs[0],
-0, 0, w, h, 0, PIPE_TEX_MIPFILTER_NEAREST,
-TGSI_WRITEMASK_XYZW, 0);
+   pp_blit(p-pipe, in, 0, 0,
+   w, h, 0, p-framebuffer.cbufs[0],
+   0, 0, w, h);
 
u_sampler_view_default_template(v_tmp, in, in-format);
arr[0] = p-pipe-create_sampler_view(p-pipe, in, v_tmp);
diff --git a/src/gallium/auxiliary/postprocess/pp_program.h 
b/src/gallium/auxiliary/postprocess/pp_program.h
index 2d1804d..b7774dc 100644
--- a/src/gallium/auxiliary/postprocess/pp_program.h
+++ b/src/gallium/auxiliary/postprocess/pp_program.h
@@ -56,8 +56,6 @@ struct program
struct pipe_resource *vbuf;
struct pipe_surface surf;
struct pipe_sampler_view *view;
-
-   struct blit_state *blitctx;
 };
 
 
diff --git a/src/gallium/auxiliary/postprocess/pp_run.c 
b/src/gallium/auxiliary/postprocess/pp_run.c
index 7c0f85c..81b538c 100644
--- a/src/gallium/auxiliary/postprocess/pp_run.c
+++ b/src/gallium/auxiliary/postprocess/pp_run.c
@@ -28,12 +28,50 @@
 #include postprocess.h
 
 #include postprocess/pp_filters.h
-#include util/u_blit.h
 #include util/u_inlines.h
 #include util/u_sampler.h
 
 #include tgsi/tgsi_parse.h
 
+void
+pp_blit(struct pipe_context *pipe,
+struct pipe_resource *src_tex,
+int srcX0, int srcY0,
+int srcX1, int srcY1,
+int srcZ0,
+struct pipe_surface *dst,
+int 

Mesa (master): st/osmesa: initialize disable_glsl_line_continuations

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 71e0b5d688e8442c4c19d905db84caad94314d5e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=71e0b5d688e8442c4c19d905db84caad94314d5e

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:15 2013 +0200

st/osmesa: initialize disable_glsl_line_continuations

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com

---

 src/gallium/state_trackers/osmesa/osmesa.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/osmesa/osmesa.c 
b/src/gallium/state_trackers/osmesa/osmesa.c
index 31a4dce..548e3ad 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -543,6 +543,7 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, 
GLint stencilBits,
attribs.minor = 1;
attribs.flags = 0;  /* ST_CONTEXT_FLAG_x */
attribs.options.force_glsl_extensions_warn = FALSE;
+   attribs.options.disable_glsl_line_continuations = FALSE;
 
osmesa_init_st_visual(attribs.visual,
  PIPE_FORMAT_R8G8B8A8_UNORM,

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


Mesa (master): st/dri: implement the driconf option force_s3tc_enable properly

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 83dbe61ea4308638f1c041d2f550f0f719e36967
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83dbe61ea4308638f1c041d2f550f0f719e36967

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:18 2013 +0200

st/dri: implement the driconf option force_s3tc_enable properly

Reviewed-by: Brian Paul bri...@vmware.com

---

 src/gallium/auxiliary/util/u_format_s3tc.c |   12 ++--
 src/gallium/include/state_tracker/st_api.h |1 +
 .../state_trackers/dri/common/dri_context.c|2 ++
 src/gallium/state_trackers/dri/common/dri_screen.c |   19 +--
 src/gallium/state_trackers/osmesa/osmesa.c |1 +
 src/mesa/state_tracker/st_extensions.c |   10 +-
 6 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c 
b/src/gallium/auxiliary/util/u_format_s3tc.c
index fd62815..11b4602 100644
--- a/src/gallium/auxiliary/util/u_format_s3tc.c
+++ b/src/gallium/auxiliary/util/u_format_s3tc.c
@@ -111,7 +111,6 @@ util_format_s3tc_init(void)
util_dl_proc fetch_2d_texel_rgba_dxt3;
util_dl_proc fetch_2d_texel_rgba_dxt5;
util_dl_proc tx_compress_dxtn;
-   char *force_s3tc_enable;
 
if (!first_time)
   return;
@@ -122,15 +121,8 @@ util_format_s3tc_init(void)
 
library = util_dl_open(DXTN_LIBNAME);
if (!library) {
-  if ((force_s3tc_enable = getenv(force_s3tc_enable)) 
-  !strcmp(force_s3tc_enable, true)) {
- debug_printf(couldn't open  DXTN_LIBNAME , enabling DXTn due to 
-force_s3tc_enable=true environment variable\n);
- util_format_s3tc_enabled = TRUE;
-  } else {
- debug_printf(couldn't open  DXTN_LIBNAME , software DXTn 
-compression/decompression unavailable\n);
-  }
+  debug_printf(couldn't open  DXTN_LIBNAME , software DXTn 
+   compression/decompression unavailable\n);
   return;
}
 
diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index fd6d04c..2c178b6 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -242,6 +242,7 @@ struct st_config_options
boolean force_glsl_extensions_warn;
boolean disable_glsl_line_continuations;
boolean disable_blend_func_extended;
+   boolean force_s3tc_enable;
 };
 
 /**
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
b/src/gallium/state_trackers/dri/common/dri_context.c
index 5794e48..ab80fc7 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -58,6 +58,8 @@ static void dri_fill_st_options(struct st_config_options 
*options,
   driQueryOptionb(optionCache, disable_glsl_line_continuations);
options-disable_blend_func_extended =
   driQueryOptionb(optionCache, disable_blend_func_extended);
+   options-force_s3tc_enable =
+  driQueryOptionb(optionCache, force_s3tc_enable);
 }
 
 GLboolean
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index c8aed63..ca17742 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -41,6 +41,7 @@
 #include state_tracker/drm_driver.h
 
 #include util/u_debug.h
+#include util/u_format_s3tc.h
 
 #define MSAA_VISUAL_MAX_SAMPLES 32
 
@@ -54,7 +55,7 @@ PUBLIC const char __driConfigOptions[] =
   DRI_CONF_SECTION_END
 
   DRI_CONF_SECTION_QUALITY
-/*   DRI_CONF_FORCE_S3TC_ENABLE(false) */
+ DRI_CONF_FORCE_S3TC_ENABLE(false)
  DRI_CONF_PP_CELSHADE(0)
  DRI_CONF_PP_NORED(0)
  DRI_CONF_PP_NOGREEN(0)
@@ -76,7 +77,7 @@ PUBLIC const char __driConfigOptions[] =
 
 #define false 0
 
-static const uint __driNConfigOptions = 12;
+static const uint __driNConfigOptions = 13;
 
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)
@@ -416,6 +417,20 @@ dri_init_screen_helper(struct dri_screen *screen,
screen-sPriv-myNum,
driver_descriptor.name);
 
+   /* Handle force_s3tc_enable. */
+   if (!util_format_s3tc_enabled 
+   driQueryOptionb(screen-optionCache, force_s3tc_enable)) {
+  /* Ensure libtxc_dxtn has been loaded if available.
+   * Forcing S3TC on before calling this would prevent loading
+   * the library.
+   * This is just a precaution, the driver should have called it
+   * already.
+   */
+  util_format_s3tc_init();
+
+  util_format_s3tc_enabled = TRUE;
+   }
+
return dri_fill_in_modes(screen);
 }
 
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c 
b/src/gallium/state_trackers/osmesa/osmesa.c
index 5908316..594372b 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -545,6 +545,7 @@ OSMesaCreateContextExt(GLenum 

Mesa (master): st/dri: support the driconf option disable_blend_func_extended

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 2acc27cc6de5cae395d19017daf86ddd8de704cf
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2acc27cc6de5cae395d19017daf86ddd8de704cf

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:16 2013 +0200

st/dri: support the driconf option disable_blend_func_extended

This is needed for Unigine.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com

---

 src/gallium/include/state_tracker/st_api.h |5 +++--
 .../state_trackers/dri/common/dri_context.c|2 ++
 src/gallium/state_trackers/dri/common/dri_screen.c |3 ++-
 src/gallium/state_trackers/osmesa/osmesa.c |1 +
 src/mesa/state_tracker/st_extensions.c |3 ++-
 5 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 52c9dc0..fd6d04c 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -239,8 +239,9 @@ struct st_visual
  */
 struct st_config_options
 {
-   boolean force_glsl_extensions_warn;
-   boolean disable_glsl_line_continuations;
+   boolean force_glsl_extensions_warn;
+   boolean disable_glsl_line_continuations;
+   boolean disable_blend_func_extended;
 };
 
 /**
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
b/src/gallium/state_trackers/dri/common/dri_context.c
index 58a710d..5794e48 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -56,6 +56,8 @@ static void dri_fill_st_options(struct st_config_options 
*options,
   driQueryOptionb(optionCache, force_glsl_extensions_warn);
options-disable_glsl_line_continuations =
   driQueryOptionb(optionCache, disable_glsl_line_continuations);
+   options-disable_blend_func_extended =
+  driQueryOptionb(optionCache, disable_blend_func_extended);
 }
 
 GLboolean
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index 6a037c4..20a3caf 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -67,6 +67,7 @@ PUBLIC const char __driConfigOptions[] =
   DRI_CONF_SECTION_DEBUG
  DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false)
  DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false)
+ DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false)
   DRI_CONF_SECTION_END
 
   DRI_CONF_SECTION_MISCELLANEOUS
@@ -76,7 +77,7 @@ PUBLIC const char __driConfigOptions[] =
 
 #define false 0
 
-static const uint __driNConfigOptions = 12;
+static const uint __driNConfigOptions = 13;
 
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c 
b/src/gallium/state_trackers/osmesa/osmesa.c
index 548e3ad..5908316 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -543,6 +543,7 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, 
GLint stencilBits,
attribs.minor = 1;
attribs.flags = 0;  /* ST_CONTEXT_FLAG_x */
attribs.options.force_glsl_extensions_warn = FALSE;
+   attribs.options.disable_blend_func_extended = FALSE;
attribs.options.disable_glsl_line_continuations = FALSE;
 
osmesa_init_st_visual(attribs.visual,
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index bc0de49..b201012 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -713,7 +713,8 @@ void st_init_extensions(struct st_context *st)
   ctx-Extensions.EXT_framebuffer_multisample_blit_scaled = GL_TRUE;
}
 
-   if (ctx-Const.MaxDualSourceDrawBuffers  0)
+   if (ctx-Const.MaxDualSourceDrawBuffers  0 
+   !st-options.disable_blend_func_extended)
   ctx-Extensions.ARB_blend_func_extended = GL_TRUE;
 
st-has_time_elapsed =

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


Mesa (master): driconf: remove the unused option allow_large_textures

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: f27f3a4b15449e9ba3c0ee4e01b9db753e48e55f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f27f3a4b15449e9ba3c0ee4e01b9db753e48e55f

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:17 2013 +0200

driconf: remove the unused option allow_large_textures

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/gallium/state_trackers/dri/common/dri_screen.c |3 +--
 src/mesa/drivers/dri/common/xmlpool/t_options.h|9 -
 2 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index 20a3caf..c8aed63 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -55,7 +55,6 @@ PUBLIC const char __driConfigOptions[] =
 
   DRI_CONF_SECTION_QUALITY
 /*   DRI_CONF_FORCE_S3TC_ENABLE(false) */
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
  DRI_CONF_PP_CELSHADE(0)
  DRI_CONF_PP_NORED(0)
  DRI_CONF_PP_NOGREEN(0)
@@ -77,7 +76,7 @@ PUBLIC const char __driConfigOptions[] =
 
 #define false 0
 
-static const uint __driNConfigOptions = 13;
+static const uint __driNConfigOptions = 12;
 
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)
diff --git a/src/mesa/drivers/dri/common/xmlpool/t_options.h 
b/src/mesa/drivers/dri/common/xmlpool/t_options.h
index ca47720..5b0f961 100644
--- a/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -266,15 +266,6 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min : # 
max ) \
 DRI_CONF_DESC(en,gettext(Number of texture units used)) \
 DRI_CONF_OPT_END
 
-#define DRI_CONF_ALLOW_LARGE_TEXTURES(def) \
-DRI_CONF_OPT_BEGIN_V(allow_large_textures,enum,def,0:2) \
-   DRI_CONF_DESC_BEGIN(en,gettext(Support larger textures not guaranteed 
to fit into graphics memory)) \
-   DRI_CONF_ENUM(0,gettext(No)) \
-   DRI_CONF_ENUM(1,gettext(At least 1 texture must fit under 
worst-case assumptions)) \
-   DRI_CONF_ENUM(2,gettext(Announce hardware limits)) \
-   DRI_CONF_DESC_END \
-DRI_CONF_OPT_END
-
 #define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
 DRI_CONF_OPT_BEGIN_V(texture_blend_quality,float,def,range) \
DRI_CONF_DESC(en,gettext(Texture filtering quality vs. speed, AKA 
“brilinear” texture filtering)) \

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


Mesa (master): st/dri: move enabling postprocessing to dri_screen

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: dda936e057b01b6401de7747038d341332c6d128
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dda936e057b01b6401de7747038d341332c6d128

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:20 2013 +0200

st/dri: move enabling postprocessing to dri_screen

The driconf options are global.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com

---

 .../state_trackers/dri/common/dri_context.c|   15 +--
 .../state_trackers/dri/common/dri_context.h|2 --
 src/gallium/state_trackers/dri/common/dri_screen.c |   13 +
 src/gallium/state_trackers/dri/common/dri_screen.h |4 
 4 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
b/src/gallium/state_trackers/dri/common/dri_context.c
index ab80fc7..6603491 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -39,16 +39,6 @@
 #include pipe/p_context.h
 #include state_tracker/st_context.h
 
-static void
-dri_pp_query(struct dri_context *ctx)
-{
-   unsigned int i;
-
-   for (i = 0; i  PP_FILTERS; i++) {
-  ctx-pp_enabled[i] = driQueryOptioni(ctx-optionCache, 
pp_filters[i].name);
-   }
-}
-
 static void dri_fill_st_options(struct st_config_options *options,
 const struct driOptionCache * optionCache)
 {
@@ -156,11 +146,8 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
ctx-st-st_manager_private = (void *) ctx;
ctx-stapi = stapi;
 
-   // Context successfully created. See if post-processing is requested.
-   dri_pp_query(ctx);
-
if (ctx-st-cso_context) {
-  ctx-pp = pp_init(ctx-st-pipe, ctx-pp_enabled, ctx-st-cso_context);
+  ctx-pp = pp_init(ctx-st-pipe, screen-pp_enabled, 
ctx-st-cso_context);
   ctx-hud = hud_create(ctx-st-pipe, ctx-st-cso_context);
}
 
diff --git a/src/gallium/state_trackers/dri/common/dri_context.h 
b/src/gallium/state_trackers/dri/common/dri_context.h
index 5af2861..2734ee5 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.h
+++ b/src/gallium/state_trackers/dri/common/dri_context.h
@@ -34,7 +34,6 @@
 
 #include dri_util.h
 #include pipe/p_compiler.h
-#include postprocess/filters.h
 #include hud/hud_context.h
 
 struct pipe_context;
@@ -59,7 +58,6 @@ struct dri_context
struct st_api *stapi;
struct st_context_iface *st;
struct pp_queue_t *pp;
-   unsigned int pp_enabled[PP_FILTERS];
struct hud_context *hud;
 };
 
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index f19998b..bb4d5b6 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -382,6 +382,17 @@ dri_destroy_screen(__DRIscreen * sPriv)
sPriv-extensions = NULL;
 }
 
+static void
+dri_postprocessing_init(struct dri_screen *screen)
+{
+   unsigned i;
+
+   for (i = 0; i  PP_FILTERS; i++) {
+  screen-pp_enabled[i] = driQueryOptioni(screen-optionCache,
+  pp_filters[i].name);
+   }
+}
+
 const __DRIconfig **
 dri_init_screen_helper(struct dri_screen *screen,
struct pipe_screen *pscreen)
@@ -426,6 +437,8 @@ dri_init_screen_helper(struct dri_screen *screen,
   util_format_s3tc_enabled = TRUE;
}
 
+   dri_postprocessing_init(screen);
+
return dri_fill_in_modes(screen);
 }
 
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h 
b/src/gallium/state_trackers/dri/common/dri_screen.h
index 859ebfd..18ede86 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -39,6 +39,7 @@
 #include pipe/p_context.h
 #include pipe/p_state.h
 #include state_tracker/st_api.h
+#include postprocess/filters.h
 
 struct dri_context;
 struct dri_drawable;
@@ -63,6 +64,9 @@ struct dri_screen
/** The screen's effective configuration options */
driOptionCache optionCache;
 
+   /* Which postprocessing filters are enabled. */
+   unsigned pp_enabled[PP_FILTERS];
+
/* drm */
int fd;
 

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


Mesa (master): st/dri: remove more unused driconf options

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 772070527f6a6db72505575d6571470280a131ab
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=772070527f6a6db72505575d6571470280a131ab

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:19 2013 +0200

st/dri: remove more unused driconf options

vblank_mode is read by dri_util.c and falls under the dri2 driver name,
which is not connected to the actual Mesa/Gallium driver in any way.

Reviewed-by: Brian Paul bri...@vmware.com

---

 src/gallium/state_trackers/dri/common/dri_screen.c |7 +--
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index ca17742..f19998b 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -49,11 +49,6 @@
 
 PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN
-  DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
- DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-  DRI_CONF_SECTION_END
-
   DRI_CONF_SECTION_QUALITY
  DRI_CONF_FORCE_S3TC_ENABLE(false)
  DRI_CONF_PP_CELSHADE(0)
@@ -77,7 +72,7 @@ PUBLIC const char __driConfigOptions[] =
 
 #define false 0
 
-static const uint __driNConfigOptions = 13;
+static const uint __driNConfigOptions = 11;
 
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)

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


Mesa (master): st/dri: remove driOptionCache from dri_context in favor of dri_screen

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: bc4f0b6bacff34c724a2a301662051364870e5e5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc4f0b6bacff34c724a2a301662051364870e5e5

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:21 2013 +0200

st/dri: remove driOptionCache from dri_context in favor of dri_screen

There is no reason to have this duplicated.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com

---

 .../state_trackers/dri/common/dri_context.c|   12 +---
 .../state_trackers/dri/common/dri_context.h|2 --
 2 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
b/src/gallium/state_trackers/dri/common/dri_context.c
index 6603491..b5445f8 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -109,11 +109,7 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
ctx-cPriv = cPriv;
ctx-sPriv = sPriv;
 
-   driParseConfigFiles(ctx-optionCache,
-  screen-optionCacheDefaults,
-   sPriv-myNum, driver_descriptor.name);
-
-   dri_fill_st_options(attribs.options, ctx-optionCache);
+   dri_fill_st_options(attribs.options, screen-optionCache);
dri_fill_st_visual(attribs.visual, screen, visual);
ctx-st = stapi-create_context(stapi, screen-base, attribs, ctx_err,
   st_share);
@@ -171,12 +167,6 @@ dri_destroy_context(__DRIcontext * cPriv)
   hud_destroy(ctx-hud);
}
 
-   /* note: we are freeing values and nothing more because
-* driParseConfigFiles allocated values only - the rest
-* is owned by screen optionCacheDefaults.
-*/
-   free(ctx-optionCache.values);
-
/* No particular reason to wait for command completion before
 * destroying a context, but we flush the context here
 * to avoid having to add code elsewhere to cope with flushing a
diff --git a/src/gallium/state_trackers/dri/common/dri_context.h 
b/src/gallium/state_trackers/dri/common/dri_context.h
index 2734ee5..b87ce40 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.h
+++ b/src/gallium/state_trackers/dri/common/dri_context.h
@@ -50,8 +50,6 @@ struct dri_context
__DRIdrawable *dPriv;
__DRIdrawable *rPriv;
 
-   driOptionCache optionCache;
-
unsigned int bind_count;
 
/* gallium */

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


Mesa (master): mesa: add MESA_GLSL debug flag to dump shaders on compile error

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: ab789393443629027dca16e0aad501d6c1c32cb0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab789393443629027dca16e0aad501d6c1c32cb0

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:23 2013 +0200

mesa: add MESA_GLSL debug flag to dump shaders on compile error

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/mesa/main/mtypes.h|1 +
 src/mesa/main/shaderapi.c |   19 ++-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index aba7d84..4042e9a 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2402,6 +2402,7 @@ struct gl_shader_program
 #define GLSL_NOP_FRAG 0x40  /** Force no-op fragment shaders */
 #define GLSL_USE_PROG 0x80  /** Log glUseProgram calls */
 #define GLSL_REPORT_ERRORS 0x100  /** Print compilation errors */
+#define GLSL_DUMP_ON_ERROR 0x200 /** Dump shaders to stderr on compile error 
*/
 
 
 /**
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 4cc0357..c349b0c 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -71,7 +71,9 @@ get_shader_flags(void)
const char *env = _mesa_getenv(MESA_GLSL);
 
if (env) {
-  if (strstr(env, dump))
+  if (strstr(env, dump_on_error))
+ flags |= GLSL_DUMP_ON_ERROR;
+  else if (strstr(env, dump))
  flags |= GLSL_DUMP;
   if (strstr(env, log))
  flags |= GLSL_LOG;
@@ -783,10 +785,17 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
 
}
 
-   if (sh-CompileStatus == GL_FALSE  
-   (ctx-Shader.Flags  GLSL_REPORT_ERRORS)) {
-  _mesa_debug(ctx, Error compiling shader %u:\n%s\n,
-  sh-Name, sh-InfoLog);
+   if (!sh-CompileStatus) {
+  if (ctx-Shader.Flags  GLSL_DUMP_ON_ERROR) {
+ fprintf(stderr, GLSL source for %s shader %d:\n,
+ _mesa_glsl_shader_target_name(sh-Type), sh-Name);
+ fprintf(stderr, %s\n, sh-Source);
+  }
+
+  if (ctx-Shader.Flags  GLSL_REPORT_ERRORS) {
+ _mesa_debug(ctx, Error compiling shader %u:\n%s\n,
+ sh-Name, sh-InfoLog);
+  }
}
 }
 

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


Mesa (master): mesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 0f6a7cb00c86fbdb415b01450bb1ece8cfe1e31d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f6a7cb00c86fbdb415b01450bb1ece8cfe1e31d

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:24 2013 +0200

mesa,glsl,st/dri: add a new driconf option force_glsl_version for Unigine

See documentation in mtypes.h.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/gallium/include/state_tracker/st_api.h |5 ++-
 .../state_trackers/dri/common/dri_context.c|   10 +++--
 src/gallium/state_trackers/dri/common/dri_screen.c |3 +-
 src/gallium/state_trackers/osmesa/osmesa.c |1 +
 src/glsl/glsl_parser_extras.cpp|3 +-
 src/mesa/drivers/dri/common/drirc  |   34 
 src/mesa/drivers/dri/common/xmlpool/t_options.h|5 +++
 src/mesa/main/mtypes.h |6 +++
 src/mesa/state_tracker/st_extensions.c |5 +++
 9 files changed, 64 insertions(+), 8 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 2c178b6..539dec0 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -239,9 +239,10 @@ struct st_visual
  */
 struct st_config_options
 {
-   boolean force_glsl_extensions_warn;
-   boolean disable_glsl_line_continuations;
boolean disable_blend_func_extended;
+   boolean disable_glsl_line_continuations;
+   boolean force_glsl_extensions_warn;
+   unsigned force_glsl_version;
boolean force_s3tc_enable;
 };
 
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
b/src/gallium/state_trackers/dri/common/dri_context.c
index b5445f8..b4ee2c8 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -42,12 +42,14 @@
 static void dri_fill_st_options(struct st_config_options *options,
 const struct driOptionCache * optionCache)
 {
-   options-force_glsl_extensions_warn =
-  driQueryOptionb(optionCache, force_glsl_extensions_warn);
-   options-disable_glsl_line_continuations =
-  driQueryOptionb(optionCache, disable_glsl_line_continuations);
options-disable_blend_func_extended =
   driQueryOptionb(optionCache, disable_blend_func_extended);
+   options-disable_glsl_line_continuations =
+  driQueryOptionb(optionCache, disable_glsl_line_continuations);
+   options-force_glsl_extensions_warn =
+  driQueryOptionb(optionCache, force_glsl_extensions_warn);
+   options-force_glsl_version =
+  driQueryOptioni(optionCache, force_glsl_version);
options-force_s3tc_enable =
   driQueryOptionb(optionCache, force_s3tc_enable);
 }
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index bb4d5b6..6e999b1 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -63,6 +63,7 @@ PUBLIC const char __driConfigOptions[] =
  DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false)
  DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false)
  DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false)
+ DRI_CONF_FORCE_GLSL_VERSION(0)
   DRI_CONF_SECTION_END
 
   DRI_CONF_SECTION_MISCELLANEOUS
@@ -72,7 +73,7 @@ PUBLIC const char __driConfigOptions[] =
 
 #define false 0
 
-static const uint __driNConfigOptions = 11;
+static const uint __driNConfigOptions = 12;
 
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c 
b/src/gallium/state_trackers/osmesa/osmesa.c
index 594372b..5b63b8b 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -546,6 +546,7 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, 
GLint stencilBits,
attribs.options.disable_blend_func_extended = FALSE;
attribs.options.disable_glsl_line_continuations = FALSE;
attribs.options.force_s3tc_enable = FALSE;
+   attribs.options.force_glsl_version = 0;
 
osmesa_init_st_visual(attribs.visual,
  PIPE_FORMAT_R8G8B8A8_UNORM,
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index 4f8fcab..a5bc20c 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -74,7 +74,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
gl_context *_ctx,
this-num_builtins_to_link = 0;
 
/* Set default language version and extensions */
-   this-language_version = 110;
+   this-language_version = ctx-Const.ForceGLSLVersion ?
+ctx-Const.ForceGLSLVersion : 110;
this-es_shader = false;
this-ARB_texture_rectangle_enable = true;
 
diff --git 

Mesa (master): driconf: enable app-specific workarounds for all drivers

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 7f2f804c75f6c7451c3630cb48e4675686bd68a7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f2f804c75f6c7451c3630cb48e4675686bd68a7

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:22 2013 +0200

driconf: enable app-specific workarounds for all drivers

They were only enabled for i965.

Note that drirc must be installed in /etc.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com
Reviewed-by: Ian Romanick ian.d.roman...@intel.com

---

 src/mesa/drivers/dri/common/drirc   |4 +++-
 src/mesa/drivers/dri/common/xmlconfig.c |4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/common/drirc 
b/src/mesa/drivers/dri/common/drirc
index 556d1b5..7c2d3ba 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -1,5 +1,7 @@
 driconf
-device screen=0 driver=i965
+!-- Please always enable app-specific workarounds for all drivers and
+ screens. --
+device
 application name=Unigine Sanctuary executable=Sanctuary
 option name=force_glsl_extensions_warn value=true /
 option name=disable_blend_func_extended value=true /
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c 
b/src/mesa/drivers/dri/common/xmlconfig.c
index 72483a4..5c97c20 100644
--- a/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/src/mesa/drivers/dri/common/xmlconfig.c
@@ -812,7 +812,9 @@ static void parseOptConfAttr (struct OptConfData *data, 
const XML_Char **attr) {
driOptionCache *cache = data-cache;
GLuint opt = findOption (cache, name);
if (cache-info[opt].name == NULL)
-   XML_WARNING (undefined option: %s., name);
+/* don't use XML_WARNING, drirc defines options for all drivers,
+ * but not all drivers support them */
+return;
else if (getenv (cache-info[opt].name))
  /* don't use XML_WARNING, we want the user to see this! */
fprintf (stderr, ATTENTION: option value of option %s ignored.\n,

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


Mesa (master): st/mesa: fix opcode translation for ARB_shader_bit_encoding functions

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 369c8291523682dda5df5a64aded89ff696370f2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=369c8291523682dda5df5a64aded89ff696370f2

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:25 2013 +0200

st/mesa: fix opcode translation for ARB_shader_bit_encoding functions

We treat the opcodes as MOVs, but we should at least change the type
of the expression, which later affects which TGSI opcode is chosen.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com

---

 src/mesa/state_tracker/st_glsl_to_tgsi.cpp |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 69c1b41..3dfd5e5 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1832,10 +1832,17 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
  emit(ir, TGSI_OPCODE_TRUNC, result_dst, op[0]);
   break;
case ir_unop_bitcast_f2i:
+  result_src = op[0];
+  result_src.type = GLSL_TYPE_INT;
+  break;
case ir_unop_bitcast_f2u:
+  result_src = op[0];
+  result_src.type = GLSL_TYPE_UINT;
+  break;
case ir_unop_bitcast_i2f:
case ir_unop_bitcast_u2f:
   result_src = op[0];
+  result_src.type = GLSL_TYPE_FLOAT;
   break;
case ir_unop_f2b:
   emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], st_src_reg_for_float(0.0));

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


Mesa (master): st/dri: add a new driconf option disable_shader_bit_encoding for Unigine

2013-07-30 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 7568a89500c35f14cbd397f87c77acc915afc672
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7568a89500c35f14cbd397f87c77acc915afc672

Author: Marek Olšák marek.ol...@amd.com
Date:   Tue Jul 30 22:29:27 2013 +0200

st/dri: add a new driconf option disable_shader_bit_encoding for Unigine

Now Unigine Heaven 3.0 finally works with r600g.

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Brian Paul bri...@vmware.com

---

 src/gallium/include/state_tracker/st_api.h |1 +
 .../state_trackers/dri/common/dri_context.c|2 ++
 src/gallium/state_trackers/dri/common/dri_screen.c |3 ++-
 src/gallium/state_trackers/osmesa/osmesa.c |1 +
 src/mesa/drivers/dri/common/drirc  |6 ++
 src/mesa/drivers/dri/common/xmlpool/t_options.h|5 +
 src/mesa/state_tracker/st_extensions.c |5 -
 7 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 539dec0..3ecd12e 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -241,6 +241,7 @@ struct st_config_options
 {
boolean disable_blend_func_extended;
boolean disable_glsl_line_continuations;
+   boolean disable_shader_bit_encoding;
boolean force_glsl_extensions_warn;
unsigned force_glsl_version;
boolean force_s3tc_enable;
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
b/src/gallium/state_trackers/dri/common/dri_context.c
index b4ee2c8..031e951 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -46,6 +46,8 @@ static void dri_fill_st_options(struct st_config_options 
*options,
   driQueryOptionb(optionCache, disable_blend_func_extended);
options-disable_glsl_line_continuations =
   driQueryOptionb(optionCache, disable_glsl_line_continuations);
+   options-disable_shader_bit_encoding =
+  driQueryOptionb(optionCache, disable_shader_bit_encoding);
options-force_glsl_extensions_warn =
   driQueryOptionb(optionCache, force_glsl_extensions_warn);
options-force_glsl_version =
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index 6e999b1..3b42b5a 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -63,6 +63,7 @@ PUBLIC const char __driConfigOptions[] =
  DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(false)
  DRI_CONF_DISABLE_GLSL_LINE_CONTINUATIONS(false)
  DRI_CONF_DISABLE_BLEND_FUNC_EXTENDED(false)
+ DRI_CONF_DISABLE_SHADER_BIT_ENCODING(false)
  DRI_CONF_FORCE_GLSL_VERSION(0)
   DRI_CONF_SECTION_END
 
@@ -73,7 +74,7 @@ PUBLIC const char __driConfigOptions[] =
 
 #define false 0
 
-static const uint __driNConfigOptions = 12;
+static const uint __driNConfigOptions = 13;
 
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen)
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c 
b/src/gallium/state_trackers/osmesa/osmesa.c
index 5b63b8b..9f9d2ad 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -545,6 +545,7 @@ OSMesaCreateContextExt(GLenum format, GLint depthBits, 
GLint stencilBits,
attribs.options.force_glsl_extensions_warn = FALSE;
attribs.options.disable_blend_func_extended = FALSE;
attribs.options.disable_glsl_line_continuations = FALSE;
+   attribs.options.disable_shader_bit_encoding = FALSE;
attribs.options.force_s3tc_enable = FALSE;
attribs.options.force_glsl_version = 0;
 
diff --git a/src/mesa/drivers/dri/common/drirc 
b/src/mesa/drivers/dri/common/drirc
index b5430ed..ebc04cd 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -18,6 +18,10 @@ Application bugs worked around in this file:
   fails to compile with GLSL 1.10.
   Adding #version 130 fixes this.
 
+* Unigine Heaven 3.0 with ARB_shader_bit_encoding uses a uint  int
+  expression, which fails (and should fail) to compile with any GLSL version.
+  Disabling ARB_shader_bit_encoding fixes this.
+
 TODO: document the other workarounds.
 
 --
@@ -40,12 +44,14 @@ TODO: document the other workarounds.
 option name=force_glsl_extensions_warn value=true /
 option name=disable_blend_func_extended value=true /
 option name=force_glsl_version value=130 /
+option name=disable_shader_bit_encoding value=true /
/application
 
 application name=Unigine Heaven (64-bit) executable=heaven_x64
 option name=force_glsl_extensions_warn value=true /
 option name=disable_blend_func_extended value=true /
 option name=force_glsl_version value=130 /
+option name=disable_shader_bit_encoding 

Mesa (9.1): r300g/swtcl: fix geometry corruption by uploading indices to a buffer

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: 4fb5c6f77b6ee26857c7fa8cb9d77485e6c3d548
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4fb5c6f77b6ee26857c7fa8cb9d77485e6c3d548

Author: Marek Olšák mar...@gmail.com
Date:   Mon Jul 15 02:42:44 2013 +0200

r300g/swtcl: fix geometry corruption by uploading indices to a buffer

The splitting of a draw call into several draw commands was broken, because
the split sometimes took place in the middle of a primitive. The splitting
was supposed to be dealing with the case when there are more indices than
the maximum size of a CS.

This commit throws that code away and uses a real index buffer instead.

https://bugs.freedesktop.org/show_bug.cgi?id=66558

Cc: mesa-sta...@lists.freedesktop.org
(cherry picked from commit 22427640b248aeb9875b40b216d27bedb13a1db8)

---

 src/gallium/drivers/r300/r300_context.c   |6 +--
 src/gallium/drivers/r300/r300_render.c|   63 +---
 src/gallium/drivers/r300/r300_screen_buffer.c |7 ++-
 3 files changed, 31 insertions(+), 45 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_context.c 
b/src/gallium/drivers/r300/r300_context.c
index 340a7f0..701a6b3 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -412,10 +412,8 @@ struct pipe_context* r300_create_context(struct 
pipe_screen* screen,
 r300-context.create_video_decoder = vl_create_decoder;
 r300-context.create_video_buffer = vl_video_buffer_create;
 
-if (r300screen-caps.has_tcl) {
-r300-uploader = u_upload_create(r300-context, 256 * 1024, 4,
- PIPE_BIND_INDEX_BUFFER);
-}
+r300-uploader = u_upload_create(r300-context, 256 * 1024, 4,
+ PIPE_BIND_CUSTOM);
 
 r300-blitter = util_blitter_create(r300-context);
 if (r300-blitter == NULL)
diff --git a/src/gallium/drivers/r300/r300_render.c 
b/src/gallium/drivers/r300/r300_render.c
index 1e79970..5416c3a 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -1005,60 +1005,45 @@ static void r300_render_draw_elements(struct 
vbuf_render* render,
 {
 struct r300_render* r300render = r300_render(render);
 struct r300_context* r300 = r300render-r300;
-struct radeon_winsys_cs *cs = r300-cs;
-unsigned end_cs_dwords;
 unsigned max_index = (r300-vbo-size - r300-draw_vbo_offset) /
  (r300render-r300-vertex_info.size * 4) - 1;
-unsigned short_count;
-unsigned free_dwords;
+struct pipe_resource *index_buffer = NULL;
+unsigned index_buffer_offset;
 
 CS_LOCALS(r300);
 DBG(r300, DBG_DRAW, r300: render_draw_elements (count: %d)\n, count);
 
+u_upload_data(r300-uploader, 0, count * 2, indices,
+  index_buffer_offset, index_buffer);
+if (!index_buffer) {
+return;
+}
+
 if (!r300_prepare_for_rendering(r300,
 PREP_EMIT_STATES |
 PREP_EMIT_VARRAYS_SWTCL | PREP_INDEXED,
-NULL, 256, 0, 0, -1)) {
+index_buffer, 12, 0, 0, -1)) {
+pipe_resource_reference(index_buffer, NULL);
 return;
 }
 
-/* Below we manage the CS space manually because there may be more
- * indices than it can fit in CS. */
-
-end_cs_dwords = r300_get_num_cs_end_dwords(r300);
-
-while (count) {
-free_dwords =
-RADEON_MAX_CMDBUF_DWORDS - r300-cs-cdw - end_cs_dwords - 6;
-
-short_count = MIN2(count, free_dwords * 2);
-
-BEGIN_CS(6);
-OUT_CS_REG(R300_GA_COLOR_CONTROL,
-r300_provoking_vertex_fixes(r300, r300render-prim));
-OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, max_index);
-OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, (short_count+1)/2);
-OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (short_count  16) |
-   r300render-hwprim);
-END_CS;
-
-memcpy(cs-buf+cs-cdw, indices, short_count * 2);
-cs-cdw += (short_count + 1) / 2;
+BEGIN_CS(12);
+OUT_CS_REG(R300_GA_COLOR_CONTROL,
+   r300_provoking_vertex_fixes(r300, r300render-prim));
+OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, max_index);
 
-/* OK now subtract the emitted indices and see if we need to emit
- * another draw packet. */
-indices += short_count;
-count -= short_count;
+OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0);
+OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count  16) |
+   r300render-hwprim);
 
-if (count) {
-if (!r300_prepare_for_rendering(r300,
-PREP_EMIT_VARRAYS_SWTCL | PREP_INDEXED,
-NULL, 256, 0, 0, -1))
-return;
+OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2);
+OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0  2));
+OUT_CS(index_buffer_offset);
+  

Mesa (9.1): i965/Gen4: Zero extra coordinates for ir_tex

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: 01b38d489c3dda7814873ba80df7d8918e8bce44
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=01b38d489c3dda7814873ba80df7d8918e8bce44

Author: Chris Forbes chr...@ijw.co.nz
Date:   Sun Jul 14 18:30:52 2013 +1200

i965/Gen4: Zero extra coordinates for ir_tex

We always emit U,V,R coordinates for this message, but the sampler gets
very angry if we pass garbage in the R coordinate for at least some
texture formats.

Fill the remaining coordinates with zero instead.

Fixes broken rendering on GM45 in Source games, and in VDrift.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65236

NOTE: This is a candidate for stable branches.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
(cherry picked from commit 121ea0b38bfee093e0bde0ff1443fc2efec688b0)

---

 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 3df4966..7276154 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -809,6 +809,10 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, 
fs_reg coordinate,
 emit(MOV(fs_reg(MRF, base_mrf + mlen + i), coordinate));
 coordinate.reg_offset++;
   }
+  /* zero the others. */
+  for (int i = ir-coordinate-type-vector_elements; i3; i++) {
+ emit(MOV(fs_reg(MRF, base_mrf + mlen + i), fs_reg(0.0f)));
+  }
   /* gen4's SIMD8 sampler always has the slots for u,v,r present. */
   mlen += 3;
} else if (ir-op == ir_txd) {

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


Mesa (9.1): r600g: increase array size for shader inputs and outputs

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: ebd1f4e069433d8be529b0c0bd9e5bd1b3e12bd9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ebd1f4e069433d8be529b0c0bd9e5bd1b3e12bd9

Author: Marek Olšák mar...@gmail.com
Date:   Fri Jul 19 17:49:54 2013 +0200

r600g: increase array size for shader inputs and outputs

and add assertions to prevent buffer overflow. This fixes corruption
of the r600_shader struct.

NOTE: This is a candidate for the stable branches.
(backported from commit da33f9b919039442e9ab51f9b1d1c83a73607133)

Conflicts:
src/gallium/drivers/r600/r600_shader.c

---

 src/gallium/drivers/r600/r600_shader.c |2 ++
 src/gallium/drivers/r600/r600_shader.h |4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index e0fb18b..9a37916 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -862,6 +862,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx)
switch (d-Declaration.File) {
case TGSI_FILE_INPUT:
i = ctx-shader-ninput++;
+assert(i  Elements(ctx-shader-input));
ctx-shader-input[i].name = d-Semantic.Name;
ctx-shader-input[i].sid = d-Semantic.Index;
ctx-shader-input[i].interpolate = d-Interp.Interpolate;
@@ -888,6 +889,7 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx)
break;
case TGSI_FILE_OUTPUT:
i = ctx-shader-noutput++;
+assert(i  Elements(ctx-shader-output));
ctx-shader-output[i].name = d-Semantic.Name;
ctx-shader-output[i].sid = d-Semantic.Index;
ctx-shader-output[i].gpr = ctx-file_offset[TGSI_FILE_OUTPUT] 
+ d-Range.First;
diff --git a/src/gallium/drivers/r600/r600_shader.h 
b/src/gallium/drivers/r600/r600_shader.h
index f55e002..3b918f9 100644
--- a/src/gallium/drivers/r600/r600_shader.h
+++ b/src/gallium/drivers/r600/r600_shader.h
@@ -45,8 +45,8 @@ struct r600_shader {
unsignedninput;
unsignednoutput;
unsignednlds;
-   struct r600_shader_io   input[32];
-   struct r600_shader_io   output[32];
+   struct r600_shader_io   input[40];
+   struct r600_shader_io   output[40];
boolean uses_kill;
boolean fs_write_all;
boolean two_side;

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


Mesa (9.1): mesa: implement mipmap generation for compressed 2D array textures

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: aa4938f0467761732e6b775137178a3a0976db54
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aa4938f0467761732e6b775137178a3a0976db54

Author: Brian Paul bri...@vmware.com
Date:   Tue Jul 16 06:04:32 2013 -0600

mesa: implement mipmap generation for compressed 2D array textures

We weren't looping over all the slices in the array.  The updated
code should also correctly handle 3D compressed textures too, whenever
we have that feature.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66850

NOTE: This is a candidate for the 9.x branches
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: José Fonseca jfons...@vmware.com
(cherry picked from commit 8a9df7a370b66ec50b6255e4d66ac1ed331319fb)

---

 src/mesa/main/mipmap.c |   59 +++-
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index a2f3767..887830c 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -2020,13 +2020,15 @@ generate_mipmap_compressed(struct gl_context *ctx, 
GLenum target,
GLint level;
gl_format temp_format;
GLint components;
-   GLuint temp_src_stride; /* in bytes */
+   GLuint temp_src_row_stride, temp_src_img_stride; /* in bytes */
GLubyte *temp_src = NULL, *temp_dst = NULL;
GLenum temp_datatype;
GLenum temp_base_format;
+   GLubyte **temp_src_slices, **temp_dst_slices;
 
/* only two types of compressed textures at this time */
assert(texObj-Target == GL_TEXTURE_2D ||
+ texObj-Target == GL_TEXTURE_2D_ARRAY ||
  texObj-Target == GL_TEXTURE_CUBE_MAP_ARB);
 
/*
@@ -2051,15 +2053,24 @@ generate_mipmap_compressed(struct gl_context *ctx, 
GLenum target,
 
 
/* allocate storage for the temporary, uncompressed image */
-   /* 20 extra bytes, just be safe when calling last FetchTexel */
-   temp_src_stride = _mesa_format_row_stride(temp_format, srcImage-Width);
-   temp_src = malloc(temp_src_stride * srcImage-Height + 20);
-   if (!temp_src) {
+   temp_src_row_stride = _mesa_format_row_stride(temp_format, srcImage-Width);
+   temp_src_img_stride = _mesa_format_image_size(temp_format, srcImage-Width,
+ srcImage-Height, 1);
+   temp_src = malloc(temp_src_img_stride * srcImage-Depth);
+
+   /* Allocate storage for arrays of slice pointers */
+   temp_src_slices = malloc(srcImage-Depth * sizeof(GLubyte *));
+   temp_dst_slices = malloc(srcImage-Depth * sizeof(GLubyte *));
+
+   if (!temp_src || !temp_src_slices || !temp_dst_slices) {
+  free(temp_src);
+  free(temp_src_slices);
+  free(temp_dst_slices);
   _mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
   return;
}
 
-   /* decompress base image to the temporary */
+   /* decompress base image to the temporary src buffer */
{
   /* save pixel packing mode */
   struct gl_pixelstore_attrib save = ctx-Pack;
@@ -2075,7 +2086,6 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum 
target,
   ctx-Pack = save;
}
 
-
for (level = texObj-BaseLevel; level  maxLevel; level++) {
   /* generate image[level+1] from image[level] */
   const struct gl_texture_image *srcImage;
@@ -2084,7 +2094,8 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum 
target,
   GLint dstWidth, dstHeight, dstDepth;
   GLint border;
   GLboolean nextLevel;
-  GLuint temp_dst_stride; /* in bytes */
+  GLuint temp_dst_row_stride, temp_dst_img_stride; /* in bytes */
+  GLuint i;
 
   /* get src image parameters */
   srcImage = _mesa_select_tex_image(ctx, texObj, target, level);
@@ -2100,9 +2111,12 @@ generate_mipmap_compressed(struct gl_context *ctx, 
GLenum target,
   if (!nextLevel)
 break;
 
-  temp_dst_stride = _mesa_format_row_stride(temp_format, dstWidth);
+  /* Compute dst image strides and alloc memory on first iteration */
+  temp_dst_row_stride = _mesa_format_row_stride(temp_format, dstWidth);
+  temp_dst_img_stride = _mesa_format_image_size(temp_format, dstWidth,
+dstHeight, 1);
   if (!temp_dst) {
-temp_dst = malloc(temp_dst_stride * dstHeight);
+temp_dst = malloc(temp_dst_img_stride * dstDepth);
 if (!temp_dst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, generate mipmaps);
break;
@@ -2117,13 +2131,23 @@ generate_mipmap_compressed(struct gl_context *ctx, 
GLenum target,
  return;
   }
 
-  /* rescale src image to dest image */
+  /* for 2D arrays, setup array[depth] of slice pointers */
+  for (i = 0; i  srcDepth; i++) {
+ temp_src_slices[i] = temp_src + temp_src_img_stride * i;
+  }
+  for (i = 0; i  dstDepth; i++) {
+ temp_dst_slices[i] = temp_dst + temp_dst_img_stride * i;
+  }
+
+  /* Rescale src image to dest image.
+   * This will loop over the slices of a 2D 

Mesa (9.1): Revert r300g: allow HiZ with a 16-bit zbuffer

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: b5477f1b3fbdf2c224a6cf7fc8a30c2a3eedab74
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5477f1b3fbdf2c224a6cf7fc8a30c2a3eedab74

Author: Marek Olšák mar...@gmail.com
Date:   Mon Jul 15 23:39:39 2013 +0200

Revert r300g: allow HiZ with a 16-bit zbuffer

This reverts commit 631c631cbf5b7e84e42a7cfffa1c206d63143370.

https://bugs.freedesktop.org/show_bug.cgi?id=66921

Cc: mesa-sta...@lists.freedesktop.org
(cherry picked from commit a882067d74840ab87e35018bca53081f8deb460b)

---

 src/gallium/drivers/r300/r300_texture_desc.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_texture_desc.c 
b/src/gallium/drivers/r300/r300_texture_desc.c
index 6d64528..bfacdc4 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.c
+++ b/src/gallium/drivers/r300/r300_texture_desc.c
@@ -349,6 +349,7 @@ static void r300_setup_hyperz_properties(struct r300_screen 
*screen,
 static unsigned hiz_align_y[4] = {8, 8, 8, 32};
 
 if (util_format_is_depth_or_stencil(tex-b.b.format) 
+util_format_get_blocksizebits(tex-b.b.format) == 32 
 tex-tex.microtile) {
 unsigned i, pipes;
 

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


Mesa (9.1): r300g/swtcl: fix a lockup in MSAA resolve

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: 2772ba41e0b09cb9bd66fbc2eb769bcb937380d7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2772ba41e0b09cb9bd66fbc2eb769bcb937380d7

Author: Marek Olšák mar...@gmail.com
Date:   Mon Jul 15 03:53:09 2013 +0200

r300g/swtcl: fix a lockup in MSAA resolve

Cc: mesa-sta...@lists.freedesktop.org
(cherry picked from commit 7969b567bd4361b44ead6ed5eb86218769a025be)

---

 src/gallium/drivers/r300/r300_render.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_render.c 
b/src/gallium/drivers/r300/r300_render.c
index 5416c3a..175b83a 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -1122,6 +1122,13 @@ void r300_blitter_draw_rectangle(struct blitter_context 
*blitter,
 static const union pipe_color_union zeros;
 CS_LOCALS(r300);
 
+/* XXX workaround for a lockup in MSAA resolve on SWTCL chipsets, this
+ * function most probably doesn't handle type=NONE correctly */
+if (!r300-screen-caps.has_tcl  type == UTIL_BLITTER_ATTRIB_NONE) {
+util_blitter_draw_rectangle(blitter, x1, y1, x2, y2, depth, type, 
attrib);
+return;
+}
+
 if (r300-skip_rendering)
 return;
 

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


Mesa (9.1): glsl: Handle empty if statement encountered during loop analysis.

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: 0f05066feab2863ff5b4570c8be129a8955996ee
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0f05066feab2863ff5b4570c8be129a8955996ee

Author: Paul Berry stereotype...@gmail.com
Date:   Wed Jul 24 08:04:44 2013 -0700

glsl: Handle empty if statement encountered during loop analysis.

The is_loop_terminator() function was asserting that the following
kind of if statement could never occur:

if (...) { } else { }

(presumably based on the assumption that such an if statement would be
eliminated by previous optimization stages).  But that isn't the
case--it's possible that previous optimization stages might simplify
more complex code down to this empty if statement, in which case it
won't be eliminated until the next time through the optimization loop.

So is_loop_terminator() needs to handle it.  Fortunately it's easy to
handle--it's not a loop terminator because it does nothing.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64330
CC: mesa-sta...@lists.freedesktop.org

Reviewed-by: Kenneth Graunke kenn...@whitecape.org
(cherry picked from commit a5eecb246d66fd8f27eca3c4f6f83bf2641b9403)

---

 src/glsl/loop_analysis.cpp |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp
index 6a0e4da..fae5768 100644
--- a/src/glsl/loop_analysis.cpp
+++ b/src/glsl/loop_analysis.cpp
@@ -505,7 +505,8 @@ is_loop_terminator(ir_if *ir)
 
ir_instruction *const inst =
   (ir_instruction *) ir-then_instructions.get_head();
-   assert(inst != NULL);
+   if (inst == NULL)
+  return false;
 
if (inst-ir_type != ir_type_loop_jump)
   return false;

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


Mesa (9.1): meta: handle 2D texture arrays in decompress_texture_image()

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: c94e507616166e3173cd654c62f45d9103de930e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c94e507616166e3173cd654c62f45d9103de930e

Author: Brian Paul bri...@vmware.com
Date:   Tue Jul 16 06:27:33 2013 -0600

meta: handle 2D texture arrays in decompress_texture_image()

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66850

NOTE: This is a candidate for the 9.x branches.
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: José Fonseca jfons...@vmware.com
(cherry picked from commit 484fa879847fdc7c9ef22231315f78a4c342e85d)

---

 src/mesa/drivers/common/meta.c |   23 +--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 486db25..1c36042 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -4052,10 +4052,29 @@ _mesa_meta_GetTexImage(struct gl_context *ctx,
_mesa_get_format_datatype(texImage-TexFormat)
== GL_UNSIGNED_NORMALIZED) {
   struct gl_texture_object *texObj = texImage-TexObject;
-  const GLuint slice = 0; /* only 2D compressed textures for now */
+  GLuint slice;
   /* Need to unlock the texture here to prevent deadlock... */
   _mesa_unlock_texture(ctx, texObj);
-  decompress_texture_image(ctx, texImage, slice, format, type, pixels);
+  for (slice = 0; slice  texImage-Depth; slice++) {
+ void *dst;
+ if (texImage-TexObject-Target == GL_TEXTURE_2D_ARRAY) {
+/* Setup pixel packing.  SkipPixels and SkipRows will be applied
+ * in the decompress_texture_image() function's call to
+ * glReadPixels but we need to compute the dest slice's address
+ * here (according to SkipImages and ImageHeight).
+ */
+struct gl_pixelstore_attrib packing = ctx-Pack;
+packing.SkipPixels = 0;
+packing.SkipRows = 0;
+dst = _mesa_image_address3d(packing, pixels, texImage-Width,
+texImage-Height, format, type,
+slice, 0, 0);
+ }
+ else {
+dst = pixels;
+ }
+ decompress_texture_image(ctx, texImage, slice, format, type, dst);
+  }
   /* ... and relock it */
   _mesa_lock_texture(ctx, texObj);
}

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


Mesa (9.1): mesa: handle 2D texture arrays in get_tex_rgba_compressed()

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: 81f0b980d00cd960c9e29d354333cb791cb54abd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81f0b980d00cd960c9e29d354333cb791cb54abd

Author: Brian Paul bri...@vmware.com
Date:   Mon Jul 15 10:23:49 2013 -0600

mesa: handle 2D texture arrays in get_tex_rgba_compressed()

If we call glGetTexImage() for a compressed 2D texture array we need
to loop over all the slices.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66850

NOTE: This is a candidate for the 9.x branches.
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: José Fonseca jfons...@vmware.com
(cherry picked from commit 2931bcb0d245c356ea9c467e792fd176790f9cfc)

---

 src/mesa/main/texgetimage.c |   52 +++---
 1 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 74b09ef..9c50c99 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -234,8 +234,8 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint 
dimensions,
const GLuint width = texImage-Width;
const GLuint height = texImage-Height;
const GLuint depth = texImage-Depth;
-   GLfloat *tempImage, *srcRow;
-   GLuint row;
+   GLfloat *tempImage, *tempSlice, *srcRow;
+   GLuint row, slice;
 
/* Decompress into temp float buffer, then pack into user buffer */
tempImage = malloc(width * height * depth
@@ -245,20 +245,22 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint 
dimensions,
   return;
}
 
-   /* Decompress the texture image - results in 'tempImage' */
-   {
+   /* Decompress the texture image slices - results in 'tempImage' */
+   for (slice = 0; slice  depth; slice++) {
   GLubyte *srcMap;
   GLint srcRowStride;
 
-  ctx-Driver.MapTextureImage(ctx, texImage, 0,
+  tempSlice = tempImage + slice * 4 * width * height;
+
+  ctx-Driver.MapTextureImage(ctx, texImage, slice,
   0, 0, width, height,
   GL_MAP_READ_BIT,
   srcMap, srcRowStride);
   if (srcMap) {
  _mesa_decompress_image(texFormat, width, height,
-srcMap, srcRowStride, tempImage);
+srcMap, srcRowStride, tempSlice);
 
- ctx-Driver.UnmapTextureImage(ctx, texImage, 0);
+ ctx-Driver.UnmapTextureImage(ctx, texImage, slice);
   }
   else {
  _mesa_error(ctx, GL_OUT_OF_MEMORY, glGetTexImage);
@@ -295,15 +297,19 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint 
dimensions,
   rebaseFormat);
}
 
-   srcRow = tempImage;
-   for (row = 0; row  height; row++) {
-  void *dest = _mesa_image_address(dimensions, ctx-Pack, pixels,
-   width, height, format, type,
-   0, row, 0);
-
-  _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) srcRow,
- format, type, dest, ctx-Pack, transferOps);
-  srcRow += width * 4;
+   tempSlice = tempImage;
+   for (slice = 0; slice  depth; slice++) {
+  srcRow = tempSlice;
+  for (row = 0; row  height; row++) {
+ void *dest = _mesa_image_address(dimensions, ctx-Pack, pixels,
+  width, height, format, type,
+  slice, row, 0);
+
+ _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) srcRow,
+format, type, dest, ctx-Pack, 
transferOps);
+ srcRow += 4 * width;
+  }
+  tempSlice += 4 * width * height;
}
 
free(tempImage);
@@ -617,18 +623,8 @@ _mesa_get_teximage(struct gl_context *ctx,
GLenum format, GLenum type, GLvoid *pixels,
struct gl_texture_image *texImage)
 {
-   GLuint dimensions;
-
-   switch (texImage-TexObject-Target) {
-   case GL_TEXTURE_1D:
-  dimensions = 1;
-  break;
-   case GL_TEXTURE_3D:
-  dimensions = 3;
-  break;
-   default:
-  dimensions = 2;
-   }
+   const GLuint dimensions =
+  _mesa_get_texture_dimensions(texImage-TexObject-Target);
 
/* map dest buffer, if PBO */
if (_mesa_is_bufferobj(ctx-Pack.BufferObj)) {

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


Mesa (9.1): i965/vs: Fix flaky texture swizzling

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: f437513bed58749b812f1f773631eca3c70ec673
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f437513bed58749b812f1f773631eca3c70ec673

Author: Chris Forbes chr...@ijw.co.nz
Date:   Wed Jul 24 07:21:22 2013 +1200

i965/vs: Fix flaky texture swizzling

If any component used the ZERO or ONE swizzle, its corresponding member
in the `swizzle` array would never be initialized. We *mostly* got away
with this, except when that memory happened to contain a value that
clobbered another channel when combined using BRW_SWIZZLE4().

NOTE: This is a candidate for stable branches.

Signed-off-by: Chris Forbes chr...@ijw.co.nz
Reviewed-by: Ian Romanick ian.d.roman...@intel.com
Reviewed-by: Kenneth Graunke kenn...@whitecape.org
(cherry picked from commit 124f567f1d575eaea98a6ae1d0a4687b8fb5bba2)

---

 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index a0b5c8c..86f9a33 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2285,7 +2285,7 @@ vec4_visitor::swizzle_result(ir_texture *ir, src_reg 
orig_val, int sampler)
}
 
int zero_mask = 0, one_mask = 0, copy_mask = 0;
-   int swizzle[4];
+   int swizzle[4] = {0};
 
for (int i = 0; i  4; i++) {
   switch (GET_SWZ(s, i)) {

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


Mesa (9.1): get-pick-list.sh: Include commits mentionining CC: mesa-stable ... in pick list

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: d2700c1a05cebdd3aa47b3350b33860a3c10d215
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2700c1a05cebdd3aa47b3350b33860a3c10d215

Author: Carl Worth cwo...@cworth.org
Date:   Tue Jul 30 12:36:37 2013 -0700

get-pick-list.sh: Include commits mentionining CC: mesa-stable... in pick list

We recently adopted a new convention that patches can be nominated for the
stable branch by including a line in the commit message as follows:

CC: mesa-sta...@lists.freedesktop.org

This is a convenient syntax as git send-email will notice this line and
automatically copy the resulting patch email to the mesa-stable mailing list.

Here we extend the regular expression in the get-pick-list.sh script to also
notice this pattern, (as well as the traditional NOTE: This patch is a
candidate... form.

---

 bin/get-pick-list.sh |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/bin/get-pick-list.sh b/bin/get-pick-list.sh
index d2b76e7..b9def6b 100755
--- a/bin/get-pick-list.sh
+++ b/bin/get-pick-list.sh
@@ -14,7 +14,7 @@ git log --reverse --grep=cherry picked from commit 
origin/master..HEAD |\
sed -e 's/^[[:space:]]*(cherry picked from commit[[:space:]]*//' -e 
's/)//'  already_picked
 
 # Grep for commits that were marked as a candidate for the stable tree.
-git log --reverse --pretty=%H -i --grep='^[[:space:]]*NOTE: .*[Cc]andidate' 
HEAD..origin/master |\
+git log --reverse --pretty=%H -i --grep='^\([[:space:]]*NOTE: 
.*[Cc]andidate\|CC:[[:space:]]*mesa-stable\)' HEAD..origin/master |\
 while read sha
 do
# Check to see whether the patch is on the ignore list.

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


Mesa (9.1): gallium/vl: add prime support

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: 6b6f29eb202c1e2f1a1b4fc3c4ac2456314842f1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b6f29eb202c1e2f1a1b4fc3c4ac2456314842f1

Author: Dave Airlie airl...@redhat.com
Date:   Thu Jul 25 13:31:26 2013 +1000

gallium/vl: add prime support

This fixes the dri2 opening to check if DRI_PRIME is set,
and picks the correct drm device path to open, this along
with a change to libvdpau allows vdpauinfo to work at least,

Martin Peres tested with nouveau, and there seems to be a
further issue with final displaying, it only works sometimes,
but this patch is at least necessary to help debug further.

Signed-off-by: Dave Airlie airl...@redhat.com
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Christian König christian.koe...@amd.com
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67283
Tested-by: Armin K. kre...@email.com
(cherry picked from commit 19338157c97becac1e61cc51dc0904ddfab8e9da)

---

 src/gallium/auxiliary/vl/vl_winsys_dri.c |   20 +++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c 
b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 560c914..91d52e4 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -32,8 +32,10 @@
 #include fcntl.h
 
 #include X11/Xlib-xcb.h
+#include X11/extensions/dri2tokens.h
 #include xcb/dri2.h
 #include xf86drm.h
+#include errno.h
 
 #include pipe/p_screen.h
 #include pipe/p_context.h
@@ -305,6 +307,7 @@ vl_screen_create(Display *display, int screen)
xcb_generic_error_t *error = NULL;
char *device_name;
int fd, device_name_length;
+   unsigned int driverType;
 
drm_magic_t magic;
 
@@ -332,7 +335,22 @@ vl_screen_create(Display *display, int screen)
s = xcb_setup_roots_iterator(xcb_get_setup(scrn-conn));
while (screen--)
xcb_screen_next(s);
-   connect_cookie = xcb_dri2_connect_unchecked(scrn-conn, s.data-root, 
XCB_DRI2_DRIVER_TYPE_DRI);
+   driverType = XCB_DRI2_DRIVER_TYPE_DRI;
+#ifdef DRI2DriverPrimeShift
+   {
+  char *prime = getenv(DRI_PRIME);
+  if (prime) {
+ unsigned int primeid;
+ errno = 0;
+ primeid = strtoul(prime, NULL, 0);
+ if (errno == 0)
+driverType |=
+   ((primeid  DRI2DriverPrimeMask)  DRI2DriverPrimeShift);
+  }
+   }
+#endif
+
+   connect_cookie = xcb_dri2_connect_unchecked(scrn-conn, s.data-root, 
driverType);
connect = xcb_dri2_connect_reply(scrn-conn, connect_cookie, NULL);
if (connect == NULL || connect-driver_name_length + 
connect-device_name_length == 0)
   goto free_screen;

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


Mesa (9.1): cherry-ignore: Drop 13 patches from the pick list

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: 30fc154945c0e6f78b3bc91a697577a985b84b1c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=30fc154945c0e6f78b3bc91a697577a985b84b1c

Author: Carl Worth cwo...@cworth.org
Date:   Tue Jul 30 12:35:00 2013 -0700

cherry-ignore: Drop 13 patches from the pick list

Each of these have recently been discussed with the original patch authors
(see posts to the mesa-sta...@lists.freedesktop.org mailing list).

---

 bin/.cherry-ignore |   25 +
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/bin/.cherry-ignore b/bin/.cherry-ignore
index 15a8e95..be95f17 100644
--- a/bin/.cherry-ignore
+++ b/bin/.cherry-ignore
@@ -39,3 +39,28 @@ fcaa48d9cc8937e0ceb59dfd22ef5b6e6fd1a273 glsl: Disallow 
return with a void argum
 
 # Rejected at author's request (attempted backport did not fix piglit test)
 4c3ed795662974a1c2ad2326fc74bef608a34f31 r600g: Workaround for a harware bug 
with nested loops on Cayman
+
+# These do not apply and the author has confirmed they should be dropped.
+49c1fc7044eaaa5c2dca05ff4a709be8e3636871 r600g: don't emit 
SQ_DYN_GPR_RESOURCE_LIMIT_1 on cayman
+4539f8e20af286d1f521eb016c89c6d9af0b801c r600g: don't emit surface_sync after 
FLUSH_AND_INV_EVENT
+
+# Backported as commit ca2df146429fba22ea8df3e8f9b76d84d391cf5f
+da33f9b919039442e9ab51f9b1d1c83a73607133 r600g: increase array size for shader 
inputs and outputs
+
+# Has potential to break previously-working (though technically incorrect) 
programs
+17856726c94000bf16156f7f9acea77a271a6005 glsl: Disallow auxiliary storage 
qualifiers on FS outputs.
+
+# Doesn't cherry-pick cleanly, and doesn't change the implementation (just 
cleans up compiler warning spam)
+803f755edeabd1b0af3d8f4ebf2005333e152ad4 glsl: Less const for glsl_type 
convenience accessors
+
+# Not needed for 9.1 (restores code never deleted from this branch)
+0e9549e2bd57168086421468cbf1db0821c36730 Revert i965: Delete pre-DRI2.3 
viewport hacks.
+
+# These are all intended for 9.2, not 9.1
+4e90bc9a12bea93c6b5522abe8151a8cfe1d6d1d gallium: Add PIPE_CAP_ENDIANNESS
+8c9d3c62f60a2819948bdfb005600cdc10aa2547 clover: Return correct value for 
CL_DEVICE_ENDIAN_LITTLE
+a3dcab43c6b6fed2f35aa0e802be6398985f100c clover: Pass corresponding 
module::argument to kernel::argument::bind().
+2265b40e377cc2c9d1091498df2aede5df2ff684 clover: Add kernel argument fields to 
allow differing host/target data types.
+829caf410e2c2c6f79902199da5a7900abc16129 clover: Byte-swap kernel arguments 
when host and device endianness differ.
+f64c0ca692d3e8c78dd9ae1f015f58f1dfc1c760 clover: Extend kernel arguments for 
differing host and device data types.
+df530829f757a8968389427eb26f45a0d46623fa clover: Respect kernel argument 
alignment restrictions.

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


Mesa (9.1): glsl: Classify layout like other identifiers.

2013-07-30 Thread Carl Worth
Module: Mesa
Branch: 9.1
Commit: 9688066bcaee041ea148e7dd60fba36012e00539
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9688066bcaee041ea148e7dd60fba36012e00539

Author: Kenneth Graunke kenn...@whitecape.org
Date:   Fri Jul 26 12:31:06 2013 -0700

glsl: Classify layout like other identifiers.

When layout isn't being lexed as LAYOUT_TOK, we should treat it like
an ordinary identifier.  This means we need to classify it to determine
whether we should return IDENTIFIER, TYPE_IDENTIFIER, or NEW_IDENTIFIER.

Fixes the WebGL conformance test shader-with-non-reserved-words.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64087
Signed-off-by: Kenneth Graunke kenn...@whitecape.org
Reviewed-by: Matt Turner matts...@gmail.com
Cc: mesa-sta...@lists.freedesktop.org
(cherry picked from commit c178ec0d7e8cc7007cb34e4f56f14261a057c200)

---

 src/glsl/glsl_lexer.ll |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index ddc9f80..f6aee4a 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -361,7 +361,7 @@ layout  {
  return LAYOUT_TOK;
   } else {
  yylval-identifier = strdup(yytext);
- return IDENTIFIER;
+ return classify_identifier(yyextra, yytext);
   }
}
 

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