[Mesa-dev] [PATCH 2/2] nv30: fix clip plane uploads and enable changes

2015-05-23 Thread Ilia Mirkin
nv30_validate_clip depends on the rasterizer state. Also we should
upload all the new clip planes on change since next time the plane data
won't have changed, but the enables might.

Signed-off-by: Ilia Mirkin 
---
 src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c 
b/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
index 86ac4f7..a954dcc 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
@@ -272,15 +272,13 @@ nv30_validate_clip(struct nv30_context *nv30)
uint32_t clpd_enable = 0;
 
for (i = 0; i < 6; i++) {
-  if (nv30->rast->pipe.clip_plane_enable & (1 << i)) {
- if (nv30->dirty & NV30_NEW_CLIP) {
-BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
-PUSH_DATA (push, i);
-PUSH_DATAp(push, nv30->clip.ucp[i], 4);
- }
-
- clpd_enable |= 1 << (1 + 4*i);
+  if (nv30->dirty & NV30_NEW_CLIP) {
+ BEGIN_NV04(push, NV30_3D(VP_UPLOAD_CONST_ID), 5);
+ PUSH_DATA (push, i);
+ PUSH_DATAp(push, nv30->clip.ucp[i], 4);
   }
+  if (nv30->rast->pipe.clip_plane_enable & (1 << i))
+ clpd_enable |= 2 << (4*i);
}
 
BEGIN_NV04(push, NV30_3D(VP_CLIP_PLANES_ENABLE), 1);
@@ -389,7 +387,7 @@ static struct state_validate hwtnl_validate_list[] = {
 { nv30_validate_stipple,   NV30_NEW_STIPPLE },
 { nv30_validate_scissor,   NV30_NEW_SCISSOR | NV30_NEW_RASTERIZER },
 { nv30_validate_viewport,  NV30_NEW_VIEWPORT },
-{ nv30_validate_clip,  NV30_NEW_CLIP },
+{ nv30_validate_clip,  NV30_NEW_CLIP | NV30_NEW_RASTERIZER },
 { nv30_fragprog_validate,  NV30_NEW_FRAGPROG | NV30_NEW_FRAGCONST },
 { nv30_vertprog_validate,  NV30_NEW_VERTPROG | NV30_NEW_VERTCONST |
NV30_NEW_FRAGPROG | NV30_NEW_RASTERIZER },
-- 
2.3.6

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


[Mesa-dev] [PATCH 1/2] nv30: avoid doing extra work on clear and hitting unexpected states

2015-05-23 Thread Ilia Mirkin
Clearing can happen at a time when various state objects are incoherent
and not ready for a draw. Some of the validation functions don't handle
this well, so only flush the framebuffer state. This has the advantage
of also not doing extra work.

This works around some crashes that can happen when clearing.

Signed-off-by: Ilia Mirkin 
---
 src/gallium/drivers/nouveau/nv30/nv30_clear.c  |  2 +-
 src/gallium/drivers/nouveau/nv30/nv30_context.h|  2 +-
 src/gallium/drivers/nouveau/nv30/nv30_draw.c   |  4 ++--
 src/gallium/drivers/nouveau/nv30/nv30_state_validate.c | 10 ++
 src/gallium/drivers/nouveau/nv30/nv30_vbo.c|  2 +-
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_clear.c 
b/src/gallium/drivers/nouveau/nv30/nv30_clear.c
index 1ab8929..83fd1fa 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_clear.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_clear.c
@@ -58,7 +58,7 @@ nv30_clear(struct pipe_context *pipe, unsigned buffers,
struct pipe_framebuffer_state *fb = &nv30->framebuffer;
uint32_t colr = 0, zeta = 0, mode = 0;
 
-   if (!nv30_state_validate(nv30, TRUE))
+   if (!nv30_state_validate(nv30, NV30_NEW_FRAMEBUFFER | NV30_NEW_SCISSOR, 
TRUE))
   return;
 
if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) {
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.h 
b/src/gallium/drivers/nouveau/nv30/nv30_context.h
index 7b32aae..592cdbe 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_context.h
+++ b/src/gallium/drivers/nouveau/nv30/nv30_context.h
@@ -204,7 +204,7 @@ void
 nv30_render_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info);
 
 boolean
-nv30_state_validate(struct nv30_context *nv30, boolean hwtnl);
+nv30_state_validate(struct nv30_context *nv30, uint32_t mask, boolean hwtnl);
 
 void
 nv30_state_release(struct nv30_context *nv30);
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c 
b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
index 3575c3d..38c31e9 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
@@ -129,7 +129,7 @@ nv30_render_draw_elements(struct vbuf_render *render,
NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0);
}
 
-   if (!nv30_state_validate(nv30, FALSE))
+   if (!nv30_state_validate(nv30, ~0, FALSE))
   return;
 
BEGIN_NV04(push, NV30_3D(VERTEX_BEGIN_END), 1);
@@ -174,7 +174,7 @@ nv30_render_draw_arrays(struct vbuf_render *render, 
unsigned start, uint nr)
NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0);
}
 
-   if (!nv30_state_validate(nv30, FALSE))
+   if (!nv30_state_validate(nv30, ~0, FALSE))
   return;
 
BEGIN_NV04(push, NV30_3D(VERTEX_BEGIN_END), 1);
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c 
b/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
index 0f9d19d..86ac4f7 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_state_validate.c
@@ -456,7 +456,7 @@ nv30_state_context_switch(struct nv30_context *nv30)
 }
 
 boolean
