Mesa (master): radeonsi: move si_shader_context::soa:: addr to si_shader_context

2017-01-13 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: f04088a7ba30f235e4267f9191fc274d39f4412f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f04088a7ba30f235e4267f9191fc274d39f4412f

Author: Samuel Pitoiset 
Date:   Wed Jan 11 16:21:23 2017 +0100

radeonsi: move si_shader_context::soa::addr to si_shader_context

The plan is to replace si_shader_context::soa with its parent
structure (ie. bld_base).

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Nicolai Hähnle 
Reviewed-by: Marek Olšák 

---

 src/gallium/drivers/radeonsi/si_shader.c|  4 ++--
 src/gallium/drivers/radeonsi/si_shader_internal.h   |  2 ++
 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 17 -
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 61c0eff..9e4a22f 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -511,7 +511,7 @@ static LLVMValueRef get_indirect_index(struct 
si_shader_context *ctx,
struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
LLVMValueRef result;
 
-   result = ctx->soa.addr[ind->Index][ind->Swizzle];
+   result = ctx->addrs[ind->Index][ind->Swizzle];
result = LLVMBuildLoad(gallivm->builder, result, "");
result = LLVMBuildAdd(gallivm->builder, result,
  lp_build_const_int32(gallivm, rel_index), "");
@@ -1863,7 +1863,7 @@ static LLVMValueRef fetch_constant(
bufp = load_const_buffer_desc(ctx, buf);
 
if (reg->Register.Indirect) {
-   addr = ctx->soa.addr[ireg->Index][ireg->Swizzle];
+   addr = ctx->addrs[ireg->Index][ireg->Swizzle];
addr = LLVMBuildLoad(base->gallivm->builder, addr, "load addr 
reg");
addr = lp_build_mul_imm(&bld_base->uint_bld, addr, 16);
addr = lp_build_add(&bld_base->uint_bld, addr,
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h 
b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 430c110..1d1349d 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -43,6 +43,7 @@ struct radeon_shader_binary;
 #define RADEON_LLVM_INITIAL_CF_DEPTH 4
 
 #define RADEON_LLVM_MAX_SYSTEM_VALUES 4
+#define RADEON_LLVM_MAX_ADDRS 16
 
 struct si_llvm_flow;
 
@@ -80,6 +81,7 @@ struct si_shader_context {
struct tgsi_full_declaration input_decls[RADEON_LLVM_MAX_INPUT_SLOTS];
LLVMValueRef inputs[RADEON_LLVM_MAX_INPUTS];
LLVMValueRef outputs[RADEON_LLVM_MAX_OUTPUTS][TGSI_NUM_CHANNELS];
+   LLVMValueRef addrs[RADEON_LLVM_MAX_ADDRS][TGSI_NUM_CHANNELS];
 
/** This pointer is used to contain the temporary values.
  * The amount of temporary used in tgsi can't be bound to a max value 
and
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c 
b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index d86b460..12f465e 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -419,16 +419,16 @@ get_array_range(struct lp_build_tgsi_context *bld_base,
 }
 
 static LLVMValueRef
-emit_array_index(struct lp_build_tgsi_soa_context *bld,
+emit_array_index(struct si_shader_context *ctx,
 const struct tgsi_ind_register *reg,
 unsigned offset)
 {
-   struct gallivm_state *gallivm = bld->bld_base.base.gallivm;
+   struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
 
if (!reg) {
return lp_build_const_int32(gallivm, offset);
}
-   LLVMValueRef addr = LLVMBuildLoad(gallivm->builder, 
bld->addr[reg->Index][reg->Swizzle], "");
+   LLVMValueRef addr = LLVMBuildLoad(gallivm->builder, 
ctx->addrs[reg->Index][reg->Swizzle], "");
return LLVMBuildAdd(gallivm->builder, addr, 
lp_build_const_int32(gallivm, offset), "");
 }
 
@@ -470,7 +470,7 @@ get_pointer_into_array(struct si_shader_context *ctx,
if (!(array->writemask & (1 << swizzle)))
return ctx->undef_alloca;
 
-   index = emit_array_index(&ctx->soa, reg_indirect,
+   index = emit_array_index(ctx, reg_indirect,
 reg_index - ctx->temp_arrays[array_id - 
1].range.First);
 
/* Ensure that the index is within a valid range, to guard against
@@ -559,7 +559,6 @@ load_value_from_array(struct lp_build_tgsi_context 
*bld_base,
  const struct tgsi_ind_register *reg_indirect)
 {
struct si_shader_context *ctx = si_shader_context(bld_base);
-   struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base);
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMBuilderRef builder = gallivm->builder;
LLVMValueRef ptr;
@@ -579,7 +578,7 @@ load_value_from_array(struct lp_build_tgsi_context 
*bld_base,
struct tgsi_d

Mesa (master): radeonsi: replace si_shader_context::soa by bld_base

2017-01-13 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: e1ea70d9f3317e09104bb7c9f268ef6de9dfb358
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e1ea70d9f3317e09104bb7c9f268ef6de9dfb358

Author: Samuel Pitoiset 
Date:   Thu Jan 12 12:23:14 2017 +0100

radeonsi: replace si_shader_context::soa by bld_base

We no longer need to use lp_build_tgsi_soa_context.

No regressions founds with full piglit run.

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Nicolai Hähnle 
Reviewed-by: Marek Olšák 

---

 src/gallium/drivers/radeonsi/si_shader.c   | 112 ++---
 src/gallium/drivers/radeonsi/si_shader_internal.h  |   2 +-
 .../drivers/radeonsi/si_shader_tgsi_setup.c|  46 -
 3 files changed, 78 insertions(+), 82 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 097a3f5..d45c0e8 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -176,7 +176,7 @@ static LLVMValueRef unpack_param(struct si_shader_context 
*ctx,
  param);
 
if (LLVMGetTypeKind(LLVMTypeOf(value)) == LLVMFloatTypeKind)
-   value = bitcast(&ctx->soa.bld_base,
+   value = bitcast(&ctx->bld_base,
TGSI_TYPE_UNSIGNED, value);
 
if (rshift)
@@ -251,7 +251,7 @@ get_tcs_out_patch_stride(struct si_shader_context *ctx)
 static LLVMValueRef
 get_tcs_out_patch0_offset(struct si_shader_context *ctx)
 {
-   return lp_build_mul_imm(&ctx->soa.bld_base.uint_bld,
+   return lp_build_mul_imm(&ctx->bld_base.uint_bld,
unpack_param(ctx,
 SI_PARAM_TCS_OUT_OFFSETS,
 0, 16),
@@ -261,7 +261,7 @@ get_tcs_out_patch0_offset(struct si_shader_context *ctx)
 static LLVMValueRef
 get_tcs_out_patch0_patch_data_offset(struct si_shader_context *ctx)
 {
-   return lp_build_mul_imm(&ctx->soa.bld_base.uint_bld,
+   return lp_build_mul_imm(&ctx->bld_base.uint_bld,
unpack_param(ctx,
 SI_PARAM_TCS_OUT_OFFSETS,
 16, 16),
@@ -322,7 +322,7 @@ static void build_indexed_store(struct si_shader_context 
*ctx,
LLVMValueRef base_ptr, LLVMValueRef index,
LLVMValueRef value)
 {
-   struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
+   struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
 
LLVMBuildStore(gallivm->builder, value,
@@ -342,7 +342,7 @@ static LLVMValueRef build_indexed_load(struct 
si_shader_context *ctx,
   LLVMValueRef base_ptr, LLVMValueRef 
index,
   bool uniform)
 {
-   struct lp_build_tgsi_context *bld_base = &ctx->soa.bld_base;
+   struct lp_build_tgsi_context *bld_base = &ctx->bld_base;
struct gallivm_state *gallivm = bld_base->base.gallivm;
LLVMValueRef pointer;
 
@@ -370,8 +370,8 @@ static LLVMValueRef get_instance_index_for_fetch(
unsigned param_start_instance, unsigned divisor)
 {
struct si_shader_context *ctx =
-   si_shader_context(&radeon_bld->soa.bld_base);
-   struct gallivm_state *gallivm = radeon_bld->soa.bld_base.base.gallivm;
+   si_shader_context(&radeon_bld->bld_base);
+   struct gallivm_state *gallivm = radeon_bld->bld_base.base.gallivm;
 
LLVMValueRef result = LLVMGetParam(radeon_bld->main_fn,
   ctx->param_instance_id);
@@ -391,7 +391,7 @@ static void declare_input_vs(
const struct tgsi_full_declaration *decl,
LLVMValueRef out[4])
 {
-   struct lp_build_context *base = &ctx->soa.bld_base.base;
+   struct lp_build_context *base = &ctx->bld_base.base;
struct gallivm_state *gallivm = base->gallivm;
 
unsigned chan;
@@ -508,7 +508,7 @@ static LLVMValueRef get_indirect_index(struct 
si_shader_context *ctx,
   const struct tgsi_ind_register *ind,
   int rel_index)
 {
-   struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
+   struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
LLVMValueRef result;
 
result = ctx->addrs[ind->Index][ind->Swizzle];
@@ -548,7 +548,7 @@ static LLVMValueRef get_dw_address(struct si_shader_context 
*ctx,
   LLVMValueRef vertex_dw_stride,
   LLVMValueRef base_addr)
 {
-   struct gallivm_state *gallivm = ctx->soa.bld_base.base.gallivm;
+   struct gallivm_state *gallivm = ctx->bld_base.base.gallivm;
struct tgsi_shader_info *info = &ctx->shader->selector->info;
ubyte 

Mesa (master): radeonsi: replace ctx->soa.outputs by ctx->outputs

2017-01-13 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: ecf04b84e5d9685d24ab5cfed3025de8c19bddad
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ecf04b84e5d9685d24ab5cfed3025de8c19bddad

Author: Samuel Pitoiset 
Date:   Wed Jan 11 16:28:51 2017 +0100

radeonsi: replace ctx->soa.outputs by ctx->outputs

The plan is to replace si_shader_context::soa with its parent
structure (ie. bld_base).

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Nicolai Hähnle 
Reviewed-by: Marek Olšák 

---

 src/gallium/drivers/radeonsi/si_shader.c   | 20 +++
 .../drivers/radeonsi/si_shader_tgsi_setup.c| 29 +-
 2 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 9e4a22f..097a3f5 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2779,7 +2779,7 @@ static void si_llvm_emit_ls_epilogue(struct 
lp_build_tgsi_context *bld_base)
/* Write outputs to LDS. The next shader (TCS aka HS) will read
 * its inputs from it. */
for (i = 0; i < info->num_outputs; i++) {
-   LLVMValueRef *out_ptr = ctx->soa.outputs[i];
+   LLVMValueRef *out_ptr = ctx->outputs[i];
unsigned name = info->output_semantic_name[i];
unsigned index = info->output_semantic_index[i];
int param = si_shader_io_get_unique_index(name, index);
@@ -2805,8 +2805,7 @@ static void si_llvm_emit_es_epilogue(struct 
lp_build_tgsi_context *bld_base)
int i;
 
for (i = 0; i < info->num_outputs; i++) {
-   LLVMValueRef *out_ptr =
-   ctx->soa.outputs[i];
+   LLVMValueRef *out_ptr = ctx->outputs[i];
int param_index;
 
if (info->output_semantic_name[i] == 
TGSI_SEMANTIC_VIEWPORT_INDEX ||
@@ -2883,7 +2882,7 @@ static void si_llvm_emit_vs_epilogue(struct 
lp_build_tgsi_context *bld_base)
}
 
for (j = 0; j < 4; j++) {
-   addr = ctx->soa.outputs[i][j];
+   addr = ctx->outputs[i][j];
val = LLVMBuildLoad(gallivm->builder, addr, "");
val = si_llvm_saturate(bld_base, val);
LLVMBuildStore(gallivm->builder, val, addr);
@@ -2901,7 +2900,7 @@ static void si_llvm_emit_vs_epilogue(struct 
lp_build_tgsi_context *bld_base)
for (j = 0; j < 4; j++) {
outputs[i].values[j] =
LLVMBuildLoad(gallivm->builder,
- ctx->soa.outputs[i][j],
+ ctx->outputs[i][j],
  "");
outputs[i].vertex_stream[j] =
(info->output_streams[i] >> (2 * j)) & 3;
@@ -3151,22 +3150,22 @@ static void si_llvm_return_fs_outputs(struct 
lp_build_tgsi_context *bld_base)
case TGSI_SEMANTIC_COLOR:
assert(semantic_index < 8);
for (j = 0; j < 4; j++) {
-   LLVMValueRef ptr = ctx->soa.outputs[i][j];
+   LLVMValueRef ptr = ctx->outputs[i][j];
LLVMValueRef result = LLVMBuildLoad(builder, 
ptr, "");
color[semantic_index][j] = result;
}
break;
case TGSI_SEMANTIC_POSITION:
depth = LLVMBuildLoad(builder,
- ctx->soa.outputs[i][2], "");
+ ctx->outputs[i][2], "");
break;
case TGSI_SEMANTIC_STENCIL:
stencil = LLVMBuildLoad(builder,
-   ctx->soa.outputs[i][1], "");
+   ctx->outputs[i][1], "");
break;
case TGSI_SEMANTIC_SAMPLEMASK:
samplemask = LLVMBuildLoad(builder,
-  ctx->soa.outputs[i][0], "");
+  ctx->outputs[i][0], "");
break;
default:
fprintf(stderr, "Warning: SI unhandled fs output 
type:%d\n",
@@ -5314,8 +5313,7 @@ static void si_llvm_emit_vertex(
 
offset = 0;
for (i = 0; i < info->num_outputs; i++) {
-   LLVMValueRef *out_ptr =
-   ctx->soa.outputs[i];
+   LLVMValueRef *out_ptr = ctx->outputs[i];
 
for (chan = 0; chan < 4; chan++) {
if (!(info->output_usagemask[i] & (1 << chan)) ||
diff --git a/src/gallium/driv

Mesa (master): radeonsi: allocate the array of immediates dynamically

2017-01-13 Thread Samuel Pitoiset
Module: Mesa
Branch: master
Commit: 6f0d955b6d5017ad76752555c1a4214c16e92622
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f0d955b6d5017ad76752555c1a4214c16e92622

Author: Samuel Pitoiset 
Date:   Wed Jan 11 14:50:41 2017 +0100

radeonsi: allocate the array of immediates dynamically

Currently, we can store up to 256 immediates in a static array,
but this is not always enough. Instead, allocate a dynamic array
like what we currently do for temps.

This fixes a segfault with
dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.23

No regressions found with full piglit run.

Signed-off-by: Samuel Pitoiset 
Reviewed-by: Nicolai Hähnle 
Reviewed-by: Marek Olšák 

---

 src/gallium/drivers/radeonsi/si_shader.c| 16 
 src/gallium/drivers/radeonsi/si_shader_internal.h   |  3 +++
 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 18 +-
 3 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index c24d82d..61c0eff 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4724,7 +4724,6 @@ static void tex_fetch_args(
/* add tex offsets */
if (inst->Texture.NumOffsets) {
struct lp_build_context *uint_bld = &bld_base->uint_bld;
-   struct lp_build_tgsi_soa_context *bld = 
lp_soa_context(bld_base);
const struct tgsi_texture_offset *off = 
inst->TexOffsets;
 
assert(inst->Texture.NumOffsets == 1);
@@ -4732,7 +4731,7 @@ static void tex_fetch_args(
switch (target) {
case TGSI_TEXTURE_3D:
address[2] = lp_build_add(uint_bld, address[2],
-   
bld->immediates[off->Index][off->SwizzleZ]);
+   ctx->imms[off->Index * 
TGSI_NUM_CHANNELS + off->SwizzleZ]);
/* fall through */
case TGSI_TEXTURE_2D:
case TGSI_TEXTURE_SHADOW2D:
@@ -4742,7 +4741,7 @@ static void tex_fetch_args(
case TGSI_TEXTURE_SHADOW2D_ARRAY:
address[1] =
lp_build_add(uint_bld, address[1],
-   
bld->immediates[off->Index][off->SwizzleY]);
+   ctx->imms[off->Index * 
TGSI_NUM_CHANNELS + off->SwizzleY]);
/* fall through */
case TGSI_TEXTURE_1D:
case TGSI_TEXTURE_SHADOW1D:
@@ -4750,7 +4749,7 @@ static void tex_fetch_args(
case TGSI_TEXTURE_SHADOW1D_ARRAY:
address[0] =
lp_build_add(uint_bld, address[0],
-   
bld->immediates[off->Index][off->SwizzleX]);
+   ctx->imms[off->Index * 
TGSI_NUM_CHANNELS + off->SwizzleX]);
break;
/* texture offsets do not apply to other 
texture targets */
}
@@ -4770,13 +4769,12 @@ static void tex_fetch_args(
 
/* Get the component index from src1.x for Gather4. */
if (!tgsi_is_shadow_target(target)) {
-   LLVMValueRef (*imms)[4] = 
lp_soa_context(bld_base)->immediates;
LLVMValueRef comp_imm;
struct tgsi_src_register src1 = inst->Src[1].Register;
 
assert(src1.File == TGSI_FILE_IMMEDIATE);
 
-   comp_imm = imms[src1.Index][src1.SwizzleX];
+   comp_imm = ctx->imms[src1.Index * TGSI_NUM_CHANNELS + 
src1.SwizzleX];
gather_comp = LLVMConstIntGetZExtValue(comp_imm);
gather_comp = CLAMP(gather_comp, 0, 3);
}
@@ -5250,13 +5248,15 @@ static void build_interp_intrinsic(const struct 
lp_build_tgsi_action *action,
 static unsigned si_llvm_get_stream(struct lp_build_tgsi_context *bld_base,
   struct lp_build_emit_data *emit_data)
 {
-   LLVMValueRef (*imms)[4] = lp_soa_context(bld_base)->immediates;
+   struct si_shader_context *ctx = si_shader_context(bld_base);
struct tgsi_src_register src0 = emit_data->inst->Src[0].Register;
+   LLVMValueRef imm;
unsigned stream;
 
assert(src0.File == TGSI_FILE_IMMEDIATE);
 
-   stream = LLVMConstIntGetZExtValue(imms[src0.Index][src0.SwizzleX]) & 
0x3;
+   imm = ctx->imms[src0.Index * TGSI_NUM_CHANNELS + src0.SwizzleX];
+   stream = LLVMConstIntGetZExtValue(imm) & 0x3;
return stream;
 }
 
diff --git a/src/galli

Mesa (master): mesa/main: fix version/extension checks in _mesa_ClampColor

2017-01-13 Thread Nicolai Hähnle
Module: Mesa
Branch: master
Commit: 963311b71fd9900351a4a9dd1cd5f5db391f7e1b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=963311b71fd9900351a4a9dd1cd5f5db391f7e1b

Author: Nicolai Hähnle 
Date:   Thu Jan 12 10:55:33 2017 +0100

mesa/main: fix version/extension checks in _mesa_ClampColor

Add a proper check for feature support, and raise an invalid enum for
GL_CLAMP_VERTEX/FRAGMENT_COLOR unconditionally in core profiles, since
those enums were explicitly removed after the extension was promoted
to core functionality (not in the profile sense) with OpenGL 3.0.

This matches the behavior of the AMD closed source driver and fixes
GL45-CTS.gtf30.GL3Tests.half_float.half_float_textures.

Cc: "12.0 13.0" 
Reviewed-by: Ilia Mirkin 

---

 src/mesa/main/blend.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 0322799..955fda1 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -861,6 +861,14 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
 {
GET_CURRENT_CONTEXT(ctx);
 
+   /* Check for both the extension and the GL version, since the Intel driver
+* does not advertise the extension in core profiles.
+*/
+   if (ctx->Version <= 30 && !ctx->Extensions.ARB_color_buffer_float) {
+  _mesa_error(ctx, GL_INVALID_OPERATION, "glClampColor()");
+  return;
+   }
+
if (clamp != GL_TRUE && clamp != GL_FALSE && clamp != GL_FIXED_ONLY_ARB) {
   _mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(clamp)");
   return;
@@ -868,19 +876,15 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
 
switch (target) {
case GL_CLAMP_VERTEX_COLOR_ARB:
-  if (ctx->API == API_OPENGL_CORE &&
-  !ctx->Extensions.ARB_color_buffer_float) {
+  if (ctx->API == API_OPENGL_CORE)
  goto invalid_enum;
-  }
   FLUSH_VERTICES(ctx, _NEW_LIGHT);
   ctx->Light.ClampVertexColor = clamp;
   _mesa_update_clamp_vertex_color(ctx, ctx->DrawBuffer);
   break;
case GL_CLAMP_FRAGMENT_COLOR_ARB:
-  if (ctx->API == API_OPENGL_CORE &&
-  !ctx->Extensions.ARB_color_buffer_float) {
+  if (ctx->API == API_OPENGL_CORE)
  goto invalid_enum;
-  }
   FLUSH_VERTICES(ctx, _NEW_FRAG_CLAMP);
   ctx->Color.ClampFragmentColor = clamp;
   _mesa_update_clamp_fragment_color(ctx, ctx->DrawBuffer);

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


Mesa (master): main/fbobject: throw invalid operation when get_attachment fails if needed

2017-01-13 Thread Alejandro Pinheiro
Module: Mesa
Branch: master
Commit: 84e3e12b2582f4707a837ebb960ea7ce19e1c263
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=84e3e12b2582f4707a837ebb960ea7ce19e1c263

Author: Alejandro Piñeiro 
Date:   Thu Jan 12 16:09:17 2017 -0200

main/fbobject: throw invalid operation when get_attachment fails if needed

In most cases, if a call to get_attachment fails is because attachment
is a INVALID_ENUM. But for some specific cases, if COLOR_ATTACHMENTm
(where m >= MAX_COLOR_ATTACHMENTS) is used, it should raise an
INVALID_OPERATION exception instead.

Fixes:
GL45-CTS.direct_state_access.framebuffers_get_attachment_parameter_errors
GL45-CTS.direct_state_access.framebuffers_renderbuffer_attachment_errors

v2: extra new line before quote block. Include "color attachment" on both
new message errors (Nicolai).

Reviewed-by: Nicolai Hähnle 

---

 src/mesa/main/fbobject.c | 49 +---
 1 file changed, 42 insertions(+), 7 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ce5eeae..044bd63 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3495,6 +3495,7 @@ framebuffer_renderbuffer(struct gl_context *ctx,
  const char *func)
 {
struct gl_renderbuffer_attachment *att;
+   bool is_color_attachment;
 
if (_mesa_is_winsys_fbo(fb)) {
   /* Can't attach new renderbuffers to a window system framebuffer */
@@ -3503,11 +3504,29 @@ framebuffer_renderbuffer(struct gl_context *ctx,
   return;
}
 
-   att = get_attachment(ctx, fb, attachment, NULL);
+   att = get_attachment(ctx, fb, attachment, &is_color_attachment);
if (att == NULL) {
-  _mesa_error(ctx, GL_INVALID_ENUM,
-  "%s(invalid attachment %s)", func,
-  _mesa_enum_to_string(attachment));
+  /*
+   * From OpenGL 4.5 spec, section 9.2.7 "Attaching Renderbuffer Images to
+   * a Framebuffer":
+   *
+   *"An INVALID_OPERATION error is generated if attachment is COLOR_-
+   * ATTACHMENTm where m is greater than or equal to the value of
+   * MAX_COLOR_- ATTACHMENTS ."
+   *
+   * If we are at this point, is because the attachment is not valid, so
+   * if is_color_attachment is true, is because of the previous reason.
+   */
+  if (is_color_attachment) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(invalid color attachment %s)", func,
+ _mesa_enum_to_string(attachment));
+  } else {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "%s(invalid attachment %s)", func,
+ _mesa_enum_to_string(attachment));
+  }
+
   return;
}
 
@@ -3609,6 +3628,7 @@ _mesa_get_framebuffer_attachment_parameter(struct 
gl_context *ctx,
GLint *params, const char *caller)
 {
const struct gl_renderbuffer_attachment *att;
+   bool is_color_attachment;
GLenum err;
 
/* The error code for an attachment type of GL_NONE differs between APIs.
@@ -3676,12 +3696,27 @@ _mesa_get_framebuffer_attachment_parameter(struct 
gl_context *ctx,
}
else {
   /* user-created framebuffer FBO */
-  att = get_attachment(ctx, buffer, attachment, NULL);
+  att = get_attachment(ctx, buffer, attachment, &is_color_attachment);
}
 
if (att == NULL) {
-  _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid attachment %s)", caller,
-  _mesa_enum_to_string(attachment));
+  /*
+   * From OpenGL 4.5 spec, section 9.2.3 "Framebuffer Object Queries":
+   *
+   *"An INVALID_OPERATION error is generated if a framebuffer object
+   * is bound to target and attachment is COLOR_ATTACHMENTm where m is
+   * greater than or equal to the value of MAX_COLOR_ATTACHMENTS."
+   *
+   * If we are at this point, is because the attachment is not valid, so
+   * if is_color_attachment is true, is because of the previous reason.
+   */
+  if (is_color_attachment) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid color attachment 
%s)",
+ caller, _mesa_enum_to_string(attachment));
+  } else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid attachment %s)", caller,
+ _mesa_enum_to_string(attachment));
+  }
   return;
}
 

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


Mesa (master): main/fboject: return if it is color_attachment on get_attachment

2017-01-13 Thread Alejandro Pinheiro
Module: Mesa
Branch: master
Commit: c6eb3aeba530fe82087c1c3c06ded23cb79bc199
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6eb3aeba530fe82087c1c3c06ded23cb79bc199

Author: Alejandro Piñeiro 
Date:   Thu Jan 12 16:03:00 2017 -0200

main/fboject: return if it is color_attachment on get_attachment

Some callers would need that info to know if they should raise
INVALID_ENUM or INVALID_OPERATION. An alternative would be the caller
to check if the attachment is a GL_COLOR_ATTACHMENTm, but that seems
redundant as get_attachment is already doing that.

Reviewed-by: Nicolai Hähnle 

---

 src/mesa/main/fbobject.c | 30 +++---
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 26fc15d..ce5eeae 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -222,15 +222,21 @@ get_framebuffer_target(struct gl_context *ctx, GLenum 
target)
  * default / window-system FB object.
  * If \p attachment is GL_DEPTH_STENCIL_ATTACHMENT, return a pointer to
  * the depth buffer attachment point.
+ * Returns if the attachment is a GL_COLOR_ATTACHMENTm_EXT on
+ * is_color_attachment, because several callers would return different errors
+ * if they don't find the attachment.
  */
 static struct gl_renderbuffer_attachment *
 get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
-   GLenum attachment)
+   GLenum attachment, bool *is_color_attachment)
 {
GLuint i;
 
assert(_mesa_is_user_fbo(fb));
 
+   if (is_color_attachment)
+  *is_color_attachment = false;
+
switch (attachment) {
case GL_COLOR_ATTACHMENT0_EXT:
case GL_COLOR_ATTACHMENT1_EXT:
@@ -248,6 +254,8 @@ get_attachment(struct gl_context *ctx, struct 
gl_framebuffer *fb,
case GL_COLOR_ATTACHMENT13_EXT:
case GL_COLOR_ATTACHMENT14_EXT:
case GL_COLOR_ATTACHMENT15_EXT:
+  if (is_color_attachment)
+ *is_color_attachment = true;
   /* Only OpenGL ES 1.x forbids color attachments other than
* GL_COLOR_ATTACHMENT0.  For all other APIs the limit set by the
* hardware is used.
@@ -543,13 +551,13 @@ _mesa_FramebufferRenderbuffer_sw(struct gl_context *ctx,
 
mtx_lock(&fb->Mutex);
 
-   att = get_attachment(ctx, fb, attachment);
+   att = get_attachment(ctx, fb, attachment, NULL);
assert(att);
if (rb) {
   set_renderbuffer_attachment(ctx, att, rb);
   if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
  /* do stencil attachment here (depth already done above) */
- att = get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT);
+ att = get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT, NULL);
  assert(att);
  set_renderbuffer_attachment(ctx, att, rb);
   }
@@ -559,7 +567,7 @@ _mesa_FramebufferRenderbuffer_sw(struct gl_context *ctx,
   remove_attachment(ctx, att);
   if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
  /* detach stencil (depth was detached above) */
- att = get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT);
+ att = get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT, NULL);
  assert(att);
  remove_attachment(ctx, att);
   }
@@ -1219,7 +1227,7 @@ _mesa_test_framebuffer_completeness(struct gl_context 
*ctx,
   for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
  if (fb->ColorDrawBuffer[j] != GL_NONE) {
 const struct gl_renderbuffer_attachment *att
-   = get_attachment(ctx, fb, fb->ColorDrawBuffer[j]);
+   = get_attachment(ctx, fb, fb->ColorDrawBuffer[j], NULL);
 assert(att);
 if (att->Type == GL_NONE) {
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
@@ -1232,7 +1240,7 @@ _mesa_test_framebuffer_completeness(struct gl_context 
*ctx,
   /* Check that the ReadBuffer is present */
   if (fb->ColorReadBuffer != GL_NONE) {
  const struct gl_renderbuffer_attachment *att
-= get_attachment(ctx, fb, fb->ColorReadBuffer);
+= get_attachment(ctx, fb, fb->ColorReadBuffer, NULL);
  assert(att);
  if (att->Type == GL_NONE) {
 fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT;
@@ -3151,7 +3159,7 @@ _mesa_framebuffer_texture(struct gl_context *ctx, struct 
gl_framebuffer *fb,
}
 
/* Not a hash lookup, so we can afford to get the attachment here. */
-   att = get_attachment(ctx, fb, attachment);
+   att = get_attachment(ctx, fb, attachment, NULL);
if (att == NULL) {
   _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid attachment %s)", caller,
   _mesa_enum_to_string(attachment));
@@ -3495,7 +3503,7 @@ framebuffer_renderbuffer(struct gl_context *ctx,
   return;
}
 
-   att = get_attachment(ctx, fb, attachment);
+   att = get_attachment(ctx, fb, attachment, NULL);
if (att == NULL) {
   _mesa_error(ctx, GL_INVALID_ENUM,
   "%s(invalid attachment %s)",

Mesa (master): st/va: flush pipeline after post processing

2017-01-13 Thread Christian König
Module: Mesa
Branch: master
Commit: 9b14a828db76dcc27302059ff5504170540c6e2f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9b14a828db76dcc27302059ff5504170540c6e2f

Author: sguttula 
Date:   Thu Nov 10 00:59:53 2016 -0500

st/va: flush pipeline after post processing

This will flush the pipeline,which will allow to share dma-buf based
buffers.

Signed-off-by: Suresh Guttula 
Reviewed-by: Christian König 

---

 src/gallium/state_trackers/va/postproc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/va/postproc.c 
b/src/gallium/state_trackers/va/postproc.c
index d06f016..01e240f 100644
--- a/src/gallium/state_trackers/va/postproc.c
+++ b/src/gallium/state_trackers/va/postproc.c
@@ -80,6 +80,7 @@ vlVaPostProcCompositor(vlVaDriver *drv, vlVaContext *context,
vl_compositor_set_layer_dst_area(&drv->cstate, 0, &dst_rect);
vl_compositor_render(&drv->cstate, &drv->compositor, surfaces[0], NULL, 
false);
 
+   drv->pipe->flush(drv->pipe, NULL, 0);
return VA_STATUS_SUCCESS;
 }
 

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


Mesa (master): travis: Add the new drivers etnaviv and imx

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: cba808695148cda65be5c8df2d8be76e406369b1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=cba808695148cda65be5c8df2d8be76e406369b1

Author: Rhys Kidd 
Date:   Thu Jan 12 23:06:34 2017 -0500

travis: Add the new drivers etnaviv and imx

Signed-off-by: Rhys Kidd 
Reviewed-by: Christian Gmeiner 
Reviewed-by: Emil Velikov 

---

 .travis.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 3d107aa..dfbc052 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,7 +32,7 @@ env:
 - DRI3PROTO_VERSION=dri3proto-1.0
 - PRESENTPROTO_VERSION=presentproto-1.0
 - LIBPCIACCESS_VERSION=libpciaccess-0.13.4
-- LIBDRM_VERSION=libdrm-2.4.65
+- LIBDRM_VERSION=libdrm-2.4.74
 - XCBPROTO_VERSION=xcb-proto-1.11
 - LIBXCB_VERSION=libxcb-1.11
 - LIBXSHMFENCE_VERSION=libxshmfence-1.2
@@ -92,7 +92,7 @@ install:
 
   - wget http://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.bz2
   - tar -jxvf $LIBDRM_VERSION.tar.bz2
-  - (cd $LIBDRM_VERSION && ./configure --prefix=$HOME/prefix --enable-vc4 && 
make install)
+  - (cd $LIBDRM_VERSION && ./configure --prefix=$HOME/prefix --enable-vc4 
--enable-etnaviv-experimental-api && make install)
 
   - wget $XORG_RELEASES/lib/$LIBXSHMFENCE_VERSION.tar.bz2
   - tar -jxvf $LIBXSHMFENCE_VERSION.tar.bz2
@@ -103,7 +103,7 @@ script:
   ./autogen.sh --enable-debug
 --with-egl-platforms=x11,drm
 --with-dri-drivers=i915,i965,radeon,r200,swrast,nouveau
---with-gallium-drivers=svga,swrast,vc4,virgl,r300,r600
+--with-gallium-drivers=svga,swrast,vc4,virgl,r300,r600,etnaviv,imx
 --disable-llvm-shared-libs
 ;
   make && make check;

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


Mesa (master): gbm/drm: Pick the oldest available buffer in get_back_bo

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 4f1d27a406478d405eac6f9894ccc46a80034adb
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f1d27a406478d405eac6f9894ccc46a80034adb

Author: Derek Foreman 
Date:   Wed Nov 23 16:40:42 2016 -0600

gbm/drm: Pick the oldest available buffer in get_back_bo

Applications may query the back buffer age to efficiently perform
partial updates. Generally the application will keep a fixed length
damage history, and use this to calculate what needs to be redrawn
based on the age of the back buffer it's about to render to.

If presented with a buffer that has an age greater than the
length of the damage history, the application will likely have
to completely repaint the buffer.

Our current buffer selection strategy is to pick the first available
buffer without considering its age.  If an application frequently
manages to fit within two buffers but occasionally requires a third,
this extra buffer will almost always be old enough to fall outside
of a reasonably long damage history, and require a full repaint.

This patch changes the buffer selection behaviour to prefer the oldest
available buffer.

By selecting the oldest available buffer, the application will likely
always be able to use its damage history, at a cost of having to
perform slightly more work every frame.  This is an improvement if
the cost of a full repaint is heavy, and the surface damage between
frames is relatively small.

It should be noted that since we don't currently trim our queue in
any way, an application that briefly needs a large number of buffers
will continue to receive older buffers than it would if it only ever
needed two buffers.

Reviewed-by: Daniel Stone 
Signed-off-by: Derek Foreman 
Reviewed-by: Pekka Paalanen 

---

 src/egl/drivers/dri2/platform_drm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index 2099314..f812ab5 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -215,13 +215,15 @@ get_back_bo(struct dri2_egl_surface *dri2_surf)
struct dri2_egl_display *dri2_dpy =
   dri2_egl_display(dri2_surf->base.Resource.Display);
struct gbm_dri_surface *surf = dri2_surf->gbm_surf;
+   int age = 0;
unsigned i;
 
if (dri2_surf->back == NULL) {
   for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
-if (!dri2_surf->color_buffers[i].locked) {
+if (!dri2_surf->color_buffers[i].locked &&
+ dri2_surf->color_buffers[i].age >= age) {
dri2_surf->back = &dri2_surf->color_buffers[i];
-   break;
+   age = dri2_surf->color_buffers[i].age;
 }
   }
}

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


Mesa (master): egl/wayland: Avoid race conditions when on non-main thread

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 36b9976e1f99e8070c67cb8a255793939db77d02
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=36b9976e1f99e8070c67cb8a255793939db77d02

Author: Jonas Ådahl 
Date:   Fri Jan 13 23:05:10 2017 +0800

egl/wayland: Avoid race conditions when on non-main thread

When EGL is used on some other thread than the thread that drives the
main wl_display queue, the Wayland EGL dri2 implementation is
vulnerable to a race condition related to display round trips and global
object advertisements.

The race that may happen is that after after a proxy is created, but
before the queue is set, events meant to be emitted via the yet to be
set queue may already have been queued on the wrong queue.

In order to make it possible to avoid this race, wayland 1.11
introduced new API that allows creating a proxy wrapper that may be used
as the factory proxy when creating new proxies via Wayland requests. The
queue of a proxy wrapper can be changed without effecting what queue
events emitted by the actual proxy will be queued on, while still
effecting what default queue proxies created from it will have.

By introducing a wl_display proxy wrapper and using this when performing
round trips (via wl_display_sync()) and retrieving the global objects (via
wl_display_get_registry()), the mentioned race condition is avoided.

Signed-off-by: Jonas Ådahl 
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Daniel Stone 

---

 configure.ac|  2 +-
 src/egl/drivers/dri2/egl_dri2.c |  1 +
 src/egl/drivers/dri2/egl_dri2.h |  1 +
 src/egl/drivers/dri2/platform_wayland.c | 37 -
 4 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/configure.ac b/configure.ac
index bc92fb5..459f3e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,7 +84,7 @@ GLPROTO_REQUIRED=1.4.14
 LIBOMXIL_BELLAGIO_REQUIRED=0.0
 LIBVA_REQUIRED=0.38.0
 VDPAU_REQUIRED=1.1
-WAYLAND_REQUIRED=1.2.0
+WAYLAND_REQUIRED=1.11
 XCB_REQUIRED=1.9.3
 XCBDRI2_REQUIRED=1.8
 XCBGLX_REQUIRED=1.8.1
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 52fbdff..cf72a7e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -914,6 +914,7 @@ dri2_display_release(_EGLDisplay *disp)
   wl_shm_destroy(dri2_dpy->wl_shm);
   wl_registry_destroy(dri2_dpy->wl_registry);
   wl_event_queue_destroy(dri2_dpy->wl_queue);
+  wl_proxy_wrapper_destroy(dri2_dpy->wl_dpy_wrapper);
   if (dri2_dpy->own_device) {
  wl_display_disconnect(dri2_dpy->wl_dpy);
   }
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index eac58f3..f3437e2 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -208,6 +208,7 @@ struct dri2_egl_display
 
 #ifdef HAVE_WAYLAND_PLATFORM
struct wl_display*wl_dpy;
+   struct wl_display*wl_dpy_wrapper;
struct wl_registry   *wl_registry;
struct wl_drm*wl_server_drm;
struct wl_drm*wl_drm;
diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 2b50d8e..17ff684 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -74,9 +74,8 @@ roundtrip(struct dri2_egl_display *dri2_dpy)
struct wl_callback *callback;
int done = 0, ret = 0;
 
-   callback = wl_display_sync(dri2_dpy->wl_dpy);
+   callback = wl_display_sync(dri2_dpy->wl_dpy_wrapper);
wl_callback_add_listener(callback, &sync_listener, &done);
-   wl_proxy_set_queue((struct wl_proxy *) callback, dri2_dpy->wl_queue);
while (ret != -1 && !done)
   ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
 
@@ -780,11 +779,9 @@ dri2_wl_swap_buffers_with_damage(_EGLDriver *drv,
 * handle the commit and send a release event before checking for a free
 * buffer */
if (dri2_surf->throttle_callback == NULL) {
-  dri2_surf->throttle_callback = wl_display_sync(dri2_dpy->wl_dpy);
+  dri2_surf->throttle_callback = wl_display_sync(dri2_dpy->wl_dpy_wrapper);
   wl_callback_add_listener(dri2_surf->throttle_callback,
&throttle_listener, dri2_surf);
-  wl_proxy_set_queue((struct wl_proxy *) dri2_surf->throttle_callback,
- dri2_dpy->wl_queue);
}
 
wl_display_flush(dri2_dpy->wl_dpy);
@@ -1159,12 +1156,17 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, 
_EGLDisplay *disp)
 
dri2_dpy->wl_queue = wl_display_create_queue(dri2_dpy->wl_dpy);
 
+   dri2_dpy->wl_dpy_wrapper = wl_proxy_create_wrapper(dri2_dpy->wl_dpy);
+   if (dri2_dpy->wl_dpy_wrapper == NULL)
+  goto cleanup_dpy_wrapper;
+
+   wl_proxy_set_queue((struct wl_proxy *) dri2_dpy->wl_dpy_wrapper,
+  dri2_dpy->wl_queue);
+
if (dri2_dpy->own_device)
   wl_display_dispatch_pending(dri2_dpy->wl_dpy);
 
-   dri2_dpy->wl_registry = wl_display

Mesa (master): i915: Add XRGB8888 format to intel_screen_make_configs

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 3698d7112484baef90c0d3599d5705db561a37c1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3698d7112484baef90c0d3599d5705db561a37c1

Author: Derek Foreman 
Date:   Wed Nov 23 17:01:43 2016 -0600

i915: Add XRGB format to intel_screen_make_configs

This is a copy of commit 536003c11e4cb1172c540932ce3cce06f03bf44e
except for i915.

Original log for the i965 commit follows:

 Some application, such as drm backend of weston, uses XRGB config as
 default. i965 doesn't provide this format, but before commit 65c8965d,
 the drm platform of EGL takes ARGB as XRGB. Now that commit
 65c8965d makes EGL recognize format correctly so weston won't start
 because it can't find XRGB. Add XRGB format to i965 just as
 other drivers do.

Signed-off-by: Derek Foreman 
Acked-by: Boyan Ding 
Tested-by: Mark Janes 

---

 src/mesa/drivers/dri/i915/intel_screen.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
b/src/mesa/drivers/dri/i915/intel_screen.c
index 1b80df0..5c7c06a 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -1044,7 +1044,8 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
 {
static const mesa_format formats[] = {
   MESA_FORMAT_B5G6R5_UNORM,
-  MESA_FORMAT_B8G8R8A8_UNORM
+  MESA_FORMAT_B8G8R8A8_UNORM,
+  MESA_FORMAT_B8G8R8X8_UNORM
};
 
/* GLX_SWAP_COPY_OML is not supported due to page flipping. */

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


Mesa (master): egl/wayland: Cleanup private display connection when init fails

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 361796651c5abb21ff429466c061119dce8f33d5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=361796651c5abb21ff429466c061119dce8f33d5

Author: Jonas Ådahl 
Date:   Fri Jan 13 23:05:09 2017 +0800

egl/wayland: Cleanup private display connection when init fails

When failing to initializing the Wayland EGL driver, don't leak the
display server connection if it was us who created it.

Signed-off-by: Jonas Ådahl 
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Emil Velikov 
Reviewed-by: Daniel Stone 

---

 src/egl/drivers/dri2/platform_wayland.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index fd4812a..2b50d8e 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1283,6 +1283,8 @@ dri2_initialize_wayland_drm(_EGLDriver *drv, _EGLDisplay 
*disp)
  cleanup_registry:
wl_registry_destroy(dri2_dpy->wl_registry);
wl_event_queue_destroy(dri2_dpy->wl_queue);
+   if (disp->PlatformDisplay == NULL)
+  wl_display_disconnect(dri2_dpy->wl_dpy);
  cleanup_dpy:
free(dri2_dpy);
disp->DriverData = NULL;
@@ -1921,6 +1923,8 @@ dri2_initialize_wayland_swrast(_EGLDriver *drv, 
_EGLDisplay *disp)
  cleanup_registry:
wl_registry_destroy(dri2_dpy->wl_registry);
wl_event_queue_destroy(dri2_dpy->wl_queue);
+   if (disp->PlatformDisplay == NULL)
+  wl_display_disconnect(dri2_dpy->wl_dpy);
  cleanup_dpy:
free(dri2_dpy);
disp->DriverData = NULL;

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


Mesa (master): radeon: Unify the style of function pointer calls in structs

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 2d05425d3e00a74da54730e4fa7230662dca2b48
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d05425d3e00a74da54730e4fa7230662dca2b48

Author: Boyan Ding 
Date:   Wed Nov 25 13:27:07 2015 +0800

radeon: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding 
[Emil Velikov: handle the all cases]
Signed-off-by: Emil Velikov 

---

 src/mesa/drivers/dri/radeon/radeon_common.c|  8 
 .../drivers/dri/radeon/radeon_common_context.c | 24 +++---
 src/mesa/drivers/dri/radeon/radeon_queryobj.c  |  2 +-
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c 
b/src/mesa/drivers/dri/radeon/radeon_common.c
index fde8921..ee4d5f8 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -426,7 +426,7 @@ static void radeon_print_state_atom(radeonContextPtr 
radeon, struct radeon_state
if (!radeon_is_debug_enabled(RADEON_STATE, RADEON_VERBOSE) )
return;
 
-   dwords = (*state->check) (&radeon->glCtx, state);
+   dwords = state->check(&radeon->glCtx, state);
 
fprintf(stderr, "  emit %s %d/%d\n", state->name, dwords, 
state->cmd_size);
 
@@ -491,13 +491,13 @@ static inline void radeon_emit_atom(radeonContextPtr 
radeon, struct radeon_state
BATCH_LOCALS(radeon);
int dwords;
 
-   dwords = (*atom->check) (&radeon->glCtx, atom);
+   dwords = atom->check(&radeon->glCtx, atom);
if (dwords) {
 
radeon_print_state_atom(radeon, atom);
 
if (atom->emit) {
-   (*atom->emit)(&radeon->glCtx, atom);
+   atom->emit(&radeon->glCtx, atom);
} else {
BEGIN_BATCH(dwords);
OUT_BATCH_TABLE(atom->cmd, dwords);
@@ -591,7 +591,7 @@ flush_front:
 */
radeon->front_buffer_dirty = GL_FALSE;
 
-   (*screen->dri2.loader->flushFrontBuffer)(drawable, 
drawable->loaderPrivate);
+   screen->dri2.loader->flushFrontBuffer(drawable, 
drawable->loaderPrivate);
}
}
 }
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c 
b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 4660d98..d981ca2 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -418,12 +418,12 @@ radeon_update_renderbuffers(__DRIcontext *context, 
__DRIdrawable *drawable,
}
}
 
-   buffers = (*screen->dri2.loader->getBuffersWithFormat)(drawable,
-   &drawable->w,
-   &drawable->h,
-   attachments, i 
/ 2,
-   &count,
-   
drawable->loaderPrivate);
+   buffers = screen->dri2.loader->getBuffersWithFormat(drawable,
+   
&drawable->w,
+   
&drawable->h,
+   
attachments, i / 2,
+   &count,
+   
drawable->loaderPrivate);
} else if (screen->dri2.loader) {
i = 0;
if (draw->color_rb[0])
@@ -437,12 +437,12 @@ radeon_update_renderbuffers(__DRIcontext *context, 
__DRIdrawable *drawable,
attachments[i++] = __DRI_BUFFER_STENCIL;
}
 
-   buffers = (*screen->dri2.loader->getBuffers)(drawable,
-&drawable->w,
-&drawable->h,
-attachments, i,
-&count,
-
drawable->loaderPrivate);
+   buffers = screen->dri2.loader->getBuffers(drawable,
+ &drawable->w,
+ &drawable->h,
+ attachments, i,
+ &count,
+ 
drawable->loaderPrivate);
}
 
if (buffers == NULL)
diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c 
b/src/mesa/driv

Mesa (master): xlib: Unify the style of function pointer calls in structs

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: dc18ec8b24e206c60de681a505bf66ae74e37742
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc18ec8b24e206c60de681a505bf66ae74e37742

Author: Boyan Ding 
Date:   Wed Nov 25 13:43:06 2015 +0800

xlib: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding 
[Emil Velikov: handle the final case in glXCreateContextAttribsARB]
Signed-off-by: Emil Velikov 

---

 src/mesa/drivers/x11/glxapi.c | 148 +-
 1 file changed, 74 insertions(+), 74 deletions(-)

diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c
index cc1bb2a..07c1d84 100644
--- a/src/mesa/drivers/x11/glxapi.c
+++ b/src/mesa/drivers/x11/glxapi.c
@@ -159,7 +159,7 @@ glXChooseVisual(Display *dpy, int screen, int *list)
GET_DISPATCH(dpy, t);
if (!t)
   return NULL;
-   return (t->ChooseVisual)(dpy, screen, list);
+   return t->ChooseVisual(dpy, screen, list);
 }
 
 
@@ -170,7 +170,7 @@ glXCopyContext(Display *dpy, GLXContext src, GLXContext 
dst, unsigned long mask)
GET_DISPATCH(dpy, t);
if (!t)
   return;
-   (t->CopyContext)(dpy, src, dst, mask);
+   t->CopyContext(dpy, src, dst, mask);
 }
 
 
@@ -181,7 +181,7 @@ glXCreateContext(Display *dpy, XVisualInfo *visinfo, 
GLXContext shareList, Bool
GET_DISPATCH(dpy, t);
if (!t)
   return 0;
-   return (t->CreateContext)(dpy, visinfo, shareList, direct);
+   return t->CreateContext(dpy, visinfo, shareList, direct);
 }
 
 
@@ -192,7 +192,7 @@ glXCreateGLXPixmap(Display *dpy, XVisualInfo *visinfo, 
Pixmap pixmap)
GET_DISPATCH(dpy, t);
if (!t)
   return 0;
-   return (t->CreateGLXPixmap)(dpy, visinfo, pixmap);
+   return t->CreateGLXPixmap(dpy, visinfo, pixmap);
 }
 
 
@@ -203,7 +203,7 @@ glXDestroyContext(Display *dpy, GLXContext ctx)
GET_DISPATCH(dpy, t);
if (!t)
   return;
-   (t->DestroyContext)(dpy, ctx);
+   t->DestroyContext(dpy, ctx);
 }
 
 
@@ -214,7 +214,7 @@ glXDestroyGLXPixmap(Display *dpy, GLXPixmap pixmap)
GET_DISPATCH(dpy, t);
if (!t)
   return;
-   (t->DestroyGLXPixmap)(dpy, pixmap);
+   t->DestroyGLXPixmap(dpy, pixmap);
 }
 
 
@@ -225,7 +225,7 @@ glXGetConfig(Display *dpy, XVisualInfo *visinfo, int 
attrib, int *value)
GET_DISPATCH(dpy, t);
if (!t)
   return GLX_NO_EXTENSION;
-   return (t->GetConfig)(dpy, visinfo, attrib, value);
+   return t->GetConfig(dpy, visinfo, attrib, value);
 }
 
 
@@ -254,7 +254,7 @@ glXIsDirect(Display *dpy, GLXContext ctx)
GET_DISPATCH(dpy, t);
if (!t)
   return False;
-   return (t->IsDirect)(dpy, ctx);
+   return t->IsDirect(dpy, ctx);
 }
 
 
@@ -267,7 +267,7 @@ glXMakeCurrent(Display *dpy, GLXDrawable drawable, 
GLXContext ctx)
if (!t) {
   return False;
}
-   b = (*t->MakeCurrent)(dpy, drawable, ctx);
+   b = t->MakeCurrent(dpy, drawable, ctx);
return b;
 }
 
@@ -279,7 +279,7 @@ glXQueryExtension(Display *dpy, int *errorb, int *event)
GET_DISPATCH(dpy, t);
if (!t)
   return False;
-   return (t->QueryExtension)(dpy, errorb, event);
+   return t->QueryExtension(dpy, errorb, event);
 }
 
 
@@ -290,7 +290,7 @@ glXQueryVersion(Display *dpy, int *maj, int *min)
GET_DISPATCH(dpy, t);
if (!t)
   return False;
-   return (t->QueryVersion)(dpy, maj, min);
+   return t->QueryVersion(dpy, maj, min);
 }
 
 
@@ -301,7 +301,7 @@ glXSwapBuffers(Display *dpy, GLXDrawable drawable)
GET_DISPATCH(dpy, t);
if (!t)
   return;
-   (t->SwapBuffers)(dpy, drawable);
+   t->SwapBuffers(dpy, drawable);
 }
 
 
@@ -313,7 +313,7 @@ glXUseXFont(Font font, int first, int count, int listBase)
GET_DISPATCH(dpy, t);
if (!t)
   return;
-   (t->UseXFont)(font, first, count, listBase);
+   t->UseXFont(font, first, count, listBase);
 }
 
 
@@ -325,7 +325,7 @@ glXWaitGL(void)
GET_DISPATCH(dpy, t);
if (!t)
   return;
-   (t->WaitGL)();
+   t->WaitGL();
 }
 
 
