[Mesa-dev] [PATCH] u_vbuf: fix vb slot assignment for translated buffers

2015-10-04 Thread Nicolai Hähnle
Vertex attributes of different categories (constant/per-instance/
per-vertex) go into different buffers for translation, and this is now
properly reflected in the vertex buffers passed to the driver.

Fixes e.g. piglit's point-vertex-id divisor test.
---
 src/gallium/auxiliary/util/u_vbuf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/auxiliary/util/u_vbuf.c 
b/src/gallium/auxiliary/util/u_vbuf.c
index 3d2193c..b31ada1 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -544,6 +544,7 @@ u_vbuf_translate_find_free_vb_slots(struct u_vbuf *mgr,
 
  index = ffs(unused_vb_mask) - 1;
  fallback_vbs[type] = index;
+ unused_vb_mask &= ~(1 << index);
  /*printf("found slot=%i for type=%i\n", index, type);*/
   }
}
-- 
2.1.4

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


Re: [Mesa-dev] [PATCH] u_vbuf: fix vb slot assignment for translated buffers

2015-10-04 Thread Marek Olšák
Nice catch. Please add this to the commit message:

Cc: mesa-sta...@lists.freedesktop.org

It will be automatically picked for 11.0 after you push it.

Marek

On Sun, Oct 4, 2015 at 12:09 PM, Nicolai Hähnle  wrote:
> Vertex attributes of different categories (constant/per-instance/
> per-vertex) go into different buffers for translation, and this is now
> properly reflected in the vertex buffers passed to the driver.
>
> Fixes e.g. piglit's point-vertex-id divisor test.
> ---
>  src/gallium/auxiliary/util/u_vbuf.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/gallium/auxiliary/util/u_vbuf.c 
> b/src/gallium/auxiliary/util/u_vbuf.c
> index 3d2193c..b31ada1 100644
> --- a/src/gallium/auxiliary/util/u_vbuf.c
> +++ b/src/gallium/auxiliary/util/u_vbuf.c
> @@ -544,6 +544,7 @@ u_vbuf_translate_find_free_vb_slots(struct u_vbuf *mgr,
>
>   index = ffs(unused_vb_mask) - 1;
>   fallback_vbs[type] = index;
> + unused_vb_mask &= ~(1 << index);
>   /*printf("found slot=%i for type=%i\n", index, type);*/
>}
> }
> --
> 2.1.4
>
> ___
> 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] u_vbuf: fix vb slot assignment for translated buffers

2015-10-04 Thread Marek Olšák
Oh, I forgot this:

Reviewed-by: Marek Olšák 

Marek

On Sun, Oct 4, 2015 at 2:03 PM, Marek Olšák  wrote:
> Nice catch. Please add this to the commit message:
>
> Cc: mesa-sta...@lists.freedesktop.org
>
> It will be automatically picked for 11.0 after you push it.
>
> Marek
>
> On Sun, Oct 4, 2015 at 12:09 PM, Nicolai Hähnle  wrote:
>> Vertex attributes of different categories (constant/per-instance/
>> per-vertex) go into different buffers for translation, and this is now
>> properly reflected in the vertex buffers passed to the driver.
>>
>> Fixes e.g. piglit's point-vertex-id divisor test.
>> ---
>>  src/gallium/auxiliary/util/u_vbuf.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/gallium/auxiliary/util/u_vbuf.c 
>> b/src/gallium/auxiliary/util/u_vbuf.c
>> index 3d2193c..b31ada1 100644
>> --- a/src/gallium/auxiliary/util/u_vbuf.c
>> +++ b/src/gallium/auxiliary/util/u_vbuf.c
>> @@ -544,6 +544,7 @@ u_vbuf_translate_find_free_vb_slots(struct u_vbuf *mgr,
>>
>>   index = ffs(unused_vb_mask) - 1;
>>   fallback_vbs[type] = index;
>> + unused_vb_mask &= ~(1 << index);
>>   /*printf("found slot=%i for type=%i\n", index, type);*/
>>}
>> }
>> --
>> 2.1.4
>>
>> ___
>> 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/2] glsl: reduce memory footprint of uniform_storage struct

2015-10-04 Thread Francisco Jerez
Timothy Arceri  writes:

> The uniform will only be of a single type so store the data for
> opaque types in a single array.
>
> Cc: Francisco Jerez 
> Cc: Ilia Mirkin 

This patch is:

Reviewed-by: Francisco Jerez 

