[Mesa-dev] [PATCH] glsl: Fix clang mismatched-tags warnings with glsl_type.

2014-06-15 Thread Vinson Lee
Fix clang mismatched-tags warnings introduced with commit
4f5445a45d3ed02e00a061b10c943c0b079c6020.

./glsl_symbol_table.h:37:1: warning: class 'glsl_type' was previously declared 
as a struct [-Wmismatched-tags]
class glsl_type;
^
./glsl_types.h:86:8: note: previous use is here
struct glsl_type {
   ^
./glsl_symbol_table.h:37:1: note: did you mean struct here?
class glsl_type;
^

Signed-off-by: Vinson Lee v...@freedesktop.org
---
 src/glsl/glsl_symbol_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h
index 39b84e4..2528264 100644
--- a/src/glsl/glsl_symbol_table.h
+++ b/src/glsl/glsl_symbol_table.h
@@ -34,7 +34,7 @@ extern C {
 #include ir.h
 
 class symbol_table_entry;
-class glsl_type;
+struct glsl_type;
 
 /**
  * Facade class for _mesa_symbol_table
-- 
1.9.2

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


Re: [Mesa-dev] [PATCH] glsl: Fix clang mismatched-tags warnings with glsl_type.

2014-06-15 Thread Matt Turner
I just wrote the same patch tonight. :)

Reviewed-by: Matt Turner matts...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 75661] st_glsl_to_tgsi.cpp:637:get_opcode: Assertion `src0.type != GLSL_TYPE_STRUCT' failed.

2014-06-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75661

Vinson Lee v...@freedesktop.org changed:

   What|Removed |Added

 Blocks||79706

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


[Mesa-dev] [Bug 79706] [TRACKER] Mesa regression tracker

2014-06-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=79706

Vinson Lee v...@freedesktop.org changed:

   What|Removed |Added

 Depends on||75661

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


Re: [Mesa-dev] [PATCH] glsl: Fix clang mismatched-tags warnings with glsl_type.

2014-06-15 Thread Thomas Helland
Ooops. My bad. Thanks for fixing this. LGTM

Reading up on this warning it seems name mangling is pretty messed up with
MSVC.
I'll get a MSVC build system set up to make sure my future work
extraneous includes does not introduce issues with MSVC.


2014-06-15 9:38 GMT+02:00 Matt Turner matts...@gmail.com:

 I just wrote the same patch tonight. :)

 Reviewed-by: Matt Turner matts...@gmail.com

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


Re: [Mesa-dev] [PATCH] clover: Cache serialized binaries

2014-06-15 Thread Francisco Jerez
Tom Stellard thomas.stell...@amd.com writes:

 We were serializing the binaries once when clGetProgramInfo was called
 with CL_PROGRAM_BINARY_SIZES and then again when it was called with
 CL_PROGRAM_BINARIES.  This was slowing down some OpenCV tests which were
 building binary kernel caches.

 This improves the run-time of OpenCV's OCL_ImgProc/CvtColor8u.*
 test from 7 minutes to 1 minute.
 ---

Can you give the attached two patches a try?  I'm curious to see if they
have a comparable effect -- If they do I'd prefer to fix the underlying
object rather than caching binaries in serialized form.

Thanks.

[...]

From a500126213b073793184b0b6f170a58229340778 Mon Sep 17 00:00:00 2001
From: Francisco Jerez curroje...@riseup.net
Date: Sat, 14 Jun 2014 20:53:35 +0200
Subject: [PATCH 1/2] clover: Optimize module serialization for vectors of
 fundamental types.

---
 src/gallium/state_trackers/clover/core/module.cpp | 23 ++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/clover/core/module.cpp b/src/gallium/state_trackers/clover/core/module.cpp
index 3e3ad99..41de734 100644
--- a/src/gallium/state_trackers/clover/core/module.cpp
+++ b/src/gallium/state_trackers/clover/core/module.cpp
@@ -69,7 +69,9 @@ namespace {
 
/// (De)serialize a vector.
templatetypename T
-   struct _serializercompat::vectorT {
+   struct _serializercompat::vectorT,
+  typename std::enable_if
+ !std::is_scalarT::value::type {
   static void
   proc(compat::ostream os, const compat::vectorT v) {
  _procuint32_t(os, v.size());
@@ -87,6 +89,25 @@ namespace {
   }
};
 
+   templatetypename T
+   struct _serializercompat::vectorT,
+  typename std::enable_if
+ std::is_scalarT::value::type {
+  static void
+  proc(compat::ostream os, const compat::vectorT v) {
+ _procuint32_t(os, v.size());
+ os.write(reinterpret_castconst char *(v.begin()),
+  v.size() * sizeof(T));
+  }
+
+  static void
+  proc(compat::istream is, compat::vectorT v) {
+ v.reserve(_procuint32_t(is));
+ is.read(reinterpret_castchar *(v.begin()),
+ v.size() * sizeof(T));
+  }
+   };
+
/// (De)serialize a module::section.
template
struct _serializermodule::section {
-- 
1.9.2

From 1267038c2b0621dddc3d5c7718eed7ef2beb111b Mon Sep 17 00:00:00 2001
From: Francisco Jerez curroje...@riseup.net
Date: Sat, 14 Jun 2014 21:03:02 +0200
Subject: [PATCH 2/2] clover: Calculate the serialized size of a module
 efficiently.

---
 src/gallium/state_trackers/clover/api/program.cpp |  5 +---
 src/gallium/state_trackers/clover/core/module.cpp | 32 +++
 src/gallium/state_trackers/clover/core/module.hpp |  1 +
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
index fedc91d..a14baa3 100644
--- a/src/gallium/state_trackers/clover/api/program.cpp
+++ b/src/gallium/state_trackers/clover/api/program.cpp
@@ -190,10 +190,7 @@ clGetProgramInfo(cl_program d_prog, cl_program_info param,
 
case CL_PROGRAM_BINARY_SIZES:
   buf.as_vectorsize_t() = map([](const device dev) {
-compat::ostream::buffer_t bin;
-compat::ostream s(bin);
-prog.binary(dev).serialize(s);
-return bin.size();
+return prog.binary(dev).size();
  },
  prog.devices());
   break;
diff --git a/src/gallium/state_trackers/clover/core/module.cpp b/src/gallium/state_trackers/clover/core/module.cpp
index 41de734..55ed91a 100644
--- a/src/gallium/state_trackers/clover/core/module.cpp
+++ b/src/gallium/state_trackers/clover/core/module.cpp
@@ -52,6 +52,13 @@ namespace {
   return x;
}
 
+   /// Calculate the size of the specified object.
+   templatetypename T
+   void
+   _proc(module::size_t sz, const T x) {
+  _serializerT::proc(sz, x);
+   }
+
/// (De)serialize a scalar value.
templatetypename T
struct _serializerT, typename std::enable_if
@@ -65,6 +72,11 @@ namespace {
   proc(compat::istream is, T x) {
  is.read(reinterpret_castchar *(x), sizeof(x));
   }
+
+  static void
+  proc(module::size_t sz, const T x) {
+ sz += sizeof(x);
+  }
};
 
/// (De)serialize a vector.
@@ -87,6 +99,14 @@ namespace {
  for (size_t i = 0; i  v.size(); i++)
 new(v[i]) T(_procT(is));
   }
+
+  static void
+  proc(module::size_t sz, const compat::vectorT v) {
+ sz += sizeof(uint32_t);
+
+ for (size_t i = 0; i  v.size(); i++)
+_procT(sz, v[i]);
+  }
};
 
templatetypename T
@@ -106,6 +126,11 @@ namespace {
  is.read(reinterpret_castchar *(v.begin()),
  v.size() * sizeof(T));
   }
+
+  static void
+  

Re: [Mesa-dev] [PATCH] i965/vec4: unit test for copy propagation and writemask

2014-06-15 Thread Eric Anholt
Chia-I Wu olva...@gmail.com writes:

 This unit test demonstrates a subtle bug fixed by
 4ddf51db6af36736d5d42c1043eeea86e47459ce.

Reviewed-by: Eric Anholt e...@anholt.net


pgp_vjrlXGJiT.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: Fix clang mismatched-tags warnings with glsl_type.

2014-06-15 Thread Matt Turner
On Sun, Jun 15, 2014 at 3:58 AM, Thomas Helland
thomashellan...@gmail.com wrote:
 Ooops. My bad. Thanks for fixing this. LGTM

 Reading up on this warning it seems name mangling is pretty messed up with
 MSVC.
 I'll get a MSVC build system set up to make sure my future work
 extraneous includes does not introduce issues with MSVC.

I don't think you really need to bother. It didn't break anything, and
clang is also capable of warning about this.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/13] glsl: Remove 'struct' from ir_variable declaration.

2014-06-15 Thread Matt Turner
---
 src/glsl/opt_dead_builtin_varyings.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/opt_dead_builtin_varyings.cpp 
b/src/glsl/opt_dead_builtin_varyings.cpp
index 6612592..50c8aa7 100644
--- a/src/glsl/opt_dead_builtin_varyings.cpp
+++ b/src/glsl/opt_dead_builtin_varyings.cpp
@@ -334,7 +334,7 @@ public:
}
 
void prepare_array(exec_list *ir,
-  struct ir_variable **new_var,
+  ir_variable **new_var,
   int max_elements, unsigned start_location,
   const char *var_name, const char *mode_str,
   unsigned usage, unsigned external_usage)
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 03/13] egl: Remove unused variable dri_driver_path.

2014-06-15 Thread Matt Turner
---
 src/egl/drivers/dri2/egl_dri2.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index eb6abfd..cc7531c 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -304,8 +304,6 @@ const __DRIimageLookupExtension image_lookup_extension = {
.lookupEGLImage   = dri2_lookup_egl_image
 };
 
-static const char dri_driver_path[] = DEFAULT_DRIVER_DIR;
-
 struct dri2_extension_match {
const char *name;
int version;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 02/13] swrast: Remove unused solve_plane_recip().

2014-06-15 Thread Matt Turner
Unused since commit 9e8a961d.
---
 src/mesa/swrast/s_aatriangle.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c
index d670d31..2192827 100644
--- a/src/mesa/swrast/s_aatriangle.c
+++ b/src/mesa/swrast/s_aatriangle.c
@@ -112,20 +112,6 @@ solve_plane(GLfloat x, GLfloat y, const GLfloat plane[4])
 
 
 /*
- * Return 1 / solve_plane().
- */
-static inline GLfloat
-solve_plane_recip(GLfloat x, GLfloat y, const GLfloat plane[4])
-{
-   const GLfloat denom = plane[3] + plane[0] * x + plane[1] * y;
-   if (denom == 0.0F)
-  return 0.0F;
-   else
-  return -plane[2] / denom;
-}
-
-
-/*
  * Solve plane and return clamped GLchan value.
  */
 static inline GLchan
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 04/13] mesa: Mark default case unreachable to silence warning.

2014-06-15 Thread Matt Turner
Warned about 'coord' being undefined in the default case, which is
unreachable.
---
 src/mesa/drivers/common/meta.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index cab0dd8..dc9cce5 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2614,6 +2614,7 @@ _mesa_meta_setup_texture_coords(GLenum faceTarget,
 break;
  default:
 assert(0);
+unreachable();
  }
 
