Mesa (master): st/mesa: get max supported number of image samples from driver

2016-07-01 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 6f4d35212b9566125cee4c2b749f8baa2a6fc031
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f4d35212b9566125cee4c2b749f8baa2a6fc031

Author: Ilia Mirkin 
Date:   Wed Jun 29 00:11:57 2016 -0400

st/mesa: get max supported number of image samples from driver

Signed-off-by: Ilia Mirkin 
Reviewed-by: Marek Olšák 

---

 src/mesa/state_tracker/st_extensions.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index 412f598..c5ecd5a 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -443,7 +443,6 @@ void st_init_limits(struct pipe_screen *screen,
  c->Program[MESA_SHADER_COMPUTE].MaxImageUniforms;
c->MaxCombinedShaderOutputResources += c->MaxCombinedImageUniforms;
c->MaxImageUnits = MAX_IMAGE_UNITS;
-   c->MaxImageSamples = 0; /* XXX */
if (c->MaxCombinedImageUniforms) {
   extensions->ARB_shader_image_load_store = GL_TRUE;
   extensions->ARB_shader_image_size = GL_TRUE;
@@ -988,6 +987,11 @@ void st_init_extensions(struct pipe_screen *screen,
  color_formats, 16,
  PIPE_BIND_RENDER_TARGET);
 
+  consts->MaxImageSamples =
+ get_max_samples_for_formats(screen, ARRAY_SIZE(color_formats),
+ color_formats, 16,
+ PIPE_BIND_SHADER_IMAGE);
+
   consts->MaxColorTextureSamples =
  get_max_samples_for_formats(screen, ARRAY_SIZE(color_formats),
  color_formats, consts->MaxSamples,

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


Mesa (master): nvc0: fix up image support for allowing multiple samples

2016-07-01 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: b2b5075e04bbe6c6462fd01711524abd80380f45
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b2b5075e04bbe6c6462fd01711524abd80380f45

Author: Ilia Mirkin 
Date:   Wed Jun 29 00:08:01 2016 -0400

nvc0: fix up image support for allowing multiple samples

Basically we just have to scale up the coordinates and then add the
relevant sample offset. The code to handle this was already largely
present from Christoph's earlier attempts to pipe images through back in
the dark ages, this just hooks it all up.

Signed-off-by: Ilia Mirkin 

---

 .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp  |  3 +
 .../nouveau/codegen/nv50_ir_lowering_nvc0.cpp  | 80 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_compute.c| 24 +++
 src/gallium/drivers/nouveau/nvc0/nvc0_context.h|  2 +-
 src/gallium/drivers/nouveau/nvc0/nvc0_program.c| 20 +++---
 src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 20 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_tex.c|  8 +--
 7 files changed, 108 insertions(+), 49 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index ed3249e..41dc18f 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -2388,6 +2388,9 @@ Converter::getImageCoords(std::vector , 
int r, int s)
 
for (int c = 0; c < arg; ++c)
   coords.push_back(fetchSrc(s, c));
+
+   if (t.isMS())
+  coords.push_back(fetchSrc(s, 3));
 }
 
 // For raw loads, granularity is 4 byte.
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
index 67bd73b..0558ae0 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp
@@ -1569,44 +1569,51 @@ static inline uint16_t getSuClampSubOp(const 
TexInstruction *su, int c)
 bool
 NVC0LoweringPass::handleSUQ(TexInstruction *suq)
 {
+   int mask = suq->tex.mask;
int dim = suq->tex.target.getDim();
int arg = dim + (suq->tex.target.isArray() || suq->tex.target.isCube());
-   uint8_t s = prog->driver->io.auxCBSlot;
Value *ind = suq->getIndirectR();
uint32_t base;
-   int c;
-
-   base = prog->driver->io.suInfoBase + suq->tex.r * NVE4_SU_INFO__STRIDE;
+   int c, d;
 
-   if (ind)
-  ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getScratch(),
+   if (ind) {
+  ind = bld.mkOp2v(OP_ADD, TYPE_U32, bld.getSSA(),
+   ind, bld.mkImm(suq->tex.r));
+  ind = bld.mkOp2v(OP_AND, TYPE_U32, bld.getSSA(),
+   ind, bld.mkImm(7));
+  ind = bld.mkOp2v(OP_SHL, TYPE_U32, bld.getSSA(),
ind, bld.mkImm(6));
+  base = 0;
+   } else {
+  base = suq->tex.r * NVE4_SU_INFO__STRIDE;
+   }
 
-   for (c = 0; c < arg; ++c) {
-  if (suq->defExists(c)) {
- int offset;
+   for (c = 0, d = 0; c < 3; ++c, mask >>= 1) {
+  if (c >= arg || !(mask & 1))
+ continue;
 
- if (c == 1 && suq->tex.target == TEX_TARGET_1D_ARRAY) {
-offset = base + NVE4_SU_INFO_SIZE(2);
- } else {
-offset = base + NVE4_SU_INFO_SIZE(c);
- }
- bld.mkLoad(TYPE_U32, suq->getDef(c),
-bld.mkSymbol(FILE_MEMORY_CONST, s, TYPE_U32, offset), ind);
-  }
-   }
+  int offset;
 
-   if (suq->tex.target.isCube()) {
-  if (suq->defExists(2)) {
- bld.mkOp2(OP_DIV, TYPE_U32, suq->getDef(2), suq->getDef(2),
-   bld.loadImm(NULL, 6));
+  if (c == 1 && suq->tex.target == TEX_TARGET_1D_ARRAY) {
+ offset = NVE4_SU_INFO_SIZE(2);
+  } else {
+ offset = NVE4_SU_INFO_SIZE(c);
   }
+  bld.mkMov(suq->getDef(d++), loadSuInfo32(ind, base + offset));
+  if (c == 2 && suq->tex.target.isCube())
+ bld.mkOp2(OP_DIV, TYPE_U32, suq->getDef(d - 1), suq->getDef(d - 1),
+   bld.loadImm(NULL, 6));
}
 
-   if (suq->defExists(3)) {
-  // .w contains the number of samples for multi-sampled images but we
-  // don't support them for now.
-  bld.mkMov(suq->getDef(3), bld.loadImm(NULL, 1));
+   if (mask & 1) {
+  if (suq->tex.target.isMS()) {
+ Value *ms_x = loadSuInfo32(ind, base + NVE4_SU_INFO_MS(0));
+ Value *ms_y = loadSuInfo32(ind, base + NVE4_SU_INFO_MS(1));
+ Value *ms = bld.mkOp2v(OP_ADD, TYPE_U32, bld.getScratch(), ms_x, 
ms_y);
+ bld.mkOp2(OP_SHL, TYPE_U32, suq->getDef(d++), bld.loadImm(NULL, 1), 
ms);
+  } else {
+ bld.mkMov(suq->getDef(d++), bld.loadImm(NULL, 1));
+  }
}
 
bld.remove(suq);
@@ -1616,7 +1623,7 @@ NVC0LoweringPass::handleSUQ(TexInstruction *suq)
 void
 NVC0LoweringPass::adjustCoordinatesMS(TexInstruction *tex)
 {
-   const uint16_t base = tex->tex.r * 

Mesa (master): st/mesa: check the texture image level in st_texture_match_image

2016-07-01 Thread Nicolai Hähnle
Module: Mesa
Branch: master
Commit: 07cc838b105dd3f34526db73064f1f21b452240e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=07cc838b105dd3f34526db73064f1f21b452240e

Author: Nicolai Hähnle 
Date:   Fri Jun 24 17:54:51 2016 +0200

st/mesa: check the texture image level in st_texture_match_image

Otherwise, 1x1 images of arbitrarily high level are accepted.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96639#add_comment
Cc: 11.2 12.0 
Reviewed-by: Ilia Mirkin 

---

 src/mesa/state_tracker/st_texture.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/state_tracker/st_texture.c 
b/src/mesa/state_tracker/st_texture.c
index 52b0943..42616ca 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -226,6 +226,9 @@ st_texture_match_image(struct st_context *st,
ptLayers != pt->array_size)
   return GL_FALSE;
 
+   if (image->Level > pt->last_level)
+  return GL_FALSE;
+
return GL_TRUE;
 }
 

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


Mesa (master): st/mesa: an incomplete texture may have a zero-size first image

2016-07-01 Thread Nicolai Hähnle
Module: Mesa
Branch: master
Commit: 0ba053b34c29106817568996ac53b41029cf4e4c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ba053b34c29106817568996ac53b41029cf4e4c

Author: Nicolai Hähnle 
Date:   Fri Jun 24 16:35:36 2016 +0200

st/mesa: an incomplete texture may have a zero-size first image

Fixes a regression introduced by commit 42624ea83 which triggered
an assertion in
dEQP-GLES2.functional.texture.completeness.cube.not_positive_level_0

While stImage must have a non-zero size as verified by the caller, we also
look at the size of the base image in an attempt to make a better guess at
the level0 size (this is important when the base image size is odd). However,
the base image may have a zero size even when it exists.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96629
Cc: 12.0 
Reviewed-by: Ilia Mirkin 

---

 src/mesa/state_tracker/st_cb_texture.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/state_tracker/st_cb_texture.c 
b/src/mesa/state_tracker/st_cb_texture.c
index 088ac9e..1474d97 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -472,6 +472,9 @@ guess_and_alloc_texture(struct st_context *st,
 */
firstImage = _mesa_base_tex_image(>base);
if (firstImage &&
+   firstImage->Width2 > 0 &&
+   firstImage->Height2 > 0 &&
+   firstImage->Depth2 > 0 &&
guess_base_level_size(stObj->base.Target,
  firstImage->Width2,
  firstImage->Height2,

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


Mesa (master): st/vdpau: use bicubic filter for scaling(v6.1)

2016-07-01 Thread Christian König
Module: Mesa
Branch: master
Commit: de772bc060fb401e30cfbfa4ae3973fb025865e5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=de772bc060fb401e30cfbfa4ae3973fb025865e5

Author: Nayan Deshmukh 
Date:   Wed Jun 29 19:12:01 2016 +0530

st/vdpau: use bicubic filter for scaling(v6.1)

use bicubic filtering as high quality scaling L1.

v2: fix a typo and add a newline to code
v3: -render the unscaled image on a temporary surface (Christian)
-apply noise reduction and sharpness filter on
 unscaled surface
-render the final scaled surface using bicubic
 interpolation
v4: support high quality scaling
v5: set dst_area and dst_clip in bicubic filter
v6: set buffer layer before setting dst_area
v6.1: add PIPE_BIND_LINEAR when creating resource

Signed-off-by: Nayan Deshmukh 
Reviewed-by: Christian König 

---

 src/gallium/state_trackers/vdpau/mixer.c | 113 ---
 src/gallium/state_trackers/vdpau/query.c |   1 +
 src/gallium/state_trackers/vdpau/vdpau_private.h |   6 ++
 3 files changed, 106 insertions(+), 14 deletions(-)

diff --git a/src/gallium/state_trackers/vdpau/mixer.c 
b/src/gallium/state_trackers/vdpau/mixer.c
index 65c3ce2..cb0ef03 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -82,7 +82,6 @@ vlVdpVideoMixerCreate(VdpDevice device,
   switch (features[i]) {
   /* they are valid, but we doesn't support them */
   case VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL:
-  case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1:
   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L2:
   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L3:
   case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L4:
@@ -110,6 +109,9 @@ vlVdpVideoMixerCreate(VdpDevice device,
  vmixer->luma_key.supported = true;
  break;
 
+  case VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1:
+ vmixer->bicubic.supported = true;
+ break;
   default: goto no_params;
   }
}
@@ -202,6 +204,11 @@ vlVdpVideoMixerDestroy(VdpVideoMixer mixer)
   vl_matrix_filter_cleanup(vmixer->sharpness.filter);
   FREE(vmixer->sharpness.filter);
}
+
+   if (vmixer->bicubic.filter) {
+  vl_bicubic_filter_cleanup(vmixer->bicubic.filter);
+  FREE(vmixer->bicubic.filter);
+   }
pipe_mutex_unlock(vmixer->device->mutex);
DeviceReference(>device, NULL);
 
@@ -230,9 +237,11 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
 VdpLayer const *layers)
 {
enum vl_compositor_deinterlace deinterlace;
-   struct u_rect rect, clip, *prect;
+   struct u_rect rect, clip, *prect, dirty_area;
unsigned i, layer = 0;
struct pipe_video_buffer *video_buffer;
+   struct pipe_sampler_view *sampler_view;
+   struct pipe_surface *surface;
 
vlVdpVideoMixer *vmixer;
vlVdpSurface *surf;
@@ -325,7 +334,44 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
   prect = 
}
vl_compositor_set_buffer_layer(>cstate, compositor, layer, 
video_buffer, prect, NULL, deinterlace);
-   vl_compositor_set_layer_dst_area(>cstate, layer++, 
RectToPipe(destination_video_rect, ));
+
+   if(vmixer->bicubic.filter) {
+  struct pipe_context *pipe;
+  struct pipe_resource res_tmpl, *res;
+  struct pipe_sampler_view sv_templ;
+  struct pipe_surface surf_templ;
+
+  pipe = vmixer->device->context;
+  memset(_tmpl, 0, sizeof(res_tmpl));
+
+  res_tmpl.target = PIPE_TEXTURE_2D;
+  res_tmpl.width0 = surf->templat.width;
+  res_tmpl.height0 = surf->templat.height;
+  res_tmpl.format = dst->sampler_view->format;
+  res_tmpl.depth0 = 1;
+  res_tmpl.array_size = 1;
+  res_tmpl.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET |
+  PIPE_BIND_LINEAR;
+  res_tmpl.usage = PIPE_USAGE_DEFAULT;
+
+  res = pipe->screen->resource_create(pipe->screen, _tmpl);
+
+  vlVdpDefaultSamplerViewTemplate(_templ, res);
+  sampler_view = pipe->create_sampler_view(pipe, res, _templ);
+
+  memset(_templ, 0, sizeof(surf_templ));
+  surf_templ.format = res->format;
+  surface = pipe->create_surface(pipe, res, _templ);
+
+  vl_compositor_reset_dirty_area(_area);
+  pipe_resource_reference(, NULL);
+   } else {
+  surface = dst->surface;
+  sampler_view = dst->sampler_view;
+  dirty_area = dst->dirty_area;
+  vl_compositor_set_layer_dst_area(>cstate, layer++, 
RectToPipe(destination_video_rect, ));
+  vl_compositor_set_dst_clip(>cstate, RectToPipe(destination_rect, 
));
+   }
 
for (i = 0; i < layer_count; ++i) {
   vlVdpOutputSurface *src = vlGetDataHTAB(layers->source_surface);
@@ -343,22 +389,29 @@ VdpStatus vlVdpVideoMixerRender(VdpVideoMixer mixer,
   ++layers;
}
 
-   vl_compositor_set_dst_clip(>cstate, RectToPipe(destination_rect, 
));
- 

Mesa (master): vl: add a bicubic interpolation filter(v5)

2016-07-01 Thread Christian König
Module: Mesa
Branch: master
Commit: 872dd9ad154b0ef9c91486640f73232a60074292
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=872dd9ad154b0ef9c91486640f73232a60074292

Author: Nayan Deshmukh 
Date:   Wed Jun 29 19:12:00 2016 +0530

vl: add a bicubic interpolation filter(v5)

This is a shader based bicubic interpolater which uses cubic
Hermite spline algorithm.

v2: set dst_area and dst_clip during scaling (Christian)
v3: clear the render target before rendering
v4: intialize offsets while initializing shaders
use a constant buffer to send dst_size to frag shader
small changes to reduce calculation in shader
v5: send half pixel offset instead of sending dst_size

Signed-off-by: Nayan Deshmukh 
Reviewed-by: Christian König 

---

 src/gallium/auxiliary/Makefile.sources   |   2 +
 src/gallium/auxiliary/vl/vl_bicubic_filter.c | 463 +++
 src/gallium/auxiliary/vl/vl_bicubic_filter.h |  63 
 3 files changed, 528 insertions(+)

diff --git a/src/gallium/auxiliary/Makefile.sources 
b/src/gallium/auxiliary/Makefile.sources
index ab58358..e0311bf 100644
--- a/src/gallium/auxiliary/Makefile.sources
+++ b/src/gallium/auxiliary/Makefile.sources
@@ -317,6 +317,8 @@ NIR_SOURCES := \
nir/tgsi_to_nir.h
 
 VL_SOURCES := \
+   vl/vl_bicubic_filter.c \
+   vl/vl_bicubic_filter.h \
vl/vl_compositor.c \
vl/vl_compositor.h \
vl/vl_csc.c \
diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c 
b/src/gallium/auxiliary/vl/vl_bicubic_filter.c
new file mode 100644
index 000..ca9f882
--- /dev/null
+++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c
@@ -0,0 +1,463 @@
+/**
+ *
+ * Copyright 2016 Nayan Deshmukh.
+ * All Rights Reserved.
+ *
+ * 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, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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 "pipe/p_context.h"
+
+#include "tgsi/tgsi_ureg.h"
+
+#include "util/u_draw.h"
+#include "util/u_memory.h"
+#include "util/u_math.h"
+#include "util/u_rect.h"
+
+#include "vl_types.h"
+#include "vl_vertex_buffers.h"
+#include "vl_bicubic_filter.h"
+
+enum VS_OUTPUT
+{
+   VS_O_VPOS = 0,
+   VS_O_VTEX = 0
+};
+
+static void *
+create_vert_shader(struct vl_bicubic_filter *filter)
+{
+   struct ureg_program *shader;
+   struct ureg_src i_vpos;
+   struct ureg_dst o_vpos, o_vtex;
+
+   shader = ureg_create(PIPE_SHADER_VERTEX);
+   if (!shader)
+  return NULL;
+
+   i_vpos = ureg_DECL_vs_input(shader, 0);
+   o_vpos = ureg_DECL_output(shader, TGSI_SEMANTIC_POSITION, VS_O_VPOS);
+   o_vtex = ureg_DECL_output(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTEX);
+
+   ureg_MOV(shader, o_vpos, i_vpos);
+   ureg_MOV(shader, o_vtex, i_vpos);
+
+   ureg_END(shader);
+
+   return ureg_create_shader_and_destroy(shader, filter->pipe);
+}
+
+static void
+create_frag_shader_cubic_interpolater(struct ureg_program *shader, struct 
ureg_src tex_a,
+  struct ureg_src tex_b, struct ureg_src 
tex_c,
+  struct ureg_src tex_d, struct ureg_src t,
+  struct ureg_dst o_fragment)
+{
+   struct ureg_dst temp[11];
+   struct ureg_dst t_2;
+   unsigned i;
+
+   for(i = 0; i < 11; ++i)
+   temp[i] = ureg_DECL_temporary(shader);
+   t_2 = ureg_DECL_temporary(shader);
+
+   /*
+* |temp[0]|   |  0  2  0  0 |  |tex_a|
+* |temp[1]| = | -1  0  1  0 |* |tex_b|
+* |temp[2]|   |  2 -5  4 -1 |  |tex_c|
+* |temp[3]|   | -1  3 -3  1 |  |tex_d|
+*/
+   ureg_MUL(shader, temp[0], tex_b, ureg_imm1f(shader, 2.0f));
+
+   ureg_MUL(shader, temp[1], tex_a, ureg_imm1f(shader, -1.0f));
+   ureg_MAD(shader, temp[1], tex_c, ureg_imm1f(shader, 1.0f),
+ureg_src(temp[1]));
+

Mesa (master): mesa/st: Use 'struct nir_shader' instead of 'nir_shader'.

2016-07-01 Thread Vinson Lee
Module: Mesa
Branch: master
Commit: 3fea592c4eb26f6652bef1e5dc430e2296e14bac
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3fea592c4eb26f6652bef1e5dc430e2296e14bac

Author: Vinson Lee 
Date:   Wed Jun 29 20:15:03 2016 -0700

mesa/st: Use 'struct nir_shader' instead of 'nir_shader'.

Fix this build error with GCC 4.4.

  CC state_tracker/st_nir_lower_builtin.lo
In file included from state_tracker/st_nir_lower_builtin.c:61:
state_tracker/st_nir.h:34: error: redefinition of typedef ‘nir_shader’
../../src/compiler/nir/nir.h:1830: note: previous declaration of ‘nir_shader’ 
was here

Suggested-by: Rob Clark 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96235
Signed-off-by: Vinson Lee 
Reviewed-by: Jason Ekstrand 
Reviewed-by: Rob Clark 

---

 src/mesa/state_tracker/st_nir.h | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/mesa/state_tracker/st_nir.h b/src/mesa/state_tracker/st_nir.h
index 19e2d2d..523a274 100644
--- a/src/mesa/state_tracker/st_nir.h
+++ b/src/mesa/state_tracker/st_nir.h
@@ -31,14 +31,14 @@
 extern "C" {
 #endif
 
-typedef struct nir_shader nir_shader;
+struct nir_shader;
 
-void st_nir_lower_builtin(nir_shader *shader);
-nir_shader * st_glsl_to_nir(struct st_context *st, struct gl_program *prog,
-struct gl_shader_program *shader_program,
-gl_shader_stage stage);
+void st_nir_lower_builtin(struct nir_shader *shader);
+struct nir_shader * st_glsl_to_nir(struct st_context *st, struct gl_program 
*prog,
+   struct gl_shader_program *shader_program,
+   gl_shader_stage stage);
 
-void st_finalize_nir(struct st_context *st, struct gl_program *prog, 
nir_shader *nir);
+void st_finalize_nir(struct st_context *st, struct gl_program *prog, struct 
nir_shader *nir);
 
 struct gl_program *
 st_nir_get_mesa_program(struct gl_context *ctx,

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


Mesa (master): docs: update MESA_DEBUG envvar documentation.

2016-07-01 Thread Alejandro Pinheiro
Module: Mesa
Branch: master
Commit: a97ee60926f6c08cb4cdd26a2746c483d8782547
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a97ee60926f6c08cb4cdd26a2746c483d8782547

Author: Alejandro Piñeiro 
Date:   Mon Jun 27 10:00:58 2016 +0200

docs: update MESA_DEBUG envvar documentation.

silent, flush, incomplete_tex and incomplete_fbo flags were not
documented (see src/mesa/main.debug.c for more info).

FP is not checked anymore.

v2 (Brian Paul):
 * MESA_DEBUG accepts a comma-separated list of parameters.
 * Clarify how MESA_DEBUG behaves with mesa debug and release builds.
 * Updated wording.

v3: Better wording for one paragraph (Brian Paul)

Reviewed-by: Brian Paul 

---

 docs/envvars.html | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/docs/envvars.html b/docs/envvars.html
index 2d9a289..6d79398 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -50,8 +50,17 @@ sometimes be useful for debugging end-user issues.
if the application generates a GL_INVALID_ENUM error, a corresponding error
message indicating where the error occurred, and possibly why, will be
printed to stderr.
-   If the value of MESA_DEBUG is 'FP' floating point arithmetic errors will
-   generate exceptions.
+
+   For release builds, MESA_DEBUG defaults to off (no debug output).
+
+   MESA_DEBUG accepts the following comma-separated list of named
+   flags, which adds extra behaviour to just set MESA_DEBUG=1:
+   
+ silent - turn off debug messages. Only useful for debug builds.
+ flush - flush after each drawing command
+ incomplete_tex - extra debug messages when a texture is 
incomplete
+ incomplete_fbo - extra debug messages when a fbo is incomplete
+   
 MESA_LOG_FILE - specifies a file name for logging all errors, warnings,
 etc., rather than stderr
 MESA_TEX_PROG - if set, implement conventional texture env modes with

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


Mesa (master): i965: intel_texture_barrier reimplemented

2016-07-01 Thread Alejandro Pinheiro
Module: Mesa
Branch: master
Commit: 5e553a6bb31cc205e43bde48a19399284ce3d5e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5e553a6bb31cc205e43bde48a19399284ce3d5e1

Author: Alejandro Piñeiro 
Date:   Tue Jun 28 13:16:33 2016 +0200

i965: intel_texture_barrier reimplemented

Fixes:
GL44-CTS.texture_barrier_ARB.same-texel-rw-multipass

On Haswell, Broadwell and Skylake (note that in order to execute that
test, it is needed to override GL and GLSL versions).

On gen6 this test was already working without this change. It keeps
working after it.

This commit replaces the call to brw_emit_mi_flush for gen6+ with two
calls to brw_emit_pipe_control_flush:

 * The first one with RENDER_TARGET_FLUSH and CS_STALL set to initiate
   a render cache flush after any concurrent rendering completes and
   cause the CS to stop parsing commands until the render cache
   becomes coherent with memory.

 * The second one have TEXTURE_CACHE_INVALIDATE set (and no CS stall)
   to clean up any stale data from the sampler caches before rendering
   continues.

Didn't touch gen4-5, basically because I don't have a way to test
them.

More info on commits:
0aa4f99f562a05880a779707cbcd46be459863bf
72473658c51d5e074ce219c1e6385a4cce29f467

Thanks to Curro to help to tracking this down, as the root case was a
hw race condition.

v2: use two calls to pipe_control_flush instead of a combination of
gen7_emit_cs_stall_flush and brw_emit_mi_flush calls (Curro)
v3: no need to const cache invalidation (Curro)

Reviewed-by: Francisco Jerez 

---

 src/mesa/drivers/dri/i965/intel_tex.c | 21 -
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex.c 
b/src/mesa/drivers/dri/i965/intel_tex.c
index cac33ac..a802d5a 100644
--- a/src/mesa/drivers/dri/i965/intel_tex.c
+++ b/src/mesa/drivers/dri/i965/intel_tex.c
@@ -9,6 +9,7 @@
 #include "intel_mipmap_tree.h"
 #include "intel_tex.h"
 #include "intel_fbo.h"
+#include "intel_reg.h"
 
 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
 
@@ -362,7 +363,25 @@ intel_texture_barrier(struct gl_context *ctx)
 {
struct brw_context *brw = brw_context(ctx);
 
-   brw_emit_mi_flush(brw);
+   if (brw->gen >= 6) {
+  if (brw->gen == 6) {
+ /* [Dev-SNB{W/A}]: Before a PIPE_CONTROL with Write Cache
+  * Flush Enable = 1, a PIPE_CONTROL with any non-zero
+  * post-sync-op is required.
+  */
+ brw_emit_post_sync_nonzero_flush(brw);
+  }
+
+  brw_emit_pipe_control_flush(brw,
+  PIPE_CONTROL_DEPTH_CACHE_FLUSH |
+  PIPE_CONTROL_RENDER_TARGET_FLUSH |
+  PIPE_CONTROL_CS_STALL);
+
+  brw_emit_pipe_control_flush(brw,
+  PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE);
+   } else {
+  brw_emit_mi_flush(brw);
+   }
 }
 
 void

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