[Mesa-dev] [Bug 103062] Error starting game FS17

2017-10-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103062

--- Comment #9 from alexander  ---
And another OpenGL context for compatibility me 3.0 and Shader 1.30.

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


[Mesa-dev] [Bug 103062] Error starting game FS17

2017-10-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103062

--- Comment #8 from alexander  ---
> The thread has nothing to do with using Core vs Compat GL context.
> I suggest focusing on that - it's the first key obstacle.

Compat for compatibility with older devices.
In Innovations added to Mesa core.
4.5 COMPAT there is support for OpenGL 4.5, Shader 4.50.

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


[Mesa-dev] [PATCH 3/4] radeonsi: use postponed KILL only when derivatives are used

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_shader.c  | 3 +--
 src/gallium/drivers/radeonsi/si_shader.h  | 1 +
 src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 2 +-
 src/gallium/drivers/radeonsi/si_state_shaders.c   | 6 ++
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 8abacac..c343048 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5839,22 +5839,21 @@ static bool si_compile_tgsi_main(struct 
si_shader_context *ctx,
 
if (ctx->type == PIPE_SHADER_GEOMETRY) {
int i;
for (i = 0; i < 4; i++) {
ctx->gs_next_vertex[i] =
lp_build_alloca(>gallivm,
ctx->i32, "");
}
}
 
-   if (ctx->type == PIPE_SHADER_FRAGMENT && sel->info.uses_kill &&
-   ctx->screen->b.debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL)) {
+   if (sel->force_correct_derivs_after_kill) {
ctx->postponed_kill = lp_build_alloca_undef(>gallivm, 
ctx->i1, "");
/* true = don't kill. */
LLVMBuildStore(ctx->ac.builder, LLVMConstInt(ctx->i1, 1, 0),
   ctx->postponed_kill);
}
 
if (sel->tokens) {
if (!lp_build_tgsi_llvm(bld_base, sel->tokens)) {
fprintf(stderr, "Failed to translate shader from TGSI 
to LLVM\n");
return false;
diff --git a/src/gallium/drivers/radeonsi/si_shader.h 
b/src/gallium/drivers/radeonsi/si_shader.h
index ebe956e..78a2ee1 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -337,20 +337,21 @@ struct si_shader_selector {
 
struct tgsi_token   *tokens;
struct nir_shader   *nir;
struct pipe_stream_output_info  so;
struct tgsi_shader_info info;
struct tgsi_tessctrl_info   tcs_info;
 
/* PIPE_SHADER_[VERTEX|FRAGMENT|...] */
unsignedtype;
boolvs_needs_prolog;
+   boolforce_correct_derivs_after_kill;
unsignedpa_cl_vs_out_cntl;
ubyte   clipdist_mask;
ubyte   culldist_mask;
 
/* GS parameters. */
unsignedesgs_itemsize;
unsignedgs_input_verts_per_prim;
unsignedgs_output_prim;
unsignedgs_max_out_vertices;
unsignedgs_num_invocations;
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
index ad7a42f..283a889 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
@@ -61,21 +61,21 @@ static void kil_emit(const struct lp_build_tgsi_action 
*action,
LLVMBuilderRef builder = ctx->ac.builder;
LLVMValueRef visible;
 
if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL_IF) {
visible = emit_data->args[0];
} else {
assert(emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL);
visible = LLVMConstInt(ctx->i1, false, 0);
}
 
-   if (ctx->postponed_kill) {
+   if (ctx->shader->selector->force_correct_derivs_after_kill) {
LLVMValueRef mask = LLVMBuildLoad(builder, ctx->postponed_kill, 
"");
mask = LLVMBuildAnd(builder, mask, visible, "");
LLVMBuildStore(builder, mask, ctx->postponed_kill);
return;
}
 
ac_build_kill_if_false(>ac, visible);
 }
 
 static void emit_icmp(const struct lp_build_tgsi_action *action,
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c 
b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 9340328..af7f6ec 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -2045,20 +2045,26 @@ static void *si_create_shader_selector(struct 
pipe_context *ctx,
sel->enabled_streamout_buffer_mask |=
(1 << sel->so.output[i].output_buffer) <<
(sel->so.output[i].stream * 4);
}
 
/* The prolog is a no-op if there are no inputs. */
sel->vs_needs_prolog = sel->type == PIPE_SHADER_VERTEX &&
   sel->info.num_inputs &&
   
!sel->info.properties[TGSI_PROPERTY_VS_BLIT_SGPRS];
 
+   sel->force_correct_derivs_after_kill =
+   sel->type == PIPE_SHADER_FRAGMENT &&
+   sel->info.uses_derivatives &&
+   sel->info.uses_kill &&
+   sctx->screen->b.debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL);
+
/* Set which opcode uses which (i,j) pair. 

[Mesa-dev] [PATCH 1/4] ac: replace ac_build_kill with ac_build_kill_if_false

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

This will be a new LLVM intrinsic and will also work nicely with
llvm.amdgcn.wqm.vote.
---
 src/amd/common/ac_llvm_build.c| 19 +++--
 src/amd/common/ac_llvm_build.h|  2 +-
 src/amd/common/ac_nir_to_llvm.c   | 16 ++--
 src/gallium/drivers/radeonsi/si_shader.c  | 48 +++
 src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 42 
 5 files changed, 49 insertions(+), 78 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 949f181..752c42e 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1398,34 +1398,27 @@ LLVMValueRef ac_build_cvt_pkrtz_f16(struct 
ac_llvm_context *ctx,
   v2f16, args, 2,
   AC_FUNC_ATTR_READNONE);
return LLVMBuildBitCast(ctx->builder, res, ctx->i32, "");
}
 
return ac_build_intrinsic(ctx, "llvm.SI.packf16", ctx->i32, args, 2,
  AC_FUNC_ATTR_READNONE |
  AC_FUNC_ATTR_LEGACY);
 }
 
-/**
- * KILL, AKA discard in GLSL.
- *
- * \param value  kill if value < 0.0 or value == NULL.
- */
-void ac_build_kill(struct ac_llvm_context *ctx, LLVMValueRef value)
+void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef i1)
 {
-   if (value) {
-   ac_build_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt,
-  , 1, AC_FUNC_ATTR_LEGACY);
-   } else {
-   ac_build_intrinsic(ctx, "llvm.AMDGPU.kilp", ctx->voidt,
-  NULL, 0, AC_FUNC_ATTR_LEGACY);
-   }
+   LLVMValueRef value = LLVMBuildSelect(ctx->builder, i1,
+LLVMConstReal(ctx->f32, 1),
+LLVMConstReal(ctx->f32, -1), "");
+   ac_build_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt,
+  , 1, AC_FUNC_ATTR_LEGACY);
 }
 
 LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
  LLVMValueRef offset, LLVMValueRef width,
  bool is_signed)
 {
LLVMValueRef args[] = {
input,
offset,
width,
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index f0b5875..b721782 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -258,21 +258,21 @@ struct ac_image_args {
LLVMValueRef addr;
unsigned dmask;
bool unorm;
bool da;
 };
 
 LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
   struct ac_image_args *a);
 LLVMValueRef ac_build_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
LLVMValueRef args[2]);
-void ac_build_kill(struct ac_llvm_context *ctx, LLVMValueRef value);
+void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef i1);
 LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
  LLVMValueRef offset, LLVMValueRef width,
  bool is_signed);
 
 void ac_get_image_intr_name(const char *base_name,
LLVMTypeRef data_type,
LLVMTypeRef coords_type,
LLVMTypeRef rsrc_type,
char *out_name, unsigned out_len);
 
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 3ba3ebf..c1490a5 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -3614,28 +3614,24 @@ static void emit_barrier(struct nir_to_llvm_context 
*ctx)
}
ac_build_intrinsic(>ac, "llvm.amdgcn.s.barrier",
   ctx->voidt, NULL, 0, AC_FUNC_ATTR_CONVERGENT);
 }
 
 static void emit_discard_if(struct ac_nir_context *ctx,
const nir_intrinsic_instr *instr)
 {
LLVMValueRef cond;
 
-   cond = LLVMBuildICmp(ctx->ac.builder, LLVMIntNE,
+   cond = LLVMBuildICmp(ctx->ac.builder, LLVMIntEQ,
 get_src(ctx, instr->src[0]),
 ctx->ac.i32_0, "");
-
-   cond = LLVMBuildSelect(ctx->ac.builder, cond,
-  LLVMConstReal(ctx->ac.f32, -1.0f),
-  ctx->ac.f32_0, "");
-   ac_build_kill(>ac, cond);
+   ac_build_kill_if_false(>ac, cond);
 }
 
 static LLVMValueRef
 visit_load_local_invocation_index(struct nir_to_llvm_context *ctx)
 {
LLVMValueRef result;
LLVMValueRef thread_id = ac_get_thread_id(>ac);
result = LLVMBuildAnd(ctx->builder, ctx->tg_size,
  LLVMConstInt(ctx->i32, 0xfc0, false), "");
 
@@ -3856,41 +3852,37 @@ static LLVMValueRef visit_interp(struct 

[Mesa-dev] [PATCH 4/4] radeonsi: postponed KILL isn't postponed anymore, but maintains WQM

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

This restores performance for the drirc workaround, i.e.
KILL_IF does:
   visible = src0 >= 0;
   kill_flag &= visible; // accumulate kills
   amdgcn_kill(wqm_vote(visible)); // kill fully dead quads only

And all helper pixels are killed at the end of the shader:
   amdgcn_kill(kill_flag);
---
 src/amd/common/ac_llvm_build.c| 7 +++
 src/amd/common/ac_llvm_build.h| 1 +
 src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 6 ++
 3 files changed, 14 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 0550f80..2f8f59f 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1398,20 +1398,27 @@ LLVMValueRef ac_build_cvt_pkrtz_f16(struct 
ac_llvm_context *ctx,
   v2f16, args, 2,
   AC_FUNC_ATTR_READNONE);
return LLVMBuildBitCast(ctx->builder, res, ctx->i32, "");
}
 
return ac_build_intrinsic(ctx, "llvm.SI.packf16", ctx->i32, args, 2,
  AC_FUNC_ATTR_READNONE |
  AC_FUNC_ATTR_LEGACY);
 }
 
+LLVMValueRef ac_build_wqm_vote(struct ac_llvm_context *ctx, LLVMValueRef i1)
+{
+   assert(HAVE_LLVM >= 0x0600);
+   return ac_build_intrinsic(ctx, "llvm.amdgcn.wqm.vote", ctx->i1,
+ , 1, AC_FUNC_ATTR_READNONE);
+}
+
 void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef i1)
 {
if (HAVE_LLVM >= 0x0600) {
ac_build_intrinsic(ctx, "llvm.amdgcn.kill", ctx->voidt,
   , 1, 0);
return;
}
 
LLVMValueRef value = LLVMBuildSelect(ctx->builder, i1,
 LLVMConstReal(ctx->f32, 1),
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index b721782..088a986 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -258,20 +258,21 @@ struct ac_image_args {
LLVMValueRef addr;
unsigned dmask;
bool unorm;
bool da;
 };
 
 LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
   struct ac_image_args *a);
 LLVMValueRef ac_build_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
LLVMValueRef args[2]);
+LLVMValueRef ac_build_wqm_vote(struct ac_llvm_context *ctx, LLVMValueRef i1);
 void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef i1);
 LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
  LLVMValueRef offset, LLVMValueRef width,
  bool is_signed);
 
 void ac_get_image_intr_name(const char *base_name,
LLVMTypeRef data_type,
LLVMTypeRef coords_type,
LLVMTypeRef rsrc_type,
char *out_name, unsigned out_len);
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
index 283a889..913b6c3 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
@@ -62,20 +62,26 @@ static void kil_emit(const struct lp_build_tgsi_action 
*action,
LLVMValueRef visible;
 
if (emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL_IF) {
visible = emit_data->args[0];
} else {
assert(emit_data->inst->Instruction.Opcode == TGSI_OPCODE_KILL);
visible = LLVMConstInt(ctx->i1, false, 0);
}
 
if (ctx->shader->selector->force_correct_derivs_after_kill) {
+   /* LLVM 6.0 can kill immediately while maintaining WQM. */
+   if (HAVE_LLVM >= 0x0600) {
+   ac_build_kill_if_false(>ac,
+  ac_build_wqm_vote(>ac, 
visible));
+   }
+
LLVMValueRef mask = LLVMBuildLoad(builder, ctx->postponed_kill, 
"");
mask = LLVMBuildAnd(builder, mask, visible, "");
LLVMBuildStore(builder, mask, ctx->postponed_kill);
return;
}
 
ac_build_kill_if_false(>ac, visible);
 }
 
 static void emit_icmp(const struct lp_build_tgsi_action *action,
-- 
2.7.4

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


[Mesa-dev] [PATCH 2/4] ac: use llvm.amdgcn.kill with LLVM 6.0

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/amd/common/ac_llvm_build.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 752c42e..0550f80 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1400,20 +1400,26 @@ LLVMValueRef ac_build_cvt_pkrtz_f16(struct 
ac_llvm_context *ctx,
return LLVMBuildBitCast(ctx->builder, res, ctx->i32, "");
}
 
return ac_build_intrinsic(ctx, "llvm.SI.packf16", ctx->i32, args, 2,
  AC_FUNC_ATTR_READNONE |
  AC_FUNC_ATTR_LEGACY);
 }
 
 void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef i1)
 {
+   if (HAVE_LLVM >= 0x0600) {
+   ac_build_intrinsic(ctx, "llvm.amdgcn.kill", ctx->voidt,
+  , 1, 0);
+   return;
+   }
+
LLVMValueRef value = LLVMBuildSelect(ctx->builder, i1,
 LLVMConstReal(ctx->f32, 1),
 LLVMConstReal(ctx->f32, -1), "");
ac_build_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt,
   , 1, AC_FUNC_ATTR_LEGACY);
 }
 
 LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
  LLVMValueRef offset, LLVMValueRef width,
  bool is_signed)
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 1/2] meson: provide Makefile.sources variables to meson build

2017-10-13 Thread Dylan Baker
I'm not sure about this approach, we would need a way to add depends to meson,
but I'm also worried that calling make adds another dependency that could be
problematic for windows, and I really don't like the idea of having a
half-and-half approach with the sources.

Here's what I've been playing with:
https://github.com/dcbaker/meson/tree/make-import-module
https://github.com/dcbaker/mesa/tree/wip/meson-makefile-sources

How would you feel about that?

Dylan

Quoting Scott D Phillips (2017-10-13 16:26:07)
> ---
> Caveat: meson won't pick up modifications to the Makefile.sources
> files without something like:
> 
> https://github.com/mesonbuild/meson/pull/2490
> 
>  bin/get-makefile-sources-vars.py | 50 +++
>  meson.build  | 85 
> 
>  2 files changed, 135 insertions(+)
>  create mode 100755 bin/get-makefile-sources-vars.py
> 
> diff --git a/bin/get-makefile-sources-vars.py 
> b/bin/get-makefile-sources-vars.py
> new file mode 100755
> index 00..1f6b432d1b
> --- /dev/null
> +++ b/bin/get-makefile-sources-vars.py
> @@ -0,0 +1,50 @@
> +#!/usr/bin/env python
> +
> +from __future__ import print_function
> +
> +import collections
> +import os
> +import multiprocessing
> +import subprocess
> +import re
> +import sys
> +
> +# matches variables that contain .c, .cpp, or .h filenames
> +VAR_RE = re.compile(r'^(\w+)\s*:?=\s*(.*\.(c|cpp|h).*)$')
> +
> +# matches makefile variable references
> +REF_RE = re.compile(r'\$\(([^)]*)\)')
> +
> +def get_vars(makefile):
> +out = subprocess.check_output('make -f {0} -n -p -R -r 
> {0}'.format(makefile), shell=True, env={})
> +res = {}
> +for o in out.splitlines():
> +m = VAR_RE.match(o)
> +if not m:
> +continue
> +res[m.group(1)] = m.group(2)
> +for var in res.keys():
> +m = REF_RE.search(res[var])

You should be using res.items() here.

> +while m:
> +res[var] = res[var][:m.start()] + res.get(m.group(1), '') + 
> res[var][m.end():]
> +m = REF_RE.search(res[var])
> +return (makefile, res)
> +
> +def main(makefiles):
> +p = multiprocessing.Pool()
> +make_vars = p.imap_unordered(get_vars, makefiles)
> +p.close()

You need to join the pool as well.

> +srcdir = os.sep.join(__file__.split(os.sep)[:-2] + ['src'])
> +for makefile, vars in make_vars:
> +if makefile.startswith(srcdir):
> +makefile = makefile[len(srcdir):]
> +prefix = '_'.join(makefile.split(os.sep)[1:-1]) + '_'
> +prefix = prefix.replace('-', '_')
> +for name, val in vars.items():
> +name = prefix + name
> +print(name)
> +print(val)
> +return 0
> +
> +if __name__ == '__main__':
> +sys.exit(main(sys.argv[1:]))
> diff --git a/meson.build b/meson.build
> index 02264aeed4..8c675e2624 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -665,5 +665,90 @@ inc_include = include_directories('include')
>  
>  pkg = import('pkgconfig')
>  
> +makefile_sources_vars = run_command('bin/get-makefile-sources-vars.py',
> +files(
> +'src/amd/Makefile.sources',
> +'src/amd/vulkan/Makefile.sources',
> +'src/broadcom/Makefile.sources',
> +'src/compiler/Makefile.sources',
> +'src/egl/Makefile.sources',
> +'src/gallium/auxiliary/Makefile.sources',
> +'src/gallium/auxiliary/pipe-loader/Makefile.sources',
> +'src/gallium/drivers/ddebug/Makefile.sources',
> +'src/gallium/drivers/etnaviv/Makefile.sources',
> +'src/gallium/drivers/freedreno/Makefile.sources',
> +'src/gallium/drivers/i915/Makefile.sources',
> +'src/gallium/drivers/llvmpipe/Makefile.sources',
> +'src/gallium/drivers/noop/Makefile.sources',
> +'src/gallium/drivers/nouveau/Makefile.sources',
> +'src/gallium/drivers/pl111/Makefile.sources',
> +'src/gallium/drivers/r300/Makefile.sources',
> +'src/gallium/drivers/r600/Makefile.sources',
> +'src/gallium/drivers/radeon/Makefile.sources',
> +'src/gallium/drivers/radeonsi/Makefile.sources',
> +'src/gallium/drivers/rbug/Makefile.sources',
> +'src/gallium/drivers/softpipe/Makefile.sources',
> +'src/gallium/drivers/svga/Makefile.sources',
> +'src/gallium/drivers/swr/Makefile.sources',
> +'src/gallium/drivers/trace/Makefile.sources',
> +'src/gallium/drivers/vc4/Makefile.sources',
> +'src/gallium/drivers/vc5/Makefile.sources',
> +'src/gallium/drivers/virgl/Makefile.sources',
> +'src/gallium/state_trackers/clover/Makefile.sources',
> +'src/gallium/state_trackers/dri/Makefile.sources',
> +'src/gallium/state_trackers/glx/xlib/Makefile.sources',
> +'src/gallium/state_trackers/nine/Makefile.sources',
> +'src/gallium/state_trackers/omx_bellagio/Makefile.sources',
> +

Re: [Mesa-dev] [PATCH] vulkan/wsi: Free the event in x11_manage_fifo_queues().

2017-10-13 Thread Lionel Landwerlin

Reviewed-by: Lionel Landwerlin 
---
I should still have commit access.
---
  src/vulkan/wsi/wsi_common_x11.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index ecdaf91..22b067b 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -939,6 +939,7 @@ x11_manage_fifo_queues(void *state)
  goto fail;
  
   result = x11_handle_dri3_present_event(chain, (void *)event);

+ free(event);
   if (result != VK_SUCCESS)
  goto fail;
}



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


Re: [Mesa-dev] [PATCH] mapi/shared-glapi/test: rework glapitable.h handling

2017-10-13 Thread Dylan Baker
Quoting Emil Velikov (2017-10-13 13:20:37)
> On 13 October 2017 at 19:13, Dylan Baker  wrote:
> > Quoting Emil Velikov (2017-10-13 08:35:47)
> >> From: Emil Velikov 
> >>
> >> Currently all the build systems but Meson generate the header in
> >> src/mapi/glapi. Meson cannot do that since:
> >>  - it does not allow user control over the location of output files
> >>  - moving the generation rule(s) causes explosion due to the unusual
> >> structure of glapi and friends
> >>  - copying the file into the correct location is a non-trivial task
> >>
> >> To workaround the above deficiency in the least invasive way, let's
> >> adjust the #include directive and add a few -I flags to the autotools
> >> build.
> >>
> >> Note: both builddir and srcdir, should be used. Otherwise building from
> >> a release tarball fails badly.
> >>
> >> Cc: Dylan Baker 
> >> Signed-off-by: Emil Velikov 
> >> ---
> >> Dylan seems like glapi_gentable.c dependency tracking is broken/missing.
> >> Furthermore the tests seems to be broken on Meson even w/o my revert :-(
> >> ---
> >>  src/mapi/Makefile.am| 5 +++--
> >>  src/mapi/shared-glapi/tests/check_table.cpp | 2 +-
> >>  2 files changed, 4 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
> >> index 83e32d2185e..3f8fcc02e55 100644
> >> --- a/src/mapi/Makefile.am
> >> +++ b/src/mapi/Makefile.am
> >> @@ -47,7 +47,9 @@ AM_CPPFLAGS =
> >>  \
> >> -I$(top_srcdir)/include \
> >> -I$(top_srcdir)/src \
> >> -I$(top_builddir)/src/mapi  \
> >> -   -I$(top_srcdir)/src/mapi
> >> +   -I$(top_srcdir)/src/mapi\
> >> +   -I$(top_builddir)/src/mapi/glapi\
> >> +   -I$(top_srcdir)/src/mapi/glapi
> >>
> >>  include Makefile.sources
> >>
> >> @@ -113,7 +115,6 @@ endif
> >>  glapi_libglapi_la_SOURCES =
> >>  glapi_libglapi_la_CPPFLAGS = \
> >> $(AM_CPPFLAGS) \
> >> -   -I$(top_srcdir)/src/mapi/glapi \
> >> -I$(top_srcdir)/src/mesa
> >>
> >>  if HAVE_APPLEDRI
> >> diff --git a/src/mapi/shared-glapi/tests/check_table.cpp 
> >> b/src/mapi/shared-glapi/tests/check_table.cpp
> >> index 02d313c22d3..314e6769b49 100644
> >> --- a/src/mapi/shared-glapi/tests/check_table.cpp
> >> +++ b/src/mapi/shared-glapi/tests/check_table.cpp
> >> @@ -25,7 +25,7 @@
> >>  #include "../../../mesa/main/glheader.h"
> >>
> >>  #include "glapi/glapi.h"
> >> -#include "glapi/glapitable.h"
> >> +#include "glapitable.h"
> >>
> >>  struct name_offset {
> >> const char *name;
> >> --
> >> 2.14.1
> >>
> >> ___
> >> mesa-dev mailing list
> >> mesa-dev@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> >
> > I went ahead and pushed this, it has review and testing and this will 
> > unbreak
> > our CI. Thanks for looking into this.
> >
> Thanks for that, just came back from dinner.
> You're right, I should not have reverted w/o checking with you. I was
> not expecting that you'll immediately switch to Meson.
> 
> Looking at Martin Peres' talk at XDC I'm wondering ...
> 
> Can one convince Jenkins to send a lovely email to the list if things break?
> Sort of like how Appveyor does it. It should safe you guys some time.
> 
> -Emil

We haven't switched yet, but we run a build test job, we also run one for scons
and for a larger slice of mesa than we use for our actual testing, which is
i965, i915, and anv. 

I'll talk to Mark and see what's possible as far as emailing the list.

Dylan


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


Re: [Mesa-dev] [PATCH] meson: build mesa test.

2017-10-13 Thread Dylan Baker
Quoting Eric Anholt (2017-10-13 16:58:01)
> Dylan Baker  writes:
> 
> > Signed-off-by: Dylan Baker 
> > ---
> >  src/mesa/main/tests/meson.build | 44 
> > +
> >  src/mesa/meson.build|  3 +++
> >  2 files changed, 47 insertions(+)
> >  create mode 100644 src/mesa/main/tests/meson.build
> >
> > diff --git a/src/mesa/main/tests/meson.build 
> > b/src/mesa/main/tests/meson.build
> > new file mode 100644
> > index 000..cac87d8dcac
> > --- /dev/null
> > +++ b/src/mesa/main/tests/meson.build
> > @@ -0,0 +1,44 @@
> > +# Copyright © 2017 Intel Corporation
> > +
> > +# Permission is hereby granted, free of charge, to any person obtaining a 
> > copy
> > +# of this software and associated documentation files (the "Software"), to 
> > deal
> > +# in the Software without restriction, including without limitation the 
> > rights
> > +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > +# copies of the Software, and to permit persons to whom the Software is
> > +# furnished to do so, subject to the following conditions:
> > +
> > +# The above copyright notice and this permission notice shall be included 
> > in
> > +# all copies or substantial portions of the Software.
> > +
> > +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
> > OR
> > +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
> > THE
> > +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> > FROM,
> > +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
> > IN THE
> > +# SOFTWARE.
> > +
> > +files_main_test = files('enum_strings.cpp')
> > +link_main_test = []
> > +
> > +if with_shared_glapi
> > +  files_main_test += files(
> > +'dispatch_sanity.cpp',
> > +'mesa_formats.cpp',
> > +'mesa_extensions.cpp',
> > +'program_state_string.cpp',
> > +  )
> > +  link_main_test += libglapi
> > +else
> > +  files_main_test += files('stub.cpp')
> > +endif
> > +
> > +main_test = executable(
> > +  'main_test',
> > +  files_main_test,
> > +  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa],
> > +  dependencies : [idep_gtest, dep_clock, dep_dl, dep_thread],
> > +  link_with : [libmesa_classic, link_main_test],
> > +)
> > +
> > +test('main-test', main_test)
> 
> I still find the extra temp variable strange.  Regardless,

I'll drop the temp variable before I push.

> Reviewed-by: Eric Anholt 

Thanks!

Dylan


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


Re: [Mesa-dev] [PATCH] meson: build mesa test.

2017-10-13 Thread Eric Anholt
Dylan Baker  writes:

> Signed-off-by: Dylan Baker 
> ---
>  src/mesa/main/tests/meson.build | 44 
> +
>  src/mesa/meson.build|  3 +++
>  2 files changed, 47 insertions(+)
>  create mode 100644 src/mesa/main/tests/meson.build
>
> diff --git a/src/mesa/main/tests/meson.build b/src/mesa/main/tests/meson.build
> new file mode 100644
> index 000..cac87d8dcac
> --- /dev/null
> +++ b/src/mesa/main/tests/meson.build
> @@ -0,0 +1,44 @@
> +# Copyright © 2017 Intel Corporation
> +
> +# Permission is hereby granted, free of charge, to any person obtaining a 
> copy
> +# of this software and associated documentation files (the "Software"), to 
> deal
> +# in the Software without restriction, including without limitation the 
> rights
> +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> +# copies of the Software, and to permit persons to whom the Software is
> +# furnished to do so, subject to the following conditions:
> +
> +# The above copyright notice and this permission notice shall be included in
> +# all copies or substantial portions of the Software.
> +
> +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
> FROM,
> +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
> THE
> +# SOFTWARE.
> +
> +files_main_test = files('enum_strings.cpp')
> +link_main_test = []
> +
> +if with_shared_glapi
> +  files_main_test += files(
> +'dispatch_sanity.cpp',
> +'mesa_formats.cpp',
> +'mesa_extensions.cpp',
> +'program_state_string.cpp',
> +  )
> +  link_main_test += libglapi
> +else
> +  files_main_test += files('stub.cpp')
> +endif
> +
> +main_test = executable(
> +  'main_test',
> +  files_main_test,
> +  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa],
> +  dependencies : [idep_gtest, dep_clock, dep_dl, dep_thread],
> +  link_with : [libmesa_classic, link_main_test],
> +)
> +
> +test('main-test', main_test)

I still find the extra temp variable strange.  Regardless,

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH v3 10/21] meson: split and simplify dependencies

2017-10-13 Thread Dylan Baker
Quoting Eric Anholt (2017-10-13 16:27:55)
> Dylan Baker  writes:
> 
> > Rather than group dependencies in complex groups, use a flatter
> > structure with split dependencies to avoid checking for the same
> > dependencies twice.
> >
> > v2: - Fix building vulkan drivers without gallium or dri drivers
> > v3: - Drop TODO comment that is done
> > - Fix typo in commit message
> 
> Note: Had previously said that with the comment change, r-b.

Oops, you did, and I didn't apply your rb.


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


Re: [Mesa-dev] MESA and KOTOR

2017-10-13 Thread Miklós Máté

Hello!

I'm sorry for being late to the party.

The patch you linked did land in mesa: 
https://cgit.freedesktop.org/mesa/mesa/commit/?id=baab345b192d207236253ce67b320fb32fa67625 
However, that area of the code has since been altered a lot.


Back then I made sure that KOTOR ran perfectly with Wine+Mesa on Linux, 
and it's still the case (thanks Marek for maintaining my code!). The 
only hardware driver I can test it with is radeonsi though. With 
llvmpipe the game runs, but it has limitations: the post-process effects 
have to be turned off or it dies with X error (BadMatch for X_PutImage), 
texture effects are ugly due to insufficient precision, and it's 
horribly slow (around 2fps on my Phenom II x4).


Federico, if the game runs well on your system with llvmpipe when the 
post-process effects are disabled, I recommend that you leave it that 
way. Framebuffer effects and soft shadows look cool, but they are 
resource hogs, and even if you managed to fix them the performance would 
be quite bad. Even on radeonsi they halve the fps.


I hope my $0.02 was useful.

MM

On 27/09/17 10:31, Federico Dossena wrote:
Yes his work was on radeonsi, but the patch that he says fixes the 
crash with framebuffer effects and soft shadows was in the state 
tracker. Link: https://patchwork.freedesktop.org/patch/68298/


The patch never made it to master, and the files touched seem to have 
changed a lot since he made this patch, so it does not apply. I tried 
to make some changes myself but I don't really know what I'm doing 
here to be honest.


Do you know what I could do to get the same behaviour?

Thanks


On 2017-09-27 10:25, Marek Olšák wrote:

Pbuffers are problematic because it's an ancient feature that nobody
cares about anymore.

I think Miklos made KOTOR work on radeonsi or r600.

Marek

On Mon, Sep 25, 2017 at 6:50 PM, Federico Dossena 
 wrote:

Hello everyone,
you may remember that a few months ago I was trying to fix KOTOR to 
work

with Mesa to use the Gallium llvmpipe software renderer.

Well, it's been a while and I'm happy to see that things are a bit 
better

with Mesa 17.2. The game still crashes, but we're closer to fixing it.

Here's what I found using 17.2.1:
With frame buffer effects and soft shadows the game crashes at the 
end of
loading; the crash is inside a function that amongst other things, 
generates
mipmaps for a texture used in a pbuffer (function at offset 2FB37D 
in my

exe).
The crash happens when gluBuild2DMipmaps is called, however doesn't 
seem to

be a null pointer like it was back in march: it's an access violation
alright but no longer a null pointer. So I think it's a different, 
hopefully

simpler, problem.

Back in march, Miklòs Màté suggested that changing the checks for 
the pixel

format could fix the problem, and he was right; without those checks we
definitely got a step closer to fixing it.

My first thought was to just NOP the entire section that generates 
mipmaps
and a bit of code later that uses it. The game no longer crashes, 
however it
displays nothing, but I can hear it running in background. So this 
is the

last issue! We're almost there!

Now, I'm bothering you again because I think that at this point it's 
just a
problem with the texture format used there. The call to 
gluBuild2DMipmaps
uses LuminanceAlpha' as texture format as well as internal format 
(0x190a).
I tried changing it to RGB and RGBA just to try something, but that 
didn't
work because I guess the texture was already generated with another 
format.


What could I do to investigate this further? And where should I look 
inside
Mesa if I wanted to say... force a specific texture format for 
pbuffers?


I feel that we're very close to fixing this. Your help would mean 
the world

to me and the whole KOTOR community.

Thank you ;)

P.S.
This has nothing to do with mesa, but you should know that KOTOR is 
slowly
dieing. It is currently unplayable on Intel and AMD graphics, and 
recent
nVidia driver updates have introduced a glitch with transparencies 
(it can
be fixed, but still, no one can play KOTOR on modern hardware 
properly and
we have to keep old computers as dedicated "shrines" for KOTOR, 
that's why I

insist so much on Mesa)


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



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



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


Re: [Mesa-dev] [PATCH v3 10/21] meson: split and simplify dependencies

2017-10-13 Thread Eric Anholt
Dylan Baker  writes:

> Rather than group dependencies in complex groups, use a flatter
> structure with split dependencies to avoid checking for the same
> dependencies twice.
>
> v2: - Fix building vulkan drivers without gallium or dri drivers
> v3: - Drop TODO comment that is done
> - Fix typo in commit message

Note: Had previously said that with the comment change, r-b.


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


[Mesa-dev] [PATCH 2/2] i965: use Makefile.sources source list in meson build

2017-10-13 Thread Scott D Phillips
---
 src/mesa/drivers/dri/i965/meson.build | 114 +-
 1 file changed, 1 insertion(+), 113 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/meson.build 
