Mesa (master): mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

2015-03-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: dd0d3a2c0fb388745519c8a3be800720541eccfe
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd0d3a2c0fb388745519c8a3be800720541eccfe

Author: Matt Turner 
Date:   Tue Mar 10 17:55:21 2015 -0700

mesa: Replace _mesa_round_to_even() with _mesa_roundeven().

Eric's initial patch adding constant expression evaluation for
ir_unop_round_even used nearbyint. The open-coded _mesa_round_to_even
implementation came about without much explanation after a reviewer
asked whether nearbyint depended on the application not modifying the
rounding mode. Of course (as Eric commented) we rely on the application
not changing the rounding mode from its default (round-to-nearest) in
many other places, including the IROUND function used by
_mesa_round_to_even!

Worse, IROUND() is implemented using the trunc(x + 0.5) trick which
fails for x = nextafterf(0.5, 0.0).

Still worse, _mesa_round_to_even unexpectedly returns an int. I suspect
that could cause problems when rounding large integral values not
representable as an int in ir_constant_expression.cpp's
ir_unop_round_even evaluation. Its use of _mesa_round_to_even is clearly
broken for doubles (as noted during review).

The constant expression evaluation code for the packing built-in
functions also mistakenly assumed that _mesa_round_to_even returned a
float, as can be seen by the cast through a signed integer type to an
unsigned (since negative float -> unsigned conversions are undefined).

rint() and nearbyint() implement the round-half-to-even behavior we want
when the rounding mode is set to the default round-to-nearest. The only
difference between them is that nearbyint() raises the inexact
exception.

This patch implements _mesa_roundeven{f,}, a function similar to the
roundeven function added by a yet unimplemented technical specification
(ISO/IEC TS 18661-1:2014), with a small difference in behavior -- we
don't bother raising the inexact exception, which I don't think we care
about anyway.

At least recent Intel CPUs can quickly change a subset of the bits in
the x87 floating-point control register, but the exception mask bits are
not included. rint() does not need to change these bits, but nearbyint()
does (twice: save old, set new, and restore old) in order to raise the
inexact exception, which would incur some penalty.

Reviewed-by: Carl Worth 

---

 src/glsl/ir_constant_expression.cpp  |   18 +-
 src/glsl/nir/nir_constant_expressions.py |   15 
 src/glsl/nir/nir_opcodes.py  |2 +-
 src/mesa/main/imports.c  |   25 ++---
 src/mesa/main/imports.h  |3 --
 src/util/Makefile.sources|1 +
 src/util/rounding.h  |   58 ++
 7 files changed, 82 insertions(+), 40 deletions(-)

diff --git a/src/glsl/ir_constant_expression.cpp 
b/src/glsl/ir_constant_expression.cpp
index 388c4c2..ecebc3c 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -35,6 +35,7 @@
 
 #include 
 #include "main/core.h" /* for MAX2, MIN2, CLAMP */
+#include "util/rounding.h" /* for _mesa_roundeven */
 #include "ir.h"
 #include "glsl_types.h"
 #include "program/hash_table.h"
@@ -245,8 +246,8 @@ pack_snorm_1x8(float x)
  * We must first cast the float to an int, because casting a negative
  * float to a uint is undefined.
  */
-   return (uint8_t) (int8_t)
-  _mesa_round_to_even(CLAMP(x, -1.0f, +1.0f) * 127.0f);
+   return (uint8_t) (int)
+  _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 127.0f);
 }
 
 /**
@@ -267,8 +268,8 @@ pack_snorm_1x16(float x)
  * We must first cast the float to an int, because casting a negative
  * float to a uint is undefined.
  */
-   return (uint16_t) (int16_t)
-  _mesa_round_to_even(CLAMP(x, -1.0f, +1.0f) * 32767.0f);
+   return (uint16_t) (int)
+  _mesa_roundevenf(CLAMP(x, -1.0f, +1.0f) * 32767.0f);
 }
 
 /**
@@ -322,7 +323,7 @@ pack_unorm_1x8(float x)
  *
  *   packUnorm4x8: round(clamp(c, 0, +1) * 255.0)
  */
-   return (uint8_t) _mesa_round_to_even(CLAMP(x, 0.0f, 1.0f) * 255.0f);
+   return (uint8_t) (int) _mesa_roundevenf(CLAMP(x, 0.0f, 1.0f) * 255.0f);
 }
 
 /**
@@ -340,7 +341,8 @@ pack_unorm_1x16(float x)
  *
  *   packUnorm2x16: round(clamp(c, 0, +1) * 65535.0)
  */
-   return (uint16_t) _mesa_round_to_even(CLAMP(x, 0.0f, 1.0f) * 65535.0f);
+   return (uint16_t) (int)
+  _mesa_roundevenf(CLAMP(x, 0.0f, 1.0f) * 65535.0f);
 }
 
 /**
@@ -733,9 +735,9 @@ ir_expression::constant_expression_value(struct hash_table 
*variable_context)
case ir_unop_round_even:
   for (unsigned c = 0; c < op[0]->type->components(); c++) {
  if (op[0]->type->base_type == GLSL_TYPE_DOUBLE)
-data.d[c] = _mesa_round_to_even(op[0]->value.d[c]);
+data.d[c] = _mesa_roundeven(op[0]->value.d[c]);
  else
-data.f[c] = _mesa_round_to_eve

Mesa (master): util: Optimize _mesa_roundeven with SSE 4.1.

2015-03-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 036e347f3c129bb547137aed955e75062fca09b8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=036e347f3c129bb547137aed955e75062fca09b8

Author: Matt Turner 
Date:   Wed Mar 18 14:23:41 2015 -0700

util: Optimize _mesa_roundeven with SSE 4.1.

The SSE 4.1 ROUND instructions let us implement roundeven directly.
Otherwise we assume that the rounding mode has not been modified (as we
do in the rest of Mesa) and use rint().

glibc uses the ROUND instruction in rint() after a cpuid check. This
patch just lets us inline it directly when we're already building for
SSE 4.1.

Reviewed-by: Carl Worth 

---

 src/util/rounding.h |   20 
 1 file changed, 20 insertions(+)

diff --git a/src/util/rounding.h b/src/util/rounding.h
index c8be450..0cbe926 100644
--- a/src/util/rounding.h
+++ b/src/util/rounding.h
@@ -23,6 +23,10 @@
 
 #include 
 
+#ifdef __SSE4_1__
+#include 
+#endif
+
 /* The C standard library has functions round()/rint()/nearbyint() that round
  * their arguments according to the rounding mode set in the floating-point
  * control register. While there are trunc()/ceil()/floor() functions that do
@@ -45,7 +49,15 @@
 static inline float
 _mesa_roundevenf(float x)
 {
+#ifdef __SSE4_1__
+   float ret;
+   __m128 m = _mm_load_ss(&x);
+   m = _mm_round_ss(m, m, _MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC);
+   _mm_store_ss(&ret, m);
+   return ret;
+#else
return rintf(x);
+#endif
 }
 
 /**
@@ -54,5 +66,13 @@ _mesa_roundevenf(float x)
 static inline double
 _mesa_roundeven(double x)
 {
+#ifdef __SSE4_1__
+   double ret;
+   __m128d m = _mm_load_sd(&x);
+   m = _mm_round_sd(m, m, _MM_FROUND_CUR_DIRECTION | _MM_FROUND_NO_EXC);
+   _mm_store_sd(&ret, m);
+   return ret;
+#else
return rint(x);
+#endif
 }

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


Mesa (master): util: Add a roundeven test.

2015-03-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 5de86102f917d9f3a229daec8f107afb77246feb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5de86102f917d9f3a229daec8f107afb77246feb

Author: Matt Turner 
Date:   Thu Mar 12 11:34:05 2015 -0700

util: Add a roundeven test.

Reviewed-by: Carl Worth 

---

 src/util/Makefile.am  |4 +-
 src/util/roundeven_test.c |  140 +
 2 files changed, 143 insertions(+), 1 deletion(-)

diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index ec49dc6..2e7542e 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -50,7 +50,9 @@ endif
 
 libmesautil_la_LIBADD = $(SHA1_LIBS)
 
-check_PROGRAMS = u_atomic_test
+roundeven_test_LDADD = -lm
+
+check_PROGRAMS = u_atomic_test roundeven_test
 TESTS = $(check_PROGRAMS)
 
 BUILT_SOURCES = $(MESA_UTIL_GENERATED_FILES)
diff --git a/src/util/roundeven_test.c b/src/util/roundeven_test.c
new file mode 100644
index 000..7526db1
--- /dev/null
+++ b/src/util/roundeven_test.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include "macros.h"
+#include "rounding.h"
+
+int main(int argc, char *argv[])
+{
+   const struct {
+  float input, expected;
+   } float_data[] = {
+  { 0.0,  0.0 },
+  { nextafterf(0.5, 0.0), 0.0 },
+  { 0.5,  0.0 },
+  { nextafterf(0.5, 1.0), 1.0 },
+  { 1.0,  1.0 },
+  { nextafterf(1.5, 1.0), 1.0 },
+  { 1.5,  2.0 },
+  { nextafterf(1.5, 2.0), 2.0 },
+  { 2.0,  2.0 },
+  { nextafterf(2.5, 2.0), 2.0 },
+  { 2.5,  2.0 },
+  { nextafterf(2.5, 3.0), 3.0 },
+   };
+
+   const struct {
+  double input, expected;
+   } double_data[] = {
+  { 0.0, 0.0 },
+  { nextafter(0.5, 0.0), 0.0 },
+  { 0.5, 0.0 },
+  { nextafter(0.5, 1.0), 1.0 },
+  { 1.0, 1.0 },
+  { nextafter(1.5, 1.0), 1.0 },
+  { 1.5, 2.0 },
+  { nextafter(1.5, 2.0), 2.0 },
+  { 2.0, 2.0 },
+  { nextafter(2.5, 2.0), 2.0 },
+  { 2.5, 2.0 },
+  { nextafter(2.5, 3.0), 3.0 },
+   };
+
+   bool failed = false;
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(float_data); i++) {
+  float output = _mesa_roundevenf(float_data[i].input);
+  if (memcmp(&float_data[i].expected, &output, sizeof(float))) {
+ fprintf(stderr, "%d float: expected %f (%a) from "
+ "_mesa_roundevenf(%f (%a)) but got %f (%a)\n",
+ i,
+ float_data[i].expected,
+ float_data[i].expected,
+ float_data[i].input,
+ float_data[i].input,
+ output,
+ output);
+ failed = true;
+  }
+   }
+
+   /* Test negated values */
+   for (i = 0; i < ARRAY_SIZE(float_data); i++) {
+  float output = _mesa_roundevenf(-float_data[i].input);
+  float negated_expected = -float_data[i].expected;
+  if (memcmp(&negated_expected, &output, sizeof(float))) {
+ fprintf(stderr, "%d float: expected %f (%a) from "
+ "_mesa_roundevenf(%f (%a)) but got %f (%a)\n",
+ i,
+ negated_expected,
+ negated_expected,
+ -float_data[i].input,
+ -float_data[i].input,
+ output,
+ output);
+ failed = true;
+  }
+   }
+
+   for (i = 0; i < ARRAY_SIZE(double_data); i++) {
+  double output = _mesa_roundeven(double_data[i].input);
+  if (memcmp(&double_data[i].expected, &output, sizeof(double))) {
+ fprintf(stderr, "%d double: expected %f (%a) from "
+ "_mesa_roundeven(%f (%

Mesa (master): i965/fs: Ignore type in cmod prop if scan_inst is CMP.

2015-03-18 Thread Matt Turner
Module: Mesa
Branch: master
Commit: bb22aa08e4b08c9688c5d5c6558ac01663d0163a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb22aa08e4b08c9688c5d5c6558ac01663d0163a

Author: Matt Turner 
Date:   Tue Mar 17 19:17:15 2015 -0700

i965/fs: Ignore type in cmod prop if scan_inst is CMP.

total instructions in shared programs: 6263270 -> 6203091 (-0.96%)
instructions in affected programs: 2606529 -> 2546350 (-2.31%)
helped:14301
GAINED:5
LOST:  3

Revewed-by: Jason Ekstrand 

---

 .../drivers/dri/i965/brw_fs_cmod_propagation.cpp   |   25 ++--
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
index 1935f06..798fef3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cmod_propagation.cpp
@@ -94,21 +94,22 @@ opt_cmod_propagation_local(bblock_t *block)
 scan_inst->dst.reg_offset != inst->src[0].reg_offset)
break;
 
-/* This must be done before the dst.type check because the result
- * type of the AND will always be D, but the result of the CMP
- * could be anything.  The assumption is that the AND is just
- * figuring out what the result of the previous comparison was
- * instead of doing a new comparison with a different type.
- */
-if (inst->opcode == BRW_OPCODE_AND) {
-   if (scan_inst->opcode == BRW_OPCODE_CMP) {
-  inst->remove(block);
-  progress = true;
-   }
-
+/* CMP's result is the same regardless of dest type. */
+if (inst->conditional_mod == BRW_CONDITIONAL_NZ &&
+scan_inst->opcode == BRW_OPCODE_CMP &&
+(inst->dst.type == BRW_REGISTER_TYPE_D ||
+ inst->dst.type == BRW_REGISTER_TYPE_UD)) {
+   inst->remove(block);
+   progress = true;
break;
 }
 
+/* If the AND wasn't handled by the previous case, it isn't safe
+ * to remove it.
+ */
+if (inst->opcode == BRW_OPCODE_AND)
+   break;
+
 /* Comparisons operate differently for ints and floats */
 if (scan_inst->dst.type != inst->dst.type)
break;

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


Mesa (10.4): glx: Handle out-of-sequence swap completion events correctly. (v2)

2015-03-18 Thread Emil Velikov
Module: Mesa
Branch: 10.4
Commit: 70832be2f1357edafeeafa5fe8c96792da4dfd7b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=70832be2f1357edafeeafa5fe8c96792da4dfd7b

Author: Mario Kleiner 
Date:   Thu Mar 12 20:34:06 2015 +0100

glx: Handle out-of-sequence swap completion events correctly. (v2)

The code for emitting INTEL_swap_events swap completion
events needs to translate from 32-Bit sbc on the wire to
64-Bit sbc for the events and handle wraparound accordingly.

It assumed that events would be sent by the server in the
order their corresponding swap requests were emitted from
the client, iow. sbc count should be always increasing. This
was correct for DRI2.

This is not always the case under the DRI3/Present backend,
where the Present extension can execute presents and send out
completion events in a different order than the submission
order of the present requests, due to client code specifying
targetMSC target vblank counts which are not strictly
monotonically increasing. This confused the wraparound
handling. This patch fixes the problem by handling 32-Bit
wraparound in both directions. As long as successive swap
completion events real 64-Bit sbc's don't differ by more
than 2^30, this should be able to do the right thing.

How this is supposed to work:

awire->sbc contains the low 32-Bits of the true 64-Bit sbc
of the current swap event, transmitted over the wire.

glxDraw->lastEventSbc contains the low 32-Bits of the 64-Bit
sbc of the most recently processed swap event.

glxDraw->eventSbcWrap is a 64-Bit offset which tracks the upper
32-Bits of the current sbc. The final 64-Bit output sbc
aevent->sbc is computed from the sum of awire->sbc and
glxDraw->eventSbcWrap.

Under DRI3/Present, swap completion events can be received
slightly out of order due to non-monotic targetMsc specified
by client code, e.g., present request submission:

Submission sbc:   1   2   3
targetMsc:10  11  9

Reception of completion events:
Completion sbc:   3   1   2

The completion sequence 3, 1, 2 would confuse the old wraparound
handling made for DRI2 as 1 < 3 --> Assumes a 32-Bit wraparound
has happened when it hasn't.

The client can queue multiple present requests, in the case of
Mesa up to n requests for n-buffered rendering, e.g., n =  2-4 in
the current Mesa GLX DRI3/Present implementation. In the case of
direct Pixmap presents via xcb_present_pixmap() the number n is
limited by the amount of memory available.

We reasonably assume that the number of outstanding requests n is
much less than 2 billion due to memory contraints and common sense.
Therefore while the order of received sbc's can be a bit scrambled,
successive 64-Bit sbc's won't deviate by much, a given sbc may be
a few counts lower or higher than the previous received sbc.

Therefore any large difference between the incoming awire->sbc and
the last recorded glxDraw->lastEventSbc will be due to 32-Bit
wraparound and we need to adapt glxDraw->eventSbcWrap accordingly
to adjust the upper 32-Bits of the sbc.

Two cases, correponding to the two if-statements in the patch:

a) Previous sbc event was below the last 2^32 boundary, in the previous
glxDraw->eventSbcWrap epoch, the new sbc event is in the next 2^32
epoch, therefore the low 32-Bit awire->sbc wrapped around to zero,
or close to zero --> awire->sbc is apparently much lower than the
glxDraw->lastEventSbc recorded for the previous epoch

--> We need to increment glxDraw->eventSbcWrap by 2^32 to adjust
the current epoch to be one higher than the previous one.

--> Case a) also handles the old DRI2 behaviour.

b) Previous sbc event was above closest 2^32 boundary, but now a
late event from the previous 2^32 epoch arrives, with a true sbc
that belongs to the previous 2^32 segment, so the awire->sbc of
this late event has a high count close to 2^32, whereas
glxDraw->lastEventSbc is closer to zero --> awire->sbc is much
greater than glXDraw->lastEventSbc.