@@ -337,7 +337,7 @@ glXWaitX(void)
GET_DISPATCH(dpy, t);
if (!t)
   return;
-   (t->WaitX)();
+   t->WaitX();
 }
 
 
@@ -351,7 +351,7 @@ glXGetClientString(Display *dpy, int name)
GET_DISPATCH(dpy, t);
if (!t)
   return NULL;
-   return (t->GetClientString)(dpy, name);
+   return t->GetClientString(dpy, name);
 }
 
 
@@ -362,7 +362,7 @@ glXQueryExtensionsString(Display *dpy, int screen)
GET_DISPATCH(dpy, t);
if (!t)
   return NULL;
-   return (t->QueryExtensionsString)(dpy, screen);
+   return t->QueryExtensionsString(dpy, screen);
 }
 
 
@@ -373,7 +373,7 @@ glXQueryServerString(Display *dpy, int screen, int name)
GET_DISPATCH(dpy, t);
if (!t)
   return NULL;
-   return (t->QueryServerString)(dpy, screen, name);
+   return t->QueryServerString(dpy, screen, name);
 }
 
 
@@ -399,7 +399,7 @@ glXChooseFBConfig(Display *dpy, int screen, const int 
*attribList, int *nitems)
GET_DISPATCH(dpy, t);
if (!t)
   return 0;
-   return (t->ChooseFBConfig)(dpy, screen, attribList, nitems);
+   return t->Choose

Mesa (master): nouveau: Unify the style of function pointer calls in structs

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 056cfa558c280fe3833756d6a6f265b516da1b7b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=056cfa558c280fe3833756d6a6f265b516da1b7b

Author: Boyan Ding 
Date:   Wed Nov 25 13:27:06 2015 +0800

nouveau: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding 

---

 src/mesa/drivers/dri/nouveau/nouveau_context.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index cb854b8..6ddcadc 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -259,9 +259,9 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, 
__DRIdrawable *draw)
else if (fb->Visual.haveStencilBuffer)
attachments[i++] = __DRI_BUFFER_STENCIL;
 
-   buffers = (*screen->dri2.loader->getBuffers)(draw, &draw->w, &draw->h,
-attachments, i, &count,
-draw->loaderPrivate);
+   buffers = screen->dri2.loader->getBuffers(draw, &draw->w, &draw->h,
+ attachments, i, &count,
+ draw->loaderPrivate);
if (buffers == NULL)
return;
 

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


Mesa (master): loader/dri3: Unify the style of function pointer calls in structs

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 1411fbd50dbd654755dd53cd087b86fffbd2c9ed
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1411fbd50dbd654755dd53cd087b86fffbd2c9ed