> ---
>  src/glsl/ir_uniform.h|  6 +---
>  src/glsl/link_uniform_initializers.cpp   | 12 +++
>  src/glsl/link_uniforms.cpp   | 41 
> +++-
>  src/glsl/linker.cpp  |  2 +-
>  src/glsl/nir/nir_lower_samplers.c|  4 +--
>  src/glsl/tests/set_uniform_initializer_tests.cpp |  8 ++---
>  src/mesa/drivers/dri/i965/brw_shader.cpp |  2 +-
>  src/mesa/main/shaderapi.c|  2 +-
>  src/mesa/main/uniform_query.cpp  |  8 ++---
>  src/mesa/program/ir_to_mesa.cpp  |  5 +--
>  src/mesa/program/sampler.cpp |  4 +--
>  11 files changed, 43 insertions(+), 51 deletions(-)
>
> diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h
> index 858a7da..50fe76b 100644
> --- a/src/glsl/ir_uniform.h
> +++ b/src/glsl/ir_uniform.h
> @@ -110,11 +110,7 @@ struct gl_uniform_storage {
>  */
> bool initialized;
>  
> -   struct gl_opaque_uniform_index sampler[MESA_SHADER_STAGES];
> -
> -   struct gl_opaque_uniform_index image[MESA_SHADER_STAGES];
> -
> -   struct gl_opaque_uniform_index subroutine[MESA_SHADER_STAGES];
> +   struct gl_opaque_uniform_index opaque[MESA_SHADER_STAGES];
>  
> /**
>  * Storage used by the driver for the uniform
> diff --git a/src/glsl/link_uniform_initializers.cpp 
> b/src/glsl/link_uniform_initializers.cpp
> index 3483082..0918d2a 100644
> --- a/src/glsl/link_uniform_initializers.cpp
> +++ b/src/glsl/link_uniform_initializers.cpp
> @@ -134,16 +134,16 @@ set_opaque_binding(gl_shader_program *prog, const char 
> *name, int binding)
>  
>if (shader) {
>   if (storage->type->base_type == GLSL_TYPE_SAMPLER &&
> - storage->sampler[sh].active) {
> + storage->opaque[sh].active) {
>  for (unsigned i = 0; i < elements; i++) {
> -   const unsigned index = storage->sampler[sh].index + i;
> +   const unsigned index = storage->opaque[sh].index + i;
> shader->SamplerUnits[index] = storage->storage[i].i;
>  }
>  
>   } else if (storage->type->base_type == GLSL_TYPE_IMAGE &&
> -storage->image[sh].active) {
> +storage->opaque[sh].active) {
>  for (unsigned i = 0; i < elements; i++) {
> -   const unsigned index = storage->image[sh].index + i;
> +   const unsigned index = storage->opaque[sh].index + i;
> shader->ImageUnits[index] = storage->storage[i].i;
>  }
>   }
> @@ -243,8 +243,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program 
> *prog,
>   for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
>  gl_shader *shader = prog->_LinkedShaders[sh];
>  
> -if (shader && storage->sampler[sh].active) {
> -   unsigned index = storage->sampler[sh].index;
> +if (shader && storage->opaque[sh].active) {
> +   unsigned index = storage->opaque[sh].index;
>  
> shader->SamplerUnits[index] = storage->storage[0].i;
>  }
> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
> index 740b0a4..0642ddc 100644
> --- a/src/glsl/link_uniforms.cpp
> +++ b/src/glsl/link_uniforms.cpp
> @@ -566,7 +566,7 @@ private:
>  struct gl_uniform_storage *uniform, const char *name)
> {
>if (base_type->is_sampler()) {
> - uniform->sampler[shader_type].active = true;
> + uniform->opaque[shader_type].active = true;
>  
>   /* Handle multiple samplers inside struct arrays */
>   if (this->record_array_count > 1) {
> @@ -586,8 +586,8 @@ private:
> /* In this case, we've already seen this uniform so we just 
> use
>  * the next sampler index recorded the last time we visited.
>  */
> -   uniform->sampler[shader_type].index = index;
> -   index = inner_array_size + 
> uniform->sampler[shader_type].index;
> +   uniform->opaque[shader_type].index = index;
> +   index = inner_array_size + uniform->opaque[shader_type].index;
> this->record_next_sampler->put(index, name_copy);
>  
> ralloc_free(name_copy);
> @@ -605,13 +605,13 @@ private:
>  * structs. This allows the offset to be easily calculated for
>  * indirect indexing.
>  */
> -   uniform->sampler[shader_type].index = this->next_sampler;
> +   uniform->opaque[shader_type].index = this->next_sampler;
>   

[Mesa-dev] [PATCH 2/2] glsl: keep track of intra-stage indices for atomics

2015-10-04 Thread Timothy Arceri
This is more optimal as it means we no longer have to upload the same set
of Atomic Buffer Object surfaces to all stages in the program.

This also fixes a bug where since commit c0cd5b var->data.binding was
being used as a replacement for atomic buffer index, but they don't have
to be the same value they just happened to end up the same when binding is 0.

Cc: Francisco Jerez 
Cc: Ilia Mirkin 
Cc: Alejandro Piñeiro 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90175
---
 src/glsl/ir_uniform.h|  8 -
 src/glsl/link_atomics.cpp| 43 ++--
 src/glsl/nir/glsl_to_nir.cpp |  2 --
 src/glsl/nir/nir.h   |  4 +--
 src/glsl/nir/nir_lower_atomics.c | 25 +++---
 src/mesa/drivers/dri/i965/brw_context.h  |  2 +-
 src/mesa/drivers/dri/i965/brw_gs_surface_state.c |  4 +--
 src/mesa/drivers/dri/i965/brw_nir.c  |  6 ++--
 src/mesa/drivers/dri/i965/brw_shader.cpp |  4 +--
 src/mesa/drivers/dri/i965/brw_vs_surface_state.c |  4 +--
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 37 ++--
 src/mesa/main/mtypes.h   |  5 ++-
 12 files changed, 103 insertions(+), 41 deletions(-)

diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h
index 50fe76b..2265caf 100644
--- a/src/glsl/ir_uniform.h
+++ b/src/glsl/ir_uniform.h
@@ -71,7 +71,9 @@ struct gl_uniform_driver_storage {
 
 struct gl_opaque_uniform_index {
/**
-* Base opaque uniform index
+* == For types other than atomics ==
+*
+* This is the base opaque uniform index
 *
 * If \c gl_uniform_storage::base_type is an opaque type, this
 * represents its uniform index.  If \c
@@ -80,6 +82,10 @@ struct gl_opaque_uniform_index {
 * gl_uniform_storage::array_elements - 1, inclusive.
 *
 * Note that the index may be different in each shader stage.
+*
+* == For atomics ==
+*
+* This is the intra-stage stage index of gl_shader::AtomicBuffers[].
 */
uint8_t index;
 
diff --git a/src/glsl/link_atomics.cpp b/src/glsl/link_atomics.cpp
index 100d03c..3073de0 100644
--- a/src/glsl/link_atomics.cpp
+++ b/src/glsl/link_atomics.cpp
@@ -167,6 +167,7 @@ link_assign_atomic_counter_resources(struct gl_context *ctx,
  struct gl_shader_program *prog)
 {
unsigned num_buffers;
+   unsigned num_atomic_buffers[MESA_SHADER_STAGES] = {};
active_atomic_buffer *abs =
   find_active_atomic_counters(ctx, prog, _buffers);
 
@@ -211,13 +212,49 @@ link_assign_atomic_counter_resources(struct gl_context 
*ctx,
   }
 
   /* Assign stage-specific fields. */
-  for (unsigned j = 0; j < MESA_SHADER_STAGES; ++j)
- mab.StageReferences[j] =
-(ab.stage_references[j] ? GL_TRUE : GL_FALSE);
+  for (unsigned j = 0; j < MESA_SHADER_STAGES; ++j) {
+ if (ab.stage_references[j]) {
+mab.StageReferences[j] = GL_TRUE;
+num_atomic_buffers[j]++;
+ } else {
+mab.StageReferences[j] = GL_FALSE;
+ }
+  }
 
   i++;
}
 
+   /* Store a list pointers to atomic buffers per stage and store the index
+* to this intra-stage buffer list along with the uniform.
+*/
+   for (unsigned j = 0; j < MESA_SHADER_STAGES; ++j) {
+  if (prog->_LinkedShaders[j] && num_atomic_buffers[j] > 0) {
+ prog->_LinkedShaders[j]->NumAtomicBuffers = num_atomic_buffers[j];
+ prog->_LinkedShaders[j]->AtomicBuffers =
+rzalloc_array(prog, gl_active_atomic_buffer *,
+  num_atomic_buffers[j]);
+
+ unsigned intra_stage_idx = 0;
+ for (unsigned i = 0; i < num_buffers; i++) {
+struct gl_active_atomic_buffer *atomic_buffer =
+   >AtomicBuffers[i];
+if (atomic_buffer->StageReferences[j]) {
+   prog->_LinkedShaders[j]->AtomicBuffers[intra_stage_idx] =
+  atomic_buffer;
+
+   for (unsigned u = 0; u < atomic_buffer->NumUniforms; u++) {
+  
prog->UniformStorage[atomic_buffer->Uniforms[u]].opaque[j].index =
+ intra_stage_idx;
+  
prog->UniformStorage[atomic_buffer->Uniforms[u]].opaque[j].active =
+ true;
+   }
+
+   intra_stage_idx++;
+}
+ }
+  }
+   }
+
delete [] abs;
assert(i == num_buffers);
 }
diff --git a/src/glsl/nir/glsl_to_nir.cpp b/src/glsl/nir/glsl_to_nir.cpp
index 4dd6287..0e12a5b 100644
--- a/src/glsl/nir/glsl_to_nir.cpp
+++ b/src/glsl/nir/glsl_to_nir.cpp
@@ -357,8 +357,6 @@ nir_visitor::visit(ir_variable *ir)
 
var->data.index = ir->data.index;
var->data.binding = ir->data.binding;
-   /* XXX Get rid of buffer_index */
-   var->data.atomic.buffer_index = ir->data.binding;

[Mesa-dev] [PATCH 1/2] glsl: reduce memory footprint of uniform_storage struct

2015-10-04 Thread Timothy Arceri
The uniform will only be of a single type so store the data for
opaque types in a single array.

Cc: Francisco Jerez 
Cc: Ilia Mirkin 
---
 src/glsl/ir_uniform.h|  6 +---
 src/glsl/link_uniform_initializers.cpp   | 12 +++
 src/glsl/link_uniforms.cpp   | 41 +++-
 src/glsl/linker.cpp  |  2 +-
 src/glsl/nir/nir_lower_samplers.c|  4 +--
 src/glsl/tests/set_uniform_initializer_tests.cpp |  8 ++---
 src/mesa/drivers/dri/i965/brw_shader.cpp |  2 +-
 src/mesa/main/shaderapi.c|  2 +-
 src/mesa/main/uniform_query.cpp  |  8 ++---
 src/mesa/program/ir_to_mesa.cpp  |  5 +--
 src/mesa/program/sampler.cpp |  4 +--
 11 files changed, 43 insertions(+), 51 deletions(-)

diff --git a/src/glsl/ir_uniform.h b/src/glsl/ir_uniform.h
index 858a7da..50fe76b 100644
--- a/src/glsl/ir_uniform.h
+++ b/src/glsl/ir_uniform.h
@@ -110,11 +110,7 @@ struct gl_uniform_storage {
 */
bool initialized;
 
-   struct gl_opaque_uniform_index sampler[MESA_SHADER_STAGES];
-
-   struct gl_opaque_uniform_index image[MESA_SHADER_STAGES];
-
-   struct gl_opaque_uniform_index subroutine[MESA_SHADER_STAGES];
+   struct gl_opaque_uniform_index opaque[MESA_SHADER_STAGES];
 
/**
 * Storage used by the driver for the uniform
diff --git a/src/glsl/link_uniform_initializers.cpp 
b/src/glsl/link_uniform_initializers.cpp
index 3483082..0918d2a 100644
--- a/src/glsl/link_uniform_initializers.cpp
+++ b/src/glsl/link_uniform_initializers.cpp
@@ -134,16 +134,16 @@ set_opaque_binding(gl_shader_program *prog, const char 
*name, int binding)
 
   if (shader) {
  if (storage->type->base_type == GLSL_TYPE_SAMPLER &&
- storage->sampler[sh].active) {
+ storage->opaque[sh].active) {
 for (unsigned i = 0; i < elements; i++) {
-   const unsigned index = storage->sampler[sh].index + i;
+   const unsigned index = storage->opaque[sh].index + i;
shader->SamplerUnits[index] = storage->storage[i].i;
 }
 
  } else if (storage->type->base_type == GLSL_TYPE_IMAGE &&
-storage->image[sh].active) {
+storage->opaque[sh].active) {
 for (unsigned i = 0; i < elements; i++) {
-   const unsigned index = storage->image[sh].index + i;
+   const unsigned index = storage->opaque[sh].index + i;
shader->ImageUnits[index] = storage->storage[i].i;
 }
  }
@@ -243,8 +243,8 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program 
*prog,
  for (int sh = 0; sh < MESA_SHADER_STAGES; sh++) {
 gl_shader *shader = prog->_LinkedShaders[sh];
 
-if (shader && storage->sampler[sh].active) {
-   unsigned index = storage->sampler[sh].index;
+if (shader && storage->opaque[sh].active) {
+   unsigned index = storage->opaque[sh].index;
 
shader->SamplerUnits[index] = storage->storage[0].i;
 }
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index 740b0a4..0642ddc 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -566,7 +566,7 @@ private:
 struct gl_uniform_storage *uniform, const char *name)
{
   if (base_type->is_sampler()) {
- uniform->sampler[shader_type].active = true;
+ uniform->opaque[shader_type].active = true;
 
  /* Handle multiple samplers inside struct arrays */
  if (this->record_array_count > 1) {
@@ -586,8 +586,8 @@ private:
/* In this case, we've already seen this uniform so we just use
 * the next sampler index recorded the last time we visited.
 */
-   uniform->sampler[shader_type].index = index;
-   index = inner_array_size + uniform->sampler[shader_type].index;
+   uniform->opaque[shader_type].index = index;
+   index = inner_array_size + uniform->opaque[shader_type].index;
this->record_next_sampler->put(index, name_copy);
 
ralloc_free(name_copy);
@@ -605,13 +605,13 @@ private:
 * structs. This allows the offset to be easily calculated for
 * indirect indexing.
 */
-   uniform->sampler[shader_type].index = this->next_sampler;
+   uniform->opaque[shader_type].index = this->next_sampler;
this->next_sampler +=
   inner_array_size * this->record_array_count;
 
/* Store the next index for future passes over the struct array
 */
-   index = uniform->sampler[shader_type].index + inner_array_size;
+   index = 

[Mesa-dev] [Bug 92265] Black windows in weston after update mesa to 11.0.2-1

2015-10-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=92265

--- Comment #5 from Fabio Coatti  ---
Spotted this report after bisecting :(

So, I can confirm the same behaviour under kde5/gentoo/qt-5.4.2: black windows,
and the commit that cause the problem seems to be 

commit f15a7f3c6e1bb802ae8c2a29a2dc35ff530aea4d
Author: Eduardo Lima Mitev 
Date:   Thu Sep 24 10:57:43 2015 +0200

mesa: Use the effective internal format instead for validation
[...]

-- 
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] i965: store reference to the context within struct brw_fence

2015-10-04 Thread Chih-Wei Huang
a

2015-09-30 5:36 GMT+08:00 Chad Versace :
> On Mon 28 Sep 2015, Marek Olšák wrote:
>> On Mon, Sep 28, 2015 at 1:29 PM, Emil Velikov  
>> wrote:
>> > As the spec allows for {server,client}_wait_sync to be called without
>> > currently bound context, while our implementation requires context
>> > pointer.
>> >
>> > UNTESTED.
>> >
>> > Cc: Chad Versace 
>> > Cc: Marek Olšák 
>> > Cc: Chih-Wei Huang 
>> > Cc: Mauro Rossi 
>> > Cc: 10.6 11.0 
>> > Signed-off-by: Emil Velikov 
>> > ---
>> >
>> > Upon second thought I'm leaning that we should move this to the API
>> > specific library (i.e. libEGL) rather than keeping it here. It will give
>> > us remove API specific from the DRI extension, plus it'll give us better
>> > mix'n'match (loader+dri module) compatibility.
>> >
>> > How do you guys feel on the topic ?
>>
>> I don't think there is anything to move into libEGL. st/dri doesn't
>> add a context pointer to the fence, instead it adds a screen pointer,
>> which is a different thing.
>
> I agree with Mark here.  Even if there was something you could move into
> libEGL, I don't it could be done safely. It needs to remain in the
> driver.
>
>> This i965 fix is probably not thread-safe, because eglClientWaitSync
>> can be called from another thread and contexts typically contain no
>> locks.
>
> Emil, the fix is not thread-safe because drm_intel_gem_bo_wait() mutates
> the bo. Thread-safety matters because some Chromium Ozone code that's
> cooking does call eglCreateSync and eglClientWaitSync from different
> threads.
>
> If you add a mutex to struct brw_fence, and lock it for the duration of
> brw_fence_client_wait() and brw_fence_is_completed(), then I think
> that's sufficient for ensuring thread-safety.

Any update?

I can confirm the patch (+ 2 Marek's patches)
fix the crashing in android-x86.
But I don't know whether if the
thread-safe issue affect us.

Since I'm going to release lollipop-x86 soon
and the camera crashing is a must fix bug.
I'll just apply the patch to the lollipop-x86
if no further update in 1-2 day(s).


-- 
Chih-Wei
Android-x86 project
http://www.android-x86.org
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v5 0/3] add clLinkProgram

2015-10-04 Thread Serge Martin
This serie add clLinkProgram function needed for CL 1.2.
However, it lacks the binary type part that is mandatory for input validation
and also for CL_PROGRAM_BINARY_TYPE query. This will be adressed
in another serie once we agree on the way to store it.

Now that llvm/invocation.cpp is no longer changed, this v5 is a rebased v4 in
hope that the first patch in the serie can be reviewed.

CC: Francisco Jerez 

Serge Martin (3):
  clover: separate compile and link stages
  clover: override ret_object
  clover: add clLinkProgramm (CL 1.2)

 src/gallium/state_trackers/clover/api/program.cpp  |  50 +++-
 src/gallium/state_trackers/clover/api/util.hpp |  12 +
 .../state_trackers/clover/core/compiler.hpp|   7 +-
 src/gallium/state_trackers/clover/core/error.hpp   |   7 +
 src/gallium/state_trackers/clover/core/program.cpp |  41 +++-
 src/gallium/state_trackers/clover/core/program.hpp |   8 +-
 .../state_trackers/clover/llvm/invocation.cpp  | 264 +++--
 7 files changed, 296 insertions(+), 93 deletions(-)

-- 
2.5.2

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


[Mesa-dev] [PATCH v5 3/3] clover: add clLinkProgramm (CL 1.2)

2015-10-04 Thread Serge Martin
Reviewed-by: Francisco Jerez 
---
 src/gallium/state_trackers/clover/api/program.cpp  | 31 +++---
 src/gallium/state_trackers/clover/core/program.hpp |  4 +--
 2 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/program.cpp 
b/src/gallium/state_trackers/clover/api/program.cpp
index f8d946e..4176562 100644
--- a/src/gallium/state_trackers/clover/api/program.cpp
+++ b/src/gallium/state_trackers/clover/api/program.cpp
@@ -241,10 +241,33 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
 CLOVER_API cl_program
 clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs,
   const char *p_opts, cl_uint num_progs, const cl_program *d_progs,
-  void (*pfn_notify)(cl_program, void *), void *user_data,
-  cl_int *r_errcode) {
-   CLOVER_NOT_SUPPORTED_UNTIL("1.2");
-   ret_error(r_errcode, CL_LINKER_NOT_AVAILABLE);
+  void (*pfn_notify) (cl_program, void *), void *user_data,
+  cl_int *r_errcode) try {
+   auto  = obj(d_ctx);
+   auto devs = (d_devs ? objs(d_devs, num_devs) :
+ref_vector(ctx.devices()));
+   auto opts = (p_opts ? p_opts : "");
+   auto progs = objs(d_progs, num_progs);
+
+   if (!pfn_notify && user_data)
+ throw error(CL_INVALID_VALUE);
+
+   if (any_of([&](const device ) {
+return !count(dev, ctx.devices());
+ }, objs(d_devs, num_devs)))
+  throw error(CL_INVALID_DEVICE);
+
+   auto prog = create(ctx);
+   try {
+  prog().link(devs, opts, progs);
+  ret_error(r_errcode, CL_SUCCESS);
+   } catch (link_error ) {
+  ret_error(r_errcode, CL_LINK_PROGRAM_FAILURE);
+   }
+
+   return ret_object(prog);
+} catch (error ) {
+   ret_error(r_errcode, e);
return NULL;
 }
 
diff --git a/src/gallium/state_trackers/clover/core/program.hpp 
b/src/gallium/state_trackers/clover/core/program.hpp
index 7d86018..a70ed08 100644
--- a/src/gallium/state_trackers/clover/core/program.hpp
+++ b/src/gallium/state_trackers/clover/core/program.hpp
@@ -40,8 +40,8 @@ namespace clover {
   program(clover::context ,
   const std::string );
   program(clover::context ,
-  const ref_vector ,
-  const std::vector );
+  const ref_vector  = {},
+  const std::vector  = {});
 
   program(const program ) = delete;
   program &
-- 
2.5.2

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


[Mesa-dev] [PATCH v5 2/3] clover: override ret_object

2015-10-04 Thread Serge Martin
Return an API object from an intrusive reference to a Clover object,
incrementing the reference count of the object.

Reviewed-by: Francisco Jerez 
---
 src/gallium/state_trackers/clover/api/util.hpp | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/gallium/state_trackers/clover/api/util.hpp 
b/src/gallium/state_trackers/clover/api/util.hpp
index 31e20e4..18ba143 100644
--- a/src/gallium/state_trackers/clover/api/util.hpp
+++ b/src/gallium/state_trackers/clover/api/util.hpp
@@ -68,6 +68,18 @@ namespace clover {
  *p = desc(v());
   }
}
+
+   ///
+   /// Return an API object from an intrusive reference to a Clover object,
+   /// incrementing the reference count of the object.
+   ///
+   template
+   typename T::descriptor_type *
+   ret_object(const intrusive_ref ) {
+  v().retain();
+  return desc(v());
+   }
+
 }
 
 #endif
-- 
2.5.2

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


[Mesa-dev] [PATCH v5 1/3] clover: separate compile and link stages

2015-10-04 Thread Serge Martin
---
 src/gallium/state_trackers/clover/api/program.cpp  |  19 +-
 .../state_trackers/clover/core/compiler.hpp|   7 +-
 src/gallium/state_trackers/clover/core/error.hpp   |   7 +
 src/gallium/state_trackers/clover/core/program.cpp |  41 +++-
 src/gallium/state_trackers/clover/core/program.hpp |   4 +-
 .../state_trackers/clover/llvm/invocation.cpp  | 264 +++--
 6 files changed, 255 insertions(+), 87 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/program.cpp 
b/src/gallium/state_trackers/clover/api/program.cpp
index 27ca2ef..f8d946e 100644
--- a/src/gallium/state_trackers/clover/api/program.cpp
+++ b/src/gallium/state_trackers/clover/api/program.cpp
@@ -181,13 +181,20 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
 
validate_build_program_common(prog, num_devs, d_devs, pfn_notify, 
user_data);
 
-   prog.build(devs, opts);
+   if (prog.has_source) {
+  prog.compile(devs, opts);
+  prog.link(devs, opts, { prog });
+   }
return CL_SUCCESS;
 } catch (error ) {
-   if (e.get() == CL_INVALID_COMPILER_OPTIONS)
-  return CL_INVALID_BUILD_OPTIONS;
-   if (e.get() == CL_COMPILE_PROGRAM_FAILURE)
-  return CL_BUILD_PROGRAM_FAILURE;
+   switch (e.get()) {
+  case CL_INVALID_COMPILER_OPTIONS:
+  case CL_INVALID_LINKER_OPTIONS:
+ return CL_INVALID_BUILD_OPTIONS;
+  case CL_COMPILE_PROGRAM_FAILURE:
+  case CL_LINK_PROGRAM_FAILURE:
+ return CL_BUILD_PROGRAM_FAILURE;
+   }
return e.get();
 }
 
@@ -224,7 +231,7 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
   range(header_names, num_headers),
   objs(d_header_progs, num_headers));
 