--> We need to decrement glxDraw->eventSbcWrap by 2^32 to adjust
the current epoch back to the previous lower epoch of this late
completion event.

We assume such a wraparound to a higher (a) epoch or lower (b)
epoch has happened if awire->sbc and glxDraw->lastEventSbc differ
by more than 2^30 counts, as such a difference can only happen
on wraparound, or if somehow 2^30 present requests would be pending
for a given drawable inside the server, which is rather unlikely.

v2: Explain the reason for this patch and the new wraparound handling
much more extensive in commit message, no code change wrt. initial
version.

Cc: "10.3 10.4 10.5" 
Signed-off-by: Mario Kleiner 
Reviewed-by: Michel Dänzer 
(cherry picked from commit cc5ddd584d17abd422ae4d8e83805969485740d9)

---

 src/glx/glxext.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 68c359e..fdc24d4 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -143,8 +143,13 @@ __glXWireToEvent(Display *dpy, XEvent *

Mesa (10.4): radeonsi: increase coords array size for radeon_llvm_emit_prepare_cube_coords

2015-03-18 Thread Emil Velikov
Module: Mesa
Branch: 10.4
Commit: 832c94a55c50bd3d05c17d2651ede6d3859095c2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=832c94a55c50bd3d05c17d2651ede6d3859095c2

Author: Marek Olšák 
Date:   Tue Mar 17 17:47:17 2015 +0100

radeonsi: increase coords array size for radeon_llvm_emit_prepare_cube_coords

radeon_llvm_emit_prepare_cube_coords uses coords[4] in some cases (TXB2 etc.)

Discovered by Coverity. Reported by Ilia Mirkin.

Cc: 10.5 10.4 
Reviewed-by: Michel Dänzer 
(cherry picked from commit a984abdad39df2d8ceb4c46e11f4ce1344c36c86)

---

 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c |2 +-
 src/gallium/drivers/radeonsi/si_shader.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c 
b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index c30a9d0..1f1484d 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -748,7 +748,7 @@ static void txp_fetch_args(
const struct tgsi_full_instruction * inst = emit_data->inst;
LLVMValueRef src_w;
unsigned chan;
-   LLVMValueRef coords[4];
+   LLVMValueRef coords[5];
 
emit_data->dst_type = LLVMVectorType(bld_base->base.elem_type, 4);
src_w = lp_build_emit_fetch(bld_base, emit_data->inst, 0, TGSI_CHAN_W);
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index c15e8111..19e1781 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1505,7 +1505,7 @@ static void tex_fetch_args(
const struct tgsi_full_instruction * inst = emit_data->inst;
unsigned opcode = inst->Instruction.Opcode;
unsigned target = inst->Texture.Texture;
-   LLVMValueRef coords[4];
+   LLVMValueRef coords[5];
LLVMValueRef address[16];
int ref_pos;
unsigned num_coords = tgsi_util_get_texture_coord_dim(target, &ref_pos);

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


Mesa (10.4): freedreno: update generated headers

2015-03-18 Thread Emil Velikov
Module: Mesa
Branch: 10.4
Commit: 0506f69f08dba612e5dc4d3334b78f3a2d4ee5ba
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0506f69f08dba612e5dc4d3334b78f3a2d4ee5ba

Author: Rob Clark 
Date:   Sun Mar 15 17:59:01 2015 -0400

freedreno: update generated headers

Fix a3xx texture layer-size.

Signed-off-by: Rob Clark 
Cc: "10.4 10.5" 
(cherry picked from commit e92bc6b38e90339a394e95a562bcce35c3ee9696)
[Emil Velikov: sqush trivial conflicts, drop the a4xx.xml.h changes]

Signed-off-by: Emil Velikov 

Conflicts:
src/gallium/drivers/freedreno/a2xx/a2xx.xml.h
src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
src/gallium/drivers/freedreno/a4xx/a4xx.xml.h
src/gallium/drivers/freedreno/adreno_common.xml.h
src/gallium/drivers/freedreno/adreno_pm4.xml.h

---

 src/gallium/drivers/freedreno/a2xx/a2xx.xml.h |2 +-
 src/gallium/drivers/freedreno/a3xx/a3xx.xml.h |4 ++--
 src/gallium/drivers/freedreno/adreno_common.xml.h |2 +-
 src/gallium/drivers/freedreno/adreno_pm4.xml.h|2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a2xx/a2xx.xml.h 
b/src/gallium/drivers/freedreno/a2xx/a2xx.xml.h
index e8c54d0..e185827 100644
--- a/src/gallium/drivers/freedreno/a2xx/a2xx.xml.h
+++ b/src/gallium/drivers/freedreno/a2xx/a2xx.xml.h
@@ -13,7 +13,7 @@ The rules-ng-ng source files this header was generated from 
are:
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml  (  
32901 bytes, from 2014-06-02 15:21:30)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  
10347 bytes, from 2014-10-01 18:55:57)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml(  
14960 bytes, from 2014-07-27 17:22:13)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
60533 bytes, from 2014-10-15 18:32:43)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
64771 bytes, from 2015-03-15 21:55:57)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  (  
41068 bytes, from 2014-08-01 12:22:48)
 
 Copyright (C) 2013-2014 by the following authors:
diff --git a/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h 
b/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
index ef3971c..8435b43 100644
--- a/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
+++ b/src/gallium/drivers/freedreno/a3xx/a3xx.xml.h
@@ -13,7 +13,7 @@ The rules-ng-ng source files this header was generated from 
are:
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml  (  
32901 bytes, from 2014-06-02 15:21:30)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  
10347 bytes, from 2014-10-01 18:55:57)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml(  
14960 bytes, from 2014-07-27 17:22:13)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
60533 bytes, from 2014-10-15 18:32:43)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
64771 bytes, from 2015-03-15 21:55:57)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  (  
41068 bytes, from 2014-08-01 12:22:48)
 
 Copyright (C) 2013-2014 by the following authors:
@@ -2572,7 +2572,7 @@ static inline uint32_t A3XX_TEX_CONST_2_SWAP(enum 
a3xx_color_swap val)
 }
 
 #define REG_A3XX_TEX_CONST_3   0x0003
-#define A3XX_TEX_CONST_3_LAYERSZ1__MASK
0x000f
+#define A3XX_TEX_CONST_3_LAYERSZ1__MASK
0x1fff
 #define A3XX_TEX_CONST_3_LAYERSZ1__SHIFT   0
 static inline uint32_t A3XX_TEX_CONST_3_LAYERSZ1(uint32_t val)
 {
diff --git a/src/gallium/drivers/freedreno/adreno_common.xml.h 
b/src/gallium/drivers/freedreno/adreno_common.xml.h
index ac53281..ad77061 100644
--- a/src/gallium/drivers/freedreno/adreno_common.xml.h
+++ b/src/gallium/drivers/freedreno/adreno_common.xml.h
@@ -13,7 +13,7 @@ The rules-ng-ng source files this header was generated from 
are:
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml  (  
32901 bytes, from 2014-06-02 15:21:30)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml (  
10347 bytes, from 2014-10-01 18:55:57)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml(  
14960 bytes, from 2014-07-27 17:22:13)
-- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
60533 bytes, from 2014-10-15 18:32:43)
+- /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml  (  
64771 bytes, from 2015-03-15 21:55:57)
 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml  (  
41068 bytes, from 2014-08-01 12:22:48)
 
 Copyright (C) 2013-2014 by the following authors:
diff --git a/src/gallium/drivers/freedreno/adreno_pm4.xml.h 
b/src/gallium/drivers/freedreno/adreno_pm4.xml.h
index 8835601..69430bf 100644
--- a/src/gallium/drivers/freedreno/adren

Mesa (10.4): auxiliary/os: fix the android build - s/drm_munmap/os_munmap/

2015-03-18 Thread Emil Velikov
Module: Mesa
Branch: 10.4
Commit: ad259df2e0ada1ea5b3139f203c6fa6cb51bfca3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad259df2e0ada1ea5b3139f203c6fa6cb51bfca3

Author: Emil Velikov 
Date:   Mon Mar 16 15:00:18 2015 +

auxiliary/os: fix the android build - s/drm_munmap/os_munmap/

Squash this silly typo introduced with commit c63eb5dd5ec(auxiliary/os: get
the mmap/munmap wrappers working with android)

Cc: "10.4 10.5" 
Signed-off-by: Emil Velikov 
Reviewed-by: Brian Paul 
(cherry picked from commit 55f0c0a29f788c5df4820e81c0cf93613ccedf5e)

---

 src/gallium/auxiliary/os/os_mman.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_mman.h 
b/src/gallium/auxiliary/os/os_mman.h
index 19c9a5b..3fc8c43 100644
--- a/src/gallium/auxiliary/os/os_mman.h
+++ b/src/gallium/auxiliary/os/os_mman.h
@@ -70,8 +70,8 @@ static INLINE void *os_mmap(void *addr, size_t length, int 
prot, int flags,
return __mmap2(addr, length, prot, flags, fd, (size_t) (offset >> 12));
 }
 
-#  define drm_munmap(addr, length) \
-  munmap(addr, length)
+#  define os_munmap(addr, length) \
+ munmap(addr, length)
 
 #else
 /* assume large file support exists */

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


Mesa (10.4): glsl: optimize (0 cmp x + y) into (-x cmp y).

2015-03-18 Thread Emil Velikov
Module: Mesa
Branch: 10.4
Commit: b2e243f70c5395c1002bcc6104b060b05584adbc
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b2e243f70c5395c1002bcc6104b060b05584adbc

Author: Samuel Iglesias Gonsalvez 
Date:   Tue Feb 24 19:02:57 2015 +0100

glsl: optimize (0 cmp x + y) into (-x cmp y).

The optimization done by commit 34ec1a24d did not take it into account.

Fixes:

dEQP-GLES3.functional.shaders.random.all_features.fragment.20

Signed-off-by: Samuel Iglesias Gonsalvez 
Reviewed-by: Ian Romanick 
Reviewed-by: Matt Turner 
Cc: "10.4 10.5" 
(cherry picked from commit b43bbfa90ace596c8b2e0b3954a5f69924726c59)

---

 src/glsl/opt_algebraic.cpp |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp
index 87bb875..e94e072 100644
--- a/src/glsl/opt_algebraic.cpp
+++ b/src/glsl/opt_algebraic.cpp
@@ -578,9 +578,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
  if (!is_vec_zero(zero))
 continue;
 
- return new(mem_ctx) ir_expression(ir->operation,
-   add->operands[0],
-   neg(add->operands[1]));
+ /* Depending of the zero position we want to optimize
+  * (0 cmp x+y) into (-x cmp y) or (x+y cmp 0) into (x cmp -y)
+  */
+ if (add_pos == 1) {
+return new(mem_ctx) ir_expression(ir->operation,
+  neg(add->operands[0]),
+  add->operands[1]);
+ } else {
+return new(mem_ctx) ir_expression(ir->operation,
+  add->operands[0],
+  neg(add->operands[1]));
+ }
   }
   break;
 

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


Mesa (10.4): loader: include for non-sysfs builds

2015-03-18 Thread Emil Velikov
Module: Mesa
Branch: 10.4
Commit: df2db2a55fc097d1ecb5ec48e1187542be2beee9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=df2db2a55fc097d1ecb5ec48e1187542be2beee9

Author: Emil Velikov 
Date:   Wed Mar 11 19:12:35 2015 +

loader: include  for non-sysfs builds

Required by fstat(), otherwise we'll error out due to implicit function
declaration.

Cc: "10.4 10.5" 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89530
Signed-off-by: Emil Velikov 
Reported-by: Vadim Rutkovsky 
Tested-by: Vadim Rutkovsky 
(cherry picked from commit 771cd266b9d00bdcf2cf7acaa3c8363c358d7478)

---

 src/loader/loader.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 94c993a..638ebf2 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -64,6 +64,7 @@
  *Rob Clark 
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -80,7 +81,6 @@
 #endif
 #endif
 #ifdef HAVE_SYSFS
-#include 
 #include 
 #endif
 #include "loader.h"

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


Mesa (10.4): freedreno: fix slice pitch calculations

2015-03-18 Thread Emil Velikov
Module: Mesa
Branch: 10.4
Commit: a563045009fe01689553c6e3db2b030cd074ce8a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a563045009fe01689553c6e3db2b030cd074ce8a

Author: Ilia Mirkin 
Date:   Fri Mar 13 01:36:57 2015 -0400

freedreno: fix slice pitch calculations

For example if width were 65, the first slice would get 96 while the
second would get 32. However the hardware appears to expect the second
pitch to be 64, based on halving the 96 (and aligning up to 32).

This fixes texelFetch piglit tests on a3xx below a certain size. Going
higher they break again, but most likely due to unrelated reasons.

Signed-off-by: Ilia Mirkin 
Cc: "10.4 10.5" 
Reviewed-by: Rob Clark 
(cherry picked from commit 620e29b74821fd75b24495ab2bfddea53fc75350)

---

 src/gallium/drivers/freedreno/freedreno_resource.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c 
b/src/gallium/drivers/freedreno/freedreno_resource.c
index 6b31d26..e9ec913 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -199,7 +199,7 @@ setup_slices(struct fd_resource *rsc)
for (level = 0; level <= prsc->last_level; level++) {
struct fd_resource_slice *slice = fd_resource_slice(rsc, level);
 
-   slice->pitch = align(width, 32);
+   slice->pitch = width = align(width, 32);
slice->offset = size;
slice->size0 = slice->pitch * height * rsc->cpp;
 

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


Mesa (master): i965/nir: Make our environment variable checking smarter

2015-03-18 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: e1f3ddef8c9928d9b8e845b811dc08983c541f99
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e1f3ddef8c9928d9b8e845b811dc08983c541f99

Author: Jason Ekstrand 
Date:   Tue Mar 17 12:10:58 2015 -0700

i965/nir: Make our environment variable checking smarter

Before, we enabled NIR if you set INTEL_USE_NIR to anything which mean that
INTEL_USE_NIR=false would actually turn on NIR.  In preparation for turning
NIR on by default, this commit makes it smarter by allowing the
INTEL_USE_NIR variable to work as either a force-enable or a force-disable.

Reviewed-by: Mark Janes 

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |   24 ++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 53ceb29..3d4d31a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3838,6 +3838,26 @@ fs_visitor::allocate_registers()
   prog_data->total_scratch = brw_get_scratch_size(last_scratch);
 }
 