Author: Boyan Ding 
Date:   Wed Nov 25 13:27:04 2015 +0800

loader/dri3: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding 

---

 src/loader/loader_dri3_helper.c | 78 -
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index ca02e97..6e5d1b8 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -95,9 +95,9 @@ dri3_free_render_buffer(struct loader_dri3_drawable *draw,
   xcb_free_pixmap(draw->conn, buffer->pixmap);
xcb_sync_destroy_fence(draw->conn, buffer->sync_fence);
xshmfence_unmap_shm(buffer->shm_fence);
-   (draw->ext->image->destroyImage)(buffer->image);
+   draw->ext->image->destroyImage(buffer->image);
if (buffer->linear_buffer)
-  (draw->ext->image->destroyImage)(buffer->linear_buffer);
+  draw->ext->image->destroyImage(buffer->linear_buffer);
free(buffer);
 }
 
@@ -106,7 +106,7 @@ loader_dri3_drawable_fini(struct loader_dri3_drawable *draw)
 {
int i;
 
-   (draw->ext->core->destroyDrawable)(draw->dri_drawable);
+   draw->ext->core->destroyDrawable(draw->dri_drawable);
 
for (i = 0; i < LOADER_DRI3_NUM_BUFFERS; i++) {
   if (draw->buffers[i])
@@ -171,9 +171,9 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
 
/* Create a new drawable */
draw->dri_drawable =
-  (draw->ext->image_driver->createNewDrawable)(dri_screen,
-   dri_config,
-   draw);
+  draw->ext->image_driver->createNewDrawable(dri_screen,
+ dri_config,
+ draw);
 
if (!draw->dri_drawable)
   return 1;
@@ -740,7 +740,7 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable 
*draw,
  ++(*draw->stamp);
}
 
-   (draw->ext->flush->invalidate)(draw->dri_drawable);
+   draw->ext->flush->invalidate(draw->dri_drawable);
 
return ret;
 }
@@ -856,34 +856,34 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
*draw, unsigned int format,
   goto no_image;
 
if (!draw->is_different_gpu) {
-  buffer->image = (draw->ext->image->createImage)(draw->dri_screen,
-  width, height,
-  format,
-  __DRI_IMAGE_USE_SHARE |
-  __DRI_IMAGE_USE_SCANOUT |
-  
__DRI_IMAGE_USE_BACKBUFFER,
-  buffer);
+  buffer->image = draw->ext->image->createImage(draw->dri_screen,
+width, height,
+format,
+__DRI_IMAGE_USE_SHARE |
+__DRI_IMAGE_USE_SCANOUT |
+__DRI_IMAGE_USE_BACKBUFFER,
+buffer);
   pixmap_buffer = buffer->image;
 
   if (!buffer->image)
  goto no_image;
} else {
-  buffer->image = (draw->ext->image->createImage)(draw->dri_screen,
-  width, height,
-  format,
-  0,
-  buffer);
+  buffer->image = draw->ext->image->createImage(draw->dri_screen,
+width, height,
+format,
+0,
+buffer);
 
   if (!buffer->image)
  goto no_image;
 
   buffer->linear_buffer =
-(draw->ext->image->createImage)(draw->dri_screen,
-width, height, format,
-__DRI_IMAGE_USE_SHARE |
-__DRI_IMAGE_USE_LINEAR |
-__DRI_IMAGE_USE_BACKBUFFER,
-buffer);
+draw->ext->image->createImage(draw->dri_screen,
+  width, height, format,
+  __DRI_IMAGE_USE_SHARE |
+  __DRI_IMAGE_USE_LINEAR |
+  __DRI_IMAGE_USE_BACKBUFFER,
+

Mesa (master): glX_proto_send.py: Unify the style of function pointer calls in structs

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 0ee4c4a732af29a31ab27c3f847bcf20db6b09c3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ee4c4a732af29a31ab27c3f847bcf20db6b09c3

Author: Boyan Ding 
Date:   Wed Nov 25 13:27:05 2015 +0800

glX_proto_send.py: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding 

---

 src/mapi/glapi/gen/glX_proto_send.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/glX_proto_send.py 
b/src/mapi/glapi/gen/glX_proto_send.py
index 26e7ab6..b534cd4 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -573,7 +573,7 @@ generic_%u_byte( GLint rop, const void * ptr )
 condition = 'compsize > 0'
 
 print 'if (%s) {' % (condition)
-print '(*gc->fillImage)(gc, %s, %s, %s, %s, %s, %s, 
%s, %s, %s);' % (dim_str, width, height, depth, param.img_format, 
param.img_type, param.name, pcPtr, pixHeaderPtr)
+print 'gc->fillImage(gc, %s, %s, %s, %s, %s, %s, %s, 
%s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, 
param.name, pcPtr, pixHeaderPtr)
 print '} else {'
 print '(void) memcpy( %s, default_pixel_store_%uD, 