-   prog.build(devs, opts, headers);
+   prog.compile(devs, opts, headers);
return CL_SUCCESS;
 
 } catch (error ) {
diff --git a/src/gallium/state_trackers/clover/core/compiler.hpp 
b/src/gallium/state_trackers/clover/core/compiler.hpp
index 2076417..0d6766a 100644
--- a/src/gallium/state_trackers/clover/core/compiler.hpp
+++ b/src/gallium/state_trackers/clover/core/compiler.hpp
@@ -32,11 +32,16 @@ namespace clover {
 
module compile_program_llvm(const std::string ,
const header_map ,
-   pipe_shader_ir ir,
const std::string ,
const std::string ,
std::string _log);
 
+   module link_program_llvm(const std::vector ,
+enum pipe_shader_ir ir,
+const std::string ,
+const std::string ,
+std::string _log);
+
module compile_program_tgsi(const std::string ,
std::string _log);
 }
diff --git a/src/gallium/state_trackers/clover/core/error.hpp 
b/src/gallium/state_trackers/clover/core/error.hpp
index 59a5af4..4ec619c 100644
--- a/src/gallium/state_trackers/clover/core/error.hpp
+++ b/src/gallium/state_trackers/clover/core/error.hpp
@@ -72,6 +72,13 @@ namespace clover {
   }
};
 
