Re: [Mesa-dev] [PATCH] i965/fs: New peephole optimization to flatten IF/BREAK/ENDIF.

2013-11-05 Thread Paul Berry
On 5 November 2013 14:58, Paul Berry  wrote:

> On 1 November 2013 17:31, Matt Turner  wrote:
>
>> total instructions in shared programs: 1649485 -> 1649157 (-0.02%)
>> instructions in affected programs: 7823 -> 7495 (-4.19%)
>> ---
>>  src/mesa/drivers/dri/i965/Makefile.sources |  1 +
>>  src/mesa/drivers/dri/i965/brw_fs.cpp   |  1 +
>>  src/mesa/drivers/dri/i965/brw_fs.h |  1 +
>>  .../dri/i965/brw_fs_peephole_predicated_break.cpp  | 96
>> ++
>>  4 files changed, 99 insertions(+)
>>  create mode 100644
>> src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
>>
>> diff --git a/src/mesa/drivers/dri/i965/Makefile.sources
>> b/src/mesa/drivers/dri/i965/Makefile.sources
>> index 14b2f61..fcc6fdb 100644
>> --- a/src/mesa/drivers/dri/i965/Makefile.sources
>> +++ b/src/mesa/drivers/dri/i965/Makefile.sources
>> @@ -59,6 +59,7 @@ i965_FILES = \
>> brw_fs_fp.cpp \
>> brw_fs_generator.cpp \
>> brw_fs_live_variables.cpp \
>> +   brw_fs_peephole_predicated_break.cpp \
>> brw_fs_reg_allocate.cpp \
>> brw_fs_vector_splitting.cpp \
>> brw_fs_visitor.cpp \
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index 7064910..5c8443f 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -3149,6 +3149,7 @@ fs_visitor::run()
>>  progress = opt_algebraic() || progress;
>>  progress = opt_cse() || progress;
>>  progress = opt_copy_propagate() || progress;
>> + progress = opt_peephole_predicated_break() || progress;
>>  progress = dead_code_eliminate() || progress;
>>  progress = dead_code_eliminate_local() || progress;
>>  progress = register_coalesce() || progress;
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h
>> b/src/mesa/drivers/dri/i965/brw_fs.h
>> index 43e4761..09e5174 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.h
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
>> @@ -362,6 +362,7 @@ public:
>> bool try_emit_saturate(ir_expression *ir);
>> bool try_emit_mad(ir_expression *ir, int mul_arg);
>> void try_replace_with_sel();
>> +   bool opt_peephole_predicated_break();
>> void emit_bool_to_cond_code(ir_rvalue *condition);
>> void emit_if_gen6(ir_if *ir);
>> void emit_unspill(fs_inst *inst, fs_reg reg, uint32_t spill_offset,
>> diff --git
>> a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
>> b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
>> new file mode 100644
>> index 000..7845113
>> --- /dev/null
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
>> @@ -0,0 +1,96 @@
>> +/*
>> + * 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, 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.
>> + */
>> +
>> +#include "brw_fs.h"
>> +#include "brw_cfg.h"
>> +
>> +/** @file brw_fs_peephole_predicated_break.cpp
>> + *
>> + * Loops are often structured as
>> + *
>> + * loop:
>> + *CMP.f0
>> + *(+f0) IF
>> + *BREAK
>> + *ENDIF
>> + *...
>> + *WHILE loop
>> + *
>> + * This peephole pass removes the IF and ENDIF instructions and
>> predicates the
>> + * BREAK, dropping two instructions from the loop body.
>>
>
> Instead of this special-purpose peephole optimization, I'm wondering if it
> would be more useful to create a more general optimization pass that just
> converts the entire IF block to predicated instructions, assuming certain
> conditions hold.  Those conditions would be something like:
>
> - If any instruction but the last writes to the flag register, then don't
> do the optimization.
> - If there's nested control flow, then don't do the optimization.
> - If any instruction inside the IF block is incompatible with predic

Re: [Mesa-dev] [v2 6/6] mesa: OES_get_program_binary functionality

2013-11-05 Thread Tapani Pälli

On 11/06/2013 12:14 AM, Paul Berry wrote:
On 1 November 2013 05:08, Tapani Pälli > wrote:


On 11/01/2013 12:38 PM, Erik Faye-Lund wrote:

On Fri, Nov 1, 2013 at 11:35 AM, Tapani Pälli
mailto:tapani.pa...@intel.com>> wrote:

On 11/01/2013 12:21 PM, Erik Faye-Lund wrote:


Won't using the git-sha1 as a compatibility-criteria
cause issues for
developers with local changes? I'm not so worried
about this for
OES_get_program_binary itself, but once the
shader-cache is in place
it sounds like a potential source of difficult to
track down
misbehavior...


I agree it might be too aggressive criteria but it is hard
to come up with
better and as simple.

That's not my objection. My objection is that this might give
headaches for people with local modifications to the
glsl-compiler.
Local modifications does not affect the git-sha1.


For the automatic shader cache this headache could be helped a bit
with a environment variable or drirc setting that can be used
during development. On the other hand an automatic cache must work
in a transparent way so it should be always able to recover when
it fails, so one should only see it as 'slower than usual' (since
recompilation/relink required) sort of behaviour. The WIP of the
automatic cache I sent some time earlier also marked (renamed)
these 'problematic' cached shaders so that they can be detected on
further runs and cache can ignore those.

I agree that it might become problematic, on the other hand it is
also easy to just wipe ~/.cache/mesa and disable cache. Not sure
if Nvidia or Imagination try to handles these cases with their
cache implementations.


I'm also concerned about this, especially for the automatic shader 
cache.  During development, we frequently make small changes to the 
front end, recompile, and then run a small test program, expecting our 
changes to take effect.  I'm very worried about requiring developers 
to remember to set an environment variable, change a drirc setting, or 
wipe out a cache when making changes that haven't been committed yet.  
Especially when the consequence of forgetting to do so is that the 
change you were trying to make won't have any observed effect. That's 
the sort of thing that leads people to spend hours chasing phantom bugs.


How about if we have the cache mechanism include the modification time 
of the mesa .so in the shader binary (in addition to the sha), and 
reject shader binaries that don't have a matching modification time?  
That way if mesa is recompiled, any previously-cached shaders will 
automatically become invalid without the developer having to do any work.




My next plan for adding more validation was to add ir instruction sizes 
and a couple important struct sizes as part of the dump, this would 
allow some amount of sanity checking but mesa modification time addition 
sounds like better idea and would not add so much additional data.




A related concern I have is: what happens if someone changes their 
video card, or transplants their hard drive into a different machine 
that has different graphics hardware?  Different back-ends have 
different settings of ctx->ShaderCompilerOptions (some back-ends have 
different values from one chipset to another), so even if the version 
of Mesa is the same and there are no local developer changes, the 
linked IR is not going to necessarily be the same if the graphics 
hardware changes.


To address this, I'd recommend that we also include the device's PCI 
ID in the shader binary, and reject mismatched binaries.


Thanks, this is is a nice idea, currently there's also the vendor and 
renderer strings in the dump but so far these have been used only for 
debug purposes.


// Tapani

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


Re: [Mesa-dev] [PATCH] i965: Fix compiler warning.

2013-11-05 Thread Kenneth Graunke
On 10/30/2013 02:58 PM, Courtney Goeltzenleuchter wrote:
> fix: intel_screen.c:1320:4: warning: initialization from
> incompatible pointer type [enabled by default]
> ---
>  src/mesa/drivers/dri/i965/brw_context.c | 2 +-
>  src/mesa/drivers/dri/i965/brw_context.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> b/src/mesa/drivers/dri/i965/brw_context.c
> index 2a923c4..5b4d662d 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -498,7 +498,7 @@ brw_process_driconf_options(struct brw_context *brw)
>driQueryOptionb(options, "disable_glsl_line_continuations");
>  }
>  
> -bool
> +GLboolean
>  brwCreateContext(gl_api api,
>const struct gl_config *mesaVis,
>__DRIcontext *driContextPriv,
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 7f7d5c2..c261ae8 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -1446,7 +1446,7 @@ void intel_prepare_render(struct brw_context *brw);
>  void intel_resolve_for_dri2_flush(struct brw_context *brw,
>__DRIdrawable *drawable);
>  
> -bool brwCreateContext(gl_api api,
> +GLboolean brwCreateContext(gl_api api,
> const struct gl_config *mesaVis,
> __DRIcontext *driContextPriv,
>unsigned major_version,
> 

Whoops...looks like I got a bit overzealous in converting those during
the intel_context/brw_context merges.

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


[Mesa-dev] [PATCH 3/3] i965/fs: Prefer things we know reduce reg pressure when pre-scheduling.

2013-11-05 Thread Eric Anholt
Previously, the best thing we had was to schedule the things unblocked by
the last chosen instruction, on the hope that it would be consuming two
values at the end of their live intervals while only producing one new
value.  But that's just a guess, and we can do counting of usage of
registers to know when an instruction would (almost surely) reduce
register pressure.

The only failure mode I know of in this new dominant heuristic is that
inside of a loop when scheduling the iterator (for example), choosing the
last use of the iterator doesn't actually reduce the live interval of the
iterator.  But it doesn't seem to matter in shader-db:

total instructions in shared programs: 1618700 -> 1618700 (0.00%)
instructions in affected programs: 0 -> 0
GAINED:13
LOST:  0

Note: The new functions are made virtual because I expect we'll soon lift
the pre-regalloc scheduling heuristic over to the vec4 backend.
---
 .../drivers/dri/i965/brw_schedule_instructions.cpp | 144 +
 1 file changed, 144 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp 
b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
index 5a42513..53fffa7 100644
--- a/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp
@@ -417,6 +417,13 @@ public:
   this->instructions_to_schedule = 0;
   this->post_reg_alloc = post_reg_alloc;
   this->time = 0;
+  if (!post_reg_alloc) {
+ this->remaining_grf_uses = rzalloc_array(mem_ctx, int, grf_count);
+ this->grf_active = rzalloc_array(mem_ctx, bool, grf_count);
+  } else {
+ this->remaining_grf_uses = NULL;
+ this->grf_active = NULL;
+  }
}
 
~instruction_scheduler()
@@ -442,6 +449,10 @@ public:
 */
virtual int issue_time(backend_instruction *inst) = 0;
 
+   virtual void count_remaining_grf_uses(backend_instruction *inst) = 0;
+   virtual void update_register_pressure(backend_instruction *inst) = 0;
+   virtual int get_register_pressure_benefit(backend_instruction *inst) = 0;
+
void schedule_instructions(backend_instruction *next_block_header);
 
void *mem_ctx;
@@ -452,6 +463,22 @@ public:
int time;
exec_list instructions;
backend_visitor *bv;
+
+   /**
+* Number of instructions left to schedule that reference each vgrf.
+*
+* Used so that we can prefer scheduling instructions that will end the
+* live intervals of multiple variables, to reduce register pressure.
+*/
+   int *remaining_grf_uses;
+
+   /**
+* Tracks whether each VGRF has had an instruction scheduled that uses it.
+*
+* This is used to estimate whether scheduling a new instruction will
+* increase register pressure.
+*/
+   bool *grf_active;
 };
 
 class fs_instruction_scheduler : public instruction_scheduler
@@ -463,6 +490,10 @@ public:
schedule_node *choose_instruction_to_schedule();
int issue_time(backend_instruction *inst);
fs_visitor *v;
+
+   void count_remaining_grf_uses(backend_instruction *inst);
+   void update_register_pressure(backend_instruction *inst);
+   int get_register_pressure_benefit(backend_instruction *inst);
 };
 
 fs_instruction_scheduler::fs_instruction_scheduler(fs_visitor *v,
@@ -473,6 +504,72 @@ 
fs_instruction_scheduler::fs_instruction_scheduler(fs_visitor *v,
 {
 }
 
+void
+fs_instruction_scheduler::count_remaining_grf_uses(backend_instruction *be)
+{
+   fs_inst *inst = (fs_inst *)be;
+
+   if (!remaining_grf_uses)
+  return;
+
+   if (inst->dst.file == GRF)
+  remaining_grf_uses[inst->dst.reg]++;
+
+   for (int i = 0; i < 3; i++) {
+  if (inst->src[i].file != GRF)
+ continue;
+
+  remaining_grf_uses[inst->src[i].reg]++;
+   }
+}
+
+void
+fs_instruction_scheduler::update_register_pressure(backend_instruction *be)
+{
+   fs_inst *inst = (fs_inst *)be;
+
+   if (!remaining_grf_uses)
+  return;
+
+   if (inst->dst.file == GRF) {
+  remaining_grf_uses[inst->dst.reg]--;
+  grf_active[inst->dst.reg] = true;
+   }
+
+   for (int i = 0; i < 3; i++) {
+  if (inst->src[i].file == GRF) {
+ remaining_grf_uses[inst->src[i].reg]--;
+ grf_active[inst->src[i].reg] = true;
+  }
+   }
+}
+
+int
+fs_instruction_scheduler::get_register_pressure_benefit(backend_instruction 
*be)
+{
+   fs_inst *inst = (fs_inst *)be;
+   int benefit = 0;
+
+   if (inst->dst.file == GRF) {
+  if (remaining_grf_uses[inst->dst.reg] == 1)
+ benefit += v->virtual_grf_sizes[inst->dst.reg];
+  if (!grf_active[inst->dst.reg])
+ benefit -= v->virtual_grf_sizes[inst->dst.reg];
+   }
+
+   for (int i = 0; i < 3; i++) {
+  if (inst->src[i].file != GRF)
+ continue;
+
+  if (remaining_grf_uses[inst->src[i].reg] == 1)
+ benefit += v->virtual_grf_sizes[inst->src[i].reg];
+  if (!grf_active[inst->src[i].reg])
+ benefit -= v->v

[Mesa-dev] [PATCH 1/3] i965: Add a warning if something ever hits a bug I noticed.

2013-11-05 Thread Eric Anholt
We'd have to map the VBO and rewrite things to a lower stride to fix it.
---
 src/mesa/drivers/dri/i965/brw_draw_upload.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c 
b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 4da1b7e..8b1f0c5 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -607,6 +607,7 @@ static void brw_prepare_vertices(struct brw_context *brw)
 
 static void brw_emit_vertices(struct brw_context *brw)
 {
+   struct gl_context *ctx = &brw->ctx;
GLuint i, nr_elements;
 
brw_prepare_vertices(brw);
@@ -678,6 +679,9 @@ static void brw_emit_vertices(struct brw_context *brw)
  if (brw->gen == 7)
dw0 |= GEN7_MOCS_L3 << 16;
 
+ WARN_ONCE(buffer->stride >= (brw->gen >= 5 ? 2048 : 2047),
+   "VBO stride %d too large, bad rendering may occur\n",
+   buffer->stride);
 OUT_BATCH(dw0 | (buffer->stride << BRW_VB0_PITCH_SHIFT));
 OUT_RELOC(buffer->bo, I915_GEM_DOMAIN_VERTEX, 0, buffer->offset);
 if (brw->gen >= 5) {
-- 
1.8.4.rc3

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


[Mesa-dev] [PATCH 2/3] i965: Fix undefined value usage in ABO setup.

2013-11-05 Thread Eric Anholt
Fixes a compiler warning.
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 46871c7..cbeaa32 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -885,7 +885,7 @@ brw_upload_abo_surfaces(struct brw_context *brw,
   struct intel_buffer_object *intel_bo =
  intel_buffer_object(binding->BufferObject);
   drm_intel_bo *bo = intel_bufferobj_buffer(
- brw, intel_bo, binding->Offset, bo->size - binding->Offset);
+ brw, intel_bo, binding->Offset, intel_bo->Base.Size - 
binding->Offset);
 
   brw->vtbl.create_raw_surface(brw, bo, binding->Offset,
bo->size - binding->Offset,
-- 
1.8.4.rc3

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


Re: [Mesa-dev] [PATCH 5/7] mesa: Update TexStorage to support ARB_texture_view

2013-11-05 Thread Chris Forbes
You also need to update teximagemultisample (in teximage.c) which
handles TexStorageMultisample* to do similar things.

-- Chris

On Wed, Nov 6, 2013 at 11:59 AM, Courtney Goeltzenleuchter
 wrote:
> TexStorage now updates texture object state needed by
> ARB_texture_view extension.
>
> Set appropriate TextureView state in texture object.
> ---
>  src/mesa/main/texstorage.c | 33 +
>  1 file changed, 33 insertions(+)
>
> diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
> index 84b8f82..4da3c91 100644
> --- a/src/mesa/main/texstorage.c
> +++ b/src/mesa/main/texstorage.c
> @@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
> GLenum internalformat,
>   return;
>}
>
> +  /* If the command is successful,
> +   * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
> +   * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
> +   * If the texture target is TEXTURE_1D_ARRAY then
> +   * TEXTURE_VIEW_NUM_LAYERS becomes height.
> +   * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
> +   * or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS 
> becomes depth.
> +   * If the texture target is TEXTURE_CUBE_MAP, then
> +   * TEXTURE_VIEW_NUM_LAYERS becomes 6.
> +   * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
> +   */
> +
>texObj->Immutable = GL_TRUE;
>texObj->ImmutableLevels = levels;
> +  texObj->MinLevel = 0;
> +  texObj->NumLevels = levels;
> +  texObj->MinLayer = 0;
> +  texObj->NumLayers = 1;
> +  switch (target)
> +  {
> +  case GL_TEXTURE_1D_ARRAY:
> + texObj->NumLayers = height;
> + break;
> +
> +  case GL_TEXTURE_2D_ARRAY:
> +  case GL_TEXTURE_CUBE_MAP_ARRAY:
> +  case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> + texObj->NumLayers = depth;
> + break;
> +
> +  case GL_TEXTURE_CUBE_MAP:
> + texObj->NumLayers = 6;
> + break;
> +  }
> +
> }
>  }
>
> --
> 1.8.1.2
>
> ___
> 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] mesa: for GLSL_DUMP_ON_ERROR, also dump the info log

2013-11-05 Thread Brian Paul
Since it's helpful to know why the shader did not compile.
Also, call fflush() for Windows.
---
 src/mesa/main/shaderapi.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 7da860d..1d9aac3 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -825,6 +825,8 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj)
  fprintf(stderr, "GLSL source for %s shader %d:\n",
  _mesa_glsl_shader_target_name(sh->Type), sh->Name);
  fprintf(stderr, "%s\n", sh->Source);
+ fprintf(stderr, "Info Log:\n%s\n", sh->InfoLog);
+ fflush(stderr);
   }
 
   if (ctx->Shader.Flags & GLSL_REPORT_ERRORS) {
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 2/2] mesa: Build program as part of libmesa.

2013-11-05 Thread Matt Turner
---
Right you are! This version fixes out of tree builds by mkdir'ing
the program folder in the builddir.


 Makefile.am  |  2 +-
 configure.ac |  1 -
 src/mesa/Makefile.am | 26 +
 src/mesa/program/Makefile.am | 45 
 4 files changed, 19 insertions(+), 55 deletions(-)
 delete mode 100644 src/mesa/program/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index 343bade..361fb51 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,7 +64,7 @@ IGNORE_FILES = \
 
 parsers: configure
$(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp 
glcpp/glcpp-lex.c glcpp/glcpp-parse.c glcpp/glcpp-parse.h
-   $(MAKE) -C src/mesa/program lex.yy.c program_parse.tab.c 
program_parse.tab.h
+   $(MAKE) -C src/mesa program/lex.yy.c program/program_parse.tab.c 
program/program_parse.tab.h
 
 # Everything for new a Mesa release:
 ARCHIVES = $(PACKAGE_NAME).tar.gz \
diff --git a/configure.ac b/configure.ac
index 0a25047..bbdad83 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2096,7 +2096,6 @@ AC_CONFIG_FILES([Makefile
src/mesa/drivers/x11/Makefile
src/mesa/main/tests/Makefile
src/mesa/main/tests/hash_table/Makefile
-   src/mesa/program/Makefile
src/mesa/x86-64/Makefile
src/mesa/x86/Makefile])
 
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 6ce31d2..a54b8ac 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -19,7 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-SUBDIRS = program x86 x86-64 . main/tests
+SUBDIRS = x86 x86-64 . main/tests
 
 if HAVE_X11_DRIVER
 SUBDIRS += drivers/x11
@@ -59,11 +59,17 @@ main/git_sha1.h: main/git_sha1.h.tmp
 GLAPI = $(top_srcdir)/src/mapi/glapi/gen
 include $(GLAPI)/glapi_gen.mk
 
+BUILDDIR = $(builddir)/
+include Makefile.sources
+
 BUILT_SOURCES = \
main/git_sha1.h \
-   main/get_hash.h
+   main/get_hash.h \
+   $(BUILDDIR)program/program_parse.tab.c \
+   $(BUILDDIR)program/lex.yy.c
 CLEANFILES = \
$(BUILT_SOURCES) \
+   $(BUILDDIR)program/program_parse.tab.h \
git_sha1.h.tmp
 
 GET_HASH_GEN = main/get_hash_generator.py
@@ -85,9 +91,6 @@ if HAVE_GALLIUM
 noinst_LTLIBRARIES += libmesagallium.la
 endif
 
-BUILDDIR = $(builddir)/
-include Makefile.sources
-
 AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
 AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
@@ -109,26 +112,33 @@ endif
 
 libmesa_la_SOURCES = \
$(MESA_FILES) \
+   $(PROGRAM_FILES) \
 $(MESA_ASM_FILES_FOR_ARCH)
 
 libmesa_la_LIBADD = \
 $(top_builddir)/src/glsl/libglsl.la \
-$(top_builddir)/src/mesa/program/libprogram.la \
 $()
-libmesa_la_LDFLAGS =
 
 libmesagallium_la_SOURCES = \
$(MESA_GALLIUM_FILES) \
+   $(PROGRAM_FILES) \
 $(MESA_ASM_FILES_FOR_ARCH)
 
 libmesagallium_la_LIBADD = \
 $(top_builddir)/src/glsl/libglsl.la \
-$(top_builddir)/src/mesa/program/libprogram.la \
 $()
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
 
+$(BUILDDIR)program/lex.yy.c: program/program_lexer.l
+   $(MKDIR_P) $(builddir)/program
+   $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
+
+$(BUILDDIR)program/program_parse.tab.c $(BUILDDIR)program/program_parse.tab.h: 
program/program_parse.y
+   $(MKDIR_P) $(builddir)/program
+   $(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d 
--output=$(BUILDDIR)program/program_parse.tab.c $<
+
 # Emacs tags
 tags:
etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h
diff --git a/src/mesa/program/Makefile.am b/src/mesa/program/Makefile.am
deleted file mode 100644
index 5e05782..000
--- a/src/mesa/program/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright © 2012 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, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT O

Re: [Mesa-dev] Fix crashes with static LLVM

2013-11-05 Thread Tom Stellard
On Wed, Oct 23, 2013 at 04:26:18PM -0400, Tom Stellard wrote:
> Hi,
> 
> The attached patches introduce linker scripts to the pipe-loader and
> egl-static targets.  The linker scripts prevents these targets from
> exporting LLVM (and other) symbols that they shouldn't be.  This fixes
> several crashes in the radeon drivers when statically linking LLVM.
> 
> With these patches: clover, glamor, and the egl demos from the mesa-demo repo 
> all
> work for me with statically linked LLVM, but I would like to get confirmation 
> that
> this works for other people too, so if you care about these use cases, please 
> test
> and let me know the results.
> 

I have gotten some positive feedback on these patches from testers, so
if there are no objections, I will push these tomorrow.

-Tom

> Thanks,
> Tom
> 
> ___
> 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] i965/fs: Fix message setup for SIMD8 spills.

2013-11-05 Thread Eric Anholt
In the SIMD16 spilling changes, I replaced a "1" in the spill path with
"mlen", but obviously it wasn't mlen before because spills have the g0
header along with the payload. The interface I was trying to use was
asking for how many physical regs we're writing, so we're looking for "1"
or "2".

I'm guessing this actually passed piglit because the high 8 bits of the
execution mask in SIMD8 mode are all 0s.
---
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp 
b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 63ac530..83917f5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -757,7 +757,7 @@ fs_generator::generate_scratch_write(fs_inst *inst, struct 
brw_reg src)
   retype(brw_message_reg(inst->base_mrf + 1), BRW_REGISTER_TYPE_UD),
   retype(src, BRW_REGISTER_TYPE_UD));
brw_oword_block_write_scratch(p, brw_message_reg(inst->base_mrf),
- inst->mlen, inst->offset);
+ dispatch_width / 8, inst->offset);
 }
 
 void
-- 
1.8.4.rc3

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


Re: [Mesa-dev] [PATCH 0/8] Add DRIimage-based DRI3/Present loader

2013-11-05 Thread Keith Packard
Eric Anholt  writes:

> It seems like we could just stick these things in __DRI_CORE as opposed
> to having another new extension to look up.

Having the driver expose this new extension is how I tell that the
driver is going to actually call the __DRIimage-based loader; the
alternative to a new extension would be to stick a flag in the
__DRI_CORE structure.

> The downside I see there is
> bugs in the server, which have patches at xserver-driinterface-versions
> of my tree.  (Unfortunately, I'm having a hard time building the server
> currently, so no testing yet).  Having a new extension whose name has
> nothing to do with the functions in it seems really weird.

It defines the interface to a driver which will be using the image
loader to allocate color buffers if available. The fact that the image
loader and DRI2 loader can both share the same driver interface is a
happy coincidence.

-- 
keith.pack...@intel.com


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


Re: [Mesa-dev] [PATCH 4/4] i965: Combine {brw, gen7}_update_texture_buffer_surface() functions.

2013-11-05 Thread Paul Berry
On 1 November 2013 20:23, Kenneth Graunke  wrote:

> Now that brw_update_texture_buffer_surface() uses the virtual
> emit_buffer_surface_state() function, it works for Gen7+ too.
>
> Signed-off-by: Kenneth Graunke 
>

Series is:

Reviewed-by: Paul Berry 


> ---
>  src/mesa/drivers/dri/i965/brw_context.h   |  3 ++
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c  |  2 +-
>  src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 40
> +--
>  3 files changed, 5 insertions(+), 40 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 85bba1d..2294ce0 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -1579,6 +1579,9 @@ void brw_create_constant_surface(struct brw_context
> *brw,
>   uint32_t size,
>   uint32_t *out_offset,
>   bool dword_pitch);
> +void brw_update_buffer_texture_surface(struct gl_context *ctx,
> +   unsigned unit,
> +   uint32_t *surf_offset);
>  void
>  brw_update_sol_surface(struct brw_context *brw,
> struct gl_buffer_object *buffer_obj,
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 5a60a6b..2088688 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -226,7 +226,7 @@ gen4_emit_buffer_surface_state(struct brw_context *brw,
> }
>  }
>
> -static void
> +void
>  brw_update_buffer_texture_surface(struct gl_context *ctx,
>unsigned unit,
>uint32_t *surf_offset)
> diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> index c52e12d..3f4817d 100644
> --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> @@ -268,44 +268,6 @@ gen7_emit_buffer_surface_state(struct brw_context
> *brw,
>  }
>
>  static void
> -gen7_update_buffer_texture_surface(struct gl_context *ctx,
> -   unsigned unit,
> -   uint32_t *surf_offset)
> -{
> -   struct brw_context *brw = brw_context(ctx);
> -   struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
> -   struct intel_buffer_object *intel_obj =
> -  intel_buffer_object(tObj->BufferObject);
> -   uint32_t size = tObj->BufferSize;
> -   drm_intel_bo *bo = NULL;
> -
> -   if (intel_obj) {
> -  size = MIN2(size, intel_obj->Base.Size);
> -  bo = intel_bufferobj_buffer(brw, intel_obj, tObj->BufferOffset,
> size);
> -   }
> -
> -   gl_format format = tObj->_BufferObjectFormat;
> -
> -   uint32_t surface_format = brw_format_for_mesa_format(format);
> -   if (surface_format == 0 && format != MESA_FORMAT_RGBA_FLOAT32) {
> -  _mesa_problem(NULL, "bad format %s for texture buffer\n",
> -_mesa_get_format_name(format));
> -   }
> -
> -   int texel_size = _mesa_get_format_bytes(format);
> -
> -   gen7_emit_buffer_surface_state(brw,
> -  surf_offset,
> -  bo,
> -  tObj->BufferOffset,
> -  surface_format,
> -  size / texel_size,
> -  texel_size,
> -  0 /* mocs */,
> -  false /* rw */);
> -}
> -
> -static void
>  gen7_update_texture_surface(struct gl_context *ctx,
>  unsigned unit,
>  uint32_t *surf_offset,
> @@ -319,7 +281,7 @@ gen7_update_texture_surface(struct gl_context *ctx,
> struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
>
> if (tObj->Target == GL_TEXTURE_BUFFER) {
> -  gen7_update_buffer_texture_surface(ctx, unit, surf_offset);
> +  brw_update_buffer_texture_surface(ctx, unit, surf_offset);
>return;
> }
>
> --
> 1.8.3.2
>
> ___
> 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] st/vdpau: resolve delayed rendering for GL interop

2013-11-05 Thread Grigori Goronzy
Otherwise OutputSurface interop has funny results sometimes.
This fixes interop with the mpv media player.
---
 src/gallium/state_trackers/vdpau/output.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/vdpau/output.c 
b/src/gallium/state_trackers/vdpau/output.c
index def01c8..76c7312 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -734,5 +734,6 @@ struct pipe_resource 
*vlVdpOutputSurfaceGallium(VdpOutputSurface surface)
if (!vlsurface || !vlsurface->surface)
   return NULL;
 
+   vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
return vlsurface->surface->texture;
 }
-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH 2/2] mesa: Build program as part of libmesa.

2013-11-05 Thread Emil Velikov
On 05/11/13 00:11, Matt Turner wrote:
> ---
>  Makefile.am  |  2 +-
>  configure.ac |  1 -
>  src/mesa/Makefile.am | 24 +++
>  src/mesa/program/Makefile.am | 45 
> 
>  4 files changed, 17 insertions(+), 55 deletions(-)
>  delete mode 100644 src/mesa/program/Makefile.am
> 
Hi Matt,
This commit seems to break out-of tree builds on my system :'(

  GEN  main/get_hash.h
  GEN  program/program_parse.tab.c
bison: ./program/program_parse.output: cannot open: No such file or
directory
Makefile:4105: recipe for target 'program/program_parse.tab.c' failed

Cheers
Emil
> diff --git a/Makefile.am b/Makefile.am
> index 343bade..361fb51 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -64,7 +64,7 @@ IGNORE_FILES = \
>  
>  parsers: configure
>   $(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp 
> glcpp/glcpp-lex.c glcpp/glcpp-parse.c glcpp/glcpp-parse.h
> - $(MAKE) -C src/mesa/program lex.yy.c program_parse.tab.c 
> program_parse.tab.h
> + $(MAKE) -C src/mesa program/lex.yy.c program/program_parse.tab.c 
> program/program_parse.tab.h
>  
>  # Everything for new a Mesa release:
>  ARCHIVES = $(PACKAGE_NAME).tar.gz \
> diff --git a/configure.ac b/configure.ac
> index 0a25047..bbdad83 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2096,7 +2096,6 @@ AC_CONFIG_FILES([Makefile
>   src/mesa/drivers/x11/Makefile
>   src/mesa/main/tests/Makefile
>   src/mesa/main/tests/hash_table/Makefile
> - src/mesa/program/Makefile
>   src/mesa/x86-64/Makefile
>   src/mesa/x86/Makefile])
>  
> diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
> index 6ce31d2..b4ad9fc 100644
> --- a/src/mesa/Makefile.am
> +++ b/src/mesa/Makefile.am
> @@ -19,7 +19,7 @@
>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
>  # IN THE SOFTWARE.
>  
> -SUBDIRS = program x86 x86-64 . main/tests
> +SUBDIRS = x86 x86-64 . main/tests
>  
>  if HAVE_X11_DRIVER
>  SUBDIRS += drivers/x11
> @@ -59,9 +59,15 @@ main/git_sha1.h: main/git_sha1.h.tmp
>  GLAPI = $(top_srcdir)/src/mapi/glapi/gen
>  include $(GLAPI)/glapi_gen.mk
>  
> +BUILDDIR = $(builddir)/
> +include Makefile.sources
> +
>  BUILT_SOURCES = \
>   main/git_sha1.h \
> - main/get_hash.h
> + main/get_hash.h \
> + $(BUILDDIR)program/program_parse.tab.c \
> + $(BUILDDIR)program/program_parse.tab.h \
> + $(BUILDDIR)program/lex.yy.c
>  CLEANFILES = \
>   $(BUILT_SOURCES) \
>   git_sha1.h.tmp
> @@ -85,9 +91,6 @@ if HAVE_GALLIUM
>  noinst_LTLIBRARIES += libmesagallium.la
>  endif
>  
> -BUILDDIR = $(builddir)/
> -include Makefile.sources
> -
>  AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
>  AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
>  AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
> @@ -109,26 +112,31 @@ endif
>  
>  libmesa_la_SOURCES = \
>   $(MESA_FILES) \
> + $(PROGRAM_FILES) \
>  $(MESA_ASM_FILES_FOR_ARCH)
>  
>  libmesa_la_LIBADD = \
>  $(top_builddir)/src/glsl/libglsl.la \
> -$(top_builddir)/src/mesa/program/libprogram.la \
>  $()
> -libmesa_la_LDFLAGS =
>  
>  libmesagallium_la_SOURCES = \
>   $(MESA_GALLIUM_FILES) \
> + $(PROGRAM_FILES) \
>  $(MESA_ASM_FILES_FOR_ARCH)
>  
>  libmesagallium_la_LIBADD = \
>  $(top_builddir)/src/glsl/libglsl.la \
> -$(top_builddir)/src/mesa/program/libprogram.la \
>  $()
>  
>  pkgconfigdir = $(libdir)/pkgconfig
>  pkgconfig_DATA = gl.pc
>  
> +$(BUILDDIR)program/lex.yy.c: program/program_lexer.l
> + $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
> +
> +$(BUILDDIR)program/program_parse.tab.c 
> $(BUILDDIR)program/program_parse.tab.h: program/program_parse.y
> + $(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d 
> --output=$(BUILDDIR)program/program_parse.tab.c $<
> +
>  # Emacs tags
>  tags:
>   etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h
> diff --git a/src/mesa/program/Makefile.am b/src/mesa/program/Makefile.am
> deleted file mode 100644
> index 5e05782..000
> --- a/src/mesa/program/Makefile.am
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -# Copyright © 2012 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

Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Emil Velikov
On 05/11/13 18:55, Matt Turner wrote:
> On Tue, Nov 5, 2013 at 10:49 AM, Emil Velikov  
> wrote:
>> Now we have one intermediate library (archive), which links against both
>> mesa classic and gallium. Whereas with your patch it builds it twice but
>> drops the linking part. Is the extra recursion + linking that much more
>> significant than rebuilding the exact same source(s) twice ?
> 
> It's not building it twice (just like it doesn't build other sources
> common to libmesa and libmesagallium twice).
> 
> It builds the sources once and links them into libmesa and
> libmesagallium, instead of going through the intermediate step of
> linking them into libprogram.
> 
Not sure where in mesa I saw this, but I could swear it was rebuilding
the same source(s) twice. Seems that I was a bit in the clouds on this one.

I'll drop the "moving moving sources list(s)" part but would like to
keep the cleanups.

~Emil


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


[Mesa-dev] [PATCH 2/3] build: Change HAVE_X86_ASM to mean x86 or x86-64 asm.

2013-11-05 Thread Matt Turner
I want a conditional that says generally "we have x86 assembly" in the
next patch.
---
 configure.ac   | 2 +-
 src/mapi/glapi/Makefile.am | 5 +++--
 src/mapi/glapi/gen/Makefile.am | 6 +++---
 src/mesa/Makefile.am   | 7 ---
 src/mesa/x86/Makefile.am   | 2 ++
 5 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 633d86e..951f590 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1938,7 +1938,7 @@ AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" 
= xyes)
 AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
 
-AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86)
+AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86 -o "x$asm_arch" = 
xx86_64)
 AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64)
 AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
 
diff --git a/src/mapi/glapi/Makefile.am b/src/mapi/glapi/Makefile.am
index 05c67a6..bf653a3 100644
--- a/src/mapi/glapi/Makefile.am
+++ b/src/mapi/glapi/Makefile.am
@@ -33,10 +33,11 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/src/mesa
 
 if HAVE_X86_ASM
-GLAPI_ASM_SOURCES = $(X86_API)
-endif
 if HAVE_X86_64_ASM
 GLAPI_ASM_SOURCES = $(X86_64_API)
+else
+GLAPI_ASM_SOURCES = $(X86_API)
+endif
 endif
 if HAVE_SPARC_ASM
 GLAPI_ASM_SOURCES = $(SPARC_API)
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index cbbf659..13a544b 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -32,11 +32,11 @@ MESA_GLAPI_OUTPUTS = \
 
 MESA_GLAPI_ASM_OUTPUTS =
 if HAVE_X86_ASM
-MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86.S
-endif
-
 if HAVE_X86_64_ASM
 MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86-64.S
+else
+MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86.S
+endif
 endif
 
 if HAVE_SPARC_ASM
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index b4ad9fc..83d3d10 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -98,12 +98,13 @@ AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
 MESA_ASM_FILES_FOR_ARCH =
 
 if HAVE_X86_ASM
-MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
-AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
-endif
 if HAVE_X86_64_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
+else
+MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
+AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
+endif
 endif
 if HAVE_SPARC_ASM
 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
diff --git a/src/mesa/x86/Makefile.am b/src/mesa/x86/Makefile.am
index 1678576..9b4a2dd 100644
--- a/src/mesa/x86/Makefile.am
+++ b/src/mesa/x86/Makefile.am
@@ -20,6 +20,7 @@
 # IN THE SOFTWARE.
 
 if HAVE_X86_ASM
+if !HAVE_X86_64_ASM
 
 AM_CPPFLAGS = \
-I$(top_srcdir)/include \
@@ -47,3 +48,4 @@ matypes.h: gen_matypes
 endif
 
 endif
+endif
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 1/3] configure.ac: Test $asm_arch directly.

2013-11-05 Thread Matt Turner
---
 configure.ac | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 433470b..633d86e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1938,9 +1938,9 @@ AM_CONDITIONAL(HAVE_X11_DRIVER, test "x$enable_xlib_glx" 
= xyes)
 AM_CONDITIONAL(HAVE_OSMESA, test "x$enable_osmesa" = xyes)
 AM_CONDITIONAL(HAVE_GALLIUM_OSMESA, test "x$enable_gallium_osmesa" = xyes)
 
-AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
-AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 
2>&1)
-AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 
2>&1)
+AM_CONDITIONAL(HAVE_X86_ASM, test "x$asm_arch" = xx86)
+AM_CONDITIONAL(HAVE_X86_64_ASM, test "x$asm_arch" = xx86_64)
+AM_CONDITIONAL(HAVE_SPARC_ASM, test "x$asm_arch" = xsparc)
 
 AC_SUBST([VDPAU_MAJOR], 1)
 AC_SUBST([VDPAU_MINOR], 0)
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 3/3] build: Build gen_matypes and matypes.h from src/mesa.

2013-11-05 Thread Matt Turner
---
 configure.ac|  4 +---
 src/mesa/.gitignore |  2 ++
 src/mesa/Makefile.am| 16 +-
 src/mesa/x86-64/.gitignore  |  2 --
 src/mesa/x86-64/Makefile.am | 49 ---
 src/mesa/x86/.gitignore |  2 --
 src/mesa/x86/Makefile.am| 51 -
 7 files changed, 18 insertions(+), 108 deletions(-)
 create mode 100644 src/mesa/.gitignore
 delete mode 100644 src/mesa/x86-64/.gitignore
 delete mode 100644 src/mesa/x86-64/Makefile.am
 delete mode 100644 src/mesa/x86/.gitignore
 delete mode 100644 src/mesa/x86/Makefile.am

diff --git a/configure.ac b/configure.ac
index 951f590..3d4da78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2091,9 +2091,7 @@ AC_CONFIG_FILES([Makefile
src/mesa/drivers/osmesa/osmesa.pc
src/mesa/drivers/x11/Makefile
src/mesa/main/tests/Makefile
-   src/mesa/main/tests/hash_table/Makefile
-   src/mesa/x86-64/Makefile
-   src/mesa/x86/Makefile])
+   src/mesa/main/tests/hash_table/Makefile])
 
 dnl Sort the dirs alphabetically
 GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
diff --git a/src/mesa/.gitignore b/src/mesa/.gitignore
new file mode 100644
index 000..ca3130d
--- /dev/null
+++ b/src/mesa/.gitignore
@@ -0,0 +1,2 @@
+gen_matypes
+matypes.h
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 83d3d10..026a517 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -19,7 +19,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 # IN THE SOFTWARE.
 
-SUBDIRS = x86 x86-64 . main/tests
+SUBDIRS = . main/tests
 
 if HAVE_X11_DRIVER
 SUBDIRS += drivers/x11
@@ -98,6 +98,11 @@ AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
 MESA_ASM_FILES_FOR_ARCH =
 
 if HAVE_X86_ASM
+noinst_PROGRAMS = gen_matypes
+
+gen_matypes_SOURCES = x86/gen_matypes.c
+BUILT_SOURCES += matypes.h
+
 if HAVE_X86_64_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
@@ -138,6 +143,15 @@ $(BUILDDIR)program/lex.yy.c: program/program_lexer.l
 $(BUILDDIR)program/program_parse.tab.c $(BUILDDIR)program/program_parse.tab.h: 
program/program_parse.y
$(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d 
--output=$(BUILDDIR)program/program_parse.tab.c $<
 
+if GEN_ASM_OFFSETS
+matypes.h: $(gen_matypes_SOURCES)
+   $(AM_V_GEN)$(COMPILE) $< -DASM_OFFSETS -S -o - | \
+   sed -n '/^->/{s:^->::;/[$$]/{s:^:#define :;s:[$$]::};p}' > $@
+else
+matypes.h: gen_matypes
+   $(AM_V_GEN)./gen_matypes > $@
+endif
+
 # Emacs tags
 tags:
etags `find . -name \*.[ch]` $(top_srcdir)/include/GL/*.h
diff --git a/src/mesa/x86-64/.gitignore b/src/mesa/x86-64/.gitignore
deleted file mode 100644
index ca3130d..000
--- a/src/mesa/x86-64/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-gen_matypes
-matypes.h
diff --git a/src/mesa/x86-64/Makefile.am b/src/mesa/x86-64/Makefile.am
deleted file mode 100644
index b62387d..000
--- a/src/mesa/x86-64/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright © 2012 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, 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.
-
-if HAVE_X86_64_ASM
-
-AM_CPPFLAGS = \
-   -I$(top_srcdir)/include \
-   -I$(top_srcdir)/src/mesa \
-   -I$(top_srcdir)/src/mapi \
-   $(DEFINES)
-
-noinst_PROGRAMS = gen_matypes
-
-gen_matypes_SOURCES = ../x86/gen_matypes.c
-BUILT_SOURCES = matypes.h
-CLEANFILES = matypes.h
-
-if GEN_ASM_OFFSETS
-
-matypes.h: $(gen_matypes_SOURCES)
-   $(AM_V_GEN)$(COMPILE) $< -DASM_OFFSETS -S -o - | \
-   sed -n '/^->/{s:^->::;/[$$]/{s:^:#define :;s:[$$]::};p}' > $@
-
-else
-
-matypes.h: gen_matypes
-   $(AM_V_GEN)./gen_matypes > $@
-
-endif
-
-endif
diff --git a/src/mesa/x86/.gitignore b/src/mesa/x86/.gitignore
deleted file mode 100644
index ca3130d..00

[Mesa-dev] [PATCH] configure.ac: Drop no-out-of-tree notice.

2013-11-05 Thread Matt Turner
We do support out of tree builds now.

Cc: Colin Walters 
---
 configure.ac | 4 
 1 file changed, 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index bbdad83..433470b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,10 +14,6 @@ AC_CONFIG_MACRO_DIR([m4])
 AC_CANONICAL_SYSTEM
 AM_INIT_AUTOMAKE([foreign])
 
-dnl http://people.gnome.org/~walters/docs/build-api.txt
-dnl We don't support srcdir != builddir.
-echo \#buildapi-variable-no-builddir >/dev/null
-
 # Support silent build rules, requires at least automake-1.11. Disable
 # by either passing --disable-silent-rules to configure or passing V=1
 # to make
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 4/7] mesa: ARB_texture_view get parameters

2013-11-05 Thread Courtney Goeltzenleuchter
Add support for ARB_texture_view get parameters:
GL_TEXTURE_VIEW_MIN_LEVEL
GL_TEXTURE_VIEW_NUM_LEVELS
GL_TEXTURE_VIEW_MIN_LAYER
GL_TEXTURE_VIEW_NUM_LAYERS

Incorporate feedback regarding when to allow query of
GL_TEXTURE_IMMUTABLE_LEVELS.
---
 src/mesa/main/texparam.c | 60 
 1 file changed, 56 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d56b7d9..b3e2d0a 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1565,9 +1565,35 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, 
GLfloat *params )
  break;
 
   case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (!_mesa_is_gles3(ctx))
+ if (_mesa_is_gles3(ctx) ||
+ (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
+*params = (GLfloat) obj->ImmutableLevels;
+ else
+goto invalid_pname;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LEVEL:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->MinLevel;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LEVELS:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->NumLevels;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LAYER:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLfloat) obj->MinLayer;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LAYERS:
+ if (!ctx->Extensions.ARB_texture_view)
 goto invalid_pname;
- *params = (GLfloat) obj->ImmutableLevels;
+ *params = (GLfloat) obj->NumLayers;
  break;
 
   case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
@@ -1746,9 +1772,35 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, 
GLint *params )
  break;
 
   case GL_TEXTURE_IMMUTABLE_LEVELS:
- if (!_mesa_is_gles3(ctx))
+ if (_mesa_is_gles3(ctx) ||
+ (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
+*params = obj->ImmutableLevels;
+ else
+goto invalid_pname;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LEVEL:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->MinLevel;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LEVELS:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->NumLevels;
+ break;
+
+  case GL_TEXTURE_VIEW_MIN_LAYER:
+ if (!ctx->Extensions.ARB_texture_view)
+goto invalid_pname;
+ *params = (GLint) obj->MinLayer;
+ break;
+
+  case GL_TEXTURE_VIEW_NUM_LAYERS:
+ if (!ctx->Extensions.ARB_texture_view)
 goto invalid_pname;
- *params = obj->ImmutableLevels;
+ *params = (GLint) obj->NumLayers;
  break;
 
   case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 3/7] mesa: update texture object for ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
Add state needed by glTextureView to the gl_texture_object.
---
 src/mesa/main/mtypes.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index a35e9d9..2c5343c 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1192,6 +1192,11 @@ struct gl_texture_object
 pressure? */
GLboolean Immutable;/**< GL_ARB_texture_storage */
 
+   GLuint MinLevel;/**< GL_ARB_texture_view */
+   GLuint MinLayer;/**< GL_ARB_texture_view */
+   GLuint NumLevels;   /**< GL_ARB_texture_view */
+   GLuint NumLayers;   /**< GL_ARB_texture_view */
+
/** Actual texture images, indexed by [cube face] and [mipmap level] */
struct gl_texture_image *Image[MAX_FACES][MAX_TEXTURE_LEVELS];
 
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 5/7] mesa: Update TexStorage to support ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
TexStorage now updates texture object state needed by
ARB_texture_view extension.

Set appropriate TextureView state in texture object.
---
 src/mesa/main/texstorage.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 84b8f82..4da3c91 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
GLenum internalformat,
  return;
   }
 
+  /* If the command is successful,
+   * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
+   * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
+   * If the texture target is TEXTURE_1D_ARRAY then
+   * TEXTURE_VIEW_NUM_LAYERS becomes height.
+   * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
+   * or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes 
depth.
+   * If the texture target is TEXTURE_CUBE_MAP, then
+   * TEXTURE_VIEW_NUM_LAYERS becomes 6.
+   * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
+   */
+
   texObj->Immutable = GL_TRUE;
   texObj->ImmutableLevels = levels;
+  texObj->MinLevel = 0;
+  texObj->NumLevels = levels;
+  texObj->MinLayer = 0;
+  texObj->NumLayers = 1;
+  switch (target)
+  {
+  case GL_TEXTURE_1D_ARRAY:
+ texObj->NumLayers = height;
+ break;
+
+  case GL_TEXTURE_2D_ARRAY:
+  case GL_TEXTURE_CUBE_MAP_ARRAY:
+  case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+ texObj->NumLayers = depth;
+ break;
+
+  case GL_TEXTURE_CUBE_MAP:
+ texObj->NumLayers = 6;
+ break;
+  }
+
}
 }
 
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 1/7] mesa: Add API definitions for ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
Stub in glTextureView API call to go with the
glTextureView API xml definition.
Includes dispatch test for glTextureView
---
 src/mapi/glapi/gen/ARB_texture_view.xml | 23 
 src/mapi/glapi/gen/Makefile.am  |  1 +
 src/mapi/glapi/gen/gl_API.xml   |  6 ++-
 src/mapi/glapi/gen/gl_genexec.py|  1 +
 src/mesa/Makefile.sources   |  1 +
 src/mesa/SConscript |  1 +
 src/mesa/main/tests/dispatch_sanity.cpp |  2 +-
 src/mesa/main/textureview.c | 65 +
 src/mesa/main/textureview.h | 39 
 9 files changed, 137 insertions(+), 2 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_texture_view.xml
 create mode 100644 src/mesa/main/textureview.c
 create mode 100644 src/mesa/main/textureview.h

diff --git a/src/mapi/glapi/gen/ARB_texture_view.xml 
b/src/mapi/glapi/gen/ARB_texture_view.xml
new file mode 100644
index 000..3e6b8c9
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_texture_view.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+   
+  
+  
+  
+  
+  
+  
+  
+  
+   
+
+
+
+
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index cbbf659..68d36cc 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -124,6 +124,7 @@ API_XML = \
ARB_texture_rg.xml \
ARB_texture_storage_multisample.xml \
ARB_texture_storage.xml \
+   ARB_texture_view.xml \
ARB_vertex_array_object.xml \
AMD_draw_buffers_blend.xml \
AMD_performance_monitor.xml \
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 69014c5..e91cee9 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8458,7 +8458,11 @@
 
 
 
-
+
+
+http://www.w3.org/2001/XInclude"/>
+
+
 
 http://www.w3.org/2001/XInclude"/>
 
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index 3ce190f..b557b3b 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -102,6 +102,7 @@ header = """/**
 #include "main/texstate.h"
 #include "main/texstorage.h"
 #include "main/texturebarrier.h"
+#include "main/textureview.h"
 #include "main/transformfeedback.h"
 #include "main/mtypes.h"
 #include "main/varray.h"
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index a84f8a7..39525bc 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -103,6 +103,7 @@ MAIN_FILES = \
$(SRCDIR)main/texstate.c \
$(SRCDIR)main/texstorage.c \
$(SRCDIR)main/texstore.c \
+$(SRCDIR)main/textureview.c \
$(SRCDIR)main/texturebarrier.c \
$(SRCDIR)main/transformfeedback.c \
$(SRCDIR)main/uniforms.c \
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 4213498..581bd69 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -136,6 +136,7 @@ main_sources = [
 'main/texstorage.c',
 'main/texstore.c',
 'main/texturebarrier.c',
+'main/textureview.c',
 'main/transformfeedback.c',
 'main/uniform_query.cpp',
 'main/uniforms.c',
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 58cff9b..c28c111 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -853,7 +853,7 @@ const struct function gl_core_functions_possible[] = {
 // { "glDispatchCompute", 43, -1 }, // XXX: Add to xml
 // { "glDispatchComputeIndirect", 43, -1 }, // XXX: Add to xml
 // { "glCopyImageSubData", 43, -1 },// XXX: Add to xml
-// { "glTextureView", 43, -1 }, // XXX: Add to xml
+   { "glTextureView", 43, -1 },
 // { "glBindVertexBuffer", 43, -1 },// XXX: Add to xml
 // { "glVertexAttribFormat", 43, -1 },  // XXX: Add to xml
 // { "glVertexAttribIFormat", 43, -1 }, // XXX: Add to xml
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
new file mode 100644
index 000..4a6bd62
--- /dev/null
+++ b/src/mesa/main/textureview.c
@@ -0,0 +1,65 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2013 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT

[Mesa-dev] [PATCH 2/7] mesa: Tracking for ARB_texture_view extension

2013-11-05 Thread Courtney Goeltzenleuchter
---
 src/mesa/main/extensions.c | 1 +
 src/mesa/main/mtypes.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 48c4e9f..75591b0 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -156,6 +156,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_texture_rg",  o(ARB_texture_rg),  
GL, 2008 },
{ "GL_ARB_texture_storage", o(dummy_true),  
GL, 2011 },
{ "GL_ARB_texture_storage_multisample", o(ARB_texture_multisample), 
GL, 2012 },
+   { "GL_ARB_texture_view",o(ARB_texture_view),
GL, 2012 },
{ "GL_ARB_texture_swizzle", o(EXT_texture_swizzle), 
GL, 2008 },
{ "GL_ARB_timer_query", o(ARB_timer_query), 
GL, 2010 },
{ "GL_ARB_transform_feedback2", o(ARB_transform_feedback2), 
GL, 2010 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b5c5583..a35e9d9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3284,6 +3284,7 @@ struct gl_extensions
GLboolean ARB_texture_query_lod;
GLboolean ARB_texture_rg;
GLboolean ARB_texture_rgb10_a2ui;
+   GLboolean ARB_texture_view;
GLboolean ARB_timer_query;
GLboolean ARB_transform_feedback2;
GLboolean ARB_transform_feedback3;
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 6/7] mesa: Add driver entry point for ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
---
 src/mesa/drivers/common/driverfuncs.c | 3 +++
 src/mesa/main/dd.h| 5 +
 2 files changed, 8 insertions(+)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index 5faa98a..f185688 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -211,6 +211,9 @@ _mesa_init_driver_functions(struct dd_function_table 
*driver)
/* GL_ARB_texture_storage */
driver->AllocTextureStorage = _mesa_alloc_texture_storage;
 
+   /* GL_ARB_texture_view */
+   driver->TextureView = NULL;
+
/* GL_ARB_texture_multisample */
driver->GetSamplePosition = NULL;
 }
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index d7c4327..6690e5a 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -375,6 +375,11 @@ struct dd_function_table {
 GLsizei levels, GLsizei width,
 GLsizei height, GLsizei depth);
 
+   /** Called as part of glTextureView to add views to origTexObj */
+   GLboolean (*TextureView)(struct gl_context *ctx,
+struct gl_texture_object *texObj,
+struct gl_texture_object *origTexObj);
+
/**
 * Map a renderbuffer into user space.
 * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and
-- 
1.8.1.2

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


[Mesa-dev] [PATCH 7/7] mesa: Fill out ARB_texture_view entry points

2013-11-05 Thread Courtney Goeltzenleuchter
Add Mesa TextureView logic.
Incorporate feedback on ARB_texture_view
---
 src/mesa/main/texstorage.c  |   3 +-
 src/mesa/main/textureview.c | 558 +++-
 2 files changed, 558 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 4da3c91..8519bb8 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -454,8 +454,7 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
GLenum internalformat,
   texObj->NumLevels = levels;
   texObj->MinLayer = 0;
   texObj->NumLayers = 1;
-  switch (target)
-  {
+  switch (target) {
   case GL_TEXTURE_1D_ARRAY:
  texObj->NumLayers = height;
  break;
diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c
index 4a6bd62..a30598d 100644
--- a/src/mesa/main/textureview.c
+++ b/src/mesa/main/textureview.c
@@ -42,6 +42,340 @@
 #include "textureview.h"
 #include "mtypes.h"
 
+/* Table 3.X.2 (Compatible internal formats for TextureView)
+---
+| Class | Internal formats|
+---
+| VIEW_CLASS_128_BITS   | RGBA32F, RGBA32UI, RGBA32I  |
+---
+| VIEW_CLASS_96_BITS| RGB32F, RGB32UI, RGB32I |
+---
+| VIEW_CLASS_64_BITS| RGBA16F, RG32F, RGBA16UI, RG32UI, RGBA16I,  |
+|   | RG32I, RGBA16, RGBA16_SNORM |
+---
+| VIEW_CLASS_48_BITS| RGB16, RGB16_SNORM, RGB16F, RGB16UI, RGB16I |
+---
+| VIEW_CLASS_32_BITS| RG16F, R11F_G11F_B10F, R32F,|
+|   | RGB10_A2UI, RGBA8UI, RG16UI, R32UI, |
+|   | RGBA8I, RG16I, R32I, RGB10_A2, RGBA8, RG16, |
+|   | RGBA8_SNORM, RG16_SNORM, SRGB8_ALPHA8, RGB9_E5  |
+---
+| VIEW_CLASS_24_BITS| RGB8, RGB8_SNORM, SRGB8, RGB8UI, RGB8I  |
+---
+| VIEW_CLASS_16_BITS| R16F, RG8UI, R16UI, RG8I, R16I, RG8, R16,   |
+|   | RG8_SNORM, R16_SNORM|
+---
+| VIEW_CLASS_8_BITS | R8UI, R8I, R8, R8_SNORM |
+---
+| VIEW_CLASS_RGTC1_RED  | COMPRESSED_RED_RGTC1,   |
+|   | COMPRESSED_SIGNED_RED_RGTC1 |
+---
+| VIEW_CLASS_RGTC2_RG   | COMPRESSED_RG_RGTC2,|
+|   | COMPRESSED_SIGNED_RG_RGTC2  |
+---
+| VIEW_CLASS_BPTC_UNORM | COMPRESSED_RGBA_BPTC_UNORM, |
+|   | COMPRESSED_SRGB_ALPHA_BPTC_UNORM|
+---
+| VIEW_CLASS_BPTC_FLOAT | COMPRESSED_RGB_BPTC_SIGNED_FLOAT,   |
+|   | COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT  |
+---
+ */
+struct internal_format_class_info {
+   GLenum view_class;
+   GLenum internal_format;
+};
+#define INFO(c,f) {GL_##c, GL_##f}
+static const struct internal_format_class_info _compatible_internal_formats[] 
= {
+   INFO(VIEW_CLASS_128_BITS, RGBA32F),
+   INFO(VIEW_CLASS_128_BITS, RGBA32UI),
+   INFO(VIEW_CLASS_128_BITS, RGBA32I),
+   INFO(VIEW_CLASS_96_BITS, RGB32F),
+   INFO(VIEW_CLASS_96_BITS, RGB32UI),
+   INFO(VIEW_CLASS_96_BITS, RGB32I),
+   INFO(VIEW_CLASS_64_BITS, RGBA16F),
+   INFO(VIEW_CLASS_64_BITS, RG32F),
+   INFO(VIEW_CLASS_64_BITS, RGBA16UI),
+   INFO(VIEW_CLASS_64_BITS, RG32UI),
+   INFO(VIEW_CLASS_64_BITS, RGBA16I),
+   INFO(VIEW_CLASS_64_BITS, RG32I),
+   INFO(VIEW_CLASS_64_BITS, RGBA16),
+   INFO(VIEW_CLASS_64_BITS, RGBA16_SNORM),
+   INFO(VIEW_CLASS_48_BITS, RGB16),
+   INFO(VIEW_CLASS_48_BITS, RGB16_SNORM),
+   INFO(VIEW_CLASS_48_BITS, RGB16F),
+   INFO(VIEW_CLASS_48_BITS, RGB16UI),
+   INFO(VIEW_CLASS_48_BITS, RGB16I),
+   INFO(VIEW_CLASS_32_BITS, RG16F),
+   INFO(VIEW_CLASS_32_BITS, R11F_G11F_

[Mesa-dev] [PATCH 0/7] Add ARB_texture_view

2013-11-05 Thread Courtney Goeltzenleuchter
The following patches add the necessary functions to Mesa
to support ARB_texture_view. These patches do not include
the actual driver elements, just the device independent portion.
This extension requires ARB_texture_storage.

The extension supports one new API call, glTextureView and
a handful of enums that have been added as queriable texture
parameters.

Adds one new driver entry point for the driver to
map the view specified onto the origtexture given.

Passes non-rendering ARB_texture_view piglit tests (recently added).

Courtney Goeltzenleuchter (7):
  mesa: Add API definitions for ARB_texture_view
  mesa: Tracking for ARB_texture_view extension
  mesa: update texture object for ARB_texture_view
  mesa: ARB_texture_view get parameters
  mesa: Update TexStorage to support ARB_texture_view
  mesa: Add driver entry point for ARB_texture_view
  mesa: Fill out ARB_texture_view entry points

 src/mapi/glapi/gen/ARB_texture_view.xml |  23 ++
 src/mapi/glapi/gen/Makefile.am  |   1 +
 src/mapi/glapi/gen/gl_API.xml   |   6 +-
 src/mapi/glapi/gen/gl_genexec.py|   1 +
 src/mesa/Makefile.sources   |   1 +
 src/mesa/SConscript |   1 +
 src/mesa/drivers/common/driverfuncs.c   |   3 +
 src/mesa/main/dd.h  |   5 +
 src/mesa/main/extensions.c  |   1 +
 src/mesa/main/mtypes.h  |   6 +
 src/mesa/main/tests/dispatch_sanity.cpp |   2 +-
 src/mesa/main/texparam.c|  60 ++-
 src/mesa/main/texstorage.c  |  32 ++
 src/mesa/main/textureview.c | 621 
 src/mesa/main/textureview.h |  39 ++
 15 files changed, 796 insertions(+), 6 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_texture_view.xml
 create mode 100644 src/mesa/main/textureview.c
 create mode 100644 src/mesa/main/textureview.h

-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH] i965/fs: New peephole optimization to flatten IF/BREAK/ENDIF.

2013-11-05 Thread Paul Berry
On 1 November 2013 17:31, Matt Turner  wrote:

> total instructions in shared programs: 1649485 -> 1649157 (-0.02%)
> instructions in affected programs: 7823 -> 7495 (-4.19%)
> ---
>  src/mesa/drivers/dri/i965/Makefile.sources |  1 +
>  src/mesa/drivers/dri/i965/brw_fs.cpp   |  1 +
>  src/mesa/drivers/dri/i965/brw_fs.h |  1 +
>  .../dri/i965/brw_fs_peephole_predicated_break.cpp  | 96
> ++
>  4 files changed, 99 insertions(+)
>  create mode 100644
> src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
>
> diff --git a/src/mesa/drivers/dri/i965/Makefile.sources
> b/src/mesa/drivers/dri/i965/Makefile.sources
> index 14b2f61..fcc6fdb 100644
> --- a/src/mesa/drivers/dri/i965/Makefile.sources
> +++ b/src/mesa/drivers/dri/i965/Makefile.sources
> @@ -59,6 +59,7 @@ i965_FILES = \
> brw_fs_fp.cpp \
> brw_fs_generator.cpp \
> brw_fs_live_variables.cpp \
> +   brw_fs_peephole_predicated_break.cpp \
> brw_fs_reg_allocate.cpp \
> brw_fs_vector_splitting.cpp \
> brw_fs_visitor.cpp \
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 7064910..5c8443f 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -3149,6 +3149,7 @@ fs_visitor::run()
>  progress = opt_algebraic() || progress;
>  progress = opt_cse() || progress;
>  progress = opt_copy_propagate() || progress;
> + progress = opt_peephole_predicated_break() || progress;
>  progress = dead_code_eliminate() || progress;
>  progress = dead_code_eliminate_local() || progress;
>  progress = register_coalesce() || progress;
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.h
> b/src/mesa/drivers/dri/i965/brw_fs.h
> index 43e4761..09e5174 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.h
> +++ b/src/mesa/drivers/dri/i965/brw_fs.h
> @@ -362,6 +362,7 @@ public:
> bool try_emit_saturate(ir_expression *ir);
> bool try_emit_mad(ir_expression *ir, int mul_arg);
> void try_replace_with_sel();
> +   bool opt_peephole_predicated_break();
> void emit_bool_to_cond_code(ir_rvalue *condition);
> void emit_if_gen6(ir_if *ir);
> void emit_unspill(fs_inst *inst, fs_reg reg, uint32_t spill_offset,
> diff --git
> a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
> b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
> new file mode 100644
> index 000..7845113
> --- /dev/null
> +++ b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
> @@ -0,0 +1,96 @@
> +/*
> + * 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, 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.
> + */
> +
> +#include "brw_fs.h"
> +#include "brw_cfg.h"
> +
> +/** @file brw_fs_peephole_predicated_break.cpp
> + *
> + * Loops are often structured as
> + *
> + * loop:
> + *CMP.f0
> + *(+f0) IF
> + *BREAK
> + *ENDIF
> + *...
> + *WHILE loop
> + *
> + * This peephole pass removes the IF and ENDIF instructions and
> predicates the
> + * BREAK, dropping two instructions from the loop body.
>

Instead of this special-purpose peephole optimization, I'm wondering if it
would be more useful to create a more general optimization pass that just
converts the entire IF block to predicated instructions, assuming certain
conditions hold.  Those conditions would be something like:

- If any instruction but the last writes to the flag register, then don't
do the optimization.
- If there's nested control flow, then don't do the optimization.
- If any instruction inside the IF block is incompatible with predication
(are there any such instructions?  I don't know) then don't do the
optimization.
- If the block is larger than a certain heuristically-determined size, then
don't do the optimiza

Re: [Mesa-dev] [PATCH 5/8] dri/common: Add functions mapping MESA_FORMAT_* <-> __DRI_IMAGE_FORMAT_*

2013-11-05 Thread Jordan Justen
On Mon, Nov 4, 2013 at 8:11 PM, Keith Packard  wrote:
> Jordan Justen  writes:
>> After patch 6, this will add SARGB8, right? So, maybe add this to the
>> commit message, or separate out adding SARGB8 into a separate commit?
>
> I added the SARGB8 define in patch 4; is there some other separation you
> think would be warranted?

I was just noting that a side effect of patch five is adding support
for SARGB8. When you remove the code in patch 6, and use these, you've
now added support for this new format.

Not important, but I thought it might be worth noting in the commit
message. Actually probably noting it in the commit message for patch 6
is better since the change happens at that point.

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


[Mesa-dev] [PATCH 02/11] mesa: Split out the format code from update_array()

2013-11-05 Thread Fredrik Höglund
Split out the code for updating the array format into a new function
called update_array_format(). This function will be called by both
update_array() and the new glVertexAttrib*Format() entry points in
ARB_vertex_attrib_binding.

Reviewed-by: Eric Anholt 
Reviewed-by: Ian Romanick 
---
 src/mesa/main/varray.c |  150 ++--
 1 file changed, 93 insertions(+), 57 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 24cd324..bb26b09 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -103,52 +103,33 @@ type_to_bit(const struct gl_context *ctx, GLenum type)
 
 
 /**
- * Do error checking and update state for glVertex/Color/TexCoord/...Pointer
- * functions.
+ * Does error checking and updates the format in an attrib array.
  *
- * \param func  name of calling function used for error reporting
- * \param attrib  the attribute array index to update
- * \param legalTypes  bitmask of *_BIT above indicating legal datatypes
- * \param sizeMin  min allowable size value
- * \param sizeMax  max allowable size value (may also be BGRA_OR_4)
- * \param size  components per element (1, 2, 3 or 4)
- * \param type  datatype of each component (GL_FLOAT, GL_INT, etc)
- * \param stride  stride between elements, in elements
- * \param normalized  are integer types converted to floats in [-1, 1]?
- * \param integer  integer-valued values (will not be normalized to [-1,1])
- * \param ptr  the address (or offset inside VBO) of the array data
+ * Called by update_array().
+ *
+ * \param funcName of calling function used for error reporting
+ * \param attrib  The index of the attribute array
+ * \param legalTypes  Bitmask of *_BIT above indicating legal datatypes
+ * \param sizeMin Min allowable size value
+ * \param sizeMax Max allowable size value (may also be BGRA_OR_4)
+ * \param sizeComponents per element (1, 2, 3 or 4)
+ * \param typeDatatype of each component (GL_FLOAT, GL_INT, etc)
+ * \param normalized  Whether integer types are converted to floats in [-1, 1]
+ * \param integer Integer-valued values (will not be normalized to [-1, 1])
  */
-static void
-update_array(struct gl_context *ctx,
- const char *func,
- GLuint attrib, GLbitfield legalTypesMask,
- GLint sizeMin, GLint sizeMax,
- GLint size, GLenum type, GLsizei stride,
- GLboolean normalized, GLboolean integer,
- const GLvoid *ptr)
+static bool
+update_array_format(struct gl_context *ctx,
+const char *func,
+GLuint attrib, GLbitfield legalTypesMask,
+GLint sizeMin, GLint sizeMax,
+GLint size, GLenum type,
+GLboolean normalized, GLboolean integer)
 {
struct gl_client_array *array;
GLbitfield typeBit;
-   GLsizei elementSize;
+   GLuint elementSize;
GLenum format = GL_RGBA;
 
-   /* Page 407 (page 423 of the PDF) of the OpenGL 3.0 spec says:
-*
-* "Client vertex arrays - all vertex array attribute pointers must
-* refer to buffer objects (section 2.9.2). The default vertex array
-* object (the name zero) is also deprecated. Calling
-* VertexAttribPointer when no buffer object or no vertex array object
-* is bound will generate an INVALID_OPERATION error..."
-*
-* The check for VBOs is handled below.
-*/
-   if (ctx->API == API_OPENGL_CORE
-   && (ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj)) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no array object bound)",
-  func);
-  return;
-   }
-
if (_mesa_is_gles(ctx)) {
   legalTypesMask &= ~(FIXED_GL_BIT | DOUBLE_BIT);
 
@@ -186,7 +167,7 @@ update_array(struct gl_context *ctx,
if (typeBit == 0x0 || (typeBit & legalTypesMask) == 0x0) {
   _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)",
   func, _mesa_lookup_enum_by_nr(type));
-  return;
+  return false;
}
 
/* Do size parameter checking.
@@ -206,26 +187,26 @@ update_array(struct gl_context *ctx,
*...
*• size is BGRA and normalized is FALSE;"
*/
-  GLboolean bgra_error = GL_FALSE;
+  bool bgra_error = false;
 
   if (ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) {
  if (type != GL_UNSIGNED_INT_2_10_10_10_REV &&
  type != GL_INT_2_10_10_10_REV &&
  type != GL_UNSIGNED_BYTE)
-bgra_error = GL_TRUE;
+bgra_error = true;
   } else if (type != GL_UNSIGNED_BYTE)
- bgra_error = GL_TRUE;
+ bgra_error = true;
 
   if (bgra_error) {
  _mesa_error(ctx, GL_INVALID_OPERATION, "%s(size=GL_BGRA and type=%s)",
  func, _mesa_lookup_enum_by_nr(type));
- return;
+ return false;
   }
 
   if (!normalized) {
  _mesa_error(ctx, GL_INVALID_OPERATION,
  "

[Mesa-dev] [PATCH 11/11] docs: Mark ARB_vertex_attrib_binding as done, update relnotes

2013-11-05 Thread Fredrik Höglund
---
 docs/GL3.txt|2 +-
 docs/relnotes/10.0.html |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 03b24ed..c35f014 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -161,7 +161,7 @@ GL_ARB_texture_buffer_range  DONE 
(nv50, nvc0, i965, r60
 GL_ARB_texture_query_levels  DONE (i965)
 GL_ARB_texture_storage_multisample   DONE (all drivers that 
support GL_ARB_texture_multisample)
 GL_ARB_texture_view  not started
-GL_ARB_vertex_attrib_binding started (Fredrik)
+GL_ARB_vertex_attrib_binding DONE (all drivers)
 
 
 GL 4.4:
diff --git a/docs/relnotes/10.0.html b/docs/relnotes/10.0.html
index 5ff5339..82599dd 100644
--- a/docs/relnotes/10.0.html
+++ b/docs/relnotes/10.0.html
@@ -50,6 +50,7 @@ Note: some of the new features are only available with 
certain drivers.
 GL_ARB_texture_query_levels on i965.
 GL_ARB_texture_mirror_clamp_to_edge.
 GL_ARB_transform_feedback2, GL_ARB_transform_feedback3, and 
GL_ARB_transform_feedback_instanced on i965/Gen7 (with appropriate kernel 
support).
+GL_ARB_vertex_attrib_binding
 GL_KHR_debug
 
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 03/11] mesa: Rename gl_array_object::VertexAttrib to _VertexAttrib

2013-11-05 Thread Fredrik Höglund
This will become derived state as part of the ARB_vertex_attrib_binding
support.

Reviewed-by: Eric Anholt 
Reviewed-by: Ian Romanick 
---
 src/mesa/main/api_arrayelt.c |   36 ++---
 src/mesa/main/api_validate.c |6 ++--
 src/mesa/main/arrayobj.c |   26 +++
 src/mesa/main/attrib.c   |4 +--
 src/mesa/main/bufferobj.c|4 +--
 src/mesa/main/enable.c   |   36 ++---
 src/mesa/main/ffvertex_prog.c|2 +-
 src/mesa/main/get.c  |6 ++--
 src/mesa/main/get_hash_params.py |   66 +++---
 src/mesa/main/getstring.c|   18 +--
 src/mesa/main/mtypes.h   |2 +-
 src/mesa/main/varray.c   |   50 ++---
 src/mesa/vbo/vbo_exec_array.c|   12 +++
 13 files changed, 134 insertions(+), 134 deletions(-)

diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
index ea09238..5a316f0 100644
--- a/src/mesa/main/api_arrayelt.c
+++ b/src/mesa/main/api_arrayelt.c
@@ -1486,45 +1486,45 @@ _ae_update_state(struct gl_context *ctx)
actx->nr_vbos = 0;
 
/* conventional vertex arrays */
-   if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
-  aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
+   if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
+  aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
   aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)];
   check_vbo(actx, aa->array->BufferObj);
   aa++;
}
-   if (arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
-  aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG];
+   if (arrayObj->_VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
+  aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_EDGEFLAG];
   aa->offset = _gloffset_EdgeFlagv;
   check_vbo(actx, aa->array->BufferObj);
   aa++;
}
-   if (arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
-  aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL];
+   if (arrayObj->_VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
+  aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_NORMAL];
   aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)];
   check_vbo(actx, aa->array->BufferObj);
   aa++;
}
-   if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
-  aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0];
+   if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
+  aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR0];
   aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)];
   check_vbo(actx, aa->array->BufferObj);
   aa++;
}
-   if (arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
-  aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1];
+   if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
+  aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR1];
   aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
   check_vbo(actx, aa->array->BufferObj);
   aa++;
}
-   if (arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
-  aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_FOG];
+   if (arrayObj->_VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
+  aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_FOG];
   aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
   check_vbo(actx, aa->array->BufferObj);
   aa++;
}
for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
   struct gl_client_array *attribArray =
- &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(i)];
+ &arrayObj->_VertexAttrib[VERT_ATTRIB_TEX(i)];
   if (attribArray->Enabled) {
  /* NOTE: we use generic glVertexAttribNV functions here.
   * If we ever remove GL_NV_vertex_program this will have to change.
@@ -1543,7 +1543,7 @@ _ae_update_state(struct gl_context *ctx)
/* generic vertex attribute arrays */
for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) {  /* skip zero! */
   struct gl_client_array *attribArray =
- &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(i)];
+ &arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC(i)];
   if (attribArray->Enabled) {
  GLint intOrNorm;
  at->array = attribArray;
@@ -1570,18 +1570,18 @@ _ae_update_state(struct gl_context *ctx)
}
 
/* finally, vertex position */
-   if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
+   if (arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) {
   /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's
* issued as the last (provoking) attribute).
*/
-  aa->array = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0];
+  aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC0];
   assert(aa->array->Size >= 2); /* XXX fix someday? */
   aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)];
   check_vbo(actx

[Mesa-dev] [PATCH 08/11] mesa: Handle zero-stride arrays in _mesa_update_array_max_element()

2013-11-05 Thread Fredrik Höglund
Reviewed-by: Eric Anholt 
Reviewed-by: Ian Romanick 
---
 src/mesa/main/varray.h |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index a75cb7d..8a9487c 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -51,8 +51,10 @@ _mesa_update_array_max_element(struct gl_client_array *array)
   GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size;
 
   if (offset < bufSize) {
-array->_MaxElement = (bufSize - offset + array->StrideB
-   - array->_ElementSize) / array->StrideB;
+ const GLuint stride = array->StrideB ?
+ array->StrideB : array->_ElementSize;
+ array->_MaxElement = (bufSize - offset + stride
+  - array->_ElementSize) / stride;
   }
   else {
 array->_MaxElement = 0;
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 09/11] mesa: Optimize rebinding the same VBO

2013-11-05 Thread Fredrik Höglund
Check if the new buffer object has the same name as the current
buffer object before looking it up.

Reviewed-by: Eric Anholt 
---
 src/mesa/main/varray.c |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 39e5ad3..1025d67 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1351,9 +1351,10 @@ void GLAPIENTRY
 _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
GLsizei stride)
 {
+   GET_CURRENT_CONTEXT(ctx);
+   const struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
struct gl_buffer_object *vbo;
 
-   GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END(ctx);
 
/* The ARB_vertex_attrib_binding spec says:
@@ -1398,7 +1399,9 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint 
buffer, GLintptr offset,
   return;
}
 
-   if (buffer != 0) {
+   if (buffer == 
arrayObj->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) {
+  vbo = 
arrayObj->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj;
+   } else if (buffer != 0) {
   vbo = _mesa_lookup_bufferobj(ctx, buffer);
 
   /* From the GL_ARB_vertex_attrib_array spec:
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 05/11] glapi: Add infrastructure for ARB_vertex_attrib_binding

2013-11-05 Thread Fredrik Höglund
Reviewed-by: Eric Anholt 
Reviewed-by: Ian Romanick 
---
 src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml |   58 ++
 src/mapi/glapi/gen/Makefile.am   |1 +
 src/mapi/glapi/gen/gl_API.xml|6 ++-
 src/mesa/main/tests/dispatch_sanity.cpp  |   12 ++---
 src/mesa/main/varray.c   |   43 
 src/mesa/main/varray.h   |   23 +
 6 files changed, 136 insertions(+), 7 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml

diff --git a/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml 
b/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml
new file mode 100644
index 000..0ee6a3c
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_vertex_attrib_binding.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index cbbf659..9c25387 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -125,6 +125,7 @@ API_XML = \
ARB_texture_storage_multisample.xml \
ARB_texture_storage.xml \
ARB_vertex_array_object.xml \
+   ARB_vertex_attrib_binding.xml \
AMD_draw_buffers_blend.xml \
AMD_performance_monitor.xml \
ARB_vertex_type_2_10_10_10_rev.xml \
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 69014c5..a2d914a 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8458,7 +8458,11 @@
 
 
 
-
+
+
+http://www.w3.org/2001/XInclude"/>
+
+
 
 http://www.w3.org/2001/XInclude"/>
 
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index 58cff9b..922f0ac 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -854,12 +854,12 @@ const struct function gl_core_functions_possible[] = {
 // { "glDispatchComputeIndirect", 43, -1 }, // XXX: Add to xml
 // { "glCopyImageSubData", 43, -1 },// XXX: Add to xml
 // { "glTextureView", 43, -1 }, // XXX: Add to xml
-// { "glBindVertexBuffer", 43, -1 },// XXX: Add to xml
-// { "glVertexAttribFormat", 43, -1 },  // XXX: Add to xml
-// { "glVertexAttribIFormat", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribLFormat", 43, -1 }, // XXX: Add to xml
-// { "glVertexAttribBinding", 43, -1 }, // XXX: Add to xml
-// { "glVertexBindingDivisor", 43, -1 },// XXX: Add to xml
+   { "glBindVertexBuffer", 43, -1 },
+   { "glVertexAttribFormat", 43, -1 },
+   { "glVertexAttribIFormat", 43, -1 },
+   { "glVertexAttribLFormat", 43, -1 },
+   { "glVertexAttribBinding", 43, -1 },
+   { "glVertexBindingDivisor", 43, -1 },
 // { "glVertexArrayBindVertexBufferEXT", 43, -1 },  // XXX: Add to xml
 // { "glVertexArrayVertexAttribFormatEXT", 43, -1 },// XXX: Add to xml
 // { "glVertexArrayVertexAttribIFormatEXT", 43, -1 },   // XXX: Add to xml
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index e6997f4..a705b6b 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1231,6 +1231,49 @@ _mesa_primitive_restart_index(const struct gl_context 
*ctx, GLenum ib_type)
 
 
 /**
+ * GL_ARB_vertex_attrib_binding
+ */
+void GLAPIENTRY
+_mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
+   GLsizei stride)
+{
+}
+
+
+void GLAPIENTRY
+_mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type,
+ GLboolean normalized, GLuint relativeOffset)
+{
+}
+
+
+void GLAPIENTRY
+_mesa_VertexAttribIFormat(GLuint attribIndex, GLint size, GLenum type,
+  GLuint relativeOffset)
+{
+}
+
+
+void GLAPIENTRY
+_mesa_VertexAttribLFormat(GLuint attribIndex, GLint size, GLenum type,
+  GLuint relativeOffset)
+{
+}
+
+
+void GLAPIENTRY
+_mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
+{
+}
+
+
+void GLAPIENTRY
+_mesa_VertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
+{
+}
+
+
+/**
  * Copy one client vertex array to another.
  */
 void
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 7e611e8..2b54fde 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -250,6 +250,29 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor);
 extern unsigned
 _mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type);
 
+extern void GLAPIENTRY
+_mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,

[Mesa-dev] [PATCH 00/11] Implement GL_ARB_vertex_attrib_binding

2013-11-05 Thread Fredrik Höglund
So here's ARB_vertex_attrib_binding, take two.

This incorporates all the feedback from Eric and Ian.

Patches 6, 7, and 8 in the previous series have now been squashed into
patch 5.  This is unfortunate, since patch 5 was already larger than
I would have liked, but unfortunately it's necessary to avoid piglit
regressions between patches 5 and 8.

This series is also available at:

git://people.freedesktop.org/~fredrik/mesa arb-vertex-attrib-binding-2

Fredrik

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


[Mesa-dev] [PATCH 10/11] mesa: Enable ARB_vertex_attrib_binding

2013-11-05 Thread Fredrik Höglund
---
 src/mesa/main/extensions.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 48c4e9f..0815eec 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -165,6 +165,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_uniform_buffer_object",   
o(ARB_uniform_buffer_object),   GL, 2009 },
{ "GL_ARB_vertex_array_bgra",   o(EXT_vertex_array_bgra),   
GL, 2008 },
{ "GL_ARB_vertex_array_object", o(dummy_true),  
GL, 2006 },
+   { "GL_ARB_vertex_attrib_binding",   o(dummy_true),  
GL, 2012 },
{ "GL_ARB_vertex_buffer_object",o(dummy_true),  
GLL,2003 },
{ "GL_ARB_vertex_program",  o(ARB_vertex_program),  
GLL,2002 },
{ "GL_ARB_vertex_shader",   o(ARB_vertex_shader),   
GL, 2002 },
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 07/11] mesa: Add Get* support for ARB_vertex_attrib_binding

2013-11-05 Thread Fredrik Höglund
Reviewed-by: Eric Anholt 
Reviewed-by: Ian Romanick 
---
 src/mesa/main/get.c  |   24 
 src/mesa/main/get_hash_params.py |4 
 src/mesa/main/varray.c   |   10 ++
 3 files changed, 38 insertions(+)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index a0dd7cf..eee8550 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1740,6 +1740,30 @@ find_value_indexed(const char *func, GLenum pname, 
GLuint index, union value *v)
  goto invalid_value;
   v->value_int64 = ctx->AtomicBufferBindings[index].Size;
   return TYPE_INT64;
+
+   case GL_VERTEX_BINDING_DIVISOR:
+  if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_instanced_arrays)
+  goto invalid_enum;
+  if (index >= ctx->Const.VertexProgram.MaxAttribs)
+  goto invalid_value;
+  v->value_int = 
ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
+  return TYPE_INT;
+
+   case GL_VERTEX_BINDING_OFFSET:
+  if (!_mesa_is_desktop_gl(ctx))
+  goto invalid_enum;
+  if (index >= ctx->Const.VertexProgram.MaxAttribs)
+  goto invalid_value;
+  v->value_int = 
ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
+  return TYPE_INT;
+
+   case GL_VERTEX_BINDING_STRIDE:
+  if (!_mesa_is_desktop_gl(ctx))
+  goto invalid_enum;
+  if (index >= ctx->Const.VertexProgram.MaxAttribs)
+  goto invalid_value;
+  v->value_int = 
ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
+  return TYPE_INT;
}
 
  invalid_enum:
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 5ecfbbc..c961fee 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -737,6 +737,10 @@ descriptor=[
   [ "MAX_GEOMETRY_ATOMIC_COUNTERS", 
"CONTEXT_INT(Const.GeometryProgram.MaxAtomicCounters), 
extra_ARB_shader_atomic_counters_and_geometry_shader" ],
   [ "MAX_COMBINED_ATOMIC_COUNTER_BUFFERS", 
"CONTEXT_INT(Const.MaxCombinedAtomicBuffers), extra_ARB_shader_atomic_counters" 
],
   [ "MAX_COMBINED_ATOMIC_COUNTERS", 
"CONTEXT_INT(Const.MaxCombinedAtomicCounters), 
extra_ARB_shader_atomic_counters" ],
+
+# GL_ARB_vertex_attrib_binding
+  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
"CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
+  [ "MAX_VERTEX_ATTRIB_BINDINGS", 
"CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ],
 ]},
 
 # Enums restricted to OpenGL Core profile
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index b0e0286..39e5ad3 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -747,6 +747,16 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint 
index, GLenum pname,
  return arrayObj->VertexBinding[array->VertexBinding].InstanceDivisor;
   }
   goto error;
+   case GL_VERTEX_ATTRIB_BINDING:
+  if (_mesa_is_desktop_gl(ctx)) {
+ return array->VertexBinding - VERT_ATTRIB_GENERIC0;
+  }
+  goto error;
+   case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
+  if (_mesa_is_desktop_gl(ctx)) {
+ return array->RelativeOffset;
+  }
+  goto error;
default:
   ; /* fall-through */
}
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 04/11] mesa: Make handle_bind_buffer_gen() non-static

2013-11-05 Thread Fredrik Höglund
...and rename it to _mesa_bind_buffer_gen().

This is so the function can be called from _mesa_BindVertexBuffer().

This patch also adds a caller parameter so we can report the right
entry point in error messages.

Based on a patch by Eric Anholt.

Reviewed-by: Eric Anholt 
Reviewed-by: Ian Romanick 
---
 src/mesa/main/bufferobj.c |   24 ++--
 src/mesa/main/bufferobj.h |9 -
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 54bba1a..15ec40c 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -655,16 +655,17 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
}
 }
 
-static bool
-handle_bind_buffer_gen(struct gl_context *ctx,
-  GLenum target,
-  GLuint buffer,
-  struct gl_buffer_object **buf_handle)
+bool
+_mesa_handle_bind_buffer_gen(struct gl_context *ctx,
+ GLenum target,
+ GLuint buffer,
+ struct gl_buffer_object **buf_handle,
+ const char *caller)
 {
struct gl_buffer_object *buf = *buf_handle;
 
if (!buf && ctx->API == API_OPENGL_CORE) {
-  _mesa_error(ctx, GL_INVALID_OPERATION, "glBindBuffer(non-gen name)");
+  _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", caller);
   return false;
}
 
@@ -675,7 +676,7 @@ handle_bind_buffer_gen(struct gl_context *ctx,
   ASSERT(ctx->Driver.NewBufferObject);
   buf = ctx->Driver.NewBufferObject(ctx, buffer, target);
   if (!buf) {
-_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB");
+_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
 return false;
   }
   _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, buf);
@@ -719,7 +720,8 @@ bind_buffer_object(struct gl_context *ctx, GLenum target, 
GLuint buffer)
else {
   /* non-default buffer object */
   newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
-  if (!handle_bind_buffer_gen(ctx, target, buffer, &newBufObj))
+  if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
+&newBufObj, "glBindBuffer"))
  return;
}

@@ -2181,7 +2183,8 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
} else {
   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
}
-   if (!handle_bind_buffer_gen(ctx, target, buffer, &bufObj))
+   if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
+ &bufObj, "glBindBufferRange"))
   return;
 
if (!bufObj) {
@@ -2227,7 +2230,8 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint 
buffer)
} else {
   bufObj = _mesa_lookup_bufferobj(ctx, buffer);
}
-   if (!handle_bind_buffer_gen(ctx, target, buffer, &bufObj))
+   if (!_mesa_handle_bind_buffer_gen(ctx, target, buffer,
+ &bufObj, "glBindBufferBase"))
   return;
 
if (!bufObj) {
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 9b582f8c..0b898a2 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -28,7 +28,7 @@
 #ifndef BUFFEROBJ_H
 #define BUFFEROBJ_H
 
-
+#include 
 #include "mtypes.h"
 
 
@@ -62,6 +62,13 @@ _mesa_init_buffer_objects( struct gl_context *ctx );
 extern void
 _mesa_free_buffer_objects( struct gl_context *ctx );
 
+extern bool
+_mesa_handle_bind_buffer_gen(struct gl_context *ctx,
+ GLenum target,
+ GLuint buffer,
+ struct gl_buffer_object **buf_handle,
+ const char *caller);
+
 extern void
 _mesa_update_default_objects_buffer_objects(struct gl_context *ctx);
 
-- 
1.7.10.4

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


[Mesa-dev] [PATCH 01/11] mesa: Restore gl_array_object::NewArray

2013-11-05 Thread Fredrik Höglund
This will be used by the ARB_vertex_attrib_binding implementation.
This reverts commit db38e9a0e179441f59274f6f2a751912c29872e2.

Reviewed-by: Eric Anholt 
Reviewed-by: Ian Romanick 
---
 src/mesa/main/enable.c |2 ++
 src/mesa/main/mtypes.h |3 +++
 src/mesa/main/state.c  |1 +
 src/mesa/main/varray.c |4 
 4 files changed, 10 insertions(+)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index dd6a772..c047f5d 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -135,6 +135,8 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean 
state)
else
   arrayObj->_Enabled &= ~flag;
 
+   arrayObj->NewArrays |= flag;
+
if (ctx->Driver.Enable) {
   ctx->Driver.Enable( ctx, cap, state );
}
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b5c5583..500f670 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1513,6 +1513,9 @@ struct gl_array_object
/** Mask of VERT_BIT_* values indicating which arrays are enabled */
GLbitfield64 _Enabled;
 
+   /** Mask of VERT_BIT_* values indicating changed/dirty arrays */
+   GLbitfield64 NewArrays;
+
/**
 * Min of all enabled arrays' _MaxElement.  When arrays reside inside VBOs
 * we can determine the max legal (in bounds) glDrawElements array index.
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 2392641..bf21631 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -430,6 +430,7 @@ _mesa_update_state_locked( struct gl_context *ctx )
new_state = ctx->NewState | new_prog_state;
ctx->NewState = 0;
ctx->Driver.UpdateState(ctx, new_state);
+   ctx->Array.ArrayObj->NewArrays = 0x0;
 }
 
 
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index dee476a..24cd324 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -286,6 +286,7 @@ update_array(struct gl_context *ctx,
  ctx->Array.ArrayBufferObj);
 
ctx->NewState |= _NEW_ARRAY;
+   ctx->Array.ArrayObj->NewArrays |= VERT_BIT(attrib);
 }
 
 
@@ -537,6 +538,7 @@ _mesa_EnableVertexAttribArray(GLuint index)
   FLUSH_VERTICES(ctx, _NEW_ARRAY);
   arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE;
   arrayObj->_Enabled |= VERT_BIT_GENERIC(index);
+  arrayObj->NewArrays |= VERT_BIT_GENERIC(index);
}
 }
 
@@ -562,6 +564,7 @@ _mesa_DisableVertexAttribArray(GLuint index)
   FLUSH_VERTICES(ctx, _NEW_ARRAY);
   arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE;
   arrayObj->_Enabled &= ~VERT_BIT_GENERIC(index);
+  arrayObj->NewArrays |= VERT_BIT_GENERIC(index);
}
 }
 
@@ -1161,6 +1164,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
if (array->InstanceDivisor != divisor) {
   FLUSH_VERTICES(ctx, _NEW_ARRAY);
   array->InstanceDivisor = divisor;
+  ctx->Array.ArrayObj->NewArrays |= VERT_BIT(VERT_ATTRIB_GENERIC(index));
}
 }
 
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH] glsl: cleanup, remove duplicate assignment

2013-11-05 Thread Paul Berry
On 1 November 2013 03:21, Tapani Pälli  wrote:

> Signed-off-by: Tapani Pälli 
> ---
>  src/glsl/glsl_parser_extras.cpp | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/glsl/glsl_parser_extras.cpp
> b/src/glsl/glsl_parser_extras.cpp
> index be17109..8f66d5f 100644
> --- a/src/glsl/glsl_parser_extras.cpp
> +++ b/src/glsl/glsl_parser_extras.cpp
> @@ -1521,7 +1521,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx,
> struct gl_shader *shader,
> shader->CompileStatus = !state->error;
> shader->InfoLog = state->info_log;
> shader->Version = state->language_version;
> -   shader->InfoLog = state->info_log;
> shader->IsES = state->es_shader;
>
> memcpy(shader->builtins_to_link, state->builtins_to_link,
> --
> 1.8.1.4
>

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


Re: [Mesa-dev] [v2 6/6] mesa: OES_get_program_binary functionality

2013-11-05 Thread Paul Berry
On 1 November 2013 05:08, Tapani Pälli  wrote:

> On 11/01/2013 12:38 PM, Erik Faye-Lund wrote:
>
>> On Fri, Nov 1, 2013 at 11:35 AM, Tapani Pälli 
>> wrote:
>>
>>> On 11/01/2013 12:21 PM, Erik Faye-Lund wrote:
>>>

 Won't using the git-sha1 as a compatibility-criteria cause issues for
 developers with local changes? I'm not so worried about this for
 OES_get_program_binary itself, but once the shader-cache is in place
 it sounds like a potential source of difficult to track down
 misbehavior...

>>>
>>> I agree it might be too aggressive criteria but it is hard to come up
>>> with
>>> better and as simple.
>>>
>> That's not my objection. My objection is that this might give
>> headaches for people with local modifications to the glsl-compiler.
>> Local modifications does not affect the git-sha1.
>>
>
> For the automatic shader cache this headache could be helped a bit with a
> environment variable or drirc setting that can be used during development.
> On the other hand an automatic cache must work in a transparent way so it
> should be always able to recover when it fails, so one should only see it
> as 'slower than usual' (since recompilation/relink required) sort of
> behaviour. The WIP of the automatic cache I sent some time earlier also
> marked (renamed) these 'problematic' cached shaders so that they can be
> detected on further runs and cache can ignore those.
>
> I agree that it might become problematic, on the other hand it is also
> easy to just wipe ~/.cache/mesa and disable cache. Not sure if Nvidia or
> Imagination try to handles these cases with their cache implementations.
>

I'm also concerned about this, especially for the automatic shader cache.
During development, we frequently make small changes to the front end,
recompile, and then run a small test program, expecting our changes to take
effect.  I'm very worried about requiring developers to remember to set an
environment variable, change a drirc setting, or wipe out a cache when
making changes that haven't been committed yet.  Especially when the
consequence of forgetting to do so is that the change you were trying to
make won't have any observed effect.  That's the sort of thing that leads
people to spend hours chasing phantom bugs.

How about if we have the cache mechanism include the modification time of
the mesa .so in the shader binary (in addition to the sha), and reject
shader binaries that don't have a matching modification time?  That way if
mesa is recompiled, any previously-cached shaders will automatically become
invalid without the developer having to do any work.


A related concern I have is: what happens if someone changes their video
card, or transplants their hard drive into a different machine that has
different graphics hardware?  Different back-ends have different settings
of ctx->ShaderCompilerOptions (some back-ends have different values from
one chipset to another), so even if the version of Mesa is the same and
there are no local developer changes, the linked IR is not going to
necessarily be the same if the graphics hardware changes.

To address this, I'd recommend that we also include the device's PCI ID in
the shader binary, and reject mismatched binaries.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 0/8] Add DRIimage-based DRI3/Present loader

2013-11-05 Thread Kristian Høgsberg
On Tue, Nov 05, 2013 at 12:04:32PM -0800, Eric Anholt wrote:
> Keith Packard  writes:
> 
> > Keith Packard  writes:
> >
> >> This sequence first adds a a couple of new DRIimage extensions to the
> >> dri/common, dri/i915 and dri/i965 directories which define a
> >> loader-independent API for managing window system operations.
> >>
> >> The last patch adds a new DRI3000 loader using those new interfaces.
> >
> > I've figured out that I can also re-use dri2CreateNewScreen2 for the
> > image driver bits, as long as I change that function to also look up the
> > image loader. That means there are *no* new dri_util functions needed.
> >
> > To recap, the changes needed to support using the DRIimageExtension
> > interfaces for allocating buffers from the driver in the loader are:
> >
> > DRIimageDriverExtension
> >
> > A proper subset of DRIdri2DriverExtension, which uses
> > the same five functions involved in creating new objects:
> >
> >/* Common DRI functions, shared with DRI2 */
> >__DRIcreateNewScreen2createNewScreen2;
> >__DRIcreateNewDrawable   createNewDrawable;
> >__DRIcreateNewContextcreateNewContext;
> >__DRIcreateContextAttribscreateContextAttribs;
> >__DRIgetAPIMask  getAPIMask;
> 
> It seems like we could just stick these things in __DRI_CORE as opposed
> to having another new extension to look up.  The downside I see there is
> bugs in the server, which have patches at xserver-driinterface-versions
> of my tree.  (Unfortunately, I'm having a hard time building the server
> currently, so no testing yet).  Having a new extension whose name has
> nothing to do with the functions in it seems really weird.

It may make more sense to just extend the existing interfaces, but
when we discussed DRIimageDriverExtension, the idea was that we could
phase out DRIdri2Extension.  I think that still makes sense but
introducing more extensions doesn't make this interface better.

The way this was done originally was that we have DRIcoreExtension
which provided DRI1 support.  The DRIdri2Extension extension replaces
some of the core functions (it has a createNewScreen that doesn't take
a sarea handle, for example...) and allows a loader to implement DRI2,
but you have to use both extensions.  DRIswrastExtension works in a
similar for swrast.

The idea was to share the core functionality, but it's obviously messy
to have to mix two extensions to get things working.  If we're
introducing a new extension, I'd suggest we move the functions from
DRIcoreExtension that we still use into this new extension and make it
completely replace DRIcoreExtension and DRIdri2Extension.  The
functions from the core extension we still use are:

void (*destroyScreen)(__DRIscreen *screen);

const __DRIextension **(*getExtensions)(__DRIscreen *screen);

int (*getConfigAttrib)(const __DRIconfig *config,
   unsigned int attrib,
   unsigned int *value);

int (*indexConfigAttrib)(const __DRIconfig *config, int index,
 unsigned int *attrib, unsigned int *value);

void (*destroyDrawable)(__DRIdrawable *drawable);

int (*copyContext)(__DRIcontext *dest,
   __DRIcontext *src,
   unsigned long mask);

void (*destroyContext)(__DRIcontext *context);

int (*bindContext)(__DRIcontext *ctx,
   __DRIdrawable *pdraw,
   __DRIdrawable *pread);

int (*unbindContext)(__DRIcontext *ctx);

and if we add those to DRIimageDriverExtension the loader only needs
to look for that and the DRIimage extension.  Of course, the
implementation is already in dri_util.c, we just need to set the
function pointers to the DRIcoreExtension functions we share.

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


Re: [Mesa-dev] [v2 5/6] glsl: functions to serialize gl_shader and gl_shader_program

2013-11-05 Thread Paul Berry
On 1 November 2013 02:16, Tapani Pälli  wrote:

> These utility functions can be used to (de)serialize gl_shader and
> gl_shader_program structures. This makes it possible to implement a
> shader compiler cache for individual shaders and functionality required
> by OES_get_program_binary extension.
>
> Signed-off-by: Tapani Pälli 
> ---
>  src/glsl/Makefile.sources |   1 +
>  src/glsl/ir_cache.cpp | 373
> ++
>  src/glsl/ir_cache.h   |  58 +++
>  3 files changed, 432 insertions(+)
>  create mode 100644 src/glsl/ir_cache.cpp
>  create mode 100644 src/glsl/ir_cache.h
>
> diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> index 81d5753..99b3c1a 100644
> --- a/src/glsl/Makefile.sources
> +++ b/src/glsl/Makefile.sources
> @@ -30,6 +30,7 @@ LIBGLSL_FILES = \
> $(GLSL_SRCDIR)/hir_field_selection.cpp \
> $(GLSL_SRCDIR)/ir_basic_block.cpp \
> $(GLSL_SRCDIR)/ir_builder.cpp \
> +   $(GLSL_SRCDIR)/ir_cache.cpp \
> $(GLSL_SRCDIR)/ir_cache_serializer.cpp \
> $(GLSL_SRCDIR)/ir_cache_deserializer.cpp \
> $(GLSL_SRCDIR)/ir_clone.cpp \
> diff --git a/src/glsl/ir_cache.cpp b/src/glsl/ir_cache.cpp
> new file mode 100644
> index 000..24e1c77
> --- /dev/null
> +++ b/src/glsl/ir_cache.cpp
> @@ -0,0 +1,373 @@
> +/* -*- c++ -*- */
> +/*
> + * 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, 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.
> + */
> +
> +#include "main/shaderobj.h"
> +#include "main/uniforms.h"
> +#include "main/macros.h"
> +
> +#include "ir_cache_serializer.h"
> +#include "ir_cache_deserializer.h"
> +
> +/**
> + * Serialize gl_shader structure
> + */
> +extern "C" char *
> +_mesa_shader_serialize(struct gl_shader *shader,
> +   struct _mesa_glsl_parse_state *state,
> +   const char *mesa_sha, size_t *size)
> +{
> +   ir_serializer s;
> +   return s.serialize(shader, state, mesa_sha, size);
> +}
> +
> +
> +static void
> +calc_item(const void *key, void *data, void *closure)
>

How about "increment_count" for the name of this function?


> +{
> +   unsigned *sz = (unsigned *) closure;
> +   *sz = *sz + 1;
> +}
> +
> +
> +static unsigned
> +_hash_table_size(struct string_to_uint_map *map)
>

This function is global, so its name can't start with an underscore--such
names are reserved for library functions.  Same goes for many of the other
functions in this file.


> +{
> +   unsigned size = 0;
> +   map->iterate(calc_item, &size);
> +   return size;
> +}
> +
> +
> +static void
> +serialize_item(const void *key, void *data, void *closure)
> +{
> +   memory_writer *blob = (memory_writer *) closure;
> +   uint32_t value = ((intptr_t)data);
> +
> +   blob->write_string((char *)key);
> +   blob->write_uint32(&value);
> +}
> +
> +
> +static void
> +_serialize_hash_table(struct string_to_uint_map *map, memory_writer *blob)
> +{
> +   uint32_t size = _hash_table_size(map);
> +   blob->write_uint32(&size);
> +   map->iterate(serialize_item, blob);
>

Rather than take two passes over the hash table (one to compute its size
and one to output its contents), why not do the trick that we do with
overwrite() in ir_cache_serializer.cpp?  (In other words, reserve space for
the size of the hashtable in bytes, then serialize the hashtable, then
overwrite the reserved space with the actual size).


> +}
> +
> +
> +static void
> +_serialize_uniform_storage(gl_uniform_storage *uni, memory_writer &blob)
> +{
> +   blob.write_string(uni->name);
> +
> +   save_glsl_type(blob, uni->type);
> +
> +   uint8_t initialized = uni->initialized;
> +   uint8_t row_major = uni->row_major;
> +
> +   blob.write_uint32(&uni->array_elements);
> +   blob.write_uint8(&initialized);
> +   blob.write_int32(&uni->block_index);
> +   blob.write_int32(&uni->offset);
> +   blob.write_int32(&uni->matrix_stride);
> +   blob.write_uint8(&row_

[Mesa-dev] [PATCH 2/2] i965: Add an implementation of intel_miptree_map using streaming loads.

2013-11-05 Thread Matt Turner
---
Chad has benchmark numbers, I think.

 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 88 +++
 1 file changed, 88 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 2f5e04f..17f0075 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1774,6 +1774,86 @@ intel_miptree_unmap_blit(struct brw_context *brw,
intel_miptree_release(&map->mt);
 }
 
+#ifdef __SSE4_1__
+/**
+ * "Map" a buffer by copying it to an untiled temporary using MOVNTDQA.
+ */
+static void
+intel_miptree_map_movntdqa(struct brw_context *brw,
+   struct intel_mipmap_tree *mt,
+   struct intel_miptree_map *map,
+   unsigned int level, unsigned int slice)
+{
+   assert(map->mode & GL_MAP_READ_BIT);
+   assert(!(map->mode & GL_MAP_WRITE_BIT));
+
+   DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __FUNCTION__,
+   map->x, map->y, map->w, map->h,
+   mt, _mesa_get_format_name(mt->format),
+   level, slice, map->ptr, map->stride);
+
+   /* Map the original image */
+   uint32_t image_x;
+   uint32_t image_y;
+   intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y);
+   image_x += map->x;
+   image_y += map->y;
+
+   void *src = intel_miptree_map_raw(brw, mt);
+   if (!src) {
+  _mesa_align_free(map->buffer);
+  map->buffer = NULL;
+  map->ptr = NULL;
+  return;
+   }
+   src += image_y * mt->region->pitch;
+   src += image_x * mt->region->cpp;
+
+   /* Due to the pixel offsets for the particular image being mapped, our
+* src pointer may not be 16-byte aligned.  However, if the pitch is
+* divisible by 16, then the amount by which it's misaligned will remain
+* consistent from row to row.
+*/
+   assert((mt->region->pitch % 16) == 0);
+   const int misalignment = ((uintptr_t) src) & 15;
+
+   /* Create an untiled temporary buffer for the mapping. */
+   unsigned stride = _mesa_format_row_stride(mt->format, map->w);
+
+   map->stride = ALIGN(misalignment + stride, 16);
+
+   map->buffer = malloc(misalignment + map->stride * map->h * mt->region->cpp);
+   /* Offset the destination so it has the same misalignment as src. */
+   map->ptr = map->buffer + misalignment;
+
+   assertuintptr_t) map->ptr) & 15) == misalignment);
+
+   for (uint32_t y = 0; y < map->h; y++) {
+  void *dst_ptr = map->ptr + y * map->stride;
+  void *src_ptr = src + y * mt->region->pitch;
+
+  _mesa_streaming_load_memcpy(dst_ptr, src_ptr, stride);
+
+  dst_ptr += stride;
+  src_ptr += stride;
+   }
+
+   intel_miptree_unmap_raw(brw, mt);
+}
+
+static void
+intel_miptree_unmap_movntdqa(struct brw_context *brw,
+ struct intel_mipmap_tree *mt,
+ struct intel_miptree_map *map,
+ unsigned int level,
+ unsigned int slice)
+{
+   free(map->buffer);
+   map->buffer = NULL;
+   map->ptr = NULL;
+}
+#endif
+
 static void
 intel_miptree_map_s8(struct brw_context *brw,
 struct intel_mipmap_tree *mt,
@@ -2137,6 +2217,10 @@ intel_miptree_map_singlesample(struct brw_context *brw,
   mt->region->bo->size >= brw->max_gtt_map_object_size) {
   assert(mt->region->pitch < 32768);
   intel_miptree_map_blit(brw, mt, map, level, slice);
+#ifdef __SSE4_1__
+   } else if (!(mode & GL_MAP_WRITE_BIT) && !mt->compressed) {
+  intel_miptree_map_movntdqa(brw, mt, map, level, slice);
+#endif
} else {
   intel_miptree_map_gtt(brw, mt, map, level, slice);
}
@@ -2173,6 +2257,10 @@ intel_miptree_unmap_singlesample(struct brw_context *brw,
   intel_miptree_unmap_depthstencil(brw, mt, map, level, slice);
} else if (map->mt) {
   intel_miptree_unmap_blit(brw, mt, map, level, slice);
+#ifdef __SSE4_1__
+   } else if (map->buffer) {
+  intel_miptree_unmap_movntdqa(brw, mt, map, level, slice);
+#endif
} else {
   intel_miptree_unmap_gtt(brw, mt, map, level, slice);
}
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 1/2] mesa: Add a streaming load memcpy implementation.

2013-11-05 Thread Matt Turner
Uses SSE 4.1's MOVNTDQA instruction (streaming load) to read from
uncached memory without polluting the cache.
---
We should add runtime detection support later.

 src/mesa/Makefile.am  | 10 +
 src/mesa/main/streaming-load-memcpy.c | 85 +++
 src/mesa/main/streaming-load-memcpy.h | 33 ++
 3 files changed, 128 insertions(+)
 create mode 100644 src/mesa/main/streaming-load-memcpy.c
 create mode 100644 src/mesa/main/streaming-load-memcpy.h

diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index b4ad9fc..f34ca82 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -100,16 +100,20 @@ MESA_ASM_FILES_FOR_ARCH =
 if HAVE_X86_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_FILES)
 AM_CPPFLAGS += -I$(builddir)/x86 -I$(srcdir)/x86
+ARCH_LIBS = libmesa_sse41.la
 endif
 if HAVE_X86_64_ASM
 MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES)
 AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64
+ARCH_LIBS = libmesa_sse41.la
 endif
 if HAVE_SPARC_ASM
 MESA_ASM_FILES_FOR_ARCH += $(SPARC_FILES)
 AM_CPPFLAGS += -I$(builddir)/sparc -I$(srcdir)/sparc
 endif
 
+noinst_LTLIBRARIES += $(ARCH_LIBS)
+
 libmesa_la_SOURCES = \
$(MESA_FILES) \
$(PROGRAM_FILES) \
@@ -117,6 +121,7 @@ libmesa_la_SOURCES = \
 
 libmesa_la_LIBADD = \
 $(top_builddir)/src/glsl/libglsl.la \
+   $(ARCH_LIBS) \
 $()
 
 libmesagallium_la_SOURCES = \
@@ -126,8 +131,13 @@ libmesagallium_la_SOURCES = \
 
 libmesagallium_la_LIBADD = \
 $(top_builddir)/src/glsl/libglsl.la \
+   $(ARCH_LIBS) \
 $()
 
+libmesa_sse41_la_SOURCES = \
+   main/streaming-load-memcpy.c
+libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
 
diff --git a/src/mesa/main/streaming-load-memcpy.c 
b/src/mesa/main/streaming-load-memcpy.c
new file mode 100644
index 000..d7147af
--- /dev/null
+++ b/src/mesa/main/streaming-load-memcpy.c
@@ -0,0 +1,85 @@
+/*
+ * 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, 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:
+ *Eric Anholt 
+ *Matt Turner 
+ *
+ */
+
+#include "main/macros.h"
+#include "main/streaming-load-memcpy.h"
+#include 
+
+/* Copies memory from src to dst, using SSE 4.1's MOVNTDQA to get streaming
+ * read performance from uncached memory.
+ */
+void
+_mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t len)
+{
+   char *restrict d = dst;
+   char *restrict s = src;
+
+   /* If dst and src are not co-aligned, fallback to memcpy(). */
+   if (((uintptr_t)d & 15) != ((uintptr_t)s & 15)) {
+  memcpy(d, s, len);
+  return;
+   }
+
+   /* memcpy() the misaligned header. At the end of this if block,  and 
+* are aligned to a 16-byte boundary or  == 0.
+*/
+   if ((uintptr_t)d & 15) {
+  uintptr_t bytes_before_alignment_boundary = 16 - ((uintptr_t)d & 15);
+  assert(bytes_before_alignment_boundary < 16);
+
+  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);
+   }
+
+   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);
+
+  _mm_store_si128(dst_cacheline + 0, temp1);
+  _mm_store_si128(dst_cacheline + 1, temp2);
+  _mm_store_si128(dst_cacheline + 2, temp3);
+  _mm_store_si128(dst_cacheline + 3, temp4);
+
+  d += 64;
+  s += 64;
+  len -= 64;
+   }
+
+   /* memcpy() the tail. */
+   if (len) {
+  memcpy(d, s, len);
+   }
+}
diff --git a/src/mesa/mai

[Mesa-dev] [PATCH] mesa: Add API debug logging to TexStorage

2013-11-05 Thread Courtney Goeltzenleuchter
Give glTexStorage* equivalent debug logging to glTexImage*.

Signed-off-by: Courtney Goeltzenleuchter 
---
 src/mesa/main/texstorage.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 7bd8652..84b8f82 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -365,6 +365,13 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, 
GLenum internalformat,
 
GET_CURRENT_CONTEXT(ctx);
 
+   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
+  _mesa_debug(ctx, "glTexStorage%uD %s %d %s %d %d %d\n",
+  dims,
+  _mesa_lookup_enum_by_nr(target), levels,
+  _mesa_lookup_enum_by_nr(internalformat),
+  width, height, depth);
+
if (tex_storage_error_check(ctx, dims, target, levels,
internalformat, width, height, depth)) {
   return; /* error was recorded */
-- 
1.8.1.2

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


Re: [Mesa-dev] [PATCH 3/4] mesa: fix build on kFreeBSD

2013-11-05 Thread Andreas Boll
I think we could simplify this a bit.

2013/11/5 Fabio Pedretti :
> From: Aurelien Jarno 
> From: Cyril Brulebois 
>
> mesa fails to build on GNU/kFreeBSD, since some parts are not enabled.
>
> Debian bug: http://bugs.debian.org/524690
>
> Patch from Debian package
> ---
>  configure.ac | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 0a25047..e250734 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -425,7 +425,7 @@ if test "x$enable_asm" = xyes; then
>  case "$host_cpu" in
>  i?86)
>  case "$host_os" in
> -linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
> +linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | 
> kfreebsd*-gnu*)
*freebsd* already includes kfreebsd*-gnu*

>  test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
>  ;;
>  gnu*)
> @@ -435,7 +435,7 @@ if test "x$enable_asm" = xyes; then
>  ;;
>  x86_64|amd64)
>  case "$host_os" in
> -linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
> +linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | 
> kfreebsd*-gnu*)
same as above

>  test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
>  ;;
>  esac
> @@ -974,7 +974,7 @@ if test "x$enable_dri" = xyes; then
>  ;;
>  esac
>  ;;
> -freebsd* | dragonfly* | *netbsd* | openbsd*)
> +freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)

To be consistent we could use *freebsd* as well.

Andreas.

>  DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
>  DEFINES="$DEFINES -DHAVE_ALIAS"
>
> --
> 1.8.3.2
>
> ___
> 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] clover: mark gcc < 4.7.3 as broken

2013-11-05 Thread David Heidelberger
---
 configure.ac | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index dc15ad4..20b1769 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,6 +109,7 @@ if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
 if test $? -eq 0; then
 GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1`
 GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2`
+GCC_VERSION_MAINTANANCE=`echo $GCC_VERSION | cut -d. -f3`
 fi
 
 if test $GCC_VERSION_MAJOR -lt 3 -o $GCC_VERSION_MAJOR -eq 3 -a 
$GCC_VERSION_MINOR -lt 3 ; then
@@ -1371,8 +1372,10 @@ if test "x$enable_opencl" = xyes; then
 AC_MSG_ERROR([cannot enable OpenCL without Gallium])
 fi
 
-if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a 
$GCC_VERSION_MINOR -lt 7; then
-AC_MSG_ERROR([gcc >= 4.7 is required to build clover])
+if test $GCC_VERSION_MAJOR -lt 4 -o \
+$GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7 -o \
+$GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -eq 7 -a 
$GCC_VERSION_MAINTANANCE -lt 4; then
+AC_MSG_ERROR([gcc >= 4.7.1 is required to build clover])
 fi
 
 if test "x$have_libclc" = xno; then
-- 
1.8.4

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


Re: [Mesa-dev] [PATCH] i965/gen6: Don't allow SIMD16 dispatch in 4x PERPIXEL mode with computed depth.

2013-11-05 Thread Paul Berry
On 5 November 2013 12:13, Chris Forbes  wrote:

> Unfortunate :(
>
> Is the bad behavior from violating this restriction observable?
>

That's unclear.  Sometimes restrictions like this wind up in the hardware
docs because a hardware bug was found, in which case yes, the bad behaviour
is definitely observable.  Other times restrictions like these arise out of
deliberate simplifying assumptions that were made during hardware design,
in which case it's possible that violating the restriction is benign, but
it's really hard to tell for sure without a vast validation effort.  The
hardware docs rarely distinguish between these two possibilities.

I don't really have a good guess as to what the bad behaviour is in this
particular case.


>
> In any case, Reviewed-by: Chris Forbes 
>
> On Wed, Nov 6, 2013 at 7:43 AM, Eric Anholt  wrote:
> > Paul Berry  writes:
> >
> >> Hardware docs say we can only use SIMD8 dispatch in this condition.
> >
> > Reviewed-by: Eric Anholt 
> >
> > ___
> > 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] i965/gen6: Don't allow SIMD16 dispatch in 4x PERPIXEL mode with computed depth.

2013-11-05 Thread Chris Forbes
Unfortunate :(

Is the bad behavior from violating this restriction observable?

In any case, Reviewed-by: Chris Forbes 

On Wed, Nov 6, 2013 at 7:43 AM, Eric Anholt  wrote:
> Paul Berry  writes:
>
>> Hardware docs say we can only use SIMD8 dispatch in this condition.
>
> Reviewed-by: Eric Anholt 
>
> ___
> 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] gallivm: optimize lp_build_minify for sse

2013-11-05 Thread Jose Fonseca
Looks great to me

Jose

- Original Message -
> From: Roland Scheidegger 
> 
> SSE can't handle true vector shifts (with variable shift count),
> so llvm is turning them into a mess of extracts, scalar shifts and inserts.
> It is however possible to emulate them in lp_build_minify with float muls,
> which should be way faster (saves over 20 instructions per 8-wide
> lp_build_minify). This wouldn't work for "generic" 32bit shifts though
> since we've got only 24bits of mantissa (actually for left shifts it would
> work by using sse41 int mul instead of float mul but not for right shifts).
> Note that this has very limited scope for now, since this is only used with
> per-pixel lod (otherwise we're avoiding the non-constant shift count by doing
> per-quad shifts manually), and only 1d textures even then (though the latter
> should change).
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_sample.c |   62
>  +
>  src/gallium/auxiliary/gallivm/lp_bld_sample.h |3 +-
>  src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |2 +-
>  3 files changed, 54 insertions(+), 13 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> index a032d9d..e60a035 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> @@ -36,6 +36,7 @@
>  #include "pipe/p_state.h"
>  #include "util/u_format.h"
>  #include "util/u_math.h"
> +#include "util/u_cpu_detect.h"
>  #include "lp_bld_arit.h"
>  #include "lp_bld_const.h"
>  #include "lp_bld_debug.h"
> @@ -248,7 +249,7 @@ lp_build_rho(struct lp_build_sample_context *bld,
> first_level = bld->dynamic_state->first_level(bld->dynamic_state,
>   bld->gallivm,
>   texture_unit);
> first_level_vec = lp_build_broadcast_scalar(int_size_bld, first_level);
> -   int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec);
> +   int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec,
> TRUE);
> float_size = lp_build_int_to_float(float_size_bld, int_size);
>  
> if (cube_rho) {
> @@ -1089,12 +1090,14 @@ lp_build_get_mip_offsets(struct
> lp_build_sample_context *bld,
>  
>  /**
>   * Codegen equivalent for u_minify().
> + * @param lod_scalar  if lod is a (broadcasted) scalar
>   * Return max(1, base_size >> level);
>   */
>  LLVMValueRef
>  lp_build_minify(struct lp_build_context *bld,
>  LLVMValueRef base_size,
> -LLVMValueRef level)
> +LLVMValueRef level,
> +boolean lod_scalar)
>  {
> LLVMBuilderRef builder = bld->gallivm->builder;
> assert(lp_check_value(bld->type, base_size));
> @@ -1105,10 +1108,49 @@ lp_build_minify(struct lp_build_context *bld,
>return base_size;
> }
> else {
> -  LLVMValueRef size =
> - LLVMBuildLShr(builder, base_size, level, "minify");
> +  LLVMValueRef size;
>assert(bld->type.sign);
> -  size = lp_build_max(bld, size, bld->one);
> +  if (lod_scalar ||
> + (util_cpu_caps.has_avx2 || !util_cpu_caps.has_sse)) {
> + size = LLVMBuildLShr(builder, base_size, level, "minify");
> + size = lp_build_max(bld, size, bld->one);
> +  }
> +  else {
> + /*
> +  * emulate shift with float mul, since intel "forgot" shifts with
> +  * per-element shift count until avx2, which results in terrible
> +  * scalar extraction (both count and value), scalar shift,
> +  * vector reinsertion. Should not be an issue on any non-x86 cpu
> +  * with a vector instruction set.
> +  * On cpus with AMD's XOP this should also be unnecessary but I'm
> +  * not sure if llvm would emit this with current flags.
> +  */
> + LLVMValueRef const127, const23, lf;
> + struct lp_type ftype;
> + struct lp_build_context fbld;
> + ftype = lp_type_float_vec(32, bld->type.length * bld->type.width);
> + lp_build_context_init(&fbld, bld->gallivm, ftype);
> + const127 = lp_build_const_int_vec(bld->gallivm, bld->type, 127);
> + const23 = lp_build_const_int_vec(bld->gallivm, bld->type, 23);
> +
> + /* calculate 2^(-level) float */
> + lf = lp_build_sub(bld, const127, level);
> + lf = lp_build_shl(bld, lf, const23);
> + lf = LLVMBuildBitCast(builder, lf, fbld.vec_type, "");
> +
> + /* finish shift operation by doing float mul */
> + base_size = lp_build_int_to_float(&fbld, base_size);
> + size = lp_build_mul(&fbld, base_size, lf);
> + /*
> +  * do the max also with floats because
> +  * a) non-emulated int max requires sse41
> +  *(this is actually a lie as we could cast to 16bit values
> +  *as 16bit is sufficient and 16bit int max is sse2)
> +  

Re: [Mesa-dev] [PATCH 0/8] Add DRIimage-based DRI3/Present loader

2013-11-05 Thread Eric Anholt
Keith Packard  writes:

> Keith Packard  writes:
>
>> This sequence first adds a a couple of new DRIimage extensions to the
>> dri/common, dri/i915 and dri/i965 directories which define a
>> loader-independent API for managing window system operations.
>>
>> The last patch adds a new DRI3000 loader using those new interfaces.
>
> I've figured out that I can also re-use dri2CreateNewScreen2 for the
> image driver bits, as long as I change that function to also look up the
> image loader. That means there are *no* new dri_util functions needed.
>
> To recap, the changes needed to support using the DRIimageExtension
> interfaces for allocating buffers from the driver in the loader are:
>
> DRIimageDriverExtension
>
> A proper subset of DRIdri2DriverExtension, which uses
> the same five functions involved in creating new objects:
>
>/* Common DRI functions, shared with DRI2 */
>__DRIcreateNewScreen2createNewScreen2;
>__DRIcreateNewDrawable   createNewDrawable;
>__DRIcreateNewContextcreateNewContext;
>__DRIcreateContextAttribscreateContextAttribs;
>__DRIgetAPIMask  getAPIMask;

It seems like we could just stick these things in __DRI_CORE as opposed
to having another new extension to look up.  The downside I see there is
bugs in the server, which have patches at xserver-driinterface-versions
of my tree.  (Unfortunately, I'm having a hard time building the server
currently, so no testing yet).  Having a new extension whose name has
nothing to do with the functions in it seems really weird.

Also, apologies for not having done this myself for my CreateNewScreen2
change.


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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Courtney Goeltzenleuchter
On Tue, Nov 5, 2013 at 12:22 PM, Ian Romanick  wrote:

> On 11/05/2013 09:44 AM, Chris Forbes wrote:
> >> So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.
>  Hmm...
> >
> > My understanding is you can't actually, since views can only be
> > created from immutable-format textures, and GL_LUMINANCE is not a
> > sized internalformat, so it can't be used with TexStorage?
>
> I was just using GL_LUMINANCE as shorthand for GL_LUMINANCE4,
> GL_LUMINANCE8, GL_LUMINANCE12, and GL_LUMINANCE16.  As far as I can tell,
>
> glGenTextures(1, &tex);
> glBindTexture(GL_TEXTURE_2D, tex);
> glTexStorage2D(GL_TEXTURE_2D,
> 8,
> GL_LUMINANCE8,
> 1024, 1024);
>
> is perfectly valid.  Sayeth GL_ARB_texture_storage:
>
> Accepted by the  parameter of TexStorage* when
> implemented on OpenGL ES:
>
> ALPHA8_EXT 0x803C
> LUMINANCE8_EXT 0x8040
> LUMINANCE8_ALPHA8_EXT  0x8045
>
> I guess that means GL_LUMINANCE4, GL_LUMINANCE12, and GL_LUMINANCE16 are
> out.  As are all GL_INTENSITY formats.  There are still these three
> legacy formats to handle.
>
> So, if we support GL_ARB_texture_view in a compatibility profile,
>
> glGenTextures(1, &view);
> glTextureView(view,
> GL_TEXTURE_2D,
> tex,
> GL_LUMINANCE8,
> 1, 1, 1, 1);
>
> is also valid.
>
> Right?
>

The spec is pickier than that.  For 8bit texels the allowed internal
formats are:  R8UI, R8I, R8, R8_SNORM
I use the table specified in the ARB_texture_view to translate the target
internalFormat passed to glTextureView into a VIEW_CLASS. GL_LUMINANCE8
does not have a valid VIEW_CLASS and could not match the internal format of
the source texture.

That makes me wonder, should I be trying to map the target internalformat
into a driver internal format?

Courtney


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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Ian Romanick
On 11/05/2013 09:44 AM, Chris Forbes wrote:
>> So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...
> 
> My understanding is you can't actually, since views can only be
> created from immutable-format textures, and GL_LUMINANCE is not a
> sized internalformat, so it can't be used with TexStorage?

I was just using GL_LUMINANCE as shorthand for GL_LUMINANCE4,
GL_LUMINANCE8, GL_LUMINANCE12, and GL_LUMINANCE16.  As far as I can tell,

glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexStorage2D(GL_TEXTURE_2D,
8,
GL_LUMINANCE8,
1024, 1024);

is perfectly valid.  Sayeth GL_ARB_texture_storage:

Accepted by the  parameter of TexStorage* when
implemented on OpenGL ES:

ALPHA8_EXT 0x803C
LUMINANCE8_EXT 0x8040
LUMINANCE8_ALPHA8_EXT  0x8045

I guess that means GL_LUMINANCE4, GL_LUMINANCE12, and GL_LUMINANCE16 are
out.  As are all GL_INTENSITY formats.  There are still these three
legacy formats to handle.

So, if we support GL_ARB_texture_view in a compatibility profile,

glGenTextures(1, &view);
glTextureView(view,
GL_TEXTURE_2D,
tex,
GL_LUMINANCE8,
1, 1, 1, 1);

is also valid.

Right?

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


Re: [Mesa-dev] [PATCH] gallivm: optimize lp_build_minify for sse

2013-11-05 Thread Brian Paul

On 11/05/2013 11:22 AM, srol...@vmware.com wrote:

From: Roland Scheidegger 

SSE can't handle true vector shifts (with variable shift count),
so llvm is turning them into a mess of extracts, scalar shifts and inserts.
It is however possible to emulate them in lp_build_minify with float muls,
which should be way faster (saves over 20 instructions per 8-wide
lp_build_minify). This wouldn't work for "generic" 32bit shifts though
since we've got only 24bits of mantissa (actually for left shifts it would
work by using sse41 int mul instead of float mul but not for right shifts).
Note that this has very limited scope for now, since this is only used with
per-pixel lod (otherwise we're avoiding the non-constant shift count by doing
per-quad shifts manually), and only 1d textures even then (though the latter
should change).


LGTM.

Reviewed-by: Brian Paul 

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


Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Chad Versace

On 11/05/2013 10:55 AM, Emil Velikov wrote:

On 05/11/13 18:18, Chad Versace wrote:

On 11/02/2013 12:00 PM, Emil Velikov wrote:

Rip out the source file list from mesa/Makefile.sources, to a
more sensible location/file.
* Split PROGRAM_FILES and GENERATED_FILES.
* Update the automake and Android build systems.

Android
* Slightly reshuffle the Android.mk for readability sake.
* Use GENERATED_FILES, drop the TODO item.
* Use explicit 'call' when executing local macros.

Cc: Chad Versace 
Signed-off-by: Emil Velikov 
---

Andoid changes are _not_ tested (yet).


The changes to the Andoid.mk look good to me. It's much easier to
understand now. However, I've also not tested the changes. This
path is
Reviewed-by: Chad Versace 


Cheers Chad.

Seems like I would need an extra harddrive to get the Android build
running. This thing is a crazy, it ate 30GiB like it was nothing and
asks for more :)


And after you acquire sufficient space, you will then need to wait for
hours. If you're lucky, your build will succeed on the first try and
you won't need to restart with a clean build :)

I once attended an hour long presentation at a technical conference whose
sole purpose was to explain how to get Android to build faster. The main
message was "Buy a machine with 32-64GB of RAM, and put it all into ramfs".




Adrian, do wish to test this series on Android?


Adrian, if you can give this patch a test that would be greatly appreciated.


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


Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Matt Turner
On Tue, Nov 5, 2013 at 10:49 AM, Emil Velikov  wrote:
> Now we have one intermediate library (archive), which links against both
> mesa classic and gallium. Whereas with your patch it builds it twice but
> drops the linking part. Is the extra recursion + linking that much more
> significant than rebuilding the exact same source(s) twice ?

It's not building it twice (just like it doesn't build other sources
common to libmesa and libmesagallium twice).

It builds the sources once and links them into libmesa and
libmesagallium, instead of going through the intermediate step of
linking them into libprogram.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Emil Velikov
On 05/11/13 18:18, Chad Versace wrote:
> On 11/02/2013 12:00 PM, Emil Velikov wrote:
>> Rip out the source file list from mesa/Makefile.sources, to a
>> more sensible location/file.
>> * Split PROGRAM_FILES and GENERATED_FILES.
>> * Update the automake and Android build systems.
>>
>> Android
>> * Slightly reshuffle the Android.mk for readability sake.
>> * Use GENERATED_FILES, drop the TODO item.
>> * Use explicit 'call' when executing local macros.
>>
>> Cc: Chad Versace 
>> Signed-off-by: Emil Velikov 
>> ---
>>
>> Andoid changes are _not_ tested (yet).
> 
> The changes to the Andoid.mk look good to me. It's much easier to
> understand now. However, I've also not tested the changes. This
> path is
> Reviewed-by: Chad Versace 
> 
Cheers Chad.

Seems like I would need an extra harddrive to get the Android build
running. This thing is a crazy, it ate 30GiB like it was nothing and
asks for more :)

> Adrian, do wish to test this series on Android?
> 
Adrian, if you can give this patch a test that would be greatly appreciated.

Thanks
Emil

>> ---
>>   src/mesa/Makefile.sources | 24 ---
>>   src/mesa/program/Android.mk   | 65
>> ---
>>   src/mesa/program/Makefile.am  | 25 +--
>>   src/mesa/program/Makefile.sources | 27 
>>   4 files changed, 69 insertions(+), 72 deletions(-)
>>   create mode 100644 src/mesa/program/Makefile.sources
>>
>> diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
>> index a84f8a7..e4146ae 100644
>> --- a/src/mesa/Makefile.sources
>> +++ b/src/mesa/Makefile.sources
>> @@ -252,30 +252,6 @@ STATETRACKER_FILES = \
>>   $(SRCDIR)state_tracker/st_texture.c \
>>   $(SRCDIR)state_tracker/st_vdpau.c
>>
>> -PROGRAM_FILES = \
>> -$(SRCDIR)program/arbprogparse.c \
>> -$(SRCDIR)program/prog_hash_table.c \
>> -$(SRCDIR)program/ir_to_mesa.cpp \
>> -$(SRCDIR)program/program.c \
>> -$(SRCDIR)program/program_parse_extra.c \
>> -$(SRCDIR)program/prog_cache.c \
>> -$(SRCDIR)program/prog_execute.c \
>> -$(SRCDIR)program/prog_instruction.c \
>> -$(SRCDIR)program/prog_noise.c \
>> -$(SRCDIR)program/prog_optimize.c \
>> -$(SRCDIR)program/prog_opt_constant_fold.c \
>> -$(SRCDIR)program/prog_parameter.c \
>> -$(SRCDIR)program/prog_parameter_layout.c \
>> -$(SRCDIR)program/prog_print.c \
>> -$(SRCDIR)program/prog_statevars.c \
>> -$(SRCDIR)program/programopt.c \
>> -$(SRCDIR)program/register_allocate.c \
>> -$(SRCDIR)program/sampler.cpp \
>> -$(SRCDIR)program/string_to_uint_map.cpp \
>> -$(SRCDIR)program/symbol_table.c \
>> -$(BUILDDIR)program/lex.yy.c \
>> -$(BUILDDIR)program/program_parse.tab.c
>> -
>>   ASM_C_FILES =\
>>   $(SRCDIR)x86/common_x86.c \
>>   $(SRCDIR)x86/x86_xform.c \
>> diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
>> index e85afe6..e340ed4 100644
>> --- a/src/mesa/program/Android.mk
>> +++ b/src/mesa/program/Android.mk
>> @@ -18,8 +18,30 @@
>>   # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>>   # DEALINGS IN THE SOFTWARE.
>>
>> +# --
>> +# libmesa_program.a
>> +# --
>>   LOCAL_PATH := $(call my-dir)
>>
>> +# get PROGRAM_FILES and GENERATED_FILES
>> +include $(LOCAL_PATH)/Makefile.sources
>> +include $(CLEAR_VARS)
>> +
>> +LOCAL_MODULE := libmesa_program
>> +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
>> +
>> +intermediates := $(call local-intermediates-dir)
>> +
>> +LOCAL_C_INCLUDES := \
>> +$(intermediates) \
>> +$(MESA_TOP)/src/mapi \
>> +$(MESA_TOP)/src/mesa \
>> +$(MESA_TOP)/src/glsl
>> +
>> +
>> +LOCAL_SRC_FILES := $(PROGRAM_FILES)
>> +LOCAL_GENERATED_SOURCES := $(addprefix
>> $(intermediates)/,$(GENERATED_FILES))
>> +
>>   define local-l-to-c
>>   @mkdir -p $(dir $@)
>>   @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
>> @@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
>>   $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
>>   endef
>>
>> -# --
>> -# libmesa_program.a
>> -# --
>> -
>> -# Import the following variables:
>> -# PROGRAM_FILES
>> -include $(MESA_TOP)/src/mesa/Makefile.sources
>> -
>> -include $(CLEAR_VARS)
>> -
>> -LOCAL_MODULE := libmesa_program
>> -LOCAL_MODULE_CLASS := STATIC_LIBRARIES
>> -
>> -intermediates := $(call local-intermediates-dir)
>> +$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
>> +$(call local-l-to-c)
>>
>> -# TODO(chadv): In Makefile.sources, move these vars to a different
>> list so we can
>> -# remove this kludge.
>> -generated_sources_basenames := \
>> -lex.yy.c \
>> -program_parse.tab.c \
>> -program_parse.tab.h
>> +$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_pa

Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Emil Velikov
On 05/11/13 18:28, Matt Turner wrote:
> On Sat, Nov 2, 2013 at 12:00 PM, Emil Velikov  
> wrote:
>> Rip out the source file list from mesa/Makefile.sources, to a
>> more sensible location/file.
>> * Split PROGRAM_FILES and GENERATED_FILES.
>> * Update the automake and Android build systems.
>>
>> Android
>> * Slightly reshuffle the Android.mk for readability sake.
>> * Use GENERATED_FILES, drop the TODO item.
>> * Use explicit 'call' when executing local macros.
>>
>> Cc: Chad Versace 
>> Signed-off-by: Emil Velikov 
>> ---
>>
>> Andoid changes are _not_ tested (yet).
>>
>> ---
>>  src/mesa/Makefile.sources | 24 ---
>>  src/mesa/program/Android.mk   | 65 
>> ---
>>  src/mesa/program/Makefile.am  | 25 +--
>>  src/mesa/program/Makefile.sources | 27 
>>  4 files changed, 69 insertions(+), 72 deletions(-)
>>  create mode 100644 src/mesa/program/Makefile.sources
>>
>> diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
>> index a84f8a7..e4146ae 100644
>> --- a/src/mesa/Makefile.sources
>> +++ b/src/mesa/Makefile.sources
>> @@ -252,30 +252,6 @@ STATETRACKER_FILES = \
>> $(SRCDIR)state_tracker/st_texture.c \
>> $(SRCDIR)state_tracker/st_vdpau.c
>>
>> -PROGRAM_FILES = \
>> -   $(SRCDIR)program/arbprogparse.c \
>> -   $(SRCDIR)program/prog_hash_table.c \
>> -   $(SRCDIR)program/ir_to_mesa.cpp \
>> -   $(SRCDIR)program/program.c \
>> -   $(SRCDIR)program/program_parse_extra.c \
>> -   $(SRCDIR)program/prog_cache.c \
>> -   $(SRCDIR)program/prog_execute.c \
>> -   $(SRCDIR)program/prog_instruction.c \
>> -   $(SRCDIR)program/prog_noise.c \
>> -   $(SRCDIR)program/prog_optimize.c \
>> -   $(SRCDIR)program/prog_opt_constant_fold.c \
>> -   $(SRCDIR)program/prog_parameter.c \
>> -   $(SRCDIR)program/prog_parameter_layout.c \
>> -   $(SRCDIR)program/prog_print.c \
>> -   $(SRCDIR)program/prog_statevars.c \
>> -   $(SRCDIR)program/programopt.c \
>> -   $(SRCDIR)program/register_allocate.c \
>> -   $(SRCDIR)program/sampler.cpp \
>> -   $(SRCDIR)program/string_to_uint_map.cpp \
>> -   $(SRCDIR)program/symbol_table.c \
>> -   $(BUILDDIR)program/lex.yy.c \
>> -   $(BUILDDIR)program/program_parse.tab.c
>> -
>>  ASM_C_FILES =  \
>> $(SRCDIR)x86/common_x86.c \
>> $(SRCDIR)x86/x86_xform.c \
>> diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
>> index e85afe6..e340ed4 100644
>> --- a/src/mesa/program/Android.mk
>> +++ b/src/mesa/program/Android.mk
>> @@ -18,8 +18,30 @@
>>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>>  # DEALINGS IN THE SOFTWARE.
>>
>> +# --
>> +# libmesa_program.a
>> +# --
>>  LOCAL_PATH := $(call my-dir)
>>
>> +# get PROGRAM_FILES and GENERATED_FILES
>> +include $(LOCAL_PATH)/Makefile.sources
>> +include $(CLEAR_VARS)
>> +
>> +LOCAL_MODULE := libmesa_program
>> +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
>> +
>> +intermediates := $(call local-intermediates-dir)
>> +
>> +LOCAL_C_INCLUDES := \
>> +   $(intermediates) \
>> +   $(MESA_TOP)/src/mapi \
>> +   $(MESA_TOP)/src/mesa \
>> +   $(MESA_TOP)/src/glsl
>> +
>> +
>> +LOCAL_SRC_FILES := $(PROGRAM_FILES)
>> +LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(GENERATED_FILES))
>> +
>>  define local-l-to-c
>> @mkdir -p $(dir $@)
>> @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
>> @@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
>> $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
>>  endef
>>
>> -# --
>> -# libmesa_program.a
>> -# --
>> -
>> -# Import the following variables:
>> -# PROGRAM_FILES
>> -include $(MESA_TOP)/src/mesa/Makefile.sources
>> -
>> -include $(CLEAR_VARS)
>> -
>> -LOCAL_MODULE := libmesa_program
>> -LOCAL_MODULE_CLASS := STATIC_LIBRARIES
>> -
>> -intermediates := $(call local-intermediates-dir)
>> +$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
>> +   $(call local-l-to-c)
>>
>> -# TODO(chadv): In Makefile.sources, move these vars to a different list so 
>> we can
>> -# remove this kludge.
>> -generated_sources_basenames := \
>> -   lex.yy.c \
>> -   program_parse.tab.c \
>> -   program_parse.tab.h
>> +$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
>> +   $(call mesa_local-y-to-c-and-h)
>>
>> -LOCAL_SRC_FILES := \
>> -   $(filter-out $(generated_sources_basenames),$(subst 
>> program/,,$(PROGRAM_FILES)))
>> -
>> -LOCAL_GENERATED_SOURCES := \
>> -   $(addprefix $(intermediates)/program/,$(generated_sources_basenames))
>> -
>> -$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
>> -   

Re: [Mesa-dev] [PATCH 1/2] mesa: Add unreachable macro.

2013-11-05 Thread Matt Turner
On Mon, Nov 4, 2013 at 4:43 PM, Matt Turner  wrote:
> ---
>  src/mesa/main/compiler.h | 15 +++
>  1 file changed, 15 insertions(+)
>
> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
> index 61ce5db..6a25bf5 100644
> --- a/src/mesa/main/compiler.h
> +++ b/src/mesa/main/compiler.h
> @@ -252,6 +252,21 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
>(void) sizeof(char [1 - 2*!(COND)]); \
> } while (0)
>
> +/**
> + * Unreachable macro. Useful for suppressing "control reaches end of non-void
> + * function" warnings.
> + */
> +#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 5
> +#define unreachable __builtin_unreachable()
> +#elif (defined(__clang__) && defined(__has_builtin))
> +# if __has_builtin(__builtin_unreachable)
> +#  define unreachable __builtin_unreachable()
> +# endif
> +#endif
> +
> +#ifndef unreachable
> +#define unreachable
> +#endif
>
>  #if (__GNUC__ >= 3)
>  #define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
> --
> 1.8.3.2
>

I'm actually going to change these to 'unreachable()' so it looks less funny.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Courtney Goeltzenleuchter
On Tue, Nov 5, 2013 at 9:40 AM, Ian Romanick  wrote:

> On 11/04/2013 03:34 PM, Courtney Goeltzenleuchter wrote:
> >
> > On Fri, Nov 1, 2013 at 1:42 PM, Ian Romanick  > > wrote:
> >
> > On 11/01/2013 09:54 AM, Courtney Goeltzenleuchter wrote:
> > > @@ -1746,11 +1770,37 @@ _mesa_GetTexParameteriv( GLenum target,
> > GLenum pname, GLint *params )
> > >   break;
> > >
> > >case GL_TEXTURE_IMMUTABLE_LEVELS:
> > > - if (!_mesa_is_gles3(ctx))
> > > + if (!_mesa_is_gles3(ctx)
> > > + && !_mesa_is_desktop_gl(ctx)
> > > + && !ctx->Extensions.ARB_texture_view)
> >
> > This if-statement will never evaluate to true because at least one of
> > _mesa_is_gles3 or _mesa_is_desktop_gl will be false.
> >
> >
> > The intent - as I understand it - is to only return
> > GL_TEXTURE_IMMUTABLE_LEVELS if we are being called using a context that
> > can support it. How about:
> > if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_texture_view)
> >*params = obj->ImmutableLevels;
> > else
> >goto invalid_pname;
> >
> > Does that protect GL_TEXTURE_IMMUTABLE_LEVELS properly?
>
> No... it still lets it slip through in OpenGL ES 1.x. :)
>
>if (!_mesa_is_gles3(ctx) &&
>!(_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
>   goto invalid_pname;
>
The !'s make my brain hurt.

This should be equivalent to:
 if (_mesa_is_gles3(ctx) || (_mesa_is_desktop_gl(ctx) &&
ctx->Extensions.ARB_texture_view)) {
  return param
 } else {
   goto invalid_pname
}

In English, if this is a gles3 context or this is a desktop context that
supports ARB_texture_view you can get the value of TEXTURE_IMMUTABLE_LEVELS.
If this is not a gles3 context, it's not sufficient to just support the
ARB_texture_view extension, this has to be a desktop context for this glGet
to succeed.

That makes me wonder about the other ARB_texture_view texture parameters.
I.e.
case GL_TEXTURE_VIEW_MIN_LEVEL:
 if (!ctx->Extensions.ARB_texture_view)
goto invalid_pname;
 *params = (GLint) obj->MinLevel;

Is it sufficient to allow the query any time the extension is supported
regardless of the context?


> I'm also debating whether or not we should expose this compatibility
> profiles.  The extension spec doesn't mention anything about legacy
> texture formats (luminance, etc.).  I haven't looked at the OpenGL 4.3
> Compatibility Profile spec yet.  The only relevant text in the extension
> spec is:
>
> "The two textures' internal formats must be compatible according
> to Table 3.X.2 (Compatible internal formats for TextureView) if
> the internal format exists in that table and the internal
> formats must be identical if not in that table, or else an
> INVALID_OPERATION error is generated."
>
> So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...
>
>


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


Re: [Mesa-dev] [PATCH] i965/gen6: Don't allow SIMD16 dispatch in 4x PERPIXEL mode with computed depth.

2013-11-05 Thread Eric Anholt
Paul Berry  writes:

> Hardware docs say we can only use SIMD8 dispatch in this condition.

Reviewed-by: Eric Anholt 


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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Courtney Goeltzenleuchter
On Tue, Nov 5, 2013 at 10:44 AM, Chris Forbes  wrote:

> > So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...
>
> My understanding is you can't actually, since views can only be
> created from immutable-format textures, and GL_LUMINANCE is not a
> sized internalformat, so it can't be used with TexStorage?
>

Chris is correct. GL_LUMINANCE is unsized and is not an allowed format for
glTexStorage.

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


Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Matt Turner
On Sat, Nov 2, 2013 at 12:00 PM, Emil Velikov  wrote:
> Rip out the source file list from mesa/Makefile.sources, to a
> more sensible location/file.
> * Split PROGRAM_FILES and GENERATED_FILES.
> * Update the automake and Android build systems.
>
> Android
> * Slightly reshuffle the Android.mk for readability sake.
> * Use GENERATED_FILES, drop the TODO item.
> * Use explicit 'call' when executing local macros.
>
> Cc: Chad Versace 
> Signed-off-by: Emil Velikov 
> ---
>
> Andoid changes are _not_ tested (yet).
>
> ---
>  src/mesa/Makefile.sources | 24 ---
>  src/mesa/program/Android.mk   | 65 
> ---
>  src/mesa/program/Makefile.am  | 25 +--
>  src/mesa/program/Makefile.sources | 27 
>  4 files changed, 69 insertions(+), 72 deletions(-)
>  create mode 100644 src/mesa/program/Makefile.sources
>
> diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
> index a84f8a7..e4146ae 100644
> --- a/src/mesa/Makefile.sources
> +++ b/src/mesa/Makefile.sources
> @@ -252,30 +252,6 @@ STATETRACKER_FILES = \
> $(SRCDIR)state_tracker/st_texture.c \
> $(SRCDIR)state_tracker/st_vdpau.c
>
> -PROGRAM_FILES = \
> -   $(SRCDIR)program/arbprogparse.c \
> -   $(SRCDIR)program/prog_hash_table.c \
> -   $(SRCDIR)program/ir_to_mesa.cpp \
> -   $(SRCDIR)program/program.c \
> -   $(SRCDIR)program/program_parse_extra.c \
> -   $(SRCDIR)program/prog_cache.c \
> -   $(SRCDIR)program/prog_execute.c \
> -   $(SRCDIR)program/prog_instruction.c \
> -   $(SRCDIR)program/prog_noise.c \
> -   $(SRCDIR)program/prog_optimize.c \
> -   $(SRCDIR)program/prog_opt_constant_fold.c \
> -   $(SRCDIR)program/prog_parameter.c \
> -   $(SRCDIR)program/prog_parameter_layout.c \
> -   $(SRCDIR)program/prog_print.c \
> -   $(SRCDIR)program/prog_statevars.c \
> -   $(SRCDIR)program/programopt.c \
> -   $(SRCDIR)program/register_allocate.c \
> -   $(SRCDIR)program/sampler.cpp \
> -   $(SRCDIR)program/string_to_uint_map.cpp \
> -   $(SRCDIR)program/symbol_table.c \
> -   $(BUILDDIR)program/lex.yy.c \
> -   $(BUILDDIR)program/program_parse.tab.c
> -
>  ASM_C_FILES =  \
> $(SRCDIR)x86/common_x86.c \
> $(SRCDIR)x86/x86_xform.c \
> diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
> index e85afe6..e340ed4 100644
> --- a/src/mesa/program/Android.mk
> +++ b/src/mesa/program/Android.mk
> @@ -18,8 +18,30 @@
>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>  # DEALINGS IN THE SOFTWARE.
>
> +# --
> +# libmesa_program.a
> +# --
>  LOCAL_PATH := $(call my-dir)
>
> +# get PROGRAM_FILES and GENERATED_FILES
> +include $(LOCAL_PATH)/Makefile.sources
> +include $(CLEAR_VARS)
> +
> +LOCAL_MODULE := libmesa_program
> +LOCAL_MODULE_CLASS := STATIC_LIBRARIES
> +
> +intermediates := $(call local-intermediates-dir)
> +
> +LOCAL_C_INCLUDES := \
> +   $(intermediates) \
> +   $(MESA_TOP)/src/mapi \
> +   $(MESA_TOP)/src/mesa \
> +   $(MESA_TOP)/src/glsl
> +
> +
> +LOCAL_SRC_FILES := $(PROGRAM_FILES)
> +LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(GENERATED_FILES))
> +
>  define local-l-to-c
> @mkdir -p $(dir $@)
> @echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
> @@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
> $(hide) $(YACC) -o $@ -p "_mesa_program_" $<
>  endef
>
> -# --
> -# libmesa_program.a
> -# --
> -
> -# Import the following variables:
> -# PROGRAM_FILES
> -include $(MESA_TOP)/src/mesa/Makefile.sources
> -
> -include $(CLEAR_VARS)
> -
> -LOCAL_MODULE := libmesa_program
> -LOCAL_MODULE_CLASS := STATIC_LIBRARIES
> -
> -intermediates := $(call local-intermediates-dir)
> +$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
> +   $(call local-l-to-c)
>
> -# TODO(chadv): In Makefile.sources, move these vars to a different list so 
> we can
> -# remove this kludge.
> -generated_sources_basenames := \
> -   lex.yy.c \
> -   program_parse.tab.c \
> -   program_parse.tab.h
> +$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
> +   $(call mesa_local-y-to-c-and-h)
>
> -LOCAL_SRC_FILES := \
> -   $(filter-out $(generated_sources_basenames),$(subst 
> program/,,$(PROGRAM_FILES)))
> -
> -LOCAL_GENERATED_SOURCES := \
> -   $(addprefix $(intermediates)/program/,$(generated_sources_basenames))
> -
> -$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
> -   $(mesa_local-y-to-c-and-h)
> -
> -$(intermediates)/program/program_parse.tab.h: 
> $(intermediates)/program/program_parse.tab.c
> +$(intermediates)/program_parse.tab.h: $(interme

[Mesa-dev] [PATCH] gallivm: optimize lp_build_minify for sse

2013-11-05 Thread sroland
From: Roland Scheidegger 

SSE can't handle true vector shifts (with variable shift count),
so llvm is turning them into a mess of extracts, scalar shifts and inserts.
It is however possible to emulate them in lp_build_minify with float muls,
which should be way faster (saves over 20 instructions per 8-wide
lp_build_minify). This wouldn't work for "generic" 32bit shifts though
since we've got only 24bits of mantissa (actually for left shifts it would
work by using sse41 int mul instead of float mul but not for right shifts).
Note that this has very limited scope for now, since this is only used with
per-pixel lod (otherwise we're avoiding the non-constant shift count by doing
per-quad shifts manually), and only 1d textures even then (though the latter
should change).
---
 src/gallium/auxiliary/gallivm/lp_bld_sample.c |   62 +
 src/gallium/auxiliary/gallivm/lp_bld_sample.h |3 +-
 src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |2 +-
 3 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c 
b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
index a032d9d..e60a035 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
@@ -36,6 +36,7 @@
 #include "pipe/p_state.h"
 #include "util/u_format.h"
 #include "util/u_math.h"
+#include "util/u_cpu_detect.h"
 #include "lp_bld_arit.h"
 #include "lp_bld_const.h"
 #include "lp_bld_debug.h"
@@ -248,7 +249,7 @@ lp_build_rho(struct lp_build_sample_context *bld,
first_level = bld->dynamic_state->first_level(bld->dynamic_state,
  bld->gallivm, texture_unit);
first_level_vec = lp_build_broadcast_scalar(int_size_bld, first_level);
-   int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec);
+   int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec, 
TRUE);
float_size = lp_build_int_to_float(float_size_bld, int_size);
 
if (cube_rho) {
@@ -1089,12 +1090,14 @@ lp_build_get_mip_offsets(struct lp_build_sample_context 
*bld,
 
 /**
  * Codegen equivalent for u_minify().
+ * @param lod_scalar  if lod is a (broadcasted) scalar
  * Return max(1, base_size >> level);
  */
 LLVMValueRef
 lp_build_minify(struct lp_build_context *bld,
 LLVMValueRef base_size,
-LLVMValueRef level)
+LLVMValueRef level,
+boolean lod_scalar)
 {
LLVMBuilderRef builder = bld->gallivm->builder;
assert(lp_check_value(bld->type, base_size));
@@ -1105,10 +1108,49 @@ lp_build_minify(struct lp_build_context *bld,
   return base_size;
}
else {
-  LLVMValueRef size =
- LLVMBuildLShr(builder, base_size, level, "minify");
+  LLVMValueRef size;
   assert(bld->type.sign);
-  size = lp_build_max(bld, size, bld->one);
+  if (lod_scalar ||
+ (util_cpu_caps.has_avx2 || !util_cpu_caps.has_sse)) {
+ size = LLVMBuildLShr(builder, base_size, level, "minify");
+ size = lp_build_max(bld, size, bld->one);
+  }
+  else {
+ /*
+  * emulate shift with float mul, since intel "forgot" shifts with
+  * per-element shift count until avx2, which results in terrible
+  * scalar extraction (both count and value), scalar shift,
+  * vector reinsertion. Should not be an issue on any non-x86 cpu
+  * with a vector instruction set.
+  * On cpus with AMD's XOP this should also be unnecessary but I'm
+  * not sure if llvm would emit this with current flags.
+  */
+ LLVMValueRef const127, const23, lf;
+ struct lp_type ftype;
+ struct lp_build_context fbld;
+ ftype = lp_type_float_vec(32, bld->type.length * bld->type.width);
+ lp_build_context_init(&fbld, bld->gallivm, ftype);
+ const127 = lp_build_const_int_vec(bld->gallivm, bld->type, 127);
+ const23 = lp_build_const_int_vec(bld->gallivm, bld->type, 23);
+
+ /* calculate 2^(-level) float */
+ lf = lp_build_sub(bld, const127, level);
+ lf = lp_build_shl(bld, lf, const23);
+ lf = LLVMBuildBitCast(builder, lf, fbld.vec_type, "");
+
+ /* finish shift operation by doing float mul */
+ base_size = lp_build_int_to_float(&fbld, base_size);
+ size = lp_build_mul(&fbld, base_size, lf);
+ /*
+  * do the max also with floats because
+  * a) non-emulated int max requires sse41
+  *(this is actually a lie as we could cast to 16bit values
+  *as 16bit is sufficient and 16bit int max is sse2)
+  * b) with avx we can do int max 4-wide but float max 8-wide
+  */
+ size = lp_build_max(&fbld, size, fbld.one);
+ size = lp_build_itrunc(&fbld, size);
+  }
   return size;
}
 }
@@ -1185,7 +1227,7 @@ lp_build_mipmap_level_sizes(struct 
lp_build_sample_context *bld,
 */
   

Re: [Mesa-dev] [PATCH 10/37] mesa/program: move source files list to Makefile.sources

2013-11-05 Thread Chad Versace

On 11/02/2013 12:00 PM, Emil Velikov wrote:

Rip out the source file list from mesa/Makefile.sources, to a
more sensible location/file.
* Split PROGRAM_FILES and GENERATED_FILES.
* Update the automake and Android build systems.

Android
* Slightly reshuffle the Android.mk for readability sake.
* Use GENERATED_FILES, drop the TODO item.
* Use explicit 'call' when executing local macros.

Cc: Chad Versace 
Signed-off-by: Emil Velikov 
---

Andoid changes are _not_ tested (yet).


The changes to the Andoid.mk look good to me. It's much easier to
understand now. However, I've also not tested the changes. This
path is
Reviewed-by: Chad Versace 

Adrian, do wish to test this series on Android?


---
  src/mesa/Makefile.sources | 24 ---
  src/mesa/program/Android.mk   | 65 ---
  src/mesa/program/Makefile.am  | 25 +--
  src/mesa/program/Makefile.sources | 27 
  4 files changed, 69 insertions(+), 72 deletions(-)
  create mode 100644 src/mesa/program/Makefile.sources

diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index a84f8a7..e4146ae 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -252,30 +252,6 @@ STATETRACKER_FILES = \
$(SRCDIR)state_tracker/st_texture.c \
$(SRCDIR)state_tracker/st_vdpau.c

-PROGRAM_FILES = \
-   $(SRCDIR)program/arbprogparse.c \
-   $(SRCDIR)program/prog_hash_table.c \
-   $(SRCDIR)program/ir_to_mesa.cpp \
-   $(SRCDIR)program/program.c \
-   $(SRCDIR)program/program_parse_extra.c \
-   $(SRCDIR)program/prog_cache.c \
-   $(SRCDIR)program/prog_execute.c \
-   $(SRCDIR)program/prog_instruction.c \
-   $(SRCDIR)program/prog_noise.c \
-   $(SRCDIR)program/prog_optimize.c \
-   $(SRCDIR)program/prog_opt_constant_fold.c \
-   $(SRCDIR)program/prog_parameter.c \
-   $(SRCDIR)program/prog_parameter_layout.c \
-   $(SRCDIR)program/prog_print.c \
-   $(SRCDIR)program/prog_statevars.c \
-   $(SRCDIR)program/programopt.c \
-   $(SRCDIR)program/register_allocate.c \
-   $(SRCDIR)program/sampler.cpp \
-   $(SRCDIR)program/string_to_uint_map.cpp \
-   $(SRCDIR)program/symbol_table.c \
-   $(BUILDDIR)program/lex.yy.c \
-   $(BUILDDIR)program/program_parse.tab.c
-
  ASM_C_FILES = \
$(SRCDIR)x86/common_x86.c \
$(SRCDIR)x86/x86_xform.c \
diff --git a/src/mesa/program/Android.mk b/src/mesa/program/Android.mk
index e85afe6..e340ed4 100644
--- a/src/mesa/program/Android.mk
+++ b/src/mesa/program/Android.mk
@@ -18,8 +18,30 @@
  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  # DEALINGS IN THE SOFTWARE.

+# --
+# libmesa_program.a
+# --
  LOCAL_PATH := $(call my-dir)

+# get PROGRAM_FILES and GENERATED_FILES
+include $(LOCAL_PATH)/Makefile.sources
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libmesa_program
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+
+intermediates := $(call local-intermediates-dir)
+
+LOCAL_C_INCLUDES := \
+   $(intermediates) \
+   $(MESA_TOP)/src/mapi \
+   $(MESA_TOP)/src/mesa \
+   $(MESA_TOP)/src/glsl
+
+
+LOCAL_SRC_FILES := $(PROGRAM_FILES)
+LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/,$(GENERATED_FILES))
+
  define local-l-to-c
@mkdir -p $(dir $@)
@echo "Mesa Lex: $(PRIVATE_MODULE) <= $<"
@@ -32,48 +54,15 @@ define mesa_local-y-to-c-and-h
$(hide) $(YACC) -o $@ -p "_mesa_program_" $<
  endef

-# --
-# libmesa_program.a
-# --
-
-# Import the following variables:
-# PROGRAM_FILES
-include $(MESA_TOP)/src/mesa/Makefile.sources
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libmesa_program
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-
-intermediates := $(call local-intermediates-dir)
+$(intermediates)/lex.yy.c: $(LOCAL_PATH)/program_lexer.l
+   $(call local-l-to-c)

-# TODO(chadv): In Makefile.sources, move these vars to a different list so we 
can
-# remove this kludge.
-generated_sources_basenames := \
-   lex.yy.c \
-   program_parse.tab.c \
-   program_parse.tab.h
+$(intermediates)/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
+   $(call mesa_local-y-to-c-and-h)

-LOCAL_SRC_FILES := \
-   $(filter-out $(generated_sources_basenames),$(subst 
program/,,$(PROGRAM_FILES)))
-
-LOCAL_GENERATED_SOURCES := \
-   $(addprefix $(intermediates)/program/,$(generated_sources_basenames))
-
-$(intermediates)/program/program_parse.tab.c: $(LOCAL_PATH)/program_parse.y
-   $(mesa_local-y-to-c-and-h)
-
-$(intermediates)/program/program_parse.tab.h: 
$(intermediates)/program/program_parse.tab.c
+$(intermediates)/program_parse.tab.h: $(intermediates)/program_parse.tab.c
@

-$(interm

[Mesa-dev] [PATCH] i965/gen6: Don't allow SIMD16 dispatch in 4x PERPIXEL mode with computed depth.

2013-11-05 Thread Paul Berry
Hardware docs say we can only use SIMD8 dispatch in this condition.
---
 src/mesa/drivers/dri/i965/gen6_wm_state.c | 34 ++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c 
b/src/mesa/drivers/dri/i965/gen6_wm_state.c
index 42d8789..e56186b 100644
--- a/src/mesa/drivers/dri/i965/gen6_wm_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c
@@ -229,8 +229,40 @@ upload_wm_state(struct brw_context *brw)
 
   if (min_inv_per_frag > 1)
  dw6 |= GEN6_WM_MSDISPMODE_PERSAMPLE;
-  else
+  else {
  dw6 |= GEN6_WM_MSDISPMODE_PERPIXEL;
+
+ /* From the Sandy Bridge PRM, Vol 2 part 1, 7.7.1 ("Pixel Grouping
+  * (Dispatch Size) Control"), p.334:
+  *
+  * Note: in the table below, the Valid column indicates which
+  * products that combination is supported on. Combinations of
+  * dispatch enables not listed in the table are not available on
+  * any product.
+  *
+  * A: Valid on all products
+  *
+  * B: Not valid on [DevSNB] if 4x PERPIXEL mode with pixel shader
+  * computed depth.
+  *
+  * D: Valid on all products, except when in non-1x PERSAMPLE mode
+  * (applies to [DevSNB+] only). Not valid on [DevSNB] if 4x
+  * PERPIXEL mode with pixel shader computed depth.
+  *
+  * E: Not valid on [DevSNB] if 4x PERPIXEL mode with pixel shader
+  * computed depth.
+  *
+  * F: Valid on all products, except not valid on [DevSNB] if 4x
+  * PERPIXEL mode with pixel shader computed depth.
+  *
+  * In the table that follows, the only entry with "A" in the Valid
+  * column is the entry where only 8 pixel dispatch is enabled.
+  * Therefore, when we are in PERPIXEL mode with pixel shader computed
+  * depth, we need to disable SIMD16 dispatch.
+  */
+ if (dw5 & GEN6_WM_COMPUTED_DEPTH)
+dw5 &= ~GEN6_WM_16_DISPATCH_ENABLE;
+  }
} else {
   dw6 |= GEN6_WM_MSRAST_OFF_PIXEL;
   dw6 |= GEN6_WM_MSDISPMODE_PERSAMPLE;
-- 
1.8.4.2

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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Chris Forbes
> So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...

My understanding is you can't actually, since views can only be
created from immutable-format textures, and GL_LUMINANCE is not a
sized internalformat, so it can't be used with TexStorage?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] 9.2.2 OSMesa classic 80 new regressions in VTK

2013-11-05 Thread Ian Romanick
On 11/05/2013 09:32 AM, burlen wrote:
> Upgrading from 9.2.0 to 9.2.2 with OSMesa classic I'm seeing 80 new
> regressions in VTK.
> http://open.cdash.org/viewTest.php?onlyfailed&buildid=3087854
> click "Failed" to see an image diff. Maybe related to line rendering?
> Any chance a mesa developer could investigate?

Can you bisect?

> Burlen
> ___
> 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] 9.2.2 OSMesa classic 80 new regressions in VTK

2013-11-05 Thread burlen
Upgrading from 9.2.0 to 9.2.2 with OSMesa classic I'm seeing 80 new 
regressions in VTK.

http://open.cdash.org/viewTest.php?onlyfailed&buildid=3087854
click "Failed" to see an image diff. Maybe related to line rendering? 
Any chance a mesa developer could investigate?


Burlen



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


Re: [Mesa-dev] [PATCH 1/6] st/draw: silence Mingw warning in pointer_to_offset()

2013-11-05 Thread Ian Romanick
On 10/29/2013 01:11 PM, Brian Paul wrote:
> Fixes "warning: cast from pointer to integer of different size" for
> 64-bit builds.
> ---
>  src/mesa/state_tracker/st_draw.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/state_tracker/st_draw.h 
> b/src/mesa/state_tracker/st_draw.h
> index 3313fc8..394473b 100644
> --- a/src/mesa/state_tracker/st_draw.h
> +++ b/src/mesa/state_tracker/st_draw.h
> @@ -77,7 +77,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
>  static INLINE unsigned
>  pointer_to_offset(const void *ptr)
>  {
> -   return (unsigned) (((unsigned long) ptr) & 0xUL);
> +   return (unsigned) (((GLsizeiptr) ptr) & 0xUL);

Would it be better to just use uintptr_t?

>  }
>  
>  

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


Re: [Mesa-dev] [PATCH 09/11] mesa: Add Get* support for ARB_vertex_attrib_binding

2013-11-05 Thread Ian Romanick
On 11/04/2013 03:10 PM, Fredrik Höglund wrote:
> On Monday 04 November 2013, Ian Romanick wrote:
>> On 10/28/2013 03:33 PM, Fredrik Höglund wrote:
>>
>> This needs some extension checks somewhere.
> 
> I've added a check for ARB_instanced_arrays in the VERTEX_BINDING_DIVISOR
> case.  I didn't add checks for ARB_vertex_attrib_binding since the intent is 
> to
> always enable it on desktop GL.

I had overlooked that patch #5 enabled the extension unconditionally.
Just adding the checks for ARB_instanced_arrays should be fine.  With that,

Reviewed-by: Ian Romanick 

> Or were you thinking of something else?
> 
>>> ---
>>>  src/mesa/main/get.c  |   24 
>>>  src/mesa/main/get_hash_params.py |3 +++
>>>  src/mesa/main/varray.c   |9 +
>>>  3 files changed, 36 insertions(+)
>>>
>>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>>> index b39fdfb..caa163e 100644
>>> --- a/src/mesa/main/get.c
>>> +++ b/src/mesa/main/get.c
>>> @@ -1692,6 +1692,30 @@ find_value_indexed(const char *func, GLenum pname, 
>>> GLuint index, union value *v)
>>>   goto invalid_enum;
>>>v->value_int = ctx->Multisample.SampleMaskValue;
>>>return TYPE_INT;
>>> +
>>> +   case GL_VERTEX_BINDING_DIVISOR:
>>> +  if (!_mesa_is_desktop_gl(ctx))
>>> +  goto invalid_enum;
>>> +  if (index >= ctx->Const.VertexProgram.MaxAttribs)
>>> +  goto invalid_value;
>>> +  v->value_int = 
>>> ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor;
>>> +  return TYPE_INT;
>>> +
>>> +   case GL_VERTEX_BINDING_OFFSET:
>>> +  if (!_mesa_is_desktop_gl(ctx))
>>> +  goto invalid_enum;
>>> +  if (index >= ctx->Const.VertexProgram.MaxAttribs)
>>> +  goto invalid_value;
>>> +  v->value_int = 
>>> ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset;
>>> +  return TYPE_INT;
>>> +
>>> +   case GL_VERTEX_BINDING_STRIDE:
>>> +  if (!_mesa_is_desktop_gl(ctx))
>>> +  goto invalid_enum;
>>> +  if (index >= ctx->Const.VertexProgram.MaxAttribs)
>>> +  goto invalid_value;
>>> +  v->value_int = 
>>> ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
>>> +  return TYPE_INT;
>>> }
>>>  
>>>   invalid_enum:
>>> diff --git a/src/mesa/main/get_hash_params.py 
>>> b/src/mesa/main/get_hash_params.py
>>> index 3204940..4e2f7d2 100644
>>> --- a/src/mesa/main/get_hash_params.py
>>> +++ b/src/mesa/main/get_hash_params.py
>>> @@ -722,6 +722,9 @@ descriptor=[
>>>[ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", 
>>> "CONTEXT_INT(Const.MaxProgramTextureGatherOffset), 
>>> extra_ARB_texture_gather"],
>>>[ "MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB", 
>>> "CONTEXT_INT(Const.MaxProgramTextureGatherComponents), 
>>> extra_ARB_texture_gather"],
>>>  
>>> +# GL_ARB_vertex_attrib_binding
>>> +  [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", 
>>> "CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
>>> +  [ "MAX_VERTEX_ATTRIB_BINDINGS", 
>>> "CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ],
>>>  ]},
>>>  
>>>  # Enums restricted to OpenGL Core profile
>>> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
>>> index 6c56ddd..5b5b8b2 100644
>>> --- a/src/mesa/main/varray.c
>>> +++ b/src/mesa/main/varray.c
>>> @@ -762,6 +762,15 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint 
>>> index, GLenum pname,
>>>|| _mesa_is_gles3(ctx)) {
>>>   return gl_vertex_buffer_binding(ctx, 
>>> array->VertexBinding)->InstanceDivisor;
>>>}
>>> +   case GL_VERTEX_ATTRIB_BINDING:
>>> +  if (_mesa_is_desktop_gl(ctx)) {
>>> + return array->VertexBinding - VERT_ATTRIB_GENERIC0;
>>> +  }
>>> +  goto error;
>>> +   case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
>>> +  if (_mesa_is_desktop_gl(ctx)) {
>>> + return array->RelativeOffset;
>>> +  }
>>>goto error;
>>> default:
>>>; /* fall-through */
>>>

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


[Mesa-dev] [PATCH 3/3] gbm: Add entry points for mapping and unmapping bos

2013-11-05 Thread Ander Conselvan de Oliveira
Add gbm_bo_map() and gbm_bo_unmap(). This lets a user access the
contents of a bo using the CPU.

---

I'm not sure about the extra flags. We do have GBM_BO_USE_WRITE but
that is defined to always work with GBM_BO_USE_CURSOR_64X64. Reusing
that would imply that these buffers are always mappable or an API
change.
---
 src/gbm/backends/dri/gbm_dri.c |4 
 src/gbm/backends/intel/gbm_intel.c |   21 +
 src/gbm/backends/intel/gbm_intel.h |2 ++
 src/gbm/main/gbm.c |   25 +
 src/gbm/main/gbm.h |   14 ++
 src/gbm/main/gbmint.h  |2 ++
 6 files changed, 68 insertions(+)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 9998308..bdd1c85 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -315,6 +315,10 @@ gbm_dri_is_format_supported(struct gbm_device *gbm,
usage & GBM_BO_USE_RENDERING)
   return 0;
 
+   if (usage & GBM_BO_USE_CPU_WRITE ||
+   usage & GBM_BO_USE_CPU_READ)
+  return 0;
+
return 1;
 }
 
diff --git a/src/gbm/backends/intel/gbm_intel.c 
b/src/gbm/backends/intel/gbm_intel.c
index 9f17df7..f8baa98 100644
--- a/src/gbm/backends/intel/gbm_intel.c
+++ b/src/gbm/backends/intel/gbm_intel.c
@@ -73,6 +73,24 @@ gbm_intel_bo_write(struct gbm_bo *bo, const void *buf, 
size_t count)
return drm_intel_bo_unmap(ibo->bo);
 }
 
+static void *
+gbm_intel_bo_map(struct gbm_bo *bo)
+{
+   struct gbm_intel_bo *ibo = gbm_intel_bo(bo);
+
+   drm_intel_bo_map(ibo->bo, 1);
+
+   return ibo->bo->virtual;
+}
+
+static void
+gbm_intel_bo_unmap(struct gbm_bo *bo)
+{
+   struct gbm_intel_bo *ibo = gbm_intel_bo(bo);
+
+   drm_intel_bo_unmap(ibo->bo);
+}
+
 static void
 gbm_intel_bo_destroy(struct gbm_bo *_bo)
 {
@@ -102,6 +120,7 @@ gbm_intel_bo_create_with_bo(struct gbm_device *gbm,
   return NULL;
 
ibo->bo = bo;
+   ibo->usage = usage;
 
ibo->base.base.gbm = gbm;
ibo->base.base.width = width;
@@ -225,6 +244,8 @@ gbm_intel_device_create(int fd)
igbm->base.base.bo_export = gbm_intel_bo_export;
igbm->base.base.is_format_supported = gbm_intel_is_format_supported;
igbm->base.base.bo_write = gbm_intel_bo_write;
+   igbm->base.base.bo_map = gbm_intel_bo_map;
+   igbm->base.base.bo_unmap = gbm_intel_bo_unmap;
igbm->base.base.bo_destroy = gbm_intel_bo_destroy;
igbm->base.base.destroy = gbm_intel_destroy;
igbm->base.base.surface_create = gbm_intel_surface_create;
diff --git a/src/gbm/backends/intel/gbm_intel.h 
b/src/gbm/backends/intel/gbm_intel.h
index 4691ecc..8136c78 100644
--- a/src/gbm/backends/intel/gbm_intel.h
+++ b/src/gbm/backends/intel/gbm_intel.h
@@ -46,6 +46,8 @@ struct gbm_intel_device {
 struct gbm_intel_bo {
struct gbm_drm_bo base;
 
+   uint32_t usage;
+
drm_intel_bo *bo;
uint32_t name;
 };
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index b68ead0..f41b4c9 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -250,6 +250,31 @@ gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t 
count)
return bo->gbm->bo_write(bo, buf, count);
 }
 
+/** Map a buffer object in CPU accesible memory
+ *
+ * \param bo The buffer object to be mapped
+ * \return Pointer to the mapped buffer object or NULL on failure
+ */
+GBM_EXPORT void *
+gbm_bo_map(struct gbm_bo *bo)
+{
+   if (bo->gbm->bo_map)
+  return bo->gbm->bo_map(bo);
+   else
+  return NULL;
+}
+
+/** Unmap a preivously mapped buffer object
+ *
+ * \param The buffer object to be unmapped
+ */
+GBM_EXPORT void
+gbm_bo_unmap(struct gbm_bo *bo)
+{
+   if (bo->gbm->bo_unmap)
+  bo->gbm->bo_unmap(bo);
+}
+
 /** Get the gbm device used to create the buffer object
  *
  * \param bo The buffer object
diff --git a/src/gbm/main/gbm.h b/src/gbm/main/gbm.h
index 3854c4c..b3942d3 100644
--- a/src/gbm/main/gbm.h
+++ b/src/gbm/main/gbm.h
@@ -207,6 +207,14 @@ enum gbm_bo_flags {
 * combinations.
 */
GBM_BO_USE_WRITE= (1 << 3),
+   /**
+* Buffer can be mapped with gbm_bo_map() for writing.
+*/
+   GBM_BO_USE_CPU_WRITE = (1 << 4),
+   /**
+* Buffer can be mapped with gbm_bo_map() for reading.
+*/
+   GBM_BO_USE_CPU_READ = (1 << 5),
 };
 
 int
@@ -262,6 +270,12 @@ gbm_bo_get_handle(struct gbm_bo *bo);
 int
 gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count);
 
+void *
+gbm_bo_map(struct gbm_bo *bo);
+
+void
+gbm_bo_unmap(struct gbm_bo *bo);
+
 void
 gbm_bo_set_user_data(struct gbm_bo *bo, void *data,
 void (*destroy_user_data)(struct gbm_bo *, void *));
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
index a8cf49e..f17a46f 100644
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -70,6 +70,8 @@ struct gbm_device {
void *buffer, uint32_t usage);
int (*bo_export)(struct gbm_bo *bo, uint32_t type, void **buffer);
int (*bo_write)(struct gbm_bo *bo, const void *buf, size_t data);
+   void *(*bo_map)

[Mesa-dev] [PATCH 1/3] gbm: Add intel backend

2013-11-05 Thread Ander Conselvan de Oliveira
This adds an intel backend that doesn't depend on dri. Its usage is
limited since the current EGL implementation won't work with this as
it is.
---
 src/gbm/Makefile.am|   12 ++
 src/gbm/backends/intel/gbm_intel.c |  227 
 src/gbm/backends/intel/gbm_intel.h |   74 
 src/gbm/main/backend.c |2 +
 src/gbm/main/common_drm.h  |1 +
 5 files changed, 316 insertions(+)
 create mode 100644 src/gbm/backends/intel/gbm_intel.c
 create mode 100644 src/gbm/backends/intel/gbm_intel.h

diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
index 1282b14..e808b7f 100644
--- a/src/gbm/Makefile.am
+++ b/src/gbm/Makefile.am
@@ -42,6 +42,18 @@ libgbm_la_LIBADD += \
libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la 
$(LIBDRM_LIBS)
 endif
 
+if HAVE_I965_DRI
+noinst_LTLIBRARIES = libgbm_intel.la
+libgbm_intel_la_SOURCES = \
+   backends/intel/gbm_intel.c
+
+libgbm_intel_la_CFLAGS = \
+   $(AM_CFLAGS) $(INTEL_CFLAGS)
+
+libgbm_la_LIBADD += \
+   libgbm_intel.la $(INTEL_LIBS)
+endif
+
 all-local: libgbm.la
$(MKDIR_P) $(top_builddir)/$(LIB_DIR);
ln -f .libs/libgbm.so.1.0.0 $(top_builddir)/$(LIB_DIR)/libgbm.so
diff --git a/src/gbm/backends/intel/gbm_intel.c 
b/src/gbm/backends/intel/gbm_intel.c
new file mode 100644
index 000..dc9f174
--- /dev/null
+++ b/src/gbm/backends/intel/gbm_intel.c
@@ -0,0 +1,227 @@
+/*
+ * 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, 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:
+ *Ander Conselvan de Oliveira 
+ */
+
+#include 
+#include 
+#include 
+
+#include "gbm_intel.h"
+
+#include "gbmint.h"
+
+static int
+gbm_intel_is_format_supported(struct gbm_device *gbm,
+uint32_t format,
+uint32_t usage)
+{
+   switch (format) {
+   case GBM_BO_FORMAT_XRGB:
+   case GBM_FORMAT_XRGB:
+  break;
+   case GBM_BO_FORMAT_ARGB:
+   case GBM_FORMAT_ARGB:
+  if (usage & GBM_BO_USE_SCANOUT)
+ return 0;
+  break;
+   default:
+  return 0;
+   }
+
+   if (usage & GBM_BO_USE_CURSOR_64X64 &&
+   usage & GBM_BO_USE_RENDERING)
+  return 0;
+
+   return 1;
+}
+
+static int
+gbm_intel_bo_write(struct gbm_bo *bo, const void *buf, size_t count)
+{
+   struct gbm_intel_bo *ibo = gbm_intel_bo(bo);
+   int ret;
+
+   ret = drm_intel_bo_map(ibo->bo, 1);
+   if (ret < 0)
+  return ret;
+
+   memcpy(ibo->bo->virtual, buf, count);
+
+   return drm_intel_bo_unmap(ibo->bo);
+}
+
+static void
+gbm_intel_bo_destroy(struct gbm_bo *_bo)
+{
+   struct gbm_intel_bo *ibo = gbm_intel_bo(_bo);
+
+   drm_intel_bo_unreference(ibo->bo);
+
+   free(ibo);
+}
+
+static inline int
+align(int value, int size)
+{
+   return (value + size - 1) & ~(size - 1);
+}
+
+static struct gbm_intel_bo *
+gbm_intel_bo_create_with_bo(struct gbm_device *gbm,
+uint32_t width, uint32_t height, uint32_t stride,
+uint32_t format, uint32_t usage,
+drm_intel_bo *bo)
+{
+   struct gbm_intel_bo *ibo;
+
+   ibo = calloc(1, sizeof *ibo);
+   if (!ibo)
+  return NULL;
+
+   ibo->bo = bo;
+
+   ibo->base.base.gbm = gbm;
+   ibo->base.base.width = width;
+   ibo->base.base.height = height;
+   ibo->base.base.stride = stride;
+   ibo->base.base.format = format;
+   ibo->base.base.handle.s32 = ibo->bo->handle;
+
+   return ibo;
+}
+
+static struct gbm_bo *
+gbm_intel_bo_create(struct gbm_device *gbm,
+uint32_t width, uint32_t height,
+uint32_t format, uint32_t usage)
+{
+   struct gbm_intel_device *igbm = gbm_intel_device(gbm);
+   struct gbm_intel_bo *ibo;
+   drm_intel_bo *bo;
+   int size, stride;
+
+   switch (format) {
+   case GBM_BO_FORMAT_XRGB:
+   case GBM_FORMAT_XRGB:
+   case GBM_BO_FORMAT_ARGB:
+   case GBM_FORMAT_

Re: [Mesa-dev] [PATCH 0/8] Add DRIimage-based DRI3/Present loader

2013-11-05 Thread Keith Packard
Keith Packard  writes:

> This sequence first adds a a couple of new DRIimage extensions to the
> dri/common, dri/i915 and dri/i965 directories which define a
> loader-independent API for managing window system operations.
>
> The last patch adds a new DRI3000 loader using those new interfaces.

I've figured out that I can also re-use dri2CreateNewScreen2 for the
image driver bits, as long as I change that function to also look up the
image loader. That means there are *no* new dri_util functions needed.

To recap, the changes needed to support using the DRIimageExtension
interfaces for allocating buffers from the driver in the loader are:

DRIimageDriverExtension

A proper subset of DRIdri2DriverExtension, which uses
the same five functions involved in creating new objects:

   /* Common DRI functions, shared with DRI2 */
   __DRIcreateNewScreen2createNewScreen2;
   __DRIcreateNewDrawable   createNewDrawable;
   __DRIcreateNewContextcreateNewContext;
   __DRIcreateContextAttribscreateContextAttribs;
   __DRIgetAPIMask  getAPIMask;

DRIimageLoaderExtension

Contains just two functions, one to allocate buffers and one to
copy the fake front to the real front when flushing stuff.

   /**
* Allocate color buffers.
*
* \param driDrawable
* \param width  Width of allocated buffers
* \param height Height of allocated buffers
* \param format one of __DRI_IMAGE_FORMAT_*
* \param stamp  Address of variable to be updated when
*   getBuffers must be called again
* \param loaderPrivate  The loaderPrivate for driDrawable
* \param buffer_maskSet of buffers to allocate
* \param buffersReturned buffers
*/
   int (*getBuffers)(__DRIdrawable *driDrawable,
 int *width, int *height,
 unsigned int format,
 uint32_t *stamp,
 void *loaderPrivate,
 uint32_t buffer_mask,
 struct __DRIimageList *buffers);

/**
 * Flush pending front-buffer rendering
 *
 * Any rendering that has been performed to the
 * fake front will be flushed to the front
 *
 * \param driDrawableDrawable whose front-buffer is to be 
flushed
 * \param loaderPrivate  Loader's private data that was previously 
passed
 *   into 
__DRIdri2ExtensionRec::createNewDrawable
 */
void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void 
*loaderPrivate);

Each driver will need to have a path to use the image loader to get
color buffers using the DRIimageLoaderExtension getBuffers function.

-- 
keith.pack...@intel.com


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


Re: [Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

2013-11-05 Thread Ian Romanick
On 11/04/2013 03:34 PM, Courtney Goeltzenleuchter wrote:
> 
> On Fri, Nov 1, 2013 at 1:42 PM, Ian Romanick  > wrote:
> 
> On 11/01/2013 09:54 AM, Courtney Goeltzenleuchter wrote:
> > @@ -1746,11 +1770,37 @@ _mesa_GetTexParameteriv( GLenum target,
> GLenum pname, GLint *params )
> >   break;
> >
> >case GL_TEXTURE_IMMUTABLE_LEVELS:
> > - if (!_mesa_is_gles3(ctx))
> > + if (!_mesa_is_gles3(ctx)
> > + && !_mesa_is_desktop_gl(ctx)
> > + && !ctx->Extensions.ARB_texture_view)
> 
> This if-statement will never evaluate to true because at least one of
> _mesa_is_gles3 or _mesa_is_desktop_gl will be false.
> 
> 
> The intent - as I understand it - is to only return
> GL_TEXTURE_IMMUTABLE_LEVELS if we are being called using a context that
> can support it. How about:
> if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_texture_view)
>*params = obj->ImmutableLevels;
> else
>goto invalid_pname;
> 
> Does that protect GL_TEXTURE_IMMUTABLE_LEVELS properly?

No... it still lets it slip through in OpenGL ES 1.x. :)

   if (!_mesa_is_gles3(ctx) &&
   !(_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
  goto invalid_pname;

I'm also debating whether or not we should expose this compatibility
profiles.  The extension spec doesn't mention anything about legacy
texture formats (luminance, etc.).  I haven't looked at the OpenGL 4.3
Compatibility Profile spec yet.  The only relevant text in the extension
spec is:

"The two textures' internal formats must be compatible according
to Table 3.X.2 (Compatible internal formats for TextureView) if
the internal format exists in that table and the internal
formats must be identical if not in that table, or else an
INVALID_OPERATION error is generated."

So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...

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


[Mesa-dev] [PATCH 2/3] egl/dri: Add gbm platform

2013-11-05 Thread Ander Conselvan de Oliveira
This adds a GBM platform that doesn't depend on gbm's dri backend. This
can be used, for instance, with the intel backend.

This also adds a gbm_bo_export entrypoint to gbm, so that the EGL code
can access the buffer. This is necessary since EGL won't share the fd
width gbm when using the new platform.

The new platform is mostly a copy from platform-drm.c
---
 configure.ac|5 +-
 src/egl/drivers/dri2/Makefile.am|5 +
 src/egl/drivers/dri2/egl_dri2.c |6 +
 src/egl/drivers/dri2/egl_dri2.h |   11 +-
 src/egl/drivers/dri2/platform_gbm.c |  545 +++
 src/egl/main/Makefile.am|5 +
 src/egl/main/egldisplay.c   |3 +-
 src/egl/main/egldisplay.h   |1 +
 src/gbm/backends/dri/gbm_dri.c  |7 +
 src/gbm/backends/intel/gbm_intel.c  |   21 ++
 src/gbm/backends/intel/gbm_intel.h  |1 +
 src/gbm/main/gbm.c  |   29 +-
 src/gbm/main/gbm.h  |4 +
 src/gbm/main/gbmint.h   |3 +
 14 files changed, 638 insertions(+), 8 deletions(-)
 create mode 100644 src/egl/drivers/dri2/platform_gbm.c

diff --git a/configure.ac b/configure.ac
index 91b9871..e6beb5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1442,9 +1442,9 @@ for plat in $egl_platforms; do
 fi
;;
 
-   drm)
+   drm|gbm)
test "x$enable_gbm" = "xno" &&
-   AC_MSG_ERROR([EGL platform drm needs gbm])
+   AC_MSG_ERROR([EGL platform '$plat' needs gbm])
;;
 
android|fbdev|gdi|null)
@@ -1478,6 +1478,7 @@ AM_CONDITIONAL(HAVE_EGL_PLATFORM_WAYLAND, echo 
"$egl_platforms" | grep 'wayland'
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_DRM, echo "$egl_platforms" | grep 'drm' 
>/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_FBDEV, echo "$egl_platforms" | grep 'fbdev' 
>/dev/null 2>&1)
 AM_CONDITIONAL(HAVE_EGL_PLATFORM_NULL, echo "$egl_platforms" | grep 'null' 
>/dev/null 2>&1)
+AM_CONDITIONAL(HAVE_EGL_PLATFORM_GBM, echo "$egl_platforms" | grep 'gbm' 
>/dev/null 2>&1)
 
 AM_CONDITIONAL(HAVE_EGL_DRIVER_DRI2, test "x$HAVE_EGL_DRIVER_DRI2" != "x")
 AM_CONDITIONAL(HAVE_EGL_DRIVER_GLX, test "x$HAVE_EGL_DRIVER_GLX" != "x")
diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am
index 823ef5e..5482a57 100644
--- a/src/egl/drivers/dri2/Makefile.am
+++ b/src/egl/drivers/dri2/Makefile.am
@@ -63,3 +63,8 @@ if HAVE_EGL_PLATFORM_DRM
 libegl_dri2_la_SOURCES += platform_drm.c
 AM_CFLAGS += -DHAVE_DRM_PLATFORM
 endif
+
+if HAVE_EGL_PLATFORM_GBM
+libegl_dri2_la_SOURCES += platform_gbm.c
+AM_CFLAGS += -DHAVE_GBM_PLATFORM
+endif
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 903a1a6..b0797a4 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -626,6 +626,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
  return EGL_TRUE;
   return dri2_initialize_drm(drv, disp);
 #endif
+#ifdef HAVE_GBM_PLATFORM
+   case _EGL_PLATFORM_GBM:
+  if (disp->Options.TestOnly)
+ return EGL_TRUE;
+  return dri2_initialize_gbm(drv, disp);
+#endif
 #ifdef HAVE_WAYLAND_PLATFORM
case _EGL_PLATFORM_WAYLAND:
   if (disp->Options.TestOnly)
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index a72e7b2..ede72e6 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -183,7 +183,11 @@ struct dri2_egl_surface
struct gbm_dri_surface *gbm_dri_surf;
 #endif
 
-#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM)
+#ifdef HAVE_GBM_PLATFORM
+   struct gbm_surface *gbm_surf;
+#endif
+
+#if defined(HAVE_WAYLAND_PLATFORM) || defined(HAVE_DRM_PLATFORM) || 
defined(HAVE_GBM_PLATFORM)
__DRIbuffer   *dri_buffers[__DRI_BUFFER_COUNT];
struct {
 #ifdef HAVE_WAYLAND_PLATFORM
@@ -191,7 +195,7 @@ struct dri2_egl_surface
   __DRIimage *dri_image;
   int pitch, name;
 #endif
-#ifdef HAVE_DRM_PLATFORM
+#if defined(HAVE_DRM_PLATFORM) || defined(HAVE_GBM_PLATFORM)
   struct gbm_bo   *bo;
 #endif
   int locked;
@@ -262,6 +266,9 @@ EGLBoolean
 dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp);
 
 EGLBoolean
+dri2_initialize_gbm(_EGLDriver *drv, _EGLDisplay *disp);
+
+EGLBoolean
 dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp);
 
 EGLBoolean
diff --git a/src/egl/drivers/dri2/platform_gbm.c 
b/src/egl/drivers/dri2/platform_gbm.c
new file mode 100644
index 000..c28bc4a
--- /dev/null
+++ b/src/egl/drivers/dri2/platform_gbm.c
@@ -0,0 +1,545 @@
+/*
+ * Copyright © 2011-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, dist

[Mesa-dev] [RFC] [PATCH 0/3] gbm: Add support for mapping bos

2013-11-05 Thread Ander Conselvan de Oliveira
Hi,

This is a request for comments on the idea of being able to map gbm
bos and how to implement it. The idea here is to take advantage of
UMA atchitectures when the contents on the screen are a mix of GPU
and CPU rendered.

One of the problems of adding a map entry point to gbm is the fact
that it relies on the DRI image extension to do all the work. Instead
of extending that extension, the proposal here is to support different
gbm backends, which may optionally support mapping. However, this
requires changes to the EGL implementation, since the current
implementation is heavily coupled with gbm's dri backend.

The one problem in doing that is that the dri driver and gbm device no
longer share the same fd, so another way of sharing buffers between
then is necessary. As a stop gap measure I added the ability for gbm to
provide gem names (given that dri 2's interface relies on names anyway),
but a better solution is needed.

This would also let the dependency between libgbm and libEGL to be moved
to gbm's dri backend, and open up the possibility of running a Wayland
compositor on KMS with a software renderer that would still be able to
use overlays. This ties with the fast start patches I submitted to the
wayland mailing list.

Still talking about Wayland, I have a rough plan on how to make this
usable with that too. Since gbm is already Wayland aware to some extent,
given that it is able to import wl_buffers into gbm_bos, it seems like
a natural extension that it would be able to do the converse. That
ability together with an entry point for creating a gbm_device for a
given wl_display would be enough for making this available for any
wayland client.

Any comments on this will be highly appreciated.

Thanks,
Ander


Ander Conselvan de Oliveira (3):
  gbm: Add intel backend
  egl/dri: Add gbm platform
  gbm: Add entry points for mapping and unmapping bos

 configure.ac|5 +-
 src/egl/drivers/dri2/Makefile.am|5 +
 src/egl/drivers/dri2/egl_dri2.c |6 +
 src/egl/drivers/dri2/egl_dri2.h |   11 +-
 src/egl/drivers/dri2/platform_gbm.c |  545 +++
 src/egl/main/Makefile.am|5 +
 src/egl/main/egldisplay.c   |3 +-
 src/egl/main/egldisplay.h   |1 +
 src/gbm/Makefile.am |   12 +
 src/gbm/backends/dri/gbm_dri.c  |   11 +
 src/gbm/backends/intel/gbm_intel.c  |  269 +
 src/gbm/backends/intel/gbm_intel.h  |   77 +
 src/gbm/main/backend.c  |2 +
 src/gbm/main/common_drm.h   |1 +
 src/gbm/main/gbm.c  |   54 +++-
 src/gbm/main/gbm.h  |   18 ++
 src/gbm/main/gbmint.h   |5 +
 17 files changed, 1022 insertions(+), 8 deletions(-)
 create mode 100644 src/egl/drivers/dri2/platform_gbm.c
 create mode 100644 src/gbm/backends/intel/gbm_intel.c
 create mode 100644 src/gbm/backends/intel/gbm_intel.h

-- 
1.7.9.5

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


[Mesa-dev] R: Re: [PATCH 2/4] mesa: add aarch64 support

2013-11-05 Thread Fabio Pedretti
>On 11/05/2013 04:49 AM, Fabio Pedretti wrote:
>> Patch from Ubuntu package
>> ---
>>   src/mesa/main/compiler.h | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
>> index 2820913..65c4141 100644
>> --- a/src/mesa/main/compiler.h
>> +++ b/src/mesa/main/compiler.h
>> @@ -312,6 +312,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
>>   defined(__hppa__) || defined(hpux) || \
>>   defined(__mips) || defined(_MIPS_ARCH) || \
>>   defined(__arm__) || \
>> +defined(__aarch64__) || \
>>   defined(__sh__) || defined(__m32r__) || \
>>   (defined(__sun) && defined(_IEEE_754)) || \
>>   defined(__alpha__)
>>
>
>I believe that's Arm64, right?  If so, it could go on the same line as 
>the __arm__ check.  That would follow the pattern of preceding HP and 
>MIPS checks.  But not a big deal.

I sent a new patch with clarified commit message and put on the same line.

>Reviewed-by: Brian Paul 

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


Re: [Mesa-dev] [PATCH 2/4] mesa: add arm64 support

2013-11-05 Thread Brian Paul

On 11/05/2013 08:51 AM, Fabio Pedretti wrote:

Patch from Ubuntu package
---
  src/mesa/main/compiler.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 2820913..d7a52d2 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -311,7 +311,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
  defined(ia64) || defined(__ia64__) || \
  defined(__hppa__) || defined(hpux) || \
  defined(__mips) || defined(_MIPS_ARCH) || \
-defined(__arm__) || \
+defined(__arm__) || defined(__aarch64__) || \
  defined(__sh__) || defined(__m32r__) || \
  (defined(__sun) && defined(_IEEE_754)) || \
  defined(__alpha__)



Reviewed-by: Brian Paul 

Thanks.

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


[Mesa-dev] [PATCH 2/4] mesa: add arm64 support

2013-11-05 Thread Fabio Pedretti
Patch from Ubuntu package
---
 src/mesa/main/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 2820913..d7a52d2 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -311,7 +311,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 defined(ia64) || defined(__ia64__) || \
 defined(__hppa__) || defined(hpux) || \
 defined(__mips) || defined(_MIPS_ARCH) || \
-defined(__arm__) || \
+defined(__arm__) || defined(__aarch64__) || \
 defined(__sh__) || defined(__m32r__) || \
 (defined(__sun) && defined(_IEEE_754)) || \
 defined(__alpha__)
-- 
1.8.3.2

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


Re: [Mesa-dev] [PATCH 3/4] mesa: fix build on kFreeBSD

2013-11-05 Thread Brian Paul

On 11/05/2013 04:49 AM, Fabio Pedretti wrote:

From: Aurelien Jarno 
From: Cyril Brulebois 

mesa fails to build on GNU/kFreeBSD, since some parts are not enabled.

Debian bug: http://bugs.debian.org/524690

Patch from Debian package
---
  configure.ac | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0a25047..e250734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -425,7 +425,7 @@ if test "x$enable_asm" = xyes; then
  case "$host_cpu" in
  i?86)
  case "$host_os" in
-linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
+linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
  test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
  ;;
  gnu*)
@@ -435,7 +435,7 @@ if test "x$enable_asm" = xyes; then
  ;;
  x86_64|amd64)
  case "$host_os" in
-linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
+linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
  test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
  ;;
  esac
@@ -974,7 +974,7 @@ if test "x$enable_dri" = xyes; then
  ;;
  esac
  ;;
-freebsd* | dragonfly* | *netbsd* | openbsd*)
+freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
  DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
  DEFINES="$DEFINES -DHAVE_ALIAS"




For the series:

Reviewed-by: Brian Paul 

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


Re: [Mesa-dev] [PATCH 2/4] mesa: add aarch64 support

2013-11-05 Thread Brian Paul

On 11/05/2013 04:49 AM, Fabio Pedretti wrote:

Patch from Ubuntu package
---
  src/mesa/main/compiler.h | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 2820913..65c4141 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -312,6 +312,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
  defined(__hppa__) || defined(hpux) || \
  defined(__mips) || defined(_MIPS_ARCH) || \
  defined(__arm__) || \
+defined(__aarch64__) || \
  defined(__sh__) || defined(__m32r__) || \
  (defined(__sun) && defined(_IEEE_754)) || \
  defined(__alpha__)



I believe that's Arm64, right?  If so, it could go on the same line as 
the __arm__ check.  That would follow the pattern of preceding HP and 
MIPS checks.  But not a big deal.


Reviewed-by: Brian Paul 

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


Re: [Mesa-dev] [PATCH] mesa: Remove last BEOS checks

2013-11-05 Thread Brian Paul

On 11/04/2013 06:34 PM, Alexander von Gluck IV wrote:

* Goodbye BeOS, we hardly knew thee
* As BeOS was gcc2 only, there was little chance
   of this being useful.
* Doesn't effect Haiku in any meaningful way
---
  include/GL/gl.h  |8 
  scons/gallium.py |2 --
  2 files changed, 10 deletions(-)

diff --git a/include/GL/gl.h b/include/GL/gl.h
index d0710ba..b484b96 100644
--- a/include/GL/gl.h
+++ b/include/GL/gl.h
@@ -36,10 +36,6 @@
   * Begin system-specific stuff.
   */

-#if defined(__BEOS__)
-#include  /* to get some BeOS-isms */
-#endif
-
  #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
  #define __WIN32__
  #endif
@@ -65,10 +61,6 @@
  #  define GLAPIENTRY
  #endif /* WIN32 && !CYGWIN */

-#if (defined(__BEOS__) && defined(__POWERPC__))
-#  define PRAGMA_EXPORT_SUPPORTED  1
-#endif
-
  /*
   * WINDOWS: Include windows.h here to define APIENTRY.
   * It is also useful when applications include this file by
diff --git a/scons/gallium.py b/scons/gallium.py
index be3c3e7..ea8bacd 100755
--- a/scons/gallium.py
+++ b/scons/gallium.py
@@ -295,8 +295,6 @@ def generate(env):
  cppdefines += ['_DEBUG']
  if platform == 'windows':
  cppdefines += ['PIPE_SUBSYSTEM_WINDOWS_USER']
-if platform == 'haiku':
-cppdefines += ['BEOS_THREADS']
  if env['embedded']:
  cppdefines += ['PIPE_SUBSYSTEM_EMBEDDED']
  if env['texture_float']:



Reviewed-by: Brian Paul 

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


Re: [Mesa-dev] [PATCH 6/6] vbo: fix MSVC double->float conversion warnings

2013-11-05 Thread Jose Fonseca
Series looks good AFAICT.

Jose

- Original Message -
> ---
>  src/mesa/vbo/vbo_attrib_tmp.h |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h
> index 02c283d..bbc0205 100644
> --- a/src/mesa/vbo/vbo_attrib_tmp.h
> +++ b/src/mesa/vbo/vbo_attrib_tmp.h
> @@ -140,7 +140,7 @@ static inline float conv_i10_to_norm_float(const struct
> gl_context *ctx, int i10
> (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
>/* Equation 2.3 above. */
>float f = ((float) val.x) / 511.0F;
> -  return MAX2(f, -1.0);
> +  return MAX2(f, -1.0f);
> } else {
>/* Equation 2.2 above. */
>return (2.0F * (float)val.x + 1.0F) * (1.0F  / 1023.0F);
> @@ -156,7 +156,7 @@ static inline float conv_i2_to_norm_float(const struct
> gl_context *ctx, int i2)
> (ctx->API == API_OPENGL_CORE && ctx->Version >= 42)) {
>/* Equation 2.3 above. */
>float f = (float) val.x;
> -  return MAX2(f, -1.0);
> +  return MAX2(f, -1.0f);
> } else {
>/* Equation 2.2 above. */
>return (2.0F * (float)val.x + 1.0F) * (1.0F / 3.0F);
> --
> 1.7.10.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


[Mesa-dev] R: Re: [PATCH 1/4] r600/compute: silence unused var warning

2013-11-05 Thread Fabio Pedretti
I have no commit access, so feel free to push it.

>Reviewed-by: Marek Olšák 
>
>Marek
>
>On Tue, Nov 5, 2013 at 12:49 PM, Fabio Pedretti  wrote:
>> ---
>>  src/gallium/drivers/r600/evergreen_compute.c | 1 -
>>  1 file changed, 1 deletion(-)
>>
>> diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
b/src/gallium/drivers/r600/evergreen_compute.c
>> index ea77f5e..ffdc5c3 100644
>> --- a/src/gallium/drivers/r600/evergreen_compute.c
>> +++ b/src/gallium/drivers/r600/evergreen_compute.c
>> @@ -392,7 +392,6 @@ static void compute_emit_cs(struct r600_context *ctx, 
const uint *block_layout,
>> const uint *grid_layout)
>>  {
>> struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
>> -   unsigned flush_flags = 0;
>> int i;
>>
>> /* make sure that the gfx ring is only one active */
>> --
>> 1.8.3.2
>>
>> ___
>> 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/5] mesa: remove Alpha CPU checks

2013-11-05 Thread Aaron Watry
On Mon, Nov 4, 2013 at 7:04 PM, Matt Turner  wrote:
> On Mon, Nov 4, 2013 at 4:48 PM, Brian Paul  wrote:
>> ---
>>  src/mesa/main/compiler.h |7 +--
>>  1 file changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
>> index 61ce5db..2752ca8 100644
>> --- a/src/mesa/main/compiler.h
>> +++ b/src/mesa/main/compiler.h
>> @@ -36,11 +36,7 @@
>>
>>  #include 
>>  #include 
>> -#if defined(__alpha__) && defined(CCPML)
>> -#include  /* use Compaq's Fast Math Library on Alpha */
>> -#else
>>  #include 
>> -#endif
>>  #include 
>>  #include 
>>  #include 
>> @@ -317,8 +313,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
>>  defined(__mips) || defined(_MIPS_ARCH) || \
>>  defined(__arm__) || \
>>  defined(__sh__) || defined(__m32r__) || \
>> -(defined(__sun) && defined(_IEEE_754)) || \
>> -defined(__alpha__)
>> +(defined(__sun) && defined(_IEEE_754))
>>  #define USE_IEEE
>>  #define IEEE_ONE 0x3f80
>>  #endif
>> --
>> 1.7.10.4
>
> I actually have an Alpha with an R300. I'd like this hunk to stay.
> CPML support... feel free to drop.

Agreed.  I've got a PWS 500a that I'm in the process of getting
running again, and I'd hate to lose support for it... but it'll be
running Gentoo, so feel free to drop the CPML bits.

--Aaron


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

On Mon, Nov 4, 2013 at 7:04 PM, Matt Turner  wrote:
> On Mon, Nov 4, 2013 at 4:48 PM, Brian Paul  wrote:
>> ---
>>  src/mesa/main/compiler.h |7 +--
>>  1 file changed, 1 insertion(+), 6 deletions(-)
>>
>> diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
>> index 61ce5db..2752ca8 100644
>> --- a/src/mesa/main/compiler.h
>> +++ b/src/mesa/main/compiler.h
>> @@ -36,11 +36,7 @@
>>
>>  #include 
>>  #include 
>> -#if defined(__alpha__) && defined(CCPML)
>> -#include  /* use Compaq's Fast Math Library on Alpha */
>> -#else
>>  #include 
>> -#endif
>>  #include 
>>  #include 
>>  #include 
>> @@ -317,8 +313,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
>>  defined(__mips) || defined(_MIPS_ARCH) || \
>>  defined(__arm__) || \
>>  defined(__sh__) || defined(__m32r__) || \
>> -(defined(__sun) && defined(_IEEE_754)) || \
>> -defined(__alpha__)
>> +(defined(__sun) && defined(_IEEE_754))
>>  #define USE_IEEE
>>  #define IEEE_ONE 0x3f80
>>  #endif
>> --
>> 1.7.10.4
>
> I actually have an Alpha with an R300. I'd like this hunk to stay.
> CPML support... feel free to drop.
> ___
> 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/4] r600/compute: silence unused var warning

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

Marek

On Tue, Nov 5, 2013 at 12:49 PM, Fabio Pedretti  wrote:
> ---
>  src/gallium/drivers/r600/evergreen_compute.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
> b/src/gallium/drivers/r600/evergreen_compute.c
> index ea77f5e..ffdc5c3 100644
> --- a/src/gallium/drivers/r600/evergreen_compute.c
> +++ b/src/gallium/drivers/r600/evergreen_compute.c
> @@ -392,7 +392,6 @@ static void compute_emit_cs(struct r600_context *ctx, 
> const uint *block_layout,
> const uint *grid_layout)
>  {
> struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
> -   unsigned flush_flags = 0;
> int i;
>
> /* make sure that the gfx ring is only one active */
> --
> 1.8.3.2
>
> ___
> 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 2/4] mesa: add aarch64 support

2013-11-05 Thread Fabio Pedretti
Patch from Ubuntu package
---
 src/mesa/main/compiler.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 2820913..65c4141 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -312,6 +312,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
 defined(__hppa__) || defined(hpux) || \
 defined(__mips) || defined(_MIPS_ARCH) || \
 defined(__arm__) || \
+defined(__aarch64__) || \
 defined(__sh__) || defined(__m32r__) || \
 (defined(__sun) && defined(_IEEE_754)) || \
 defined(__alpha__)
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 1/4] r600/compute: silence unused var warning

2013-11-05 Thread Fabio Pedretti
---
 src/gallium/drivers/r600/evergreen_compute.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
b/src/gallium/drivers/r600/evergreen_compute.c
index ea77f5e..ffdc5c3 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -392,7 +392,6 @@ static void compute_emit_cs(struct r600_context *ctx, const 
uint *block_layout,
const uint *grid_layout)
 {
struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
-   unsigned flush_flags = 0;
int i;
 
/* make sure that the gfx ring is only one active */
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 4/4] mesa: fix build on kFreeBSD

2013-11-05 Thread Fabio Pedretti
Patch from Debian package
---
 src/gallium/auxiliary/rtasm/rtasm_execmem.c | 2 +-
 src/gallium/include/pipe/p_config.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c 
b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
index 3c4b048..edc1b66 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
@@ -38,7 +38,7 @@
 
 #include "rtasm_execmem.h"
 
-#if defined(PIPE_OS_BSD)
+#ifndef MAP_ANONYMOUS
 #define MAP_ANONYMOUS MAP_ANON
 #endif
 
diff --git a/src/gallium/include/pipe/p_config.h 
b/src/gallium/include/pipe/p_config.h
index 9bccf32..64acd02 100644
--- a/src/gallium/include/pipe/p_config.h
+++ b/src/gallium/include/pipe/p_config.h
@@ -190,7 +190,7 @@
 #define PIPE_OS_ANDROID
 #endif
 
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #define PIPE_OS_FREEBSD
 #define PIPE_OS_BSD
 #define PIPE_OS_UNIX
-- 
1.8.3.2

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


[Mesa-dev] [PATCH 3/4] mesa: fix build on kFreeBSD

2013-11-05 Thread Fabio Pedretti
From: Aurelien Jarno 
From: Cyril Brulebois 

mesa fails to build on GNU/kFreeBSD, since some parts are not enabled.

Debian bug: http://bugs.debian.org/524690

Patch from Debian package
---
 configure.ac | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0a25047..e250734 100644
--- a/configure.ac
+++ b/configure.ac
@@ -425,7 +425,7 @@ if test "x$enable_asm" = xyes; then
 case "$host_cpu" in
 i?86)
 case "$host_os" in
-linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
+linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
 test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
 ;;
 gnu*)
@@ -435,7 +435,7 @@ if test "x$enable_asm" = xyes; then
 ;;
 x86_64|amd64)
 case "$host_os" in
-linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*)
+linux* | *freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
 test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
 ;;
 esac
@@ -974,7 +974,7 @@ if test "x$enable_dri" = xyes; then
 ;;
 esac
 ;;
-freebsd* | dragonfly* | *netbsd* | openbsd*)
+freebsd* | dragonfly* | *netbsd* | openbsd* | kfreebsd*-gnu*)
 DEFINES="$DEFINES -DHAVE_PTHREAD -DUSE_EXTERNAL_DXTN_LIB=1"
 DEFINES="$DEFINES -DHAVE_ALIAS"
 
-- 
1.8.3.2

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