default_pixel_store_%uD_size );' % (pixHeaderPtr, dim, dim)
 print '}'

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


Mesa (master): egl/dri2: Unify the style of function pointer calls in structs

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: 868ae3e31b0e479b299188d0047c88f0d260c6ec
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=868ae3e31b0e479b299188d0047c88f0d260c6ec

Author: Boyan Ding 
Date:   Wed Nov 25 13:27:02 2015 +0800

egl/dri2: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding 
Acked-by: Alex Deucher 
[Emil Velikov: address platform_surfaceless]
Signed-off-by: Emil Velikov 

---

 src/egl/drivers/dri2/egl_dri2.c | 11 +--
 src/egl/drivers/dri2/platform_android.c |  8 
 src/egl/drivers/dri2/platform_drm.c | 14 +++---
 src/egl/drivers/dri2/platform_surfaceless.c |  6 +++---
 src/egl/drivers/dri2/platform_wayland.c | 14 +++---
 src/egl/drivers/dri2/platform_x11.c | 16 
 6 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index cf72a7e..63e29fc 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1549,9 +1549,9 @@ dri2_bind_tex_image(_EGLDriver *drv,
   assert(!"Unexpected texture target in dri2_bind_tex_image()");
}
 
-   (*dri2_dpy->tex_buffer->setTexBuffer2)(dri2_ctx->dri_context,
-  target, format,
-  dri_drawable);
+   dri2_dpy->tex_buffer->setTexBuffer2(dri2_ctx->dri_context,
+   target, format,
+   dri_drawable);
 
return EGL_TRUE;
 }
@@ -1582,9 +1582,8 @@ dri2_release_tex_image(_EGLDriver *drv,
 
if (dri2_dpy->tex_buffer->base.version >= 3 &&
dri2_dpy->tex_buffer->releaseTexBuffer != NULL) {
-  (*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context,
-target,
-dri_drawable);
+  dri2_dpy->tex_buffer->releaseTexBuffer(dri2_ctx->dri_context,
+ target, dri_drawable);
}
 
return EGL_TRUE;
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 1c880f9..36bd119 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -339,8 +339,8 @@ droid_create_surface(_EGLDriver *drv, _EGLDisplay *disp, 
EGLint type,
   goto cleanup_surface;
 
dri2_surf->dri_drawable =
-  (*dri2_dpy->dri2->createNewDrawable)(dri2_dpy->dri_screen, config,
-   dri2_surf);
+  dri2_dpy->dri2->createNewDrawable(dri2_dpy->dri_screen, config,
+dri2_surf);
if (dri2_surf->dri_drawable == NULL) {
   _eglError(EGL_BAD_ALLOC, "dri2->createNewDrawable");
   goto cleanup_surface;
@@ -403,7 +403,7 @@ droid_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *surf)
   dri2_surf->dri_image_front = NULL;
}
 
-   (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable);
+   dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
 
free(dri2_surf);
 
@@ -593,7 +593,7 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
if (dri2_surf->buffer)
   droid_window_enqueue_buffer(disp, dri2_surf);
 
-   (*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
+   dri2_dpy->flush->invalidate(dri2_surf->dri_drawable);
 
return EGL_TRUE;
 }
diff --git a/src/egl/drivers/dri2/platform_drm.c 
b/src/egl/drivers/dri2/platform_drm.c
index f812ab5..e5e8c60 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -136,15 +136,15 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay 
*disp, EGLint type,
 
if (dri2_dpy->dri2) {
   dri2_surf->dri_drawable =
- (*dri2_dpy->dri2->createNewDrawable)(dri2_dpy->dri_screen, config,
-  dri2_surf->gbm_surf);
+ dri2_dpy->dri2->createNewDrawable(dri2_dpy->dri_screen, config,
+   dri2_surf->gbm_surf);
 
} else {
   assert(dri2_dpy->swrast != NULL);
 
   dri2_surf->dri_drawable =
- (*dri2_dpy->swrast->createNewDrawable)(dri2_dpy->dri_screen, config,
-dri2_surf->gbm_surf);
+ dri2_dpy->swrast->createNewDrawable(dri2_dpy->dri_screen, config,
+ dri2_surf->gbm_surf);
 
}
if (dri2_surf->dri_drawable == NULL) {
@@ -191,7 +191,7 @@ dri2_drm_destroy_surface(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLSurface *surf)
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
unsigned i;
 
-   (*dri2_dpy->core->destroyDrawable)(dri2_surf->dri_drawable);
+   dri2_dpy->core->destroyDrawable(dri2_surf->dri_drawable);
 
for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++) {
   if (dri2_surf->color_buffers[i].bo)
@@ -416,7 +416,7 @@ d

Mesa (master): mesa/get: Remove unused extra_ARB_viewport_array

2017-01-13 Thread Emil Velikov
Module: Mesa
Branch: master
Commit: ddd27ef462c8a67982cd04a7d46851aad699c75c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ddd27ef462c8a67982cd04a7d46851aad699c75c

Author: Boyan Ding 
Date:   Mon Jan  9 22:48:38 2017 +0800

mesa/get: Remove unused extra_ARB_viewport_array

Unused since 0a7691ee (mesa: Enable enums for OES_viewport_array).
Silence a warning of unused variable.

Signed-off-by: Boyan Ding 
Reviewed-by: Emil Velikov 

---

 src/mesa/main/get.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 10b40d4..f0bb041 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -482,7 +482,6 @@ EXTRA_EXT(ARB_texture_gather);
 EXTRA_EXT(ARB_shader_atomic_counters);
 EXTRA_EXT(ARB_draw_indirect);
 EXTRA_EXT(ARB_shader_image_load_store);
-EXTRA_EXT(ARB_viewport_array);
 EXTRA_EXT(ARB_query_buffer_object);
 EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5);
 EXTRA_EXT(INTEL_performance_query);

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


Mesa (master): radv: Support loader interface version 3.

2017-01-13 Thread Bas Nieuwenhuizen
Module: Mesa
Branch: master
Commit: 6d2fb04f0922047232d10b2a5d292d68c9506f45
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d2fb04f0922047232d10b2a5d292d68c9506f45

Author: Bas Nieuwenhuizen 
Date:   Fri Jan 13 08:55:59 2017 +0100

radv: Support loader interface version 3.

Port of 1e41d7f7b0855934744fe578ba4eae9209ee69f7:
"anv: Support loader interface version 3 (patch v2)"

Signed-off-by: Bas Nieuwenhuizen 
Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Emil Velikov 

---

 src/amd/vulkan/radv_device.c | 45 
 1 file changed, 45 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 05d..64fbce8 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -2032,3 +2032,48 @@ void radv_DestroySampler(
return;
vk_free2(&device->alloc, pAllocator, sampler);
 }
+
+
+/* vk_icd.h does not declare this function, so we declare it here to
+ * suppress Wmissing-prototypes.
+ */
+PUBLIC VKAPI_ATTR VkResult VKAPI_CALL
+vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion);
+
+PUBLIC VKAPI_ATTR VkResult VKAPI_CALL
+vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t *pSupportedVersion)
+{
+   /* For the full details on loader interface versioning, see
+   * 
.
+   * What follows is a condensed summary, to help you navigate the large 
and
+   * confusing official doc.
+   *
+   *   - Loader interface v0 is incompatible with later versions. We don't
+   * support it.
+   *
+   *   - In loader interface v1:
+   *   - The first ICD entrypoint called by the loader is
+   * vk_icdGetInstanceProcAddr(). The ICD must statically expose 
this
+   * entrypoint.
+   *   - The ICD must statically expose no other Vulkan symbol unless 
it is
+   * linked with -Bsymbolic.
+   *   - Each dispatchable Vulkan handle created by the ICD must be
+   * a pointer to a struct whose first member is VK_LOADER_DATA. 
The
+   * ICD must initialize VK_LOADER_DATA.loadMagic to 
ICD_LOADER_MAGIC.
+   *   - The loader implements vkCreate{PLATFORM}SurfaceKHR() and
+   * vkDestroySurfaceKHR(). The ICD must be capable of working with
+   * such loader-managed surfaces.
+   *
+   *- Loader interface v2 differs from v1 in:
+   *   - The first ICD entrypoint called by the loader is
+   * vk_icdNegotiateLoaderICDInterfaceVersion(). The ICD must
+   * statically expose this entrypoint.
+   *
+   *- Loader interface v3 differs from v2 in:
+   *- The ICD must implement vkCreate{PLATFORM}SurfaceKHR(),
+   *  vkDestroySurfaceKHR(), and other API which uses VKSurfaceKHR,
+   *  because the loader no longer does so.
+   */
+   *pSupportedVersion = MIN2(*pSupportedVersion, 3u);
+   return VK_SUCCESS;
+}

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


Mesa (master): i965: Fix textureGather with RG32I/UI on Gen7.

2017-01-13 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 99c019e1d41eb72c5ca9e0ae4b263acd6e6c214f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=99c019e1d41eb72c5ca9e0ae4b263acd6e6c214f

Author: Kenneth Graunke 
Date:   Thu Jan  5 02:51:38 2017 -0800

i965: Fix textureGather with RG32I/UI on Gen7.

According to the "Gather4 R32G32_FLOAT Bug" internal documentation
page, the R32G32_UINT and R32G32_SINT formats are affected by the
same bug as R32G32_FLOAT.  Applying the same workarounds should be
viable - apparently the R32G32_FLOAT_LD format shouldn't corrupt
integer data which is NaN or other sketchy floating point values.

One irritating caveat is that, because it's a FLOAT format, the
alpha channel or any set to SCS_ONE return 0x3f8 (1.0) rather than
integer 1.  So we need shader code to whack those channels to 1.

Fixes GL45-CTS.texture_gather.plain-gather-int-cube-rg on Haswell.

v2: Fix swizzle component zeroing (caught by Jordan Justen).

Signed-off-by: Kenneth Graunke 
Reviewed-by: Jordan Justen 

---

 src/mesa/drivers/dri/i965/brw_wm.c   | 41 
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |  4 ++-
 2 files changed, 37 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm.c 
b/src/mesa/drivers/dri/i965/brw_wm.c
index 56b60b8..bd2b24a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -347,13 +347,40 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
key->gl_clamp_mask[2] |= 1 << s;
  }
 
