Mesa (master): glsl: Use more portable bash invocation construct.

2013-11-20 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: b7c0b61782251c1dedb0b0fb0e6654af81249910
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b7c0b61782251c1dedb0b0fb0e6654af81249910

Author: Vinson Lee 
Date:   Fri Oct 11 18:33:08 2013 -0700

glsl: Use more portable bash invocation construct.

Fixes 'make check' on distros where bash is not at /bin/bash.

Signed-off-by: Vinson Lee 
Reviewed-by: Brian Paul 
Reviewed-by: Ian Romanick 
Tested-by: Ian Romanick 

---

 src/glsl/tests/lower_jumps/create_test_cases.py|2 +-
 src/glsl/tests/lower_jumps/lower_breaks_1.opt_test |2 +-
 src/glsl/tests/lower_jumps/lower_breaks_2.opt_test |2 +-
 src/glsl/tests/lower_jumps/lower_breaks_3.opt_test |2 +-
 src/glsl/tests/lower_jumps/lower_breaks_4.opt_test |2 +-
 src/glsl/tests/lower_jumps/lower_breaks_5.opt_test |2 +-
 src/glsl/tests/lower_jumps/lower_breaks_6.opt_test |2 +-
 .../lower_guarded_conditional_break.opt_test   |2 +-
 .../lower_jumps/lower_pulled_out_jump.opt_test |2 +-
 .../tests/lower_jumps/lower_returns_1.opt_test |2 +-
 .../tests/lower_jumps/lower_returns_2.opt_test |2 +-
 .../tests/lower_jumps/lower_returns_3.opt_test |2 +-
 .../tests/lower_jumps/lower_returns_4.opt_test |2 +-
 .../lower_jumps/lower_returns_main_false.opt_test  |2 +-
 .../lower_jumps/lower_returns_main_true.opt_test   |2 +-
 .../lower_jumps/lower_returns_sub_false.opt_test   |2 +-
 .../lower_jumps/lower_returns_sub_true.opt_test|2 +-
 .../lower_jumps/lower_unified_returns.opt_test |2 +-
 .../remove_continue_at_end_of_loop.opt_test|2 +-
 ..._non_void_at_end_of_loop_lower_nothing.opt_test |2 +-
 ...n_non_void_at_end_of_loop_lower_return.opt_test |2 +-
 ..._at_end_of_loop_lower_return_and_break.opt_test |2 +-
 ...turn_void_at_end_of_loop_lower_nothing.opt_test |2 +-
 ...eturn_void_at_end_of_loop_lower_return.opt_test |2 +-
 ..._at_end_of_loop_lower_return_and_break.opt_test |2 +-
 src/glsl/tests/optimization-test   |2 +-
 26 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/src/glsl/tests/lower_jumps/create_test_cases.py 
b/src/glsl/tests/lower_jumps/create_test_cases.py
index fbc6f0a..9974681 100644
--- a/src/glsl/tests/lower_jumps/create_test_cases.py
+++ b/src/glsl/tests/lower_jumps/create_test_cases.py
@@ -291,7 +291,7 @@ def create_test_case(doc_string, input_sexp, expected_sexp, 
test_name,
 args = ['../../glsl_test', 'optpass', '--quiet', '--input-ir', 
optimization]
 test_file = '{0}.opt_test'.format(test_name)
 with open(test_file, 'w') as f:
-f.write('#!/bin/bash\n#\n# This file was generated by 
create_test_cases.py.\n#\n')
+f.write('#!/usr/bin/env bash\n#\n# This file was generated by 
create_test_cases.py.\n#\n')
 f.write(doc_string)
 f.write('{0} 

Mesa (master): gallivm: Ignore unknown file type in non-debug builds.

2013-11-20 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 7f56780915e352fda80b0e062591995021916859
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f56780915e352fda80b0e062591995021916859

Author: Vinson Lee 
Date:   Tue Nov 19 23:16:34 2013 -0800

gallivm: Ignore unknown file type in non-debug builds.

Fixes "Uninitialized pointer read" defect reported by Coverity.

Signed-off-by: Vinson Lee 
Reviewed-by: Jose Fonseca 

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c 
b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 37f7a56..6d8dc8c 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -2410,6 +2410,7 @@ emit_dump_file(struct lp_build_tgsi_soa_context *bld,
 res = LLVMBuildLoad(builder, reg_ptr, "");
  } else {
 assert(0);
+continue;
  }
 
  emit_dump_reg(gallivm, file, index, chan, res);

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


Mesa (master): mesa/swrast: fix inverted front buffer rendering with old-school swrast

2013-11-20 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: a43b49dfb13dc7e6d2d6d7ceee892077038d7102
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a43b49dfb13dc7e6d2d6d7ceee892077038d7102

Author: Dave Airlie 
Date:   Wed Nov 13 12:53:52 2013 +1000

mesa/swrast: fix inverted front buffer rendering with old-school swrast

I've no idea when this broke, but we have some people who wanted it fixed,
so here's my attempt.

reproducer, run readpix with swrast hit f, or run trival tri -sb things are
upside down, after this patch they aren't.

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

Cc: "
Signed-off-by: Dave Airlie 

---

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

diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
b/src/mesa/drivers/dri/swrast/swrast.c
index c062071..73dc5c4 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -406,8 +406,8 @@ swrast_map_renderbuffer(struct gl_context *ctx,
 (char *) xrb->Base.Buffer,
 dPriv->loaderPrivate);
 
-  *out_map = xrb->Base.Buffer;
-  *out_stride = stride;
+  *out_map = xrb->Base.Buffer + (h - 1) * stride;
+  *out_stride = -stride;
   return;
}
 

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


Mesa (master): glx: don't fail out when no configs if we have visuals

2013-11-20 Thread Dave Airlie
Module: Mesa
Branch: master
Commit: b01a3a9b72ed8d4899b4552658da7233c451142a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b01a3a9b72ed8d4899b4552658da7233c451142a

Author: Dave Airlie 
Date:   Mon Nov 18 17:34:52 2013 +1000

glx: don't fail out when no configs if we have visuals

GLX 1.2 servers with no SGIX_fbconfigs exist (some citrix thing),
and we fail glxinfo completely in those cases.

CC: 
Reviewed-by: Adam Jackson 
Reviewed-by: Brian Paul 
Signed-off-by: Dave Airlie 

---

 src/glx/glxcmds.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 1d8fe83..06c4c16 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -183,7 +183,7 @@ GetGLXPrivScreenConfig(Display * dpy, int scrn, struct 
glx_display ** ppriv,
 
/* Check to see if the GL is supported on this screen */
*ppsc = (*ppriv)->screens[scrn];
-   if ((*ppsc)->configs == NULL) {
+   if ((*ppsc)->configs == NULL && (*ppsc)->visuals == NULL) {
   /* No support for GL on this screen regardless of visual */
   return GLX_BAD_VISUAL;
}

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


Demos (master): glxinfo: handle no fbconfigs case better

2013-11-20 Thread Dave Airlie
Module: Demos
Branch: master
Commit: c202524348826e1e54a853d69395334faafa6103
URL:
http://cgit.freedesktop.org/mesa/demos/commit/?id=c202524348826e1e54a853d69395334faafa6103

Author: Dave Airlie 
Date:   Tue Nov 19 09:30:51 2013 +1000

glxinfo: handle no fbconfigs case better

If we get a server that has only GLX1.2 and no SGIX_fbconfig, we can
print stuff we shouldn't. If we have no fbconfigs then we don't have core
profile, so don't bother trying visual path when doing core profile.

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

---

 src/xdemos/glxinfo.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index 4d9a5cc..218b018 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -862,13 +862,14 @@ print_screen_info(Display *dpy, int scrnum, Bool 
allowDirect,
   visinfo = glXGetVisualFromFBConfig(dpy, fbconfigs[0]);
   XFree(fbconfigs);
}
-   else {
+   else if (!coreProfile) {
   visinfo = choose_xvisinfo(dpy, scrnum);
   if (visinfo)
 ctx = glXCreateContext(dpy, visinfo, NULL, allowDirect);
-   }
+   } else
+  visinfo = NULL;
 
-   if (!visinfo) {
+   if (!visinfo && !coreProfile) {
   fprintf(stderr, "Error: couldn't find RGB GLX visual or fbconfig\n");
   return False;
}

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


Mesa (master): mesa: Fix setup of LocalParams array.

2013-11-20 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 81ff29e30c573fcc134bf717670015ab4654ebcd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81ff29e30c573fcc134bf717670015ab4654ebcd

Author: Eric Anholt 
Date:   Mon Nov 18 09:55:00 2013 -0800

mesa: Fix setup of LocalParams array.

i965 passed piglit, but swrast and gallium both segfaulted without this.
i965 happened to work because it never ran _mesa_load_state_parameters()
on the new program before the test called glProgramLocalParameter(), which
was allocating a LocalParams array for the fallback path.

v2: Since v1 threw away old localparams data, leaked old LocalParams
memory, only fixed fragment programs, and I was dubious of my previous
invariants already (nothing but program_parse.y will generate
LocalParams, and only that one path of program_parse.y will), just
late-allocate localparams at the other point of dereferencing them.
This adds overhead to _mesa_load_state_parameter, which is
uncomfortable, but I'm pretty sure that giant switch statement is
super slow already.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71734
Tested-by: Michel Dänzer 

---

 src/mesa/program/prog_statevars.c |   14 ++
 src/mesa/program/program_parse.y  |7 ---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/mesa/program/prog_statevars.c 
b/src/mesa/program/prog_statevars.c
index f6fd535..58e1f49 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -368,6 +368,13 @@ _mesa_fetch_state(struct gl_context *ctx, const 
gl_state_index state[],
COPY_4V(value, ctx->FragmentProgram.Parameters[idx]);
return;
 case STATE_LOCAL:
+   if (!ctx->FragmentProgram.Current->Base.LocalParams) {
+  ctx->FragmentProgram.Current->Base.LocalParams =
+ calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
+  if (!ctx->FragmentProgram.Current->Base.LocalParams)
+ return;
+   }
+
COPY_4V(value, 
ctx->FragmentProgram.Current->Base.LocalParams[idx]);
return;
 default:
@@ -387,6 +394,13 @@ _mesa_fetch_state(struct gl_context *ctx, const 
gl_state_index state[],
COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
return;
 case STATE_LOCAL:
+   if (!ctx->VertexProgram.Current->Base.LocalParams) {
+  ctx->VertexProgram.Current->Base.LocalParams =
+ calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
+  if (!ctx->VertexProgram.Current->Base.LocalParams)
+ return;
+   }
+
COPY_4V(value, 
ctx->VertexProgram.Current->Base.LocalParams[idx]);
return;
 default:
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index 03c0a3d..a76db4e 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -25,7 +25,6 @@
 #include 
 #include 
 
-#include "main/macros.h"
 #include "main/mtypes.h"
 #include "main/imports.h"
 #include "program/program.h"
@@ -2560,12 +2559,6 @@ initialize_symbol_from_param(struct gl_program *prog,
param_var->type = at_param;
param_var->param_binding_type = PROGRAM_STATE_VAR;
 
-   /* Dynamically allocate LocalParams, since it's a large array to have
-* statically in every gl_program otherwise.
-*/
-   if (state_tokens[1] == STATE_LOCAL && !prog->LocalParams)
-  prog->LocalParams = calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
-
/* If we are adding a STATE_ENV or STATE_LOCAL that has multiple elements,
 * we need to unroll it and call add_state_reference() for each row
 */

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


Mesa (llvmpipe-rast-64): llvmpipe: enable 32 bit sse paths in the triangle setup

2013-11-20 Thread Zack Rusin
Module: Mesa
Branch: llvmpipe-rast-64
Commit: e8b9a19fb074295f4bf06a18afa77b8249ee9643
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8b9a19fb074295f4bf06a18afa77b8249ee9643

Author: Zack Rusin 
Date:   Wed Nov 20 18:50:00 2013 -0500

llvmpipe: enable 32 bit sse paths in the triangle setup

we can use the 32 bit sse paths if the fb is smaller than
the largest bounding box is known to not cause an overflow
and triangle fits within the box.

---

 src/gallium/drivers/llvmpipe/lp_setup_tri.c |   35 +-
 1 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c 
b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 0062ebb..1507a5c 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -44,9 +44,6 @@
 
 #define NUM_CHANNELS 4
 
-/* TODO */
-#undef PIPE_ARCH_SSE
-
 #if defined(PIPE_ARCH_SSE)
 #include 
 #endif
@@ -381,7 +378,10 @@ do_triangle_ccw(struct lp_setup_context *setup,
plane = GET_PLANES(tri);
 
 #if defined(PIPE_ARCH_SSE)
-   {
+   if (setup->fb.width <= MAX_FIXED_LENGTH32 &&
+   setup->fb.height <= MAX_FIXED_LENGTH32 &&
+   (bbox.x1 - bbox.x0) <= MAX_FIXED_LENGTH32 &&
+   (bbox.y1 - bbox.y0) <= MAX_FIXED_LENGTH32) {
   __m128i vertx, verty;
   __m128i shufx, shufy;
   __m128i dcdx, dcdy, c;
@@ -393,9 +393,12 @@ do_triangle_ccw(struct lp_setup_context *setup,
   __m128i c_inc_mask, c_inc;
   __m128i eo, p0, p1, p2;
   __m128i zero = _mm_setzero_si128();
+  PIPE_ALIGN_VAR(16) int32_t temp_vec[4];
 
-  vertx = _mm_loadu_si128((__m128i *)position->x); /* vertex x coords */
-  verty = _mm_loadu_si128((__m128i *)position->y); /* vertex y coords */
+  vertx = _mm_setr_epi32((int32_t)position->x[0], (int32_t)position->x[1],
+ (int32_t)position->x[2], (int32_t)position->x[3]);
+  verty = _mm_setr_epi32((int32_t)position->y[0], (int32_t)position->y[1],
+ (int32_t)position->y[2], (int32_t)position->y[3]);
 
   shufx = _mm_shuffle_epi32(vertx, _MM_SHUFFLE(3,0,2,1));
   shufy = _mm_shuffle_epi32(verty, _MM_SHUFFLE(3,0,2,1));
@@ -439,11 +442,20 @@ do_triangle_ccw(struct lp_setup_context *setup,
   transpose4_epi32(&c, &dcdx, &dcdy, &eo,
&p0, &p1, &p2, &unused);
 
-  _mm_store_si128((__m128i *)&plane[0], p0);
-  _mm_store_si128((__m128i *)&plane[1], p1);
-  _mm_store_si128((__m128i *)&plane[2], p2);
-   }
-#else
+#define STORE_PLANE(plane, vec) do { \
+ _mm_store_si128((__m128i *)&temp_vec, vec); \
+ plane.c= (int64_t)temp_vec[0];  \
+ plane.dcdx = temp_vec[1];   \
+ plane.dcdy = temp_vec[2];   \
+ plane.eo   = temp_vec[3];   \
+  } while(0)
+
+  STORE_PLANE(plane[0], p0);
+  STORE_PLANE(plane[1], p1);
+  STORE_PLANE(plane[2], p2);
+#undef STORE_PLANE
+   } else
+#endif
{
   int i;
   plane[0].dcdy = position->dx01;
@@ -496,7 +508,6 @@ do_triangle_ccw(struct lp_setup_context *setup,
  if (plane[i].dcdy > 0) plane[i].eo += plane[i].dcdy;
   }
}
-#endif
 
if (0) {
   debug_printf("p0: %"PRIx64"/%08x/%08x/%"PRIx64"\n",

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


Mesa (master): i965/vec4: Add invalidate_live_intervals method.

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 1c263f8f4f767df0511e63377c17a95ebebba944
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1c263f8f4f767df0511e63377c17a95ebebba944

Author: Matt Turner 
Date:   Mon Nov 11 10:33:46 2013 -0800

i965/vec4: Add invalidate_live_intervals method.

Reviewed-by: Paul Berry 
Reviewed-by: Kenneth Graunke 

---

 .../drivers/dri/i965/brw_schedule_instructions.cpp |2 +-
 src/mesa/drivers/dri/i965/brw_vec4.cpp |8 
 src/mesa/drivers/dri/i965/brw_vec4.h   |1 +
 .../drivers/dri/i965/brw_vec4_copy_propagation.cpp |2 +-
 .../drivers/dri/i965/brw_vec4_live_variables.cpp   |6 ++
 .../drivers/dri/i965/brw_vec4_reg_allocate.cpp |2 +-
 6 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index a4fae0d..1050d67 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -1446,5 +1446,5 @@ vec4_visitor::opt_schedule_instructions()
   printf("vec4 estimated execution time: %d cycles\n", sched.time);
}
 
-   this->live_intervals_valid = false;
+   invalidate_live_intervals();
 }
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 20fbd45..e7cfab2 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -343,7 +343,7 @@ vec4_visitor::dead_code_eliminate()
}
 
if (progress)
-  live_intervals_valid = false;
+  invalidate_live_intervals();
 
return progress;
 }
@@ -554,7 +554,7 @@ vec4_visitor::opt_algebraic()
}
 
if (progress)
-  this->live_intervals_valid = false;
+  invalidate_live_intervals();
 
return progress;
 }
@@ -1017,7 +1017,7 @@ vec4_visitor::opt_register_coalesce()
}
 
if (progress)
-  live_intervals_valid = false;
+  invalidate_live_intervals();
 
return progress;
 }
@@ -1100,7 +1100,7 @@ vec4_visitor::split_virtual_grfs()
  }
   }
}
-   this->live_intervals_valid = false;
+   invalidate_live_intervals();
 }
 
 void
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h 
b/src/mesa/drivers/dri/i965/brw_vec4.h
index 1f29e57..5cec9f9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -352,6 +352,7 @@ public:
void split_uniform_registers();
void pack_uniform_registers();
void calculate_live_intervals();
+   void invalidate_live_intervals();
void split_virtual_grfs();
bool dead_code_eliminate();
bool virtual_grf_interferes(int a, int b);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index d009a08..033c642 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -362,7 +362,7 @@ vec4_visitor::opt_copy_propagation()
}
 
if (progress)
-  live_intervals_valid = false;
+  invalidate_live_intervals();
 
return progress;
 }
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
index 3adda09..5bc2f9f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_live_variables.cpp
@@ -266,6 +266,12 @@ vec4_visitor::calculate_live_intervals()
this->live_intervals_valid = true;
 }
 
+void
+vec4_visitor::invalidate_live_intervals()
+{
+   live_intervals_valid = false;
+}
+
 bool
 vec4_visitor::virtual_grf_interferes(int a, int b)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
index 387e3c4..95c8d9f 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp
@@ -359,7 +359,7 @@ vec4_visitor::spill_reg(int spill_reg_nr)
   }
}
 
-   this->live_intervals_valid = false;
+   invalidate_live_intervals();
 }
 
 } /* namespace brw */

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


Mesa (master): i965: Fix disassembled names of BFI1 and BFI2 instructions.

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 82bfb45e24c7a19031a19ad1d361c07dd3da4987
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=82bfb45e24c7a19031a19ad1d361c07dd3da4987

Author: Matt Turner 
Date:   Sat Nov 16 13:03:55 2013 -0800

i965: Fix disassembled names of BFI1 and BFI2 instructions.

Reviewed-by: Kenneth Graunke 

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c 
b/src/mesa/drivers/dri/i965/brw_disasm.c
index 22b37d7..128e717 100644
--- a/src/mesa/drivers/dri/i965/brw_disasm.c
+++ b/src/mesa/drivers/dri/i965/brw_disasm.c
@@ -75,8 +75,8 @@ const struct opcode_desc opcode_descs[128] = {
 [BRW_OPCODE_CMP] = { .name = "cmp", .nsrc = 2, .ndst = 1 },
 [BRW_OPCODE_CMPN] = { .name = "cmpn", .nsrc = 2, .ndst = 1 },
 [BRW_OPCODE_BFE] = { .name = "bfe", .nsrc = 3, .ndst = 1},
-[BRW_OPCODE_BFI1] = { .name = "bfe1", .nsrc = 2, .ndst = 1},
-[BRW_OPCODE_BFI2] = { .name = "bfe2", .nsrc = 3, .ndst = 1},
+[BRW_OPCODE_BFI1] = { .name = "bfi1", .nsrc = 2, .ndst = 1},
+[BRW_OPCODE_BFI2] = { .name = "bfi2", .nsrc = 3, .ndst = 1},
 [BRW_OPCODE_ADDC] = { .name = "addc", .nsrc = 2, .ndst = 1},
 [BRW_OPCODE_SUBB] = { .name = "subb", .nsrc = 2, .ndst = 1},
 

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


Mesa (master): i965/test: Use unreachable() to silence warning.

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 5fe49d99f250be1aa6080286ff15862ac4d4c903
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5fe49d99f250be1aa6080286ff15862ac4d4c903

Author: Matt Turner 
Date:   Mon Nov 18 15:20:01 2013 -0800

i965/test: Use unreachable() to silence warning.

---

 .../dri/i965/test_vec4_register_coalesce.cpp   |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp 
b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
index c5a3cfc..83d931c 100644
--- a/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/test_vec4_register_coalesce.cpp
@@ -88,6 +88,7 @@ protected:
virtual vec4_instruction *emit_urb_write_opcode(bool complete)
{
   assert(!"Not reached");
+  unreachable();
}
 };
 

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


Mesa (master): i965: Link -ldl after libmesa.la

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 1f9092958d365c94af825c3b3b6664688c27b5a1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f9092958d365c94af825c3b3b6664688c27b5a1

Author: Matt Turner 
Date:   Mon Nov 18 15:19:15 2013 -0800

i965: Link -ldl after libmesa.la

DLOPEN_LIBS is part of DRI_LIB_DEPS.

Cc: "10.0" "
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71512
Reviewed-by: Eric Anholt 

---

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

diff --git a/src/mesa/drivers/dri/i965/Makefile.am 
b/src/mesa/drivers/dri/i965/Makefile.am
index 8c0f9a3..3b46af8 100644
--- a/src/mesa/drivers/dri/i965/Makefile.am
+++ b/src/mesa/drivers/dri/i965/Makefile.am
@@ -46,8 +46,8 @@ TEST_LIBS = \
libi965_dri.la \
../common/libdricommon.la \
../common/libmegadriver_stub.la \
-   $(DRI_LIB_DEPS) \
 ../../../libmesa.la \
+   $(DRI_LIB_DEPS) \
 -lrt \
../common/libdri_test_stubs.la
 

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


Mesa (master): i965/fs: Emit compressed 3-source instructions on Haswell.

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 9bbedf6146be6ecad2863fd924c434a2a530c361
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9bbedf6146be6ecad2863fd924c434a2a530c361

Author: Matt Turner 
Date:   Sat Nov 16 12:31:26 2013 -0800

i965/fs: Emit compressed 3-source instructions on Haswell.

For commit 4df56177 Paul discovered that the hardware restriction that
Align16 instructions cannot be compressed was lifted on Haswell. This
has prevented us from emitting compressed three-source instructions.

For added confirmation, the bspec lists a work around called
WaBreakSimd16TernaryInstructionsIntoSimd8 that hasn't been applicable
since very early Haswell silicon.

Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_fs_generator.cpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index cc58ff2..a97a016 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1404,7 +1404,7 @@ fs_generator::generate_code(exec_list *instructions)
   case BRW_OPCODE_MAD:
  assert(brw->gen >= 6);
 brw_set_access_mode(p, BRW_ALIGN_16);
-if (dispatch_width == 16) {
+ if (dispatch_width == 16 && !brw->is_haswell) {
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
brw_MAD(p, dst, src[0], src[1], src[2]);
brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF);
@@ -1419,7 +1419,7 @@ fs_generator::generate_code(exec_list *instructions)
   case BRW_OPCODE_LRP:
  assert(brw->gen >= 6);
 brw_set_access_mode(p, BRW_ALIGN_16);
-if (dispatch_width == 16) {
+ if (dispatch_width == 16 && !brw->is_haswell) {
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
brw_LRP(p, dst, src[0], src[1], src[2]);
brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF);
@@ -1516,7 +1516,7 @@ fs_generator::generate_code(exec_list *instructions)
   case BRW_OPCODE_BFE:
  assert(brw->gen >= 7);
  brw_set_access_mode(p, BRW_ALIGN_16);
- if (dispatch_width == 16) {
+ if (dispatch_width == 16 && !brw->is_haswell) {
 brw_set_compression_control(p, BRW_COMPRESSION_NONE);
 brw_BFE(p, dst, src[0], src[1], src[2]);
 brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF);

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


Mesa (master): i965/fs: Don't emit SIMD16 BFI instructions.

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: c4464c9eea65a287aa74f6bb59cd00b1ef665a36
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4464c9eea65a287aa74f6bb59cd00b1ef665a36

Author: Matt Turner 
Date:   Sat Nov 16 13:16:50 2013 -0800

i965/fs: Don't emit SIMD16 BFI instructions.

Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_fs_generator.cpp |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index a97a016..6626a8c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1530,11 +1530,32 @@ fs_generator::generate_code(exec_list *instructions)
 
   case BRW_OPCODE_BFI1:
  assert(brw->gen >= 7);
- brw_BFI1(p, dst, src[0], src[1]);
+ /* The Haswell WaForceSIMD8ForBFIInstruction workaround says that we
+  * should
+  *
+  *"Force BFI instructions to be executed always in SIMD8."
+  */
+ if (dispatch_width == 16 && brw->is_haswell) {
+brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+brw_BFI1(p, dst, src[0], src[1]);
+brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF);
+brw_BFI1(p, sechalf(dst), sechalf(src[0]), sechalf(src[1]));
+brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED);
+ } else {
+brw_BFI1(p, dst, src[0], src[1]);
+ }
  break;
   case BRW_OPCODE_BFI2:
  assert(brw->gen >= 7);
  brw_set_access_mode(p, BRW_ALIGN_16);
+ /* The Haswell WaForceSIMD8ForBFIInstruction workaround says that we
+  * should
+  *
+  *"Force BFI instructions to be executed always in SIMD8."
+  *
+  * Otherwise we would be able to emit compressed instructions like we
+  * do for the other three-source instructions.
+  */
  if (dispatch_width == 16) {
 brw_set_compression_control(p, BRW_COMPRESSION_NONE);
 brw_BFI2(p, dst, src[0], src[1], src[2]);

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


Mesa (master): i965: Make invalidate_live_intervals() a virtual method of backend_visitor.

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: b63d6aae55c06bf7cb6b9ed1370634bc120ed045
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b63d6aae55c06bf7cb6b9ed1370634bc120ed045

Author: Matt Turner 
Date:   Mon Nov 11 10:36:36 2013 -0800

i965: Make invalidate_live_intervals() a virtual method of backend_visitor.

Reviewed-by: Paul Berry 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_shader.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_shader.h 
b/src/mesa/drivers/dri/i965/brw_shader.h
index aba24c5..ae7823e 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -88,6 +88,8 @@ public:
void dump_instructions();
 
void assign_common_binding_table_offsets(uint32_t 
next_binding_table_offset);
+
+   virtual void invalidate_live_intervals() = 0;
 };
 
 uint32_t brw_texture_offset(struct gl_context *ctx, ir_constant *offset);

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


Mesa (master): i965: Add a pass to remove dead control flow.

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: a97cd0f4d7902965d5173f4bcbf2ad27c0eb5d12
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a97cd0f4d7902965d5173f4bcbf2ad27c0eb5d12

Author: Matt Turner 
Date:   Wed Oct 30 10:32:12 2013 -0700

i965: Add a pass to remove dead control flow.

Removes IF/ENDIF and IF/ELSE/ENDIF with no intervening instructions.

total instructions in shared programs: 1360393 -> 1360387 (-0.00%)
instructions in affected programs: 157 -> 151 (-3.82%)

(no change in vertex shaders)

Reviewed-by: Paul Berry 
Reviewed-by: Eric Anholt 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/Makefile.sources |1 +
 .../drivers/dri/i965/brw_dead_control_flow.cpp |   83 
 src/mesa/drivers/dri/i965/brw_dead_control_flow.h  |   26 ++
 src/mesa/drivers/dri/i965/brw_fs.cpp   |2 +
 src/mesa/drivers/dri/i965/brw_vec4.cpp |2 +
 5 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
b/src/mesa/drivers/dri/i965/Makefile.sources
index 5724458..ac1363c 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -44,6 +44,7 @@ i965_FILES = \
brw_context.c \
brw_cubemap_normalize.cpp \
brw_curbe.c \
+   brw_dead_control_flow.cpp \
brw_device_info.c \
brw_disasm.c \
brw_draw.c \
diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp 
b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
new file mode 100644
index 000..8bdf094
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/** @file brw_dead_control_flow.cpp
+ *
+ * This file implements the dead control flow elimination optimization pass.
+ */
+
+#include "brw_shader.h"
+#include "brw_cfg.h"
+
+/* Look for and eliminate dead control flow:
+ *
+ *   - if/endif
+ *   - if/else/endif
+ */
+bool
+dead_control_flow_eliminate(backend_visitor *v)
+{
+   bool progress = false;
+
+   cfg_t cfg(v);
+
+   for (int b = 0; b < cfg.num_blocks; b++) {
+  bblock_t *block = cfg.blocks[b];
+  bool found = false;
+
+  /* ENDIF instructions, by definition, can only be found at the ends of
+   * basic blocks.
+   */
+  backend_instruction *endif_inst = block->end;
+  if (endif_inst->opcode != BRW_OPCODE_ENDIF)
+ continue;
+
+  backend_instruction *if_inst = NULL, *else_inst = NULL;
+  backend_instruction *prev_inst = (backend_instruction *) 
endif_inst->prev;
+  if (prev_inst->opcode == BRW_OPCODE_IF) {
+ if_inst = prev_inst;
+ found = true;
+  } else if (prev_inst->opcode == BRW_OPCODE_ELSE) {
+ else_inst = prev_inst;
+
+ prev_inst = (backend_instruction *) prev_inst->prev;
+ if (prev_inst->opcode == BRW_OPCODE_IF) {
+if_inst = prev_inst;
+found = true;
+ }
+  }
+
+  if (found) {
+ if_inst->remove();
+ if (else_inst)
+else_inst->remove();
+ endif_inst->remove();
+ progress = true;
+  }
+   }
+
+   if (progress)
+  v->invalidate_live_intervals();
+
+   return progress;
+}
diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.h 
b/src/mesa/drivers/dri/i965/brw_dead_control_flow.h
new file mode 100644
index 000..57a4dab
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, 

Mesa (master): i965/fs: Use source's original type in register_coalesce().

2013-11-20 Thread Matt Turner
Module: Mesa
Branch: master
Commit: 9793fc1335f11b4131d6db680bec567dcfccfb5f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9793fc1335f11b4131d6db680bec567dcfccfb5f

Author: Matt Turner 
Date:   Fri Nov 15 11:09:47 2013 -0800

i965/fs: Use source's original type in register_coalesce().

Previously, register_coalesce() would modify

   mov   vgrf1:f  vgrf2:f
   cmp   null vgrf3:d  vgrf1:d

to be

   cmp   null vgrf3:d  vgrf2:f

and incorrectly use vgrf2's type in the instruction that the mov was
coalesced into.

Reviewed-by: Kenneth Graunke 

---

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

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 8b3f8df..5b20b1c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2429,6 +2429,7 @@ fs_visitor::register_coalesce()
scan_inst->src[i].reg == inst->dst.reg &&
scan_inst->src[i].reg_offset == inst->dst.reg_offset) {
   fs_reg new_src = inst->src[0];
+   new_src.type = scan_inst->src[i].type;
if (scan_inst->src[i].abs) {
   new_src.negate = 0;
   new_src.abs = 1;

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