+static bool
+env_var_as_boolean(const char *var_name, bool default_value)
+{
+   const char *str = getenv(var_name);
+   if (str == NULL)
+  return default_value;
+
+   if (strcmp(str, "1") == 0 ||
+   strcasecmp(str, "true") == 0 ||
+   strcasecmp(str, "yes") == 0) {
+  return true;
+   } else if (strcmp(str, "0") == 0 ||
+  strcasecmp(str, "false") == 0 ||
+  strcasecmp(str, "no") == 0) {
+  return false;
+   } else {
+  return default_value;
+   }
+}
+
 bool
 fs_visitor::run_vs()
 {
@@ -3849,7 +3869,7 @@ fs_visitor::run_vs()
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
   emit_shader_time_begin();
 
-   if (getenv("INTEL_USE_NIR") != NULL) {
+   if (env_var_as_boolean("INTEL_USE_NIR", false)) {
   emit_nir_code();
} else {
   foreach_in_list(ir_instruction, ir, shader->base.ir) {
@@ -3923,7 +3943,7 @@ fs_visitor::run_fs()
* functions called "main").
*/
   if (shader) {
- if (getenv("INTEL_USE_NIR") != NULL) {
+ if (env_var_as_boolean("INTEL_USE_NIR", false)) {
 emit_nir_code();
  } else {
 foreach_in_list(ir_instruction, ir, shader->base.ir) {

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


Mesa (master): egl: don't fill client apis string forever.

2015-03-18 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: 37e3a116f8ae09d0fa894d126d081a1af24ec14f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=37e3a116f8ae09d0fa894d126d081a1af24ec14f

Author: Dave Airlie 
Date:   Mon Mar 16 15:21:55 2015 +1000

egl: don't fill client apis string forever.

We never reset the string on eglTerminate, so it grows
for ever on multiple eglInitialise.

Reviewed-by: Brian Paul 
Reviewed-by: Matt Turner 
Signed-off-by: Dave Airlie 

---

 src/egl/main/eglapi.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index e224560..6031a7a 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -514,6 +514,7 @@ eglTerminate(EGLDisplay dpy)
 
   drv->API.Terminate(drv, disp);
   /* do not reset disp->Driver */
+  disp->ClientAPIsString[0] = 0;
   disp->Initialized = EGL_FALSE;
}
 

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


Mesa (master): swrast: Use BITFIELD64_BIT for arrayAttribs.

2015-03-18 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: cebc62f1060c815e3b5a1bd3728c3d909db3d2b8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cebc62f1060c815e3b5a1bd3728c3d909db3d2b8

Author: Jose Fonseca 
Date:   Wed Mar 18 14:25:19 2015 +

swrast: Use BITFIELD64_BIT for arrayAttribs.

As VARYING_SLOT_MAX can be bigger than 32.

I'll probably stop building swrast with MSVC in the near future, but this
seems a real bug regardless.

Reviewed-by: Brian Paul 

---

 src/mesa/swrast/s_span.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 5d618f0..e304b6b 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -788,7 +788,7 @@ clip_span( struct gl_context *ctx, SWspan *span )
  memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0]))
 
  for (i = 0; i < VARYING_SLOT_MAX; i++) {
-if (span->arrayAttribs & (1 << i)) {
+if (span->arrayAttribs & BITFIELD64_BIT(i)) {
/* shift array elements left by 'leftClip' */
SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip);
 }

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


Mesa (master): scons: Don't link program_lexer.l/y twice.

2015-03-18 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: d3e9aa8d88e6684235bb0be549551d1402ef8881
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3e9aa8d88e6684235bb0be549551d1402ef8881

Author: Jose Fonseca 
Date:   Wed Mar 18 14:22:41 2015 +

scons: Don't link program_lexer.l/y twice.

program/lex.yy.c and program/program_parse.tab.c is already included in
the PROGRAM_FILES variable.

We still need to specify the dependency relationship though.

Reviewed-by: Brian Paul 

---

 src/mesa/SConscript |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 81939f9..cc5d242 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -40,17 +40,12 @@ else:
 source_lists = env.ParseSourceList('Makefile.sources')
 
 env.Append(YACCFLAGS = '-d -p "_mesa_program_"')
-program_lex = env.CFile('program/lex.yy.c', 'program/program_lexer.l')
-program_parse = env.CFile('program/program_parse.tab.c',
-  'program/program_parse.y')
-program_sources = source_lists['PROGRAM_FILES'] + [
-program_lex,
-program_parse[0],
-]
+env.CFile('program/lex.yy.c', 'program/program_lexer.l')
+env.CFile('program/program_parse.tab.c', 'program/program_parse.y')
 
 mesa_sources = (
 source_lists['MESA_FILES'] +
-program_sources +
+source_lists['PROGRAM_FILES'] +
 source_lists['STATETRACKER_FILES']
 )
 

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


Mesa (master): scons: Silence MSVC warnings about overflows in constant arithmetic.

2015-03-18 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 1d30fd85dd2a240d4ccafc9a9eca55a129306cf5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d30fd85dd2a240d4ccafc9a9eca55a129306cf5

Author: Jose Fonseca 
Date:   Wed Mar 18 14:18:28 2015 +

scons: Silence MSVC warnings about overflows in constant arithmetic.

These get triggered even when using the standard C99 INFINITY/NAN
constants.

Reviewed-by: Brian Paul 

---

 scons/gallium.py |2 ++
 1 file changed, 2 insertions(+)

diff --git a/scons/gallium.py b/scons/gallium.py
index 9d53848..b4018e7 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -495,8 +495,10 @@ def generate(env):
 ccflags += [
 '/W3', # warning level
 '/wd4018', # signed/unsigned mismatch
+'/wd4056', # overflow in floating-point constant arithmetic
 '/wd4244', # conversion from 'type1' to 'type2', possible loss of 
data
 '/wd4305', # truncation from 'type1' to 'type2'
+'/wd4756', # overflow in constant arithmetic
 '/wd4800', # forcing value to bool 'true' or 'false' (performance 
warning)
 '/wd4996', # disable deprecated POSIX name warnings
 ]

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


Mesa (master): scons: Disable MSVC signed/unsigned mismatch warnings.

2015-03-18 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: bbac03ecca51fdbedf3c569c68322043c8e93fae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bbac03ecca51fdbedf3c569c68322043c8e93fae

Author: José Fonseca 
Date:   Tue Nov 25 22:27:04 2014 +

scons: Disable MSVC signed/unsigned mismatch warnings.

By default gcc ignores the issue, and as result code that mixes
signed/unsigned is so widespread through the code base that it ends up
being little more than noise, potentially obscuring more pertinent
warnings.

Maybe one day we enable the corresponding gcc warnings and cleanup, but
until then, this change disables them.

Reviewed-by: Brian Paul 
Reviewed-by: Roland Scheidegger 

---

 scons/gallium.py |1 +
 1 file changed, 1 insertion(+)

diff --git a/scons/gallium.py b/scons/gallium.py
index b162089..9d53848 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -494,6 +494,7 @@ def generate(env):
 ]
 ccflags += [
 '/W3', # warning level
+'/wd4018', # signed/unsigned mismatch
 '/wd4244', # conversion from 'type1' to 'type2', possible loss of 
data
 '/wd4305', # truncation from 'type1' to 'type2'
 '/wd4800', # forcing value to bool 'true' or 'false' (performance 
warning)

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


Mesa (master): gallivm: Use INFINITY directly.

2015-03-18 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: a56f1a8b32a2cafdd4e46c0d48a1a252d0e3c0ae
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a56f1a8b32a2cafdd4e46c0d48a1a252d0e3c0ae

Author: Jose Fonseca 
Date:   Wed Mar 18 14:19:10 2015 +

gallivm: Use INFINITY directly.

Already done below.

Reviewed-by: Brian Paul 

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c 
b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index cd05f11..0d4eaea 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -2564,16 +2564,9 @@ lp_build_rsqrt(struct lp_build_context *bld,
   * All numbers smaller than FLT_MIN will result in +infinity
   * (rsqrtps treats all denormals as zero).
   */
- /*
-  * Certain non-c99 compilers don't know INFINITY and might not support
-  * hacks to evaluate it at compile time neither.
-  */
- const unsigned posinf_int = 0x7F80;
  LLVMValueRef cmp;
  LLVMValueRef flt_min = lp_build_const_vec(bld->gallivm, type, 
FLT_MIN);
- LLVMValueRef inf = lp_build_const_int_vec(bld->gallivm, type, 
posinf_int);
-
- inf = LLVMBuildBitCast(builder, inf, lp_build_vec_type(bld->gallivm, 
type), "");
+ LLVMValueRef inf = lp_build_const_vec(bld->gallivm, type, INFINITY);
 
  for (i = 0; i < num_iterations; ++i) {
 res = lp_build_rsqrt_refine(bld, a, res);

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


Mesa (master): docs: Update progress on ARB_direct_state_access.

2015-03-18 Thread Laura Ekstrand
Module: Mesa
Branch: master
Commit: 2ccfce3f4ce72e1ae3e85c44193b3343e23572d8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ccfce3f4ce72e1ae3e85c44193b3343e23572d8

Author: Laura Ekstrand 
Date:   Wed Mar 18 13:26:31 2015 -0700

docs: Update progress on ARB_direct_state_access.

Acked-by: Matt Turner 

---

 docs/GL3.txt |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 0d37240..93fa60d 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -194,10 +194,10 @@ GL 4.5, GLSL 4.50:
   GL_ARB_derivative_controlDONE (i965, nv50, nvc0, 
r600)
   GL_ARB_direct_state_access   started
   - Transform Feedback object  started (Martin Peres)
-  - Buffer object  started (Laura Ekstrand)
+  - Buffer object  DONE
   - Framebuffer object started (Laura Ekstrand)
   - Renderbuffer objectstarted (Martin Peres)
-  - Texture object started (Laura Ekstrand)
+  - Texture object DONE
   - Vertex array objectstarted (Fredrik 
Höglund)
   - Sampler object started (Martin Peres)
   - Program Pipeline objectstarted (Martin Peres)

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


Mesa (master): dri: add _glapi_set_nop_handler(), _glapi_new_nop_table() to dri_test.c

2015-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 627991dbf74ce5aee9ce75155fc27a429bdd0548
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=627991dbf74ce5aee9ce75155fc27a429bdd0548

Author: Brian Paul 
Date:   Wed Mar 18 12:25:03 2015 -0600

dri: add _glapi_set_nop_handler(), _glapi_new_nop_table() to dri_test.c

I wasn't aware of these _glapi_ stub functions when I committed
4bdbb588a9d385509f9168e38bfdb76952ba469c.  Fixes "make check"

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89662
Reviewed-by: Mark Janes 

---

 src/mesa/drivers/dri/common/dri_test.c |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/mesa/drivers/dri/common/dri_test.c 
b/src/mesa/drivers/dri/common/dri_test.c
index 7ab50d9..57bfa5b 100644
--- a/src/mesa/drivers/dri/common/dri_test.c
+++ b/src/mesa/drivers/dri/common/dri_test.c
@@ -76,6 +76,17 @@ _glapi_get_dispatch_table_size(void)
return 0;
 }
 
+PUBLIC void
+_glapi_set_nop_handler(_glapi_nop_handler_proc func)
+{
+}
+
+PUBLIC struct _glapi_table *
+_glapi_new_nop_table(unsigned num_entries)
+{
+   return NULL;
+}
+
 #ifndef NO_MAIN
 int main(int argc, char** argv)
 {

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


Mesa (master): mesa: reimplement dispatch table no-op function handling

2015-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4bdbb588a9d385509f9168e38bfdb76952ba469c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4bdbb588a9d385509f9168e38bfdb76952ba469c

Author: Brian Paul 
Date:   Fri Mar 13 11:43:44 2015 -0600

mesa: reimplement dispatch table no-op function handling

Use the new _glapi_new_nop_table() and _glapi_set_nop_handler() to
improve how we handle calling no-op GL functions.

If there's a current context for the calling thread, generate a
GL_INVALID_OPERATION error.  This will happen if the app calls an
unimplemented extension function or it calls an illegal function
between glBegin/glEnd.

If there's no current context, print an error to stdout if it's a debug
build.

The dispatch_sanity.cpp file has some previous checks removed since
the _mesa_generic_nop() function no longer exists.

This fixes the piglit gl-1.0-dlist-begin-end and gl-1.0-beginend-coverage
tests on Windows.

Reviewed-by: Jose Fonseca 

---

 src/mesa/main/context.c |   66 ---
 src/mesa/main/context.h |3 --
 src/mesa/main/tests/dispatch_sanity.cpp |   35 +---
 3 files changed, 37 insertions(+), 67 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 22c2341..e7d1f4d 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -882,18 +882,35 @@ update_default_objects(struct gl_context *ctx)
 
 
 /**
- * This is the default function we plug into all dispatch table slots
- * This helps prevents a segfault when someone calls a GL function without
- * first checking if the extension's supported.
+ * This function is called by the glapi no-op functions.  For each OpenGL
+ * function/entrypoint there's a simple no-op function.  These "no-op"
+ * functions call this function.
+ *
+ * If there's a current OpenGL context for the calling thread, we record a
+ * GL_INVALID_OPERATION error.  This can happen either because the app's
+ * calling an unsupported extension function, or calling an illegal function
+ * (such as glClear between glBegin/glEnd).
+ *
+ * If there's no current OpenGL context for the calling thread, we can
+ * print a message to stderr.
+ *
+ * \param name  the name of the OpenGL function, without the "gl" prefix
  */
-int
-_mesa_generic_nop(void)
+static void
+nop_handler(const char *name)
 {
GET_CURRENT_CONTEXT(ctx);
-   _mesa_error(ctx, GL_INVALID_OPERATION,
-   "unsupported function called "
-   "(unsupported extension or deprecated function?)");
-   return 0;
+   if (ctx) {
+  _mesa_error(ctx, GL_INVALID_OPERATION, "gl%s(invalid call)", name);
+   }
+#if defined(DEBUG)
+   else if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
+  fprintf(stderr,
+  "GL User Error: gl%s called without a rendering context\n",
+  name);
+  fflush(stderr);
+   }
+#endif
 }
 
 
@@ -909,13 +926,10 @@ nop_glFlush(void)
 #endif
 
 
-extern void (*__glapi_noop_table[])(void);
-
-
 /**
- * Allocate and initialize a new dispatch table.  All the dispatch
- * function pointers will point at the _mesa_generic_nop() function
- * which raises GL_INVALID_OPERATION.
+ * Allocate and initialize a new dispatch table.  The table will be
+ * populated with pointers to "no-op" functions.  In turn, the no-op
+ * functions will call nop_handler() above.
  */
 struct _glapi_table *
 _mesa_alloc_dispatch_table(void)
@@ -926,23 +940,10 @@ _mesa_alloc_dispatch_table(void)
 * DRI drivers.
 */
GLint numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
-   struct _glapi_table *table;
-
-   table = malloc(numEntries * sizeof(_glapi_proc));
-   if (table) {
-  _glapi_proc *entry = (_glapi_proc *) table;
-  GLint i;
-  for (i = 0; i < numEntries; i++) {
-#if defined(_WIN32)
- /* FIXME: This will not generate an error, but at least it won't
-  * corrupt the stack like _mesa_generic_nop does. */
- entry[i] = __glapi_noop_table[i];
-#else
- entry[i] = (_glapi_proc) _mesa_generic_nop;
-#endif
-  }
+   struct _glapi_table *table = _glapi_new_nop_table(numEntries);
 
 #if defined(_WIN32)
+   if (table) {
   /* This is a special case for Windows in the event that
* wglGetProcAddress is called between glBegin/End().
*
@@ -960,8 +961,11 @@ _mesa_alloc_dispatch_table(void)
* assertion passes and the test continues.
*/
   SET_Flush(table, nop_glFlush);
-#endif
}
+#endif
+
+   _glapi_set_nop_handler(nop_handler);
+
return table;
 }
 
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index d565087..1cd89a8 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -175,9 +175,6 @@ _mesa_finish(struct gl_context *ctx);
 extern void
 _mesa_flush(struct gl_context *ctx);
 
-extern int
-_mesa_generic_nop(void);
-
 extern void GLAPIENTRY
 _mesa_Finish( void );
 
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tes

Mesa (master): mapi: move some #includes from .h file to .c files

2015-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9fbbd60c1da4467683d93540c64164ad337ce454
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9fbbd60c1da4467683d93540c64164ad337ce454

Author: Brian Paul 
Date:   Fri Mar 13 13:12:12 2015 -0600

mapi: move some #includes from .h file to .c files

Just include things where they're needed.

Reviewed-by: Jose Fonseca 

---

 src/mapi/glapi/glapi_getproc.c |4 
 src/mapi/glapi/glapi_nop.c |1 +
 src/mapi/glapi/glapi_priv.h|3 ---
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/mapi/glapi/glapi_getproc.c b/src/mapi/glapi/glapi_getproc.c
index bfde92c..524a771 100644
--- a/src/mapi/glapi/glapi_getproc.c
+++ b/src/mapi/glapi/glapi_getproc.c
@@ -30,6 +30,9 @@
  */
 
 
+#include 
+#include 
+#include 
 #include "glapi/glapi_priv.h"
 #include "glapi/glapitable.h"
 
@@ -37,6 +40,7 @@
 #define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *))
 
 
+
 /**
  * Static function management.
  */
diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c
index 0041ed5..13db310 100644
--- a/src/mapi/glapi/glapi_nop.c
+++ b/src/mapi/glapi/glapi_nop.c
@@ -44,6 +44,7 @@
  */
 
 
+#include 
 #include 
 #include "glapi/glapi_priv.h"
 
diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h
index d368260..50f710e 100644
--- a/src/mapi/glapi/glapi_priv.h
+++ b/src/mapi/glapi/glapi_priv.h
@@ -26,9 +26,6 @@
 #ifndef _GLAPI_PRIV_H
 #define _GLAPI_PRIV_H
 
-#include 
-#include 
-#include 
 
 #ifdef HAVE_DIX_CONFIG_H
 #include 

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


Mesa (master): mesa: remove MSVC warning pragmas

2015-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 9263986401c90a309d167121bc98c47b24c39d3d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9263986401c90a309d167121bc98c47b24c39d3d

Author: Brian Paul 
Date:   Tue Mar 17 11:57:34 2015 -0600

mesa: remove MSVC warning pragmas

Removing this block of pragmas doesn't seem to increase the number of
warning generated by MSVC.  Other than signed/unsigned comparison warnings
there's very few other warnings nowadays.

Acked-by: Matt Turner 

---

 src/mesa/main/compiler.h |   20 
 1 file changed, 20 deletions(-)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 5c60391..55152fd 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -60,26 +60,6 @@ extern "C" {
 #endif
 
 
-/**
- * Disable assorted warnings
- */
-#if defined(_WIN32) && !defined(__CYGWIN__)
-#  if !defined(__GNUC__) /* mingw environment */
-#pragma warning( disable : 4068 ) /* unknown pragma */
-#pragma warning( disable : 4710 ) /* function 'foo' not inlined */
-#pragma warning( disable : 4711 ) /* function 'foo' selected for automatic 
inline expansion */
-#pragma warning( disable : 4127 ) /* conditional expression is constant */
-#if defined(MESA_MINWARN)
-#  pragma warning( disable : 4244 ) /* '=' : conversion from 'const double 
' to 'float ', possible loss of data */
-#  pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
-#  pragma warning( disable : 4305 ) /* '=' : truncation from 'const double 
' to 'float ' */
-#  pragma warning( disable : 4550 ) /* 'function' undefined; assuming 
extern returning int */
-#  pragma warning( disable : 4761 ) /* integral size mismatch in argument; 
conversion supplied */
-#endif
-#  endif
-#endif
-
-
 /* XXX: Use standard `__func__` instead */
 #ifndef __FUNCTION__
 #  define __FUNCTION__ __func__

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


Mesa (master): mesa: add void to format_array_format_table_init() declaration

2015-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: ea1b066a34dccd3bf1fe8bba52a586fff4158601
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea1b066a34dccd3bf1fe8bba52a586fff4158601

Author: Brian Paul 
Date:   Tue Mar 17 11:50:35 2015 -0600

mesa: add void to format_array_format_table_init() declaration

Silences an MSVC warning where it's called from call_once().

Reviewed-by: Matt Turner 

---

 src/mesa/main/formats.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 422c9dc..2bc8bca 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -388,7 +388,7 @@ array_formats_equal(const void *a, const void *b)
 }
 
 static void
-format_array_format_table_init()
+format_array_format_table_init(void)
 {
const struct gl_format_info *info;
mesa_array_format array_format;

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


Mesa (master): mesa: make _mesa_alloc_dispatch_table() static

2015-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 4009d22b61e76850b1b725f4e491da05c2406fa4
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4009d22b61e76850b1b725f4e491da05c2406fa4

Author: Brian Paul 
Date:   Fri Mar 13 12:05:01 2015 -0600

mesa: make _mesa_alloc_dispatch_table() static

Never called from outside of context.c

Reviewed-by: Jose Fonseca 

---

 src/mesa/main/api_exec.h |4 
 src/mesa/main/context.c  |   10 +-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h
index 1e4a9d6..12249fe 100644
--- a/src/mesa/main/api_exec.h
+++ b/src/mesa/main/api_exec.h
@@ -30,12 +30,8 @@
 extern "C" {
 #endif
 
-struct _glapi_table;
 struct gl_context;
 
-extern struct _glapi_table *
-_mesa_alloc_dispatch_table(void);
-
 extern void
 _mesa_initialize_exec_table(struct gl_context *ctx);
 
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index e7d1f4d..c1acda9 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -931,8 +931,8 @@ nop_glFlush(void)
  * populated with pointers to "no-op" functions.  In turn, the no-op
  * functions will call nop_handler() above.
  */
-struct _glapi_table *
-_mesa_alloc_dispatch_table(void)
+static struct _glapi_table *
+alloc_dispatch_table(void)
 {
/* Find the larger of Mesa's dispatch table and libGL's dispatch table.
 * In practice, this'll be the same for stand-alone Mesa.  But for DRI
@@ -1001,7 +1001,7 @@ create_beginend_table(const struct gl_context *ctx)
 {
struct _glapi_table *table;
 
-   table = _mesa_alloc_dispatch_table();
+   table = alloc_dispatch_table();
if (!table)
   return NULL;
 
@@ -1140,7 +1140,7 @@ _mesa_initialize_context(struct gl_context *ctx,
   goto fail;
 
/* setup the API dispatch tables with all nop functions */
-   ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table();
+   ctx->OutsideBeginEnd = alloc_dispatch_table();
if (!ctx->OutsideBeginEnd)
   goto fail;
ctx->Exec = ctx->OutsideBeginEnd;
@@ -1167,7 +1167,7 @@ _mesa_initialize_context(struct gl_context *ctx,
switch (ctx->API) {
case API_OPENGL_COMPAT:
   ctx->BeginEnd = create_beginend_table(ctx);
-  ctx->Save = _mesa_alloc_dispatch_table();
+  ctx->Save = alloc_dispatch_table();
   if (!ctx->BeginEnd || !ctx->Save)
  goto fail;
 

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


Mesa (master): mapi: add new _glapi_new_nop_table() and _glapi_set_nop_handler()

2015-03-18 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 201e36e77d6ca616f75f14d5f1c31f0062ae4366
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=201e36e77d6ca616f75f14d5f1c31f0062ae4366

Author: Brian Paul 
Date:   Fri Mar 13 10:20:29 2015 -0600

mapi: add new _glapi_new_nop_table() and _glapi_set_nop_handler()

_glapi_new_nop_table() creates a new dispatch table populated with
pointers to no-op functions.

_glapi_set_nop_handler() is used to register a callback function which
will be called from each of the no-op functions.

Now we always generate a separate no-op function for each GL entrypoint.
This allows us to do proper stack clean-up for Windows __stdcall and
lets us report the actual function name in error messages.  Before this
change, for non-Windows release builds we used a single no-op function
for all entrypoints.

Reviewed-by: Jose Fonseca 

---

 src/mapi/glapi/glapi.h |   11 ++
 src/mapi/glapi/glapi_nop.c |   84 +---
 src/mapi/mapi_glapi.c  |   23 
 src/mapi/table.c   |   23 +---
 src/mapi/table.h   |8 +
 5 files changed, 108 insertions(+), 41 deletions(-)

diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index 8d991fb..673295b 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -80,6 +80,9 @@ extern "C" {
 #endif
 
 typedef void (*_glapi_proc)(void);
+
+typedef void (*_glapi_nop_handler_proc)(const char *name);
+
 struct _glapi_table;
 
 
@@ -159,6 +162,14 @@ _GLAPI_EXPORT struct _glapi_table *
 _glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
 
 
+_GLAPI_EXPORT void
+_glapi_set_nop_handler(_glapi_nop_handler_proc func);
+
+/** Return pointer to new dispatch table filled with no-op functions */
+_GLAPI_EXPORT struct _glapi_table *
+_glapi_new_nop_table(unsigned num_entries);
+
+
 /** Deprecated function */
 _GLAPI_EXPORT unsigned long
 _glthread_GetID(void);
diff --git a/src/mapi/glapi/glapi_nop.c b/src/mapi/glapi/glapi_nop.c
index 628276e..0041ed5 100644
--- a/src/mapi/glapi/glapi_nop.c
+++ b/src/mapi/glapi/glapi_nop.c
@@ -30,14 +30,21 @@
  * This file defines a special dispatch table which is loaded with no-op
  * functions.
  *
- * When there's no current rendering context, calling a GL function like
- * glBegin() is a no-op.  Apps should never normally do this.  So as a
- * debugging aid, each of the no-op functions will emit a warning to
- * stderr if the MESA_DEBUG or LIBGL_DEBUG env var is set.
+ * Mesa can register a "no-op handler function" which will be called in
+ * the event that a no-op function is called.
+ *
+ * In the past, the dispatch table was loaded with pointers to a single
+ * no-op function.  But that broke on Windows because the GL entrypoints
+ * use __stdcall convention.  __stdcall means the callee cleans up the
+ * stack.  So one no-op function can't properly clean up the stack.  This
+ * would lead to crashes.
+ *
+ * Another benefit of unique no-op functions is we can accurately report
+ * the function's name in an error message.
  */
 
 
-
+#include 
 #include "glapi/glapi_priv.h"
 
 
@@ -51,25 +58,32 @@ _glapi_set_warning_func(_glapi_proc func)
 {
 }
 
-/*
- * When GLAPIENTRY is __stdcall (i.e. Windows), the stack is popped by the
- * callee making the number/type of arguments significant.
+
+/**
+ * We'll jump though this function pointer whenever a no-op function
+ * is called.
  */
-#if defined(_WIN32) || defined(DEBUG)
+static _glapi_nop_handler_proc nop_handler = NULL;
+
+
+/**
+ * Register the no-op handler call-back function.
+ */
+void
+_glapi_set_nop_handler(_glapi_nop_handler_proc func)
+{
+   nop_handler = func;
+}
+
 
 /**
  * Called by each of the no-op GL entrypoints.
  */
-static int
-Warn(const char *func)
+static void
+nop(const char *func)
 {
-#if defined(DEBUG)
-   if (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG")) {
-  fprintf(stderr, "GL User Error: gl%s called without a rendering 
context\n",
-  func);
-   }
-#endif
-   return 0;
+   if (nop_handler)
+  nop_handler(func);
 }
 
 
@@ -79,7 +93,8 @@ Warn(const char *func)
 static GLint
 NoOpUnused(void)
 {
-   return Warn(" function");
+   nop("unused GL entry point");
+   return 0;
 }
 
 /*
@@ -89,31 +104,28 @@ NoOpUnused(void)
 #define KEYWORD1_ALT static
 #define KEYWORD2 GLAPIENTRY
 #define NAME(func)  NoOp##func
-#define DISPATCH(func, args, msg)  Warn(#func);
-#define RETURN_DISPATCH(func, args, msg)  Warn(#func); return 0
+#define DISPATCH(func, args, msg)  nop(#func);
+#define RETURN_DISPATCH(func, args, msg)  nop(#func); return 0
 
 
 /*
  * Defines for the table of no-op entry points.
  */
 #define TABLE_ENTRY(name) (_glapi_proc) NoOp##name
+#define DISPATCH_TABLE_NAME __glapi_noop_table
+#define UNUSED_TABLE_NAME __unused_noop_functions
+
+#include "glapi/glapitemp.h"
 
-#else
 
-static int
-NoOpGeneric(void)
+/** Return pointer to new dispatch table filled with no-op functions */
+struct _glapi_table *
+_glapi_new_nop_table

Mesa (master): freedreno: fix spelling

2015-03-18 Thread Rob Clark
Module: Mesa
Branch: master
Commit: 62cc003b7d2031c2321f4698bd5b97cc97261c07
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=62cc003b7d2031c2321f4698bd5b97cc97261c07

Author: Rob Clark 
Date:   Wed Mar 18 09:51:27 2015 -0400

freedreno: fix spelling

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/freedreno_screen.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
b/src/gallium/drivers/freedreno/freedreno_screen.c
index 1d73513..cdcc0da 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -67,7 +67,7 @@ static const struct debug_named_value debug_options[] = {
{"nobypass",  FD_DBG_NOBYPASS, "Disable GMEM bypass"},
{"fraghalf",  FD_DBG_FRAGHALF, "Use half-precision in fragment 
shader"},
{"nobin", FD_DBG_NOBIN,  "Disable hw binning"},
-   {"optmsgs",   FD_DBG_OPTMSGS,"Enable optimizater debug 
messages"},
+   {"optmsgs",   FD_DBG_OPTMSGS,"Enable optimizer debug messages"},
{"optdump",   FD_DBG_OPTDUMP,"Dump shader DAG to .dot files"},
{"glsl120",   FD_DBG_GLSL120,"Temporary flag to force GLSL 120 
(rather than 130) on a3xx+"},
{"nocp",  FD_DBG_NOCP,   "Disable copy-propagation"},

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


Mesa (master): freedreno/ir3: fix infinite recursion in sched

2015-03-18 Thread Rob Clark
Module: Mesa
Branch: master
Commit: aee26d292f165438577426f5e62a62ec2a1514c9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aee26d292f165438577426f5e62a62ec2a1514c9

Author: Rob Clark 
Date:   Wed Mar 18 09:51:57 2015 -0400

freedreno/ir3: fix infinite recursion in sched

One more case we need to handle.  One of the src instructions for the
indirect could also end up being ourself.

Signed-off-by: Rob Clark 

---

 src/gallium/drivers/freedreno/ir3/ir3_sched.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/ir3/ir3_sched.c 
b/src/gallium/drivers/freedreno/ir3/ir3_sched.c
index c1921d0..94237c3 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_sched.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_sched.c
@@ -283,7 +283,7 @@ static int trysched(struct ir3_sched_ctx *ctx,
 * on ourself (ie. avoid infinite recursion):
 */
foreach_ssa_src(src, indirect) {
-   if (src == instr)
+   if ((src == instr) || (src->address == instr))
continue;
delay = trysched(ctx, src);
if (delay)

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


Mesa (master): docs/GL3: don't list nv30

2015-03-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 42715ad7932cdcfaffd8e514a200a461d6133927
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=42715ad7932cdcfaffd8e514a200a461d6133927

Author: Marek Olšák 
Date:   Wed Mar 18 01:50:03 2015 +0100

docs/GL3: don't list nv30

Suggested by Ilia Mirkin.

---

 docs/GL3.txt |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index bd17743..0d37240 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -176,12 +176,12 @@ GL 4.3, GLSL 4.30:
 GL 4.4, GLSL 4.40:
 
   GL_MAX_VERTEX_ATTRIB_STRIDE  DONE (all drivers)
-  GL_ARB_buffer_storageDONE (i965, nv30, nv50, 
nvc0, r600, radeonsi)
+  GL_ARB_buffer_storageDONE (i965, nv50, nvc0, 
r600, radeonsi)
   GL_ARB_clear_texture DONE (i965)
   GL_ARB_enhanced_layouts  not started
   GL_ARB_multi_bindDONE (all drivers)
   GL_ARB_query_buffer_object   not started
-  GL_ARB_texture_mirror_clamp_to_edge  DONE (i965, nv30, nv50, 
nvc0, r600, radeonsi, llvmpipe, softpipe)
+  GL_ARB_texture_mirror_clamp_to_edge  DONE (i965, nv50, nvc0, 
r600, radeonsi, llvmpipe, softpipe)
   GL_ARB_texture_stencil8  not started
   GL_ARB_vertex_type_10f_11f_11f_rev   DONE (i965, nv50, nvc0, 
r600, radeonsi, llvmpipe, softpipe)
 

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


Mesa (master): radeonsi: increase coords array size for radeon_llvm_emit_prepare_cube_coords

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

Author: Marek Olšák 
Date:   Tue Mar 17 17:47:17 2015 +0100

radeonsi: increase coords array size for radeon_llvm_emit_prepare_cube_coords

radeon_llvm_emit_prepare_cube_coords uses coords[4] in some cases (TXB2 etc.)

Discovered by Coverity. Reported by Ilia Mirkin.

Cc: 10.5 10.4 
Reviewed-by: Michel Dänzer 

---

 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c |2 +-
 src/gallium/drivers/radeonsi/si_shader.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c 
b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index d89e2b4..1690194 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -748,7 +748,7 @@ static void txp_fetch_args(
const struct tgsi_full_instruction * inst = emit_data->inst;
LLVMValueRef src_w;
unsigned chan;
-   LLVMValueRef coords[4];
+   LLVMValueRef coords[5];
 
emit_data->dst_type = LLVMVectorType(bld_base->base.elem_type, 4);
src_w = lp_build_emit_fetch(bld_base, emit_data->inst, 0, TGSI_CHAN_W);
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index de889ed..4dcf756 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1572,7 +1572,7 @@ static void tex_fetch_args(
const struct tgsi_full_instruction * inst = emit_data->inst;
unsigned opcode = inst->Instruction.Opcode;
unsigned target = inst->Texture.Texture;
-   LLVMValueRef coords[4];
+   LLVMValueRef coords[5];
LLVMValueRef address[16];
int ref_pos;
unsigned num_coords = tgsi_util_get_texture_coord_dim(target, &ref_pos);

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


Mesa (master): docs/GL3: don't list r300

2015-03-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 2b5379651f0b4dca9c1187b53b8466ff265ceb80
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b5379651f0b4dca9c1187b53b8466ff265ceb80

Author: Marek Olšák 
Date:   Mon Mar 16 23:15:22 2015 +0100

docs/GL3: don't list r300

r300g already supports everything it can. There's no point in listing
the driver here.

Reviewed-by: Ilia Mirkin 

---

 docs/GL3.txt |   56 
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 5d59341..1ca4502 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -21,23 +21,23 @@ Feature   Status
 GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, 
softpipe
 
   glBindFragDataLocation, glGetFragDataLocation DONE
-  Conditional rendering (GL_NV_conditional_render)  DONE (r300, swrast)
-  Map buffer subranges (GL_ARB_map_buffer_range)DONE (r300, swrast)
-  Clamping controls (GL_ARB_color_buffer_float) DONE (r300)
-  Float textures, renderbuffers (GL_ARB_texture_float)  DONE (r300)
+  Conditional rendering (GL_NV_conditional_render)  DONE (swrast)
+  Map buffer subranges (GL_ARB_map_buffer_range)DONE (swrast)
+  Clamping controls (GL_ARB_color_buffer_float) DONE ()
+  Float textures, renderbuffers (GL_ARB_texture_float)  DONE ()
   GL_EXT_packed_float   DONE ()
   GL_EXT_texture_shared_exponentDONE (swrast)
   Float depth buffers (GL_ARB_depth_buffer_float)   DONE ()
-  Framebuffer objects (GL_ARB_framebuffer_object)   DONE (r300, swrast)
+  Framebuffer objects (GL_ARB_framebuffer_object)   DONE (swrast)
   GL_ARB_half_float_pixel   DONE (all drivers)
-  GL_ARB_half_float_vertex  DONE (r300, swrast)
+  GL_ARB_half_float_vertex  DONE (swrast)
   GL_EXT_texture_integerDONE ()
   GL_EXT_texture_array  DONE ()
   Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE (swrast)
-  GL_EXT_texture_compression_rgtc   DONE (r300, swrast)
-  GL_ARB_texture_rg DONE (r300, swrast)
+  GL_EXT_texture_compression_rgtc   DONE (swrast)
+  GL_ARB_texture_rg DONE (swrast)
   Transform feedback (GL_EXT_transform_feedback)DONE ()
-  Vertex array objects (GL_ARB_vertex_array_object) DONE (all drivers)
+  Vertex array objects (GL_ARB_vertex_array_object) DONE ()
   sRGB framebuffer format (GL_EXT_framebuffer_sRGB) DONE ()
   glClearBuffer commandsDONE
   glGetStringi command  DONE
@@ -45,7 +45,7 @@ GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
   glVertexAttribI commands  DONE
   Depth format cube texturesDONE ()
   GLX_ARB_create_context (GLX 1.4 is required)  DONE
-  Multisample anti-aliasing DONE (llvmpipe (*), 
softpipe (*), r300)
+  Multisample anti-aliasing DONE (llvmpipe (*), 
softpipe (*))
 
 (*) llvmpipe and softpipe have fake Multisample anti-aliasing support
 
@@ -54,27 +54,27 @@ GL 3.1, GLSL 1.40 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
 
   Forward compatible context support/deprecations   DONE ()
   Instanced drawing (GL_ARB_draw_instanced) DONE (swrast)
-  Buffer copying (GL_ARB_copy_buffer)   DONE (r300, swrast)
-  Primitive restart (GL_NV_primitive_restart)   DONE (r300)
+  Buffer copying (GL_ARB_copy_buffer)   DONE (swrast)
+  Primitive restart (GL_NV_primitive_restart)   DONE ()
   16 vertex texture image units DONE ()
   Texture buffer objs (GL_ARB_texture_buffer_object)DONE for OpenGL 3.1 
contexts ()
-  Rectangular textures (GL_ARB_texture_rectangle)   DONE (r300, swrast)
+  Rectangular textures (GL_ARB_texture_rectangle)   DONE (swrast)
   Uniform buffer objs (GL_ARB_uniform_buffer_object)DONE (swrast)
-  Signed normalized textures (GL_EXT_texture_snorm) DONE (r300)
+  Signed normalized textures (GL_EXT_texture_snorm) DONE ()
 
 
 GL 3.2, GLSL 1.50 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, 
softpipe
 
   Core/compatibility profiles   DONE
   Geometry shaders  DONE ()
-  BGRA vertex order (GL_ARB_vertex_array_bgra)  DONE (r300, swrast)
-  Base vertex offset(GL_ARB_draw_elements_base_vertex)  DONE (r300, swrast)
-  Frag shader coord (GL_ARB_fragment_coord_conventions) DONE (r300, swrast)
-  Provoking vertex (GL_ARB_provoking_vertex)DONE (r300, swrast)
+ 

Mesa (master): docs/GL3: don't list swrast

2015-03-18 Thread Marek Olšák
Module: Mesa
Branch: master
Commit: 4e46af0195f7f9000ee0633685756d26f745499a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e46af0195f7f9000ee0633685756d26f745499a

Author: Marek Olšák 
Date:   Mon Mar 16 23:19:17 2015 +0100

docs/GL3: don't list swrast

Let's face it: This driver is unlikely to get more love.

Reviewed-by: Ilia Mirkin 

---

 docs/GL3.txt |   42 +-
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 1ca4502..bd17743 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -21,21 +21,21 @@ Feature   Status
 GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, 
softpipe
 
   glBindFragDataLocation, glGetFragDataLocation DONE
-  Conditional rendering (GL_NV_conditional_render)  DONE (swrast)
-  Map buffer subranges (GL_ARB_map_buffer_range)DONE (swrast)
+  Conditional rendering (GL_NV_conditional_render)  DONE ()
+  Map buffer subranges (GL_ARB_map_buffer_range)DONE ()
   Clamping controls (GL_ARB_color_buffer_float) DONE ()
   Float textures, renderbuffers (GL_ARB_texture_float)  DONE ()
   GL_EXT_packed_float   DONE ()
-  GL_EXT_texture_shared_exponentDONE (swrast)
+  GL_EXT_texture_shared_exponentDONE ()
   Float depth buffers (GL_ARB_depth_buffer_float)   DONE ()
-  Framebuffer objects (GL_ARB_framebuffer_object)   DONE (swrast)
+  Framebuffer objects (GL_ARB_framebuffer_object)   DONE ()
   GL_ARB_half_float_pixel   DONE (all drivers)
-  GL_ARB_half_float_vertex  DONE (swrast)
+  GL_ARB_half_float_vertex  DONE ()
   GL_EXT_texture_integerDONE ()
   GL_EXT_texture_array  DONE ()
-  Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE (swrast)
-  GL_EXT_texture_compression_rgtc   DONE (swrast)
-  GL_ARB_texture_rg DONE (swrast)
+  Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE ()
+  GL_EXT_texture_compression_rgtc   DONE ()
+  GL_ARB_texture_rg DONE ()
   Transform feedback (GL_EXT_transform_feedback)DONE ()
   Vertex array objects (GL_ARB_vertex_array_object) DONE ()
   sRGB framebuffer format (GL_EXT_framebuffer_sRGB) DONE ()
@@ -53,13 +53,13 @@ GL 3.0, GLSL 1.30 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
 GL 3.1, GLSL 1.40 --- all DONE: i965, nv50, nvc0, r600, radeonsi, llvmpipe, 
softpipe
 
   Forward compatible context support/deprecations   DONE ()
-  Instanced drawing (GL_ARB_draw_instanced) DONE (swrast)
-  Buffer copying (GL_ARB_copy_buffer)   DONE (swrast)
+  Instanced drawing (GL_ARB_draw_instanced) DONE ()
+  Buffer copying (GL_ARB_copy_buffer)   DONE ()
   Primitive restart (GL_NV_primitive_restart)   DONE ()
   16 vertex texture image units DONE ()
   Texture buffer objs (GL_ARB_texture_buffer_object)DONE for OpenGL 3.1 
contexts ()
-  Rectangular textures (GL_ARB_texture_rectangle)   DONE (swrast)
-  Uniform buffer objs (GL_ARB_uniform_buffer_object)DONE (swrast)
+  Rectangular textures (GL_ARB_texture_rectangle)   DONE ()
+  Uniform buffer objs (GL_ARB_uniform_buffer_object)DONE ()
   Signed normalized textures (GL_EXT_texture_snorm) DONE ()
 
 
@@ -67,14 +67,14 @@ GL 3.2, GLSL 1.50 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
 
   Core/compatibility profiles   DONE
   Geometry shaders  DONE ()
-  BGRA vertex order (GL_ARB_vertex_array_bgra)  DONE (swrast)
-  Base vertex offset(GL_ARB_draw_elements_base_vertex)  DONE (swrast)
-  Frag shader coord (GL_ARB_fragment_coord_conventions) DONE (swrast)
-  Provoking vertex (GL_ARB_provoking_vertex)DONE (swrast)
+  BGRA vertex order (GL_ARB_vertex_array_bgra)  DONE ()
+  Base vertex offset(GL_ARB_draw_elements_base_vertex)  DONE ()
+  Frag shader coord (GL_ARB_fragment_coord_conventions) DONE ()
+  Provoking vertex (GL_ARB_provoking_vertex)DONE ()
   Seamless cubemaps (GL_ARB_seamless_cube_map)  DONE ()
   Multisample textures (GL_ARB_texture_multisample) DONE ()
-  Frag depth clamp (GL_ARB_depth_clamp) DONE (swrast)
-  Fence objects (GL_ARB_sync)   DONE (swrast)
+  Frag depth clamp (GL_ARB_depth_clamp) DONE ()
+  Fence objects (GL_ARB_sync)   DONE ()
   GLX_ARB_create_context_profileDONE
 
 
@@ -82,11 +82,11 @@ GL 3.3, GLSL 3.30 --- all DONE: i965, nv50, nvc0, r600, 
radeonsi, llvmpipe, soft
 

Mesa (master): configure: check if compiler supports -Werror=vla.

2015-03-18 Thread Jose Fonseca
Module: Mesa
Branch: master
Commit: 8475526a3842580f00a043bca8f821e14e9f5eb7
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8475526a3842580f00a043bca8f821e14e9f5eb7

Author: Jonathan Gray 
Date:   Tue Mar 17 13:16:05 2015 +1100

configure: check if compiler supports -Werror=vla.

Check if the compiler supports -Werror=vla before using it.
-Wvla was introduced with GCC 4.3 and is not present in 4.2.
Fixes the build on OpenBSD.

v2: Fix statement order, and quote $save_CFLAGS.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89433
Signed-off-by: Jonathan Gray 
Signed-off-by: Jose Fonseca 

---

 configure.ac |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index a3b0ebd..8c90b41 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,8 +278,20 @@ if test "x$GCC" = xyes; then
 # - non-Linux/Posix OpenGL portions needs to build on MSVC 2013 (which
 #   supports most of C99)
 # - the rest has no compiler compiler restrictions
-MSVC2013_COMPAT_CFLAGS="-Werror=vla -Werror=pointer-arith"
-MSVC2013_COMPAT_CXXFLAGS="-Werror=vla -Werror=pointer-arith"
+MSVC2013_COMPAT_CFLAGS="-Werror=pointer-arith"
+MSVC2013_COMPAT_CXXFLAGS="-Werror=pointer-arith"
+
+# Enable -Werror=vla if compiler supports it
+save_CFLAGS="$CFLAGS"
+AC_MSG_CHECKING([whether $CC supports -Werror=vla])
+CFLAGS="$CFLAGS -Werror=vla"
+AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+  [MSVC2013_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS 
-Werror=vla";
+   MSVC2013_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS 
-Werror=vla";
+   AC_MSG_RESULT([yes])],
+   AC_MSG_RESULT([no]));
+CFLAGS="$save_CFLAGS"
+
 MSVC2008_COMPAT_CFLAGS="$MSVC2013_COMPAT_CFLAGS 
-Werror=declaration-after-statement"
 MSVC2008_COMPAT_CXXFLAGS="$MSVC2013_COMPAT_CXXFLAGS"
 fi

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


Mesa (master): i965: Throttle to the previous frame

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

Author: Chris Wilson 
Date:   Fri Sep 19 10:10:13 2014 +0100

i965: Throttle to the previous frame

In order to facilitate the concurrency offered by triple buffering and to
offset the latency induced by swapping via an external process, which
may incur extra rendering itself, only throttle to the previous frame
and not the last. The second issue that mostly affects swap benchmarks,
but also can incur jitter in the throttling, is that the throttle bo is
closer to the next SwapBuffers rather than immediately after the previous
SwapBuffers. Throttling to the previous frame doubles the maximum possible
latency at the benefit of improving throughput and reducing jitter.

v2: Rename "first_post_swapbuffer" batches array to a plain
throttle_batch[] as the pluralisation was contorting the name and not
making it clear as to whether it was the first batch or first_post_swap
batch. Not least of which was that not all throttle points are SwapBuffers.

Signed-off-by: Chris Wilson 
Cc: Daniel Vetter 
Cc: Kenneth Graunke 
Cc: Ben Widawsky 
Cc: Kristian Høgsberg 
Cc: Chad Versace 
Cc: Ian Romanick 
Reviewed-by: Chad Versace 

---

 src/mesa/drivers/dri/i965/brw_context.c   |   19 ---
 src/mesa/drivers/dri/i965/brw_context.h   |2 +-
 src/mesa/drivers/dri/i965/intel_batchbuffer.c |7 ---
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 5120372..8257fb6 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -935,8 +935,10 @@ intelDestroyContext(__DRIcontext * driContextPriv)
 
intel_batchbuffer_free(brw);
 
-   drm_intel_bo_unreference(brw->first_post_swapbuffers_batch);
-   brw->first_post_swapbuffers_batch = NULL;
+   drm_intel_bo_unreference(brw->throttle_batch[1]);
+   drm_intel_bo_unreference(brw->throttle_batch[0]);
+   brw->throttle_batch[1] = NULL;
+   brw->throttle_batch[0] = NULL;
 
driDestroyOptionCache(&brw->optionCache);
 
@@ -1245,11 +1247,14 @@ intel_prepare_render(struct brw_context *brw)
 * the swap, and getting our hands on that doesn't seem worth it,
 * so we just us the first batch we emitted after the last swap.
 */
-   if (brw->need_swap_throttle && brw->first_post_swapbuffers_batch) {
-  if (!brw->disable_throttling)
- drm_intel_bo_wait_rendering(brw->first_post_swapbuffers_batch);
-  drm_intel_bo_unreference(brw->first_post_swapbuffers_batch);
-  brw->first_post_swapbuffers_batch = NULL;
+   if (brw->need_swap_throttle && brw->throttle_batch[0]) {
+  if (brw->throttle_batch[1]) {
+ if (!brw->disable_throttling)
+drm_intel_bo_wait_rendering(brw->throttle_batch[1]);
+ drm_intel_bo_unreference(brw->throttle_batch[1]);
+  }
+  brw->throttle_batch[1] = brw->throttle_batch[0];
+  brw->throttle_batch[0] = NULL;
   brw->need_swap_throttle = false;
   /* Throttling here is more precise than the throttle ioctl, so skip it */
   brw->need_flush_throttle = false;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index eebd7ce..8b29e2a 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1030,7 +1030,7 @@ struct brw_context
bool front_buffer_dirty;
 
/** Framerate throttling: @{ */
-   drm_intel_bo *first_post_swapbuffers_batch;
+   drm_intel_bo *throttle_batch[2];
 
/* Limit the number of outstanding SwapBuffers by waiting for an earlier
 * frame of rendering to complete. This gives a very precise cap to the
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 5ac4d18..87862cd 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -168,6 +168,7 @@ static void
 brw_new_batch(struct brw_context *brw)
 {
/* Create a new batchbuffer and reset the associated state: */
+   drm_intel_gem_bo_clear_relocs(brw->batch.bo, 0);
intel_batchbuffer_reset(brw);
 
/* If the kernel supports hardware contexts, then most hardware state is
@@ -289,9 +290,9 @@ _intel_batchbuffer_flush(struct brw_context *brw,
if (brw->batch.used == 0)
   return 0;
 
-   if (brw->first_post_swapbuffers_batch == NULL) {
-  brw->first_post_swapbuffers_batch = brw->batch.bo;
-  drm_intel_bo_reference(brw->first_post_swapbuffers_batch);
+   if (brw->throttle_batch[0] == NULL) {
+  brw->throttle_batch[0] = brw->batch.bo;
+  drm_intel_bo_reference(brw->throttle_batch[0]);
}
 
if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {

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

Mesa (master): i965: Defer the throttle until we submit new commands

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

Author: Chris Wilson 
Date:   Wed Mar 11 12:21:29 2015 +

i965: Defer the throttle until we submit new commands

Currently, we throttle before the user begins preparing commands for the
next frame when we acquire the draw/read buffers. However, construction
of the command buffer can itself take significant time relative to the
frame time. If we move the throttle from the buffer acquire to the
command submit phase we can allow the user to improve concurrency
between the CPU and GPU (i.e. reduce the amount of time we waste inside
the throttle).

v2: Whitespace + delay throttling until after the next submission for
greater parallelism

Signed-off-by: Chris Wilson 
Cc: Daniel Vetter 
Cc: Kenneth Graunke 
Cc: Ben Widawsky 
Cc: Kristian Høgsberg 
Cc: Chad Versace 
Cc: Ian Romanick 
Reviewed-by: Chad Versace  [v1]

---

 src/mesa/drivers/dri/i965/brw_context.c   |   34 ---
 src/mesa/drivers/dri/i965/intel_batchbuffer.c |   44 +
 2 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 8257fb6..88685cd 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1231,40 +1231,6 @@ intel_prepare_render(struct brw_context *brw)
 */
if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
   brw->front_buffer_dirty = true;
-
-   /* Wait for the swapbuffers before the one we just emitted, so we
-* don't get too many swaps outstanding for apps that are GPU-heavy
-* but not CPU-heavy.
-*
-* We're using intelDRI2Flush (called from the loader before
-* swapbuffer) and glFlush (for front buffer rendering) as the
-* indicator that a frame is done and then throttle when we get
-* here as we prepare to render the next frame.  At this point for
-* round trips for swap/copy and getting new buffers are done and
-* we'll spend less time waiting on the GPU.
-*
-* Unfortunately, we don't have a handle to the batch containing
-* the swap, and getting our hands on that doesn't seem worth it,
-* so we just us the first batch we emitted after the last swap.
-*/
-   if (brw->need_swap_throttle && brw->throttle_batch[0]) {
-  if (brw->throttle_batch[1]) {
- if (!brw->disable_throttling)
-drm_intel_bo_wait_rendering(brw->throttle_batch[1]);
- drm_intel_bo_unreference(brw->throttle_batch[1]);
-  }
-  brw->throttle_batch[1] = brw->throttle_batch[0];
-  brw->throttle_batch[0] = NULL;
-  brw->need_swap_throttle = false;
-  /* Throttling here is more precise than the throttle ioctl, so skip it */
-  brw->need_flush_throttle = false;
-   }
-
-   if (brw->need_flush_throttle) {
-  __DRIscreen *psp = brw->intelScreen->driScrnPriv;
-  drmCommandNone(psp->fd, DRM_I915_GEM_THROTTLE);
-  brw->need_flush_throttle = false;
-   }
 }
 
 /**
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c 
b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 87862cd..3cf44ad 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -33,6 +33,9 @@
 #include "intel_fbo.h"
 #include "brw_context.h"
 
+#include 
+#include 
+
 static void
 intel_batchbuffer_reset(struct brw_context *brw);
 
@@ -226,6 +229,44 @@ brw_finish_batch(struct brw_context *brw)
brw->cache.bo_used_by_gpu = true;
 }
 
+static void
+throttle(struct brw_context *brw)
+{
+   /* Wait for the swapbuffers before the one we just emitted, so we
+* don't get too many swaps outstanding for apps that are GPU-heavy
+* but not CPU-heavy.
+*
+* We're using intelDRI2Flush (called from the loader before
+* swapbuffer) and glFlush (for front buffer rendering) as the
+* indicator that a frame is done and then throttle when we get
+* here as we prepare to render the next frame.  At this point for
+* round trips for swap/copy and getting new buffers are done and
+* we'll spend less time waiting on the GPU.
+*
+* Unfortunately, we don't have a handle to the batch containing
+* the swap, and getting our hands on that doesn't seem worth it,
+* so we just use the first batch we emitted after the last swap.
+*/
+   if (brw->need_swap_throttle && brw->throttle_batch[0]) {
+  if (brw->throttle_batch[1]) {
+ if (!brw->disable_throttling)
+drm_intel_bo_wait_rendering(brw->throttle_batch[1]);
+ drm_intel_bo_unreference(brw->throttle_batch[1]);
+  }
+  brw->throttle_batch[1] = brw->throttle_batch[0];
+  brw->throttle_batch[0] = NULL;
+  brw->need_swap_throttle = false;
+  /* Throttling here is more precise than the throttle ioctl, so skip it */
+  brw->need_flush_throttl

Mesa (master): i965: Throttle rendering to an fbo

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

Author: Chris Wilson 
Date:   Thu Feb 26 11:25:18 2015 +

i965: Throttle rendering to an fbo

When rendering to an fbo, even though it may be acting as a winsys
frontbuffer or just generally, we never throttle. However, when rendering
to an fbo, there is no natural frame boundary. Conventionally we use
SwapBuffers and glFinish, but potential callers avoid often glFinish for
being too heavy handed (waiting on all outstanding rendering to complete).
The kernel provides a soft-throttling option for this case that waits for
rendering older than 20ms to be complete (that's a little too lax to be
used for swapbuffers, but is here a useful safety net). The remaining
choice is then either never to throttle, throttle after every draw call,
or at after intermediate user defined point such as glFlush and thus all the
implied flushes. This patch opts for the latter as that is the current
method used for flushing to front buffers.

v2: Defer the throttling from inside the flush to the next
intel_prepare_render() and switch non-fbo frontbuffer throttling over to
use the same lax method. The issuing being that
glFlush()/intel_prepare_read() is just as likely to be called inside a
tight loop and not at "frame" boundaries.

v3: Rename from need_front_throttle to need_flush_throttle to avoid any
ambiguity between front buffer rendering and fbo rendering. (Chad)

v4: Whitespace

Signed-off-by: Chris Wilson 
Cc: Daniel Vetter 
Cc: Kenneth Graunke 
Cc: Ben Widawsky 
Cc: Kristian Høgsberg 
Cc: Chad Versace 
Cc: Ian Romanick 
Reviewed-by: Chad Versace 

---

 src/mesa/drivers/dri/i965/brw_context.c  |   16 
 src/mesa/drivers/dri/i965/brw_context.h  |   14 +-
 src/mesa/drivers/dri/i965/intel_screen.c |8 
 3 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 0881e48..5120372 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -234,8 +234,8 @@ intel_glFlush(struct gl_context *ctx)
 
intel_batchbuffer_flush(brw);
intel_flush_front(ctx);
-   if (brw_is_front_buffer_drawing(ctx->DrawBuffer))
-  brw->need_throttle = true;
+
+   brw->need_flush_throttle = true;
 }
 
 static void
@@ -1245,12 +1245,20 @@ intel_prepare_render(struct brw_context *brw)
 * the swap, and getting our hands on that doesn't seem worth it,
 * so we just us the first batch we emitted after the last swap.
 */
-   if (brw->need_throttle && brw->first_post_swapbuffers_batch) {
+   if (brw->need_swap_throttle && brw->first_post_swapbuffers_batch) {
   if (!brw->disable_throttling)
  drm_intel_bo_wait_rendering(brw->first_post_swapbuffers_batch);
   drm_intel_bo_unreference(brw->first_post_swapbuffers_batch);
   brw->first_post_swapbuffers_batch = NULL;
-  brw->need_throttle = false;
+  brw->need_swap_throttle = false;
+  /* Throttling here is more precise than the throttle ioctl, so skip it */
+  brw->need_flush_throttle = false;
+   }
+
+   if (brw->need_flush_throttle) {
+  __DRIscreen *psp = brw->intelScreen->driScrnPriv;
+  drmCommandNone(psp->fd, DRM_I915_GEM_THROTTLE);
+  brw->need_flush_throttle = false;
}
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index 682fbe9..eebd7ce 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1031,7 +1031,19 @@ struct brw_context
 
/** Framerate throttling: @{ */
drm_intel_bo *first_post_swapbuffers_batch;
-   bool need_throttle;
+
+   /* Limit the number of outstanding SwapBuffers by waiting for an earlier
+* frame of rendering to complete. This gives a very precise cap to the
+* latency between input and output such that rendering never gets more
+* than a frame behind the user. (With the caveat that we technically are
+* not using the SwapBuffers itself as a barrier but the first batch
+* submitted afterwards, which may be immediately prior to the next
+* SwapBuffers.)
+*/
+   bool need_swap_throttle;
+
+   /** General throttling, not caught by throttling between SwapBuffers */
+   bool need_flush_throttle;
/** @} */
 
GLuint stats_wm;
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index cea7ddf..3640b67 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -174,10 +174,10 @@ intel_dri2_flush_with_flags(__DRIcontext *cPriv,
if (flags & __DRI2_FLUSH_DRAWABLE)
   intel_resolve_for_dri2_flush(brw, dPriv);
 
-   if (reason == __DRI2_THROTTLE_SWAPBUFFER ||
-   reason == __DRI2_THROTTLE_FLUSHFRONT) {
-  brw->need_throttle = true;
-