- /* gather4's channel select for green from RG32F is broken; requires
-  * a shader w/a on IVB; fixable with just SCS on HSW.
-  */
- if (brw->gen == 7 && !brw->is_haswell &&
- prog->nir->info->uses_texture_gather) {
-if (img->InternalFormat == GL_RG32F)
-   key->gather_channel_quirk_mask |= 1 << s;
+ /* gather4 for RG32* is broken in multiple ways on Gen7. */
+ if (brw->gen == 7 && prog->nir->info->uses_texture_gather) {
+switch (img->InternalFormat) {
+case GL_RG32I:
+case GL_RG32UI: {
+   /* We have to override the format to R32G32_FLOAT_LD.
+* This means that SCS_ALPHA and SCS_ONE will return 0x3f8
+* (1.0) rather than integer 1.  This needs shader hacks.
+*
+* On Ivybridge, we whack W (alpha) to ONE in our key's
+* swizzle.  On Haswell, we look at the original texture
+* swizzle, and use XYZW with channels overridden to ONE,
+* leaving normal texture swizzling to SCS.
+*/
+   unsigned src_swizzle =
+  brw->is_haswell ? t->_Swizzle : key->swizzles[s];
+   for (int i = 0; i < 4; i++) {
+  unsigned src_comp = GET_SWZ(src_swizzle, i);
+  if (src_comp == SWIZZLE_ONE || src_comp == SWIZZLE_W) {
+ key->swizzles[i] &= ~(0x7 << (3 * i));
+ key->swizzles[i] |= SWIZZLE_ONE << (3 * i);
+  }
+   }
+   /* fallthrough */
+}
+case GL_RG32F:
+   /* The channel select for green doesn't work - we have to
+* request blue.  Haswell can use SCS for this, but Ivybridge
+* needs a shader workaround.
+*/
+   if (!brw->is_haswell)
+  key->gather_channel_quirk_mask |= 1 << s;
+   break;
+}
  }
 
  /* Gen6's gather4 is broken for UINT/SINT; we treat them as
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 4566696..02aea78 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -565,7 +565,9 @@ brw_update_texture_surface(struct gl_context *ctx,
   /* Implement gen6 and gen7 gather work-around */
   bool need_green_to_blue = false;
   if (for_gather) {
- if (brw->gen == 7 && format == BRW_SURFACEFORMAT_R32G32_FLOAT) {
+ if (brw->gen == 7 && (format == BRW_SURFACEFORMAT_R32G32_FLOAT ||
+   format == BRW_SURFACEFORMAT_R32G32_SINT ||
+   format == BRW_SURFACEFORMAT_R32G32_UINT)) {
 format = BRW_SURFACEFORMAT_R32G32_FLOAT_LD;
 need_green_to_blue = brw->is_haswell;
  } else if (brw->gen == 6) {

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


Mesa (master): anv: Move nir_lower_wpos_center after dead variable elimination.

2017-01-13 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: fed4afc5bba9455e857407e10a4dce79ca8dfe2d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fed4afc5bba9455e857407e10a4dce79ca8dfe2d

Author: Kenneth Graunke 
Date:   Wed Jan 11 15:10:48 2017 -0800

anv: Move nir_lower_wpos_center after dead variable elimination.

When multiple shader stages exist in the same SPIR-V module, we compile
all entry points and their inputs/outputs, then dead code eliminate the
ones not related to the specific entry point later.

nir_lower_wpos_center was being run prior to eliminating those random
other variables, which made it trip up, thinking it found gl_FragCoord
when it actually found something else like gl_PerVertex[3].

Fixes dEQP-VK.spirv_assembly.instruction.graphics.module.same_module.

Signed-off-by: Kenneth Graunke 
Reviewed-by: Timothy Arceri 
Reviewed-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_pipeline.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 6c939b0..7d939eb 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -139,9 +139,6 @@ anv_shader_compile_to_nir(struct anv_device *device,
 
free(spec_entries);
 
-   if (stage == MESA_SHADER_FRAGMENT)
-  NIR_PASS_V(nir, nir_lower_wpos_center);
-
/* We have to lower away local constant initializers right before we
 * inline functions.  That way they get properly initialized at the top
 * of the function and not at the top of its caller.
@@ -161,6 +158,9 @@ anv_shader_compile_to_nir(struct anv_device *device,
NIR_PASS_V(nir, nir_remove_dead_variables,
   nir_var_shader_in | nir_var_shader_out | nir_var_system_value);
 
+   if (stage == MESA_SHADER_FRAGMENT)
+  NIR_PASS_V(nir, nir_lower_wpos_center);
+
/* Now that we've deleted all but the main function, we can go ahead and
 * lower the rest of the constant initializers.
 */

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


Mesa (master): i965/vec4: Fix mapping attributes

2017-01-13 Thread Jordan Justen
Module: Mesa
Branch: master
Commit: 56ee2df4bf9b1e8c26cf8689f5ef20237c95466b
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=56ee2df4bf9b1e8c26cf8689f5ef20237c95466b

Author: Juan A. Suarez Romero 
Date:   Fri Jan 13 17:47:57 2017 +0100

i965/vec4: Fix mapping attributes

This patch reverts 57bab6708f2bbc1ab8a3d202e9a467963596d462, which was
causing issues with ILK and earlier VS programs.

1. brw_nir.c: Revert "i965/vec4/nir: vec4 also needs to remap vs attributes"

   Do not perform a remap in vec4 backend. Rather, do it later when
   setup attributes

2. brw_vec4.cpp: This fixes mapping ATTRx to proper GRFn.

Suggested-by: Kenneth Graunke 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99391
[jordan.l.jus...@intel.com: merge Juan's two patches from bugzilla]
Signed-off-by: Jordan Justen 
Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/i965/brw_nir.c| 32 ++--
 src/mesa/drivers/dri/i965/brw_vec4.cpp |  2 +-
 2 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_nir.c 
b/src/mesa/drivers/dri/i965/brw_nir.c
index b39e2b1..3c1bc51 100644
--- a/src/mesa/drivers/dri/i965/brw_nir.c
+++ b/src/mesa/drivers/dri/i965/brw_nir.c
@@ -95,19 +95,9 @@ add_const_offset_to_base(nir_shader *nir, nir_variable_mode 
mode)
}
 }
 
-struct remap_vs_attrs_params {
-   shader_info *nir_info;
-   bool is_scalar;
-};
-
 static bool
-remap_vs_attrs(nir_block *block, void *closure)
+remap_vs_attrs(nir_block *block, shader_info *nir_info)
 {
-   struct remap_vs_attrs_params *params =
-  (struct remap_vs_attrs_params *) closure;
-   shader_info *nir_info = params->nir_info;
-   bool is_scalar = params->is_scalar;
-
nir_foreach_instr(instr, block) {
   if (instr->type != nir_instr_type_intrinsic)
  continue;
@@ -123,7 +113,7 @@ remap_vs_attrs(nir_block *block, void *closure)
  int attr = intrin->const_index[0];
  int slot = _mesa_bitcount_64(nir_info->inputs_read &
   BITFIELD64_MASK(attr));
- intrin->const_index[0] = is_scalar ? 4 * slot : slot;
+ intrin->const_index[0] = 4 * slot;
   }
}
return true;
@@ -267,11 +257,6 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
 bool use_legacy_snorm_formula,
 const uint8_t *vs_attrib_wa_flags)
 {
-   struct remap_vs_attrs_params params = {
-  .nir_info = nir->info,
-  .is_scalar = is_scalar
-   };
-
/* Start with the location of the variable's base. */
foreach_list_typed(nir_variable, var, node, &nir->inputs) {
   var->data.driver_location = var->data.location;
@@ -291,11 +276,14 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
brw_nir_apply_attribute_workarounds(nir, use_legacy_snorm_formula,
vs_attrib_wa_flags);
 
-   /* Finally, translate VERT_ATTRIB_* values into the actual registers. */
-   nir_foreach_function(function, nir) {
-  if (function->impl) {
- nir_foreach_block(block, function->impl) {
-remap_vs_attrs(block, ¶ms);
+   if (is_scalar) {
+  /* Finally, translate VERT_ATTRIB_* values into the actual registers. */
+
+  nir_foreach_function(function, nir) {
+ if (function->impl) {
+nir_foreach_block(block, function->impl) {
+   remap_vs_attrs(block, nir->info);
+}
  }
   }
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp 
b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 748a068..5e60eb6 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1739,7 +1739,7 @@ vec4_vs_visitor::setup_attributes(int payload_reg)
   int needed_slots =
  (vs_prog_data->double_inputs_read & BITFIELD64_BIT(first)) ? 2 : 1;
   for (int c = 0; c < needed_slots; c++) {
- attribute_map[nr_attributes] = payload_reg + nr_attributes;
+ attribute_map[first + c] = payload_reg + nr_attributes;
  nr_attributes++;
  vs_inputs &= ~BITFIELD64_BIT(first + c);
   }

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


Mesa (master): anv: Default PointSize to 1.0 if not written by the shader

2017-01-13 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 3b804819650cc943fcd4cccedd140e4b27fbf993
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b804819650cc943fcd4cccedd140e4b27fbf993

Author: Jason Ekstrand 
Date:   Fri Jan 13 09:30:13 2017 -0800

anv: Default PointSize to 1.0 if not written by the shader

The Vulkan rules for point size are a bit whacky.  If you only have a
vertex shader and you use points, then you must write PointSize in your
vertex shader.  If you have a geometry or tessellation shader, then it's
dependent on the shaderTessellationAndGeometryPointSize device feature.
From the Vulkan 1.0.38 specification:

   "shaderTessellationAndGeometryPointSize indicates whether the
   PointSize built-in decoration is available in the tessellation
   control, tessellation evaluation, and geometry shader stages. If this
   feature is not enabled, members decorated with the PointSize built-in
   decoration must not be read from or written to and all points written
   from a tessellation or geometry shader will have a size of 1.0. This
   also indicates whether shader modules can declare the
   TessellationPointSize capability for tessellation control and
   evaluation shaders, or if the shader modules can declare the
   GeometryPointSize capability for geometry shaders. An implementation
   supporting this feature must also support one or both of the
   tessellationShader or geometryShader features."

In other words, if the feature is disbled (the client can disable
features!) then they don't write PointSize and we provide a 1.0 default
but if the feature is enabled, they do write PointSize and we use the
one they wrote in the shader.  There are at least two valid ways we can
implement this:

 1) Track whether or not shaderTessellationAndGeometryPointSize is
enabled and set the 3DSTATE_SF bits based on that and what stages
are enabled, ignoring the shader source.

 2) Just look at the last geometry stage VUE map and see if they wrote
PointSize and set the 3DSTATE_SF accordingly.

The second solution is the easiest and the most robust against invalid
usage of the Vulkan API, so we choose to go with that one.

This fixes all of the dEQP-VK.tessellation.primitive_discard.*point_mode
tests.  The tests are also broken because they unconditionally enable
shaderTessellationAndGeometryPointSize if it's supported by the
implementation and then don't write PointSize in the evaluation shader.
However, since this is the "robust against invalid API usage" solution,
the tests happily pass. :-)

Reviewed-by: Kenneth Graunke 

---

 src/intel/vulkan/genX_pipeline.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 7fa68c0..a537a40 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -420,8 +420,16 @@ emit_rs_state(struct anv_pipeline *pipeline,
sf.TriangleStripListProvokingVertexSelect = 0;
sf.LineStripListProvokingVertexSelect = 0;
sf.TriangleFanProvokingVertexSelect = 1;
-   sf.PointWidthSource = Vertex;
-   sf.PointWidth = 1.0;
+
+   const struct brw_vue_prog_data *last_vue_prog_data =
+  anv_pipeline_get_last_vue_prog_data(pipeline);
+
+   if (last_vue_prog_data->vue_map.slots_valid & VARYING_BIT_PSIZ) {
+  sf.PointWidthSource = Vertex;
+   } else {
+  sf.PointWidthSource = State;
+  sf.PointWidth = 1.0;
+   }
 
 #if GEN_GEN >= 8
struct GENX(3DSTATE_RASTER) raster = {

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


Mesa (master): anv/pipeline: Replace get_fs_input_map with get_last_vue_prog_data

2017-01-13 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 99d497c5b6912c5a8b2fec48084e3e00c7c80395
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=99d497c5b6912c5a8b2fec48084e3e00c7c80395

Author: Jason Ekstrand 
Date:   Thu Jan 12 17:07:08 2017 -0800

anv/pipeline: Replace get_fs_input_map with get_last_vue_prog_data

This lets us delete a helper from genX_pipeline.c

Reviewed-by: Lionel Landwerlin 

---

 src/intel/vulkan/anv_pipeline.c  |  2 +-
 src/intel/vulkan/anv_private.h   | 10 +-
 src/intel/vulkan/genX_pipeline.c | 20 
 3 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 7d939eb..2060c6d 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -270,7 +270,7 @@ populate_wm_prog_key(const struct anv_pipeline *pipeline,
/* TODO: we could set this to 0 based on the information in nir_shader, but
 * this function is called before spirv_to_nir. */
const struct brw_vue_map *vue_map =
-  anv_pipeline_get_fs_input_map(pipeline);
+  &anv_pipeline_get_last_vue_prog_data(pipeline)->vue_map;
key->input_slots_valid = vue_map->slots_valid;
 
/* Vulkan doesn't specify a default */
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 2342fcb..a3b0af7 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1498,15 +1498,15 @@ ANV_DECL_GET_PROG_DATA_FUNC(gs, MESA_SHADER_GEOMETRY)
 ANV_DECL_GET_PROG_DATA_FUNC(wm, MESA_SHADER_FRAGMENT)
 ANV_DECL_GET_PROG_DATA_FUNC(cs, MESA_SHADER_COMPUTE)
 
-static inline const struct brw_vue_map *
-anv_pipeline_get_fs_input_map(const struct anv_pipeline *pipeline)
+static inline const struct brw_vue_prog_data *
+anv_pipeline_get_last_vue_prog_data(const struct anv_pipeline *pipeline)
 {
if (anv_pipeline_has_stage(pipeline, MESA_SHADER_GEOMETRY))
-  return &get_gs_prog_data(pipeline)->base.vue_map;
+  return &get_gs_prog_data(pipeline)->base;
else if (anv_pipeline_has_stage(pipeline, MESA_SHADER_TESS_EVAL))
-  return &get_tes_prog_data(pipeline)->base.vue_map;
+  return &get_tes_prog_data(pipeline)->base;
else
-  return &get_vs_prog_data(pipeline)->base.vue_map;
+  return &get_vs_prog_data(pipeline)->base;
 }
 
 VkResult
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index b58aac4..7fa68c0 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -286,7 +286,6 @@ static void
 emit_3dstate_sbe(struct anv_pipeline *pipeline)
 {
const struct brw_wm_prog_data *wm_prog_data = get_wm_prog_data(pipeline);
-   const struct brw_vue_map *fs_input_map;
 
if (!anv_pipeline_has_stage(pipeline, MESA_SHADER_FRAGMENT)) {
   anv_batch_emit(&pipeline->batch, GENX(3DSTATE_SBE), sbe);
@@ -296,7 +295,8 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline)
   return;
}
 
-   fs_input_map = anv_pipeline_get_fs_input_map(pipeline);
+   const struct brw_vue_map *fs_input_map =
+  &anv_pipeline_get_last_vue_prog_data(pipeline)->vue_map;
 
struct GENX(3DSTATE_SBE) sbe = {
   GENX(3DSTATE_SBE_header),
@@ -846,19 +846,6 @@ emit_cb_state(struct anv_pipeline *pipeline,
}
 }
 
-/**
- * Get the brw_vue_prog_data for the last stage which outputs VUEs.
- */
-static inline struct brw_vue_prog_data *
-get_last_vue_prog_data(struct anv_pipeline *pipeline)
-{
-   for (int s = MESA_SHADER_GEOMETRY; s >= 0; s--) {
-  if (pipeline->shaders[s])
- return (struct brw_vue_prog_data *) pipeline->shaders[s]->prog_data;
-   }
-   return NULL;
-}
-
 static void
 emit_3dstate_clip(struct anv_pipeline *pipeline,
   const VkPipelineViewportStateCreateInfo *vp_info,
@@ -886,7 +873,8 @@ emit_3dstate_clip(struct anv_pipeline *pipeline,
   clip.FrontWinding= vk_to_gen_front_face[rs_info->frontFace];
   clip.CullMode= vk_to_gen_cullmode[rs_info->cullMode];
   clip.ViewportZClipTestEnable = !pipeline->depth_clamp_enable;
-  const struct brw_vue_prog_data *last = get_last_vue_prog_data(pipeline);
+  const struct brw_vue_prog_data *last =
+ anv_pipeline_get_last_vue_prog_data(pipeline);
   if (last) {
  clip.UserClipDistanceClipTestEnableBitmask = last->clip_distance_mask;
  clip.UserClipDistanceCullTestEnableBitmask = last->cull_distance_mask;

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


Mesa (master): anv: remove some unused macros and functions

2017-01-13 Thread Jason Ekstrand
Module: Mesa
Branch: master
Commit: 40a8f9e6f2d048e0fd32f9a974cc0ca58ad1335e
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=40a8f9e6f2d048e0fd32f9a974cc0ca58ad1335e

Author: Grazvydas Ignotas 
Date:   Sat Jan 14 01:10:08 2017 +0200

anv: remove some unused macros and functions

VK_ICD_WSI_PLATFORM_MAX is used, but a duplicate from wsi_common.h .

Acked-by: Jason Ekstrand 

---

 src/intel/vulkan/anv_private.h | 15 ---
 src/intel/vulkan/anv_util.c| 19 ---
 2 files changed, 34 deletions(-)

diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index a3b0af7..17b7236 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -95,9 +95,7 @@ extern "C" {
 #define MAX_PUSH_CONSTANTS_SIZE 128
 #define MAX_DYNAMIC_BUFFERS 16
 #define MAX_IMAGES 8
-#define MAX_SAMPLES_LOG2 4 /* SKL supports 16 samples */
 
-#define anv_noreturn __attribute__((__noreturn__))
 #define anv_printflike(a, b) __attribute__((__format__(__printf__, a, b)))
 
 static inline uint32_t
@@ -243,9 +241,6 @@ void anv_loge_v(const char *format, va_list va);
 #define anv_validate if (0)
 #endif
 
-void anv_abortf(const char *format, ...) anv_noreturn anv_printflike(1, 2);
-void anv_abortfv(const char *format, va_list va) anv_noreturn;
-
 #define stub_return(v) \
do { \
   anv_finishme("stub %s", __func__); \
@@ -495,8 +490,6 @@ struct anv_bo *anv_scratch_pool_alloc(struct anv_device 
*device,
 
 extern struct anv_dispatch_table dtable;
 
-#define VK_ICD_WSI_PLATFORM_MAX 5
-
 struct anv_physical_device {
 VK_LOADER_DATA  _loader_data;
 
@@ -1893,14 +1886,6 @@ ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_render_pass, 
VkRenderPass)
 ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_sampler, VkSampler)
 ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_shader_module, VkShaderModule)
 
-#define ANV_DEFINE_STRUCT_CASTS(__anv_type, __VkType) \
-   \
-   static inline const __VkType * \
-   __anv_type ## _to_ ## __VkType(const struct __anv_type *__anv_obj) \
-   { \
-  return (const __VkType *) __anv_obj; \
-   }
-
 /* Gen-specific function declarations */
 #ifdef genX
 #  include "anv_genX.h"
diff --git a/src/intel/vulkan/anv_util.c b/src/intel/vulkan/anv_util.c
index 2972cd2..6408ac8 100644
--- a/src/intel/vulkan/anv_util.c
+++ b/src/intel/vulkan/anv_util.c
@@ -63,25 +63,6 @@ __anv_finishme(const char *file, int line, const char 
*format, ...)
fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer);
 }
 
-void anv_noreturn anv_printflike(1, 2)
-anv_abortf(const char *format, ...)
-{
-   va_list va;
-
-   va_start(va, format);
-   anv_abortfv(format, va);
-   va_end(va);
-}
-
-void anv_noreturn
-anv_abortfv(const char *format, va_list va)
-{
-   fprintf(stderr, "vk: error: ");
-   vfprintf(stderr, format, va);
-   fprintf(stderr, "\n");
-   abort();
-}
-
 VkResult
 __vk_errorf(VkResult error, const char *file, int line, const char *format, 
...)
 {

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


Mesa (master): i965: Move Gen4-5 interpolation stuff to brw_wm_prog_data.

2017-01-13 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 0d5071db5e50629a63490639a3c86dfc65bf27ab
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d5071db5e50629a63490639a3c86dfc65bf27ab

Author: Kenneth Graunke 
Date:   Fri Jan 13 14:29:52 2017 -0800

i965: Move Gen4-5 interpolation stuff to brw_wm_prog_data.

This fixes glxgears rendering, which had surprisingly been broken since
late October!  Specifically, commit 91d61fbf7cb61a44adcaae51ee08ad0dd6b.

glxgears uses glShadeModel(GL_FLAT) when drawing the main portion of the
gears, then uses glShadeModel(GL_SMOOTH) for drawing the Gouraud-shaded
inner portion of the gears.  This results in the same fragment program
having two different state-dependent interpolation maps: one where
gl_Color is flat, and another where it's smooth.

The problem is that there's only one gen4_fragment_program, so it can't
store both.  Each FS compile would trash the last one.  But, the FS
compiles are cached, so the first one would store FLAT, and the second
would see a matching program in the cache and never bother to compile
one with SMOOTH.  (Clearing the program cache on every draw made it
render correctly.)

Instead, move it to brw_wm_prog_data, where we can keep a copy for
every specialization of the program.  The only downside is bloating
the structure a bit, but we can tighten that up a bit if we need to.
This also lets us kill gen4_fragment_program entirely!

Signed-off-by: Kenneth Graunke 
Reviewed-by: Timothy Arceri 

---

 src/mesa/drivers/dri/i965/brw_clip.c  | 19 +++---
 src/mesa/drivers/dri/i965/brw_clip.h  |  2 +-
 src/mesa/drivers/dri/i965/brw_compiler.h  | 10 +++-
 src/mesa/drivers/dri/i965/brw_context.h   | 14 ---
 src/mesa/drivers/dri/i965/brw_fs.cpp  |  9 ++-
 src/mesa/drivers/dri/i965/brw_interpolation_map.c | 30 +++
 src/mesa/drivers/dri/i965/brw_nir.c   |  8 +-
 src/mesa/drivers/dri/i965/brw_nir.h   |  3 +--
 src/mesa/drivers/dri/i965/brw_program.c   |  9 +--
 src/mesa/drivers/dri/i965/brw_sf.c| 16 ++--
 src/mesa/drivers/dri/i965/brw_sf.h|  2 +-
 11 files changed, 52 insertions(+), 70 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_clip.c 
b/src/mesa/drivers/dri/i965/brw_clip.c
index 8560dd4..e375674 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -139,7 +139,7 @@ brw_upload_clip_prog(struct brw_context *brw)
 _NEW_POLYGON |
 _NEW_TRANSFORM,
 BRW_NEW_BLORP |
-BRW_NEW_FRAGMENT_PROGRAM |
+BRW_NEW_FS_PROG_DATA |
 BRW_NEW_REDUCED_PRIMITIVE |
 BRW_NEW_VUE_MAP_GEOM_OUT))
   return;
@@ -149,15 +149,14 @@ brw_upload_clip_prog(struct brw_context *brw)
/* Populate the key:
 */
 
-   const struct gl_program *fprog = brw->fragment_program;
-   if (fprog) {
-  assert(brw->gen < 6);
-  struct gen4_fragment_program *p = (struct gen4_fragment_program *) fprog;
-
-  /* BRW_NEW_FRAGMENT_PROGRAM */
-  key.contains_flat_varying = p->contains_flat_varying;
-  key.contains_noperspective_varying = p->contains_noperspective_varying;
-  key.interp_mode = p->interp_mode;
+   /* BRW_NEW_FS_PROG_DATA */
+   const struct brw_wm_prog_data *wm_prog_data =
+  brw_wm_prog_data(brw->wm.base.prog_data);
+   if (wm_prog_data) {
+  key.contains_flat_varying = wm_prog_data->contains_flat_varying;
+  key.contains_noperspective_varying =
+ wm_prog_data->contains_noperspective_varying;
+  key.interp_mode = wm_prog_data->interp_mode;
}
 
/* BRW_NEW_REDUCED_PRIMITIVE */
diff --git a/src/mesa/drivers/dri/i965/brw_clip.h 
b/src/mesa/drivers/dri/i965/brw_clip.h
index 355ae64..a8ee394 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.h
+++ b/src/mesa/drivers/dri/i965/brw_clip.h
@@ -49,7 +49,7 @@ struct brw_clip_prog_key {
GLbitfield64 attrs;
bool contains_flat_varying;
bool contains_noperspective_varying;
-   unsigned char *interp_mode;
+   const unsigned char *interp_mode;
GLuint primitive:4;
GLuint nr_userclip:4;
GLuint pv_first:1;
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h 
b/src/mesa/drivers/dri/i965/brw_compiler.h
index c378e93..3b3b7e0 100644
--- a/src/mesa/drivers/dri/i965/brw_compiler.h
+++ b/src/mesa/drivers/dri/i965/brw_compiler.h
@@ -412,6 +412,9 @@ struct brw_wm_prog_data {
bool has_side_effects;
bool pulls_bary;
 
+   bool contains_flat_varying;
+   bool contains_noperspective_varying;
+
/**
 * Mask of which interpolation modes are required by the fragment shader.
 * Used in hardware setup on gen6+.
@@ -424,6 +427,11 @@ struct brw_wm_prog_data {
 */
uint32_t flat_inputs;
 
+   /* Mapping of VUE slots to interpolation modes.
+* Used by the Gen4-5 clip/sf/wm stages.
+*/
+