+   class link_error : public error {
+   public:
+  link_error(const std::string  = "") :
+ error(CL_LINK_PROGRAM_FAILURE , what) {
+  }
+   };
+
template
class invalid_object_error;
 
diff --git a/src/gallium/state_trackers/clover/core/program.cpp 
b/src/gallium/state_trackers/clover/core/program.cpp
index 6eebd9c..4aa2622 100644
--- a/src/gallium/state_trackers/clover/core/program.cpp
+++ b/src/gallium/state_trackers/clover/core/program.cpp
@@ -40,8 +40,8 @@ program::program(clover::context ,
 }
 
 void
-program::build(const ref_vector , const char *opts,
-   const header_map ) {
+program::compile(const ref_vector , const std::string ,
+ const header_map ) {
if (has_source) {
   _devices = devs;
 
@@ -58,9 +58,7 @@ program::build(const ref_vector , const char 
*opts,
 auto module = (dev.ir_format() == PIPE_SHADER_IR_TGSI ?
compile_program_tgsi(_source, log) :
compile_program_llvm(_source, headers,
-dev.ir_format(),
-dev.ir_target(), 
build_opts(dev),
-log));
+dev.ir_target(), opts, log));
 _binaries.insert({ , module });
 _logs.insert({ , log });
  } catch (const error &) {
@@ -71,6 +69,39 @@ program::build(const ref_vector , const char 
*opts,
}
 }
 
+void
+program::link(const ref_vector , const std::string ,
+  const ref_vector ) {
+   _devices = devs;
+
+   for (auto  : devs) {
+  if (dev.ir_format() == PIPE_SHADER_IR_TGSI)
+ continue;
+
+   const std::vector mods = map([&](const program ) {
+  return prog.binary(dev);
+   }, progs);
+
+  _binaries.erase();
+  _opts.erase();
+
+  

[Mesa-dev] [Bug 91596] EGL_KHR_gl_colorspace (v2) causes problem with Android-x86 GUI

2015-10-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=91596

--- Comment #17 from Rob Clark  ---
(In reply to Emil Velikov from comment #15)
> (In reply to Chih-Wei Huang from comment #11)
> > Mesa still doesn't support PIXEL_FORMAT_RGBA_?
> 
> It should, depending on how exactly you define the formats. I've looked a
> while back for some android documentation but I came short. Have you seen
> any ?
> 
> Upon closer look the mappings in drm_format_from_hal and get_pipe_format
> look very funny.

fwiw, there is a bogus patch that needs to be reverted in drm_gralloc, see:

https://github.com/robclark/drm_gralloc/commit/34bf9d8566aaf97a0f2adb127836134078abd340

-- 
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 92265] Black windows in weston after update mesa to 11.0.2-1

2015-10-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=92265

Dennis Schridde  changed:

   What|Removed |Added

 CC||devuran...@gmx.net

-- 
You are receiving this mail because:
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 92278] Black screen in War Thunder

2015-10-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=92278

Bug ID: 92278
   Summary: Black screen in War Thunder
   Product: Mesa
   Version: 11.0
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: s...@whiz.se
QA Contact: mesa-dev@lists.freedesktop.org

Created attachment 118658
  --> https://bugs.freedesktop.org/attachment.cgi?id=118658=edit
Apitrace warnings

The game "War Thunder" doesn't seem to be working with Mesa.

I get a green screen instead of what I'm guessing is an intro video, and a
black screen in the menu. Happens on i965 and with software rendering, reported
to be the same on radeon.

Same behavior on 10.6.7 and 11.0.2. 

The game is free to play:
https://warthunder.com/


I created an apitrace, that results in a lot of logged warnings:

469: message: api issue 1: FBO incomplete: no attachments and default width or
height is 0 [-1]
469: message: shader compiler issue 2: FS SIMD8 shader: 5 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 80 to 48 bytes.
469: message: shader compiler issue 3: FS SIMD16 shader: 5 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 80 to 48 bytes.
483: message: shader compiler issue 4: FS SIMD16 shader: 2 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 32 to 32 bytes.
483: message: shader compiler issue 5: VS vec4 shader: 6 inst, 0 loops,
compacted 96 to 96 bytes.
509: message: shader compiler issue 6: FS SIMD8 shader: 5 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 80 to 48 bytes.
509: message: shader compiler issue 7: FS SIMD16 shader: 5 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 80 to 48 bytes.
561: message: api performance issue 8: Falling back to plain clear because
16x16 buffer is untiled
561: message: shader compiler issue 9: FS SIMD8 shader: 5 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 80 to 48 bytes.
561: message: shader compiler issue 10: FS SIMD16 shader: 5 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 80 to 48 bytes.
561: message: shader compiler issue 11: VS vec4 shader: 6 inst, 0 loops,
compacted 96 to 96 bytes.
561: message: shader compiler issue 12: FS SIMD8 shader: 5 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 80 to 48 bytes.
561: message: shader compiler issue 13: FS SIMD16 shader: 5 inst, 0 loops, 0:0
spills:fills, Promoted 0 constants, compacted 80 to 48 bytes.
561: message: shader compiler issue 14: VS vec4 shader: 6 inst, 0 loops,
compacted 96 to 96 bytes.
743: message: api performance issue 8: Falling back to plain clear because
16x16 buffer is untiled

Full log is attached.

-- 
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 92278] Black screen in War Thunder

2015-10-04 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=92278

--- Comment #1 from Sven Arvidsson  ---
Trace: https://www.dropbox.com/s/7zvvfe25ye46jrl/aces.trace?dl=0

-- 
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] docs: Mark GL_ARB_enhanced_layouts as in progress

2015-10-04 Thread Timothy Arceri
On Sun, 2015-10-04 at 11:24 +1100, Timothy Arceri wrote:
> ---
>  docs/GL3.txt | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/GL3.txt b/docs/GL3.txt
> index e020deb..09c711f 100644
> --- a/docs/GL3.txt
> +++ b/docs/GL3.txt
> @@ -178,7 +178,13 @@ GL 4.4, GLSL 4.40:
>GL_MAX_VERTEX_ATTRIB_STRIDE  DONE (all
> drivers)
>GL_ARB_buffer_storageDONE (i965,
> nv50, nvc0, r600, radeonsi)
>GL_ARB_clear_texture DONE (i965)
> (gallium - in progress, VMware)
> -  GL_ARB_enhanced_layouts  not started
> +  GL_ARB_enhanced_layouts  in progress
> (Timothy)
> +  - compile-time constant expressions  in progress
> +  - explicit byte offsets for blocks   in progress
> +  - forced alignment within blocks in progress
> +  - specify vec4-slot component numbersin progress
> +  - specify transform/feedback layout  in progress
> +  - input/output block locations   in progress
>GL_ARB_multi_bindDONE (all
> drivers)
>GL_ARB_query_buffer_object   not started
>GL_ARB_texture_mirror_clamp_to_edge  DONE (i965,
> nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)


I'll push this later today if there are no objections
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa/state_tracker: Fix draw-pixel-with-texture piglit test.

2015-10-04 Thread Marek Olšák
Thank you for the patch, but it's not applicable on my (private)
branch where I'm reworking st/mesa's shader compilation, including
DrawPixels shaders. Your patch helped to fix it in the new
implementation at least.

Sorry for ignoring it in the first place.

Marek

On Sat, Mar 28, 2015 at 6:07 PM, Matthew Dawson  wrote:
> When glDrawPixels was used with an external texture, the pixels passed in
> were sampled instead of the texture.  Change gallium to instead move the user
> texture to a new sampler below the glDrawPixels samplers and use the texture
> coordinates from the raster position.
>
> This uses a uniform for the texture coordinates instead passing it through
> the vertex shader as the texture coordinates are constant for the entire
> operation.  While working the vertex shader would be possible, implementing
> that solution would break several assumptions throughout the glDrawPixels
> implementation as well as helper functions used by other code paths, 
> increasing
> the chance for breakage.
>
> Tested on llvmpipe, r600, and radeonsi.
>
> V2: Complete everything missing from V1.
>
> v3:
>  - Fix style issues.
>  - Add comments about how the texture references are fixed up to be valid.
> ---
>  src/mesa/state_tracker/st_cb_drawpixels.c  | 39 ++---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 40 
> ++
>  2 files changed, 76 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c 
> b/src/mesa/state_tracker/st_cb_drawpixels.c
> index 3edf31b..47abd16 100644
> --- a/src/mesa/state_tracker/st_cb_drawpixels.c
> +++ b/src/mesa/state_tracker/st_cb_drawpixels.c
> @@ -44,6 +44,7 @@
>  #include "main/texstore.h"
>  #include "main/glformats.h"
>  #include "program/program.h"
> +#include "program/prog_parameter.h"
>  #include "program/prog_print.h"
>  #include "program/prog_instruction.h"
>
> @@ -676,6 +677,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint 
> y, GLfloat z,
> GLfloat x0, y0, x1, y1;
> GLsizei maxSize;
> boolean normalized = sv[0]->texture->target != PIPE_TEXTURE_RECT;
> +   GLuint num_user_samplers = st->state.num_samplers[PIPE_SHADER_FRAGMENT];
> +   unsigned int i;
>
> /* limit checks */
> /* XXX if DrawPixels image is larger than max texture size, break
> @@ -765,6 +768,10 @@ draw_textured_quad(struct gl_context *ctx, GLint x, 
> GLint y, GLfloat z,
>if (num_sampler_view > 1) {
>   cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 1, );
>}
> +  for (i = 0; i < num_user_samplers; ++i) {
> + cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, i+num_sampler_view,
> +>state.samplers[PIPE_SHADER_FRAGMENT][i]);
> +  }
>cso_single_sampler_done(cso, PIPE_SHADER_FRAGMENT);
> }
>
> @@ -786,7 +793,14 @@ draw_textured_quad(struct gl_context *ctx, GLint x, 
> GLint y, GLfloat z,
> cso_set_stream_outputs(st->cso_context, 0, NULL, NULL);
>
> /* texture state: */
> -   cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv);
> +   {
> +  struct pipe_sampler_view *lsv[PIPE_MAX_SAMPLERS];
> +  memcpy(lsv, sv, num_sampler_view*sizeof(struct pipe_sampler_view*));
> +  memcpy(lsv+num_sampler_view, 
> st->state.sampler_views[PIPE_SHADER_FRAGMENT],
> + num_user_samplers*sizeof(struct pipe_sampler_view*));
> +  cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT,
> +num_sampler_view+num_user_samplers, lsv);
> +   }
>
> /* Compute Gallium window coords (y=0=top) with pixel zoom.
>  * Recall that these coords are transformed by the current
> @@ -1160,8 +1174,27 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
>}
> }
>
> -   /* update fragment program constants */
> -   st_upload_constants(st, fpv->parameters, PIPE_SHADER_FRAGMENT);
> +   /* updated texture coordinates and fragment program constants. */
> +   {
> +  int i;
> +  struct gl_program_parameter_list *parameters = fpv->parameters;
> +  /* Update the texture coordinates from all the used texture units, 
> using
> +   * the values associated with the raster position */
> +  for (i = 0; i < parameters->NumParameters; ++i) {
> + const char *name = parameters->Parameters[i].Name;
> + /* Any texture coordinate will use the parameter name texcoord_, 
> where
> +  * _ is the texture units id added to the ascii character 'A'.  This
> +  * checks if a parameter matches this patterns, and updates the
> +  * parameter's value with the appropriate raster position texture
> +  * coordinate. */
> + if (strncmp("texcoord", name, 8) == 0 && strlen(name) == 9) {
> +memcpy(parameters->ParameterValues[i],
> +   st->ctx->Current.RasterTexCoords[name[8] - 'A'],
> +   sizeof(GL_FLOAT) * 4);
> + }
> +  }
> +  st_upload_constants(st, 

Re: [Mesa-dev] [PATCH] mesa: Add missing _mm_mfence() before streaming loads.

2015-10-04 Thread Nuzman, Joseph
You need to ensure that the streaming loads do not execute speculatively too 
early (before the data to be copied has been produced).  The MFENCE at the 
start of the copy routine is sufficient to ensure that the loads don't see 
stale data older than that fence.

All loads must be completed at the time of their retirement.  There are no 
special ordering requirements to ensure completion of the streaming loads.

Joe


-Original Message-
From: Justen, Jordan L 
Sent: Thursday, October 01, 2015 21:20
To: Matt Turner; mesa-dev@lists.freedesktop.org
Cc: Nuzman, Joseph
Subject: Re: [Mesa-dev] [PATCH] mesa: Add missing _mm_mfence() before streaming 
loads.

On 2015-10-01 10:11:33, Matt Turner wrote:
> According to the Intel Software Development Manual:

How about a more specific doc location?

According to the Intel Software Development Manual (Volume 1: Basic 
Architecture, 12.10.3 Streaming Load Hint Instruction):

>Streaming loads may be weakly ordered and may appear to software to
>execute out of order with respect to other memory operations.
>Software must explicitly use fences (e.g. MFENCE) if it needs to
>preserve order among streaming loads or between streaming loads and
>other memory operations.

Does this mean we need a mfence following the load as well?

-Jordan

> That is, a memory fence is needed to preserve the order between the 
> GPU writing the buffer and the streaming loads reading it back.
> 
> Reported-by: Joseph Nuzman 
> ---
>  src/mesa/main/streaming-load-memcpy.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/mesa/main/streaming-load-memcpy.c 
> b/src/mesa/main/streaming-load-memcpy.c
> index d7147af..32854b6 100644
> --- a/src/mesa/main/streaming-load-memcpy.c
> +++ b/src/mesa/main/streaming-load-memcpy.c
> @@ -54,16 +54,19 @@ _mesa_streaming_load_memcpy(void *restrict dst, 
> void *restrict src, size_t len)
>  
>memcpy(d, s, MIN2(bytes_before_alignment_boundary, len));
>  
>d = (char *)ALIGN((uintptr_t)d, 16);
>s = (char *)ALIGN((uintptr_t)s, 16);
>len -= MIN2(bytes_before_alignment_boundary, len);
> }
>  
> +   if (len >= 64)
> +  _mm_mfence();
> +
> while (len >= 64) {
>__m128i *dst_cacheline = (__m128i *)d;
>__m128i *src_cacheline = (__m128i *)s;
>  
>__m128i temp1 = _mm_stream_load_si128(src_cacheline + 0);
>__m128i temp2 = _mm_stream_load_si128(src_cacheline + 1);
>__m128i temp3 = _mm_stream_load_si128(src_cacheline + 2);
>__m128i temp4 = _mm_stream_load_si128(src_cacheline + 3);
> --
> 2.4.9
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev