Mesa (master): auxilary/os: Add DragonFly BSD support in os_get_total_physical_memory.

2014-10-13 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: a2fd55cfb65d3933c27ed6c2259966a98acc55eb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2fd55cfb65d3933c27ed6c2259966a98acc55eb

Author: Vinson Lee 
Date:   Fri Oct 10 22:40:21 2014 -0700

auxilary/os: Add DragonFly BSD support in os_get_total_physical_memory.

This patch fixes this build error on DragonFly BSD.

  CC   os/os_misc.lo
os/os_misc.c: In function 'os_get_total_physical_memory':
os/os_misc.c:132:2: error: #error Unsupported *BSD

Signed-off-by: Vinson Lee 
Reviewed-by: Brian Paul 

---

 src/gallium/auxiliary/os/os_misc.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/os/os_misc.c 
b/src/gallium/auxiliary/os/os_misc.c
index 4c5a22d..ebf033c 100644
--- a/src/gallium/auxiliary/os/os_misc.c
+++ b/src/gallium/auxiliary/os/os_misc.c
@@ -128,6 +128,8 @@ os_get_total_physical_memory(uint64_t *size)
mib[1] = HW_PHYSMEM64;
 #elif defined(PIPE_OS_FREEBSD)
mib[1] = HW_REALMEM;
+#elif defined(PIPE_OS_DRAGONFLY)
+   mib[1] = HW_PHYSMEM;
 #else
 #error Unsupported *BSD
 #endif

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


Mesa (master): glx: Fix glxUseXFont for glxWindow and glxPixmaps

2014-10-13 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 291be28476ea60c6fb1eb2a882e2e25def5d3735
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=291be28476ea60c6fb1eb2a882e2e25def5d3735

Author: Daniel Manjarres 
Date:   Sun Jun 22 09:47:58 2014 -0700

glx: Fix glxUseXFont for glxWindow and glxPixmaps

The current implementation of glxUseXFont requires creating
a temporary pixmap and graphics context, which requires a real
old-school X11 Window, not a glxDrawable. This patch changes
things so that glxUseXFont will also accept a glxWindow or
glxPixmap, and lookup the underlying X11 Drawable. Without
this patch glxUseXFont generates a giant stream of Xerrors
about bad drawables and bad graphics contexts.

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

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

---

 src/glx/xfont.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/src/glx/xfont.c b/src/glx/xfont.c
index 316c585..a086b7a 100644
--- a/src/glx/xfont.c
+++ b/src/glx/xfont.c
@@ -221,6 +221,7 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int 
first, int count, int lis
XGCValues values;
unsigned long valuemask;
XFontStruct *fs;
+   __GLXDRIdrawable *glxdraw;
 
GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
@@ -233,6 +234,10 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int 
first, int count, int lis
dpy = CC->currentDpy;
win = CC->currentDrawable;
 
+   glxdraw = GetGLXDRIDrawable(CC->currentDpy, CC->currentDrawable);
+   if (glxdraw)
+  win = glxdraw->xDrawable;
+
fs = XQueryFont(dpy, font);
if (!fs) {
   __glXSetError(CC, GL_INVALID_VALUE);

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


Mesa (master): ilo: clear writer pointer after unmapping

2014-10-13 Thread Chia-I Wu
Module: Mesa
Branch: master
Commit: 4e2cf84b1f5fd9f52dd1a12947a405a25d1e2137
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4e2cf84b1f5fd9f52dd1a12947a405a25d1e2137

Author: Chia-I Wu 
Date:   Tue Oct 14 08:29:16 2014 +0800

ilo: clear writer pointer after unmapping

It does not look like an issue now but it is good to be future proof.  Spotted
by Courtney Goeltzenleuchter.

Signed-off-by: Chia-I Wu 

---

 src/gallium/drivers/ilo/ilo_builder_decode.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/ilo/ilo_builder_decode.c 
b/src/gallium/drivers/ilo/ilo_builder_decode.c
index 470c1ae..922acc0 100644
--- a/src/gallium/drivers/ilo/ilo_builder_decode.c
+++ b/src/gallium/drivers/ilo/ilo_builder_decode.c
@@ -529,6 +529,7 @@ ilo_builder_writer_decode_items(struct ilo_builder *builder,
}
 
intel_bo_unmap(writer->bo);
+   writer->ptr = NULL;
 }
 
 static void

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


Mesa (master): vc4: Write the VPM read setup multiple times to queue all the inputs.

2014-10-13 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 615bbf0ca641d356d975f12a5491f2fd56549ed8
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=615bbf0ca641d356d975f12a5491f2fd56549ed8

Author: Eric Anholt 
Date:   Mon Oct 13 16:20:01 2014 +0100

vc4: Write the VPM read setup multiple times to queue all the inputs.

There's a 4-element fifo, and the size (number of dwords per vertex) field
is just 4 bits.

Fixes glsl-routing on sim.

---

 src/gallium/drivers/vc4/vc4_qpu_emit.c |   21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c 
b/src/gallium/drivers/vc4/vc4_qpu_emit.c
index 397e6f2..99e634e 100644
--- a/src/gallium/drivers/vc4/vc4_qpu_emit.c
+++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c
@@ -238,15 +238,30 @@ vc4_generate_code(struct vc4_context *vc4, struct 
vc4_compile *c)
 {
 struct qpu_reg *temp_registers = vc4_register_allocate(vc4, c);
 bool discard = false;
+uint32_t inputs_remaining = c->num_inputs;
+uint32_t vpm_read_fifo_count = 0;
+uint32_t vpm_read_offset = 0;
 
 make_empty_list(&c->qpu_inst_list);
 
 switch (c->stage) {
 case QSTAGE_VERT:
 case QSTAGE_COORD:
-queue(c, qpu_load_imm_ui(qpu_vrsetup(),
- (0x1a00 +
-  0x0010 * c->num_inputs)));
+/* There's a 4-entry FIFO for VPMVCD reads, each of which can
+ * load up to 16 dwords (4 vec4s) per vertex.
+ */
+while (inputs_remaining) {
+uint32_t num_entries = MIN2(inputs_remaining, 16);
+queue(c, qpu_load_imm_ui(qpu_vrsetup(),
+ vpm_read_offset |
+ 0x1a00 |
+ ((num_entries & 0xf) << 20)));
+inputs_remaining -= num_entries;
+vpm_read_offset += num_entries;
+vpm_read_fifo_count++;
+}
+assert(vpm_read_fifo_count <= 4);
+
 queue(c, qpu_load_imm_ui(qpu_vwsetup(), 0x1a00));
 break;
 case QSTAGE_FRAG:

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


Mesa (master): vc4: Improve the accuracy of SIN and COS.

2014-10-13 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 5bc91b6e322354d0964c07375c9a3a28b0083a38
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5bc91b6e322354d0964c07375c9a3a28b0083a38

Author: Eric Anholt 
Date:   Mon Oct 13 14:11:28 2014 +0100

vc4: Improve the accuracy of SIN and COS.

This gets them to pass glsl-sin/cos.  There was an obvious problem that I
was using the FRC code on the scaled input value, which means that we had
a range in [0, 1], while our taylor is most accurate across [-0.5, 0.5].
We can just slide things over, but that means flipping the sign of the
coefficients.  After that, it was just a matter of stuffing more
coefficients in.

---

 src/gallium/drivers/vc4/vc4_program.c |   28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c 
b/src/gallium/drivers/vc4/vc4_program.c
index 455b5d7..1bbdba5 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -766,10 +766,11 @@ tgsi_to_qir_sin(struct vc4_compile *c,
 enum qop op, struct qreg *src, int i)
 {
 float coeff[] = {
-2.0 * M_PI,
--pow(2.0 * M_PI, 3) / (3 * 2 * 1),
-pow(2.0 * M_PI, 5) / (5 * 4 * 3 * 2 * 1),
--pow(2.0 * M_PI, 7) / (7 * 6 * 5 * 4 * 3 * 2 * 1),
+-2.0 * M_PI,
+pow(2.0 * M_PI, 3) / (3 * 2 * 1),
+-pow(2.0 * M_PI, 5) / (5 * 4 * 3 * 2 * 1),
+pow(2.0 * M_PI, 7) / (7 * 6 * 5 * 4 * 3 * 2 * 1),
+-pow(2.0 * M_PI, 9) / (9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1),
 };
 
 struct qreg scaled_x =
@@ -777,8 +778,9 @@ tgsi_to_qir_sin(struct vc4_compile *c,
  src[0 * 4 + 0],
  qir_uniform_f(c, 1.0f / (M_PI * 2.0f)));
 
-
-struct qreg x = tgsi_to_qir_frc(c, NULL, 0, &scaled_x, 0);
+struct qreg x = qir_FADD(c,
+ tgsi_to_qir_frc(c, NULL, 0, &scaled_x, 0),
+ qir_uniform_f(c, -0.5));
 struct qreg x2 = qir_FMUL(c, x, x);
 struct qreg sum = qir_FMUL(c, x, qir_uniform_f(c, coeff[0]));
 for (int i = 1; i < ARRAY_SIZE(coeff); i++) {
@@ -799,16 +801,20 @@ tgsi_to_qir_cos(struct vc4_compile *c,
 enum qop op, struct qreg *src, int i)
 {
 float coeff[] = {
-1.0f,
--pow(2.0 * M_PI, 2) / (2 * 1),
-pow(2.0 * M_PI, 4) / (4 * 3 * 2 * 1),
--pow(2.0 * M_PI, 6) / (6 * 5 * 4 * 3 * 2 * 1),
+-1.0f,
+pow(2.0 * M_PI, 2) / (2 * 1),
+-pow(2.0 * M_PI, 4) / (4 * 3 * 2 * 1),
+pow(2.0 * M_PI, 6) / (6 * 5 * 4 * 3 * 2 * 1),
+-pow(2.0 * M_PI, 8) / (8 * 7 * 6 * 5 * 4 * 3 * 2 * 1),
+pow(2.0 * M_PI, 10) / (10 * 9 * 8 * 7 * 6 * 5 * 4 * 3 * 2 * 1),
 };
 
 struct qreg scaled_x =
 qir_FMUL(c, src[0 * 4 + 0],
  qir_uniform_f(c, 1.0f / (M_PI * 2.0f)));
-struct qreg x_frac = tgsi_to_qir_frc(c, NULL, 0, &scaled_x, 0);
+struct qreg x_frac = qir_FADD(c,
+  tgsi_to_qir_frc(c, NULL, 0, &scaled_x, 
0),
+  qir_uniform_f(c, -0.5));
 
 struct qreg sum = qir_uniform_f(c, coeff[0]);
 struct qreg x2 = qir_FMUL(c, x_frac, x_frac);

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


Mesa (master): vc4: Add support for the TXL opcode.

2014-10-13 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: e1d1c396265ce3b363e99422b46275275723ee21
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e1d1c396265ce3b363e99422b46275275723ee21

Author: Eric Anholt 
Date:   Mon Oct 13 14:38:10 2014 +0100

vc4: Add support for the TXL opcode.

There's a bit at the bottom of cube map stride (which has some formatting
bugs in the docs) which flips the bias coordinate to being an absolute
LOD.

---

 src/gallium/drivers/vc4/vc4_program.c |   20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_program.c 
b/src/gallium/drivers/vc4/vc4_program.c
index 1bbdba5..3056c67 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -528,6 +528,7 @@ tgsi_to_qir_tex(struct vc4_compile *c,
 struct qreg t = src[0 * 4 + 1];
 struct qreg r = src[0 * 4 + 2];
 uint32_t unit = tgsi_inst->Src[1].Register.Index;
+bool is_txl = tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXL;
 
 struct qreg proj = c->undef;
 if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXP) {
@@ -561,6 +562,13 @@ tgsi_to_qir_tex(struct vc4_compile *c,
 }
 
 if (tgsi_inst->Texture.Texture == TGSI_TEXTURE_CUBE ||
+tgsi_inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE ||
+is_txl) {
+texture_u[2] = add_uniform(c, QUNIFORM_TEXTURE_CONFIG_P2,
+   unit | (is_txl << 16));
+}
+
+if (tgsi_inst->Texture.Texture == TGSI_TEXTURE_CUBE ||
tgsi_inst->Texture.Texture == TGSI_TEXTURE_SHADOWCUBE) {
 struct qreg ma = qir_FMAXABS(c, qir_FMAXABS(c, s, t), r);
 struct qreg rcp_ma = qir_RCP(c, ma);
@@ -568,8 +576,6 @@ tgsi_to_qir_tex(struct vc4_compile *c,
 t = qir_FMUL(c, t, rcp_ma);
 r = qir_FMUL(c, r, rcp_ma);
 
-texture_u[2] = add_uniform(c, QUNIFORM_TEXTURE_CONFIG_P2, 
unit);
-
 qir_TEX_R(c, r, texture_u[next_texture_u++]);
 } else if (c->key->tex[unit].wrap_s == PIPE_TEX_WRAP_CLAMP_TO_BORDER ||
c->key->tex[unit].wrap_s == PIPE_TEX_WRAP_CLAMP ||
@@ -591,7 +597,8 @@ tgsi_to_qir_tex(struct vc4_compile *c,
 
 qir_TEX_T(c, t, texture_u[next_texture_u++]);
 
-if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXB)
+if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXB ||
+tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXL)
 qir_TEX_B(c, src[0 * 4 + 3], texture_u[next_texture_u++]);
 
 qir_TEX_S(c, s, texture_u[next_texture_u++]);
@@ -1175,6 +1182,7 @@ emit_tgsi_instruction(struct vc4_compile *c,
 case TGSI_OPCODE_TEX:
 case TGSI_OPCODE_TXP:
 case TGSI_OPCODE_TXB:
+case TGSI_OPCODE_TXL:
 tgsi_to_qir_tex(c, tgsi_inst,
 op_trans[tgsi_op].op, src_regs);
 return;
@@ -2163,15 +2171,17 @@ write_texture_p1(struct vc4_context *vc4,
 static void
 write_texture_p2(struct vc4_context *vc4,
  struct vc4_texture_stateobj *texstate,
- uint32_t unit)
+ uint32_t data)
 {
+uint32_t unit = data & 0x;
 struct pipe_sampler_view *texture = texstate->textures[unit];
 struct vc4_resource *rsc = vc4_resource(texture->texture);
 
 cl_u32(&vc4->uniforms,
VC4_SET_FIELD(VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE,
  VC4_TEX_P2_PTYPE) |
-   VC4_SET_FIELD(rsc->cube_map_stride >> 12, VC4_TEX_P2_CMST));
+   VC4_SET_FIELD(rsc->cube_map_stride >> 12, VC4_TEX_P2_CMST) |
+   VC4_SET_FIELD((data >> 16) & 1, VC4_TEX_P2_BSLOD));
 }
 
 

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


Mesa: tag mesa-10.3.1: Mesa 10.3.1 release

2014-10-13 Thread Emil Velikov
Module: Mesa
Branch: refs/tags/mesa-10.3.1
Tag:cf2f705dfd3a8da1d3f3edaaa7bf7b1aae6fb084
URL:
http://cgit.freedesktop.org/mesa/mesa/tag/?id=cf2f705dfd3a8da1d3f3edaaa7bf7b1aae6fb084

Tagger: Emil Velikov 
Date:   Mon Oct 13 00:22:02 2014 +0100

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


Mesa (master): i965: Issue performance warnings when copying the program cache BO.

2014-10-13 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 4c766c7959192b455ae752a7759ffc159e0524a6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c766c7959192b455ae752a7759ffc159e0524a6

Author: Kenneth Graunke 
Date:   Thu Aug 21 10:50:31 2014 -0700

i965: Issue performance warnings when copying the program cache BO.

We don't really want unnecessary buffer copying, so it'd be nice to know
when it's happening.

v2: Drop stall warnings when doing a read-only CPU mapping of the cache
BO.  The GPU also uses it in a read-only fashion, so there won't be
any stalls, even though the buffer is busy.  (Thanks to Chris Wilson
for catching this mistake.)

Signed-off-by: Kenneth Graunke 
Reviewed-by: Kristian Høgsberg  [v1]

---

 src/mesa/drivers/dri/i965/brw_state_cache.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c 
b/src/mesa/drivers/dri/i965/brw_state_cache.c
index 62e03b1..f4cae8f 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -241,6 +241,8 @@ brw_upload_item_data(struct brw_cache *cache,
 struct brw_cache_item *item,
 const void *data)
 {
+   struct brw_context *brw = cache->brw;
+
/* Allocate space in the cache BO for our new program. */
if (cache->next_offset + item->size > cache->bo->size) {
   uint32_t new_size = cache->bo->size * 2;
@@ -255,6 +257,7 @@ brw_upload_item_data(struct brw_cache *cache,
 * recreate it.
 */
if (cache->bo_used_by_gpu) {
+  perf_debug("Copying busy program cache buffer.\n");
   brw_cache_new_bo(cache, cache->bo->size);
}
 

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


Mesa (master): i965: Issue performance warnings on MapBufferRange stalls.

2014-10-13 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: a4fe727a5d77c6a20a4e6cceaad34c81cd49f0ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a4fe727a5d77c6a20a4e6cceaad34c81cd49f0ec

Author: Kenneth Graunke 
Date:   Thu Aug 21 10:42:05 2014 -0700

i965: Issue performance warnings on MapBufferRange stalls.

This is easy: we just need to use brw_map_bo instead of mapping it
directly.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Kristian Høgsberg 

---

 src/mesa/drivers/dri/i965/intel_buffer_objects.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c 
b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
index 0e19e46..82e0744 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -424,8 +424,8 @@ intel_bufferobj_map_range(struct gl_context * ctx,
   
intel_obj->map_extra[index],
   alignment);
   if (brw->has_llc) {
- drm_intel_bo_map(intel_obj->range_map_bo[index],
-  (access & GL_MAP_WRITE_BIT) != 0);
+ brw_bo_map(brw, intel_obj->range_map_bo[index],
+(access & GL_MAP_WRITE_BIT) != 0, "range-map");
   } else {
  drm_intel_gem_bo_map_gtt(intel_obj->range_map_bo[index]);
   }
@@ -441,7 +441,8 @@ intel_bufferobj_map_range(struct gl_context * ctx,
   drm_intel_gem_bo_map_gtt(intel_obj->buffer);
   intel_bufferobj_mark_inactive(intel_obj);
} else {
-  drm_intel_bo_map(intel_obj->buffer, (access & GL_MAP_WRITE_BIT) != 0);
+  brw_bo_map(brw, intel_obj->buffer, (access & GL_MAP_WRITE_BIT) != 0,
+ "MapBufferRange");
   intel_bufferobj_mark_inactive(intel_obj);
}
 

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


Mesa (master): vc4: Match VS outputs to FS inputs.

2014-10-13 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 5d72a1c95662109b1338605da83329dd25e00859
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d72a1c95662109b1338605da83329dd25e00859

Author: Eric Anholt 
Date:   Mon Oct 13 08:24:57 2014 +0100

vc4: Match VS outputs to FS inputs.

If the VS doesn't output a value that the FS needs, we still need to read
the right contents for the remaining FS inputs, by emitting padding.  And
if the VS outputs something the FS doesn't need, we shouldn't put it in
the VPM at all (so the code producing it can get DCEed).

Fixes 77 piglit tests.

---

 src/gallium/drivers/vc4/vc4_context.h |   10 +++
 src/gallium/drivers/vc4/vc4_program.c |  113 -
 src/gallium/drivers/vc4/vc4_qir.h |   30 -
 3 files changed, 135 insertions(+), 18 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_context.h 
b/src/gallium/drivers/vc4/vc4_context.h
index 31dec04..56cfc7b 100644
--- a/src/gallium/drivers/vc4/vc4_context.h
+++ b/src/gallium/drivers/vc4/vc4_context.h
@@ -83,6 +83,7 @@ struct vc4_uncompiled_shader {
 };
 
 struct vc4_compiled_shader {
+uint64_t program_id;
 struct vc4_bo *bo;
 
 struct vc4_shader_uniform_info uniforms;
@@ -91,6 +92,14 @@ struct vc4_compiled_shader {
 uint32_t color_inputs;
 
 uint8_t num_inputs;
+
+/**
+ * Array of the meanings of the VPM inputs this shader needs.
+ *
+ * It doesn't include those that aren't part of the VPM, like
+ * point/line coordinates.
+ */
+struct vc4_varying_semantic *input_semantics;
 };
 
 struct vc4_program_stateobj {
@@ -173,6 +182,7 @@ struct vc4_context {
 struct primconvert_context *primconvert;
 
 struct util_hash_table *fs_cache, *vs_cache;
+uint64_t next_compiled_program_id;
 
 struct ra_regs *regs;
 unsigned int reg_class_any;
diff --git a/src/gallium/drivers/vc4/vc4_program.c 
b/src/gallium/drivers/vc4/vc4_program.c
index b7c51a7..455b5d7 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -75,6 +75,13 @@ struct vc4_fs_key {
 
 struct vc4_vs_key {
 struct vc4_key base;
+
+/**
+ * This is a proxy for the array of FS input semantics, which is
+ * larger than we would want to put in the key.
+ */
+uint64_t compiled_fs_id;
+
 enum pipe_format attr_formats[8];
 bool is_coord;
 bool per_vertex_point_size;
@@ -948,13 +955,28 @@ emit_point_coord_input(struct vc4_compile *c, int attr)
 }
 
 static struct qreg
-emit_fragment_varying(struct vc4_compile *c, int index)
+emit_fragment_varying(struct vc4_compile *c, uint8_t semantic,
+  uint8_t index, uint8_t swizzle)
 {
+uint32_t i = c->num_input_semantics++;
 struct qreg vary = {
 QFILE_VARY,
-index
+i
 };
 
+if (c->num_input_semantics >= c->input_semantics_array_size) {
+c->input_semantics_array_size =
+MAX2(4, c->input_semantics_array_size * 2);
+
+c->input_semantics = reralloc(c, c->input_semantics,
+  struct vc4_varying_semantic,
+  c->input_semantics_array_size);
+}
+
+c->input_semantics[i].semantic = semantic;
+c->input_semantics[i].index = index;
+c->input_semantics[i].swizzle = swizzle;
+
 return qir_VARY_ADD_C(c, qir_FMUL(c, vary, qir_FRAG_W(c)));
 }
 
@@ -964,12 +986,11 @@ emit_fragment_input(struct vc4_compile *c, int attr,
 {
 for (int i = 0; i < 4; i++) {
 c->inputs[attr * 4 + i] =
-emit_fragment_varying(c, attr * 4 + i);
+emit_fragment_varying(c,
+  decl->Semantic.Name,
+  decl->Semantic.Index,
+  i);
 c->num_inputs++;
-
-if (decl->Semantic.Name == TGSI_SEMANTIC_COLOR ||
-decl->Semantic.Name == TGSI_SEMANTIC_BCOLOR)
-c->color_inputs |= 1 << i;
 }
 }
 
@@ -1027,10 +1048,26 @@ emit_tgsi_declaration(struct vc4_compile *c,
 }
 break;
 
-case TGSI_FILE_OUTPUT:
+case TGSI_FILE_OUTPUT: {
+uint32_t old_array_size = c->outputs_array_size;
 resize_qreg_array(c, &c->outputs, &c->outputs_array_size,
   (decl->Range.Last + 1) * 4);
 
+if (old_array_size != c->outputs_array_size) {
+c->output_semantics = reralloc(c,
+   c->output_semantics,
+   struct 
vc4_varying_semantic,
+

Mesa (master): configure: use $libdir/dri as default for VA-API

2014-10-13 Thread Christian König
Module: Mesa
Branch: master
Commit: d561a42bc1fb2d2bd090630d50ff4030aebd518e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d561a42bc1fb2d2bd090630d50ff4030aebd518e

Author: Christian König 
Date:   Thu Oct  9 19:51:48 2014 +0200

configure: use $libdir/dri as default for VA-API

Signed-off-by: Christian König 
Reviewed-by: Emil Velikov 
Reviewed-by: Ilia Mirkin 

---

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

diff --git a/configure.ac b/configure.ac
index bef5753..59b90e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1806,9 +1806,9 @@ dnl Directory for VA libs
 
 AC_ARG_WITH([va-libdir],
 [AS_HELP_STRING([--with-va-libdir=DIR],
-[directory for the VA libraries @<:@default=`pkg-config libva 
--variable=driverdir`@:>@])],
+[directory for the VA libraries @<:@${libdir}/dri@:>@])],
 [VA_LIB_INSTALL_DIR="$withval"],
-[VA_LIB_INSTALL_DIR=`pkg-config libva --variable=driverdir`])
+[VA_LIB_INSTALL_DIR="${libdir}/dri"])
 AC_SUBST([VA_LIB_INSTALL_DIR])
 
 dnl

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


Mesa (master): configure: Revert " ask vdpau.pc for the default location of the vdpau drivers"

2014-10-13 Thread Christian König
Module: Mesa
Branch: master
Commit: 5ce06d12ff83d84016f380323ea8d2fce380f4ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5ce06d12ff83d84016f380323ea8d2fce380f4ec

Author: Christian König 
Date:   Thu Oct  9 18:01:19 2014 +0200

configure: Revert "ask vdpau.pc for the default location of the vdpau drivers"

This reverts commit bbe6f7f865cd4316b5f885507ee0b128a20686eb.

Signed-off-by: Christian König 
Reviewed-by: Emil Velikov 
Reviewed-by: Ilia Mirkin 

---

 configure.ac |   11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 680dff4..bc589b7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1786,17 +1786,12 @@ if test "x$enable_gallium_tests" = xyes; then
 fi
 AM_CONDITIONAL(HAVE_GALLIUM_TESTS, test "x$enable_gallium_tests" = xyes)
 
-VDPAU_LIB_INSTALL_DIR_DEFAULT=''
-if test "x$enable_vdpau" = xyes; then
-VDPAU_LIB_INSTALL_DIR_DEFAULT=`$PKG_CONFIG --variable=moduledir vdpau`
-fi
-
 dnl Directory for VDPAU libs
 AC_ARG_WITH([vdpau-libdir],
 [AS_HELP_STRING([--with-vdpau-libdir=DIR],
-[directory for the VDPAU libraries @<:@default=`pkg-config 
--variable=moduledir vdpau`@:>@])],
+[directory for the VDPAU libraries @<:@default=${libdir}/vdpau@:>@])],
 [VDPAU_LIB_INSTALL_DIR="$withval"],
-[VDPAU_LIB_INSTALL_DIR="$VDPAU_LIB_INSTALL_DIR_DEFAULT"])
+[VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
 AC_SUBST([VDPAU_LIB_INSTALL_DIR])
 
 OMX_LIB_INSTALL_DIR_DEFAULT=''
@@ -1806,7 +1801,7 @@ fi
 
 AC_ARG_WITH([omx-libdir],
 [AS_HELP_STRING([--with-omx-libdir=DIR],
-[directory for the OMX libraries @<:@default=`pkg-config 
--variable=pluginsdir libomxil-bellagio`@:>@])],
+[directory for the OMX libraries])],
 [OMX_LIB_INSTALL_DIR="$withval"],
 [OMX_LIB_INSTALL_DIR="$OMX_LIB_INSTALL_DIR_DEFAULT"])
 AC_SUBST([OMX_LIB_INSTALL_DIR])

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


Mesa (master): configure: respect $libdir for the OMX installation dir

2014-10-13 Thread Christian König
Module: Mesa
Branch: master
Commit: d3004a267af1c2c408601665f41c2f7c5f699aa2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3004a267af1c2c408601665f41c2f7c5f699aa2

Author: Christian König 
Date:   Thu Oct  9 18:42:58 2014 +0200

configure: respect $libdir for the OMX installation dir

Signed-off-by: Christian König 
Reviewed-by: Emil Velikov 
Reviewed-by: Ilia Mirkin 

---

 configure.ac |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index bc589b7..c37018f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1794,16 +1794,13 @@ AC_ARG_WITH([vdpau-libdir],
 [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau'])
 AC_SUBST([VDPAU_LIB_INSTALL_DIR])
 
-OMX_LIB_INSTALL_DIR_DEFAULT=''
-if test "x$enable_omx" = xyes; then
-OMX_LIB_INSTALL_DIR_DEFAULT=`$PKG_CONFIG --variable=pluginsdir 
libomxil-bellagio`
-fi
+dnl Directory for OMX libs
 
 AC_ARG_WITH([omx-libdir],
 [AS_HELP_STRING([--with-omx-libdir=DIR],
 [directory for the OMX libraries])],
 [OMX_LIB_INSTALL_DIR="$withval"],
-[OMX_LIB_INSTALL_DIR="$OMX_LIB_INSTALL_DIR_DEFAULT"])
+[OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --define-variable=libdir=\$libdir 
--variable=pluginsdir libomxil-bellagio`])
 AC_SUBST([OMX_LIB_INSTALL_DIR])
 
 dnl Directory for VA libs

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


Mesa (master): configure: remove superflous VA-API line from configure.ac

2014-10-13 Thread Christian König
Module: Mesa
Branch: master
Commit: 966ae170b01f6bedc2fb58d0ed17a203cda2e515
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=966ae170b01f6bedc2fb58d0ed17a203cda2e515

Author: Christian König 
Date:   Thu Oct  9 18:03:02 2014 +0200

configure: remove superflous VA-API line from configure.ac

We don't have GALLIUM_STATE_TRACKERS_DIRS any more.

Signed-off-by: Christian König 
Reviewed-by: Emil Velikov 
Reviewed-by: Ilia Mirkin 

---

 configure.ac |1 -
 1 file changed, 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index c37018f..bef5753 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1438,7 +1438,6 @@ AM_CONDITIONAL(HAVE_ST_OMX, test "x$enable_omx" = xyes)
 if test "x$enable_va" = xyes; then
 PKG_CHECK_MODULES([VA], [libva >= 0.35.0 x11-xcb xcb-dri2 >= 
$XCBDRI2_REQUIRED],
   [VA_LIBS="`$PKG_CONFIG --libs x11-xcb xcb-dri2`"])
-GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS va"
 enable_gallium_loader=$enable_shared_pipe_drivers
 fi
 AM_CONDITIONAL(HAVE_ST_VA, test "x$enable_va" = xyes)

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


Mesa (master): vc4: Add support for the SSG opcode.

2014-10-13 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 926eaa9af464f2448b3840bb401c0b2efe43bb40
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=926eaa9af464f2448b3840bb401c0b2efe43bb40

Author: Eric Anholt 
Date:   Sun Oct 12 22:02:53 2014 +0100

vc4: Add support for the SSG opcode.

---

 src/gallium/drivers/vc4/vc4_program.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/drivers/vc4/vc4_program.c 
b/src/gallium/drivers/vc4/vc4_program.c
index 690f644..15da3ed 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -811,6 +811,17 @@ tgsi_to_qir_clamp(struct vc4_compile *c,
 src[1 * 4 + i]);
 }
 
+static struct qreg
+tgsi_to_qir_ssg(struct vc4_compile *c,
+struct tgsi_full_instruction *tgsi_inst,
+enum qop op, struct qreg *src, int i)
+{
+qir_SF(c, src[0 * 4 + i]);
+return qir_SEL_X_Y_NC(c,
+  qir_SEL_X_0_ZC(c, qir_uniform_f(c, 1.0)),
+  qir_uniform_f(c, -1.0));
+}
+
 static void
 emit_vertex_input(struct vc4_compile *c, int attr)
 {
@@ -1077,6 +1088,7 @@ emit_tgsi_instruction(struct vc4_compile *c,
 [TGSI_OPCODE_SIN] = { 0, tgsi_to_qir_sin },
 [TGSI_OPCODE_COS] = { 0, tgsi_to_qir_cos },
 [TGSI_OPCODE_CLAMP] = { 0, tgsi_to_qir_clamp },
+[TGSI_OPCODE_SSG] = { 0, tgsi_to_qir_ssg },
 };
 static int asdf = 0;
 uint32_t tgsi_op = tgsi_inst->Instruction.Opcode;

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


Mesa (master): vc4: Add support for the CEIL opcode.

2014-10-13 Thread Eric Anholt
Module: Mesa
Branch: master
Commit: 83365a5b57b6ab966329bceb858d41d6159d7f3d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83365a5b57b6ab966329bceb858d41d6159d7f3d

Author: Eric Anholt 
Date:   Mon Oct 13 08:05:35 2014 +0100

vc4: Add support for the CEIL opcode.

Not as big of a deal as SSG, but still +9 piglit tests.

---

 src/gallium/drivers/vc4/vc4_program.c |   22 ++
 1 file changed, 22 insertions(+)

diff --git a/src/gallium/drivers/vc4/vc4_program.c 
b/src/gallium/drivers/vc4/vc4_program.c
index 15da3ed..b7c51a7 100644
--- a/src/gallium/drivers/vc4/vc4_program.c
+++ b/src/gallium/drivers/vc4/vc4_program.c
@@ -722,6 +722,27 @@ tgsi_to_qir_flr(struct vc4_compile *c,
   trunc);
 }
 
+/**
+ * Computes ceil(x), which is tricky because our FTOI truncates (rounds to
+ * zero).
+ */
+static struct qreg
+tgsi_to_qir_ceil(struct vc4_compile *c,
+ struct tgsi_full_instruction *tgsi_inst,
+ enum qop op, struct qreg *src, int i)
+{
+struct qreg trunc = qir_ITOF(c, qir_FTOI(c, src[0 * 4 + i]));
+
+/* This will be < 0 if we truncated and the truncation was of a value
+ * that was > 0 in the first place.
+ */
+qir_SF(c, qir_FSUB(c, trunc, src[0 * 4 + i]));
+
+return qir_SEL_X_Y_NS(c,
+  qir_FADD(c, trunc, qir_uniform_f(c, 1.0)),
+  trunc);
+}
+
 static struct qreg
 tgsi_to_qir_abs(struct vc4_compile *c,
 struct tgsi_full_instruction *tgsi_inst,
@@ -1083,6 +1104,7 @@ emit_tgsi_instruction(struct vc4_compile *c,
 [TGSI_OPCODE_LG2] = { QOP_LOG2, tgsi_to_qir_scalar },
 [TGSI_OPCODE_LRP] = { 0, tgsi_to_qir_lrp },
 [TGSI_OPCODE_TRUNC] = { 0, tgsi_to_qir_trunc },
+[TGSI_OPCODE_CEIL] = { 0, tgsi_to_qir_ceil },
 [TGSI_OPCODE_FRC] = { 0, tgsi_to_qir_frc },
 [TGSI_OPCODE_FLR] = { 0, tgsi_to_qir_flr },
 [TGSI_OPCODE_SIN] = { 0, tgsi_to_qir_sin },

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