  coord[3] = (float) (slice / 6);
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 05/13] mesa: Remove unused extra_EXT_texture_integer.

2014-06-15 Thread Matt Turner
Unused since commit b6475f94.
---
 src/mesa/main/get.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9b56edb..74ef1c9 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -278,11 +278,6 @@ static const int extra_flush_current[] = {
EXTRA_END
 };
 
-static const int extra_EXT_texture_integer[] = {
-   EXT(EXT_texture_integer),
-   EXTRA_END
-};
-
 static const int extra_EXT_texture_integer_and_new_buffers[] = {
EXT(EXT_texture_integer),
EXTRA_NEW_BUFFERS,
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 06/13] mesa: Remove unused functions from perfomance query code.

2014-06-15 Thread Matt Turner
Perhaps useful for debugging? Never used otherwise. Added by commit
8cf5bdad.
---
 src/mesa/main/performance_monitor.c | 13 -
 1 file changed, 13 deletions(-)

diff --git a/src/mesa/main/performance_monitor.c 
b/src/mesa/main/performance_monitor.c
index 9d1a6b4..c26eda4 100644
--- a/src/mesa/main/performance_monitor.c
+++ b/src/mesa/main/performance_monitor.c
@@ -164,19 +164,6 @@ counterid_to_index(GLuint counterid)
return counterid - 1;
 }
 
-static inline GLuint
-index_to_counterid(GLuint index)
-{
-   return index + 1;
-}
-
-static inline bool
-counterid_valid(const struct gl_perf_monitor_group *group_obj,
-GLuint counterid)
-{
-   return get_counter(group_obj, counterid_to_index(counterid)) != NULL;
-}
-
 /*/
 
 void GLAPIENTRY
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 10/13] i965/blorp: Mark branch unreachable to silence uninitialized var warning.

2014-06-15 Thread Matt Turner
---
 src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 064a5fb..17d9325 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -340,6 +340,7 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct 
brw_context *brw,
 break;
  default:
 assert(!Unexpected sample count for fast clear);
+unreachable();
 break;
  }
  y_scaledown = 2;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 08/13] i965: Mark backend_instruction and bblock_t as structs.

2014-06-15 Thread Matt Turner
They have to be marked as structs for C code elsewhere. bblock_t is
already defined as a struct, and all of backend_instruction's fields are
public anyway.
---
 src/mesa/drivers/dri/i965/brw_fs.h | 2 +-
 src/mesa/drivers/dri/i965/brw_shader.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index f9e0daf..62ea986 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -54,7 +54,7 @@ extern C {
 
 #define MAX_SAMPLER_MESSAGE_SIZE 11
 
-class bblock_t;
+struct bblock_t;
 namespace {
struct acp_entry;
 }
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h 
b/src/mesa/drivers/dri/i965/brw_shader.h
index cb47cdb..e602bcd 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -43,7 +43,7 @@ enum PACKED register_file {
 
 class cfg_t;
 
-class backend_instruction : public exec_node {
+struct backend_instruction : public exec_node {
 public:
bool is_tex() const;
bool is_math() const;
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 07/13] i965: Use standard SSE intrinsics instead of gcc built-ins.

2014-06-15 Thread Matt Turner
---
 src/mesa/drivers/dri/i965/intel_tex_subimage.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
index 5d79750..fe909e4 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
@@ -42,6 +42,10 @@
 #include intel_mipmap_tree.h
 #include intel_blit.h
 
+#ifdef __SSSE3__
+#include tmmintrin.h
+#endif
+
 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
 
 #define ALIGN_DOWN(a, b) ROUND_DOWN_TO(a, b)
@@ -174,13 +178,11 @@ err:
 static const uint8_t rgba8_permutation[16] =
{ 2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15 };
 
-typedef char v16 __attribute__((vector_size(16)));
-
 /* NOTE: dst must be 16 byte aligned */
 #define rgba8_copy_16(dst, src) \
-   *(v16*)(dst) = __builtin_ia32_pshufb128( \
-   (v16) __builtin_ia32_loadups((float*)(src)), \
-  *(v16*) rgba8_permutation \
+   *(__m128i *)(dst) = _mm_shuffle_epi8(\
+   (__m128i) _mm_loadu_ps((float*)(src)),   \
+  *(__m128i *) rgba8_permutation\
)
 #endif
 
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 11/13] i965/blorp: Remove unused 'brw' member.

2014-06-15 Thread Matt Turner
---
 src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 17d9325..5efdf71 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -99,7 +99,6 @@ private:
void alloc_regs();
 
void *mem_ctx;
-   struct brw_context *brw;
const brw_blorp_const_color_prog_key *key;
struct brw_compile func;
 
@@ -120,7 +119,6 @@ 
brw_blorp_const_color_program::brw_blorp_const_color_program(
   struct brw_context *brw,
   const brw_blorp_const_color_prog_key *key)
: mem_ctx(ralloc_context(NULL)),
- brw(brw),
  key(key),
  R0(),
  R1(),
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 12/13] i965/disasm: Mark three_source_reg_encoding[] static.

2014-06-15 Thread Matt Turner
---
 src/mesa/drivers/dri/i965/brw_disasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c 
b/src/mesa/drivers/dri/i965/brw_disasm.c
index 99052f8..c10a12f 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -259,7 +259,7 @@ static const char * const reg_encoding[8] = {
 [7] = F
 };
 