b/src/mesa/drivers/dri/i965/meson.build
index 144a254bd6..0101c8b91b 100644
--- a/src/mesa/drivers/dri/i965/meson.build
+++ b/src/mesa/drivers/dri/i965/meson.build
@@ -18,119 +18,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-files_i965 = files(
-  'brw_binding_tables.c',
-  'brw_blorp.c',
-  'brw_blorp.h',
-  'brw_bufmgr.c',
-  'brw_bufmgr.h',
-  'brw_clear.c',
-  'brw_clip.c',
-  'brw_compute.c',
-  'brw_conditional_render.c',
-  'brw_context.c',
-  'brw_context.h',
-  'brw_cs.c',
-  'brw_cs.h',
-  'brw_curbe.c',
-  'brw_defines.h',
-  'brw_draw.c',
-  'brw_draw.h',
-  'brw_draw_upload.c',
-  'brw_ff_gs.c',
-  'brw_ff_gs_emit.c',
-  'brw_ff_gs.h',
-  'brw_formatquery.c',
-  'brw_gs.c',
-  'brw_gs.h',
-  'brw_gs_surface_state.c',
-  'brw_link.cpp',
-  'brw_meta_util.c',
-  'brw_meta_util.h',
-  'brw_misc_state.c',
-  'brw_multisample_state.h',
-  'brw_nir_uniforms.cpp',
-  'brw_object_purgeable.c',
-  'brw_pipe_control.c',
-  'brw_performance_query.h',
-  'brw_performance_query.c',
-  'brw_program.c',
-  'brw_program.h',
-  'brw_program_cache.c',
-  'brw_primitive_restart.c',
-  'brw_queryobj.c',
-  'brw_reset.c',
-  'brw_sf.c',
-  'brw_state.h',
-  'brw_state_upload.c',
-  'brw_structs.h',
-  'brw_surface_formats.c',
-  'brw_sync.c',
-  'brw_tcs.c',
-  'brw_tcs_surface_state.c',
-  'brw_tes.c',
-  'brw_tes_surface_state.c',
-  'brw_urb.c',
-  'brw_util.c',
-  'brw_util.h',
-  'brw_vs.c',
-  'brw_vs.h',
-  'brw_vs_surface_state.c',
-  'brw_wm.c',
-  'brw_wm.h',
-  'brw_wm_surface_state.c',
-  'gen4_blorp_exec.h',
-  'gen6_clip_state.c',
-  'gen6_constant_state.c',
-  'gen6_depth_state.c',
-  'gen6_multisample_state.c',
-  'gen6_queryobj.c',
-  'gen6_sampler_state.c',
-  'gen6_sol.c',
-  'gen6_urb.c',
-  'gen7_l3_state.c',
-  'gen7_misc_state.c',
-  'gen7_sol_state.c',
-  'gen7_urb.c',
-  'gen8_depth_state.c',
-  'gen8_multisample_state.c',
-  'hsw_queryobj.c',
-  'hsw_sol.c',
-  'intel_batchbuffer.c',
-  'intel_batchbuffer.h',
-  'intel_blit.c',
-  'intel_blit.h',
-  'intel_buffer_objects.c',
-  'intel_buffer_objects.h',
-  'intel_buffers.c',
-  'intel_buffers.h',
-  'intel_copy_image.c',
-  'intel_extensions.c',
-  'intel_fbo.c',
-  'intel_fbo.h',
-  'intel_image.h',
-  'intel_mipmap_tree.c',
-  'intel_mipmap_tree.h',
-  'intel_pixel_bitmap.c',
-  'intel_pixel.c',
-  'intel_pixel_copy.c',
-  'intel_pixel_draw.c',
-  'intel_pixel.h',
-  'intel_pixel_read.c',
-  'intel_screen.c',
-  'intel_screen.h',
-  'intel_state.c',
-  'intel_tex.c',
-  'intel_tex_copy.c',
-  'intel_tex.h',
-  'intel_tex_image.c',
-  'intel_tex_obj.h',
-  'intel_tex_validate.c',
-  'intel_tiled_memcpy.c',
-  'intel_tiled_memcpy.h',
-  'intel_upload.c',
-  'libdrm_macros.h',
-)
+files_i965 = files(mesa_drivers_dri_i965_i965_FILES.split())
 
 i965_gen_libs = []
 foreach v : ['40', '45', '50', '60', '70', '75', '80', '90', '100']
-- 
2.13.3

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


[Mesa-dev] [PATCH 1/2] meson: provide Makefile.sources variables to meson build

2017-10-13 Thread Scott D Phillips
---
Caveat: meson won't pick up modifications to the Makefile.sources
files without something like:

https://github.com/mesonbuild/meson/pull/2490

 bin/get-makefile-sources-vars.py | 50 +++
 meson.build  | 85 
 2 files changed, 135 insertions(+)
 create mode 100755 bin/get-makefile-sources-vars.py