-nv30_state_validate(struct nv30_context *nv30, boolean hwtnl)
+nv30_state_validate(struct nv30_context *nv30, uint32_t mask, boolean hwtnl)
 {
struct nouveau_screen *screen = &nv30->screen->base;
struct nouveau_pushbuf *push = nv30->base.pushbuf;
@@ -481,14 +481,16 @@ nv30_state_validate(struct nv30_context *nv30, boolean 
hwtnl)
else
   validate = swtnl_validate_list;
 
-   if (nv30->dirty) {
+   mask &= nv30->dirty;
+
+   if (mask) {
   while (validate->func) {
- if (nv30->dirty & validate->mask)
+ if (mask & validate->mask)
 validate->func(nv30);
  validate++;
   }
 
-  nv30->dirty = 0;
+  nv30->dirty &= ~mask;
}
 
nouveau_pushbuf_bufctx(push, bctx);
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_vbo.c 
b/src/gallium/drivers/nouveau/nv30/nv30_vbo.c
index 67ab829..d4e384b 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_vbo.c
@@ -564,7 +564,7 @@ nv30_draw_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info)
if (nv30->vbo_user && !(nv30->dirty & (NV30_NEW_VERTEX | NV30_NEW_ARRAYS)))
   nv30_update_user_vbufs(nv30);
 
-   nv30_state_validate(nv30, TRUE);
+   nv30_state_validate(nv30, ~0, TRUE);
if (nv30->draw_flags) {
   nv30_render_vbo(pipe, info);
   return;
-- 
2.3.6

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


Re: [Mesa-dev] [PATCH 1/2] gallivm: don't use control flow when doing indirect constant buffer lookups

2015-05-23 Thread Ilia Mirkin
Hi Roland,

I've just bisected a nv30 swtnl regression to this commit. When
running the nv30 driver (on a NV44, if it matters) and forcing swtnl
(NV30_SWTNL=1), glxgears from 60% broken to 100% broken. Now, I'm not
sure what the initial breakage is, but at least it shows a
gears-looking thing some of the time. After this change, I just see a
few random lines every 30 frames or so. Setting DRAW_USE_LLVM=0 makes
the whole thing fail horribly before and after this change (nothing
drawn at all).

Do you think that it's likely coincidence that the LLVM path worked at
all before this and that I should figure out what's not working with
DRAW_USE_LLVM=0? Or can you think of some reason why this change may
have broken the llvm path in a swtnl use-case with a driver like nv30
(no gs, no integers)?

Thanks,

  -ilia


On Sat, Apr 4, 2015 at 10:50 AM,   wrote:
> From: Roland Scheidegger 
>
> llvm goes crazy when doing that, using way more memory and time, though 
> there's
> probably more to it - this points to a very much similar issue as fixed in
> 8a9f5ecdb116d0449d63f7b94efbfa8b205d826f. In any case I've seen a quite
> plain looking vertex shader with just ~50 simple tgsi instructions (but with a
> dozen or so such indirect constant buffer lookups) go from a terribly high
> ~440ms compile time (consuming 25MB of memory in the process) down to a still
> awful ~230ms and 13MB with this fix (with llvm 3.3), so there's still obvious
> improvements possible (but I have no clue why it's so slow...).
> The resulting shader is most likely also faster (certainly seemed so though
> I don't have any hard numbers as it may have been influenced by compile times)
> since generally fetching constants outside the buffer range is most likely an
> app error (that is we expect all indices to be valid).
> It is possible this fixes some mysterious vertex shader slowdowns we've seen
> ever since we are conforming to newer apis at least partially (the main draw
> loop also has similar looking conditionals which we probably could do without 
> -
> if not for the fetch at least for the additional elts condition.)
> ---
>  src/gallium/auxiliary/draw/draw_llvm.h |  2 +
>  .../draw/draw_pt_fetch_shade_pipeline_llvm.c   | 27 +++---
>  src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c| 95 
> +-
>  src/gallium/drivers/llvmpipe/lp_scene.h|  2 +
>  src/gallium/drivers/llvmpipe/lp_setup.c|  6 +-
>  5 files changed, 63 insertions(+), 69 deletions(-)
>
> diff --git a/src/gallium/auxiliary/draw/draw_llvm.h 
> b/src/gallium/auxiliary/draw/draw_llvm.h
> index 9565fc6..a1983e1 100644
> --- a/src/gallium/auxiliary/draw/draw_llvm.h
> +++ b/src/gallium/auxiliary/draw/draw_llvm.h
> @@ -472,6 +472,8 @@ struct draw_llvm {
>
> struct draw_gs_llvm_variant_list_item gs_variants_list;
> int nr_gs_variants;
> +
> +   float fake_const_buf[4];
>  };
>
>
> diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c 
> b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> index 0dfafdc..03257d8 100644
> --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
> @@ -273,28 +273,35 @@ llvm_middle_end_bind_parameters(struct 
> draw_pt_middle_end *middle)
>  {
> struct llvm_middle_end *fpme = llvm_middle_end(middle);
> struct draw_context *draw = fpme->draw;
> +   struct draw_llvm *llvm = fpme->llvm;
> unsigned i;
>
> -   for (i = 0; i < Elements(fpme->llvm->jit_context.vs_constants); ++i) {
> +   for (i = 0; i < Elements(llvm->jit_context.vs_constants); ++i) {
>int num_consts =
>   draw->pt.user.vs_constants_size[i] / (sizeof(float) * 4);
> -  fpme->llvm->jit_context.vs_constants[i] = 
> draw->pt.user.vs_constants[i];
> -  fpme->llvm->jit_context.num_vs_constants[i] = num_consts;
> +  llvm->jit_context.vs_constants[i] = draw->pt.user.vs_constants[i];
> +  llvm->jit_context.num_vs_constants[i] = num_consts;
> +  if (num_consts == 0) {
> + llvm->jit_context.vs_constants[i] = llvm->fake_const_buf;
> +  }
> }
> -   for (i = 0; i < Elements(fpme->llvm->gs_jit_context.constants); ++i) {
> +   for (i = 0; i < Elements(llvm->gs_jit_context.constants); ++i) {
>int num_consts =
>   draw->pt.user.gs_constants_size[i] / (sizeof(float) * 4);
> -  fpme->llvm->gs_jit_context.constants[i] = 
> draw->pt.user.gs_constants[i];
> -  fpme->llvm->gs_jit_context.num_constants[i] = num_consts;
> +  llvm->gs_jit_context.constants[i] = draw->pt.user.gs_constants[i];
> +  llvm->gs_jit_context.num_constants[i] = num_consts;
> +  if (num_consts == 0) {
> + llvm->gs_jit_context.constants[i] = llvm->fake_const_buf;
> +  }
> }
>
> -   fpme->llvm->jit_context.planes =
> +   llvm->jit_context.planes =
>(float (*)[DRAW_TOTAL_CLIP_PLANES][4]) draw->pt.user.planes[0];
> -   fpme->llvm->gs_jit_context.planes

Re: [Mesa-dev] [PATCH v2] nv50/ir: avoid messing up arg1 of PFETCH

2015-05-23 Thread Tobias Klausmann

Reviewed-by: Tobias Klausmann 

On 23.05.2015 18:56, Ilia Mirkin wrote:

There can be scenarios where the "indirect" arg of a PFETCH becomes
known, and so the code will attempt to propagate it. Use this
opportunity to just fold it into the first argument, and prevent the
load propagation pass from touching PFETCH further.

This fixes gs-input-array-vec4-index-rd.shader_test and
vs-output-array-vec4-index-wr-before-gs.shader_test on nvc0 at least.

Signed-off-by: Ilia Mirkin 
Cc: "10.5 10.6" 
---

v1 -> v2:
  - redo final section of ConstantFolding::expr using a switch, per tobijk

  .../drivers/nouveau/codegen/nv50_ir_peephole.cpp | 20 ++--
  1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 72dd31e..b7fcd56 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -236,6 +236,9 @@ LoadPropagation::visit(BasicBlock *bb)
if (i->op == OP_CALL) // calls have args as sources, they must be in 
regs
   continue;
  
+  if (i->op == OP_PFETCH) // pfetch expects arg1 to be a reg

+ continue;
+
if (i->srcExists(1))
   checkSwapSrc01(i);
  
@@ -581,6 +584,11 @@ ConstantFolding::expr(Instruction *i,

 case OP_POPCNT:
res.data.u32 = util_bitcount(a->data.u32 & b->data.u32);
break;
+   case OP_PFETCH:
+  // The two arguments to pfetch are logically added together. Normally
+  // the second argument will not be constant, but that can happen.
+  res.data.u32 = a->data.u32 + b->data.u32;
+  break;
 default:
return;
 }
@@ -595,7 +603,9 @@ ConstantFolding::expr(Instruction *i,
  
 i->getSrc(0)->reg.data = res.data;
  
-   if (i->op == OP_MAD || i->op == OP_FMA) {

+   switch (i->op) {
+   case OP_MAD:
+   case OP_FMA: {
i->op = OP_ADD;
  
i->setSrc(1, i->getSrc(0));

@@ -610,8 +620,14 @@ ConstantFolding::expr(Instruction *i,
   bld.setPosition(i, false);
   i->setSrc(1, bld.loadImm(NULL, res.data.u32));
}
-   } else {
+  break;
+   }
+   case OP_PFETCH:
+  // Leave PFETCH alone... we just folded its 2 args into 1.
+  break;
+   default:
i->op = i->saturate ? OP_SAT : OP_MOV; /* SAT handled by unary() */
+  break;
 }
 i->subOp = 0;
  }


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


Re: [Mesa-dev] [PATCH 2/2] clover: try userptr for CL_MEM_USE_HOST_PTR

2015-05-23 Thread Grigori Goronzy
On 23.05.2015 15:53, Francisco Jerez wrote:
>> diff --git a/src/gallium/state_trackers/clover/core/resource.cpp 
>> b/src/gallium/state_trackers/clover/core/resource.cpp
>> index 8ed4c42..8e51b3c 100644
>> --- a/src/gallium/state_trackers/clover/core/resource.cpp
>> +++ b/src/gallium/state_trackers/clover/core/resource.cpp
>> @@ -118,6 +118,8 @@ root_resource::root_resource(clover::device &dev, 
>> memory_obj &obj,
>>   command_queue &q, const std::string &data) :
>> resource(dev, obj) {
>> pipe_resource info {};
>> +   bool user_ptr_support = (bool)dev.pipe->get_param(dev.pipe,
> 
> Let's make this variable "const", and remove the cast to bool, it
> shouldn't be necessary.  With that fixed:
> Reviewed-by: Francisco Jerez 
>

Thanks for the review. Pushed with minor changes.

Grigori



signature.asc
Description: OpenPGP digital signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] i965: Delete GS scratch space workaround warning.

2015-05-23 Thread Kenneth Graunke
This workaround is documented in the 3DSTATE_GS documentation.  It
appears to only apply to early steppings of Broadwell and Skylake.

I don't think it ever affected production hardware, so at this point it
probably makes sense to delete it.

Signed-off-by: Kenneth Graunke 
---
 src/mesa/drivers/dri/i965/gen8_gs_state.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen8_gs_state.c 
b/src/mesa/drivers/dri/i965/gen8_gs_state.c
index 46b9713..6a0e215 100644
--- a/src/mesa/drivers/dri/i965/gen8_gs_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_gs_state.c
@@ -59,10 +59,6 @@ gen8_upload_gs_state(struct brw_context *brw)
  OUT_RELOC64(stage_state->scratch_bo,
  I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
  ffs(brw->gs.prog_data->base.base.total_scratch) - 11);
- WARN_ONCE(true,
-   "May need to implement a temporary workaround: GS Number of 
"
-   "URB Entries must be less than or equal to the GS Maximum "
-   "Number of Threads.\n");
   } else {
  OUT_BATCH(0);
  OUT_BATCH(0);
-- 
2.4.1

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


Re: [Mesa-dev] [PATCH] i965/skl: Add a message header for the TXF_MCS instruction in vec4vs

2015-05-23 Thread Kenneth Graunke
On Thursday, May 21, 2015 04:59:13 PM Neil Roberts wrote:
> When using SIMD4x2 on Skylake, the sampler instructions need a message
> header to select the correct mode. This was added for most sample
> instructions in 0ac4c2727 but the TXF_MCS instruction is emitted
> separately and it was missed.
> 
> This fixes a bunch of Piglit tests which test texelFetch in a geometry
> shader, for example:
> 
>  spec/arb_texture_multisample/texelfetch/2-gs-sampler2dms
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 20 ++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp 
> b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> index 5a60fe4..59a73a9 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
> @@ -2460,11 +2460,27 @@ vec4_visitor::emit_mcs_fetch(ir_texture *ir, src_reg 
> coordinate, src_reg sampler
>new(mem_ctx) vec4_instruction(SHADER_OPCODE_TXF_MCS,
>  dst_reg(this, glsl_type::uvec4_type));
> inst->base_mrf = 2;
> -   inst->mlen = 1;
> inst->src[1] = sampler;
>  
> +   int param_base;
> +
> +   if (devinfo->gen >= 9) {
> +  /* Gen9+ needs a message header in order to use SIMD4x2 mode */
> +  vec4_instruction *header_inst = new(mem_ctx)
> + vec4_instruction(VS_OPCODE_SET_SIMD4X2_HEADER_GEN9,
> +  dst_reg(MRF, inst->base_mrf));
> +
> +  emit(header_inst);
> +
> +  inst->mlen = 2;
> +  inst->header_size = 1;
> +  param_base = inst->base_mrf + 1;
> +   } else {
> +  inst->mlen = 1;
> +  param_base = inst->base_mrf;
> +   }
> +
> /* parameters are: u, v, r, lod; lod will always be zero due to api 
> restrictions */
> -   int param_base = inst->base_mrf;
> int coord_mask = (1 << ir->coordinate->type->vector_elements) - 1;
> int zero_mask = 0xf & ~coord_mask;
>  
> 

Good catch, thanks for fixing this, Neil!

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Kenneth Graunke 


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965/fs: Fix implied_mrf_writes for scratch writes

2015-05-23 Thread Kenneth Graunke
On Saturday, May 23, 2015 11:57:32 AM Jason Ekstrand wrote:
> On Sat, May 23, 2015 at 11:53 AM, Kenneth Graunke  
> wrote:
> > On Tuesday, May 19, 2015 05:37:04 PM Jason Ekstrand wrote:
> >> We build the entire message in the generator so all the MRF writes are
> >> implied.
> >> ---
> >>  src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
> >> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> >> index 9b3186b..42a0d78 100644
> >> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> >> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> >> @@ -1050,7 +1050,7 @@ fs_visitor::implied_mrf_writes(fs_inst *inst)
> >> case FS_OPCODE_VARYING_PULL_CONSTANT_LOAD:
> >>return inst->mlen;
> >> case SHADER_OPCODE_GEN4_SCRATCH_WRITE:
> >> -  return 2;
> >> +  return inst->mlen;
> >> case SHADER_OPCODE_UNTYPED_ATOMIC:
> >> case SHADER_OPCODE_UNTYPED_SURFACE_READ:
> >> case SHADER_OPCODE_UNTYPED_SURFACE_WRITE:
> >>
> >
> > Good catch!
> 
> You should thank Neil.  He pointed out a bug that made me go look at
> spilling again.

Thanks, Neil! :)

> > These should be equivalent in SIMD8 mode - we write 1 register
> > (BRW_DATAPORT_OWORD_BLOCK_2_OWORDS), giving us a mlen of 2.
> >
> > But for SIMD16, the old code would break, since mlen is 3.
> >
> > Cc: mesa-sta...@lists.freedesktop.org
> > Reviewed-by: Kenneth Graunke 
> 
> Note: The patch was only compile-tested as actually testing that it
> fixes something is neigh impossible.  Are you ok with pushing it?
> --Jason

You should definitely Piglit test it for regressions, but I don't think
we need to verify that it fixes anything before pushing.  It fixes a bug
found by inspection which also happens to be challenging to test.


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965/fs: Fix implied_mrf_writes for scratch writes

2015-05-23 Thread Jason Ekstrand
On Sat, May 23, 2015 at 11:53 AM, Kenneth Graunke  wrote:
> On Tuesday, May 19, 2015 05:37:04 PM Jason Ekstrand wrote:
>> We build the entire message in the generator so all the MRF writes are
>> implied.
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
>> b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index 9b3186b..42a0d78 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -1050,7 +1050,7 @@ fs_visitor::implied_mrf_writes(fs_inst *inst)
>> case FS_OPCODE_VARYING_PULL_CONSTANT_LOAD:
>>return inst->mlen;
>> case SHADER_OPCODE_GEN4_SCRATCH_WRITE:
>> -  return 2;
>> +  return inst->mlen;
>> case SHADER_OPCODE_UNTYPED_ATOMIC:
>> case SHADER_OPCODE_UNTYPED_SURFACE_READ:
>> case SHADER_OPCODE_UNTYPED_SURFACE_WRITE:
>>
>
> Good catch!

You should thank Neil.  He pointed out a bug that made me go look at
spilling again.

> These should be equivalent in SIMD8 mode - we write 1 register
> (BRW_DATAPORT_OWORD_BLOCK_2_OWORDS), giving us a mlen of 2.
>
> But for SIMD16, the old code would break, since mlen is 3.
>
> Cc: mesa-sta...@lists.freedesktop.org
> Reviewed-by: Kenneth Graunke 

Note: The patch was only compile-tested as actually testing that it
fixes something is neigh impossible.  Are you ok with pushing it?
--Jason
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965/fs: Fix implied_mrf_writes for scratch writes

2015-05-23 Thread Kenneth Graunke
On Tuesday, May 19, 2015 05:37:04 PM Jason Ekstrand wrote:
> We build the entire message in the generator so all the MRF writes are
> implied.
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 9b3186b..42a0d78 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -1050,7 +1050,7 @@ fs_visitor::implied_mrf_writes(fs_inst *inst)
> case FS_OPCODE_VARYING_PULL_CONSTANT_LOAD:
>return inst->mlen;
> case SHADER_OPCODE_GEN4_SCRATCH_WRITE:
> -  return 2;
> +  return inst->mlen;
> case SHADER_OPCODE_UNTYPED_ATOMIC:
> case SHADER_OPCODE_UNTYPED_SURFACE_READ:
> case SHADER_OPCODE_UNTYPED_SURFACE_WRITE:
> 

Good catch!

These should be equivalent in SIMD8 mode - we write 1 register
(BRW_DATAPORT_OWORD_BLOCK_2_OWORDS), giving us a mlen of 2.

But for SIMD16, the old code would break, since mlen is 3.

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Kenneth Graunke 


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] prog_to_nir: Use a variable for uniform data

2015-05-23 Thread Jason Ekstrand
On Sat, May 23, 2015 at 11:47 AM, Kenneth Graunke  wrote:
> On Tuesday, May 19, 2015 05:28:17 PM Jason Ekstrand wrote:
>> Previously, the prog_to_nir pass was directly generating uniform load/store
>> intrinsics.  This converts it to use a single giant "parameters" variable
>> and we now depend on lowering to get the uniform load/store intrinsics.
>> One advantage of this is that we now have one code-path after we do the
>> initial conversion into NIR.
>>
>> No shader-db changes.
>>
>> Signed-off-by: Jason Ekstrand 
>> ---
>>  src/mesa/drivers/dri/i965/brw_nir.c | 15 ++---
>>  src/mesa/program/prog_to_nir.c  | 65 
>> -
>>  2 files changed, 38 insertions(+), 42 deletions(-)
>
> That is indeed nicer...much less special casing.  This patch also makes
> an eventual goal of mine easier:
>
> If we ever start converting ARB programs directly to NIR, we'll be able
> to create multiple variables for disjoint sections of parameters---several
> arrays, rather than one giant array.  (Currently, that information is lost
> in Mesa IR, as far as I know.)  This would allow us to eliminate more
> unused parameters in the presence of indirects.

Yeah, hopefully we can start doing some sort of array-splitting in NIR
which would help with that.  Doing that on uniforms can be tricky
though...

> Reviewed-by: Kenneth Graunke 

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


Re: [Mesa-dev] [PATCH 1/2] prog_to_nir: Use a variable for uniform data

2015-05-23 Thread Kenneth Graunke
On Tuesday, May 19, 2015 05:28:17 PM Jason Ekstrand wrote:
> Previously, the prog_to_nir pass was directly generating uniform load/store
> intrinsics.  This converts it to use a single giant "parameters" variable
> and we now depend on lowering to get the uniform load/store intrinsics.
> One advantage of this is that we now have one code-path after we do the
> initial conversion into NIR.
> 
> No shader-db changes.
> 
> Signed-off-by: Jason Ekstrand 
> ---
>  src/mesa/drivers/dri/i965/brw_nir.c | 15 ++---
>  src/mesa/program/prog_to_nir.c  | 65 
> -
>  2 files changed, 38 insertions(+), 42 deletions(-)

That is indeed nicer...much less special casing.  This patch also makes
an eventual goal of mine easier:

If we ever start converting ARB programs directly to NIR, we'll be able
to create multiple variables for disjoint sections of parameters---several
arrays, rather than one giant array.  (Currently, that information is lost
in Mesa IR, as far as I know.)  This would allow us to eliminate more
unused parameters in the presence of indirects.

Reviewed-by: Kenneth Graunke 


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2] nv50: fix PIPE_QUERY_TIMESTAMP_DISJOINT, based on nvc0

2015-05-23 Thread Samuel Pitoiset



On 05/23/2015 06:59 PM, Ilia Mirkin wrote:

On Sat, May 23, 2015 at 12:59 PM, Samuel Pitoiset
 wrote:


On 05/23/2015 06:53 PM, Ilia Mirkin wrote:

Reviewed-by: Ilia Mirkin 

Seems in line with nvc0, but I assume you tested this? e.g. the
occlquery mesa demo, or the relevant piglit tests?


Yes. And I added a temporary entry to the Gallium HUD for testing
timestamp-disjoint.

I meant just general testing of queries, since you're redoing the
whole mechanism. Fixing timestamp disjoint is just icing on the
cake...


Sure. No regressions. I tested all queries. :)






On Sat, May 23, 2015 at 12:52 PM, Samuel Pitoiset
 wrote:

PIPE_QUERY_TIMESTAMP_DISJOINT could not work because q->ready was always
set to FALSE. To fix this issue, add more different states for queries
according to nvc0.

Signed-off-by: Samuel Pitoiset 
---
   src/gallium/drivers/nouveau/nv50/nv50_query.c | 39
+++
   1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c
b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index da41209..55fcac8 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -27,6 +27,11 @@
   #include "nv50/nv50_context.h"
   #include "nv_object.xml.h"

+#define NV50_QUERY_STATE_READY   0
+#define NV50_QUERY_STATE_ACTIVE  1
+#define NV50_QUERY_STATE_ENDED   2
+#define NV50_QUERY_STATE_FLUSHED 3
+
   /* XXX: Nested queries, and simultaneous queries on multiple gallium
contexts
* (since we use only a single GPU channel per screen) will not work
properly.
*
@@ -42,8 +47,7 @@ struct nv50_query {
  struct nouveau_bo *bo;
  uint32_t base;
  uint32_t offset; /* base + i * 32 */
-   boolean ready;
-   boolean flushed;
+   uint8_t state;
  boolean is64bit;
  struct nouveau_mm_allocation *mm;
  struct nouveau_fence *fence;
@@ -66,7 +70,7 @@ nv50_query_allocate(struct nv50_context *nv50, struct
nv50_query *q, int size)
  if (q->bo) {
 nouveau_bo_ref(NULL, &q->bo);
 if (q->mm) {
- if (q->ready)
+ if (q->state == NV50_QUERY_STATE_READY)
   nouveau_mm_free(q->mm);
else
   nouveau_fence_work(screen->base.fence.current,
nouveau_mm_free_work,
@@ -203,7 +207,7 @@ nv50_query_begin(struct pipe_context *pipe, struct
pipe_query *pq)
  default:
 break;
  }
-   q->ready = FALSE;
+   q->state = NV50_QUERY_STATE_ACTIVE;
  return true;
   }

@@ -214,6 +218,8 @@ nv50_query_end(struct pipe_context *pipe, struct
pipe_query *pq)
  struct nouveau_pushbuf *push = nv50->base.pushbuf;
  struct nv50_query *q = nv50_query(pq);

+   q->state = NV50_QUERY_STATE_ENDED;
+
  switch (q->type) {
  case PIPE_QUERY_OCCLUSION_COUNTER:
 nv50_query_get(push, q, 0, 0x0100f002);
@@ -256,29 +262,27 @@ nv50_query_end(struct pipe_context *pipe, struct
pipe_query *pq)
 break;
  case PIPE_QUERY_TIMESTAMP_DISJOINT:
 /* This query is not issued on GPU because disjoint is forced to
FALSE */
-  q->ready = TRUE;
+  q->state = NV50_QUERY_STATE_READY;
 break;
  default:
 assert(0);
 break;
  }
-   q->ready = q->flushed = FALSE;

  if (q->is64bit)
 nouveau_fence_ref(nv50->screen->base.fence.current, &q->fence);
   }

-static INLINE boolean
-nv50_query_ready(struct nv50_query *q)
+static INLINE void
+nv50_query_update(struct nv50_query *q)
   {
  if (q->is64bit) {
 if (nouveau_fence_signalled(q->fence))
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
  } else {
 if (q->data[0] == q->sequence)
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
  }
-   return FALSE;
   }

   static boolean
@@ -293,13 +297,14 @@ nv50_query_result(struct pipe_context *pipe, struct
pipe_query *pq,
  uint64_t *data64 = (uint64_t *)q->data;
  int i;

-   if (!q->ready) /* update ? */
-  q->ready = nv50_query_ready(q);
-   if (!q->ready) {
+   if (q->state != NV50_QUERY_STATE_READY)
+  nv50_query_update(q);
+
+   if (q->state != NV50_QUERY_STATE_READY) {
 if (!wait) {
/* for broken apps that spin on GL_QUERY_RESULT_AVAILABLE */
- if (!q->flushed) {
-q->flushed = TRUE;
+ if (q->state != NV50_QUERY_STATE_FLUSHED) {
+q->state = NV50_QUERY_STATE_FLUSHED;
   PUSH_KICK(nv50->base.pushbuf);
}
return FALSE;
@@ -307,7 +312,7 @@ nv50_query_result(struct pipe_context *pipe, struct
pipe_query *pq,
 if (nouveau_bo_wait(q->bo, NOUVEAU_BO_RD,
nv50->screen->base.client))
return FALSE;
  }
-   q->ready = TRUE;
+   q->state = NV50_QUERY_STATE_READY;

  switch (q->type) {
  case PIPE_QUERY_GPU_FINISHED:
--
2.4.1

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




_

Re: [Mesa-dev] [PATCH v2] nv50: fix PIPE_QUERY_TIMESTAMP_DISJOINT, based on nvc0

2015-05-23 Thread Ilia Mirkin
On Sat, May 23, 2015 at 12:59 PM, Samuel Pitoiset
 wrote:
>
>
> On 05/23/2015 06:53 PM, Ilia Mirkin wrote:
>>
>> Reviewed-by: Ilia Mirkin 
>>
>> Seems in line with nvc0, but I assume you tested this? e.g. the
>> occlquery mesa demo, or the relevant piglit tests?
>
>
> Yes. And I added a temporary entry to the Gallium HUD for testing
> timestamp-disjoint.

I meant just general testing of queries, since you're redoing the
whole mechanism. Fixing timestamp disjoint is just icing on the
cake...

>
>
>>
>> On Sat, May 23, 2015 at 12:52 PM, Samuel Pitoiset
>>  wrote:
>>>
>>> PIPE_QUERY_TIMESTAMP_DISJOINT could not work because q->ready was always
>>> set to FALSE. To fix this issue, add more different states for queries
>>> according to nvc0.
>>>
>>> Signed-off-by: Samuel Pitoiset 
>>> ---
>>>   src/gallium/drivers/nouveau/nv50/nv50_query.c | 39
>>> +++
>>>   1 file changed, 22 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c
>>> b/src/gallium/drivers/nouveau/nv50/nv50_query.c
>>> index da41209..55fcac8 100644
>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
>>> @@ -27,6 +27,11 @@
>>>   #include "nv50/nv50_context.h"
>>>   #include "nv_object.xml.h"
>>>
>>> +#define NV50_QUERY_STATE_READY   0
>>> +#define NV50_QUERY_STATE_ACTIVE  1
>>> +#define NV50_QUERY_STATE_ENDED   2
>>> +#define NV50_QUERY_STATE_FLUSHED 3
>>> +
>>>   /* XXX: Nested queries, and simultaneous queries on multiple gallium
>>> contexts
>>>* (since we use only a single GPU channel per screen) will not work
>>> properly.
>>>*
>>> @@ -42,8 +47,7 @@ struct nv50_query {
>>>  struct nouveau_bo *bo;
>>>  uint32_t base;
>>>  uint32_t offset; /* base + i * 32 */
>>> -   boolean ready;
>>> -   boolean flushed;
>>> +   uint8_t state;
>>>  boolean is64bit;
>>>  struct nouveau_mm_allocation *mm;
>>>  struct nouveau_fence *fence;
>>> @@ -66,7 +70,7 @@ nv50_query_allocate(struct nv50_context *nv50, struct
>>> nv50_query *q, int size)
>>>  if (q->bo) {
>>> nouveau_bo_ref(NULL, &q->bo);
>>> if (q->mm) {
>>> - if (q->ready)
>>> + if (q->state == NV50_QUERY_STATE_READY)
>>>   nouveau_mm_free(q->mm);
>>>else
>>>   nouveau_fence_work(screen->base.fence.current,
>>> nouveau_mm_free_work,
>>> @@ -203,7 +207,7 @@ nv50_query_begin(struct pipe_context *pipe, struct
>>> pipe_query *pq)
>>>  default:
>>> break;
>>>  }
>>> -   q->ready = FALSE;
>>> +   q->state = NV50_QUERY_STATE_ACTIVE;
>>>  return true;
>>>   }
>>>
>>> @@ -214,6 +218,8 @@ nv50_query_end(struct pipe_context *pipe, struct
>>> pipe_query *pq)
>>>  struct nouveau_pushbuf *push = nv50->base.pushbuf;
>>>  struct nv50_query *q = nv50_query(pq);
>>>
>>> +   q->state = NV50_QUERY_STATE_ENDED;
>>> +
>>>  switch (q->type) {
>>>  case PIPE_QUERY_OCCLUSION_COUNTER:
>>> nv50_query_get(push, q, 0, 0x0100f002);
>>> @@ -256,29 +262,27 @@ nv50_query_end(struct pipe_context *pipe, struct
>>> pipe_query *pq)
>>> break;
>>>  case PIPE_QUERY_TIMESTAMP_DISJOINT:
>>> /* This query is not issued on GPU because disjoint is forced to
>>> FALSE */
>>> -  q->ready = TRUE;
>>> +  q->state = NV50_QUERY_STATE_READY;
>>> break;
>>>  default:
>>> assert(0);
>>> break;
>>>  }
>>> -   q->ready = q->flushed = FALSE;
>>>
>>>  if (q->is64bit)
>>> nouveau_fence_ref(nv50->screen->base.fence.current, &q->fence);
>>>   }
>>>
>>> -static INLINE boolean
>>> -nv50_query_ready(struct nv50_query *q)
>>> +static INLINE void
>>> +nv50_query_update(struct nv50_query *q)
>>>   {
>>>  if (q->is64bit) {
>>> if (nouveau_fence_signalled(q->fence))
>>> - return TRUE;
>>> + q->state = NV50_QUERY_STATE_READY;
>>>  } else {
>>> if (q->data[0] == q->sequence)
>>> - return TRUE;
>>> + q->state = NV50_QUERY_STATE_READY;
>>>  }
>>> -   return FALSE;
>>>   }
>>>
>>>   static boolean
>>> @@ -293,13 +297,14 @@ nv50_query_result(struct pipe_context *pipe, struct
>>> pipe_query *pq,
>>>  uint64_t *data64 = (uint64_t *)q->data;
>>>  int i;
>>>
>>> -   if (!q->ready) /* update ? */
>>> -  q->ready = nv50_query_ready(q);
>>> -   if (!q->ready) {
>>> +   if (q->state != NV50_QUERY_STATE_READY)
>>> +  nv50_query_update(q);
>>> +
>>> +   if (q->state != NV50_QUERY_STATE_READY) {
>>> if (!wait) {
>>>/* for broken apps that spin on GL_QUERY_RESULT_AVAILABLE */
>>> - if (!q->flushed) {
>>> -q->flushed = TRUE;
>>> + if (q->state != NV50_QUERY_STATE_FLUSHED) {
>>> +q->state = NV50_QUERY_STATE_FLUSHED;
>>>   PUSH_KICK(nv50->base.pushbuf);
>>>}
>>>return FALSE;
>>> @@ -307,7 +312,7 @@ nv50_query_result(struct pipe_context *pipe, struct
>>> pipe_query *pq,
>>> 

[Mesa-dev] [PATCH v2] nv50/ir: avoid messing up arg1 of PFETCH

2015-05-23 Thread Ilia Mirkin
There can be scenarios where the "indirect" arg of a PFETCH becomes
known, and so the code will attempt to propagate it. Use this
opportunity to just fold it into the first argument, and prevent the
load propagation pass from touching PFETCH further.

This fixes gs-input-array-vec4-index-rd.shader_test and
vs-output-array-vec4-index-wr-before-gs.shader_test on nvc0 at least.

Signed-off-by: Ilia Mirkin 
Cc: "10.5 10.6" 
---

v1 -> v2:
 - redo final section of ConstantFolding::expr using a switch, per tobijk

 .../drivers/nouveau/codegen/nv50_ir_peephole.cpp | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 72dd31e..b7fcd56 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -236,6 +236,9 @@ LoadPropagation::visit(BasicBlock *bb)
   if (i->op == OP_CALL) // calls have args as sources, they must be in regs
  continue;
 
+  if (i->op == OP_PFETCH) // pfetch expects arg1 to be a reg
+ continue;
+
   if (i->srcExists(1))
  checkSwapSrc01(i);
 
@@ -581,6 +584,11 @@ ConstantFolding::expr(Instruction *i,
case OP_POPCNT:
   res.data.u32 = util_bitcount(a->data.u32 & b->data.u32);
   break;
+   case OP_PFETCH:
+  // The two arguments to pfetch are logically added together. Normally
+  // the second argument will not be constant, but that can happen.
+  res.data.u32 = a->data.u32 + b->data.u32;
+  break;
default:
   return;
}
@@ -595,7 +603,9 @@ ConstantFolding::expr(Instruction *i,
 
i->getSrc(0)->reg.data = res.data;
 
-   if (i->op == OP_MAD || i->op == OP_FMA) {
+   switch (i->op) {
+   case OP_MAD:
+   case OP_FMA: {
   i->op = OP_ADD;
 
   i->setSrc(1, i->getSrc(0));
@@ -610,8 +620,14 @@ ConstantFolding::expr(Instruction *i,
  bld.setPosition(i, false);
  i->setSrc(1, bld.loadImm(NULL, res.data.u32));
   }
-   } else {
+  break;
+   }
+   case OP_PFETCH:
+  // Leave PFETCH alone... we just folded its 2 args into 1.
+  break;
+   default:
   i->op = i->saturate ? OP_SAT : OP_MOV; /* SAT handled by unary() */
+  break;
}
i->subOp = 0;
 }
-- 
2.3.6

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


Re: [Mesa-dev] [PATCH v2] nv50: fix PIPE_QUERY_TIMESTAMP_DISJOINT, based on nvc0

2015-05-23 Thread Samuel Pitoiset



On 05/23/2015 06:53 PM, Ilia Mirkin wrote:

Reviewed-by: Ilia Mirkin 

Seems in line with nvc0, but I assume you tested this? e.g. the
occlquery mesa demo, or the relevant piglit tests?


Yes. And I added a temporary entry to the Gallium HUD for testing 
timestamp-disjoint.




On Sat, May 23, 2015 at 12:52 PM, Samuel Pitoiset
 wrote:

PIPE_QUERY_TIMESTAMP_DISJOINT could not work because q->ready was always
set to FALSE. To fix this issue, add more different states for queries
according to nvc0.

Signed-off-by: Samuel Pitoiset 
---
  src/gallium/drivers/nouveau/nv50/nv50_query.c | 39 +++
  1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c 
b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index da41209..55fcac8 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -27,6 +27,11 @@
  #include "nv50/nv50_context.h"
  #include "nv_object.xml.h"

+#define NV50_QUERY_STATE_READY   0
+#define NV50_QUERY_STATE_ACTIVE  1
+#define NV50_QUERY_STATE_ENDED   2
+#define NV50_QUERY_STATE_FLUSHED 3
+
  /* XXX: Nested queries, and simultaneous queries on multiple gallium contexts
   * (since we use only a single GPU channel per screen) will not work properly.
   *
@@ -42,8 +47,7 @@ struct nv50_query {
 struct nouveau_bo *bo;
 uint32_t base;
 uint32_t offset; /* base + i * 32 */
-   boolean ready;
-   boolean flushed;
+   uint8_t state;
 boolean is64bit;
 struct nouveau_mm_allocation *mm;
 struct nouveau_fence *fence;
@@ -66,7 +70,7 @@ nv50_query_allocate(struct nv50_context *nv50, struct 
nv50_query *q, int size)
 if (q->bo) {
nouveau_bo_ref(NULL, &q->bo);
if (q->mm) {
- if (q->ready)
+ if (q->state == NV50_QUERY_STATE_READY)
  nouveau_mm_free(q->mm);
   else
  nouveau_fence_work(screen->base.fence.current, 
nouveau_mm_free_work,
@@ -203,7 +207,7 @@ nv50_query_begin(struct pipe_context *pipe, struct 
pipe_query *pq)
 default:
break;
 }
-   q->ready = FALSE;
+   q->state = NV50_QUERY_STATE_ACTIVE;
 return true;
  }

@@ -214,6 +218,8 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query 
*pq)
 struct nouveau_pushbuf *push = nv50->base.pushbuf;
 struct nv50_query *q = nv50_query(pq);

+   q->state = NV50_QUERY_STATE_ENDED;
+
 switch (q->type) {
 case PIPE_QUERY_OCCLUSION_COUNTER:
nv50_query_get(push, q, 0, 0x0100f002);
@@ -256,29 +262,27 @@ nv50_query_end(struct pipe_context *pipe, struct 
pipe_query *pq)
break;
 case PIPE_QUERY_TIMESTAMP_DISJOINT:
/* This query is not issued on GPU because disjoint is forced to FALSE 
*/
-  q->ready = TRUE;
+  q->state = NV50_QUERY_STATE_READY;
break;
 default:
assert(0);
break;
 }
-   q->ready = q->flushed = FALSE;

 if (q->is64bit)
nouveau_fence_ref(nv50->screen->base.fence.current, &q->fence);
  }

-static INLINE boolean
-nv50_query_ready(struct nv50_query *q)
+static INLINE void
+nv50_query_update(struct nv50_query *q)
  {
 if (q->is64bit) {
if (nouveau_fence_signalled(q->fence))
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
 } else {
if (q->data[0] == q->sequence)
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
 }
-   return FALSE;
  }

  static boolean
@@ -293,13 +297,14 @@ nv50_query_result(struct pipe_context *pipe, struct 
pipe_query *pq,
 uint64_t *data64 = (uint64_t *)q->data;
 int i;

-   if (!q->ready) /* update ? */
-  q->ready = nv50_query_ready(q);
-   if (!q->ready) {
+   if (q->state != NV50_QUERY_STATE_READY)
+  nv50_query_update(q);
+
+   if (q->state != NV50_QUERY_STATE_READY) {
if (!wait) {
   /* for broken apps that spin on GL_QUERY_RESULT_AVAILABLE */
- if (!q->flushed) {
-q->flushed = TRUE;
+ if (q->state != NV50_QUERY_STATE_FLUSHED) {
+q->state = NV50_QUERY_STATE_FLUSHED;
  PUSH_KICK(nv50->base.pushbuf);
   }
   return FALSE;
@@ -307,7 +312,7 @@ nv50_query_result(struct pipe_context *pipe, struct 
pipe_query *pq,
if (nouveau_bo_wait(q->bo, NOUVEAU_BO_RD, nv50->screen->base.client))
   return FALSE;
 }
-   q->ready = TRUE;
+   q->state = NV50_QUERY_STATE_READY;

 switch (q->type) {
 case PIPE_QUERY_GPU_FINISHED:
--
2.4.1

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


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


Re: [Mesa-dev] [PATCH v2] nv50: fix PIPE_QUERY_TIMESTAMP_DISJOINT, based on nvc0

2015-05-23 Thread Ilia Mirkin
Reviewed-by: Ilia Mirkin 

Seems in line with nvc0, but I assume you tested this? e.g. the
occlquery mesa demo, or the relevant piglit tests?

On Sat, May 23, 2015 at 12:52 PM, Samuel Pitoiset
 wrote:
> PIPE_QUERY_TIMESTAMP_DISJOINT could not work because q->ready was always
> set to FALSE. To fix this issue, add more different states for queries
> according to nvc0.
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/nouveau/nv50/nv50_query.c | 39 
> +++
>  1 file changed, 22 insertions(+), 17 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c 
> b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> index da41209..55fcac8 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> @@ -27,6 +27,11 @@
>  #include "nv50/nv50_context.h"
>  #include "nv_object.xml.h"
>
> +#define NV50_QUERY_STATE_READY   0
> +#define NV50_QUERY_STATE_ACTIVE  1
> +#define NV50_QUERY_STATE_ENDED   2
> +#define NV50_QUERY_STATE_FLUSHED 3
> +
>  /* XXX: Nested queries, and simultaneous queries on multiple gallium contexts
>   * (since we use only a single GPU channel per screen) will not work 
> properly.
>   *
> @@ -42,8 +47,7 @@ struct nv50_query {
> struct nouveau_bo *bo;
> uint32_t base;
> uint32_t offset; /* base + i * 32 */
> -   boolean ready;
> -   boolean flushed;
> +   uint8_t state;
> boolean is64bit;
> struct nouveau_mm_allocation *mm;
> struct nouveau_fence *fence;
> @@ -66,7 +70,7 @@ nv50_query_allocate(struct nv50_context *nv50, struct 
> nv50_query *q, int size)
> if (q->bo) {
>nouveau_bo_ref(NULL, &q->bo);
>if (q->mm) {
> - if (q->ready)
> + if (q->state == NV50_QUERY_STATE_READY)
>  nouveau_mm_free(q->mm);
>   else
>  nouveau_fence_work(screen->base.fence.current, 
> nouveau_mm_free_work,
> @@ -203,7 +207,7 @@ nv50_query_begin(struct pipe_context *pipe, struct 
> pipe_query *pq)
> default:
>break;
> }
> -   q->ready = FALSE;
> +   q->state = NV50_QUERY_STATE_ACTIVE;
> return true;
>  }
>
> @@ -214,6 +218,8 @@ nv50_query_end(struct pipe_context *pipe, struct 
> pipe_query *pq)
> struct nouveau_pushbuf *push = nv50->base.pushbuf;
> struct nv50_query *q = nv50_query(pq);
>
> +   q->state = NV50_QUERY_STATE_ENDED;
> +
> switch (q->type) {
> case PIPE_QUERY_OCCLUSION_COUNTER:
>nv50_query_get(push, q, 0, 0x0100f002);
> @@ -256,29 +262,27 @@ nv50_query_end(struct pipe_context *pipe, struct 
> pipe_query *pq)
>break;
> case PIPE_QUERY_TIMESTAMP_DISJOINT:
>/* This query is not issued on GPU because disjoint is forced to FALSE 
> */
> -  q->ready = TRUE;
> +  q->state = NV50_QUERY_STATE_READY;
>break;
> default:
>assert(0);
>break;
> }
> -   q->ready = q->flushed = FALSE;
>
> if (q->is64bit)
>nouveau_fence_ref(nv50->screen->base.fence.current, &q->fence);
>  }
>
> -static INLINE boolean
> -nv50_query_ready(struct nv50_query *q)
> +static INLINE void
> +nv50_query_update(struct nv50_query *q)
>  {
> if (q->is64bit) {
>if (nouveau_fence_signalled(q->fence))
> - return TRUE;
> + q->state = NV50_QUERY_STATE_READY;
> } else {
>if (q->data[0] == q->sequence)
> - return TRUE;
> + q->state = NV50_QUERY_STATE_READY;
> }
> -   return FALSE;
>  }
>
>  static boolean
> @@ -293,13 +297,14 @@ nv50_query_result(struct pipe_context *pipe, struct 
> pipe_query *pq,
> uint64_t *data64 = (uint64_t *)q->data;
> int i;
>
> -   if (!q->ready) /* update ? */
> -  q->ready = nv50_query_ready(q);
> -   if (!q->ready) {
> +   if (q->state != NV50_QUERY_STATE_READY)
> +  nv50_query_update(q);
> +
> +   if (q->state != NV50_QUERY_STATE_READY) {
>if (!wait) {
>   /* for broken apps that spin on GL_QUERY_RESULT_AVAILABLE */
> - if (!q->flushed) {
> -q->flushed = TRUE;
> + if (q->state != NV50_QUERY_STATE_FLUSHED) {
> +q->state = NV50_QUERY_STATE_FLUSHED;
>  PUSH_KICK(nv50->base.pushbuf);
>   }
>   return FALSE;
> @@ -307,7 +312,7 @@ nv50_query_result(struct pipe_context *pipe, struct 
> pipe_query *pq,
>if (nouveau_bo_wait(q->bo, NOUVEAU_BO_RD, nv50->screen->base.client))
>   return FALSE;
> }
> -   q->ready = TRUE;
> +   q->state = NV50_QUERY_STATE_READY;
>
> switch (q->type) {
> case PIPE_QUERY_GPU_FINISHED:
> --
> 2.4.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] nv50: fix PIPE_QUERY_TIMESTAMP_DISJOINT, based on nvc0

2015-05-23 Thread Samuel Pitoiset



On 05/23/2015 06:47 PM, Ilia Mirkin wrote:

On Sat, May 23, 2015 at 12:46 PM, Samuel Pitoiset
 wrote:

PIPE_QUERY_TIMESTAMP_DISJOINT could not work because q->ready was always
set to FALSE. To fix this issue, add more different states for queries
according to nvc0.

Signed-off-by: Samuel Pitoiset 
---
  src/gallium/drivers/nouveau/nv50/nv50_query.c  |  39 +-
  .../drivers/nouveau/nvc0/nvc0_query_hw_sm.c| 798 +

oops?


Oops.


  2 files changed, 820 insertions(+), 17 deletions(-)
  create mode 100644 src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c 
b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index da41209..55fcac8 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -27,6 +27,11 @@
  #include "nv50/nv50_context.h"
  #include "nv_object.xml.h"

+#define NV50_QUERY_STATE_READY   0
+#define NV50_QUERY_STATE_ACTIVE  1
+#define NV50_QUERY_STATE_ENDED   2
+#define NV50_QUERY_STATE_FLUSHED 3
+
  /* XXX: Nested queries, and simultaneous queries on multiple gallium contexts
   * (since we use only a single GPU channel per screen) will not work properly.
   *
@@ -42,8 +47,7 @@ struct nv50_query {
 struct nouveau_bo *bo;
 uint32_t base;
 uint32_t offset; /* base + i * 32 */
-   boolean ready;
-   boolean flushed;
+   uint8_t state;
 boolean is64bit;
 struct nouveau_mm_allocation *mm;
 struct nouveau_fence *fence;
@@ -66,7 +70,7 @@ nv50_query_allocate(struct nv50_context *nv50, struct 
nv50_query *q, int size)
 if (q->bo) {
nouveau_bo_ref(NULL, &q->bo);
if (q->mm) {
- if (q->ready)
+ if (q->state == NV50_QUERY_STATE_READY)
  nouveau_mm_free(q->mm);
   else
  nouveau_fence_work(screen->base.fence.current, 
nouveau_mm_free_work,
@@ -203,7 +207,7 @@ nv50_query_begin(struct pipe_context *pipe, struct 
pipe_query *pq)
 default:
break;
 }
-   q->ready = FALSE;
+   q->state = NV50_QUERY_STATE_ACTIVE;
 return true;
  }

@@ -214,6 +218,8 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query 
*pq)
 struct nouveau_pushbuf *push = nv50->base.pushbuf;
 struct nv50_query *q = nv50_query(pq);

+   q->state = NV50_QUERY_STATE_ENDED;
+
 switch (q->type) {
 case PIPE_QUERY_OCCLUSION_COUNTER:
nv50_query_get(push, q, 0, 0x0100f002);
@@ -256,29 +262,27 @@ nv50_query_end(struct pipe_context *pipe, struct 
pipe_query *pq)
break;
 case PIPE_QUERY_TIMESTAMP_DISJOINT:
/* This query is not issued on GPU because disjoint is forced to FALSE 
*/
-  q->ready = TRUE;
+  q->state = NV50_QUERY_STATE_READY;
break;
 default:
assert(0);
break;
 }
-   q->ready = q->flushed = FALSE;

 if (q->is64bit)
nouveau_fence_ref(nv50->screen->base.fence.current, &q->fence);
  }

-static INLINE boolean
-nv50_query_ready(struct nv50_query *q)
+static INLINE void
+nv50_query_update(struct nv50_query *q)
  {
 if (q->is64bit) {
if (nouveau_fence_signalled(q->fence))
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
 } else {
if (q->data[0] == q->sequence)
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
 }
-   return FALSE;
  }

  static boolean
@@ -293,13 +297,14 @@ nv50_query_result(struct pipe_context *pipe, struct 
pipe_query *pq,
 uint64_t *data64 = (uint64_t *)q->data;
 int i;

-   if (!q->ready) /* update ? */
-  q->ready = nv50_query_ready(q);
-   if (!q->ready) {
+   if (q->state != NV50_QUERY_STATE_READY)
+  nv50_query_update(q);
+
+   if (q->state != NV50_QUERY_STATE_READY) {
if (!wait) {
   /* for broken apps that spin on GL_QUERY_RESULT_AVAILABLE */
- if (!q->flushed) {
-q->flushed = TRUE;
+ if (q->state != NV50_QUERY_STATE_FLUSHED) {
+q->state = NV50_QUERY_STATE_FLUSHED;
  PUSH_KICK(nv50->base.pushbuf);
   }
   return FALSE;
@@ -307,7 +312,7 @@ nv50_query_result(struct pipe_context *pipe, struct 
pipe_query *pq,
if (nouveau_bo_wait(q->bo, NOUVEAU_BO_RD, nv50->screen->base.client))
   return FALSE;
 }
-   q->ready = TRUE;
+   q->state = NV50_QUERY_STATE_READY;

 switch (q->type) {
 case PIPE_QUERY_GPU_FINISHED:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
new file mode 100644
index 000..668f0fb
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
@@ -0,0 +1,798 @@
+/*
+ * Copyright 2011 Nouveau Project
+ *
+ * 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, s

[Mesa-dev] [PATCH v2] nv50: fix PIPE_QUERY_TIMESTAMP_DISJOINT, based on nvc0

2015-05-23 Thread Samuel Pitoiset
PIPE_QUERY_TIMESTAMP_DISJOINT could not work because q->ready was always
set to FALSE. To fix this issue, add more different states for queries
according to nvc0.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/nouveau/nv50/nv50_query.c | 39 +++
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c 
b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index da41209..55fcac8 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -27,6 +27,11 @@
 #include "nv50/nv50_context.h"
 #include "nv_object.xml.h"
 
+#define NV50_QUERY_STATE_READY   0
+#define NV50_QUERY_STATE_ACTIVE  1
+#define NV50_QUERY_STATE_ENDED   2
+#define NV50_QUERY_STATE_FLUSHED 3
+
 /* XXX: Nested queries, and simultaneous queries on multiple gallium contexts
  * (since we use only a single GPU channel per screen) will not work properly.
  *
@@ -42,8 +47,7 @@ struct nv50_query {
struct nouveau_bo *bo;
uint32_t base;
uint32_t offset; /* base + i * 32 */
-   boolean ready;
-   boolean flushed;
+   uint8_t state;
boolean is64bit;
struct nouveau_mm_allocation *mm;
struct nouveau_fence *fence;
@@ -66,7 +70,7 @@ nv50_query_allocate(struct nv50_context *nv50, struct 
nv50_query *q, int size)
if (q->bo) {
   nouveau_bo_ref(NULL, &q->bo);
   if (q->mm) {
- if (q->ready)
+ if (q->state == NV50_QUERY_STATE_READY)
 nouveau_mm_free(q->mm);
  else
 nouveau_fence_work(screen->base.fence.current, 
nouveau_mm_free_work,
@@ -203,7 +207,7 @@ nv50_query_begin(struct pipe_context *pipe, struct 
pipe_query *pq)
default:
   break;
}
-   q->ready = FALSE;
+   q->state = NV50_QUERY_STATE_ACTIVE;
return true;
 }
 
@@ -214,6 +218,8 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query 
*pq)
struct nouveau_pushbuf *push = nv50->base.pushbuf;
struct nv50_query *q = nv50_query(pq);
 
+   q->state = NV50_QUERY_STATE_ENDED;
+
switch (q->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
   nv50_query_get(push, q, 0, 0x0100f002);
@@ -256,29 +262,27 @@ nv50_query_end(struct pipe_context *pipe, struct 
pipe_query *pq)
   break;
case PIPE_QUERY_TIMESTAMP_DISJOINT:
   /* This query is not issued on GPU because disjoint is forced to FALSE */
-  q->ready = TRUE;
+  q->state = NV50_QUERY_STATE_READY;
   break;
default:
   assert(0);
   break;
}
-   q->ready = q->flushed = FALSE;
 
if (q->is64bit)
   nouveau_fence_ref(nv50->screen->base.fence.current, &q->fence);
 }
 
-static INLINE boolean
-nv50_query_ready(struct nv50_query *q)
+static INLINE void
+nv50_query_update(struct nv50_query *q)
 {
if (q->is64bit) {
   if (nouveau_fence_signalled(q->fence))
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
} else {
   if (q->data[0] == q->sequence)
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
}
-   return FALSE;
 }
 
 static boolean
@@ -293,13 +297,14 @@ nv50_query_result(struct pipe_context *pipe, struct 
pipe_query *pq,
uint64_t *data64 = (uint64_t *)q->data;
int i;
 
-   if (!q->ready) /* update ? */
-  q->ready = nv50_query_ready(q);
-   if (!q->ready) {
+   if (q->state != NV50_QUERY_STATE_READY)
+  nv50_query_update(q);
+
+   if (q->state != NV50_QUERY_STATE_READY) {
   if (!wait) {
  /* for broken apps that spin on GL_QUERY_RESULT_AVAILABLE */
- if (!q->flushed) {
-q->flushed = TRUE;
+ if (q->state != NV50_QUERY_STATE_FLUSHED) {
+q->state = NV50_QUERY_STATE_FLUSHED;
 PUSH_KICK(nv50->base.pushbuf);
  }
  return FALSE;
@@ -307,7 +312,7 @@ nv50_query_result(struct pipe_context *pipe, struct 
pipe_query *pq,
   if (nouveau_bo_wait(q->bo, NOUVEAU_BO_RD, nv50->screen->base.client))
  return FALSE;
}
-   q->ready = TRUE;
+   q->state = NV50_QUERY_STATE_READY;
 
switch (q->type) {
case PIPE_QUERY_GPU_FINISHED:
-- 
2.4.1

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


Re: [Mesa-dev] [PATCH] nv50: fix PIPE_QUERY_TIMESTAMP_DISJOINT, based on nvc0

2015-05-23 Thread Ilia Mirkin
On Sat, May 23, 2015 at 12:46 PM, Samuel Pitoiset
 wrote:
> PIPE_QUERY_TIMESTAMP_DISJOINT could not work because q->ready was always
> set to FALSE. To fix this issue, add more different states for queries
> according to nvc0.
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/nouveau/nv50/nv50_query.c  |  39 +-
>  .../drivers/nouveau/nvc0/nvc0_query_hw_sm.c| 798 
> +

oops?

>  2 files changed, 820 insertions(+), 17 deletions(-)
>  create mode 100644 src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
>
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c 
> b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> index da41209..55fcac8 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
> @@ -27,6 +27,11 @@
>  #include "nv50/nv50_context.h"
>  #include "nv_object.xml.h"
>
> +#define NV50_QUERY_STATE_READY   0
> +#define NV50_QUERY_STATE_ACTIVE  1
> +#define NV50_QUERY_STATE_ENDED   2
> +#define NV50_QUERY_STATE_FLUSHED 3
> +
>  /* XXX: Nested queries, and simultaneous queries on multiple gallium contexts
>   * (since we use only a single GPU channel per screen) will not work 
> properly.
>   *
> @@ -42,8 +47,7 @@ struct nv50_query {
> struct nouveau_bo *bo;
> uint32_t base;
> uint32_t offset; /* base + i * 32 */
> -   boolean ready;
> -   boolean flushed;
> +   uint8_t state;
> boolean is64bit;
> struct nouveau_mm_allocation *mm;
> struct nouveau_fence *fence;
> @@ -66,7 +70,7 @@ nv50_query_allocate(struct nv50_context *nv50, struct 
> nv50_query *q, int size)
> if (q->bo) {
>nouveau_bo_ref(NULL, &q->bo);
>if (q->mm) {
> - if (q->ready)
> + if (q->state == NV50_QUERY_STATE_READY)
>  nouveau_mm_free(q->mm);
>   else
>  nouveau_fence_work(screen->base.fence.current, 
> nouveau_mm_free_work,
> @@ -203,7 +207,7 @@ nv50_query_begin(struct pipe_context *pipe, struct 
> pipe_query *pq)
> default:
>break;
> }
> -   q->ready = FALSE;
> +   q->state = NV50_QUERY_STATE_ACTIVE;
> return true;
>  }
>
> @@ -214,6 +218,8 @@ nv50_query_end(struct pipe_context *pipe, struct 
> pipe_query *pq)
> struct nouveau_pushbuf *push = nv50->base.pushbuf;
> struct nv50_query *q = nv50_query(pq);
>
> +   q->state = NV50_QUERY_STATE_ENDED;
> +
> switch (q->type) {
> case PIPE_QUERY_OCCLUSION_COUNTER:
>nv50_query_get(push, q, 0, 0x0100f002);
> @@ -256,29 +262,27 @@ nv50_query_end(struct pipe_context *pipe, struct 
> pipe_query *pq)
>break;
> case PIPE_QUERY_TIMESTAMP_DISJOINT:
>/* This query is not issued on GPU because disjoint is forced to FALSE 
> */
> -  q->ready = TRUE;
> +  q->state = NV50_QUERY_STATE_READY;
>break;
> default:
>assert(0);
>break;
> }
> -   q->ready = q->flushed = FALSE;
>
> if (q->is64bit)
>nouveau_fence_ref(nv50->screen->base.fence.current, &q->fence);
>  }
>
> -static INLINE boolean
> -nv50_query_ready(struct nv50_query *q)
> +static INLINE void
> +nv50_query_update(struct nv50_query *q)
>  {
> if (q->is64bit) {
>if (nouveau_fence_signalled(q->fence))
> - return TRUE;
> + q->state = NV50_QUERY_STATE_READY;
> } else {
>if (q->data[0] == q->sequence)
> - return TRUE;
> + q->state = NV50_QUERY_STATE_READY;
> }
> -   return FALSE;
>  }
>
>  static boolean
> @@ -293,13 +297,14 @@ nv50_query_result(struct pipe_context *pipe, struct 
> pipe_query *pq,
> uint64_t *data64 = (uint64_t *)q->data;
> int i;
>
> -   if (!q->ready) /* update ? */
> -  q->ready = nv50_query_ready(q);
> -   if (!q->ready) {
> +   if (q->state != NV50_QUERY_STATE_READY)
> +  nv50_query_update(q);
> +
> +   if (q->state != NV50_QUERY_STATE_READY) {
>if (!wait) {
>   /* for broken apps that spin on GL_QUERY_RESULT_AVAILABLE */
> - if (!q->flushed) {
> -q->flushed = TRUE;
> + if (q->state != NV50_QUERY_STATE_FLUSHED) {
> +q->state = NV50_QUERY_STATE_FLUSHED;
>  PUSH_KICK(nv50->base.pushbuf);
>   }
>   return FALSE;
> @@ -307,7 +312,7 @@ nv50_query_result(struct pipe_context *pipe, struct 
> pipe_query *pq,
>if (nouveau_bo_wait(q->bo, NOUVEAU_BO_RD, nv50->screen->base.client))
>   return FALSE;
> }
> -   q->ready = TRUE;
> +   q->state = NV50_QUERY_STATE_READY;
>
> switch (q->type) {
> case PIPE_QUERY_GPU_FINISHED:
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c 
> b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
> new file mode 100644
> index 000..668f0fb
> --- /dev/null
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
> @@ -0,0 +1,798 @@
> +/*
> + * Copyright 2011 Nouveau Project
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documen

[Mesa-dev] [PATCH] nv50: fix PIPE_QUERY_TIMESTAMP_DISJOINT, based on nvc0

2015-05-23 Thread Samuel Pitoiset
PIPE_QUERY_TIMESTAMP_DISJOINT could not work because q->ready was always
set to FALSE. To fix this issue, add more different states for queries
according to nvc0.

Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/nouveau/nv50/nv50_query.c  |  39 +-
 .../drivers/nouveau/nvc0/nvc0_query_hw_sm.c| 798 +
 2 files changed, 820 insertions(+), 17 deletions(-)
 create mode 100644 src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_query.c 
b/src/gallium/drivers/nouveau/nv50/nv50_query.c
index da41209..55fcac8 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_query.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_query.c
@@ -27,6 +27,11 @@
 #include "nv50/nv50_context.h"
 #include "nv_object.xml.h"
 
+#define NV50_QUERY_STATE_READY   0
+#define NV50_QUERY_STATE_ACTIVE  1
+#define NV50_QUERY_STATE_ENDED   2
+#define NV50_QUERY_STATE_FLUSHED 3
+
 /* XXX: Nested queries, and simultaneous queries on multiple gallium contexts
  * (since we use only a single GPU channel per screen) will not work properly.
  *
@@ -42,8 +47,7 @@ struct nv50_query {
struct nouveau_bo *bo;
uint32_t base;
uint32_t offset; /* base + i * 32 */
-   boolean ready;
-   boolean flushed;
+   uint8_t state;
boolean is64bit;
struct nouveau_mm_allocation *mm;
struct nouveau_fence *fence;
@@ -66,7 +70,7 @@ nv50_query_allocate(struct nv50_context *nv50, struct 
nv50_query *q, int size)
if (q->bo) {
   nouveau_bo_ref(NULL, &q->bo);
   if (q->mm) {
- if (q->ready)
+ if (q->state == NV50_QUERY_STATE_READY)
 nouveau_mm_free(q->mm);
  else
 nouveau_fence_work(screen->base.fence.current, 
nouveau_mm_free_work,
@@ -203,7 +207,7 @@ nv50_query_begin(struct pipe_context *pipe, struct 
pipe_query *pq)
default:
   break;
}
-   q->ready = FALSE;
+   q->state = NV50_QUERY_STATE_ACTIVE;
return true;
 }
 
@@ -214,6 +218,8 @@ nv50_query_end(struct pipe_context *pipe, struct pipe_query 
*pq)
struct nouveau_pushbuf *push = nv50->base.pushbuf;
struct nv50_query *q = nv50_query(pq);
 
+   q->state = NV50_QUERY_STATE_ENDED;
+
switch (q->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
   nv50_query_get(push, q, 0, 0x0100f002);
@@ -256,29 +262,27 @@ nv50_query_end(struct pipe_context *pipe, struct 
pipe_query *pq)
   break;
case PIPE_QUERY_TIMESTAMP_DISJOINT:
   /* This query is not issued on GPU because disjoint is forced to FALSE */
-  q->ready = TRUE;
+  q->state = NV50_QUERY_STATE_READY;
   break;
default:
   assert(0);
   break;
}
-   q->ready = q->flushed = FALSE;
 
if (q->is64bit)
   nouveau_fence_ref(nv50->screen->base.fence.current, &q->fence);
 }
 
-static INLINE boolean
-nv50_query_ready(struct nv50_query *q)
+static INLINE void
+nv50_query_update(struct nv50_query *q)
 {
if (q->is64bit) {
   if (nouveau_fence_signalled(q->fence))
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
} else {
   if (q->data[0] == q->sequence)
- return TRUE;
+ q->state = NV50_QUERY_STATE_READY;
}
-   return FALSE;
 }
 
 static boolean
@@ -293,13 +297,14 @@ nv50_query_result(struct pipe_context *pipe, struct 
pipe_query *pq,
uint64_t *data64 = (uint64_t *)q->data;
int i;
 
-   if (!q->ready) /* update ? */
-  q->ready = nv50_query_ready(q);
-   if (!q->ready) {
+   if (q->state != NV50_QUERY_STATE_READY)
+  nv50_query_update(q);
+
+   if (q->state != NV50_QUERY_STATE_READY) {
   if (!wait) {
  /* for broken apps that spin on GL_QUERY_RESULT_AVAILABLE */
- if (!q->flushed) {
-q->flushed = TRUE;
+ if (q->state != NV50_QUERY_STATE_FLUSHED) {
+q->state = NV50_QUERY_STATE_FLUSHED;
 PUSH_KICK(nv50->base.pushbuf);
  }
  return FALSE;
@@ -307,7 +312,7 @@ nv50_query_result(struct pipe_context *pipe, struct 
pipe_query *pq,
   if (nouveau_bo_wait(q->bo, NOUVEAU_BO_RD, nv50->screen->base.client))
  return FALSE;
}
-   q->ready = TRUE;
+   q->state = NV50_QUERY_STATE_READY;
 
switch (q->type) {
case PIPE_QUERY_GPU_FINISHED:
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
new file mode 100644
index 000..668f0fb
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query_hw_sm.c
@@ -0,0 +1,798 @@
+/*
+ * Copyright 2011 Nouveau Project
+ *
+ * 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 co

Re: [Mesa-dev] [PATCH 2/2] clover: try userptr for CL_MEM_USE_HOST_PTR

2015-05-23 Thread Francisco Jerez
Grigori Goronzy  writes:

> According to spec, CL_MEM_USE_HOST_PTR should directly use host memory,
> if possible. This is just what userptr is for, so use it.
>
> In case the memory cannot be mapped, a fallback similar to
> CL_MEM_COPY_HOST_PTR is used.
> ---
>  src/gallium/state_trackers/clover/core/memory.cpp   |  2 +-
>  src/gallium/state_trackers/clover/core/resource.cpp | 17 ++---
>  2 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/core/memory.cpp 
> b/src/gallium/state_trackers/clover/core/memory.cpp
> index 905ebc0..055336a 100644
> --- a/src/gallium/state_trackers/clover/core/memory.cpp
> +++ b/src/gallium/state_trackers/clover/core/memory.cpp
> @@ -30,7 +30,7 @@ memory_obj::memory_obj(clover::context &ctx, cl_mem_flags 
> flags,
> size_t size, void *host_ptr) :
> context(ctx), _flags(flags),
> _size(size), _host_ptr(host_ptr) {
> -   if (flags & (CL_MEM_COPY_HOST_PTR | CL_MEM_USE_HOST_PTR))
> +   if (flags & CL_MEM_COPY_HOST_PTR)
>data.append((char *)host_ptr, size);
>  }
>  
> diff --git a/src/gallium/state_trackers/clover/core/resource.cpp 
> b/src/gallium/state_trackers/clover/core/resource.cpp
> index 8ed4c42..8e51b3c 100644
> --- a/src/gallium/state_trackers/clover/core/resource.cpp
> +++ b/src/gallium/state_trackers/clover/core/resource.cpp
> @@ -118,6 +118,8 @@ root_resource::root_resource(clover::device &dev, 
> memory_obj &obj,
>   command_queue &q, const std::string &data) :
> resource(dev, obj) {
> pipe_resource info {};
> +   bool user_ptr_support = (bool)dev.pipe->get_param(dev.pipe,

Let's make this variable "const", and remove the cast to bool, it
shouldn't be necessary.  With that fixed:
Reviewed-by: Francisco Jerez 

> + PIPE_CAP_RESOURCE_FROM_USER_MEMORY);
>  
> if (image *img = dynamic_cast(&obj)) {
>info.format = translate_format(img->format());
> @@ -137,7 +139,15 @@ root_resource::root_resource(clover::device &dev, 
> memory_obj &obj,
>  PIPE_BIND_TRANSFER_READ |
>  PIPE_BIND_TRANSFER_WRITE);
>  
> -   if (obj.flags() & CL_MEM_ALLOC_HOST_PTR) {
> +   if (obj.flags() & CL_MEM_USE_HOST_PTR && user_ptr_support) {
> +  // Page alignment is normally required for this, just try, hope for the
> +  // best and fall back if it fails.
> +  pipe = dev.pipe->resource_from_user_memory(dev.pipe, &info, 
> obj.host_ptr());
> +  if (pipe)
> + return;
> +   }
> +
> +   if (obj.flags() & (CL_MEM_ALLOC_HOST_PTR | CL_MEM_USE_HOST_PTR)) {
>info.usage = PIPE_USAGE_STAGING;
> }
>  
> @@ -145,12 +155,13 @@ root_resource::root_resource(clover::device &dev, 
> memory_obj &obj,
> if (!pipe)
>throw error(CL_OUT_OF_RESOURCES);
>  
> -   if (!data.empty()) {
> +   if (obj.flags() & (CL_MEM_USE_HOST_PTR | CL_MEM_COPY_HOST_PTR)) {
> +  const void *data_ptr = !data.empty() ? data.data() : obj.host_ptr();
>box rect { {{ 0, 0, 0 }}, {{ info.width0, info.height0, info.depth0 }} 
> };
>unsigned cpp = util_format_get_blocksize(info.format);
>  
>q.pipe->transfer_inline_write(q.pipe, pipe, 0, PIPE_TRANSFER_WRITE,
> -rect, data.data(), cpp * info.width0,
> +rect, data_ptr, cpp * info.width0,
>  cpp * info.width0 * info.height0);
> }
>  }
> -- 
> 1.9.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH 1/2] clover: implement CL_MEM_ALLOC_HOST_PTR

2015-05-23 Thread Francisco Jerez
Grigori Goronzy  writes:

> This flag is typically used to request pinned host memory, to avoid
> any copies between GPU and CPU.
>
> This improves throughput with an older OpenCL app which I unfortunately
> can't publish due to its licensing.
> ---
>  src/gallium/state_trackers/clover/core/resource.cpp | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/core/resource.cpp 
> b/src/gallium/state_trackers/clover/core/resource.cpp
> index bcf87e1..8ed4c42 100644
> --- a/src/gallium/state_trackers/clover/core/resource.cpp
> +++ b/src/gallium/state_trackers/clover/core/resource.cpp
> @@ -137,6 +137,10 @@ root_resource::root_resource(clover::device &dev, 
> memory_obj &obj,
>  PIPE_BIND_TRANSFER_READ |
>  PIPE_BIND_TRANSFER_WRITE);
>  
> +   if (obj.flags() & CL_MEM_ALLOC_HOST_PTR) {
> +  info.usage = PIPE_USAGE_STAGING;
> +   }
> +

Thank you,
Reviewed-by: Francisco Jerez 

> pipe = dev.pipe->resource_create(dev.pipe, &info);
> if (!pipe)
>throw error(CL_OUT_OF_RESOURCES);
> -- 
> 1.9.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH 01/15] egl: remove unused _egl_global::ClientExtensions

2015-05-23 Thread Marek Olšák
Ping.

Nobody has given me Reviewed-by for this series yet.

Marek

On Wed, May 13, 2015 at 12:54 AM, Marek Olšák  wrote:
> From: Marek Olšák 
>
> ---
>  src/egl/main/eglglobals.c | 10 --
>  src/egl/main/eglglobals.h |  9 -
>  2 files changed, 19 deletions(-)
>
> diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
> index 129bf29..884cff0 100644
> --- a/src/egl/main/eglglobals.c
> +++ b/src/egl/main/eglglobals.c
> @@ -50,16 +50,6 @@ struct _egl_global _eglGlobal =
>_eglFiniDisplay
> },
>
> -   /* ClientExtensions */
> -   {
> -  true, /* EGL_EXT_client_extensions */
> -  true, /* EGL_EXT_platform_base */
> -  true, /* EGL_EXT_platform_x11 */
> -  true, /* EGL_EXT_platform_wayland */
> -  true, /* EGL_MESA_platform_gbm */
> -  true, /* EGL_KHR_client_get_all_proc_addresses */
> -   },
> -
> /* ClientExtensionsString */
> "EGL_EXT_client_extensions"
> " EGL_EXT_platform_base"
> diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h
> index 04b9609..ae1b75b 100644
> --- a/src/egl/main/eglglobals.h
> +++ b/src/egl/main/eglglobals.h
> @@ -50,15 +50,6 @@ struct _egl_global
> EGLint NumAtExitCalls;
> void (*AtExitCalls[10])(void);
>
> -   struct _egl_client_extensions {
> -  bool EXT_client_extensions;
> -  bool EXT_platform_base;
> -  bool EXT_platform_x11;
> -  bool EXT_platform_wayland;
> -  bool MESA_platform_gbm;
> -  bool KHR_get_all_proc_addresses;
> -   } ClientExtensions;
> -
> const char *ClientExtensionString;
>  };
>
> --
> 2.1.0
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] egl: import egl.h from registry (v2)

2015-05-23 Thread Marek Olšák
From: Marek Olšák 

v2: split the commit into 3 patches
---
 include/EGL/egl.h | 562 ++
 1 file changed, 268 insertions(+), 294 deletions(-)

diff --git a/include/EGL/egl.h b/include/EGL/egl.h
index 99ea342..0d514e4 100644
--- a/include/EGL/egl.h
+++ b/include/EGL/egl.h
@@ -1,11 +1,12 @@
-/* -*- mode: c; tab-width: 8; -*- */
-/* vi: set sw=4 ts=8: */
-/* Reference version of egl.h for EGL 1.4.
- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
- */
+#ifndef __egl_h_
+#define __egl_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /*
-** Copyright (c) 2007-2009 The Khronos Group Inc.
+** Copyright (c) 2013-2014 The Khronos Group Inc.
 **
 ** Permission is hereby granted, free of charge, to any person obtaining a
 ** copy of this software and/or associated documentation files (the
@@ -26,304 +27,277 @@
 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
 */
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 31039 $ on $Date: 2015-05-04 17:01:57 -0700 (Mon, 04 May 
2015) $
+*/
 
-#ifndef __egl_h_
-#define __egl_h_
-
-/* All platform-dependent types and macro boilerplate (such as EGLAPI
- * and EGLAPIENTRY) should go in eglplatform.h.
- */
 #include 
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+/* Generated on date 20150504 */
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
 
-/* EGL Types */
-/* EGLint is defined in eglplatform.h */
+#ifndef EGL_VERSION_1_0
+#define EGL_VERSION_1_0 1
 typedef unsigned int EGLBoolean;
-typedef unsigned int EGLenum;
-typedef void *EGLConfig;
-typedef void *EGLContext;
 typedef void *EGLDisplay;
+#include 
+#include 
+typedef void *EGLConfig;
 typedef void *EGLSurface;
-typedef void *EGLClientBuffer;
-
-/* EGL Versioning */
-#define EGL_VERSION_1_01
-#define EGL_VERSION_1_11
-#define EGL_VERSION_1_21
-#define EGL_VERSION_1_31
-#define EGL_VERSION_1_41
-
-/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
- * enums are assigned unique values starting at 0x3000.
- */
-
-/* EGL aliases */
-#define EGL_FALSE  0
-#define EGL_TRUE   1
-
-/* Out-of-band handle values */
-#define EGL_DEFAULT_DISPLAY((EGLNativeDisplayType)0)
-#define EGL_NO_CONTEXT ((EGLContext)0)
-#define EGL_NO_DISPLAY ((EGLDisplay)0)
-#define EGL_NO_SURFACE ((EGLSurface)0)
-
-/* Out-of-band attribute value */
-#define EGL_DONT_CARE  ((EGLint)-1)
-
-/* Errors / GetError return values */
-#define EGL_SUCCESS0x3000
-#define EGL_NOT_INITIALIZED0x3001
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC  0x3003
-#define EGL_BAD_ATTRIBUTE  0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT0x3006
-#define EGL_BAD_CURRENT_SURFACE0x3007
-#define EGL_BAD_DISPLAY0x3008
-#define EGL_BAD_MATCH  0x3009
-#define EGL_BAD_NATIVE_PIXMAP  0x300A
-#define EGL_BAD_NATIVE_WINDOW  0x300B
-#define EGL_BAD_PARAMETER  0x300C
-#define EGL_BAD_SURFACE0x300D
-#define EGL_CONTEXT_LOST   0x300E  /* EGL 1.1 - 
IMG_power_management */
-
-/* Reserved 0x300F-0x301F for additional errors */
-
-/* Config attributes */
-#define EGL_BUFFER_SIZE0x3020
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BLUE_SIZE  0x3022
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_RED_SIZE   0x3024
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_STENCIL_SIZE   0x3026
-#define EGL_CONFIG_CAVEAT  0x3027
-#define EGL_CONFIG_ID  0x3028
-#define EGL_LEVEL  0x3029
-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
-#define EGL_MAX_PBUFFER_PIXELS 0x302B
-#define EGL_MAX_PBUFFER_WIDTH  0x302C
-#define EGL_NATIVE_RENDERABLE  0x302D
-#define EGL_NATIVE_VISUAL_ID   0x302E
-#define EGL_NATIVE_VISUAL_TYPE 0x302F
-#define EGL_SAMPLES0x3031
-#define EGL_SAMPLE_BUFFERS 0x3032
-#define EGL_SURFACE_TYPE   0x3033
-#define EGL_TRANSPARENT_TYPE   0x3034
-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
-#define EGL_TRANSPARENT_

[Mesa-dev] [PATCH 2/3] egl: import eglext.h from registry and cleanup eglmesaext.h (v2)

2015-05-23 Thread Marek Olšák
From: Marek Olšák 

v2: include mesa and chromium extensions in eglext.h so as not to break
existing users
---
 include/EGL/eglext.h | 258 ---
 include/EGL/eglmesaext.h |  34 ---
 2 files changed, 246 insertions(+), 46 deletions(-)

diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
index 88b39db..6043b37 100644
--- a/include/EGL/eglext.h
+++ b/include/EGL/eglext.h
@@ -6,7 +6,7 @@ extern "C" {
 #endif
 
 /*
-** Copyright (c) 2013 The Khronos Group Inc.
+** Copyright (c) 2013-2014 The Khronos Group Inc.
 **
 ** Permission is hereby granted, free of charge, to any person obtaining a
 ** copy of this software and/or associated documentation files (the
@@ -33,12 +33,12 @@ extern "C" {
 ** used to make the header, and the header can be found at
 **   http://www.opengl.org/registry/
 **
-** Khronos $Revision: 24567 $ on $Date: 2013-12-18 09:50:17 -0800 (Wed, 18 Dec 
2013) $
+** Khronos $Revision$ on $Date$
 */
 
 #include 
 
-#define EGL_EGLEXT_VERSION 20131218
+#define EGL_EGLEXT_VERSION 20150508
 
 /* Generated C header for:
  * API: egl
@@ -94,12 +94,28 @@ EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR 
(EGLDisplay dpy, EGLenum type,
 #define EGL_OPENGL_ES3_BIT_KHR0x0040
 #endif /* EGL_KHR_create_context */
 
+#ifndef EGL_KHR_create_context_no_error
+#define EGL_KHR_create_context_no_error 1
+#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR   0x31B3
+#endif /* EGL_KHR_create_context_no_error */
+
 #ifndef EGL_KHR_fence_sync
 #define EGL_KHR_fence_sync 1
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
 #ifdef KHRONOS_SUPPORT_INT64
 #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
 #define EGL_SYNC_CONDITION_KHR0x30F8
 #define EGL_SYNC_FENCE_KHR0x30F9
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, 
EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, 
EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, 
EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, 
EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, 
const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR 
sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR 
sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR 
sync, EGLint attribute, EGLint *value);
+#endif
 #endif /* KHRONOS_SUPPORT_INT64 */
 #endif /* EGL_KHR_fence_sync */
 
@@ -207,9 +223,38 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR 
(EGLDisplay dpy, EGLSurface s
 #endif
 #endif /* EGL_KHR_lock_surface3 */
 
+#ifndef EGL_KHR_partial_update
+#define EGL_KHR_partial_update 1
+#define EGL_BUFFER_AGE_KHR0x313D
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay 
dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, 
EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_KHR_partial_update */
+
+#ifndef EGL_KHR_platform_android
+#define EGL_KHR_platform_android 1
+#define EGL_PLATFORM_ANDROID_KHR  0x3141
+#endif /* EGL_KHR_platform_android */
+
+#ifndef EGL_KHR_platform_gbm
+#define EGL_KHR_platform_gbm 1
+#define EGL_PLATFORM_GBM_KHR  0x31D7
+#endif /* EGL_KHR_platform_gbm */
+
+#ifndef EGL_KHR_platform_wayland
+#define EGL_KHR_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_KHR  0x31D8
+#endif /* EGL_KHR_platform_wayland */
+
+#ifndef EGL_KHR_platform_x11
+#define EGL_KHR_platform_x11 1
+#define EGL_PLATFORM_X11_KHR  0x31D5
+#define EGL_PLATFORM_X11_SCREEN_KHR   0x31D6
+#endif /* EGL_KHR_platform_x11 */
+
 #ifndef EGL_KHR_reusable_sync
 #define EGL_KHR_reusable_sync 1
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
 #ifdef KHRONOS_SUPPORT_INT64
 #define EGL_SYNC_STATUS_KHR   0x30F1
 #define EGL_SIGNALED_KHR  0x30F2
@@ -221,17 +266,9 @@ typedef khronos_utime_nanoseconds_t EGLTimeKHR;
 #define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR   0x0001
 #define EGL_FOREVER_KHR   0xull
 #define EGL_NO_SYNC_KHR   ((EGLSyncKHR)0)
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, 
EGLenum type, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, 
EGLSyncKHR sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, 
EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, 
EGLSyncKHR sync, EGLenum mode)

[Mesa-dev] [PATCH 3/3] egl: import platform headers from registry (v2)

2015-05-23 Thread Marek Olšák
From: Marek Olšák 

v2: don't remove local Mesa changes
---
 include/EGL/eglplatform.h | 19 +--
 include/KHR/khrplatform.h | 19 ---
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index 2eb6865..7802542 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -2,7 +2,7 @@
 #define __eglplatform_h_
 
 /*
-** Copyright (c) 2007-2009 The Khronos Group Inc.
+** Copyright (c) 2007-2013 The Khronos Group Inc.
 **
 ** Permission is hereby granted, free of charge, to any person obtaining a
 ** copy of this software and/or associated documentation files (the
@@ -25,7 +25,7 @@
 */
 
 /* Platform-specific types and definitions for egl.h
- * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
+ * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
  *
  * Adopters may modify khrplatform.h and this file to suit their platform.
  * You are encouraged to submit all modifications to the Khronos group so that
@@ -77,7 +77,7 @@ typedef HDC EGLNativeDisplayType;
 typedef HBITMAP EGLNativePixmapType;
 typedef HWNDEGLNativeWindowType;
 
-#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
+#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__)  /* 
Symbian */
 
 typedef int   EGLNativeDisplayType;
 typedef void *EGLNativeWindowType;
@@ -95,14 +95,15 @@ typedef struct gbm_device  *EGLNativeDisplayType;
 typedef struct gbm_bo  *EGLNativePixmapType;
 typedef void   *EGLNativeWindowType;
 
-#elif defined(ANDROID) /* Android */
+#elif defined(__ANDROID__) || defined(ANDROID)
+
+#include 
 
-struct ANativeWindow;
 struct egl_native_pixmap_t;
 
-typedef struct ANativeWindow*EGLNativeWindowType;
-typedef struct egl_native_pixmap_t  *EGLNativePixmapType;
-typedef void*EGLNativeDisplayType;
+typedef struct ANativeWindow*   EGLNativeWindowType;
+typedef struct egl_native_pixmap_t* EGLNativePixmapType;
+typedef void*   EGLNativeDisplayType;
 
 #elif defined(__unix__)
 
@@ -131,9 +132,7 @@ typedef khronos_uintptr_tEGLNativePixmapType;
 typedef khronos_uintptr_t   EGLNativeWindowType;
 
 #else
-
 #error "Platform not recognized"
-
 #endif
 
 /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
diff --git a/include/KHR/khrplatform.h b/include/KHR/khrplatform.h
index 4479539..790de44 100644
--- a/include/KHR/khrplatform.h
+++ b/include/KHR/khrplatform.h
@@ -26,7 +26,7 @@
 
 /* Khronos platform-specific types and definitions.
  *
- * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
  *
  * Adopters may modify this file to suit their platform. Adopters are
  * encouraged to submit platform specific modifications to the Khronos
@@ -106,9 +106,9 @@
 #elif defined (__SYMBIAN32__)
 #   define KHRONOS_APICALL IMPORT_C
 #elif (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \
-   || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+   || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 /* KHRONOS_APIATTRIBUTES is not used by the client API headers yet */
-#  define KHRONOS_APICALL __attribute__((visibility("default")))
+#   define KHRONOS_APICALL __attribute__((visibility("default")))
 #else
 #   define KHRONOS_APICALL
 #endif
@@ -229,10 +229,23 @@ typedef signed   char  khronos_int8_t;
 typedef unsigned char  khronos_uint8_t;
 typedef signed   short int khronos_int16_t;
 typedef unsigned short int khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64, 
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
+#ifdef _WIN64
+typedef signed   long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed   long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
 typedef signed   long  int khronos_intptr_t;
 typedef unsigned long  int khronos_uintptr_t;
 typedef signed   long  int khronos_ssize_t;
 typedef unsigned long  int khronos_usize_t;
+#endif
 
 #if KHRONOS_SUPPORT_FLOAT
 /*
-- 
2.1.0

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


[Mesa-dev] [Bug 90600] IOError: [Errno 2] No such file or directory: 'gl_API.xml'

2015-05-23 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=90600

Vinson Lee  changed:

   What|Removed |Added

   Keywords||bisected
 CC||matts...@gmail.com

--- Comment #6 from Vinson Lee  ---
cf718cc964f86dc49c1fc9ed5e39aa5bd87ad931 is the first bad commit
commit cf718cc964f86dc49c1fc9ed5e39aa5bd87ad931
Author: Dylan Baker 
Date:   Wed Nov 19 13:36:35 2014 -0800

glapi: gl_table.py: replace getopt with argparse.

This results in slightly less code, but code that is much more readable.
It has the advantage of putting everything together in one place, all of
the code is self documenting, help messages are auto-generated, choices
are automatically enforced, and the syntax is much less C like, taking
advantage of python features and idioms.

Signed-off-by: Dylan Baker 
Acked-by: Matt Turner 

:04 04 8ced3859bc44a3f2a5cf9d247139b57b6285fc51
4ba8ea55200c5fcdcce7480dbecca41d8f9f88e4 Msrc
bisect run success

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