-const char * const three_source_reg_encoding[] = {
+static const char * const three_source_reg_encoding[] = {
[BRW_3SRC_TYPE_F]  = F,
[BRW_3SRC_TYPE_D]  = D,
[BRW_3SRC_TYPE_UD] = UD,
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 09/13] i965: Silence warning about unused brw in release builds.

2014-06-15 Thread Matt Turner
---
 src/mesa/drivers/dri/i965/brw_eu_emit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index c18b783..daf4eb1 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -2654,8 +2654,7 @@ void brw_shader_time_add(struct brw_compile *p,
  struct brw_reg payload,
  uint32_t surf_index)
 {
-   struct brw_context *brw = p-brw;
-   assert(brw-gen = 7);
+   assert(p-brw-gen = 7);
 
brw_push_insn_state(p);
brw_set_default_access_mode(p, BRW_ALIGN_1);
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 13/13] i965/vec4/gs: Silence warning about unused 'success' in release build.

2014-06-15 Thread Matt Turner
---
 src/mesa/drivers/dri/i965/brw_vec4_gs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs.c 
b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
index b48c420..4b1ba36 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c
@@ -309,6 +309,7 @@ brw_upload_gs_prog(struct brw_context *brw)
  do_gs_prog(brw, ctx-_Shader-CurrentProgram[MESA_SHADER_GEOMETRY], 
gp,
 key);
   assert(success);
+  (void)success;
}
brw-gs.base.prog_data = brw-gs.prog_data-base.base;
 
-- 
1.8.3.2

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


[Mesa-dev] [PATCH v2 1/3] nvc0: implement multiple viewports/scissors, enable ARB_viewport_array

2014-06-15 Thread Tobias Klausmann
Signed-off-by: Tobias Klausmann tobias.johannes.klausm...@mni.thm.de
---
 src/gallium/drivers/nouveau/nvc0/nvc0_context.h|   7 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_program.c|   2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c |  20 ++--
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.h |   3 +
 src/gallium/drivers/nouveau/nvc0/nvc0_state.c  |  27 +++--
 .../drivers/nouveau/nvc0/nvc0_state_validate.c | 116 +
 6 files changed, 112 insertions(+), 63 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
index 76416a0..674dd3c 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
@@ -178,8 +178,11 @@ struct nvc0_context {
struct pipe_blend_color blend_colour;
struct pipe_stencil_ref stencil_ref;
struct pipe_poly_stipple stipple;
-   struct pipe_scissor_state scissor;
-   struct pipe_viewport_state viewport;
+
+   struct pipe_scissor_state scissors[NVC0_MAX_VIEWPORTS];
+   unsigned scissors_dirty;
+   struct pipe_viewport_state viewports[NVC0_MAX_VIEWPORTS];
+   unsigned viewports_dirty;
struct pipe_clip_state clip;
 
unsigned sample_mask;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
index 1c82a9a..667fbc8 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
@@ -64,7 +64,7 @@ nvc0_shader_output_address(unsigned sn, unsigned si, unsigned 
ubase)
case NV50_SEMANTIC_TESSFACTOR:return 0x000 + si * 0x4;
case TGSI_SEMANTIC_PRIMID:return 0x060;
case TGSI_SEMANTIC_LAYER: return 0x064;
-   case NV50_SEMANTIC_VIEWPORTINDEX: return 0x068;
+   case TGSI_SEMANTIC_VIEWPORT_INDEX:return 0x068;
case TGSI_SEMANTIC_PSIZE: return 0x06c;
case TGSI_SEMANTIC_POSITION:  return 0x070;
case TGSI_SEMANTIC_GENERIC:   return ubase + si * 0x10;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
index 3e6b011..3fdb6ae 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
@@ -183,7 +183,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_FAKE_SW_MSAA:
   return 0;
case PIPE_CAP_MAX_VIEWPORTS:
-  return 1;
+  return NVC0_MAX_VIEWPORTS;
case PIPE_CAP_TEXTURE_QUERY_LOD:
case PIPE_CAP_SAMPLE_SHADING:
case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
@@ -933,19 +933,23 @@ nvc0_screen_create(struct nouveau_device *dev)
 
BEGIN_NVC0(push, NVC0_3D(VIEWPORT_TRANSFORM_EN), 1);
PUSH_DATA (push, 1);
-   BEGIN_NVC0(push, NVC0_3D(DEPTH_RANGE_NEAR(0)), 2);
-   PUSH_DATAf(push, 0.0f);
-   PUSH_DATAf(push, 1.0f);
+   for (i = 0; i  NVC0_MAX_VIEWPORTS; i++) {
+  BEGIN_NVC0(push, NVC0_3D(DEPTH_RANGE_NEAR(i)), 2);
+  PUSH_DATAf(push, 0.0f);
+  PUSH_DATAf(push, 1.0f);
+   }
BEGIN_NVC0(push, NVC0_3D(VIEW_VOLUME_CLIP_CTRL), 1);
PUSH_DATA (push, NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK1_UNK1);
 
/* We use scissors instead of exact view volume clipping,
 * so they're always enabled.
 */
-   BEGIN_NVC0(push, NVC0_3D(SCISSOR_ENABLE(0)), 3);
-   PUSH_DATA (push, 1);
-   PUSH_DATA (push, 8192  16);
-   PUSH_DATA (push, 8192  16);
+   for (i = 0; i  NVC0_MAX_VIEWPORTS; i++) {
+  BEGIN_NVC0(push, NVC0_3D(SCISSOR_ENABLE(i)), 3);
+  PUSH_DATA (push, 1);
+  PUSH_DATA (push, 8192  16);
+  PUSH_DATA (push, 8192  16);
+   }
 
 #define MK_MACRO(m, n) i = nvc0_graph_set_macro(screen, m, i, sizeof(n), n);
 
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h 
b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
index c58add5..4802057 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
@@ -20,6 +20,9 @@
 
 #define NVC0_MAX_SURFACE_SLOTS 16
 
+#define NVC0_MAX_VIEWPORTS 16
+
+
 struct nvc0_context;
 
 struct nvc0_blitter;
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index 27e5cd8..c92aaac 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -909,10 +909,17 @@ nvc0_set_scissor_states(struct pipe_context *pipe,
 unsigned num_scissors,
 const struct pipe_scissor_state *scissor)
 {
-struct nvc0_context *nvc0 = nvc0_context(pipe);
+   struct nvc0_context *nvc0 = nvc0_context(pipe);
+   int i;
 
-nvc0-scissor = *scissor;
-nvc0-dirty |= NVC0_NEW_SCISSOR;
+   assert(start_slot + num_scissors = NVC0_MAX_VIEWPORTS);
+   for (i = 0; i  num_scissors; i++) {
+  if (!memcmp(nvc0-scissors[start_slot + i], scissor[i], 
sizeof(*scissor)))
+ continue;
+  nvc0-scissors[start_slot + i] = scissor[i];
+  nvc0-scissors_dirty |= 1  

[Mesa-dev] [PATCH v2 2/3] docs: update GL3.txt, relnotes: mark GL_ARB_viewport_array as done for nvc0

2014-06-15 Thread Tobias Klausmann
Signed-off-by: Tobias Klausmann tobias.johannes.klausm...@mni.thm.de
---
 docs/GL3.txt| 2 +-
 docs/relnotes/10.3.html | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index f5f940c..a392b92 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -132,7 +132,7 @@ GL 4.1:
   GL_ARB_separate_shader_objects   DONE (all drivers)
   GL_ARB_shader_precision  not started
   GL_ARB_vertex_attrib_64bit   not started
-  GL_ARB_viewport_arrayDONE (i965, nv50, r600)
+  GL_ARB_viewport_arrayDONE (i965, nv50, nvc0, 
r600)
 
 
 GL 4.2:
diff --git a/docs/relnotes/10.3.html b/docs/relnotes/10.3.html
index 7ceaca4..6859a89 100644
--- a/docs/relnotes/10.3.html
+++ b/docs/relnotes/10.3.html
@@ -48,6 +48,7 @@ Note: some of the new features are only available with 
certain drivers.
 liGL_ARB_stencil_texturing on nv50, nvc0, r600, and radeonsi/li
 liGL_ARB_texture_cube_map_array on radeonsi/li
 liGL_ARB_compressed_texture_pixel_storage on all drivers/li
+liGL_ARB_viewport_array on nvc0/li
 /ul
 
 
-- 
1.8.4.5

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


[Mesa-dev] [PATCH v2 0/3] ARB_viewport_array for nvc0

2014-06-15 Thread Tobias Klausmann
This patch-series implements the ARB_viewport_array for nvc0 and does
a little house-cleanig afterwords.

V2: 
  Add Release-Notes, mark this in GL3 as done for nvc0
  Don't mark the scissors dirty when we don't need to do that

Tobias Klausmann (3):
  nvc0: implement multiple viewports/scissors, enable ARB_viewport_array
  docs: update GL3.txt, relnotes: mark GL_ARB_viewport_array as done for
nvc0
  nv50/ir: Remove NV50_SEMANTIC_VIEWPORTINDEX

 docs/GL3.txt   |   2 +-
 docs/relnotes/10.3.html|   1 +
 .../drivers/nouveau/codegen/nv50_ir_driver.h   |   1 -
 .../nouveau/codegen/nv50_ir_target_nv50.cpp|   2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_context.h|   7 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_program.c|   2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c |  20 ++--
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.h |   3 +
 src/gallium/drivers/nouveau/nvc0/nvc0_state.c  |  27 +++--
 .../drivers/nouveau/nvc0/nvc0_state_validate.c | 116 +
 10 files changed, 115 insertions(+), 66 deletions(-)

-- 
1.8.4.5

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


[Mesa-dev] [PATCH v2 3/3] nv50/ir: Remove NV50_SEMANTIC_VIEWPORTINDEX

2014-06-15 Thread Tobias Klausmann
Use TGSI_SEMANTIC_VIEWPORT_INDEX for the last consumer.

Signed-off-by: Tobias Klausmann tobias.johannes.klausm...@mni.thm.de
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h| 1 -
 src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
index f829aac..c885c8c 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
@@ -70,7 +70,6 @@ struct nv50_ir_varying
 #endif
 
 #define NV50_SEMANTIC_CLIPDISTANCE  (TGSI_SEMANTIC_COUNT + 0)
-#define NV50_SEMANTIC_VIEWPORTINDEX (TGSI_SEMANTIC_COUNT + 4)
 #define NV50_SEMANTIC_TESSFACTOR(TGSI_SEMANTIC_COUNT + 7)
 #define NV50_SEMANTIC_TESSCOORD (TGSI_SEMANTIC_COUNT + 8)
 #define NV50_SEMANTIC_COUNT (TGSI_SEMANTIC_COUNT + 10)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
index abadc7f..b0d617a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target_nv50.cpp
@@ -538,7 +538,7 @@ recordLocation(uint16_t *locs, uint8_t *masks,
case TGSI_SEMANTIC_VERTEXID: locs[SV_VERTEX_ID] = addr; break;
case TGSI_SEMANTIC_PRIMID: locs[SV_PRIMITIVE_ID] = addr; break;
case TGSI_SEMANTIC_LAYER: locs[SV_LAYER] = addr; break;
-   case NV50_SEMANTIC_VIEWPORTINDEX: locs[SV_VIEWPORT_INDEX] = addr; break;
+   case TGSI_SEMANTIC_VIEWPORT_INDEX: locs[SV_VIEWPORT_INDEX] = addr; break;
default:
   break;
}
-- 
1.8.4.5

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


Re: [Mesa-dev] [PATCH 05/13] mesa: Remove unused extra_EXT_texture_integer.

2014-06-15 Thread Marek Olšák
Reviewed-by: Marek Olšák marek.ol...@amd.com

Marek

On Sun, Jun 15, 2014 at 7:17 PM, Matt Turner matts...@gmail.com wrote:
 Unused since commit b6475f94.
 ---
  src/mesa/main/get.c | 5 -
  1 file changed, 5 deletions(-)

 diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
 index 9b56edb..74ef1c9 100644
 --- a/src/mesa/main/get.c
 +++ b/src/mesa/main/get.c
 @@ -278,11 +278,6 @@ static const int extra_flush_current[] = {
 EXTRA_END
  };

 -static const int extra_EXT_texture_integer[] = {
 -   EXT(EXT_texture_integer),
 -   EXTRA_END
 -};
 -
  static const int extra_EXT_texture_integer_and_new_buffers[] = {
 EXT(EXT_texture_integer),
 EXTRA_NEW_BUFFERS,
 --
 1.8.3.2

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


Re: [Mesa-dev] [PATCH 07/13] i965: Use standard SSE intrinsics instead of gcc built-ins.

2014-06-15 Thread Frank Henigman
On Sun, Jun 15, 2014 at 1:18 PM, Matt Turner matts...@gmail.com wrote:
 ---
  src/mesa/drivers/dri/i965/intel_tex_subimage.c | 12 +++-
  1 file changed, 7 insertions(+), 5 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/intel_tex_subimage.c 
 b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
 index 5d79750..fe909e4 100644
 --- a/src/mesa/drivers/dri/i965/intel_tex_subimage.c
 +++ b/src/mesa/drivers/dri/i965/intel_tex_subimage.c
 @@ -42,6 +42,10 @@
  #include intel_mipmap_tree.h
  #include intel_blit.h

 +#ifdef __SSSE3__
 +#include tmmintrin.h
 +#endif
 +
  #define FILE_DEBUG_FLAG DEBUG_TEXTURE

  #define ALIGN_DOWN(a, b) ROUND_DOWN_TO(a, b)
 @@ -174,13 +178,11 @@ err:
  static const uint8_t rgba8_permutation[16] =
 { 2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15 };

 -typedef char v16 __attribute__((vector_size(16)));
 -
  /* NOTE: dst must be 16 byte aligned */
  #define rgba8_copy_16(dst, src) \
 -   *(v16*)(dst) = __builtin_ia32_pshufb128( \
 -   (v16) __builtin_ia32_loadups((float*)(src)), \
 -  *(v16*) rgba8_permutation \
 +   *(__m128i *)(dst) = _mm_shuffle_epi8(\
 +   (__m128i) _mm_loadu_ps((float*)(src)),   \
 +  *(__m128i *) rgba8_permutation\
 )
  #endif

 --
 1.8.3.2


Reviewed-by: Frank Henigman fjhenig...@google.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 1/3] nvc0: implement multiple viewports/scissors, enable ARB_viewport_array

2014-06-15 Thread Ilia Mirkin
I've made a few small fixes to this -- you forget to set the
scissors/viewports dirty to ~0 on context switch, and also marking the
first scissor dirty after a 3d blit (which I was forgetting to do on
nv50 as well... oops). I'll push this out shortly with my
modifications.

Thanks for the contribution!

  -ilia

On Sun, Jun 15, 2014 at 3:24 PM, Tobias Klausmann
tobias.johannes.klausm...@mni.thm.de wrote:
 Signed-off-by: Tobias Klausmann tobias.johannes.klausm...@mni.thm.de
 ---
  src/gallium/drivers/nouveau/nvc0/nvc0_context.h|   7 +-
  src/gallium/drivers/nouveau/nvc0/nvc0_program.c|   2 +-
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c |  20 ++--
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.h |   3 +
  src/gallium/drivers/nouveau/nvc0/nvc0_state.c  |  27 +++--
  .../drivers/nouveau/nvc0/nvc0_state_validate.c | 116 
 +
  6 files changed, 112 insertions(+), 63 deletions(-)

 diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h 
 b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
 index 76416a0..674dd3c 100644
 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
 +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
 @@ -178,8 +178,11 @@ struct nvc0_context {
 struct pipe_blend_color blend_colour;
 struct pipe_stencil_ref stencil_ref;
 struct pipe_poly_stipple stipple;
 -   struct pipe_scissor_state scissor;
 -   struct pipe_viewport_state viewport;
 +
 +   struct pipe_scissor_state scissors[NVC0_MAX_VIEWPORTS];
 +   unsigned scissors_dirty;
 +   struct pipe_viewport_state viewports[NVC0_MAX_VIEWPORTS];
 +   unsigned viewports_dirty;
 struct pipe_clip_state clip;

 unsigned sample_mask;
 diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c 
 b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
 index 1c82a9a..667fbc8 100644
 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
 +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
 @@ -64,7 +64,7 @@ nvc0_shader_output_address(unsigned sn, unsigned si, 
 unsigned ubase)
 case NV50_SEMANTIC_TESSFACTOR:return 0x000 + si * 0x4;
 case TGSI_SEMANTIC_PRIMID:return 0x060;
 case TGSI_SEMANTIC_LAYER: return 0x064;
 -   case NV50_SEMANTIC_VIEWPORTINDEX: return 0x068;
 +   case TGSI_SEMANTIC_VIEWPORT_INDEX:return 0x068;
 case TGSI_SEMANTIC_PSIZE: return 0x06c;
 case TGSI_SEMANTIC_POSITION:  return 0x070;
 case TGSI_SEMANTIC_GENERIC:   return ubase + si * 0x10;
 diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
 b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 index 3e6b011..3fdb6ae 100644
 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 @@ -183,7 +183,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_FAKE_SW_MSAA:
return 0;
 case PIPE_CAP_MAX_VIEWPORTS:
 -  return 1;
 +  return NVC0_MAX_VIEWPORTS;
 case PIPE_CAP_TEXTURE_QUERY_LOD:
 case PIPE_CAP_SAMPLE_SHADING:
 case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
 @@ -933,19 +933,23 @@ nvc0_screen_create(struct nouveau_device *dev)

 BEGIN_NVC0(push, NVC0_3D(VIEWPORT_TRANSFORM_EN), 1);
 PUSH_DATA (push, 1);
 -   BEGIN_NVC0(push, NVC0_3D(DEPTH_RANGE_NEAR(0)), 2);
 -   PUSH_DATAf(push, 0.0f);
 -   PUSH_DATAf(push, 1.0f);
 +   for (i = 0; i  NVC0_MAX_VIEWPORTS; i++) {
 +  BEGIN_NVC0(push, NVC0_3D(DEPTH_RANGE_NEAR(i)), 2);
 +  PUSH_DATAf(push, 0.0f);
 +  PUSH_DATAf(push, 1.0f);
 +   }
 BEGIN_NVC0(push, NVC0_3D(VIEW_VOLUME_CLIP_CTRL), 1);
 PUSH_DATA (push, NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK1_UNK1);

 /* We use scissors instead of exact view volume clipping,
  * so they're always enabled.
  */
 -   BEGIN_NVC0(push, NVC0_3D(SCISSOR_ENABLE(0)), 3);
 -   PUSH_DATA (push, 1);
 -   PUSH_DATA (push, 8192  16);
 -   PUSH_DATA (push, 8192  16);
 +   for (i = 0; i  NVC0_MAX_VIEWPORTS; i++) {
 +  BEGIN_NVC0(push, NVC0_3D(SCISSOR_ENABLE(i)), 3);
 +  PUSH_DATA (push, 1);
 +  PUSH_DATA (push, 8192  16);
 +  PUSH_DATA (push, 8192  16);
 +   }

  #define MK_MACRO(m, n) i = nvc0_graph_set_macro(screen, m, i, sizeof(n), n);

 diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h 
 b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
 index c58add5..4802057 100644
 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
 +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.h
 @@ -20,6 +20,9 @@

  #define NVC0_MAX_SURFACE_SLOTS 16

 +#define NVC0_MAX_VIEWPORTS 16
 +
 +
  struct nvc0_context;

  struct nvc0_blitter;
 diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c 
 b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
 index 27e5cd8..c92aaac 100644
 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
 +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
 @@ -909,10 +909,17 @@ nvc0_set_scissor_states(struct pipe_context *pipe,
  unsigned num_scissors,
  const struct 

Re: [Mesa-dev] [PATCH] i965/Gen7: Fix HiZ ops for MSAA depth

2014-06-15 Thread Chris Forbes
Ping.

This has been broken for ages, and at least tesseract is carrying
hacks to work around it (extra color buffer containing depth values,
in their g-buffer). Getting rid of that wins us about 15%.

-- Chris

On Sat, Feb 8, 2014 at 3:54 PM, Chris Forbes chr...@ijw.co.nz wrote:
 Previously, we would program the sample count based on the blorp
 operation's dst sample count -- which is zero for a HiZ op; we'd also
 ignore the difference between physical and logical surface size for
 the depth surface.

 That kindof worked -- the two errors almost cancel out -- but produced
 strange blocky artifacts.

 Instead, program the sample count properly, and use the logical
 dimensions of the depth surface.

 Fixes broken rendering in `Tesseract` with msaa=4 glineardepth=0

 NOTE: I've hacked the BLORP depth alignment code a bit (at `Not quite
 sure ...`). This is almost certainly not the right thing.

 Signed-off-by: Chris Forbes chr...@ijw.co.nz
 ---
  src/mesa/drivers/dri/i965/gen7_blorp.cpp | 41 
 +++-
  1 file changed, 25 insertions(+), 16 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
 b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 index 4bf9396..58dc497 100644
 --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
 @@ -447,7 +447,8 @@ gen7_blorp_emit_streamout_disable(struct brw_context *brw,

  static void
  gen7_blorp_emit_sf_config(struct brw_context *brw,
 -  const brw_blorp_params *params)
 +  const brw_blorp_params *params,
 +  int num_samples)
  {
 /* 3DSTATE_SF
  *
 @@ -472,7 +473,7 @@ gen7_blorp_emit_sf_config(struct brw_context *brw,
OUT_BATCH(_3DSTATE_SF  16 | (7 - 2));
OUT_BATCH(params-depth_format 
  GEN7_SF_DEPTH_BUFFER_SURFACE_FORMAT_SHIFT);
 -  OUT_BATCH(params-dst.num_samples  1 ? GEN6_SF_MSRAST_ON_PATTERN : 0);
 +  OUT_BATCH(num_samples  1 ? GEN6_SF_MSRAST_ON_PATTERN : 0);
OUT_BATCH(0);
OUT_BATCH(0);
OUT_BATCH(0);
 @@ -500,7 +501,8 @@ gen7_blorp_emit_sf_config(struct brw_context *brw,
  static void
  gen7_blorp_emit_wm_config(struct brw_context *brw,
const brw_blorp_params *params,
 -  brw_blorp_prog_data *prog_data)
 +  brw_blorp_prog_data *prog_data,
 +  int num_samples)
  {
 uint32_t dw1 = 0, dw2 = 0;

 @@ -528,7 +530,7 @@ gen7_blorp_emit_wm_config(struct brw_context *brw,
dw1 |= GEN7_WM_DISPATCH_ENABLE; /* We are rendering */
 }

 -  if (params-dst.num_samples  1) {
 +  if (num_samples  1) {
   dw1 |= GEN7_WM_MSRAST_ON_PATTERN;
   if (prog_data  prog_data-persample_msaa_dispatch)
  dw2 |= GEN7_WM_MSDISPMODE_PERSAMPLE;
 @@ -562,7 +564,8 @@ static void
  gen7_blorp_emit_ps_config(struct brw_context *brw,
const brw_blorp_params *params,
uint32_t prog_offset,
 -  brw_blorp_prog_data *prog_data)
 +  brw_blorp_prog_data *prog_data,
 +  int num_samples)
  {
 uint32_t dw2, dw4, dw5;
 const int max_threads_shift = brw-is_haswell ?
 @@ -579,8 +582,10 @@ gen7_blorp_emit_ps_config(struct brw_context *brw,
  */
 dw4 |= GEN7_PS_16_DISPATCH_ENABLE;

 -   if (brw-is_haswell)
 -  dw4 |= SET_FIELD(1, HSW_PS_SAMPLE_MASK); /* 1 sample for now */
 +   if (brw-is_haswell) {
 +  int sample_mask = (num_samples  1) ? (1  num_samples) - 1 : 1;
 +  dw4 |= SET_FIELD(sample_mask, HSW_PS_SAMPLE_MASK);
 +   }
 if (params-use_wm_prog) {
dw2 |= 1  GEN7_PS_SAMPLER_COUNT_SHIFT; /* Up to 4 samplers */
dw4 |= GEN7_PS_PUSH_CONSTANT_ENABLE;
 @@ -714,7 +719,9 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context 
 *brw,

 lod = params-depth.level - params-depth.mt-first_level;

 -   if (params-hiz_op != GEN6_HIZ_OP_NONE  lod == 0) {
 +   /* not quite sure about the MSAA interaction here! */
 +   if (params-hiz_op != GEN6_HIZ_OP_NONE  lod == 0 
 + params-depth.mt-num_samples = 1) {
/* HIZ ops for lod 0 may set the width  height a little
 * larger to allow the fast depth clear to fit the hardware
 * alignment requirements. (8x4)
 @@ -722,8 +729,8 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context 
 *brw,
surfwidth = params-depth.width;
surfheight = params-depth.height;
 } else {
 -  surfwidth = params-depth.mt-logical_width0;
 -  surfheight = params-depth.mt-logical_height0;
 +  surfwidth = ALIGN(params-depth.mt-logical_width0, 8);
 +  surfheight = ALIGN(params-depth.mt-logical_height0, 4);
 }

 /* 3DSTATE_DEPTH_BUFFER */
 @@ -863,10 +870,12 @@ gen7_blorp_exec(struct brw_context *brw,
 uint32_t sampler_offset = 0;

 uint32_t prog_offset = params-get_wm_prog(brw, prog_data);
 -   

[Mesa-dev] [Bug 80069] New: rendering problems: black areas in KDE desktop. [mesa 10.2.1 (not with 10.1.4)]

2014-06-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=80069

  Priority: medium
Bug ID: 80069
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: rendering problems: black areas in KDE desktop. [mesa
10.2.1 (not with 10.1.4)]
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: 4607vrfcr84spd21...@weg-werf-email.de
  Hardware: Other
Status: NEW
   Version: unspecified
 Component: Mesa core
   Product: Mesa

Since I updated mesa-related packages (Arch Linux) some days ago I had a black
screen (with mouse cursor) after login (via KDM) into KDE. I use a Intel 855GM
graphics (driver: SNA compiled from 2.99.911-114-g94e3932 OR xf86-video-intel
2.99.912).

Some of my observations with KDE 4.13.2:

* black screen (after login with KDM) or parts/areas - see attached
screenshots. Mouse cursor is always correct.
* alt+f2 (krunner) brings the desktop content back but only until a program is
started (then parts get black again)
* Starting programs partly removes black areas. E.g. Ctrl+Esc brings up the
process viewer, but only with partly non-black window decoration.
* the log-off menu does not appear (only the screen dims as expected) after
right clicking the desktop → log-off.
* it only happens with active desktop effects (transparency, shadows, ...).
Switching those off in KDE instantanously removes the rendering problem.

No issues observed in Openbox or TWM (well, those have no tranparency and so
on).

Workaround - Downgrade those packages:

   [2014-06-11 02:57] [PACMAN] downgraded mesa (10.2.1-1 - 10.1.4-1)
   [2014-06-11 02:57] [PACMAN] downgraded mesa-libgl (10.2.1-1 - 10.1.4-1)
   [2014-06-11 02:57] [PACMAN] downgraded intel-dri (10.2.1-1 - 10.1.4-1)

A previous discussion / report was at [KDE desktop black after upgrade of mesa
and intel-dri](https://bbs.archlinux.org/viewtopic.php?id=182699).

I know of [X segfault after Mesa
upgrade](https://bugs.archlinux.org/task/40781?project=1cat[0]=2string=mesa)
but I guess I see something different since I have no segfaults.

I could run a version from git or do a bisect if this is needed. In this case:
mention the git source.

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


[Mesa-dev] [Bug 80069] rendering problems: black areas in KDE desktop. [mesa 10.2.1 (not with 10.1.4)]

2014-06-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=80069

CarlEitsger 4607vrfcr84spd21...@weg-werf-email.de changed:

   What|Removed |Added

   Hardware|Other   |x86 (IA32)
 OS|All |Linux (All)

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


[Mesa-dev] [Bug 80069] rendering problems: black areas in KDE desktop. [mesa 10.2.1 (not with 10.1.4)]

2014-06-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=80069

--- Comment #1 from CarlEitsger 4607vrfcr84spd21...@weg-werf-email.de ---
Created attachment 101125
  -- https://bugs.freedesktop.org/attachment.cgi?id=101125action=edit
screenshot: a program window with black areas

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


[Mesa-dev] [Bug 80069] rendering problems: black areas in KDE desktop. [mesa 10.2.1 (not with 10.1.4)]

2014-06-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=80069

--- Comment #2 from CarlEitsger 4607vrfcr84spd21...@weg-werf-email.de ---
Created attachment 101127
  -- https://bugs.freedesktop.org/attachment.cgi?id=101127action=edit
screenshot: more black areas. Green is edited out for privacy reasons

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


Re: [Mesa-dev] [PATCH 00/18] Multi-stream support for geometry shaders

2014-06-15 Thread Ilia Mirkin
On Wed, Jun 11, 2014 at 12:31 PM, Jordan Justen jljus...@gmail.com wrote:
 On Wed, Jun 11, 2014 at 2:49 AM, Iago Toral ito...@igalia.com wrote:
 Hi Chris,

 thanks for the quick review!

 On Wed, 2014-06-11 at 21:45 +1200, Chris Forbes wrote:
 I sent comments on patches 1, 3, 5, 9, 11, 16, 18

 We will look into these.

 Patches 2, 4, 6-8, 10, 12-15, 17 are:

 Reviewed-by: Chris Forbes chr...@ijw.co.nz

 You should also include a patch to docs/GL3.txt marking off this
 subfeature for i965 :)


 Do you have a bunch of piglits which exercise all the tricky corners
 of this? I see a few tests
 which require the existence of the stream layout qualifier, but not
 covering all the behavior.

 No, so far we have been testing this with a standalone program. We will
 check what already exists in piglit and add missing test cases.

 This is the only piglit test that I know about:
 http://patchwork.freedesktop.org/patch/19224/

 Note that it passed on nvidia, but failed on catalyst.

I just ran that test against this code (+ a few changes to add support
in gallium) and I got:

$ MESA_EXTENSION_OVERRIDE=GL_ARB_gpu_shader5
bin/arb_gpu_shader5-xfb-streams -fbo -auto
Failed to compile geometry shader: 0:3(1): error: invalid input layout
qualifiers used

source:
#version 150
#extension GL_ARB_gpu_shader5 : enable
layout(points, invocations = 32) in;
layout(points, max_vertices = 4) out;
out float stream0_0_out;
layout(stream = 1) out vec2 stream1_0_out;
layout(stream = 2) out float stream2_0_out;
layout(stream = 3) out vec3 stream3_0_out;
layout(stream = 1) out vec3 stream1_1_out;
layout(stream = 2) out vec4 stream2_1_out;
void main() {
  gl_Position = gl_in[0].gl_Position;
  stream0_0_out = 1.0 + gl_InvocationID;
  EmitVertex();
  EndPrimitive();
  stream3_0_out = vec3(12.0 + gl_InvocationID, 13.0 + gl_InvocationID,
   14.0 + gl_InvocationID);
  EmitStreamVertex(3);
  EndStreamPrimitive(3);
  stream2_0_out = 7.0 + gl_InvocationID;
  stream2_1_out = vec4(8.0 + gl_InvocationID, 9.0 + gl_InvocationID,
   10.0 + gl_InvocationID, 11.0 + gl_InvocationID);
  EmitStreamVertex(2);
  EndStreamPrimitive(2);
  stream1_0_out = vec2(2.0 + gl_InvocationID, 3.0 + gl_InvocationID);
  stream1_1_out = vec3(4.0 + gl_InvocationID, 5.0 + gl_InvocationID,
   6.0 + gl_InvocationID);
  EmitStreamVertex(1);
  EndStreamPrimitive(1);
}PIGLIT: {'result': 'fail' }

I guess it doesn't like

layout(points, invocations=32) in? Not sure. I could also have
messed something up... doing a bisect over your patches blames

glsl: Add parsing support for multi-stream output in geometry shaders.

Before that, it goes until the first stream=1 layout and fails there
(which is expected).

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


[Mesa-dev] [PATCH v3 1/3] Add support for swrast to the DRM EGL platform

2014-06-15 Thread Giovanni Campagna
From: Giovanni Campagna gcampa...@src.gnome.org

Turn GBM into a swrast loader (providing putimage/getimage backed
by a dumb KMS buffer). This allows to run KMS+DRM GL applications
(such as weston or mutter-wayland) unmodified on cards that don't
have any client side HW acceleration component but that can do
modeset (examples include simpledrm and qxl)
---
 src/egl/drivers/dri2/platform_drm.c | 162 +
 src/gbm/backends/dri/gbm_dri.c  | 202 +++-
 src/gbm/backends/dri/gbm_driint.h   |  35 ++-
 src/gbm/main/gbm.h  |   3 +
 4 files changed, 354 insertions(+), 48 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 6227bc9..6a0dcd3 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -44,6 +44,7 @@ lock_front_buffer(struct gbm_surface *_surf)
 {
struct gbm_dri_surface *surf = (struct gbm_dri_surface *) _surf;
struct dri2_egl_surface *dri2_surf = surf-dri_private;
+   struct gbm_dri_device *device = (struct gbm_dri_device *) _surf-gbm;
struct gbm_bo *bo;
 
if (dri2_surf-current == NULL) {
@@ -52,8 +53,11 @@ lock_front_buffer(struct gbm_surface *_surf)
}
 
bo = dri2_surf-current-bo;
-   dri2_surf-current-locked = 1;
-   dri2_surf-current = NULL;
+
+   if (device-dri2) {
+  dri2_surf-current-locked = 1;
+  dri2_surf-current = NULL;
+   }
 
return bo;
 }
@@ -122,14 +126,27 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay 
*disp, EGLint type,
   goto cleanup_surf;
}
 
-   dri2_surf-dri_drawable =
-  (*dri2_dpy-dri2-createNewDrawable) (dri2_dpy-dri_screen,
-   dri2_conf-dri_double_config,
-   dri2_surf-gbm_surf);
+   if (dri2_dpy-dri2) {
+  dri2_surf-dri_drawable =
+ (*dri2_dpy-dri2-createNewDrawable) (dri2_dpy-dri_screen,
+   dri2_conf-dri_double_config,
+   dri2_surf-gbm_surf);
 
-   if (dri2_surf-dri_drawable == NULL) {
-  _eglError(EGL_BAD_ALLOC, dri2-createNewDrawable);
-  goto cleanup_surf;
+  if (dri2_surf-dri_drawable == NULL) {
+ _eglError(EGL_BAD_ALLOC, dri2-createNewDrawable);
+ goto cleanup_surf;
+  }
+   } else {
+  assert (dri2_dpy-swrast != NULL);
+  dri2_surf-dri_drawable =
+ (*dri2_dpy-swrast-createNewDrawable) (dri2_dpy-dri_screen,
+ dri2_conf-dri_double_config,
+ dri2_surf-gbm_surf);
+
+  if (dri2_surf-dri_drawable == NULL) {
+ _eglError(EGL_BAD_ALLOC, swrast-createNewDrawable);
+ goto cleanup_surf;
+  }
}
 
return dri2_surf-base;
@@ -221,6 +238,28 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
return 0;
 }
 
+static int
+get_swrast_front_bo(struct dri2_egl_surface *dri2_surf)
+{
+   struct dri2_egl_display *dri2_dpy =
+  dri2_egl_display(dri2_surf-base.Resource.Display);
+   struct gbm_dri_surface *surf = dri2_surf-gbm_surf;
+
+   if (dri2_surf-current == NULL) {
+  assert (!dri2_surf-color_buffers[0].locked);
+  dri2_surf-current = dri2_surf-color_buffers[0];
+   }
+
+   if (dri2_surf-current-bo == NULL)
+  dri2_surf-current-bo = gbm_bo_create(dri2_dpy-gbm_dri-base.base,
+ surf-base.width, 
surf-base.height,
+ surf-base.format, 
surf-base.flags);
+   if (dri2_surf-current-bo == NULL)
+  return -1;
+
+   return 0;
+}
+
 static void
 back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
 {
@@ -374,19 +413,23 @@ dri2_drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
int i;
 
-   if (dri2_surf-base.Type == EGL_WINDOW_BIT) {
-  if (dri2_surf-current)
-_eglError(EGL_BAD_SURFACE, dri2_swap_buffers);
-  for (i = 0; i  ARRAY_SIZE(dri2_surf-color_buffers); i++)
- if (dri2_surf-color_buffers[i].age  0)
-dri2_surf-color_buffers[i].age++;
-  dri2_surf-current = dri2_surf-back;
-  dri2_surf-current-age = 1;
-  dri2_surf-back = NULL;
-   }
+   if (dri2_dpy-swrast) {
+  (*dri2_dpy-core-swapBuffers)(dri2_surf-dri_drawable);
+   } else {
+  if (dri2_surf-base.Type == EGL_WINDOW_BIT) {
+ if (dri2_surf-current)
+_eglError(EGL_BAD_SURFACE, dri2_swap_buffers);
+ for (i = 0; i  ARRAY_SIZE(dri2_surf-color_buffers); i++)
+if (dri2_surf-color_buffers[i].age  0)
+   dri2_surf-color_buffers[i].age++;
+ dri2_surf-current = dri2_surf-back;
+ dri2_surf-current-age = 1;
+ dri2_surf-back = NULL;
+  }
 
-   (*dri2_dpy-flush-flush)(dri2_surf-dri_drawable);
-   

[Mesa-dev] [PATCH v3 3/3] Add a new capabilities for drivers that can't share buffers

2014-06-15 Thread Giovanni Campagna
From: Giovanni Campagna gcampa...@src.gnome.org

The kms-dri swrast driver cannot share buffers using the GEM,
so it must tell the loader to disable extensions relying on
that, without disabling the image DRI extension altogheter
(which would prevent the loader from working at all).
This requires a new gallium capability (which is queried on
the pipe_screen and for swrast drivers it's forwared to the
winsys), and requires a new version of the DRI image extension.
---
 include/GL/internal/dri_interface.h| 17 +-
 src/egl/drivers/dri2/egl_dri2.c| 10 -
 src/egl/drivers/dri2/platform_drm.c| 17 +++---
 src/gallium/docs/source/screen.rst |  5 -
 src/gallium/drivers/freedreno/freedreno_screen.c   |  1 +
 src/gallium/drivers/i915/i915_screen.c |  1 +
 src/gallium/drivers/ilo/ilo_screen.c   |  2 ++
 src/gallium/drivers/llvmpipe/lp_screen.c   |  7 ++
 src/gallium/drivers/nouveau/nv30/nv30_screen.c |  1 +
 src/gallium/drivers/nouveau/nv50/nv50_screen.c |  2 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c |  2 ++
 src/gallium/drivers/r300/r300_screen.c |  1 +
 src/gallium/drivers/r600/r600_pipe.c   |  1 +
 src/gallium/drivers/radeonsi/si_pipe.c |  1 +
 src/gallium/drivers/softpipe/sp_screen.c   |  7 ++
 src/gallium/drivers/svga/svga_screen.c |  2 ++
 src/gallium/include/pipe/p_defines.h   |  3 ++-
 src/gallium/include/state_tracker/sw_winsys.h  |  5 +
 src/gallium/state_trackers/dri/common/dri_screen.h |  1 +
 src/gallium/state_trackers/dri/drm/dri2.c  | 23 +++
 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c  | 26 +++---
 21 files changed, 121 insertions(+), 14 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 4d57d0b..fba1cac 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1005,7 +1005,7 @@ struct __DRIdri2ExtensionRec {
  * extensions.
  */
 #define __DRI_IMAGE DRI_IMAGE
-#define __DRI_IMAGE_VERSION 8
+#define __DRI_IMAGE_VERSION 9
 
 /**
  * These formats correspond to the similarly named MESA_FORMAT_*
@@ -1133,6 +1133,13 @@ enum __DRIChromaSiting {
 #define __DRI_IMAGE_ERROR_BAD_PARAMETER 3
 /*@}*/
 
+/**
+ * \name Capabilities that might be returned by 
__DRIimageExtensionRec::getCapabilities
+ */
+/*@{*/
+#define __DRI_IMAGE_CAP_GLOBAL_NAMES 1
+/*@}*/
+
 typedef struct __DRIimageRec  __DRIimage;
 typedef struct __DRIimageExtensionRec __DRIimageExtension;
 struct __DRIimageExtensionRec {
@@ -1239,6 +1246,14 @@ struct __DRIimageExtensionRec {
  enum __DRIChromaSiting vert_siting,
  unsigned *error,
  void *loaderPrivate);
+
+   /**
+* Query for general capabilities of the driver that concern
+* buffer sharing and image importing.
+*
+* \since 9
+*/
+   int (*getCapabilities)(__DRIscreen *screen);
 };
 
 
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index eb6abfd..132ebff 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -520,7 +520,15 @@ dri2_setup_screen(_EGLDisplay *disp)
}
 
if (dri2_dpy-image) {
-  disp-Extensions.MESA_drm_image = EGL_TRUE;
+  if (dri2_dpy-image-base.version = 9 
+  dri2_dpy-image-getCapabilities != NULL) {
+ int capabilities;
+
+ capabilities = dri2_dpy-image-getCapabilities(dri2_dpy-dri_screen);
+ disp-Extensions.MESA_drm_image = (capabilities  
__DRI_IMAGE_CAP_GLOBAL_NAMES) != 0;
+  } else
+ disp-Extensions.MESA_drm_image = EGL_TRUE;
+
   disp-Extensions.KHR_image_base = EGL_TRUE;
   disp-Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
   if (dri2_dpy-image-base.version = 5 
diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 6a0dcd3..633b2ab 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -270,7 +270,10 @@ back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, 
__DRIbuffer *buffer)
 
bo = (struct gbm_dri_bo *) dri2_surf-back-bo;
 
-   dri2_dpy-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME, name);
+   if (dri2_surf-base.Resource.Display-Extensions.MESA_drm_image)
+  dri2_dpy-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_NAME, name);
+   else
+  dri2_dpy-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_HANDLE, name);
dri2_dpy-image-queryImage(bo-image, __DRI_IMAGE_ATTRIB_STRIDE, pitch);
 
buffer-attachment = __DRI_BUFFER_BACK_LEFT;
@@ -690,8 +693,16 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
   disp-Extensions.EXT_buffer_age = EGL_TRUE;
 
 #ifdef HAVE_WAYLAND_PLATFORM
-   if (dri2_dpy-image)
-  

[Mesa-dev] [PATCH v3 2/3] Add a dumb drm/kms winsys for software rendering

2014-06-15 Thread Giovanni Campagna
From: Giovanni Campagna gcampa...@src.gnome.org

Add a new winsys and target that can be used with a dri2 state tracker and
loader instead of drisw. This allows to use gbm as a dri2/image loader
and avoid the extra copy from the backbuffer to the shadow frontbuffer.

The new driver is called kms_swrast, and is only loaded by gbm
as a fallback, because it is only useful with the gbm platform
(as no buffer sharing is possible)
---
 configure.ac   |   5 +
 docs/relnotes/10.3.html|   2 +
 src/gallium/targets/Makefile.am|   3 +
 src/gallium/targets/dri-kms-swrast/Makefile.am |  61 
 .../targets/dri-kms-swrast/kms_swrast_drm_api.c|  65 +
 src/gallium/winsys/Makefile.am |   5 +
 src/gallium/winsys/sw/kms-dri/Makefile.am  |  33 +++
 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c  | 312 +
 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.h  |  37 +++
 src/gbm/backends/dri/gbm_dri.c |  31 +-
 10 files changed, 549 insertions(+), 5 deletions(-)
 create mode 100644 src/gallium/targets/dri-kms-swrast/Makefile.am
 create mode 100644 src/gallium/targets/dri-kms-swrast/kms_swrast_drm_api.c
 create mode 100644 src/gallium/winsys/sw/kms-dri/Makefile.am
 create mode 100644 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c
 create mode 100644 src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.h

diff --git a/configure.ac b/configure.ac
index 390adaa..07e4648 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1993,6 +1993,9 @@ if test -n $with_gallium_drivers; then
 if test x$enable_dri = xyes; then
 GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS dri-swrast
 fi
+if text x$have_libdrm = xyes; then
+GALLIUM_TARGET_DIRS=$GALLIUM_TARGET_DIRS dri-kms-swrast
+fi
 ;;
 *)
 AC_MSG_ERROR([Unknown Gallium driver: $driver])
@@ -2206,6 +2209,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/state_trackers/xvmc/Makefile
src/gallium/targets/Makefile
src/gallium/targets/dri-freedreno/Makefile
+   src/gallium/targets/dri-kms-swrast/Makefile
src/gallium/targets/dri-i915/Makefile
src/gallium/targets/dri-ilo/Makefile
src/gallium/targets/dri-nouveau/Makefile
@@ -2243,6 +2247,7 @@ AC_CONFIG_FILES([Makefile
src/gallium/winsys/svga/drm/Makefile
src/gallium/winsys/sw/dri/Makefile
src/gallium/winsys/sw/fbdev/Makefile
+   src/gallium/winsys/sw/kms-dri/Makefile
src/gallium/winsys/sw/null/Makefile
src/gallium/winsys/sw/wayland/Makefile
src/gallium/winsys/sw/wrapper/Makefile
diff --git a/docs/relnotes/10.3.html b/docs/relnotes/10.3.html
index 7ceaca4..6c47c19 100644
--- a/docs/relnotes/10.3.html
+++ b/docs/relnotes/10.3.html
@@ -48,6 +48,8 @@ Note: some of the new features are only available with 
certain drivers.
 liGL_ARB_stencil_texturing on nv50, nvc0, r600, and radeonsi/li
 liGL_ARB_texture_cube_map_array on radeonsi/li
 liGL_ARB_compressed_texture_pixel_storage on all drivers/li
+liA new software rasterizer driver (kms_swrast_dri.so) that works with
+DRM drivers that don't have a full-fledged GEM (such as qxl or simpledrm)/li
 /ul
 
 
diff --git a/src/gallium/targets/Makefile.am b/src/gallium/targets/Makefile.am
index 36d359c..16f88ba 100644
--- a/src/gallium/targets/Makefile.am
+++ b/src/gallium/targets/Makefile.am
@@ -126,6 +126,9 @@ if HAVE_GALLIUM_SOFTPIPE
 if HAVE_DRISW
 SUBDIRS += dri-swrast
 endif
+if HAVE_DRI2
+SUBDIRS += dri-kms-swrast
+endif
 endif
 
 if NEED_GALLIUM_LOADER
diff --git a/src/gallium/targets/dri-kms-swrast/Makefile.am 
b/src/gallium/targets/dri-kms-swrast/Makefile.am
new file mode 100644
index 000..09a8d17
--- /dev/null
+++ b/src/gallium/targets/dri-kms-swrast/Makefile.am
@@ -0,0 +1,61 @@
+# Copyright © 2012 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the Software),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 

[Mesa-dev] [PATCH v3 0/3] Software rendering in EGL-DRM

2014-06-15 Thread Giovanni Campagna
Hello all,

This is the third attempt at swrast/llvmpipe support for DRM
drivers that don't have userspace support (qxl, cirrus, simpledrm, etc.)

I hope I addressed all of Emil's comments.

Giovanni

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


Re: [Mesa-dev] [PATCH v2] glsl: type check between switch init-expression and case

2014-06-15 Thread Matt Turner
Looks good. Thanks!

Reviewed-by: Matt Turner matts...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v3 0/3] Software rendering in EGL-DRM

2014-06-15 Thread Pekka Paalanen
On Sun, 15 Jun 2014 13:49:48 +0200
Giovanni Campagna scampa.giova...@gmail.com wrote:

 Hello all,
 
 This is the third attempt at swrast/llvmpipe support for DRM
 drivers that don't have userspace support (qxl, cirrus, simpledrm, etc.)
 
 I hope I addressed all of Emil's comments.

Hi,

this sounds cool work to me, sorry I can't really review it.

Does this work also help in getting llvmpipe working with the egl_dri2
loader?

AFAIU, currently on EGL-Wayland the only way to use llvmpipe is to use
egl_gallium.so as the loader, and I don't really know what it would
take to make egl_dri2 work there, apart from the Wayland-specific bits,
so I was kind of hoping your work would make that easier to implement.


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


Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME

2014-06-15 Thread Dave Airlie
 diff --git a/src/mesa/drivers/dri/common/xmlconfig.h 
 b/src/mesa/drivers/dri/common/xmlconfig.h
 index 786caae..a4daa6b 100644
 --- a/src/mesa/drivers/dri/common/xmlconfig.h
 +++ b/src/mesa/drivers/dri/common/xmlconfig.h
 @@ -30,6 +30,8 @@
  #ifndef __XMLCONFIG_H
  #define __XMLCONFIG_H

 +#include GL/gl.h
 +
  #define STRING_CONF_MAXLEN 25


Is that required? seemed a bit strange that would be a change in this patch.

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


Re: [Mesa-dev] [PATCH 06/11] loader: Use drirc device_id parameter in complement to DRI_PRIME

2014-06-15 Thread Dave Airlie
On 16 June 2014 15:55, Dave Airlie airl...@gmail.com wrote:
 diff --git a/src/mesa/drivers/dri/common/xmlconfig.h 
 b/src/mesa/drivers/dri/common/xmlconfig.h
 index 786caae..a4daa6b 100644
 --- a/src/mesa/drivers/dri/common/xmlconfig.h
 +++ b/src/mesa/drivers/dri/common/xmlconfig.h
 @@ -30,6 +30,8 @@
  #ifndef __XMLCONFIG_H
  #define __XMLCONFIG_H

 +#include GL/gl.h
 +
  #define STRING_CONF_MAXLEN 25


 Is that required? seemed a bit strange that would be a change in this patch.

Oh I see things don't build without it, strange, but I suppose it makes sense.

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