diff --git a/bin/get-makefile-sources-vars.py b/bin/get-makefile-sources-vars.py
new file mode 100755
index 00..1f6b432d1b
--- /dev/null
+++ b/bin/get-makefile-sources-vars.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import collections
+import os
+import multiprocessing
+import subprocess
+import re
+import sys
+
+# matches variables that contain .c, .cpp, or .h filenames
+VAR_RE = re.compile(r'^(\w+)\s*:?=\s*(.*\.(c|cpp|h).*)$')
+
+# matches makefile variable references
+REF_RE = re.compile(r'\$\(([^)]*)\)')
+
+def get_vars(makefile):
+out = subprocess.check_output('make -f {0} -n -p -R -r 
{0}'.format(makefile), shell=True, env={})
+res = {}
+for o in out.splitlines():
+m = VAR_RE.match(o)
+if not m:
+continue
+res[m.group(1)] = m.group(2)
+for var in res.keys():
+m = REF_RE.search(res[var])
+while m:
+res[var] = res[var][:m.start()] + res.get(m.group(1), '') + 
res[var][m.end():]
+m = REF_RE.search(res[var])
+return (makefile, res)
+
+def main(makefiles):
+p = multiprocessing.Pool()
+make_vars = p.imap_unordered(get_vars, makefiles)
+p.close()
+srcdir = os.sep.join(__file__.split(os.sep)[:-2] + ['src'])
+for makefile, vars in make_vars:
+if makefile.startswith(srcdir):
+makefile = makefile[len(srcdir):]
+prefix = '_'.join(makefile.split(os.sep)[1:-1]) + '_'
+prefix = prefix.replace('-', '_')
+for name, val in vars.items():
+name = prefix + name
+print(name)
+print(val)
+return 0
+
+if __name__ == '__main__':
+sys.exit(main(sys.argv[1:]))
diff --git a/meson.build b/meson.build
index 02264aeed4..8c675e2624 100644
--- a/meson.build
+++ b/meson.build
@@ -665,5 +665,90 @@ inc_include = include_directories('include')
 
 pkg = import('pkgconfig')
 
+makefile_sources_vars = run_command('bin/get-makefile-sources-vars.py',
+files(
+'src/amd/Makefile.sources',
+'src/amd/vulkan/Makefile.sources',
+'src/broadcom/Makefile.sources',
+'src/compiler/Makefile.sources',
+'src/egl/Makefile.sources',
+'src/gallium/auxiliary/Makefile.sources',
+'src/gallium/auxiliary/pipe-loader/Makefile.sources',
+'src/gallium/drivers/ddebug/Makefile.sources',
+'src/gallium/drivers/etnaviv/Makefile.sources',
+'src/gallium/drivers/freedreno/Makefile.sources',
+'src/gallium/drivers/i915/Makefile.sources',
+'src/gallium/drivers/llvmpipe/Makefile.sources',
+'src/gallium/drivers/noop/Makefile.sources',
+'src/gallium/drivers/nouveau/Makefile.sources',
+'src/gallium/drivers/pl111/Makefile.sources',
+'src/gallium/drivers/r300/Makefile.sources',
+'src/gallium/drivers/r600/Makefile.sources',
+'src/gallium/drivers/radeon/Makefile.sources',
+'src/gallium/drivers/radeonsi/Makefile.sources',
+'src/gallium/drivers/rbug/Makefile.sources',
+'src/gallium/drivers/softpipe/Makefile.sources',
+'src/gallium/drivers/svga/Makefile.sources',
+'src/gallium/drivers/swr/Makefile.sources',
+'src/gallium/drivers/trace/Makefile.sources',
+'src/gallium/drivers/vc4/Makefile.sources',
+'src/gallium/drivers/vc5/Makefile.sources',
+'src/gallium/drivers/virgl/Makefile.sources',
+'src/gallium/state_trackers/clover/Makefile.sources',
+'src/gallium/state_trackers/dri/Makefile.sources',
+'src/gallium/state_trackers/glx/xlib/Makefile.sources',
+'src/gallium/state_trackers/nine/Makefile.sources',
+'src/gallium/state_trackers/omx_bellagio/Makefile.sources',
+'src/gallium/state_trackers/osmesa/Makefile.sources',
+'src/gallium/state_trackers/va/Makefile.sources',
+'src/gallium/state_trackers/vdpau/Makefile.sources',
+'src/gallium/state_trackers/wgl/Makefile.sources',
+'src/gallium/state_trackers/xa/Makefile.sources',
+'src/gallium/state_trackers/xvmc/Makefile.sources',
+'src/gallium/winsys/amdgpu/drm/Makefile.sources',
+'src/gallium/winsys/etnaviv/drm/Makefile.sources',
+'src/gallium/winsys/freedreno/drm/Makefile.sources',
+'src/gallium/winsys/i915/drm/Makefile.sources',
+'src/gallium/winsys/imx/drm/Makefile.sources',
+'src/gallium/winsys/nouveau/drm/Makefile.sources',
+'src/gallium/winsys/pl111/drm/Makefile.sources',
+'src/gallium/winsys/radeon/drm/Makefile.sources',
+

Re: [Mesa-dev] [PATCH v3 02/21] configure: commit test files

2017-10-13 Thread Eric Anholt
Dylan Baker  writes:

> These are currently auto-generated, but meson needs the same files, so
> lets commit them to reduce duplication.
>
> v3: - Rename .build to build-support

2, 3 are:

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH] amd/common: run the EarlyCSEMemSSA LLVM pass

2017-10-13 Thread Bas Nieuwenhuizen
r-b

On Thu, Oct 12, 2017 at 4:39 PM, Samuel Pitoiset
 wrote:
> It's recommended by the instruction combining pass, and
> RadeonSI also runs it. The code size should decrease but
> the number of register might increase a little bit.
>
> Though, after comparing the shader stats with DOW3, it
> appears that the number of registers has been decreased and
> it gives a very minor boost (~+1%).
>
> It also improves the raytracing Vulkan demo, 233->245 FPS
> and doesn't seem to affect any other demos.
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/common/ac_nir_to_llvm.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 11ba487f37..a700c0c875 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -6168,6 +6168,10 @@ static void ac_llvm_finalize_module(struct 
> nir_to_llvm_context * ctx)
> LLVMAddLICMPass(passmgr);
> LLVMAddAggressiveDCEPass(passmgr);
> LLVMAddCFGSimplificationPass(passmgr);
> +#if HAVE_LLVM >= 0x0400
> +   /* This is recommended by the instruction combining pass. */
> +   LLVMAddEarlyCSEMemSSAPass(passmgr);
> +#endif
> LLVMAddInstructionCombiningPass(passmgr);
>
> /* Run the pass */
> --
> 2.14.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: minor simplification in test_attachment_completeness()

2017-10-13 Thread Timothy Arceri

Reviewed-by: Timothy Arceri 

On 14/10/17 09:17, Brian Paul wrote:

We already have a pointer to the texture object.  Use it here.
---
  src/mesa/main/fbobject.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index db8c207..71e91f9 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -855,8 +855,7 @@ test_attachment_completeness(const struct gl_context *ctx, 
GLenum format,
* these textures to be used as a render target, this is done via
* GL_EXT_color_buffer(_half)_float with set of new sized types.
*/
- if (_mesa_is_gles(ctx) && (texImage->TexObject->_IsFloat ||
-texImage->TexObject->_IsHalfFloat)) {
+ if (_mesa_is_gles(ctx) && (texObj->_IsFloat || texObj->_IsHalfFloat)) 
{
  att_incomplete("bad internal format");
  att->Complete = GL_FALSE;
  return;


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


Re: [Mesa-dev] [PATCH 1/4] i965/gen10: Implement WaSampleOffsetIZ workaround

2017-10-13 Thread Rafael Antognolli
On Wed, Oct 04, 2017 at 09:25:57AM -0700, Rafael Antognolli wrote:
> Hi Anuj,
> 
> On Mon, Oct 02, 2017 at 04:07:57PM -0700, Anuj Phogat wrote:
> > WaFlushHangWhenNonPipelineStateAndMarkerStalled goes along
> > with WaSampleOffsetIZ. Both recommends the same.
> > 
> > Cc: mesa-sta...@lists.freedesktop.org
> > Signed-off-by: Anuj Phogat 
> > ---
> >  src/mesa/drivers/dri/i965/brw_context.h|  2 +
> >  src/mesa/drivers/dri/i965/brw_defines.h|  1 +
> >  src/mesa/drivers/dri/i965/brw_pipe_control.c   | 54 
> > ++
> >  src/mesa/drivers/dri/i965/gen8_multisample_state.c |  8 
> >  4 files changed, 65 insertions(+)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> > b/src/mesa/drivers/dri/i965/brw_context.h
> > index 92fc16de13..f0e8d562e9 100644
> > --- a/src/mesa/drivers/dri/i965/brw_context.h
> > +++ b/src/mesa/drivers/dri/i965/brw_context.h
> > @@ -1647,6 +1647,8 @@ void brw_emit_post_sync_nonzero_flush(struct 
> > brw_context *brw);
> >  void brw_emit_depth_stall_flushes(struct brw_context *brw);
> >  void gen7_emit_vs_workaround_flush(struct brw_context *brw);
> >  void gen7_emit_cs_stall_flush(struct brw_context *brw);
> > +void gen10_emit_wa_cs_stall_flush(struct brw_context *brw);
> > +void gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw);
> >  
> >  /* brw_queryformat.c */
> >  void brw_query_internal_format(struct gl_context *ctx, GLenum target,
> > diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
> > b/src/mesa/drivers/dri/i965/brw_defines.h
> > index 4abb790612..270cdf29db 100644
> > --- a/src/mesa/drivers/dri/i965/brw_defines.h
> > +++ b/src/mesa/drivers/dri/i965/brw_defines.h
> > @@ -1609,6 +1609,7 @@ enum brw_pixel_shader_coverage_mask_mode {
> >  #define GEN7_GPGPU_DISPATCHDIMY 0x2504
> >  #define GEN7_GPGPU_DISPATCHDIMZ 0x2508
> >  
> > +#define GEN7_CACHE_MODE_0   0x7000
> >  #define GEN7_CACHE_MODE_1   0x7004
> >  # define GEN9_FLOAT_BLEND_OPTIMIZATION_ENABLE (1 << 4)
> >  # define GEN8_HIZ_NP_PMA_FIX_ENABLE(1 << 11)
> > diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c 
> > b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> > index 460b8f73b6..6326957a7a 100644
> > --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c
> > +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> > @@ -278,6 +278,60 @@ gen7_emit_cs_stall_flush(struct brw_context *brw)
> > brw->workaround_bo, 0, 0);
> >  }
> >  
> > +static void
> > +brw_flush_write_caches(struct brw_context *brw) {
> > +   brw_emit_pipe_control_flush(brw, PIPE_CONTROL_CACHE_FLUSH_BITS);
> > +}
> > +
> > +static void
> > +brw_flush_read_caches(struct brw_context *brw) {
> > +   brw_emit_pipe_control_flush(brw, PIPE_CONTROL_CACHE_INVALIDATE_BITS);
> > +}
> > +
> > +/**
> > + * From Gen10 Workarounds page in h/w specs:
> > + * WaSampleOffsetIZ:
> > + * Prior to the 3DSTATE_SAMPLE_PATTERN driver must ensure there are no
> > + * markers in the pipeline by programming a PIPE_CONTROL with stall.
> > + */
> > +void
> > +gen10_emit_wa_cs_stall_flush(struct brw_context *brw)
> > +{
> > +   const struct gen_device_info *devinfo = >screen->devinfo;
> > +   assert(devinfo->gen == 10);
> > +   brw_emit_pipe_control_flush(brw,
> > +   PIPE_CONTROL_CS_STALL |
> > +   PIPE_CONTROL_STALL_AT_SCOREBOARD);
> > +}
> > +
> > +/**
> > + * From Gen10 Workarounds page in h/w specs:
> > + * WaSampleOffsetIZ:
> > + * When 3DSTATE_SAMPLE_PATTERN is programmed, driver must then issue an
> > + * MI_LOAD_REGISTER_IMM command to an offset between 0x7000 and 0x7FFF(SVL)
> > + * after the command to ensure the state has been delivered prior to any
> > + * command causing a marker in the pipeline.
> > + */
> > +void
> > +gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw)
> > +{
> > +   const struct gen_device_info *devinfo = >screen->devinfo;
> > +   assert(devinfo->gen == 10);
> > +
> > +   /* Before changing the value of CACHE_MODE_0 register, GFX pipeline must
> > +* be idle; i.e., full flush is required.
> > +*/
> > +   brw_flush_write_caches(brw);
> > +   brw_flush_read_caches(brw);
> > +
> > +   /* Write to CACHE_MODE_0 (0x7000) */
> > +   BEGIN_BATCH(3);
> > +   OUT_BATCH(MI_LOAD_REGISTER_IMM | (3 - 2));
> > +   OUT_BATCH(GEN7_CACHE_MODE_0);
> > +   OUT_BATCH(0);
> > +   ADVANCE_BATCH();
> > +}
> > +
> >  /**
> >   * Emits a PIPE_CONTROL with a non-zero post-sync operation, for
> >   * implementing two workarounds on gen6.  From section 1.4.7.1
> > diff --git a/src/mesa/drivers/dri/i965/gen8_multisample_state.c 
> > b/src/mesa/drivers/dri/i965/gen8_multisample_state.c
> > index 7a31a5df4a..14043025b6 100644
> > --- a/src/mesa/drivers/dri/i965/gen8_multisample_state.c
> > +++ b/src/mesa/drivers/dri/i965/gen8_multisample_state.c
> > @@ -49,6 +49,11 @@ gen8_emit_3dstate_multisample(struct brw_context *brw, 
> > 

Re: [Mesa-dev] [PATCH] radv: set correct INDEX_TYPE for indexed indirect draws on GFX9

2017-10-13 Thread Bas Nieuwenhuizen
r-b

On Fri, Oct 13, 2017 at 6:01 PM, Samuel Pitoiset
 wrote:
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/vulkan/radv_cmd_buffer.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c 
> b/src/amd/vulkan/radv_cmd_buffer.c
> index 78a250214a..c0fe12b489 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -3110,8 +3110,14 @@ radv_cmd_draw_indexed_indirect_count(
>
> MAYBE_UNUSED unsigned cdw_max = 
> radeon_check_space(cmd_buffer->device->ws, cmd_buffer->cs, 31 * MAX_VIEWS);
>
> -   radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_TYPE, 0, 0));
> -   radeon_emit(cmd_buffer->cs, cmd_buffer->state.index_type);
> +   if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX9) 
> {
> +   radeon_set_uconfig_reg_idx(cmd_buffer->cs,
> +  R_03090C_VGT_INDEX_TYPE,
> +  2, cmd_buffer->state.index_type);
> +   } else {
> +   radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_TYPE, 0, 0));
> +   radeon_emit(cmd_buffer->cs, cmd_buffer->state.index_type);
> +   }
>
> radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_BASE, 1, 0));
> radeon_emit(cmd_buffer->cs, index_va);
> --
> 2.14.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] radv: set correct INDEX_TYPE for indexed indirect draws on GFX9

2017-10-13 Thread Bas Nieuwenhuizen
r-b

On Fri, Oct 13, 2017 at 6:01 PM, Samuel Pitoiset
 wrote:
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/vulkan/radv_cmd_buffer.c | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c 
> b/src/amd/vulkan/radv_cmd_buffer.c
> index 78a250214a..c0fe12b489 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -3110,8 +3110,14 @@ radv_cmd_draw_indexed_indirect_count(
>
> MAYBE_UNUSED unsigned cdw_max = 
> radeon_check_space(cmd_buffer->device->ws, cmd_buffer->cs, 31 * MAX_VIEWS);
>
> -   radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_TYPE, 0, 0));
> -   radeon_emit(cmd_buffer->cs, cmd_buffer->state.index_type);
> +   if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX9) 
> {
> +   radeon_set_uconfig_reg_idx(cmd_buffer->cs,
> +  R_03090C_VGT_INDEX_TYPE,
> +  2, cmd_buffer->state.index_type);
> +   } else {
> +   radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_TYPE, 0, 0));
> +   radeon_emit(cmd_buffer->cs, cmd_buffer->state.index_type);
> +   }
>
> radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_BASE, 1, 0));
> radeon_emit(cmd_buffer->cs, index_va);
> --
> 2.14.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/4] radv: use CLEAR_STATE for initializing some registers

2017-10-13 Thread Bas Nieuwenhuizen
r-b for the series

On Wed, Oct 11, 2017 at 7:15 PM, Samuel Pitoiset
 wrote:
> Based on RadeonSI.
>
> This improves some Vulkan demos by +1% to +3%.
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/vulkan/si_cmd_buffer.c | 99 
> +-
>  1 file changed, 58 insertions(+), 41 deletions(-)
>
> diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c
> index 626b68ad8e..1e8b43d4fa 100644
> --- a/src/amd/vulkan/si_cmd_buffer.c
> +++ b/src/amd/vulkan/si_cmd_buffer.c
> @@ -332,15 +332,25 @@ si_emit_config(struct radv_physical_device 
> *physical_device,
>  {
> int i;
>
> +   /* Only SI can disable CLEAR_STATE for now. */
> +   assert(physical_device->has_clear_state ||
> +  physical_device->rad_info.chip_class == SI);
> +
> radeon_emit(cs, PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
> radeon_emit(cs, CONTEXT_CONTROL_LOAD_ENABLE(1));
> radeon_emit(cs, CONTEXT_CONTROL_SHADOW_ENABLE(1));
>
> +   if (physical_device->has_clear_state) {
> +   radeon_emit(cs, PKT3(PKT3_CLEAR_STATE, 1, 0));
> +   radeon_emit(cs, 0);
> +   }
> +
> if (physical_device->rad_info.chip_class <= VI)
> si_set_raster_config(physical_device, cs);
>
> radeon_set_context_reg(cs, R_028A18_VGT_HOS_MAX_TESS_LEVEL, fui(64));
> -   radeon_set_context_reg(cs, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, fui(0));
> +   if (!physical_device->has_clear_state)
> +   radeon_set_context_reg(cs, R_028A1C_VGT_HOS_MIN_TESS_LEVEL, 
> fui(0));
>
> /* FIXME calculate these values somehow ??? */
> if (physical_device->rad_info.chip_class <= VI) {
> @@ -348,16 +358,15 @@ si_emit_config(struct radv_physical_device 
> *physical_device,
> radeon_set_context_reg(cs, R_028A58_VGT_ES_PER_GS, 0x40);
> }
>
> -   radeon_set_context_reg(cs, R_028A5C_VGT_GS_PER_VS, 0x2);
> -
> -   radeon_set_context_reg(cs, R_028A8C_VGT_PRIMITIVEID_RESET, 0x0);
> -   radeon_set_context_reg(cs, R_028B28_VGT_STRMOUT_DRAW_OPAQUE_OFFSET, 
> 0);
> +   if (!physical_device->has_clear_state) {
> +   radeon_set_context_reg(cs, R_028A5C_VGT_GS_PER_VS, 0x2);
> +   radeon_set_context_reg(cs, R_028A8C_VGT_PRIMITIVEID_RESET, 
> 0x0);
> +   radeon_set_context_reg(cs, 
> R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0);
> +   }
>
> -   radeon_set_context_reg(cs, R_028B98_VGT_STRMOUT_BUFFER_CONFIG, 0x0);
> radeon_set_context_reg(cs, R_028AA0_VGT_INSTANCE_STEP_RATE_0, 1);
> -   if (physical_device->rad_info.chip_class >= GFX9)
> -   radeon_set_context_reg(cs, R_028AB4_VGT_REUSE_OFF, 0);
> -   radeon_set_context_reg(cs, R_028AB8_VGT_VTX_CNT_EN, 0x0);
> +   if (!physical_device->has_clear_state)
> +   radeon_set_context_reg(cs, R_028AB8_VGT_VTX_CNT_EN, 0x0);
> if (physical_device->rad_info.chip_class < CIK)
> radeon_set_config_reg(cs, R_008A14_PA_CL_ENHANCE, 
> S_008A14_NUM_CLIP_SEQ(3) |
>   S_008A14_CLIP_VTX_REORDER_ENA(1));
> @@ -365,30 +374,43 @@ si_emit_config(struct radv_physical_device 
> *physical_device,
> radeon_set_context_reg(cs, R_028BD4_PA_SC_CENTROID_PRIORITY_0, 
> 0x76543210);
> radeon_set_context_reg(cs, R_028BD8_PA_SC_CENTROID_PRIORITY_1, 
> 0xfedcba98);
>
> -   radeon_set_context_reg(cs, R_02882C_PA_SU_PRIM_FILTER_CNTL, 0);
> +   if (!physical_device->has_clear_state)
> +   radeon_set_context_reg(cs, R_02882C_PA_SU_PRIM_FILTER_CNTL, 
> 0);
>
> -   for (i = 0; i < 16; i++) {
> -   radeon_set_context_reg(cs, R_0282D0_PA_SC_VPORT_ZMIN_0 + i*8, 
> 0);
> -   radeon_set_context_reg(cs, R_0282D4_PA_SC_VPORT_ZMAX_0 + i*8, 
> fui(1.0));
> +   /* CLEAR_STATE doesn't clear these correctly on certain generations.
> +* I don't know why. Deduced by trial and error.
> +*/
> +   if (physical_device->rad_info.chip_class <= CIK) {
> +   radeon_set_context_reg(cs, 
> R_028B28_VGT_STRMOUT_DRAW_OPAQUE_OFFSET, 0);
> +   radeon_set_context_reg(cs, R_028204_PA_SC_WINDOW_SCISSOR_TL,
> +  S_028204_WINDOW_OFFSET_DISABLE(1));
> +   radeon_set_context_reg(cs, R_028240_PA_SC_GENERIC_SCISSOR_TL,
> +  S_028240_WINDOW_OFFSET_DISABLE(1));
> +   radeon_set_context_reg(cs, R_028244_PA_SC_GENERIC_SCISSOR_BR,
> +  S_028244_BR_X(16384) | 
> S_028244_BR_Y(16384));
> +   radeon_set_context_reg(cs, R_028030_PA_SC_SCREEN_SCISSOR_TL, 
> 0);
> +   radeon_set_context_reg(cs, R_028034_PA_SC_SCREEN_SCISSOR_BR,
> +  S_028034_BR_X(16384) | 
> S_028034_BR_Y(16384));
> +   }
> +
> +   if 

Re: [Mesa-dev] [PATCH V2 1/4] i965/gen10: Implement WaSampleOffsetIZ workaround

2017-10-13 Thread Rafael Antognolli
Hi Anuj, sorry that I missed this patch. Please see below.

On Fri, Oct 06, 2017 at 04:30:47PM -0700, Anuj Phogat wrote:
> There are few other (duplicate) workarounds which have similar 
> recommendations:
> WaFlushHangWhenNonPipelineStateAndMarkerStalled
> WaCSStallBefore3DSamplePattern
> WaPipeControlBefore3DStateSamplePattern
> 
> WaPipeControlBefore3DStateSamplePattern has some extra recommendations if
> driver is using mid batch context restore. Ignoring it for now because We're
> not doing mid-batch context restore in Mesa.
> 
> Cc: mesa-sta...@lists.freedesktop.org
> Cc: Jason Ekstrand 
> Cc: Rafael Antognolli 
> Signed-off-by: Anuj Phogat 
> ---
>  src/mesa/drivers/dri/i965/brw_context.h|  2 +
>  src/mesa/drivers/dri/i965/brw_defines.h|  1 +
>  src/mesa/drivers/dri/i965/brw_pipe_control.c   | 50 
> ++
>  src/mesa/drivers/dri/i965/gen8_multisample_state.c |  8 
>  4 files changed, 61 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 92fc16de13..f0e8d562e9 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -1647,6 +1647,8 @@ void brw_emit_post_sync_nonzero_flush(struct 
> brw_context *brw);
>  void brw_emit_depth_stall_flushes(struct brw_context *brw);
>  void gen7_emit_vs_workaround_flush(struct brw_context *brw);
>  void gen7_emit_cs_stall_flush(struct brw_context *brw);
> +void gen10_emit_wa_cs_stall_flush(struct brw_context *brw);
> +void gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw);
>  
>  /* brw_queryformat.c */
>  void brw_query_internal_format(struct gl_context *ctx, GLenum target,
> diff --git a/src/mesa/drivers/dri/i965/brw_defines.h 
> b/src/mesa/drivers/dri/i965/brw_defines.h
> index 4abb790612..270cdf29db 100644
> --- a/src/mesa/drivers/dri/i965/brw_defines.h
> +++ b/src/mesa/drivers/dri/i965/brw_defines.h
> @@ -1609,6 +1609,7 @@ enum brw_pixel_shader_coverage_mask_mode {
>  #define GEN7_GPGPU_DISPATCHDIMY 0x2504
>  #define GEN7_GPGPU_DISPATCHDIMZ 0x2508
>  
> +#define GEN7_CACHE_MODE_0   0x7000
>  #define GEN7_CACHE_MODE_1   0x7004
>  # define GEN9_FLOAT_BLEND_OPTIMIZATION_ENABLE (1 << 4)
>  # define GEN8_HIZ_NP_PMA_FIX_ENABLE(1 << 11)
> diff --git a/src/mesa/drivers/dri/i965/brw_pipe_control.c 
> b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> index 460b8f73b6..156f5c25ec 100644
> --- a/src/mesa/drivers/dri/i965/brw_pipe_control.c
> +++ b/src/mesa/drivers/dri/i965/brw_pipe_control.c
> @@ -278,6 +278,56 @@ gen7_emit_cs_stall_flush(struct brw_context *brw)
> brw->workaround_bo, 0, 0);
>  }
>  
> +static void
> +brw_flush_gpu_caches(struct brw_context *brw) {
> +   brw_emit_pipe_control_flush(brw,
> +   PIPE_CONTROL_CACHE_FLUSH_BITS |
> +   PIPE_CONTROL_CACHE_INVALIDATE_BITS);
> +}

This function is only calling another function without any extra logic, so I
would just call brw_emit_pipe_control_flush() and remove this declaration. But
that's just cosmetic.

With or without this change, this patch correctly implements the workaround
imho, so it is

Reviewed-by: Rafael Antognolli 

> +/**
> + * From Gen10 Workarounds page in h/w specs:
> + * WaSampleOffsetIZ:
> + * Prior to the 3DSTATE_SAMPLE_PATTERN driver must ensure there are no
> + * markers in the pipeline by programming a PIPE_CONTROL with stall.
> + */
> +void
> +gen10_emit_wa_cs_stall_flush(struct brw_context *brw)
> +{
> +   const struct gen_device_info *devinfo = >screen->devinfo;
> +   assert(devinfo->gen == 10);
> +   brw_emit_pipe_control_flush(brw,
> +   PIPE_CONTROL_CS_STALL |
> +   PIPE_CONTROL_STALL_AT_SCOREBOARD);
> +}
> +
> +/**
> + * From Gen10 Workarounds page in h/w specs:
> + * WaSampleOffsetIZ:
> + * When 3DSTATE_SAMPLE_PATTERN is programmed, driver must then issue an
> + * MI_LOAD_REGISTER_IMM command to an offset between 0x7000 and 0x7FFF(SVL)
> + * after the command to ensure the state has been delivered prior to any
> + * command causing a marker in the pipeline.
> + */
> +void
> +gen10_emit_wa_lri_to_cache_mode_zero(struct brw_context *brw)
> +{
> +   const struct gen_device_info *devinfo = >screen->devinfo;
> +   assert(devinfo->gen == 10);
> +
> +   /* Before changing the value of CACHE_MODE_0 register, GFX pipeline must
> +* be idle; i.e., full flush is required.
> +*/
> +   brw_flush_gpu_caches(brw);
> +
> +   /* Write to CACHE_MODE_0 (0x7000) */
> +   BEGIN_BATCH(3);
> +   OUT_BATCH(MI_LOAD_REGISTER_IMM | (3 - 2));
> +   OUT_BATCH(GEN7_CACHE_MODE_0);
> +   OUT_BATCH(0);
> +   ADVANCE_BATCH();
> +}
> +
>  /**
>   * Emits a PIPE_CONTROL with a non-zero post-sync operation, for
>   * implementing two workarounds 

[Mesa-dev] [Bug 103268] [llvmpipe] piglit texdepth regression

2017-10-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103268

Bug ID: 103268
   Summary: [llvmpipe] piglit texdepth regression
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: bisected, regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: mar...@gmail.com, nhaeh...@gmail.com

mesa: 77d3d71f23b32550b045b5f74b7a5e6ca54d83c5 (master 17.3.0-devel)

$ ./bin/texdepth -auto
GL_ARB_shadow_ambient not supported.
Illegal sampler view creation without bind flag
Probe color at (80,16)
  Expected: 0.00 0.00 0.00 1.00
  Observed: 1.00 1.00 1.00 1.00
Test failed: 'EXT_shadow_func: GL_LESS'
See above for details.

PIGLIT: {"result": "fail" }


be3ab867bd444594f9d9e0f8e59d305d15769afd is the first bad commit
commit be3ab867bd444594f9d9e0f8e59d305d15769afd
Author: Marek Olšák 
Date:   Mon Oct 2 22:30:55 2017 +0200

tgsi: implement tgsi_util_get_inst_usage_mask properly

All opcodes are handled.

Reviewed-by: Nicolai Hähnle 

:04 04 d1db49cee47cbe6ea3ac52d46bbf4a612f14d3be
11c3d50751b4c921bec7cf463e8c52d4162af19e M  src
bisect run success

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


Re: [Mesa-dev] [Mesa-stable] [PATCH] vulkan/wsi: Free the event in x11_manage_fifo_queues().

2017-10-13 Thread Henri Verbeet
On 13 October 2017 at 19:23, Emil Velikov  wrote:
> Please give it time for Vulkan devs to take a look.
>
Sure, I'm in no particular hurry.

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


[Mesa-dev] [PATCH] mesa: minor simplification in test_attachment_completeness()

2017-10-13 Thread Brian Paul
We already have a pointer to the texture object.  Use it here.
---
 src/mesa/main/fbobject.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index db8c207..71e91f9 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -855,8 +855,7 @@ test_attachment_completeness(const struct gl_context *ctx, 
GLenum format,
   * these textures to be used as a render target, this is done via
   * GL_EXT_color_buffer(_half)_float with set of new sized types.
   */
- if (_mesa_is_gles(ctx) && (texImage->TexObject->_IsFloat ||
-texImage->TexObject->_IsHalfFloat)) {
+ if (_mesa_is_gles(ctx) && (texObj->_IsFloat || texObj->_IsHalfFloat)) 
{
 att_incomplete("bad internal format");
 att->Complete = GL_FALSE;
 return;
-- 
1.9.1

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


[Mesa-dev] [AppVeyor] mesa master #5796 completed

2017-10-13 Thread AppVeyor


Build mesa 5796 completed



Commit 1cec500c69 by Jason Ekstrand on 10/13/2017 5:40 PM:

blob: Use intptr_t instead of ssize_t\n\nssize_t is a GNU extension and is not available on Windows or MacOS.\nInstead, we use intptr_t which should be effectively equivalent and is\npart of the C standard.  This should fix the Windows and Mac OS builds.\n\nFixes: 3af1c829891a4530682bce113fdd512d4f2de3c6\nBugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103253\nReviewed-by: Jose Fonseca \nTested-by: Vinson Lee 


Configure your notification preferences

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


[Mesa-dev] [PATCH v3 18/21] meson: build softpipe

2017-10-13 Thread Dylan Baker
This doesn't include llvmpipe.

v2: - Fix inconsistent use of with_gallium_swrast and
  with_gallium_softpipe.

Signed-off-by: Dylan Baker 
Reviewed-by: Eric Anholt 
---
 meson.build  |  5 ++
 meson_options.txt|  4 +-
 src/gallium/drivers/softpipe/meson.build | 85 
 src/gallium/meson.build  |  2 +-
 src/gallium/targets/dri/meson.build  |  8 +++
 5 files changed, 101 insertions(+), 3 deletions(-)
 create mode 100644 src/gallium/drivers/softpipe/meson.build

diff --git a/meson.build b/meson.build
index ff5666c207e..e96dc864986 100644
--- a/meson.build
+++ b/meson.build
@@ -99,6 +99,7 @@ if _drivers != ''
   _split = _drivers.split(',')
   with_gallium_radeonsi = _split.contains('radeonsi')
   with_gallium_nouveau = _split.contains('nouveau')
+  with_gallium_softpipe = _split.contains('swrast')
   with_gallium = true
   with_dri = true
 endif
@@ -111,6 +112,10 @@ if not (with_dri or with_gallium)
   with_shared_glapi = false
 endif
 
+if with_dri_swrast and with_gallium_softpipe
+  error('Only one swrast provider can be built')
+endif
+
 dep_libdrm_intel = []
 if with_dri_i915
   dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
diff --git a/meson_options.txt b/meson_options.txt
index c3f8ddc7980..d7304ab664c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,11 +22,11 @@ option('platforms', type : 'string', value : 
'x11,wayland,drm',
description : 'comma separated list of window systems to support. 
wayland, x11, surfaceless, drm, etc.')
 option('dri3', type : 'combo', value : 'auto', choices : ['auto', 'yes', 'no'],
description : 'enable support for dri3')
-option('dri-drivers', type : 'string', value : 'swrast,i915,i965',
+option('dri-drivers', type : 'string', value : 'i915,i965',
description : 'comma separated list of dri drivers to build.')
 option('dri-drivers-path', type : 'string', value : '',
description : 'Location of dri drivers. Default: $libdir/dri.')
-option('gallium-drivers', type : 'string', value : 'radeonsi,nouveau',
+option('gallium-drivers', type : 'string', value : 'radeonsi,nouveau,swrast',
description : 'comma separated list of gallium drivers to build.')
 option('gallium-media', type : 'string', value : '',
description : 'comma separated list of gallium media APIs to build 
(omx,va,vdpau,xvmc).')
diff --git a/src/gallium/drivers/softpipe/meson.build 
b/src/gallium/drivers/softpipe/meson.build
new file mode 100644
index 000..0cef15152e2
--- /dev/null
+++ b/src/gallium/drivers/softpipe/meson.build
@@ -0,0 +1,85 @@
+# Copyright ?? 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_softpipe = files(
+  'sp_buffer.c',
+  'sp_buffer.h',
+  'sp_clear.c',
+  'sp_clear.h',
+  'sp_context.c',
+  'sp_context.h',
+  'sp_compute.c',
+  'sp_draw_arrays.c',
+  'sp_fence.c',
+  'sp_fence.h',
+  'sp_flush.c',
+  'sp_flush.h',
+  'sp_fs_exec.c',
+  'sp_fs.h',
+  'sp_image.c',
+  'sp_image.h',
+  'sp_limits.h',
+  'sp_prim_vbuf.c',
+  'sp_prim_vbuf.h',
+  'sp_public.h',
+  'sp_quad_blend.c',
+  'sp_quad_depth_test.c',
+  'sp_quad_depth_test_tmp.h',
+  'sp_quad_fs.c',
+  'sp_quad.h',
+  'sp_quad_pipe.c',
+  'sp_quad_pipe.h',
+  'sp_quad_stipple.c',
+  'sp_query.c',
+  'sp_query.h',
+  'sp_screen.c',
+  'sp_screen.h',
+  'sp_setup.c',
+  'sp_setup.h',
+  'sp_state_blend.c',
+  'sp_state_clip.c',
+  'sp_state_derived.c',
+  'sp_state_image.c',
+  'sp_state.h',
+  'sp_state_rasterizer.c',
+  'sp_state_sampler.c',
+  'sp_state_shader.c',
+  'sp_state_so.c',
+  'sp_state_surface.c',
+  'sp_state_vertex.c',
+  'sp_surface.c',
+  'sp_surface.h',
+  'sp_tex_sample.c',
+  'sp_tex_sample.h',
+  'sp_tex_tile_cache.c',
+  'sp_tex_tile_cache.h',
+  'sp_texture.c',
+  'sp_texture.h',
+  'sp_tile_cache.c',
+  'sp_tile_cache.h',
+)
+
+libsoftpipe = 

[Mesa-dev] [PATCH v3 21/21] .travis: Add meson configuration for gallium drivers

2017-10-13 Thread Dylan Baker
---
 .travis.yml | 26 --
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 766ee158c70..c92a6b6f01c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -367,7 +367,7 @@ matrix:
 - env:
 - LABEL="meson Vulkan"
 - BUILD=meson
-- MESON_OPTIONS="-Ddri-drivers="
+- MESON_OPTIONS="-Ddri-drivers= -Dgallium-drivers="
   addons:
 apt:
   sources:
@@ -385,7 +385,7 @@ matrix:
 - env:
 - LABEL="meson loaders/classic DRI"
 - BUILD=meson
-- MESON_OPTIONS="-Dvulkan-drivers="
+- MESON_OPTIONS="-Dvulkan-drivers= -Dgallium-drivers="
   addons:
 apt:
   packages:
@@ -396,6 +396,28 @@ matrix:
 - libxdamage-dev
 - libxfixes-dev
 - python3-pip
+- env:
+- LABEL="meson Gallium drivers"
+- BUILD=meson
+- MESON_OPTIONS="-Dvulkan-drivers= -Ddri-drivers="
+  addons:
+apt:
+  sources:
+- llvm-toolchain-trusty-3.9
+  packages:
+# LLVM packaging is broken and misses these dependencies
+- libedit-dev
+# From sources above
+- llvm-3.9-dev
+# Common
+- xz-utils
+- x11proto-xf86vidmode-dev
+- libexpat1-dev
+- libx11-xcb-dev
+- libxdamage-dev
+- libxfixes-dev
+- python3-pip
+- libelf-dev
 
 install:
   - pip install --user mako
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 01/21] meson: Add switch for texture float

2017-10-13 Thread Dylan Baker
Signed-off-by: Dylan Baker 
Reviewed-by: Eric Anholt 
---
 meson.build   | 4 
 meson_options.txt | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/meson.build b/meson.build
index 02264aeed4e..54230a91ed5 100644
--- a/meson.build
+++ b/meson.build
@@ -37,6 +37,10 @@ with_vulkan_icd_dir = get_option('vulkan-icd-dir')
 with_tests = get_option('build-tests')
 with_valgrind = get_option('valgrind')
 with_asm = get_option('asm')
+if get_option('texture-float')
+  pre_args += '-DTEXTURE_FLOAT_ENABLED'
+  message('WARNING: Floating-point texture enabled. Please consult 
docs/patents.txt and your lawyer before building mesa.')
+endif
 
 # XXX: yeah, do these
 with_appledri = false
diff --git a/meson_options.txt b/meson_options.txt
index abd5135742a..e0a162a0b82 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -52,3 +52,5 @@ option('valgrind', type : 'boolean', value : true,
description : 'Build with valgrind support if possible')
 option('build-tests', type : 'boolean', value : false,
description : 'Build unit tests. Currently this will build *all* unit 
tests, which may build more than expected.')
+option('texture-float', type : 'boolean', value : false,
+   description : 'Enable floating point textures and renderbuffers. This 
option may be patent encumbered, please read docs/patents.txt and consult with 
your lawyer before turning this on.')
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 19/21] meson: build llvmpipe

2017-10-13 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 meson.build  |   4 +-
 src/gallium/drivers/llvmpipe/meson.build | 116 +++
 src/gallium/meson.build  |   2 +-
 src/gallium/targets/dri/meson.build  |   4 ++
 4 files changed, 124 insertions(+), 2 deletions(-)
 create mode 100644 src/gallium/drivers/llvmpipe/meson.build

diff --git a/meson.build b/meson.build
index e96dc864986..bc3bbf41a65 100644
--- a/meson.build
+++ b/meson.build
@@ -589,7 +589,9 @@ if with_llvm
   '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
 ]
   else
-if with_amd_vk or with_gallium_radeonsi
+if with_gallium_softpipe
+  error('Cannot find LLVM to build LLVMPipe. If you wanted softpipe pass 
-Dllvm=false to meson')
+elif with_amd_vk or with_gallium_radeonsi # etc
   error('The following drivers requires LLVM: Radv, RadeonSI. One of these 
is enabled, but LLVM was not found.')
 endif
   endif
diff --git a/src/gallium/drivers/llvmpipe/meson.build 
b/src/gallium/drivers/llvmpipe/meson.build
new file mode 100644
index 000..ca1d2aa797b
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/meson.build
@@ -0,0 +1,116 @@
+# Copyright ?? 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_llvmpipe = files(
+  'lp_bld_alpha.c',
+  'lp_bld_alpha.h',
+  'lp_bld_blend_aos.c',
+  'lp_bld_blend.c',
+  'lp_bld_blend.h',
+  'lp_bld_blend_logicop.c',
+  'lp_bld_depth.c',
+  'lp_bld_depth.h',
+  'lp_bld_interp.c',
+  'lp_bld_interp.h',
+  'lp_clear.c',
+  'lp_clear.h',
+  'lp_context.c',
+  'lp_context.h',
+  'lp_debug.h',
+  'lp_draw_arrays.c',
+  'lp_fence.c',
+  'lp_fence.h',
+  'lp_flush.c',
+  'lp_flush.h',
+  'lp_jit.c',
+  'lp_jit.h',
+  'lp_limits.h',
+  'lp_memory.c',
+  'lp_memory.h',
+  'lp_perf.c',
+  'lp_perf.h',
+  'lp_public.h',
+  'lp_query.c',
+  'lp_query.h',
+  'lp_rast.c',
+  'lp_rast_debug.c',
+  'lp_rast.h',
+  'lp_rast_priv.h',
+  'lp_rast_tri.c',
+  'lp_rast_tri_tmp.h',
+  'lp_scene.c',
+  'lp_scene.h',
+  'lp_scene_queue.c',
+  'lp_scene_queue.h',
+  'lp_screen.c',
+  'lp_screen.h',
+  'lp_setup.c',
+  'lp_setup_context.h',
+  'lp_setup.h',
+  'lp_setup_line.c',
+  'lp_setup_point.c',
+  'lp_setup_tri.c',
+  'lp_setup_vbuf.c',
+  'lp_state_blend.c',
+  'lp_state_clip.c',
+  'lp_state_derived.c',
+  'lp_state_fs.c',
+  'lp_state_fs.h',
+  'lp_state_gs.c',
+  'lp_state.h',
+  'lp_state_rasterizer.c',
+  'lp_state_sampler.c',
+  'lp_state_setup.c',
+  'lp_state_setup.h',
+  'lp_state_so.c',
+  'lp_state_surface.c',
+  'lp_state_vertex.c',
+  'lp_state_vs.c',
+  'lp_surface.c',
+  'lp_surface.h',
+  'lp_tex_sample.c',
+  'lp_tex_sample.h',
+  'lp_texture.c',
+  'lp_texture.h',
+)
+
+libllvmpipe = static_library(
+  'llvmpipe',
+  files_llvmpipe,
+  c_args : [c_vis_args, c_msvc_compat_args],
+  cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+  include_directories : [inc_gallium, inc_gallium_aux, inc_include, inc_src],
+  dependencies : dep_llvm,
+  build_by_default : false,
+)
+
+if with_tests and with_gallium_softpipe and with_llvm
+  foreach t : ['lp_test_format', 'lp_test_arit', 'lp_test_blend',
+   'lp_test_conv', 'lp_test_printf']
+test(t, executable(
+t,
+['@0@.c'.format(t), 'lp_test_main.c'],
+dependencies : [dep_llvm, dep_dl, dep_thread, dep_clock],
+include_directories : [inc_gallium, inc_gallium_aux, inc_include, 
inc_src],
+link_with : [libllvmpipe, libgallium, libmesa_util],
+  )
+)
+  endforeach
+endif
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index ea7f1d2ef64..e7970e11638 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -32,6 +32,7 @@ subdir('drivers/radeon')
 subdir('drivers/radeonsi')
 subdir('drivers/nouveau')
 subdir('drivers/softpipe')
+subdir('drivers/llvmpipe')
 subdir('winsys/sw/null')
 subdir('winsys/sw/dri')
 subdir('winsys/sw/kms-dri')
@@ -48,7 

[Mesa-dev] [PATCH v3 09/21] meson: Build gallium auxiliary

2017-10-13 Thread Dylan Baker
v2: - guard gallivm files with "with_llvm" instead of "dep_llvm.found()"

Signed-off-by: Dylan Baker 
Reviewed-by: Eric Anholt  (v1)
---
 meson.build   |  36 ++-
 meson_options.txt |   4 +-
 src/gallium/auxiliary/meson.build | 528 ++
 src/{ => gallium}/meson.build |  44 +---
 src/meson.build   |   2 +-
 5 files changed, 564 insertions(+), 50 deletions(-)
 create mode 100644 src/gallium/auxiliary/meson.build
 copy src/{ => gallium}/meson.build (52%)

diff --git a/meson.build b/meson.build
index 0ffa280b7e4..240c868675b 100644
--- a/meson.build
+++ b/meson.build
@@ -140,11 +140,13 @@ endif
 # TODO: there are more platforms required for non-vulkan drivers
 with_platform_wayland = false
 with_platform_x11 = false
+with_platform_drm = false
 _platforms = get_option('platforms')
 if _platforms != ''
   _split = _platforms.split(',')
   with_platform_x11 = _split.contains('x11')
   with_platform_wayland = _split.contains('wayland')
+  with_platform_drm = _split.contains('drm')
 endif
 
 with_gbm = get_option('gbm')
@@ -558,7 +560,10 @@ dep_selinux = []
 
 # TODO: llvm-prefix and llvm-shared-libs
 
-# TODO: unwind (llvm [radeon, gallivm] and gallium)
+dep_unwind = dependency('libunwind', required : false)
+if dep_unwind.found()
+  pre_args += '-DHAVE_LIBUNWIND'
+endif
 
 # TODO: flags for opengl, gles, dri
 
@@ -568,9 +573,6 @@ dep_selinux = []
 
 # TODO: osmesa provider
 
-# TODO: flags for xa, egl, gbm, nin, xvmc, vdpau, omx, va, opencl,
-#   gallium-tests,
-
 # TODO: symbol mangling
 
 # TODO: egl configuration
@@ -652,8 +654,6 @@ endif
 
 # TODO: egl
 
-# TODO: xa
-
 # TODO: vallium G3DVL
 
 # TODO: nine
@@ -662,7 +662,29 @@ endif
 
 # TODO: egl sans x11
 
-# TODO: xvmc
+with_gallium_xvmc = false
+with_gallium_vdpau = false
+with_gallium_omx = false  # this is bellagio
+with_gallium_va = false
+with_gallium_media = false
+dep_va = []
+_drivers = get_option('gallium-media')
+if _drivers != ''
+  _split = _drivers.split(',')
+  with_gallium_xvmc = _split.contains('xvmc')
+  with_gallium_vdpau = _split.contains('vdpau')
+  with_gallium_omx = _split.contains('omx')
+  with_gallium_va = _split.contains('va')
+  with_gallium_media = (with_gallium_xvmc or with_gallium_vdpau or
+with_gallium_omx or with_gallium_va)
+  if with_gallium_media
+dep_va = [
+  dependency('x11-xcb'),
+  dependency('xcb'),
+  dependency('xcb-dri2', version : '>= 1.8'), # FIXME: dedup version
+]
+  endif
+endif
 
 # TODO: gallium tests
 
diff --git a/meson_options.txt b/meson_options.txt
index c9e95263cd2..75c53fc49d6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,7 +18,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-option('platforms', type : 'string', value : 'x11,wayland',
+option('platforms', type : 'string', value : 'x11,wayland,drm',
description : 'comma separated list of window systems to support. 
wayland, x11, surfaceless, drm, etc.')
 option('dri3', type : 'combo', value : 'auto', choices : ['auto', 'yes', 'no'],
description : 'enable support for dri3')
@@ -28,6 +28,8 @@ option('dri-drivers-path', type : 'string', value : '',
description : 'Location of dri drivers. Default: $libdir/dri.')
 option('gallium-drivers', type : 'string', value : 'radeonsi',
description : 'comma separated list of gallium drivers to build.')
+option('gallium-media', type : 'string', value : '',
+   description : 'comma separated list of gallium media APIs to build 
(omx,va,vdpau,xvmc).')
 option('vulkan-drivers', type : 'string', value : 'intel,amd',
description : 'comma separated list of vulkan drivers to build.')
 option('shader-cache', type : 'boolean', value : true,
diff --git a/src/gallium/auxiliary/meson.build 
b/src/gallium/auxiliary/meson.build
new file mode 100644
index 000..bb7c0506d84
--- /dev/null
+++ b/src/gallium/auxiliary/meson.build
@@ -0,0 +1,528 @@
+# Copyright ?? 2017 Dylan Baker
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 

[Mesa-dev] [PATCH v3 15/21] meson: build gallium winsys for dri, null, and wrapper

2017-10-13 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 meson.build |  4 ++
 src/gallium/auxiliary/pipe-loader/meson.build   | 12 --
 src/gallium/meson.build |  8 ++--
 src/gallium/{ => winsys/sw/dri}/meson.build | 55 +++-
 src/gallium/{ => winsys/sw/kms-dri}/meson.build | 57 -
 src/gallium/{ => winsys/sw/null}/meson.build| 55 +++-
 src/gallium/{ => winsys/sw/wrapper}/meson.build | 55 +++-
 7 files changed, 47 insertions(+), 199 deletions(-)
 copy src/gallium/{ => winsys/sw/dri}/meson.build (53%)
 copy src/gallium/{ => winsys/sw/kms-dri}/meson.build (51%)
 copy src/gallium/{ => winsys/sw/null}/meson.build (53%)
 copy src/gallium/{ => winsys/sw/wrapper}/meson.build (53%)

diff --git a/meson.build b/meson.build
index ebaf2d957fd..e2f49415295 100644
--- a/meson.build
+++ b/meson.build
@@ -523,10 +523,14 @@ else
   dep_clock = cc.find_library('rt')
 endif
 
+with_gallium_drisw_kms = false
 dep_libdrm = dependency('libdrm', version : '>= 2.4.75',
 required : with_dri2 or with_dri3)
 if dep_libdrm.found()
   pre_args += '-DHAVE_LIBDRM'
+  if with_dri_platform == 'drm' and with_dri
+with_gallium_drisw_kms = true
+  endif
 endif
 
 # TODO: some of these may be conditional
diff --git a/src/gallium/auxiliary/pipe-loader/meson.build 
b/src/gallium/auxiliary/pipe-loader/meson.build
index c84fc9ddce8..9b12432aea0 100644
--- a/src/gallium/auxiliary/pipe-loader/meson.build
+++ b/src/gallium/auxiliary/pipe-loader/meson.build
@@ -26,9 +26,14 @@ files_pipe_loader = files(
   'driinfo_gallium.h',
 )
 
+libpipe_loader_defines = []
+
 if dep_libdrm.found()
   files_pipe_loader += files('pipe_loader_drm.c')
 endif
+if with_gallium_drisw_kms
+  libpipe_loader_defines += '-DHAVE_PIPE_LOADER_KMS'
+endif
 
 libpipe_loader_static = static_library(
   'pipe_loader_static',
@@ -38,7 +43,8 @@ libpipe_loader_static = static_library(
 inc_gallium_winsys,
   ],
   c_args : [
-c_vis_args, '-DHAVE_PIPE_LOADER_DRI', '-DGALLIUM_STATIC_TARGETS=1'
+c_vis_args, '-DHAVE_PIPE_LOADER_DRI', '-DGALLIUM_STATIC_TARGETS=1',
+libpipe_loader_defines,
   ],
   link_with : [libloader, libxmlconfig],
   dependencies : [dep_libdrm],
@@ -53,8 +59,8 @@ libpipe_loader_dynamic = static_library(
 inc_gallium_winsys,
   ],
   c_args : [
-c_vis_args, '-DHAVE_PIPE_LOADER_DRI', '-DPIPE_SEARCH_DIR="@0@"'.format(
-  join_paths(get_option('libdir'), 'gallium-pipe')
+c_vis_args, libpipe_loader_defines, '-DHAVE_PIPE_LOADER_DRI',
+'-DPIPE_SEARCH_DIR="@0@"'.format(join_paths(get_option('libdir'), 
'gallium-pipe')
 )
   ],
   link_with : [libloader, libxmlconfig],
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index 0a808d3cfda..d500cf5493c 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -30,6 +30,10 @@ subdir('drivers/trace')
 subdir('drivers/rbug')
 subdir('drivers/radeon')
 subdir('drivers/radeonsi')
+subdir('winsys/sw/null')
+subdir('winsys/sw/dri')
+subdir('winsys/sw/kms-dri')
+subdir('winsys/sw/wrapper')
 subdir('winsys/radeon/drm')
 subdir('winsys/amdgpu/drm')
 subdir('state_trackers/dri')
@@ -47,11 +51,7 @@ subdir('state_trackers/dri')
 # TODO: SWR
 # TODO: vc4
 # TODO: virgl
-# TODO: winsys/sw/null
 # TODO: winsys/sw/xlib
-# TODO: winsys/sw/dri
-# TODO: winsys/sw/kms-dri
-# TODO: winsys/sw/wrapper
 # TODO: clover
 if with_dri
   #subdir('targets/dri')
diff --git a/src/gallium/meson.build b/src/gallium/winsys/sw/dri/meson.build
similarity index 53%
copy from src/gallium/meson.build
copy to src/gallium/winsys/sw/dri/meson.build
index 0a808d3cfda..6ada8d1bc7d 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/winsys/sw/dri/meson.build
@@ -18,51 +18,10 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-inc_gallium = include_directories('include')
-inc_gallium_drivers = include_directories('drivers')
-inc_gallium_winsys = include_directories('winsys')
-
-subdir('auxiliary')
-subdir('auxiliary/pipe-loader')
-subdir('drivers/ddebug')
-subdir('drivers/noop')
-subdir('drivers/trace')
-subdir('drivers/rbug')
-subdir('drivers/radeon')
-subdir('drivers/radeonsi')
-subdir('winsys/radeon/drm')
-subdir('winsys/amdgpu/drm')
-subdir('state_trackers/dri')
-# TODO: freedreno
-# TODO: i915
-# TODO: nouveau
-# TODO: SVGA
-# TODO: r300
-# TODO: r600
-# TODO: etnaviv
-# TODO: IMX
-# TODO: PL111
-# TODO: softpipe
-# TODO: llvmpipe
-# TODO: SWR
-# TODO: vc4
-# TODO: virgl
-# TODO: winsys/sw/null
-# TODO: winsys/sw/xlib
-# TODO: winsys/sw/dri
-# TODO: winsys/sw/kms-dri
-# TODO: winsys/sw/wrapper
-# TODO: clover
-if with_dri
-  #subdir('targets/dri')
-endif
-# TODO: dricommon
-# TODO: xlib-glx
-# TODO: OMX
-# TODO: osmesa
-# TODO: VA
-# TODO: vdpau
-# TODO: xa
-# TODO: xvmc
-# TODO: nine
-# TODO: tests
+libswdri = static_library(
+  'swdri',
+  files('dri_sw_winsys.c', 

[Mesa-dev] [PATCH v3 20/21] meson: refactor meson_options

2017-10-13 Thread Dylan Baker
To put one argument on each line. This results in the file being much
longer, but I think much more readable.

Suggested-by: Eero Tamminen 
Signed-off-by: Dylan Baker 
---
 meson_options.txt | 170 +-
 1 file changed, 129 insertions(+), 41 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index d7304ab664c..71e9ea63555 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,44 +18,132 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-option('platforms', type : 'string', value : 'x11,wayland,drm',
-   description : 'comma separated list of window systems to support. 
wayland, x11, surfaceless, drm, etc.')
-option('dri3', type : 'combo', value : 'auto', choices : ['auto', 'yes', 'no'],
-   description : 'enable support for dri3')
-option('dri-drivers', type : 'string', value : 'i915,i965',
-   description : 'comma separated list of dri drivers to build.')
-option('dri-drivers-path', type : 'string', value : '',
-   description : 'Location of dri drivers. Default: $libdir/dri.')
-option('gallium-drivers', type : 'string', value : 'radeonsi,nouveau,swrast',
-   description : 'comma separated list of gallium drivers to build.')
-option('gallium-media', type : 'string', value : '',
-   description : 'comma separated list of gallium media APIs to build 
(omx,va,vdpau,xvmc).')
-option('vulkan-drivers', type : 'string', value : 'intel,amd',
-   description : 'comma separated list of vulkan drivers to build.')
-option('shader-cache', type : 'boolean', value : true,
-   description : 'Build with on-disk shader cache support')
-option('vulkan-icd-dir', type : 'string', value : '',
-   description : 'Location relative to prefix to put vulkan icds on 
install. Default: $datadir/vulkan/icd.d')
-option('shared-glapi', type : 'boolean', value : true,
-   description : 'Whether to build a shared or static glapi')
-option('gles1', type : 'boolean', value : true,
-   description : 'Build support for OpenGL ES 1.x')
-option('gles2', type : 'boolean', value : true,
-   description : 'Build support for OpenGL ES 2.x and 3.x')
-option('opengl', type : 'boolean', value : true,
-   description : 'Build support for OpenGL (all versions)')
-option('gbm', type : 'combo', value : 'auto', choices : ['auto', 'yes', 'no'],
-   description : 'Build support for gbm platform')
-option('glx', type : 'combo', value : 'auto', choices : ['auto', 'disabled', 
'dri', 'xlib', 'gallium-xlib'],
-   description : 'Build support for GLX platform')
-option('glvnd', type : 'boolean', value : false,
-   description : 'Enable GLVND support.')
-option('asm', type : 'boolean', value : true,
-   description : 'Build assembly code if possible')
-option('llvm', type : 'boolean', value : true, description : 'Build with LLVM 
support.')
-option('valgrind', type : 'boolean', value : true,
-   description : 'Build with valgrind support if possible')
-option('build-tests', type : 'boolean', value : false,
-   description : 'Build unit tests. Currently this will build *all* unit 
tests, which may build more than expected.')
-option('texture-float', type : 'boolean', value : false,
-   description : 'Enable floating point textures and renderbuffers. This 
option may be patent encumbered, please read docs/patents.txt and consult with 
your lawyer before turning this on.')
+option(
+  'platforms',
+  type : 'string',
+  value : 'x11,wayland,drm',
+  description : 'comma separated list of window systems to support. wayland, 
x11, surfaceless, drm, etc.'
+)
+option(
+  'dri3',
+  type : 'combo',
+  value : 'auto',
+  choices : ['auto', 'yes', 'no'],
+  description : 'enable support for dri3'
+)
+option(
+  'dri-drivers',
+  type : 'string',
+  value : 'i915,i965',
+  description : 'comma separated list of dri drivers to build.'
+)
+option(
+  'dri-drivers-path',
+  type : 'string',
+  value : '',
+  description : 'Location of dri drivers. Default: $libdir/dri.'
+)
+option(
+  'gallium-drivers',
+  type : 'string',
+  value : 'radeonsi,nouveau,swrast',
+  description : 'comma separated list of gallium drivers to build.'
+)
+option(
+  'gallium-media',
+  type : 'string',
+  value : '',
+  description : 'comma separated list of gallium media APIs to build 
(omx,va,vdpau,xvmc).'
+)
+option(
+  'vulkan-drivers',
+  type : 'string',
+  value : 'intel,amd',
+  description : 'comma separated list of vulkan drivers to build.'
+)
+option(
+  'shader-cache',
+  type : 'boolean',
+  value : true,
+  description : 'Build with on-disk shader cache support'
+)
+option(
+  'vulkan-icd-dir',
+  type : 'string',
+  value : '',
+  description : 'Location relative to prefix to put vulkan icds on install. 
Default: $datadir/vulkan/icd.d'
+)
+option(
+  'shared-glapi',
+  type : 'boolean',
+  value : true,
+  description : 'Whether to build 

[Mesa-dev] [PATCH v3 14/21] meson: build radeonsi

2017-10-13 Thread Dylan Baker
This builds the radeonsi (and radeon) window system bits and gallium
driver bits.

Signed-off-by: Dylan Baker 
---
 meson.build | 18 --
 src/gallium/{ => drivers/radeon}/meson.build| 43 +++---
 src/gallium/drivers/radeonsi/meson.build| 78 +
 src/gallium/meson.build | 38 
 src/gallium/{ => winsys/amdgpu/drm}/meson.build | 26 +
 src/gallium/{ => winsys/radeon/drm}/meson.build | 20 +++
 6 files changed, 189 insertions(+), 34 deletions(-)
 copy src/gallium/{ => drivers/radeon}/meson.build (58%)
 create mode 100644 src/gallium/drivers/radeonsi/meson.build
 copy src/gallium/{ => winsys/amdgpu/drm}/meson.build (70%)
 copy src/gallium/{ => winsys/radeon/drm}/meson.build (72%)

diff --git a/meson.build b/meson.build
index 4cde8c76908..ebaf2d957fd 100644
--- a/meson.build
+++ b/meson.build
@@ -543,7 +543,15 @@ dep_expat = dependency('expat')
 # this only exists on linux so either this is linux and it will be found, or
 # its not linux and and wont
 dep_m = cc.find_library('m', required : false)
-dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82', 
required : with_amd_vk)
+
+dep_libdrm_amdgpu = []
+dep_libdrm_radeon = []
+if with_amd_vk or with_gallium_radeonsi
+  dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.84')
+endif
+if with_gallium_radeonsi # older radeon too
+  dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71')
+endif
 
 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
 if with_amd_vk
@@ -566,12 +574,12 @@ if with_llvm
   '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
 ]
   else
-if with_amd_vk
-  error('The following drivers requires LLVM: Radv. One of these is 
enabled, but LLVM was not found.')
+if with_amd_vk or with_gallium_radeonsi
+  error('The following drivers requires LLVM: Radv, RadeonSI. One of these 
is enabled, but LLVM was not found.')
 endif
   endif
-elif with_amd_vk
-  error('The following drivers requires LLVM: Radv. One of these is enabled, 
but LLVM is disabled.')
+elif with_amd_vk or with_gallium_radeonsi
+  error('The following drivers requires LLVM: Radv, RadeonSI. One of these is 
enabled, but LLVM is disabled.')
 endif
 
 dep_glvnd = []
diff --git a/src/gallium/meson.build b/src/gallium/drivers/radeon/meson.build
similarity index 58%
copy from src/gallium/meson.build
copy to src/gallium/drivers/radeon/meson.build
index 47dbcd84414..b4d2832d016 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/drivers/radeon/meson.build
@@ -18,13 +18,38 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-inc_gallium = include_directories('include')
-inc_gallium_winsys = include_directories('winsys')
+files_libradeon = files(
+  'r600_buffer_common.c',
+  'r600_cs.h',
+  'r600_gpu_load.c',
+  'r600_perfcounter.c',
+  'r600_pipe_common.c',
+  'r600_pipe_common.h',
+  'r600_query.c',
+  'r600_query.h',
+  'r600_test_dma.c',
+  'r600_texture.c',
+  'radeon_uvd.c',
+  'radeon_uvd.h',
+  'radeon_vcn_dec.c',
+  'radeon_vcn_dec.h',
+  'radeon_vce_40_2_2.c',
+  'radeon_vce_50.c',
+  'radeon_vce_52.c',
+  'radeon_vce.c',
+  'radeon_vce.h',
+  'radeon_video.c',
+  'radeon_video.h',
+  'radeon_winsys.h',
+)
 
-subdir('auxiliary')
-subdir('auxiliary/pipe-loader')
-subdir('drivers/ddebug')
-subdir('drivers/noop')
-subdir('drivers/trace')
-subdir('drivers/rbug')
-subdir('state_trackers/dri')
+libradeon = static_library(
+  'radeon',
+  files_libradeon,
+  c_args : ['-Wstrict-overflow=0', c_vis_args],
+  dependencies : [dep_llvm, dep_clock],
+  include_directories : [
+inc_include, inc_src, inc_gallium, inc_gallium_aux, inc_gallium_drivers,
+  ],
+  build_by_default : false,
+)
diff --git a/src/gallium/drivers/radeonsi/meson.build 
b/src/gallium/drivers/radeonsi/meson.build
new file mode 100644
index 000..08e855d75b5
--- /dev/null
+++ b/src/gallium/drivers/radeonsi/meson.build
@@ -0,0 +1,78 @@
+# Copyright ?? 2017 Dylan Baker
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 

[Mesa-dev] [PATCH v3 11/21] meson: Build gallium pipe-loader

2017-10-13 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/gallium/auxiliary/meson.build |  2 +
 src/gallium/auxiliary/pipe-loader/meson.build | 63 +++
 src/gallium/meson.build   |  2 +
 3 files changed, 67 insertions(+)
 create mode 100644 src/gallium/auxiliary/pipe-loader/meson.build

diff --git a/src/gallium/auxiliary/meson.build 
b/src/gallium/auxiliary/meson.build
index bb7c0506d84..778b4ce4ac2 100644
--- a/src/gallium/auxiliary/meson.build
+++ b/src/gallium/auxiliary/meson.build
@@ -18,6 +18,8 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
+inc_gallium_aux = include_directories('.')
+
 files_libgallium = files(
   'cso_cache/cso_cache.c',
   'cso_cache/cso_cache.h',
diff --git a/src/gallium/auxiliary/pipe-loader/meson.build 
b/src/gallium/auxiliary/pipe-loader/meson.build
new file mode 100644
index 000..c84fc9ddce8
--- /dev/null
+++ b/src/gallium/auxiliary/pipe-loader/meson.build
@@ -0,0 +1,63 @@
+# Copyright ?? 2017 Dylan Baker
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_pipe_loader = files(
+  'pipe_loader.c',
+  'pipe_loader.h',
+  'pipe_loader_priv.h',
+  'pipe_loader_sw.c',
+  'driinfo_gallium.h',
+)
+
+if dep_libdrm.found()
+  files_pipe_loader += files('pipe_loader_drm.c')
+endif
+
+libpipe_loader_static = static_library(
+  'pipe_loader_static',
+  files_pipe_loader,
+  include_directories : [
+inc_util, inc_loader, inc_gallium, inc_include, inc_src, inc_gallium_aux,
+inc_gallium_winsys,
+  ],
+  c_args : [
+c_vis_args, '-DHAVE_PIPE_LOADER_DRI', '-DGALLIUM_STATIC_TARGETS=1'
+  ],
+  link_with : [libloader, libxmlconfig],
+  dependencies : [dep_libdrm],
+  build_by_default : false,
+)
+
+libpipe_loader_dynamic = static_library(
+  'pipe_loader_dynamic',
+  files_pipe_loader,
+  include_directories : [
+inc_util, inc_loader, inc_gallium, inc_include, inc_src, inc_gallium_aux,
+inc_gallium_winsys,
+  ],
+  c_args : [
+c_vis_args, '-DHAVE_PIPE_LOADER_DRI', '-DPIPE_SEARCH_DIR="@0@"'.format(
+  join_paths(get_option('libdir'), 'gallium-pipe')
+)
+  ],
+  link_with : [libloader, libxmlconfig],
+  dependencies : [dep_libdrm],
+  build_by_default : false,
+)
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index a9c36973ca1..50708d146fc 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -19,5 +19,7 @@
 # SOFTWARE.
 
 inc_gallium = include_directories('include')
+inc_gallium_winsys = include_directories('winsys')
 
 subdir('auxiliary')
+subdir('auxiliary/pipe-loader')
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 16/21] meson: build radeonsi gallium driver

2017-10-13 Thread Dylan Baker
This hooks up the bits necessary to build gallium dri drivers, with
radeonSI as the first example driver. This isn't tested yet.
---
 meson.build  |  4 +-
 src/gallium/drivers/radeonsi/meson.build |  2 +-
 src/gallium/meson.build  |  3 +-
 src/gallium/targets/dri/meson.build  | 90 
 4 files changed, 94 insertions(+), 5 deletions(-)
 create mode 100644 src/gallium/targets/dri/meson.build

diff --git a/meson.build b/meson.build
index e2f49415295..e0fac4858fc 100644
--- a/meson.build
+++ b/meson.build
@@ -540,8 +540,8 @@ if dep_thread.found() and host_machine.system() == 'linux'
   pre_args += '-DHAVE_PTHREAD'
 endif
 dep_elf = dependency('libelf', required : false)
-if not dep_elf.found()
-  dep_elf = cc.find_library('elf', required : with_amd_vk) # TODO: clover, 
r600, radeonsi
+if not dep_elf.found() and (with_amd_vk or with_gallium_radeonsi) # TODO: 
clover, r600
+  dep_elf = cc.find_library('elf')
 endif
 dep_expat = dependency('expat')
 # this only exists on linux so either this is linux and it will be found, or
diff --git a/src/gallium/drivers/radeonsi/meson.build 
b/src/gallium/drivers/radeonsi/meson.build
index 08e855d75b5..b0089c0d56e 100644
--- a/src/gallium/drivers/radeonsi/meson.build
+++ b/src/gallium/drivers/radeonsi/meson.build
@@ -66,7 +66,7 @@ si_driinfo_h = custom_target(
 
 libradeonsi = static_library(
   'radeonsi',
-  [files_libradeonsi, si_driinfo_h, nir_opcodes_h],
+  [files_libradeonsi, si_driinfo_h, nir_opcodes_h, sid_tables_h],
   include_directories : [
 inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_amd_common,
 inc_gallium_drivers,
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index d500cf5493c..6c0e9782ae9 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -54,9 +54,8 @@ subdir('state_trackers/dri')
 # TODO: winsys/sw/xlib
 # TODO: clover
 if with_dri
-  #subdir('targets/dri')
+  subdir('targets/dri')
 endif
-# TODO: dricommon
 # TODO: xlib-glx
 # TODO: OMX
 # TODO: osmesa
diff --git a/src/gallium/targets/dri/meson.build 
b/src/gallium/targets/dri/meson.build
new file mode 100644
index 000..382b00db5dc
--- /dev/null
+++ b/src/gallium/targets/dri/meson.build
@@ -0,0 +1,90 @@
+# Copyright ?? 2017 Dylan Baker
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# TODO: support non-static targets
+# Static targets are always enabled in autotools (unless you modify
+# configure.ac)
+
+gallium_dri_c_args = [
+  '-DGALLIUM_DDEBUG',
+  '-DGALLIUM_NOOP',
+  '-DGALLIUM_RBUG',
+  '-DGALLIUME_TRACE',
+]
+gallium_dri_ld_args = []
+gallium_dri_link_with = []
+gallium_dri_depends = []
+gallium_dri_link_depends = []
+gallium_dri_drivers = []
+gallium_dri_sources = []
+
+if with_ld_version_script
+  gallium_dri_ld_args += ['-Wl,--version-script', 
join_paths(meson.current_source_dir(), 'dri.sym')]
+  gallium_dri_link_depends += files('dri.sym')
+endif
+if with_ld_dynamic_list
+  gallium_dri_ld_args += ['-Wl,--dynamic-list', 
join_paths(meson.current_source_dir(), '../dri-vdpau.dyn')]
+  gallium_dri_link_depends += files('../dri-vdpau.dyn')
+endif
+
+if with_dri
+  gallium_dri_link_with += libswdri
+endif
+if with_gallium_drisw_kms
+  gallium_dri_link_with += libswkmsdri
+endif
+
+if with_gallium_radeonsi
+  gallium_dri_c_args += '-DGALLIUM_RADEONSI'
+  gallium_dri_sources += si_driinfo_h
+  gallium_dri_link_with += [
+libradeonsi, libnir, libradeonwinsys, libamdgpuwinsys, libradeon,
+libamd_common,
+  ]
+  gallium_dri_drivers += 'radeonsi_dri.so'
+endif
+
+libgallium_dri = shared_library(
+  'gallium_dri',
+  [files('target.c'), gallium_dri_sources],
+  include_directories : [
+inc_common, inc_util, inc_dri_common, inc_gallium_drivers,
+inc_gallium_winsys, include_directories('../../state_trackers/dri'),
+  ],
+  c_args : [c_vis_args, gallium_dri_c_args],
+  cpp_args : [cpp_vis_args],
+  link_args : [ld_args_gc_sections, 

[Mesa-dev] [PATCH v3 05/21] meson: Don't try to install dri drivers unless one is built

2017-10-13 Thread Dylan Baker
This confused the with_dri flag which is meant to control Direct
Rendering Infrastructure, not classic drivers

Signed-off-by: Dylan Baker 
Reviewed-by: Eric Anholt 
---
 src/mesa/drivers/dri/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/meson.build b/src/mesa/drivers/dri/meson.build
index 63cfcce8399..36079324d41 100644
--- a/src/mesa/drivers/dri/meson.build
+++ b/src/mesa/drivers/dri/meson.build
@@ -32,7 +32,7 @@ if with_dri_i965
   subdir('i965')
 endif
 
-if with_dri
+if dri_drivers != []
   libmesa_dri_drivers = shared_library(
 'mesa_dri_drivers',
 dummy_cpp,  # see meson #2180
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 03/21] meson: add checks for version script and dynamic list

2017-10-13 Thread Dylan Baker
These are used by gallium drivers.

Signed-off-by: Dylan Baker 
---
 meson.build | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 54230a91ed5..2f73215ca52 100644
--- a/meson.build
+++ b/meson.build
@@ -433,14 +433,28 @@ endif
 
 # Check for some linker flags
 ld_args_bsymbolic = []
-if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic')
+if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic', name : 
'Bsymbolic')
   ld_args_bsymbolic += '-Wl,-Bsymbolic'
 endif
 ld_args_gc_sections = []
 if cc.links('static char unused() { return 5; } int main() { return 0; }',
-args : '-Wl,--gc-sections')
+args : '-Wl,--gc-sections', name : 'gc-sections')
   ld_args_gc_sections += '-Wl,--gc-sections'
 endif
+with_ld_version_script = false
+if cc.links('int main() { return 0; }',
+args : '-Wl,--version-script=@0@'.format(
+  join_paths(meson.source_root(), 'build-support/conftest.map')),
+name : 'version-script')
+  with_ld_version_script = true
+endif
+with_ld_dynamic_list = false
+if cc.links('int main() { return 0; }',
+args : '-Wl,--dynamic-list=@0@'.format(
+  join_paths(meson.source_root(), 'build-support/conftest.dyn')),
+name : 'dynamic-list')
+  with_ld_dynamic_list = true
+endif
 
 # check for dl support
 if cc.has_function('dlopen')
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 13/21] meson: Build gallium dri state tracker

2017-10-13 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 meson.build  |  1 +
 src/gallium/meson.build  |  1 +
 src/gallium/{ => state_trackers/dri}/meson.build | 46 +++-
 3 files changed, 39 insertions(+), 9 deletions(-)
 copy src/gallium/{ => state_trackers/dri}/meson.build (59%)

diff --git a/meson.build b/meson.build
index fecb5dbac81..4cde8c76908 100644
--- a/meson.build
+++ b/meson.build
@@ -92,6 +92,7 @@ endif
 
 with_gallium = false
 with_gallium_radeonsi = false
+with_gallium_softpipe = false
 _drivers = get_option('gallium-drivers')
 if _drivers != ''
   _split = _drivers.split(',')
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index d69c3aeca39..47dbcd84414 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -27,3 +27,4 @@ subdir('drivers/ddebug')
 subdir('drivers/noop')
 subdir('drivers/trace')
 subdir('drivers/rbug')
+subdir('state_trackers/dri')
diff --git a/src/gallium/meson.build 
b/src/gallium/state_trackers/dri/meson.build
similarity index 59%
copy from src/gallium/meson.build
copy to src/gallium/state_trackers/dri/meson.build
index d69c3aeca39..5d89f23a6fe 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/state_trackers/dri/meson.build
@@ -18,12 +18,40 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-inc_gallium = include_directories('include')
-inc_gallium_winsys = include_directories('winsys')
-
-subdir('auxiliary')
-subdir('auxiliary/pipe-loader')
-subdir('drivers/ddebug')
-subdir('drivers/noop')
-subdir('drivers/trace')
-subdir('drivers/rbug')
+files_libdri = files(
+  'dri_context.c',
+  'dri_context.h',
+  'dri_drawable.c',
+  'dri_drawable.h',
+  'dri_helpers.c',
+  'dri_helpers.h',
+  'dri_query_renderer.c',
+  'dri_query_renderer.h',
+  'dri_screen.c',
+  'dri_screen.h',
+)
+
+if with_dri
+  files_libdri += files('drisw.c')
+endif
+
+if with_dri2
+  files_libdri += files('dri2.c', 'dri2_buffer.h')
+endif
+
+libdri_c_args = []
+if with_gallium_softpipe
+  libdri_c_args += '-DGALLIUM_SOFTPIPE'
+endif
+
+libdri = static_library(
+  'dri',
+  files_libdri,
+  include_directories : [
+inc_include, inc_util, inc_mesa, inc_mapi, inc_src, inc_gallium,
+inc_gallium_aux, inc_dri_common,
+  ],
+  c_args : [c_vis_args, libdri_c_args],
+  dependencies : dep_libdrm,
+  build_by_default : false,
+)
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 17/21] meson: build nouveau (gallium) driver

2017-10-13 Thread Dylan Baker
Tested with a GK107.

v2: - Add target for nouveau standalone compiler. This target is not
  built by default.
v3: - Add nouveau to list of drivers built by default

Signed-off-by: Dylan Baker 
---
 meson.build  |   6 +
 meson_options.txt|   2 +-
 src/gallium/drivers/nouveau/meson.build  | 224 +++
 src/gallium/meson.build  |   3 +-
 src/gallium/targets/dri/meson.build  |   5 +
 src/gallium/{ => winsys/nouveau/drm}/meson.build |  57 +-
 6 files changed, 248 insertions(+), 49 deletions(-)
 create mode 100644 src/gallium/drivers/nouveau/meson.build
 copy src/gallium/{ => winsys/nouveau/drm}/meson.build (53%)

diff --git a/meson.build b/meson.build
index e0fac4858fc..ff5666c207e 100644
--- a/meson.build
+++ b/meson.build
@@ -92,11 +92,13 @@ endif
 
 with_gallium = false
 with_gallium_radeonsi = false
+with_gallium_nouveau = false
 with_gallium_softpipe = false
 _drivers = get_option('gallium-drivers')
 if _drivers != ''
   _split = _drivers.split(',')
   with_gallium_radeonsi = _split.contains('radeonsi')
+  with_gallium_nouveau = _split.contains('nouveau')
   with_gallium = true
   with_dri = true
 endif
@@ -550,12 +552,16 @@ dep_m = cc.find_library('m', required : false)
 
 dep_libdrm_amdgpu = []
 dep_libdrm_radeon = []
+dep_libdrm_nouveau = []
 if with_amd_vk or with_gallium_radeonsi
   dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.84')
 endif
 if with_gallium_radeonsi # older radeon too
   dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71')
 endif
+if with_gallium_nouveau
+  dep_libdrm_nouveau = dependency('libdrm_nouveau', version : '>= 2.4.66')
+endif
 
 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
 if with_amd_vk
diff --git a/meson_options.txt b/meson_options.txt
index 75c53fc49d6..c3f8ddc7980 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -26,7 +26,7 @@ option('dri-drivers', type : 'string', value : 
'swrast,i915,i965',
description : 'comma separated list of dri drivers to build.')
 option('dri-drivers-path', type : 'string', value : '',
description : 'Location of dri drivers. Default: $libdir/dri.')
-option('gallium-drivers', type : 'string', value : 'radeonsi',
+option('gallium-drivers', type : 'string', value : 'radeonsi,nouveau',
description : 'comma separated list of gallium drivers to build.')
 option('gallium-media', type : 'string', value : '',
description : 'comma separated list of gallium media APIs to build 
(omx,va,vdpau,xvmc).')
diff --git a/src/gallium/drivers/nouveau/meson.build 
b/src/gallium/drivers/nouveau/meson.build
new file mode 100644
index 000..2bc6142879e
--- /dev/null
+++ b/src/gallium/drivers/nouveau/meson.build
@@ -0,0 +1,224 @@
+# Copyright ?? 2017 Dylan Baker
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_libnouveau = files(
+  'nouveau_buffer.c',
+  'nouveau_buffer.h',
+  'nouveau_context.h',
+  'nouveau_debug.h',
+  'nouveau_fence.c',
+  'nouveau_fence.h',
+  'nouveau_gldefs.h',
+  'nouveau_heap.c',
+  'nouveau_heap.h',
+  'nouveau_mm.c',
+  'nouveau_mm.h',
+  'nouveau_screen.c',
+  'nouveau_screen.h',
+  'nouveau_statebuf.h',
+  'nouveau_video.c',
+  'nouveau_video.h',
+  'nouveau_vp3_video_bsp.c',
+  'nouveau_vp3_video.c',
+  'nouveau_vp3_video.h',
+  'nouveau_vp3_video_vp.c',
+  'nouveau_winsys.h',
+  'nv17_mpeg.xml.h',
+  'nv31_mpeg.xml.h',
+  'nv_m2mf.xml.h',
+  'nv_object.xml.h',
+  'nv30/nv01_2d.xml.h',
+  'nv30/nv30-40_3d.xml.h',
+  'nv30/nv30_clear.c',
+  'nv30/nv30_context.c',
+  'nv30/nv30_context.h',
+  'nv30/nv30_draw.c',
+  'nv30/nv30_format.c',
+  'nv30/nv30_format.h',
+  'nv30/nv30_fragprog.c',
+  'nv30/nv30_fragtex.c',
+  'nv30/nv30_miptree.c',
+  'nv30/nv30_push.c',
+  'nv30/nv30_query.c',
+  'nv30/nv30_resource.c',
+  'nv30/nv30_resource.h',
+  'nv30/nv30_screen.c',

[Mesa-dev] [PATCH v3 10/21] meson: split and simplify dependencies

2017-10-13 Thread Dylan Baker
Rather than group dependencies in complex groups, use a flatter
structure with split dependencies to avoid checking for the same
dependencies twice.

v2: - Fix building vulkan drivers without gallium or dri drivers
v3: - Drop TODO comment that is done
- Fix typo in commit message

Signed-off-by: Dylan Baker 
---
 meson.build| 196 ++---
 src/loader/meson.build |   5 +-
 src/vulkan/wsi/meson.build |  10 ++-
 3 files changed, 108 insertions(+), 103 deletions(-)

diff --git a/meson.build b/meson.build
index 240c868675b..fecb5dbac81 100644
--- a/meson.build
+++ b/meson.build
@@ -116,27 +116,6 @@ endif
 # TODO: other OSes
 with_dri_platform = 'drm'
 
-# TODO: conditionalize libdrm requirement
-dep_libdrm = dependency('libdrm', version : '>= 2.4.75')
-pre_args += '-DHAVE_LIBDRM'
-
-with_dri2 = with_dri_platform == 'drm' and dep_libdrm.found()
-with_dri3 = get_option('dri3')
-if with_dri3 == 'auto'
-  if host_machine.system() == 'linux' and with_dri2
-with_dri3 = true
-  else
-with_dri3 = false
- endif
-elif with_dri3 == 'yes'
-  if not with_dri2
-error('dri3 support requires libdrm')
-  endif
-  with_dri3 = true
-else
-  with_dri3 = false
-endif
-
 # TODO: there are more platforms required for non-vulkan drivers
 with_platform_wayland = false
 with_platform_x11 = false
@@ -211,17 +190,69 @@ if _vulkan_drivers != ''
   if not (with_platform_x11 or with_platform_wayland)
 error('Vulkan requires at least one platform (x11, wayland)')
   endif
-  if with_platform_x11 and not with_dri3
-error('Vulkan drivers require dri3 for X11 support')
-  endif
 endif
 
+with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm'
+with_dri3 = get_option('dri3')
+if with_dri3 == 'auto'
+  if host_machine.system() == 'linux' and with_dri2
+with_dri3 = true
+  else
+with_dri3 = false
+ endif
+elif with_dri3 == 'yes'
+  with_dri3 = true
+else
+  with_dri3 = false
+endif
+
+if with_any_vk and (with_platform_x11 and not with_dri3)
+  error('Vulkan drivers require dri3 for X11 support')
+endif
 if with_dri or with_gallium
   if with_glx == 'disabled' # TODO: or egl
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
 
+with_gallium_xvmc = false
+with_gallium_vdpau = false
+with_gallium_omx = false  # this is bellagio
+with_gallium_va = false
+with_gallium_media = false
+dep_va = []
+_drivers = get_option('gallium-media')
+if _drivers != ''
+  _split = _drivers.split(',')
+  with_gallium_xvmc = _split.contains('xvmc')
+  with_gallium_vdpau = _split.contains('vdpau')
+  with_gallium_omx = _split.contains('omx')
+  with_gallium_va = _split.contains('va')
+  with_gallium_media = (with_gallium_xvmc or with_gallium_vdpau or
+with_gallium_omx or with_gallium_va)
+endif
+
+if with_platform_x11
+  if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
+pre_args += '-DHAVE_X11_PLATFORM'
+  endif
+  if with_glx == 'xlib'
+# TODO
+error('TODO')
+  elif with_glx == 'gallium-xlib'
+# TODO
+error('TODO')
+  else
+pre_args += '-DGLX_INDIRECT_RENDERING'
+if with_glx_direct
+  pre_args += '-DGLX_DIRECT_RENDERING'
+endif
+if with_dri_platform == 'drm'
+  pre_args += '-DGLX_USE_DRM'
+endif
+  endif
+endif
+
 prog_python2 = find_program('python2')
 has_mako = run_command(prog_python2, '-c', 'import mako')
 if has_mako.returncode() != 0
@@ -491,10 +522,18 @@ else
   dep_clock = cc.find_library('rt')
 endif
 
+dep_libdrm = dependency('libdrm', version : '>= 2.4.75',
+required : with_dri2 or with_dri3)
+if dep_libdrm.found()
+  pre_args += '-DHAVE_LIBDRM'
+endif
+
 # TODO: some of these may be conditional
 dep_zlib = dependency('zlib', version : '>= 1.2.3')
 dep_thread = dependency('threads')
-pre_args += '-DHAVE_PTHREAD'
+if dep_thread.found() and host_machine.system() == 'linux'
+  pre_args += '-DHAVE_PTHREAD'
+endif
 dep_elf = dependency('libelf', required : false)
 if not dep_elf.found()
   dep_elf = cc.find_library('elf', required : with_amd_vk) # TODO: clover, 
r600, radeonsi
@@ -503,18 +542,14 @@ dep_expat = dependency('expat')
 # this only exists on linux so either this is linux and it will be found, or
 # its not linux and and wont
 dep_m = cc.find_library('m', required : false)
-
-dep_libdrm_amdgpu = []
-if with_amd_vk
-  dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82')
-endif
+dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.82', 
required : with_amd_vk)
 
 llvm_modules = ['bitwriter', 'engine', 'mcdisassembler', 'mcjit']
 if with_amd_vk
   llvm_modules += ['amdgpu', 'bitreader', 'ipo']
 endif
 dep_llvm = dependency(
-  'llvm', version : '>= 3.9.0', required : false, modules : llvm_modules,
+  'llvm', version : '>= 3.9.0', required : with_amd_vk, modules : llvm_modules,
 )
 if with_llvm
   if dep_llvm.found()
@@ -589,63 +624,47 @@ else

[Mesa-dev] [PATCH v3 08/21] meson: build libmesa_gallium

2017-10-13 Thread Dylan Baker
Signed-off-by: Dylan Baker 
Reviewed-by: Eric Anholt 
---
 meson.build  |  25 +
 meson_options.txt|   2 +
 src/mesa/meson.build | 143 ++-
 3 files changed, 158 insertions(+), 12 deletions(-)

diff --git a/meson.build b/meson.build
index ff2ce55e924..0ffa280b7e4 100644
--- a/meson.build
+++ b/meson.build
@@ -90,12 +90,17 @@ if _drivers != ''
   with_dri = true
 endif
 
-dep_libdrm_intel = []
-if with_dri_i915
-  dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
+with_gallium = false
+with_gallium_radeonsi = false
+_drivers = get_option('gallium-drivers')
+if _drivers != ''
+  _split = _drivers.split(',')
+  with_gallium_radeonsi = _split.contains('radeonsi')
+  with_gallium = true
+  with_dri = true
 endif
 
-if not with_dri
+if not (with_dri or with_gallium)
   with_gles1 = false
   with_gles2 = false
   with_opengl = false
@@ -103,12 +108,14 @@ if not with_dri
   with_shared_glapi = false
 endif
 
+dep_libdrm_intel = []
+if with_dri_i915
+  dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
+endif
+
 # TODO: other OSes
 with_dri_platform = 'drm'
 
-with_gallium = false
-# TODO: gallium drivers
-
 # TODO: conditionalize libdrm requirement
 dep_libdrm = dependency('libdrm', version : '>= 2.4.75')
 pre_args += '-DHAVE_LIBDRM'
@@ -207,7 +214,7 @@ if _vulkan_drivers != ''
   endif
 endif
 
-if with_dri # TODO: or gallium
+if with_dri or with_gallium
   if with_glx == 'disabled' # TODO: or egl
 error('building dri or gallium drivers require at least one window system')
   endif
@@ -564,8 +571,6 @@ dep_selinux = []
 # TODO: flags for xa, egl, gbm, nin, xvmc, vdpau, omx, va, opencl,
 #   gallium-tests,
 
-# TODO: gallium drivers
-
 # TODO: symbol mangling
 
 # TODO: egl configuration
diff --git a/meson_options.txt b/meson_options.txt
index 21cf07ea934..c9e95263cd2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -26,6 +26,8 @@ option('dri-drivers', type : 'string', value : 
'swrast,i915,i965',
description : 'comma separated list of dri drivers to build.')
 option('dri-drivers-path', type : 'string', value : '',
description : 'Location of dri drivers. Default: $libdir/dri.')
+option('gallium-drivers', type : 'string', value : 'radeonsi',
+   description : 'comma separated list of gallium drivers to build.')
 option('vulkan-drivers', type : 'string', value : 'intel,amd',
description : 'comma separated list of vulkan drivers to build.')
 option('shader-cache', type : 'boolean', value : true,
diff --git a/src/mesa/meson.build b/src/mesa/meson.build
index c96105faae4..d55b03c7187 100644
--- a/src/mesa/meson.build
+++ b/src/mesa/meson.build
@@ -350,6 +350,7 @@ files_libmesa_common = files(
   'vbo/vbo_split_copy.c',
   'vbo/vbo_split.h',
   'vbo/vbo_split_inplace.c',
+  'x86/common_x86.c',
 )
 
 # mesa files
@@ -456,7 +457,6 @@ files_libmesa_classic = files(
   'drivers/common/meta_generate_mipmap.c',
   'drivers/common/meta.c',
   'drivers/common/meta.h',
-  'x86/common_x86.c',
   'x86/x86_xform.c',
   'x86/3dnow.c',
   'x86/sse.c',
@@ -466,6 +466,137 @@ files_libmesa_classic = files(
   'x86-64/x86-64.c',
 )
 
+files_libmesa_gallium = files(
+  'state_tracker/st_atifs_to_tgsi.c',
+  'state_tracker/st_atifs_to_tgsi.h',
+  'state_tracker/st_atom_array.c',
+  'state_tracker/st_atom_atomicbuf.c',
+  'state_tracker/st_atom_blend.c',
+  'state_tracker/st_atom.c',
+  'state_tracker/st_atom_clip.c',
+  'state_tracker/st_atom_constbuf.c',
+  'state_tracker/st_atom_constbuf.h',
+  'state_tracker/st_atom_depth.c',
+  'state_tracker/st_atom_framebuffer.c',
+  'state_tracker/st_atom.h',
+  'state_tracker/st_atom_list.h',
+  'state_tracker/st_atom_image.c',
+  'state_tracker/st_atom_msaa.c',
+  'state_tracker/st_atom_pixeltransfer.c',
+  'state_tracker/st_atom_rasterizer.c',
+  'state_tracker/st_atom_sampler.c',
+  'state_tracker/st_atom_scissor.c',
+  'state_tracker/st_atom_shader.c',
+  'state_tracker/st_atom_shader.h',
+  'state_tracker/st_atom_stipple.c',
+  'state_tracker/st_atom_storagebuf.c',
+  'state_tracker/st_atom_tess.c',
+  'state_tracker/st_atom_texture.c',
+  'state_tracker/st_atom_viewport.c',
+  'state_tracker/st_cb_bitmap.c',
+  'state_tracker/st_cb_bitmap.h',
+  'state_tracker/st_cb_bitmap_shader.c',
+  'state_tracker/st_cb_blit.c',
+  'state_tracker/st_cb_blit.h',
+  'state_tracker/st_cb_bufferobjects.c',
+  'state_tracker/st_cb_bufferobjects.h',
+  'state_tracker/st_cb_clear.c',
+  'state_tracker/st_cb_clear.h',
+  'state_tracker/st_cb_compute.c',
+  'state_tracker/st_cb_compute.h',
+  'state_tracker/st_cb_condrender.c',
+  'state_tracker/st_cb_condrender.h',
+  'state_tracker/st_cb_copyimage.c',
+  'state_tracker/st_cb_copyimage.h',
+  'state_tracker/st_cb_drawpixels.c',
+  'state_tracker/st_cb_drawpixels.h',
+  'state_tracker/st_cb_drawpixels_shader.c',
+  'state_tracker/st_cb_drawtex.c',
+  

[Mesa-dev] [PATCH v3 04/21] meson: Set _GNU_SOURCE

2017-10-13 Thread Dylan Baker
When we start adding non-free software platforms support we'll need to
guard this, but for now it should be fine as is.

Signed-off-by: Dylan Baker 
Reviewed-by: Eric Anholt 
---
 meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meson.build b/meson.build
index 2f73215ca52..e68469262bf 100644
--- a/meson.build
+++ b/meson.build
@@ -31,6 +31,7 @@ pre_args = [
   '-DVERSION="@0@"'.format(meson.project_version()),
   '-DPACKAGE_VERSION=VERSION',
   
'-DPACKAGE_BUGREPORT="https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa;',
+  '-D_GNU_SOURCE',
 ]
 
 with_vulkan_icd_dir = get_option('vulkan-icd-dir')
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 06/21] meson: always set GLX_USE_TLS

2017-10-13 Thread Dylan Baker
This can be applied to all GLX implementations, and in autotools this is
guarded only by the --enable-glx-tls flag. Since this is on by default
in autotools, and is strictly better than being off, the meson build
doesn't even have a toggle for it.

Signed-off-by: Dylan Baker 
Reviewed-by: Eric Anholt 
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index e68469262bf..17187f3d909 100644
--- a/meson.build
+++ b/meson.build
@@ -151,9 +151,9 @@ else
   with_gbm = false
 endif
 
+pre_args += '-DGLX_USE_TLS'
 with_glx = get_option('glx')
 if with_glx != 'disabled'
-  pre_args += '-DGLX_USE_TLS'
   if not (with_platform_x11 and with_any_opengl) and with_glx != 'auto'
 error('Cannot build GLX support without X11 platform support and at least 
one OpenGL API')
   elif with_glx == 'gallium-xlib' 
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 07/21] meson: Add option to toggle LLVM

2017-10-13 Thread Dylan Baker
Signed-off-by: Dylan Baker 
Reviewed-by: Eric Anholt 
---
 meson.build   | 35 ---
 meson_options.txt |  1 +
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/meson.build b/meson.build
index 17187f3d909..ff2ce55e924 100644
--- a/meson.build
+++ b/meson.build
@@ -38,6 +38,7 @@ with_vulkan_icd_dir = get_option('vulkan-icd-dir')
 with_tests = get_option('build-tests')
 with_valgrind = get_option('valgrind')
 with_asm = get_option('asm')
+with_llvm = get_option('llvm')
 if get_option('texture-float')
   pre_args += '-DTEXTURE_FLOAT_ENABLED'
   message('WARNING: Floating-point texture enabled. Please consult 
docs/patents.txt and your lawyer before building mesa.')
@@ -506,22 +507,26 @@ endif
 dep_llvm = dependency(
   'llvm', version : '>= 3.9.0', required : false, modules : llvm_modules,
 )
-if not dep_llvm.found()
-  if with_amd_vk
-error('Radv requires llvm.')
-  endif
-else
-  _llvm_version = dep_llvm.version().split('.')
-  # Development versions of LLVM have an 'svn' suffix, we don't want that for
-  # our version checks.
-  _llvm_patch = _llvm_version[2]
-  if _llvm_patch.endswith('svn')
-_llvm_patch = _llvm_patch.split('s')[0]
+if with_llvm
+  if dep_llvm.found()
+_llvm_version = dep_llvm.version().split('.')
+# Development versions of LLVM have an 'svn' suffix, we don't want that for
+# our version checks.
+_llvm_patch = _llvm_version[2]
+if _llvm_patch.endswith('svn')
+  _llvm_patch = _llvm_patch.split('s')[0]
+endif
+pre_args += [
+  '-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], 
_llvm_patch),
+  '-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
+]
+  else
+if with_amd_vk
+  error('The following drivers requires LLVM: Radv. One of these is 
enabled, but LLVM was not found.')
+endif
   endif
-  pre_args += [
-'-DHAVE_LLVM=0x0@0@@1@@2@'.format(_llvm_version[0], _llvm_version[1], 
_llvm_patch),
-'-DMESA_LLVM_VERSION_PATCH=@0@'.format(_llvm_patch),
-  ]
+elif with_amd_vk
+  error('The following drivers requires LLVM: Radv. One of these is enabled, 
but LLVM is disabled.')
 endif
 
 dep_glvnd = []
diff --git a/meson_options.txt b/meson_options.txt
index e0a162a0b82..21cf07ea934 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -48,6 +48,7 @@ option('glvnd', type : 'boolean', value : false,
description : 'Enable GLVND support.')
 option('asm', type : 'boolean', value : true,
description : 'Build assembly code if possible')
+option('llvm', type : 'boolean', value : true, description : 'Build with LLVM 
support.')
 option('valgrind', type : 'boolean', value : true,
description : 'Build with valgrind support if possible')
 option('build-tests', type : 'boolean', value : false,
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 12/21] meson: build gallium helper drivers

2017-10-13 Thread Dylan Baker
This builds ddebug, noop, rbug, and trace drivers.

Signed-off-by: Dylan Baker 
---
 src/gallium/{ => drivers/ddebug}/meson.build | 13 -
 src/gallium/{ => drivers/noop}/meson.build   | 12 +++-
 src/gallium/{ => drivers/rbug}/meson.build   | 13 -
 src/gallium/{ => drivers/trace}/meson.build  | 14 +-
 src/gallium/meson.build  |  4 
 5 files changed, 36 insertions(+), 20 deletions(-)
 copy src/gallium/{ => drivers/ddebug}/meson.build (79%)
 copy src/gallium/{ => drivers/noop}/meson.build (82%)
 copy src/gallium/{ => drivers/rbug}/meson.build (77%)
 copy src/gallium/{ => drivers/trace}/meson.build (72%)

diff --git a/src/gallium/meson.build b/src/gallium/drivers/ddebug/meson.build
similarity index 79%
copy from src/gallium/meson.build
copy to src/gallium/drivers/ddebug/meson.build
index 50708d146fc..09ede3d04d4 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/drivers/ddebug/meson.build
@@ -18,8 +18,11 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-inc_gallium = include_directories('include')
-inc_gallium_winsys = include_directories('winsys')
-
-subdir('auxiliary')
-subdir('auxiliary/pipe-loader')
+libddebug = static_library(
+  'ddebug',
+  files('dd_context.c', 'dd_draw.c', 'dd_pipe.h', 'dd_public.h', 'dd_screen.c',
+'dd_util.h'),
+  c_args : [c_vis_args],
+  include_directories : [inc_gallium, inc_include, inc_src, inc_gallium_aux],
+  build_by_default : false,
+)
diff --git a/src/gallium/meson.build b/src/gallium/drivers/noop/meson.build
similarity index 82%
copy from src/gallium/meson.build
copy to src/gallium/drivers/noop/meson.build
index 50708d146fc..c4bb1508e3c 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/drivers/noop/meson.build
@@ -18,8 +18,10 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-inc_gallium = include_directories('include')
-inc_gallium_winsys = include_directories('winsys')
-
-subdir('auxiliary')
-subdir('auxiliary/pipe-loader')
+libnoop = static_library(
+  'noop',
+  files('noop_pipe.c', 'noop_public.h', 'noop_state.c'),
+  c_args : [c_vis_args],
+  include_directories : [inc_gallium, inc_include, inc_src, inc_gallium_aux],
+  build_by_default : false,
+)
diff --git a/src/gallium/meson.build b/src/gallium/drivers/rbug/meson.build
similarity index 77%
copy from src/gallium/meson.build
copy to src/gallium/drivers/rbug/meson.build
index 50708d146fc..9c74171f7b5 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/drivers/rbug/meson.build
@@ -18,8 +18,11 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-inc_gallium = include_directories('include')
-inc_gallium_winsys = include_directories('winsys')
-
-subdir('auxiliary')
-subdir('auxiliary/pipe-loader')
+librbug = static_library(
+  'rbug',
+  files('rbug_context.c', 'rbug_context.h', 'rbug_core.c', 'rbug_objects.c',
+'rbug_objects.h', 'rbug_public.h', 'rbug_screen.c', 'rbug_screen.h'),
+  include_directories : [inc_gallium, inc_gallium_aux, inc_include, inc_src],
+  c_args : [c_vis_args],
+  build_by_default : false,
+)
diff --git a/src/gallium/meson.build b/src/gallium/drivers/trace/meson.build
similarity index 72%
copy from src/gallium/meson.build
copy to src/gallium/drivers/trace/meson.build
index 50708d146fc..4fc5d8ba0f6 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/drivers/trace/meson.build
@@ -18,8 +18,12 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-inc_gallium = include_directories('include')
-inc_gallium_winsys = include_directories('winsys')
-
-subdir('auxiliary')
-subdir('auxiliary/pipe-loader')
+libtrace = static_library(
+  'trace',
+  files('tr_context.c', 'tr_context.h', 'tr_dump.c', 'tr_dump_defines.h',
+'tr_dump.h', 'tr_dump_state.c', 'tr_dump_state.h', 'tr_public.h',
+'tr_screen.c', 'tr_screen.h', 'tr_texture.c', 'tr_texture.h'),
+  c_args : [c_msvc_compat_args, c_vis_args],
+  include_directories : [inc_gallium, inc_gallium_aux, inc_include, inc_src],
+  build_by_default : false,
+)
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index 50708d146fc..d69c3aeca39 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -23,3 +23,7 @@ inc_gallium_winsys = include_directories('winsys')
 
 subdir('auxiliary')
 subdir('auxiliary/pipe-loader')
+subdir('drivers/ddebug')
+subdir('drivers/noop')
+subdir('drivers/trace')
+subdir('drivers/rbug')
-- 
2.14.2

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


[Mesa-dev] [PATCH v3 02/21] configure: commit test files

2017-10-13 Thread Dylan Baker
These are currently auto-generated, but meson needs the same files, so
lets commit them to reduce duplication.

v3: - Rename .build to build-support

cc:  Emil Velikov 
Signed-off-by: Dylan Baker 
---

I ran make dist and that works (after patching out the swr llvm 3.9 check). I
alos built that tarball and the build succeeded. dist-check fails with missing
libdrm_freedreno.

 Makefile.am|  4 +++-
 build-support/conftest.dyn |  3 +++
 build-support/conftest.map |  6 ++
 configure.ac   | 18 ++
 4 files changed, 14 insertions(+), 17 deletions(-)
 create mode 100644 build-support/conftest.dyn
 create mode 100644 build-support/conftest.map

diff --git a/Makefile.am b/Makefile.am
index a4f49d3d332..fe1ef948918 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,7 +56,9 @@ EXTRA_DIST = \
doxygen \
bin/git_sha1_gen.py \
scons \
-   SConstruct
+   SConstruct \
+   build-support/conftest.dyn \
+   build-support/conftest.map
 
 noinst_HEADERS = \
include/c99_alloca.h \
diff --git a/build-support/conftest.dyn b/build-support/conftest.dyn
new file mode 100644
index 000..8d243dc0a79
--- /dev/null
+++ b/build-support/conftest.dyn
@@ -0,0 +1,3 @@
+{
+   radeon_drm_winsys_create;
+};
diff --git a/build-support/conftest.map b/build-support/conftest.map
new file mode 100644
index 000..7d8590ff357
--- /dev/null
+++ b/build-support/conftest.map
@@ -0,0 +1,6 @@
+VERSION_1 {
+global:
+main;
+local:
+*;
+};
diff --git a/configure.ac b/configure.ac
index 62d33a1941c..bbabf3bed7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -606,16 +606,7 @@ dnl Check if linker supports version scripts
 dnl
 AC_MSG_CHECKING([if the linker supports version-scripts])
 save_LDFLAGS=$LDFLAGS
-LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
-cat > conftest.map < conftest.dyn 

[Mesa-dev] [Bug 103265] [llvmpipe] piglit depth-tex-compare regression

2017-10-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103265

--- Comment #1 from Roland Scheidegger  ---
(In reply to Vinson Lee from comment #0)
> commit be3ab867bd444594f9d9e0f8e59d305d15769afd
> Author: Marek Olšák 
> Date:   Mon Oct 2 22:30:55 2017 +0200
> 
> tgsi: implement tgsi_util_get_inst_usage_mask properly
> 
> All opcodes are handled.
> 
> Reviewed-by: Nicolai Hähnle 


Looks buggy indeed - for texture opcodes it tries to subtract the shadow coord
from dimension for dim_layer however the value from
tgsi_util_get_texture_coord_dim() never includes that in the first place. And
therefore dim_layer_shadow (which is used to determine the mask in this case)
would be wrong too (just XY instead of XYZ for 2d shadow texture).

-- 
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
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 103266] [llvmpipe] piglit sampler-cube-shadow regression

2017-10-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103266

Bug ID: 103266
   Summary: [llvmpipe] piglit sampler-cube-shadow regression
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: bisected, regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: mar...@gmail.com, nhaeh...@gmail.com

mesa: 77d3d71f23b32550b045b5f74b7a5e6ca54d83c5 (master 17.3.0-devel)

$ ./bin/sampler-cube-shadow -auto
Probe color at (101,170)
  Expected: 1.00 1.00 1.00
  Observed: 0.00 0.00 0.00
PIGLIT: {"result": "fail" }

be3ab867bd444594f9d9e0f8e59d305d15769afd is the first bad commit
commit be3ab867bd444594f9d9e0f8e59d305d15769afd
Author: Marek Olšák 
Date:   Mon Oct 2 22:30:55 2017 +0200

tgsi: implement tgsi_util_get_inst_usage_mask properly

All opcodes are handled.

Reviewed-by: Nicolai Hähnle 

:04 04 d1db49cee47cbe6ea3ac52d46bbf4a612f14d3be
11c3d50751b4c921bec7cf463e8c52d4162af19e M  src
bisect run success

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


Re: [Mesa-dev] [PATCH 0/6] Prehash all the things

2017-10-13 Thread Dieter Nützel

Thank you Thomas for the update, then.
Awaiting your coming work.

Regards,
Dieter

Am 10.10.2017 15:22, schrieb Thomas Helland:

Hi!

Thanks for keeping up with the long wait =)
I revisited this not too long ago, and found that with the new
pointer hashing function the benefits are zero to negative
from this series. I've reduced it to only the instruction set and
the string_to_uint_map patch but it's not convincing.
I suspect we are seeing cache miss vs hashing tradeoffs.
So I've basically put it to rest for now. Might give it another
go sometime, but I think right now the effort is better spent
elsewhere in the codebase.

Greetings,
Thomas

2017-10-09 14:02 GMT+02:00 Dieter Nützel :

Hello Thomas,

now, that you have write commit 'only' this one is missing.
Maybe you have time for this.

Latest version do not apply any longer.

Wende an: util: Avoid computing hash twice in string_to_uint_map
error: src/util/string_to_uint_map.h ist nicht im Index
Anwendung des Patches fehlgeschlagen bei 0006 util: Avoid computing 
hash

twice in string_to_uint_map

Greetings,
Dieter


Am 19.06.2017 18:09, schrieb Dieter Nützel:


Ping!

Any news, reviews --- anyone?

I'm running this all day without a hitch.

Cheers,
Dieter

Am 23.05.2017 05:40, schrieb Dieter Nützel:


For the series:

Tested-by: Dieter Nützel 

on radeonsi/RX580

Unigine_Heaven-4.0, Unigine_Valley-1.0, Unigine_Superposition-1.0,
LS2015 (Wine-staging), Mesa-demos (objviewer)

Dieter

Am 22.05.2017 20:55, schrieb Thomas Helland:


While this doesn't prehash all the things, it does switch quite a 
lot

of places from doing a search and then a subsequent insert to first
hash the key, and then use this hash when searching / inserting.
While our new pointer hashing function remedied much of our 
overhead
hashing pointers, there is still more to gain here. This cuts 
executed
instructions / task-clock by about 0.5% on a shader-db run on my 
i965

running machine. While that's not a lot, it is still a nice little
improvement on the way to less overhead. The changes should also be
fairly trivial, so it's not much of a burden.

Thomas Helland (6):
  glsl: Prehash in refcount hash table to reduce hashing
  nir: Prehash in instr_set to avoid hashing twice
  glsl: Prehash in constant propagation
  glsl: Prehash in constant variable pass to avoid hashing twice
  glsl: Prehash to avoid computing the hash twice
  util: Avoid computing hash twice in string_to_uint_map

 src/compiler/glsl/ir_variable_refcount.cpp  | 7 +--
 src/compiler/glsl/opt_constant_propagation.cpp  | 8 +---
 src/compiler/glsl/opt_constant_variable.cpp | 6 --
 src/compiler/glsl/opt_copy_propagation_elements.cpp | 7 +--
 src/compiler/nir/nir_instr_set.c| 7 +--
 src/util/string_to_uint_map.h   | 9 ++---
 6 files changed, 30 insertions(+), 14 deletions(-)


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


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

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


[Mesa-dev] [Bug 103265] [llvmpipe] piglit depth-tex-compare regression

2017-10-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103265

Bug ID: 103265
   Summary: [llvmpipe] piglit depth-tex-compare regression
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Keywords: bisected, regression
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: mar...@gmail.com, nhaeh...@gmail.com

mesa: 77d3d71f23b32550b045b5f74b7a5e6ca54d83c5 (master 17.3.0-devel)

$ ./bin/depth-tex-compare -auto
Probe color at (23,285)
  Expected: 1.00 0.00 1.00
  Observed: 1.00 1.00 1.00
Probe color at (79,285)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (85,285)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (91,285)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (129,285)
  Expected: 0.00 1.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (135,285)
  Expected: 0.00 1.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (141,285)
  Expected: 0.00 1.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (23,250)
  Expected: 1.00 0.00 1.00
  Observed: 1.00 1.00 1.00
Probe color at (79,250)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (129,250)
  Expected: 0.00 1.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (23,215)
  Expected: 1.00 1.00 1.00
  Observed: 1.00 0.00 1.00
Probe color at (79,215)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 0.00 0.00
Probe color at (129,215)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 1.00 0.00
Probe color at (23,180)
  Expected: 1.00 1.00 1.00
  Observed: 1.00 0.00 1.00
Probe color at (79,180)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 0.00 0.00
Probe color at (85,180)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 0.00 0.00
Probe color at (91,180)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 0.00 0.00
Probe color at (129,180)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 1.00 0.00
Probe color at (135,180)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 1.00 0.00
Probe color at (141,180)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 1.00 0.00
Probe color at (85,75)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (91,75)
  Expected: 0.00 0.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (135,75)
  Expected: 0.00 1.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (141,75)
  Expected: 0.00 1.00 0.00
  Observed: 1.00 0.00 1.00
Probe color at (85,40)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 0.00 0.00
Probe color at (91,40)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 0.00 0.00
Probe color at (135,40)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 1.00 0.00
Probe color at (141,40)
  Expected: 1.00 0.00 1.00
  Observed: 0.00 1.00 0.00
Left to Right: ALPHA, LUMINANCE, INTENSITY
Top to Bottom: LESS, LEQUAL, GREATER, GEQUAL, ALWAYS, NEVER, NOTEQUAL, EQUAL
PIGLIT: {"result": "fail" }


be3ab867bd444594f9d9e0f8e59d305d15769afd is the first bad commit
commit be3ab867bd444594f9d9e0f8e59d305d15769afd
Author: Marek Olšák 
Date:   Mon Oct 2 22:30:55 2017 +0200

tgsi: implement tgsi_util_get_inst_usage_mask properly

All opcodes are handled.

Reviewed-by: Nicolai Hähnle 

:04 04 d1db49cee47cbe6ea3ac52d46bbf4a612f14d3be
11c3d50751b4c921bec7cf463e8c52d4162af19e M  src
bisect run success

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


[Mesa-dev] [Bug 103264] cache-test fails on Mac OS X 10.13

2017-10-13 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103264

Bug ID: 103264
   Summary: cache-test fails on Mac OS X 10.13
   Product: Mesa
   Version: git
  Hardware: x86-64 (AMD64)
OS: Mac OS X (All)
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: v...@freedesktop.org
QA Contact: mesa-dev@lists.freedesktop.org
CC: t_arc...@yahoo.com.au

mesa: 77d3d71f23b32550b045b5f74b7a5e6ca54d83c5 (master 17.3.0-devel)


   Mesa 17.3.0-devel: src/compiler/test-suite.log


# TOTAL: 10
# PASS:  9
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: glsl/tests/cache-test
===

Failed to create ./cache-test-tmp/xdg-cache-home for shader cache (No such file
or directory)---disabling.
Failed to create ./cache-test-tmp/mesa-glsl-cache-dir for shader cache (No such
file or directory)---disabling.
Error: Test 'disk_cache_put eviction with MAX_SIZE=1K' failed: Expected=1,
Actual=3
Error: Test 'eviction after overflow with MAX_SIZE=1M' failed: Expected=1,
Actual=4
FAIL glsl/tests/cache-test (exit status: 1)

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


Re: [Mesa-dev] [PATCH] blob: Use intptr_t instead of ssize_t

2017-10-13 Thread Vinson Lee
On Fri, Oct 13, 2017 at 10:44 AM, Jason Ekstrand  wrote:
> ssize_t is a GNU extension and is not available on Windows or MacOS.
> Instead, we use intptr_t which should be effectively equivalent and is
> part of the C standard.  This should fix the Windows and Mac OS builds.
>
> Cc: Jose Fonseca 
> Cc: Vinson Lee 
> Fixes: 3af1c829891a4530682bce113fdd512d4f2de3c6
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103253
> ---
>  src/compiler/blob.c   | 8 
>  src/compiler/blob.h   | 6 +++---
>  src/intel/vulkan/anv_pipeline_cache.c | 2 +-
>  3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/src/compiler/blob.c b/src/compiler/blob.c
> index f0fa85e..8dd254f 100644
> --- a/src/compiler/blob.c
> +++ b/src/compiler/blob.c
> @@ -158,10 +158,10 @@ blob_write_bytes(struct blob *blob, const void *bytes, 
> size_t to_write)
> return true;
>  }
>
> -ssize_t
> +intptr_t
>  blob_reserve_bytes(struct blob *blob, size_t to_write)
>  {
> -   ssize_t ret;
> +   intptr_t ret;
>
> if (! grow_to_fit (blob, to_write))
>return -1;
> @@ -172,14 +172,14 @@ blob_reserve_bytes(struct blob *blob, size_t to_write)
> return ret;
>  }
>
> -ssize_t
> +intptr_t
>  blob_reserve_uint32(struct blob *blob)
>  {
> align_blob(blob, sizeof(uint32_t));
> return blob_reserve_bytes(blob, sizeof(uint32_t));
>  }
>
> -ssize_t
> +intptr_t
>  blob_reserve_intptr(struct blob *blob)
>  {
> align_blob(blob, sizeof(intptr_t));
> diff --git a/src/compiler/blob.h b/src/compiler/blob.h
> index f0f28ec..2b975d4 100644
> --- a/src/compiler/blob.h
> +++ b/src/compiler/blob.h
> @@ -135,7 +135,7 @@ blob_write_bytes(struct blob *blob, const void *bytes, 
> size_t to_write);
>   * \return An offset to space allocated within \blob to which \to_write bytes
>   * can be written, (or -1 in case of any allocation error).
>   */
> -ssize_t
> +intptr_t
>  blob_reserve_bytes(struct blob *blob, size_t to_write);
>
>  /**
> @@ -143,7 +143,7 @@ blob_reserve_bytes(struct blob *blob, size_t to_write);
>   * space. Note that this must be used if later reading with \sa
>   * blob_read_uint32, since it aligns the offset correctly.
>   */
> -ssize_t
> +intptr_t
>  blob_reserve_uint32(struct blob *blob);
>
>  /**
> @@ -151,7 +151,7 @@ blob_reserve_uint32(struct blob *blob);
>   * space. Note that this must be used if later reading with \sa
>   * blob_read_intptr, since it aligns the offset correctly.
>   */
> -ssize_t
> +intptr_t
>  blob_reserve_intptr(struct blob *blob);
>
>  /**
> diff --git a/src/intel/vulkan/anv_pipeline_cache.c 
> b/src/intel/vulkan/anv_pipeline_cache.c
> index ad9c810..82551e9 100644
> --- a/src/intel/vulkan/anv_pipeline_cache.c
> +++ b/src/intel/vulkan/anv_pipeline_cache.c
> @@ -449,7 +449,7 @@ VkResult anv_GetPipelineCacheData(
> blob_write_bytes(, , sizeof(header));
>
> uint32_t count = 0;
> -   ssize_t count_offset = blob_reserve_uint32();
> +   intptr_t count_offset = blob_reserve_uint32();
> if (count_offset < 0) {
>*pDataSize = 0;
>blob_finish();
> --
> 2.5.0.400.gff86faf
>


This patch fixes the Mac OS X build error.

Tested-by: Vinson Lee 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mapi/shared-glapi/test: rework glapitable.h handling

2017-10-13 Thread Emil Velikov
On 13 October 2017 at 19:13, Dylan Baker  wrote:
> Quoting Emil Velikov (2017-10-13 08:35:47)
>> From: Emil Velikov 
>>
>> Currently all the build systems but Meson generate the header in
>> src/mapi/glapi. Meson cannot do that since:
>>  - it does not allow user control over the location of output files
>>  - moving the generation rule(s) causes explosion due to the unusual
>> structure of glapi and friends
>>  - copying the file into the correct location is a non-trivial task
>>
>> To workaround the above deficiency in the least invasive way, let's
>> adjust the #include directive and add a few -I flags to the autotools
>> build.
>>
>> Note: both builddir and srcdir, should be used. Otherwise building from
>> a release tarball fails badly.
>>
>> Cc: Dylan Baker 
>> Signed-off-by: Emil Velikov 
>> ---
>> Dylan seems like glapi_gentable.c dependency tracking is broken/missing.
>> Furthermore the tests seems to be broken on Meson even w/o my revert :-(
>> ---
>>  src/mapi/Makefile.am| 5 +++--
>>  src/mapi/shared-glapi/tests/check_table.cpp | 2 +-
>>  2 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
>> index 83e32d2185e..3f8fcc02e55 100644
>> --- a/src/mapi/Makefile.am
>> +++ b/src/mapi/Makefile.am
>> @@ -47,7 +47,9 @@ AM_CPPFLAGS =  
>>\
>> -I$(top_srcdir)/include \
>> -I$(top_srcdir)/src \
>> -I$(top_builddir)/src/mapi  \
>> -   -I$(top_srcdir)/src/mapi
>> +   -I$(top_srcdir)/src/mapi\
>> +   -I$(top_builddir)/src/mapi/glapi\
>> +   -I$(top_srcdir)/src/mapi/glapi
>>
>>  include Makefile.sources
>>
>> @@ -113,7 +115,6 @@ endif
>>  glapi_libglapi_la_SOURCES =
>>  glapi_libglapi_la_CPPFLAGS = \
>> $(AM_CPPFLAGS) \
>> -   -I$(top_srcdir)/src/mapi/glapi \
>> -I$(top_srcdir)/src/mesa
>>
>>  if HAVE_APPLEDRI
>> diff --git a/src/mapi/shared-glapi/tests/check_table.cpp 
>> b/src/mapi/shared-glapi/tests/check_table.cpp
>> index 02d313c22d3..314e6769b49 100644
>> --- a/src/mapi/shared-glapi/tests/check_table.cpp
>> +++ b/src/mapi/shared-glapi/tests/check_table.cpp
>> @@ -25,7 +25,7 @@
>>  #include "../../../mesa/main/glheader.h"
>>
>>  #include "glapi/glapi.h"
>> -#include "glapi/glapitable.h"
>> +#include "glapitable.h"
>>
>>  struct name_offset {
>> const char *name;
>> --
>> 2.14.1
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
> I went ahead and pushed this, it has review and testing and this will unbreak
> our CI. Thanks for looking into this.
>
Thanks for that, just came back from dinner.
You're right, I should not have reverted w/o checking with you. I was
not expecting that you'll immediately switch to Meson.

Looking at Martin Peres' talk at XDC I'm wondering ...

Can one convince Jenkins to send a lovely email to the list if things break?
Sort of like how Appveyor does it. It should safe you guys some time.

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


[Mesa-dev] [PATCH] meson: build mesa test.

2017-10-13 Thread Dylan Baker
Signed-off-by: Dylan Baker 
---
 src/mesa/main/tests/meson.build | 44 +
 src/mesa/meson.build|  3 +++
 2 files changed, 47 insertions(+)
 create mode 100644 src/mesa/main/tests/meson.build

diff --git a/src/mesa/main/tests/meson.build b/src/mesa/main/tests/meson.build
new file mode 100644
index 000..cac87d8dcac
--- /dev/null
+++ b/src/mesa/main/tests/meson.build
@@ -0,0 +1,44 @@
+# Copyright ?? 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_main_test = files('enum_strings.cpp')
+link_main_test = []
+
+if with_shared_glapi
+  files_main_test += files(
+'dispatch_sanity.cpp',
+'mesa_formats.cpp',
+'mesa_extensions.cpp',
+'program_state_string.cpp',
+  )
+  link_main_test += libglapi
+else
+  files_main_test += files('stub.cpp')
+endif
+
+main_test = executable(
+  'main_test',
+  files_main_test,
+  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa],
+  dependencies : [idep_gtest, dep_clock, dep_dl, dep_thread],
+  link_with : [libmesa_classic, link_main_test],
+)
+
+test('main-test', main_test)
diff --git a/src/mesa/meson.build b/src/mesa/meson.build
index c96105faae4..b40146c0984 100644
--- a/src/mesa/meson.build
+++ b/src/mesa/meson.build
@@ -579,3 +579,6 @@ libmesa_classic = static_library(
 # TODO: gallium
 
 subdir('drivers/dri')
+if with_tests
+  subdir('main/tests')
+endif
-- 
2.14.2

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


Re: [Mesa-dev] [PATCH v1] clover/llvm: Drop support for LLVM < 3.9.

2017-10-13 Thread Francisco Jerez
Emil Velikov  writes:

> Hi Vedran,
>
> Just pushed the LLVM version bump, so this patch should be able to go in.
> I won't be able to offer any review here, apart from a small suggestion.
>
> On 9 October 2017 at 00:08, Vedran Miletić  wrote:
>
>>  #include 
>>  #include 
>> @@ -63,11 +56,7 @@
>>  namespace clover {
>> namespace llvm {
>>namespace compat {
>> -#if HAVE_LLVM >= 0x0307
>>   typedef ::llvm::TargetLibraryInfoImpl target_library_info;
>> -#else
>> - typedef ::llvm::TargetLibraryInfo target_library_info;
>> -#endif
>>
> With the guards gone, one should be able to remove/inline compat stuff
> like this.
> Not sure how much it matters or if one isn't going to need anyway for
> newer LLVM.
>

Agree with Emil, a few of these compatibility defininitions now become
trivial and could be folded into their uses.  Still seems like a good
start, patch is:

Reviewed-by: Francisco Jerez 

> -Emil


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


[Mesa-dev] [PATCH] egl/wayland: Support for KHR_partial_update

2017-10-13 Thread Harish Krupo
This passes 33/37 deqp tests related to partial_update, 4 are not
supported.

Signed-off-by: Harish Krupo 
---
 src/egl/drivers/dri2/platform_wayland.c | 68 -
 1 file changed, 59 insertions(+), 9 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 14db55ca74..483d588b92 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -810,15 +810,39 @@ try_damage_buffer(struct dri2_egl_surface *dri2_surf,
}
return EGL_TRUE;
 }
+
 /**
- * Called via eglSwapBuffers(), drv->API.SwapBuffers().
+ * Called via eglSetDamageRegionKHR(), drv->API.SetDamageRegion().
  */
 static EGLBoolean
-dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
- _EGLDisplay *disp,
- _EGLSurface *draw,
- const EGLint *rects,
- EGLint n_rects)
+wl_set_damage_region(_EGLDriver *drv,
+ _EGLDisplay *dpy,
+ _EGLSurface *surf,
+ const EGLint *rects,
+ EGLint n_rects)
+{
+   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
+
+   /* The spec doesn't mention what should be returned in case of
+* failure in setting the damage buffer with the window system, so
+* setting the damage to maximum surface area
+   */
+   if (!n_rects || !try_damage_buffer(dri2_surf, rects, n_rects)) {
+  wl_surface_damage(dri2_surf->wl_surface_wrapper,
+0, 0, INT32_MAX, INT32_MAX);
+  return EGL_TRUE;
+   }
+
+   return EGL_TRUE;
+}
+
+static EGLBoolean
+dri2_wl_swap_buffers_common(_EGLDriver *drv,
+_EGLDisplay *disp,
+_EGLSurface *draw,
+const EGLint *rects,
+EGLint n_rects,
+EGLBoolean with_damage)
 {
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
@@ -876,7 +900,17 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
/* If the compositor doesn't support damage_buffer, we deliberately
 * ignore the damage region and post maximum damage, due to
 * https://bugs.freedesktop.org/78190 */
-   if (!n_rects || !try_damage_buffer(dri2_surf, rects, n_rects))
+
+   if (!with_damage) {
+
+  /* If called from swapBuffers, check if the damage region
+   * is already set, if not set to full damage
+   */
+  if (!dri2_surf->base.SetDamageRegionCalled)
+ wl_surface_damage(dri2_surf->wl_surface_wrapper,
+   0, 0, INT32_MAX, INT32_MAX);
+   }
+   else if (!n_rects || !try_damage_buffer(dri2_surf, rects, n_rects))
   wl_surface_damage(dri2_surf->wl_surface_wrapper,
 0, 0, INT32_MAX, INT32_MAX);
 
@@ -912,6 +946,20 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
return EGL_TRUE;
 }
 
+/**
+ * Called via eglSwapBuffers(), drv->API.SwapBuffers().
+ */
+static EGLBoolean
+dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
+ _EGLDisplay *disp,
+ _EGLSurface *draw,
+ const EGLint *rects,
+ EGLint n_rects)
+{
+   return dri2_wl_swap_buffers_common(drv, disp, draw,
+  rects, n_rects, EGL_TRUE);
+}
+
 static EGLint
 dri2_wl_query_buffer_age(_EGLDriver *drv,
  _EGLDisplay *disp, _EGLSurface *surface)
@@ -929,7 +977,8 @@ dri2_wl_query_buffer_age(_EGLDriver *drv,
 static EGLBoolean
 dri2_wl_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
 {
-   return dri2_wl_swap_buffers_with_damage(drv, disp, draw, NULL, 0);
+   return dri2_wl_swap_buffers_common(drv, disp, draw,
+  NULL, 0, EGL_FALSE);
 }
 
 static struct wl_buffer *
@@ -1167,7 +1216,7 @@ static const struct dri2_egl_display_vtbl 
dri2_wl_display_vtbl = {
.swap_buffers = dri2_wl_swap_buffers,
.swap_buffers_with_damage = dri2_wl_swap_buffers_with_damage,
.swap_buffers_region = dri2_fallback_swap_buffers_region,
-   .set_damage_region = dri2_fallback_set_damage_region,
+   .set_damage_region = wl_set_damage_region,
.post_sub_buffer = dri2_fallback_post_sub_buffer,
.copy_buffers = dri2_fallback_copy_buffers,
.query_buffer_age = dri2_wl_query_buffer_age,
@@ -1379,6 +1428,7 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay 
*disp)
disp->Extensions.EXT_buffer_age = EGL_TRUE;
 
disp->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
+   disp->Extensions.KHR_partial_update = EGL_TRUE;
 
/* Fill vtbl last to prevent accidentally calling virtual function during
 * initialization.
-- 
2.14.2


Re: [Mesa-dev] [PATCH] mapi/shared-glapi/test: rework glapitable.h handling

2017-10-13 Thread Dylan Baker
Quoting Emil Velikov (2017-10-13 08:35:47)
> From: Emil Velikov 
> 
> Currently all the build systems but Meson generate the header in
> src/mapi/glapi. Meson cannot do that since:
>  - it does not allow user control over the location of output files
>  - moving the generation rule(s) causes explosion due to the unusual
> structure of glapi and friends
>  - copying the file into the correct location is a non-trivial task
> 
> To workaround the above deficiency in the least invasive way, let's
> adjust the #include directive and add a few -I flags to the autotools
> build.
> 
> Note: both builddir and srcdir, should be used. Otherwise building from
> a release tarball fails badly.
> 
> Cc: Dylan Baker 
> Signed-off-by: Emil Velikov 
> ---
> Dylan seems like glapi_gentable.c dependency tracking is broken/missing.
> Furthermore the tests seems to be broken on Meson even w/o my revert :-(
> ---
>  src/mapi/Makefile.am| 5 +++--
>  src/mapi/shared-glapi/tests/check_table.cpp | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
> index 83e32d2185e..3f8fcc02e55 100644
> --- a/src/mapi/Makefile.am
> +++ b/src/mapi/Makefile.am
> @@ -47,7 +47,9 @@ AM_CPPFLAGS =   
>   \
> -I$(top_srcdir)/include \
> -I$(top_srcdir)/src \
> -I$(top_builddir)/src/mapi  \
> -   -I$(top_srcdir)/src/mapi
> +   -I$(top_srcdir)/src/mapi\
> +   -I$(top_builddir)/src/mapi/glapi\
> +   -I$(top_srcdir)/src/mapi/glapi
>  
>  include Makefile.sources
>  
> @@ -113,7 +115,6 @@ endif
>  glapi_libglapi_la_SOURCES =
>  glapi_libglapi_la_CPPFLAGS = \
> $(AM_CPPFLAGS) \
> -   -I$(top_srcdir)/src/mapi/glapi \
> -I$(top_srcdir)/src/mesa
>  
>  if HAVE_APPLEDRI
> diff --git a/src/mapi/shared-glapi/tests/check_table.cpp 
> b/src/mapi/shared-glapi/tests/check_table.cpp
> index 02d313c22d3..314e6769b49 100644
> --- a/src/mapi/shared-glapi/tests/check_table.cpp
> +++ b/src/mapi/shared-glapi/tests/check_table.cpp
> @@ -25,7 +25,7 @@
>  #include "../../../mesa/main/glheader.h"
>  
>  #include "glapi/glapi.h"
> -#include "glapi/glapitable.h"
> +#include "glapitable.h"
>  
>  struct name_offset {
> const char *name;
> -- 
> 2.14.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

I went ahead and pushed this, it has review and testing and this will unbreak
our CI. Thanks for looking into this.

Dylan


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


Re: [Mesa-dev] [PATCH v2 21/52] intel/cs: Drop min_dispatch_width checks from compile_cs

2017-10-13 Thread Michael Schellenberger
Hi Jason, you actually dropped max_dispatch_width  so you might want to
update the commit message.
Michael

Am 13.10.2017 08:13 schrieb "Jason Ekstrand" :

The only things that adjust min_dispatch_width are render target writes
which don't happen in compute shaders so they're pointless.
---
 src/intel/compiler/brw_fs.cpp | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 676496f..1a44d00 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -6816,8 +6816,7 @@ brw_compile_cs(const struct brw_compiler *compiler,
void *log_data,
  NULL, /* Never used in core profile */
  shader, 16, shader_time_index);
if (likely(!(INTEL_DEBUG & DEBUG_NO16)) &&
-   !fail_msg && v8.max_dispatch_width >= 16 &&
-   min_dispatch_width <= 16) {
+   !fail_msg && min_dispatch_width <= 16) {
   /* Try a SIMD16 compile */
   if (min_dispatch_width <= 8)
  v16.import_uniforms();
@@ -6841,8 +6840,7 @@ brw_compile_cs(const struct brw_compiler *compiler,
void *log_data,
fs_visitor v32(compiler, log_data, mem_ctx, key, _data->base,
  NULL, /* Never used in core profile */
  shader, 32, shader_time_index);
-   if (!fail_msg && v8.max_dispatch_width >= 32 &&
-   (min_dispatch_width > 16 || (INTEL_DEBUG & DEBUG_DO32))) {
+   if (!fail_msg && (min_dispatch_width > 16 || (INTEL_DEBUG &
DEBUG_DO32))) {
   /* Try a SIMD32 compile */
   if (min_dispatch_width <= 8)
  v32.import_uniforms();
--
2.5.0.400.gff86faf

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


Re: [Mesa-dev] [PATCH] mapi/shared-glapi/test: rework glapitable.h handling

2017-10-13 Thread Dylan Baker
For list posterity:
Reviewed-by: Dylan Baker 

Quoting Emil Velikov (2017-10-13 08:35:47)
> From: Emil Velikov 
> 
> Currently all the build systems but Meson generate the header in
> src/mapi/glapi. Meson cannot do that since:
>  - it does not allow user control over the location of output files
>  - moving the generation rule(s) causes explosion due to the unusual
> structure of glapi and friends
>  - copying the file into the correct location is a non-trivial task
> 
> To workaround the above deficiency in the least invasive way, let's
> adjust the #include directive and add a few -I flags to the autotools
> build.
> 
> Note: both builddir and srcdir, should be used. Otherwise building from
> a release tarball fails badly.
> 
> Cc: Dylan Baker 
> Signed-off-by: Emil Velikov 
> ---
> Dylan seems like glapi_gentable.c dependency tracking is broken/missing.
> Furthermore the tests seems to be broken on Meson even w/o my revert :-(
> ---
>  src/mapi/Makefile.am| 5 +++--
>  src/mapi/shared-glapi/tests/check_table.cpp | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
> index 83e32d2185e..3f8fcc02e55 100644
> --- a/src/mapi/Makefile.am
> +++ b/src/mapi/Makefile.am
> @@ -47,7 +47,9 @@ AM_CPPFLAGS =   
>   \
> -I$(top_srcdir)/include \
> -I$(top_srcdir)/src \
> -I$(top_builddir)/src/mapi  \
> -   -I$(top_srcdir)/src/mapi
> +   -I$(top_srcdir)/src/mapi\
> +   -I$(top_builddir)/src/mapi/glapi\
> +   -I$(top_srcdir)/src/mapi/glapi
>  
>  include Makefile.sources
>  
> @@ -113,7 +115,6 @@ endif
>  glapi_libglapi_la_SOURCES =
>  glapi_libglapi_la_CPPFLAGS = \
> $(AM_CPPFLAGS) \
> -   -I$(top_srcdir)/src/mapi/glapi \
> -I$(top_srcdir)/src/mesa
>  
>  if HAVE_APPLEDRI
> diff --git a/src/mapi/shared-glapi/tests/check_table.cpp 
> b/src/mapi/shared-glapi/tests/check_table.cpp
> index 02d313c22d3..314e6769b49 100644
> --- a/src/mapi/shared-glapi/tests/check_table.cpp
> +++ b/src/mapi/shared-glapi/tests/check_table.cpp
> @@ -25,7 +25,7 @@
>  #include "../../../mesa/main/glheader.h"
>  
>  #include "glapi/glapi.h"
> -#include "glapi/glapitable.h"
> +#include "glapitable.h"
>  
>  struct name_offset {
> const char *name;
> -- 
> 2.14.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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


Re: [Mesa-dev] [PATCH v2 02/12] make: Fix test to be meson compatible

2017-10-13 Thread Dylan Baker
Quoting Emil Velikov (2017-10-13 10:27:38)
> On 13 October 2017 at 18:21, Dylan Baker  wrote:
> > Quoting Emil Velikov (2017-10-13 07:01:24)
> >> On 5 October 2017 at 20:12, Dylan Baker  wrote:
> >> > Quoting Emil Velikov (2017-10-05 11:26:40)
> >> >> On 5 October 2017 at 18:12, Dylan Baker  wrote:
> >> >> > This has the same problem as the previous commit, generated headers 
> >> >> > and
> >> >> > hardcoded paths.
> >> >> >
> >> >> Something's strange here. You already have the "generic"
> >> >>
> >> >> AM_CPPFLAGS = \
> >> >>... \
> >> >>-I$(top_builddir)/src/mapi \
> >> >>-I$(top_srcdir)/src/mapi
> >> >>
> >> >> ... at the top. Thus you don't need the extra -I directive, nor the
> >> >> include change.
> >> >> Where is the file generated with Meson?
> >> >>
> >> >> -Emil
> >> >
> >> > /src/mapi/glapi/gen
> >> >
> >> In this case - everything should work like a charm.
> >>
> >> As-is the patch breaks the normal distcheck. So I'll revert it for now
> >> and will look into fixing it properly.
> >> Please try to not break !others with your meson work.
> >>
> >> Thanks
> >> Emil
> >
> > Hi Emil,
> >
> > This patch does not break ./configure && make, which I have been testing
> > whenever I make changes to autotools.
> As you're changing tests, please run the check/distcheck. Pretty please?

I did run make check, which worked fine for me at the time, and works fine for
me with mesa with your revert locally reverted (well, gallium tests fail, but
those fail with your patch too). I will run dist-check in the future.

I'll fix the guards for compiler tests (which is why tests aren't built in
travis) so we can turn them on there.

Dylan


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


Re: [Mesa-dev] [PATCH] mapi/shared-glapi/test: rework glapitable.h handling

2017-10-13 Thread Mark Janes
Tested-by: Mark Janes 

Emil Velikov  writes:

> From: Emil Velikov 
>
> Currently all the build systems but Meson generate the header in
> src/mapi/glapi. Meson cannot do that since:
>  - it does not allow user control over the location of output files
>  - moving the generation rule(s) causes explosion due to the unusual
> structure of glapi and friends
>  - copying the file into the correct location is a non-trivial task
>
> To workaround the above deficiency in the least invasive way, let's
> adjust the #include directive and add a few -I flags to the autotools
> build.
>
> Note: both builddir and srcdir, should be used. Otherwise building from
> a release tarball fails badly.
>
> Cc: Dylan Baker 
> Signed-off-by: Emil Velikov 
> ---
> Dylan seems like glapi_gentable.c dependency tracking is broken/missing.
> Furthermore the tests seems to be broken on Meson even w/o my revert :-(
> ---
>  src/mapi/Makefile.am| 5 +++--
>  src/mapi/shared-glapi/tests/check_table.cpp | 2 +-
>  2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
> index 83e32d2185e..3f8fcc02e55 100644
> --- a/src/mapi/Makefile.am
> +++ b/src/mapi/Makefile.am
> @@ -47,7 +47,9 @@ AM_CPPFLAGS =   
> \
>   -I$(top_srcdir)/include \
>   -I$(top_srcdir)/src \
>   -I$(top_builddir)/src/mapi  \
> - -I$(top_srcdir)/src/mapi
> + -I$(top_srcdir)/src/mapi\
> + -I$(top_builddir)/src/mapi/glapi\
> + -I$(top_srcdir)/src/mapi/glapi
>  
>  include Makefile.sources
>  
> @@ -113,7 +115,6 @@ endif
>  glapi_libglapi_la_SOURCES =
>  glapi_libglapi_la_CPPFLAGS = \
>   $(AM_CPPFLAGS) \
> - -I$(top_srcdir)/src/mapi/glapi \
>   -I$(top_srcdir)/src/mesa
>  
>  if HAVE_APPLEDRI
> diff --git a/src/mapi/shared-glapi/tests/check_table.cpp 
> b/src/mapi/shared-glapi/tests/check_table.cpp
> index 02d313c22d3..314e6769b49 100644
> --- a/src/mapi/shared-glapi/tests/check_table.cpp
> +++ b/src/mapi/shared-glapi/tests/check_table.cpp
> @@ -25,7 +25,7 @@
>  #include "../../../mesa/main/glheader.h"
>  
>  #include "glapi/glapi.h"
> -#include "glapi/glapitable.h"
> +#include "glapitable.h"
>  
>  struct name_offset {
> const char *name;
> -- 
> 2.14.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] blob: Use intptr_t instead of ssize_t

2017-10-13 Thread Jason Ekstrand
ssize_t is a GNU extension and is not available on Windows or MacOS.
Instead, we use intptr_t which should be effectively equivalent and is
part of the C standard.  This should fix the Windows and Mac OS builds.

Cc: Jose Fonseca 
Cc: Vinson Lee 
Fixes: 3af1c829891a4530682bce113fdd512d4f2de3c6
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103253
---
 src/compiler/blob.c   | 8 
 src/compiler/blob.h   | 6 +++---
 src/intel/vulkan/anv_pipeline_cache.c | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/compiler/blob.c b/src/compiler/blob.c
index f0fa85e..8dd254f 100644
--- a/src/compiler/blob.c
+++ b/src/compiler/blob.c
@@ -158,10 +158,10 @@ blob_write_bytes(struct blob *blob, const void *bytes, 
size_t to_write)
return true;
 }
 
-ssize_t
+intptr_t
 blob_reserve_bytes(struct blob *blob, size_t to_write)
 {
-   ssize_t ret;
+   intptr_t ret;
 
if (! grow_to_fit (blob, to_write))
   return -1;
@@ -172,14 +172,14 @@ blob_reserve_bytes(struct blob *blob, size_t to_write)
return ret;
 }
 
-ssize_t
+intptr_t
 blob_reserve_uint32(struct blob *blob)
 {
align_blob(blob, sizeof(uint32_t));
return blob_reserve_bytes(blob, sizeof(uint32_t));
 }
 
-ssize_t
+intptr_t
 blob_reserve_intptr(struct blob *blob)
 {
align_blob(blob, sizeof(intptr_t));
diff --git a/src/compiler/blob.h b/src/compiler/blob.h
index f0f28ec..2b975d4 100644
--- a/src/compiler/blob.h
+++ b/src/compiler/blob.h
@@ -135,7 +135,7 @@ blob_write_bytes(struct blob *blob, const void *bytes, 
size_t to_write);
  * \return An offset to space allocated within \blob to which \to_write bytes
  * can be written, (or -1 in case of any allocation error).
  */
-ssize_t
+intptr_t
 blob_reserve_bytes(struct blob *blob, size_t to_write);
 
 /**
@@ -143,7 +143,7 @@ blob_reserve_bytes(struct blob *blob, size_t to_write);
  * space. Note that this must be used if later reading with \sa
  * blob_read_uint32, since it aligns the offset correctly.
  */
-ssize_t
+intptr_t
 blob_reserve_uint32(struct blob *blob);
 
 /**
@@ -151,7 +151,7 @@ blob_reserve_uint32(struct blob *blob);
  * space. Note that this must be used if later reading with \sa
  * blob_read_intptr, since it aligns the offset correctly.
  */
-ssize_t
+intptr_t
 blob_reserve_intptr(struct blob *blob);
 
 /**
diff --git a/src/intel/vulkan/anv_pipeline_cache.c 
b/src/intel/vulkan/anv_pipeline_cache.c
index ad9c810..82551e9 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -449,7 +449,7 @@ VkResult anv_GetPipelineCacheData(
blob_write_bytes(, , sizeof(header));
 
uint32_t count = 0;
-   ssize_t count_offset = blob_reserve_uint32();
+   intptr_t count_offset = blob_reserve_uint32();
if (count_offset < 0) {
   *pDataSize = 0;
   blob_finish();
-- 
2.5.0.400.gff86faf

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


Re: [Mesa-dev] [PATCH] blob: Use intptr_t instead of ssize_t

2017-10-13 Thread Jose Fonseca

On 13/10/17 18:44, Jason Ekstrand wrote:

ssize_t is a GNU extension and is not available on Windows or MacOS.
Instead, we use intptr_t which should be effectively equivalent and is
part of the C standard.  This should fix the Windows and Mac OS builds.

Cc: Jose Fonseca 
Cc: Vinson Lee 
Fixes: 3af1c829891a4530682bce113fdd512d4f2de3c6
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103253
---
  src/compiler/blob.c   | 8 
  src/compiler/blob.h   | 6 +++---
  src/intel/vulkan/anv_pipeline_cache.c | 2 +-
  3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/compiler/blob.c b/src/compiler/blob.c
index f0fa85e..8dd254f 100644
--- a/src/compiler/blob.c
+++ b/src/compiler/blob.c
@@ -158,10 +158,10 @@ blob_write_bytes(struct blob *blob, const void *bytes, 
size_t to_write)
 return true;
  }
  
-ssize_t

+intptr_t
  blob_reserve_bytes(struct blob *blob, size_t to_write)
  {
-   ssize_t ret;
+   intptr_t ret;
  
 if (! grow_to_fit (blob, to_write))

return -1;
@@ -172,14 +172,14 @@ blob_reserve_bytes(struct blob *blob, size_t to_write)
 return ret;
  }
  
-ssize_t

+intptr_t
  blob_reserve_uint32(struct blob *blob)
  {
 align_blob(blob, sizeof(uint32_t));
 return blob_reserve_bytes(blob, sizeof(uint32_t));
  }
  
-ssize_t

+intptr_t
  blob_reserve_intptr(struct blob *blob)
  {
 align_blob(blob, sizeof(intptr_t));
diff --git a/src/compiler/blob.h b/src/compiler/blob.h
index f0f28ec..2b975d4 100644
--- a/src/compiler/blob.h
+++ b/src/compiler/blob.h
@@ -135,7 +135,7 @@ blob_write_bytes(struct blob *blob, const void *bytes, 
size_t to_write);
   * \return An offset to space allocated within \blob to which \to_write bytes
   * can be written, (or -1 in case of any allocation error).
   */
-ssize_t
+intptr_t
  blob_reserve_bytes(struct blob *blob, size_t to_write);
  
  /**

@@ -143,7 +143,7 @@ blob_reserve_bytes(struct blob *blob, size_t to_write);
   * space. Note that this must be used if later reading with \sa
   * blob_read_uint32, since it aligns the offset correctly.
   */
-ssize_t
+intptr_t
  blob_reserve_uint32(struct blob *blob);
  
  /**

@@ -151,7 +151,7 @@ blob_reserve_uint32(struct blob *blob);
   * space. Note that this must be used if later reading with \sa
   * blob_read_intptr, since it aligns the offset correctly.
   */
-ssize_t
+intptr_t
  blob_reserve_intptr(struct blob *blob);
  
  /**

diff --git a/src/intel/vulkan/anv_pipeline_cache.c 
b/src/intel/vulkan/anv_pipeline_cache.c
index ad9c810..82551e9 100644
--- a/src/intel/vulkan/anv_pipeline_cache.c
+++ b/src/intel/vulkan/anv_pipeline_cache.c
@@ -449,7 +449,7 @@ VkResult anv_GetPipelineCacheData(
 blob_write_bytes(, , sizeof(header));
  
 uint32_t count = 0;

-   ssize_t count_offset = blob_reserve_uint32();
+   intptr_t count_offset = blob_reserve_uint32();
 if (count_offset < 0) {
*pDataSize = 0;
blob_finish();



Thanks.

Reviewed-by: Jose Fonseca 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] radv: add the draw count buffer to the list of buffers

2017-10-13 Thread Bas Nieuwenhuizen
r-b

On Fri, Oct 13, 2017 at 6:20 PM, Samuel Pitoiset
 wrote:
> My guess is that the GPU is going to report VM faults if
> vkCmdDrawIndirectCountAMD() (and friends) are used.
>
> Signed-off-by: Samuel Pitoiset 
> Cc: mesa-sta...@lists.freedesktop.org
> ---
>  src/amd/vulkan/radv_cmd_buffer.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c 
> b/src/amd/vulkan/radv_cmd_buffer.c
> index c0fe12b489..c959088378 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -3046,6 +3046,8 @@ radv_emit_indirect_draw(struct radv_cmd_buffer 
> *cmd_buffer,
> if (count_buffer) {
> count_va = radv_buffer_get_va(count_buffer->bo);
> count_va += count_offset + count_buffer->offset;
> +
> +   cmd_buffer->device->ws->cs_add_buffer(cs, count_buffer->bo, 
> 8);
> }
>
> if (!draw_count)
> --
> 2.14.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 02/12] make: Fix test to be meson compatible

2017-10-13 Thread Emil Velikov
On 13 October 2017 at 18:21, Dylan Baker  wrote:
> Quoting Emil Velikov (2017-10-13 07:01:24)
>> On 5 October 2017 at 20:12, Dylan Baker  wrote:
>> > Quoting Emil Velikov (2017-10-05 11:26:40)
>> >> On 5 October 2017 at 18:12, Dylan Baker  wrote:
>> >> > This has the same problem as the previous commit, generated headers and
>> >> > hardcoded paths.
>> >> >
>> >> Something's strange here. You already have the "generic"
>> >>
>> >> AM_CPPFLAGS = \
>> >>... \
>> >>-I$(top_builddir)/src/mapi \
>> >>-I$(top_srcdir)/src/mapi
>> >>
>> >> ... at the top. Thus you don't need the extra -I directive, nor the
>> >> include change.
>> >> Where is the file generated with Meson?
>> >>
>> >> -Emil
>> >
>> > /src/mapi/glapi/gen
>> >
>> In this case - everything should work like a charm.
>>
>> As-is the patch breaks the normal distcheck. So I'll revert it for now
>> and will look into fixing it properly.
>> Please try to not break !others with your meson work.
>>
>> Thanks
>> Emil
>
> Hi Emil,
>
> This patch does not break ./configure && make, which I have been testing
> whenever I make changes to autotools.
As you're changing tests, please run the check/distcheck. Pretty please?

> Your revert however, breaks the meson
> build when building tests, which we do in our CI.
>
The meson check/test target is broken even without my revert, sorry to
be the bearer of bad news.

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


Re: [Mesa-dev] [Mesa-stable] [PATCH] vulkan/wsi: Free the event in x11_manage_fifo_queues().

2017-10-13 Thread Emil Velikov
Hi Henri,

On 13 October 2017 at 16:10, Henri Verbeet  wrote:
> Cc: mesa-sta...@lists.freedesktop.org
> Signed-off-by: Henri Verbeet 

Fixes: e73d136a023 ("vulkan/wsi/x11: Implement FIFO mode.")
Reviewed-by: Emil Velikov 

Please give it time for Vulkan devs to take a look.

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


Re: [Mesa-dev] [PATCH v2 02/12] make: Fix test to be meson compatible

2017-10-13 Thread Dylan Baker
Quoting Emil Velikov (2017-10-13 07:01:24)
> On 5 October 2017 at 20:12, Dylan Baker  wrote:
> > Quoting Emil Velikov (2017-10-05 11:26:40)
> >> On 5 October 2017 at 18:12, Dylan Baker  wrote:
> >> > This has the same problem as the previous commit, generated headers and
> >> > hardcoded paths.
> >> >
> >> Something's strange here. You already have the "generic"
> >>
> >> AM_CPPFLAGS = \
> >>... \
> >>-I$(top_builddir)/src/mapi \
> >>-I$(top_srcdir)/src/mapi
> >>
> >> ... at the top. Thus you don't need the extra -I directive, nor the
> >> include change.
> >> Where is the file generated with Meson?
> >>
> >> -Emil
> >
> > /src/mapi/glapi/gen
> >
> In this case - everything should work like a charm.
> 
> As-is the patch breaks the normal distcheck. So I'll revert it for now
> and will look into fixing it properly.
> Please try to not break !others with your meson work.
> 
> Thanks
> Emil

Hi Emil,

This patch does not break ./configure && make, which I have been testing
whenever I make changes to autotools. Your revert however, breaks the meson
build when building tests, which we do in our CI.

Frankly, it's pretty frustrating that you reverted a patch to fix dist-check
without review when a release is not imminent (we're still a week away from
feature freeze) and it doesn't affect standard developer workflow, instead of
waiting a few hours to make sure that it didn't break anything.

Dylan


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


[Mesa-dev] [PATCH] radv: add the draw count buffer to the list of buffers

2017-10-13 Thread Samuel Pitoiset
My guess is that the GPU is going to report VM faults if
vkCmdDrawIndirectCountAMD() (and friends) are used.

Signed-off-by: Samuel Pitoiset 
Cc: mesa-sta...@lists.freedesktop.org
---
 src/amd/vulkan/radv_cmd_buffer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index c0fe12b489..c959088378 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -3046,6 +3046,8 @@ radv_emit_indirect_draw(struct radv_cmd_buffer 
*cmd_buffer,
if (count_buffer) {
count_va = radv_buffer_get_va(count_buffer->bo);
count_va += count_offset + count_buffer->offset;
+
+   cmd_buffer->device->ws->cs_add_buffer(cs, count_buffer->bo, 8);
}
 
if (!draw_count)
-- 
2.14.2

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


[Mesa-dev] [PATCH] radv: set correct INDEX_TYPE for indexed indirect draws on GFX9

2017-10-13 Thread Samuel Pitoiset
Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_cmd_buffer.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 78a250214a..c0fe12b489 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -3110,8 +3110,14 @@ radv_cmd_draw_indexed_indirect_count(
 
MAYBE_UNUSED unsigned cdw_max = 
radeon_check_space(cmd_buffer->device->ws, cmd_buffer->cs, 31 * MAX_VIEWS);
 
-   radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_TYPE, 0, 0));
-   radeon_emit(cmd_buffer->cs, cmd_buffer->state.index_type);
+   if (cmd_buffer->device->physical_device->rad_info.chip_class >= GFX9) {
+   radeon_set_uconfig_reg_idx(cmd_buffer->cs,
+  R_03090C_VGT_INDEX_TYPE,
+  2, cmd_buffer->state.index_type);
+   } else {
+   radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_TYPE, 0, 0));
+   radeon_emit(cmd_buffer->cs, cmd_buffer->state.index_type);
+   }
 
radeon_emit(cmd_buffer->cs, PKT3(PKT3_INDEX_BASE, 1, 0));
radeon_emit(cmd_buffer->cs, index_va);
-- 
2.14.2

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


[Mesa-dev] [PATCH] mapi/shared-glapi/test: rework glapitable.h handling

2017-10-13 Thread Emil Velikov
From: Emil Velikov 

Currently all the build systems but Meson generate the header in
src/mapi/glapi. Meson cannot do that since:
 - it does not allow user control over the location of output files
 - moving the generation rule(s) causes explosion due to the unusual
structure of glapi and friends
 - copying the file into the correct location is a non-trivial task

To workaround the above deficiency in the least invasive way, let's
adjust the #include directive and add a few -I flags to the autotools
build.

Note: both builddir and srcdir, should be used. Otherwise building from
a release tarball fails badly.

Cc: Dylan Baker 
Signed-off-by: Emil Velikov 
---
Dylan seems like glapi_gentable.c dependency tracking is broken/missing.
Furthermore the tests seems to be broken on Meson even w/o my revert :-(
---
 src/mapi/Makefile.am| 5 +++--
 src/mapi/shared-glapi/tests/check_table.cpp | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mapi/Makefile.am b/src/mapi/Makefile.am
index 83e32d2185e..3f8fcc02e55 100644
--- a/src/mapi/Makefile.am
+++ b/src/mapi/Makefile.am
@@ -47,7 +47,9 @@ AM_CPPFLAGS = 
\
-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_builddir)/src/mapi  \
-   -I$(top_srcdir)/src/mapi
+   -I$(top_srcdir)/src/mapi\
+   -I$(top_builddir)/src/mapi/glapi\
+   -I$(top_srcdir)/src/mapi/glapi
 
 include Makefile.sources
 
@@ -113,7 +115,6 @@ endif
 glapi_libglapi_la_SOURCES =
 glapi_libglapi_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
-   -I$(top_srcdir)/src/mapi/glapi \
-I$(top_srcdir)/src/mesa
 
 if HAVE_APPLEDRI
diff --git a/src/mapi/shared-glapi/tests/check_table.cpp 
b/src/mapi/shared-glapi/tests/check_table.cpp
index 02d313c22d3..314e6769b49 100644
--- a/src/mapi/shared-glapi/tests/check_table.cpp
+++ b/src/mapi/shared-glapi/tests/check_table.cpp
@@ -25,7 +25,7 @@
 #include "../../../mesa/main/glheader.h"
 
 #include "glapi/glapi.h"
-#include "glapi/glapitable.h"
+#include "glapitable.h"
 
 struct name_offset {
const char *name;
-- 
2.14.1

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


[Mesa-dev] [PATCH] vulkan/wsi: Free the event in x11_manage_fifo_queues().

2017-10-13 Thread Henri Verbeet
Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Henri Verbeet 
---
I should still have commit access.
---
 src/vulkan/wsi/wsi_common_x11.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index ecdaf91..22b067b 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -939,6 +939,7 @@ x11_manage_fifo_queues(void *state)
 goto fail;
 
  result = x11_handle_dri3_present_event(chain, (void *)event);
+ free(event);
  if (result != VK_SUCCESS)
 goto fail;
   }
-- 
2.1.4

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


Re: [Mesa-dev] [PATCH 14/16] ac: use amdgpu-flat-work-group-size

2017-10-13 Thread Marek Olšák
Nevermind. I'm dropping this patch. It's incomplete.

Marek

On Fri, Oct 13, 2017 at 3:49 PM, Marek Olšák  wrote:
> Yes good point.
>
> Marek
>
> On Fri, Oct 13, 2017 at 3:39 PM, Ernst Sjöstrand  wrote:
>> Isn't the logic inverted here?
>>
>> 2017-10-13 14:04 GMT+02:00 Marek Olšák :
>>> From: Marek Olšák 
>>>
>>> the old one is being deprecated or removed
>>> ---
>>>  src/amd/common/ac_nir_to_llvm.c  | 3 ++-
>>>  src/gallium/drivers/radeonsi/si_shader.c | 4 +++-
>>>  2 files changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/amd/common/ac_nir_to_llvm.c 
>>> b/src/amd/common/ac_nir_to_llvm.c
>>> index 11ba487..4492d8e 100644
>>> --- a/src/amd/common/ac_nir_to_llvm.c
>>> +++ b/src/amd/common/ac_nir_to_llvm.c
>>> @@ -346,21 +346,22 @@ create_llvm_function(LLVMContextRef ctx, 
>>> LLVMModuleRef module,
>>> ac_add_function_attr(ctx, main_function, i + 1, 
>>> AC_FUNC_ATTR_BYVAL);
>>> ac_add_attr_dereferenceable(P, UINT64_MAX);
>>> }
>>> else {
>>> ac_add_function_attr(ctx, main_function, i + 1, 
>>> AC_FUNC_ATTR_INREG);
>>> }
>>> }
>>>
>>> if (max_workgroup_size) {
>>> ac_llvm_add_target_dep_function_attr(main_function,
>>> -
>>> "amdgpu-max-work-group-size",
>>> +HAVE_LLVM >= 0x0400 ? 
>>> "amdgpu-max-work-group-size" :
>>> +  
>>> "amdgpu-flat-work-group-size",
>>>  max_workgroup_size);
>>> }
>>> if (unsafe_math) {
>>> /* These were copied from some LLVM test. */
>>> LLVMAddTargetDependentFunctionAttr(main_function,
>>>"less-precise-fpmad",
>>>"true");
>>> LLVMAddTargetDependentFunctionAttr(main_function,
>>>"no-infs-fp-math",
>>>"true");
>>> diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
>>> b/src/gallium/drivers/radeonsi/si_shader.c
>>> index ff372ae..506da6f 100644
>>> --- a/src/gallium/drivers/radeonsi/si_shader.c
>>> +++ b/src/gallium/drivers/radeonsi/si_shader.c
>>> @@ -4155,21 +4155,23 @@ static void si_create_function(struct 
>>> si_shader_context *ctx,
>>> } else
>>> lp_add_function_attr(ctx->main_fn, i + 1, 
>>> LP_FUNC_ATTR_INREG);
>>> }
>>>
>>> for (i = 0; i < fninfo->num_params; ++i) {
>>> if (fninfo->assign[i])
>>> *fninfo->assign[i] = LLVMGetParam(ctx->main_fn, i);
>>> }
>>>
>>> if (max_workgroup_size) {
>>> -   si_llvm_add_attribute(ctx->main_fn, 
>>> "amdgpu-max-work-group-size",
>>> +   si_llvm_add_attribute(ctx->main_fn,
>>> + HAVE_LLVM >= 0x0400 ? 
>>> "amdgpu-max-work-group-size" :
>>> +   
>>> "amdgpu-flat-work-group-size",
>>>   max_workgroup_size);
>>> }
>>> LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
>>>"no-signed-zeros-fp-math",
>>>"true");
>>>
>>> if (ctx->screen->b.debug_flags & DBG(UNSAFE_MATH)) {
>>> /* These were copied from some LLVM test. */
>>> LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
>>>"less-precise-fpmad",
>>> --
>>> 2.7.4
>>>
>>> ___
>>> mesa-dev mailing list
>>> mesa-dev@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v2 02/12] make: Fix test to be meson compatible

2017-10-13 Thread Emil Velikov
On 5 October 2017 at 20:12, Dylan Baker  wrote:
> Quoting Emil Velikov (2017-10-05 11:26:40)
>> On 5 October 2017 at 18:12, Dylan Baker  wrote:
>> > This has the same problem as the previous commit, generated headers and
>> > hardcoded paths.
>> >
>> Something's strange here. You already have the "generic"
>>
>> AM_CPPFLAGS = \
>>... \
>>-I$(top_builddir)/src/mapi \
>>-I$(top_srcdir)/src/mapi
>>
>> ... at the top. Thus you don't need the extra -I directive, nor the
>> include change.
>> Where is the file generated with Meson?
>>
>> -Emil
>
> /src/mapi/glapi/gen
>
In this case - everything should work like a charm.

As-is the patch breaks the normal distcheck. So I'll revert it for now
and will look into fixing it properly.
Please try to not break !others with your meson work.

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


Re: [Mesa-dev] [PATCH 14/16] ac: use amdgpu-flat-work-group-size

2017-10-13 Thread Marek Olšák
Yes good point.

Marek

On Fri, Oct 13, 2017 at 3:39 PM, Ernst Sjöstrand  wrote:
> Isn't the logic inverted here?
>
> 2017-10-13 14:04 GMT+02:00 Marek Olšák :
>> From: Marek Olšák 
>>
>> the old one is being deprecated or removed
>> ---
>>  src/amd/common/ac_nir_to_llvm.c  | 3 ++-
>>  src/gallium/drivers/radeonsi/si_shader.c | 4 +++-
>>  2 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/amd/common/ac_nir_to_llvm.c 
>> b/src/amd/common/ac_nir_to_llvm.c
>> index 11ba487..4492d8e 100644
>> --- a/src/amd/common/ac_nir_to_llvm.c
>> +++ b/src/amd/common/ac_nir_to_llvm.c
>> @@ -346,21 +346,22 @@ create_llvm_function(LLVMContextRef ctx, LLVMModuleRef 
>> module,
>> ac_add_function_attr(ctx, main_function, i + 1, 
>> AC_FUNC_ATTR_BYVAL);
>> ac_add_attr_dereferenceable(P, UINT64_MAX);
>> }
>> else {
>> ac_add_function_attr(ctx, main_function, i + 1, 
>> AC_FUNC_ATTR_INREG);
>> }
>> }
>>
>> if (max_workgroup_size) {
>> ac_llvm_add_target_dep_function_attr(main_function,
>> -
>> "amdgpu-max-work-group-size",
>> +HAVE_LLVM >= 0x0400 ? 
>> "amdgpu-max-work-group-size" :
>> +  
>> "amdgpu-flat-work-group-size",
>>  max_workgroup_size);
>> }
>> if (unsafe_math) {
>> /* These were copied from some LLVM test. */
>> LLVMAddTargetDependentFunctionAttr(main_function,
>>"less-precise-fpmad",
>>"true");
>> LLVMAddTargetDependentFunctionAttr(main_function,
>>"no-infs-fp-math",
>>"true");
>> diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
>> b/src/gallium/drivers/radeonsi/si_shader.c
>> index ff372ae..506da6f 100644
>> --- a/src/gallium/drivers/radeonsi/si_shader.c
>> +++ b/src/gallium/drivers/radeonsi/si_shader.c
>> @@ -4155,21 +4155,23 @@ static void si_create_function(struct 
>> si_shader_context *ctx,
>> } else
>> lp_add_function_attr(ctx->main_fn, i + 1, 
>> LP_FUNC_ATTR_INREG);
>> }
>>
>> for (i = 0; i < fninfo->num_params; ++i) {
>> if (fninfo->assign[i])
>> *fninfo->assign[i] = LLVMGetParam(ctx->main_fn, i);
>> }
>>
>> if (max_workgroup_size) {
>> -   si_llvm_add_attribute(ctx->main_fn, 
>> "amdgpu-max-work-group-size",
>> +   si_llvm_add_attribute(ctx->main_fn,
>> + HAVE_LLVM >= 0x0400 ? 
>> "amdgpu-max-work-group-size" :
>> +   
>> "amdgpu-flat-work-group-size",
>>   max_workgroup_size);
>> }
>> LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
>>"no-signed-zeros-fp-math",
>>"true");
>>
>> if (ctx->screen->b.debug_flags & DBG(UNSAFE_MATH)) {
>> /* These were copied from some LLVM test. */
>> LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
>>"less-precise-fpmad",
>> --
>> 2.7.4
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 14/16] ac: use amdgpu-flat-work-group-size

2017-10-13 Thread Ernst Sjöstrand
Isn't the logic inverted here?

2017-10-13 14:04 GMT+02:00 Marek Olšák :
> From: Marek Olšák 
>
> the old one is being deprecated or removed
> ---
>  src/amd/common/ac_nir_to_llvm.c  | 3 ++-
>  src/gallium/drivers/radeonsi/si_shader.c | 4 +++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 11ba487..4492d8e 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -346,21 +346,22 @@ create_llvm_function(LLVMContextRef ctx, LLVMModuleRef 
> module,
> ac_add_function_attr(ctx, main_function, i + 1, 
> AC_FUNC_ATTR_BYVAL);
> ac_add_attr_dereferenceable(P, UINT64_MAX);
> }
> else {
> ac_add_function_attr(ctx, main_function, i + 1, 
> AC_FUNC_ATTR_INREG);
> }
> }
>
> if (max_workgroup_size) {
> ac_llvm_add_target_dep_function_attr(main_function,
> -
> "amdgpu-max-work-group-size",
> +HAVE_LLVM >= 0x0400 ? 
> "amdgpu-max-work-group-size" :
> +  
> "amdgpu-flat-work-group-size",
>  max_workgroup_size);
> }
> if (unsafe_math) {
> /* These were copied from some LLVM test. */
> LLVMAddTargetDependentFunctionAttr(main_function,
>"less-precise-fpmad",
>"true");
> LLVMAddTargetDependentFunctionAttr(main_function,
>"no-infs-fp-math",
>"true");
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
> b/src/gallium/drivers/radeonsi/si_shader.c
> index ff372ae..506da6f 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -4155,21 +4155,23 @@ static void si_create_function(struct 
> si_shader_context *ctx,
> } else
> lp_add_function_attr(ctx->main_fn, i + 1, 
> LP_FUNC_ATTR_INREG);
> }
>
> for (i = 0; i < fninfo->num_params; ++i) {
> if (fninfo->assign[i])
> *fninfo->assign[i] = LLVMGetParam(ctx->main_fn, i);
> }
>
> if (max_workgroup_size) {
> -   si_llvm_add_attribute(ctx->main_fn, 
> "amdgpu-max-work-group-size",
> +   si_llvm_add_attribute(ctx->main_fn,
> + HAVE_LLVM >= 0x0400 ? 
> "amdgpu-max-work-group-size" :
> +   
> "amdgpu-flat-work-group-size",
>   max_workgroup_size);
> }
> LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
>"no-signed-zeros-fp-math",
>"true");
>
> if (ctx->screen->b.debug_flags & DBG(UNSAFE_MATH)) {
> /* These were copied from some LLVM test. */
> LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
>"less-precise-fpmad",
> --
> 2.7.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/16] RadeonSI micro-optimizations

2017-10-13 Thread Marek Olšák
On Fri, Oct 13, 2017 at 2:24 PM, Mike Lothian  wrote:
> Hi
>
> Have you ran any benchmarks against these?

No I haven't.

For the IB placement, I measured the decrease in CP stalls using
performance counters, but generally CP isn't memory-bound on radeonsi
due to our optimized packet ordering.

For the last one, I checked shader-db changes.

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


Re: [Mesa-dev] [PATCH v1] clover/llvm: Drop support for LLVM < 3.9.

2017-10-13 Thread Emil Velikov
Hi Vedran,

Just pushed the LLVM version bump, so this patch should be able to go in.
I won't be able to offer any review here, apart from a small suggestion.

On 9 October 2017 at 00:08, Vedran Miletić  wrote:

>  #include 
>  #include 
> @@ -63,11 +56,7 @@
>  namespace clover {
> namespace llvm {
>namespace compat {
> -#if HAVE_LLVM >= 0x0307
>   typedef ::llvm::TargetLibraryInfoImpl target_library_info;
> -#else
> - typedef ::llvm::TargetLibraryInfo target_library_info;
> -#endif
>
With the guards gone, one should be able to remove/inline compat stuff
like this.
Not sure how much it matters or if one isn't going to need anyway for
newer LLVM.

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


Re: [Mesa-dev] [PATCH 00/16] RadeonSI micro-optimizations

2017-10-13 Thread Mike Lothian
Hi

Have you ran any benchmarks against these?

Cheers

Mike

On Fri, 13 Oct 2017 at 13:04 Marek Olšák  wrote:

> Hi,
>
> This series:
> - switches IB placement to GTT WC
> - uses SPI_SHADER_USER_DATA_COMMON on GFX9
> - combines setting of 2 per-stage descriptor pointers into 1 SET_SH_REG
> packet
> - if there is only 1 constant buffer and 0 shader and atomic buffers,
>   the constant buffer pointer is directly set into
> SI_SGPR_CONST_AND_SHADER_-
>   BUFFERS, skipping a descriptor upload and shader load
>
> Please review.
>
> Thanks!
>
> Marek
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/15] i965: Complete 'expose RGBA visuals only on Android'

2017-10-13 Thread Emil Velikov
On 12 October 2017 at 16:34, Mario Kleiner  wrote:
> On 10/11/2017 05:25 PM, Emil Velikov wrote:
>>
>> On 10 October 2017 at 11:34, Tapani Pälli  wrote:
>>>
>>> Reviewed-by: Tapani Pälli 
>>>
>>> I think this fix can/should land separately from the set.
>>>
>> Yes, please. Thanks for catching that Mario.
>> Reviewed-by: Emil Velikov 
>>
>> -Emil
>>
>
> I assume you just pull that patch, or do i need to do something like resend
> it separately?

Wanted to a couple of days for others to skim/double-check.
Pushed to master.

Thanks again Mario.
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 11/16] radeonsi: unify code for extracting a buffer address from a descriptor

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_descriptors.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index cac203b..3c33e85 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -90,20 +90,25 @@ static uint32_t null_texture_descriptor[8] = {
 
 static uint32_t null_image_descriptor[8] = {
0,
0,
0,
S_008F1C_TYPE(V_008F1C_SQ_RSRC_IMG_1D)
/* the rest must contain zeros, which is also used by the buffer
 * descriptor */
 };
 
+static uint64_t si_desc_extract_buffer_address(uint32_t *desc)
+{
+   return desc[0] | ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc[1]) << 32);
+}
+
 static void si_init_descriptor_list(uint32_t *desc_list,
unsigned element_dw_size,
unsigned num_elements,
const uint32_t *null_descriptor)
 {
int i;
 
/* Initialize the array to NULL descriptors if the element size is 8. */
if (null_descriptor) {
assert(element_dw_size % 8 == 0);
@@ -1358,22 +1363,21 @@ void si_set_ring_buffer(struct pipe_context *ctx, uint 
slot,
}
 
sctx->descriptors_dirty |= 1u << SI_DESCS_RW_BUFFERS;
 }
 
 static void si_desc_reset_buffer_offset(struct pipe_context *ctx,
uint32_t *desc, uint64_t old_buf_va,
struct pipe_resource *new_buf)
 {
/* Retrieve the buffer offset from the descriptor. */
-   uint64_t old_desc_va =
-   desc[0] | ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc[1]) << 32);
+   uint64_t old_desc_va = si_desc_extract_buffer_address(desc);
 
assert(old_buf_va <= old_desc_va);
uint64_t offset_within_buffer = old_desc_va - old_buf_va;
 
/* Update the descriptor. */
si_set_buf_desc_address(r600_resource(new_buf), offset_within_buffer,
desc);
 }
 
 /* INTERNAL CONST BUFFERS */
@@ -2171,22 +2175,21 @@ static void si_update_bindless_buffer_descriptor(struct 
si_context *sctx,
 {
struct si_descriptors *desc = >bindless_descriptors;
struct r600_resource *buf = r600_resource(resource);
unsigned desc_slot_offset = desc_slot * 16;
uint32_t *desc_list = desc->list + desc_slot_offset + 4;
uint64_t old_desc_va;
 
assert(resource->target == PIPE_BUFFER);
 
/* Retrieve the old buffer addr from the descriptor. */
-   old_desc_va  = desc_list[0];
-   old_desc_va |= ((uint64_t)G_008F04_BASE_ADDRESS_HI(desc_list[1]) << 32);
+   old_desc_va = si_desc_extract_buffer_address(desc_list);
 
if (old_desc_va != buf->gpu_address + offset) {
/* The buffer has been invalidated when the handle wasn't
 * resident, update the descriptor and the dirty flag.
 */
si_set_buf_desc_address(buf, offset, _list[0]);
 
*desc_dirty = true;
}
 }
-- 
2.7.4

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


[Mesa-dev] [PATCH 07/16] radeonsi: split si_emit_shader_pointer

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_descriptors.c | 34 ++-
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 6e1fd80..a0f3dcf 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1947,39 +1947,51 @@ void si_shader_change_notify(struct si_context *sctx)
si_set_user_data_base(sctx, PIPE_SHADER_TESS_EVAL,
  
R_00B330_SPI_SHADER_USER_DATA_ES_0);
else
si_set_user_data_base(sctx, PIPE_SHADER_TESS_EVAL,
  
R_00B130_SPI_SHADER_USER_DATA_VS_0);
} else {
si_set_user_data_base(sctx, PIPE_SHADER_TESS_EVAL, 0);
}
 }
 
-static void si_emit_shader_pointer(struct si_context *sctx,
-  struct si_descriptors *desc,
-  unsigned sh_base)
+static void si_emit_shader_pointer_head(struct radeon_winsys_cs *cs,
+   struct si_descriptors *desc,
+   unsigned sh_base,
+   unsigned pointer_count)
 {
-   struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
-   uint64_t va;
+   radeon_emit(cs, PKT3(PKT3_SET_SH_REG, pointer_count * 2, 0));
+   radeon_emit(cs, (sh_base + desc->shader_userdata_offset - 
SI_SH_REG_OFFSET) >> 2);
+}
 
-   if (!desc->buffer)
-   return; /* the pointer is not used by current shaders */
+static void si_emit_shader_pointer_body(struct radeon_winsys_cs *cs,
+   struct si_descriptors *desc)
+{
+   uint64_t va = 0;
 
-   va = desc->buffer->gpu_address +
-desc->buffer_offset;
+   if (desc->buffer)
+   va = desc->buffer->gpu_address + desc->buffer_offset;
 
-   radeon_emit(cs, PKT3(PKT3_SET_SH_REG, 2, 0));
-   radeon_emit(cs, (sh_base + desc->shader_userdata_offset - 
SI_SH_REG_OFFSET) >> 2);
radeon_emit(cs, va);
radeon_emit(cs, va >> 32);
 }
 
+static void si_emit_shader_pointer(struct si_context *sctx,
+  struct si_descriptors *desc,
+  unsigned sh_base)
+{
+   struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
+
+   si_emit_shader_pointer_head(cs, desc, sh_base, 1);
+   si_emit_shader_pointer_body(cs, desc);
+}
+
 static void si_emit_global_shader_pointers(struct si_context *sctx,
   struct si_descriptors *descs)
 {
if (sctx->b.chip_class == GFX9) {
/* Broadcast it to all shader stages. */
si_emit_shader_pointer(sctx, descs,
   R_00B530_SPI_SHADER_USER_DATA_COMMON_0);
return;
}
 
-- 
2.7.4

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


[Mesa-dev] [PATCH 14/16] ac: use amdgpu-flat-work-group-size

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

the old one is being deprecated or removed
---
 src/amd/common/ac_nir_to_llvm.c  | 3 ++-
 src/gallium/drivers/radeonsi/si_shader.c | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 11ba487..4492d8e 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -346,21 +346,22 @@ create_llvm_function(LLVMContextRef ctx, LLVMModuleRef 
module,
ac_add_function_attr(ctx, main_function, i + 1, 
AC_FUNC_ATTR_BYVAL);
ac_add_attr_dereferenceable(P, UINT64_MAX);
}
else {
ac_add_function_attr(ctx, main_function, i + 1, 
AC_FUNC_ATTR_INREG);
}
}
 
if (max_workgroup_size) {
ac_llvm_add_target_dep_function_attr(main_function,
-
"amdgpu-max-work-group-size",
+HAVE_LLVM >= 0x0400 ? 
"amdgpu-max-work-group-size" :
+  
"amdgpu-flat-work-group-size",
 max_workgroup_size);
}
if (unsafe_math) {
/* These were copied from some LLVM test. */
LLVMAddTargetDependentFunctionAttr(main_function,
   "less-precise-fpmad",
   "true");
LLVMAddTargetDependentFunctionAttr(main_function,
   "no-infs-fp-math",
   "true");
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index ff372ae..506da6f 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4155,21 +4155,23 @@ static void si_create_function(struct si_shader_context 
*ctx,
} else
lp_add_function_attr(ctx->main_fn, i + 1, 
LP_FUNC_ATTR_INREG);
}
 
for (i = 0; i < fninfo->num_params; ++i) {
if (fninfo->assign[i])
*fninfo->assign[i] = LLVMGetParam(ctx->main_fn, i);
}
 
if (max_workgroup_size) {
-   si_llvm_add_attribute(ctx->main_fn, 
"amdgpu-max-work-group-size",
+   si_llvm_add_attribute(ctx->main_fn,
+ HAVE_LLVM >= 0x0400 ? 
"amdgpu-max-work-group-size" :
+   
"amdgpu-flat-work-group-size",
  max_workgroup_size);
}
LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
   "no-signed-zeros-fp-math",
   "true");
 
if (ctx->screen->b.debug_flags & DBG(UNSAFE_MATH)) {
/* These were copied from some LLVM test. */
LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
   "less-precise-fpmad",
-- 
2.7.4

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


[Mesa-dev] [PATCH 13/16] radeonsi: handle 64-bit loads earlier in fetch_constant

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_shader.c | 26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 62a056d..ff372ae 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -1970,31 +1970,39 @@ static LLVMValueRef fetch_constant(
struct lp_build_tgsi_context *bld_base,
const struct tgsi_full_src_register *reg,
enum tgsi_opcode_type type,
unsigned swizzle)
 {
struct si_shader_context *ctx = si_shader_context(bld_base);
const struct tgsi_ind_register *ireg = >Indirect;
unsigned buf, idx;
 
LLVMValueRef addr, bufp;
-   LLVMValueRef result;
 
if (swizzle == LP_CHAN_ALL) {
unsigned chan;
LLVMValueRef values[4];
for (chan = 0; chan < TGSI_NUM_CHANNELS; ++chan)
values[chan] = fetch_constant(bld_base, reg, type, 
chan);
 
return lp_build_gather_values(>gallivm, values, 4);
}
 
+   /* Split 64-bit loads. */
+   if (tgsi_type_is_64bit(type)) {
+   LLVMValueRef lo, hi;
+
+   lo = fetch_constant(bld_base, reg, TGSI_TYPE_UNSIGNED, swizzle);
+   hi = fetch_constant(bld_base, reg, TGSI_TYPE_UNSIGNED, swizzle 
+ 1);
+   return si_llvm_emit_fetch_64bit(bld_base, type, lo, hi);
+   }
+
assert(reg->Register.Dimension);
buf = reg->Dimension.Index;
idx = reg->Register.Index * 4 + swizzle;
 
if (reg->Dimension.Indirect) {
LLVMValueRef ptr = LLVMGetParam(ctx->main_fn, 
ctx->param_const_and_shader_buffers);
LLVMValueRef index;
index = si_get_bounded_indirect_index(ctx, >DimIndirect,
  reg->Dimension.Index,
  ctx->num_const_buffers);
@@ -2003,35 +2011,21 @@ static LLVMValueRef fetch_constant(
bufp = ac_build_indexed_load_const(>ac, ptr, index);
} else
bufp = load_const_buffer_desc(ctx, buf);
 
if (reg->Register.Indirect) {
addr = si_get_indirect_index(ctx, ireg, 16, idx * 4);
} else {
addr = LLVMConstInt(ctx->i32, idx * 4, 0);
}
 
-   result = buffer_load_const(ctx, bufp, addr);
-
-   if (!tgsi_type_is_64bit(type))
-   result = bitcast(bld_base, type, result);
-   else {
-   LLVMValueRef addr2, result2;
-
-   addr2 = lp_build_add(_base->uint_bld, addr,
-LLVMConstInt(ctx->i32, 4, 0));
-   result2 = buffer_load_const(ctx, bufp, addr2);
-
-   result = si_llvm_emit_fetch_64bit(bld_base, type,
- result, result2);
-   }
-   return result;
+   return bitcast(bld_base, type, buffer_load_const(ctx, bufp, addr));
 }
 
 /* Upper 16 bits must be zero. */
 static LLVMValueRef si_llvm_pack_two_int16(struct si_shader_context *ctx,
   LLVMValueRef val[2])
 {
return LLVMBuildOr(ctx->ac.builder, val[0],
   LLVMBuildShl(ctx->ac.builder, val[1],
LLVMConstInt(ctx->i32, 16, 0),
""), "");
-- 
2.7.4

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


[Mesa-dev] [PATCH 10/16] radeonsi: remove atom parameter from si_upload_descriptors

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_descriptors.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index a2b7c11..cac203b 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -123,22 +123,21 @@ static void si_init_descriptors(struct si_descriptors 
*desc,
desc->shader_userdata_offset = shader_userdata_index * 4;
 }
 
 static void si_release_descriptors(struct si_descriptors *desc)
 {
r600_resource_reference(>buffer, NULL);
FREE(desc->list);
 }
 
 static bool si_upload_descriptors(struct si_context *sctx,
- struct si_descriptors *desc,
- struct r600_atom * atom)
+ struct si_descriptors *desc)
 {
unsigned slot_size = desc->element_dw_size * 4;
unsigned first_slot_offset = desc->first_active_slot * slot_size;
unsigned upload_size = desc->num_active_slots * slot_size;
 
/* Skip the upload if no shader is using the descriptors. dirty_mask
 * will stay dirty and the descriptors will be uploaded when there is
 * a shader using them.
 */
if (!upload_size)
@@ -156,23 +155,21 @@ static bool si_upload_descriptors(struct si_context *sctx,
util_memcpy_cpu_to_le32(ptr, (char*)desc->list + first_slot_offset,
upload_size);
desc->gpu_list = ptr - first_slot_offset / 4;
 
radeon_add_to_buffer_list(>b, >b.gfx, desc->buffer,
 RADEON_USAGE_READ, RADEON_PRIO_DESCRIPTORS);
 
/* The shader pointer should point to slot 0. */
desc->buffer_offset -= first_slot_offset;
 
-   if (atom)
-   si_mark_atom_dirty(sctx, atom);
-
+   si_mark_atom_dirty(sctx, >shader_pointers.atom);
return true;
 }
 
 static void
 si_descriptors_begin_new_cs(struct si_context *sctx, struct si_descriptors 
*desc)
 {
if (!desc->buffer)
return;
 
radeon_add_to_buffer_list(>b, >b.gfx, desc->buffer,
@@ -2149,21 +2146,21 @@ si_create_bindless_descriptor(struct si_context *sctx, 
uint32_t *desc_list,
 * 16-dword slots for now. Image descriptors only need 8-dword but this
 * doesn't really matter because no real apps use image handles.
 */
desc_slot_offset = desc_slot * 16;
 
/* Copy the descriptor into the array. */
memcpy(desc->list + desc_slot_offset, desc_list, size);
 
/* Re-upload the whole array of bindless descriptors into a new buffer.
 */
-   if (!si_upload_descriptors(sctx, desc, >shader_pointers.atom))
+   if (!si_upload_descriptors(sctx, desc))
return 0;
 
/* Make sure to re-emit the shader pointers for all stages. */
sctx->graphics_bindless_pointer_dirty = true;
sctx->compute_bindless_pointer_dirty = true;
 
return desc_slot;
 }
 
 static void si_update_bindless_buffer_descriptor(struct si_context *sctx,
@@ -2622,22 +2619,21 @@ void si_init_all_descriptors(struct si_context *sctx)
 static bool si_upload_shader_descriptors(struct si_context *sctx, unsigned 
mask)
 {
unsigned dirty = sctx->descriptors_dirty & mask;
 
/* Assume nothing will go wrong: */
sctx->shader_pointers_dirty |= dirty;
 
while (dirty) {
unsigned i = u_bit_scan();
 
-   if (!si_upload_descriptors(sctx, >descriptors[i],
-  >shader_pointers.atom))
+   if (!si_upload_descriptors(sctx, >descriptors[i]))
return false;
}
 
sctx->descriptors_dirty &= ~mask;
 
si_upload_bindless_descriptors(sctx);
 
return true;
 }
 
-- 
2.7.4

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


[Mesa-dev] [PATCH 15/16] ac: clean up ac_build_indexed_load function interfaces

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/amd/common/ac_llvm_build.c| 42 ++-
 src/amd/common/ac_llvm_build.h| 14 
 src/amd/common/ac_nir_to_llvm.c   | 22 ++--
 src/gallium/drivers/radeonsi/si_shader.c  | 34 +-
 src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c |  4 +--
 5 files changed, 61 insertions(+), 55 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 1d97b09..949f181 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -710,46 +710,54 @@ ac_build_indexed_store(struct ac_llvm_context *ctx,
   ac_build_gep0(ctx, base_ptr, index));
 }
 
 /**
  * Build an LLVM bytecode indexed load using LLVMBuildGEP + LLVMBuildLoad.
  * It's equivalent to doing a load from _ptr[index].
  *
  * \param base_ptr  Where the array starts.
  * \param index The element index into the array.
  * \param uniform   Whether the base_ptr and index can be assumed to be
- *  dynamically uniform
+ *  dynamically uniform (i.e. load to an SGPR)
+ * \param invariant Whether the load is invariant (no other opcodes affect it)
  */
-LLVMValueRef
-ac_build_indexed_load(struct ac_llvm_context *ctx,
- LLVMValueRef base_ptr, LLVMValueRef index,
- bool uniform)
+static LLVMValueRef
+ac_build_load_custom(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
+LLVMValueRef index, bool uniform, bool invariant)
 {
-   LLVMValueRef pointer;
+   LLVMValueRef pointer, result;
 
pointer = ac_build_gep0(ctx, base_ptr, index);
if (uniform)
LLVMSetMetadata(pointer, ctx->uniform_md_kind, ctx->empty_md);
-   return LLVMBuildLoad(ctx->builder, pointer, "");
+   result = LLVMBuildLoad(ctx->builder, pointer, "");
+   if (invariant)
+   LLVMSetMetadata(result, ctx->invariant_load_md_kind, 
ctx->empty_md);
+   return result;
 }
 
-/**
- * Do a load from _ptr[index], but also add a flag that it's loading
- * a constant from a dynamically uniform index.
- */
-LLVMValueRef
-ac_build_indexed_load_const(struct ac_llvm_context *ctx,
-   LLVMValueRef base_ptr, LLVMValueRef index)
+LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
+  LLVMValueRef index)
 {
-   LLVMValueRef result = ac_build_indexed_load(ctx, base_ptr, index, true);
-   LLVMSetMetadata(result, ctx->invariant_load_md_kind, ctx->empty_md);
-   return result;
+   return ac_build_load_custom(ctx, base_ptr, index, false, false);
+}
+
+LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx,
+LLVMValueRef base_ptr, LLVMValueRef index)
+{
+   return ac_build_load_custom(ctx, base_ptr, index, false, true);
+}
+
+LLVMValueRef ac_build_load_to_sgpr(struct ac_llvm_context *ctx,
+  LLVMValueRef base_ptr, LLVMValueRef index)
+{
+   return ac_build_load_custom(ctx, base_ptr, index, true, true);
 }
 
 /* TBUFFER_STORE_FORMAT_{X,XY,XYZ,XYZW} <- the suffix is selected by 
num_channels=1..4.
  * The type of vdata must be one of i32 (num_channels=1), v2i32 
(num_channels=2),
  * or v4i32 (num_channels=3,4).
  */
 void
 ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,
LLVMValueRef vdata,
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index ac8ea9c..f0b5875 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -143,28 +143,26 @@ ac_build_fs_interp_mov(struct ac_llvm_context *ctx,
 LLVMValueRef
 ac_build_gep0(struct ac_llvm_context *ctx,
  LLVMValueRef base_ptr,
  LLVMValueRef index);
 
 void
 ac_build_indexed_store(struct ac_llvm_context *ctx,
   LLVMValueRef base_ptr, LLVMValueRef index,
   LLVMValueRef value);
 
-LLVMValueRef
-ac_build_indexed_load(struct ac_llvm_context *ctx,
- LLVMValueRef base_ptr, LLVMValueRef index,
- bool uniform);
-
-LLVMValueRef
-ac_build_indexed_load_const(struct ac_llvm_context *ctx,
-   LLVMValueRef base_ptr, LLVMValueRef index);
+LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
+  LLVMValueRef index);
+LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx,
+LLVMValueRef base_ptr, LLVMValueRef index);
+LLVMValueRef ac_build_load_to_sgpr(struct ac_llvm_context *ctx,
+  LLVMValueRef base_ptr, LLVMValueRef index);
 
 void
 ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,

[Mesa-dev] [PATCH 16/16] radeonsi: if there's just const buffer 0, set it in place of CONST/SSBO pointer

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

SI_SGPR_CONST_AND_SHADER_BUFFERS now contains the pointer to const buffer 0
if there is no other buffer there.

Benefits:
- there is no constbuf descriptor upload and shader load

It's assumed that all constant addresses are within bounds. Non-constant
addresses are clamped against the last declared CONST variable.
This only works if the state tracker ensures the bound constant buffer
matches what the shader needs.

Once we get 32-bit pointers, we can only do this for user constant buffers
where the driver is in charge of the upload so that it can guarantee a 32-bit
address.

The real performance benefit might not be measurable.

These apps get 100% theoretical benefit in all shaders (except where noted):
- antichamber
- barman arkham origins
- borderlands 2
- borderlands pre-sequel
- brutal legend
- civilization BE
- CS:GO
- deadcore
- dota 2 -- most shaders
- europa universalis
- grid autosport -- most shaders
- left 4 dead 2
- legend of grimrock
- life is strange
- payday 2
- portal
- rocket league
- serious sam 3 bfe
- talos principle
- team fortress 2
- thea
- unigine heaven
- unigine valley -- also sanctuary and tropics
- wasteland 2
- xcom: enemy unknown & enemy within
- tesseract
- unity (engine)

Changed stats only:
SGPRS: 2059998 -> 2086238 (1.27 %)
VGPRS: 1626888 -> 1626904 (0.00 %)
Spilled SGPRs: 7902 -> 7865 (-0.47 %)
Code Size: 60924520 -> 60982660 (0.10 %) bytes
Max Waves: 374539 -> 374526 (-0.00 %)
---
 src/gallium/drivers/radeonsi/si_descriptors.c | 23 +++--
 src/gallium/drivers/radeonsi/si_shader.c  | 72 +++
 src/gallium/drivers/radeonsi/si_shader.h  |  2 +-
 src/gallium/drivers/radeonsi/si_state.h   |  3 ++
 4 files changed, 87 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 0c1fca8..da6efa8 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -119,20 +119,21 @@ static void si_init_descriptor_list(uint32_t *desc_list,
 
 static void si_init_descriptors(struct si_descriptors *desc,
unsigned shader_userdata_index,
unsigned element_dw_size,
unsigned num_elements)
 {
desc->list = CALLOC(num_elements, element_dw_size * 4);
desc->element_dw_size = element_dw_size;
desc->num_elements = num_elements;
desc->shader_userdata_offset = shader_userdata_index * 4;
+   desc->slot_index_to_bind_directly = -1;
 }
 
 static void si_release_descriptors(struct si_descriptors *desc)
 {
r600_resource_reference(>buffer, NULL);
FREE(desc->list);
 }
 
 static bool si_upload_descriptors(struct si_context *sctx,
  struct si_descriptors *desc)
@@ -141,20 +142,34 @@ static bool si_upload_descriptors(struct si_context *sctx,
unsigned first_slot_offset = desc->first_active_slot * slot_size;
unsigned upload_size = desc->num_active_slots * slot_size;
 
/* Skip the upload if no shader is using the descriptors. dirty_mask
 * will stay dirty and the descriptors will be uploaded when there is
 * a shader using them.
 */
if (!upload_size)
return true;
 
+   /* If there is just one active descriptor, bind it directly. */
+   if ((int)desc->first_active_slot == desc->slot_index_to_bind_directly &&
+   desc->num_active_slots == 1) {
+   uint32_t *descriptor = 
>list[desc->slot_index_to_bind_directly *
+  desc->element_dw_size];
+
+   /* The buffer is already in the buffer list. */
+   r600_resource_reference(>buffer, NULL);
+   desc->gpu_list = NULL;
+   desc->gpu_address = si_desc_extract_buffer_address(descriptor);
+   si_mark_atom_dirty(sctx, >shader_pointers.atom);
+   return true;
+   }
+
uint32_t *ptr;
int buffer_offset;
u_upload_alloc(sctx->b.b.const_uploader, 0, upload_size,
   si_optimal_tcc_alignment(sctx, upload_size),
   (unsigned*)_offset,
   (struct pipe_resource**)>buffer,
   (void**));
if (!desc->buffer) {
desc->gpu_address = 0;
return false; /* skip the draw call */
@@ -2524,38 +2539,40 @@ void si_init_all_descriptors(struct si_context *sctx)
int i;
 
STATIC_ASSERT(GFX9_SGPR_TCS_CONST_AND_SHADER_BUFFERS % 2 == 0);
STATIC_ASSERT(GFX9_SGPR_GS_CONST_AND_SHADER_BUFFERS % 2 == 0);
 
for (i = 0; i < SI_NUM_SHADERS; i++) {
bool gfx9_tcs = false;
bool gfx9_gs = false;
unsigned num_sampler_slots = SI_NUM_IMAGES / 2 + 
SI_NUM_SAMPLERS;
   

[Mesa-dev] [PATCH 08/16] radeonsi: emit dirty consecutive pointers in one SET_SH_REG packet

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

IB size: -1.6%
---
 src/gallium/drivers/radeonsi/si_descriptors.c | 66 ---
 1 file changed, 39 insertions(+), 27 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index a0f3dcf..a2b7c11 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1978,20 +1978,42 @@ static void si_emit_shader_pointer_body(struct 
radeon_winsys_cs *cs,
 static void si_emit_shader_pointer(struct si_context *sctx,
   struct si_descriptors *desc,
   unsigned sh_base)
 {
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
 
si_emit_shader_pointer_head(cs, desc, sh_base, 1);
si_emit_shader_pointer_body(cs, desc);
 }
 
+static void si_emit_consecutive_shader_pointers(struct si_context *sctx,
+   unsigned pointer_mask,
+   unsigned sh_base)
+{
+   if (!sh_base)
+   return;
+
+   struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
+   unsigned mask = sctx->shader_pointers_dirty & pointer_mask;
+
+   while (mask) {
+   int start, count;
+   u_bit_scan_consecutive_range(, , );
+
+   struct si_descriptors *descs = >descriptors[start];
+
+   si_emit_shader_pointer_head(cs, descs, sh_base, count);
+   for (int i = 0; i < count; i++)
+   si_emit_shader_pointer_body(cs, descs + i);
+   }
+}
+
 static void si_emit_global_shader_pointers(struct si_context *sctx,
   struct si_descriptors *descs)
 {
if (sctx->b.chip_class == GFX9) {
/* Broadcast it to all shader stages. */
si_emit_shader_pointer(sctx, descs,
   R_00B530_SPI_SHADER_USER_DATA_COMMON_0);
return;
}
 
@@ -2005,71 +2027,61 @@ static void si_emit_global_shader_pointers(struct 
si_context *sctx,
   R_00B230_SPI_SHADER_USER_DATA_GS_0);
si_emit_shader_pointer(sctx, descs,
   R_00B430_SPI_SHADER_USER_DATA_HS_0);
si_emit_shader_pointer(sctx, descs,
   R_00B530_SPI_SHADER_USER_DATA_LS_0);
 }
 
 void si_emit_graphics_shader_pointers(struct si_context *sctx,
   struct r600_atom *atom)
 {
-   unsigned mask;
uint32_t *sh_base = sctx->shader_pointers.sh_base;
-   struct si_descriptors *descs;
 
-   descs = >descriptors[SI_DESCS_RW_BUFFERS];
-
-   if (sctx->shader_pointers_dirty & (1 << SI_DESCS_RW_BUFFERS))
-   si_emit_global_shader_pointers(sctx, descs);
-
-   mask = sctx->shader_pointers_dirty &
-  u_bit_consecutive(SI_DESCS_FIRST_SHADER,
-SI_DESCS_FIRST_COMPUTE - 
SI_DESCS_FIRST_SHADER);
+   if (sctx->shader_pointers_dirty & (1 << SI_DESCS_RW_BUFFERS)) {
+   si_emit_global_shader_pointers(sctx,
+  
>descriptors[SI_DESCS_RW_BUFFERS]);
+   }
 
-   while (mask) {
-   unsigned i = u_bit_scan();
-   unsigned shader = (i - SI_DESCS_FIRST_SHADER) / 
SI_NUM_SHADER_DESCS;
-   unsigned base = sh_base[shader];
+   si_emit_consecutive_shader_pointers(sctx, SI_DESCS_SHADER_MASK(VERTEX),
+   sh_base[PIPE_SHADER_VERTEX]);
+   si_emit_consecutive_shader_pointers(sctx, 
SI_DESCS_SHADER_MASK(TESS_CTRL),
+   sh_base[PIPE_SHADER_TESS_CTRL]);
+   si_emit_consecutive_shader_pointers(sctx, 
SI_DESCS_SHADER_MASK(TESS_EVAL),
+   sh_base[PIPE_SHADER_TESS_EVAL]);
+   si_emit_consecutive_shader_pointers(sctx, 
SI_DESCS_SHADER_MASK(GEOMETRY),
+   sh_base[PIPE_SHADER_GEOMETRY]);
+   si_emit_consecutive_shader_pointers(sctx, 
SI_DESCS_SHADER_MASK(FRAGMENT),
+   sh_base[PIPE_SHADER_FRAGMENT]);
 
-   if (base)
-   si_emit_shader_pointer(sctx, descs + i, base);
-   }
sctx->shader_pointers_dirty &=
~u_bit_consecutive(SI_DESCS_RW_BUFFERS, SI_DESCS_FIRST_COMPUTE);
 
if (sctx->vertex_buffer_pointer_dirty) {
si_emit_shader_pointer(sctx, >vertex_buffers,
   sh_base[PIPE_SHADER_VERTEX]);
sctx->vertex_buffer_pointer_dirty = false;
}
 
if (sctx->graphics_bindless_pointer_dirty) {
si_emit_global_shader_pointers(sctx,
   >bindless_descriptors);
sctx->graphics_bindless_pointer_dirty 

[Mesa-dev] [PATCH 01/16] winsys/amdgpu: don't do read-modify-write on command buffers

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

i.e. don't use |=
---
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 19 +++
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.h |  1 +
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c 
b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index d9d2a8b..0a657f7 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -718,34 +718,45 @@ static bool amdgpu_get_new_ib(struct radeon_winsys *ws, 
struct amdgpu_cs *cs,
ib->used_ib_space + ib_size > ib->big_ib_buffer->size) {
   if (!amdgpu_ib_new_buffer(aws, ib))
  return false;
}
 
info->va_start = amdgpu_winsys_bo(ib->big_ib_buffer)->va + 
ib->used_ib_space;
info->ib_bytes = 0;
/* ib_bytes is in dwords and the conversion to bytes will be done before
 * the CS ioctl. */
ib->ptr_ib_size = >ib_bytes;
+   ib->ptr_ib_size_inside_ib = false;
 
amdgpu_cs_add_buffer(>main.base, ib->big_ib_buffer,
 RADEON_USAGE_READ, 0, RADEON_PRIO_IB1);
 
ib->base.current.buf = (uint32_t*)(ib->ib_mapped + ib->used_ib_space);
 
ib_size = ib->big_ib_buffer->size - ib->used_ib_space;
ib->base.current.max_dw = ib_size / 4 - amdgpu_cs_epilog_dws(cs->ring_type);
return true;
 }
 
+static void amdgpu_set_ib_size(struct amdgpu_ib *ib)
+{
+   if (ib->ptr_ib_size_inside_ib) {
+  *ib->ptr_ib_size = ib->base.current.cdw |
+ S_3F2_CHAIN(1) | S_3F2_VALID(1);
+   } else {
+  *ib->ptr_ib_size = ib->base.current.cdw;
+   }
+}
+
 static void amdgpu_ib_finalize(struct amdgpu_ib *ib)
 {
-   *ib->ptr_ib_size |= ib->base.current.cdw;
+   amdgpu_set_ib_size(ib);
ib->used_ib_space += ib->base.current.cdw * 4;
ib->max_ib_size = MAX2(ib->max_ib_size, ib->base.prev_dw + 
ib->base.current.cdw);
 }
 
 static bool amdgpu_init_cs_context(struct amdgpu_cs_context *cs,
enum ring_type ring_type)
 {
switch (ring_type) {
case RING_DMA:
   cs->ib[IB_MAIN].ip_type = AMDGPU_HW_IP_DMA;
@@ -926,28 +937,28 @@ static bool amdgpu_cs_check_space(struct radeon_winsys_cs 
*rcs, unsigned dw)
assert(ib->used_ib_space + 4 * rcs->current.max_dw <= 
ib->big_ib_buffer->size);
 
/* Pad with NOPs and add INDIRECT_BUFFER packet */
while ((rcs->current.cdw & 7) != 4)
   radeon_emit(rcs, 0x1000); /* type3 nop packet */
 
radeon_emit(rcs, PKT3(ib->ib_type == IB_MAIN ? PKT3_INDIRECT_BUFFER_CIK
: PKT3_INDIRECT_BUFFER_CONST, 2, 
0));
radeon_emit(rcs, va);
radeon_emit(rcs, va >> 32);
-   new_ptr_ib_size = >current.buf[rcs->current.cdw];
-   radeon_emit(rcs, S_3F2_CHAIN(1) | S_3F2_VALID(1));
+   new_ptr_ib_size = >current.buf[rcs->current.cdw++];
 
assert((rcs->current.cdw & 7) == 0);
assert(rcs->current.cdw <= rcs->current.max_dw);
 
-   *ib->ptr_ib_size |= rcs->current.cdw;
+   amdgpu_set_ib_size(ib);
ib->ptr_ib_size = new_ptr_ib_size;
+   ib->ptr_ib_size_inside_ib = true;
 
/* Hook up the new chunk */
rcs->prev[rcs->num_prev].buf = rcs->current.buf;
rcs->prev[rcs->num_prev].cdw = rcs->current.cdw;
rcs->prev[rcs->num_prev].max_dw = rcs->current.cdw; /* no modifications */
rcs->num_prev++;
 
ib->base.prev_dw += ib->base.current.cdw;
ib->base.current.cdw = 0;
 
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h 
b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
index 21e1354..1c3d0f0 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
@@ -66,20 +66,21 @@ enum ib_type {
 
 struct amdgpu_ib {
struct radeon_winsys_cs base;
 
/* A buffer out of which new IBs are allocated. */
struct pb_buffer*big_ib_buffer;
uint8_t *ib_mapped;
unsignedused_ib_space;
unsignedmax_ib_size;
uint32_t*ptr_ib_size;
+   boolptr_ib_size_inside_ib;
enum ib_typeib_type;
 };
 
 struct amdgpu_cs_context {
struct drm_amdgpu_cs_chunk_ib ib[IB_NUM];
 
/* Buffers. */
unsignedmax_real_buffers;
unsignednum_real_buffers;
struct amdgpu_cs_buffer *real_buffers;
-- 
2.7.4

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


[Mesa-dev] [PATCH 12/16] radeonsi: add si_descriptors::gpu_address and remove buffer_offset

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

This allows us to change the pointer arbitrarily.
---
 src/gallium/drivers/radeonsi/si_cp_dma.c  |  3 ++-
 src/gallium/drivers/radeonsi/si_descriptors.c | 27 +++
 src/gallium/drivers/radeonsi/si_state.h   |  2 +-
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c 
b/src/gallium/drivers/radeonsi/si_cp_dma.c
index 97adc27..9a3971a 100644
--- a/src/gallium/drivers/radeonsi/si_cp_dma.c
+++ b/src/gallium/drivers/radeonsi/si_cp_dma.c
@@ -453,21 +453,22 @@ static void cik_prefetch_shader_async(struct si_context 
*sctx,
 
cik_prefetch_TC_L2_async(sctx, bo, 0, bo->width0);
 }
 
 static void cik_prefetch_VBO_descriptors(struct si_context *sctx)
 {
if (!sctx->vertex_elements)
return;
 
cik_prefetch_TC_L2_async(sctx, >vertex_buffers.buffer->b.b,
-sctx->vertex_buffers.buffer_offset,
+sctx->vertex_buffers.gpu_address -
+sctx->vertex_buffers.buffer->gpu_address,
 sctx->vertex_elements->desc_list_byte_size);
 }
 
 void cik_emit_prefetch_L2(struct si_context *sctx)
 {
/* Prefetch shaders and VBO descriptors to TC L2. */
if (sctx->b.chip_class >= GFX9) {
/* Choose the right spot for the VBO prefetch. */
if (sctx->tes_shader.cso) {
if (sctx->prefetch_L2_mask & SI_PREFETCH_HS)
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 3c33e85..0c1fca8 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -142,37 +142,41 @@ static bool si_upload_descriptors(struct si_context *sctx,
unsigned upload_size = desc->num_active_slots * slot_size;
 
/* Skip the upload if no shader is using the descriptors. dirty_mask
 * will stay dirty and the descriptors will be uploaded when there is
 * a shader using them.
 */
if (!upload_size)
return true;
 
uint32_t *ptr;
+   int buffer_offset;
u_upload_alloc(sctx->b.b.const_uploader, 0, upload_size,
   si_optimal_tcc_alignment(sctx, upload_size),
-  (unsigned*)>buffer_offset,
+  (unsigned*)_offset,
   (struct pipe_resource**)>buffer,
   (void**));
-   if (!desc->buffer)
+   if (!desc->buffer) {
+   desc->gpu_address = 0;
return false; /* skip the draw call */
+   }
 
util_memcpy_cpu_to_le32(ptr, (char*)desc->list + first_slot_offset,
upload_size);
desc->gpu_list = ptr - first_slot_offset / 4;
 
radeon_add_to_buffer_list(>b, >b.gfx, desc->buffer,
 RADEON_USAGE_READ, RADEON_PRIO_DESCRIPTORS);
 
/* The shader pointer should point to slot 0. */
-   desc->buffer_offset -= first_slot_offset;
+   buffer_offset -= first_slot_offset;
+   desc->gpu_address = desc->buffer->gpu_address + buffer_offset;
 
si_mark_atom_dirty(sctx, >shader_pointers.atom);
return true;
 }
 
 static void
 si_descriptors_begin_new_cs(struct si_context *sctx, struct si_descriptors 
*desc)
 {
if (!desc->buffer)
return;
@@ -990,28 +994,32 @@ bool si_upload_vertex_buffer_descriptors(struct 
si_context *sctx)
if (!count)
return true;
 
desc_list_byte_size = velems->desc_list_byte_size;
first_vb_use_mask = velems->first_vb_use_mask;
 
/* Vertex buffer descriptors are the only ones which are uploaded
 * directly through a staging buffer and don't go through
 * the fine-grained upload path.
 */
+   unsigned buffer_offset = 0;
u_upload_alloc(sctx->b.b.const_uploader, 0,
   desc_list_byte_size,
   si_optimal_tcc_alignment(sctx, desc_list_byte_size),
-  (unsigned*)>buffer_offset,
+  _offset,
   (struct pipe_resource**)>buffer, (void**));
-   if (!desc->buffer)
+   if (!desc->buffer) {
+   desc->gpu_address = 0;
return false;
+   }
 
+   desc->gpu_address = desc->buffer->gpu_address + buffer_offset;
desc->list = ptr;
radeon_add_to_buffer_list(>b, >b.gfx,
  desc->buffer, RADEON_USAGE_READ,
  RADEON_PRIO_DESCRIPTORS);
 
assert(count <= SI_MAX_ATTRIBS);
 
for (i = 0; i < count; i++) {
struct pipe_vertex_buffer *vb;
struct r600_resource *rbuffer;
@@ -1707,23 +1715,21 @@ static void si_upload_bindless_descriptor(struct 
si_context *sctx,

[Mesa-dev] [PATCH 06/16] radeonsi: generalize the SI_VS_SHADER_POINTER_MASK macro

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_blit.c   | 2 +-
 src/gallium/drivers/radeonsi/si_state.h  | 4 ++--
 src/gallium/drivers/radeonsi/si_state_draw.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_blit.c 
b/src/gallium/drivers/radeonsi/si_blit.c
index 03aa4f7..fd8559a 100644
--- a/src/gallium/drivers/radeonsi/si_blit.c
+++ b/src/gallium/drivers/radeonsi/si_blit.c
@@ -88,21 +88,21 @@ static void si_blitter_begin(struct pipe_context *ctx, enum 
si_blitter_op op)
 }
 
 static void si_blitter_end(struct pipe_context *ctx)
 {
struct si_context *sctx = (struct si_context *)ctx;
 
sctx->b.render_cond_force_off = false;
 
/* Restore shader pointers because the VS blit shader changed all
 * non-global VS user SGPRs. */
-   sctx->shader_pointers_dirty |= SI_VS_SHADER_POINTER_MASK;
+   sctx->shader_pointers_dirty |= SI_DESCS_SHADER_MASK(VERTEX);
sctx->vertex_buffer_pointer_dirty = true;
si_mark_atom_dirty(sctx, >shader_pointers.atom);
 }
 
 static unsigned u_max_sample(struct pipe_resource *r)
 {
return r->nr_samples ? r->nr_samples - 1 : 0;
 }
 
 static unsigned
diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index 8122ddb..bc7e7b3 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -240,23 +240,23 @@ enum {
SI_NUM_SHADER_DESCS,
 };
 
 #define SI_DESCS_RW_BUFFERS0
 #define SI_DESCS_FIRST_SHADER  1
 #define SI_DESCS_FIRST_COMPUTE (SI_DESCS_FIRST_SHADER + \
 PIPE_SHADER_COMPUTE * 
SI_NUM_SHADER_DESCS)
 #define SI_NUM_DESCS   (SI_DESCS_FIRST_SHADER + \
 SI_NUM_SHADERS * SI_NUM_SHADER_DESCS)
 
-#define SI_VS_SHADER_POINTER_MASK \
+#define SI_DESCS_SHADER_MASK(name) \
u_bit_consecutive(SI_DESCS_FIRST_SHADER + \
- PIPE_SHADER_VERTEX * SI_NUM_SHADER_DESCS, \
+ PIPE_SHADER_##name * SI_NUM_SHADER_DESCS, \
  SI_NUM_SHADER_DESCS)
 
 /* This represents descriptors in memory, such as buffer resources,
  * image resources, and sampler states.
  */
 struct si_descriptors {
/* The list of descriptors in malloc'd memory. */
uint32_t *list;
/* The list in mapped GPU memory. */
uint32_t *gpu_list;
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c 
b/src/gallium/drivers/radeonsi/si_state_draw.c
index 9468fde..ed48edd 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -1537,21 +1537,21 @@ void si_draw_rectangle(struct blitter_context *blitter,
}
 
pipe->bind_vs_state(pipe, si_get_blit_vs(sctx, type, num_instances));
 
struct pipe_draw_info info = {};
info.mode = R600_PRIM_RECTANGLE_LIST;
info.count = 3;
info.instance_count = num_instances;
 
/* Don't set per-stage shader pointers for VS. */
-   sctx->shader_pointers_dirty &= ~SI_VS_SHADER_POINTER_MASK;
+   sctx->shader_pointers_dirty &= ~SI_DESCS_SHADER_MASK(VERTEX);
sctx->vertex_buffer_pointer_dirty = false;
 
si_draw_vbo(pipe, );
 }
 
 void si_trace_emit(struct si_context *sctx)
 {
struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
uint64_t va = sctx->current_saved_cs->trace_buf->gpu_address;
uint32_t trace_id = ++sctx->current_saved_cs->trace_id;
-- 
2.7.4

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


[Mesa-dev] [PATCH 03/16] radeonsi: add GFX-IB-size query to the HUD

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

It shows the sum of all IBs per frame.
---
 src/gallium/drivers/radeon/r600_query.c   | 4 
 src/gallium/drivers/radeon/r600_query.h   | 1 +
 src/gallium/drivers/radeon/radeon_winsys.h| 1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 2 ++
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h | 1 +
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 1 +
 7 files changed, 11 insertions(+)

diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index b2809f8..aedf950 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -72,20 +72,21 @@ static enum radeon_value_id winsys_id_from_type(unsigned 
type)
switch (type) {
case R600_QUERY_REQUESTED_VRAM: return RADEON_REQUESTED_VRAM_MEMORY;
case R600_QUERY_REQUESTED_GTT: return RADEON_REQUESTED_GTT_MEMORY;
case R600_QUERY_MAPPED_VRAM: return RADEON_MAPPED_VRAM;
case R600_QUERY_MAPPED_GTT: return RADEON_MAPPED_GTT;
case R600_QUERY_BUFFER_WAIT_TIME: return RADEON_BUFFER_WAIT_TIME_NS;
case R600_QUERY_NUM_MAPPED_BUFFERS: return RADEON_NUM_MAPPED_BUFFERS;
case R600_QUERY_NUM_GFX_IBS: return RADEON_NUM_GFX_IBS;
case R600_QUERY_NUM_SDMA_IBS: return RADEON_NUM_SDMA_IBS;
case R600_QUERY_GFX_BO_LIST_SIZE: return RADEON_GFX_BO_LIST_COUNTER;
+   case R600_QUERY_GFX_IB_SIZE: return RADEON_GFX_IB_SIZE_COUNTER;
case R600_QUERY_NUM_BYTES_MOVED: return RADEON_NUM_BYTES_MOVED;
case R600_QUERY_NUM_EVICTIONS: return RADEON_NUM_EVICTIONS;
case R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS: return 
RADEON_NUM_VRAM_CPU_PAGE_FAULTS;
case R600_QUERY_VRAM_USAGE: return RADEON_VRAM_USAGE;
case R600_QUERY_VRAM_VIS_USAGE: return RADEON_VRAM_VIS_USAGE;
case R600_QUERY_GTT_USAGE: return RADEON_GTT_USAGE;
case R600_QUERY_GPU_TEMPERATURE: return RADEON_GPU_TEMPERATURE;
case R600_QUERY_CURRENT_GPU_SCLK: return RADEON_CURRENT_SCLK;
case R600_QUERY_CURRENT_GPU_MCLK: return RADEON_CURRENT_MCLK;
case R600_QUERY_CS_THREAD_BUSY: return RADEON_CS_THREAD_TIME;
@@ -171,20 +172,21 @@ static bool r600_query_sw_begin(struct 
r600_common_context *rctx,
case R600_QUERY_VRAM_VIS_USAGE:
case R600_QUERY_GTT_USAGE:
case R600_QUERY_GPU_TEMPERATURE:
case R600_QUERY_CURRENT_GPU_SCLK:
case R600_QUERY_CURRENT_GPU_MCLK:
case R600_QUERY_BACK_BUFFER_PS_DRAW_RATIO:
case R600_QUERY_NUM_MAPPED_BUFFERS:
query->begin_result = 0;
break;
case R600_QUERY_BUFFER_WAIT_TIME:
+   case R600_QUERY_GFX_IB_SIZE:
case R600_QUERY_NUM_GFX_IBS:
case R600_QUERY_NUM_SDMA_IBS:
case R600_QUERY_NUM_BYTES_MOVED:
case R600_QUERY_NUM_EVICTIONS:
case R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS: {
enum radeon_value_id ws_id = winsys_id_from_type(query->b.type);
query->begin_result = rctx->ws->query_value(rctx->ws, ws_id);
break;
}
case R600_QUERY_GFX_BO_LIST_SIZE:
@@ -326,20 +328,21 @@ static bool r600_query_sw_end(struct r600_common_context 
*rctx,
case R600_QUERY_REQUESTED_GTT:
case R600_QUERY_MAPPED_VRAM:
case R600_QUERY_MAPPED_GTT:
case R600_QUERY_VRAM_USAGE:
case R600_QUERY_VRAM_VIS_USAGE:
case R600_QUERY_GTT_USAGE:
case R600_QUERY_GPU_TEMPERATURE:
case R600_QUERY_CURRENT_GPU_SCLK:
case R600_QUERY_CURRENT_GPU_MCLK:
case R600_QUERY_BUFFER_WAIT_TIME:
+   case R600_QUERY_GFX_IB_SIZE:
case R600_QUERY_NUM_MAPPED_BUFFERS:
case R600_QUERY_NUM_GFX_IBS:
case R600_QUERY_NUM_SDMA_IBS:
case R600_QUERY_NUM_BYTES_MOVED:
case R600_QUERY_NUM_EVICTIONS:
case R600_QUERY_NUM_VRAM_CPU_PAGE_FAULTS: {
enum radeon_value_id ws_id = winsys_id_from_type(query->b.type);
query->end_result = rctx->ws->query_value(rctx->ws, ws_id);
break;
}
@@ -1926,20 +1929,21 @@ static struct pipe_driver_query_info 
r600_driver_query_list[] = {
X("gallium-thread-busy",GALLIUM_THREAD_BUSY,UINT64, 
AVERAGE),
X("requested-VRAM", REQUESTED_VRAM, BYTES, AVERAGE),
X("requested-GTT",  REQUESTED_GTT,  BYTES, AVERAGE),
X("mapped-VRAM",MAPPED_VRAM,BYTES, AVERAGE),
X("mapped-GTT", MAPPED_GTT, BYTES, AVERAGE),
X("buffer-wait-time",   BUFFER_WAIT_TIME,   MICROSECONDS, 
CUMULATIVE),
X("num-mapped-buffers", NUM_MAPPED_BUFFERS, UINT64, 
AVERAGE),
X("num-GFX-IBs",NUM_GFX_IBS,UINT64, 
AVERAGE),
X("num-SDMA-IBs",   NUM_SDMA_IBS, 

[Mesa-dev] [PATCH 02/16] winsys/amdgpu: disable CPU caching for GFX & SDMA IBs

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

This should decrease IB fetch latency.
---
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c 
b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 0a657f7..8fbe8ae 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -609,21 +609,22 @@ static unsigned amdgpu_cs_add_buffer(struct 
radeon_winsys_cs *rcs,
buffer->u.real.priority_usage |= 1ull << priority;
buffer->usage |= usage;
 
cs->last_added_bo = bo;
cs->last_added_bo_index = index;
cs->last_added_bo_usage = buffer->usage;
cs->last_added_bo_priority_usage = buffer->u.real.priority_usage;
return index;
 }
 
-static bool amdgpu_ib_new_buffer(struct amdgpu_winsys *ws, struct amdgpu_ib 
*ib)
+static bool amdgpu_ib_new_buffer(struct amdgpu_winsys *ws, struct amdgpu_ib 
*ib,
+ enum ring_type ring_type)
 {
struct pb_buffer *pb;
uint8_t *mapped;
unsigned buffer_size;
 
/* Always create a buffer that is at least as large as the maximum seen IB
 * size, aligned to a power of two (and multiplied by 4 to reduce internal
 * fragmentation if chaining is not available). Limit to 512k dwords, which
 * is the largest power of two that fits into the size field of the
 * INDIRECT_BUFFER packet.
@@ -639,21 +640,25 @@ static bool amdgpu_ib_new_buffer(struct amdgpu_winsys 
*ws, struct amdgpu_ib *ib)
case IB_MAIN:
   buffer_size = MAX2(buffer_size, 8 * 1024 * 4);
   break;
default:
   unreachable("unhandled IB type");
}
 
pb = ws->base.buffer_create(>base, buffer_size,
ws->info.gart_page_size,
RADEON_DOMAIN_GTT,
-   RADEON_FLAG_NO_INTERPROCESS_SHARING);
+   RADEON_FLAG_NO_INTERPROCESS_SHARING |
+   (ring_type == RING_GFX ||
+ring_type == RING_COMPUTE ||
+ring_type == RING_DMA ?
+   RADEON_FLAG_GTT_WC : 0));
if (!pb)
   return false;
 
mapped = ws->base.buffer_map(pb, NULL, PIPE_TRANSFER_WRITE);
if (!mapped) {
   pb_reference(, NULL);
   return false;
}
 
pb_reference(>big_ib_buffer, pb);
@@ -709,21 +714,21 @@ static bool amdgpu_get_new_ib(struct radeon_winsys *ws, 
struct amdgpu_cs *cs,
ib->max_ib_size = ib->max_ib_size - ib->max_ib_size / 32;
 
ib->base.prev_dw = 0;
ib->base.num_prev = 0;
ib->base.current.cdw = 0;
ib->base.current.buf = NULL;
 
/* Allocate a new buffer for IBs if the current buffer is all used. */
if (!ib->big_ib_buffer ||
ib->used_ib_space + ib_size > ib->big_ib_buffer->size) {
-  if (!amdgpu_ib_new_buffer(aws, ib))
+  if (!amdgpu_ib_new_buffer(aws, ib, cs->ring_type))
  return false;
}
 
info->va_start = amdgpu_winsys_bo(ib->big_ib_buffer)->va + 
ib->used_ib_space;
info->ib_bytes = 0;
/* ib_bytes is in dwords and the conversion to bytes will be done before
 * the CS ioctl. */
ib->ptr_ib_size = >ib_bytes;
ib->ptr_ib_size_inside_ib = false;
 
@@ -919,21 +924,21 @@ static bool amdgpu_cs_check_space(struct radeon_winsys_cs 
*rcs, unsigned dw)
   new_prev = REALLOC(rcs->prev,
  sizeof(*new_prev) * rcs->max_prev,
  sizeof(*new_prev) * new_max_prev);
   if (!new_prev)
  return false;
 
   rcs->prev = new_prev;
   rcs->max_prev = new_max_prev;
}
 
-   if (!amdgpu_ib_new_buffer(cs->ctx->ws, ib))
+   if (!amdgpu_ib_new_buffer(cs->ctx->ws, ib, cs->ring_type))
   return false;
 
assert(ib->used_ib_space == 0);
va = amdgpu_winsys_bo(ib->big_ib_buffer)->va;
 
/* This space was originally reserved. */
rcs->current.max_dw += 4;
assert(ib->used_ib_space + 4 * rcs->current.max_dw <= 
ib->big_ib_buffer->size);
 
/* Pad with NOPs and add INDIRECT_BUFFER packet */
-- 
2.7.4

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


[Mesa-dev] [PATCH 04/16] radeonsi/gfx9: move RW_BUFFERS from s[0:1] to s[8:9] for HS and GS

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

Let's use the same user data SGPRs in all stages.
(for SPI_SHADER_USER_DATA_COMMON_0)
---
 src/gallium/drivers/radeonsi/si_descriptors.c | 24 -
 src/gallium/drivers/radeonsi/si_shader.c  | 31 +++
 2 files changed, 16 insertions(+), 39 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index cda7d94..9ba8df6 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1973,47 +1973,31 @@ static void si_emit_shader_pointer(struct si_context 
*sctx,
radeon_emit(cs, va >> 32);
 }
 
 static void si_emit_global_shader_pointers(struct si_context *sctx,
   struct si_descriptors *descs)
 {
si_emit_shader_pointer(sctx, descs,
   R_00B030_SPI_SHADER_USER_DATA_PS_0);
si_emit_shader_pointer(sctx, descs,
   R_00B130_SPI_SHADER_USER_DATA_VS_0);
+   si_emit_shader_pointer(sctx, descs,
+  R_00B330_SPI_SHADER_USER_DATA_ES_0);
 
if (sctx->b.chip_class >= GFX9) {
/* GFX9 merged LS-HS and ES-GS. */
-   if (descs == >descriptors[SI_DESCS_RW_BUFFERS]) {
-   /* Set RW_BUFFERS in the special registers, so that
-* it's preloaded into s[0:1] instead of s[8:9].
-*/
-   si_emit_shader_pointer(sctx, descs,
-  
R_00B208_SPI_SHADER_USER_DATA_ADDR_LO_GS);
-   si_emit_shader_pointer(sctx, descs,
-  
R_00B408_SPI_SHADER_USER_DATA_ADDR_LO_HS);
-   } else {
-   /* Set BINDLESS_SAMPLERS_AND_IMAGES into s[10:11],
-* s[8:9] remains unused for now.
-*/
-   assert(descs == >bindless_descriptors);
-   si_emit_shader_pointer(sctx, descs,
-  
R_00B330_SPI_SHADER_USER_DATA_ES_0);
-   si_emit_shader_pointer(sctx, descs,
-  
R_00B430_SPI_SHADER_USER_DATA_LS_0);
-   }
+   si_emit_shader_pointer(sctx, descs,
+  R_00B430_SPI_SHADER_USER_DATA_LS_0);
} else {
si_emit_shader_pointer(sctx, descs,
   R_00B230_SPI_SHADER_USER_DATA_GS_0);
si_emit_shader_pointer(sctx, descs,
-  R_00B330_SPI_SHADER_USER_DATA_ES_0);
-   si_emit_shader_pointer(sctx, descs,
   R_00B430_SPI_SHADER_USER_DATA_HS_0);
si_emit_shader_pointer(sctx, descs,
   R_00B530_SPI_SHADER_USER_DATA_LS_0);
}
 }
 
 void si_emit_graphics_shader_pointers(struct si_context *sctx,
   struct r600_atom *atom)
 {
unsigned mask;
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 4456c3d..62a056d 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -3024,25 +3024,27 @@ static void si_llvm_emit_tcs_epilogue(struct 
lp_build_tgsi_context *bld_base)
ret = LLVMBuildInsertValue(builder, ret, tf_lds_offset, vgpr++, 
"");
}
ctx->return_value = ret;
 }
 
 /* Pass TCS inputs from LS to TCS on GFX9. */
 static void si_set_ls_return_value_for_tcs(struct si_shader_context *ctx)
 {
LLVMValueRef ret = ctx->return_value;
 
-   ret = si_insert_input_ptr_as_2xi32(ctx, ret, ctx->param_rw_buffers, 0);
ret = si_insert_input_ret(ctx, ret, ctx->param_tcs_offchip_offset, 2);
ret = si_insert_input_ret(ctx, ret, ctx->param_merged_wave_info, 3);
ret = si_insert_input_ret(ctx, ret, ctx->param_tcs_factor_offset, 4);
ret = si_insert_input_ret(ctx, ret, ctx->param_merged_scratch_offset, 
5);
+
+   ret = si_insert_input_ptr_as_2xi32(ctx, ret, ctx->param_rw_buffers,
+  8 + SI_SGPR_RW_BUFFERS);
ret = si_insert_input_ptr_as_2xi32(ctx, ret,
ctx->param_bindless_samplers_and_images,
8 + SI_SGPR_BINDLESS_SAMPLERS_AND_IMAGES);
 
ret = si_insert_input_ret(ctx, ret, ctx->param_vs_state_bits,
  8 + SI_SGPR_VS_STATE_BITS);
ret = si_insert_input_ret(ctx, ret, ctx->param_tcs_offchip_layout,
  8 + GFX9_SGPR_TCS_OFFCHIP_LAYOUT);
ret = si_insert_input_ret(ctx, ret, ctx->param_tcs_out_lds_offsets,
  8 + GFX9_SGPR_TCS_OUT_OFFSETS);
@@ -3065,25 +3067,26 @@ 

[Mesa-dev] [PATCH 00/16] RadeonSI micro-optimizations

2017-10-13 Thread Marek Olšák
Hi,

This series:
- switches IB placement to GTT WC
- uses SPI_SHADER_USER_DATA_COMMON on GFX9
- combines setting of 2 per-stage descriptor pointers into 1 SET_SH_REG packet
- if there is only 1 constant buffer and 0 shader and atomic buffers,
  the constant buffer pointer is directly set into SI_SGPR_CONST_AND_SHADER_-
  BUFFERS, skipping a descriptor upload and shader load

Please review.

Thanks!

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


[Mesa-dev] [PATCH 09/16] radeonsi: pack si_descriptors better again

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

---
 src/gallium/drivers/radeonsi/si_state.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.h 
b/src/gallium/drivers/radeonsi/si_state.h
index bc7e7b3..8ce3cdb 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -258,34 +258,34 @@ enum {
 struct si_descriptors {
/* The list of descriptors in malloc'd memory. */
uint32_t *list;
/* The list in mapped GPU memory. */
uint32_t *gpu_list;
 
/* The buffer where the descriptors have been uploaded. */
struct r600_resource *buffer;
int buffer_offset; /* can be negative if not using lower slots */
 
-   /* The size of one descriptor. */
-   ubyte element_dw_size;
/* The maximum number of descriptors. */
uint32_t num_elements;
 
/* Slots that are used by currently-bound shaders.
 * It determines which slots are uploaded.
 */
uint32_t first_active_slot;
uint32_t num_active_slots;
 
/* The SGPR index where the 64-bit pointer to the descriptor array will
 * be stored. */
ubyte shader_userdata_offset;
+   /* The size of one descriptor. */
+   ubyte element_dw_size;
 };
 
 struct si_buffer_resources {
struct pipe_resource**buffers; /* this has num_buffers 
elements */
 
enum radeon_bo_usageshader_usage:4; /* READ, WRITE, or 
READWRITE */
enum radeon_bo_usageshader_usage_constbuf:4;
enum radeon_bo_priority priority:6;
enum radeon_bo_priority priority_constbuf:6;
 
-- 
2.7.4

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


[Mesa-dev] [PATCH 05/16] radeonsi/gfx9: use SPI_SHADER_USER_DATA_COMMON

2017-10-13 Thread Marek Olšák
From: Marek Olšák 

IB size: -0.4%
---
 src/gallium/drivers/radeonsi/si_descriptors.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index 9ba8df6..6e1fd80 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1969,39 +1969,39 @@ static void si_emit_shader_pointer(struct si_context 
*sctx,
 
radeon_emit(cs, PKT3(PKT3_SET_SH_REG, 2, 0));
radeon_emit(cs, (sh_base + desc->shader_userdata_offset - 
SI_SH_REG_OFFSET) >> 2);
radeon_emit(cs, va);
radeon_emit(cs, va >> 32);
 }
 
 static void si_emit_global_shader_pointers(struct si_context *sctx,
   struct si_descriptors *descs)
 {
+   if (sctx->b.chip_class == GFX9) {
+   /* Broadcast it to all shader stages. */
+   si_emit_shader_pointer(sctx, descs,
+  R_00B530_SPI_SHADER_USER_DATA_COMMON_0);
+   return;
+   }
+
si_emit_shader_pointer(sctx, descs,
   R_00B030_SPI_SHADER_USER_DATA_PS_0);
si_emit_shader_pointer(sctx, descs,
   R_00B130_SPI_SHADER_USER_DATA_VS_0);
si_emit_shader_pointer(sctx, descs,
   R_00B330_SPI_SHADER_USER_DATA_ES_0);
-
-   if (sctx->b.chip_class >= GFX9) {
-   /* GFX9 merged LS-HS and ES-GS. */
-   si_emit_shader_pointer(sctx, descs,
-  R_00B430_SPI_SHADER_USER_DATA_LS_0);
-   } else {
-   si_emit_shader_pointer(sctx, descs,
-  R_00B230_SPI_SHADER_USER_DATA_GS_0);
-   si_emit_shader_pointer(sctx, descs,
-  R_00B430_SPI_SHADER_USER_DATA_HS_0);
-   si_emit_shader_pointer(sctx, descs,
-  R_00B530_SPI_SHADER_USER_DATA_LS_0);
-   }
+   si_emit_shader_pointer(sctx, descs,
+  R_00B230_SPI_SHADER_USER_DATA_GS_0);
+   si_emit_shader_pointer(sctx, descs,
+  R_00B430_SPI_SHADER_USER_DATA_HS_0);
+   si_emit_shader_pointer(sctx, descs,
+  R_00B530_SPI_SHADER_USER_DATA_LS_0);
 }
 
 void si_emit_graphics_shader_pointers(struct si_context *sctx,
   struct r600_atom *atom)
 {
unsigned mask;
uint32_t *sh_base = sctx->shader_pointers.sh_base;
struct si_descriptors *descs;
 
descs = >descriptors[SI_DESCS_RW_BUFFERS];
-- 
2.7.4

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


Re: [Mesa-dev] [PATCH 2/4] radv: update ia_multi_vgt when executing secondary buffers

2017-10-13 Thread Samuel Pitoiset



On 10/13/2017 12:47 AM, Bas Nieuwenhuizen wrote:

Why don't we use the approach from patch 3 for this?


Yeah, will do.



Otherwise the series is r-b?

On Wed, Oct 11, 2017 at 10:25 AM, Samuel Pitoiset
 wrote:

Signed-off-by: Samuel Pitoiset 
---
  src/amd/vulkan/radv_cmd_buffer.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
index 9d6fb9fe40..f6f9847a14 100644
--- a/src/amd/vulkan/radv_cmd_buffer.c
+++ b/src/amd/vulkan/radv_cmd_buffer.c
@@ -2680,6 +2680,7 @@ void radv_CmdExecuteCommands(

 primary->state.last_primitive_reset_en = 
secondary->state.last_primitive_reset_en;
 primary->state.last_primitive_reset_index = 
secondary->state.last_primitive_reset_index;
+   primary->state.last_ia_multi_vgt_param = 
secondary->state.last_ia_multi_vgt_param;
 }

 /* if we execute secondary we need to mark some stuff to reset dirty */
--
2.14.2

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

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


  1   2   >