[Mesa-dev] [Bug 90397] ARB_program_interface_query: glGetProgramResourceiv() returns wrong value for GL_REFERENCED_BY_*_SHADER prop for GL_UNIFORM for members of an interface block with an instance na

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

Bug ID: 90397
   Summary: ARB_program_interface_query: glGetProgramResourceiv()
returns wrong value for GL_REFERENCED_BY_*_SHADER prop
for GL_UNIFORM for members of an interface block with
an instance name
   Product: Mesa
   Version: git
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: sigles...@igalia.com
QA Contact: mesa-dev@lists.freedesktop.org
CC: lem...@gmail.com

I was doing some testing of GL_BUFFER_VARIABLE  parameter in
glGetProgramResourceiv() checking different property queries, because I need
that support for testing my GL_ARB_shader_storage_buffer_object work.

I realized that queries for GL_REFERENCED_BY_*_SHADER
(GL_REFERENCED_BY_VERTEX_SHADER, GL_REFERENCED_BY_FRAGMENT_SHADER...) are not
returning the proper value when the variable is a member of an interface block
with an instance name. This is happening to GL_UNIFORM in current master
branch.

For example: using the following vertex shader,
glGetProgramResourceiv(GL_REFERENCED_BY_VERTEX_SHADER) query for GL_UNIFORM's
"ubo_std140.s[0].b[0]" should return 1 but it returns 0. ATI proprietary driver
returns 1.

#version 330
#extension GL_ARB_uniform_buffer_object : require

struct B {mat2 b[3]; float c;};
layout(row_major, std140) uniform ubo_std140 {
vec4 v;
B s[2];
} a_std140;

in vec4 piglit_vertex;

void main() {
gl_Position = piglit_vertex;
mat2 a = a_std140.s[0].b[0];
gl_Position.x = a[0][0];
}

Tested on Mesa master: abf3fefa1aa734844e0ca8e95e8c3a501909aa33

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


Re: [Mesa-dev] [PATCH] nir: fix sampler lowering pass for arrays

2015-05-11 Thread Tapani Pälli



On 05/08/2015 10:35 PM, Jason Ekstrand wrote:

Over-all, I think this is on the right track, but I still don't think
it's 100% correct.

On Fri, May 8, 2015 at 12:04 AM, Tapani Pälli  wrote:



On 05/08/2015 09:56 AM, Pohjolainen, Topi wrote:


On Fri, May 08, 2015 at 09:51:54AM +0300, Tapani P?lli wrote:


This fixes bugs with special cases where we have arrays of
structures containing samplers or arrays of samplers.

I've verified that patch results in calculating same index value as
returned by _mesa_get_sampler_uniform_value for IR. Patch makes
following ES3 conformance test pass:

 ES3-CTS.shaders.struct.uniform.sampler_array_fragment

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90114
---
   src/glsl/nir/nir_lower_samplers.cpp | 6 +-
   1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/glsl/nir/nir_lower_samplers.cpp
b/src/glsl/nir/nir_lower_samplers.cpp
index cf8ab83..9859cc0 100644
--- a/src/glsl/nir/nir_lower_samplers.cpp
+++ b/src/glsl/nir/nir_lower_samplers.cpp
@@ -78,7 +78,11 @@ lower_sampler(nir_tex_instr *instr, const struct
gl_shader_program *shader_progr
instr->sampler_index *= glsl_get_length(deref->type);


We really should get rid of the multiply since the sampler index is
zero up until the end and the multiply does nothing but confuse
people.


Yes, makes sense.


switch (deref_array->deref_array_type) {
case nir_deref_array_type_direct:
-instr->sampler_index += deref_array->base_offset;
+
+/* If this is an array of samplers. */



Above the case is for arrays and below you check for the sampler. This
comment does not tell much extra :)



Yeah, not sure how to change it. What I want to state here is that only for
arrays of samplers we need to do this, otherwise we don't. The only other
case really is array of structs that contain sampler so maybe I should state
that instead?




+if (deref->child->type->base_type == GLSL_TYPE_SAMPLER)
+   instr->sampler_index += deref_array->base_offset;
+
   if (deref_array->deref.child)
  ralloc_asprintf_append(&name, "[%u]",
deref_array->base_offset);


The two conditionals above should be combined.  If the deref has a
child, it should not have type SAMPLER and vice-versa.  A better way
to do it would be

if (deref_array->deref.child) {
ralloc_asprintf_append(&name, "[%u]", deref_array->base_offset);
} else {
assert(deref->child->type->bbase_type == GLSL_TYPE_SAMPLER);
instr->sampler_index = deref_array->base_offset;
}

Also, it may be better to do that outside of the switch and turn the
switch into an "if (deref_array->deref_array_type ==
deref_array_type_indirect)" to handle indirects.  Right now, I don't
think that we correctly handle an indirect with a base offset other
than 0.

Does that make sense?


Fair enough, I'll modify it this way. I'll try to add some more 
documentation too to make it more clear.



--Jason


   break;
--
2.1.0

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


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

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


[Mesa-dev] [Bug 90397] ARB_program_interface_query: glGetProgramResourceiv() returns wrong value for GL_REFERENCED_BY_*_SHADER prop for GL_UNIFORM for members of an interface block with an instance na

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

Tapani Pälli  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|mesa-dev@lists.freedesktop. |lem...@gmail.com
   |org |

--- Comment #1 from Tapani Pälli  ---
Yep, the problem is that their stage reference bitmask is empty. This is a
debug print of active resources for your shader. They are considered active but
not referenced. Will have to see how to tackle this.

--- 8< ---

PROGRAM RESOURCE LIST
IN   piglit_vertex [x___]
OUT  gl_Position [x___]
UNI  ubo_std140.v []
UNI  ubo_std140.s[0].b []
UNI  ubo_std140.s[0].c []
UNI  ubo_std140.s[1].b []
UNI  ubo_std140.s[1].c []
UBO  ubo_std140 []

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


[Mesa-dev] [Bug 90397] ARB_program_interface_query: glGetProgramResourceiv() returns wrong value for GL_REFERENCED_BY_*_SHADER prop for GL_UNIFORM for members of an interface block with an instance na

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

--- Comment #2 from Tapani Pälli  ---
Created attachment 115690
  --> https://bugs.freedesktop.org/attachment.cgi?id=115690&action=edit
patch to fix the issue

Does this fix the issue for you?

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


[Mesa-dev] [Bug 90397] ARB_program_interface_query: glGetProgramResourceiv() returns wrong value for GL_REFERENCED_BY_*_SHADER prop for GL_UNIFORM for members of an interface block with an instance na

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

--- Comment #3 from Samuel Iglesias  ---
(In reply to Tapani Pälli from comment #2)
> Created attachment 115690 [details] [review]
> patch to fix the issue
> 
> Does this fix the issue for you?

Yes, it does :-D

Thanks!

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


[Mesa-dev] [PATCH] glsl: add stage references for UBO uniforms

2015-05-11 Thread Tapani Pälli
Patch marks uniforms inside UBO properly referenced by stages.

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90397
---
 src/glsl/linker.cpp | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index ea73c6f..ecdc025 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2700,6 +2700,16 @@ build_program_resource_list(struct gl_context *ctx,
 
   uint8_t stageref =
  build_stageref(shProg, shProg->UniformStorage[i].name);
+
+  /* Add stagereferences for uniforms in a uniform block. */
+  int block_index = shProg->UniformStorage[i].block_index;
+  if (block_index != -1) {
+ for (unsigned j = 0; j < MESA_SHADER_STAGES; j++) {
+ if (shProg->UniformBlockStageIndex[j][block_index] != -1)
+stageref |= (1 << j);
+ }
+  }
+
   if (!add_program_resource(shProg, GL_UNIFORM,
 &shProg->UniformStorage[i], stageref))
  return;
-- 
2.1.0

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


[Mesa-dev] [PATCH] glsl: set the binding value regardless explicit_binding

2015-05-11 Thread Alejandro Piñeiro
Since commit c0cd5b var->data.binding was set only when explicit_binding
was false, thas was wrong, should be a test to true. This prevented
to use any binding point different to 0.

In any case, that if statement is not needed. Right now mesa requires
all atomic counters to have an explicit binding point. This would match
the original implementation.

Cc: 10.4, 10.5 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90175
---

New version based on Timothy Arceri suggestion at the list. Also
gentle ping for a formal review of the patch.

 src/glsl/link_atomics.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
index 603873a..2cede91 100644
--- a/src/glsl/link_atomics.cpp
+++ b/src/glsl/link_atomics.cpp
@@ -201,8 +201,7 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
  gl_uniform_storage *const storage = &prog->UniformStorage[id];
 
  mab.Uniforms[j] = id;
- if (!var->data.explicit_binding)
-var->data.binding = i;
+ var->data.binding = i;
 
  storage->atomic_buffer_index = i;
  storage->offset = var->data.atomic.offset;
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH v3] glsl: set the binding value regardless explicit_binding

2015-05-11 Thread Alejandro Piñeiro
Sorry, forgot to include the version number of the patch.

On 11/05/15 12:37, Alejandro Piñeiro wrote:
> Since commit c0cd5b var->data.binding was set only when explicit_binding
> was false, thas was wrong, should be a test to true. This prevented
> to use any binding point different to 0.
>
> In any case, that if statement is not needed. Right now mesa requires
> all atomic counters to have an explicit binding point. This would match
> the original implementation.
>
> Cc: 10.4, 10.5 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90175
> ---
>
> New version based on Timothy Arceri suggestion at the list. Also
> gentle ping for a formal review of the patch.
>
>  src/glsl/link_atomics.cpp | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
> index 603873a..2cede91 100644
> --- a/src/glsl/link_atomics.cpp
> +++ b/src/glsl/link_atomics.cpp
> @@ -201,8 +201,7 @@ link_assign_atomic_counter_resources(struct gl_context 
> *ctx,
>   gl_uniform_storage *const storage = &prog->UniformStorage[id];
>  
>   mab.Uniforms[j] = id;
> - if (!var->data.explicit_binding)
> -var->data.binding = i;
> + var->data.binding = i;
>  
>   storage->atomic_buffer_index = i;
>   storage->offset = var->data.atomic.offset;

-- 
Alejandro Piñeiro (apinhe...@igalia.com)

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


[Mesa-dev] [Bug 90383] assembly enabled mesa crashes dota2

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

--- Comment #6 from Sylvain BERTRAND  ---
It's not a multilib build. It's a standard 32 bits build on x86_64
(CC="i686-pc-linux-gnu")

So you think the issue is the assembly code from the glapi dispatch table not
compiled properly?

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


[Mesa-dev] [Bug 90383] assembly enabled mesa crashes dota2

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

--- Comment #7 from Tapani Pälli  ---
(In reply to Sylvain BERTRAND from comment #6)
> It's not a multilib build. It's a standard 32 bits build on x86_64
> (CC="i686-pc-linux-gnu")
> 
> So you think the issue is the assembly code from the glapi dispatch table not
> compiled properly?

Yep, you'll need the arguments in comment #5 for your build. Otherwise
CCASFLAGS wont have -m32.

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


[Mesa-dev] [PATCH v2] nir: fix sampler lowering pass for arrays

2015-05-11 Thread Tapani Pälli
This fixes bugs with special cases where we have arrays of
structures containing samplers or arrays of samplers.

I've verified that patch results in calculating same index value as
returned by _mesa_get_sampler_uniform_value for IR. Patch makes
following ES3 conformance test pass:

ES3-CTS.shaders.struct.uniform.sampler_array_fragment

v2: remove unnecessary comment (Topi)
simplify changes and the overall code (Jason)

Signed-off-by: Tapani Pälli 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90114
---
 src/glsl/nir/nir_lower_samplers.cpp | 31 ---
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/glsl/nir/nir_lower_samplers.cpp 
b/src/glsl/nir/nir_lower_samplers.cpp
index 8fc5909..7a0b0a0 100644
--- a/src/glsl/nir/nir_lower_samplers.cpp
+++ b/src/glsl/nir/nir_lower_samplers.cpp
@@ -70,19 +70,22 @@ lower_sampler(nir_tex_instr *instr, const struct 
gl_shader_program *shader_progr
   case nir_deref_type_array: {
  nir_deref_array *deref_array = nir_deref_as_array(deref->child);
 
+ assert(deref_array->deref_array_type != 
nir_deref_array_type_wildcard);
+
+ if (deref_array->deref.child) {
+ralloc_asprintf_append(&name, "[%u]",
+   deref_array->deref_array_type == nir_deref_array_type_direct ?
+  deref_array->base_offset : 0);
+ } else {
+assert(deref->child->type->base_type == GLSL_TYPE_SAMPLER);
+instr->sampler_index = deref_array->base_offset;
+ }
+
  /* XXX: We're assuming here that the indirect is the last array
   * thing we have.  This should be ok for now as we don't support
   * arrays_of_arrays yet.
   */
-
- instr->sampler_index *= glsl_get_length(deref->type);
- switch (deref_array->deref_array_type) {
- case nir_deref_array_type_direct:
-instr->sampler_index += deref_array->base_offset;
-if (deref_array->deref.child)
-   ralloc_asprintf_append(&name, "[%u]", deref_array->base_offset);
-break;
- case nir_deref_array_type_indirect: {
+ if (deref_array->deref_array_type == nir_deref_array_type_indirect) {
 /* First, we have to resize the array of texture sources */
 nir_tex_src *new_srcs = rzalloc_array(instr, nir_tex_src,
   instr->num_srcs + 1);
@@ -106,16 +109,6 @@ lower_sampler(nir_tex_instr *instr, const struct 
gl_shader_program *shader_progr
&deref_array->indirect);
 
 instr->sampler_array_size = glsl_get_length(deref->type);
-
-if (deref_array->deref.child)
-   ralloc_strcat(&name, "[0]");
-break;
- }
-
- case nir_deref_array_type_wildcard:
-unreachable("Cannot copy samplers");
- default:
-unreachable("Invalid deref array type");
  }
  break;
   }
-- 
2.1.0

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


[Mesa-dev] [PATCH 4/9] mesa/es3.1: Allow textures with target GL_TEXTURE_2D_MULTISAMPLE

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

GLES 3.1 should be able to bind a texture with the target
GL_TEXTURE_2D_MULTISAMPLE.

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/teximage.c | 2 +-
 src/mesa/main/texobj.c   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 7bc1da7..44fad2d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1008,7 +1008,7 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum 
target)
case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
-  return _mesa_is_desktop_gl(ctx)
+  return (_mesa_is_desktop_gl(ctx) || _mesa_is_gles31(ctx))
  && ctx->Extensions.ARB_texture_multisample
  ? 1 : 0;
case GL_TEXTURE_EXTERNAL_OES:
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index c563f1e..2f5ee8e 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1606,8 +1606,8 @@ _mesa_tex_target_to_index(const struct gl_context *ctx, 
GLenum target)
   return _mesa_is_desktop_gl(ctx) && 
ctx->Extensions.ARB_texture_cube_map_array
  ? TEXTURE_CUBE_ARRAY_INDEX : -1;
case GL_TEXTURE_2D_MULTISAMPLE:
-  return _mesa_is_desktop_gl(ctx) && 
ctx->Extensions.ARB_texture_multisample
- ? TEXTURE_2D_MULTISAMPLE_INDEX: -1;
+  return ((_mesa_is_desktop_gl(ctx) && 
ctx->Extensions.ARB_texture_multisample) ||
+  _mesa_is_gles31(ctx)) ? TEXTURE_2D_MULTISAMPLE_INDEX: -1;
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
   return _mesa_is_desktop_gl(ctx) && 
ctx->Extensions.ARB_texture_multisample
  ? TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX: -1;
-- 
1.9.1

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


[Mesa-dev] [PATCH 1/9] mesa/es3.1: Allow binding GL_DRAW_INDIRECT_BUFFER with gles 3.1

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/bufferobj.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 66dee68..07f82cd 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -91,8 +91,9 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
case GL_COPY_WRITE_BUFFER:
   return &ctx->CopyWriteBuffer;
case GL_DRAW_INDIRECT_BUFFER:
-  if (ctx->API == API_OPENGL_CORE &&
-  ctx->Extensions.ARB_draw_indirect) {
+  if ((ctx->API == API_OPENGL_CORE &&
+   ctx->Extensions.ARB_draw_indirect) ||
+   _mesa_is_gles31(ctx)) {
  return &ctx->DrawIndirectBuffer;
   }
   break;
-- 
1.9.1

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


[Mesa-dev] [PATCH 7/9] mesa/es3.1: Allow query of GL_TEXTURE_MULTISAMPLE

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

GLES 3.1 must allow a query for GL_TEXTURE_MULTISAMPLED.

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/formatquery.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 7741cab..a6c8971 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -74,7 +74,9 @@ _mesa_GetInternalformativ(GLenum target, GLenum 
internalformat, GLenum pname,
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
   /* These enums are only valid if ARB_texture_multisample is supported */
-  if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample)
+  if ((_mesa_is_desktop_gl(ctx) &&
+   ctx->Extensions.ARB_texture_multisample) ||
+  _mesa_is_gles31(ctx))
  break;
 
default:
-- 
1.9.1

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


[Mesa-dev] [PATCH 5/9] mesa/es3.1: Allow enable of GL_SAMPLE_MASK

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

GLES 3.1 must be able to enable GL_SAMPLE_MASK.

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/enable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 801a5ca..9109120 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1603,7 +1603,7 @@ _mesa_IsEnabled( GLenum cap )
 
   /* ARB_texture_multisample */
   case GL_SAMPLE_MASK:
- if (!_mesa_is_desktop_gl(ctx))
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles31(ctx))
 goto invalid_enum_error;
  CHECK_EXTENSION(ARB_texture_multisample);
  return ctx->Multisample.SampleMask;
-- 
1.9.1

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


[Mesa-dev] [PATCH 8/9] mesa/es3.1: Allow multisampled textures for GLES 3.1

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

GLES 3.1 must be allowed to create multisampled
textures.

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/teximage.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 44fad2d..1442113 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -5581,8 +5581,8 @@ _mesa_texture_image_multisample(struct gl_context *ctx, 
GLuint dims,
GLenum sample_count_error;
bool dsa = strstr(func, "ture") ? true : false;
 
-   if (!(ctx->Extensions.ARB_texture_multisample
-  && _mesa_is_desktop_gl(ctx))) {
+   if (!((ctx->Extensions.ARB_texture_multisample
+ && _mesa_is_desktop_gl(ctx))) && !_mesa_is_gles31(ctx)) {
   _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unsupported)", func);
   return;
}
-- 
1.9.1

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


[Mesa-dev] [PATCH 2/9] mesa/es3.1: Allow GL_SAMPLE_MASK

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

GLES 3.1 should be allowed to enable GL_SAMPLE_MASK.

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/enable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 9008a38..801a5ca 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1001,7 +1001,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
 
   /* ARB_texture_multisample */
   case GL_SAMPLE_MASK:
- if (!_mesa_is_desktop_gl(ctx))
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles31(ctx))
 goto invalid_enum_error;
  CHECK_EXTENSION(ARB_texture_multisample, cap);
  if (ctx->Multisample.SampleMask == state)
-- 
1.9.1

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


[Mesa-dev] [PATCH 9/9] mesa/es3.1: Pass sample count check for multisampled textures

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

For GLES 3.1 to support Multisample textures it needs
to be able to pass the sample count test.

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/multisample.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index 816837b..dd18365 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -166,7 +166,7 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum 
target,
 * is greater than zero, then the error INVALID_OPERATION is generated."
 */
if (_mesa_is_gles3(ctx) && _mesa_is_enum_format_integer(internalFormat)
-   && samples > 0) {
+   && samples > 0 && (!_mesa_is_gles31(ctx))) {
   return GL_INVALID_OPERATION;
}
 
-- 
1.9.1

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


[Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

GLES 3.1 must be allowed to use multisampled
frambuffer textures.

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/fbobject.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 27cf97f..14a015e 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum 
attachment,
  break;
   case GL_TEXTURE_2D_MULTISAMPLE:
   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
- error = _mesa_is_gles(ctx)
-|| !ctx->Extensions.ARB_texture_multisample;
+ error = (_mesa_is_gles(ctx)
+|| !ctx->Extensions.ARB_texture_multisample) &&
+!_mesa_is_gles31(ctx);
  break;
   default:
  error = GL_TRUE;
-- 
1.9.1

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


[Mesa-dev] [PATCH 3/9] mesa/es3.1: Allow GL_DEPTH_STENCIL_TEXTURE_MODE

2015-05-11 Thread Marta Lofstedt
From: Marta Lofstedt 

GLES 3.1 must support the parameter
GL_DEPTH_STENCIL_TEXTURE_MODE.

Signed-off-by: Marta Lofstedt 
---
 src/mesa/main/texparam.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index b5d42d3..c5cb2b1 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -500,7 +500,9 @@ set_tex_parameteri(struct gl_context *ctx,
   goto invalid_pname;
 
case GL_DEPTH_STENCIL_TEXTURE_MODE:
-  if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_stencil_texturing) {
+  if ((_mesa_is_desktop_gl(ctx) &&
+   ctx->Extensions.ARB_stencil_texturing) ||
+  _mesa_is_gles31(ctx)) {
  bool stencil = params[0] == GL_STENCIL_INDEX;
  if (!stencil && params[0] != GL_DEPTH_COMPONENT)
 goto invalid_param;
-- 
1.9.1

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


[Mesa-dev] [PATCH 0/9] OpenGL ES 3.1 enablement continued

2015-05-11 Thread Marta Lofstedt
Some of the functionality needed for GLES 3.1 conformance has been 
limited to usage for desktop Open GL and/or excluded Open GL ES usage. 
This patch-set removes some of those limitation for Open GL ES 3.1. 

Marta Lofstedt (9):
  mesa/es3.1: Allow binding GL_DRAW_INDIRECT_BUFFER with gles 3.1
  mesa/es3.1: Allow GL_SAMPLE_MASK
  mesa/es3.1: Allow GL_DEPTH_STENCIL_TEXTURE_MODE
  mesa/es3.1: Allow textures with target GL_TEXTURE_2D_MULTISAMPLE
  mesa/es3.1: Allow enable of GL_SAMPLE_MASK
  mesa/es3.1: Allow Multisampled FrameBufferTextures
  mesa/es3.1: Allow query of GL_TEXTURE_MULTISAMPLE
  mesa/es3.1: Allow multisampled textures for GLES 3.1
  mesa/es3.1: Pass sample count check for multisampled textures

 src/mesa/main/bufferobj.c   | 5 +++--
 src/mesa/main/enable.c  | 4 ++--
 src/mesa/main/fbobject.c| 5 +++--
 src/mesa/main/formatquery.c | 4 +++-
 src/mesa/main/multisample.c | 2 +-
 src/mesa/main/teximage.c| 6 +++---
 src/mesa/main/texobj.c  | 4 ++--
 src/mesa/main/texparam.c| 4 +++-
 8 files changed, 20 insertions(+), 14 deletions(-)

-- 
1.9.1

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


[Mesa-dev] [PATCH] egl: more define fixes for EGL_MESA_image_dma_buf_export

2015-05-11 Thread Marc-André Lureau
s/EGL_MESA_dma_buf_image_export/EGL_MESA_image_dma_buf_export as defined by the 
spec
---
 src/egl/main/eglapi.c   | 2 +-
 src/egl/main/eglfallbacks.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index ba1d0dd..6d2b51d 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1245,7 +1245,7 @@ eglGetProcAddress(const char *procname)
   { "eglCreatePlatformWindowSurfaceEXT", (_EGLProc) 
eglCreatePlatformWindowSurfaceEXT },
   { "eglCreatePlatformPixmapSurfaceEXT", (_EGLProc) 
eglCreatePlatformPixmapSurfaceEXT },
   { "eglGetSyncValuesCHROMIUM", (_EGLProc) eglGetSyncValuesCHROMIUM },
-#ifdef EGL_MESA_dma_buf_image_export
+#ifdef EGL_MESA_image_dma_buf_export
   { "eglExportDMABUFImageQueryMESA", (_EGLProc) 
eglExportDMABUFImageQueryMESA },
   { "eglExportDMABUFImageMESA", (_EGLProc) eglExportDMABUFImageMESA },
 #endif
diff --git a/src/egl/main/eglfallbacks.c b/src/egl/main/eglfallbacks.c
index 83d7756..ef65d2c 100644
--- a/src/egl/main/eglfallbacks.c
+++ b/src/egl/main/eglfallbacks.c
@@ -120,7 +120,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
drv->API.SwapBuffersRegionNOK = NULL;
 #endif
 
-#ifdef EGL_MESA_dma_buf_image_export
+#ifdef EGL_MESA_image_dma_buf_export
drv->API.ExportDMABUFImageQueryMESA = NULL;
drv->API.ExportDMABUFImageMESA = NULL;
 #endif
-- 
2.1.0

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


Re: [Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Erik Faye-Lund
On Mon, May 11, 2015 at 3:03 PM, Marta Lofstedt
 wrote:
> From: Marta Lofstedt 
>
> GLES 3.1 must be allowed to use multisampled
> frambuffer textures.
>
> Signed-off-by: Marta Lofstedt 
> ---
>  src/mesa/main/fbobject.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 27cf97f..14a015e 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum 
> attachment,
>   break;
>case GL_TEXTURE_2D_MULTISAMPLE:
>case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> - error = _mesa_is_gles(ctx)
> -|| !ctx->Extensions.ARB_texture_multisample;
> + error = (_mesa_is_gles(ctx)
> +|| !ctx->Extensions.ARB_texture_multisample) &&
> +!_mesa_is_gles31(ctx);
>   break;
>default:
>   error = GL_TRUE;

Shouldn't this be like this instead (and make sure
ARB_texture_multisample is enabled for ES3.1)?

@@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum
attachment,
  break;
   case GL_TEXTURE_2D_MULTISAMPLE:
   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
- error = _mesa_is_gles(ctx)
-|| !ctx->Extensions.ARB_texture_multisample;
+ error = !ctx->Extensions.ARB_texture_multisample;
  break;
   default:
  error = GL_TRUE;
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2 v3] i965: Use predicate enable bit for conditional rendering w/o stalling

2015-05-11 Thread Neil Roberts
Kenneth Graunke  writes:

> It might be nice to create a brw_load_register_mem64 function, for
> symmetry with brw_store_register_mem64 - we might want to reuse it
> elsewhere someday.

Ok, that sounds sensible.

> One interesting quirk: the two halves of your register write may land
> in two separate batchbuffers, since it's done with two BEGIN_BATCH /
> ADVANCE_BATCH blocks (each of which only reserves space for one LRM).

Ah right, yes, good point.

> */ goes on its own line, here and elsewhere.

Oops, yes.

>> +   } else {
>> +  if (brw->ctx.Query.CondRenderQuery) {
>> + perf_debug("Conditional rendering is implemented in software and 
>> may "
>> +"stall.\n");
>> +  }
>> +
>> +  return _mesa_check_conditional_render(&brw->ctx);
>
> I'd put this in the same block as the perf_debug and just do 'return
> true' here - we can save the function call and redundant query check in
> the common case (and this is a really hot path).

Ok, sounds good.

>> @@ -333,6 +335,9 @@ intelInitExtensions(struct gl_context *ctx)
>>   ctx->Extensions.ARB_transform_feedback2 = true;
>>   ctx->Extensions.ARB_transform_feedback3 = true;
>>   ctx->Extensions.ARB_transform_feedback_instanced = true;
>> +
>> + if (brw->intelScreen->cmd_parser_version >= 2)
>> +brw->predicate.supported = true;
>
> So, this is insufficient for Haswell.  There was not a version bump when
> it actually started working (I think Daniel assumed we didn't need it,
> since we were already attempting to write registers ourselves.)
>
> I think the best plan of action is to submit a kernel patch bumping the
> command parser version number to 4, then change this to:
>
>const int cmd_parser_version = brw->intelScreen->cmd_parser_version;
>
>if (cmd_parser_version >= (brw->is_haswell ? 4 : 2))
>   brw->predicate.supported = true;

I don't think this is necessary. It's a bit hard to tell from the patch
diff but this hunk is inside an if statement like this:

   if (brw->gen >= 7) {
  /* ... */
  if (can_do_pipelined_register_writes(brw)) {
 /* ... transform feedback stuff ... */
 if (brw->intelScreen->cmd_parser_version >= 2)
brw->predicate.supported = true;
  }
  /* ... */
   }

Therefore it will only try to use the predicate register if the command
parser is at least version 2 *and* we can do register writes. I don't
think there is any version of the kernel where this wouldn't correctly
detect whether it can write to the predicate register.

If you agree with this then I'll post a v4 with all the other changes.
In the meantime there is a WIP branch of it here:

https://github.com/bpeel/mesa/tree/wip/conditional-render

Many thanks for the detailed review.

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


Re: [Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Ilia Mirkin
On Mon, May 11, 2015 at 10:08 AM, Erik Faye-Lund  wrote:
> On Mon, May 11, 2015 at 3:03 PM, Marta Lofstedt
>  wrote:
>> From: Marta Lofstedt 
>>
>> GLES 3.1 must be allowed to use multisampled
>> frambuffer textures.
>>
>> Signed-off-by: Marta Lofstedt 
>> ---
>>  src/mesa/main/fbobject.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
>> index 27cf97f..14a015e 100644
>> --- a/src/mesa/main/fbobject.c
>> +++ b/src/mesa/main/fbobject.c
>> @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum 
>> attachment,
>>   break;
>>case GL_TEXTURE_2D_MULTISAMPLE:
>>case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
>> - error = _mesa_is_gles(ctx)
>> -|| !ctx->Extensions.ARB_texture_multisample;
>> + error = (_mesa_is_gles(ctx)
>> +|| !ctx->Extensions.ARB_texture_multisample) &&
>> +!_mesa_is_gles31(ctx);

This seems correct. error = true when old condition, but not when
es3.1 even if the old condition holds true. If the old condition is
false, then the new addition doesn't matter.

Personally I would have written this as

error = _mesa_is_gles(ctx) && !mesa_is_gles31(ctx) ||
!ctx->Extensions.ARB_texture_multisample;

The nice thing about this is that it will force an error even in the
very hypothetical situation where a driver doesn't expose
ARB_texture_multisample, but a GLES3.1 context was created (e.g. via
an override flag).

>>   break;
>>default:
>>   error = GL_TRUE;
>
> Shouldn't this be like this instead (and make sure
> ARB_texture_multisample is enabled for ES3.1)?
>
> @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum
> attachment,
>   break;
>case GL_TEXTURE_2D_MULTISAMPLE:
>case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> - error = _mesa_is_gles(ctx)
> -|| !ctx->Extensions.ARB_texture_multisample;
> + error = !ctx->Extensions.ARB_texture_multisample;

error = false when you have a driver that supports texture_ms, but you
have a gles1/2/3 context, whereas you wanted error = true there...

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


Re: [Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Erik Faye-Lund
On Mon, May 11, 2015 at 4:57 PM, Ilia Mirkin  wrote:
> On Mon, May 11, 2015 at 10:08 AM, Erik Faye-Lund  wrote:
>> Shouldn't this be like this instead (and make sure
>> ARB_texture_multisample is enabled for ES3.1)?
>>
>> @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum
>> attachment,
>>   break;
>>case GL_TEXTURE_2D_MULTISAMPLE:
>>case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
>> - error = _mesa_is_gles(ctx)
>> -|| !ctx->Extensions.ARB_texture_multisample;
>> + error = !ctx->Extensions.ARB_texture_multisample;
>
> error = false when you have a driver that supports texture_ms, but you
> have a gles1/2/3 context, whereas you wanted error = true there...

I would expect ctx->Extensions.ARB_texture_multisample to be false in
any pre-GLES 3.1 context, since ARB_texture_multisample is written
against the OpenGL 3.1 specification, and not any Open GL ES flavor.

Are you saying that we do not mask these booleans against what the
context can support? Are these purely about what the driver can
manage?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 0/6] i965: INTEL_performance_query re-work

2015-05-11 Thread Samuel Pitoiset

Did you write piglit tests according to what the spec says, btw ?

On 05/06/2015 02:53 AM, Robert Bragg wrote:

As we've learned more about the observability capabilities of Gen
graphics we've found that it's not enough to only try and configure the
OA unit from userspace without any dedicated support from the kernel.

As it is currently the i965 backends for both AMD_performance_monitor
and INTEL_performance_query aren't able to report normalized metrics
useful to application developers due to the limitations of configuring
the OA unit from userspace via LRIs.

More recently we've developed a perf PMU (performance monitoring unit)
driver within the drm i915 driver ("i915_oa") that lets userspace
configure and open an event fd via the perf_event_open syscall which
provides us a more complete interface for configuring the Gen graphics
OA unit.

With help from the kernel we can support periodic sampling (where the
hardware writes reports into a gpu mapped circular buffer that we can
forward as perf samples), we can deal with the clock gating + PM
limitations imposed by the observability hw and also manage + maintain
the selection of performance counters.

The perf_event_open(2) man page is a good starting point for anyone
wanting to learn about the Linux perf interface. Something to beware of
is that there's currently no precedent upstream for exposing device
metrics via a perf PMU and although early feedback was sought for this
work, some of this may be subject to change based on feedback from the
core perf maintainers as well as the i915 drm driver maintainers.

This PRM is a good starting point for anyone wanting to learn about the
Gen graphics Observability hardware. Some important information is
currently missing and this should be updated soon, but that's more
directly related to the i915_oa perf driver. Notably though the report
formats described here need to be understood by Mesa, since the perf
samples simply forward the raw reports from the OA hardware.

https://01.org/sites/default/files/documentation/
observability_performance_counters_haswell.pdf

This series re-works the i965 driver's support for exposing performance
counters, taking advantage of this i915_oa perf event interface.

A corresponding kernel branch with an initial i915_oa driver for Haswell
can be found here:

https://github.com/rib/linux  wip/rib/oa-hsw-4.0.0

A corresponding libdrm branch can be found here:

https://github.com/rib/drm  wip/rib/oa-hsw-4.0.0

In case it's helpful to see another example using the i915_oa perf
interface I've also been developing a 'gputop' tool that both lets me
test the INTEL_performance_query interface to collect per-context
metrics from Mesa and can also visualize system wide metrics (i.e.
across all gpu contexts) using perf directly:

https://github.com/rib/gputop

Although I haven't updated the branches in a while, I could share some
initial code adding support for Broadwell if anyone's interested to get
a sense of what's involved in supporting later hardware generations.

I still anticipate some (hopefully relatively minor) tweaking of
implementation details based on review feedback for the i915_oa driver,
but I hope that this is a good point to ask for some feedback on the
Mesa changes.

If it's more convenient, these patches can also be fetched from here:

https://github.com/rib/mesa  wip/rib/oa-hsw-4.0.0

Regards,
- Robert

Robert Bragg (6):
   i965: Remove perf monitor/query backend
   Separate INTEL_performance_query frontend
   Model INTEL perf query backend after query object BE
   i965: Implement INTEL_performance_query extension
   i965: Expose OA counters via INTEL_performance_query
   i965: Adds further support for "3D" OA counters

  src/mapi/glapi/gen/gl_genexec.py   |1 +
  src/mesa/Makefile.sources  |2 +
  src/mesa/drivers/dri/i965/Makefile.sources |2 +-
  src/mesa/drivers/dri/i965/brw_context.c|5 +-
  src/mesa/drivers/dri/i965/brw_context.h|  101 +-
  .../drivers/dri/i965/brw_performance_monitor.c | 1472 
  src/mesa/drivers/dri/i965/brw_performance_query.c  | 2356 
  src/mesa/drivers/dri/i965/intel_batchbuffer.c  |   10 +-
  src/mesa/drivers/dri/i965/intel_extensions.c   |   69 +-
  src/mesa/main/context.c|3 +
  src/mesa/main/dd.h |   39 +
  src/mesa/main/mtypes.h |   28 +
  src/mesa/main/performance_monitor.c|  579 -
  src/mesa/main/performance_monitor.h|   39 -
  src/mesa/main/performance_query.c  |  608 +
  src/mesa/main/performance_query.h  |   80 +
  16 files changed, 3197 insertions(+), 2197 deletions(-)
  delete mode 100644 src/mesa/drivers/dri/i965/brw_performance_monitor.c
  create mode 100644 src/mesa/drivers/dri/i965/brw_performance_query.c
  create mode 100644 src/mesa/main/pe

Re: [Mesa-dev] [RFC 3/6] Model INTEL perf query backend after query object BE

2015-05-11 Thread Samuel Pitoiset

Patches 1 and 2 look fine to me.

See my comments below for this one.

On 05/06/2015 02:53 AM, Robert Bragg wrote:

Instead of using the same backend interface as AMD_performance_monitor
this defines a dedicated INTEL_performance_query interface that is based
on the ARB_query_buffer_object interface (considering the similarity of
the extensions) with the addition of vfuncs for enumerating queries and
their counters.

Compared to the previous backend, some notable differences are:

- The backend is free to represent counters using whatever data
   structures are optimal/convenient since queries and counters are
   enumerated via an iterator api instead of declaring them using
   structures directly shared with the frontend.

   This is also done to help us support the full range of data and
   semantic types available with INTEL_performance_query which is awkward
   while using a structure shared with the AMD_performance_monitor
   backend since neither extension's types are a subset of the other.

- The backend must support waiting for a query instead of the frontend
   simply using glFinish().

- Objects go through 'Active' and 'Ready' states consistent with the
   query object backend (hopefully making them more familiar). There is
   no 'Ended' state (which used to show that a query has ended at least
   once for a given object). There is a new 'Used' state similar to the
   'EverBound' state of query objects, set when a query is first begun
   which implies that we are expecting to get results back for the object
   at some point.

The INTEL_performance_query and AMD_performance_monitor extensions are
now completely orthogonal within Mesa (though a driver could optionally
choose to implement both extensions within a unified backend if that
were convenient for the sake of sharing state/code).

Signed-off-by: Robert Bragg 
---
  src/mesa/main/dd.h|  39 +++
  src/mesa/main/mtypes.h|  25 +-
  src/mesa/main/performance_query.c | 590 ++
  src/mesa/main/performance_query.h |   6 +-
  4 files changed, 275 insertions(+), 385 deletions(-)

diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 0c1a13f..4ba1524 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -759,6 +759,45 @@ struct dd_function_table {
  GLint *bytesWritten);
 /*@}*/
  
+   /**

+* \name Performance Query objects
+*/
+   /*@{*/
+   void (*GetPerfQueryInfo)(struct gl_context *ctx,
+int queryIndex,
+const char **name,
+GLuint *dataSize,
+GLuint *numCounters,
+GLuint *numActive);
+   void (*GetPerfCounterInfo)(struct gl_context *ctx,
+  int queryIndex,
+  int counterIndex,
+  const char **name,
+  const char **desc,
+  GLuint *offset,
+  GLuint *data_size,
+  GLuint *type_enum,
+  GLuint *data_type_enum,
+  GLuint64 *raw_max);
+   struct gl_perf_query_object * (*NewPerfQueryObject)(struct gl_context *ctx,
+   int queryIndex);
+   void (*DeletePerfQuery)(struct gl_context *ctx,
+   struct gl_perf_query_object *obj);
+   GLboolean (*BeginPerfQuery)(struct gl_context *ctx,
+   struct gl_perf_query_object *obj);
+   void (*EndPerfQuery)(struct gl_context *ctx,
+struct gl_perf_query_object *obj);
+   void (*WaitPerfQuery)(struct gl_context *ctx,
+ struct gl_perf_query_object *obj);
+   GLboolean (*IsPerfQueryReady)(struct gl_context *ctx,
+ struct gl_perf_query_object *obj);
+   void (*GetPerfQueryData)(struct gl_context *ctx,
+struct gl_perf_query_object *obj,
+GLsizei dataSize,
+GLuint *data,
+GLuint *bytesWritten);
+   /*@}*/
+
  
 /**

  * \name Vertex Array objects
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b1e5fa9..a26109d 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2014,6 +2014,23 @@ struct gl_perf_monitor_group
  
  
  /**

+ * A query object instance as described in INTEL_performance_query.
+ *
+ * NB: We want to keep this and the corresponding backend structure
+ * relatively lean considering that applications may expect to
+ * allocate enough objects to be able to query around all draw calls
+ * in a frame.
+ */
+struct gl_perf_query_object
+{
+   GLuint Id;/**< hash table ID/name */
+   GLuint Used:1;/**< has been used for 1 or more queries */
+   GLuint Active:1;  /**< inside 

Re: [Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Ilia Mirkin
On Mon, May 11, 2015 at 11:07 AM, Erik Faye-Lund  wrote:
> On Mon, May 11, 2015 at 4:57 PM, Ilia Mirkin  wrote:
>> On Mon, May 11, 2015 at 10:08 AM, Erik Faye-Lund  wrote:
>>> Shouldn't this be like this instead (and make sure
>>> ARB_texture_multisample is enabled for ES3.1)?
>>>
>>> @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum
>>> attachment,
>>>   break;
>>>case GL_TEXTURE_2D_MULTISAMPLE:
>>>case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
>>> - error = _mesa_is_gles(ctx)
>>> -|| !ctx->Extensions.ARB_texture_multisample;
>>> + error = !ctx->Extensions.ARB_texture_multisample;
>>
>> error = false when you have a driver that supports texture_ms, but you
>> have a gles1/2/3 context, whereas you wanted error = true there...
>
> I would expect ctx->Extensions.ARB_texture_multisample to be false in
> any pre-GLES 3.1 context, since ARB_texture_multisample is written
> against the OpenGL 3.1 specification, and not any Open GL ES flavor.
>
> Are you saying that we do not mask these booleans against what the
> context can support? Are these purely about what the driver can
> manage?

Correct. They are exclusively set by the driver and never modified again.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Erik Faye-Lund
On Mon, May 11, 2015 at 5:21 PM, Ilia Mirkin  wrote:
> On Mon, May 11, 2015 at 11:07 AM, Erik Faye-Lund  wrote:
>> On Mon, May 11, 2015 at 4:57 PM, Ilia Mirkin  wrote:
>>> On Mon, May 11, 2015 at 10:08 AM, Erik Faye-Lund  
>>> wrote:
 Shouldn't this be like this instead (and make sure
 ARB_texture_multisample is enabled for ES3.1)?

 @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum
 attachment,
   break;
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
 - error = _mesa_is_gles(ctx)
 -|| !ctx->Extensions.ARB_texture_multisample;
 + error = !ctx->Extensions.ARB_texture_multisample;
>>>
>>> error = false when you have a driver that supports texture_ms, but you
>>> have a gles1/2/3 context, whereas you wanted error = true there...
>>
>> I would expect ctx->Extensions.ARB_texture_multisample to be false in
>> any pre-GLES 3.1 context, since ARB_texture_multisample is written
>> against the OpenGL 3.1 specification, and not any Open GL ES flavor.
>>
>> Are you saying that we do not mask these booleans against what the
>> context can support? Are these purely about what the driver can
>> manage?
>
> Correct. They are exclusively set by the driver and never modified again.

OK. Then yeah, my comments were obviously wrong. Thanks for setting me straight!
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/9] mesa/es3.1: Allow binding GL_DRAW_INDIRECT_BUFFER with gles 3.1

2015-05-11 Thread Ilia Mirkin
On Mon, May 11, 2015 at 9:03 AM, Marta Lofstedt
 wrote:
> From: Marta Lofstedt 
>
> Signed-off-by: Marta Lofstedt 
> ---
>  src/mesa/main/bufferobj.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 66dee68..07f82cd 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -91,8 +91,9 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
> case GL_COPY_WRITE_BUFFER:
>return &ctx->CopyWriteBuffer;
> case GL_DRAW_INDIRECT_BUFFER:
> -  if (ctx->API == API_OPENGL_CORE &&
> -  ctx->Extensions.ARB_draw_indirect) {
> +  if ((ctx->API == API_OPENGL_CORE &&
> +   ctx->Extensions.ARB_draw_indirect) ||
> +   _mesa_is_gles31(ctx)) {

Similar to my comment on the other patch (and if this occurs in the
other patches, I'd have the same comment there again). I think it's
confusing, the way you're mixing things. Also it'll lead to backend
drivers potentially receiving things they're not ready for. IMHO this
should become

if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) &&
ctx->Extensions.ARB_draw_indirect)

Cheers,

  -ilia

>   return &ctx->DrawIndirectBuffer;
>}
>break;
> --
> 1.9.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC 4/6] i965: Implement INTEL_performance_query extension

2015-05-11 Thread Samuel Pitoiset



On 05/06/2015 02:53 AM, Robert Bragg wrote:

This adds a bare-bones backend for the INTEL_performance_query extension
that exposes the pipeline statistics on gen 6 and 7 hardware.

Although this could be considered redundant given that the same
statistics are now available via query objects, they are a simple
starting point for this extension and it's expected to be convenient for
tools wanting to have a single go to api to introspect what performance
counters are available, along with names, descriptions and semantic/data
types.

This code is derived from Kenneth Graunke's work, temporarily removed
while the frontend and backend interface were reworked.

Signed-off-by: Robert Bragg 
---
  src/mesa/drivers/dri/i965/Makefile.sources|   1 +
  src/mesa/drivers/dri/i965/brw_context.c   |   3 +
  src/mesa/drivers/dri/i965/brw_context.h   |  26 +
  src/mesa/drivers/dri/i965/brw_performance_query.c | 611 ++
  src/mesa/drivers/dri/i965/intel_extensions.c  |   3 +
  5 files changed, 644 insertions(+)
  create mode 100644 src/mesa/drivers/dri/i965/brw_performance_query.c

diff --git a/src/mesa/drivers/dri/i965/Makefile.sources 
b/src/mesa/drivers/dri/i965/Makefile.sources
index 210314b..066364a 100644
--- a/src/mesa/drivers/dri/i965/Makefile.sources
+++ b/src/mesa/drivers/dri/i965/Makefile.sources
@@ -81,6 +81,7 @@ i965_FILES = \
brw_nir_analyze_boolean_resolves.c \
brw_object_purgeable.c \
brw_packed_float.c \
+   brw_performance_query.c \
brw_primitive_restart.c \
brw_program.c \
brw_program.h \
diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 80a4b0a..1350bc1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -884,6 +884,9 @@ brwCreateContext(gl_api api,
 _mesa_initialize_dispatch_tables(ctx);
 _mesa_initialize_vbo_vtxfmt(ctx);
  
+   if (ctx->Extensions.INTEL_performance_query)

+  brw_init_performance_queries(brw);
+
 vbo_use_buffer_objects(ctx);
 vbo_always_unmap_buffers(ctx);
  
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h

index db65191..2cd963d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -953,6 +953,21 @@ struct brw_stage_state
 uint32_t sampler_offset;
  };
  
+enum brw_query_kind {

+   PIPELINE_STATS
+};
+
+struct brw_perf_query
+{
+   enum brw_query_kind kind;
+   const char *name;
+   struct brw_perf_query_counter *counters;
+   int n_counters;
+   size_t data_size;
+};
+
+#define MAX_PERF_QUERIES 3
+#define MAX_PERF_QUERY_COUNTERS 150
  
  /**

   * brw_context is derived from gl_context.
@@ -1380,6 +1395,13 @@ struct brw_context
bool begin_emitted;
 } query;
  
+   struct {

+  struct brw_perf_query queries[MAX_PERF_QUERIES];


Why the number of active queries is limited to 3? Is that a hardware 
limitation?



+  int n_queries;
+
+  int n_active_pipeline_stats_queries;
+   } perfquery;
+
 int num_atoms[BRW_NUM_PIPELINES];
 const struct brw_tracked_state render_atoms[57];
 const struct brw_tracked_state compute_atoms[1];
@@ -1656,6 +1678,10 @@ bool brw_render_target_supported(struct brw_context *brw,
   struct gl_renderbuffer *rb);
  uint32_t brw_depth_format(struct brw_context *brw, mesa_format format);
  
+/* brw_performance_query.c */

+void brw_init_performance_queries(struct brw_context *brw);
+void brw_dump_perf_queries(struct brw_context *brw);
+
  /* intel_buffer_objects.c */
  int brw_bo_map(struct brw_context *brw, drm_intel_bo *bo, int write_enable,
 const char *bo_name);
diff --git a/src/mesa/drivers/dri/i965/brw_performance_query.c 
b/src/mesa/drivers/dri/i965/brw_performance_query.c
new file mode 100644
index 000..38447e8
--- /dev/null
+++ b/src/mesa/drivers/dri/i965/brw_performance_query.c
@@ -0,0 +1,611 @@
+/*
+ * Copyright © 2013 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 (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, D

Re: [Mesa-dev] [PATCH 4/9] egl/wayland: Add support for render-nodes

2015-05-11 Thread Matt Turner
On Sat, May 9, 2015 at 4:20 AM, Axel Davy  wrote:
> for drmGetNodeTypeFromFd, it looks like a very recent libdrm function, and
> we would require libdrm 2.4.60, which is quite recent. Currently mesa
> requires 2.4.38, when libdrm is needed. I guess we cannot require 2.4.60 for
> now.

Sure you can. libdrm dependencies aren't a problem.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] clover: log build options when dumping clc source

2015-05-11 Thread EdB
---
 src/gallium/state_trackers/clover/llvm/invocation.cpp | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp 
b/src/gallium/state_trackers/clover/llvm/invocation.cpp
index 7d2d941..fc7ab9c 100644
--- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
+++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
@@ -708,8 +708,10 @@ clover::compile_program_llvm(const std::string &source,
 
llvm_ctx.setDiagnosticHandler(diagnostic_handler, &r_log);
 
-   if (get_debug_flags() & DBG_CLC)
-  debug_log(source, ".cl");
+   if (get_debug_flags() & DBG_CLC) {
+  const std::string src = "// Build options: " + opts + '\n' + source;
+  debug_log(src, ".cl");
+   }
 
// The input file name must have the .cl extension in order for the
// CompilerInvocation class to recognize it as an OpenCL source file.
-- 
2.1.0

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


[Mesa-dev] [Bug 90147] swrast: build error undeclared _SC_PHYS_PAGES on osx

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

Jon TURNEY  changed:

   What|Removed |Added

 CC||jon.tur...@dronecode.org.uk

--- Comment #9 from Jon TURNEY  ---
Created attachment 115698
  --> https://bugs.freedesktop.org/attachment.cgi?id=115698&action=edit
Fix compilation when sys/sysctl.h is not present

Unfortunately, this patch unconditionally includes sys/sysctl.h, which breaks
compilation for me (see
http://tinderbox.x.org/builds/2015-05-07-0008/logs/mesa-mesa/#build)

I can't find any evidence that sys/sysctl.h is required by POSIX.

Attached is an attempt to fix this.

Additionally, I'm not sure if any platform exists which has both interfaces,
but preferring sysctl() to sysconf() as this patch does, would mean on any such
platforms a different path would be used to that previously.

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


[Mesa-dev] [Bug 90383] assembly enabled mesa crashes dota2

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

--- Comment #8 from Sylvain BERTRAND  ---
I tried -m32. Did not change anything. -m32 and -m64 are only for a gcc
multilib toolchains. Here, it's a normal x86 toolchain, with i686-pc-gnu-gcc
calling i686-pc-gnu-as (I checked i686-pc-gnu-gcc verbose output).
Did you mean something is hardcoded in the build system for the availabily
of the -m32/-m64 flags? If yes, what is it?

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


[Mesa-dev] [Bug 90311] Fail to build libglx with clang at linking stage

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

--- Comment #2 from Jon TURNEY  ---
I don't remember all the details, but when I wrote "XXX: There has to be a
better way fixing this.", I think my concern was that
perhaps this indicates that the partitioning of functionality into whatever it
is that provides _SET_DrawBuffers isn't quite right.

That said, I have no problem with this patch being applied as is, as it's
pretty non-invasive and clearly an improvement over the current situation.

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


[Mesa-dev] [PATCH 48/57] mesa: Add ARB_direct_state_access checks in texture functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/genmipmap.c   |  7 
 src/mesa/main/texgetimage.c | 14 
 src/mesa/main/teximage.c| 74 +++
 src/mesa/main/texobj.c  | 14 
 src/mesa/main/texparam.c| 84 +
 src/mesa/main/texstorage.c  |  7 
 6 files changed, 200 insertions(+)

diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c
index 9aef090..32b9460 100644
--- a/src/mesa/main/genmipmap.c
+++ b/src/mesa/main/genmipmap.c
@@ -158,6 +158,13 @@ _mesa_GenerateTextureMipmap(GLuint texture)
struct gl_texture_object *texObj;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glGenerateTextureMipmap(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
texObj = _mesa_lookup_texture_err(ctx, texture, "glGenerateTextureMipmap");
if (!texObj)
   return;
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 92b4d67..f582a7f 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1108,6 +1108,13 @@ _mesa_GetTextureImage(GLuint texture, GLint level, 
GLenum format,
GLenum err;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glGetTextureImage(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
/*
 * This has been moved here because a format/type mismatch can cause a NULL
 * texImage object, which in turn causes the mismatch error to be
@@ -1344,6 +1351,13 @@ _mesa_GetCompressedTextureImage(GLuint texture, GLint 
level,
GLint image_stride;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glGetCompressedTextureImage(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
texObj = _mesa_lookup_texture_err(ctx, texture,
  "glGetCompressedTextureImage");
if (!texObj)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 7bc1da7..7616fd7 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3624,6 +3624,13 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
   _mesa_lookup_enum_by_nr(format),
   _mesa_lookup_enum_by_nr(type), pixels);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glTextureSubImage%uD(GL_ARB_direct_state_access "
+  "is not supported)", dims);
+  return;
+   }
+
/* Get the texture object by Name. */
texObj = _mesa_lookup_texture(ctx, texture);
if (!texObj) {
@@ -4183,6 +4190,12 @@ _mesa_CopyTextureSubImage1D(GLuint texture, GLint level,
const char *self = "glCopyTextureSubImage1D";
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "%s(GL_ARB_direct_state_access is not supported)", self);
+  return;
+   }
+
texObj = _mesa_lookup_texture_err(ctx, texture, self);
if (!texObj)
   return;
@@ -4207,6 +4220,12 @@ _mesa_CopyTextureSubImage2D(GLuint texture, GLint level,
const char *self = "glCopyTextureSubImage2D";
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "%s(GL_ARB_direct_state_access is not supported)", self);
+  return;
+   }
+
texObj = _mesa_lookup_texture_err(ctx, texture, self);
if (!texObj)
   return;
@@ -4234,6 +4253,12 @@ _mesa_CopyTextureSubImage3D(GLuint texture, GLint level,
const char *self = "glCopyTextureSubImage3D";
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "%s(GL_ARB_direct_state_access is not supported)", self);
+  return;
+   }
+
texObj = _mesa_lookup_texture_err(ctx, texture, self);
if (!texObj)
   return;
@@ -4829,6 +4854,13 @@ _mesa_CompressedTextureSubImage1D(GLuint texture, GLint 
level, GLint xoffset,
 
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glCompressedTextureSubImage1D(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
texObj = _mesa_lookup_texture_err(ctx, texture,
  "glCompressedTextureSubImage1D");
if (!texObj)
@@ -4907,6 +4939,13 @@ _mesa_CompressedTextureSubImage2D(GLuint texture, GLint 
level, GLint xoffset,
 
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {

[Mesa-dev] [PATCH 55/57] st/mesa: Enable ARB_direct_state_access

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/state_tracker/st_extensions.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index b1057f3..d3f31db 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -650,6 +650,9 @@ void st_init_extensions(struct pipe_screen *screen,
   ARRAY_SIZE(vertex_mapping), PIPE_BUFFER,
   PIPE_BIND_VERTEX_BUFFER);
 
+   if (extensions->ARB_texture_non_power_of_two)
+  extensions->ARB_direct_state_access = GL_TRUE;
+
if (extensions->ARB_stencil_texturing)
   extensions->ARB_texture_stencil8 = GL_TRUE;
 
-- 
2.1.4

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


[Mesa-dev] [PATCH 09/57] main: Fix an error generated by FramebufferTexture

2015-05-11 Thread Fredrik Höglund
From: Laura Ekstrand 

gl*FramebufferTexture should generate GL_INVALID_VALUE when the
texture doesn't exist.

[Fredrik: Split this change out from the next commit]

Cc: "10.4 10.5" 
Reviewed-by: Fredrik Höglund 
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/fbobject.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 20a4e86..09dbf33 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2654,10 +2654,19 @@ framebuffer_texture(struct gl_context *ctx, const char 
*caller, GLenum target,
  }
   }
   else {
- /* can't render to a non-existant texture */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glFramebufferTexture%s(non existant texture)",
- caller);
+ /* Can't render to a non-existent texture object.
+  *
+  * The OpenGL 4.5 core spec (02.02.2015) in Section 9.2 Binding and
+  * Managing Framebuffer Objects specifies a different error
+  * depending upon the calling function (PDF pages 325-328).
+  * *FramebufferTexture (where layered = GL_TRUE) throws invalid
+  * value, while the other commands throw invalid operation (where
+  * layered = GL_FALSE).
+  */
+ const GLenum error = layered ? GL_INVALID_VALUE :
+  GL_INVALID_OPERATION;
+ _mesa_error(ctx, error,
+ "%s(non-existent texture %u)", caller, texture);
  return;
   }
 
-- 
2.1.4

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


[Mesa-dev] [PATCH 08/57] mesa: Generate GL_INVALID_VALUE in framebuffer_texture when layer < 0

2015-05-11 Thread Fredrik Höglund
Cc: "10.4 10.5" 
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/fbobject.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 4524e51..20a4e86 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2668,6 +2668,18 @@ framebuffer_texture(struct gl_context *ctx, const char 
*caller, GLenum target,
  return;
   }
 
+  /* Page 306 (page 328 of the PDF) of the OpenGL 4.5 (Core Profile)
+   * spec says:
+   *
+   *"An INVALID_VALUE error is generated if texture is non-zero
+   * and layer is negative."
+   */
+  if (zoffset < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glFramebufferTexture%s(layer %u < 0)", caller, zoffset);
+ return;
+  }
+
   if (texObj->Target == GL_TEXTURE_3D) {
  const GLuint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
  if (zoffset >= maxSize) {
-- 
2.1.4

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


[Mesa-dev] [PATCH 00/57] Finish enabling ARB_direct_state_access

2015-05-11 Thread Fredrik Höglund
This is a respin of Laura's FBO patches.  I've rebased them, fixed
the issues I found, and added my R-b tags.  Note that there is a total
of 57 patches, so I'm only posting the ones that don't already have R-b
tags, and the ones that are candidates for the stable branches.  But
all the patches are available in my arb-direct-state-access branch at:

git://people.freedesktop.org/~fredrik/mesa arb-direct-state-access

There is one issue however.  The plan was to only expose the extension
in the core profile, but it turns out that several of the piglit tests
that have been written for the extension depend on the compatibility
profile.  Some of those tests would have to be completely rewritten
to work with the core profile.  The only DSA functions that behave
differently in the compatibility profile, however, are the VAO functions,
and those implement both the core and the compatibility behavior.  We
also have the piglit tests to prove that.  So in this series I'm enabling
the extension in both profiles.  It's easier to do that than it is
to rewrite the piglit tests.

If there are no objections I hope to land this series before the freeze
on Friday.

Fredrik Höglund (18):
  main: Require that the texture exists in framebuffer_texture
  mesa: Generate GL_INVALID_VALUE in framebuffer_texture when layer < 0
  mesa: Add an extension flag for ARB_direct_state_access
  mesa: Make GL_TEXTURE_CUBE_MAP valid in FramebufferTextureLayer
  mesa: Add ARB_direct_state_access checks in XFB functions
  mesa: Add ARB_direct_state_access checks in buffer object functions
  mesa: Add ARB_direct_state_access checks in FBO functions
  mesa: Add ARB_direct_state_access checks in renderbuffer functions
  mesa: Add ARB_direct_state_access checks in texture functions
  mesa: Add ARB_direct_state_access checks in VAO functions
  mesa: Add ARB_direct_state_access checks in sampler object functions
  mesa: Add ARB_direct_state_access checks in program pipeline functions
  mesa: Add ARB_direct_state_access checks in query object functions
  i915: Enable ARB_direct_state_access
  i965: Enable ARB_direct_state_access
  st/mesa: Enable ARB_direct_state_access
  docs: Update the ARB_direct_state_access status
  docs/relnotes: Mark off ARB_direct_state_access for 10.6

Laura Ekstrand (39):
  main: Add utility function _mesa_lookup_framebuffer_err.
  main: Add glCreateFramebuffers.
  main: Add utility function _mesa_lookup_renderbuffer_err.
  main: Rename framebuffer renderbuffer software fallback.
  main: Add entry point for NamedFramebufferRenderbuffer.
  main: Fix the indentation in framebuffer_texture
  main: Fix an error generated by FramebufferTexture
  main: Split framebuffer_texture.
  main: Refactor get_texture_for_framebuffer.
  main: Fix indentation in get_texture_for_framebuffer.
  main: Add entry points for glNamedFramebufferTexture[Layer].
  main: Major refactor of get_texture_for_framebuffer.
  main: Fix indents in former get_texture_for_framebuffer functions.
  main: Add entry point for CheckNamedFramebufferStatus.
  main: Add entry point GetNamedFramebufferAttachmentParameteriv.
  main: Fix whitespace in blit.c
  main: Refactor glBlitFramebuffer.
  main: Refactor _mesa_update_framebuffer.
  main: Refactor _mesa_[update|get]_clamp_vertex_color.
  main: Refactor _mesa_[update|get]_clamp_fragment_color.
  main: Refactor _mesa_get_clamp_read_color.
  main: Refactor _mesa_update_draw_buffer_bounds.
  main: Add entry point for BlitNamedFramebuffer.
  main: _mesa_blit_framebuffer updates its arbitrary framebuffers.
  main: Complete error conditions for glInvalidate*Framebuffer.
  main: Refactor invalidate_framebuffer_storage.
  main: Add entry points for InvalidateNamedFramebuffer[Sub]Data.
  main: Fake entry point for glClearNamedFramebufferiv.
  main: Fake entry point for glClearNamedFramebufferuiv.
  main: Fake entry point for glClearNamedFramebufferfv.
  main: Fake entry point for glClearNamedFramebufferfi.
  main: Add stubs for [Get]NamedFramebufferParameteri[v].
  main: Refactor _mesa_drawbuffers.
  main: Refactor _mesa_DrawBuffer.
  main: Add entry point for NamedFramebufferDrawBuffer.
  main: Refactor _mesa_ReadBuffer.
  main: Add entry point for NamedFramebufferReadBuffer.
  main: Refactor DrawBuffers.
  main: Add entry point for NamedFramebufferDrawBuffers.

 docs/GL3.txt   |4 +-
 docs/relnotes/10.6.0.html  |1 +
 src/mapi/glapi/gen/ARB_direct_state_access.xml |  129 ++
 src/mapi/glapi/gen/ARB_framebuffer_object.xml  |2 +-
 src/mesa/drivers/common/driverfuncs.c  |2 +-
 src/mesa/drivers/common/meta.c |3 +-
 src/mesa/drivers/dri/i915/i830_vtbl.c  |4 +-
 src/mesa/drivers/dri/i915/i915_vtbl.c 

[Mesa-dev] [PATCH 44/57] mesa: Add ARB_direct_state_access checks in XFB functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/transformfeedback.c | 42 +++
 1 file changed, 42 insertions(+)

diff --git a/src/mesa/main/transformfeedback.c 
b/src/mesa/main/transformfeedback.c
index 103011c..642fa96 100644
--- a/src/mesa/main/transformfeedback.c
+++ b/src/mesa/main/transformfeedback.c
@@ -706,6 +706,13 @@ _mesa_TransformFeedbackBufferBase(GLuint xfb, GLuint 
index, GLuint buffer)
struct gl_transform_feedback_object *obj;
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glTransformFeedbackBufferBase(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
obj = lookup_transform_feedback_object_err(ctx, xfb,
   "glTransformFeedbackBufferBase");
if(!obj) {
@@ -729,6 +736,13 @@ _mesa_TransformFeedbackBufferRange(GLuint xfb, GLuint 
index, GLuint buffer,
struct gl_transform_feedback_object *obj;
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glTransformFeedbackBufferRange(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
obj = lookup_transform_feedback_object_err(ctx, xfb,
   
"glTransformFeedbackBufferRange");
if(!obj) {
@@ -1045,6 +1059,13 @@ _mesa_CreateTransformFeedbacks(GLsizei n, GLuint *names)
 {
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glCreateTransformFeedbacks(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
create_transform_feedbacks(ctx, n, names, true);
 }
 
@@ -1215,6 +1236,13 @@ _mesa_GetTransformFeedbackiv(GLuint xfb, GLenum pname, 
GLint *param)
 struct gl_transform_feedback_object *obj;
 GET_CURRENT_CONTEXT(ctx);
 
+if (!ctx->Extensions.ARB_direct_state_access) {
+   _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glGetTransformFeedbackiv(GL_ARB_direct_state_access "
+   "is not supported)");
+   return;
+}
+
 obj = lookup_transform_feedback_object_err(ctx, xfb,
"glGetTransformFeedbackiv");
 if(!obj) {
@@ -1241,6 +1269,13 @@ _mesa_GetTransformFeedbacki_v(GLuint xfb, GLenum pname, 
GLuint index,
struct gl_transform_feedback_object *obj;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glGetTransformFeedbacki_v(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
obj = lookup_transform_feedback_object_err(ctx, xfb,
   "glGetTransformFeedbacki_v");
if(!obj) {
@@ -1270,6 +1305,13 @@ _mesa_GetTransformFeedbacki64_v(GLuint xfb, GLenum 
pname, GLuint index,
struct gl_transform_feedback_object *obj;
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glGetTransformFeedbacki64_v(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
obj = lookup_transform_feedback_object_err(ctx, xfb,
   "glGetTransformFeedbacki64_v");
if(!obj) {
-- 
2.1.4

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


[Mesa-dev] [PATCH 45/57] mesa: Add ARB_direct_state_access checks in buffer object functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/bufferobj.c | 105 ++
 1 file changed, 105 insertions(+)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 66dee68..660bc94 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1303,6 +1303,12 @@ create_buffers(GLsizei n, GLuint *buffers, bool dsa)
 
const char *func = dsa ? "glCreateBuffers" : "glGenBuffers";
 
+   if (dsa && !ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "%s(GL_ARB_direct_state_access is not supported)", func);
+  return;
+   }
+
if (MESA_VERBOSE & VERBOSE_API)
   _mesa_debug(ctx, "%s(%d)\n", func, n);
 
@@ -1477,6 +1483,13 @@ _mesa_NamedBufferStorage(GLuint buffer, GLsizeiptr size, 
const GLvoid *data,
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glNamedBufferStorage(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glNamedBufferStorage");
if (!bufObj)
   return;
@@ -1603,6 +1616,13 @@ _mesa_NamedBufferData(GLuint buffer, GLsizeiptr size, 
const GLvoid *data,
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glNamedBufferData(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glNamedBufferData");
if (!bufObj)
   return;
@@ -1673,6 +1693,13 @@ _mesa_NamedBufferSubData(GLuint buffer, GLintptr offset,
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glNamedBufferSubData(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glNamedBufferSubData");
if (!bufObj)
   return;
@@ -1710,6 +1737,13 @@ _mesa_GetNamedBufferSubData(GLuint buffer, GLintptr 
offset,
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glGetNamedBufferSubData(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
"glGetNamedBufferSubData");
if (!bufObj)
@@ -1805,6 +1839,13 @@ _mesa_ClearNamedBufferData(GLuint buffer, GLenum 
internalformat,
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glClearNamedBufferData(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glClearNamedBufferData");
if (!bufObj)
   return;
@@ -1842,6 +1883,13 @@ _mesa_ClearNamedBufferSubData(GLuint buffer, GLenum 
internalformat,
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glClearNamedBufferSubData(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
"glClearNamedBufferSubData");
if (!bufObj)
@@ -1930,6 +1978,13 @@ _mesa_UnmapNamedBuffer(GLuint buffer)
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glUnmapNamedBuffer(GL_ARB_direct_state_access "
+  "is not supported)");
+  return GL_FALSE;
+   }
+
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer, "glUnmapNamedBuffer");
if (!bufObj)
   return GL_FALSE;
@@ -2039,6 +2094,13 @@ _mesa_GetNamedBufferParameteriv(GLuint buffer, GLenum 
pname, GLint *params)
struct gl_buffer_object *bufObj;
GLint64 parameter;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glGetNamedBufferParameteriv(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
bufObj = _mesa_lookup_bufferobj_err(ctx, buffer,
"glGetNamedBufferParameteriv");
if (!bufObj)
@@ -2059,6 +2121,13 @@ _mesa_GetNamedBufferParameteri64v(GLuint buffer, GLenum 
pname,
struct gl_buffer_object *bufObj;
GLint64 parameter;
 

[Mesa-dev] [PATCH 42/57] mesa: Add an extension flag for ARB_direct_state_access

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/extensions.c | 2 +-
 src/mesa/main/mtypes.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index f7ce064..c82416a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -104,7 +104,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_depth_clamp", o(ARB_depth_clamp), 
GL, 2003 },
{ "GL_ARB_depth_texture",   o(ARB_depth_texture),   
GLL,2001 },
{ "GL_ARB_derivative_control",  o(ARB_derivative_control),  
GL, 2014 },
-   { "GL_ARB_direct_state_access", o(dummy_false), 
GL, 2014 },
+   { "GL_ARB_direct_state_access", o(ARB_direct_state_access), 
GL, 2014 },
{ "GL_ARB_draw_buffers",o(dummy_true),  
GL, 2002 },
{ "GL_ARB_draw_buffers_blend",  o(ARB_draw_buffers_blend),  
GL, 2009 },
{ "GL_ARB_draw_elements_base_vertex",   
o(ARB_draw_elements_base_vertex),   GL, 2009 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 737f0be..8342517 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3621,6 +3621,7 @@ struct gl_extensions
GLboolean ARB_depth_clamp;
GLboolean ARB_depth_texture;
GLboolean ARB_derivative_control;
+   GLboolean ARB_direct_state_access;
GLboolean ARB_draw_buffers_blend;
GLboolean ARB_draw_elements_base_vertex;
GLboolean ARB_draw_indirect;
-- 
2.1.4

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


[Mesa-dev] [PATCH 27/57] main: Complete error conditions for glInvalidate*Framebuffer.

2015-05-11 Thread Fredrik Höglund
From: Laura Ekstrand 

Cc: "10.4 10.5" 
Reviewed-by: Fredrik Höglund 
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/fbobject.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 15878d3..7ba7255 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3650,12 +3650,29 @@ invalidate_framebuffer_storage(GLenum target, GLsizei 
numAttachments,
   return;
}
 
+   /* Section 17.4 Whole Framebuffer Operations of the OpenGL 4.5 Core
+* Spec (2.2.2015, PDF page 522) says:
+*"An INVALID_VALUE error is generated if numAttachments, width, or
+*height is negative."
+*/
if (numAttachments < 0) {
   _mesa_error(ctx, GL_INVALID_VALUE,
   "%s(numAttachments < 0)", name);
   return;
}
 
+   if (width < 0) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "%s(width < 0)", name);
+  return;
+   }
+
+   if (height < 0) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "%s(height < 0)", name);
+  return;
+   }
+
/* The GL_ARB_invalidate_subdata spec says:
 *
 * "If an attachment is specified that does not exist in the
@@ -3748,7 +3765,8 @@ invalidate_framebuffer_storage(GLenum target, GLsizei 
numAttachments,
return;
 
 invalid_enum:
-   _mesa_error(ctx, GL_INVALID_ENUM, "%s(attachment)", name);
+   _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid attachment %s)", name,
+   _mesa_lookup_enum_by_nr(attachments[i]));
return;
 }
 
-- 
2.1.4

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


[Mesa-dev] [PATCH 51/57] mesa: Add ARB_direct_state_access checks in program pipeline functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/pipelineobj.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/main/pipelineobj.c b/src/mesa/main/pipelineobj.c
index 0fefa7d..a33cdd1 100644
--- a/src/mesa/main/pipelineobj.c
+++ b/src/mesa/main/pipelineobj.c
@@ -553,6 +553,12 @@ _mesa_CreateProgramPipelines(GLsizei n, GLuint *pipelines)
 {
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION, "glCreateProgramPipelines("
+  "GL_ARB_direct_state_access is not supported)");
+  return;
+   }
+
create_program_pipelines(ctx, n, pipelines, true);
 }
 
-- 
2.1.4

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


[Mesa-dev] [PATCH 53/57] i915: Enable ARB_direct_state_access

2015-05-11 Thread Fredrik Höglund
This extension requires OpenGL 2.0, so enable the extension on
gen3 and later.

Signed-off-by: Fredrik Höglund 
---
 src/mesa/drivers/dri/i915/intel_extensions.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i915/intel_extensions.c 
b/src/mesa/drivers/dri/i915/intel_extensions.c
index ab7820f..590c6ef 100644
--- a/src/mesa/drivers/dri/i915/intel_extensions.c
+++ b/src/mesa/drivers/dri/i915/intel_extensions.c
@@ -83,6 +83,7 @@ intelInitExtensions(struct gl_context *ctx)
if (intel->gen >= 3) {
   ctx->Extensions.ARB_ES2_compatibility = true;
   ctx->Extensions.ARB_depth_texture = true;
+  ctx->Extensions.ARB_direct_state_access = true;
   ctx->Extensions.ARB_fragment_program = true;
   ctx->Extensions.ARB_shadow = true;
   ctx->Extensions.ARB_texture_non_power_of_two = true;
-- 
2.1.4

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


[Mesa-dev] [PATCH 56/57] docs: Update the ARB_direct_state_access status

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 docs/GL3.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 7a7c1bd..1b764ee 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -192,10 +192,10 @@ GL 4.5, GLSL 4.50:
   GL_ARB_conditional_render_inverted   DONE (i965, nv50, nvc0, 
llvmpipe, softpipe)
   GL_ARB_cull_distance not started
   GL_ARB_derivative_controlDONE (i965, nv50, nvc0, 
r600)
-  GL_ARB_direct_state_access   started
+  GL_ARB_direct_state_access   DONE (all drivers)
   - Transform Feedback object  DONE
   - Buffer object  DONE
-  - Framebuffer object started (Laura Ekstrand)
+  - Framebuffer object DONE
   - Renderbuffer objectDONE
   - Texture object DONE
   - Vertex array objectDONE
-- 
2.1.4

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


[Mesa-dev] [PATCH 54/57] i965: Enable ARB_direct_state_access

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c 
b/src/mesa/drivers/dri/i965/intel_extensions.c
index c3eee31..6e5d40d 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -183,6 +183,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_depth_buffer_float = true;
ctx->Extensions.ARB_depth_clamp = true;
ctx->Extensions.ARB_depth_texture = true;
+   ctx->Extensions.ARB_direct_state_access = true;
ctx->Extensions.ARB_draw_elements_base_vertex = true;
ctx->Extensions.ARB_draw_instanced = true;
ctx->Extensions.ARB_ES2_compatibility = true;
-- 
2.1.4

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


[Mesa-dev] [PATCH 43/57] mesa: Make GL_TEXTURE_CUBE_MAP valid in FramebufferTextureLayer

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/fbobject.c | 36 +++-
 1 file changed, 31 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 971dc68..c2bc081 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2704,9 +2704,9 @@ static bool
 check_texture_target(struct gl_context *ctx, GLenum target,
  const char *caller)
 {
-   /* We're being called by glFramebufferTextureLayer() and
-* textarget is not used.  The only legal texture types for
-* that function are 3D and 1D/2D arrays textures.
+   /* We're being called by glFramebufferTextureLayer().
+* The only legal texture types for that function are 3D,
+* cube-map, and 1D/2D/cube-map array textures.
 */
switch (target) {
case GL_TEXTURE_3D:
@@ -2715,6 +2715,11 @@ check_texture_target(struct gl_context *ctx, GLenum 
target,
case GL_TEXTURE_CUBE_MAP_ARRAY:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
   return true;
+   case GL_TEXTURE_CUBE_MAP:
+  /* This target is valid in TextureLayer when ARB_direct_state_access
+   * or OpenGL 4.5 is supported.
+   */
+  return ctx->Extensions.ARB_direct_state_access;
}
 
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2847,6 +2852,13 @@ check_layer(struct gl_context *ctx, GLenum target, GLint 
layer,
  return false;
   }
}
+   else if (target == GL_TEXTURE_CUBE_MAP) {
+  if (layer >= 6) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(layer %u >= 6)", caller, layer);
+ return false;
+  }
+   }
 
return true;
 }
@@ -3035,6 +3047,7 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum 
attachment,
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *fb;
struct gl_texture_object *texObj;
+   GLenum textarget = 0;
 
const char *func = "glFramebufferTextureLayer";
 
@@ -3060,9 +3073,15 @@ _mesa_FramebufferTextureLayer(GLenum target, GLenum 
attachment,
 
   if (!check_level(ctx, texObj->Target, level, func))
  return;
+
+  if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+ assert(layer >= 0 && layer < 6);
+ textarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer;
+ layer = 0;
+  }
}
 
-   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, 0, level,
+   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, textarget, level,
  layer, GL_FALSE, func);
 }
 
@@ -3074,6 +3093,7 @@ _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, 
GLenum attachment,
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *fb;
struct gl_texture_object *texObj;
+   GLenum textarget = 0;
 
const char *func = "glNamedFramebufferTextureLayer";
 
@@ -3095,9 +3115,15 @@ _mesa_NamedFramebufferTextureLayer(GLuint framebuffer, 
GLenum attachment,
 
   if (!check_level(ctx, texObj->Target, level, func))
  return;
+
+  if (texObj->Target == GL_TEXTURE_CUBE_MAP) {
+ assert(layer >= 0 && layer < 6);
+ textarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer;
+ layer = 0;
+  }
}
 
-   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, 0, level,
+   _mesa_framebuffer_texture(ctx, fb, attachment, texObj, textarget, level,
  layer, GL_FALSE, func);
 }
 
-- 
2.1.4

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


[Mesa-dev] [PATCH 50/57] mesa: Add ARB_direct_state_access checks in sampler object functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/samplerobj.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index a3aacc6..60711a5 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -221,6 +221,13 @@ void GLAPIENTRY
 _mesa_CreateSamplers(GLsizei count, GLuint *samplers)
 {
GET_CURRENT_CONTEXT(ctx);
+
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION, "glCreateSamplers("
+  "GL_ARB_direct_state_access is not supported)");
+  return;
+   }
+
create_samplers(ctx, count, samplers, "glCreateSamplers");
 }
 
-- 
2.1.4

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


[Mesa-dev] [PATCH 57/57] docs/relnotes: Mark off ARB_direct_state_access for 10.6

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 docs/relnotes/10.6.0.html | 1 +
 1 file changed, 1 insertion(+)

diff --git a/docs/relnotes/10.6.0.html b/docs/relnotes/10.6.0.html
index b7cd486..7fbf702 100644
--- a/docs/relnotes/10.6.0.html
+++ b/docs/relnotes/10.6.0.html
@@ -48,6 +48,7 @@ Note: some of the new features are only available with 
certain drivers.
 GL_ARB_clip_control on i965
 GL_ARB_depth_buffer_float on freedreno
 GL_ARB_depth_clamp on freedreno
+GL_ARB_direct_state_access on all drivers
 GL_ARB_draw_indirect, GL_ARB_multi_draw_indirect on r600
 GL_ARB_draw_instanced on freedreno
 GL_ARB_gpu_shader_fp64 on nvc0, softpipe
-- 
2.1.4

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


[Mesa-dev] [PATCH 52/57] mesa: Add ARB_direct_state_access checks in query object functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/queryobj.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
index 5ff1b95..2784b4c 100644
--- a/src/mesa/main/queryobj.c
+++ b/src/mesa/main/queryobj.c
@@ -284,6 +284,13 @@ _mesa_CreateQueries(GLenum target, GLsizei n, GLuint *ids)
 {
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glCreateQueries(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
switch (target) {
case GL_SAMPLES_PASSED:
case GL_ANY_SAMPLES_PASSED:
-- 
2.1.4

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


[Mesa-dev] [PATCH 49/57] mesa: Add ARB_direct_state_access checks in VAO functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/arrayobj.c | 22 +
 src/mesa/main/varray.c   | 64 
 2 files changed, 86 insertions(+)

diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 7c40040..320f435 100644
--- a/src/mesa/main/arrayobj.c
+++ b/src/mesa/main/arrayobj.c
@@ -617,6 +617,14 @@ void GLAPIENTRY
 _mesa_CreateVertexArrays(GLsizei n, GLuint *arrays)
 {
GET_CURRENT_CONTEXT(ctx);
+
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glCreateVertexArrays(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
gen_vertex_arrays(ctx, n, arrays, true, "glCreateVertexArrays");
 }
 
@@ -659,6 +667,13 @@ _mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer)
struct gl_vertex_array_object *vao;
struct gl_buffer_object *bufObj;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glVertexArrayElementBuffer(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
ASSERT_OUTSIDE_BEGIN_END(ctx);
 
/* The GL_ARB_direct_state_access specification says:
@@ -695,6 +710,13 @@ _mesa_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint 
*param)
 
ASSERT_OUTSIDE_BEGIN_END(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glGetVertexArrayiv(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
/* The GL_ARB_direct_state_access specification says:
 *
 *   "An INVALID_OPERATION error is generated if  is not
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 7389037..da6bbce 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -777,6 +777,13 @@ _mesa_EnableVertexArrayAttrib(GLuint vaobj, GLuint index)
GET_CURRENT_CONTEXT(ctx);
struct gl_vertex_array_object *vao;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glEnableVertexArrayAttrib(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
/* The ARB_direct_state_access specification says:
 *
 *   "An INVALID_OPERATION error is generated by EnableVertexArrayAttrib
@@ -830,6 +837,13 @@ _mesa_DisableVertexArrayAttrib(GLuint vaobj, GLuint index)
GET_CURRENT_CONTEXT(ctx);
struct gl_vertex_array_object *vao;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glDisableVertexArrayAttrib(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
/* The ARB_direct_state_access specification says:
 *
 *   "An INVALID_OPERATION error is generated by EnableVertexArrayAttrib
@@ -1094,6 +1108,13 @@ _mesa_GetVertexArrayIndexediv(GLuint vaobj, GLuint index,
GET_CURRENT_CONTEXT(ctx);
struct gl_vertex_array_object *vao;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glGetVertexArrayIndexediv(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
/* The ARB_direct_state_access specification says:
 *
 *"An INVALID_OPERATION error is generated if  is not
@@ -1157,6 +1178,14 @@ _mesa_GetVertexArrayIndexed64iv(GLuint vaobj, GLuint 
index,
GET_CURRENT_CONTEXT(ctx);
struct gl_vertex_array_object *vao;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glGetVertexArrayIndexed64iv(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
+
/* The ARB_direct_state_access specification says:
 *
 *"An INVALID_OPERATION error is generated if  is not
@@ -1745,6 +1774,13 @@ _mesa_VertexArrayVertexBuffer(GLuint vaobj, GLuint 
bindingIndex, GLuint buffer,
GET_CURRENT_CONTEXT(ctx);
struct gl_vertex_array_object *vao;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glVertexArrayVertexBuffer(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
/* The ARB_direct_state_access specification says:
 *
 *   "An INVALID_OPERATION error is generated by VertexArrayVertexBuffer
@@ -1910,6 +1946,14 @@ _mesa_VertexArrayVertexBuffers(GLuint vaobj, GLuint 
first, GLsizei count,
GET_CURRENT_CONTEXT(ctx);
struct gl_vertex_array_object *vao;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+   "glVertexArrayVertexBuffers(GL_ARB_direct_state_access "
+   "is not supported");
+  return;
+   }
+
+
/* The ARB_direct_st

[Mesa-dev] [PATCH 07/57] main: Require that the texture exists in framebuffer_texture

2015-05-11 Thread Fredrik Höglund
Generate GL_INVALID_OPERATION if the texture hasn't been created.

Cc: "10.4 10.5" 
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/fbobject.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 9486ded..4524e51 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2603,7 +2603,7 @@ framebuffer_texture(struct gl_context *ctx, const char 
*caller, GLenum target,
   GLboolean err = GL_TRUE;
 
   texObj = _mesa_lookup_texture(ctx, texture);
-  if (texObj != NULL) {
+  if (texObj != NULL && texObj->Target != 0) {
  if (textarget == 0) {
 if (layered) {
/* We're being called by glFramebufferTexture() and textarget
-- 
2.1.4

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


[Mesa-dev] [PATCH 46/57] mesa: Add ARB_direct_state_access checks in FBO functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/blit.c |  7 +
 src/mesa/main/buffers.c  | 21 +++
 src/mesa/main/clear.c| 32 +++
 src/mesa/main/fbobject.c | 67 
 4 files changed, 127 insertions(+)

diff --git a/src/mesa/main/blit.c b/src/mesa/main/blit.c
index db8fee5..fac9724 100644
--- a/src/mesa/main/blit.c
+++ b/src/mesa/main/blit.c
@@ -540,6 +540,13 @@ _mesa_BlitNamedFramebuffer(GLuint readFramebuffer, GLuint 
drawFramebuffer,
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *readFb, *drawFb;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glBlitNamedFramebuffer(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
if (MESA_VERBOSE & VERBOSE_API)
   _mesa_debug(ctx,
   "glBlitNamedFramebuffer(%u %u %d, %d, %d, %d, "
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 0536266..c83459a 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -303,6 +303,13 @@ _mesa_NamedFramebufferDrawBuffer(GLuint framebuffer, 
GLenum buf)
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *fb;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glNamedFramebufferDrawBuffer(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
if (framebuffer) {
   fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
 "glNamedFramebufferDrawBuffer");
@@ -513,6 +520,13 @@ _mesa_NamedFramebufferDrawBuffers(GLuint framebuffer, 
GLsizei n,
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *fb;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glNamedFramebufferDrawBuffers(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
if (framebuffer) {
   fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
 "glNamedFramebufferDrawBuffers");
@@ -750,6 +764,13 @@ _mesa_NamedFramebufferReadBuffer(GLuint framebuffer, 
GLenum src)
GET_CURRENT_CONTEXT(ctx);
struct gl_framebuffer *fb;
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glNamedFramebufferReadBuffer(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
if (framebuffer) {
   fb = _mesa_lookup_framebuffer_err(ctx, framebuffer,
 "glNamedFramebufferReadBuffer");
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 426caea..c6999f7 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -412,6 +412,14 @@ _mesa_ClearNamedFramebufferiv(GLuint framebuffer, GLenum 
buffer,
 {
GLint oldfb;
 
+   GET_CURRENT_CONTEXT(ctx);
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glClearNamedFramebufferiv(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
_mesa_GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldfb);
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer);
_mesa_ClearBufferiv(buffer, drawbuffer, value);
@@ -502,6 +510,14 @@ _mesa_ClearNamedFramebufferuiv(GLuint framebuffer, GLenum 
buffer,
 {
GLint oldfb;
 
+   GET_CURRENT_CONTEXT(ctx);
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glClearNamedFramebufferuiv(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
_mesa_GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldfb);
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer);
_mesa_ClearBufferuiv(buffer, drawbuffer, value);
@@ -613,6 +629,14 @@ _mesa_ClearNamedFramebufferfv(GLuint framebuffer, GLenum 
buffer,
 {
GLint oldfb;
 
+   GET_CURRENT_CONTEXT(ctx);
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glClearNamedFramebufferfv(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
_mesa_GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldfb);
_mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, framebuffer);
_mesa_ClearBufferfv(buffer, drawbuffer, value);
@@ -695,6 +719,14 @@ _mesa_ClearNamedFramebufferfi(GLuint framebuffer, GLenum 
buffer,
 {
GLint oldfb;
 
+   GET_CURRENT_CONTEXT(ctx);
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glClearNamedFramebufferfi(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
_mesa_GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &oldfb);
_mes

[Mesa-dev] [PATCH 47/57] mesa: Add ARB_direct_state_access checks in renderbuffer functions

2015-05-11 Thread Fredrik Höglund
Signed-off-by: Fredrik Höglund 
---
 src/mesa/main/fbobject.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 65e194c..8db651c 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1489,6 +1489,14 @@ void GLAPIENTRY
 _mesa_CreateRenderbuffers(GLsizei n, GLuint *renderbuffers)
 {
GET_CURRENT_CONTEXT(ctx);
+
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glCreateRenderbuffers(GL_ARB_direct_state_access "
+  "is not supported)");
+  return;
+   }
+
create_render_buffers(ctx, n, renderbuffers, true);
 }
 
@@ -1929,6 +1937,12 @@ renderbuffer_storage_named(GLuint renderbuffer, GLenum 
internalFormat,
 {
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "%s(GL_ARB_direct_state_access is not supported)", func);
+  return;
+   }
+
if (MESA_VERBOSE & VERBOSE_API) {
   if (samples == NO_SAMPLES)
  _mesa_debug(ctx, "%s(%u, %s, %d, %d)\n",
@@ -2183,6 +2197,13 @@ _mesa_GetNamedRenderbufferParameteriv(GLuint 
renderbuffer, GLenum pname,
 {
GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.ARB_direct_state_access) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+  "glGetNamedRenderbufferParameteriv("
+  "GL_ARB_direct_state_access is not supported)");
+  return;
+   }
+
struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, renderbuffer);
if (!rb || rb == &DummyRenderbuffer) {
   /* ID was reserved, but no real renderbuffer object made yet */
-- 
2.1.4

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


Re: [Mesa-dev] [PATCH 4/9] egl/wayland: Add support for render-nodes

2015-05-11 Thread Axel Davy

Le 11/05/2015 17:42, Matt Turner a écrit :

On Sat, May 9, 2015 at 4:20 AM, Axel Davy  wrote:

for drmGetNodeTypeFromFd, it looks like a very recent libdrm function, and
we would require libdrm 2.4.60, which is quite recent. Currently mesa
requires 2.4.38, when libdrm is needed. I guess we cannot require 2.4.60 for
now.

Sure you can. libdrm dependencies aren't a problem.

As libdrm 2.4.60 is very recent, and I didn't want cause problems 
(especially so close to the merge window),

I've pushed the patches without drmGetNodeTypeFromFd.

The code can be modified later to use it.

Yours,

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


Re: [Mesa-dev] [PATCH 4/9] egl/wayland: Add support for render-nodes

2015-05-11 Thread Matt Turner
On Mon, May 11, 2015 at 10:38 AM, Axel Davy  wrote:
> Le 11/05/2015 17:42, Matt Turner a écrit :
>>
>> On Sat, May 9, 2015 at 4:20 AM, Axel Davy  wrote:
>>>
>>> for drmGetNodeTypeFromFd, it looks like a very recent libdrm function,
>>> and
>>> we would require libdrm 2.4.60, which is quite recent. Currently mesa
>>> requires 2.4.38, when libdrm is needed. I guess we cannot require 2.4.60
>>> for
>>> now.
>>
>> Sure you can. libdrm dependencies aren't a problem.
>>
> As libdrm 2.4.60 is very recent, and I didn't want cause problems
> (especially so close to the merge window),
> I've pushed the patches without drmGetNodeTypeFromFd.
>
> The code can be modified later to use it.
>
> Yours,
>
> Axel Davy

No, really. It's a non-issue. i965 *already requires* 2.4.60.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl: Remove skeleton implementation of EGL_MESA_screen_surface

2015-05-11 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Fri, May 1, 2015 at 5:35 PM, Adam Jackson  wrote:
> No backend wires this up to anything, and the extension spec has been
> marked obsolete for 4+ years.
>
> Signed-off-by: Adam Jackson 
> ---
>  include/EGL/eglmesaext.h  |  46 --
>  src/egl/main/Makefile.sources |   4 -
>  src/egl/main/eglapi.c | 278 
>  src/egl/main/eglapi.h |  31 
>  src/egl/main/eglconfig.c  |   4 -
>  src/egl/main/eglcurrent.c |   8 -
>  src/egl/main/egldisplay.h |   1 -
>  src/egl/main/eglfallbacks.c   |  18 ---
>  src/egl/main/eglmode.c| 357 
> --
>  src/egl/main/eglmode.h|  88 ---
>  src/egl/main/eglscreen.c  | 235 ---
>  src/egl/main/eglscreen.h  | 117 --
>  src/egl/main/eglsurface.c |  55 ---
>  13 files changed, 1242 deletions(-)
>  delete mode 100644 src/egl/main/eglmode.c
>  delete mode 100644 src/egl/main/eglmode.h
>  delete mode 100644 src/egl/main/eglscreen.c
>  delete mode 100644 src/egl/main/eglscreen.h
>
> diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h
> index 595babd..d344e7c 100644
> --- a/include/EGL/eglmesaext.h
> +++ b/include/EGL/eglmesaext.h
> @@ -34,52 +34,6 @@ extern "C" {
>
>  #include 
>
> -/* EGL_MESA_screen extension  >>> PRELIMINARY <<< */
> -#ifndef EGL_MESA_screen_surface
> -#define EGL_MESA_screen_surface 1
> -
> -#define EGL_BAD_SCREEN_MESA0x4000
> -#define EGL_BAD_MODE_MESA  0x4001
> -#define EGL_SCREEN_COUNT_MESA  0x4002
> -#define EGL_SCREEN_POSITION_MESA   0x4003
> -#define EGL_SCREEN_POSITION_GRANULARITY_MESA   0x4004
> -#define EGL_MODE_ID_MESA   0x4005
> -#define EGL_REFRESH_RATE_MESA  0x4006
> -#define EGL_OPTIMAL_MESA   0x4007
> -#define EGL_INTERLACED_MESA0x4008
> -#define EGL_SCREEN_BIT_MESA0x08
> -
> -typedef khronos_uint32_t EGLScreenMESA;
> -typedef khronos_uint32_t EGLModeMESA;
> -
> -#ifdef EGL_EGLEXT_PROTOTYPES
> -EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, 
> EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint 
> modes_size, EGLint *num_modes);
> -EGLAPI EGLBoolean EGLAPIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA 
> screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
> -EGLAPI EGLBoolean EGLAPIENTRY eglGetModeAttribMESA(EGLDisplay dpy, 
> EGLModeMESA mode, EGLint attribute, EGLint *value);
> -EGLAPI EGLBoolean EGLAPIENTRY eglGetScreensMESA(EGLDisplay dpy, 
> EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
> -EGLAPI EGLSurface EGLAPIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, 
> EGLConfig config, const EGLint *attrib_list);
> -EGLAPI EGLBoolean EGLAPIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, 
> EGLint screen, EGLSurface surface, EGLModeMESA mode);
> -EGLAPI EGLBoolean EGLAPIENTRY eglScreenPositionMESA(EGLDisplay dpy, 
> EGLScreenMESA screen, EGLint x, EGLint y);
> -EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenMESA(EGLDisplay dpy, 
> EGLScreenMESA screen, EGLint attribute, EGLint *value);
> -EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, 
> EGLScreenMESA screen, EGLSurface *surface);
> -EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, 
> EGLScreenMESA screen, EGLModeMESA *mode);
> -EGLAPI const char * EGLAPIENTRY eglQueryModeStringMESA(EGLDisplay dpy, 
> EGLModeMESA mode);
> -#endif /* EGL_EGLEXT_PROTOTYPES */
> -
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSEMODEMESA) (EGLDisplay dpy, 
> EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint 
> modes_size, EGLint *num_modes);
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMODESMESA) (EGLDisplay dpy, 
> EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint 
> *num_modes);
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGetModeATTRIBMESA) (EGLDisplay dpy, 
> EGLModeMESA mode, EGLint attribute, EGLint *value);
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSCRREENSMESA) (EGLDisplay dpy, 
> EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
> -typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESCREENSURFACEMESA) (EGLDisplay 
> dpy, EGLConfig config, const EGLint *attrib_list);
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSHOWSCREENSURFACEMESA) (EGLDisplay 
> dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSCREENPOSIITONMESA) (EGLDisplay dpy, 
> EGLScreenMESA screen, EGLint x, EGLint y);
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMESA) (EGLDisplay dpy, 
> EGLScreenMESA screen, EGLint attribute, EGLint *value);
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENSURFACEMESA) (EGLDisplay 
> dpy, EGLScreenMESA screen, EGLSurface *surface);
> -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMODEMESA) (EGLDisplay

Re: [Mesa-dev] [PATCH 09/13] util/list: Add list_empty and list_length functions

2015-05-11 Thread Neil Roberts
Ian Romanick  writes:

>> For what it's worth, I'm strongly in favour of using these
>> kernel-style lists instead of exec_list. The kernel ones seem much
>> less confusing.
>
> Huh? They're practically identical. The only difference is the
> kernel-style lists have a single sentinel node, and that node is
> impossible to identify "in a crowd." The exec_lists use two sentinel
> nodes, and those nodes have one pointer of overlapping storage (head
> and tail are the next and prev pointers of one node, and tail and
> tail_pred are the next and prev pointers of the other). I thought
> there was some ASCII art in list.h that showed this, but that appears
> to not be the case...

Yes, I understand how they work. But you have to admit that the magic of
making the end sentinel overlap with the head sentinel is a bit more
difficult to get your head around then just having a single sentinel. At
least personally I found that more confusing.

> This gives some convenience that you can walk through a list from any
> node in the list without having a pointer to the list itself. I don't
> know if we still do, but there used to be a few places where we took
> advantage of that.

Ok, that is a good point. However if we can't find any examples of where
we are doing this then maybe it isn't all that important. A counter
advantage of the kernel-style lists is that the sentinel is slightly
smaller (one fewer pointer). That might be an important consideration if
you're using them to build up a tree structure with a lot of lists, like
an AST.

However the main advantage for me is that saying “they're easy, they're
just like in the kernel and Wayland” is a lot more likely to have
meaning for someone than saying “they're just like on the Amiga”!

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


Re: [Mesa-dev] [PATCH] st/mesa: make sure to create a "clean" bool when doing i2b

2015-05-11 Thread Ilia Mirkin
Could any of the Gallium folk R-b this? It's been this way since Bryan
Cain introduced it... I don't think that there was a USNE/etc variant
at the time.

Also, what do people think of making b2i do INEG instead of AND? That
should allow implementations to fold the neg into instructions that
support it...

On Thu, May 7, 2015 at 12:44 AM, Jason Ekstrand  wrote:
> I know nothing about TGSI but this looks perfectly reasonable to me.
>
> Reviewed-by: Jason Ekstrand 
>
> On Wed, May 6, 2015 at 8:33 PM, Ilia Mirkin  wrote:
>> i2b has to work for all integers, not just 1. INEG would not necessarily
>> result with all bits set, which is something that other operations can
>> rely on by e.g. using AND (or INEG for b2i).
>>
>> Signed-off-by: Ilia Mirkin 
>> ---
>>
>> Found by observation. Noticed a weird pattern in the generated code,
>> which led up to this.
>>
>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
>> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> index 93671ba..8a591b9 100644
>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>> @@ -1941,7 +1941,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>>break;
>> case ir_unop_i2b:
>>if (native_integers)
>> - emit(ir, TGSI_OPCODE_INEG, result_dst, op[0]);
>> + emit(ir, TGSI_OPCODE_USNE, result_dst, op[0], 
>> st_src_reg_for_int(0));
>>else
>>   emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], 
>> st_src_reg_for_float(0.0));
>>break;
>> --
>> 2.3.6
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2 v3] i965: Use predicate enable bit for conditional rendering w/o stalling

2015-05-11 Thread Kenneth Graunke
On Monday, May 11, 2015 03:14:21 PM Neil Roberts wrote:
> Kenneth Graunke  writes:
> 
> > It might be nice to create a brw_load_register_mem64 function, for
> > symmetry with brw_store_register_mem64 - we might want to reuse it
> > elsewhere someday.
> 
> Ok, that sounds sensible.
> 
> > One interesting quirk: the two halves of your register write may land
> > in two separate batchbuffers, since it's done with two BEGIN_BATCH /
> > ADVANCE_BATCH blocks (each of which only reserves space for one LRM).
> 
> Ah right, yes, good point.
> 
> > */ goes on its own line, here and elsewhere.
> 
> Oops, yes.
> 
> >> +   } else {
> >> +  if (brw->ctx.Query.CondRenderQuery) {
> >> + perf_debug("Conditional rendering is implemented in software and 
> >> may "
> >> +"stall.\n");
> >> +  }
> >> +
> >> +  return _mesa_check_conditional_render(&brw->ctx);
> >
> > I'd put this in the same block as the perf_debug and just do 'return
> > true' here - we can save the function call and redundant query check in
> > the common case (and this is a really hot path).
> 
> Ok, sounds good.
> 
> >> @@ -333,6 +335,9 @@ intelInitExtensions(struct gl_context *ctx)
> >>   ctx->Extensions.ARB_transform_feedback2 = true;
> >>   ctx->Extensions.ARB_transform_feedback3 = true;
> >>   ctx->Extensions.ARB_transform_feedback_instanced = true;
> >> +
> >> + if (brw->intelScreen->cmd_parser_version >= 2)
> >> +brw->predicate.supported = true;
> >
> > So, this is insufficient for Haswell.  There was not a version bump when
> > it actually started working (I think Daniel assumed we didn't need it,
> > since we were already attempting to write registers ourselves.)
> >
> > I think the best plan of action is to submit a kernel patch bumping the
> > command parser version number to 4, then change this to:
> >
> >const int cmd_parser_version = brw->intelScreen->cmd_parser_version;
> >
> >if (cmd_parser_version >= (brw->is_haswell ? 4 : 2))
> >   brw->predicate.supported = true;
> 
> I don't think this is necessary. It's a bit hard to tell from the patch
> diff but this hunk is inside an if statement like this:
> 
>if (brw->gen >= 7) {
>   /* ... */
>   if (can_do_pipelined_register_writes(brw)) {
>  /* ... transform feedback stuff ... */
>  if (brw->intelScreen->cmd_parser_version >= 2)
> brw->predicate.supported = true;
>   }
>   /* ... */
>}
> 
> Therefore it will only try to use the predicate register if the command
> parser is at least version 2 *and* we can do register writes. I don't
> think there is any version of the kernel where this wouldn't correctly
> detect whether it can write to the predicate register.
> 
> If you agree with this then I'll post a v4 with all the other changes.
> In the meantime there is a WIP branch of it here:
> 
> https://github.com/bpeel/mesa/tree/wip/conditional-render
> 
> Many thanks for the detailed review.
> 
> Regards,
> - Neil

Ahh, I missed that it was in a can_do_pipelined_register_writes() block.
I agree - this should work out fine then.

I don't think you need to post a v4 - I looked through your branch, and
everything looks good.

Reviewed-by: Kenneth Graunke 


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


Re: [Mesa-dev] [PATCH v2] nir: fix sampler lowering pass for arrays

2015-05-11 Thread Jason Ekstrand
On Mon, May 11, 2015 at 4:50 AM, Tapani Pälli  wrote:
> This fixes bugs with special cases where we have arrays of
> structures containing samplers or arrays of samplers.
>
> I've verified that patch results in calculating same index value as
> returned by _mesa_get_sampler_uniform_value for IR. Patch makes
> following ES3 conformance test pass:
>
> ES3-CTS.shaders.struct.uniform.sampler_array_fragment
>
> v2: remove unnecessary comment (Topi)
> simplify changes and the overall code (Jason)

This looks way better!  Thanks for working on this Tapani!  Assuming
this passes piglit,

Reviewed-by: Jason Ekstrand 

> Signed-off-by: Tapani Pälli 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90114
> ---
>  src/glsl/nir/nir_lower_samplers.cpp | 31 ---
>  1 file changed, 12 insertions(+), 19 deletions(-)
>
> diff --git a/src/glsl/nir/nir_lower_samplers.cpp 
> b/src/glsl/nir/nir_lower_samplers.cpp
> index 8fc5909..7a0b0a0 100644
> --- a/src/glsl/nir/nir_lower_samplers.cpp
> +++ b/src/glsl/nir/nir_lower_samplers.cpp
> @@ -70,19 +70,22 @@ lower_sampler(nir_tex_instr *instr, const struct 
> gl_shader_program *shader_progr
>case nir_deref_type_array: {
>   nir_deref_array *deref_array = nir_deref_as_array(deref->child);
>
> + assert(deref_array->deref_array_type != 
> nir_deref_array_type_wildcard);
> +
> + if (deref_array->deref.child) {
> +ralloc_asprintf_append(&name, "[%u]",
> +   deref_array->deref_array_type == nir_deref_array_type_direct ?
> +  deref_array->base_offset : 0);
> + } else {
> +assert(deref->child->type->base_type == GLSL_TYPE_SAMPLER);
> +instr->sampler_index = deref_array->base_offset;
> + }
> +
>   /* XXX: We're assuming here that the indirect is the last array
>* thing we have.  This should be ok for now as we don't support
>* arrays_of_arrays yet.
>*/
> -
> - instr->sampler_index *= glsl_get_length(deref->type);
> - switch (deref_array->deref_array_type) {
> - case nir_deref_array_type_direct:
> -instr->sampler_index += deref_array->base_offset;
> -if (deref_array->deref.child)
> -   ralloc_asprintf_append(&name, "[%u]", 
> deref_array->base_offset);
> -break;
> - case nir_deref_array_type_indirect: {
> + if (deref_array->deref_array_type == nir_deref_array_type_indirect) 
> {
>  /* First, we have to resize the array of texture sources */
>  nir_tex_src *new_srcs = rzalloc_array(instr, nir_tex_src,
>instr->num_srcs + 1);
> @@ -106,16 +109,6 @@ lower_sampler(nir_tex_instr *instr, const struct 
> gl_shader_program *shader_progr
> &deref_array->indirect);
>
>  instr->sampler_array_size = glsl_get_length(deref->type);
> -
> -if (deref_array->deref.child)
> -   ralloc_strcat(&name, "[0]");
> -break;
> - }
> -
> - case nir_deref_array_type_wildcard:
> -unreachable("Cannot copy samplers");
> - default:
> -unreachable("Invalid deref array type");
>   }
>   break;
>}
> --
> 2.1.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/9] mesa/es3.1: Allow binding GL_DRAW_INDIRECT_BUFFER with gles 3.1

2015-05-11 Thread Ian Romanick
On 05/11/2015 08:23 AM, Ilia Mirkin wrote:
> On Mon, May 11, 2015 at 9:03 AM, Marta Lofstedt
>  wrote:
>> From: Marta Lofstedt 
>>
>> Signed-off-by: Marta Lofstedt 
>> ---
>>  src/mesa/main/bufferobj.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
>> index 66dee68..07f82cd 100644
>> --- a/src/mesa/main/bufferobj.c
>> +++ b/src/mesa/main/bufferobj.c
>> @@ -91,8 +91,9 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
>> case GL_COPY_WRITE_BUFFER:
>>return &ctx->CopyWriteBuffer;
>> case GL_DRAW_INDIRECT_BUFFER:
>> -  if (ctx->API == API_OPENGL_CORE &&
>> -  ctx->Extensions.ARB_draw_indirect) {
>> +  if ((ctx->API == API_OPENGL_CORE &&
>> +   ctx->Extensions.ARB_draw_indirect) ||
>> +   _mesa_is_gles31(ctx)) {
> 
> Similar to my comment on the other patch (and if this occurs in the
> other patches, I'd have the same comment there again). I think it's
> confusing, the way you're mixing things. Also it'll lead to backend
> drivers potentially receiving things they're not ready for. IMHO this
> should become
> 
> if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) &&
> ctx->Extensions.ARB_draw_indirect)

Before these patches were sent out for review, they were written in this
way.  I had suggested changing it to the current method.
GL_ARB_draw_indirect isn't an ES extension, so checking that case seemed
weird to me.

> Cheers,
> 
>   -ilia
> 
>>   return &ctx->DrawIndirectBuffer;
>>}
>>break;
>> --
>> 1.9.1
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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


Re: [Mesa-dev] [PATCH] egl: more define fixes for EGL_MESA_image_dma_buf_export

2015-05-11 Thread Emil Velikov
On 11 May 2015 at 14:23, Marc-André Lureau  wrote:
> s/EGL_MESA_dma_buf_image_export/EGL_MESA_image_dma_buf_export as defined by 
> the spec
> ---
>  src/egl/main/eglapi.c   | 2 +-
>  src/egl/main/eglfallbacks.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index ba1d0dd..6d2b51d 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -1245,7 +1245,7 @@ eglGetProcAddress(const char *procname)
>{ "eglCreatePlatformWindowSurfaceEXT", (_EGLProc) 
> eglCreatePlatformWindowSurfaceEXT },
>{ "eglCreatePlatformPixmapSurfaceEXT", (_EGLProc) 
> eglCreatePlatformPixmapSurfaceEXT },
>{ "eglGetSyncValuesCHROMIUM", (_EGLProc) eglGetSyncValuesCHROMIUM },
> -#ifdef EGL_MESA_dma_buf_image_export
> +#ifdef EGL_MESA_image_dma_buf_export
>{ "eglExportDMABUFImageQueryMESA", (_EGLProc) 
> eglExportDMABUFImageQueryMESA },
>{ "eglExportDMABUFImageMESA", (_EGLProc) eglExportDMABUFImageMESA },
>  #endif
> diff --git a/src/egl/main/eglfallbacks.c b/src/egl/main/eglfallbacks.c
> index 83d7756..ef65d2c 100644
> --- a/src/egl/main/eglfallbacks.c
> +++ b/src/egl/main/eglfallbacks.c
> @@ -120,7 +120,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
> drv->API.SwapBuffersRegionNOK = NULL;
>  #endif
>
> -#ifdef EGL_MESA_dma_buf_image_export
> +#ifdef EGL_MESA_image_dma_buf_export
> drv->API.ExportDMABUFImageQueryMESA = NULL;
> drv->API.ExportDMABUFImageMESA = NULL;
>  #endif
Considering how these can go (have been) subtly broken without many
people realising can we just nuke the #ifdef spaghetti ? I'm
suspecting that they are present in order to prevent build issues,
when the compiler picks up the non-mesa headers - egl{,ext}.h.

Wouldn't it be better to coerce the compiler to prioritise the mesa
headers over the rest ? GCC's -isystem and automake's nostdinc comes
to mind, but I never had the pleasure to work with either one.

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


Re: [Mesa-dev] [PATCH 1/9] mesa/es3.1: Allow binding GL_DRAW_INDIRECT_BUFFER with gles 3.1

2015-05-11 Thread Ilia Mirkin
On Mon, May 11, 2015 at 3:02 PM, Ian Romanick  wrote:
> On 05/11/2015 08:23 AM, Ilia Mirkin wrote:
>> On Mon, May 11, 2015 at 9:03 AM, Marta Lofstedt
>>  wrote:
>>> From: Marta Lofstedt 
>>>
>>> Signed-off-by: Marta Lofstedt 
>>> ---
>>>  src/mesa/main/bufferobj.c | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
>>> index 66dee68..07f82cd 100644
>>> --- a/src/mesa/main/bufferobj.c
>>> +++ b/src/mesa/main/bufferobj.c
>>> @@ -91,8 +91,9 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
>>> case GL_COPY_WRITE_BUFFER:
>>>return &ctx->CopyWriteBuffer;
>>> case GL_DRAW_INDIRECT_BUFFER:
>>> -  if (ctx->API == API_OPENGL_CORE &&
>>> -  ctx->Extensions.ARB_draw_indirect) {
>>> +  if ((ctx->API == API_OPENGL_CORE &&
>>> +   ctx->Extensions.ARB_draw_indirect) ||
>>> +   _mesa_is_gles31(ctx)) {
>>
>> Similar to my comment on the other patch (and if this occurs in the
>> other patches, I'd have the same comment there again). I think it's
>> confusing, the way you're mixing things. Also it'll lead to backend
>> drivers potentially receiving things they're not ready for. IMHO this
>> should become
>>
>> if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) &&
>> ctx->Extensions.ARB_draw_indirect)
>
> Before these patches were sent out for review, they were written in this
> way.  I had suggested changing it to the current method.
> GL_ARB_draw_indirect isn't an ES extension, so checking that case seemed
> weird to me.

Yeah, but we don't have GL vs GLES vs GLES3.1 driver API's. We just
have a single API, and the enable bit for "I can do indirect draws" is
that you set Extensions.ARB_draw_indirect to true. In a desktop GL
context, this also means that GL_ARB_draw_indirect is reported in the
extension string. I could easily imagine a hypothetical GLES ext that
could be enabled by the same bit (although there is none afaik).

Basically the question is what do we want to have happen when you have
a driver that doesn't quite support GL (ES) version X, but you use a
version override, and then try to use one of the features that version
X provides but the driver isn't quite ready for. Do you get a
(potential) library crash/otherwise inconsistent state? Or do you just
get an error at the API level (which the spec doesn't allow for, since
the feature is supposed to exist)?

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


Re: [Mesa-dev] [PATCH] egl: more define fixes for EGL_MESA_image_dma_buf_export

2015-05-11 Thread Emil Velikov
On 11 May 2015 at 20:07, Emil Velikov  wrote:
> On 11 May 2015 at 14:23, Marc-André Lureau  wrote:
>> s/EGL_MESA_dma_buf_image_export/EGL_MESA_image_dma_buf_export as defined by 
>> the spec
>> ---
>>  src/egl/main/eglapi.c   | 2 +-
>>  src/egl/main/eglfallbacks.c | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
>> index ba1d0dd..6d2b51d 100644
>> --- a/src/egl/main/eglapi.c
>> +++ b/src/egl/main/eglapi.c
>> @@ -1245,7 +1245,7 @@ eglGetProcAddress(const char *procname)
>>{ "eglCreatePlatformWindowSurfaceEXT", (_EGLProc) 
>> eglCreatePlatformWindowSurfaceEXT },
>>{ "eglCreatePlatformPixmapSurfaceEXT", (_EGLProc) 
>> eglCreatePlatformPixmapSurfaceEXT },
>>{ "eglGetSyncValuesCHROMIUM", (_EGLProc) eglGetSyncValuesCHROMIUM },
>> -#ifdef EGL_MESA_dma_buf_image_export
>> +#ifdef EGL_MESA_image_dma_buf_export
>>{ "eglExportDMABUFImageQueryMESA", (_EGLProc) 
>> eglExportDMABUFImageQueryMESA },
>>{ "eglExportDMABUFImageMESA", (_EGLProc) eglExportDMABUFImageMESA },
>>  #endif
>> diff --git a/src/egl/main/eglfallbacks.c b/src/egl/main/eglfallbacks.c
>> index 83d7756..ef65d2c 100644
>> --- a/src/egl/main/eglfallbacks.c
>> +++ b/src/egl/main/eglfallbacks.c
>> @@ -120,7 +120,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
>> drv->API.SwapBuffersRegionNOK = NULL;
>>  #endif
>>
>> -#ifdef EGL_MESA_dma_buf_image_export
>> +#ifdef EGL_MESA_image_dma_buf_export
>> drv->API.ExportDMABUFImageQueryMESA = NULL;
>> drv->API.ExportDMABUFImageMESA = NULL;
>>  #endif
> Considering how these can go (have been) subtly broken without many
> people realising can we just nuke the #ifdef spaghetti ? I'm
> suspecting that they are present in order to prevent build issues,
> when the compiler picks up the non-mesa headers - egl{,ext}.h.
>
> Wouldn't it be better to coerce the compiler to prioritise the mesa
> headers over the rest ? GCC's -isystem and automake's nostdinc comes
> to mind, but I never had the pleasure to work with either one.
>
^^ is not meant as an objection against the patch (if it ever come
across as such).

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


Re: [Mesa-dev] [PATCH] st/mesa: make sure to create a "clean" bool when doing i2b

2015-05-11 Thread Marek Olšák
Reviewed-by: Marek Olšák 

If there are no piglit regressions after switching b2i to INEG, then why not.

Marek

On Mon, May 11, 2015 at 8:38 PM, Ilia Mirkin  wrote:
> Could any of the Gallium folk R-b this? It's been this way since Bryan
> Cain introduced it... I don't think that there was a USNE/etc variant
> at the time.
>
> Also, what do people think of making b2i do INEG instead of AND? That
> should allow implementations to fold the neg into instructions that
> support it...
>
> On Thu, May 7, 2015 at 12:44 AM, Jason Ekstrand  wrote:
>> I know nothing about TGSI but this looks perfectly reasonable to me.
>>
>> Reviewed-by: Jason Ekstrand 
>>
>> On Wed, May 6, 2015 at 8:33 PM, Ilia Mirkin  wrote:
>>> i2b has to work for all integers, not just 1. INEG would not necessarily
>>> result with all bits set, which is something that other operations can
>>> rely on by e.g. using AND (or INEG for b2i).
>>>
>>> Signed-off-by: Ilia Mirkin 
>>> ---
>>>
>>> Found by observation. Noticed a weird pattern in the generated code,
>>> which led up to this.
>>>
>>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
>>> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> index 93671ba..8a591b9 100644
>>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> @@ -1941,7 +1941,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>>>break;
>>> case ir_unop_i2b:
>>>if (native_integers)
>>> - emit(ir, TGSI_OPCODE_INEG, result_dst, op[0]);
>>> + emit(ir, TGSI_OPCODE_USNE, result_dst, op[0], 
>>> st_src_reg_for_int(0));
>>>else
>>>   emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], 
>>> st_src_reg_for_float(0.0));
>>>break;
>>> --
>>> 2.3.6
>>>
>>> ___
>>> mesa-dev mailing list
>>> mesa-dev@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] clover: Refactor event::trigger and ::abort to prevent deadlock and reentrancy issues.

2015-05-11 Thread Tom Stellard
On Sat, May 09, 2015 at 04:42:29PM +0300, Francisco Jerez wrote:
> Refactor ::trigger and ::abort to split out the operations that access
> concurrently modified data members and require locking from the
> recursive and possibly re-entrant part of these methods.  This will
> avoid some deadlock situations when locking is implemented.

I've pushed the two bug-fixes that you reviewed, so this series should apply
cleanly to master now.

For the series:
Tested-by: Tom Stellard 

CC: stable should also be added to these.

Thanks,
Tom

> ---
>  src/gallium/state_trackers/clover/core/event.cpp | 43 
> +---
>  src/gallium/state_trackers/clover/core/event.hpp |  3 ++
>  2 files changed, 34 insertions(+), 12 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/clover/core/event.cpp 
> b/src/gallium/state_trackers/clover/core/event.cpp
> index 5579303..d03e0b4 100644
> --- a/src/gallium/state_trackers/clover/core/event.cpp
> +++ b/src/gallium/state_trackers/clover/core/event.cpp
> @@ -36,28 +36,47 @@ event::event(clover::context &ctx, const 
> ref_vector &deps,
>  event::~event() {
>  }
>  
> +std::vector>
> +event::trigger_self() {
> +   std::vector> evs;
> +
> +   if (!--wait_count)
> +  std::swap(_chain, evs);
> +
> +   return evs;
> +}
> +
>  void
>  event::trigger() {
> -   if (!--wait_count) {
> -  cv.notify_all();
> -  action_ok(*this);
> +   auto evs = trigger_self();
>  
> -  while (!_chain.empty()) {
> - _chain.back()().trigger();
> - _chain.pop_back();
> -  }
> +   if (signalled()) {
> +  action_ok(*this);
> +  cv.notify_all();
> }
> +
> +   for (event &ev : evs)
> +  ev.trigger();
> +}
> +
> +std::vector>
> +event::abort_self(cl_int status) {
> +   std::vector> evs;
> +
> +   _status = status;
> +   std::swap(_chain, evs);
> +
> +   return evs;
>  }
>  
>  void
>  event::abort(cl_int status) {
> -   _status = status;
> +   auto evs = abort_self(status);
> +
> action_fail(*this);
>  
> -   while (!_chain.empty()) {
> -  _chain.back()().abort(status);
> -  _chain.pop_back();
> -   }
> +   for (event &ev : evs)
> +  ev.abort(status);
>  }
>  
>  bool
> diff --git a/src/gallium/state_trackers/clover/core/event.hpp 
> b/src/gallium/state_trackers/clover/core/event.hpp
> index 0914842..f638c5b 100644
> --- a/src/gallium/state_trackers/clover/core/event.hpp
> +++ b/src/gallium/state_trackers/clover/core/event.hpp
> @@ -84,6 +84,9 @@ namespace clover {
>std::vector> deps;
>  
> private:
> +  std::vector> trigger_self();
> +  std::vector> abort_self(cl_int status);
> +
>unsigned wait_count;
>action action_ok;
>action action_fail;
> -- 
> 2.3.5
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] st/mesa: make sure to create a "clean" bool when doing i2b

2015-05-11 Thread Roland Scheidegger
Reviewed-by: Roland Scheidegger 

As for b2i I'm not really convinced using INEG is preferable there.
Generally I'd favor logic ops over arithmetic any day.
I suppose backend probably need to try to recognize such patterns anyway
for best performance (so that for instance things like b2i->i2b should
be no-ops), and I just don't see that INEG using AND instead would help
much there in general. But I don't really know...

Roland


Am 11.05.2015 um 20:38 schrieb Ilia Mirkin:
> Could any of the Gallium folk R-b this? It's been this way since Bryan
> Cain introduced it... I don't think that there was a USNE/etc variant
> at the time.
> 
> Also, what do people think of making b2i do INEG instead of AND? That
> should allow implementations to fold the neg into instructions that
> support it...
> 
> On Thu, May 7, 2015 at 12:44 AM, Jason Ekstrand  wrote:
>> I know nothing about TGSI but this looks perfectly reasonable to me.
>>
>> Reviewed-by: Jason Ekstrand 
>>
>> On Wed, May 6, 2015 at 8:33 PM, Ilia Mirkin  wrote:
>>> i2b has to work for all integers, not just 1. INEG would not necessarily
>>> result with all bits set, which is something that other operations can
>>> rely on by e.g. using AND (or INEG for b2i).
>>>
>>> Signed-off-by: Ilia Mirkin 
>>> ---
>>>
>>> Found by observation. Noticed a weird pattern in the generated code,
>>> which led up to this.
>>>
>>>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp 
>>> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> index 93671ba..8a591b9 100644
>>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> @@ -1941,7 +1941,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>>>break;
>>> case ir_unop_i2b:
>>>if (native_integers)
>>> - emit(ir, TGSI_OPCODE_INEG, result_dst, op[0]);
>>> + emit(ir, TGSI_OPCODE_USNE, result_dst, op[0], 
>>> st_src_reg_for_int(0));
>>>else
>>>   emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], 
>>> st_src_reg_for_float(0.0));
>>>break;
>>> --
>>> 2.3.6
>>>
>>> ___
>>> mesa-dev mailing list
>>> mesa-dev@lists.freedesktop.org
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=O4w34vxMqlqGFay7yc5k7qGagzc6zNfaCipZfxo8cyA&s=SmX-YkZSIqJwQTJEPqGJ_urIagfbgjrmYRNPZwrVf9I&e=
>>>  
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=O4w34vxMqlqGFay7yc5k7qGagzc6zNfaCipZfxo8cyA&s=SmX-YkZSIqJwQTJEPqGJ_urIagfbgjrmYRNPZwrVf9I&e=
>  
> 

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


Re: [Mesa-dev] [PATCH 1/9] mesa/es3.1: Allow binding GL_DRAW_INDIRECT_BUFFER with gles 3.1

2015-05-11 Thread Emil Velikov
On 11 May 2015 at 20:09, Ilia Mirkin  wrote:
> On Mon, May 11, 2015 at 3:02 PM, Ian Romanick  wrote:
>> On 05/11/2015 08:23 AM, Ilia Mirkin wrote:
>>> On Mon, May 11, 2015 at 9:03 AM, Marta Lofstedt
>>>  wrote:
 From: Marta Lofstedt 

 Signed-off-by: Marta Lofstedt 
 ---
  src/mesa/main/bufferobj.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index 66dee68..07f82cd 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -91,8 +91,9 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
 case GL_COPY_WRITE_BUFFER:
return &ctx->CopyWriteBuffer;
 case GL_DRAW_INDIRECT_BUFFER:
 -  if (ctx->API == API_OPENGL_CORE &&
 -  ctx->Extensions.ARB_draw_indirect) {
 +  if ((ctx->API == API_OPENGL_CORE &&
 +   ctx->Extensions.ARB_draw_indirect) ||
 +   _mesa_is_gles31(ctx)) {
>>>
>>> Similar to my comment on the other patch (and if this occurs in the
>>> other patches, I'd have the same comment there again). I think it's
>>> confusing, the way you're mixing things. Also it'll lead to backend
>>> drivers potentially receiving things they're not ready for. IMHO this
>>> should become
>>>
>>> if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) &&
>>> ctx->Extensions.ARB_draw_indirect)
>>
>> Before these patches were sent out for review, they were written in this
>> way.  I had suggested changing it to the current method.
>> GL_ARB_draw_indirect isn't an ES extension, so checking that case seemed
>> weird to me.
>
> Yeah, but we don't have GL vs GLES vs GLES3.1 driver API's. We just
> have a single API, and the enable bit for "I can do indirect draws" is
> that you set Extensions.ARB_draw_indirect to true. In a desktop GL
> context, this also means that GL_ARB_draw_indirect is reported in the
> extension string. I could easily imagine a hypothetical GLES ext that
> could be enabled by the same bit (although there is none afaik).
>
> Basically the question is what do we want to have happen when you have
> a driver that doesn't quite support GL (ES) version X, but you use a
> version override, and then try to use one of the features that version
> X provides but the driver isn't quite ready for. Do you get a
> (potential) library crash/otherwise inconsistent state? Or do you just
> get an error at the API level (which the spec doesn't allow for, since
> the feature is supposed to exist)?
>
A while back I was under the strange impression - the extension
booleans are set per API. Thankfully Marek and/or Brian, did point out
that they are meant as a capability flags, and the state-tracker
can/should check them accordingly. Perhaps one can even envision a way
to use GL_ARB_foo to implement a short cut internally :-)

For the purposes of glGetString(GL_EXTENSIONS) everything is handled
nicely (in src/mesa/main/extensions.c), and we never expose the
incorrect string to the user.

TLDR: I'm in favour of Ilia's suggestion.

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


[Mesa-dev] [PATCH] nvc0: do not expose MP counters for nvf0 (GK110+)

2015-05-11 Thread Samuel Pitoiset
This fixes a crash when trying to monitor MP counters because compute
support is not implemented for nvf0.

Reported-by: Ilia Mirkin 
Signed-off-by: Samuel Pitoiset 
---
 src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 89 +++
 1 file changed, 50 insertions(+), 39 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c 
b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
index 52032eb..74f210c 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
@@ -1407,11 +1407,14 @@ nvc0_screen_get_driver_query_info(struct pipe_screen 
*pscreen,
count += NVC0_QUERY_DRV_STAT_COUNT;
 
if (screen->base.device->drm_version >= 0x01000101) {
-  if (screen->base.class_3d >= NVE4_3D_CLASS) {
- count += NVE4_PM_QUERY_COUNT;
-  } else
   if (screen->compute) {
- count += NVC0_PM_QUERY_COUNT; /* NVC0_COMPUTE is not always enabled */
+ if (screen->base.class_3d == NVE4_3D_CLASS) {
+count += NVE4_PM_QUERY_COUNT;
+ } else
+ if (screen->base.class_3d < NVE4_3D_CLASS) {
+/* NVC0_COMPUTE is not always enabled */
+count += NVC0_PM_QUERY_COUNT;
+ }
   }
}
 
@@ -1437,19 +1440,21 @@ nvc0_screen_get_driver_query_info(struct pipe_screen 
*pscreen,
} else
 #endif
if (id < count) {
-  if (screen->base.class_3d >= NVE4_3D_CLASS) {
- info->name = nve4_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
- info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
- info->max_value.u64 =
-(id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? 0 : 100;
- info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
- return 1;
-  } else
   if (screen->compute) {
- info->name = nvc0_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
- info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
- info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
- return 1;
+ if (screen->base.class_3d == NVE4_3D_CLASS) {
+info->name = nve4_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
+info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
+info->max_value.u64 =
+   (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? 0 : 100;
+info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
+return 1;
+ } else
+ if (screen->base.class_3d < NVE4_3D_CLASS) {
+info->name = nvc0_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
+info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
+info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
+return 1;
+ }
   }
}
/* user asked for info about non-existing query */
@@ -1469,10 +1474,13 @@ nvc0_screen_get_driver_query_group_info(struct 
pipe_screen *pscreen,
 #endif
 
if (screen->base.device->drm_version >= 0x01000101) {
-  if (screen->base.class_3d >= NVE4_3D_CLASS) {
- count++;
-  } else if (screen->compute) {
- count++; /* NVC0_COMPUTE is not always enabled */
+  if (screen->compute) {
+ if (screen->base.class_3d == NVE4_3D_CLASS) {
+count++;
+ } else
+ if (screen->base.class_3d < NVE4_3D_CLASS) {
+count++; /* NVC0_COMPUTE is not always enabled */
+ }
   }
}
 
@@ -1480,25 +1488,28 @@ nvc0_screen_get_driver_query_group_info(struct 
pipe_screen *pscreen,
   return count;
 
if (id == NVC0_QUERY_MP_COUNTER_GROUP) {
-  info->name = "MP counters";
-  info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_GPU;
-
-  if (screen->base.class_3d >= NVE4_3D_CLASS) {
- info->num_queries = NVE4_PM_QUERY_COUNT;
-
-  /* On NVE4+, each multiprocessor have 8 hardware counters separated
-   * in two distinct domains, but we allow only one active query
-   * simultaneously because some of them use more than one hardware
-   * counter and this will result in an undefined behaviour. */
-  info->max_active_queries = 1; /* TODO: handle multiple hw counters */
-  return 1;
-  } else if (screen->compute) {
- info->num_queries = NVC0_PM_QUERY_COUNT;
-
- /* On NVC0:NVE4, each multiprocessor have 8 hardware counters
-  * in a single domain. */
- info->max_active_queries = 8;
- return 1;
+  if (screen->compute) {
+ info->name = "MP counters";
+ info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_GPU;
+
+ if (screen->base.class_3d == NVE4_3D_CLASS) {
+info->num_queries = NVE4_PM_QUERY_COUNT;
+
+ /* On NVE4+, each multiprocessor have 8 hardware counters 
separated
+  * in two distinct domains, but we allow only one active query
+  * simultaneously because some of them use more than one hardware
+  * counter and this will result in an undefined behaviour. */

Re: [Mesa-dev] [PATCH] st/mesa: make sure to create a "clean" bool when doing i2b

2015-05-11 Thread Ilia Mirkin
On Mon, May 11, 2015 at 3:29 PM, Roland Scheidegger  wrote:
> Reviewed-by: Roland Scheidegger 
>
> As for b2i I'm not really convinced using INEG is preferable there.
> Generally I'd favor logic ops over arithmetic any day.
> I suppose backend probably need to try to recognize such patterns anyway
> for best performance (so that for instance things like b2i->i2b should
> be no-ops), and I just don't see that INEG using AND instead would help
> much there in general. But I don't really know...

Well, there are a number of instructions that can take "neg" modifiers
(like add, mul, mad). None that can take "& 1" modifiers (although
and/etc can take "not" modifiers). By the time things get to gallium,
the bool-ness of variables is lost, so it can be tricky to figure if &
1 really means "b2i" or if it really means "random value & 1". I guess
bool's are always produced by comparisons, so you could just key it
off of whether the random value is produced by a set or not. [I'm
already planning a similar hack for "& 1.0", where the set instruction
can actually produce the 1.0 value directly if told so.]

I'm curious why you prefer bit manipulation over arithmetic? I have
the opposite preference...

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


Re: [Mesa-dev] [PATCH] nvc0: do not expose MP counters for nvf0 (GK110+)

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

The comments about nvc0 not always being enabled are a little
misplaced now... esp since now nvf0+ are also not enabled. But not a
big deal.

On Mon, May 11, 2015 at 3:36 PM, Samuel Pitoiset
 wrote:
> This fixes a crash when trying to monitor MP counters because compute
> support is not implemented for nvf0.
>
> Reported-by: Ilia Mirkin 
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/gallium/drivers/nouveau/nvc0/nvc0_query.c | 89 
> +++
>  1 file changed, 50 insertions(+), 39 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c 
> b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> index 52032eb..74f210c 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_query.c
> @@ -1407,11 +1407,14 @@ nvc0_screen_get_driver_query_info(struct pipe_screen 
> *pscreen,
> count += NVC0_QUERY_DRV_STAT_COUNT;
>
> if (screen->base.device->drm_version >= 0x01000101) {
> -  if (screen->base.class_3d >= NVE4_3D_CLASS) {
> - count += NVE4_PM_QUERY_COUNT;
> -  } else
>if (screen->compute) {
> - count += NVC0_PM_QUERY_COUNT; /* NVC0_COMPUTE is not always enabled 
> */
> + if (screen->base.class_3d == NVE4_3D_CLASS) {
> +count += NVE4_PM_QUERY_COUNT;
> + } else
> + if (screen->base.class_3d < NVE4_3D_CLASS) {
> +/* NVC0_COMPUTE is not always enabled */
> +count += NVC0_PM_QUERY_COUNT;
> + }
>}
> }
>
> @@ -1437,19 +1440,21 @@ nvc0_screen_get_driver_query_info(struct pipe_screen 
> *pscreen,
> } else
>  #endif
> if (id < count) {
> -  if (screen->base.class_3d >= NVE4_3D_CLASS) {
> - info->name = nve4_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
> - info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
> - info->max_value.u64 =
> -(id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? 0 : 100;
> - info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
> - return 1;
> -  } else
>if (screen->compute) {
> - info->name = nvc0_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
> - info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
> - info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
> - return 1;
> + if (screen->base.class_3d == NVE4_3D_CLASS) {
> +info->name = nve4_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
> +info->query_type = NVE4_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
> +info->max_value.u64 =
> +   (id < NVE4_PM_QUERY_METRIC_MP_OCCUPANCY) ? 0 : 100;
> +info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
> +return 1;
> + } else
> + if (screen->base.class_3d < NVE4_3D_CLASS) {
> +info->name = nvc0_pm_query_names[id - NVC0_QUERY_DRV_STAT_COUNT];
> +info->query_type = NVC0_PM_QUERY(id - NVC0_QUERY_DRV_STAT_COUNT);
> +info->group_id = NVC0_QUERY_MP_COUNTER_GROUP;
> +return 1;
> + }
>}
> }
> /* user asked for info about non-existing query */
> @@ -1469,10 +1474,13 @@ nvc0_screen_get_driver_query_group_info(struct 
> pipe_screen *pscreen,
>  #endif
>
> if (screen->base.device->drm_version >= 0x01000101) {
> -  if (screen->base.class_3d >= NVE4_3D_CLASS) {
> - count++;
> -  } else if (screen->compute) {
> - count++; /* NVC0_COMPUTE is not always enabled */
> +  if (screen->compute) {
> + if (screen->base.class_3d == NVE4_3D_CLASS) {
> +count++;
> + } else
> + if (screen->base.class_3d < NVE4_3D_CLASS) {
> +count++; /* NVC0_COMPUTE is not always enabled */
> + }
>}
> }
>
> @@ -1480,25 +1488,28 @@ nvc0_screen_get_driver_query_group_info(struct 
> pipe_screen *pscreen,
>return count;
>
> if (id == NVC0_QUERY_MP_COUNTER_GROUP) {
> -  info->name = "MP counters";
> -  info->type = PIPE_DRIVER_QUERY_GROUP_TYPE_GPU;
> -
> -  if (screen->base.class_3d >= NVE4_3D_CLASS) {
> - info->num_queries = NVE4_PM_QUERY_COUNT;
> -
> -  /* On NVE4+, each multiprocessor have 8 hardware counters separated
> -   * in two distinct domains, but we allow only one active query
> -   * simultaneously because some of them use more than one hardware
> -   * counter and this will result in an undefined behaviour. */
> -  info->max_active_queries = 1; /* TODO: handle multiple hw counters 
> */
> -  return 1;
> -  } else if (screen->compute) {
> - info->num_queries = NVC0_PM_QUERY_COUNT;
> -
> - /* On NVC0:NVE4, each multiprocessor have 8 hardware counters
> -  * in a single domain. */
> - info->max_active_queries = 8;
> - return 1;
> +  if (screen->compute) {
> + info->name = "MP counters";
> + info->type = PIPE_DRIVER

[Mesa-dev] [PATCH 1/2] radeon/vce: move CPB handling function into common code

2015-05-11 Thread Christian König
From: Christian König 

They are not firmware version dependent.

Signed-off-by: Christian König 
---
 src/gallium/drivers/radeon/radeon_vce.c| 38 ++
 src/gallium/drivers/radeon/radeon_vce.h|  7 +
 src/gallium/drivers/radeon/radeon_vce_40_2_2.c | 32 ++
 3 files changed, 48 insertions(+), 29 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_vce.c 
b/src/gallium/drivers/radeon/radeon_vce.c
index e220f40..9913c8b 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -183,6 +183,44 @@ static unsigned get_cpb_num(struct rvce_encoder *enc)
 }
 
 /**
+ * Get the slot for the currently encoded frame
+ */
+struct rvce_cpb_slot *current_slot(struct rvce_encoder *enc)
+{
+   return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.prev, list);
+}
+
+/**
+ * Get the slot for L0
+ */
+struct rvce_cpb_slot *l0_slot(struct rvce_encoder *enc)
+{
+   return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.next, list);
+}
+
+/**
+ * Get the slot for L1
+ */
+struct rvce_cpb_slot *l1_slot(struct rvce_encoder *enc)
+{
+   return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.next->next, 
list);
+}
+
+/**
+ * Calculate the offsets into the CPB
+ */
+void rvce_frame_offset(struct rvce_encoder *enc, struct rvce_cpb_slot *slot,
+  unsigned *luma_offset, unsigned *chroma_offset)
+{
+   unsigned pitch = align(enc->luma->level[0].pitch_bytes, 128);
+   unsigned vpitch = align(enc->luma->npix_y, 16);
+   unsigned fsize = pitch * (vpitch + vpitch / 2);
+
+   *luma_offset = slot->index * fsize;
+   *chroma_offset = *luma_offset + pitch * vpitch;
+}
+
+/**
  * destroy this video encoder
  */
 static void rvce_destroy(struct pipe_video_codec *encoder)
diff --git a/src/gallium/drivers/radeon/radeon_vce.h 
b/src/gallium/drivers/radeon/radeon_vce.h
index 1cf0180..9fcaeca 100644
--- a/src/gallium/drivers/radeon/radeon_vce.h
+++ b/src/gallium/drivers/radeon/radeon_vce.h
@@ -104,6 +104,13 @@ struct rvce_encoder {
bool use_vui;
 };
 
+/* CPB handling functions */
+struct rvce_cpb_slot *current_slot(struct rvce_encoder *enc);
+struct rvce_cpb_slot *l0_slot(struct rvce_encoder *enc);
+struct rvce_cpb_slot *l1_slot(struct rvce_encoder *enc);
+void rvce_frame_offset(struct rvce_encoder *enc, struct rvce_cpb_slot *slot,
+  unsigned *luma_offset, unsigned *chroma_offset);
+
 struct pipe_video_codec *rvce_create_encoder(struct pipe_context *context,
 const struct pipe_video_codec 
*templat,
 struct radeon_winsys* ws,
diff --git a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c 
b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
index 0902957..51b17b5 100644
--- a/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
+++ b/src/gallium/drivers/radeon/radeon_vce_40_2_2.c
@@ -46,32 +46,6 @@
 
 static const unsigned profiles[7] = { 66, 77, 88, 100, 110, 122, 244 };
 
-static struct rvce_cpb_slot *current_slot(struct rvce_encoder *enc)
-{
-   return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.prev, list);
-}
-
-static struct rvce_cpb_slot *l0_slot(struct rvce_encoder *enc)
-{
-   return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.next, list);
-}
-
-static struct rvce_cpb_slot *l1_slot(struct rvce_encoder *enc)
-{
-   return LIST_ENTRY(struct rvce_cpb_slot, enc->cpb_slots.next->next, 
list);
-}
-
-static void frame_offset(struct rvce_encoder *enc, struct rvce_cpb_slot *slot,
-unsigned *luma_offset, unsigned *chroma_offset)
-{
-   unsigned pitch = align(enc->luma->level[0].pitch_bytes, 128);
-   unsigned vpitch = align(enc->luma->npix_y, 16);
-   unsigned fsize = pitch * (vpitch + vpitch / 2);
-
-   *luma_offset = slot->index * fsize;
-   *chroma_offset = *luma_offset + pitch * vpitch;
-}
-
 static void session(struct rvce_encoder *enc)
 {
RVCE_BEGIN(0x0001); // session cmd
@@ -369,7 +343,7 @@ static void encode(struct rvce_encoder *enc)
if(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_P ||
   enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_B) {
struct rvce_cpb_slot *l0 = l0_slot(enc);
-   frame_offset(enc, l0, &luma_offset, &chroma_offset);
+   rvce_frame_offset(enc, l0, &luma_offset, &chroma_offset);
RVCE_CS(l0->picture_type); // encPicType
RVCE_CS(l0->frame_num); // frameNumber
RVCE_CS(l0->pic_order_cnt); // pictureOrderCount
@@ -395,7 +369,7 @@ static void encode(struct rvce_encoder *enc)
RVCE_CS(0x); // pictureStructure
if(enc->pic.picture_type == PIPE_H264_ENC_PICTURE_TYPE_B) {
struct rvce_cpb_slot *l1 = l1_slot(enc);
-   frame_offset(enc, l1, &luma_offset, &chroma_offset);
+   rvce_frame_offset(enc, l1, &luma_offset, &chroma_offs

[Mesa-dev] [PATCH 2/2] radeon/vce: adapt new firmware interface changes

2015-05-11 Thread Christian König
From: Christian König 

v2: make this also compatible with original released firmware
v3 (chk): switch to original idea of separate files for fw versions

Signed-off-by: Leo Liu 
Signed-off-by: Christian König 
Reviewed-by: Alex Deucher  (v2)
---
 src/gallium/drivers/radeon/Makefile.sources |   1 +
 src/gallium/drivers/radeon/radeon_vce.c |  22 ++-
 src/gallium/drivers/radeon/radeon_vce.h |   3 +
 src/gallium/drivers/radeon/radeon_vce_50.c  | 228 
 4 files changed, 252 insertions(+), 2 deletions(-)
 create mode 100644 src/gallium/drivers/radeon/radeon_vce_50.c

diff --git a/src/gallium/drivers/radeon/Makefile.sources 
b/src/gallium/drivers/radeon/Makefile.sources
index c655fe5..f63790c 100644
--- a/src/gallium/drivers/radeon/Makefile.sources
+++ b/src/gallium/drivers/radeon/Makefile.sources
@@ -12,6 +12,7 @@ C_SOURCES := \
radeon_uvd.c \
radeon_uvd.h \
radeon_vce_40_2_2.c \
+   radeon_vce_50.c \
radeon_vce.c \
radeon_vce.h \
radeon_video.c \
diff --git a/src/gallium/drivers/radeon/radeon_vce.c 
b/src/gallium/drivers/radeon/radeon_vce.c
index 9913c8b..a656737 100644
--- a/src/gallium/drivers/radeon/radeon_vce.c
+++ b/src/gallium/drivers/radeon/radeon_vce.c
@@ -44,6 +44,10 @@
 #include "radeon_video.h"
 #include "radeon_vce.h"
 
+#define FW_40_2_2 ((40 << 24) | (2 << 16) | (2 << 8))
+#define FW_50_0_1 ((50 << 24) | (0 << 16) | (1 << 8))
+#define FW_50_1_2 ((50 << 24) | (1 << 16) | (2 << 8))
+
 /**
  * flush commands to the hardware
  */
@@ -444,7 +448,19 @@ struct pipe_video_codec *rvce_create_encoder(struct 
pipe_context *context,
 
reset_cpb(enc);
 
-   radeon_vce_40_2_2_init(enc);
+   switch (rscreen->info.vce_fw_version) {
+   case FW_40_2_2:
+   radeon_vce_40_2_2_init(enc);
+   break;
+
+   case FW_50_0_1:
+   case FW_50_1_2:
+   radeon_vce_50_init(enc);
+   break;
+
+   default:
+   goto error;
+   }
 
return &enc->base;
 
@@ -464,5 +480,7 @@ error:
  */
 bool rvce_is_fw_version_supported(struct r600_common_screen *rscreen)
 {
-   return rscreen->info.vce_fw_version == ((40 << 24) | (2 << 16) | (2 << 
8));
+   return rscreen->info.vce_fw_version == FW_40_2_2 ||
+   rscreen->info.vce_fw_version == FW_50_0_1 ||
+   rscreen->info.vce_fw_version == FW_50_1_2;
 }
diff --git a/src/gallium/drivers/radeon/radeon_vce.h 
b/src/gallium/drivers/radeon/radeon_vce.h
index 9fcaeca..8319ef4 100644
--- a/src/gallium/drivers/radeon/radeon_vce.h
+++ b/src/gallium/drivers/radeon/radeon_vce.h
@@ -121,4 +121,7 @@ bool rvce_is_fw_version_supported(struct r600_common_screen 
*rscreen);
 /* init vce fw 40.2.2 specific callbacks */
 void radeon_vce_40_2_2_init(struct rvce_encoder *enc);
 
+/* init vce fw 50 specific callbacks */
+void radeon_vce_50_init(struct rvce_encoder *enc);
+
 #endif
diff --git a/src/gallium/drivers/radeon/radeon_vce_50.c 
b/src/gallium/drivers/radeon/radeon_vce_50.c
new file mode 100644
index 000..84a2bfb
--- /dev/null
+++ b/src/gallium/drivers/radeon/radeon_vce_50.c
@@ -0,0 +1,228 @@
+/**
+ *
+ * Copyright 2013 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ **/
+
+/*
+ * Authors:
+ *  Christian König 
+ *
+ */
+
+#include 
+
+#include "pipe/p_video_codec.h"
+
+#include "util/u_video.h"
+#include "util/u_memory.h"
+
+#include "vl/vl_video_buffer.h"
+
+#include "r600_pipe_common.h"
+#include "radeon_video.h"
+#include "radeon_vce.h"
+
+static void task_info(struct rvce_encoder *enc, uint32_t taskOperation)
+{
+   RVCE_BEGIN(0x0002); // task info
+   RVCE_CS(0x); // offsetOfNextTaskInfo
+ 

Re: [Mesa-dev] [PATCH] st/mesa: make sure to create a "clean" bool when doing i2b

2015-05-11 Thread Roland Scheidegger
Am 11.05.2015 um 21:38 schrieb Ilia Mirkin:
> On Mon, May 11, 2015 at 3:29 PM, Roland Scheidegger  
> wrote:
>> Reviewed-by: Roland Scheidegger 
>>
>> As for b2i I'm not really convinced using INEG is preferable there.
>> Generally I'd favor logic ops over arithmetic any day.
>> I suppose backend probably need to try to recognize such patterns anyway
>> for best performance (so that for instance things like b2i->i2b should
>> be no-ops), and I just don't see that INEG using AND instead would help
>> much there in general. But I don't really know...
> 
> Well, there are a number of instructions that can take "neg" modifiers
> (like add, mul, mad). None that can take "& 1" modifiers (although
> and/etc can take "not" modifiers). By the time things get to gallium,
> the bool-ness of variables is lost, so it can be tricky to figure if &
> 1 really means "b2i" or if it really means "random value & 1". I guess
> bool's are always produced by comparisons, so you could just key it
> off of whether the random value is produced by a set or not. [I'm
> already planning a similar hack for "& 1.0", where the set instruction
> can actually produce the 1.0 value directly if told so.]
> 
> I'm curious why you prefer bit manipulation over arithmetic? I have
> the opposite preference...
> 

That is mostly based on theory. bit-ops should be cheaper than
arithmetic (be it in terms of actual execution latency/throughput or if
not that in terms of energy needed for the computation at least). Of
course I may be biased here working on llvmpipe :-).
That said, since it's b2i using ineg may be quite reasonable, as the
result is going to be used as a int (hence somewhat likely you could
actually fold something with that negation). So I'm ok with that change
if you think it's better, though ideally we'd have some numbers how such
changes actually affect different drivers (like shader-db).

Roland

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


Re: [Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Ian Romanick
On 05/11/2015 07:57 AM, Ilia Mirkin wrote:
> On Mon, May 11, 2015 at 10:08 AM, Erik Faye-Lund  wrote:
>> On Mon, May 11, 2015 at 3:03 PM, Marta Lofstedt
>>  wrote:
>>> From: Marta Lofstedt 
>>>
>>> GLES 3.1 must be allowed to use multisampled
>>> frambuffer textures.
>>>
>>> Signed-off-by: Marta Lofstedt 
>>> ---
>>>  src/mesa/main/fbobject.c | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
>>> index 27cf97f..14a015e 100644
>>> --- a/src/mesa/main/fbobject.c
>>> +++ b/src/mesa/main/fbobject.c
>>> @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum 
>>> attachment,
>>>   break;
>>>case GL_TEXTURE_2D_MULTISAMPLE:
>>>case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
>>> - error = _mesa_is_gles(ctx)
>>> -|| !ctx->Extensions.ARB_texture_multisample;
>>> + error = (_mesa_is_gles(ctx)
>>> +|| !ctx->Extensions.ARB_texture_multisample) &&
>>> +!_mesa_is_gles31(ctx);
> 
> This seems correct. error = true when old condition, but not when
> es3.1 even if the old condition holds true. If the old condition is
> false, then the new addition doesn't matter.
> 
> Personally I would have written this as
> 
> error = _mesa_is_gles(ctx) && !mesa_is_gles31(ctx) ||
> !ctx->Extensions.ARB_texture_multisample;
> 
> The nice thing about this is that it will force an error even in the
> very hypothetical situation where a driver doesn't expose
> ARB_texture_multisample, but a GLES3.1 context was created (e.g. via
> an override flag).

I think this is a mis-feature.  Most of the ARB extensions are supersets
of the ES3.1 functionality, so we could someday have a driver that does
one but not the other.

>>>   break;
>>>default:
>>>   error = GL_TRUE;
>>
>> Shouldn't this be like this instead (and make sure
>> ARB_texture_multisample is enabled for ES3.1)?
>>
>> @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum
>> attachment,
>>   break;
>>case GL_TEXTURE_2D_MULTISAMPLE:
>>case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
>> - error = _mesa_is_gles(ctx)
>> -|| !ctx->Extensions.ARB_texture_multisample;
>> + error = !ctx->Extensions.ARB_texture_multisample;
> 
> error = false when you have a driver that supports texture_ms, but you
> have a gles1/2/3 context, whereas you wanted error = true there...
> 
>   -ilia
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 

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


Re: [Mesa-dev] [PATCH 9/9] mesa/es3.1: Pass sample count check for multisampled textures

2015-05-11 Thread Ian Romanick
On 05/11/2015 06:03 AM, Marta Lofstedt wrote:
> From: Marta Lofstedt 
> 
> For GLES 3.1 to support Multisample textures it needs
> to be able to pass the sample count test.
> 
> Signed-off-by: Marta Lofstedt 
> ---
>  src/mesa/main/multisample.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
> index 816837b..dd18365 100644
> --- a/src/mesa/main/multisample.c
> +++ b/src/mesa/main/multisample.c
> @@ -166,7 +166,7 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum 
> target,
>  * is greater than zero, then the error INVALID_OPERATION is 
> generated."
>  */
> if (_mesa_is_gles3(ctx) && _mesa_is_enum_format_integer(internalFormat)
> -   && samples > 0) {
> +   && samples > 0 && (!_mesa_is_gles31(ctx))) {

I think I would open-code this and add a comment.

   /* ...
*
* The restriction is relaxed in GLES 3.1.
*/
   if ((ctx->API == API_OPENGLES2 && ctx->Version == 30) && ...)

>return GL_INVALID_OPERATION;
> }
>  

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


Re: [Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Ilia Mirkin
On Mon, May 11, 2015 at 4:34 PM, Ian Romanick  wrote:
> On 05/11/2015 07:57 AM, Ilia Mirkin wrote:
>> On Mon, May 11, 2015 at 10:08 AM, Erik Faye-Lund  wrote:
>>> On Mon, May 11, 2015 at 3:03 PM, Marta Lofstedt
>>>  wrote:
 From: Marta Lofstedt 

 GLES 3.1 must be allowed to use multisampled
 frambuffer textures.

 Signed-off-by: Marta Lofstedt 
 ---
  src/mesa/main/fbobject.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

 diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
 index 27cf97f..14a015e 100644
 --- a/src/mesa/main/fbobject.c
 +++ b/src/mesa/main/fbobject.c
 @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum 
 attachment,
   break;
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
 - error = _mesa_is_gles(ctx)
 -|| !ctx->Extensions.ARB_texture_multisample;
 + error = (_mesa_is_gles(ctx)
 +|| !ctx->Extensions.ARB_texture_multisample) &&
 +!_mesa_is_gles31(ctx);
>>
>> This seems correct. error = true when old condition, but not when
>> es3.1 even if the old condition holds true. If the old condition is
>> false, then the new addition doesn't matter.
>>
>> Personally I would have written this as
>>
>> error = _mesa_is_gles(ctx) && !mesa_is_gles31(ctx) ||
>> !ctx->Extensions.ARB_texture_multisample;
>>
>> The nice thing about this is that it will force an error even in the
>> very hypothetical situation where a driver doesn't expose
>> ARB_texture_multisample, but a GLES3.1 context was created (e.g. via
>> an override flag).
>
> I think this is a mis-feature.  Most of the ARB extensions are supersets
> of the ES3.1 functionality, so we could someday have a driver that does
> one but not the other.

OK, well, I won't fight this further -- I think I've made my point,
and I believe you've understood it. Since you disagree, happy to let
it go.

I can't help but add though that in the situation where the ARB
extension is a superset in terms of actual backend driver
functionality, not just small frontend differences (e.g.
ARB_gpu_shader5), we should add more enables that allow the (in this
case) ES3.1 functionality. This enables a driver to be developed over
time and lets people use version overrides without resulting in
crashes or other driver weirdness.

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


Re: [Mesa-dev] [PATCH 6/9] mesa/es3.1: Allow Multisampled FrameBufferTextures

2015-05-11 Thread Ian Romanick
On 05/11/2015 01:43 PM, Ilia Mirkin wrote:
> On Mon, May 11, 2015 at 4:34 PM, Ian Romanick  wrote:
>> On 05/11/2015 07:57 AM, Ilia Mirkin wrote:
>>> On Mon, May 11, 2015 at 10:08 AM, Erik Faye-Lund  
>>> wrote:
 On Mon, May 11, 2015 at 3:03 PM, Marta Lofstedt
  wrote:
> From: Marta Lofstedt 
>
> GLES 3.1 must be allowed to use multisampled
> frambuffer textures.
>
> Signed-off-by: Marta Lofstedt 
> ---
>  src/mesa/main/fbobject.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 27cf97f..14a015e 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -2756,8 +2756,9 @@ _mesa_FramebufferTexture2D(GLenum target, GLenum 
> attachment,
>   break;
>case GL_TEXTURE_2D_MULTISAMPLE:
>case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> - error = _mesa_is_gles(ctx)
> -|| !ctx->Extensions.ARB_texture_multisample;
> + error = (_mesa_is_gles(ctx)
> +|| !ctx->Extensions.ARB_texture_multisample) &&
> +!_mesa_is_gles31(ctx);
>>>
>>> This seems correct. error = true when old condition, but not when
>>> es3.1 even if the old condition holds true. If the old condition is
>>> false, then the new addition doesn't matter.
>>>
>>> Personally I would have written this as
>>>
>>> error = _mesa_is_gles(ctx) && !mesa_is_gles31(ctx) ||
>>> !ctx->Extensions.ARB_texture_multisample;
>>>
>>> The nice thing about this is that it will force an error even in the
>>> very hypothetical situation where a driver doesn't expose
>>> ARB_texture_multisample, but a GLES3.1 context was created (e.g. via
>>> an override flag).
>>
>> I think this is a mis-feature.  Most of the ARB extensions are supersets
>> of the ES3.1 functionality, so we could someday have a driver that does
>> one but not the other.
> 
> OK, well, I won't fight this further -- I think I've made my point,
> and I believe you've understood it. Since you disagree, happy to let
> it go.
> 
> I can't help but add though that in the situation where the ARB
> extension is a superset in terms of actual backend driver
> functionality, not just small frontend differences (e.g.
> ARB_gpu_shader5), we should add more enables that allow the (in this
> case) ES3.1 functionality. This enables a driver to be developed over
> time and lets people use version overrides without resulting in
> crashes or other driver weirdness.

Perhaps.  Similar situations have been handled in a couple different
ways in the past.  Sometimes we'll add a more complex function to
determine whether something is enabled (e.g.,
_mesa_has_geometry_shaders).  Sometimes a driver will on enable a
certain extension for a certain kind of context (e.g., ARB_base_instance
in the i965 driver).  And there are other cases where we have multiple
extension bits (e.g., OES_texture_float).

>   -ilia

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


[Mesa-dev] Mesa 10.5.5

2015-05-11 Thread Emil Velikov
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mesa 10.5.5 is now available. This release includes a selection of i965 and
nouveau driver fixes. Everyone using a gallium driver (r300, r600 and others)
is also encouraged to update.


Boyan Ding (1):
  i965: Add XRGB format to intel_screen_make_configs

Emil Velikov (4):
  docs: Add sha256 sums for the 10.5.4 release
  r300: do not link against libdrm_intel
  Update version to 10.5.5
  Add release notes for the 10.5.5 release

Ilia Mirkin (4):
  nvc0/ir: flush denorms to zero in non-compute shaders
  gk110/ir: fix set with a register dest to not auto-set the abs flag
  nvc0/ir: fix predicated PFETCH emission
  nv50/ir: fix asFlow() const helper for OP_JOIN

Kenneth Graunke (2):
  i965: Make intel_emit_linear_blit handle Gen8+ alignment restrictions.
  i965: Disallow linear blits that are not cacheline aligned.

Roland Scheidegger (1):
  draw: fix prim ids when there's no gs



git tag: mesa-10.5.5

ftp://ftp.freedesktop.org/pub/mesa/10.5.5/mesa-10.5.5.tar.gz
MD5: 3021d8c0482294ced4c1ca6e9ea64478  mesa-10.5.5.tar.gz
SHA1: 0983b699538d4f096dbee78887ca4575c878e10a  mesa-10.5.5.tar.gz
SHA256: c10f00fd792b8290dd51ebcc48a9016c4cafab19ec205423c6fcadfd7f3a59f2  
mesa-10.5.5.tar.gz
PGP: ftp://ftp.freedesktop.org/pub/mesa/10.5.5/mesa-10.5.5.tar.gz.sig

ftp://ftp.freedesktop.org/pub/mesa/10.5.5/mesa-10.5.5.tar.xz
MD5: 5e6e182fd9414b74b95c45b4eda99fb5  mesa-10.5.5.tar.xz
SHA1: 367f78c244a34eeb5e8fc4531228166ea1118165  mesa-10.5.5.tar.xz
SHA256: 4ac4e4ea3414f1cadb1467f2f173f9e56170d31e8674f7953a46f0549d319f28  
mesa-10.5.5.tar.xz
PGP: ftp://ftp.freedesktop.org/pub/mesa/10.5.5/mesa-10.5.5.tar.xz.sig

- --
- -Emil

-BEGIN PGP SIGNATURE-
Version: GnuPG v2

iQIcBAEBAgAGBQJVUSxSAAoJEO2uN7As60kNwPIP/RbMo1lsEv+qpYr2iuMJG7By
T4JmZ9CRGlhmvg0cOcXaZBefZdSJDWR1pS354D2/Fc2F8HjLRNUxoRc9flmPX2Y+
nyLQmYKfLeaXZUOTP1dMJMz2dWgJmn5vF1U/umGQeHWaDvfT8ZG2SdmiwfZxWXdy
fDnciBVNkIsrVMYozmGUjJVUBC5npaCinl3zlNy8MNtv5TkKak4dkTz+F0BXApr3
qeHY45axp69iUiKP10r9a/w221IWTO2AHwW/wuLZCZAFnBr0ue0vz/hbaGGMyGAf
iD6IVB1x+3LWGRJB2eEFM/eF+3acWsVbsp9J4GAxhRATv53jf8a9GvdgJymU3sCr
kW6rfTmpFtZulGokp6epKuYQiQ4A3lYRDTnO1VqThuLSFRb2kqXxuF8mHOv+6vpG
AqcM88F3m9S71TKoKiaHALEe3b9hTSaEJJJj9DjZdlUBPjItTnaVdm3p1dbrKr8A
I9IMllkca+uZYn5uJlJgm4jYrOq4tkJYsWpvemlszxWwhT3cNORjUVNYMx5Sy5TE
UviYIVowyKOL5gyHRlsGrjmllFA0RGOpGW0pw1aWrWJQUIEXRhUq0VXHB7B6TA2R
mgE0GGW3oN9pM/w7T2vjQRGEdVCsZD9oxqaAaA4jscxygQFw+uhpGEpBARbsEQYr
WKGGKSmL1cgYCmX96qPB
=n8KX
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 90383] assembly enabled mesa crashes dota2

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

Sylvain BERTRAND  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

--- Comment #9 from Sylvain BERTRAND  ---
Well, the asm tls path is working 'ok', with only a few "Mesa: User error:
GL_INVALID_OPERATION in function(invalid call)".
It's the relevant code path anyway. Let's deal with this one for good.

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


Re: [Mesa-dev] [PATCH 08/29] i965/vec4: Introduce VEC4 IR builder.

2015-05-11 Thread Matt Turner
On Sat, May 2, 2015 at 8:29 AM, Francisco Jerez  wrote:
> See "i965/fs: Introduce FS IR builder." for the rationale.
>
> v2: Drop scalarizing VEC4 builder.

I think part of v2 was supposed to be dropping this whole patch. :)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/6] egl/main: cleanup function prototypes

2015-05-11 Thread Emil Velikov
Cleanup the function propotypes which were part of the previous EGL
drivers.

Signed-off-by: Emil Velikov 
---
 src/egl/main/egldriver.c |  4 
 src/egl/main/egldriver.h | 12 ++--
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 4cadbc7..6ef79d9 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -45,10 +45,6 @@
 #include "egldriver.h"
 #include "egllog.h"
 
-#ifdef _EGL_BUILT_IN_DRIVER_HAIKU
-_EGLDriver* _eglBuiltInDriverHaiku(const char* args);
-#endif
-
 typedef struct _egl_module {
char *Name;
_EGLMain_t BuiltIn;
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 11300ce..eac2187 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -87,19 +87,11 @@ struct _egl_driver
 
 
 extern _EGLDriver *
-_eglBuiltInDriverGALLIUM(const char *args);
-
-
-extern _EGLDriver *
 _eglBuiltInDriverDRI2(const char *args);
 
 
-extern _EGLDriver *
-_eglBuiltInDriverGLX(const char *args);
-
-
-extern _EGLDriver *
-_eglMain(const char *args);
+extern _EGLDriver*
+_eglBuiltInDriverHaiku(const char* args);
 
 
 extern _EGLDriver *
-- 
2.3.5

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


[Mesa-dev] [PATCH 4/6] egl: fix the EGL_MESA_image_dma_buf_export header declarations

2015-05-11 Thread Emil Velikov
Similar to other EGL extensions - guard the function prototypes by
EGL_EGLEXT_PROTOTYPES as the libEGL library does (should) not provide
the symbols statically.

Instead users should call eglGetProcAddress, which returns the function
pointer. The latter of which was missing the type declaration (typedef).

Dave, Marc-André,

I'm not sure if we have any users of these two new functions. If we do,
can we use eglGetProcAddress so that the things don't "explode" with
other EGL implementations.

Thanks

Cc: Dave Airlie 
Cc: Marc-André Lureau 
Signed-off-by: Emil Velikov 
---
 include/EGL/eglmesaext.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/EGL/eglmesaext.h b/include/EGL/eglmesaext.h
index 27cf7eb..40a60ec 100644
--- a/include/EGL/eglmesaext.h
+++ b/include/EGL/eglmesaext.h
@@ -127,10 +127,16 @@ typedef EGLBoolean (EGLAPIENTRYP 
PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EG
 #if KHRONOS_SUPPORT_INT64
 #ifndef EGL_MESA_image_dma_buf_export
 #define EGL_MESA_image_dma_buf_export 1
+#ifdef EGL_EGLEXT_PROTOTYPES
 EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, 
EGLImageKHR image, EGLint *fourcc, EGLint *nplanes, EGLuint64KHR *modifiers);
 EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, 
EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
 #endif
 #endif
+
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESA) (EGLDisplay 
dpy, EGLImageKHR image, EGLint *fourcc, EGLint *nplanes, EGLuint64KHR 
*modifiers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESA) (EGLDisplay dpy, 
EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
+
+#endif
 #ifdef __cplusplus
 }
 #endif
-- 
2.3.5

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


[Mesa-dev] [PATCH 3/6] egl/main: Update README.txt

2015-05-11 Thread Emil Velikov
The driver search/load is not done at eglGetDisplay (or eglOpenDisplay
as the readme called it) time, but during eglInitialize().

Drop _eglMain (available only for external drivers) reference. Mention
we use function(s), specific to the built-in driver(s).

Signed-off-by: Emil Velikov 
---
 src/egl/main/README.txt | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/egl/main/README.txt b/src/egl/main/README.txt
index b3d253d..1af9959 100644
--- a/src/egl/main/README.txt
+++ b/src/egl/main/README.txt
@@ -16,10 +16,10 @@ The EGL code here basically consists of two things:
 
 Bootstrapping:
 
-When the apps calls eglOpenDisplay() a device driver is selected and loaded
-(look for dlsym() or LoadLibrary() in egldriver.c).
+When the apps calls eglInitialize() a device driver is selected and loaded
+(look for _eglAddDrivers() and _eglLoadModule() in egldriver.c).
 
-The driver's _eglMain() function is then called.  This driver function
+The built-in driver's entry point function is then called.  This driver 
function
 allocates, initializes and returns a new _EGLDriver object (usually a
 subclass of that type).
 
@@ -30,10 +30,9 @@ driver->API.Initialize and driver->API.Terminate _must_ be 
implemented
 with driver-specific code (no default/fallback function is possible).
 
 
-A bit later, the app will call eglInitialize().  This will get routed
-to the driver->API.Initialize() function.  Any additional driver
-initialization that wasn't done in _eglMain() should be done at this
-point.  Typically, this will involve setting up visual configs, etc.
+Shortly after, the driver->API.Initialize() function is executed.  Any 
additional
+driver initialization that wasn't done in the driver entry point should be
+done at this point.  Typically, this will involve setting up visual configs, 
etc.
 
 
 
-- 
2.3.5

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


[Mesa-dev] [PATCH 5/6] egl/main: expose only core EGL functions statically

2015-05-11 Thread Emil Velikov
The EGL 1.3, 1.4 and 1.5 spec explicitly mentions that providing
static symbols for functions provided by EGL extensions is not portable.
Considering that relatively recently we've seen a non-mesa desktop EGL
implementation, the fact that we opt for such behaviour has gone
unnoticed.

To encourage devs against writing such non-portable code, let's hide the
symbols similar to the official binary driver from NVIDIA.

Gents,

Considering your experience with mesa and other vendors' EGL
implementations would you envision any conflicts that this may cause ?

Thanks

Cc: Brian Paul 
Cc: Chad Versace 
Cc: Daniel Kurtz 
Signed-off-by: Emil Velikov 
---
 src/egl/main/eglapi.c  | 265 ++---
 src/egl/main/egltypedefs.h |   2 -
 2 files changed, 132 insertions(+), 135 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 3f02c5c..9e6cb2f 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -270,7 +270,7 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay)
return _eglGetDisplayHandle(dpy);
 }
 
-EGLDisplay EGLAPIENTRY
+static EGLDisplay EGLAPIENTRY
 eglGetPlatformDisplayEXT(EGLenum platform, void *native_display,
  const EGLint *attrib_list)
 {
@@ -697,7 +697,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
 }
 
 
-EGLSurface EGLAPIENTRY
+static EGLSurface EGLAPIENTRY
 eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config,
   void *native_window,
   const EGLint *attrib_list)
@@ -750,7 +750,7 @@ eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
  attrib_list);
 }
 
-EGLSurface EGLAPIENTRY
+static EGLSurface EGLAPIENTRY
 eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config,
void *native_pixmap,
const EGLint *attrib_list)
@@ -921,7 +921,7 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
 
 #ifdef EGL_EXT_swap_buffers_with_damage
 
-EGLBoolean EGLAPIENTRY
+static EGLBoolean EGLAPIENTRY
 eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLSurface surface,
 EGLint *rects, EGLint n_rects)
 {
@@ -1108,117 +1108,9 @@ eglGetError(void)
 }
 
 
-__eglMustCastToProperFunctionPointerType EGLAPIENTRY
-eglGetProcAddress(const char *procname)
-{
-   static const struct {
-  const char *name;
-  _EGLProc function;
-   } egl_functions[] = {
-  /* core functions should not be queryable, but, well... */
-#ifdef _EGL_GET_CORE_ADDRESSES
-  /* alphabetical order */
-  { "eglBindAPI", (_EGLProc) eglBindAPI },
-  { "eglBindTexImage", (_EGLProc) eglBindTexImage },
-  { "eglChooseConfig", (_EGLProc) eglChooseConfig },
-  { "eglCopyBuffers", (_EGLProc) eglCopyBuffers },
-  { "eglCreateContext", (_EGLProc) eglCreateContext },
-  { "eglCreatePbufferFromClientBuffer", (_EGLProc) 
eglCreatePbufferFromClientBuffer },
-  { "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface },
-  { "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface },
-  { "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface },
-  { "eglDestroyContext", (_EGLProc) eglDestroyContext },
-  { "eglDestroySurface", (_EGLProc) eglDestroySurface },
-  { "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib },
-  { "eglGetConfigs", (_EGLProc) eglGetConfigs },
-  { "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext },
-  { "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay },
-  { "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface },
-  { "eglGetDisplay", (_EGLProc) eglGetDisplay },
-  { "eglGetError", (_EGLProc) eglGetError },
-  { "eglGetProcAddress", (_EGLProc) eglGetProcAddress },
-  { "eglInitialize", (_EGLProc) eglInitialize },
-  { "eglMakeCurrent", (_EGLProc) eglMakeCurrent },
-  { "eglQueryAPI", (_EGLProc) eglQueryAPI },
-  { "eglQueryContext", (_EGLProc) eglQueryContext },
-  { "eglQueryString", (_EGLProc) eglQueryString },
-  { "eglQuerySurface", (_EGLProc) eglQuerySurface },
-  { "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage },
-  { "eglReleaseThread", (_EGLProc) eglReleaseThread },
-  { "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib },
-  { "eglSwapBuffers", (_EGLProc) eglSwapBuffers },
-  { "eglSwapInterval", (_EGLProc) eglSwapInterval },
-  { "eglTerminate", (_EGLProc) eglTerminate },
-  { "eglWaitClient", (_EGLProc) eglWaitClient },
-  { "eglWaitGL", (_EGLProc) eglWaitGL },
-  { "eglWaitNative", (_EGLProc) eglWaitNative },
-#endif /* _EGL_GET_CORE_ADDRESSES */
-#ifdef EGL_MESA_drm_display
-  { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
-#endif
-  { "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR },
-  { "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR },
-  { "eglCreateSyncKHR", (_EGLProc) eglCr

[Mesa-dev] [PATCH 1/6] egl/main: drop support for external egl drivers

2015-05-11 Thread Emil Velikov
The only user (egl_gallium) is not longer around.

Signed-off-by: Emil Velikov 
---
 src/egl/main/egldriver.c | 364 ++-
 1 file changed, 13 insertions(+), 351 deletions(-)

diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 6983af9..4cadbc7 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -45,21 +45,13 @@
 #include "egldriver.h"
 #include "egllog.h"
 
-#if defined(_EGL_OS_UNIX)
-#include 
-#include 
-#include 
-#include 
-#endif
-
 #ifdef _EGL_BUILT_IN_DRIVER_HAIKU
 _EGLDriver* _eglBuiltInDriverHaiku(const char* args);
 #endif
 
 typedef struct _egl_module {
-   char *Path;
+   char *Name;
_EGLMain_t BuiltIn;
-   void *Handle;
_EGLDriver *Driver;
 } _EGLModule;
 
@@ -80,152 +72,23 @@ const struct {
 };
 
 /**
- * Wrappers for dlopen/dlclose()
- */
-#if defined(_EGL_OS_WINDOWS)
-
-
-typedef HMODULE lib_handle;
-
-static HMODULE
-open_library(const char *filename)
-{
-   return LoadLibrary(filename);
-}
-
-static void
-close_library(HMODULE lib)
-{
-   FreeLibrary(lib);
-}
-
-
-static const char *
-library_suffix(void)
-{
-   return ".dll";
-}
-
-
-#elif defined(_EGL_OS_UNIX)
-
-
-typedef void * lib_handle;
-
-static void *
-open_library(const char *filename)
-{
-   return dlopen(filename, RTLD_LAZY);
-}
-
-static void
-close_library(void *lib)
-{
-   dlclose(lib);
-}
-
-
-static const char *
-library_suffix(void)
-{
-   return ".so";
-}
-
-
-#endif
-
-
-/**
- * Open the named driver and find its bootstrap function: _eglMain().
- */
-static _EGLMain_t
-_eglOpenLibrary(const char *driverPath, lib_handle *handle)
-{
-   lib_handle lib;
-   _EGLMain_t mainFunc = NULL;
-   const char *error = "unknown error";
-
-   assert(driverPath);
-
-   _eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath);
-   lib = open_library(driverPath);
-
-#if defined(_EGL_OS_WINDOWS)
-   /* XXX untested */
-   if (lib)
-  mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
-#elif defined(_EGL_OS_UNIX)
-   if (lib) {
-  union {
- _EGLMain_t func;
- void *ptr;
-  } tmp = { NULL };
-  /* direct cast gives a warning when compiled with -pedantic */
-  tmp.ptr = dlsym(lib, "_eglMain");
-  mainFunc = tmp.func;
-  if (!mainFunc)
- error = dlerror();
-   }
-   else {
-  error = dlerror();
-   }
-#endif
-
-   if (!lib) {
-  _eglLog(_EGL_WARNING, "Could not open driver %s (%s)",
-  driverPath, error);
-  return NULL;
-   }
-
-   if (!mainFunc) {
-  _eglLog(_EGL_WARNING, "_eglMain not found in %s (%s)",
-  driverPath, error);
-  if (lib)
- close_library(lib);
-  return NULL;
-   }
-
-   *handle = lib;
-   return mainFunc;
-}
-
-
-/**
  * Load a module and create the driver object.
  */
 static EGLBoolean
 _eglLoadModule(_EGLModule *mod)
 {
-   _EGLMain_t mainFunc;
-   lib_handle lib;
_EGLDriver *drv;
 
if (mod->Driver)
   return EGL_TRUE;
 
-   if (mod->BuiltIn) {
-  lib = (lib_handle) NULL;
-  mainFunc = mod->BuiltIn;
-   }
-   else {
-  mainFunc = _eglOpenLibrary(mod->Path, &lib);
-  if (!mainFunc)
+   if (!mod->BuiltIn)
  return EGL_FALSE;
-   }
 
-   drv = mainFunc(NULL);
-   if (!drv) {
-  if (lib)
- close_library(lib);
+   drv = mod->BuiltIn(NULL);
+   if (!drv || !drv->Name)
   return EGL_FALSE;
-   }
-
-   if (!drv->Name) {
-  _eglLog(_EGL_WARNING, "Driver loaded from %s has no name", mod->Path);
-  drv->Name = "UNNAMED";
-   }
 
-   mod->Handle = (void *) lib;
mod->Driver = drv;
 
return EGL_TRUE;
@@ -243,20 +106,11 @@ _eglUnloadModule(_EGLModule *mod)
if (mod->Driver && mod->Driver->Unload)
   mod->Driver->Unload(mod->Driver);
 
-   /*
-* XXX At this point (atexit), the module might be the last reference to
-* libEGL.  Closing the module might unmap libEGL and give problems.
-*/
-#if 0
-   if (mod->Handle)
-  close_library(mod->Handle);
-#endif
 #elif defined(_EGL_OS_WINDOWS)
/* XXX Windows unloads DLLs before atexit */
 #endif
 
mod->Driver = NULL;
-   mod->Handle = NULL;
 }
 
 
@@ -264,7 +118,7 @@ _eglUnloadModule(_EGLModule *mod)
  * Add a module to the module array.
  */
 static _EGLModule *
-_eglAddModule(const char *path)
+_eglAddModule(const char *name)
 {
_EGLModule *mod;
EGLint i;
@@ -278,22 +132,22 @@ _eglAddModule(const char *path)
/* find duplicates */
for (i = 0; i < _eglModules->Size; i++) {
   mod = _eglModules->Elements[i];
-  if (strcmp(mod->Path, path) == 0)
+  if (strcmp(mod->Name, name) == 0)
  return mod;
}
 
/* allocate a new one */
mod = calloc(1, sizeof(*mod));
if (mod) {
-  mod->Path = _eglstrdup(path);
-  if (!mod->Path) {
+  mod->Name = _eglstrdup(name);
+  if (!mod->Name) {
  free(mod);
  mod = NULL;
   }
}
if (mod) {
   _eglAppendArray(_eglModules, (void *) mod);
-  _eglLog(_EGL_DEBUG, "added %s to module array"

Re: [Mesa-dev] [PATCH 6/6] egl: more define fixes for EGL_MESA_image_dma_buf_export

2015-05-11 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Tue, May 12, 2015 at 12:43 AM, Emil Velikov  wrote:
> From: Marc-André Lureau 
>
> s/EGL_MESA_dma_buf_image_export/EGL_MESA_image_dma_buf_export as defined by 
> the spec
> ---
>  src/egl/main/eglapi.c   | 2 +-
>  src/egl/main/eglfallbacks.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 9e6cb2f..e4d098c 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -1747,7 +1747,7 @@ eglGetProcAddress(const char *procname)
>{ "eglCreatePlatformWindowSurfaceEXT", (_EGLProc) 
> eglCreatePlatformWindowSurfaceEXT },
>{ "eglCreatePlatformPixmapSurfaceEXT", (_EGLProc) 
> eglCreatePlatformPixmapSurfaceEXT },
>{ "eglGetSyncValuesCHROMIUM", (_EGLProc) eglGetSyncValuesCHROMIUM },
> -#ifdef EGL_MESA_dma_buf_image_export
> +#ifdef EGL_MESA_image_dma_buf_export
>{ "eglExportDMABUFImageQueryMESA", (_EGLProc) 
> eglExportDMABUFImageQueryMESA },
>{ "eglExportDMABUFImageMESA", (_EGLProc) eglExportDMABUFImageMESA },
>  #endif
> diff --git a/src/egl/main/eglfallbacks.c b/src/egl/main/eglfallbacks.c
> index d12b849..c44ec6c 100644
> --- a/src/egl/main/eglfallbacks.c
> +++ b/src/egl/main/eglfallbacks.c
> @@ -102,7 +102,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
> drv->API.SwapBuffersRegionNOK = NULL;
>  #endif
>
> -#ifdef EGL_MESA_dma_buf_image_export
> +#ifdef EGL_MESA_image_dma_buf_export
> drv->API.ExportDMABUFImageQueryMESA = NULL;
> drv->API.ExportDMABUFImageMESA = NULL;
>  #endif
> --
> 2.3.5
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] egl/main: fix EGL_KHR_get_all_proc_addresses

2015-05-11 Thread Emil Velikov
The extension requires that the address of the core functions should be
available via eglGetProcAddress. Currently the list is guarded by
_EGL_GET_CORE_ADDRESSES, which was only set for the scons (windows)
build.

Unconditionally enable it for all the builds (automake, android and
haiku) considering that the extension is not platform specific and is
always enabled.

Chad,
I'm struggling to see if this was working at some point. I'm suspecting
that it was broken since the beginning - commit 7e8ba77c49b (egl: Expose
EGL_KHR_get_all_proc_addresses and its client extension) although I may
be missing something.

If the patch is correct should we just drop the guarding macro rather
than adding the defines into the build ?

Thanks

Cc: Chad Versace 
Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Emil Velikov 
---
 src/egl/main/Android.mk  | 1 +
 src/egl/main/Makefile.am | 1 +
 src/egl/main/SConscript  | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk
index 12b66d0..2a6f05e 100644
--- a/src/egl/main/Android.mk
+++ b/src/egl/main/Android.mk
@@ -39,6 +39,7 @@ include $(CLEAR_VARS)
 LOCAL_SRC_FILES := $(SOURCES)
 
 LOCAL_CFLAGS := \
+   -D_EGL_GET_CORE_ADDRESSES=1 \
-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID \
-D_EGL_DRIVER_SEARCH_DIR=\"/system/lib/egl\" \
-D_EGL_OS_UNIX=1
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index b661736..f976fc0 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -27,6 +27,7 @@ AM_CFLAGS = \
$(DEFINES) \
$(VISIBILITY_CFLAGS) \
$(EGL_CFLAGS) \
+   -D_EGL_GET_CORE_ADDRESSES=1 \
-D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \
-D_EGL_DRIVER_SEARCH_DIR=\"$(libdir)/egl\" \
-D_EGL_OS_UNIX=1
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index c001283..4f15888 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -12,6 +12,7 @@ env.Append(CPPDEFINES = [
 
 if env['platform'] == 'haiku':
 env.Append(CPPDEFINES = [
+'_EGL_GET_CORE_ADDRESSES',
 '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_HAIKU',
 '_EGL_OS_UNIX',
 '_EGL_BUILT_IN_DRIVER_HAIKU',
-- 
2.3.5

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


Re: [Mesa-dev] [PATCH 03/29] i965: Define consistent interface to disable control flow execution masking.

2015-05-11 Thread Matt Turner
On Tue, May 5, 2015 at 9:57 AM, Francisco Jerez  wrote:
> Kenneth Graunke  writes:
>
>> On Saturday, May 02, 2015 06:29:30 PM Francisco Jerez wrote:
>>> ---
>>>  src/mesa/drivers/dri/i965/brw_ir_fs.h   | 10 ++
>>>  src/mesa/drivers/dri/i965/brw_ir_vec4.h |  9 +
>>>  2 files changed, 19 insertions(+)
>>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h 
>>> b/src/mesa/drivers/dri/i965/brw_ir_fs.h
>>> index ce23fc5..6c65632 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
>>> +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
>>> @@ -258,4 +258,14 @@ public:
>>> bool pi_noperspective:1;   /**< Pixel interpolator noperspective flag */
>>>  };
>>>
>>> +/**
>>> + * Disable per-channel control flow execution masking on \p inst.
>>> + */
>>> +static inline fs_inst *
>>> +exec_all(fs_inst *inst)
>>> +{
>>> +   inst->force_writemask_all = true;
>>> +   return inst;
>>> +}
>>> +
>>>  #endif
>>> diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h 
>>> b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
>>> index 36a8224..48dd90f 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
>>> +++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
>>> @@ -192,6 +192,15 @@ public:
>>> }
>>>  };
>>>
>>> +/**
>>> + * Disable per-channel control flow execution masking on \p inst.
>>> + */
>>> +inline vec4_instruction *
>>> +exec_all(vec4_instruction *inst)
>>> +{
>>> +   inst->force_writemask_all = true;
>>> +   return inst;
>>> +}
>>>  } /* namespace brw */
>>>
>>>  #endif
>>>
>>
>> Patches 3-6 are:
>> Reviewed-by: Kenneth Graunke 
>>
> Thanks Ken.
>
>> Matt and I were confused about the "exec_" prefix in the functions
>> though - why "exec"?  "exec_all" makes a lot of sense here - execute on
>> all channels - but "exec_saturate" seems a little odd to me.
>>
>> Perhaps we can find a different prefix (or you can convince us).
>
> *Shrug*, I felt that e.g. saturate() alone would have been misleading
> because the function doesn't saturate a value by itself, instead it
> modifies the execution parameters of an instruction.  I'm open to
> suggestions if you can come up with a nicer prefix.

I think set_* would be better.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] Regarding X.Org Endless Vacation of Code

2015-05-11 Thread Anish Kanchan
I looked through the project ideas at
http://www.x.org/wiki/SummerOfCodeIdeas/ which seemed doable to me. I would
like to know more about the following projects -

1. Add support for performances counters in the profiling view
2. GL/GLSL tests for GL 4.0 and newer

I have worked on projects using C and OpenGL as a part of coursework in
college. Hence I feel I'll be able to work on these projects if I put
enough time in it.

I am also proficient in Java, Php, Javascript, HTML5 and CSS3 so if there
are any projects using these, I would love to look into them as well.

I plan to work on a project through EVoC during June and July if my
application gets accepted. So till then I would like to spend one month in
understanding the project, solving bugs and preparing a good application.


Kindly help.

Thanks and Regards,
Anish Kanchan
Student, University of Mumbai
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/6] egl/main: drop support for external egl drivers

2015-05-11 Thread Emil Velikov
On 11 May 2015 at 23:43, Emil Velikov  wrote:
> The only user (egl_gallium) is not longer around.
>
> Signed-off-by: Emil Velikov 
Seems like I goofed up the numbering - there is no patch 6/6 in the
series. I've picked up Marc-André Lureau's fix to silence the compiler
warnings.

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


Re: [Mesa-dev] Regarding X.Org Endless Vacation of Code

2015-05-11 Thread Emil Velikov
Hi Anish,

On 11 May 2015 at 20:47, Anish Kanchan  wrote:

> I looked through the project ideas at
> http://www.x.org/wiki/SummerOfCodeIdeas/ which seemed doable to me. I
> would like to know more about the following projects -
>
> 1. Add support for performances counters in the profiling view
>
I believe that there is a student working on this project as part of GSoC
2015. Personally I think that going for another project will be better,
although others might feel otherwise.


> 2. GL/GLSL tests for GL 4.0 and newer
>
> This topic has come across multiple times. The task entails that you pick
up an GL extension (or a few) that are used by GL 4.0+, read through the
spec test and write small piglit programs [1] which test the applicable
functionality. One is expected to confirm their tests against another
GL/GLSL implementation - i.e. run the programs on a GL 4.0+ capable
hardware using the Nvida/AMD binary drivers.

Note that there is a bit of a hurdle here on the patch review front. So you
would be expected interact with the community and find a person interested
in mentoring/reviewing your work.


> I have worked on projects using C and OpenGL as a part of coursework in
> college. Hence I feel I'll be able to work on these projects if I put
> enough time in it.
>
> I am also proficient in Java, Php, Javascript, HTML5 and CSS3 so if there
> are any projects using these, I would love to look into them as well.
>
> I plan to work on a project through EVoC during June and July if my
> application gets accepted. So till then I would like to spend one month in
> understanding the project, solving bugs and preparing a good application.
>
> According to the EVoC page [2] the student is expected to put three to
four months of work. Regardless I would encourage that you try and get a
better feel about the projects listed [3] and observe the direction of the
current X development. Chilling out in #dri-devel (at FreeNode) and
skimming through the dri-devel and mesa-dev mailing lists will help you
out. Once you have a better feel on the projects (or idea for another one)
just follow the guidelines [4] and submit a proposal.

I believe this information is enough to get you in the right direction.

Cheers,
Emil

[1] http://piglit.freedesktop.org/
[2] http://www.x.org/wiki/XorgEVoC/
[3] http://www.x.org/wiki/SummerOfCodeIdeas/
[4] http://www.x.org/wiki/GSoCApplication/
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 03/29] i965: Define consistent interface to disable control flow execution masking.

2015-05-11 Thread Kenneth Graunke
On Monday, May 11, 2015 05:12:41 PM Matt Turner wrote:
> On Tue, May 5, 2015 at 9:57 AM, Francisco Jerez  wrote:
> > Kenneth Graunke  writes:
> >
> >> On Saturday, May 02, 2015 06:29:30 PM Francisco Jerez wrote:
> >>> ---
> >>>  src/mesa/drivers/dri/i965/brw_ir_fs.h   | 10 ++
> >>>  src/mesa/drivers/dri/i965/brw_ir_vec4.h |  9 +
> >>>  2 files changed, 19 insertions(+)
> >>>
> >>> diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h 
> >>> b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> >>> index ce23fc5..6c65632 100644
> >>> --- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
> >>> +++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
> >>> @@ -258,4 +258,14 @@ public:
> >>> bool pi_noperspective:1;   /**< Pixel interpolator noperspective flag 
> >>> */
> >>>  };
> >>>
> >>> +/**
> >>> + * Disable per-channel control flow execution masking on \p inst.
> >>> + */
> >>> +static inline fs_inst *
> >>> +exec_all(fs_inst *inst)
> >>> +{
> >>> +   inst->force_writemask_all = true;
> >>> +   return inst;
> >>> +}
> >>> +
> >>>  #endif
> >>> diff --git a/src/mesa/drivers/dri/i965/brw_ir_vec4.h 
> >>> b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
> >>> index 36a8224..48dd90f 100644
> >>> --- a/src/mesa/drivers/dri/i965/brw_ir_vec4.h
> >>> +++ b/src/mesa/drivers/dri/i965/brw_ir_vec4.h
> >>> @@ -192,6 +192,15 @@ public:
> >>> }
> >>>  };
> >>>
> >>> +/**
> >>> + * Disable per-channel control flow execution masking on \p inst.
> >>> + */
> >>> +inline vec4_instruction *
> >>> +exec_all(vec4_instruction *inst)
> >>> +{
> >>> +   inst->force_writemask_all = true;
> >>> +   return inst;
> >>> +}
> >>>  } /* namespace brw */
> >>>
> >>>  #endif
> >>>
> >>
> >> Patches 3-6 are:
> >> Reviewed-by: Kenneth Graunke 
> >>
> > Thanks Ken.
> >
> >> Matt and I were confused about the "exec_" prefix in the functions
> >> though - why "exec"?  "exec_all" makes a lot of sense here - execute on
> >> all channels - but "exec_saturate" seems a little odd to me.
> >>
> >> Perhaps we can find a different prefix (or you can convince us).
> >
> > *Shrug*, I felt that e.g. saturate() alone would have been misleading
> > because the function doesn't saturate a value by itself, instead it
> > modifies the execution parameters of an instruction.  I'm open to
> > suggestions if you can come up with a nicer prefix.
> 
> I think set_* would be better.

Agreed.  Reading this in action...

   exec_all(bld.MOV(...))

sounds a bit funny to me - execute this MOV?

set_exec_all or set_writemask_all(MOV(...)) reads a bit nicer - set this
property on the given MOV instruction...


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


[Mesa-dev] [Bug 90383] assembly enabled mesa crashes dota2

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

--- Comment #10 from Tapani Pälli  ---
(In reply to Sylvain BERTRAND from comment #8)
> I tried -m32. Did not change anything. -m32 and -m64 are only for a gcc
> multilib toolchains. Here, it's a normal x86 toolchain, with i686-pc-gnu-gcc
> calling i686-pc-gnu-as (I checked i686-pc-gnu-gcc verbose output).
> Did you mean something is hardcoded in the build system for the availabily
> of the -m32/-m64 flags? If yes, what is it?

Did you have also '--build=x86_64-pc-linux-gnu --host=i686-pc-linux-gnu'? It
could be that '-m32' is not necessary here (I would not count on it though
because I believe libtool needs it) but at least the build and host arguments
are *very* necessary because libtool makes decisions based on them. So when you
feed these to autogen.sh, it should generate you proper libtool file contents.

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


Re: [Mesa-dev] [PATCH 1/9] mesa/es3.1: Allow binding GL_DRAW_INDIRECT_BUFFER with gles 3.1

2015-05-11 Thread Tapani Pälli



On 05/11/2015 10:09 PM, Ilia Mirkin wrote:

On Mon, May 11, 2015 at 3:02 PM, Ian Romanick  wrote:

On 05/11/2015 08:23 AM, Ilia Mirkin wrote:

On Mon, May 11, 2015 at 9:03 AM, Marta Lofstedt
 wrote:

From: Marta Lofstedt 

Signed-off-by: Marta Lofstedt 
---
  src/mesa/main/bufferobj.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 66dee68..07f82cd 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -91,8 +91,9 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
 case GL_COPY_WRITE_BUFFER:
return &ctx->CopyWriteBuffer;
 case GL_DRAW_INDIRECT_BUFFER:
-  if (ctx->API == API_OPENGL_CORE &&
-  ctx->Extensions.ARB_draw_indirect) {
+  if ((ctx->API == API_OPENGL_CORE &&
+   ctx->Extensions.ARB_draw_indirect) ||
+   _mesa_is_gles31(ctx)) {


Similar to my comment on the other patch (and if this occurs in the
other patches, I'd have the same comment there again). I think it's
confusing, the way you're mixing things. Also it'll lead to backend
drivers potentially receiving things they're not ready for. IMHO this
should become

if ((ctx->API == API_OPENGL_CORE || _mesa_is_gles31(ctx)) &&
ctx->Extensions.ARB_draw_indirect)


Before these patches were sent out for review, they were written in this
way.  I had suggested changing it to the current method.
GL_ARB_draw_indirect isn't an ES extension, so checking that case seemed
weird to me.


Yeah, but we don't have GL vs GLES vs GLES3.1 driver API's. We just
have a single API, and the enable bit for "I can do indirect draws" is
that you set Extensions.ARB_draw_indirect to true. In a desktop GL
context, this also means that GL_ARB_draw_indirect is reported in the
extension string. I could easily imagine a hypothetical GLES ext that
could be enabled by the same bit (although there is none afaik).

Basically the question is what do we want to have happen when you have
a driver that doesn't quite support GL (ES) version X, but you use a
version override, and then try to use one of the features that version
X provides but the driver isn't quite ready for. Do you get a
(potential) library crash/otherwise inconsistent state? Or do you just
get an error at the API level (which the spec doesn't allow for, since
the feature is supposed to exist)?


I'm not sure what the worry is here but for a user it's the same end 
result if it's the app or library that causes crash/bug. In my 
experience apps (especially games) do crash when using version 
overrides. They don't expect symbol lookup to fail, shader compilation 
to fail or some format support to not exist. Using version override 
already means that you are on a dangerous path where things may fail 
unexpectedly.




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




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


  1   2   >